ZHANGYUXUAN-zR commited on
Commit
858809e
·
verified ·
1 Parent(s): bab7525

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. parse/test/0A5o6dCKeK/0A5o6dCKeK.md +0 -0
  2. parse/test/0A5o6dCKeK/0A5o6dCKeK_content_list.json +0 -0
  3. parse/test/0A5o6dCKeK/0A5o6dCKeK_middle.json +0 -0
  4. parse/test/0A5o6dCKeK/0A5o6dCKeK_model.json +0 -0
  5. parse/test/4nPswr1KcP/4nPswr1KcP.md +318 -0
  6. parse/test/4nPswr1KcP/4nPswr1KcP_content_list.json +737 -0
  7. parse/test/4nPswr1KcP/4nPswr1KcP_middle.json +0 -0
  8. parse/test/4nPswr1KcP/4nPswr1KcP_model.json +0 -0
  9. parse/test/5Nn2BLV7SB/5Nn2BLV7SB.md +334 -0
  10. parse/test/5Nn2BLV7SB/5Nn2BLV7SB_content_list.json +748 -0
  11. parse/test/5Nn2BLV7SB/5Nn2BLV7SB_middle.json +0 -0
  12. parse/test/5Nn2BLV7SB/5Nn2BLV7SB_model.json +0 -0
  13. parse/test/Ee277P3AYC/Ee277P3AYC.md +332 -0
  14. parse/test/Ee277P3AYC/Ee277P3AYC_content_list.json +687 -0
  15. parse/test/Ee277P3AYC/Ee277P3AYC_middle.json +0 -0
  16. parse/test/Ee277P3AYC/Ee277P3AYC_model.json +0 -0
  17. parse/test/XD0PHQ5ry4/XD0PHQ5ry4.md +396 -0
  18. parse/test/XD0PHQ5ry4/XD0PHQ5ry4_content_list.json +971 -0
  19. parse/test/XD0PHQ5ry4/XD0PHQ5ry4_middle.json +0 -0
  20. parse/test/XD0PHQ5ry4/XD0PHQ5ry4_model.json +0 -0
  21. parse/test/ZG3RaNIsO8/ZG3RaNIsO8.md +496 -0
  22. parse/test/aRtjVZvbpK/aRtjVZvbpK.md +0 -0
  23. parse/test/aRtjVZvbpK/aRtjVZvbpK_content_list.json +0 -0
  24. parse/test/aRtjVZvbpK/aRtjVZvbpK_middle.json +0 -0
  25. parse/test/aRtjVZvbpK/aRtjVZvbpK_model.json +0 -0
  26. parse/test/di52zR8xgf/di52zR8xgf.md +224 -0
  27. parse/test/di52zR8xgf/di52zR8xgf_content_list.json +468 -0
  28. parse/test/di52zR8xgf/di52zR8xgf_middle.json +0 -0
  29. parse/test/di52zR8xgf/di52zR8xgf_model.json +0 -0
  30. parse/test/lKK50q2MtV/lKK50q2MtV.md +243 -0
  31. parse/test/lKK50q2MtV/lKK50q2MtV_content_list.json +503 -0
  32. parse/test/lKK50q2MtV/lKK50q2MtV_middle.json +0 -0
  33. parse/test/lKK50q2MtV/lKK50q2MtV_model.json +0 -0
  34. parse/test/p09XyFxZkc/p09XyFxZkc.md +322 -0
  35. parse/test/p09XyFxZkc/p09XyFxZkc_content_list.json +688 -0
  36. parse/test/p09XyFxZkc/p09XyFxZkc_middle.json +0 -0
  37. parse/test/p09XyFxZkc/p09XyFxZkc_model.json +0 -0
  38. parse/test/rcFXg2aqEj/rcFXg2aqEj.md +339 -0
  39. parse/test/rcFXg2aqEj/rcFXg2aqEj_content_list.json +838 -0
  40. parse/test/rcFXg2aqEj/rcFXg2aqEj_middle.json +0 -0
  41. parse/test/rcFXg2aqEj/rcFXg2aqEj_model.json +0 -0
  42. parse/test/wLg9JrwFvL/wLg9JrwFvL.md +0 -0
  43. parse/test/wLg9JrwFvL/wLg9JrwFvL_content_list.json +0 -0
  44. parse/test/wLg9JrwFvL/wLg9JrwFvL_middle.json +0 -0
  45. parse/test/wLg9JrwFvL/wLg9JrwFvL_model.json +0 -0
  46. parse/test/y886UXPEZ0/y886UXPEZ0_middle.json +0 -0
  47. parse/test/yzkSU5zdwD/yzkSU5zdwD.md +408 -0
  48. parse/test/yzkSU5zdwD/yzkSU5zdwD_content_list.json +0 -0
  49. parse/test/yzkSU5zdwD/yzkSU5zdwD_middle.json +0 -0
  50. parse/test/yzkSU5zdwD/yzkSU5zdwD_model.json +0 -0
parse/test/0A5o6dCKeK/0A5o6dCKeK.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/0A5o6dCKeK/0A5o6dCKeK_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/0A5o6dCKeK/0A5o6dCKeK_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/0A5o6dCKeK/0A5o6dCKeK_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/4nPswr1KcP/4nPswr1KcP.md ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # How to train your ViT? Data, Augmentation, and Regularization in Vision Transformers
2
+
3
+ Andreas Steiner∗
4
+
5
+ Alexander Kolesnikov∗
6
+
7
+ Xiaohua Zhai∗
8
+
9
+ Ross Wightman†
10
+
11
+ andstein@google.com
12
+ akolesnikov@google.com xzhai@google.com
13
+ rwightman@gmail.com usz@google.com lbeyer@google.com
14
+
15
+ Jakob Uszkoreit
16
+
17
+ Lucas Beyer∗
18
+
19
+ Google Research, Brain Team, Zürich $^ *$ Equal technical contribution, $^ \dagger$ independent researcher
20
+
21
+ Reviewed on OpenReview: https: // openreview. net/ forum? id= 4nPswr1KcP
22
+
23
+ # Abstract
24
+
25
+ Vision Transformers (ViT) have been shown to attain highly competitive performance for a wide range of vision applications, such as image classification, object detection and semantic image segmentation. In comparison to convolutional neural networks, the Vision Transformer’s weaker inductive bias is generally found to cause an increased reliance on model regularization or data augmentation (“AugReg” for short) when training on smaller training datasets. We conduct a systematic empirical study in order to better understand the interplay between the amount of training data, AugReg, model size and compute budget.1 As one result of this study we find that the combination of increased compute and AugReg can yield models with the same performance as models trained on an order of magnitude more training data: we train ViT models of various sizes on the public ImageNet-21k dataset which either match or outperform their counterparts trained on the larger, but not publicly available JFT-300M dataset.
26
+
27
+ # 1 Introduction
28
+
29
+ The Vision Transformer (ViT) (13) has recently emerged as a competitive alternative to convolutional neural networks (CNNs) that are ubiquitous across the field of computer vision. Without the translational equivariance of CNNs, ViT models are generally found to perform best in settings with large amounts of training data (13) or to require strong AugReg schemes to avoid overfitting (39). However, so far there was no comprehensive study of the trade-offs between model regularization, data augmentation, training data size and compute budget in Vision Transformers.
30
+
31
+ In this work, we fill this knowledge gap by conducting a thorough empirical study. We pre-train a large collection of ViT models (different sizes and hybrids with ResNets (18)) on datasets of different sizes, while at the same time performing carefully designed comparisons across different amounts of regularization and data augmentation. We then proceed with extensive transfer learning experiments for the resulting models. We focus mainly on gaining insights useful for a practitioner with limited compute and data budgets.
32
+
33
+ ![](images/269dac993b8ef29759d8ee69ae42945f865514eb84ee4de0c73ae55b3c926bbf.jpg)
34
+ Figure 1: Adding the right amount of regularization and image augmentation can lead to similar gains as increasing the dataset size by an order of magnitude.
35
+
36
+ The homogeneity of the performed study constitutes one of the key contributions of this paper. For the vast majority of works involving Vision Transformers it is not practical to retrain all baselines and proposed methods on equal footing, in particular those trained on larger amounts of data. Furthermore, there are numerous subtle and implicit design choices that cannot be controlled for effectively, such as the precise implementation of complex augmentation schemes, hyper-parameters (e.g. learning rate schedule, weight decay), test-time preprocessing, dataset splits and so forth. Such inconsistencies can result in significant amounts of noise added to the results, quite possibly affecting the ability to draw any conclusions. Hence, all models on which this work reports have been trained and evaluated in a consistent setup.
37
+
38
+ The insights we draw from our study constitute another important contribution of this paper. In particular, we demonstrate that carefully selected regularization and augmentations roughly correspond (from the perspective of model accuracy) to a 10x increase in training data size. However, regardless of whether the models are trained with more data or better AugRegs, one has to spend roughly the same amount of compute to get models attaining similar performance. We further evaluate if there is a difference between adding data or better AugReg when fine-tuning the resulting models on datasets of various categories. Other findings, such as the overall beneficial effect of AugRegs for medium-sized datasets, simply confirm commonly held beliefs. For those findings, the value of this study lies not in novelty, but rather in confirming these assumptions and quantifying their effect in a strictly controlled setting.
39
+
40
+ In addition, we aim to shed light on other aspects of using Vision Transformers in practice such as comparing transfer learning and training from scratch for mid-sized datasets. Finally, we evaluate various compute versus performance trade-offs. We discuss all of the aforementioned insights and more in detail in Section 4.
41
+
42
+ # 2 Scope of the study
43
+
44
+ With the ubiquity of modern deep learning (25) in computer vision it has quickly become common practice to pre-train models on large datasets once and re-use their parameters as initialization or feature extraction part in models trained on a broad variety of other tasks (32; 45).
45
+
46
+ In this setup, there are multiple ways to characterize computational and sample efficiency. When simply considering the overall costs of pre-training and subsequent training or fine-tuning procedures together, the cost of pre-training usually dominates, often by orders of magnitude. From the vantage point of a researcher aiming to improve model architectures or pre-training schemes, the pre-training costs might therefore be most relevant. Most practitioners, however, rarely, if ever perform pre-training on today’s largest datasets but instead use some of the many publicly available parameter sets. For them the costs of fine-tuning, adaptation or training a task-specific model from scratch would be of most interest.
47
+
48
+ Yet another valid perspective is that all training costs are effectively negligible since they are amortized over the course of the deployment of a model in applications requiring a very large number of invocations of inference.
49
+
50
+ In this setup there are different viewpoints on computational and data efficiency aspects. One approach is to look at the overall computational and sample cost of both pre-training and fine-tuning. Normally, “pre-training cost” will dominate overall costs. This interpretation is valid in specific scenarios, especially when pre-training needs to be done repeatedly or reproduced for academic/industrial purposes. However, in the majority of cases the pre-trained model can be downloaded or, in the worst case, trained once in a while. Contrary, in these cases, the budget required for adapting this model may become the main bottleneck.
51
+
52
+ Thus, we pay extra attention to the scenario, where the cost of obtaining a pre-trained model is free or effectively amortized by future adaptation runs. Instead, we concentrate on time and compute spent on finding a good adaptation strategy (or on tuning from scratch training setup), which we call “practitioner’s cost”.
53
+
54
+ A more extreme viewpoint is that the training cost is not crucial, and all that matters is eventual inference cost of the trained model, “deployment cost”, which will amortize all other costs. This is especially true for large scale deployments, where a visual model is expected to be used a massive number of times. Overall, there are three major viewpoints on what is considered to be the central cost of training a vision model. In this study we touch on all three of them, but mostly concentrate on “practitioner” and “deployment” costs.
55
+
56
+ # 3 Experimental setup
57
+
58
+ In this section we describe our unified experimental setup, which is used throughout the paper. We use a single JAX/Flax (19; 3) codebase for pre-training and transfer learning using TPUs. Inference speed measurements, however, were obtained on V100 GPUs (16G) using the timm PyTorch library (42). All datasets are accessed through the TensorFlow Datasets library (15), which helps to ensure consistency and reproducibility. More details of our setup are provided below.
59
+
60
+ # 3.1 Datasets and metrics
61
+
62
+ For pre-training we use two large-scale image datasets: ILSVRC-2012 (ImageNet-1k) and ImageNet-21k. ImageNet-21k dataset contains approximately 14 million images with about 21 000 distinct object categories (11; 22; 30). ImageNet-1k is a subset of ImageNet-21k consisting of about 1.3 million training images and 1000 object categories. We make sure to de-duplicate images in ImageNet-21k with respect to the test sets of the downstream tasks as described in (13; 22). Additionally, we used ImageNetV2 (29) for evaluation purposes.
63
+
64
+ For transfer learning evaluation we use 4 popular computer vision datasets from the VTAB benchmark (45): CIFAR-100 (24), Oxford IIIT Pets (28) (or Pets37 for short), Resisc45 (6) and Kitti-distance (14). We selected these datasets to cover the standard setting of natural image classification (CIFAR-100 and Pets37), as well as classification of images captured by specialized equipment (Resisc45) and geometric tasks (Kitti-distance). In some cases we also use the full VTAB benchmark (19 datasets) to additionally ensure robustness of our findings.
65
+
66
+ For all datasets we report top-1 classification accuracy as our main metric. Hyper-parameters for fine-tuning are selected by the result from the validation split, and final numbers are reported from the test split. Note that for ImageNet-1k we follow common practice of reporting our main results on the validation set. Thus, we set aside 1% of the training data into a minival split that we use for model selection. Similarly, we use a minival split for CIFAR-100 ( $2 \%$ of training split) and Oxford IIIT Pets ( $1 0 \%$ of training split). For Resisc45, we use only $6 0 \%$ of the training split for training, and another 20% for validation, and 20% for computing test metrics. Kitti-distance finally comes with an official validation and test split that we use for the intended purpose. See (45) for details about the VTAB dataset splits.
67
+
68
+ Table 1: Configurations of ViT models.
69
+
70
+ <table><tr><td>Model</td><td>Layers</td><td>Width</td><td>MLP</td><td>Heads</td><td>Params</td></tr><tr><td>ViT-Ti (39)</td><td>12</td><td>192</td><td>768</td><td>3</td><td>5.8M</td></tr><tr><td>ViT-S (39)</td><td>12</td><td>384</td><td>1536</td><td>6</td><td>22.2M</td></tr><tr><td>ViT-B (13)</td><td>12</td><td>768</td><td>3072</td><td>12</td><td>86M</td></tr><tr><td>ViT-L (13)</td><td>24</td><td>1024</td><td>4096</td><td>16</td><td>307M</td></tr></table>
71
+
72
+ Table 2: ResNet $^ +$ ViT hybrid models.
73
+
74
+ <table><tr><td>Model</td><td>Resblocks</td><td>Patch-size</td><td>Params</td></tr><tr><td>R+Ti/16</td><td>□</td><td>8</td><td>6.4M</td></tr><tr><td>R26+S/32 [2, 2, 2, 2]</td><td></td><td>1</td><td>36.6M</td></tr><tr><td>R50+L/32 [3,4, 6, 3]</td><td></td><td>1</td><td>330.0M</td></tr></table>
75
+
76
+ # 3.2 Models
77
+
78
+ This study focuses mainly on the Vision Transformer (ViT) (13). We use 4 different configurations from (13; 39): ViT-Ti, ViT-S, ViT-B and ViT-L, which span a wide range of different capacities. The details of each configuration are provided in Table 1. We use patch-size 16 for all models, and additionally patch-size 32 for the ViT-S and ViT-B variants. The only difference to the original ViT model (13) in our paper is that we drop the hidden layer in the head, as empirically it does not lead to more accurate models and often results in optimization instabilities: when pre-training on ImageNet-1k we include both models with and without hidden layer, when pre-training on ImageNet-21k we always drop the hidden layer.
79
+
80
+ In addition, we train hybrid models that first process images with a ResNet (18) backbone and then feed the spatial output to a ViT as the initial patch embeddings. We use a ResNet stem block ( $7 \times 7$ convolution $^ +$ batch normalization $^ +$ ReLU $^ +$ max pooling) followed by a variable number of bottleneck blocks (18). We use the notation $\mathrm { R } n { + } \{ \mathrm { T i } , \mathrm { S } , \mathrm { L } \} / p$ where $n$ counts the number of convolutions, and $p$ denotes the patch-size in the input image - for example R+Ti/16 reduces image dimensions by a factor of two in the ResNet stem and then forms patches of size 8 as an input to the ViT, which results in an effective patch-size of 16.
81
+
82
+ # 3.3 Regularization and data augmentations
83
+
84
+ To regularize our models we use robust regularization techniques widely adopted in the computer vision community. We apply dropout to intermediate activations of ViT as in (13). Moreover, we use the stochastic depth regularization technique (20) with linearly increasing probability of dropping layers.
85
+
86
+ For data augmentation, we rely on the combination of two recent techniques, namely Mixup (47) and RandAugment (7). For Mixup, we vary its parameter $\alpha$ , where 0 corresponds to no Mixup. For RandAugment, we vary the magnitude parameter $m$ , and the number of augmentation layers $\textit { l }$ . Note that we use the original RandAugment implementation in TensorFlow, which differs from re-implementations found, for example, in timm (42).
87
+
88
+ We also try two values for weight decay (27) which we found to work well, since increasing AugReg may need a decrease in weight decay (2).
89
+
90
+ Overall, our sweep contains 28 configurations, which is a cross-product of the following hyper-parameter choices:
91
+
92
+ • Either use no dropout and no stochastic depth (e.g. no regularization) or use dropout with probability 0.1 and stochastic depth with maximal layer dropping probability of 0.1, thus 2 configuration in total.
93
+ • 7 data augmentation setups for $( l , m , \alpha )$ : none $( 0 , 0 , 0 )$ , light1 $( 2 , 0 , 0 )$ , light2 $( 2 , 1 0 , 0 . 2 )$ , medium1 (2, 15, 0.2), medium2 $( 2 , 1 5 , 0 . 5 )$ , strong1 $( 2 , 2 0 , 0 . 5 )$ , strong2 $( 2 , 2 0 , 0 . 8 )$ .
94
+ • Weight decay: 0.1 or 0.03. The weight decay is decoupled following (27), but multiplied by the learning-rate which peaks at 0.001.
95
+
96
+ # 3.4 Pre-training
97
+
98
+ We pre-trained the models with Adam (21), using $\beta _ { 1 } = 0 . 9$ and $\beta _ { 2 } = 0 . 9 9 9$ , with a batch size of 4096, and a cosine learning rate schedule with a linear warmup (10k steps). To stabilize training, gradients were clipped at global norm 1. The images are pre-processed by Inception-style cropping (36) and random horizontal
99
+
100
+ ![](images/dfddb056b457029025f0d6f072d96e7cf8c6ddf794df03cfe7c982a0bad67667.jpg)
101
+ Figure 2: Left: When training small and mid-sized datasets from scratch it is very hard to achieve a test error that can trivially be attained by fine-tuning a model pre-trained on a large dataset like ImageNet-21k. With our recommended models (Section 4.5), one can find a good solution with very few trials (bordered green dots, using recipe from B). Note that AugReg is not helpful when transferring pre-trained models (borderless green dots). Right: Same data as on the left side (ignoring the borderless green dots), but simulating the results of a random search. For a given compute budget (x-axis), choosing random configurations within that budget leads to varying final performance, depending on choice of hyper parameters (shaded area covers $9 0 \%$ from 1000 random samples, line corresponds to median).
102
+
103
+ flipping. On the smaller ImageNet-1k dataset we trained for 300 epochs, and for 30 and 300 epochs on the ImageNet-21k dataset. Since ImageNet-21k is about 10x larger than ImageNet-1k, this allows us to examine the effects of the increased dataset size also with a roughly constant total compute used for pre-training.
104
+
105
+ # 3.5 Fine-tuning
106
+
107
+ We fine-tune with SGD with a momentum of 0.9 (storing internal state as bfloat16), sweeping over 2-3 learning rates and 1-2 training durations per dataset as detailed in Table 4 in the appendix. We used a fixed batch size of 512, gradient clipping at global norm 1 and a cosine decay learning rate schedule with linear warmup. Fine-tuning was done both at the original resolution (224), as well as at a higher resolution (384) as described in (40).
108
+
109
+ # 4 Findings
110
+
111
+ # 4.1 Scaling datasets with AugReg and compute
112
+
113
+ One major finding of our study, which is depicted in Figure 1, is that by judicious use of image augmentations and model regularization, one can (pre-)train a model to similar accuracy as by increasing the dataset size by about an order of magnitude. More precisely, our best models trained on AugReg ImageNet-1k (31) perform about equal to the same models pre-trained on the 10x larger plain ImageNet-21k (11) dataset. Similarly, our best models trained on AugReg ImageNet-21k, when compute is also increased (e.g. training run longer), match or outperform those from (13) which were trained on the plain JFT-300M (35) dataset with 25x more images. Thus, it is possible to match these private results with a publicly available dataset, and it is imaginable that training longer and with AugReg on JFT-300M might further increase performance.
114
+
115
+ Of course, these results cannot hold for arbitrarily small datasets. For instance, according to Table 5 of (44), training a ResNet50 on only $1 0 \%$ of ImageNet-1k with heavy data augmentation improves results, but does not recover training on the full dataset.
116
+
117
+ # 4.2 Transfer is the better option
118
+
119
+ Here, we investigate whether, for reasonably-sized datasets a practitioner might encounter, it is advisable to try training from scratch with AugReg, or whether time and money is better spent transferring pre-trained models that are freely available. The result is that, for most practical purposes, transferring a pre-trained model is both more cost-efficient and leads to better results.
120
+
121
+ ![](images/900fb945ee0e6f4221cd4044fc4fe6f4c2ee1a6827e6d2425fe0295d9d278dca.jpg)
122
+ Figure 3: Pretraining on more data yields more transferable models on average, tested on the VTAB suite (45) of 19 tasks across 3 categories.
123
+
124
+ We perform a thorough search for a good training recipe2 for both the small ViT-B/32 and the larger ViT-B/16 models on two datasets of practical size: Pet37 contains only about 3000 training images and is relatively similar to the ImageNet-1k dataset. Resisc45 contains about 30 000 training images and consists of a very different modality of satellite images, which is not well covered by either ImageNet-1k or ImageNet-21k. Figure 2 shows the result of this search.
125
+
126
+ The most striking finding is that, no matter how much training time is spent, for the tiny Pet37 dataset, it does not seem possible to train ViT models from scratch to reach accuracy anywhere near that of transferred models. Furthermore, since pre-trained models are freely available for download, the pre-training cost for a practitioner is effectively zero, only the compute spent on transfer matters, and thus transferring a pre-trained model is simultaneously significantly cheaper and gives better results.
127
+
128
+ For the larger Resisc45 dataset, this result still holds, although spending two orders of magnitude more compute and performing a heavy search may come close (but not reach) to the accuracy of pre-trained models.
129
+
130
+ Notably, this does not account for the “exploration cost”, which is difficult to quantify. For the pre-trained models, we highlight those which performed best on the pre-training validation set and could be called recommended models (see Section 4.5). We can see that using a recommended model has a high likelihood of leading to good results in just a few attempts, while this is not the case for training from-scratch, as evidenced by the wide vertical spread of points.
131
+
132
+ # 4.3 More data yields more generic models
133
+
134
+ We investigate the impact of pre-training dataset size by transferring pre-trained models to unseen downstream tasks. We evaluate the pre-trained models on VTAB, including 19 diverse tasks (45).
135
+
136
+ Figure 3 shows the results on three VTAB categories: natural, specialized and structured. The models are sorted by the inference time per step, thus the larger model the slower inference speed. We first compare two models using the same compute budget, with the only difference being the dataset size of ImageNet-1k (1.3M images) and ImageNet-21k (13M images). We pre-train for 300 epochs on ImageNet-1k, and 30 epochs on ImageNet-21k. Interestingly, the model pre-trained on ImageNet-21k is significantly better than the ImageNet-1k one, across all the three VTAB categories. This is in contrast with the validation performance on ImageNet-1k (Figure 6), where this difference does not appear so clearly.
137
+
138
+ As the compute budget keeps growing, we observe consistent improvements on ImageNet-21k dataset with 10x longer schedule. On a few almost solved tasks, e.g. flowers, the gain is small in absolute numbers. For
139
+
140
+ ![](images/648ea7ae3d8e322a7b527d10a88789b4f61b62a27132dd933f787cf40717be21.jpg)
141
+ Figure 4: Validation accuracy (for ImageNet-1k: minival accuracy) when using various amounts of augmentation and regularization, highlighting differences to the unregularized, unaugmented setting. For relatively small amount of data, almost everything helps. However, when switching to ImageNet-21k while keeping the training budget fixed, almost everything hurts; only when also increasing compute, does AugReg help again. The single column right of each plot show the difference between the best setting with regularization and the best setting without, highlighting that regularization typically hurts on ImageNet-21k.
142
+
143
+ the rest of the tasks, the improvements are significant compared to the model pre-trained for a short schedule.
144
+ All the detailed results on VTAB could be found from supplementary section C. Overall, we conclude that more data yields more generic models, the trend holds across very diverse tasks.
145
+ We recommend the design choice of using more data with a fixed compute budget.
146
+
147
+ # 4.4 Prefer augmentation to regularization
148
+
149
+ It is not clear a priori what the trade-offs are between data augmentation such as RandAugment and Mixup, and model regularization such as Dropout and StochasticDepth. In this section, we aim to discover general patterns for these that can be used as rules of thumb when applying Vision Transformers to a new task. In Figure 4, we show the upstream validation score obtained for each individual setting, i.e. numbers are not comparable when changing dataset. The colour of a cell encodes its improvement or deterioration in score when compared to the unregularized, unaugmented setting, i.e. the leftmost column. Augmentation strength increases from left to right, and model “capacity” increases from top to bottom.
150
+
151
+ The first observation that becomes visible, is that for the mid-sized ImageNet-1k dataset, any kind of AugReg helps. However, when using the 10x larger ImageNet-21k dataset and keeping compute fixed, i.e. running for 30 epochs, any kind of AugReg hurts performance for all but the largest models. It is only when also increasing the computation budget to 300 epochs that AugReg helps more models, although even then, it continues hurting the smaller ones. Generally speaking, there are significantly more cases where adding augmentation helps, than where adding regularization helps. More specifically, the thin columns right of each map in Figure 4 shows, for any given model, its best regularized score minus its best unregularized score. This view, which is expanded in Figure 7 in the Appendix, tells us that when using ImageNet-21k, regularization almost always hurts.
152
+
153
+ # 4.5 Choosing which pre-trained model to transfer
154
+
155
+ As we show above, when pre-training ViT models, various regularization and data augmentation settings result in models with drastically different performance. Then, from the practitioner’s point of view, a natural question emerges: how to select a model for further adaption for an end application? One way is to run downstream adaptation for all available pre-trained models and then select the best performing model, based on the validation score on the downstream task of interest. This could be quite expensive in practice. Alternatively, one can select a single pre-trained model based on the upstream validation accuracy and then only use this model for adaptation, which is much cheaper.
156
+
157
+ ![](images/500a89efed4b731180506a06c4b64ebb7216abad911279dcbc9573a6ca57b11d.jpg)
158
+ Figure 5: Choosing best models. Left: Difference of fine-tuning test scores between models chosen by best validation score on pre-training data vs. validation score on fine-tuning data (negative values mean that selecting models by pre-training validation deteriorates fine-tuning test metrics). Right: Correlation between “minival” validation score vs. ImageNetV2 validation score and official ImageNet-1k validation score (that serves as a test score in this study). Red circles highlight the best models by validation score, see Section 4.5 for an explanation.
159
+
160
+ In this section we analyze the trade-off between these two strategies. We compare them for a large collection of our pre-trained models on 5 different datasets. Specifically, in Figure 5 (left) we highlight the performance difference between the cheaper strategy of adapting only the best pre-trained model and the more expensive strategy of adapting all pre-trained models (and then selecting the best).
161
+
162
+ The results are mixed, but generally reflect that the cheaper strategy works equally well as the more expensive strategy in the majority of scenarios. Nevertheless, there are a few notable outliers, when it is beneficial to adapt all models. Thus, we conclude that selecting a single pre-trained model based on the upstream score is a cost-effective practical strategy and also use it throughout our paper. However, we also stress that if extra compute resources are available, then in certain cases one can further improve adaptation performance by fine-tuning additional pre-trained models.
163
+
164
+ A note on validation data for the ImageNet-1k dataset. While performing the above analysis, we observed a subtle, but severe issue with models pre-trained on ImageNet-21k and transferred to ImageNet-1k dataset. The validation score for these models (especially for large models) is not well correlated with observed test performance, see Figure 5 (right). This is due to the fact that ImageNet-21k data contains ImageNet-1k training data and we use a “minival” split from the training data for evaluation (see Section 3.1). As a result, large models on long training schedules memorize the data from the training set, which biases the evaluation metric computed in the “minival” evaluation set. To address this issue and enable fair hyper-parameter selection, we instead use the independently collected ImageNetV2 data (29) as the validation split for transferring to ImageNet-1k. As shown in Figure 5 (right), this resolves the issue. We did not observe similar issues for the other datasets. We recommend that researchers transferring ImageNet-21k models to ImageNet-1k follow this strategy.
165
+
166
+ # 4.6 Prefer increasing patch-size to shrinking model-size
167
+
168
+ One unexpected outcome of our study is that we trained several models that are roughly equal in terms of inference throughput, but vary widely in terms of their quality. Specifically, Figure 6 (right) shows that models containing the “Tiny” variants perform significantly worse than the similarly fast larger models with “/32” patch-size. For a given resolution, the patch-size influences the amount of tokens on which self-attention is performed and, thus, is a contributor to model capacity which is not reflected by parameter count. Parameter count is reflective neither of speed, nor of capacity (10).
169
+
170
+ ![](images/7fc08dff69d0914711069589acfce45e0cd480216ad383e39848883fa03b0b5f.jpg)
171
+ Figure 6: ImageNet transfer. Left: For every architecture and upstream dataset, we selected the best model by upstream validation accuracy. Main ViT-S,B,L models are connected with a solid line to highlight the trend, with the exception of ViT-L models pre-trained on i1k, where the trend breaks down. The same data is also shown in Table 3. Right: Focusing on small models, it is evident that using a larger patch-size (/32) significantly outperforms making the model thinner (Ti).
172
+
173
+ Table 3: ImageNet-1k transfer. Column i1k $\mathbf { u p }$ evaluates best checkpoint without adaptation, columns i1k300, i21k30 and i21k300 (ImageNet-1k 300 epochs and ImageNet-21k 30 and 300 epochs) report numbers after fine-tuning, which are shown in Figure 6, the “recommended checkpoints” (see Section 4.5) were fine-tuned with two different learning rates (see Section B). For the column i21k $\mathbf { v } 2$ (ImageNet-21k, 300 epochs), the upstream checkpoint was instead chosen by ImageNetV2 validation accuracy. The JFT-300M numbers are taken from (13) (bold numbers indicate our results that are on par or surpass the published JFT-300M results without AugReg for the same models). Inference speed measurements were computed on an NVIDIA V100 GPU using timm (42), sweeping the batch size for best throughput.
174
+
175
+ <table><tr><td rowspan="2">Model</td><td colspan="5">224px resolution</td><td colspan="6">384px resolution</td></tr><tr><td>img/sec</td><td>i1kup</td><td>i1k300</td><td>i21k30</td><td>i21k300</td><td>img/sec</td><td>i1k300</td><td>i21k30</td><td>i21k300</td><td>i21kv2</td><td>JFT300M</td></tr><tr><td>L/16</td><td>228</td><td>75.72</td><td>74.01</td><td>82.05</td><td>83.98</td><td>50</td><td>77.21</td><td>84.48</td><td>85.59</td><td>87.08</td><td>87.12</td></tr><tr><td>B/16</td><td>659</td><td>79.84</td><td>78.73</td><td>80.42</td><td>83.96</td><td>138</td><td>81.63</td><td>83.46</td><td>85.49</td><td>86.15</td><td>84.15</td></tr><tr><td>S/16</td><td>1508</td><td>79.00</td><td>77.51</td><td>76.04</td><td>80.46</td><td>300</td><td>80.70</td><td>80.22</td><td>83.73</td><td>83.15</td><td>1</td></tr><tr><td>R50+L/32</td><td>1047</td><td>76.84</td><td>74.17</td><td>80.26</td><td>82.74</td><td>327</td><td>76.71</td><td>83.19</td><td>85.99</td><td>86.21</td><td>1</td></tr><tr><td>R26+S/32</td><td>1814</td><td>79.61</td><td>78.20</td><td>77.42</td><td>80.81</td><td>560</td><td>81.55</td><td>81.11</td><td>83.85</td><td>83.80</td><td>1</td></tr><tr><td>Ti/16</td><td>3097</td><td>72.59</td><td>69.56</td><td>68.89</td><td>73.75</td><td>610</td><td>74.64</td><td>74.20</td><td>78.22</td><td>77.83</td><td></td></tr><tr><td>B/32</td><td>3597</td><td>74.42</td><td>71.38</td><td>72.24</td><td>79.13</td><td>955</td><td>76.60</td><td>78.65</td><td>83.59</td><td>83.59</td><td>80.73</td></tr><tr><td>S/32</td><td>8342</td><td>72.07</td><td>69.19</td><td>68.49</td><td>73.47</td><td>2154</td><td>75.65</td><td>75.74</td><td>79.58</td><td>80.01</td><td>1</td></tr><tr><td>R+Ti/16</td><td>9371</td><td>70.13</td><td>67.30</td><td>65.65</td><td>69.69</td><td>2426</td><td>73.48</td><td>71.97</td><td>75.40</td><td>75.33</td><td></td></tr></table>
176
+
177
+ # 5 Related work
178
+
179
+ The scope of this paper is limited to studying pre-training and transfer learning of Vision Transformer models and there already are a number of studies considering similar questions for convolutional neural networks (23; 22). Here we hence focus on related work involving ViT models.
180
+
181
+ As first proposed in (13), ViT achieved competitive performance only when trained on comparatively large amounts of training data, with state-of-the-art transfer results using the ImageNet-21k and JFT-300M datasets, with roughly 13M and 300M images, respectively. In stark contrast, (39) focused on tackling overfitting of ViT when training from scratch on ImageNet-1k by designing strong regularization and augmentation schemes. Yet neither work analyzed the effects of stronger augmentation of regularization and augmentation in the presence of larger amounts of training data.
182
+
183
+ Ever since (22) first showed good results when pre-training BiT on ImageNet-21k, more architecture works have mentioned using it for select few experiments (13; 38; 37; 8), with (30) arguing more directly for the use of ImageNet-21k. However, none of these works thoroughly investigates the combined use of AugReg and ImageNet-21k and provides conclusions, as we do here.
184
+
185
+ An orthogonal line of work introduces cleverly designed inductive biases in ViT variants or retain some of the general architectural parameters of successful convolutional architectures while adding self-attention to them. (33) carefully combines a standard convolutional backbone with bottleneck blocks based on self-attention instead of convolutions. In (26; 17; 41; 43) the authors propose hierarchical versions of ViT. (9) suggests a very elegant idea of initializing Vision Transformer, such that it behaves similarly to convolutional neural network in the beginning of training.
186
+
187
+ Yet another way to address overfitting and improve transfer performance is to rely on self-supervised learning objectives. (1) pre-trains ViT to reconstruct perturbed image patches. Alternatively, (4) devises a selfsupervised training procedure based on the idea from (16), achieving impressive results. We leave the systematic comparison of self-supervised and supervised pre-training to future work.
188
+
189
+ # 6 Discussion
190
+
191
+ Societal Impact. Our experimental study is relatively thorough and used a lot of compute. This could be taken as encouraging anyone who uses ViTs to perform such large studies. On the contrary, our aim is to provide good starting points and off-the-shelf checkpoints that remove the need for such extensive search in future work.
192
+
193
+ Limitations. In order to be thorough, we restrict the study to the default ViT architecture and neither include ResNets, which have been well studied over the course of the past years, nor more recent ViT variants. We anticipate though that many of our findings extend to other ViT-based architectures as well.
194
+
195
+ # 7 Summary of recommendations
196
+
197
+ Below we summarize three main recommendations based on our study:
198
+
199
+ • We recommend to use checkpoints that were pre-trained on more upstream data, and not relying only on ImageNet-1k as a proxy for model quality, since ImageNet-1k validation accuracy is inflated when pre-training on ImageNet-1k, and more varied upstream data yields more widely applicable models (Figure 3 and Section 4.3).
200
+ • Judiciously applying data augmentation and model regularization makes it possible to train much better models on a dataset of a given size (Figure 1), and these improvements can be observed both with medium sized datasets like ImageNet-1k, and even with large datasets like ImageNet-21k. But there are no simple rules which AugReg settings to select. The best settings vary a lot depending on model capacity and training schedule, and one needs to be careful not to apply AugReg to a model that is too small, or when pre-training for too short – otherwise the model quality may deteriorate (see Figure 4 for an exhaustive quantitative evaluation and Section 4.4 for further comments on regularization vs augmentations). How to select the best upstream model for transfer on your own task? Aside from always using ImageNet-21k checkpoints, we recommend to select the model with the best upstream validation performance (Section 4.5, table with paths in our Github repository $\cdot$ ). As we show in Figure 5, this choice is generally optimal for a wide range of tasks. If the user has additional computational resources available to fine-tune all checkpoints, they may get slightly better results in some scenarios, but also need to be careful with respect to ImageNet-1k and ImageNet-21k data overlap when it comes to model selection (Figure 5, right).
201
+
202
+ # 8 Conclusion
203
+
204
+ We conduct the first systematic, large scale study of the interplay between regularization, data augmentation, model size, and training data size when pre-training Vision Transformers, including their respective effects on the compute budget needed to achieve a certain level of performance. We also evaluate pre-trained models through the lens of transfer learning. As a result, we characterize a quite complex landscape of training settings for pre-training Vision Transformers across different model sizes. Our experiments yield a number of surprising insights around the impact of various techniques and the situations when augmentation and regularization are beneficial and when not.
205
+
206
+ We also perform an in-depth analysis of the transfer learning setting for Vision Transformers. We conclude that across a wide range of datasets, even if the downstream data of interest appears to only be weakly related to the data used for pre-training, transfer learning remains the best available option. Our analysis also suggests that among similarly performing pre-trained models, for transfer learning a model with more training data should likely be preferred over one with more data augmentation.
207
+
208
+ We hope that our study will help guide future research on Vision Transformers and will be a useful source of effective training settings for practitioners seeking to optimize their final model performance in the light of a given computational budget.
209
+
210
+ Acknowledgements We thank Alexey Dosovitskiy, Neil Houlsby, and Ting Chen for insightful feedback;
211
+ the Google Brain team at large for providing a supportive research environment.
212
+
213
+ # References
214
+
215
+ [1] Sara Atito, Muhammad Awais, and Josef Kittler. Sit: Self-supervised vision transformer. arXiv:2104.03602, 2021. 10
216
+ [2] Irwan Bello, William Fedus, Xianzhi Du, Ekin D. Cubuk, Aravind Srinivas, Tsung-Yi Lin, Jonathon Shlens, and Barret Zoph. Revisiting resnets: Improved training and scaling strategies. arXiv:2103.07579, 2021. 4
217
+ [3] James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: composable transformations of Python+NumPy programs, 2018. 3
218
+ [4] Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerging properties in self-supervised vision transformers. arXiv:2104.14294, 2021. 10
219
+ [5] Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual 12M: Pushing web-scale image-text pre-training to recognize long-tail visual concepts. 2021. 16
220
+ [6] Gong Cheng, Junwei Han, and Xiaoqiang Lu. Remote sensing image scene classification: Benchmark and state of the art. Proceedings of the IEEE, 105(10):1865–1883, 2017. 3
221
+ [7] Ekin D. Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V. Le. RandAugment: Practical automated data augmentation with a reduced search space. In CVPR Workshops, 2020. 4
222
+ [8] Zihang Dai, Hanxiao Liu, Quoc V. Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes, 2021. 10
223
+ [9] Stéphane d’Ascoli, Hugo Touvron, Matthew Leavitt, Ari Morcos, Giulio Biroli, and Levent Sagun. Convit: Improving vision transformers with soft convolutional inductive biases. arXiv:2103.10697, 2021. 10
224
+ [10] Mostafa Dehghani, Anurag Arnab, Lucas Beyer, Ashish Vaswani, and Yi Tay. The efficiency misnomer. CoRR, abs/2110.12894, 2021. 10
225
+ [11] J. Deng, W. Dong, R. Socher, L. Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009. 3, 5
226
+ [12] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT, 2019. 16
227
+ [13] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv:2010.11929, 2020. 1, 3, 4, 5, 9, 10
228
+ [14] A Geiger, P Lenz, C Stiller, and R Urtasun. Vision meets robotics: The kitti dataset. The International Journal of Robotics Research, 32(11):1231–1237, 2013. 3
229
+ [15] Google. TensorFlow Datasets, a collection of ready-to-use datasets. https://www.tensorflow.org/datasets. 3
230
+ [16] Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv:2006.07733, 2020. 10
231
+ [17] Kai Han, An Xiao, Enhua Wu, Jianyuan Guo, Chunjing Xu, and Yunhe Wang. Transformer in transformer. arXiv:2103.00112, 2021. 10
232
+ [18] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. 1, 4
233
+ [19] Jonathan Heek, Anselm Levskaya, Avital Oliver, Marvin Ritter, Bertrand Rondepierre, Andreas Steiner, and Marc van Zee. Flax: A neural network library and ecosystem for JAX, 2020. 3
234
+ [20] Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In ECCV, 2016. 4
235
+ [21] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015. 4
236
+ [22] Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (BiT): General visual representation learning. In ECCV, 2020. 3, 10
237
+ [23] Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better imagenet models transfer better? In CVPR, 2019. 10
238
+ [24] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. 3
239
+ [25] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. Imagenet classification with deep convolutional neural networks. In Peter L. Bartlett, Fernando C. N. Pereira, Christopher J. C. Burges, Léon Bottou, and Kilian Q. Weinberger, editors, Advances in Neural Information Processing Systems 25: 26th Annual Conference on Neural Information Processing Systems 2012. Proceedings of a meeting held December 3-6, 2012, Lake Tahoe, Nevada, United States, pages 1106–1114, 2012. 2
240
+ [26] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv:2103.14030, 2021. 10
241
+ [27] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2019. 4, 14
242
+ [28] Omkar M. Parkhi, Andrea Vedaldi, Andrew Zisserman, and C. V. Jawahar. Cats and dogs. In CVPR, 2012. 3
243
+ [29] Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? In ICML, 2019. 3, 8
244
+ [30] Tal Ridnik, Emanuel Ben-Baruch, Asaf Noy, and Lihi Zelnik-Manor. Imagenet-21k pretraining for the masses. arXiv:2104.10972, 2021. 3, 10
245
+ [31] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. IIJCV, 2015. 5
246
+ [32] Ali Sharif Razavian, Hossein Azizpour, Josephine Sullivan, and Stefan Carlsson. Cnn features off-the-shelf: An astounding baseline for recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, June 2014. 2
247
+ [33] Aravind Srinivas, Tsung-Yi Lin, Niki Parmar, Jonathon Shlens, Pieter Abbeel, and Ashish Vaswani. Bottleneck transformers for visual recognition. arXiv:2101.11605, 2021. 10
248
+ [34] Robin Strudel, Ricardo Garcia, Ivan Laptev, and Cordelia Schmid. Segmenter: Transformer for semantic segmentation. arXiv:2105.05633, 2021. 16
249
+ [35] Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In Proceedings of the IEEE international conference on computer vision, pages 843–852, 2017. 5
250
+ [36] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In CVPR, 2015. 4
251
+ [37] Mingxing Tan and Quoc V. Le. Efficientnetv2: Smaller models and faster training. CoRR, abs/2104.00298, 2021. 10
252
+ [38] Ilya O. Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Andreas Steiner, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, and Alexey Dosovitskiy. Mlp-mixer: An all-mlp architecture for vision. CoRR, abs/2105.01601, 2021. 10
253
+ [39] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv:2012.12877, 2020. 1, 4, 10
254
+ [40] Hugo Touvron, Andrea Vedaldi, Matthijs Douze, and Herve Jegou. Fixing the train-test resolution discrepancy. In NeurIPS, 2019. 5
255
+ [41] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv:2102.12122, 2021. 10
256
+ [42] Ross Wightman. Pytorch image models (timm): Vit training details. https://github.com/rwightman/ pytorch-image-models/issues/252#issuecomment-713838112, 2013. 3, 4, 9
257
+ [43] Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, and Lei Zhang. Cvt: Introducing convolutions to vision transformers. arXiv:2103.15808, 2021. 10
258
+ [44] Qizhe Xie, Zihang Dai, Eduard Hovy, Thang Luong, and Quoc Le. Unsupervised data augmentation for consistency training. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, 2020. 5
259
+ [45] Xiaohua Zhai, Joan Puigcerver, Alexander Kolesnikov, Pierre Ruyssen, Carlos Riquelme, Mario Lucic, Josip Djolonga, Andre Susano Pinto, Maxim Neumann, Alexey Dosovitskiy, Lucas Beyer, Olivier Bachem, Michael Tschannen, Marcin Michalski, Olivier Bousquet, Sylvain Gelly, and Neil Houlsby. A large-scale study of representation learning with the visual task adaptation benchmark, 2020. 2, 3, 6, 15
260
+ [46] Xiaohua Zhai, Xiao Wang, Basil Mustafa, Andreas Steiner, Daniel Keysers, Alexander Kolesnikov, and Lucas Beyer. Lit: Zero-shot transfer with locked-image text tuning. CVPR, 2022. 16
261
+ [47] Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In ICLR, 2018. 4
262
+
263
+ # A From-scratch training details
264
+
265
+ We present from-scratch training details for B/32 and B/16 models, on both Resisc45 and Pets37 datasets. We perform a grid search over the following parameters:
266
+
267
+ • B/32 on Pets37
268
+
269
+ – Epochs: {1k, 3k, 10k, 30k, 300k} – Learning rates: {1e−4, 3e−4, 1e−3, 3e−3} – Weight decays4: {1e−5, 3e−5, 1e−4, 3e−4}
270
+
271
+ • B/16 on Pets37
272
+
273
+ – Epochs: {1k, 3k, 10k} – Learning rates: {3e−4, 1e−3} – Weight decays: {3e−5, 1e−4}
274
+
275
+ • B/32 on Resisc45
276
+
277
+ – Epochs: {75, 250, 750, 2.5k, 7.5k, 25k} – Learning rates: {1e−4, 3e−4, 1e−3, 3e−3} – Weight decays: {1e−5, 3e−5, 1e−4, 3e−4}
278
+
279
+ • B/16 on Resisc45
280
+
281
+ – Epochs: {75, 250, 750, 2.5k, 7.5k} – Learning rates: {1e−3} – Weight decays: {1e−4, 3e−4}
282
+
283
+ All these from-scratch runs sweep over dropout rate and stochastic depth in range $\{ ( 0 . 0 , 0 . 0 ) , ( 0 . 1 , 0 . 1 ) , ( 0 . 2 , 0 . 2 ) \}$ , and data augmentation $( l , m , \alpha )$ in range $\{ \ ( 0 , 0 , 0 )$ , $( 2 , 1 0 , 0 . 2 )$ , (2, 15, 0.2), $( 2 , 1 5 , 0 . 5 )$ , $( 2 , 2 0 , 0 . 5 )$ , $( 2 , 2 0 , 0 . 8 )$ , (4, 15, 0.5), $( 4 , 2 0 , 0 . 8 ) \ \}$ .
284
+
285
+ For the definition of $( l , m , \alpha )$ refer to Section 3.3
286
+
287
+ # B Finetune details
288
+
289
+ In Table 4, we show the hyperparameter sweep range for finetune jobs. We use the same finetune sweep for all the pre-trained models in this paper.
290
+
291
+ Table 4: Finetune details for the pre-trained models.
292
+
293
+ <table><tr><td>Dataset</td><td>Learning rate</td><td>Total, warmup steps</td></tr><tr><td>ImageNet-1k</td><td>{0.01,0.03}</td><td>{(20k,500)}</td></tr><tr><td>Pets37</td><td>{1e-3,3e-3,0.01}</td><td>{(500,100),(2.5k,200)}</td></tr><tr><td>Kitti-distance</td><td>{1e-3,3e-3,0.01}</td><td>{(500,100),(2.5k,200)}</td></tr><tr><td>CIFAR-100</td><td>{1e-3,3e-3,0.01}</td><td>{(2.5k,200),(10k,500)}</td></tr><tr><td>Resisc45</td><td>{1e-3,3e-3,0.01}</td><td>{(2.5k,200),(10k,500)}</td></tr></table>
294
+
295
+ Table 5: Detailed VTAB results, including the “Mean” accuracy shown in Figure 3. We show datasets under natural, specialized, structured groups, following (45).
296
+
297
+ <table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td>std</td><td>268umso NHAS·</td><td></td><td></td><td></td><td>Leso.</td><td></td><td></td><td>ueeg</td><td></td><td></td><td>oT-Idsp·</td><td>[o-dsp·</td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="8"></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>85.2 98.6955790.6 89.7</td><td></td><td></td><td></td><td></td><td>96.1 8.4 67.499.9869</td><td>81.9</td><td>25.9</td><td></td><td>46.374.2</td></tr><tr><td></td><td>91.681.9 60794091.270695.68.2</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>B/32</td><td>92.687.6</td><td></td><td>72.7</td><td>94.4</td><td>92.2 73.8</td><td>95.887.0</td><td></td><td></td><td>82.7 98.6</td><td></td><td>94.9</td><td>79.8 89.0</td><td></td><td>94.089.6</td><td>66.1</td><td></td><td>99.8 84.7</td><td>80.3</td><td>24.7</td><td></td><td>62.475.2</td></tr><tr><td>Ti/16</td><td>92.784.0</td><td></td><td>68.9</td><td>93.8</td><td>92.5</td><td>72.0</td><td>96.1</td><td>85.7</td><td>83.7</td><td>98.7</td><td>95.6</td><td>81.6</td><td>89.9</td><td>98.0 91.9</td><td>68.5</td><td></td><td>99.783.2</td><td>82.0</td><td>26.5</td><td>65.9</td><td>77.0</td></tr><tr><td>R26+S/32 90.2</td><td></td><td>86.2</td><td></td><td>74.095.5</td><td>94.3</td><td>74.5</td><td>95.687.2</td><td></td><td>84.5</td><td>98.6</td><td>96.0</td><td>83.4</td><td>90.6</td><td>99.7 91.673.3100</td><td></td><td></td><td>84.8</td><td>84.5</td><td>28.2</td><td></td><td>51.376.7</td></tr><tr><td>S/16</td><td>93.1</td><td>86.9</td><td></td><td>72.895.7</td><td>93.8</td><td>74.3</td><td>96.2</td><td>87.5</td><td>84.1</td><td>98.7</td><td>95.9</td><td>82.7</td><td>90.3</td><td>98.7 91.5</td><td>69.8</td><td>100</td><td>84.3</td><td></td><td>79.627.3</td><td>58.0</td><td>76.1</td></tr><tr><td>R50+L/32 90.7</td><td></td><td>88.1</td><td>73.7</td><td>95.4</td><td>93.5</td><td>75.695.9</td><td></td><td>87.6</td><td>85.8</td><td>98.4</td><td>95.4</td><td>83.1 90.7</td><td></td><td>99.890.4</td><td>71.1</td><td>100</td><td></td><td>87.582.4</td><td>23.5</td><td>53.0</td><td>76.0</td></tr><tr><td>B/16</td><td>93.087.8</td><td></td><td>72.4</td><td>96.0</td><td>94.5</td><td>75.396.1</td><td>87.9</td><td></td><td>85.1 98.9</td><td></td><td></td><td>95.782.590.5</td><td></td><td>98.1 91.8</td><td>69.5</td><td></td><td>99.9 84.584.0</td><td></td><td>25.9</td><td></td><td>53.976.0</td></tr><tr><td>L/16</td><td></td><td>91.086.2</td><td></td><td></td><td>69.591.493.0</td><td>75.394.985.9</td><td></td><td></td><td>81.0</td><td>98.7</td><td></td><td>93.881.6</td><td>88.8</td><td>94.3 88.363.9</td><td></td><td></td><td>98.585.1</td><td></td><td>81.3</td><td>25.3</td><td>51.273.5</td></tr><tr><td rowspan="8"></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>80.2 244</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>92.4 8.7 72. 98.7 905</td><td>72.4 95.1 85.6</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>83.69879509.789595.7 99.2</td><td></td><td></td><td></td><td>66.6 99.8 87.9</td><td></td><td></td><td>47.0 75.9</td></tr><tr><td>B/32</td><td>93.690.5</td><td></td><td>74.599.1</td><td>91.9</td><td>77.895.789.0</td><td></td><td></td><td>83.5</td><td>98.895.1</td><td></td><td>78.8</td><td>89.1</td><td>93.690.1</td><td></td><td>62.9</td><td>99.8 89.0</td><td></td><td>78.324.1</td><td></td><td>55.974.2</td></tr><tr><td>Ti/16</td><td>93.385.5</td><td></td><td>72.699.0</td><td>90.0</td><td>74.395.1</td><td></td><td>87.1</td><td></td><td>85.598.8</td><td>95.5</td><td>81.6</td><td>90.4</td><td>97.791.7</td><td></td><td></td><td></td><td>67.499.9 83.881.2</td><td>26.3</td><td>55.1</td><td>75.4</td></tr><tr><td>R26+S/32 94.7</td><td></td><td>89.9 76.5</td><td></td><td>99.5 93.0</td><td>79.1</td><td>95.989.8</td><td></td><td>86.3</td><td>98.6</td><td>96.1</td><td>83.1</td><td>91.0</td><td>99.7 92.0</td><td>73.4</td><td></td><td>100 88.7</td><td>84.8</td><td>26.2</td><td>53.3</td><td>77.3</td></tr><tr><td>S/16</td><td>94.3 89.4</td><td></td><td>76.2</td><td>99.3 92.3</td><td>78.1</td><td>95.7</td><td>89.3</td><td>84.5</td><td>98.8</td><td>96.3</td><td>81.7</td><td>90.3</td><td>98.491.5</td><td></td><td>68.3100</td><td>86.5</td><td>82.8</td><td>25.9</td><td></td><td>52.775.8</td></tr><tr><td>R50+L/32 95.4</td><td>92.0</td><td>79.1</td><td>99.6</td><td>94.3</td><td>81.7</td><td>96.0</td><td>91.1</td><td>85.9</td><td>98.7</td><td>95.9</td><td>82.9</td><td>90.9</td><td>99.9 90.9</td><td>72.9</td><td></td><td>100 86.3</td><td>82.6</td><td>25.4</td><td>57.4</td><td>76.9</td></tr><tr><td>B/16</td><td>95.1 91.6</td><td>77.9</td><td></td><td>99.6 94.2</td><td>80.9</td><td>96.390.8</td><td></td><td>84.8</td><td>99.0</td><td>96.1</td><td>82.4</td><td>90.6</td><td>98.9 90.9</td><td></td><td>72.1</td><td>100</td><td>88.383.5</td><td>26.6</td><td>69.6</td><td>78.7</td></tr><tr><td rowspan="8">L/16</td><td></td><td>95.7 93.4</td><td>79.5</td><td></td><td>99.694.6</td><td>82.3</td><td>96.7</td><td>91.7</td><td></td><td>88.498.9</td><td>96.5</td><td>81.8</td><td>91.4</td><td>99.391.8</td><td>72.1</td><td></td><td>100 88.5</td><td>83.7</td><td>25.0</td><td>62.9</td><td>77.9</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>67.4</td><td>100 97.4</td><td></td><td>78.2 24.5</td><td></td><td>5.273.</td></tr><tr><td></td><td>93.2 85.7</td><td></td><td></td><td>71.599.290.3</td><td>747</td><td>95.2</td><td>87.0</td><td></td><td>85.298.395.4</td><td></td><td>81.6</td><td>9.0</td><td>95.5 90.5</td></table>
298
+
299
+ # C VTAB results
300
+
301
+ In Table 5, we show all the results in percentage for all the models on the full VTAB. We report VTAB score only for the best pre-trained models, selected by their upstream validation accuracy (“recommended checkpoints”, see Section 4.5). For VTAB tasks, we sweep over 8 hyper parameters, include four learning rates $\left. 0 . 0 0 1 , 0 . 0 0 3 , 0 . 0 1 , 0 . 0 3 \right.$ and two schedules $\{ 5 0 0 , 2 5 0 0 \}$ steps. The best run was selected on VTAB validation split.
302
+
303
+ ![](images/2ddc9898e2ad450a1c7486404303fbfa22483c7ff3f2c9a22501af1a4969832b.jpg)
304
+ Figure 7: The improvement or deterioration in validation accuracy when using or not using regularization (e.g. dropout and stochastic depth) – positive values when regularization improves accuracy for a given model/augmentation. For absolute values see Figure 4.
305
+
306
+ # D The benefit and harm of regularization
307
+
308
+ In Figure 7, we show the gain (green, positive numbers) or loss (red, negative numbers) in accuracy when adding regularization to the model by means of dropout and stochastic depth. We did verify in earlier experiments that combining both with (peak) drop probability 0.1 is indeed the best setting. What this shows, is that model regularization mainly helps larger models, and only when trained for long. Specifically, for ImageNet-21 pre-training, it hurts all but the largest of models across the board.
309
+
310
+ # E Using recommended checkpoints for other computer vision tasks
311
+
312
+ One limitation of our study is that it focuses mainly on the classification task. However, computer vision is a much broader field, and backbones need to excel at many tasks. While expanding the full study to many more tasks such as detection, segmentation, tracking, and others would be prohibitive, here we take a peek at one further task: multi-modal image-text retrieval.
313
+
314
+ A detailed analysis of this question is beyond the scope of this study, but we evaluated our recommended (see Section 4.5) B/32 checkpoint pre-trained on ImageNet-21k in a contrastive training setup with a locked image tower (46). We initialize the text tower with a BERT-Base (12) checkpoint and train for 20 epochs on CC12M (5). The results in Table 6 indicate that the upstream validation accuracy is a good predictor for zero-shot classification. Moreover, the representations produced by such a model yield similarly better results for image-text retrieval, when compared to models that do not have the ideal amount of AugReg applied. We hope the community will adopt our backbones for other tasks, as already done by (34).
315
+
316
+ Table 6: Comparing our recommended (see Section 4.5) B/32 checkpoint with models that apply too little or too much AugReg. The final validation accuracy from the ImageNet-21k pre-training is the same that is reported in Figure 4. The other columns are ImageNet-1K zero-shot accuracy, and image-text retrieval accuracy on different datasets, after contrastively training as described in (46).
317
+
318
+ <table><tr><td>AugReg</td><td>I21k Val</td><td>I1k Oshot</td><td>Coco I2T</td><td>Coco T2I</td><td>Flickr I2T</td><td>Flickr T2I</td></tr><tr><td>none/0.0</td><td>41.6</td><td>54.9</td><td>33.4</td><td>20.1</td><td>58.1</td><td>39.9</td></tr><tr><td>heavy2/0.1</td><td>43.5</td><td>57.3</td><td>39.1</td><td>24.4</td><td>62.1</td><td>44.6</td></tr><tr><td>Recommended</td><td>47.7</td><td>60.6</td><td>41.1</td><td>25.5</td><td>65.9</td><td>46.9</td></tr></table>
parse/test/4nPswr1KcP/4nPswr1KcP_content_list.json ADDED
@@ -0,0 +1,737 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "How to train your ViT? Data, Augmentation, and Regularization in Vision Transformers ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Andreas Steiner∗ ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "Alexander Kolesnikov∗ ",
16
+ "page_idx": 0
17
+ },
18
+ {
19
+ "type": "text",
20
+ "text": "Xiaohua Zhai∗ ",
21
+ "page_idx": 0
22
+ },
23
+ {
24
+ "type": "text",
25
+ "text": "Ross Wightman† ",
26
+ "page_idx": 0
27
+ },
28
+ {
29
+ "type": "text",
30
+ "text": "andstein@google.com \nakolesnikov@google.com xzhai@google.com \nrwightman@gmail.com usz@google.com lbeyer@google.com ",
31
+ "page_idx": 0
32
+ },
33
+ {
34
+ "type": "text",
35
+ "text": "Jakob Uszkoreit ",
36
+ "page_idx": 0
37
+ },
38
+ {
39
+ "type": "text",
40
+ "text": "Lucas Beyer∗ ",
41
+ "page_idx": 0
42
+ },
43
+ {
44
+ "type": "text",
45
+ "text": "Google Research, Brain Team, Zürich $^ *$ Equal technical contribution, $^ \\dagger$ independent researcher ",
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "Reviewed on OpenReview: https: // openreview. net/ forum? id= 4nPswr1KcP ",
51
+ "page_idx": 0
52
+ },
53
+ {
54
+ "type": "text",
55
+ "text": "Abstract ",
56
+ "text_level": 1,
57
+ "page_idx": 0
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "Vision Transformers (ViT) have been shown to attain highly competitive performance for a wide range of vision applications, such as image classification, object detection and semantic image segmentation. In comparison to convolutional neural networks, the Vision Transformer’s weaker inductive bias is generally found to cause an increased reliance on model regularization or data augmentation (“AugReg” for short) when training on smaller training datasets. We conduct a systematic empirical study in order to better understand the interplay between the amount of training data, AugReg, model size and compute budget.1 As one result of this study we find that the combination of increased compute and AugReg can yield models with the same performance as models trained on an order of magnitude more training data: we train ViT models of various sizes on the public ImageNet-21k dataset which either match or outperform their counterparts trained on the larger, but not publicly available JFT-300M dataset. ",
62
+ "page_idx": 0
63
+ },
64
+ {
65
+ "type": "text",
66
+ "text": "1 Introduction ",
67
+ "text_level": 1,
68
+ "page_idx": 0
69
+ },
70
+ {
71
+ "type": "text",
72
+ "text": "The Vision Transformer (ViT) (13) has recently emerged as a competitive alternative to convolutional neural networks (CNNs) that are ubiquitous across the field of computer vision. Without the translational equivariance of CNNs, ViT models are generally found to perform best in settings with large amounts of training data (13) or to require strong AugReg schemes to avoid overfitting (39). However, so far there was no comprehensive study of the trade-offs between model regularization, data augmentation, training data size and compute budget in Vision Transformers. ",
73
+ "page_idx": 0
74
+ },
75
+ {
76
+ "type": "text",
77
+ "text": "In this work, we fill this knowledge gap by conducting a thorough empirical study. We pre-train a large collection of ViT models (different sizes and hybrids with ResNets (18)) on datasets of different sizes, while at the same time performing carefully designed comparisons across different amounts of regularization and data augmentation. We then proceed with extensive transfer learning experiments for the resulting models. We focus mainly on gaining insights useful for a practitioner with limited compute and data budgets. ",
78
+ "page_idx": 0
79
+ },
80
+ {
81
+ "type": "image",
82
+ "img_path": "images/269dac993b8ef29759d8ee69ae42945f865514eb84ee4de0c73ae55b3c926bbf.jpg",
83
+ "image_caption": [
84
+ "Figure 1: Adding the right amount of regularization and image augmentation can lead to similar gains as increasing the dataset size by an order of magnitude. "
85
+ ],
86
+ "image_footnote": [],
87
+ "page_idx": 1
88
+ },
89
+ {
90
+ "type": "text",
91
+ "text": "",
92
+ "page_idx": 1
93
+ },
94
+ {
95
+ "type": "text",
96
+ "text": "The homogeneity of the performed study constitutes one of the key contributions of this paper. For the vast majority of works involving Vision Transformers it is not practical to retrain all baselines and proposed methods on equal footing, in particular those trained on larger amounts of data. Furthermore, there are numerous subtle and implicit design choices that cannot be controlled for effectively, such as the precise implementation of complex augmentation schemes, hyper-parameters (e.g. learning rate schedule, weight decay), test-time preprocessing, dataset splits and so forth. Such inconsistencies can result in significant amounts of noise added to the results, quite possibly affecting the ability to draw any conclusions. Hence, all models on which this work reports have been trained and evaluated in a consistent setup. ",
97
+ "page_idx": 1
98
+ },
99
+ {
100
+ "type": "text",
101
+ "text": "The insights we draw from our study constitute another important contribution of this paper. In particular, we demonstrate that carefully selected regularization and augmentations roughly correspond (from the perspective of model accuracy) to a 10x increase in training data size. However, regardless of whether the models are trained with more data or better AugRegs, one has to spend roughly the same amount of compute to get models attaining similar performance. We further evaluate if there is a difference between adding data or better AugReg when fine-tuning the resulting models on datasets of various categories. Other findings, such as the overall beneficial effect of AugRegs for medium-sized datasets, simply confirm commonly held beliefs. For those findings, the value of this study lies not in novelty, but rather in confirming these assumptions and quantifying their effect in a strictly controlled setting. ",
102
+ "page_idx": 1
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "In addition, we aim to shed light on other aspects of using Vision Transformers in practice such as comparing transfer learning and training from scratch for mid-sized datasets. Finally, we evaluate various compute versus performance trade-offs. We discuss all of the aforementioned insights and more in detail in Section 4. ",
107
+ "page_idx": 1
108
+ },
109
+ {
110
+ "type": "text",
111
+ "text": "2 Scope of the study ",
112
+ "text_level": 1,
113
+ "page_idx": 1
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "With the ubiquity of modern deep learning (25) in computer vision it has quickly become common practice to pre-train models on large datasets once and re-use their parameters as initialization or feature extraction part in models trained on a broad variety of other tasks (32; 45). ",
118
+ "page_idx": 1
119
+ },
120
+ {
121
+ "type": "text",
122
+ "text": "In this setup, there are multiple ways to characterize computational and sample efficiency. When simply considering the overall costs of pre-training and subsequent training or fine-tuning procedures together, the cost of pre-training usually dominates, often by orders of magnitude. From the vantage point of a researcher aiming to improve model architectures or pre-training schemes, the pre-training costs might therefore be most relevant. Most practitioners, however, rarely, if ever perform pre-training on today’s largest datasets but instead use some of the many publicly available parameter sets. For them the costs of fine-tuning, adaptation or training a task-specific model from scratch would be of most interest. ",
123
+ "page_idx": 1
124
+ },
125
+ {
126
+ "type": "text",
127
+ "text": "",
128
+ "page_idx": 2
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "Yet another valid perspective is that all training costs are effectively negligible since they are amortized over the course of the deployment of a model in applications requiring a very large number of invocations of inference. ",
133
+ "page_idx": 2
134
+ },
135
+ {
136
+ "type": "text",
137
+ "text": "In this setup there are different viewpoints on computational and data efficiency aspects. One approach is to look at the overall computational and sample cost of both pre-training and fine-tuning. Normally, “pre-training cost” will dominate overall costs. This interpretation is valid in specific scenarios, especially when pre-training needs to be done repeatedly or reproduced for academic/industrial purposes. However, in the majority of cases the pre-trained model can be downloaded or, in the worst case, trained once in a while. Contrary, in these cases, the budget required for adapting this model may become the main bottleneck. ",
138
+ "page_idx": 2
139
+ },
140
+ {
141
+ "type": "text",
142
+ "text": "Thus, we pay extra attention to the scenario, where the cost of obtaining a pre-trained model is free or effectively amortized by future adaptation runs. Instead, we concentrate on time and compute spent on finding a good adaptation strategy (or on tuning from scratch training setup), which we call “practitioner’s cost”. ",
143
+ "page_idx": 2
144
+ },
145
+ {
146
+ "type": "text",
147
+ "text": "A more extreme viewpoint is that the training cost is not crucial, and all that matters is eventual inference cost of the trained model, “deployment cost”, which will amortize all other costs. This is especially true for large scale deployments, where a visual model is expected to be used a massive number of times. Overall, there are three major viewpoints on what is considered to be the central cost of training a vision model. In this study we touch on all three of them, but mostly concentrate on “practitioner” and “deployment” costs. ",
148
+ "page_idx": 2
149
+ },
150
+ {
151
+ "type": "text",
152
+ "text": "3 Experimental setup ",
153
+ "text_level": 1,
154
+ "page_idx": 2
155
+ },
156
+ {
157
+ "type": "text",
158
+ "text": "In this section we describe our unified experimental setup, which is used throughout the paper. We use a single JAX/Flax (19; 3) codebase for pre-training and transfer learning using TPUs. Inference speed measurements, however, were obtained on V100 GPUs (16G) using the timm PyTorch library (42). All datasets are accessed through the TensorFlow Datasets library (15), which helps to ensure consistency and reproducibility. More details of our setup are provided below. ",
159
+ "page_idx": 2
160
+ },
161
+ {
162
+ "type": "text",
163
+ "text": "3.1 Datasets and metrics ",
164
+ "text_level": 1,
165
+ "page_idx": 2
166
+ },
167
+ {
168
+ "type": "text",
169
+ "text": "For pre-training we use two large-scale image datasets: ILSVRC-2012 (ImageNet-1k) and ImageNet-21k. ImageNet-21k dataset contains approximately 14 million images with about 21 000 distinct object categories (11; 22; 30). ImageNet-1k is a subset of ImageNet-21k consisting of about 1.3 million training images and 1000 object categories. We make sure to de-duplicate images in ImageNet-21k with respect to the test sets of the downstream tasks as described in (13; 22). Additionally, we used ImageNetV2 (29) for evaluation purposes. ",
170
+ "page_idx": 2
171
+ },
172
+ {
173
+ "type": "text",
174
+ "text": "For transfer learning evaluation we use 4 popular computer vision datasets from the VTAB benchmark (45): CIFAR-100 (24), Oxford IIIT Pets (28) (or Pets37 for short), Resisc45 (6) and Kitti-distance (14). We selected these datasets to cover the standard setting of natural image classification (CIFAR-100 and Pets37), as well as classification of images captured by specialized equipment (Resisc45) and geometric tasks (Kitti-distance). In some cases we also use the full VTAB benchmark (19 datasets) to additionally ensure robustness of our findings. ",
175
+ "page_idx": 2
176
+ },
177
+ {
178
+ "type": "text",
179
+ "text": "For all datasets we report top-1 classification accuracy as our main metric. Hyper-parameters for fine-tuning are selected by the result from the validation split, and final numbers are reported from the test split. Note that for ImageNet-1k we follow common practice of reporting our main results on the validation set. Thus, we set aside 1% of the training data into a minival split that we use for model selection. Similarly, we use a minival split for CIFAR-100 ( $2 \\%$ of training split) and Oxford IIIT Pets ( $1 0 \\%$ of training split). For Resisc45, we use only $6 0 \\%$ of the training split for training, and another 20% for validation, and 20% for computing test metrics. Kitti-distance finally comes with an official validation and test split that we use for the intended purpose. See (45) for details about the VTAB dataset splits. ",
180
+ "page_idx": 2
181
+ },
182
+ {
183
+ "type": "table",
184
+ "img_path": "images/c64132a6d633931e0f42862c8f633b1387a2de62c819bc3fc0af4cba0117f4bb.jpg",
185
+ "table_caption": [
186
+ "Table 1: Configurations of ViT models. "
187
+ ],
188
+ "table_footnote": [],
189
+ "table_body": "<table><tr><td>Model</td><td>Layers</td><td>Width</td><td>MLP</td><td>Heads</td><td>Params</td></tr><tr><td>ViT-Ti (39)</td><td>12</td><td>192</td><td>768</td><td>3</td><td>5.8M</td></tr><tr><td>ViT-S (39)</td><td>12</td><td>384</td><td>1536</td><td>6</td><td>22.2M</td></tr><tr><td>ViT-B (13)</td><td>12</td><td>768</td><td>3072</td><td>12</td><td>86M</td></tr><tr><td>ViT-L (13)</td><td>24</td><td>1024</td><td>4096</td><td>16</td><td>307M</td></tr></table>",
190
+ "page_idx": 3
191
+ },
192
+ {
193
+ "type": "table",
194
+ "img_path": "images/f194ee25d54367338bfc36c281c7decf0ed57766b1a5b0dc3742988e820d8bf0.jpg",
195
+ "table_caption": [
196
+ "Table 2: ResNet $^ +$ ViT hybrid models. "
197
+ ],
198
+ "table_footnote": [],
199
+ "table_body": "<table><tr><td>Model</td><td>Resblocks</td><td>Patch-size</td><td>Params</td></tr><tr><td>R+Ti/16</td><td>□</td><td>8</td><td>6.4M</td></tr><tr><td>R26+S/32 [2, 2, 2, 2]</td><td></td><td>1</td><td>36.6M</td></tr><tr><td>R50+L/32 [3,4, 6, 3]</td><td></td><td>1</td><td>330.0M</td></tr></table>",
200
+ "page_idx": 3
201
+ },
202
+ {
203
+ "type": "text",
204
+ "text": "3.2 Models ",
205
+ "text_level": 1,
206
+ "page_idx": 3
207
+ },
208
+ {
209
+ "type": "text",
210
+ "text": "This study focuses mainly on the Vision Transformer (ViT) (13). We use 4 different configurations from (13; 39): ViT-Ti, ViT-S, ViT-B and ViT-L, which span a wide range of different capacities. The details of each configuration are provided in Table 1. We use patch-size 16 for all models, and additionally patch-size 32 for the ViT-S and ViT-B variants. The only difference to the original ViT model (13) in our paper is that we drop the hidden layer in the head, as empirically it does not lead to more accurate models and often results in optimization instabilities: when pre-training on ImageNet-1k we include both models with and without hidden layer, when pre-training on ImageNet-21k we always drop the hidden layer. ",
211
+ "page_idx": 3
212
+ },
213
+ {
214
+ "type": "text",
215
+ "text": "In addition, we train hybrid models that first process images with a ResNet (18) backbone and then feed the spatial output to a ViT as the initial patch embeddings. We use a ResNet stem block ( $7 \\times 7$ convolution $^ +$ batch normalization $^ +$ ReLU $^ +$ max pooling) followed by a variable number of bottleneck blocks (18). We use the notation $\\mathrm { R } n { + } \\{ \\mathrm { T i } , \\mathrm { S } , \\mathrm { L } \\} / p$ where $n$ counts the number of convolutions, and $p$ denotes the patch-size in the input image - for example R+Ti/16 reduces image dimensions by a factor of two in the ResNet stem and then forms patches of size 8 as an input to the ViT, which results in an effective patch-size of 16. ",
216
+ "page_idx": 3
217
+ },
218
+ {
219
+ "type": "text",
220
+ "text": "3.3 Regularization and data augmentations ",
221
+ "text_level": 1,
222
+ "page_idx": 3
223
+ },
224
+ {
225
+ "type": "text",
226
+ "text": "To regularize our models we use robust regularization techniques widely adopted in the computer vision community. We apply dropout to intermediate activations of ViT as in (13). Moreover, we use the stochastic depth regularization technique (20) with linearly increasing probability of dropping layers. ",
227
+ "page_idx": 3
228
+ },
229
+ {
230
+ "type": "text",
231
+ "text": "For data augmentation, we rely on the combination of two recent techniques, namely Mixup (47) and RandAugment (7). For Mixup, we vary its parameter $\\alpha$ , where 0 corresponds to no Mixup. For RandAugment, we vary the magnitude parameter $m$ , and the number of augmentation layers $\\textit { l }$ . Note that we use the original RandAugment implementation in TensorFlow, which differs from re-implementations found, for example, in timm (42). ",
232
+ "page_idx": 3
233
+ },
234
+ {
235
+ "type": "text",
236
+ "text": "We also try two values for weight decay (27) which we found to work well, since increasing AugReg may need a decrease in weight decay (2). ",
237
+ "page_idx": 3
238
+ },
239
+ {
240
+ "type": "text",
241
+ "text": "Overall, our sweep contains 28 configurations, which is a cross-product of the following hyper-parameter choices: ",
242
+ "page_idx": 3
243
+ },
244
+ {
245
+ "type": "text",
246
+ "text": "• Either use no dropout and no stochastic depth (e.g. no regularization) or use dropout with probability 0.1 and stochastic depth with maximal layer dropping probability of 0.1, thus 2 configuration in total. \n• 7 data augmentation setups for $( l , m , \\alpha )$ : none $( 0 , 0 , 0 )$ , light1 $( 2 , 0 , 0 )$ , light2 $( 2 , 1 0 , 0 . 2 )$ , medium1 (2, 15, 0.2), medium2 $( 2 , 1 5 , 0 . 5 )$ , strong1 $( 2 , 2 0 , 0 . 5 )$ , strong2 $( 2 , 2 0 , 0 . 8 )$ . \n• Weight decay: 0.1 or 0.03. The weight decay is decoupled following (27), but multiplied by the learning-rate which peaks at 0.001. ",
247
+ "page_idx": 3
248
+ },
249
+ {
250
+ "type": "text",
251
+ "text": "3.4 Pre-training ",
252
+ "text_level": 1,
253
+ "page_idx": 3
254
+ },
255
+ {
256
+ "type": "text",
257
+ "text": "We pre-trained the models with Adam (21), using $\\beta _ { 1 } = 0 . 9$ and $\\beta _ { 2 } = 0 . 9 9 9$ , with a batch size of 4096, and a cosine learning rate schedule with a linear warmup (10k steps). To stabilize training, gradients were clipped at global norm 1. The images are pre-processed by Inception-style cropping (36) and random horizontal ",
258
+ "page_idx": 3
259
+ },
260
+ {
261
+ "type": "image",
262
+ "img_path": "images/dfddb056b457029025f0d6f072d96e7cf8c6ddf794df03cfe7c982a0bad67667.jpg",
263
+ "image_caption": [
264
+ "Figure 2: Left: When training small and mid-sized datasets from scratch it is very hard to achieve a test error that can trivially be attained by fine-tuning a model pre-trained on a large dataset like ImageNet-21k. With our recommended models (Section 4.5), one can find a good solution with very few trials (bordered green dots, using recipe from B). Note that AugReg is not helpful when transferring pre-trained models (borderless green dots). Right: Same data as on the left side (ignoring the borderless green dots), but simulating the results of a random search. For a given compute budget (x-axis), choosing random configurations within that budget leads to varying final performance, depending on choice of hyper parameters (shaded area covers $9 0 \\%$ from 1000 random samples, line corresponds to median). "
265
+ ],
266
+ "image_footnote": [],
267
+ "page_idx": 4
268
+ },
269
+ {
270
+ "type": "text",
271
+ "text": "flipping. On the smaller ImageNet-1k dataset we trained for 300 epochs, and for 30 and 300 epochs on the ImageNet-21k dataset. Since ImageNet-21k is about 10x larger than ImageNet-1k, this allows us to examine the effects of the increased dataset size also with a roughly constant total compute used for pre-training. ",
272
+ "page_idx": 4
273
+ },
274
+ {
275
+ "type": "text",
276
+ "text": "3.5 Fine-tuning ",
277
+ "text_level": 1,
278
+ "page_idx": 4
279
+ },
280
+ {
281
+ "type": "text",
282
+ "text": "We fine-tune with SGD with a momentum of 0.9 (storing internal state as bfloat16), sweeping over 2-3 learning rates and 1-2 training durations per dataset as detailed in Table 4 in the appendix. We used a fixed batch size of 512, gradient clipping at global norm 1 and a cosine decay learning rate schedule with linear warmup. Fine-tuning was done both at the original resolution (224), as well as at a higher resolution (384) as described in (40). ",
283
+ "page_idx": 4
284
+ },
285
+ {
286
+ "type": "text",
287
+ "text": "4 Findings ",
288
+ "text_level": 1,
289
+ "page_idx": 4
290
+ },
291
+ {
292
+ "type": "text",
293
+ "text": "4.1 Scaling datasets with AugReg and compute ",
294
+ "text_level": 1,
295
+ "page_idx": 4
296
+ },
297
+ {
298
+ "type": "text",
299
+ "text": "One major finding of our study, which is depicted in Figure 1, is that by judicious use of image augmentations and model regularization, one can (pre-)train a model to similar accuracy as by increasing the dataset size by about an order of magnitude. More precisely, our best models trained on AugReg ImageNet-1k (31) perform about equal to the same models pre-trained on the 10x larger plain ImageNet-21k (11) dataset. Similarly, our best models trained on AugReg ImageNet-21k, when compute is also increased (e.g. training run longer), match or outperform those from (13) which were trained on the plain JFT-300M (35) dataset with 25x more images. Thus, it is possible to match these private results with a publicly available dataset, and it is imaginable that training longer and with AugReg on JFT-300M might further increase performance. ",
300
+ "page_idx": 4
301
+ },
302
+ {
303
+ "type": "text",
304
+ "text": "Of course, these results cannot hold for arbitrarily small datasets. For instance, according to Table 5 of (44), training a ResNet50 on only $1 0 \\%$ of ImageNet-1k with heavy data augmentation improves results, but does not recover training on the full dataset. ",
305
+ "page_idx": 4
306
+ },
307
+ {
308
+ "type": "text",
309
+ "text": "4.2 Transfer is the better option ",
310
+ "text_level": 1,
311
+ "page_idx": 4
312
+ },
313
+ {
314
+ "type": "text",
315
+ "text": "Here, we investigate whether, for reasonably-sized datasets a practitioner might encounter, it is advisable to try training from scratch with AugReg, or whether time and money is better spent transferring pre-trained models that are freely available. The result is that, for most practical purposes, transferring a pre-trained model is both more cost-efficient and leads to better results. ",
316
+ "page_idx": 4
317
+ },
318
+ {
319
+ "type": "image",
320
+ "img_path": "images/900fb945ee0e6f4221cd4044fc4fe6f4c2ee1a6827e6d2425fe0295d9d278dca.jpg",
321
+ "image_caption": [
322
+ "Figure 3: Pretraining on more data yields more transferable models on average, tested on the VTAB suite (45) of 19 tasks across 3 categories. "
323
+ ],
324
+ "image_footnote": [],
325
+ "page_idx": 5
326
+ },
327
+ {
328
+ "type": "text",
329
+ "text": "",
330
+ "page_idx": 5
331
+ },
332
+ {
333
+ "type": "text",
334
+ "text": "We perform a thorough search for a good training recipe2 for both the small ViT-B/32 and the larger ViT-B/16 models on two datasets of practical size: Pet37 contains only about 3000 training images and is relatively similar to the ImageNet-1k dataset. Resisc45 contains about 30 000 training images and consists of a very different modality of satellite images, which is not well covered by either ImageNet-1k or ImageNet-21k. Figure 2 shows the result of this search. ",
335
+ "page_idx": 5
336
+ },
337
+ {
338
+ "type": "text",
339
+ "text": "The most striking finding is that, no matter how much training time is spent, for the tiny Pet37 dataset, it does not seem possible to train ViT models from scratch to reach accuracy anywhere near that of transferred models. Furthermore, since pre-trained models are freely available for download, the pre-training cost for a practitioner is effectively zero, only the compute spent on transfer matters, and thus transferring a pre-trained model is simultaneously significantly cheaper and gives better results. ",
340
+ "page_idx": 5
341
+ },
342
+ {
343
+ "type": "text",
344
+ "text": "For the larger Resisc45 dataset, this result still holds, although spending two orders of magnitude more compute and performing a heavy search may come close (but not reach) to the accuracy of pre-trained models. ",
345
+ "page_idx": 5
346
+ },
347
+ {
348
+ "type": "text",
349
+ "text": "Notably, this does not account for the “exploration cost”, which is difficult to quantify. For the pre-trained models, we highlight those which performed best on the pre-training validation set and could be called recommended models (see Section 4.5). We can see that using a recommended model has a high likelihood of leading to good results in just a few attempts, while this is not the case for training from-scratch, as evidenced by the wide vertical spread of points. ",
350
+ "page_idx": 5
351
+ },
352
+ {
353
+ "type": "text",
354
+ "text": "4.3 More data yields more generic models ",
355
+ "text_level": 1,
356
+ "page_idx": 5
357
+ },
358
+ {
359
+ "type": "text",
360
+ "text": "We investigate the impact of pre-training dataset size by transferring pre-trained models to unseen downstream tasks. We evaluate the pre-trained models on VTAB, including 19 diverse tasks (45). ",
361
+ "page_idx": 5
362
+ },
363
+ {
364
+ "type": "text",
365
+ "text": "Figure 3 shows the results on three VTAB categories: natural, specialized and structured. The models are sorted by the inference time per step, thus the larger model the slower inference speed. We first compare two models using the same compute budget, with the only difference being the dataset size of ImageNet-1k (1.3M images) and ImageNet-21k (13M images). We pre-train for 300 epochs on ImageNet-1k, and 30 epochs on ImageNet-21k. Interestingly, the model pre-trained on ImageNet-21k is significantly better than the ImageNet-1k one, across all the three VTAB categories. This is in contrast with the validation performance on ImageNet-1k (Figure 6), where this difference does not appear so clearly. ",
366
+ "page_idx": 5
367
+ },
368
+ {
369
+ "type": "text",
370
+ "text": "As the compute budget keeps growing, we observe consistent improvements on ImageNet-21k dataset with 10x longer schedule. On a few almost solved tasks, e.g. flowers, the gain is small in absolute numbers. For ",
371
+ "page_idx": 5
372
+ },
373
+ {
374
+ "type": "image",
375
+ "img_path": "images/648ea7ae3d8e322a7b527d10a88789b4f61b62a27132dd933f787cf40717be21.jpg",
376
+ "image_caption": [
377
+ "Figure 4: Validation accuracy (for ImageNet-1k: minival accuracy) when using various amounts of augmentation and regularization, highlighting differences to the unregularized, unaugmented setting. For relatively small amount of data, almost everything helps. However, when switching to ImageNet-21k while keeping the training budget fixed, almost everything hurts; only when also increasing compute, does AugReg help again. The single column right of each plot show the difference between the best setting with regularization and the best setting without, highlighting that regularization typically hurts on ImageNet-21k. "
378
+ ],
379
+ "image_footnote": [],
380
+ "page_idx": 6
381
+ },
382
+ {
383
+ "type": "text",
384
+ "text": "the rest of the tasks, the improvements are significant compared to the model pre-trained for a short schedule. \nAll the detailed results on VTAB could be found from supplementary section C. Overall, we conclude that more data yields more generic models, the trend holds across very diverse tasks. \nWe recommend the design choice of using more data with a fixed compute budget. ",
385
+ "page_idx": 6
386
+ },
387
+ {
388
+ "type": "text",
389
+ "text": "",
390
+ "page_idx": 6
391
+ },
392
+ {
393
+ "type": "text",
394
+ "text": "4.4 Prefer augmentation to regularization ",
395
+ "text_level": 1,
396
+ "page_idx": 6
397
+ },
398
+ {
399
+ "type": "text",
400
+ "text": "It is not clear a priori what the trade-offs are between data augmentation such as RandAugment and Mixup, and model regularization such as Dropout and StochasticDepth. In this section, we aim to discover general patterns for these that can be used as rules of thumb when applying Vision Transformers to a new task. In Figure 4, we show the upstream validation score obtained for each individual setting, i.e. numbers are not comparable when changing dataset. The colour of a cell encodes its improvement or deterioration in score when compared to the unregularized, unaugmented setting, i.e. the leftmost column. Augmentation strength increases from left to right, and model “capacity” increases from top to bottom. ",
401
+ "page_idx": 6
402
+ },
403
+ {
404
+ "type": "text",
405
+ "text": "The first observation that becomes visible, is that for the mid-sized ImageNet-1k dataset, any kind of AugReg helps. However, when using the 10x larger ImageNet-21k dataset and keeping compute fixed, i.e. running for 30 epochs, any kind of AugReg hurts performance for all but the largest models. It is only when also increasing the computation budget to 300 epochs that AugReg helps more models, although even then, it continues hurting the smaller ones. Generally speaking, there are significantly more cases where adding augmentation helps, than where adding regularization helps. More specifically, the thin columns right of each map in Figure 4 shows, for any given model, its best regularized score minus its best unregularized score. This view, which is expanded in Figure 7 in the Appendix, tells us that when using ImageNet-21k, regularization almost always hurts. ",
406
+ "page_idx": 6
407
+ },
408
+ {
409
+ "type": "text",
410
+ "text": "4.5 Choosing which pre-trained model to transfer ",
411
+ "text_level": 1,
412
+ "page_idx": 6
413
+ },
414
+ {
415
+ "type": "text",
416
+ "text": "As we show above, when pre-training ViT models, various regularization and data augmentation settings result in models with drastically different performance. Then, from the practitioner’s point of view, a natural question emerges: how to select a model for further adaption for an end application? One way is to run downstream adaptation for all available pre-trained models and then select the best performing model, based on the validation score on the downstream task of interest. This could be quite expensive in practice. Alternatively, one can select a single pre-trained model based on the upstream validation accuracy and then only use this model for adaptation, which is much cheaper. ",
417
+ "page_idx": 6
418
+ },
419
+ {
420
+ "type": "image",
421
+ "img_path": "images/500a89efed4b731180506a06c4b64ebb7216abad911279dcbc9573a6ca57b11d.jpg",
422
+ "image_caption": [
423
+ "Figure 5: Choosing best models. Left: Difference of fine-tuning test scores between models chosen by best validation score on pre-training data vs. validation score on fine-tuning data (negative values mean that selecting models by pre-training validation deteriorates fine-tuning test metrics). Right: Correlation between “minival” validation score vs. ImageNetV2 validation score and official ImageNet-1k validation score (that serves as a test score in this study). Red circles highlight the best models by validation score, see Section 4.5 for an explanation. "
424
+ ],
425
+ "image_footnote": [],
426
+ "page_idx": 7
427
+ },
428
+ {
429
+ "type": "text",
430
+ "text": "In this section we analyze the trade-off between these two strategies. We compare them for a large collection of our pre-trained models on 5 different datasets. Specifically, in Figure 5 (left) we highlight the performance difference between the cheaper strategy of adapting only the best pre-trained model and the more expensive strategy of adapting all pre-trained models (and then selecting the best). ",
431
+ "page_idx": 7
432
+ },
433
+ {
434
+ "type": "text",
435
+ "text": "The results are mixed, but generally reflect that the cheaper strategy works equally well as the more expensive strategy in the majority of scenarios. Nevertheless, there are a few notable outliers, when it is beneficial to adapt all models. Thus, we conclude that selecting a single pre-trained model based on the upstream score is a cost-effective practical strategy and also use it throughout our paper. However, we also stress that if extra compute resources are available, then in certain cases one can further improve adaptation performance by fine-tuning additional pre-trained models. ",
436
+ "page_idx": 7
437
+ },
438
+ {
439
+ "type": "text",
440
+ "text": "A note on validation data for the ImageNet-1k dataset. While performing the above analysis, we observed a subtle, but severe issue with models pre-trained on ImageNet-21k and transferred to ImageNet-1k dataset. The validation score for these models (especially for large models) is not well correlated with observed test performance, see Figure 5 (right). This is due to the fact that ImageNet-21k data contains ImageNet-1k training data and we use a “minival” split from the training data for evaluation (see Section 3.1). As a result, large models on long training schedules memorize the data from the training set, which biases the evaluation metric computed in the “minival” evaluation set. To address this issue and enable fair hyper-parameter selection, we instead use the independently collected ImageNetV2 data (29) as the validation split for transferring to ImageNet-1k. As shown in Figure 5 (right), this resolves the issue. We did not observe similar issues for the other datasets. We recommend that researchers transferring ImageNet-21k models to ImageNet-1k follow this strategy. ",
441
+ "page_idx": 7
442
+ },
443
+ {
444
+ "type": "text",
445
+ "text": "4.6 Prefer increasing patch-size to shrinking model-size ",
446
+ "text_level": 1,
447
+ "page_idx": 7
448
+ },
449
+ {
450
+ "type": "text",
451
+ "text": "One unexpected outcome of our study is that we trained several models that are roughly equal in terms of inference throughput, but vary widely in terms of their quality. Specifically, Figure 6 (right) shows that models containing the “Tiny” variants perform significantly worse than the similarly fast larger models with “/32” patch-size. For a given resolution, the patch-size influences the amount of tokens on which self-attention is performed and, thus, is a contributor to model capacity which is not reflected by parameter count. Parameter count is reflective neither of speed, nor of capacity (10). ",
452
+ "page_idx": 7
453
+ },
454
+ {
455
+ "type": "image",
456
+ "img_path": "images/7fc08dff69d0914711069589acfce45e0cd480216ad383e39848883fa03b0b5f.jpg",
457
+ "image_caption": [
458
+ "Figure 6: ImageNet transfer. Left: For every architecture and upstream dataset, we selected the best model by upstream validation accuracy. Main ViT-S,B,L models are connected with a solid line to highlight the trend, with the exception of ViT-L models pre-trained on i1k, where the trend breaks down. The same data is also shown in Table 3. Right: Focusing on small models, it is evident that using a larger patch-size (/32) significantly outperforms making the model thinner (Ti). "
459
+ ],
460
+ "image_footnote": [],
461
+ "page_idx": 8
462
+ },
463
+ {
464
+ "type": "table",
465
+ "img_path": "images/979c108c6c58dfe9d8f3212aeeab311e4f0a9e90b5cc0c205ec91200dc31577c.jpg",
466
+ "table_caption": [
467
+ "Table 3: ImageNet-1k transfer. Column i1k $\\mathbf { u p }$ evaluates best checkpoint without adaptation, columns i1k300, i21k30 and i21k300 (ImageNet-1k 300 epochs and ImageNet-21k 30 and 300 epochs) report numbers after fine-tuning, which are shown in Figure 6, the “recommended checkpoints” (see Section 4.5) were fine-tuned with two different learning rates (see Section B). For the column i21k $\\mathbf { v } 2$ (ImageNet-21k, 300 epochs), the upstream checkpoint was instead chosen by ImageNetV2 validation accuracy. The JFT-300M numbers are taken from (13) (bold numbers indicate our results that are on par or surpass the published JFT-300M results without AugReg for the same models). Inference speed measurements were computed on an NVIDIA V100 GPU using timm (42), sweeping the batch size for best throughput. "
468
+ ],
469
+ "table_footnote": [],
470
+ "table_body": "<table><tr><td rowspan=\"2\">Model</td><td colspan=\"5\">224px resolution</td><td colspan=\"6\">384px resolution</td></tr><tr><td>img/sec</td><td>i1kup</td><td>i1k300</td><td>i21k30</td><td>i21k300</td><td>img/sec</td><td>i1k300</td><td>i21k30</td><td>i21k300</td><td>i21kv2</td><td>JFT300M</td></tr><tr><td>L/16</td><td>228</td><td>75.72</td><td>74.01</td><td>82.05</td><td>83.98</td><td>50</td><td>77.21</td><td>84.48</td><td>85.59</td><td>87.08</td><td>87.12</td></tr><tr><td>B/16</td><td>659</td><td>79.84</td><td>78.73</td><td>80.42</td><td>83.96</td><td>138</td><td>81.63</td><td>83.46</td><td>85.49</td><td>86.15</td><td>84.15</td></tr><tr><td>S/16</td><td>1508</td><td>79.00</td><td>77.51</td><td>76.04</td><td>80.46</td><td>300</td><td>80.70</td><td>80.22</td><td>83.73</td><td>83.15</td><td>1</td></tr><tr><td>R50+L/32</td><td>1047</td><td>76.84</td><td>74.17</td><td>80.26</td><td>82.74</td><td>327</td><td>76.71</td><td>83.19</td><td>85.99</td><td>86.21</td><td>1</td></tr><tr><td>R26+S/32</td><td>1814</td><td>79.61</td><td>78.20</td><td>77.42</td><td>80.81</td><td>560</td><td>81.55</td><td>81.11</td><td>83.85</td><td>83.80</td><td>1</td></tr><tr><td>Ti/16</td><td>3097</td><td>72.59</td><td>69.56</td><td>68.89</td><td>73.75</td><td>610</td><td>74.64</td><td>74.20</td><td>78.22</td><td>77.83</td><td></td></tr><tr><td>B/32</td><td>3597</td><td>74.42</td><td>71.38</td><td>72.24</td><td>79.13</td><td>955</td><td>76.60</td><td>78.65</td><td>83.59</td><td>83.59</td><td>80.73</td></tr><tr><td>S/32</td><td>8342</td><td>72.07</td><td>69.19</td><td>68.49</td><td>73.47</td><td>2154</td><td>75.65</td><td>75.74</td><td>79.58</td><td>80.01</td><td>1</td></tr><tr><td>R+Ti/16</td><td>9371</td><td>70.13</td><td>67.30</td><td>65.65</td><td>69.69</td><td>2426</td><td>73.48</td><td>71.97</td><td>75.40</td><td>75.33</td><td></td></tr></table>",
471
+ "page_idx": 8
472
+ },
473
+ {
474
+ "type": "text",
475
+ "text": "",
476
+ "page_idx": 9
477
+ },
478
+ {
479
+ "type": "text",
480
+ "text": "5 Related work ",
481
+ "text_level": 1,
482
+ "page_idx": 9
483
+ },
484
+ {
485
+ "type": "text",
486
+ "text": "The scope of this paper is limited to studying pre-training and transfer learning of Vision Transformer models and there already are a number of studies considering similar questions for convolutional neural networks (23; 22). Here we hence focus on related work involving ViT models. ",
487
+ "page_idx": 9
488
+ },
489
+ {
490
+ "type": "text",
491
+ "text": "As first proposed in (13), ViT achieved competitive performance only when trained on comparatively large amounts of training data, with state-of-the-art transfer results using the ImageNet-21k and JFT-300M datasets, with roughly 13M and 300M images, respectively. In stark contrast, (39) focused on tackling overfitting of ViT when training from scratch on ImageNet-1k by designing strong regularization and augmentation schemes. Yet neither work analyzed the effects of stronger augmentation of regularization and augmentation in the presence of larger amounts of training data. ",
492
+ "page_idx": 9
493
+ },
494
+ {
495
+ "type": "text",
496
+ "text": "Ever since (22) first showed good results when pre-training BiT on ImageNet-21k, more architecture works have mentioned using it for select few experiments (13; 38; 37; 8), with (30) arguing more directly for the use of ImageNet-21k. However, none of these works thoroughly investigates the combined use of AugReg and ImageNet-21k and provides conclusions, as we do here. ",
497
+ "page_idx": 9
498
+ },
499
+ {
500
+ "type": "text",
501
+ "text": "An orthogonal line of work introduces cleverly designed inductive biases in ViT variants or retain some of the general architectural parameters of successful convolutional architectures while adding self-attention to them. (33) carefully combines a standard convolutional backbone with bottleneck blocks based on self-attention instead of convolutions. In (26; 17; 41; 43) the authors propose hierarchical versions of ViT. (9) suggests a very elegant idea of initializing Vision Transformer, such that it behaves similarly to convolutional neural network in the beginning of training. ",
502
+ "page_idx": 9
503
+ },
504
+ {
505
+ "type": "text",
506
+ "text": "Yet another way to address overfitting and improve transfer performance is to rely on self-supervised learning objectives. (1) pre-trains ViT to reconstruct perturbed image patches. Alternatively, (4) devises a selfsupervised training procedure based on the idea from (16), achieving impressive results. We leave the systematic comparison of self-supervised and supervised pre-training to future work. ",
507
+ "page_idx": 9
508
+ },
509
+ {
510
+ "type": "text",
511
+ "text": "6 Discussion ",
512
+ "text_level": 1,
513
+ "page_idx": 9
514
+ },
515
+ {
516
+ "type": "text",
517
+ "text": "Societal Impact. Our experimental study is relatively thorough and used a lot of compute. This could be taken as encouraging anyone who uses ViTs to perform such large studies. On the contrary, our aim is to provide good starting points and off-the-shelf checkpoints that remove the need for such extensive search in future work. ",
518
+ "page_idx": 9
519
+ },
520
+ {
521
+ "type": "text",
522
+ "text": "Limitations. In order to be thorough, we restrict the study to the default ViT architecture and neither include ResNets, which have been well studied over the course of the past years, nor more recent ViT variants. We anticipate though that many of our findings extend to other ViT-based architectures as well. ",
523
+ "page_idx": 9
524
+ },
525
+ {
526
+ "type": "text",
527
+ "text": "7 Summary of recommendations ",
528
+ "text_level": 1,
529
+ "page_idx": 10
530
+ },
531
+ {
532
+ "type": "text",
533
+ "text": "Below we summarize three main recommendations based on our study: ",
534
+ "page_idx": 10
535
+ },
536
+ {
537
+ "type": "text",
538
+ "text": "• We recommend to use checkpoints that were pre-trained on more upstream data, and not relying only on ImageNet-1k as a proxy for model quality, since ImageNet-1k validation accuracy is inflated when pre-training on ImageNet-1k, and more varied upstream data yields more widely applicable models (Figure 3 and Section 4.3). \n• Judiciously applying data augmentation and model regularization makes it possible to train much better models on a dataset of a given size (Figure 1), and these improvements can be observed both with medium sized datasets like ImageNet-1k, and even with large datasets like ImageNet-21k. But there are no simple rules which AugReg settings to select. The best settings vary a lot depending on model capacity and training schedule, and one needs to be careful not to apply AugReg to a model that is too small, or when pre-training for too short – otherwise the model quality may deteriorate (see Figure 4 for an exhaustive quantitative evaluation and Section 4.4 for further comments on regularization vs augmentations). How to select the best upstream model for transfer on your own task? Aside from always using ImageNet-21k checkpoints, we recommend to select the model with the best upstream validation performance (Section 4.5, table with paths in our Github repository $\\cdot$ ). As we show in Figure 5, this choice is generally optimal for a wide range of tasks. If the user has additional computational resources available to fine-tune all checkpoints, they may get slightly better results in some scenarios, but also need to be careful with respect to ImageNet-1k and ImageNet-21k data overlap when it comes to model selection (Figure 5, right). ",
539
+ "page_idx": 10
540
+ },
541
+ {
542
+ "type": "text",
543
+ "text": "8 Conclusion ",
544
+ "text_level": 1,
545
+ "page_idx": 10
546
+ },
547
+ {
548
+ "type": "text",
549
+ "text": "We conduct the first systematic, large scale study of the interplay between regularization, data augmentation, model size, and training data size when pre-training Vision Transformers, including their respective effects on the compute budget needed to achieve a certain level of performance. We also evaluate pre-trained models through the lens of transfer learning. As a result, we characterize a quite complex landscape of training settings for pre-training Vision Transformers across different model sizes. Our experiments yield a number of surprising insights around the impact of various techniques and the situations when augmentation and regularization are beneficial and when not. ",
550
+ "page_idx": 10
551
+ },
552
+ {
553
+ "type": "text",
554
+ "text": "We also perform an in-depth analysis of the transfer learning setting for Vision Transformers. We conclude that across a wide range of datasets, even if the downstream data of interest appears to only be weakly related to the data used for pre-training, transfer learning remains the best available option. Our analysis also suggests that among similarly performing pre-trained models, for transfer learning a model with more training data should likely be preferred over one with more data augmentation. ",
555
+ "page_idx": 10
556
+ },
557
+ {
558
+ "type": "text",
559
+ "text": "We hope that our study will help guide future research on Vision Transformers and will be a useful source of effective training settings for practitioners seeking to optimize their final model performance in the light of a given computational budget. ",
560
+ "page_idx": 10
561
+ },
562
+ {
563
+ "type": "text",
564
+ "text": "Acknowledgements We thank Alexey Dosovitskiy, Neil Houlsby, and Ting Chen for insightful feedback; \nthe Google Brain team at large for providing a supportive research environment. ",
565
+ "page_idx": 10
566
+ },
567
+ {
568
+ "type": "text",
569
+ "text": "References ",
570
+ "text_level": 1,
571
+ "page_idx": 10
572
+ },
573
+ {
574
+ "type": "text",
575
+ "text": "[1] Sara Atito, Muhammad Awais, and Josef Kittler. Sit: Self-supervised vision transformer. arXiv:2104.03602, 2021. 10 \n[2] Irwan Bello, William Fedus, Xianzhi Du, Ekin D. Cubuk, Aravind Srinivas, Tsung-Yi Lin, Jonathon Shlens, and Barret Zoph. Revisiting resnets: Improved training and scaling strategies. arXiv:2103.07579, 2021. 4 \n[3] James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: composable transformations of Python+NumPy programs, 2018. 3 \n[4] Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerging properties in self-supervised vision transformers. arXiv:2104.14294, 2021. 10 \n[5] Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual 12M: Pushing web-scale image-text pre-training to recognize long-tail visual concepts. 2021. 16 \n[6] Gong Cheng, Junwei Han, and Xiaoqiang Lu. Remote sensing image scene classification: Benchmark and state of the art. Proceedings of the IEEE, 105(10):1865–1883, 2017. 3 \n[7] Ekin D. Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V. Le. RandAugment: Practical automated data augmentation with a reduced search space. In CVPR Workshops, 2020. 4 \n[8] Zihang Dai, Hanxiao Liu, Quoc V. Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes, 2021. 10 \n[9] Stéphane d’Ascoli, Hugo Touvron, Matthew Leavitt, Ari Morcos, Giulio Biroli, and Levent Sagun. Convit: Improving vision transformers with soft convolutional inductive biases. arXiv:2103.10697, 2021. 10 \n[10] Mostafa Dehghani, Anurag Arnab, Lucas Beyer, Ashish Vaswani, and Yi Tay. The efficiency misnomer. CoRR, abs/2110.12894, 2021. 10 \n[11] J. Deng, W. Dong, R. Socher, L. Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009. 3, 5 \n[12] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT, 2019. 16 \n[13] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv:2010.11929, 2020. 1, 3, 4, 5, 9, 10 \n[14] A Geiger, P Lenz, C Stiller, and R Urtasun. Vision meets robotics: The kitti dataset. The International Journal of Robotics Research, 32(11):1231–1237, 2013. 3 \n[15] Google. TensorFlow Datasets, a collection of ready-to-use datasets. https://www.tensorflow.org/datasets. 3 \n[16] Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv:2006.07733, 2020. 10 \n[17] Kai Han, An Xiao, Enhua Wu, Jianyuan Guo, Chunjing Xu, and Yunhe Wang. Transformer in transformer. arXiv:2103.00112, 2021. 10 \n[18] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. 1, 4 \n[19] Jonathan Heek, Anselm Levskaya, Avital Oliver, Marvin Ritter, Bertrand Rondepierre, Andreas Steiner, and Marc van Zee. Flax: A neural network library and ecosystem for JAX, 2020. 3 \n[20] Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In ECCV, 2016. 4 \n[21] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015. 4 \n[22] Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (BiT): General visual representation learning. In ECCV, 2020. 3, 10 \n[23] Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better imagenet models transfer better? In CVPR, 2019. 10 \n[24] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. 3 \n[25] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. Imagenet classification with deep convolutional neural networks. In Peter L. Bartlett, Fernando C. N. Pereira, Christopher J. C. Burges, Léon Bottou, and Kilian Q. Weinberger, editors, Advances in Neural Information Processing Systems 25: 26th Annual Conference on Neural Information Processing Systems 2012. Proceedings of a meeting held December 3-6, 2012, Lake Tahoe, Nevada, United States, pages 1106–1114, 2012. 2 \n[26] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv:2103.14030, 2021. 10 \n[27] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2019. 4, 14 \n[28] Omkar M. Parkhi, Andrea Vedaldi, Andrew Zisserman, and C. V. Jawahar. Cats and dogs. In CVPR, 2012. 3 \n[29] Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? In ICML, 2019. 3, 8 \n[30] Tal Ridnik, Emanuel Ben-Baruch, Asaf Noy, and Lihi Zelnik-Manor. Imagenet-21k pretraining for the masses. arXiv:2104.10972, 2021. 3, 10 \n[31] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. IIJCV, 2015. 5 \n[32] Ali Sharif Razavian, Hossein Azizpour, Josephine Sullivan, and Stefan Carlsson. Cnn features off-the-shelf: An astounding baseline for recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, June 2014. 2 \n[33] Aravind Srinivas, Tsung-Yi Lin, Niki Parmar, Jonathon Shlens, Pieter Abbeel, and Ashish Vaswani. Bottleneck transformers for visual recognition. arXiv:2101.11605, 2021. 10 \n[34] Robin Strudel, Ricardo Garcia, Ivan Laptev, and Cordelia Schmid. Segmenter: Transformer for semantic segmentation. arXiv:2105.05633, 2021. 16 \n[35] Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In Proceedings of the IEEE international conference on computer vision, pages 843–852, 2017. 5 \n[36] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In CVPR, 2015. 4 \n[37] Mingxing Tan and Quoc V. Le. Efficientnetv2: Smaller models and faster training. CoRR, abs/2104.00298, 2021. 10 \n[38] Ilya O. Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Andreas Steiner, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, and Alexey Dosovitskiy. Mlp-mixer: An all-mlp architecture for vision. CoRR, abs/2105.01601, 2021. 10 \n[39] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv:2012.12877, 2020. 1, 4, 10 \n[40] Hugo Touvron, Andrea Vedaldi, Matthijs Douze, and Herve Jegou. Fixing the train-test resolution discrepancy. In NeurIPS, 2019. 5 \n[41] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv:2102.12122, 2021. 10 \n[42] Ross Wightman. Pytorch image models (timm): Vit training details. https://github.com/rwightman/ pytorch-image-models/issues/252#issuecomment-713838112, 2013. 3, 4, 9 \n[43] Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, and Lei Zhang. Cvt: Introducing convolutions to vision transformers. arXiv:2103.15808, 2021. 10 \n[44] Qizhe Xie, Zihang Dai, Eduard Hovy, Thang Luong, and Quoc Le. Unsupervised data augmentation for consistency training. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, 2020. 5 \n[45] Xiaohua Zhai, Joan Puigcerver, Alexander Kolesnikov, Pierre Ruyssen, Carlos Riquelme, Mario Lucic, Josip Djolonga, Andre Susano Pinto, Maxim Neumann, Alexey Dosovitskiy, Lucas Beyer, Olivier Bachem, Michael Tschannen, Marcin Michalski, Olivier Bousquet, Sylvain Gelly, and Neil Houlsby. A large-scale study of representation learning with the visual task adaptation benchmark, 2020. 2, 3, 6, 15 \n[46] Xiaohua Zhai, Xiao Wang, Basil Mustafa, Andreas Steiner, Daniel Keysers, Alexander Kolesnikov, and Lucas Beyer. Lit: Zero-shot transfer with locked-image text tuning. CVPR, 2022. 16 \n[47] Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In ICLR, 2018. 4 ",
576
+ "page_idx": 10
577
+ },
578
+ {
579
+ "type": "text",
580
+ "text": "",
581
+ "page_idx": 11
582
+ },
583
+ {
584
+ "type": "text",
585
+ "text": "",
586
+ "page_idx": 12
587
+ },
588
+ {
589
+ "type": "text",
590
+ "text": "A From-scratch training details ",
591
+ "text_level": 1,
592
+ "page_idx": 13
593
+ },
594
+ {
595
+ "type": "text",
596
+ "text": "We present from-scratch training details for B/32 and B/16 models, on both Resisc45 and Pets37 datasets. We perform a grid search over the following parameters: ",
597
+ "page_idx": 13
598
+ },
599
+ {
600
+ "type": "text",
601
+ "text": "• B/32 on Pets37 ",
602
+ "page_idx": 13
603
+ },
604
+ {
605
+ "type": "text",
606
+ "text": "– Epochs: {1k, 3k, 10k, 30k, 300k} – Learning rates: {1e−4, 3e−4, 1e−3, 3e−3} – Weight decays4: {1e−5, 3e−5, 1e−4, 3e−4} ",
607
+ "page_idx": 13
608
+ },
609
+ {
610
+ "type": "text",
611
+ "text": "• B/16 on Pets37 ",
612
+ "page_idx": 13
613
+ },
614
+ {
615
+ "type": "text",
616
+ "text": "– Epochs: {1k, 3k, 10k} – Learning rates: {3e−4, 1e−3} – Weight decays: {3e−5, 1e−4} ",
617
+ "page_idx": 13
618
+ },
619
+ {
620
+ "type": "text",
621
+ "text": "• B/32 on Resisc45 ",
622
+ "page_idx": 13
623
+ },
624
+ {
625
+ "type": "text",
626
+ "text": "– Epochs: {75, 250, 750, 2.5k, 7.5k, 25k} – Learning rates: {1e−4, 3e−4, 1e−3, 3e−3} – Weight decays: {1e−5, 3e−5, 1e−4, 3e−4} ",
627
+ "page_idx": 13
628
+ },
629
+ {
630
+ "type": "text",
631
+ "text": "• B/16 on Resisc45 ",
632
+ "page_idx": 13
633
+ },
634
+ {
635
+ "type": "text",
636
+ "text": "– Epochs: {75, 250, 750, 2.5k, 7.5k} – Learning rates: {1e−3} – Weight decays: {1e−4, 3e−4} ",
637
+ "page_idx": 13
638
+ },
639
+ {
640
+ "type": "text",
641
+ "text": "All these from-scratch runs sweep over dropout rate and stochastic depth in range $\\{ ( 0 . 0 , 0 . 0 ) , ( 0 . 1 , 0 . 1 ) , ( 0 . 2 , 0 . 2 ) \\}$ , and data augmentation $( l , m , \\alpha )$ in range $\\{ \\ ( 0 , 0 , 0 )$ , $( 2 , 1 0 , 0 . 2 )$ , (2, 15, 0.2), $( 2 , 1 5 , 0 . 5 )$ , $( 2 , 2 0 , 0 . 5 )$ , $( 2 , 2 0 , 0 . 8 )$ , (4, 15, 0.5), $( 4 , 2 0 , 0 . 8 ) \\ \\}$ . ",
642
+ "page_idx": 13
643
+ },
644
+ {
645
+ "type": "text",
646
+ "text": "For the definition of $( l , m , \\alpha )$ refer to Section 3.3 ",
647
+ "page_idx": 13
648
+ },
649
+ {
650
+ "type": "text",
651
+ "text": "B Finetune details ",
652
+ "text_level": 1,
653
+ "page_idx": 13
654
+ },
655
+ {
656
+ "type": "text",
657
+ "text": "In Table 4, we show the hyperparameter sweep range for finetune jobs. We use the same finetune sweep for all the pre-trained models in this paper. ",
658
+ "page_idx": 13
659
+ },
660
+ {
661
+ "type": "table",
662
+ "img_path": "images/f99b301c769850b16eea7da9bd668c7822b54480b3ef3d6acdf037ec8db04977.jpg",
663
+ "table_caption": [
664
+ "Table 4: Finetune details for the pre-trained models. "
665
+ ],
666
+ "table_footnote": [],
667
+ "table_body": "<table><tr><td>Dataset</td><td>Learning rate</td><td>Total, warmup steps</td></tr><tr><td>ImageNet-1k</td><td>{0.01,0.03}</td><td>{(20k,500)}</td></tr><tr><td>Pets37</td><td>{1e-3,3e-3,0.01}</td><td>{(500,100),(2.5k,200)}</td></tr><tr><td>Kitti-distance</td><td>{1e-3,3e-3,0.01}</td><td>{(500,100),(2.5k,200)}</td></tr><tr><td>CIFAR-100</td><td>{1e-3,3e-3,0.01}</td><td>{(2.5k,200),(10k,500)}</td></tr><tr><td>Resisc45</td><td>{1e-3,3e-3,0.01}</td><td>{(2.5k,200),(10k,500)}</td></tr></table>",
668
+ "page_idx": 13
669
+ },
670
+ {
671
+ "type": "table",
672
+ "img_path": "images/d9daeb50e2e910aec6c8db8b79ee348c480eb84f544b7e1bf6b01e70669da57d.jpg",
673
+ "table_caption": [
674
+ "Table 5: Detailed VTAB results, including the “Mean” accuracy shown in Figure 3. We show datasets under natural, specialized, structured groups, following (45). "
675
+ ],
676
+ "table_footnote": [],
677
+ "table_body": "<table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td>std</td><td>268umso NHAS·</td><td></td><td></td><td></td><td>Leso.</td><td></td><td></td><td>ueeg</td><td></td><td></td><td>oT-Idsp·</td><td>[o-dsp·</td><td></td><td></td><td></td><td></td></tr><tr><td rowspan=\"8\"></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>85.2 98.6955790.6 89.7</td><td></td><td></td><td></td><td></td><td>96.1 8.4 67.499.9869</td><td>81.9</td><td>25.9</td><td></td><td>46.374.2</td></tr><tr><td></td><td>91.681.9 60794091.270695.68.2</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>B/32</td><td>92.687.6</td><td></td><td>72.7</td><td>94.4</td><td>92.2 73.8</td><td>95.887.0</td><td></td><td></td><td>82.7 98.6</td><td></td><td>94.9</td><td>79.8 89.0</td><td></td><td>94.089.6</td><td>66.1</td><td></td><td>99.8 84.7</td><td>80.3</td><td>24.7</td><td></td><td>62.475.2</td></tr><tr><td>Ti/16</td><td>92.784.0</td><td></td><td>68.9</td><td>93.8</td><td>92.5</td><td>72.0</td><td>96.1</td><td>85.7</td><td>83.7</td><td>98.7</td><td>95.6</td><td>81.6</td><td>89.9</td><td>98.0 91.9</td><td>68.5</td><td></td><td>99.783.2</td><td>82.0</td><td>26.5</td><td>65.9</td><td>77.0</td></tr><tr><td>R26+S/32 90.2</td><td></td><td>86.2</td><td></td><td>74.095.5</td><td>94.3</td><td>74.5</td><td>95.687.2</td><td></td><td>84.5</td><td>98.6</td><td>96.0</td><td>83.4</td><td>90.6</td><td>99.7 91.673.3100</td><td></td><td></td><td>84.8</td><td>84.5</td><td>28.2</td><td></td><td>51.376.7</td></tr><tr><td>S/16</td><td>93.1</td><td>86.9</td><td></td><td>72.895.7</td><td>93.8</td><td>74.3</td><td>96.2</td><td>87.5</td><td>84.1</td><td>98.7</td><td>95.9</td><td>82.7</td><td>90.3</td><td>98.7 91.5</td><td>69.8</td><td>100</td><td>84.3</td><td></td><td>79.627.3</td><td>58.0</td><td>76.1</td></tr><tr><td>R50+L/32 90.7</td><td></td><td>88.1</td><td>73.7</td><td>95.4</td><td>93.5</td><td>75.695.9</td><td></td><td>87.6</td><td>85.8</td><td>98.4</td><td>95.4</td><td>83.1 90.7</td><td></td><td>99.890.4</td><td>71.1</td><td>100</td><td></td><td>87.582.4</td><td>23.5</td><td>53.0</td><td>76.0</td></tr><tr><td>B/16</td><td>93.087.8</td><td></td><td>72.4</td><td>96.0</td><td>94.5</td><td>75.396.1</td><td>87.9</td><td></td><td>85.1 98.9</td><td></td><td></td><td>95.782.590.5</td><td></td><td>98.1 91.8</td><td>69.5</td><td></td><td>99.9 84.584.0</td><td></td><td>25.9</td><td></td><td>53.976.0</td></tr><tr><td>L/16</td><td></td><td>91.086.2</td><td></td><td></td><td>69.591.493.0</td><td>75.394.985.9</td><td></td><td></td><td>81.0</td><td>98.7</td><td></td><td>93.881.6</td><td>88.8</td><td>94.3 88.363.9</td><td></td><td></td><td>98.585.1</td><td></td><td>81.3</td><td>25.3</td><td>51.273.5</td></tr><tr><td rowspan=\"8\"></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>80.2 244</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>92.4 8.7 72. 98.7 905</td><td>72.4 95.1 85.6</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>83.69879509.789595.7 99.2</td><td></td><td></td><td></td><td>66.6 99.8 87.9</td><td></td><td></td><td>47.0 75.9</td></tr><tr><td>B/32</td><td>93.690.5</td><td></td><td>74.599.1</td><td>91.9</td><td>77.895.789.0</td><td></td><td></td><td>83.5</td><td>98.895.1</td><td></td><td>78.8</td><td>89.1</td><td>93.690.1</td><td></td><td>62.9</td><td>99.8 89.0</td><td></td><td>78.324.1</td><td></td><td>55.974.2</td></tr><tr><td>Ti/16</td><td>93.385.5</td><td></td><td>72.699.0</td><td>90.0</td><td>74.395.1</td><td></td><td>87.1</td><td></td><td>85.598.8</td><td>95.5</td><td>81.6</td><td>90.4</td><td>97.791.7</td><td></td><td></td><td></td><td>67.499.9 83.881.2</td><td>26.3</td><td>55.1</td><td>75.4</td></tr><tr><td>R26+S/32 94.7</td><td></td><td>89.9 76.5</td><td></td><td>99.5 93.0</td><td>79.1</td><td>95.989.8</td><td></td><td>86.3</td><td>98.6</td><td>96.1</td><td>83.1</td><td>91.0</td><td>99.7 92.0</td><td>73.4</td><td></td><td>100 88.7</td><td>84.8</td><td>26.2</td><td>53.3</td><td>77.3</td></tr><tr><td>S/16</td><td>94.3 89.4</td><td></td><td>76.2</td><td>99.3 92.3</td><td>78.1</td><td>95.7</td><td>89.3</td><td>84.5</td><td>98.8</td><td>96.3</td><td>81.7</td><td>90.3</td><td>98.491.5</td><td></td><td>68.3100</td><td>86.5</td><td>82.8</td><td>25.9</td><td></td><td>52.775.8</td></tr><tr><td>R50+L/32 95.4</td><td>92.0</td><td>79.1</td><td>99.6</td><td>94.3</td><td>81.7</td><td>96.0</td><td>91.1</td><td>85.9</td><td>98.7</td><td>95.9</td><td>82.9</td><td>90.9</td><td>99.9 90.9</td><td>72.9</td><td></td><td>100 86.3</td><td>82.6</td><td>25.4</td><td>57.4</td><td>76.9</td></tr><tr><td>B/16</td><td>95.1 91.6</td><td>77.9</td><td></td><td>99.6 94.2</td><td>80.9</td><td>96.390.8</td><td></td><td>84.8</td><td>99.0</td><td>96.1</td><td>82.4</td><td>90.6</td><td>98.9 90.9</td><td></td><td>72.1</td><td>100</td><td>88.383.5</td><td>26.6</td><td>69.6</td><td>78.7</td></tr><tr><td rowspan=\"8\">L/16</td><td></td><td>95.7 93.4</td><td>79.5</td><td></td><td>99.694.6</td><td>82.3</td><td>96.7</td><td>91.7</td><td></td><td>88.498.9</td><td>96.5</td><td>81.8</td><td>91.4</td><td>99.391.8</td><td>72.1</td><td></td><td>100 88.5</td><td>83.7</td><td>25.0</td><td>62.9</td><td>77.9</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>67.4</td><td>100 97.4</td><td></td><td>78.2 24.5</td><td></td><td>5.273.</td></tr><tr><td></td><td>93.2 85.7</td><td></td><td></td><td>71.599.290.3</td><td>747</td><td>95.2</td><td>87.0</td><td></td><td>85.298.395.4</td><td></td><td>81.6</td><td>9.0</td><td>95.5 90.5</td></table>",
678
+ "page_idx": 14
679
+ },
680
+ {
681
+ "type": "text",
682
+ "text": "C VTAB results ",
683
+ "text_level": 1,
684
+ "page_idx": 14
685
+ },
686
+ {
687
+ "type": "text",
688
+ "text": "In Table 5, we show all the results in percentage for all the models on the full VTAB. We report VTAB score only for the best pre-trained models, selected by their upstream validation accuracy (“recommended checkpoints”, see Section 4.5). For VTAB tasks, we sweep over 8 hyper parameters, include four learning rates $\\left. 0 . 0 0 1 , 0 . 0 0 3 , 0 . 0 1 , 0 . 0 3 \\right.$ and two schedules $\\{ 5 0 0 , 2 5 0 0 \\}$ steps. The best run was selected on VTAB validation split. ",
689
+ "page_idx": 14
690
+ },
691
+ {
692
+ "type": "image",
693
+ "img_path": "images/2ddc9898e2ad450a1c7486404303fbfa22483c7ff3f2c9a22501af1a4969832b.jpg",
694
+ "image_caption": [
695
+ "Figure 7: The improvement or deterioration in validation accuracy when using or not using regularization (e.g. dropout and stochastic depth) – positive values when regularization improves accuracy for a given model/augmentation. For absolute values see Figure 4. "
696
+ ],
697
+ "image_footnote": [],
698
+ "page_idx": 15
699
+ },
700
+ {
701
+ "type": "text",
702
+ "text": "D The benefit and harm of regularization ",
703
+ "text_level": 1,
704
+ "page_idx": 15
705
+ },
706
+ {
707
+ "type": "text",
708
+ "text": "In Figure 7, we show the gain (green, positive numbers) or loss (red, negative numbers) in accuracy when adding regularization to the model by means of dropout and stochastic depth. We did verify in earlier experiments that combining both with (peak) drop probability 0.1 is indeed the best setting. What this shows, is that model regularization mainly helps larger models, and only when trained for long. Specifically, for ImageNet-21 pre-training, it hurts all but the largest of models across the board. ",
709
+ "page_idx": 15
710
+ },
711
+ {
712
+ "type": "text",
713
+ "text": "E Using recommended checkpoints for other computer vision tasks ",
714
+ "text_level": 1,
715
+ "page_idx": 15
716
+ },
717
+ {
718
+ "type": "text",
719
+ "text": "One limitation of our study is that it focuses mainly on the classification task. However, computer vision is a much broader field, and backbones need to excel at many tasks. While expanding the full study to many more tasks such as detection, segmentation, tracking, and others would be prohibitive, here we take a peek at one further task: multi-modal image-text retrieval. ",
720
+ "page_idx": 15
721
+ },
722
+ {
723
+ "type": "text",
724
+ "text": "A detailed analysis of this question is beyond the scope of this study, but we evaluated our recommended (see Section 4.5) B/32 checkpoint pre-trained on ImageNet-21k in a contrastive training setup with a locked image tower (46). We initialize the text tower with a BERT-Base (12) checkpoint and train for 20 epochs on CC12M (5). The results in Table 6 indicate that the upstream validation accuracy is a good predictor for zero-shot classification. Moreover, the representations produced by such a model yield similarly better results for image-text retrieval, when compared to models that do not have the ideal amount of AugReg applied. We hope the community will adopt our backbones for other tasks, as already done by (34). ",
725
+ "page_idx": 15
726
+ },
727
+ {
728
+ "type": "table",
729
+ "img_path": "images/3846a8b819fde87ba393f2ec68869a3c2a343bdb6c2d0ffe6d932fe7f4fb0313.jpg",
730
+ "table_caption": [
731
+ "Table 6: Comparing our recommended (see Section 4.5) B/32 checkpoint with models that apply too little or too much AugReg. The final validation accuracy from the ImageNet-21k pre-training is the same that is reported in Figure 4. The other columns are ImageNet-1K zero-shot accuracy, and image-text retrieval accuracy on different datasets, after contrastively training as described in (46). "
732
+ ],
733
+ "table_footnote": [],
734
+ "table_body": "<table><tr><td>AugReg</td><td>I21k Val</td><td>I1k Oshot</td><td>Coco I2T</td><td>Coco T2I</td><td>Flickr I2T</td><td>Flickr T2I</td></tr><tr><td>none/0.0</td><td>41.6</td><td>54.9</td><td>33.4</td><td>20.1</td><td>58.1</td><td>39.9</td></tr><tr><td>heavy2/0.1</td><td>43.5</td><td>57.3</td><td>39.1</td><td>24.4</td><td>62.1</td><td>44.6</td></tr><tr><td>Recommended</td><td>47.7</td><td>60.6</td><td>41.1</td><td>25.5</td><td>65.9</td><td>46.9</td></tr></table>",
735
+ "page_idx": 15
736
+ }
737
+ ]
parse/test/4nPswr1KcP/4nPswr1KcP_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/4nPswr1KcP/4nPswr1KcP_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/5Nn2BLV7SB/5Nn2BLV7SB.md ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PANDALM: AN AUTOMATIC EVALUATION BENCHMARK FOR LLM INSTRUCTION TUNING OPTIMIZATION
2
+
3
+ Yidong Wang1,2∗, Zhuohao $\mathbf { V } \mathbf { u } ^ { 1 * }$ , Wenjin $\mathbf { Y a o } ^ { 1 }$ , Zhengran $\mathbf { Z e n g ^ { 1 } }$ , Linyi Yang2, Cunxiang Wang2, Hao Chen3, Chaoya Jiang1 , Rui Xie1, Jindong Wang3, Xing $\bar { \bf X } \bar { \bf i } { \bf e } ^ { 3 }$ , Wei $\dot { \mathbf { Y } } \mathbf { e } ^ { 1 }$ †, Shikun Zhang1†, Yue Zhang2†
4
+
5
+ 1Peking University 2Westlake University 3Microsoft Research Asia
6
+
7
+ # ABSTRACT
8
+
9
+ Instruction tuning large language models (LLMs) remains a challenging task, owing to the complexity of hyperparameter selection and the difficulty involved in evaluating the tuned models. To determine the optimal hyperparameters, an automatic, robust, and reliable evaluation benchmark is essential. However, establishing such a benchmark is not a trivial task due to the challenges associated with evaluation accuracy and privacy protection. In response to these challenges, we introduce a judge large language model, named PandaLM, which is trained to distinguish the superior model given several LLMs. PandaLM’s focus extends beyond just the objective correctness of responses, which is the main focus of traditional evaluation datasets. It addresses vital subjective factors such as relative conciseness, clarity, adherence to instructions, comprehensiveness, and formality. To ensure the reliability of PandaLM, we collect a diverse human-annotated test dataset, where all contexts are generated by humans and labels are aligned with human preferences. On evaluations using our collected test dataset, our findings reveal that PandaLM-7B offers performance comparable to both GPT-3.5 and GPT4. Impressively, PandaLM-70B surpasses their performance. PandaLM enables the evaluation of LLM to be fairer but with less cost, evidenced by significant improvements achieved by models tuned through PandaLM compared to their counterparts trained with default Alpaca’s hyperparameters. In addition, PandaLM does not depend on API-based evaluations, thus avoiding potential data leakage.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Large language models (LLMs) have attracted increasing attention in the field of artificial intelligence (OpenAI, 2023; Google, 2023; Zeng et al., 2022a; Brown et al., 2020; Chowdhery et al., 2022; Anil et al., 2023; Zhang et al., 2023), with various applications from question answering (Hirschman & Gaizauskas, 2001; Kwiatkowski et al., 2019; Wang et al., 2021), machine translation (Vaswani et al., 2017; Stahlberg, 2020) to content creation (Biswas, 2023; Adams & Chuah, 2022). The Alpaca project (Taori et al., 2023) has been a pioneering effort in instruction tuning of LLaMA (Touvron et al., 2023), setting a precedent for instruction tuning LLMs, followed by Vicunna (Chiang et al., 2023). Subsequent research (Diao et al., 2023; Ji et al., 2023; Chaudhary, 2023) have typically adopted Alpaca’s hyperparameters as a standard for training their LLMs. Given the necessity of instruction tuning for these pre-trained models to effectively understand and follow natural language instructions (Wang et al., $2 0 2 2 \mathrm { c }$ ; Taori et al., 2023; Peng et al., 2023), optimizing their tuning hyperparameters is crucial for peak performance. Critical factors such as optimizer selection, learning rate, number of training epochs, and quality and size of training data significantly influence the model’s performance (Liaw et al., 2018; Tan & Le, 2019). However, a research gap remains in the area of hyperparameter optimization specifically designed for instruction tuning LLMs. To address this issue, we aim to construct an automated, reliable, and robust evaluation method, which can be integrated into any open-sourced LLMs and used as the judging basis for hyperparameter optimization.
14
+
15
+ The development of such an evaluation method presents its challenges (Guo et al., 2023; Chang et al., 2023), including ensuring evaluation reliability and privacy protection. In the context of our paper, when we refer to “privacy”, we primarily allude to the principles ingrained in federated learning (Zhang et al., 2021a) which enables model training across multiple devices or servers while keeping the data localized, thus offering a degree of privacy. Current methods often involve either crowd-sourcing work or API usage, which could be costly, and time-consuming. Besides, these methods face challenges in terms of consistency and reproducibility. This is primarily due to the lack of transparency regarding language model change logs and the inherent subjectivity of human annotations. Note that utilizing API-based evaluations carries the risk of potentially high costs associated with addressing data leaks. Although open-sourced LLMs can be alternative evaluators, they are not specifically designed for assessment, thus making it difficult to deploy them directly as evaluators.
16
+
17
+ On the other hand, the labels of previous evaluation methods (Zheng et al., 2023; Gao et al., 2021; Wang et al., 2023b;c) simply definite answers and fail to consider the language complexity in practice. The evaluation metrics of these procedures are typically accuracy and F1-score, without considering the subjective evaluation metrics that autoregressive generative language models should pay attention to, thus not reflecting the potential of such models to generate contextually relevant text. The appropriate subjective evaluation metrics can be relative conciseness, clarity, adherence to instructions, comprehensiveness, formality, and context relevance.
18
+
19
+ To tackle these challenges, we introduce a judge language model, aiming for Reproducible and Automated Language Model Assessment (PandaLM). Tuned from LLaMA, PandaLM is used to distinguish the most superior model among various candidates, each fine-tuned with different hyperparameters, and is also capable of providing the rationale behind its choice based on the reference response for the context. PandaLM surpasses the limitations of traditional evaluation methods and focuses on more subjective aspects, such as relative conciseness, clarity, comprehensiveness, formality, and adherence to instructions. Furthermore, the robustness of PandaLM is strengthened by its ability to identify and rectify problems such as logical fallacies, unnecessary repetitions, grammatical inaccuracies, and context irrelevance. By considering these diverse aspects, we leverage PandaLM’s ability to distinguish the most superior model among candidates on the validation set and then provide insights for facilitating hyperparameter optimization of instruction tuning.
20
+
21
+ In practice, we generate paired responses from a diverse set of similarly sized foundation models including LLaMA-7B (Touvron et al., 2023), Bloom-7B (Scao et al., 2022), Cerebras-GPT-6.7B (Dey et al., 2023), OPT-7B (Zhang et al., 2022a), and Pythia-6.9B (Biderman et al., 2023). Each of these models is fine-tuned using the same data and hyperparameters as Alpaca (Taori et al., 2023). The paired responses from these tuned LLMs constitute the input of training data for PandaLM. The most straightforward approach to generate the corresponding target of training data is through human annotation, but this method can be costly and time-consuming (Wang et al., 2023h). And the lack of sufficiently annotated training data has always been a significant issue in the era of deep learning Ouali et al. (2020); Wang et al. (2023e); Zhang et al. (2021b); Chen et al. (2023); Wang et al. (2022a). Considering that GPT-3.5 can provide a reliable evaluation to some extent, to reduce costs, we follow self-instruct (Wang et al., 2022c), which is a methodology that capitalizes on pre-existing knowledge within large language models to generate annotations or outputs through self-generated instructions. to distil data from GPT-3.5 and apply heuristic data filtering strategies to mitigate noise. Specifically, we filter out invalid evaluations from gpt-3.5-turbo with hand-crafted rules. To address position bias, we also filter out inconsistent samples when swapping the orders of responses in the prompt. Despite the utilization of data distilled from GPT-3.5, the active removal of noise enhances the quality of the training data, fostering a more efficient and robust training process for PandaLM.
22
+
23
+ To ensure the reliability of PandaLM, we develop a test dataset that aligns with human preference and covers a wide range of tasks and contexts. The instructions and inputs of test data are sampled from the human evaluation dataset of self-instruct (Wang et al., 2022c), with responses generated by different LLMs and each label independently provided by three different human evaluators. Samples with significant divergences are excluded to ensure the Inter Annotator Agreement (IAA) of each annotator remains larger than 0.85. As illustrated in Table 2, PandaLM-7B showcases robust and competitive performance. Remarkably, the efficacy of PandaLM-70B is even more pronounced,
24
+
25
+ ![](images/3d3b4315c781a1b5f1bcc60d84743b39820db2eed2b0e1de1fd888ccc5a3024a.jpg)
26
+ (a) Comparison Results of GPT-3.5. (b) Comparison Results of GPT-4.
27
+
28
+ ![](images/100fd2986a0fa8fa1c0176a1a2d477ea6096848f3b26c594dd6a1f2938181625.jpg)
29
+ (c) Comparison Results of Human.
30
+
31
+ Figure 1: The models are evaluated and compared using both GPT-3.5, GPT-4 and human annotators. The ‘Win’ count represents the number of responses where models fine-tuned with PandaLM-selected optimal hyperparameters outperform models using Alpaca’s hyperparameters. Conversely, the ‘Lose’ count represents the number of responses where models utilizing Alpaca’s hyperparameters produce superior responses compared with those fine-tuned with the optimal hyperparameters determined by PandaLM. Note that the overall test set comprises 170 instances, and ‘Tie’ scenarios are not considered in this illustration.
32
+
33
+ exceeding the performance metrics of GPT-4. This enhancement is largely attributable to the effective noise mitigation strategies employed during the training phase.
34
+
35
+ Moreover, as illustrated in Figure 1, adopting PandaLM’s selected optimal hyperparameters covering optimizer selection, learning rate, number of training epochs, and learning rate scheduler brings noteworthy improvements. When assessed using GPT-4 with a set of 170 instructions, a group of five open language models, tuned with optimal hyperparameters selected by PandaLM, achieves an average of 47.0 superior responses and 26.2 inferior responses, outperforming those trained using Alpaca’s hyperparameters. Note that the training data remains the same for conducting fair comparisons. Moreover, when these LLMs are evaluated by human experts, using the same set of 170 instructions, they exhibit an average of 79.8 superior responses and 25.2 inferior responses, once again surpassing the performance of models trained with Alpaca’s hyperparameters. The experimental results underline the effectiveness of PandaLM in determining optimal hyperparameters for choosing the best LLMs. In addition, when the fine-tuned LLMs are assessed using the lm-eval (Gao et al., 2021), a unified framework to test LLM on a large number of different traditional evaluation tasks, the results further reinforce the superiority of LLMs optimized by PandaLM.
36
+
37
+ In conclusion, our work delivers three key contributions:
38
+
39
+ • We introduce PandaLM, a privacy-protected judge language model for evaluating and optimizing hyperparameters for LLMs.
40
+ • We create a reliable human-annotated dataset, essential for validating PandaLM’s performance and further research.
41
+ • We make use of PandaLM to optimize the hyperparameters of a series of open-sourced LLMs. In comparison to those LLMs tuned using hyperparameters identified by Alpaca, tuning models with PandaLM-selected hyperparameters yields substantial performance enhancements.
42
+
43
+ # 2 RELATED WORK
44
+
45
+ This section reviews the relevant literature on the topic of hyperparameter optimization and the evaluation of language models.
46
+
47
+ Hyperparameter Optimization The importance of hyperparameter optimization in machine learning (Yu & Zhu, 2020; Falkner et al., 2018; Li et al., 2017; Xu et al., 2023; Wang et al., $2 0 2 3 \mathrm { a }$ ; Wu et al., 2019), particularly in the context of fine-tuning deep learning language models such as BERT (Kenton & Toutanova, 2019) and GPT (Radford et al.), cannot be ignored. For these models, the choice of hyperparameters like the learning rate, batch size, or the number of training epochs can significantly influence their performance (Godbole et al., 2023; Sun et al., 2019; Tunstall et al., 2022). This selection process becomes even more critical when fine-tuning these models on domain-specific tasks, where the optimal set of hyperparameters can vary significantly among different domains (Dodge et al., 2020; Sun et al., 2019).
48
+
49
+ ![](images/6727cfdc958122a0ef304a0c43442c867c67165e90e0942b497693d57b0fa15b.jpg)
50
+ Figure 2: The pipeline of instruction tuning LLMs.
51
+
52
+ Evaluation of Language Models Accurate evaluation of language models is crucial in determining optimal hyperparameters, thus improving the models’ overall performance (Sun et al., 2019; Godbole et al., 2023). Conventional objective metrics like perplexity (Mallio et al., 2023) and accuracy (Xu et al., 2020; Wang et al.; Yang et al., 2022a; Zhong et al., 2023) on downstream tasks (Gao et al., 2021) provide valuable insights, but they may not effectively guide the choice of hyperparameters to enhance LLMs (Rogers et al., 2021) because evaluating LLMs requires other subjective metrics. Advanced language models, such as GPT-4 (OpenAI, 2023) and Bard (Google, 2023), incorporate human evaluations as part of their testing method for LLMs, aiming to better align with human judgements (Wang et al., 2023h). Although human-based evaluation methods offer considerable insight into a model’s performance, they are costly and labor-intensive, making it less feasible for iterative hyperparameter optimization processes. Recent advancements in NLP have brought forth model-based metrics such as BERTScore (Zhang et al., 2019) and MAUVE (Pillutla et al., 2021). While these metrics offer valuable insights, there are significant areas where they may not align perfectly with the objectives of response evaluation. Firstly, BERTScore and MAUVE are engineered to measure the similarity between generated content and reference text. However, they are not inherently designed to discern which of multiple responses is superior. A response is closer to a human-written reference doesn’t necessarily mean it adheres better to given instructions or satisfies a specific context. Secondly, while these metrics yield scores that represent content similarity, they aren’t always intuitive to users. Interpreting these scores and translating them into actionable feedback can be a challenge. In contrast, PandaLM offers a more straightforward approach. It is tailored to directly output the evaluation result in an interpretable manner, making the feedback process transparent and easily understood by humans. In conclusion, while metrics like BERTScore and MAUVE provide valuable insights into content similarity, there is a pressing need for specialized evaluation tools like PandaLM. Tools that not only discern response quality but also do so in a user-friendly, human-comprehensible manner.
53
+
54
+ Subjective qualitative analysis of a model’s outputs, such as its ability to handle ambiguous instructions and provide contextually appropriate responses, is increasingly being recognized as a valuable metric for evaluating models (Zheng et al., 2023). Optimizing hyperparameters with considerations towards these qualitative measures could lead to models that perform more robustly in diverse realworld scenarios. The previous qualitative analysis can be achieved either through human evaluators or through APIs of advanced language models, which is different from our motivation.
55
+
56
+ # 3 METHODOLOGY
57
+
58
+ As shown in Figure 2, the process of instruction tuning begins with a foundation model, which is then fine-tuned using instructions. The performance of each tuned model is evaluated to determine the best output. This involves exploring numerous models, each tuned with different hyperparameters, to identify the optimal one. To facilitate this pipeline, a reliable and automated language model assessment system is essential. To address this, we introduce PandaLM - a judge LLM specifically designed to assess the performance of LLMs fine-tuned with various parameters. Our goal is to identify the superior model from a pool of candidates accurately.
59
+
60
+ ![](images/90649e8c86b3cf72bbebe097b864f94c7c5e2fc02a54f9ad4fd95d4d48ea8f1c.jpg)
61
+ Figure 3: The top 16 words used in the PandaLM-7B evaluation reasons from randomly sampled $8 0 \mathrm { k }$ evaluation outputs. An example of evaluation reason and evaluation outputs can be found in Figure 5. Stop words are filtered.
62
+
63
+ # 3.1 TRAIN DATA COLLECTION AND PREPROCESSING
64
+
65
+ The training data collection aims to create a rich dataset that allows the model to evaluate different responses in a given context and generate an evaluation reason and a reference response using the same context. As demonstrated in Appendix A, each training data instance consists of an input tuple (instruction, input, response1, response2) and an output tuple (evaluation result, evaluation reason, reference response). The instructions and inputs in the input tuple are sampled from the Alpaca 52K dataset (Taori et al., 2023). The response pairs are produced by various instruction-tuned models: LLaMA-7B (Touvron et al., 2023), Bloom-7B (Scao et al., 2022), Cerebras-GPT-6.7B (Dey et al., 2023), OPT-7B (Zhang et al., 2022a), and Pythia-6.9B (Biderman et al., 2023). These models are selected due to their comparable sizes and the public availability of their model weights. Each is fine-tuned using the same instruction data and hyperparameters following Alpaca (Taori et al., 2023). The corresponding output tuple includes an evaluation result, a brief explanation for the evaluation, and a reference response. The evaluation result would be either ‘1’ or $\bullet _ { 2 } \cdot$ , indicating that response 1 or response 2 is better, and ‘Tie’ indicates that two responses are similar in quality. The training prompt of PandaLM is shown at Appendix A.As it is impractical to source millions of output tuples from human annotators, and given that GPT-3.5 is capable of evaluating LLMs to some degree, we follow self-instruct (Wang et al., 2022c) to generate output tuples using GPT-3.5. As illustrated in Figure 3, we design prompts carefully to guide the generation of training data for PandaLM. The goal is to ensure PandaLM not only prioritizes objective response correctness but also emphasizes critical subjective aspects such as relative conciseness, clarity, comprehensiveness, formality, and adherence to instructions. Besides, we encourage PandaLM to identify and rectify issues like logical fallacies, unnecessary repetitions, grammatical inaccuracies, and the absence of context relevance. A heuristic data filtering strategy is then applied to remove noisy data. Specifically, to address the observed inherent bias in GPT-3.5 regarding the order of input responses even with carefully designed prompts, samples from the training dataset are removed if their evaluation results conflict when the orders of input responses are swapped. We finally obtain a filtered dataset containing 300K samples.
66
+
67
+ # 3.2 PANDALM TRAINING
68
+
69
+ In this subsection, we provide details about the training procedure for PandaLM. The backbone of PandaLM is LLaMA model, as it exhibits strong performance on multiple complicated NLP tasks (Beeching et al., 2023).
70
+
71
+ During the fine-tuning phase of PandaLM, we use the standard cross-entropy loss targeting the next token prediction. The model operates in a sequence-to-sequence paradigm without the necessity for a separate classification head. We train PandaLM with the DeepSpeed (Rasley et al., 2020) library, and Zero Redundancy Optimizer (ZeRO) (Rajbhandari et al., 2020; Ren et al., 2021) Stage 2, on 8 NVIDIA A100-SXM4-80GB GPUs. We use the bfloat16 (BF16) computation precision option to further optimize the model’s speed and efficiency. Regarding the training hyperparameters, we apply the AdamW (Loshchilov & Hutter, 2017) optimizer with a learning rate of 2e-5 and a cosine learning rate scheduler. The model is trained for 2 epochs. The training process uses a warmup ratio of 0.03 to avoid large gradients at the beginning of training. We use a batch size of 2 per GPU with all inputs truncated to a maximum of 1024 tokens and employ a gradient accumulation strategy with 8 steps.
72
+
73
+ ![](images/32ef8ad42d3679a9437d7a3a3e6a188496dbb903903b3d9af85e68df0dd729a2.jpg)
74
+ Figure 4: Comparative Visualization of Model Performance. The instruction-tuned models use the same training data and hyperparameters. A directed edge from node A to B indicates model A’s significant superiority over B, while a dashed undirected edge indicates the two models are similar in performance. The number associated with the directed edge (A, B) represents the difference between the number of wins and losses for model A compared to model B. The absence of a number on the dashed undirected edge indicates that the difference between the number of wins and losses for the models is smaller than 5. We swap the order of two responses to perform inference twice on each data. The conflicting evaluation results are then modified to ‘Tie’.
75
+
76
+ # 4 RELIABILITY EVALUATION OF PANDALM
77
+
78
+ To ensure the reliability of PandaLM, we create a test dataset that is labeled by humans and designed to align with human preferences for responses. Each instance of this test dataset consists of one instruction and input, and two responses produced by different instruction-tuned LLMs. The paired responses are provided by LLaMA-7B, Bloom-7B, Cerebras-GPT-6.7B, OPT-7B, and Pythia-6.9B, all instruction tuned using the same instruction data and hyperparameters following Alpaca (Taori et al., 2023). The test data is sampled from the diverse human evaluation dataset of self-instruct (Wang et al., 2022c), which includes data from Grammarly, Wikipedia, National Geographic and nearly one hundred apps or websites. The inputs and labels are solely human-generated and include a range of tasks and contents. Three different human evaluators independently annotate the labels indicating the preferred response. Samples with significant divergences are excluded to ensure the Inter Annotator Agreement (IAA) of each annotator remains larger than 0.85. This is because such samples demand additional knowledge or hard-to-obtain information, making them challenging for humans to evaluate. The filtered test dataset contains 1K samples, while the original unfiltered dataset has 2.5K samples.
79
+
80
+ To maintain high-quality crowdsourcing work, we involve three experts to annotate the same data point concurrently during the annotation process. There is no prior relationship between the experts and the authors. The experts are hired from an annotation company. These experts receive specialized training that goes beyond evaluating response correctness, enabling them to emphasize other crucial aspects like relative conciseness, clarity, comprehensiveness, formality, and adherence to instructions. Furthermore, we guide these annotators in identifying and addressing issues such as logical fallacies, unnecessary repetitions, grammatical inaccuracies, and a lack of contextual relevance. All human ratings are collected consistently within the same session. To ensure clarity and consistency, we provide comprehensive instructions for every annotator. After the trial phase of data annotation, we eliminate some low-quality labeled data. The final IAA amongst the three annotators, as measured by Cohen’s Kappa (Cohen, 1960), yields average scores of 0.85, 0.86, and 0.88 respectively, indicating a relatively high level of reliability for our test dataset. To refine the model’s performance assessment compared to human evaluators, we can use the inter-annotator agreement (IAA) of 0.85 as a benchmark. If our model exceeds this, it indicates strong performance. However, setting a realistic target slightly above this human IAA, say around 0.90, offers a challenging yet achievable goal. The distribution of the test data comprises 105 instances of ties, 422 instances where Response 1 wins, and 472 instances where Response 2 takes the lead. Note that the human-generated dataset has no
81
+
82
+ Table 1: Comparative analysis of evaluation results from various annotation models. The tuple in the table means (#win,#lose,#tie). Specifically, (72,28,11) in the first line of the table indicates that LLaMA-7B outperforms Bloom-7B in 72 responses, underperforms in 28, and matches the quality in 11 responses. The ‘Judged By’ column represents different methods of response evaluation. ‘Human’ indicates that humans evaluate the result, and ‘PandaLM’ indicates that our proposed PandaLM model evaluates the result.
83
+
84
+ Table 2: Comparison between Human Annotation results and Judged Model evaluation results.
85
+
86
+ <table><tr><td>Judged By</td><td>Base Model</td><td>LLaMA-7B</td><td>Bloom-7B</td><td>Cerebras-6.7B</td><td>OPT-7B</td><td>Pythia-6.9B</td></tr><tr><td rowspan="5">Human</td><td>LLaMA-7B</td><td>/</td><td>(72,28,11)</td><td>(80,24,6)</td><td>(71,24,11)</td><td>(58,27,9) (47,49,11)</td></tr><tr><td>Bloom-7B</td><td>(28,72,11)</td><td>/</td><td>(59,30,11)</td><td>(43,35,11)</td><td></td></tr><tr><td>Cerebras-6.7B</td><td>(24,80,6)</td><td>(30,59,11)</td><td>/</td><td>(33,49,9)</td><td>(27,53,11)</td></tr><tr><td>OPT-7B</td><td>(24,71,11)</td><td>(35,43,11)</td><td>(49,33,9)</td><td>/</td><td>(32,53,15)</td></tr><tr><td>Pythia-6.9B</td><td>(27,58,9)</td><td>(49,47,11)</td><td>(53,27,11)</td><td>(53,32,15)</td><td>/</td></tr><tr><td rowspan="5">GPT-3.5</td><td>LLaMA-7B</td><td>/</td><td>(59,19,33)</td><td>(71,13,26) (40,19,41)</td><td>(58,17,31)</td><td>(49,16,29)</td></tr><tr><td>Bloom-7B</td><td>(19,59,33)</td><td>/</td><td></td><td>(36,30,23)</td><td>(33,34,40)</td></tr><tr><td>Cerebras-6.7B</td><td>(13,71,26)</td><td>(19,40,41)</td><td>/</td><td>(24,38,29)</td><td>(22,43,26)</td></tr><tr><td>Pyhia-.BB</td><td>(17.58.3)</td><td></td><td></td><td></td><td>(30,30,40)</td></tr><tr><td></td><td></td><td>(130.3.3)</td><td>(38.2429)</td><td>(30,30,40)</td><td></td></tr><tr><td rowspan="5">GPT-4</td><td>LLaMA-7B</td><td>/</td><td>(58,15,38)</td><td>(69,9,32)</td><td>(58,14,34)</td><td>(52,17,25)</td></tr><tr><td>Bloom-7B</td><td>(15,58,38)</td><td>/</td><td>(47,16,37)</td><td>(35,31,23)</td><td>(32,33,42)</td></tr><tr><td>Cerebras-6.7B</td><td>(9,69,32)</td><td>(16,47,37)</td><td>/</td><td>(23,40,28)</td><td>(17,41,33)</td></tr><tr><td>OPT-7B</td><td>(14,58,34)</td><td>(31,35,23)</td><td>(40,23,28)</td><td>/</td><td>(25,37,38)</td></tr><tr><td>Pythia-6.9B</td><td>(17,52,25)</td><td>(33,32,42)</td><td>(41,17,33)</td><td>(37,25,38)</td><td>/</td></tr><tr><td rowspan="5">PandaLM-7B</td><td>LLaMA-7B</td><td>/</td><td>(46,29,36)</td><td>(68,18,24)</td><td>(52,26,28)</td><td>(35,28,31)</td></tr><tr><td>Bloom-7B</td><td>(29,46,36)</td><td>/</td><td>(50,18,32)</td><td>(36,30,23)</td><td>(36,31,40)</td></tr><tr><td>Cerebras-6.7B</td><td>(18,68,24)</td><td>(18,50,32)</td><td>/</td><td>(28,39,24)</td><td>(24,46,21)</td></tr><tr><td>OPT-7B</td><td>(26,52,28)</td><td>(30,36,23)</td><td>(39,28,24)</td><td>/</td><td>(30,32,38)</td></tr><tr><td>Pythia-6.9B</td><td>(28,35,31)</td><td>(31,36,40)</td><td>(46,24,21)</td><td>(32,30,38)</td><td>/</td></tr></table>
87
+
88
+ <table><tr><td>Judged Model</td><td>Accuracy</td><td>Precision</td><td>Recall</td><td>F1</td></tr><tr><td>GPT-3.5</td><td>0.6296</td><td>0.6195</td><td>0.6359</td><td>0.5820</td></tr><tr><td>GPT-4</td><td>0.6647</td><td>0.6620</td><td>0.6815</td><td>0.6180</td></tr><tr><td>PandaLM-7B</td><td>0.5926</td><td>0.5728</td><td>0.5923</td><td>0.5456</td></tr><tr><td>PandaLM-70B-LoRA</td><td>0.6186</td><td>0.7757</td><td>0.6186</td><td>0.6654</td></tr><tr><td>PandaLM-70B</td><td>0.6687</td><td>0.7402</td><td>0.6687</td><td>0.6923</td></tr></table>
89
+
90
+ personally identifiable information or offensive content, and all annotators receive redundant labor fees.
91
+
92
+ After obtaining the human-labeled test dataset, we can assess and compare the evaluation performances of GPT-3.5, GPT-4, and PandaLM. An interesting observation from Table 1 is the shared similar partial order graph between GPT-3.5, GPT-4, PandaLM-7B, and humans. Furthermore, Figure 4 illustrates directed orders of model superiority (if model A outperforms model B, a directed edge from A to B is drawn; if model A and model B perform similarly, a dashed line from A to B is drawn.), and provides a visual representation of comparative model effectiveness. The experimental results indicate similarities in the preferences of GPT-3.5, GPT-4, PandaLM-7B, and humans. Note that for PandaLM, GPT-3.5, and GPT-4, we swap the input response order and infer twice to procure the final evaluation output. The conflicting evaluation results are revised to ‘Tie’.
93
+
94
+ As shown in Table 2, we conduct a statistical analysis comparing the accuracy, precision, recall, and F1-score of GPT-3.5, GPT-4, and PandaLM against human annotations. The performance of PandaLM-70B even surpasses that of GPT-4. The results indicate the efficacy of removing noise in training data and the choosing of foundational model architectures and instructions.
95
+
96
+ To prove the robustness and adaptability of PandaLM across distribution shifts, we also concentrate our evaluations on distinct areas, with a particular emphasis on the legal (LSAT) and biological (PubMedQA and BioASQ) domains. The introduction of the used datasets can be found at Appendix D. Note that for generating responses, we employ open-sourced language models such as Vicuna and Alpaca. Due to constraints in time, GPT-4 is adopted to produce the gold standard answers (win/tie/lose of responses) instead of human annotators. The results illustrated in Table 3 underscore PandaLM’s prowess not only in general contexts but also in specific domains such as law (via LSAT) and biology (via PubMedQA and BioASQ). Since we are addressing a three-category classification task (win/lose/tie), where a random guess would lead to around $33 \%$ in the precision, recall, and F1 score. PandaLM-7B’s results are notably above this level. To further validate PandaLM-7B, we conducted a human evaluation with 30 samples on the BioASQ evaluation. The human evaluation showed that both PandaLM-7B and GPT-4 tended to favor Vicuna over Alpaca, indicating a consistent trend in their evaluations. The marked improvement in performance as the model scales up reaffirms PandaLM’s promise across varied applications, further emphasizing its reliability amidst different content distributions.
97
+
98
+ We further investigate the performance of PandaLM by contrasting its efficacy when trained solely on numerical comparisons (win/tie/lose) — akin to a traditional reward model — with the holistic approach of the standard PandaLM that incorporates evaluation reasons and reference responses. As shown in Table 4, it become evident that the evaluation reasons and reference responses significantly aid LLMs in understanding the evaluation tasks. Note that in Appendix G, the results clearly demonstrate that a smaller model, when precisely tuned, has the capability to outperform a larger, untuned model in evaluation metrics. This finding emphasizes the significant impact of targeted tuning on model performance in evaluation scenarios. We also provide an analysis on PandaLM across model shifts in Appendix K.
99
+
100
+ Table 3: Performance evaluation of PandaLM across diverse domains. The table showcases the accuracy, precision, recall, and F1 scores achieved by PandaLM of two different sizes (finetuned from LLaMA-7B and LLaMA2-70B) on three distinct datasets: LSAT, PubMedQA, and BioASQ. These datasets are representative of the legal and biological domains, chosen to demonstrate the robustness and adaptability of PandaLM to different distribution shifts. It’s worth noting that GPT-4 was employed for generating the gold standard answers instead of human annotations.
101
+
102
+ <table><tr><td></td><td>Accuracy</td><td>Precision</td><td>Recall</td><td>F1 Score</td></tr><tr><td>LSAT (PandaLM-7B)</td><td>0.4717</td><td>0.7289</td><td>0.4717</td><td>0.5345</td></tr><tr><td>LSAT (PandaLM-70B)</td><td>0.6604</td><td>0.7625</td><td>0.6604</td><td>0.6654</td></tr><tr><td>PubMedQA (PandaLM-7B)</td><td>0.6154</td><td>0.8736</td><td>0.6154</td><td>0.6972</td></tr><tr><td>PubMedQA (PandaLM-70B)</td><td>0.7692</td><td>0.7811</td><td>0.7692</td><td>0.7663</td></tr><tr><td>BioASQ(PandaLM-7B)</td><td>0.5152</td><td>0.7831</td><td>0.5152</td><td>0.5602</td></tr><tr><td>BioASQ(PandaLM-70B)</td><td>0.7727</td><td>0.8076</td><td>0.7727</td><td>0.7798</td></tr></table>
103
+
104
+ Table 4: Comparison of PandaLM performance w/ and w/o reasons and references.
105
+
106
+ <table><tr><td></td><td>Accuracy</td><td>Precision</td><td>Recall</td><td>F1 Score</td></tr><tr><td>PandaLM-7B with only win/tie/lose</td><td>0.4725</td><td>0.4505</td><td>0.4725</td><td>0.3152</td></tr><tr><td>PandaLM-7B</td><td>0.5926</td><td>0.5728</td><td>0.5923</td><td>0.5456</td></tr></table>
107
+
108
+ Table 5: Evaluation of the effectiveness of PandaLM’s selected hyperparameters and Alpaca’s hyperparameters. The tuple in the table means (#win,#lose,#tie). Specifically, (45,26,99) in the first line of the table indicates that PandaLM’s hyperparameter-tuned LLaMA-7B outperforms Alpaca’s version in 45 responses, underperforms in 26, and matches the quality in 99 instances. The ‘Judged By’ column represents different methods of response evaluation.
109
+
110
+ <table><tr><td>Judge Model</td><td>LLaMA-7B</td><td>Bloom-7B</td><td>Cerebras-6.7B</td><td>OPT-7B</td><td>Pythia-6.9B</td></tr><tr><td>GPT-3.5</td><td>(45,26.99)</td><td>(48,24,98)</td><td>(58,21,91)</td><td>(48,34,88)</td><td>(59,20,91)</td></tr><tr><td>GPT-4</td><td>(40,17,113)</td><td>(44,34,92)</td><td>(60,20,90)</td><td>(39,30,101)</td><td>(52,30,88)</td></tr><tr><td>Human</td><td>(82,21,67)</td><td>(79,23.68)</td><td>(88,25,57)</td><td>(68,26,76)</td><td>(82,31,57)</td></tr></table>
111
+
112
+ In addition, beyond performance metrics, PandaLM introduces unique advantages that are not present in models like GPT-3.5 and GPT-4. It offers open-source availability, enabling reproducibility, and protecting data privacy. Furthermore, it provides unlimited access, removing any restrictions that might hinder comprehensive evaluation and application.
113
+
114
+ # 5 USING PANDALM TO INSTRUCTION TUNE LLMS
115
+
116
+ To highlight the effectiveness of using PandaLM for instruction tuning LLMs, we compare the performance of models tuned with PandaLM’s selected optimal hyperparameters against those tuned with Alpaca’s parameters using GPT-3.5, GPT-4, and human experts. It is noteworthy that PandaLM7B is employed for this comparison due to considerations regarding computational resources. Given the proven effectiveness of PandaLM-7B, there is a grounded expectation that the performance of PandaLM-70B will exhibit further enhancement. This comparison evaluates multiple tuned LLMs: LLaMA-7B, Bloom-7B, Cerebras-GPT-6.7B, OPT-7B, and Pythia-6.9B. The assessment is conducted on a validation set comprising 170 distinct instructions and inputs obtained from our 1K test set introduced in Section 4. Alpaca’s tuning protocol involves training for three epochs with the final iteration’s checkpoints being used. It uses the AdamW (Loshchilov & Hutter, 2017) optimizer with a learning rate of 2e-5 and a cosine learning rate scheduler. We perform a wider range of hyperparamters to tune LLMs using PandaLM-7B. Specifically, we explore checkpoints from each epoch (ranging from epoch 1 to epoch 5), four different learning rates (2e-6, 1e-5, 2e-5, 2e-4), two types of optimizers (SGD (Goodfellow et al., 2016) and AdamW), and two learning rate schedulers (cosine and linear). In total, this creates a configuration space of 80 different possibilities per model.
117
+
118
+ We search for optimal hyperparameters among the 80 configurations. These are divided into four blocks, each containing 20 configurations. Sequential comparisons identify the best configuration in each block. The top configurations from each block are then compared to determine the overall best configuration. We repeat each comparison twice for robustness and carry out 800 comparisons in total. The conflicting evaluation results are modified to ‘Tie’. Key insights from our tuning process include: Bloom-7B performs best with SGD, a learning rate of 2e-5, and a cosine schedule over 5 epochs. Cerebras-GPT-6.7B also favors SGD with the same learning rate but with a linear schedule. LLaMA-7B prefers AdamW, a learning rate of 1e-5, and a linear schedule over 4 epochs. OPT-6.7B achieves top results with AdamW, a learning rate of 2e-5, and a linear scheduler over 5 epochs. Pythia-6.9B prefers SGD, a learning rate of 1e-5, a cosine schedule, and 5 epochs. This highlights the importance of customized hyperparameter tuning for different models to achieve peak performance. We also provide the analysis on data size, quality and LoRA in Appendix E and Appedix F.
119
+
120
+ As illustrated in Table 5, for GPT-3.5, GPT-4, and human, all base models achieve superior performance when tuned with PandaLM’s selected hyperparameters compared to Alpaca’s hyperparameters. Note that the procedure of switching the order of input responses, as applied for PandaLM, is also implemented for GPT-3.5 and GPT-4 to acquire more robust evaluation results. This outcome not only supports the claim that PandaLM-7B can enhance the performance of models but also highlights its potential to further improve various large language models. Besides, as shown in Appendix B, based on PandaLM’s evaluation, the model demonstrating superior performance is LLaMA-PandaLM. Note that the base foundation model’s characteristics can be a significant factor in performance, as evidenced by LLaMA models securing the top two positions. The ranking pattern observed aligns closely with the base model rankings presented in Figure 4. We also provide a hyperparameter optimization analysis in Appendix J.
121
+
122
+ Moreover, Table 6 in Appendix C compares fine-tuned LLMs on various traditional tasks with lm-eval (Gao et al., 2021). Interestingly, while most language models display enhanced performance with PandaLM finetuning, Cerebras experiences a dip. This underscores the value of subjective evaluation (win/tie/lose of responses), as evaluations from humans, GPT-4, and GPT-3.5 all indicate superior performance for Cerebras with PandaLM.
123
+
124
+ # 6 LIMITATIONS
125
+
126
+ While the outcomes of our study are encouraging, we discuss several limitations here. Firstly, the selected range of hyperparameters used in this work is based on common practice and prior literature, and thus may not encompass the absolute optimal hyperparameters. While extending the search bond will inevitably increase the computational cost. While the core data, derived from GPT-3.5, may not fully resonate with human preferences, it’s essential to recognize that the efficacy of LLMs hinges not just on training data but also on foundational model architectures and instructions. Currently, our emphasis is primarily on outcome-based evaluation, which is indeed resource-intensive. However, integrating behavior prediction (e.g., using rational analysis Lu et al. (2022); Wang et al. (2023d; 2020); Yang et al. (2021; 2023a)) into an evaluation framework could offer a more comprehensive understanding of LLM performance. For instance, analyzing and evaluating the extended text outputs of an untuned LLM can help predict how a tuned version might behave in various scenarios. This approach could provide a more efficient and insightful way to balance resource-heavy outcome assessments. Besides, we only research on supervised training of LLMs, but the realistic data could be imbalanced or unlabeled, hence semi-supervised Wang et al. (2023e); Chen et al. (2023); Wang et al. (2022b), noisy Zhang et al. (2022b); Chen et al. (2024) and imbalanced training Yang et al. (2022b); Wang et al. (2023f;g) are also our future directions.
127
+
128
+ # 7 CONCLUSION
129
+
130
+ In our exploration of hyperparameter optimization, we apply PandaLM: an automatic and reliable judge model for the tuning of LLMs. Our findings demonstrate that the use of PandaLM is feasible and consistently produces models of superior performance compared to those tuned with Alpaca’s default parameters. We are dedicated to continually enhancing PandaLM by expanding its capacity to support larger models and analyzing its intrinsic features, thereby developing increasingly robust versions of the judging model in the future.
131
+
132
+ # ACKNOWLEDGEMENT
133
+
134
+ We would like to thank the anonymous reviewers for their insightful comments and suggestions to help improve the paper. This publication has emanated from research conducted with the financial support of the Pioneer and “Leading Goose” R&D Program of Zhejiang under Grant Number 2022SDXHDX0003 and the National Natural Science Foundation of China Key Program under Grant Number 62336006.
135
+
136
+ # REFERENCES
137
+
138
+ Donnie Adams and Kee-Man Chuah. Artificial intelligence-based tools in research writing: Current trends and future potentials. Artificial Intelligence in Higher Education, pp. 169–184, 2022.
139
+ Rohan Anil, Andrew M Dai, Orhan Firat, Melvin Johnson, Dmitry Lepikhin, Alexandre Passos, Siamak Shakeri, Emanuel Taropa, Paige Bailey, Zhifeng Chen, et al. Palm 2 technical report. arXiv preprint arXiv:2305.10403, 2023.
140
+ Edward Beeching, Sheon Han, Nathan Lambert, Nazneen Rajani, Omar Sanseviero, Lewis Tunstall, and Thomas Wolf. Open llm leaderboard. https://huggingface.co/spaces/ HuggingFaceH4/open_llm_leaderboard, 2023.
141
+ Stella Biderman, Hailey Schoelkopf, Quentin Anthony, Herbie Bradley, Kyle O’Brien, Eric Hallahan, Mohammad Aflah Khan, Shivanshu Purohit, USVSN Sai Prashanth, Edward Raff, et al. Pythia: A suite for analyzing large language models across training and scaling. arXiv preprint arXiv:2304.01373, 2023.
142
+ Som Biswas. Chatgpt and the future of medical writing, 2023.
143
+ Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
144
+ Yupeng Chang, Xu Wang, Jindong Wang, Yuan Wu, Kaijie Zhu, Hao Chen, Linyi Yang, Xiaoyuan Yi, Cunxiang Wang, Yidong Wang, et al. A survey on evaluation of large language models. arXiv preprint arXiv:2307.03109, 2023.
145
+ Sahil Chaudhary. Code alpaca: An instruction-following llama model for code generation. https: //github.com/sahil280114/codealpaca, 2023.
146
+ Hao Chen, Ran Tao, Yue Fan, Yidong Wang, Jindong Wang, Bernt Schiele, Xing Xie, Bhiksha Raj, and Marios Savvides. Softmatch: Addressing the quantity-quality trade-off in semi-supervised learning. 2023.
147
+ Hao Chen, Jindong Wang, Lei Feng, Xiang Li, Yidong Wang, Xing Xie, Masashi Sugiyama, Rita Singh, and Bhiksha Raj. A general framework for learning from weak supervision. arXiv preprint arXiv:2402.01922, 2024.
148
+ Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E Gonzalez, et al. Vicuna: An open-source chatbot impressing gpt-4 with $9 0 \% *$ chatgpt quality. See https://vicuna. lmsys. org (accessed 14 April 2023), 2023.
149
+ Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
150
+ Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
151
+ Jacob Cohen. Kappa: Coefficient of concordance. Educ Psych Measurement, 20(37):37–46, 1960.
152
+
153
+ Nolan Dey, Gurpreet Gosal, Hemant Khachane, William Marshall, Ribhu Pathria, Marvin Tom, Joel Hestness, et al. Cerebras-gpt: Open compute-optimal language models trained on the cerebras wafer-scale cluster. arXiv preprint arXiv:2304.03208, 2023.
154
+ Shizhe Diao, Rui Pan, Hanze Dong, KaShun Shum, Jipeng Zhang, Wei Xiong, and Tong Zhang. Lmflow: An extensible toolkit for finetuning and inference of large foundation models. https: //optimalscale.github.io/LMFlow/, 2023.
155
+ Jesse Dodge, Gabriel Ilharco, Roy Schwartz, Ali Farhadi, Hannaneh Hajishirzi, and Noah Smith. Fine-tuning pretrained language models: Weight initializations, data orders, and early stopping. arXiv preprint arXiv:2002.06305, 2020.
156
+ Qingxiu Dong, Lei Li, Damai Dai, Ce Zheng, Zhiyong Wu, Baobao Chang, Xu Sun, Jingjing Xu, and Zhifang Sui. A survey on in-context learning. arXiv preprint arXiv:2301.00234, 2022.
157
+ Stefan Falkner, Aaron Klein, and Frank Hutter. Bohb: Robust and efficient hyperparameter optimization at scale. In International Conference on Machine Learning, pp. 1437–1446. PMLR, 2018.
158
+ Leo Gao, Jonathan Tow, Stella Biderman, Sid Black, Anthony DiPofi, Charles Foster, Laurence Golding, Jeffrey Hsu, Kyle McDonell, Niklas Muennighoff, Jason Phang, Laria Reynolds, Eric Tang, Anish Thite, Ben Wang, Kevin Wang, and Andy Zou. A framework for few-shot language model evaluation, September 2021. URL https://doi.org/10.5281/zenodo.5371628.
159
+ Varun Godbole, George E. Dahl, Justin Gilmer, Christopher J. Shallue, and Zachary Nado. Deep learning tuning playbook, 2023. URL http://github.com/google-research/tuning_ playbook. Version 1.0.
160
+ Ian Goodfellow, Yoshua Bengio, Aaron Courville, and Yoshua Bengio. Deep learning, volume 1. MIT Press, 2016.
161
+ Google. Bard. 2023.
162
+ Zishan Guo, Renren Jin, Chuang Liu, Yufei Huang, Dan Shi, Linhao Yu, Yan Liu, Jiaxuan Li, Bojian Xiong, Deyi Xiong, et al. Evaluating large language models: A comprehensive survey. arXiv preprint arXiv:2310.19736, 2023.
163
+ Lynette Hirschman and Robert Gaizauskas. Natural language question answering: the view from here. natural language engineering, 7(4):275–300, 2001.
164
+ Edward J Hu, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, Weizhu Chen, et al. Lora: Low-rank adaptation of large language models. In International Conference on Learning Representations.
165
+ Yunjie Ji, Yong Deng, Yiping Peng Yan Gong, Qiang Niu, Lei Zhang, Baochang Ma, and Xiangang Li. Exploring the impact of instruction data scaling on large language models: An empirical study on real-world use cases. arXiv preprint arXiv:2303.14742, 2023.
166
+ Jacob Devlin Ming-Wei Chang Kenton and Lee Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of NAACL-HLT, pp. 4171– 4186, 2019.
167
+ Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. Natural questions: a benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:453–466, 2019.
168
+ Lisha Li, Kevin Jamieson, Giulia DeSalvo, Afshin Rostamizadeh, and Ameet Talwalkar. Hyperband: A novel bandit-based approach to hyperparameter optimization. The Journal of Machine Learning Research, 18(1):6765–6816, 2017.
169
+ Richard Liaw, Eric Liang, Robert Nishihara, Philipp Moritz, Joseph E Gonzalez, and Ion Stoica. Tune: A research platform for distributed model selection and training. arXiv preprint arXiv:1807.05118, 2018.
170
+
171
+ Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
172
+
173
+ Jinghui Lu, Linyi Yang, Brian Mac Namee, and Yue Zhang. A rationale-centric framework for human-in-the-loop machine learning. arXiv preprint arXiv:2203.12918, 2022.
174
+ Carlo A Mallio, Andrea C Sertorio, Caterina Bernetti, and Bruno Beomonte Zobel. Large language models for structured reporting in radiology: performance of gpt-4, chatgpt-3.5, perplexity and bing. La radiologia medica, pp. 1–5, 2023.
175
+ OpenAI. Gpt-4 technical report. 2023.
176
+ Yassine Ouali, Céline Hudelot, and Myriam Tami. An overview of deep semi-supervised learning. arXiv preprint arXiv:2006.05278, 2020.
177
+ Baolin Peng, Chunyuan Li, Pengcheng He, Michel Galley, and Jianfeng Gao. Instruction tuning with gpt-4. arXiv preprint arXiv:2304.03277, 2023.
178
+ Krishna Pillutla, Swabha Swayamdipta, Rowan Zellers, John Thickstun, Sean Welleck, Yejin Choi, and Zaid Harchaoui. Mauve: Measuring the gap between neural text and human text using divergence frontiers. Advances in Neural Information Processing Systems, 34:4816–4828, 2021.
179
+ Alec Radford, Karthik Narasimhan, Tim Salimans, Ilya Sutskever, et al. Improving language understanding by generative pre-training.
180
+ Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. Zero: Memory optimizations toward training trillion parameter models. In SC20: International Conference for High Performance Computing, Networking, Storage and Analysis, pp. 1–16. IEEE, 2020.
181
+ Jeff Rasley, Samyam Rajbhandari, Olatunji Ruwase, and Yuxiong He. Deepspeed: System optimizations enable training deep learning models with over 100 billion parameters. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 3505–3506, 2020.
182
+ Jie Ren, Samyam Rajbhandari, Reza Yazdani Aminabadi, Olatunji Ruwase, Shuangyan Yang, Minjia Zhang, Dong Li, and Yuxiong He. Zero-offload: Democratizing billion-scale model training. In USENIX Annual Technical Conference, pp. 551–564, 2021.
183
+ Anna Rogers, Olga Kovaleva, and Anna Rumshisky. A primer in bertology: What we know about how bert works. Transactions of the Association for Computational Linguistics, 8:842–866, 2021.
184
+ Teven Le Scao, Angela Fan, Christopher Akiki, Ellie Pavlick, Suzana Ilic, Daniel Hesslow, Roman ´ Castagné, Alexandra Sasha Luccioni, François Yvon, Matthias Gallé, et al. Bloom: A 176bparameter open-access multilingual language model. arXiv preprint arXiv:2211.05100, 2022.
185
+ Anastasia Shimorina and Anya Belz. The human evaluation datasheet: A template for recording details of human evaluation experiments in NLP. In Proceedings of the 2nd Workshop on Human Evaluation of NLP Systems (HumEval), pp. 54–75, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.humeval-1.6. URL https: //aclanthology.org/2022.humeval-1.6.
186
+ Felix Stahlberg. Neural machine translation: A review. Journal of Artificial Intelligence Research, 69:343–418, 2020.
187
+ Chi Sun, Xipeng Qiu, Yige Xu, and Xuanjing Huang. How to fine-tune bert for text classification? In Chinese Computational Linguistics: 18th China National Conference, CCL 2019, Kunming, China, October 18–20, 2019, Proceedings 18, pp. 194–206. Springer, 2019.
188
+ Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International conference on machine learning, pp. 6105–6114. PMLR, 2019.
189
+ Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. https://github.com/tatsu-lab/stanford_alpaca, 2023.
190
+
191
+ Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023.
192
+
193
+ Lewis Tunstall, Leandro Von Werra, and Thomas Wolf. Natural language processing with transformers. " O’Reilly Media, Inc.", 2022.
194
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017.
195
+ Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. In International Conference on Learning Representations.
196
+ Chi Wang, Susan Xueqing Liu, and Ahmed H Awadallah. Cost-effective hyperparameter optimization for large language model generation inference. arXiv preprint arXiv:2303.04673, 2023a.
197
+ Cunxiang Wang, Shuailong Liang, Yue Zhang, Xiaonan Li, and Tian Gao. Does it make sense? and why? a pilot study for sense making and explanation, 2020.
198
+ Cunxiang Wang, Pai Liu, and Yue Zhang. Can generative pre-trained language models serve as knowledge bases for closed-book qa?, 2021.
199
+ Cunxiang Wang, Sirui Cheng, Qipeng Guo, Yuanhao Yue, Bowen Ding, Zhikun Xu, Yidong Wang, Xiangkun Hu, Zheng Zhang, and Yue Zhang. Evaluating open-QA evaluation. In Thirty-seventh Conference on Neural Information Processing Systems Datasets and Benchmarks Track, 2023b. URL https://openreview.net/forum?id $=$ UErNpveP6R.
200
+ Cunxiang Wang, Xiaoze Liu, Yuanhao Yue, Xiangru Tang, Tianhang Zhang, Cheng Jiayang, Yunzhi Yao, Wenyang Gao, Xuming Hu, Zehan Qi, Yidong Wang, Linyi Yang, Jindong Wang, Xing Xie, Zheng Zhang, and Yue Zhang. Survey on factuality in large language models: Knowledge, retrieval and domain-specificity, 2023c.
201
+ Cunxiang Wang, Haofei Yu, and Yue Zhang. RFiD: Towards rational fusion-in-decoder for open-domain question answering. In Anna Rogers, Jordan Boyd-Graber, and Naoaki Okazaki (eds.), Findings of the Association for Computational Linguistics: ACL 2023, pp. 2473–2481, Toronto, Canada, July 2023d. Association for Computational Linguistics. doi: 10.18653/v1/2023. findings-acl.155. URL https://aclanthology.org/2023.findings-acl.155.
202
+ Yidong Wang, Hao Chen, Yue Fan, Wang Sun, Ran Tao, Wenxin Hou, Renjie Wang, Linyi Yang, Zhi Zhou, Lan-Zhe Guo, Heli Qi, Zhen Wu, Yu-Feng Li, Satoshi Nakamura, Wei Ye, Marios Savvides, Bhiksha Raj, Takahiro Shinozaki, Bernt Schiele, Jindong Wang, Xing Xie, and Yue Zhang. Usb: A unified semi-supervised learning benchmark for classification. In Thirty-sixth Conference on Neural Information Processing Systems Datasets and Benchmarks Track, 2022a. doi: 10.48550/ARXIV.2208.07204. URL https://arxiv.org/abs/2208.07204.
203
+ Yidong Wang, Hao Wu, Ao Liu, Wenxin Hou, Zhen Wu, Jindong Wang, Takahiro Shinozaki, Manabu Okumura, and Yue Zhang. Exploiting unlabeled data for target-oriented opinion words extraction. arXiv preprint arXiv:2208.08280, 2022b.
204
+ Yidong Wang, Hao Chen, Qiang Heng, Wenxin Hou, Yue Fan, , Zhen Wu, Jindong Wang, Marios Savvides, Takahiro Shinozaki, Bhiksha Raj, Bernt Schiele, and Xing Xie. Freematch: Self-adaptive thresholding for semi-supervised learning. 2023e.
205
+ Yidong Wang, Zhuohao Yu, Jindong Wang, Qiang Heng, Hao Chen, Wei Ye, Rui Xie, Xing Xie, and Shikun Zhang. Exploring vision-language models for imbalanced learning. International Journal of Computer Vision, 2023f.
206
+ Yidong Wang, Bowen Zhang, Wenxin Hou, Zhen Wu, Jindong Wang, and Takahiro Shinozaki. Margin calibration for long-tailed visual recognition. In Asian Conference on Machine Learning, pp. 1101–1116. PMLR, 2023g.
207
+ Yiming Wang, Zhuosheng Zhang, and Rui Wang. Element-aware summarization with large language models: Expert-aligned evaluation and chain-of-thought method. arXiv preprint arXiv:2305.13412, 2023h.
208
+ Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language model with self generated instructions. arXiv preprint arXiv:2212.10560, 2022c.
209
+ Jia Wu, Xiu-Yun Chen, Hao Zhang, Li-Dong Xiong, Hang Lei, and Si-Hao Deng. Hyperparameter optimization for machine learning models based on bayesian optimization. Journal of Electronic Science and Technology, 17(1):26–40, 2019.
210
+ Canwen Xu, Daya Guo, Nan Duan, and Julian McAuley. Baize: An open-source chat model with parameter-efficient tuning on self-chat data. arXiv preprint arXiv:2304.01196, 2023.
211
+ Liang Xu, Hai Hu, Xuanwei Zhang, Lu Li, Chenjie Cao, Yudong Li, Yechen Xu, Kai Sun, Dian Yu, Cong Yu, et al. Clue: A chinese language understanding evaluation benchmark. In Proceedings of the 28th International Conference on Computational Linguistics, pp. 4762–4772, 2020.
212
+ Linyi Yang, Jiazheng Li, Pádraig Cunningham, Yue Zhang, Barry Smyth, and Ruihai Dong. Exploring the efficacy of automatically generated counterfactuals for sentiment analysis. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 306–316, 2021.
213
+ Linyi Yang, Shuibai Zhang, Libo Qin, Yafu Li, Yidong Wang, Hanmeng Liu, Jindong Wang, Xing Xie, and Yue Zhang. Glue-x: Evaluating natural language understanding models from an out-ofdistribution generalization perspective. arXiv preprint arXiv:2211.08073, 2022a.
214
+ Linyi Yang, Yaoxian Song, Xuan Ren, Chenyang Lyu, Yidong Wang, Jingming Zhuo, Lingqiao Liu, Jindong Wang, Jennifer Foster, and Yue Zhang. Out-of-distribution generalization in natural language processing: Past, present, and future. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 4533–4559, 2023a.
215
+ Linyi Yang, Shuibai Zhang, Zhuohao Yu, Guangsheng Bao, Yidong Wang, Jindong Wang, Ruochen Xu, Wei Ye, Xing Xie, Weizhu Chen, et al. Supervised knowledge makes large language models better in-context learners. arXiv preprint arXiv:2312.15918, 2023b.
216
+ Lu Yang, He Jiang, Qing Song, and Jun Guo. A survey on long-tailed visual recognition. International Journal of Computer Vision, 130(7):1837–1872, 2022b.
217
+ Tong Yu and Hong Zhu. Hyper-parameter optimization: A review of algorithms and applications. arXiv preprint arXiv:2003.05689, 2020.
218
+ Zhuohao Yu, Chang Gao, Wenjin Yao, Yidong Wang, Wei Ye, Jindong Wang, Xing Xie, Yue Zhang, and Shikun Zhang. Kieval: A knowledge-grounded interactive evaluation framework for large language models. arXiv preprint arXiv:2402.15043, 2024.
219
+ Aohan Zeng, Xiao Liu, Zhengxiao Du, Zihan Wang, Hanyu Lai, Ming Ding, Zhuoyi Yang, Yifan Xu, Wendi Zheng, Xiao Xia, et al. Glm-130b: An open bilingual pre-trained model. arXiv preprint arXiv:2210.02414, 2022a.
220
+ Zhengran Zeng, Hanzhuo Tan, Haotian Zhang, Jing Li, Yuqun Zhang, and Lingming Zhang. An extensive study on pre-trained models for program understanding and generation. In Sukyoung Ryu and Yannis Smaragdakis (eds.), ISSTA ’22: 31st ACM SIGSOFT International Symposium on Software Testing and Analysis, Virtual Event, South Korea, July 18 - 22, 2022, pp. 39–51. ACM, 2022b. doi: 10.1145/3533767.3534390. URL https://doi.org/10.1145/3533767. 3534390.
221
+ Chen Zhang, Yu Xie, Hang Bai, Bin Yu, Weihong Li, and Yuan Gao. A survey on federated learning. Knowledge-Based Systems, 216:106775, 2021a.
222
+ Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, et al. Opt: Open pre-trained transformer language
223
+
224
+ models. arXiv preprint arXiv:2205.01068, 2022a.
225
+
226
+ Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q Weinberger, and Yoav Artzi. Bertscore: Evaluating text generation with bert. In International Conference on Learning Representations, 2019. Xin Zhang, Guangwei Xu, Yueheng Sun, Meishan Zhang, and Pengjun Xie. Crowdsourcing learning as domain adaptation: A case study on named entity recognition. In Chengqing Zong, Fei Xia, Wenjie Li, and Roberto Navigli (eds.), Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 5558–5570, Online, August 2021b. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.432. URL https://aclanthology.org/2021.acl-long.432. Xin Zhang, Guangwei Xu, Yueheng Sun, Meishan Zhang, Xiaobin Wang, and Min Zhang. Identifying Chinese opinion expressions with extremely-noisy crowdsourcing annotations. In Smaranda Muresan, Preslav Nakov, and Aline Villavicencio (eds.), Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2801–2813, Dublin, Ireland, May 2022b. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long. 200. URL https://aclanthology.org/2022.acl-long.200. Xin Zhang, Zehan Li, Yanzhao Zhang, Dingkun Long, Pengjun Xie, Meishan Zhang, and Min Zhang. Language models are universal embedders. arXiv preprint arXiv:2310.08232, 2023. Lianmin Zheng, Ying Sheng, Wei-Lin Chiang, Hao Zhang, Joseph Gonzalez, E., and Ion Stoica. Chatbot arena: Benchmarking llms in the wild with elo ratings. GitHub repository, 2023. Qihuang Zhong, Liang Ding, Juhua Liu, Bo Du, and Dacheng Tao. Can chatgpt understand too? a comparative study on chatgpt and fine-tuned bert. arXiv preprint arXiv:2302.10198, 2023.
227
+
228
+ ![](images/c42cbc597eec12e6adbb54ef49658b3ca6d71242f74fb0d8448ba9f095dde23f.jpg)
229
+ Figure 5: A training data example for PandaLM.
230
+ Figure 6: The prompt for training PandaLM.
231
+
232
+ Below are two responses for a given task. The task is defined by the Instruction with an Input that provides further context. Evaluate the responses and generate a reference answer for the task.
233
+
234
+ ### Instruction: {instruction} ### Input: {input}
235
+
236
+ ### Response 1: {response 1, generated by a candidate model} ### Response 2: {response 2, generated by another candidate model}
237
+
238
+ ### Evaluation: {evaluation result} {evaluation reason}
239
+
240
+ # ### Reference:
241
+
242
+ {a reference response for the instruction}
243
+
244
+ # A TRAINING PROMPT DETAILS
245
+
246
+ We introduce the detailed prompt of training PandaLM in Figure 6.
247
+
248
+ # B DIRECTED ACYCLIC GRAPH DEPICTING THE MIXTURE RANKING OF MODELS TRAINED USING BOTH ALPACA’S AND PANDALM’S HYPERPARAMETERS.
249
+
250
+ A directed acyclic graph (DAG) is presented in Figure 7, illustrating the relative rankings of various models fine-tuned with different sets of hyperparameters. Notably, this ranking differs from those in Figure4, due to the variance in the test data: the test data for 7 is a sampled subset from that used in Figure4 which is deliberately chosen to ensure a high Inter-Annotator Agreement (IAA). A discernible pattern emerges from the rankings: models fine-tuned using PandaLM’s hyperparameters consistently outshine their counterparts fine-tuned with Alpaca’s. The top-rated model is PandaLM-LLaMA, followed by Alpaca-LLaMA, PandaLM-Bloom, PandaLM-Pythia, PandaLM-OPT, PandaLM-CerebrasGPT, Alpaca-OPT, Alpaca-Bloom, Alpaca-Pythia, and Alpaca-Cerebras-GPT, in descending order of performance. This juxtaposition accentuates the effectiveness of PandaLM’s hyperparameter selection in improving model performance, as models optimized with PandaLM consistently rank higher than those using Alpaca’s hyperparameters in the hybrid ranking. These findings underscore the potential of PandaLM as a powerful tool in enhancing the performance of large language models, further supporting the assertion of its efficacy.
251
+
252
+ ![](images/d3ffdc81b5c50b69d1443437173c8677e0358cae6d294f1a1d00e5ee921decef.jpg)
253
+ Figure 7: Directed Acyclic Graph depicting the mixture ranking of models trained using both Alpaca’s and PandaLM’s hyperparameters. The models are ranked from strongest to weakest in the following order: PandaLM-LLaMA, Alpaca-LLaMA, PandaLM-Bloom, PandaLM-Pythia, PandaLM-OPT, PandaLM-Cerebras-GPT, Alpaca-OPT, Alpaca-Bloom, Alpaca-Pythia, Alpaca-Cerebras-GPT.
254
+
255
+ Table 6: Comparison on several downstream tasks using lm-eval(Gao et al., 2021) between foundation models fine-tuned on Alpaca’s hyperparameters, and foundation models fine-tuned with PandaLM. Note that the MMLU task consists of 57 subtasks, which means providing a comprehensive standard deviation here is not feasible.
256
+
257
+ <table><tr><td></td><td>ARC-Challenge-acc_norm(25-shot)</td><td>Hellaswag-acc_norm(10-shot)</td><td>MMLU-average-acc(5-shot)</td><td>TruthfulQA-mc2(0-shot)</td><td>Average</td></tr><tr><td>llama-7b original</td><td>0.4923±0.0146</td><td>0.7583±0.0043</td><td>0.3306</td><td>0.3703±0.0141</td><td>0.4879</td></tr><tr><td>llama-7b w/ PandaLM</td><td>0.5162±0.0146</td><td>0.7764±0.0042</td><td>0.3396</td><td>0.3801±0.0145</td><td>0.5031</td></tr><tr><td>opt-6.7b original</td><td>0.3805±0.0142</td><td>0.6535±0.0047</td><td>0.2476</td><td>0.3587±0.0139</td><td>0.4101</td></tr><tr><td>opt-6.7b w/ PandaLM</td><td>0.3771±0.0142</td><td>0.6540±0.0047</td><td>0.2502</td><td>0.3609±0.0142</td><td>0.4106</td></tr><tr><td>pythia-6.9b original</td><td>0.3848±0.0142</td><td>0.6093±0.0049</td><td>0.2490</td><td>0.4187±0.0148</td><td>0.4155</td></tr><tr><td>pythia-6.9b w/PandaLM</td><td>0.4130±0.0144</td><td>0.6337±0.0048</td><td>0.2581</td><td>0.3972±0.0144</td><td>0.4255</td></tr><tr><td>bloom-7boriginal</td><td>0.3985±0.0143</td><td>0.6086±0.0049</td><td>0.2635</td><td>0.3975±0.0148</td><td>0.4170</td></tr><tr><td>bloom-7b w/ PandaLM Cerebras-GPT-6.7B original</td><td>0.3951±0.0143 0.3524±0.0140</td><td>0.6084±0.0049</td><td>0.2520</td><td>0.3997±0.0149</td><td>0.4138</td></tr><tr><td>Cerebras-GPT-6.7B w/PandaLM</td><td>0.3558±0.0140</td><td>0.5613±0.0050 0.5550±0.0050</td><td>0.2584 0.2452</td><td>0.3624±0.0140</td><td>0.3836</td></tr><tr><td></td><td></td><td></td><td></td><td>0.3448±0.0141</td><td>0.3752</td></tr></table>
258
+
259
+ # C COMPARISONS BETWEEN ORIGINAL MODELS AND MODELS TUNED USING PANDALM ON TRADITIONAL TASKS
260
+
261
+ We compare fine-tuned LLMs on various traditional tasks with lm-eval (Gao et al., 2021). Although the majority of language models exhibit improved performance after finetuning with PandaLM, Cerebras exhibits a decline. This highlights the importance of nuanced, subjective evaluations (win/tie/lose of responses). Human evaluations, as well as assessments from GPT-4 and GPT-3.5, all concur in indicating a better performance from Cerebras when paired with PandaLM. This is also confirmed in (Yu et al., 2024).
262
+
263
+ As shown in Table 7, the evaluation results of language models show that lower perplexity, indicating better predictive ability in pretraining or other tasks, does not always mean better overall performance of instruction-tuned models. For example, LLaMA-PandaLM has a higher perplexity than LLaMAAlpaca but outperforms it in both pairwise comparisons (PandaLM, GPT, Human) and traditional tasks (lm-eval). This suggests that while perplexity is not feasible for instruction-tuned models where lower perplexity might mean overfitting and less generalizability.
264
+
265
+ Table 7: Analysis on perplexity and other evaluation metrics. Note that we report the win rate over 170 samples of PandaLM, GPT, and Human.
266
+
267
+ <table><tr><td>Model</td><td>Perplexity (↓)</td><td>PandaLM-7B(↑)</td><td>PandaLM-70B(↑)</td><td>GPT-3.5 (↑)</td><td>GPT-4 (↑)</td><td>Human(↑)</td><td>Im-eval avg.score(↑)</td></tr><tr><td>LLaMA-Alpaca</td><td>2.75</td><td>15.88%</td><td>22.94%</td><td>15.29%</td><td>10.00%</td><td>12.35%</td><td>0.4879</td></tr><tr><td>LLaMA-PandaLM</td><td>2.81</td><td>19.41%</td><td>35.88%</td><td>26.47%</td><td>23.53%</td><td>48.24%</td><td>0.5031</td></tr></table>
268
+
269
+ # D LAW / BIOMEDICAL DATASETS INTRODUCTION
270
+
271
+ Specifically, we assess PandaLM’s proficiency using the LSAT (Law School Admission Test) dataset, which serves as an entrance exam question set for American law schools. This dataset incorporates 1,009 questions, further divided into three subsets: AR, LR, and RC. In the realm of biomedicine, we use the PubMedQA dataset—a vast repository for biomedical retrieval QA data, boasting 1k expert annotations, 61.2k unlabeled entries, and a massive $2 1 1 . 3 \mathrm { k }$ human-generated QA instances. For our evaluation, we rely on the labeled section (PubMedQA-l) that contains 1k instances. Each instance encompasses a question, context, and label. Additionally, we tap into the BioASQ dataset, specifically leveraging the task b dataset from its 11th challenge. This dataset is renowned for its biomedical semantic indexing and question-answering (QA) capabilities. From it, we use 1k samples for our assessment. We will test code/math dataset Cobbe et al. (2021); Zeng et al. (2022b) in future work.
272
+
273
+ # E DATA SIZE AND QUALITY ANALYSIS IN INSTRUCTION TUNING
274
+
275
+ We conduct an ablation study to investigate the impact of training data size (up to 1,344,000) on the performance of the model, given optimal hyperparameters. Importantly, a relationship exists between the size and quality of training data. Thus, we focus on an ablation study of data size here, but conducting a similar experiment on data quality is feasible. We derive the results from PandaLM-7B. The objective is to discern how much training data is required to reach each model’s peak performance. Table 8 reveals the optimal quantity of training data varies among models. More training data typically enhances model performance. However, an optimal point exists for each model, beyond which further data doesn’t improve performance. For example, the OPT model peaks at 992,000 data points, indicating additional data does not enhance the model’s performance.
276
+
277
+ Table 8: Optimal training data size for each model.
278
+
279
+ <table><tr><td>Model</td><td>Bloom</td><td>Cerebras-GPT</td><td>LLaMA</td><td>OPT</td><td>Pythia</td></tr><tr><td>Optimal Training Data Size</td><td>1,216,000</td><td>1,344,000</td><td>11,520,000</td><td>992.000</td><td>1,344,000</td></tr></table>
280
+
281
+ # F LORA ANALYSIS IN INSTRUCTION TUNING
282
+
283
+ We further aim to evaluate the efficacy of Low-Rank Adaptation (LoRA) (Hu et al.) compared to full fine-tuning across various models, utilizing optimal hyperparameters. The results are also obtained from PandaLM-7B. Our analysis seeks to provide a comparative understanding of these tuning methodologies. As shown in Table 9, the results for the Bloom model reveal a distinct advantage for full fine-tuning, which triumphs over LoRA in 66 instances as opposed to LoRA’s 35. Notably, they tie in 69 instances. In the case of the Cerebras model, full fine-tuning again proves superior, leading in 59 cases compared to LoRA’s 40, despite drawing even 71 times. The trend of full fine-tuning superiority is consistent in the LLaMA model. Out of 170 instances, full fine-tuning results in better performance in 48 instances, whereas LoRA emerges victorious in only 28 instances. The majority of the results are tied, amounting to 94 instances. In the OPT model, full fine-tuning once more showcases its advantage with 64 instances of superior performance compared to LoRA’s 33, while recording a tie in 73 instances. Lastly, for the Pythia model, full fine-tuning leads the race with 71 instances of better performance against LoRA’s 21, and a tie occurring in 78 instances. These results underscore that full fine-tuning generally yields more favorable results compared to the use of LoRA, though the outcomes can vary depending on the model. Despite the considerable number of ties, full fine-tuning holds the upper hand in most models, thereby highlighting its effectiveness. This suggests that while LoRA may provide comparable results in some instances, a strategy of full fine-tuning often proves to be the more beneficial approach in enhancing model performance.
284
+
285
+ Table 9: Comparison of LoRA and Full Fine-tuning.
286
+
287
+ <table><tr><td>Model</td><td>LoRA Wins</td><td>Full Fine-tuning Wins</td><td>Ties</td></tr><tr><td>Bloom</td><td>35</td><td>66</td><td>69</td></tr><tr><td>Cerebras-GPT</td><td>40</td><td>59</td><td>71</td></tr><tr><td>LLaMA</td><td>28</td><td>48</td><td>94</td></tr><tr><td>OPT</td><td>33</td><td>64</td><td>73</td></tr><tr><td>Pythia</td><td>21</td><td>71</td><td>78</td></tr></table>
288
+
289
+ # G LEVERAGING PRE-TRAINED MODELS AND OTHER INSTRUCTION TUNED MODELS FOR EVALUATION
290
+
291
+ Employing LLMs for response evaluation without additional training is a natural direction for the task. However, implementing evaluation criteria through zero-shot or few-shot methods is challenging for LLMs due to the necessity for extended context lengths.
292
+
293
+ We have undertaken experiments using zero-shot and few-shot (in-context learning Dong et al. (2022); Yang et al. (2023b)) evaluations with LLaMA. Our observations indicate that an un-tuned LLaMA struggles with adhering to user-specified format requirements. Consequently, our experiments focused on computing and comparing the log-likelihood of generating continuations (e.g., determining whether “Response 1 is better,” “Response 2 is better,” or if both responses are similar in quality) from the same context. We regard the choice with the highest log-likelihood as the prediction result. We also alternated response order in our experiments to reduce position bias. Furthermore, we undertook experiments with Vicuna, a finetuned version of LLaMA. The experiments demonstrated that the evaluation capabilities of instruction-tuned models possess significant potential for enhancement.
294
+
295
+ The results in Table 10 highlight the importance of tailored tuning for evaluation, a precisely-tuned smaller model outperforms a larger one in zero and few-shot scenarios.
296
+
297
+ # H ENHANCING PANDALM WITH REFINED SUPERVISION.
298
+
299
+ In our supervision goal, we incorporate not only the comparative result of responses but also a succinct explanation and a reference response. This methodology augments PandaLM’s comprehension of the evaluation criteria.
300
+
301
+ Table 10: Ablation study of directly using pre-trained models and instruction tuned models for evaluation.
302
+
303
+ <table><tr><td>Model</td><td> Accuracy</td><td>Precision</td><td>Recall</td><td>F1 score</td></tr><tr><td>LLaMA-7B 0-shot (log-likelihood)</td><td>12.11</td><td>70.23</td><td>34.52</td><td>8.77</td></tr><tr><td>LLaMA-30B 0-shot (log-likelihood)</td><td>31.43</td><td>56.48</td><td>43.12</td><td>32.83</td></tr><tr><td>LLaMA-7B 5-shot (log-likelihood)</td><td>24.82</td><td>46.99</td><td>39.79</td><td>25.43</td></tr><tr><td>LLaMA-30B 5-shot (log-likelihood)</td><td>42.24</td><td>61.99</td><td>51.76</td><td>42.93</td></tr><tr><td>Vicuna-7B (log-likelihood)</td><td>15.92</td><td>57.53</td><td>34.90</td><td>14.90</td></tr><tr><td>Vicuna-13B (log-likelihood)</td><td>35.24</td><td>57.45</td><td>43.65</td><td>36.29</td></tr><tr><td>PandaLM-7B</td><td>59.26</td><td>57.28</td><td>59.23</td><td>54.56</td></tr><tr><td>PandaLM-7B (log-likelihood)</td><td>59.26</td><td>59.70</td><td>63.07</td><td>55.78</td></tr></table>
304
+
305
+ Table 11: Ablation study of supervision goal.
306
+
307
+ <table><tr><td>Model</td><td> Accuracy</td><td>Precision</td><td>Recall</td><td>F1</td></tr><tr><td>PandaLM-7B (with only eval label)</td><td>0.4725</td><td>0.4505</td><td>0.4725</td><td>0.3152</td></tr><tr><td>PandaLM-7B</td><td>0.5926</td><td>0.5728</td><td>0.5923</td><td>0.5456</td></tr></table>
308
+
309
+ To empirically gauge the significance of this explanation, an experiment was executed. Here, the explanation and reference were omitted during training, and only the categorical outcomes (0/1/2 or Tie/Win/Lose) were retained in the dataset for training a fresh iteration of PandaLM. The results, as depicted in Table 11, demonstrate that in the absence of the explanation, PandaLM encounters difficulties in precisely determining the preferable response.
310
+
311
+ # I HUMAN EVALUATION DATASHEET
312
+
313
+ We employ human annotators from a crowdsourcing company and pay them fairly. In particular, we pay our annotators 50 dollars per hour, which is above the average local income level. We have filled out the Google Sheet provided in (Shimorina & Belz, 2022).
314
+
315
+ # J HYPERPARAMETER OPTIMIZATION ANALYSIS
316
+
317
+ In our hyperparameter searching process, we explored a range of learning rates, epochs, optimizers, and schedulers. The learning rates tested varied from 2e-6 to 2e-4, with model checkpoints saved at the end of each epoch. Performance was rigorously assessed through pairwise comparisons between checkpoints, counting the win rounds for each model, as detailed in Figure 8.
318
+
319
+ Our analysis, as depicted in Figure 8a, suggests a tendency towards a learning rate of 2e-5, although this preference was not uniformly clear across all models. Figure 8b demonstrates the variability in the optimal number of epochs, with a trend showing that peak performance often occurs around the fourth or fifth epoch. This evidence points to the complex interplay of hyperparameters with model performance, which is further influenced by data distribution, optimizer, and scheduler choices.
320
+
321
+ The findings from our hyperparameter optimization process highlight that there is no universally optimal setting for different models and training setups. While a pattern emerged suggesting that a learning rate around 2e-5 and an epoch count near 4 might be beneficial in some cases, these results are not conclusive. This reinforces the need for specific hyperparameter searches for different models, as demonstrated in our visualizations. A tailored approach to hyperparameter optimization is essential, as it allows for a more nuanced understanding of model performance across various scenarios.
322
+
323
+ Besides, we implemented an early stopping strategy using Pandalm. We focus specifically on LLaMA. Our experiments showed that in some cases, a model’s performance at epoch 3 was inferior to that at epoch 2. However, subsequent epochs demonstrated performance improvements. This indicates that early stopping may not always be suitable for large model fine-tuning, as it could prematurely halt training before reaching optimal performance.
324
+
325
+ Table 12: Analysis of PandaLM’s Evaluation Capability on Unseen Models.
326
+
327
+ <table><tr><td>Model Comparison</td><td>PandaLM</td><td>Human</td><td>Metrics (P,R, F1)</td></tr><tr><td>llama1-7b vs llama2-7b</td><td>(23,61,16)</td><td>(23,70,7)</td><td>(0.7061,0.7100,0.6932)</td></tr><tr><td>llamal-13b vs llama2-13b</td><td>(18,73,9)</td><td>(20,68,12)</td><td>(0.7032,0.6800,0.6899)</td></tr><tr><td>llamal-65b vs llama2-70b</td><td>(20,66,14)</td><td>(34,56,10)</td><td>(0.7269,0.6600,0.6808)</td></tr></table>
328
+
329
+ # K MODEL SHIFT ANALYSIS
330
+
331
+ In Table 12, we provide a detailed comparison of PandaLM’s performance against human benchmarks and in the context of different versions of instruction-tuned LLaMA models. Note that llama1-13b, llama1-65b and llama2 are indicative of model shift. The results demonstrate that PandaLM aligns closely with humans, consistently showing a preference for the LLama-2 model. This alignment is in line with expectations, as LLama-2 benefits from more pre-training data. Such findings highlight the significance of extensive pre-training in developing language models that are more skilled at understanding and correctly responding to various instructions.
332
+
333
+ ![](images/de84ee205e974b27734b2017916987f205e35f52d83313d0761bc87e7f834088.jpg)
334
+ Figure 8: Hyperparameter Optimization Analysis in PandaLM. The figure illustrates the performance across different learning rates and variability in model performance across epochs.
parse/test/5Nn2BLV7SB/5Nn2BLV7SB_content_list.json ADDED
@@ -0,0 +1,748 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "PANDALM: AN AUTOMATIC EVALUATION BENCHMARK FOR LLM INSTRUCTION TUNING OPTIMIZATION ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Yidong Wang1,2∗, Zhuohao $\\mathbf { V } \\mathbf { u } ^ { 1 * }$ , Wenjin $\\mathbf { Y a o } ^ { 1 }$ , Zhengran $\\mathbf { Z e n g ^ { 1 } }$ , Linyi Yang2, Cunxiang Wang2, Hao Chen3, Chaoya Jiang1 , Rui Xie1, Jindong Wang3, Xing $\\bar { \\bf X } \\bar { \\bf i } { \\bf e } ^ { 3 }$ , Wei $\\dot { \\mathbf { Y } } \\mathbf { e } ^ { 1 }$ †, Shikun Zhang1†, Yue Zhang2† ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "1Peking University 2Westlake University 3Microsoft Research Asia ",
16
+ "page_idx": 0
17
+ },
18
+ {
19
+ "type": "text",
20
+ "text": "ABSTRACT ",
21
+ "text_level": 1,
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "Instruction tuning large language models (LLMs) remains a challenging task, owing to the complexity of hyperparameter selection and the difficulty involved in evaluating the tuned models. To determine the optimal hyperparameters, an automatic, robust, and reliable evaluation benchmark is essential. However, establishing such a benchmark is not a trivial task due to the challenges associated with evaluation accuracy and privacy protection. In response to these challenges, we introduce a judge large language model, named PandaLM, which is trained to distinguish the superior model given several LLMs. PandaLM’s focus extends beyond just the objective correctness of responses, which is the main focus of traditional evaluation datasets. It addresses vital subjective factors such as relative conciseness, clarity, adherence to instructions, comprehensiveness, and formality. To ensure the reliability of PandaLM, we collect a diverse human-annotated test dataset, where all contexts are generated by humans and labels are aligned with human preferences. On evaluations using our collected test dataset, our findings reveal that PandaLM-7B offers performance comparable to both GPT-3.5 and GPT4. Impressively, PandaLM-70B surpasses their performance. PandaLM enables the evaluation of LLM to be fairer but with less cost, evidenced by significant improvements achieved by models tuned through PandaLM compared to their counterparts trained with default Alpaca’s hyperparameters. In addition, PandaLM does not depend on API-based evaluations, thus avoiding potential data leakage. ",
27
+ "page_idx": 0
28
+ },
29
+ {
30
+ "type": "text",
31
+ "text": "1 INTRODUCTION ",
32
+ "text_level": 1,
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "Large language models (LLMs) have attracted increasing attention in the field of artificial intelligence (OpenAI, 2023; Google, 2023; Zeng et al., 2022a; Brown et al., 2020; Chowdhery et al., 2022; Anil et al., 2023; Zhang et al., 2023), with various applications from question answering (Hirschman & Gaizauskas, 2001; Kwiatkowski et al., 2019; Wang et al., 2021), machine translation (Vaswani et al., 2017; Stahlberg, 2020) to content creation (Biswas, 2023; Adams & Chuah, 2022). The Alpaca project (Taori et al., 2023) has been a pioneering effort in instruction tuning of LLaMA (Touvron et al., 2023), setting a precedent for instruction tuning LLMs, followed by Vicunna (Chiang et al., 2023). Subsequent research (Diao et al., 2023; Ji et al., 2023; Chaudhary, 2023) have typically adopted Alpaca’s hyperparameters as a standard for training their LLMs. Given the necessity of instruction tuning for these pre-trained models to effectively understand and follow natural language instructions (Wang et al., $2 0 2 2 \\mathrm { c }$ ; Taori et al., 2023; Peng et al., 2023), optimizing their tuning hyperparameters is crucial for peak performance. Critical factors such as optimizer selection, learning rate, number of training epochs, and quality and size of training data significantly influence the model’s performance (Liaw et al., 2018; Tan & Le, 2019). However, a research gap remains in the area of hyperparameter optimization specifically designed for instruction tuning LLMs. To address this issue, we aim to construct an automated, reliable, and robust evaluation method, which can be integrated into any open-sourced LLMs and used as the judging basis for hyperparameter optimization. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "text",
42
+ "text": "",
43
+ "page_idx": 1
44
+ },
45
+ {
46
+ "type": "text",
47
+ "text": "The development of such an evaluation method presents its challenges (Guo et al., 2023; Chang et al., 2023), including ensuring evaluation reliability and privacy protection. In the context of our paper, when we refer to “privacy”, we primarily allude to the principles ingrained in federated learning (Zhang et al., 2021a) which enables model training across multiple devices or servers while keeping the data localized, thus offering a degree of privacy. Current methods often involve either crowd-sourcing work or API usage, which could be costly, and time-consuming. Besides, these methods face challenges in terms of consistency and reproducibility. This is primarily due to the lack of transparency regarding language model change logs and the inherent subjectivity of human annotations. Note that utilizing API-based evaluations carries the risk of potentially high costs associated with addressing data leaks. Although open-sourced LLMs can be alternative evaluators, they are not specifically designed for assessment, thus making it difficult to deploy them directly as evaluators. ",
48
+ "page_idx": 1
49
+ },
50
+ {
51
+ "type": "text",
52
+ "text": "On the other hand, the labels of previous evaluation methods (Zheng et al., 2023; Gao et al., 2021; Wang et al., 2023b;c) simply definite answers and fail to consider the language complexity in practice. The evaluation metrics of these procedures are typically accuracy and F1-score, without considering the subjective evaluation metrics that autoregressive generative language models should pay attention to, thus not reflecting the potential of such models to generate contextually relevant text. The appropriate subjective evaluation metrics can be relative conciseness, clarity, adherence to instructions, comprehensiveness, formality, and context relevance. ",
53
+ "page_idx": 1
54
+ },
55
+ {
56
+ "type": "text",
57
+ "text": "To tackle these challenges, we introduce a judge language model, aiming for Reproducible and Automated Language Model Assessment (PandaLM). Tuned from LLaMA, PandaLM is used to distinguish the most superior model among various candidates, each fine-tuned with different hyperparameters, and is also capable of providing the rationale behind its choice based on the reference response for the context. PandaLM surpasses the limitations of traditional evaluation methods and focuses on more subjective aspects, such as relative conciseness, clarity, comprehensiveness, formality, and adherence to instructions. Furthermore, the robustness of PandaLM is strengthened by its ability to identify and rectify problems such as logical fallacies, unnecessary repetitions, grammatical inaccuracies, and context irrelevance. By considering these diverse aspects, we leverage PandaLM’s ability to distinguish the most superior model among candidates on the validation set and then provide insights for facilitating hyperparameter optimization of instruction tuning. ",
58
+ "page_idx": 1
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "In practice, we generate paired responses from a diverse set of similarly sized foundation models including LLaMA-7B (Touvron et al., 2023), Bloom-7B (Scao et al., 2022), Cerebras-GPT-6.7B (Dey et al., 2023), OPT-7B (Zhang et al., 2022a), and Pythia-6.9B (Biderman et al., 2023). Each of these models is fine-tuned using the same data and hyperparameters as Alpaca (Taori et al., 2023). The paired responses from these tuned LLMs constitute the input of training data for PandaLM. The most straightforward approach to generate the corresponding target of training data is through human annotation, but this method can be costly and time-consuming (Wang et al., 2023h). And the lack of sufficiently annotated training data has always been a significant issue in the era of deep learning Ouali et al. (2020); Wang et al. (2023e); Zhang et al. (2021b); Chen et al. (2023); Wang et al. (2022a). Considering that GPT-3.5 can provide a reliable evaluation to some extent, to reduce costs, we follow self-instruct (Wang et al., 2022c), which is a methodology that capitalizes on pre-existing knowledge within large language models to generate annotations or outputs through self-generated instructions. to distil data from GPT-3.5 and apply heuristic data filtering strategies to mitigate noise. Specifically, we filter out invalid evaluations from gpt-3.5-turbo with hand-crafted rules. To address position bias, we also filter out inconsistent samples when swapping the orders of responses in the prompt. Despite the utilization of data distilled from GPT-3.5, the active removal of noise enhances the quality of the training data, fostering a more efficient and robust training process for PandaLM. ",
63
+ "page_idx": 1
64
+ },
65
+ {
66
+ "type": "text",
67
+ "text": "To ensure the reliability of PandaLM, we develop a test dataset that aligns with human preference and covers a wide range of tasks and contexts. The instructions and inputs of test data are sampled from the human evaluation dataset of self-instruct (Wang et al., 2022c), with responses generated by different LLMs and each label independently provided by three different human evaluators. Samples with significant divergences are excluded to ensure the Inter Annotator Agreement (IAA) of each annotator remains larger than 0.85. As illustrated in Table 2, PandaLM-7B showcases robust and competitive performance. Remarkably, the efficacy of PandaLM-70B is even more pronounced, ",
68
+ "page_idx": 1
69
+ },
70
+ {
71
+ "type": "image",
72
+ "img_path": "images/3d3b4315c781a1b5f1bcc60d84743b39820db2eed2b0e1de1fd888ccc5a3024a.jpg",
73
+ "image_caption": [
74
+ "(a) Comparison Results of GPT-3.5. (b) Comparison Results of GPT-4. "
75
+ ],
76
+ "image_footnote": [],
77
+ "page_idx": 2
78
+ },
79
+ {
80
+ "type": "image",
81
+ "img_path": "images/100fd2986a0fa8fa1c0176a1a2d477ea6096848f3b26c594dd6a1f2938181625.jpg",
82
+ "image_caption": [
83
+ "(c) Comparison Results of Human. "
84
+ ],
85
+ "image_footnote": [],
86
+ "page_idx": 2
87
+ },
88
+ {
89
+ "type": "text",
90
+ "text": "Figure 1: The models are evaluated and compared using both GPT-3.5, GPT-4 and human annotators. The ‘Win’ count represents the number of responses where models fine-tuned with PandaLM-selected optimal hyperparameters outperform models using Alpaca’s hyperparameters. Conversely, the ‘Lose’ count represents the number of responses where models utilizing Alpaca’s hyperparameters produce superior responses compared with those fine-tuned with the optimal hyperparameters determined by PandaLM. Note that the overall test set comprises 170 instances, and ‘Tie’ scenarios are not considered in this illustration. ",
91
+ "page_idx": 2
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "exceeding the performance metrics of GPT-4. This enhancement is largely attributable to the effective noise mitigation strategies employed during the training phase. ",
96
+ "page_idx": 2
97
+ },
98
+ {
99
+ "type": "text",
100
+ "text": "Moreover, as illustrated in Figure 1, adopting PandaLM’s selected optimal hyperparameters covering optimizer selection, learning rate, number of training epochs, and learning rate scheduler brings noteworthy improvements. When assessed using GPT-4 with a set of 170 instructions, a group of five open language models, tuned with optimal hyperparameters selected by PandaLM, achieves an average of 47.0 superior responses and 26.2 inferior responses, outperforming those trained using Alpaca’s hyperparameters. Note that the training data remains the same for conducting fair comparisons. Moreover, when these LLMs are evaluated by human experts, using the same set of 170 instructions, they exhibit an average of 79.8 superior responses and 25.2 inferior responses, once again surpassing the performance of models trained with Alpaca’s hyperparameters. The experimental results underline the effectiveness of PandaLM in determining optimal hyperparameters for choosing the best LLMs. In addition, when the fine-tuned LLMs are assessed using the lm-eval (Gao et al., 2021), a unified framework to test LLM on a large number of different traditional evaluation tasks, the results further reinforce the superiority of LLMs optimized by PandaLM. ",
101
+ "page_idx": 2
102
+ },
103
+ {
104
+ "type": "text",
105
+ "text": "In conclusion, our work delivers three key contributions: ",
106
+ "page_idx": 2
107
+ },
108
+ {
109
+ "type": "text",
110
+ "text": "• We introduce PandaLM, a privacy-protected judge language model for evaluating and optimizing hyperparameters for LLMs. \n• We create a reliable human-annotated dataset, essential for validating PandaLM’s performance and further research. \n• We make use of PandaLM to optimize the hyperparameters of a series of open-sourced LLMs. In comparison to those LLMs tuned using hyperparameters identified by Alpaca, tuning models with PandaLM-selected hyperparameters yields substantial performance enhancements. ",
111
+ "page_idx": 2
112
+ },
113
+ {
114
+ "type": "text",
115
+ "text": "2 RELATED WORK ",
116
+ "text_level": 1,
117
+ "page_idx": 2
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "This section reviews the relevant literature on the topic of hyperparameter optimization and the evaluation of language models. ",
122
+ "page_idx": 2
123
+ },
124
+ {
125
+ "type": "text",
126
+ "text": "Hyperparameter Optimization The importance of hyperparameter optimization in machine learning (Yu & Zhu, 2020; Falkner et al., 2018; Li et al., 2017; Xu et al., 2023; Wang et al., $2 0 2 3 \\mathrm { a }$ ; Wu et al., 2019), particularly in the context of fine-tuning deep learning language models such as BERT (Kenton & Toutanova, 2019) and GPT (Radford et al.), cannot be ignored. For these models, the choice of hyperparameters like the learning rate, batch size, or the number of training epochs can significantly influence their performance (Godbole et al., 2023; Sun et al., 2019; Tunstall et al., 2022). This selection process becomes even more critical when fine-tuning these models on domain-specific tasks, where the optimal set of hyperparameters can vary significantly among different domains (Dodge et al., 2020; Sun et al., 2019). ",
127
+ "page_idx": 2
128
+ },
129
+ {
130
+ "type": "image",
131
+ "img_path": "images/6727cfdc958122a0ef304a0c43442c867c67165e90e0942b497693d57b0fa15b.jpg",
132
+ "image_caption": [
133
+ "Figure 2: The pipeline of instruction tuning LLMs. "
134
+ ],
135
+ "image_footnote": [],
136
+ "page_idx": 3
137
+ },
138
+ {
139
+ "type": "text",
140
+ "text": "",
141
+ "page_idx": 3
142
+ },
143
+ {
144
+ "type": "text",
145
+ "text": "Evaluation of Language Models Accurate evaluation of language models is crucial in determining optimal hyperparameters, thus improving the models’ overall performance (Sun et al., 2019; Godbole et al., 2023). Conventional objective metrics like perplexity (Mallio et al., 2023) and accuracy (Xu et al., 2020; Wang et al.; Yang et al., 2022a; Zhong et al., 2023) on downstream tasks (Gao et al., 2021) provide valuable insights, but they may not effectively guide the choice of hyperparameters to enhance LLMs (Rogers et al., 2021) because evaluating LLMs requires other subjective metrics. Advanced language models, such as GPT-4 (OpenAI, 2023) and Bard (Google, 2023), incorporate human evaluations as part of their testing method for LLMs, aiming to better align with human judgements (Wang et al., 2023h). Although human-based evaluation methods offer considerable insight into a model’s performance, they are costly and labor-intensive, making it less feasible for iterative hyperparameter optimization processes. Recent advancements in NLP have brought forth model-based metrics such as BERTScore (Zhang et al., 2019) and MAUVE (Pillutla et al., 2021). While these metrics offer valuable insights, there are significant areas where they may not align perfectly with the objectives of response evaluation. Firstly, BERTScore and MAUVE are engineered to measure the similarity between generated content and reference text. However, they are not inherently designed to discern which of multiple responses is superior. A response is closer to a human-written reference doesn’t necessarily mean it adheres better to given instructions or satisfies a specific context. Secondly, while these metrics yield scores that represent content similarity, they aren’t always intuitive to users. Interpreting these scores and translating them into actionable feedback can be a challenge. In contrast, PandaLM offers a more straightforward approach. It is tailored to directly output the evaluation result in an interpretable manner, making the feedback process transparent and easily understood by humans. In conclusion, while metrics like BERTScore and MAUVE provide valuable insights into content similarity, there is a pressing need for specialized evaluation tools like PandaLM. Tools that not only discern response quality but also do so in a user-friendly, human-comprehensible manner. ",
146
+ "page_idx": 3
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "Subjective qualitative analysis of a model’s outputs, such as its ability to handle ambiguous instructions and provide contextually appropriate responses, is increasingly being recognized as a valuable metric for evaluating models (Zheng et al., 2023). Optimizing hyperparameters with considerations towards these qualitative measures could lead to models that perform more robustly in diverse realworld scenarios. The previous qualitative analysis can be achieved either through human evaluators or through APIs of advanced language models, which is different from our motivation. ",
151
+ "page_idx": 3
152
+ },
153
+ {
154
+ "type": "text",
155
+ "text": "3 METHODOLOGY ",
156
+ "text_level": 1,
157
+ "page_idx": 3
158
+ },
159
+ {
160
+ "type": "text",
161
+ "text": "As shown in Figure 2, the process of instruction tuning begins with a foundation model, which is then fine-tuned using instructions. The performance of each tuned model is evaluated to determine the best output. This involves exploring numerous models, each tuned with different hyperparameters, to identify the optimal one. To facilitate this pipeline, a reliable and automated language model assessment system is essential. To address this, we introduce PandaLM - a judge LLM specifically designed to assess the performance of LLMs fine-tuned with various parameters. Our goal is to identify the superior model from a pool of candidates accurately. ",
162
+ "page_idx": 3
163
+ },
164
+ {
165
+ "type": "image",
166
+ "img_path": "images/90649e8c86b3cf72bbebe097b864f94c7c5e2fc02a54f9ad4fd95d4d48ea8f1c.jpg",
167
+ "image_caption": [
168
+ "Figure 3: The top 16 words used in the PandaLM-7B evaluation reasons from randomly sampled $8 0 \\mathrm { k }$ evaluation outputs. An example of evaluation reason and evaluation outputs can be found in Figure 5. Stop words are filtered. "
169
+ ],
170
+ "image_footnote": [],
171
+ "page_idx": 4
172
+ },
173
+ {
174
+ "type": "text",
175
+ "text": "3.1 TRAIN DATA COLLECTION AND PREPROCESSING ",
176
+ "text_level": 1,
177
+ "page_idx": 4
178
+ },
179
+ {
180
+ "type": "text",
181
+ "text": "The training data collection aims to create a rich dataset that allows the model to evaluate different responses in a given context and generate an evaluation reason and a reference response using the same context. As demonstrated in Appendix A, each training data instance consists of an input tuple (instruction, input, response1, response2) and an output tuple (evaluation result, evaluation reason, reference response). The instructions and inputs in the input tuple are sampled from the Alpaca 52K dataset (Taori et al., 2023). The response pairs are produced by various instruction-tuned models: LLaMA-7B (Touvron et al., 2023), Bloom-7B (Scao et al., 2022), Cerebras-GPT-6.7B (Dey et al., 2023), OPT-7B (Zhang et al., 2022a), and Pythia-6.9B (Biderman et al., 2023). These models are selected due to their comparable sizes and the public availability of their model weights. Each is fine-tuned using the same instruction data and hyperparameters following Alpaca (Taori et al., 2023). The corresponding output tuple includes an evaluation result, a brief explanation for the evaluation, and a reference response. The evaluation result would be either ‘1’ or $\\bullet _ { 2 } \\cdot$ , indicating that response 1 or response 2 is better, and ‘Tie’ indicates that two responses are similar in quality. The training prompt of PandaLM is shown at Appendix A.As it is impractical to source millions of output tuples from human annotators, and given that GPT-3.5 is capable of evaluating LLMs to some degree, we follow self-instruct (Wang et al., 2022c) to generate output tuples using GPT-3.5. As illustrated in Figure 3, we design prompts carefully to guide the generation of training data for PandaLM. The goal is to ensure PandaLM not only prioritizes objective response correctness but also emphasizes critical subjective aspects such as relative conciseness, clarity, comprehensiveness, formality, and adherence to instructions. Besides, we encourage PandaLM to identify and rectify issues like logical fallacies, unnecessary repetitions, grammatical inaccuracies, and the absence of context relevance. A heuristic data filtering strategy is then applied to remove noisy data. Specifically, to address the observed inherent bias in GPT-3.5 regarding the order of input responses even with carefully designed prompts, samples from the training dataset are removed if their evaluation results conflict when the orders of input responses are swapped. We finally obtain a filtered dataset containing 300K samples. ",
182
+ "page_idx": 4
183
+ },
184
+ {
185
+ "type": "text",
186
+ "text": "3.2 PANDALM TRAINING ",
187
+ "text_level": 1,
188
+ "page_idx": 4
189
+ },
190
+ {
191
+ "type": "text",
192
+ "text": "In this subsection, we provide details about the training procedure for PandaLM. The backbone of PandaLM is LLaMA model, as it exhibits strong performance on multiple complicated NLP tasks (Beeching et al., 2023). ",
193
+ "page_idx": 4
194
+ },
195
+ {
196
+ "type": "text",
197
+ "text": "During the fine-tuning phase of PandaLM, we use the standard cross-entropy loss targeting the next token prediction. The model operates in a sequence-to-sequence paradigm without the necessity for a separate classification head. We train PandaLM with the DeepSpeed (Rasley et al., 2020) library, and Zero Redundancy Optimizer (ZeRO) (Rajbhandari et al., 2020; Ren et al., 2021) Stage 2, on 8 NVIDIA A100-SXM4-80GB GPUs. We use the bfloat16 (BF16) computation precision option to further optimize the model’s speed and efficiency. Regarding the training hyperparameters, we apply the AdamW (Loshchilov & Hutter, 2017) optimizer with a learning rate of 2e-5 and a cosine learning rate scheduler. The model is trained for 2 epochs. The training process uses a warmup ratio of 0.03 to avoid large gradients at the beginning of training. We use a batch size of 2 per GPU with all inputs truncated to a maximum of 1024 tokens and employ a gradient accumulation strategy with 8 steps. ",
198
+ "page_idx": 4
199
+ },
200
+ {
201
+ "type": "image",
202
+ "img_path": "images/32ef8ad42d3679a9437d7a3a3e6a188496dbb903903b3d9af85e68df0dd729a2.jpg",
203
+ "image_caption": [
204
+ "Figure 4: Comparative Visualization of Model Performance. The instruction-tuned models use the same training data and hyperparameters. A directed edge from node A to B indicates model A’s significant superiority over B, while a dashed undirected edge indicates the two models are similar in performance. The number associated with the directed edge (A, B) represents the difference between the number of wins and losses for model A compared to model B. The absence of a number on the dashed undirected edge indicates that the difference between the number of wins and losses for the models is smaller than 5. We swap the order of two responses to perform inference twice on each data. The conflicting evaluation results are then modified to ‘Tie’. "
205
+ ],
206
+ "image_footnote": [],
207
+ "page_idx": 5
208
+ },
209
+ {
210
+ "type": "text",
211
+ "text": "",
212
+ "page_idx": 5
213
+ },
214
+ {
215
+ "type": "text",
216
+ "text": "4 RELIABILITY EVALUATION OF PANDALM ",
217
+ "text_level": 1,
218
+ "page_idx": 5
219
+ },
220
+ {
221
+ "type": "text",
222
+ "text": "To ensure the reliability of PandaLM, we create a test dataset that is labeled by humans and designed to align with human preferences for responses. Each instance of this test dataset consists of one instruction and input, and two responses produced by different instruction-tuned LLMs. The paired responses are provided by LLaMA-7B, Bloom-7B, Cerebras-GPT-6.7B, OPT-7B, and Pythia-6.9B, all instruction tuned using the same instruction data and hyperparameters following Alpaca (Taori et al., 2023). The test data is sampled from the diverse human evaluation dataset of self-instruct (Wang et al., 2022c), which includes data from Grammarly, Wikipedia, National Geographic and nearly one hundred apps or websites. The inputs and labels are solely human-generated and include a range of tasks and contents. Three different human evaluators independently annotate the labels indicating the preferred response. Samples with significant divergences are excluded to ensure the Inter Annotator Agreement (IAA) of each annotator remains larger than 0.85. This is because such samples demand additional knowledge or hard-to-obtain information, making them challenging for humans to evaluate. The filtered test dataset contains 1K samples, while the original unfiltered dataset has 2.5K samples. ",
223
+ "page_idx": 5
224
+ },
225
+ {
226
+ "type": "text",
227
+ "text": "To maintain high-quality crowdsourcing work, we involve three experts to annotate the same data point concurrently during the annotation process. There is no prior relationship between the experts and the authors. The experts are hired from an annotation company. These experts receive specialized training that goes beyond evaluating response correctness, enabling them to emphasize other crucial aspects like relative conciseness, clarity, comprehensiveness, formality, and adherence to instructions. Furthermore, we guide these annotators in identifying and addressing issues such as logical fallacies, unnecessary repetitions, grammatical inaccuracies, and a lack of contextual relevance. All human ratings are collected consistently within the same session. To ensure clarity and consistency, we provide comprehensive instructions for every annotator. After the trial phase of data annotation, we eliminate some low-quality labeled data. The final IAA amongst the three annotators, as measured by Cohen’s Kappa (Cohen, 1960), yields average scores of 0.85, 0.86, and 0.88 respectively, indicating a relatively high level of reliability for our test dataset. To refine the model’s performance assessment compared to human evaluators, we can use the inter-annotator agreement (IAA) of 0.85 as a benchmark. If our model exceeds this, it indicates strong performance. However, setting a realistic target slightly above this human IAA, say around 0.90, offers a challenging yet achievable goal. The distribution of the test data comprises 105 instances of ties, 422 instances where Response 1 wins, and 472 instances where Response 2 takes the lead. Note that the human-generated dataset has no ",
228
+ "page_idx": 5
229
+ },
230
+ {
231
+ "type": "text",
232
+ "text": "Table 1: Comparative analysis of evaluation results from various annotation models. The tuple in the table means (#win,#lose,#tie). Specifically, (72,28,11) in the first line of the table indicates that LLaMA-7B outperforms Bloom-7B in 72 responses, underperforms in 28, and matches the quality in 11 responses. The ‘Judged By’ column represents different methods of response evaluation. ‘Human’ indicates that humans evaluate the result, and ‘PandaLM’ indicates that our proposed PandaLM model evaluates the result. ",
233
+ "page_idx": 6
234
+ },
235
+ {
236
+ "type": "table",
237
+ "img_path": "images/217031911fef51cb0bd8dd9d43f59c0e9fe5a1a471ab7c1d82c87870db04e535.jpg",
238
+ "table_caption": [
239
+ "Table 2: Comparison between Human Annotation results and Judged Model evaluation results. "
240
+ ],
241
+ "table_footnote": [],
242
+ "table_body": "<table><tr><td>Judged By</td><td>Base Model</td><td>LLaMA-7B</td><td>Bloom-7B</td><td>Cerebras-6.7B</td><td>OPT-7B</td><td>Pythia-6.9B</td></tr><tr><td rowspan=\"5\">Human</td><td>LLaMA-7B</td><td>/</td><td>(72,28,11)</td><td>(80,24,6)</td><td>(71,24,11)</td><td>(58,27,9) (47,49,11)</td></tr><tr><td>Bloom-7B</td><td>(28,72,11)</td><td>/</td><td>(59,30,11)</td><td>(43,35,11)</td><td></td></tr><tr><td>Cerebras-6.7B</td><td>(24,80,6)</td><td>(30,59,11)</td><td>/</td><td>(33,49,9)</td><td>(27,53,11)</td></tr><tr><td>OPT-7B</td><td>(24,71,11)</td><td>(35,43,11)</td><td>(49,33,9)</td><td>/</td><td>(32,53,15)</td></tr><tr><td>Pythia-6.9B</td><td>(27,58,9)</td><td>(49,47,11)</td><td>(53,27,11)</td><td>(53,32,15)</td><td>/</td></tr><tr><td rowspan=\"5\">GPT-3.5</td><td>LLaMA-7B</td><td>/</td><td>(59,19,33)</td><td>(71,13,26) (40,19,41)</td><td>(58,17,31)</td><td>(49,16,29)</td></tr><tr><td>Bloom-7B</td><td>(19,59,33)</td><td>/</td><td></td><td>(36,30,23)</td><td>(33,34,40)</td></tr><tr><td>Cerebras-6.7B</td><td>(13,71,26)</td><td>(19,40,41)</td><td>/</td><td>(24,38,29)</td><td>(22,43,26)</td></tr><tr><td>Pyhia-.BB</td><td>(17.58.3)</td><td></td><td></td><td></td><td>(30,30,40)</td></tr><tr><td></td><td></td><td>(130.3.3)</td><td>(38.2429)</td><td>(30,30,40)</td><td></td></tr><tr><td rowspan=\"5\">GPT-4</td><td>LLaMA-7B</td><td>/</td><td>(58,15,38)</td><td>(69,9,32)</td><td>(58,14,34)</td><td>(52,17,25)</td></tr><tr><td>Bloom-7B</td><td>(15,58,38)</td><td>/</td><td>(47,16,37)</td><td>(35,31,23)</td><td>(32,33,42)</td></tr><tr><td>Cerebras-6.7B</td><td>(9,69,32)</td><td>(16,47,37)</td><td>/</td><td>(23,40,28)</td><td>(17,41,33)</td></tr><tr><td>OPT-7B</td><td>(14,58,34)</td><td>(31,35,23)</td><td>(40,23,28)</td><td>/</td><td>(25,37,38)</td></tr><tr><td>Pythia-6.9B</td><td>(17,52,25)</td><td>(33,32,42)</td><td>(41,17,33)</td><td>(37,25,38)</td><td>/</td></tr><tr><td rowspan=\"5\">PandaLM-7B</td><td>LLaMA-7B</td><td>/</td><td>(46,29,36)</td><td>(68,18,24)</td><td>(52,26,28)</td><td>(35,28,31)</td></tr><tr><td>Bloom-7B</td><td>(29,46,36)</td><td>/</td><td>(50,18,32)</td><td>(36,30,23)</td><td>(36,31,40)</td></tr><tr><td>Cerebras-6.7B</td><td>(18,68,24)</td><td>(18,50,32)</td><td>/</td><td>(28,39,24)</td><td>(24,46,21)</td></tr><tr><td>OPT-7B</td><td>(26,52,28)</td><td>(30,36,23)</td><td>(39,28,24)</td><td>/</td><td>(30,32,38)</td></tr><tr><td>Pythia-6.9B</td><td>(28,35,31)</td><td>(31,36,40)</td><td>(46,24,21)</td><td>(32,30,38)</td><td>/</td></tr></table>",
243
+ "page_idx": 6
244
+ },
245
+ {
246
+ "type": "table",
247
+ "img_path": "images/9f1973c6f2f01b147f3fb1b5f68be0b52203a8bb9162285d57ffbc9f55d3461f.jpg",
248
+ "table_caption": [],
249
+ "table_footnote": [],
250
+ "table_body": "<table><tr><td>Judged Model</td><td>Accuracy</td><td>Precision</td><td>Recall</td><td>F1</td></tr><tr><td>GPT-3.5</td><td>0.6296</td><td>0.6195</td><td>0.6359</td><td>0.5820</td></tr><tr><td>GPT-4</td><td>0.6647</td><td>0.6620</td><td>0.6815</td><td>0.6180</td></tr><tr><td>PandaLM-7B</td><td>0.5926</td><td>0.5728</td><td>0.5923</td><td>0.5456</td></tr><tr><td>PandaLM-70B-LoRA</td><td>0.6186</td><td>0.7757</td><td>0.6186</td><td>0.6654</td></tr><tr><td>PandaLM-70B</td><td>0.6687</td><td>0.7402</td><td>0.6687</td><td>0.6923</td></tr></table>",
251
+ "page_idx": 6
252
+ },
253
+ {
254
+ "type": "text",
255
+ "text": "personally identifiable information or offensive content, and all annotators receive redundant labor fees. ",
256
+ "page_idx": 6
257
+ },
258
+ {
259
+ "type": "text",
260
+ "text": "After obtaining the human-labeled test dataset, we can assess and compare the evaluation performances of GPT-3.5, GPT-4, and PandaLM. An interesting observation from Table 1 is the shared similar partial order graph between GPT-3.5, GPT-4, PandaLM-7B, and humans. Furthermore, Figure 4 illustrates directed orders of model superiority (if model A outperforms model B, a directed edge from A to B is drawn; if model A and model B perform similarly, a dashed line from A to B is drawn.), and provides a visual representation of comparative model effectiveness. The experimental results indicate similarities in the preferences of GPT-3.5, GPT-4, PandaLM-7B, and humans. Note that for PandaLM, GPT-3.5, and GPT-4, we swap the input response order and infer twice to procure the final evaluation output. The conflicting evaluation results are revised to ‘Tie’. ",
261
+ "page_idx": 6
262
+ },
263
+ {
264
+ "type": "text",
265
+ "text": "As shown in Table 2, we conduct a statistical analysis comparing the accuracy, precision, recall, and F1-score of GPT-3.5, GPT-4, and PandaLM against human annotations. The performance of PandaLM-70B even surpasses that of GPT-4. The results indicate the efficacy of removing noise in training data and the choosing of foundational model architectures and instructions. ",
266
+ "page_idx": 6
267
+ },
268
+ {
269
+ "type": "text",
270
+ "text": "To prove the robustness and adaptability of PandaLM across distribution shifts, we also concentrate our evaluations on distinct areas, with a particular emphasis on the legal (LSAT) and biological (PubMedQA and BioASQ) domains. The introduction of the used datasets can be found at Appendix D. Note that for generating responses, we employ open-sourced language models such as Vicuna and Alpaca. Due to constraints in time, GPT-4 is adopted to produce the gold standard answers (win/tie/lose of responses) instead of human annotators. The results illustrated in Table 3 underscore PandaLM’s prowess not only in general contexts but also in specific domains such as law (via LSAT) and biology (via PubMedQA and BioASQ). Since we are addressing a three-category classification task (win/lose/tie), where a random guess would lead to around $33 \\%$ in the precision, recall, and F1 score. PandaLM-7B’s results are notably above this level. To further validate PandaLM-7B, we conducted a human evaluation with 30 samples on the BioASQ evaluation. The human evaluation showed that both PandaLM-7B and GPT-4 tended to favor Vicuna over Alpaca, indicating a consistent trend in their evaluations. The marked improvement in performance as the model scales up reaffirms PandaLM’s promise across varied applications, further emphasizing its reliability amidst different content distributions. ",
271
+ "page_idx": 6
272
+ },
273
+ {
274
+ "type": "text",
275
+ "text": "We further investigate the performance of PandaLM by contrasting its efficacy when trained solely on numerical comparisons (win/tie/lose) — akin to a traditional reward model — with the holistic approach of the standard PandaLM that incorporates evaluation reasons and reference responses. As shown in Table 4, it become evident that the evaluation reasons and reference responses significantly aid LLMs in understanding the evaluation tasks. Note that in Appendix G, the results clearly demonstrate that a smaller model, when precisely tuned, has the capability to outperform a larger, untuned model in evaluation metrics. This finding emphasizes the significant impact of targeted tuning on model performance in evaluation scenarios. We also provide an analysis on PandaLM across model shifts in Appendix K. ",
276
+ "page_idx": 6
277
+ },
278
+ {
279
+ "type": "table",
280
+ "img_path": "images/ba7ad8190e425a891bf68f016466307e47c79a66a446a13ddbb428f9e837bc63.jpg",
281
+ "table_caption": [
282
+ "Table 3: Performance evaluation of PandaLM across diverse domains. The table showcases the accuracy, precision, recall, and F1 scores achieved by PandaLM of two different sizes (finetuned from LLaMA-7B and LLaMA2-70B) on three distinct datasets: LSAT, PubMedQA, and BioASQ. These datasets are representative of the legal and biological domains, chosen to demonstrate the robustness and adaptability of PandaLM to different distribution shifts. It’s worth noting that GPT-4 was employed for generating the gold standard answers instead of human annotations. "
283
+ ],
284
+ "table_footnote": [],
285
+ "table_body": "<table><tr><td></td><td>Accuracy</td><td>Precision</td><td>Recall</td><td>F1 Score</td></tr><tr><td>LSAT (PandaLM-7B)</td><td>0.4717</td><td>0.7289</td><td>0.4717</td><td>0.5345</td></tr><tr><td>LSAT (PandaLM-70B)</td><td>0.6604</td><td>0.7625</td><td>0.6604</td><td>0.6654</td></tr><tr><td>PubMedQA (PandaLM-7B)</td><td>0.6154</td><td>0.8736</td><td>0.6154</td><td>0.6972</td></tr><tr><td>PubMedQA (PandaLM-70B)</td><td>0.7692</td><td>0.7811</td><td>0.7692</td><td>0.7663</td></tr><tr><td>BioASQ(PandaLM-7B)</td><td>0.5152</td><td>0.7831</td><td>0.5152</td><td>0.5602</td></tr><tr><td>BioASQ(PandaLM-70B)</td><td>0.7727</td><td>0.8076</td><td>0.7727</td><td>0.7798</td></tr></table>",
286
+ "page_idx": 7
287
+ },
288
+ {
289
+ "type": "table",
290
+ "img_path": "images/ed882a6dcc4ab3986c3024cf6ae8c02b05e95f1340d83e3d5f4f7e7838259ec7.jpg",
291
+ "table_caption": [
292
+ "Table 4: Comparison of PandaLM performance w/ and w/o reasons and references. "
293
+ ],
294
+ "table_footnote": [],
295
+ "table_body": "<table><tr><td></td><td>Accuracy</td><td>Precision</td><td>Recall</td><td>F1 Score</td></tr><tr><td>PandaLM-7B with only win/tie/lose</td><td>0.4725</td><td>0.4505</td><td>0.4725</td><td>0.3152</td></tr><tr><td>PandaLM-7B</td><td>0.5926</td><td>0.5728</td><td>0.5923</td><td>0.5456</td></tr></table>",
296
+ "page_idx": 7
297
+ },
298
+ {
299
+ "type": "table",
300
+ "img_path": "images/7dfb15a3e00af90b8d5f41ce8a2e7b6d19e462869143b00dd7ae63a8c0cee3e1.jpg",
301
+ "table_caption": [
302
+ "Table 5: Evaluation of the effectiveness of PandaLM’s selected hyperparameters and Alpaca’s hyperparameters. The tuple in the table means (#win,#lose,#tie). Specifically, (45,26,99) in the first line of the table indicates that PandaLM’s hyperparameter-tuned LLaMA-7B outperforms Alpaca’s version in 45 responses, underperforms in 26, and matches the quality in 99 instances. The ‘Judged By’ column represents different methods of response evaluation. "
303
+ ],
304
+ "table_footnote": [],
305
+ "table_body": "<table><tr><td>Judge Model</td><td>LLaMA-7B</td><td>Bloom-7B</td><td>Cerebras-6.7B</td><td>OPT-7B</td><td>Pythia-6.9B</td></tr><tr><td>GPT-3.5</td><td>(45,26.99)</td><td>(48,24,98)</td><td>(58,21,91)</td><td>(48,34,88)</td><td>(59,20,91)</td></tr><tr><td>GPT-4</td><td>(40,17,113)</td><td>(44,34,92)</td><td>(60,20,90)</td><td>(39,30,101)</td><td>(52,30,88)</td></tr><tr><td>Human</td><td>(82,21,67)</td><td>(79,23.68)</td><td>(88,25,57)</td><td>(68,26,76)</td><td>(82,31,57)</td></tr></table>",
306
+ "page_idx": 7
307
+ },
308
+ {
309
+ "type": "text",
310
+ "text": "",
311
+ "page_idx": 7
312
+ },
313
+ {
314
+ "type": "text",
315
+ "text": "In addition, beyond performance metrics, PandaLM introduces unique advantages that are not present in models like GPT-3.5 and GPT-4. It offers open-source availability, enabling reproducibility, and protecting data privacy. Furthermore, it provides unlimited access, removing any restrictions that might hinder comprehensive evaluation and application. ",
316
+ "page_idx": 7
317
+ },
318
+ {
319
+ "type": "text",
320
+ "text": "5 USING PANDALM TO INSTRUCTION TUNE LLMS ",
321
+ "text_level": 1,
322
+ "page_idx": 7
323
+ },
324
+ {
325
+ "type": "text",
326
+ "text": "To highlight the effectiveness of using PandaLM for instruction tuning LLMs, we compare the performance of models tuned with PandaLM’s selected optimal hyperparameters against those tuned with Alpaca’s parameters using GPT-3.5, GPT-4, and human experts. It is noteworthy that PandaLM7B is employed for this comparison due to considerations regarding computational resources. Given the proven effectiveness of PandaLM-7B, there is a grounded expectation that the performance of PandaLM-70B will exhibit further enhancement. This comparison evaluates multiple tuned LLMs: LLaMA-7B, Bloom-7B, Cerebras-GPT-6.7B, OPT-7B, and Pythia-6.9B. The assessment is conducted on a validation set comprising 170 distinct instructions and inputs obtained from our 1K test set introduced in Section 4. Alpaca’s tuning protocol involves training for three epochs with the final iteration’s checkpoints being used. It uses the AdamW (Loshchilov & Hutter, 2017) optimizer with a learning rate of 2e-5 and a cosine learning rate scheduler. We perform a wider range of hyperparamters to tune LLMs using PandaLM-7B. Specifically, we explore checkpoints from each epoch (ranging from epoch 1 to epoch 5), four different learning rates (2e-6, 1e-5, 2e-5, 2e-4), two types of optimizers (SGD (Goodfellow et al., 2016) and AdamW), and two learning rate schedulers (cosine and linear). In total, this creates a configuration space of 80 different possibilities per model. ",
327
+ "page_idx": 7
328
+ },
329
+ {
330
+ "type": "text",
331
+ "text": "We search for optimal hyperparameters among the 80 configurations. These are divided into four blocks, each containing 20 configurations. Sequential comparisons identify the best configuration in each block. The top configurations from each block are then compared to determine the overall best configuration. We repeat each comparison twice for robustness and carry out 800 comparisons in total. The conflicting evaluation results are modified to ‘Tie’. Key insights from our tuning process include: Bloom-7B performs best with SGD, a learning rate of 2e-5, and a cosine schedule over 5 epochs. Cerebras-GPT-6.7B also favors SGD with the same learning rate but with a linear schedule. LLaMA-7B prefers AdamW, a learning rate of 1e-5, and a linear schedule over 4 epochs. OPT-6.7B achieves top results with AdamW, a learning rate of 2e-5, and a linear scheduler over 5 epochs. Pythia-6.9B prefers SGD, a learning rate of 1e-5, a cosine schedule, and 5 epochs. This highlights the importance of customized hyperparameter tuning for different models to achieve peak performance. We also provide the analysis on data size, quality and LoRA in Appendix E and Appedix F. ",
332
+ "page_idx": 8
333
+ },
334
+ {
335
+ "type": "text",
336
+ "text": "As illustrated in Table 5, for GPT-3.5, GPT-4, and human, all base models achieve superior performance when tuned with PandaLM’s selected hyperparameters compared to Alpaca’s hyperparameters. Note that the procedure of switching the order of input responses, as applied for PandaLM, is also implemented for GPT-3.5 and GPT-4 to acquire more robust evaluation results. This outcome not only supports the claim that PandaLM-7B can enhance the performance of models but also highlights its potential to further improve various large language models. Besides, as shown in Appendix B, based on PandaLM’s evaluation, the model demonstrating superior performance is LLaMA-PandaLM. Note that the base foundation model’s characteristics can be a significant factor in performance, as evidenced by LLaMA models securing the top two positions. The ranking pattern observed aligns closely with the base model rankings presented in Figure 4. We also provide a hyperparameter optimization analysis in Appendix J. ",
337
+ "page_idx": 8
338
+ },
339
+ {
340
+ "type": "text",
341
+ "text": "Moreover, Table 6 in Appendix C compares fine-tuned LLMs on various traditional tasks with lm-eval (Gao et al., 2021). Interestingly, while most language models display enhanced performance with PandaLM finetuning, Cerebras experiences a dip. This underscores the value of subjective evaluation (win/tie/lose of responses), as evaluations from humans, GPT-4, and GPT-3.5 all indicate superior performance for Cerebras with PandaLM. ",
342
+ "page_idx": 8
343
+ },
344
+ {
345
+ "type": "text",
346
+ "text": "6 LIMITATIONS ",
347
+ "text_level": 1,
348
+ "page_idx": 8
349
+ },
350
+ {
351
+ "type": "text",
352
+ "text": "While the outcomes of our study are encouraging, we discuss several limitations here. Firstly, the selected range of hyperparameters used in this work is based on common practice and prior literature, and thus may not encompass the absolute optimal hyperparameters. While extending the search bond will inevitably increase the computational cost. While the core data, derived from GPT-3.5, may not fully resonate with human preferences, it’s essential to recognize that the efficacy of LLMs hinges not just on training data but also on foundational model architectures and instructions. Currently, our emphasis is primarily on outcome-based evaluation, which is indeed resource-intensive. However, integrating behavior prediction (e.g., using rational analysis Lu et al. (2022); Wang et al. (2023d; 2020); Yang et al. (2021; 2023a)) into an evaluation framework could offer a more comprehensive understanding of LLM performance. For instance, analyzing and evaluating the extended text outputs of an untuned LLM can help predict how a tuned version might behave in various scenarios. This approach could provide a more efficient and insightful way to balance resource-heavy outcome assessments. Besides, we only research on supervised training of LLMs, but the realistic data could be imbalanced or unlabeled, hence semi-supervised Wang et al. (2023e); Chen et al. (2023); Wang et al. (2022b), noisy Zhang et al. (2022b); Chen et al. (2024) and imbalanced training Yang et al. (2022b); Wang et al. (2023f;g) are also our future directions. ",
353
+ "page_idx": 8
354
+ },
355
+ {
356
+ "type": "text",
357
+ "text": "7 CONCLUSION ",
358
+ "text_level": 1,
359
+ "page_idx": 8
360
+ },
361
+ {
362
+ "type": "text",
363
+ "text": "In our exploration of hyperparameter optimization, we apply PandaLM: an automatic and reliable judge model for the tuning of LLMs. Our findings demonstrate that the use of PandaLM is feasible and consistently produces models of superior performance compared to those tuned with Alpaca’s default parameters. We are dedicated to continually enhancing PandaLM by expanding its capacity to support larger models and analyzing its intrinsic features, thereby developing increasingly robust versions of the judging model in the future. ",
364
+ "page_idx": 8
365
+ },
366
+ {
367
+ "type": "text",
368
+ "text": "ACKNOWLEDGEMENT ",
369
+ "text_level": 1,
370
+ "page_idx": 9
371
+ },
372
+ {
373
+ "type": "text",
374
+ "text": "We would like to thank the anonymous reviewers for their insightful comments and suggestions to help improve the paper. This publication has emanated from research conducted with the financial support of the Pioneer and “Leading Goose” R&D Program of Zhejiang under Grant Number 2022SDXHDX0003 and the National Natural Science Foundation of China Key Program under Grant Number 62336006. ",
375
+ "page_idx": 9
376
+ },
377
+ {
378
+ "type": "text",
379
+ "text": "REFERENCES ",
380
+ "text_level": 1,
381
+ "page_idx": 9
382
+ },
383
+ {
384
+ "type": "text",
385
+ "text": "",
386
+ "page_idx": 9
387
+ },
388
+ {
389
+ "type": "text",
390
+ "text": "Donnie Adams and Kee-Man Chuah. Artificial intelligence-based tools in research writing: Current trends and future potentials. Artificial Intelligence in Higher Education, pp. 169–184, 2022. \nRohan Anil, Andrew M Dai, Orhan Firat, Melvin Johnson, Dmitry Lepikhin, Alexandre Passos, Siamak Shakeri, Emanuel Taropa, Paige Bailey, Zhifeng Chen, et al. Palm 2 technical report. arXiv preprint arXiv:2305.10403, 2023. \nEdward Beeching, Sheon Han, Nathan Lambert, Nazneen Rajani, Omar Sanseviero, Lewis Tunstall, and Thomas Wolf. Open llm leaderboard. https://huggingface.co/spaces/ HuggingFaceH4/open_llm_leaderboard, 2023. \nStella Biderman, Hailey Schoelkopf, Quentin Anthony, Herbie Bradley, Kyle O’Brien, Eric Hallahan, Mohammad Aflah Khan, Shivanshu Purohit, USVSN Sai Prashanth, Edward Raff, et al. Pythia: A suite for analyzing large language models across training and scaling. arXiv preprint arXiv:2304.01373, 2023. \nSom Biswas. Chatgpt and the future of medical writing, 2023. \nTom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. \nYupeng Chang, Xu Wang, Jindong Wang, Yuan Wu, Kaijie Zhu, Hao Chen, Linyi Yang, Xiaoyuan Yi, Cunxiang Wang, Yidong Wang, et al. A survey on evaluation of large language models. arXiv preprint arXiv:2307.03109, 2023. \nSahil Chaudhary. Code alpaca: An instruction-following llama model for code generation. https: //github.com/sahil280114/codealpaca, 2023. \nHao Chen, Ran Tao, Yue Fan, Yidong Wang, Jindong Wang, Bernt Schiele, Xing Xie, Bhiksha Raj, and Marios Savvides. Softmatch: Addressing the quantity-quality trade-off in semi-supervised learning. 2023. \nHao Chen, Jindong Wang, Lei Feng, Xiang Li, Yidong Wang, Xing Xie, Masashi Sugiyama, Rita Singh, and Bhiksha Raj. A general framework for learning from weak supervision. arXiv preprint arXiv:2402.01922, 2024. \nWei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E Gonzalez, et al. Vicuna: An open-source chatbot impressing gpt-4 with $9 0 \\% *$ chatgpt quality. See https://vicuna. lmsys. org (accessed 14 April 2023), 2023. \nAakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022. \nKarl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. \nJacob Cohen. Kappa: Coefficient of concordance. Educ Psych Measurement, 20(37):37–46, 1960. ",
391
+ "page_idx": 9
392
+ },
393
+ {
394
+ "type": "text",
395
+ "text": "",
396
+ "page_idx": 9
397
+ },
398
+ {
399
+ "type": "text",
400
+ "text": "Nolan Dey, Gurpreet Gosal, Hemant Khachane, William Marshall, Ribhu Pathria, Marvin Tom, Joel Hestness, et al. Cerebras-gpt: Open compute-optimal language models trained on the cerebras wafer-scale cluster. arXiv preprint arXiv:2304.03208, 2023. \nShizhe Diao, Rui Pan, Hanze Dong, KaShun Shum, Jipeng Zhang, Wei Xiong, and Tong Zhang. Lmflow: An extensible toolkit for finetuning and inference of large foundation models. https: //optimalscale.github.io/LMFlow/, 2023. \nJesse Dodge, Gabriel Ilharco, Roy Schwartz, Ali Farhadi, Hannaneh Hajishirzi, and Noah Smith. Fine-tuning pretrained language models: Weight initializations, data orders, and early stopping. arXiv preprint arXiv:2002.06305, 2020. \nQingxiu Dong, Lei Li, Damai Dai, Ce Zheng, Zhiyong Wu, Baobao Chang, Xu Sun, Jingjing Xu, and Zhifang Sui. A survey on in-context learning. arXiv preprint arXiv:2301.00234, 2022. \nStefan Falkner, Aaron Klein, and Frank Hutter. Bohb: Robust and efficient hyperparameter optimization at scale. In International Conference on Machine Learning, pp. 1437–1446. PMLR, 2018. \nLeo Gao, Jonathan Tow, Stella Biderman, Sid Black, Anthony DiPofi, Charles Foster, Laurence Golding, Jeffrey Hsu, Kyle McDonell, Niklas Muennighoff, Jason Phang, Laria Reynolds, Eric Tang, Anish Thite, Ben Wang, Kevin Wang, and Andy Zou. A framework for few-shot language model evaluation, September 2021. URL https://doi.org/10.5281/zenodo.5371628. \nVarun Godbole, George E. Dahl, Justin Gilmer, Christopher J. Shallue, and Zachary Nado. Deep learning tuning playbook, 2023. URL http://github.com/google-research/tuning_ playbook. Version 1.0. \nIan Goodfellow, Yoshua Bengio, Aaron Courville, and Yoshua Bengio. Deep learning, volume 1. MIT Press, 2016. \nGoogle. Bard. 2023. \nZishan Guo, Renren Jin, Chuang Liu, Yufei Huang, Dan Shi, Linhao Yu, Yan Liu, Jiaxuan Li, Bojian Xiong, Deyi Xiong, et al. Evaluating large language models: A comprehensive survey. arXiv preprint arXiv:2310.19736, 2023. \nLynette Hirschman and Robert Gaizauskas. Natural language question answering: the view from here. natural language engineering, 7(4):275–300, 2001. \nEdward J Hu, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, Weizhu Chen, et al. Lora: Low-rank adaptation of large language models. In International Conference on Learning Representations. \nYunjie Ji, Yong Deng, Yiping Peng Yan Gong, Qiang Niu, Lei Zhang, Baochang Ma, and Xiangang Li. Exploring the impact of instruction data scaling on large language models: An empirical study on real-world use cases. arXiv preprint arXiv:2303.14742, 2023. \nJacob Devlin Ming-Wei Chang Kenton and Lee Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of NAACL-HLT, pp. 4171– 4186, 2019. \nTom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. Natural questions: a benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:453–466, 2019. \nLisha Li, Kevin Jamieson, Giulia DeSalvo, Afshin Rostamizadeh, and Ameet Talwalkar. Hyperband: A novel bandit-based approach to hyperparameter optimization. The Journal of Machine Learning Research, 18(1):6765–6816, 2017. \nRichard Liaw, Eric Liang, Robert Nishihara, Philipp Moritz, Joseph E Gonzalez, and Ion Stoica. Tune: A research platform for distributed model selection and training. arXiv preprint arXiv:1807.05118, 2018. ",
401
+ "page_idx": 10
402
+ },
403
+ {
404
+ "type": "text",
405
+ "text": "Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. ",
406
+ "page_idx": 11
407
+ },
408
+ {
409
+ "type": "text",
410
+ "text": "Jinghui Lu, Linyi Yang, Brian Mac Namee, and Yue Zhang. A rationale-centric framework for human-in-the-loop machine learning. arXiv preprint arXiv:2203.12918, 2022. \nCarlo A Mallio, Andrea C Sertorio, Caterina Bernetti, and Bruno Beomonte Zobel. Large language models for structured reporting in radiology: performance of gpt-4, chatgpt-3.5, perplexity and bing. La radiologia medica, pp. 1–5, 2023. \nOpenAI. Gpt-4 technical report. 2023. \nYassine Ouali, Céline Hudelot, and Myriam Tami. An overview of deep semi-supervised learning. arXiv preprint arXiv:2006.05278, 2020. \nBaolin Peng, Chunyuan Li, Pengcheng He, Michel Galley, and Jianfeng Gao. Instruction tuning with gpt-4. arXiv preprint arXiv:2304.03277, 2023. \nKrishna Pillutla, Swabha Swayamdipta, Rowan Zellers, John Thickstun, Sean Welleck, Yejin Choi, and Zaid Harchaoui. Mauve: Measuring the gap between neural text and human text using divergence frontiers. Advances in Neural Information Processing Systems, 34:4816–4828, 2021. \nAlec Radford, Karthik Narasimhan, Tim Salimans, Ilya Sutskever, et al. Improving language understanding by generative pre-training. \nSamyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. Zero: Memory optimizations toward training trillion parameter models. In SC20: International Conference for High Performance Computing, Networking, Storage and Analysis, pp. 1–16. IEEE, 2020. \nJeff Rasley, Samyam Rajbhandari, Olatunji Ruwase, and Yuxiong He. Deepspeed: System optimizations enable training deep learning models with over 100 billion parameters. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 3505–3506, 2020. \nJie Ren, Samyam Rajbhandari, Reza Yazdani Aminabadi, Olatunji Ruwase, Shuangyan Yang, Minjia Zhang, Dong Li, and Yuxiong He. Zero-offload: Democratizing billion-scale model training. In USENIX Annual Technical Conference, pp. 551–564, 2021. \nAnna Rogers, Olga Kovaleva, and Anna Rumshisky. A primer in bertology: What we know about how bert works. Transactions of the Association for Computational Linguistics, 8:842–866, 2021. \nTeven Le Scao, Angela Fan, Christopher Akiki, Ellie Pavlick, Suzana Ilic, Daniel Hesslow, Roman ´ Castagné, Alexandra Sasha Luccioni, François Yvon, Matthias Gallé, et al. Bloom: A 176bparameter open-access multilingual language model. arXiv preprint arXiv:2211.05100, 2022. \nAnastasia Shimorina and Anya Belz. The human evaluation datasheet: A template for recording details of human evaluation experiments in NLP. In Proceedings of the 2nd Workshop on Human Evaluation of NLP Systems (HumEval), pp. 54–75, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.humeval-1.6. URL https: //aclanthology.org/2022.humeval-1.6. \nFelix Stahlberg. Neural machine translation: A review. Journal of Artificial Intelligence Research, 69:343–418, 2020. \nChi Sun, Xipeng Qiu, Yige Xu, and Xuanjing Huang. How to fine-tune bert for text classification? In Chinese Computational Linguistics: 18th China National Conference, CCL 2019, Kunming, China, October 18–20, 2019, Proceedings 18, pp. 194–206. Springer, 2019. \nMingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International conference on machine learning, pp. 6105–6114. PMLR, 2019. \nRohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. https://github.com/tatsu-lab/stanford_alpaca, 2023. ",
411
+ "page_idx": 11
412
+ },
413
+ {
414
+ "type": "text",
415
+ "text": "Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023. ",
416
+ "page_idx": 12
417
+ },
418
+ {
419
+ "type": "text",
420
+ "text": "Lewis Tunstall, Leandro Von Werra, and Thomas Wolf. Natural language processing with transformers. \" O’Reilly Media, Inc.\", 2022. \nAshish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. \nAlex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. In International Conference on Learning Representations. \nChi Wang, Susan Xueqing Liu, and Ahmed H Awadallah. Cost-effective hyperparameter optimization for large language model generation inference. arXiv preprint arXiv:2303.04673, 2023a. \nCunxiang Wang, Shuailong Liang, Yue Zhang, Xiaonan Li, and Tian Gao. Does it make sense? and why? a pilot study for sense making and explanation, 2020. \nCunxiang Wang, Pai Liu, and Yue Zhang. Can generative pre-trained language models serve as knowledge bases for closed-book qa?, 2021. \nCunxiang Wang, Sirui Cheng, Qipeng Guo, Yuanhao Yue, Bowen Ding, Zhikun Xu, Yidong Wang, Xiangkun Hu, Zheng Zhang, and Yue Zhang. Evaluating open-QA evaluation. In Thirty-seventh Conference on Neural Information Processing Systems Datasets and Benchmarks Track, 2023b. URL https://openreview.net/forum?id $=$ UErNpveP6R. \nCunxiang Wang, Xiaoze Liu, Yuanhao Yue, Xiangru Tang, Tianhang Zhang, Cheng Jiayang, Yunzhi Yao, Wenyang Gao, Xuming Hu, Zehan Qi, Yidong Wang, Linyi Yang, Jindong Wang, Xing Xie, Zheng Zhang, and Yue Zhang. Survey on factuality in large language models: Knowledge, retrieval and domain-specificity, 2023c. \nCunxiang Wang, Haofei Yu, and Yue Zhang. RFiD: Towards rational fusion-in-decoder for open-domain question answering. In Anna Rogers, Jordan Boyd-Graber, and Naoaki Okazaki (eds.), Findings of the Association for Computational Linguistics: ACL 2023, pp. 2473–2481, Toronto, Canada, July 2023d. Association for Computational Linguistics. doi: 10.18653/v1/2023. findings-acl.155. URL https://aclanthology.org/2023.findings-acl.155. \nYidong Wang, Hao Chen, Yue Fan, Wang Sun, Ran Tao, Wenxin Hou, Renjie Wang, Linyi Yang, Zhi Zhou, Lan-Zhe Guo, Heli Qi, Zhen Wu, Yu-Feng Li, Satoshi Nakamura, Wei Ye, Marios Savvides, Bhiksha Raj, Takahiro Shinozaki, Bernt Schiele, Jindong Wang, Xing Xie, and Yue Zhang. Usb: A unified semi-supervised learning benchmark for classification. In Thirty-sixth Conference on Neural Information Processing Systems Datasets and Benchmarks Track, 2022a. doi: 10.48550/ARXIV.2208.07204. URL https://arxiv.org/abs/2208.07204. \nYidong Wang, Hao Wu, Ao Liu, Wenxin Hou, Zhen Wu, Jindong Wang, Takahiro Shinozaki, Manabu Okumura, and Yue Zhang. Exploiting unlabeled data for target-oriented opinion words extraction. arXiv preprint arXiv:2208.08280, 2022b. \nYidong Wang, Hao Chen, Qiang Heng, Wenxin Hou, Yue Fan, , Zhen Wu, Jindong Wang, Marios Savvides, Takahiro Shinozaki, Bhiksha Raj, Bernt Schiele, and Xing Xie. Freematch: Self-adaptive thresholding for semi-supervised learning. 2023e. \nYidong Wang, Zhuohao Yu, Jindong Wang, Qiang Heng, Hao Chen, Wei Ye, Rui Xie, Xing Xie, and Shikun Zhang. Exploring vision-language models for imbalanced learning. International Journal of Computer Vision, 2023f. \nYidong Wang, Bowen Zhang, Wenxin Hou, Zhen Wu, Jindong Wang, and Takahiro Shinozaki. Margin calibration for long-tailed visual recognition. In Asian Conference on Machine Learning, pp. 1101–1116. PMLR, 2023g. \nYiming Wang, Zhuosheng Zhang, and Rui Wang. Element-aware summarization with large language models: Expert-aligned evaluation and chain-of-thought method. arXiv preprint arXiv:2305.13412, 2023h. \nYizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language model with self generated instructions. arXiv preprint arXiv:2212.10560, 2022c. \nJia Wu, Xiu-Yun Chen, Hao Zhang, Li-Dong Xiong, Hang Lei, and Si-Hao Deng. Hyperparameter optimization for machine learning models based on bayesian optimization. Journal of Electronic Science and Technology, 17(1):26–40, 2019. \nCanwen Xu, Daya Guo, Nan Duan, and Julian McAuley. Baize: An open-source chat model with parameter-efficient tuning on self-chat data. arXiv preprint arXiv:2304.01196, 2023. \nLiang Xu, Hai Hu, Xuanwei Zhang, Lu Li, Chenjie Cao, Yudong Li, Yechen Xu, Kai Sun, Dian Yu, Cong Yu, et al. Clue: A chinese language understanding evaluation benchmark. In Proceedings of the 28th International Conference on Computational Linguistics, pp. 4762–4772, 2020. \nLinyi Yang, Jiazheng Li, Pádraig Cunningham, Yue Zhang, Barry Smyth, and Ruihai Dong. Exploring the efficacy of automatically generated counterfactuals for sentiment analysis. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 306–316, 2021. \nLinyi Yang, Shuibai Zhang, Libo Qin, Yafu Li, Yidong Wang, Hanmeng Liu, Jindong Wang, Xing Xie, and Yue Zhang. Glue-x: Evaluating natural language understanding models from an out-ofdistribution generalization perspective. arXiv preprint arXiv:2211.08073, 2022a. \nLinyi Yang, Yaoxian Song, Xuan Ren, Chenyang Lyu, Yidong Wang, Jingming Zhuo, Lingqiao Liu, Jindong Wang, Jennifer Foster, and Yue Zhang. Out-of-distribution generalization in natural language processing: Past, present, and future. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 4533–4559, 2023a. \nLinyi Yang, Shuibai Zhang, Zhuohao Yu, Guangsheng Bao, Yidong Wang, Jindong Wang, Ruochen Xu, Wei Ye, Xing Xie, Weizhu Chen, et al. Supervised knowledge makes large language models better in-context learners. arXiv preprint arXiv:2312.15918, 2023b. \nLu Yang, He Jiang, Qing Song, and Jun Guo. A survey on long-tailed visual recognition. International Journal of Computer Vision, 130(7):1837–1872, 2022b. \nTong Yu and Hong Zhu. Hyper-parameter optimization: A review of algorithms and applications. arXiv preprint arXiv:2003.05689, 2020. \nZhuohao Yu, Chang Gao, Wenjin Yao, Yidong Wang, Wei Ye, Jindong Wang, Xing Xie, Yue Zhang, and Shikun Zhang. Kieval: A knowledge-grounded interactive evaluation framework for large language models. arXiv preprint arXiv:2402.15043, 2024. \nAohan Zeng, Xiao Liu, Zhengxiao Du, Zihan Wang, Hanyu Lai, Ming Ding, Zhuoyi Yang, Yifan Xu, Wendi Zheng, Xiao Xia, et al. Glm-130b: An open bilingual pre-trained model. arXiv preprint arXiv:2210.02414, 2022a. \nZhengran Zeng, Hanzhuo Tan, Haotian Zhang, Jing Li, Yuqun Zhang, and Lingming Zhang. An extensive study on pre-trained models for program understanding and generation. In Sukyoung Ryu and Yannis Smaragdakis (eds.), ISSTA ’22: 31st ACM SIGSOFT International Symposium on Software Testing and Analysis, Virtual Event, South Korea, July 18 - 22, 2022, pp. 39–51. ACM, 2022b. doi: 10.1145/3533767.3534390. URL https://doi.org/10.1145/3533767. 3534390. \nChen Zhang, Yu Xie, Hang Bai, Bin Yu, Weihong Li, and Yuan Gao. A survey on federated learning. Knowledge-Based Systems, 216:106775, 2021a. \nSusan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, et al. Opt: Open pre-trained transformer language ",
421
+ "page_idx": 12
422
+ },
423
+ {
424
+ "type": "text",
425
+ "text": "",
426
+ "page_idx": 13
427
+ },
428
+ {
429
+ "type": "text",
430
+ "text": "models. arXiv preprint arXiv:2205.01068, 2022a. ",
431
+ "page_idx": 13
432
+ },
433
+ {
434
+ "type": "text",
435
+ "text": "Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q Weinberger, and Yoav Artzi. Bertscore: Evaluating text generation with bert. In International Conference on Learning Representations, 2019. Xin Zhang, Guangwei Xu, Yueheng Sun, Meishan Zhang, and Pengjun Xie. Crowdsourcing learning as domain adaptation: A case study on named entity recognition. In Chengqing Zong, Fei Xia, Wenjie Li, and Roberto Navigli (eds.), Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 5558–5570, Online, August 2021b. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.432. URL https://aclanthology.org/2021.acl-long.432. Xin Zhang, Guangwei Xu, Yueheng Sun, Meishan Zhang, Xiaobin Wang, and Min Zhang. Identifying Chinese opinion expressions with extremely-noisy crowdsourcing annotations. In Smaranda Muresan, Preslav Nakov, and Aline Villavicencio (eds.), Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2801–2813, Dublin, Ireland, May 2022b. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long. 200. URL https://aclanthology.org/2022.acl-long.200. Xin Zhang, Zehan Li, Yanzhao Zhang, Dingkun Long, Pengjun Xie, Meishan Zhang, and Min Zhang. Language models are universal embedders. arXiv preprint arXiv:2310.08232, 2023. Lianmin Zheng, Ying Sheng, Wei-Lin Chiang, Hao Zhang, Joseph Gonzalez, E., and Ion Stoica. Chatbot arena: Benchmarking llms in the wild with elo ratings. GitHub repository, 2023. Qihuang Zhong, Liang Ding, Juhua Liu, Bo Du, and Dacheng Tao. Can chatgpt understand too? a comparative study on chatgpt and fine-tuned bert. arXiv preprint arXiv:2302.10198, 2023. ",
436
+ "page_idx": 14
437
+ },
438
+ {
439
+ "type": "image",
440
+ "img_path": "images/c42cbc597eec12e6adbb54ef49658b3ca6d71242f74fb0d8448ba9f095dde23f.jpg",
441
+ "image_caption": [
442
+ "Figure 5: A training data example for PandaLM. ",
443
+ "Figure 6: The prompt for training PandaLM. "
444
+ ],
445
+ "image_footnote": [],
446
+ "page_idx": 15
447
+ },
448
+ {
449
+ "type": "text",
450
+ "text": "Below are two responses for a given task. The task is defined by the Instruction with an Input that provides further context. Evaluate the responses and generate a reference answer for the task. ",
451
+ "page_idx": 15
452
+ },
453
+ {
454
+ "type": "text",
455
+ "text": "### Instruction: {instruction} ### Input: {input} ",
456
+ "page_idx": 15
457
+ },
458
+ {
459
+ "type": "text",
460
+ "text": "",
461
+ "page_idx": 15
462
+ },
463
+ {
464
+ "type": "text",
465
+ "text": "### Response 1: {response 1, generated by a candidate model} ### Response 2: {response 2, generated by another candidate model} ",
466
+ "page_idx": 15
467
+ },
468
+ {
469
+ "type": "text",
470
+ "text": "",
471
+ "page_idx": 15
472
+ },
473
+ {
474
+ "type": "text",
475
+ "text": "### Evaluation: {evaluation result} {evaluation reason} ",
476
+ "page_idx": 15
477
+ },
478
+ {
479
+ "type": "text",
480
+ "text": "### Reference: ",
481
+ "text_level": 1,
482
+ "page_idx": 15
483
+ },
484
+ {
485
+ "type": "text",
486
+ "text": "{a reference response for the instruction} ",
487
+ "page_idx": 15
488
+ },
489
+ {
490
+ "type": "text",
491
+ "text": "A TRAINING PROMPT DETAILS ",
492
+ "text_level": 1,
493
+ "page_idx": 15
494
+ },
495
+ {
496
+ "type": "text",
497
+ "text": "We introduce the detailed prompt of training PandaLM in Figure 6. ",
498
+ "page_idx": 15
499
+ },
500
+ {
501
+ "type": "text",
502
+ "text": "B DIRECTED ACYCLIC GRAPH DEPICTING THE MIXTURE RANKING OF MODELS TRAINED USING BOTH ALPACA’S AND PANDALM’S HYPERPARAMETERS. ",
503
+ "text_level": 1,
504
+ "page_idx": 15
505
+ },
506
+ {
507
+ "type": "text",
508
+ "text": "A directed acyclic graph (DAG) is presented in Figure 7, illustrating the relative rankings of various models fine-tuned with different sets of hyperparameters. Notably, this ranking differs from those in Figure4, due to the variance in the test data: the test data for 7 is a sampled subset from that used in Figure4 which is deliberately chosen to ensure a high Inter-Annotator Agreement (IAA). A discernible pattern emerges from the rankings: models fine-tuned using PandaLM’s hyperparameters consistently outshine their counterparts fine-tuned with Alpaca’s. The top-rated model is PandaLM-LLaMA, followed by Alpaca-LLaMA, PandaLM-Bloom, PandaLM-Pythia, PandaLM-OPT, PandaLM-CerebrasGPT, Alpaca-OPT, Alpaca-Bloom, Alpaca-Pythia, and Alpaca-Cerebras-GPT, in descending order of performance. This juxtaposition accentuates the effectiveness of PandaLM’s hyperparameter selection in improving model performance, as models optimized with PandaLM consistently rank higher than those using Alpaca’s hyperparameters in the hybrid ranking. These findings underscore the potential of PandaLM as a powerful tool in enhancing the performance of large language models, further supporting the assertion of its efficacy. ",
509
+ "page_idx": 15
510
+ },
511
+ {
512
+ "type": "image",
513
+ "img_path": "images/d3ffdc81b5c50b69d1443437173c8677e0358cae6d294f1a1d00e5ee921decef.jpg",
514
+ "image_caption": [
515
+ "Figure 7: Directed Acyclic Graph depicting the mixture ranking of models trained using both Alpaca’s and PandaLM’s hyperparameters. The models are ranked from strongest to weakest in the following order: PandaLM-LLaMA, Alpaca-LLaMA, PandaLM-Bloom, PandaLM-Pythia, PandaLM-OPT, PandaLM-Cerebras-GPT, Alpaca-OPT, Alpaca-Bloom, Alpaca-Pythia, Alpaca-Cerebras-GPT. "
516
+ ],
517
+ "image_footnote": [],
518
+ "page_idx": 16
519
+ },
520
+ {
521
+ "type": "table",
522
+ "img_path": "images/c261e7e2cbc1b25b6defce6eca57b531307131d556e13263fa7f04f4572253b7.jpg",
523
+ "table_caption": [
524
+ "Table 6: Comparison on several downstream tasks using lm-eval(Gao et al., 2021) between foundation models fine-tuned on Alpaca’s hyperparameters, and foundation models fine-tuned with PandaLM. Note that the MMLU task consists of 57 subtasks, which means providing a comprehensive standard deviation here is not feasible. "
525
+ ],
526
+ "table_footnote": [],
527
+ "table_body": "<table><tr><td></td><td>ARC-Challenge-acc_norm(25-shot)</td><td>Hellaswag-acc_norm(10-shot)</td><td>MMLU-average-acc(5-shot)</td><td>TruthfulQA-mc2(0-shot)</td><td>Average</td></tr><tr><td>llama-7b original</td><td>0.4923±0.0146</td><td>0.7583±0.0043</td><td>0.3306</td><td>0.3703±0.0141</td><td>0.4879</td></tr><tr><td>llama-7b w/ PandaLM</td><td>0.5162±0.0146</td><td>0.7764±0.0042</td><td>0.3396</td><td>0.3801±0.0145</td><td>0.5031</td></tr><tr><td>opt-6.7b original</td><td>0.3805±0.0142</td><td>0.6535±0.0047</td><td>0.2476</td><td>0.3587±0.0139</td><td>0.4101</td></tr><tr><td>opt-6.7b w/ PandaLM</td><td>0.3771±0.0142</td><td>0.6540±0.0047</td><td>0.2502</td><td>0.3609±0.0142</td><td>0.4106</td></tr><tr><td>pythia-6.9b original</td><td>0.3848±0.0142</td><td>0.6093±0.0049</td><td>0.2490</td><td>0.4187±0.0148</td><td>0.4155</td></tr><tr><td>pythia-6.9b w/PandaLM</td><td>0.4130±0.0144</td><td>0.6337±0.0048</td><td>0.2581</td><td>0.3972±0.0144</td><td>0.4255</td></tr><tr><td>bloom-7boriginal</td><td>0.3985±0.0143</td><td>0.6086±0.0049</td><td>0.2635</td><td>0.3975±0.0148</td><td>0.4170</td></tr><tr><td>bloom-7b w/ PandaLM Cerebras-GPT-6.7B original</td><td>0.3951±0.0143 0.3524±0.0140</td><td>0.6084±0.0049</td><td>0.2520</td><td>0.3997±0.0149</td><td>0.4138</td></tr><tr><td>Cerebras-GPT-6.7B w/PandaLM</td><td>0.3558±0.0140</td><td>0.5613±0.0050 0.5550±0.0050</td><td>0.2584 0.2452</td><td>0.3624±0.0140</td><td>0.3836</td></tr><tr><td></td><td></td><td></td><td></td><td>0.3448±0.0141</td><td>0.3752</td></tr></table>",
528
+ "page_idx": 16
529
+ },
530
+ {
531
+ "type": "text",
532
+ "text": "C COMPARISONS BETWEEN ORIGINAL MODELS AND MODELS TUNED USING PANDALM ON TRADITIONAL TASKS ",
533
+ "text_level": 1,
534
+ "page_idx": 16
535
+ },
536
+ {
537
+ "type": "text",
538
+ "text": "We compare fine-tuned LLMs on various traditional tasks with lm-eval (Gao et al., 2021). Although the majority of language models exhibit improved performance after finetuning with PandaLM, Cerebras exhibits a decline. This highlights the importance of nuanced, subjective evaluations (win/tie/lose of responses). Human evaluations, as well as assessments from GPT-4 and GPT-3.5, all concur in indicating a better performance from Cerebras when paired with PandaLM. This is also confirmed in (Yu et al., 2024). ",
539
+ "page_idx": 16
540
+ },
541
+ {
542
+ "type": "text",
543
+ "text": "As shown in Table 7, the evaluation results of language models show that lower perplexity, indicating better predictive ability in pretraining or other tasks, does not always mean better overall performance of instruction-tuned models. For example, LLaMA-PandaLM has a higher perplexity than LLaMAAlpaca but outperforms it in both pairwise comparisons (PandaLM, GPT, Human) and traditional tasks (lm-eval). This suggests that while perplexity is not feasible for instruction-tuned models where lower perplexity might mean overfitting and less generalizability. ",
544
+ "page_idx": 16
545
+ },
546
+ {
547
+ "type": "table",
548
+ "img_path": "images/e5f9520560fabeab42cba36a07c80f7cf82ef97b190ccefb74922f85a8f52b9c.jpg",
549
+ "table_caption": [
550
+ "Table 7: Analysis on perplexity and other evaluation metrics. Note that we report the win rate over 170 samples of PandaLM, GPT, and Human. "
551
+ ],
552
+ "table_footnote": [],
553
+ "table_body": "<table><tr><td>Model</td><td>Perplexity (↓)</td><td>PandaLM-7B(↑)</td><td>PandaLM-70B(↑)</td><td>GPT-3.5 (↑)</td><td>GPT-4 (↑)</td><td>Human(↑)</td><td>Im-eval avg.score(↑)</td></tr><tr><td>LLaMA-Alpaca</td><td>2.75</td><td>15.88%</td><td>22.94%</td><td>15.29%</td><td>10.00%</td><td>12.35%</td><td>0.4879</td></tr><tr><td>LLaMA-PandaLM</td><td>2.81</td><td>19.41%</td><td>35.88%</td><td>26.47%</td><td>23.53%</td><td>48.24%</td><td>0.5031</td></tr></table>",
554
+ "page_idx": 17
555
+ },
556
+ {
557
+ "type": "text",
558
+ "text": "",
559
+ "page_idx": 17
560
+ },
561
+ {
562
+ "type": "text",
563
+ "text": "D LAW / BIOMEDICAL DATASETS INTRODUCTION ",
564
+ "text_level": 1,
565
+ "page_idx": 17
566
+ },
567
+ {
568
+ "type": "text",
569
+ "text": "Specifically, we assess PandaLM’s proficiency using the LSAT (Law School Admission Test) dataset, which serves as an entrance exam question set for American law schools. This dataset incorporates 1,009 questions, further divided into three subsets: AR, LR, and RC. In the realm of biomedicine, we use the PubMedQA dataset—a vast repository for biomedical retrieval QA data, boasting 1k expert annotations, 61.2k unlabeled entries, and a massive $2 1 1 . 3 \\mathrm { k }$ human-generated QA instances. For our evaluation, we rely on the labeled section (PubMedQA-l) that contains 1k instances. Each instance encompasses a question, context, and label. Additionally, we tap into the BioASQ dataset, specifically leveraging the task b dataset from its 11th challenge. This dataset is renowned for its biomedical semantic indexing and question-answering (QA) capabilities. From it, we use 1k samples for our assessment. We will test code/math dataset Cobbe et al. (2021); Zeng et al. (2022b) in future work. ",
570
+ "page_idx": 17
571
+ },
572
+ {
573
+ "type": "text",
574
+ "text": "E DATA SIZE AND QUALITY ANALYSIS IN INSTRUCTION TUNING ",
575
+ "text_level": 1,
576
+ "page_idx": 17
577
+ },
578
+ {
579
+ "type": "text",
580
+ "text": "We conduct an ablation study to investigate the impact of training data size (up to 1,344,000) on the performance of the model, given optimal hyperparameters. Importantly, a relationship exists between the size and quality of training data. Thus, we focus on an ablation study of data size here, but conducting a similar experiment on data quality is feasible. We derive the results from PandaLM-7B. The objective is to discern how much training data is required to reach each model’s peak performance. Table 8 reveals the optimal quantity of training data varies among models. More training data typically enhances model performance. However, an optimal point exists for each model, beyond which further data doesn’t improve performance. For example, the OPT model peaks at 992,000 data points, indicating additional data does not enhance the model’s performance. ",
581
+ "page_idx": 17
582
+ },
583
+ {
584
+ "type": "table",
585
+ "img_path": "images/6ad68b1acdef66c29c74f7562cab29ac62337353c428f3c3c87b14d92e7e3961.jpg",
586
+ "table_caption": [
587
+ "Table 8: Optimal training data size for each model. "
588
+ ],
589
+ "table_footnote": [],
590
+ "table_body": "<table><tr><td>Model</td><td>Bloom</td><td>Cerebras-GPT</td><td>LLaMA</td><td>OPT</td><td>Pythia</td></tr><tr><td>Optimal Training Data Size</td><td>1,216,000</td><td>1,344,000</td><td>11,520,000</td><td>992.000</td><td>1,344,000</td></tr></table>",
591
+ "page_idx": 17
592
+ },
593
+ {
594
+ "type": "text",
595
+ "text": "F LORA ANALYSIS IN INSTRUCTION TUNING",
596
+ "text_level": 1,
597
+ "page_idx": 17
598
+ },
599
+ {
600
+ "type": "text",
601
+ "text": "We further aim to evaluate the efficacy of Low-Rank Adaptation (LoRA) (Hu et al.) compared to full fine-tuning across various models, utilizing optimal hyperparameters. The results are also obtained from PandaLM-7B. Our analysis seeks to provide a comparative understanding of these tuning methodologies. As shown in Table 9, the results for the Bloom model reveal a distinct advantage for full fine-tuning, which triumphs over LoRA in 66 instances as opposed to LoRA’s 35. Notably, they tie in 69 instances. In the case of the Cerebras model, full fine-tuning again proves superior, leading in 59 cases compared to LoRA’s 40, despite drawing even 71 times. The trend of full fine-tuning superiority is consistent in the LLaMA model. Out of 170 instances, full fine-tuning results in better performance in 48 instances, whereas LoRA emerges victorious in only 28 instances. The majority of the results are tied, amounting to 94 instances. In the OPT model, full fine-tuning once more showcases its advantage with 64 instances of superior performance compared to LoRA’s 33, while recording a tie in 73 instances. Lastly, for the Pythia model, full fine-tuning leads the race with 71 instances of better performance against LoRA’s 21, and a tie occurring in 78 instances. These results underscore that full fine-tuning generally yields more favorable results compared to the use of LoRA, though the outcomes can vary depending on the model. Despite the considerable number of ties, full fine-tuning holds the upper hand in most models, thereby highlighting its effectiveness. This suggests that while LoRA may provide comparable results in some instances, a strategy of full fine-tuning often proves to be the more beneficial approach in enhancing model performance. ",
602
+ "page_idx": 17
603
+ },
604
+ {
605
+ "type": "text",
606
+ "text": "",
607
+ "page_idx": 18
608
+ },
609
+ {
610
+ "type": "table",
611
+ "img_path": "images/0e390fd6fee0b5ce2f27ada857eee2c58c7f292fb37eb3bb89d95aa979faa619.jpg",
612
+ "table_caption": [
613
+ "Table 9: Comparison of LoRA and Full Fine-tuning. "
614
+ ],
615
+ "table_footnote": [],
616
+ "table_body": "<table><tr><td>Model</td><td>LoRA Wins</td><td>Full Fine-tuning Wins</td><td>Ties</td></tr><tr><td>Bloom</td><td>35</td><td>66</td><td>69</td></tr><tr><td>Cerebras-GPT</td><td>40</td><td>59</td><td>71</td></tr><tr><td>LLaMA</td><td>28</td><td>48</td><td>94</td></tr><tr><td>OPT</td><td>33</td><td>64</td><td>73</td></tr><tr><td>Pythia</td><td>21</td><td>71</td><td>78</td></tr></table>",
617
+ "page_idx": 18
618
+ },
619
+ {
620
+ "type": "text",
621
+ "text": "G LEVERAGING PRE-TRAINED MODELS AND OTHER INSTRUCTION TUNED MODELS FOR EVALUATION ",
622
+ "text_level": 1,
623
+ "page_idx": 18
624
+ },
625
+ {
626
+ "type": "text",
627
+ "text": "Employing LLMs for response evaluation without additional training is a natural direction for the task. However, implementing evaluation criteria through zero-shot or few-shot methods is challenging for LLMs due to the necessity for extended context lengths. ",
628
+ "page_idx": 18
629
+ },
630
+ {
631
+ "type": "text",
632
+ "text": "We have undertaken experiments using zero-shot and few-shot (in-context learning Dong et al. (2022); Yang et al. (2023b)) evaluations with LLaMA. Our observations indicate that an un-tuned LLaMA struggles with adhering to user-specified format requirements. Consequently, our experiments focused on computing and comparing the log-likelihood of generating continuations (e.g., determining whether “Response 1 is better,” “Response 2 is better,” or if both responses are similar in quality) from the same context. We regard the choice with the highest log-likelihood as the prediction result. We also alternated response order in our experiments to reduce position bias. Furthermore, we undertook experiments with Vicuna, a finetuned version of LLaMA. The experiments demonstrated that the evaluation capabilities of instruction-tuned models possess significant potential for enhancement. ",
633
+ "page_idx": 18
634
+ },
635
+ {
636
+ "type": "text",
637
+ "text": "The results in Table 10 highlight the importance of tailored tuning for evaluation, a precisely-tuned smaller model outperforms a larger one in zero and few-shot scenarios. ",
638
+ "page_idx": 18
639
+ },
640
+ {
641
+ "type": "text",
642
+ "text": "H ENHANCING PANDALM WITH REFINED SUPERVISION. ",
643
+ "text_level": 1,
644
+ "page_idx": 18
645
+ },
646
+ {
647
+ "type": "text",
648
+ "text": "In our supervision goal, we incorporate not only the comparative result of responses but also a succinct explanation and a reference response. This methodology augments PandaLM’s comprehension of the evaluation criteria. ",
649
+ "page_idx": 18
650
+ },
651
+ {
652
+ "type": "table",
653
+ "img_path": "images/86536c238588e14d2ec204b76f0ec532d499a2682935d05ee0044f422a4a5552.jpg",
654
+ "table_caption": [
655
+ "Table 10: Ablation study of directly using pre-trained models and instruction tuned models for evaluation. "
656
+ ],
657
+ "table_footnote": [],
658
+ "table_body": "<table><tr><td>Model</td><td> Accuracy</td><td>Precision</td><td>Recall</td><td>F1 score</td></tr><tr><td>LLaMA-7B 0-shot (log-likelihood)</td><td>12.11</td><td>70.23</td><td>34.52</td><td>8.77</td></tr><tr><td>LLaMA-30B 0-shot (log-likelihood)</td><td>31.43</td><td>56.48</td><td>43.12</td><td>32.83</td></tr><tr><td>LLaMA-7B 5-shot (log-likelihood)</td><td>24.82</td><td>46.99</td><td>39.79</td><td>25.43</td></tr><tr><td>LLaMA-30B 5-shot (log-likelihood)</td><td>42.24</td><td>61.99</td><td>51.76</td><td>42.93</td></tr><tr><td>Vicuna-7B (log-likelihood)</td><td>15.92</td><td>57.53</td><td>34.90</td><td>14.90</td></tr><tr><td>Vicuna-13B (log-likelihood)</td><td>35.24</td><td>57.45</td><td>43.65</td><td>36.29</td></tr><tr><td>PandaLM-7B</td><td>59.26</td><td>57.28</td><td>59.23</td><td>54.56</td></tr><tr><td>PandaLM-7B (log-likelihood)</td><td>59.26</td><td>59.70</td><td>63.07</td><td>55.78</td></tr></table>",
659
+ "page_idx": 18
660
+ },
661
+ {
662
+ "type": "table",
663
+ "img_path": "images/47e0ee31fd4ab392a83f6a2055f83f9bc19de9d28b3c73ec4f000427100700ce.jpg",
664
+ "table_caption": [
665
+ "Table 11: Ablation study of supervision goal. "
666
+ ],
667
+ "table_footnote": [],
668
+ "table_body": "<table><tr><td>Model</td><td> Accuracy</td><td>Precision</td><td>Recall</td><td>F1</td></tr><tr><td>PandaLM-7B (with only eval label)</td><td>0.4725</td><td>0.4505</td><td>0.4725</td><td>0.3152</td></tr><tr><td>PandaLM-7B</td><td>0.5926</td><td>0.5728</td><td>0.5923</td><td>0.5456</td></tr></table>",
669
+ "page_idx": 19
670
+ },
671
+ {
672
+ "type": "text",
673
+ "text": "To empirically gauge the significance of this explanation, an experiment was executed. Here, the explanation and reference were omitted during training, and only the categorical outcomes (0/1/2 or Tie/Win/Lose) were retained in the dataset for training a fresh iteration of PandaLM. The results, as depicted in Table 11, demonstrate that in the absence of the explanation, PandaLM encounters difficulties in precisely determining the preferable response. ",
674
+ "page_idx": 19
675
+ },
676
+ {
677
+ "type": "text",
678
+ "text": "I HUMAN EVALUATION DATASHEET ",
679
+ "text_level": 1,
680
+ "page_idx": 19
681
+ },
682
+ {
683
+ "type": "text",
684
+ "text": "We employ human annotators from a crowdsourcing company and pay them fairly. In particular, we pay our annotators 50 dollars per hour, which is above the average local income level. We have filled out the Google Sheet provided in (Shimorina & Belz, 2022). ",
685
+ "page_idx": 19
686
+ },
687
+ {
688
+ "type": "text",
689
+ "text": "J HYPERPARAMETER OPTIMIZATION ANALYSIS ",
690
+ "text_level": 1,
691
+ "page_idx": 19
692
+ },
693
+ {
694
+ "type": "text",
695
+ "text": "In our hyperparameter searching process, we explored a range of learning rates, epochs, optimizers, and schedulers. The learning rates tested varied from 2e-6 to 2e-4, with model checkpoints saved at the end of each epoch. Performance was rigorously assessed through pairwise comparisons between checkpoints, counting the win rounds for each model, as detailed in Figure 8. ",
696
+ "page_idx": 19
697
+ },
698
+ {
699
+ "type": "text",
700
+ "text": "Our analysis, as depicted in Figure 8a, suggests a tendency towards a learning rate of 2e-5, although this preference was not uniformly clear across all models. Figure 8b demonstrates the variability in the optimal number of epochs, with a trend showing that peak performance often occurs around the fourth or fifth epoch. This evidence points to the complex interplay of hyperparameters with model performance, which is further influenced by data distribution, optimizer, and scheduler choices. ",
701
+ "page_idx": 19
702
+ },
703
+ {
704
+ "type": "text",
705
+ "text": "The findings from our hyperparameter optimization process highlight that there is no universally optimal setting for different models and training setups. While a pattern emerged suggesting that a learning rate around 2e-5 and an epoch count near 4 might be beneficial in some cases, these results are not conclusive. This reinforces the need for specific hyperparameter searches for different models, as demonstrated in our visualizations. A tailored approach to hyperparameter optimization is essential, as it allows for a more nuanced understanding of model performance across various scenarios. ",
706
+ "page_idx": 19
707
+ },
708
+ {
709
+ "type": "text",
710
+ "text": "Besides, we implemented an early stopping strategy using Pandalm. We focus specifically on LLaMA. Our experiments showed that in some cases, a model’s performance at epoch 3 was inferior to that at epoch 2. However, subsequent epochs demonstrated performance improvements. This indicates that early stopping may not always be suitable for large model fine-tuning, as it could prematurely halt training before reaching optimal performance. ",
711
+ "page_idx": 19
712
+ },
713
+ {
714
+ "type": "table",
715
+ "img_path": "images/a14846d51478c242ccae2e80e208a25b8a857f48f2844fe3f15fec2983ebc361.jpg",
716
+ "table_caption": [
717
+ "Table 12: Analysis of PandaLM’s Evaluation Capability on Unseen Models. "
718
+ ],
719
+ "table_footnote": [],
720
+ "table_body": "<table><tr><td>Model Comparison</td><td>PandaLM</td><td>Human</td><td>Metrics (P,R, F1)</td></tr><tr><td>llama1-7b vs llama2-7b</td><td>(23,61,16)</td><td>(23,70,7)</td><td>(0.7061,0.7100,0.6932)</td></tr><tr><td>llamal-13b vs llama2-13b</td><td>(18,73,9)</td><td>(20,68,12)</td><td>(0.7032,0.6800,0.6899)</td></tr><tr><td>llamal-65b vs llama2-70b</td><td>(20,66,14)</td><td>(34,56,10)</td><td>(0.7269,0.6600,0.6808)</td></tr></table>",
721
+ "page_idx": 19
722
+ },
723
+ {
724
+ "type": "text",
725
+ "text": "K MODEL SHIFT ANALYSIS ",
726
+ "text_level": 1,
727
+ "page_idx": 19
728
+ },
729
+ {
730
+ "type": "text",
731
+ "text": "In Table 12, we provide a detailed comparison of PandaLM’s performance against human benchmarks and in the context of different versions of instruction-tuned LLaMA models. Note that llama1-13b, llama1-65b and llama2 are indicative of model shift. The results demonstrate that PandaLM aligns closely with humans, consistently showing a preference for the LLama-2 model. This alignment is in line with expectations, as LLama-2 benefits from more pre-training data. Such findings highlight the significance of extensive pre-training in developing language models that are more skilled at understanding and correctly responding to various instructions. ",
732
+ "page_idx": 19
733
+ },
734
+ {
735
+ "type": "image",
736
+ "img_path": "images/de84ee205e974b27734b2017916987f205e35f52d83313d0761bc87e7f834088.jpg",
737
+ "image_caption": [
738
+ "Figure 8: Hyperparameter Optimization Analysis in PandaLM. The figure illustrates the performance across different learning rates and variability in model performance across epochs. "
739
+ ],
740
+ "image_footnote": [],
741
+ "page_idx": 20
742
+ },
743
+ {
744
+ "type": "text",
745
+ "text": "",
746
+ "page_idx": 20
747
+ }
748
+ ]
parse/test/5Nn2BLV7SB/5Nn2BLV7SB_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/5Nn2BLV7SB/5Nn2BLV7SB_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/Ee277P3AYC/Ee277P3AYC.md ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CoCa: Contrastive Captioners are Image-Text Foundation Models
2
+
3
+ Jiahui $\mathbf { Y } \mathbf { u } ^ { \star }$
4
+ Zirui Wang?
5
+ Vijay Vasudevan
6
+ Legg Yeung
7
+ Mojtaba Seyedhosseini Yonghui Wu
8
+ Google Research
9
+ $\star$ Equal contribution.
10
+
11
+ Reviewed on OpenReview: https: // openreview. net/ forum? id= Ee277P3AYC
12
+
13
+ # Abstract
14
+
15
+ Exploring large-scale pretrained foundation models is of significant interest in computer vision because these models can be quickly transferred to many downstream tasks. This paper presents Contrastive Captioner (CoCa), a minimalist design to pretrain an image-text encoder-decoder foundation model jointly with contrastive loss and captioning loss, thereby subsuming model capabilities from contrastive approaches like CLIP and generative methods like SimVLM. In contrast to standard encoder-decoder transformers where all decoder layers attend to encoder outputs, CoCa omits cross-attention in the first half of decoder layers to encode unimodal text representations, and cascades the remaining decoder layers which cross-attend to the image encoder for multimodal image-text representations. We apply a contrastive loss between unimodal image and text embeddings, in addition to a captioning loss on the multimodal decoder outputs which predicts text tokens autoregressively. By sharing the same computational graph, the two training objectives are computed efficiently with minimal overhead. CoCa is pretrained end-to-end and from scratch on both webscale alt-text data and annotated images by treating all labels simply as text, seamlessly unifying natural language supervision for representation learning. Empirically, CoCa achieves state-of-the-art performance with zero-shot transfer or minimal task-specific adaptation on a broad range of downstream tasks, spanning visual recognition (ImageNet, Kinetics400/600/700, Moments-in-Time), crossmodal retrieval (MSCOCO, Flickr30K, MSR-VTT), multimodal understanding (VQA, SNLI-VE, NLVR2), and image captioning (MSCOCO, NoCaps). Notably on ImageNet classification, CoCa obtains 86.3% zero-shot top-1 accuracy, $9 0 . 6 \%$ with a frozen encoder and learned classification head, and $9 1 . 0 \%$ with a finetuned encoder.
16
+
17
+ # 1 Introduction
18
+
19
+ Deep learning has recently witnessed the rise of foundation language models (Bommasani et al., 2021) such as BERT (Devlin et al., 2018), T5 (Raffel et al., 2019), GPT-3 (Brown et al., 2020), where models are pretrained on web-scale data and demonstrate generic multi-tasking capabilities through zero-shot, few-shot or transfer learning. Compared with specialized individual models, pretraining foundation models for massive downstream tasks can amortize training costs, providing opportunities to push the limits of model scale (Barham et al., 2022) for human-level intelligence.
20
+
21
+ ![](images/0b39fb82c55c55f99f0e64f5095268f1edba0dc1e66cf68f8c572082feb1cd48.jpg)
22
+ Figure 1: Overview of Contrastive Captioners (CoCa) pretraining as image-text foundation models. The pretrained CoCa can be used for downstream tasks including visual recognition, vision-language alignment, image captioning and multimodal understanding with zero-shot transfer, frozen-feature evaluation or end-toend finetuning.
23
+
24
+ For vision and vision-language problems, several foundation model candidates have been explored: (1) Pioneering works (Girshick et al., 2014; Long et al., 2015; Simonyan $\&$ Zisserman, 2014) have shown the effectiveness of single-encoder models pretrained with cross-entropy loss on image classification datasets such as ImageNet (Deng et al., 2009). The image encoder provides generic visual representations that can be adapted for various downstream tasks including image and video understanding (Dai et al., 2021; Zhang et al., 2021a). However, these models rely heavily on image annotations as labeled vectors and do not bake in knowledge of free-form human natural language, hindering their application to downstream tasks that involving both vision and language modalities. (2) Recently, a line of research (Radford et al., 2021; Jia et al., 2021; Yuan et al., 2021) has shown the feasibility of image-text foundation model candidates by pretraining two parallel encoders with a contrastive loss on web-scale noisy image-text pairs. In addition to the visual embeddings for vision-only tasks, the resulting dual-encoder models can additionally encode textual embeddings to the same latent space, enabling new crossmodal alignment capabilities such as zero-shot image classification and image-text retrieval. Nonetheless, these models are not directly applicable for joint vision-language understanding tasks such as visual question answering (VQA), due to missing joint components to learn fused image and text representations. (3) Another line of research (Vinyals et al., 2015; Wang et al., 2021b; 2022) has explored generative pretraining with encoder-decoder models to learn generic vision and multimodal representations. During pretraining, the model takes images on the encoder side and applies Language Modeling (LM) loss (or PrefixLM (Raffel et al., 2019; Wang et al., 2021b)) on the decoder outputs. For downstream tasks, the decoder outputs can then be used as joint representations for multimodal understanding tasks. While superior vision-language results (Wang et al., 2021b) have been attained with pretrained encoder-decoder models, they do not produce text-only representations aligned with image embeddings, thereby being less feasible and efficient for crossmodal alignment tasks.
25
+
26
+ In this work, we unify single-encoder, dual-encoder and encoder-decoder paradigms, and train one image-text foundation model that subsumes the capabilities of all three approaches. We propose a simple model family named Contrastive Captioners (CoCa) with a modified encoder-decoder architecture trained with both contrastive loss and captioning (generative) loss. As shown in Figure 1, we decouple the decoder transformer into two parts, a unimodal decoder and a multimodal decoder. We omit cross-attention in unimodal decoder layers to encode text-only representations, and cascade multimodal decoder layers cross-attending to image encoder outputs to learn multimodal image-text representations. We apply both the contrastive objective between outputs of the image encoder and unimodal text decoder, and the captioning objective at the output of the multimodal decoder. Furthermore, CoCa is trained on both image annotation data and noisy image-text data by treating all labels simply as text. The generative loss on image annotation text provides a fine-grained training signal similar to the single-encoder cross-entropy loss approach, effectively subsuming all three pretraining paradigms into a single unified method.
27
+
28
+ The design of CoCa leverages contrastive learning for learning global representations and captioning for fine-grained region-level features, thereby benefiting tasks across all three categories shown in Figure 1. CoCa shows that a single pretrained model can outperform many specialized models using zero-shot transfer or minimal task-specific adaptation. For example, CoCa obtains $8 6 . 3 \%$ zero-shot accuracy on ImageNet and better zero-shot crossmodal retrieval on MSCOCO and Flickr30k. With a frozen-encoder, CoCa achieves $9 0 . 6 \%$ on ImageNet classification, 88.0%/88.5%/81.1% on Kinetics-40/600/700 and 47.4% on Moments-in-Time. After lightweight finetuning, CoCa further achieves 91.0% on ImageNet, 82.3% on VQA and 120.6 CIDEr score on NoCaps.
29
+
30
+ # 2 Related Work
31
+
32
+ Vision Pretraining. Pretraining ConvNets (Krizhevsky et al., 2012) or Transformers (Vaswani et al., 2017) on large-scale annotated data such as ImageNet (Girshick et al., 2014; Long et al., 2015; Simonyan & Zisserman, 2014), Instagram (Mahajan et al., 2018) or JFT (Zhai et al., 2021a) has become a popular strategy towards solving visual recognition problems including classification, localization, segmentation, video recognition, tracking and many other problems. Recently, self-supervised pretraining approaches have also been explored. BEiT (Bao et al., 2021) proposes a masked image modeling task following BERT (Devlin et al., 2018) in natural language processing, and uses quantized visual token ids as prediction targets. MAE (He et al., 2021) and SimMIM (Xie et al., 2021) remove the need for an image tokenizer and directly use a light-weight decoder or projection layer to regress pixel values. Nonetheless, these methods only learn models for the vision modality and thus they are not applicable to tasks that require joint reasoning over both image and text inputs.
33
+
34
+ Vision-Language Pretraining. In recent years, rapid progress has been made in vision-language pretraining (VLP), which aims to jointly encode vision and language in a fusion model. Early work (e.g. LXMERT (Tan & Bansal, 2019), UNITER (Chen et al., 2020), VinVL (Zhang et al., 2021b), VL-T5 (Cho et al., 2021)) in this direction relies on pretrained object detection modules such as Fast(er) R-CNN (Ren et al., 2015) to extract visual representations. Later efforts such as ViLT (Kim et al., 2021) and VLMo (Wang et al., 2021a) unify vision and language transformers, and train a multimodal transformer from scratch. More recently, a line of work has also explored zero-shot/few-shot learning for vision-language tasks by re-using pretrained large language models (Yang et al., 2022b; Jin et al., 2021; Tsimpoukelli et al., 2021). Compared to prior methods, this paper focuses on training a unified model from scratch subsuming the capability of multimodal understanding and generation.
35
+
36
+ Image-Text Foundation Models. Recent work has proposed image-text foundation models that can subsume both vision and vision-language pretraining. CLIP (Radford et al., 2021) and ALIGN (Jia et al., 2021) demonstrate that dual-encoder models pretrained with contrastive objectives on noisy image-text pairs can learn strong image and text representations for crossmodal alignment tasks and zero-shot image classification. Florence (Yuan et al., 2021) further develops this method with unified contrastive objective (Yang et al., 2022a), training foundation models that can be adapted for a wide range of vision and image-text benchmarks. To further improve zero-shot image classification accuracy, LiT (Zhai et al., 2021b) and BASIC (Pham et al., 2021a) first pretrain model on an large-scale image annotation dataset with cross-entropy and further finetune with contrastive loss on an noisy alt-text image dataset. Another line of research (Wang et al., 2021b; 2022; Piergiovanni et al., 2022) proposes encoder-decoder models trained with generative losses and shows strong results in vision-language benchmarks while the visual encoder still performs competitively on image classification. In this work, we focus on training an image-text foundation model from scratch in a single pretraining stage to unify these approaches. While recent works (Singh et al., 2021; Li et al., 2021; 2022) have also explored image-text unification, they require multiple pretraining stages of unimodal and multimodal modules to attain good performance. For example, ALBEF (Li et al., 2021) combines contrastive loss with masked language modelling (MLM) with a dual-encoder design. However, our approach is simpler and more efficient to train while also enables more model capabilities: (1) CoCa only performs one forward and backward propagation for a batch of image-text pairs while ALBEF requires two (one on corrupted inputs and another without corruption), (2) CoCa is trained from scratch on the two objectives only while ALBEF is initialized from pretrained visual and textual encoders with additional training signals including momentum modules. (3) The decoder architecture with generative loss is preferred for natural language generation and thus directly enables image captioning.
37
+
38
+ # 3 Approach
39
+
40
+ We begin with a review of three foundation model families that utilize natural language supervision differently: single-encoder classification pretraining, dual-encoder contrastive learning, and encoder-decoder image captioning. We then introduce Contrastive Captioners (CoCa) that share the merits of both contrastive learning and image-to-caption generation under a simple architecture. We further discuss how CoCa models can quickly transfer to downstream tasks with zero-shot transfer or minimal task adaptation.
41
+
42
+ # 3.1 Natural Language Supervision
43
+
44
+ Single-Encoder Classification. The classic single-encoder approach pretrains a visual encoder through image classification on a large crowd-sourced image annotation dataset (e.g., ImageNet (Deng et al., 2009), Instagram (Mahajan et al., 2018) or JFT (Zhai et al., 2021a)), where the vocabulary of annotation texts is usually fixed. These image annotations are usually mapped into discrete class vectors to learn with a cross-entropy loss as
45
+
46
+ $$
47
+ \mathcal { L } _ { \mathrm { C l s } } = - p ( y ) \log q _ { \theta } ( x ) ,
48
+ $$
49
+
50
+ where $p ( y )$ is a one-hot, multi-hot or smoothed label distribution from ground truth label $y$ . The learned image encoder is then used as a generic visual representation extractor for downstream tasks.
51
+
52
+ Dual-Encoder Contrastive Learning. Compared to pretraining with single-encoder classification, which requires human-annotated labels and data cleaning, the dual-encoder approach exploits noisy web-scale text descriptions and introduces a learnable text tower to encode free-form texts. The two encoders are jointly optimized by contrasting the paired text against others in the sampled batch:
53
+
54
+ $$
55
+ \mathcal { L } _ { \mathrm { C o n } } = - \frac { 1 } { N } ( \sum _ { i } ^ { N } \log \frac { \exp ( x _ { i } ^ { \top } y _ { i } / \sigma ) } { \sum _ { j = 1 } ^ { N } \exp ( x _ { i } ^ { \top } y _ { j } / \sigma ) } + \sum _ { i } ^ { N } \log \frac { \exp ( y _ { i } ^ { \top } x _ { i } / \sigma ) } { \sum _ { j = 1 } ^ { N } \exp ( y _ { i } ^ { \top } x _ { j } / \sigma ) } ) ,
56
+ $$
57
+
58
+ where and are normalized embeddings of the image in the $i$ -th pair and that of the text in the $j$ -th $x _ { i }$ $y _ { j }$
59
+ pair. $N$ is the batch size, and $\sigma$ is the temperature to scale the logits. In addition to the image encoder, the dual-encoder approach also learns an aligned text encoder that enables crossmodal alignment applications such as image-text retrieval and zero-shot image classification. Empirical evidence shows zero-shot classification is more robust (Radford et al., 2021; Jia et al., 2021; Andreassen et al., 2021) on corrupted or out-of-distribution images.
60
+
61
+ Encoder-Decoder Captioning. While the dual-encoder approach encodes the text as a whole, the generative approach (a.k.a. captioner) aims for detailed granularity and requires the model to predict the exact tokenized texts of $y$ autoregressively. Following a standard encoder-decoder architecture, the image encoder provides latent encoded features (e.g., using a Vision Transformer (Dosovitskiy et al., 2021) or ConvNets (He et al., 2016)) and the text decoder learns to maximize the conditional likelihood of the paired text $y$ under the forward autoregressive factorization:
62
+
63
+ $$
64
+ \mathcal { L } _ { \mathrm { C a p } } = - \sum _ { t = 1 } ^ { T } \log P _ { \theta } ( y _ { t } | y _ { < t } , x ) .
65
+ $$
66
+
67
+ The encoder-decoder is trained with teacher-forcing (Williams & Zipser, 1989) to parallelize computation and maximize learning efficiency. Unlike prior methods, the captioner approach yields a joint image-text representation that can be used for vision-language understanding, and is also capable of image captioning applications with natural language generation.
68
+
69
+ ![](images/0452d2b033b5bdea9b2d9263af43d843fd9daaaaabc2ed773cf561acf22f2576.jpg)
70
+ Figure 2: Detailed illustration of CoCa architecture and training objectives.
71
+
72
+ # 3.2 Contrastive Captioners Pretraining
73
+
74
+ Figure 2 depicts the proposed contrastive captioner (CoCa): a simple encoder-decoder approach that seamlessly combines the three training paradigms. Similar to standard image-text encoder-decoder models, CoCa encodes images to latent representations by a neural network encoder, for example, vision transformer (ViT) (Dosovitskiy et al., 2021) (used by default; it can also be other image encoders like ConvNets (He et al., 2016)), and decodes texts with a causal masking transformer decoder. Unlike standard decoder transformers, CoCa omits cross-attention in the first half of the decoder layers to encode unimodal text representations, and cascades the rest of the decoder layers, cross-attending to the image encoder for multimodal image-text representations. As a result, the CoCa decoder simultaneously produces both unimodal and multimodal text representations that allow us to apply both contrastive and generative objectives as
75
+
76
+ $$
77
+ \mathcal { L } _ { \mathrm { C o C a } } = \lambda _ { \mathrm { C o n } } \cdot \mathcal { L } _ { \mathrm { C o n } } + \lambda _ { \mathrm { C a p } } \cdot \mathcal { L } _ { \mathrm { C a p } } ,
78
+ $$
79
+
80
+ where $\lambda _ { \mathrm { C o n } }$ and $\lambda _ { \mathrm { C a p } }$ are loss weighting hyper-parameters. We note that the single-encoder cross-entropy classification objective can be interpreted as a special case of the generative approach applied on image annotation data, when the vocabulary is the set of all label names.
81
+
82
+ Decoupled Text Decoder and CoCa Architecture. The captioning approach optimizes the conditional likelihood of text while the contrastive approach uses an unconditional text representation. To address this dilemma and combine these two methods into a single model, we propose a simple decoupled decoder design where we split the decoder into unimodal and multimodal components, by skipping the cross-attention mechanism in the unimodal decoder layers. That is, the bottom $n _ { \mathrm { u n i } }$ unimodal decoder layers encode the input text as latent vectors with causally-masked self-attention, and the top $n _ { \mathrm { m u l t i } }$ multimodal layers further apply causally-masked self-attention and together with cross-attention to the output of the visual encoder. All decoder layers prohibit tokens from attending to future tokens, and it is straightforward to use the multimodal text decoder output for the captioning objective $\mathcal { L } _ { \mathrm { C a p } }$ . For the contrastive objective ${ \mathcal { L } } _ { \mathrm { C o n } }$ , we append a learnable [CLS] token at the end of the input sentence and use its corresponding output of unimodal decoder as the text embedding. We split the decoder in half such that ${ \mathit { \Delta } } _ { I l } { _ { \mathrm { u n i } } } = { \mathit { \Delta } } _ { I l { \mathrm { m u l t i } } }$ . Following ALIGN (Jia et al., 2021), we pretrain with image resolution of 288 $\times$ 288 and patch size 18 $\times$ 18, resulting in a total of 256 image tokens. Our largest CoCa model ("CoCa" in short) follows the ViT-giant setup in Zhai et al. (2021a) with 1B-parameters in the image encoder and 2.1B-parameters altogether with the text decoder. We also explore two smaller variants of “CoCa-Base” and “CoCa-Large” detailed in Table 1.
83
+
84
+ Attentional Poolers. It is noteworthy that the contrastive loss uses a single embedding for each image while the decoder usually attends to a sequence of image output tokens in an encoder-decoder captioner (Wang et al., 2021b). Our preliminary experiments show that a single pooled image embedding helps visual recognition tasks as a global representation, while more visual tokens (thus more fine-grained) are beneficial for multimodal understanding tasks which require region-level features. Hence, CoCa adopts task-specific attentional pooling (Lee et al., 2019) to customize visual representations to be used for different types of training objectives and downstream tasks. Here, a pooler is a single multi-head attention layer with $n$ query learnable queries, with the encoder output as both keys and values. Through this, the model can learn to pool embeddings with different lengths for the two training objectives, as shown in Figure 2. The use of task-specific pooling not only addresses different needs for different tasks but also introduces the pooler as a natural task adapter. We use attentional poolers in pretraining for generative loss $n _ { \mathrm { q u e r y } } = 2 5 6$ and contrastive loss $n _ { \mathrm { q u e r y } } = 1$ .
85
+
86
+ Pretraining Efficiency. A key benefit of the decoupled autoregressive decoder design is that it can compute two training losses considered efficiently. Since unidirectional language models are trained with causal masking on complete sentences, the decoder can efficiently generate outputs for both contrastive and generative losses with a single forward propagation (compared to two passes for a bidirectional approach (Li et al., 2021)). Therefore, the majority of the compute is shared between the two losses and CoCa only induces minimal overhead compared to standard encoder-decoder models. On the other hand, while many existing methods (Zhai et al., 2021b; Pham et al., 2021a; Singh et al., 2021; Wang et al., 2021a; Li et al., 2021; 2022) train model components with multiple stages on various data sources and/or modalities, CoCa is pretrained end-to-end from scratch directly with various data sources (i.e., annotated images and noisy alt-text images) by treating all labels as texts for both contrastive and generative objectives.
87
+
88
+ # 3.3 Contrastive Captioners for Downstream Tasks
89
+
90
+ Zero-shot Transfer. A pretrained CoCa model performs many tasks in a zero-shot manner by leveraging both image and text inputs, including zero-shot image classification, zero-shot image-text cross-retrieval, zero-shot video-text cross-retrieval. Following previous practices (Radford et al., 2021; Zhai et al., 2021b), “zero-shot” here is different from classical zero-shot learning in that during pretraining, the model may see relevant supervised information, but no supervised examples are used during the transfer protocol. For the pretraining data, we follow strict de-duplication procedures introduced in Jia et al. (2021); Zhai et al. (2021b) to filter all near-domain examples to our downstream tasks.
91
+
92
+ Frozen-feature Evaluation. As discussed in the previous section, CoCa adopts task-specific attentional pooling (Lee et al., 2019) (pooler for brevity) to customize visual representations for different types downstream tasks while sharing the backbone encoder. This enables the model to obtain strong performance as a frozen encoder where we only learn a new pooler to aggregate features. It can also benefit to multi-task problems that share the same frozen image encoder computation but different task-specific heads. As also discussed in He et al. (2021), linear-evaluation struggles to accurately measure learned representations and we find the attentional poolers are more practical for real-world applications.
93
+
94
+ CoCa for Video Action Recognition. We use a simple approach to enable a learned CoCa model for video action recognition tasks. We first take multiple frames of a video and feed each frame into the shared image encoder individually as shown in Figure 3. For frozen-feature evaluation or finetuning, we learn an additional pooler on top of the spatial and temporal feature tokens with a softmax cross-entropy loss. Note the pooler has a single query token thus the computation of pooling over all spatial and temporal tokens is not expensive. For zero-shot video-text retrieval, we use an even simpler approach by computing the mean embedding of 16 frames of the video (frames are uniformly sampled from a video). We also encode the captions of each video as target embeddings when computing retrieval metrics (similar to the image-text case).
95
+
96
+ ![](images/a83babf72e5835130f91a898bc7ba50c550f43c92124d6e096ab88dee0b74c8d.jpg)
97
+ Figure 3: CoCa for video recognition.
98
+
99
+ <table><tr><td>Model</td><td colspan="3">Image Encoder</td><td colspan="4">Text Decoder</td><td colspan="2">Image Text</td><td></td></tr><tr><td></td><td>Layers</td><td>MLP</td><td>Params</td><td>nuni</td><td>nmulti</td><td>MLP</td><td>Params</td><td>Hidden</td><td>Heads</td><td>Total Params</td></tr><tr><td>CoCa-Base</td><td>12</td><td>3072</td><td>86M</td><td>12</td><td>12</td><td>3072</td><td>297M</td><td>768</td><td>12</td><td>383M</td></tr><tr><td>CoCa-Large</td><td>24</td><td>4096</td><td>303M</td><td>12</td><td>12</td><td>4096</td><td>484M</td><td>1024</td><td>16</td><td>787M</td></tr><tr><td>CoCa</td><td>40</td><td>6144</td><td>1B</td><td>18</td><td>18</td><td>5632</td><td>1.1B</td><td>1408</td><td>16</td><td>2.1B</td></tr></table>
100
+
101
+ Table 1: Size variants of CoCa. Both image encoder and text decoder are Transformers (Dosovitskiy et al., 2021; Vaswani et al., 2017).
102
+
103
+ # 4 Experiments
104
+
105
+ In this section, we first describe the details of our experimental setup. The main results are presented next organized as visual recognition tasks, crossmodal alignment tasks, image captioning and multimodal understanding tasks. Our main results are conducted under three categories for downstream tasks: zero-shot transfer, frozen-feature evaluation and finetuning. We also present ablation experiments including training objectives and architecture designs.
106
+
107
+ # 4.1 Training Setup
108
+
109
+ Data. As discussed in Section 3.2, CoCa is pretrained from scratch in a single stage on both web-scale alt-text data and annotated images by treating all labels simply as texts. We use the JFT-3B dataset (Zhai et al., 2021a) with label names as the paired texts, and the ALIGN dataset (Jia et al., 2021) with noisy alt-texts. Similar to Pham et al. (2021a), we randomly shuffle and concatenate label names of each image in JFT together with a prompt sampled from Radford et al. (2021). An example of the resulting text label of a JFT image would look like “a photo of the cat, animal”. Unlike prior models (Zhai et al., 2021b; Pham et al., 2021a) that also use the combination of these two datasets, we train all model parameters from scratch at the same time without pretraining an image encoder with supervised cross-entropy loss for simplicity and pretraining efficiency. To ensure fair evaluation, we follow the strict de-duplication procedures introduced in (Zhai et al., 2021b; Jia et al., 2021) to filter all near-domain examples (3.6M images are removed in total) to our downstream tasks. To tokenize text input, we use a sentence-piece model (Sennrich et al., 2015; Kudo, 2018) with a vocabulary size of 64k trained on the sampled pretraining dataset.
110
+
111
+ Optimization. Our models are implemented in the Lingvo framework (Shen et al., 2019) with GSPMD (Huang et al., 2019; Xu et al., 2020; Lepikhin et al., 2020; Xu et al., 2021) for scaling performance. Following (Pham et al., 2021a), we use a batch size of 65,536 image-text pairs, where half of each batch comes from JFT and ALIGN, respectively. All models are trained on the combined contrastive and captioning objectives in Eq.(4) for 500k steps, roughly corresponding to 5 epochs on JFT and 10 epochs on ALIGN. As shown later in our studies, we find a larger captioning loss weight is better and thus $\lambda _ { \mathrm { C a p } } = 2 . 0$ and $\lambda _ { \mathrm { C o n } } = 1 . 0$ . Following Jia et al. (2021), we apply a contrastive loss with a trainable temperature $\tau$ with an initial value of 0.07. For memory efficiency, we use the Adafactor (Shazeer & Stern, 2018) optimizer with $\beta _ { 1 } = 0 . 9 , \beta _ { 2 } = 0 . 9 9 9$ and decoupled weight decay (Loshchilov $\&$ Hutter, 2017) ratio of 0.01. We warm up the learning rate for the first 2% of training steps to a peak value of $8 \times 1 0 ^ { - 4 }$ , and linearly decay it afterwards. Pretraining CoCa takes about 5 days on 2,048 CloudTPUv4 chips. Following Radford et al. (2021); Jia et al. (2021); Yuan et al. (2021), we continue pretraining for one epoch on a higher resolution of $5 7 6 \times 5 7 6$ For finetuning evaluation, we mainly follow simple protocols and directly train CoCa on downstream tasks without further metric-specific tuning like CIDEr scores (details in Appendix A and B).
112
+
113
+ # 4.2 Main Results
114
+
115
+ We extensively evaluate the capabilities of CoCa models on a wide range of downstream tasks as a pretrained foundation model. We mainly consider core tasks of three categories that examine (1) visual recognition, (2) crossmodal alignment, and (3) image captioning and multimodal understanding capabilities. Since CoCa produces both aligned unimodal representations and fused multimodal embeddings at the same time, it is easily transferable to all three task groups with minimal adaption. Figure 4 summarizes the performance on key benchmarks of CoCa compared to other dual-encoder and encoder-decoder foundation models and state-of-the-art task-specialized methods. CoCa sets new state-of-the-art results on tasks of all three categories with a single pretrained checkpoint.
116
+
117
+ ![](images/8afb85322919b267b24952912ad57670ed1ab146b63bc1a405416a014800c4b6.jpg)
118
+ Figure 4: Comparison of CoCa with other image-text foundation models (without task-specific customization) and multiple state-of-the-art task-specialized models.
119
+
120
+ Table 2: Image classification and video action recognition with frozen encoder or finetuned encoder. Model reference: a(Jia et al., 2021) b(Yuan et al., 2021) c(Pham et al., 2021b) d(Dai et al., 2021) e(Zhai et al., 2021a) g(Wortsman et al., 2022) g(Arnab et al., 2021) h(Kondratyuk et al., 2021) i(Akbari et al., 2021) k(Wei et al., 2021) l(Zhang et al., 2021a).
121
+
122
+ <table><tr><td>Model</td><td>ImageNet</td><td>Model</td><td>K-400</td><td>K-600</td><td>K-700</td><td>Moments-in-Time</td></tr><tr><td>ALIGNa</td><td>88.6</td><td>ViViTg</td><td>84.8</td><td>84.3</td><td>1</td><td>38.0</td></tr><tr><td>Florenceb</td><td>90.1</td><td>MoViNeth</td><td>81.5</td><td>84.8</td><td>79.4</td><td>40.2</td></tr><tr><td>MetaPseudoLabels</td><td>90.2</td><td>VATTi</td><td>82.1</td><td>83.6</td><td></td><td>41.1</td></tr><tr><td>CoAtNetd</td><td>90.9</td><td>Florenceb</td><td>86.8</td><td>88.0</td><td></td><td>-</td></tr><tr><td>ViT-Ge</td><td>90.5</td><td>MaskFeatk</td><td>87.0</td><td>88.3</td><td>80.4</td><td></td></tr><tr><td>+ Model Soupsf</td><td>90.9</td><td>CoVeR1</td><td>87.2</td><td>87.9</td><td>78.5</td><td>46.1</td></tr><tr><td>CoCa (frozen)</td><td>90.6</td><td>CoCa (frozen)</td><td>88.0</td><td>88.5</td><td>81.1</td><td>47.4</td></tr><tr><td>CoCa (finetuned)</td><td>91.0</td><td>CoCa (finetuned)</td><td>88.9</td><td>89.4</td><td>82.7</td><td>49.0</td></tr></table>
123
+
124
+ # 4.2.1 Visual Recognition Tasks
125
+
126
+ Our visual recognition experiments are conducted on ImageNet (Deng et al., 2009) as image recognition benchmark, and multiple video datasets including Kinetics-400 (Kay et al., 2017), Kinetics-600 (Carreira et al., 2018), Kinetics-700 (Carreira et al., 2019), Moments-in-Time (Monfort et al., 2019) as test-beds for video action recognition; it is noteworthy that CoCa pretrains on image data only, without accessing any extra video datasets. We apply the CoCa encoder on video frames individually (Section 3.3) without early fusion of temporal information, yet the resulting CoCa-for-Video model performs better than many spatio-temporal early-fused video models.
127
+
128
+ ![](images/e4ba9a5aa2ffe728cef292653cdae3e31a1370e6b9a5a24684ff8d520a7bcccc.jpg)
129
+ Figure 5: Image classification scaling performance of model sizes.
130
+
131
+ <table><tr><td></td><td colspan="6">Flickr30K (1K test set)</td><td colspan="6">MSCOCO (5K test set)</td></tr><tr><td></td><td colspan="3">Image→ Text</td><td colspan="3">Text → Image</td><td colspan="3">Image→Text</td><td colspan="3">Text → Image</td></tr><tr><td>Model</td><td>R@1</td><td>R@5</td><td>R@10</td><td>R@1</td><td>R@5</td><td>R@10</td><td>R@1</td><td>R@5</td><td>R@10</td><td>R@1</td><td>R@5</td><td>R@10</td></tr><tr><td>CLIP (Radford et al., 2021)</td><td>88.0</td><td>98.7</td><td>99.4</td><td>68.7</td><td>90.6</td><td>95.2</td><td>58.4</td><td>81.5</td><td>88.1</td><td>37.8</td><td>62.4</td><td>72.2</td></tr><tr><td>ALIGN (Jia et al., 2021)</td><td>88.6</td><td>98.7</td><td>99.7</td><td>75.7</td><td>93.8</td><td>96.8</td><td>58.6</td><td>83.0</td><td>89.7</td><td>45.6</td><td>69.8</td><td>78.6</td></tr><tr><td>FLAVA (Singh et al., 2021)</td><td>67.7</td><td>94.0</td><td></td><td>65.2</td><td>89.4</td><td>1</td><td>42.7</td><td>76.8</td><td>1</td><td>38.4</td><td>67.5</td><td>1</td></tr><tr><td>FILIP (Yao et al., 2021)</td><td>89.8</td><td>99.2</td><td>99.8</td><td>75.0</td><td>93.4</td><td>96.3</td><td>61.3</td><td>84.3</td><td>90.4</td><td>45.9</td><td>70.6</td><td>79.3</td></tr><tr><td>Florence (Yuan et al., 2021)</td><td>90.9</td><td>99.1</td><td>1</td><td>76.7</td><td>93.6</td><td></td><td>64.7</td><td>85.9</td><td>1</td><td>47.2</td><td>71.4</td><td>1</td></tr><tr><td>CoCa-Base</td><td>89.8</td><td>98.8</td><td>99.8</td><td>76.8</td><td>93.7</td><td>96.8</td><td>63.8</td><td>84.7</td><td>90.7</td><td>47.5</td><td>72.4</td><td>80.9</td></tr><tr><td>CoCa-Large</td><td>91.4</td><td>99.2</td><td>99.9</td><td>79.0</td><td>95.1</td><td>97.4</td><td>65.4</td><td>85.6</td><td>91.4</td><td>50.1</td><td>73.8</td><td>81.8</td></tr><tr><td>CoCa</td><td>92.5</td><td>99.5</td><td>99.9</td><td>80.4</td><td>95.7</td><td>97.7</td><td>66.3</td><td>86.2</td><td>91.8</td><td>51.2</td><td>74.2</td><td>82.0</td></tr></table>
132
+
133
+ Table 3: Zero-shot image-text retrieval results on Flickr30K (Plummer et al., 2015) and MSCOCO (Chen et al., 2015) datasets.
134
+
135
+ Frozen-feature. We apply a pretrained frozen CoCa model on both image classification and video action recognition. The encoder is used for both tasks while the decoder is discarded. As discussed in Section 3.3, an attentional pooling is learned together with a softmax cross-entropy loss layer on top of the embedding outputs from CoCa encoder. For video classification, a single query-token is learned to weight outputs of all tokens of spatial patches $\times$ temporal frames. We set a learning rate of $5 \times 1 0 ^ { - 4 }$ on both attentional pooler and softmax, batch size of 128, and a cosine learning rate schedule (details in Appendix A). For video action recognition, we compare CoCa with other approaches on the same setup (i.e., without extra supervised video data and without audio signals as model inputs). As shown in Table 2, without finetuning full encoder, CoCa already achieves competitive Top-1 classification accuracies compared to specialized image and outperforms prior best-performing specialized methods on video tasks.
136
+
137
+ Finetuning. Based on the architecture of frozen-feature evaluation, we further finetune CoCa encoders on image and video datasets individually with a smaller learning rate of $1 \times 1 0 ^ { - 4 }$ . More experimental details are summarized in the Appendix A. The finetuned CoCa has improved performance across these tasks. Notably, CoCa obtains $9 1 . 0 \%$ Top-1 accuracy on ImageNet, as well as better video action recognition results compared with recent video approaches. More importantly, CoCa models use much less parameters than other methods in the visual encoder as shown in Figure 5a. These results suggest the proposed framework efficiently combines text training signals and thus is able to learn high-quality visual representation better than the classical single-encoder approach.
138
+
139
+ <table><tr><td>Model</td><td></td><td></td><td></td><td>ImageNet ImageNet-A ImageNet-R ImageNet-V2</td><td>ImageNet-Sketch</td><td>ObjectNet</td><td>Average</td></tr><tr><td>CLIP (Radford et al., 2021)</td><td>76.2</td><td>77.2</td><td>88.9</td><td>70.1</td><td>60.2</td><td>72.3</td><td>74.3</td></tr><tr><td>ALIGN (Jia et al., 2021)</td><td>76.4</td><td>75.8</td><td>92.2</td><td>70.1</td><td>64.8</td><td>72.2</td><td>74.5</td></tr><tr><td>FILIP (Yao et al., 2021)</td><td>78.3</td><td>-</td><td></td><td>-</td><td></td><td>-</td><td>-</td></tr><tr><td>Florence (Yuan et al., 2021)</td><td>83.7</td><td>-</td><td>-</td><td>-</td><td>1</td><td>1</td><td></td></tr><tr><td>LiT (Zhai et al., 2021b)</td><td>84.5</td><td>79.4</td><td>93.9</td><td>78.7</td><td></td><td>81.1</td><td>-</td></tr><tr><td>BASIC (Pham et al., 2021a)</td><td>85.7</td><td>85.6</td><td>95.7</td><td>80.6</td><td>76.1</td><td>78.9</td><td>83.7</td></tr><tr><td>CoCa-Base</td><td>82.6</td><td>76.4</td><td>93.2</td><td>76.5</td><td>71.7</td><td>71.6</td><td>78.7</td></tr><tr><td>CoCa-Large</td><td>84.8</td><td>85.7</td><td>95.6</td><td>79.6</td><td>75.7</td><td>78.6</td><td>83.3</td></tr><tr><td>CoCa</td><td>86.3</td><td>90.2</td><td>96.5</td><td>80.7</td><td>77.6</td><td>82.7</td><td>85.7</td></tr></table>
140
+
141
+ Table 4: Zero-shot image classification results on ImageNet (Deng et al., 2009), ImageNet-A (Hendrycks et al., 2021b), ImageNet-R (Hendrycks et al., 2021a), ImageNet-V2 (Recht et al., 2019), ImageNet-Sketch (Wang et al., 2019) and ObjectNet (Barbu et al., 2019).
142
+
143
+ # 4.2.2 Crossmodal Alignment Tasks
144
+
145
+ Unlike other fusion-based foundation methods (Wang et al., 2021b; Singh et al., 2021; Wang et al., 2022), CoCa is naturally applicable to crossmodal alignment tasks since it generates aligned image and text unimodal embeddings (see Appendix C for results on video-text retrieval). In particular, we are interested in the zero-shot setting where all parameters are frozen after pretraining and directly used to extract embeddings. Here, we use the same embeddings used for contrastive loss during pretraining, and thus the multimodal text decoder is not used.
146
+
147
+ Zero-Shot Image-Text Retrieval. We evaluate CoCa on the two standard image-text retrieval benchmarks: MSCOCO (Chen et al., 2015) and Flickr30K (Plummer et al., 2015). Following the CLIP setting (Radford et al., 2021), we first independently feed each image/text to the corresponding encoder and obtain embeddings for all image/text in the test set. We then retrieve based on cosine similarity scores over the whole test set. As shown in Table 3, CoCa significantly improves over prior methods on both image-to-text and text-to-image retrievals on all metrics. In addition, our model is parameter-efficient, with CoCa-Base already outperforming strong baselines (CLIP (Radford et al., 2021) and ALIGN (Jia et al., 2021)) and CoCa-Large outperforming Florence (Yuan et al., 2021) (which contains a parameter count comparable to ViT-Huge). This shows that CoCa learns good unimodal representations and aligns them well across modalities.
148
+
149
+ Zero-Shot Image Classification. Following prior work (Radford et al., 2021; Jia et al., 2021), we use the aligned image/text embeddings to perform zero-shot image classification by matching images with label names without finetuning. We follow the exact setup in Radford et al. (2021) and apply the same set of prompts used for label class names. As shown in Table 4, CoCa sets new state-of-the-art zero-shot classification results on ImageNet. Notably, CoCa uses fewer parameters than prior best model (Pham et al., 2021a) while smaller CoCa variants already outperform strong baselines (Radford et al., 2021; Yuan et al., 2021), as shown in Figure 5b. In addition, our model demonstrates effective generalization under zero-shot evaluation, consistent with prior findings (Radford et al., 2021; Jia et al., 2021), with CoCa improving on all six datasets considered. Lastly, while prior models (Zhai et al., 2021b; Pham et al., 2021a) found sequentially pretraining with single-encoder and dual-encoder methods in multiple stages is crucial to performance gains, our results show it is possible to attain strong performance by unifying training objectives and datasets in a single-stage framework.
150
+
151
+ # 4.2.3 Image Captioning and Multimodal Understanding Tasks
152
+
153
+ Another key advantage of CoCa is its ability to process multimodal embeddings as an encoder-decoder model trained with the generative objective. Therefore, CoCa can perform both image captioning and multimodal understanding downstream tasks without any further fusion adaptation (Shen et al., 2021; Dou et al., 2021). Overall, experimental results suggest CoCa reaps the benefit of a encoder-decoder model to obtain strong multimodal understanding and generation capabilities, in addition to the vision and retrieval capabilities as a dual-encoder method.
154
+
155
+ Table 5: Multimodal understanding results comparing vision-language pretraining methods. $^ \dagger$ OFA uses both image and text premises as inputs while other models utilize the image only.
156
+
157
+ <table><tr><td rowspan="2">Model</td><td colspan="2">VQA</td><td colspan="2">SNLI-VE</td><td colspan="2">NLVR2</td></tr><tr><td>test-dev</td><td>test-std</td><td>dev</td><td>test</td><td>dev</td><td>test-p</td></tr><tr><td>UNITER (Chen et al., 2020)</td><td>73.8</td><td>74.0</td><td>79.4</td><td>79.4</td><td>79.1</td><td>80.0</td></tr><tr><td>VinVL (Zhang et al., 2021b)</td><td>76.6</td><td>76.6</td><td>1</td><td>1</td><td>82.7</td><td>84.0</td></tr><tr><td>CLIP-ViL (Shen et al., 2021)</td><td>76.5</td><td>76.7</td><td>80.6</td><td>80.2</td><td>1</td><td>1</td></tr><tr><td>ALBEF (Li et al., 2021)</td><td>75.8</td><td>76.0</td><td>80.8</td><td>80.9</td><td>82.6</td><td>83.1</td></tr><tr><td>BLIP (Li et al., 2022)</td><td>78.3</td><td>78.3</td><td>1</td><td>1</td><td>82.2</td><td>82.2</td></tr><tr><td>OFA (Wang et al., 2022)</td><td>79.9</td><td>80.0</td><td>90.3t</td><td>90.2t</td><td>1</td><td>1</td></tr><tr><td>VLMo (Wang et al., 2021a)</td><td>79.9</td><td>80.0</td><td>1</td><td>1</td><td>85.6</td><td>86.9</td></tr><tr><td>SimVLM (Wang et al., 2021b)</td><td>80.0</td><td>80.3</td><td>86.2</td><td>86.3</td><td>84.5</td><td>85.2</td></tr><tr><td>Florence (Yuan et al., 2021)</td><td>80.2</td><td>80.4</td><td></td><td>1</td><td>1</td><td>1</td></tr><tr><td>METER (Dou et al., 2021)</td><td>80.3</td><td>80.5</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>CoCa</td><td>82.3</td><td>82.3</td><td>87.0</td><td>87.1</td><td>86.1</td><td>87.0</td></tr></table>
158
+
159
+ <table><tr><td></td><td colspan="4">MSCOCO</td><td colspan="4">NoCaps</td></tr><tr><td></td><td>B@4</td><td>M</td><td>C</td><td>S</td><td>Valid C</td><td>S</td><td>Test C</td><td>S</td></tr><tr><td>CLIP-ViL (Shen et al., 2021)</td><td>40.2</td><td>29.7</td><td>134.2</td><td>23.8</td><td></td><td></td><td></td><td></td></tr><tr><td>BLIP (Li et al., 2022)</td><td>40.4</td><td>1</td><td>136.7</td><td>1</td><td>1 113.2</td><td>1 14.8</td><td>=</td><td>1 1</td></tr><tr><td>VinVL(Zhang et al., 2021b)</td><td>41.0</td><td>31.1</td><td>140.9</td><td>25.4</td><td>105.1</td><td>14.4</td><td>103.7</td><td>14.4</td></tr><tr><td>SimVLM (Wang et al., 2021b)</td><td>40.6</td><td>33.7</td><td>143.3</td><td>25.4</td><td>112.2</td><td>1</td><td>110.3</td><td>14.5</td></tr><tr><td>LEMON (Hu et al., 2021)</td><td>41.5</td><td>30.8</td><td>139.1</td><td>24.1</td><td>117.3</td><td>15.0</td><td>114.3</td><td>14.9</td></tr><tr><td>LEMONscsT (Hu et al., 2021)t</td><td>42.6</td><td>31.4</td><td>145.5</td><td>25.5</td><td></td><td></td><td></td><td></td></tr><tr><td>OFA (Wang et al., 2022)</td><td>43.5</td><td>31.9</td><td>149.6</td><td>26.1</td><td></td><td></td><td></td><td></td></tr><tr><td>CoCa</td><td>40.9</td><td>33.9</td><td>143.6</td><td>24.7</td><td>122.4</td><td>15.5</td><td>120.6</td><td>15.5</td></tr></table>
160
+
161
+ Table 6: Image captioning results on MSCOCO and NoCaps (B@4: BLEU@4, M: METEOR, C: CIDEr, S: SPICE). †Models finetuned with CIDEr optimization.
162
+
163
+ Multimodal Understanding. As shown in Wang et al. (2021b), the output of encoder-decoder models can jointly encode image and text inputs, and can be used for tasks that require reasoning over both modalities. We consider three popular multimodal understaning benchmarks: visual question answering (VQA v2 (Goyal et al., 2017)), visual entailment (SNLI-VE (Xie et al., 2019)), and visual reasoning (NLVR2 (Suhr et al., 2018)). We mainly follow the settings in Wang et al. (2021b) and train linear classifiers on top of the decoder outputs to predict answers (more details in Appendix B). Our results in Table 5 suggest that CoCa outperforms strong vision-language pretraining (VLP) baselines and obtains the best performance on all three tasks. While prior dual-encoder models (Radford et al., 2021; Yuan et al., 2021) do not contain fusion layers and thus require an additional VL pretraining stage for downstream multimodal understanding tasks, CoCa subsumes the three pretraining paradigms and obtains better performance on VL tasks with lightweight finetuning.
164
+
165
+ Image Captioning. In addition to multimodal classification tasks, CoCa is also directly applicable to image captioning tasks as an encoder-decoder model. We finetune CoCa with the captioning loss $\mathcal { L } _ { \mathrm { C a p } }$ only on MSCOCO (Chen et al., 2015) captioning task and evaluate on both MSCOCO Karpathy-test split and NoCaps (Agrawal et al., 2019) online evaluation. As shown by experiments in Table 6, CoCa outperforms strong baselines trained with cross-entropy loss on MSCOCO, and achieves results comparable to methods with CIDEr metric-specific optimization (Rennie et al., 2017). It is noteworthy that we do not use CIDEr-specific optimization (Rennie et al., 2017) for simplicity. On the challenging NoCaps benchmark, CoCa obtains better results on both validation and test splits (generated examples shown in Figure 6). These results showcase the generative capability of CoCa as an image-text foundation model.
166
+
167
+ ![](images/1ff0c82bf14122484d0cfb4e5d355fdff17138baec9ee8df852e9170a1c62770.jpg)
168
+ Figure 6: Curated samples of text captions generated by CoCa with NoCaps images as input.
169
+ (f) Attentional pooler design ablation.
170
+
171
+ <table><tr><td>loss</td><td>LE</td><td>FT</td></tr><tr><td>Lcls</td><td>81.0</td><td>85.1</td></tr><tr><td>LCap</td><td>82.1</td><td>84.9</td></tr></table>
172
+
173
+ <table><tr><td>loss</td><td>ZS</td><td>VQA</td><td>TPU cost</td></tr><tr><td>Lcon</td><td>70.7</td><td>59.2</td><td>1×</td></tr><tr><td>Lcap</td><td>1</td><td>68.9</td><td>1.17×</td></tr><tr><td>LcoCa</td><td>71.6</td><td>69.0</td><td>1.18×</td></tr></table>
174
+
175
+ (b) Training objectives ablation.
176
+
177
+ (a) Encoder-decoder vs. single-encoder models (trained on JFT).
178
+
179
+ <table><tr><td>入Cap : λcon ZS VQA</td><td></td><td></td></tr><tr><td>1:1</td><td>71.5 68.6</td><td></td></tr><tr><td>1:2</td><td>71.0 68.1</td><td></td></tr><tr><td>2:1</td><td>71.6 69.0</td><td></td></tr></table>
180
+
181
+ (c) Training objectives weights.
182
+
183
+ <table><tr><td>nuni</td><td>ZS</td><td>VQA</td></tr><tr><td>3</td><td>70.2</td><td>69.0</td></tr><tr><td>6</td><td>71.6</td><td>69.0</td></tr><tr><td>9</td><td>71.4</td><td>68.8</td></tr></table>
184
+
185
+ <table><tr><td>variant</td><td>AE MSCOCO</td><td></td></tr><tr><td>1 [CLS]</td><td>80.7</td><td>41.4</td></tr><tr><td>+ text tokens 80.3</td><td></td><td>40.2</td></tr><tr><td>8 [CLS]</td><td>80.3</td><td>36.9</td></tr><tr><td>+ text tokens 80.4</td><td></td><td>40.3</td></tr></table>
186
+
187
+ <table><tr><td>variant</td><td>ZS</td><td>VQA</td></tr><tr><td>parallel</td><td>71.2</td><td>68.7</td></tr><tr><td>cascade</td><td>71.6</td><td>69.0</td></tr><tr><td>nquery = 0</td><td>71.5</td><td>69.0</td></tr><tr><td>nquery = 1</td><td>69.3</td><td>64.4</td></tr><tr><td>nquery = 32</td><td>71.2</td><td>68.2</td></tr></table>
188
+
189
+ (d) Unimodal decoder layers.
190
+
191
+ (e) Contrastive text embedding design ablation.
192
+
193
+ Table 7: CoCa ablation experiments. On ImageNet classification, we report top-1 accuracy for: zero-shot (ZS), linear evaluation (LE), attentional evaluation (AE) using pooler on frozen feature, and finetuning (FT). On MSCOCO retrieval, we report the average of image-to-text and text-to-image R@1. On VQA, we report the dev-set vqa score. The default CoCa setting is bold.
194
+
195
+ # 4.3 Ablation Analysis
196
+
197
+ We extensively ablate the properties of CoCa on a smaller model variant. Specifically, we train CoCa-Base with a reduced 12 decoder layers and a total batch size of 4,096. We mainly evaluate using zero-shot image classification and VQA, since the former covers both visual representation quality and crossmodal alignment, while the later is representative for multimodal reasoning.
198
+
199
+ Captioning vs. Classification. We first examine the effectiveness of captioning loss on image annotation datasets. To do this, we train a naive encoder-decoder model using $\mathcal { L } _ { \mathrm { C a p } }$ on the JFT-3B dataset, and compare with a standard ViT-Base single-encoder model trained with ${ \mathcal { L } } _ { \mathrm { C l s } }$ in Table 7a. We find encoder-decoder models to perform on par with single-encoder pretraining on both linear evaluation and finetuned results. This suggests that the generative pretraining subsumes classification pretraining, consistent with our intuition that ${ \mathcal { L } } _ { \mathrm { C l s } }$ is a special case of $\mathcal { L } _ { \mathrm { C a p } }$ when text vocabulary is the set of all possible class names. Thus, our CoCa model can be interpreted as an effective unification of the three paradigms. This explains why CoCa does not need a pretrained visual encoder to perform well.
200
+
201
+ Training Objectives. We study the effects of the two training objectives and compare CoCa with singleobjective variants in Table 7b. Compared to the contrastive-only model, CoCa significantly improves both zero-shot alignment and VQA (notice that the contrastive-only model requires additional fusion for VQA). CoCa performs on par with the captioning-only model on VQA while it additionally enables retrieval-style tasks such as zero-shot classification. Table 7c further studies loss ratios and suggests that the captioning loss not only improves VQA but also zero-shot alignment between modalities. We hypothesize that generative objectives learn fine-grained text representations that further improve text understanding. Finally, we compare training costs in Table 7b (measured in TPUv3-core-days; larger is slower) and find CoCa to be as efficient as the captioning-only model (a.k.a.naive encoder-decoder with same architecture as CoCa) due to the sharing of compute between two objectives. These suggest combining the two losses induces new capabilities and better performance with minimal extra cost.
202
+
203
+ Unimodal Textual Representation. CoCa introduces a novel decoder design and we ablate its components. In Table 7d, we vary the number of unimodal decoder layers (while keeping the total number of layers the same). Intuitively, fewer unimodal text layers leads to worse zero-shot classification due to lack of capacity for good unimodal text understanding, while fewer multimodal layers reduces the model’s power to reason over multimodal inputs such as VQA. Overall, we find decoupling the decoder in half maintains a good balance. One possibility is that global text representation for retrieval doesn’t require deep modules (Pham et al., 2021a) while early fusion for shallow layers may also be unnecessary for multimodal understanding. Another key design of unimodal textual representation is the application of [CLS] tokens. In particular, we experiment with the number of learnable [CLS] tokens as well as the aggregation design. For the later, we aggregate over either the [CLS] tokens only (denoted as N [CLS]) or the concatenation of [CLS] and the original input sentence (denoted as N [CLS] $^ +$ text tokens). Interestingly, in Table 7e we find training a single [CLS] token without the original input is preferred for both vision-only and crossmodal retrieval tasks. This indicates that learning an additional simple sentence representation mitigates interference between contrastive and captioning loss, and is powerful enough for strong generalization.
204
+
205
+ Attentional Poolers. CoCa exploits attentional poolers in its design both for different pretraining objectives and objective-specific downstream task adaptations. In pretraining, we compare a few design variants on using poolers for contrastive loss and generative loss: (1) the “parallel” design which extracts both contrastive and generative losses at the same time on Vision Transformer encoder outputs as shown in Figure 2, and (2) the “cascade” design which applies the contrastive pooler on top of the outputs of the generative pooler. Table 7f shows the results of these variants. Empirically, we find at small scale the “cascade” version (contrastive pooler on top of the generative pooler) performs better and is used by default in all CoCa models. We also study the effect of number of queries where $n _ { \mathrm { q u e r y } } = 0$ means no generative pooler is used (thus all ViT output tokens are used for decoder cross-attention). Results show that both tasks prefer longer sequences of detailed image tokens at a cost of slightly more computation and parameters. As a result, we use a generative pooler of length 256 to improve multimodal understanding benchmarks while still maintaining the strong frozen-feature capability.
206
+
207
+ # 5 Conclusion
208
+
209
+ In this work we present Contrastive Captioners (CoCa), a new image-text foundation model family that subsumes existing vision pretraining paradigms with natural language supervision. Pretrained on image-text pairs from various data sources in a single stage, CoCa efficiently combines contrastive and captioning objectives in an encoder-decoder model. CoCa obtains a series of state-of-the-art performance with a single checkpoint on a wide spectrum of vision and vision-language problems. Our work bridges the gap among various pretraining approaches and we hope it motivates new directions for image-text foundation models.
210
+
211
+ # Broader Impact Statement
212
+
213
+ This work presents an image-text pretraining approach on web-scale datasets that is capable of transferring to a wide range of downstream tasks in a zero-shot manner or with lightweight finetuning. While the pretrained models are capable of many vision and vision-language tasks, we note that our models use the same pretraining data as previous methods (Jia et al., 2021; Zhai et al., 2021a;b; Pham et al., 2021a) and additional analysis of the data and the resulting model is necessary before the use of the models in practice. We show CoCa models are more robust on corrupted images, but it could still be vulnerable to other image corruptions that are not yet captured by current evaluation sets or in real-world scenarios. For both the data and model, further community exploration is required to understand the broader impacts including but not limited to fairness, social bias and potential misuse.
214
+
215
+ References
216
+ Harsh Agrawal, Karan Desai, Yufei Wang, Xinlei Chen, Rishabh Jain, Mark Johnson, Dhruv Batra, Devi Parikh, Stefan Lee, and Peter Anderson. nocaps: novel object captioning at scale. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 8948–8957, 2019.
217
+ Hassan Akbari, Liangzhe Yuan, Rui Qian, Wei-Hong Chuang, Shih-Fu Chang, Yin Cui, and Boqing Gong. Vatt: Transformers for multimodal self-supervised learning from raw video, audio and text. Advances in Neural Information Processing Systems, 34, 2021.
218
+ Anders Andreassen, Yasaman Bahri, Behnam Neyshabur, and Rebecca Roelofs. The evolution of out-ofdistribution robustness throughout fine-tuning. arXiv preprint arXiv:2106.15831, 2021.
219
+ Anurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Lučić, and Cordelia Schmid. Vivit: A video vision transformer. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6836–6846, 2021.
220
+ Hangbo Bao, Li Dong, and Furu Wei. Beit: Bert pre-training of image transformers. arXiv preprint arXiv:2106.08254, 2021.
221
+ Andrei Barbu, David Mayo, Julian Alverio, William Luo, Christopher Wang, Dan Gutfreund, Josh Tenenbaum, and Boris Katz. Objectnet: A large-scale bias-controlled dataset for pushing the limits of object recognition models. Advances in neural information processing systems, 32, 2019.
222
+ Paul Barham, Aakanksha Chowdhery, Jeff Dean, Sanjay Ghemawat, Steven Hand, Dan Hurt, Michael Isard, Hyeontaek Lim, Ruoming Pang, Sudip Roy, et al. Pathways: Asynchronous distributed dataflow for ml. arXiv preprint arXiv:2203.12533, 2022.
223
+ Rishi Bommasani, Drew A Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021.
224
+ Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
225
+ Joao Carreira, Eric Noland, Andras Banki-Horvath, Chloe Hillier, and Andrew Zisserman. A short note about kinetics-600. arXiv preprint arXiv:1808.01340, 2018.
226
+ Joao Carreira, Eric Noland, Chloe Hillier, and Andrew Zisserman. A short note on the kinetics-700 human action dataset. arXiv preprint arXiv:1907.06987, 2019.
227
+ Xinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015.
228
+ Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. Uniter: Universal image-text representation learning. In ECCV, 2020.
229
+ Jaemin Cho, Jie Lei, Hao Tan, and Mohit Bansal. Unifying vision-and-language tasks via text generation. In International Conference on Machine Learning, pp. 1931–1942. PMLR, 2021.
230
+ Zihang Dai, Hanxiao Liu, Quoc V Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes. Advances in Neural Information Processing Systems, 34:3965–3977, 2021.
231
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009.
232
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
233
+ Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=YicbFdNTTy.
234
+ Zi-Yi Dou, Yichong Xu, Zhe Gan, Jianfeng Wang, Shuohang Wang, Lijuan Wang, Chenguang Zhu, Zicheng Liu, Michael Zeng, et al. An empirical study of training end-to-end vision-and-language transformers. arXiv preprint arXiv:2111.02387, 2021.
235
+ Ross Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 580–587, 2014.
236
+ Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6904–6913, 2017.
237
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
238
+ Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners. arXiv preprint arXiv:2111.06377, 2021.
239
+ Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, et al. The many faces of robustness: A critical analysis of out-of-distribution generalization. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 8340–8349, 2021a.
240
+ Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15262–15271, 2021b.
241
+ Xiaowei Hu, Zhe Gan, Jianfeng Wang, Zhengyuan Yang, Zicheng Liu, Yumao Lu, and Lijuan Wang. Scaling up vision-language pre-training for image captioning. arXiv preprint arXiv:2111.12233, 2021.
242
+ Yanping Huang, Youlong Cheng, Ankur Bapna, Orhan Firat, Dehao Chen, Mia Chen, HyoukJoong Lee, Jiquan Ngiam, Quoc V Le, Yonghui Wu, et al. Gpipe: Efficient training of giant neural networks using pipeline parallelism. Advances in neural information processing systems, 32, 2019.
243
+ Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc Le, Yun-Hsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In International Conference on Machine Learning, pp. 4904–4916. PMLR, 2021.
244
+ Woojeong Jin, Yu Cheng, Yelong Shen, Weizhu Chen, and Xiang Ren. A good prompt is worth millions of parameters? low-resource prompt-based learning for vision-language models. arXiv preprint arXiv:2110.08484, 2021.
245
+ Will Kay, Joao Carreira, Karen Simonyan, Brian Zhang, Chloe Hillier, Sudheendra Vijayanarasimhan, Fabio Viola, Tim Green, Trevor Back, Paul Natsev, et al. The kinetics human action video dataset. arXiv preprint arXiv:1705.06950, 2017.
246
+ Wonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision, 2021.
247
+ Dan Kondratyuk, Liangzhe Yuan, Yandong Li, Li Zhang, Mingxing Tan, Matthew Brown, and Boqing Gong. Movinets: Mobile video networks for efficient video recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16020–16030, 2021.
248
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25, 2012.
249
+
250
+ Taku Kudo. Subword regularization: Improving neural network translation models with multiple subword candidates. arXiv preprint arXiv:1804.10959, 2018.
251
+
252
+ Juho Lee, Yoonho Lee, Jungtaek Kim, Adam Kosiorek, Seungjin Choi, and Yee Whye Teh. Set transformer: A framework for attention-based permutation-invariant neural networks. In International Conference on Machine Learning, pp. 3744–3753. PMLR, 2019.
253
+
254
+ Dmitry Lepikhin, HyoukJoong Lee, Yuanzhong Xu, Dehao Chen, Orhan Firat, Yanping Huang, Maxim Krikun, Noam Shazeer, and Zhifeng Chen. Gshard: Scaling giant models with conditional computation and automatic sharding. arXiv preprint arXiv:2006.16668, 2020.
255
+ Junnan Li, Ramprasaath Selvaraju, Akhilesh Gotmare, Shafiq Joty, Caiming Xiong, and Steven Chu Hong Hoi. Align before fuse: Vision and language representation learning with momentum distillation. Advances in Neural Information Processing Systems, 34, 2021.
256
+ Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pre-training for unified vision-language understanding and generation. arXiv preprint arXiv:2201.12086, 2022.
257
+ Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3431–3440, 2015.
258
+ Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
259
+ Dhruv Mahajan, Ross Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens Van Der Maaten. Exploring the limits of weakly supervised pretraining. In Proceedings of the European conference on computer vision (ECCV), pp. 181–196, 2018.
260
+ Mathew Monfort, Alex Andonian, Bolei Zhou, Kandan Ramakrishnan, Sarah Adel Bargal, Tom Yan, Lisa Brown, Quanfu Fan, Dan Gutfreund, Carl Vondrick, et al. Moments in time dataset: one million videos for event understanding. IEEE transactions on pattern analysis and machine intelligence, 42(2):502–508, 2019.
261
+ Hieu Pham, Zihang Dai, Golnaz Ghiasi, Kenji Kawaguchi, Hanxiao Liu, Adams Wei Yu, Jiahui Yu, YiTing Chen, Minh-Thang Luong, Yonghui Wu, Mingxing Tan, and Quoc V. Le. Combined scaling for open-vocabulary image classification, 2021a. URL https://arxiv.org/abs/2111.10050.
262
+ Hieu Pham, Zihang Dai, Qizhe Xie, and Quoc V Le. Meta pseudo labels. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11557–11568, 2021b.
263
+ AJ Piergiovanni, Wei Li, Weicheng Kuo, Mohammad Saffar, Fred Bertsch, and Anelia Angelova. Answer-me: Multi-task open-vocabulary visual question answering. arXiv preprint arXiv:2205.00949, 2022.
264
+ Bryan A Plummer, Liwei Wang, Chris M Cervantes, Juan C Caicedo, Julia Hockenmaier, and Svetlana Lazebnik. Flickr30k entities: Collecting region-to-phrase correspondences for richer image-to-sentence models. In Proceedings of the IEEE international conference on computer vision, pp. 2641–2649, 2015.
265
+ Jesús Andrés Portillo-Quintero, José Carlos Ortiz-Bayliss, and Hugo Terashima-Marín. A straightforward framework for video retrieval using clip. arXiv preprint arXiv:2102.12443, 2021.
266
+ Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pp. 8748–8763. PMLR, 2021.
267
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683, 2019.
268
+ Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? In International Conference on Machine Learning, pp. 5389–5400. PMLR, 2019.
269
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In C. Cortes, N. Lawrence, D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 28. Curran Associates, Inc., 2015. URL https: //proceedings.neurips.cc/paper/2015/file/14bfa6bb14875e45bba028a21ed38046-Paper.pdf.
270
+ Steven J Rennie, Etienne Marcheret, Youssef Mroueh, Jerret Ross, and Vaibhava Goel. Self-critical sequence training for image captioning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7008–7024, 2017.
271
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909, 2015.
272
+ Noam Shazeer and Mitchell Stern. Adafactor: Adaptive learning rates with sublinear memory cost. In International Conference on Machine Learning, pp. 4596–4604. PMLR, 2018.
273
+ Jonathan Shen, Patrick Nguyen, Yonghui Wu, Zhifeng Chen, et al. Lingvo: a modular and scalable framework for sequence-to-sequence modeling, 2019.
274
+ Sheng Shen, Liunian Harold Li, Hao Tan, Mohit Bansal, Anna Rohrbach, Kai-Wei Chang, Zhewei Yao, and Kurt Keutzer. How much can clip benefit vision-and-language tasks? arXiv preprint arXiv:2107.06383, 2021.
275
+ Karen Simonyan and Andrew Zisserman. Two-stream convolutional networks for action recognition in videos. Advances in neural information processing systems, 27, 2014.
276
+ Amanpreet Singh, Ronghang Hu, Vedanuj Goswami, Guillaume Couairon, Wojciech Galuba, Marcus Rohrbach, and Douwe Kiela. Flava: A foundational language and vision alignment model. arXiv preprint arXiv:2112.04482, 2021.
277
+ Lucas Smaira, João Carreira, Eric Noland, Ellen Clancy, Amy Wu, and Andrew Zisserman. A short note on the kinetics-700-2020 human action dataset. arXiv preprint arXiv:2010.10864, 2020.
278
+ Alane Suhr, Stephanie Zhou, Ally Zhang, Iris Zhang, Huajun Bai, and Yoav Artzi. A corpus for reasoning about natural language grounded in photographs. arXiv preprint arXiv:1811.00491, 2018.
279
+ Hao Tan and Mohit Bansal. Lxmert: Learning cross-modality encoder representations from transformers. arXiv preprint arXiv:1908.07490, 2019.
280
+ Maria Tsimpoukelli, Jacob L Menick, Serkan Cabi, SM Eslami, Oriol Vinyals, and Felix Hill. Multimodal few-shot learning with frozen language models. Advances in Neural Information Processing Systems, 34: 200–212, 2021.
281
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017.
282
+ Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3156–3164, 2015.
283
+ Haohan Wang, Songwei Ge, Zachary Lipton, and Eric P Xing. Learning robust global representations by penalizing local predictive power. Advances in Neural Information Processing Systems, 32, 2019.
284
+ Peng Wang, An Yang, Rui Men, Junyang Lin, Shuai Bai, Zhikang Li, Jianxin Ma, Chang Zhou, Jingren Zhou, and Hongxia Yang. Unifying architectures, tasks, and modalities through a simple sequence-to-sequence learning framework. arXiv preprint arXiv:2202.03052, 2022.
285
+ Wenhui Wang, Hangbo Bao, Li Dong, and Furu Wei. Vlmo: Unified vision-language pre-training with mixture-of-modality-experts. arXiv preprint arXiv:2111.02358, 2021a.
286
+ Zirui Wang, Jiahui Yu, Adams Wei Yu, Zihang Dai, Yulia Tsvetkov, and Yuan Cao. Simvlm: Simple visual language model pretraining with weak supervision. arXiv preprint arXiv:2108.10904, 2021b.
287
+ Chen Wei, Haoqi Fan, Saining Xie, Chao-Yuan Wu, Alan Yuille, and Christoph Feichtenhofer. Masked feature prediction for self-supervised visual pre-training. arXiv preprint arXiv:2112.09133, 2021.
288
+ Ronald J Williams and David Zipser. A learning algorithm for continually running fully recurrent neural networks. Neural computation, 1(2):270–280, 1989.
289
+ Mitchell Wortsman, Gabriel Ilharco, Samir Yitzhak Gadre, Rebecca Roelofs, Raphael Gontijo-Lopes, Ari S Morcos, Hongseok Namkoong, Ali Farhadi, Yair Carmon, Simon Kornblith, et al. Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time. arXiv preprint arXiv:2203.05482, 2022.
290
+ Ning Xie, Farley Lai, Derek Doran, and Asim Kadav. Visual entailment: A novel task for fine-grained image understanding. arXiv preprint arXiv:1901.06706, 2019.
291
+ Zhenda Xie, Zheng Zhang, Yue Cao, Yutong Lin, Jianmin Bao, Zhuliang Yao, Qi Dai, and Han Hu. Simmim: A simple framework for masked image modeling. arXiv preprint arXiv:2111.09886, 2021.
292
+ Jun Xu, Tao Mei, Ting Yao, and Yong Rui. Msr-vtt: A large video description dataset for bridging video and language. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5288–5296, 2016.
293
+ Yuanzhong Xu, HyoukJoong Lee, Dehao Chen, Hongjun Choi, Blake Hechtman, and Shibo Wang. Automatic cross-replica sharding of weight update in data-parallel training. arXiv preprint arXiv:2004.13336, 2020.
294
+ Yuanzhong Xu, HyoukJoong Lee, Dehao Chen, Blake Hechtman, Yanping Huang, Rahul Joshi, Maxim Krikun, Dmitry Lepikhin, Andy Ly, Marcello Maggioni, et al. Gspmd: general and scalable parallelization for ml computation graphs. arXiv preprint arXiv:2105.04663, 2021.
295
+ Jianwei Yang, Chunyuan Li, Pengchuan Zhang, Bin Xiao, Ce Liu, Lu Yuan, and Jianfeng Gao. Unified contrastive learning in image-text-label space, 2022a.
296
+ Zhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Yumao Lu, Zicheng Liu, and Lijuan Wang. An empirical study of gpt-3 for few-shot knowledge-based vqa. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pp. 3081–3089, 2022b.
297
+ Lewei Yao, Runhui Huang, Lu Hou, Guansong Lu, Minzhe Niu, Hang Xu, Xiaodan Liang, Zhenguo Li, Xin Jiang, and Chunjing Xu. Filip: Fine-grained interactive language-image pre-training. arXiv preprint arXiv:2111.07783, 2021.
298
+ Lu Yuan, Dongdong Chen, Yi-Ling Chen, Noel Codella, Xiyang Dai, Jianfeng Gao, Houdong Hu, Xuedong Huang, Boxin Li, Chunyuan Li, et al. Florence: A new foundation model for computer vision. arXiv preprint arXiv:2111.11432, 2021.
299
+ Andy Zeng, Adrian Wong, Stefan Welker, Krzysztof Choromanski, Federico Tombari, Aveek Purohit, Michael Ryoo, Vikas Sindhwani, Johnny Lee, Vincent Vanhoucke, and Pete Florence. Socratic models: Composing zero-shot multimodal reasoning with language. arXiv preprint arXiv:2204.00598, 2022.
300
+ Xiaohua Zhai, Alexander Kolesnikov, Neil Houlsby, and Lucas Beyer. Scaling vision transformers, 2021a. URL https://arxiv.org/abs/2106.04560.
301
+ Xiaohua Zhai, Xiao Wang, Basil Mustafa, Andreas Steiner, Daniel Keysers, Alexander Kolesnikov, and Lucas Beyer. Lit: Zero-shot transfer with locked-image text tuning. arXiv preprint arXiv:2111.07991, 2021b.
302
+ Bowen Zhang, Jiahui Yu, Christopher Fifty, Wei Han, Andrew M Dai, Ruoming Pang, and Fei Sha. Co-training transformer with videos and images improves action recognition. arXiv preprint arXiv:2112.07175, 2021a.
303
+ Pengchuan Zhang, Xiujun Li, Xiaowei Hu, Jianwei Yang, Lei Zhang, Lijuan Wang, Yejin Choi, and Jianfeng Gao. Vinvl: Revisiting visual representations in vision-language models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5579–5588, June 2021b.
304
+
305
+ A Visual Recognition Finetuning Details
306
+ Table 8: Hyper-parameters used in the visual recognition experiments.
307
+
308
+ <table><tr><td></td><td colspan="2">ImageNet</td><td colspan="2">Kinetics-400/600/700 Frozen-feature Finetuning</td><td colspan="2">Moments-in-Time</td></tr><tr><td>Hyper-parameter Frozen-feature Finetuning</td><td colspan="4"></td><td colspan="2">Frozen-feature Finetuning</td></tr><tr><td>Optimizer</td><td colspan="6">Adafacter with Decoupled Weight Decay</td></tr><tr><td>Gradient clip</td><td colspan="6">1.0</td></tr><tr><td>EMA decay rate</td><td colspan="6">0.9999</td></tr><tr><td>LR decay schedule</td><td colspan="6">Cosine Schedule Decaying to Zero</td></tr><tr><td>Loss</td><td colspan="6">Softmax</td></tr><tr><td>MixUp</td><td colspan="6">None</td></tr><tr><td>CutMix</td><td colspan="6">None</td></tr><tr><td>AutoAugment</td><td colspan="6">None None</td></tr><tr><td>RepeatedAugment</td><td colspan="6"></td></tr><tr><td>RandAugment</td><td>2,20</td><td>2,20</td><td>None</td><td>None</td><td>None 0.0</td><td>None</td></tr><tr><td>Label smoothing</td><td>0.2</td><td>0.5</td><td>0.1</td><td>0.1</td><td>120k</td><td>0.0</td></tr><tr><td>Train steps</td><td>200k</td><td>200k</td><td>120k</td><td>120k</td><td></td><td>120k</td></tr><tr><td>Train batch size</td><td>512</td><td>512</td><td>128</td><td>128</td><td>128</td><td>128</td></tr><tr><td>Pooler LR</td><td>5e-4</td><td>5e-4</td><td>5e-4</td><td>5e-4</td><td>5e-4</td><td>5e-4</td></tr><tr><td>EncoderLR</td><td>0.0</td><td>5e-4</td><td>0.0</td><td>5e-4</td><td>0.0</td><td>5e-4</td></tr><tr><td>Warm-up steps</td><td>0</td><td>0</td><td>1000</td><td>1000</td><td>1000</td><td>1000</td></tr><tr><td>Weight decay rate</td><td>0.01</td><td>0.01</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td></tr></table>
309
+
310
+ In addition to zero-shot transfer, we evaluate frozen-feature and finetuning performance of CoCa on visual recognition tasks. For frozen-feature evaluation, we add an attentional pooling layer (pooler) on top of the output sequence of visual features and an additional softmax cross entropy loss layer to learn classification of images and videos. For finetuning, we adapt the same architecture as frozen-feature evaluation (thus also with poolers) and finetune both encoder and pooler. All learning hyperparameters are listed in Table 8.
311
+
312
+ # B Multimodal Understanding Finetuning Details
313
+
314
+ Table 9: Hyper-parameters used in the multimodal experiments.
315
+
316
+ <table><tr><td>Hyper-parameter</td><td>VQA</td><td>SNLI-VE</td><td>NLVR2</td><td>MSCoCO</td><td>NoCaps</td></tr><tr><td>Optimizer</td><td></td><td>Adafacter with Decoupled Weight Decay</td><td></td><td></td><td></td></tr><tr><td>Gradient clip</td><td></td><td></td><td>1.0</td><td></td><td></td></tr><tr><td>LR decay schedule</td><td></td><td></td><td>Cosine Schedule Decaying to Zero</td><td></td><td></td></tr><tr><td>RandAugment</td><td>1,10</td><td>1,10</td><td>None</td><td>None</td><td>None</td></tr><tr><td>Train steps</td><td>100k</td><td>50k</td><td>50k</td><td>50k</td><td>10k</td></tr><tr><td>Train batch size</td><td>64</td><td>128</td><td>64</td><td>128</td><td>128</td></tr><tr><td>Pooler LR</td><td>5e-4</td><td>1e-3</td><td>5e-4</td><td>NA</td><td>NA</td></tr><tr><td>Encoder LR</td><td>2e-5</td><td>5e-5</td><td>2e-5</td><td>1e-5</td><td>1e-5</td></tr><tr><td>Warm-up steps</td><td>1000</td><td>1000</td><td>1000</td><td>1000</td><td>1000</td></tr><tr><td>Weight decay rate</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr></table>
317
+
318
+ CoCa is an encoder-decoder model and the final decoder outputs can be used for multimodal understanding/- generation. Thus, we evaluate on popular vision-language benchmarks. We mainly follow the same setup introduced in Wang et al. (2021b). All hyper-parameters are listed in Table 9.
319
+
320
+ For multimodal classification, we feed the image into the encoder and the corresponding text to the decoder. We then apply another attentional pooler with a single query to extract embedding from the decoder output, and train a linear classifier on top of the pooled embedding. For VQA v2 (Goyal et al., 2017), we follow prior work and formulate the task as a classification problem over 3,129 most frequent answers in the training set.
321
+
322
+ Table 10: Zero-shot Video-Text Retrieval on MSR-VTT Full test set.
323
+
324
+ <table><tr><td></td><td colspan="6">MSR-VTTFull</td></tr><tr><td></td><td colspan="3">Text→Video</td><td colspan="3">Video→Text</td></tr><tr><td>Method</td><td>R@1</td><td>R@5</td><td>R@10</td><td>R@1</td><td>R@5</td><td>R@10</td></tr><tr><td>CLIP (Portillo-Quintero et al., 2021)</td><td>21.4</td><td>41.1</td><td>50.4</td><td>40.3</td><td>69.7</td><td>79.2</td></tr><tr><td>Socratic Models (Zeng et al., 2022)</td><td>1</td><td></td><td></td><td>44.7</td><td>71.2</td><td>80.0</td></tr><tr><td>CLIP (Portillo-Quintero et al., 2021) (subset)</td><td>23.3</td><td>44.2</td><td>53.6</td><td>43.3</td><td>73.3</td><td>81.8</td></tr><tr><td>Socratic Models (Zeng et al., 2022) (subset)</td><td>1</td><td>1</td><td>1</td><td>46.9</td><td>73.5</td><td>81.3</td></tr><tr><td>CoCa (subset)</td><td>30.0</td><td>52.4</td><td>61.6</td><td>49.9</td><td>73.4</td><td>81.4</td></tr></table>
325
+
326
+ We additionally enable cotraining with the generative loss on the concatenated pairs of textual questions and answers to improve model robustness. Similarly for SNLI-VE, the image and the textual hypothesis are fed to encoder and decoder separately, and the classifier is trained to predict the relation between them as entailment, neutral or contradiction. For NLVR2, we create two input pairs of each image and the text description, and concatenate them as input to the classifier. We do not use image augmentation for NLVR2.
327
+
328
+ For image captioning, we apply simple cross-entropy loss (same as the captioning loss used in pretraining) and finetune the model on the training split of MSCOCO to predict for MSCOCO test split and NoCaps online evaluation. We use beam search with beam size of 4 for all our experiments.
329
+
330
+ # C Zero-Shot Video Retrieval
331
+
332
+ We evaluate video-text retrieval using CoCa on MSR-VTT (Xu et al., 2016) using the full split. Table 10 shows that CoCa produces the highest retrieval metrics for both text-to-video and video-to-text retrieval. It is important to note that MSR-VTT videos are sourced from YouTube, and we require the original videos to compute our embeddings. Many of the videos have been made explicitly unavailable (Smaira et al., 2020), hence we compute retrieval over the subset of data that is publicly available at the time of evaluation. Using code $\perp$ provided by the authors of Socratic Models (Zeng et al., 2022), we re-computed metrics on the available subset for those methods, indicated by “(subset)” for fairest comparison.
parse/test/Ee277P3AYC/Ee277P3AYC_content_list.json ADDED
@@ -0,0 +1,687 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "CoCa: Contrastive Captioners are Image-Text Foundation Models ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Jiahui $\\mathbf { Y } \\mathbf { u } ^ { \\star }$ \nZirui Wang? \nVijay Vasudevan \nLegg Yeung \nMojtaba Seyedhosseini Yonghui Wu \nGoogle Research \n$\\star$ Equal contribution. ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "Reviewed on OpenReview: https: // openreview. net/ forum? id= Ee277P3AYC ",
16
+ "page_idx": 0
17
+ },
18
+ {
19
+ "type": "text",
20
+ "text": "Abstract ",
21
+ "text_level": 1,
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "Exploring large-scale pretrained foundation models is of significant interest in computer vision because these models can be quickly transferred to many downstream tasks. This paper presents Contrastive Captioner (CoCa), a minimalist design to pretrain an image-text encoder-decoder foundation model jointly with contrastive loss and captioning loss, thereby subsuming model capabilities from contrastive approaches like CLIP and generative methods like SimVLM. In contrast to standard encoder-decoder transformers where all decoder layers attend to encoder outputs, CoCa omits cross-attention in the first half of decoder layers to encode unimodal text representations, and cascades the remaining decoder layers which cross-attend to the image encoder for multimodal image-text representations. We apply a contrastive loss between unimodal image and text embeddings, in addition to a captioning loss on the multimodal decoder outputs which predicts text tokens autoregressively. By sharing the same computational graph, the two training objectives are computed efficiently with minimal overhead. CoCa is pretrained end-to-end and from scratch on both webscale alt-text data and annotated images by treating all labels simply as text, seamlessly unifying natural language supervision for representation learning. Empirically, CoCa achieves state-of-the-art performance with zero-shot transfer or minimal task-specific adaptation on a broad range of downstream tasks, spanning visual recognition (ImageNet, Kinetics400/600/700, Moments-in-Time), crossmodal retrieval (MSCOCO, Flickr30K, MSR-VTT), multimodal understanding (VQA, SNLI-VE, NLVR2), and image captioning (MSCOCO, NoCaps). Notably on ImageNet classification, CoCa obtains 86.3% zero-shot top-1 accuracy, $9 0 . 6 \\%$ with a frozen encoder and learned classification head, and $9 1 . 0 \\%$ with a finetuned encoder. ",
27
+ "page_idx": 0
28
+ },
29
+ {
30
+ "type": "text",
31
+ "text": "1 Introduction ",
32
+ "text_level": 1,
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "Deep learning has recently witnessed the rise of foundation language models (Bommasani et al., 2021) such as BERT (Devlin et al., 2018), T5 (Raffel et al., 2019), GPT-3 (Brown et al., 2020), where models are pretrained on web-scale data and demonstrate generic multi-tasking capabilities through zero-shot, few-shot or transfer learning. Compared with specialized individual models, pretraining foundation models for massive downstream tasks can amortize training costs, providing opportunities to push the limits of model scale (Barham et al., 2022) for human-level intelligence. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "image",
42
+ "img_path": "images/0b39fb82c55c55f99f0e64f5095268f1edba0dc1e66cf68f8c572082feb1cd48.jpg",
43
+ "image_caption": [
44
+ "Figure 1: Overview of Contrastive Captioners (CoCa) pretraining as image-text foundation models. The pretrained CoCa can be used for downstream tasks including visual recognition, vision-language alignment, image captioning and multimodal understanding with zero-shot transfer, frozen-feature evaluation or end-toend finetuning. "
45
+ ],
46
+ "image_footnote": [],
47
+ "page_idx": 1
48
+ },
49
+ {
50
+ "type": "text",
51
+ "text": "",
52
+ "page_idx": 1
53
+ },
54
+ {
55
+ "type": "text",
56
+ "text": "For vision and vision-language problems, several foundation model candidates have been explored: (1) Pioneering works (Girshick et al., 2014; Long et al., 2015; Simonyan $\\&$ Zisserman, 2014) have shown the effectiveness of single-encoder models pretrained with cross-entropy loss on image classification datasets such as ImageNet (Deng et al., 2009). The image encoder provides generic visual representations that can be adapted for various downstream tasks including image and video understanding (Dai et al., 2021; Zhang et al., 2021a). However, these models rely heavily on image annotations as labeled vectors and do not bake in knowledge of free-form human natural language, hindering their application to downstream tasks that involving both vision and language modalities. (2) Recently, a line of research (Radford et al., 2021; Jia et al., 2021; Yuan et al., 2021) has shown the feasibility of image-text foundation model candidates by pretraining two parallel encoders with a contrastive loss on web-scale noisy image-text pairs. In addition to the visual embeddings for vision-only tasks, the resulting dual-encoder models can additionally encode textual embeddings to the same latent space, enabling new crossmodal alignment capabilities such as zero-shot image classification and image-text retrieval. Nonetheless, these models are not directly applicable for joint vision-language understanding tasks such as visual question answering (VQA), due to missing joint components to learn fused image and text representations. (3) Another line of research (Vinyals et al., 2015; Wang et al., 2021b; 2022) has explored generative pretraining with encoder-decoder models to learn generic vision and multimodal representations. During pretraining, the model takes images on the encoder side and applies Language Modeling (LM) loss (or PrefixLM (Raffel et al., 2019; Wang et al., 2021b)) on the decoder outputs. For downstream tasks, the decoder outputs can then be used as joint representations for multimodal understanding tasks. While superior vision-language results (Wang et al., 2021b) have been attained with pretrained encoder-decoder models, they do not produce text-only representations aligned with image embeddings, thereby being less feasible and efficient for crossmodal alignment tasks. ",
57
+ "page_idx": 1
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "In this work, we unify single-encoder, dual-encoder and encoder-decoder paradigms, and train one image-text foundation model that subsumes the capabilities of all three approaches. We propose a simple model family named Contrastive Captioners (CoCa) with a modified encoder-decoder architecture trained with both contrastive loss and captioning (generative) loss. As shown in Figure 1, we decouple the decoder transformer into two parts, a unimodal decoder and a multimodal decoder. We omit cross-attention in unimodal decoder layers to encode text-only representations, and cascade multimodal decoder layers cross-attending to image encoder outputs to learn multimodal image-text representations. We apply both the contrastive objective between outputs of the image encoder and unimodal text decoder, and the captioning objective at the output of the multimodal decoder. Furthermore, CoCa is trained on both image annotation data and noisy image-text data by treating all labels simply as text. The generative loss on image annotation text provides a fine-grained training signal similar to the single-encoder cross-entropy loss approach, effectively subsuming all three pretraining paradigms into a single unified method. ",
62
+ "page_idx": 1
63
+ },
64
+ {
65
+ "type": "text",
66
+ "text": "",
67
+ "page_idx": 2
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "The design of CoCa leverages contrastive learning for learning global representations and captioning for fine-grained region-level features, thereby benefiting tasks across all three categories shown in Figure 1. CoCa shows that a single pretrained model can outperform many specialized models using zero-shot transfer or minimal task-specific adaptation. For example, CoCa obtains $8 6 . 3 \\%$ zero-shot accuracy on ImageNet and better zero-shot crossmodal retrieval on MSCOCO and Flickr30k. With a frozen-encoder, CoCa achieves $9 0 . 6 \\%$ on ImageNet classification, 88.0%/88.5%/81.1% on Kinetics-40/600/700 and 47.4% on Moments-in-Time. After lightweight finetuning, CoCa further achieves 91.0% on ImageNet, 82.3% on VQA and 120.6 CIDEr score on NoCaps. ",
72
+ "page_idx": 2
73
+ },
74
+ {
75
+ "type": "text",
76
+ "text": "2 Related Work ",
77
+ "text_level": 1,
78
+ "page_idx": 2
79
+ },
80
+ {
81
+ "type": "text",
82
+ "text": "Vision Pretraining. Pretraining ConvNets (Krizhevsky et al., 2012) or Transformers (Vaswani et al., 2017) on large-scale annotated data such as ImageNet (Girshick et al., 2014; Long et al., 2015; Simonyan & Zisserman, 2014), Instagram (Mahajan et al., 2018) or JFT (Zhai et al., 2021a) has become a popular strategy towards solving visual recognition problems including classification, localization, segmentation, video recognition, tracking and many other problems. Recently, self-supervised pretraining approaches have also been explored. BEiT (Bao et al., 2021) proposes a masked image modeling task following BERT (Devlin et al., 2018) in natural language processing, and uses quantized visual token ids as prediction targets. MAE (He et al., 2021) and SimMIM (Xie et al., 2021) remove the need for an image tokenizer and directly use a light-weight decoder or projection layer to regress pixel values. Nonetheless, these methods only learn models for the vision modality and thus they are not applicable to tasks that require joint reasoning over both image and text inputs. ",
83
+ "page_idx": 2
84
+ },
85
+ {
86
+ "type": "text",
87
+ "text": "Vision-Language Pretraining. In recent years, rapid progress has been made in vision-language pretraining (VLP), which aims to jointly encode vision and language in a fusion model. Early work (e.g. LXMERT (Tan & Bansal, 2019), UNITER (Chen et al., 2020), VinVL (Zhang et al., 2021b), VL-T5 (Cho et al., 2021)) in this direction relies on pretrained object detection modules such as Fast(er) R-CNN (Ren et al., 2015) to extract visual representations. Later efforts such as ViLT (Kim et al., 2021) and VLMo (Wang et al., 2021a) unify vision and language transformers, and train a multimodal transformer from scratch. More recently, a line of work has also explored zero-shot/few-shot learning for vision-language tasks by re-using pretrained large language models (Yang et al., 2022b; Jin et al., 2021; Tsimpoukelli et al., 2021). Compared to prior methods, this paper focuses on training a unified model from scratch subsuming the capability of multimodal understanding and generation. ",
88
+ "page_idx": 2
89
+ },
90
+ {
91
+ "type": "text",
92
+ "text": "Image-Text Foundation Models. Recent work has proposed image-text foundation models that can subsume both vision and vision-language pretraining. CLIP (Radford et al., 2021) and ALIGN (Jia et al., 2021) demonstrate that dual-encoder models pretrained with contrastive objectives on noisy image-text pairs can learn strong image and text representations for crossmodal alignment tasks and zero-shot image classification. Florence (Yuan et al., 2021) further develops this method with unified contrastive objective (Yang et al., 2022a), training foundation models that can be adapted for a wide range of vision and image-text benchmarks. To further improve zero-shot image classification accuracy, LiT (Zhai et al., 2021b) and BASIC (Pham et al., 2021a) first pretrain model on an large-scale image annotation dataset with cross-entropy and further finetune with contrastive loss on an noisy alt-text image dataset. Another line of research (Wang et al., 2021b; 2022; Piergiovanni et al., 2022) proposes encoder-decoder models trained with generative losses and shows strong results in vision-language benchmarks while the visual encoder still performs competitively on image classification. In this work, we focus on training an image-text foundation model from scratch in a single pretraining stage to unify these approaches. While recent works (Singh et al., 2021; Li et al., 2021; 2022) have also explored image-text unification, they require multiple pretraining stages of unimodal and multimodal modules to attain good performance. For example, ALBEF (Li et al., 2021) combines contrastive loss with masked language modelling (MLM) with a dual-encoder design. However, our approach is simpler and more efficient to train while also enables more model capabilities: (1) CoCa only performs one forward and backward propagation for a batch of image-text pairs while ALBEF requires two (one on corrupted inputs and another without corruption), (2) CoCa is trained from scratch on the two objectives only while ALBEF is initialized from pretrained visual and textual encoders with additional training signals including momentum modules. (3) The decoder architecture with generative loss is preferred for natural language generation and thus directly enables image captioning. ",
93
+ "page_idx": 2
94
+ },
95
+ {
96
+ "type": "text",
97
+ "text": "",
98
+ "page_idx": 3
99
+ },
100
+ {
101
+ "type": "text",
102
+ "text": "3 Approach ",
103
+ "text_level": 1,
104
+ "page_idx": 3
105
+ },
106
+ {
107
+ "type": "text",
108
+ "text": "We begin with a review of three foundation model families that utilize natural language supervision differently: single-encoder classification pretraining, dual-encoder contrastive learning, and encoder-decoder image captioning. We then introduce Contrastive Captioners (CoCa) that share the merits of both contrastive learning and image-to-caption generation under a simple architecture. We further discuss how CoCa models can quickly transfer to downstream tasks with zero-shot transfer or minimal task adaptation. ",
109
+ "page_idx": 3
110
+ },
111
+ {
112
+ "type": "text",
113
+ "text": "3.1 Natural Language Supervision ",
114
+ "text_level": 1,
115
+ "page_idx": 3
116
+ },
117
+ {
118
+ "type": "text",
119
+ "text": "Single-Encoder Classification. The classic single-encoder approach pretrains a visual encoder through image classification on a large crowd-sourced image annotation dataset (e.g., ImageNet (Deng et al., 2009), Instagram (Mahajan et al., 2018) or JFT (Zhai et al., 2021a)), where the vocabulary of annotation texts is usually fixed. These image annotations are usually mapped into discrete class vectors to learn with a cross-entropy loss as ",
120
+ "page_idx": 3
121
+ },
122
+ {
123
+ "type": "equation",
124
+ "img_path": "images/8b0ef52838b7797cfc9224a65002bc1fc826fdfbba4da5b6614ff9e7a5e5aabb.jpg",
125
+ "text": "$$\n\\mathcal { L } _ { \\mathrm { C l s } } = - p ( y ) \\log q _ { \\theta } ( x ) ,\n$$",
126
+ "text_format": "latex",
127
+ "page_idx": 3
128
+ },
129
+ {
130
+ "type": "text",
131
+ "text": "where $p ( y )$ is a one-hot, multi-hot or smoothed label distribution from ground truth label $y$ . The learned image encoder is then used as a generic visual representation extractor for downstream tasks. ",
132
+ "page_idx": 3
133
+ },
134
+ {
135
+ "type": "text",
136
+ "text": "Dual-Encoder Contrastive Learning. Compared to pretraining with single-encoder classification, which requires human-annotated labels and data cleaning, the dual-encoder approach exploits noisy web-scale text descriptions and introduces a learnable text tower to encode free-form texts. The two encoders are jointly optimized by contrasting the paired text against others in the sampled batch: ",
137
+ "page_idx": 3
138
+ },
139
+ {
140
+ "type": "equation",
141
+ "img_path": "images/9d144b51f3393b36ba12f35e045473afddba207e164b74e67a80613e67859ae9.jpg",
142
+ "text": "$$\n\\mathcal { L } _ { \\mathrm { C o n } } = - \\frac { 1 } { N } ( \\sum _ { i } ^ { N } \\log \\frac { \\exp ( x _ { i } ^ { \\top } y _ { i } / \\sigma ) } { \\sum _ { j = 1 } ^ { N } \\exp ( x _ { i } ^ { \\top } y _ { j } / \\sigma ) } + \\sum _ { i } ^ { N } \\log \\frac { \\exp ( y _ { i } ^ { \\top } x _ { i } / \\sigma ) } { \\sum _ { j = 1 } ^ { N } \\exp ( y _ { i } ^ { \\top } x _ { j } / \\sigma ) } ) ,\n$$",
143
+ "text_format": "latex",
144
+ "page_idx": 3
145
+ },
146
+ {
147
+ "type": "text",
148
+ "text": "where and are normalized embeddings of the image in the $i$ -th pair and that of the text in the $j$ -th $x _ { i }$ $y _ { j }$ \npair. $N$ is the batch size, and $\\sigma$ is the temperature to scale the logits. In addition to the image encoder, the dual-encoder approach also learns an aligned text encoder that enables crossmodal alignment applications such as image-text retrieval and zero-shot image classification. Empirical evidence shows zero-shot classification is more robust (Radford et al., 2021; Jia et al., 2021; Andreassen et al., 2021) on corrupted or out-of-distribution images. ",
149
+ "page_idx": 3
150
+ },
151
+ {
152
+ "type": "text",
153
+ "text": "Encoder-Decoder Captioning. While the dual-encoder approach encodes the text as a whole, the generative approach (a.k.a. captioner) aims for detailed granularity and requires the model to predict the exact tokenized texts of $y$ autoregressively. Following a standard encoder-decoder architecture, the image encoder provides latent encoded features (e.g., using a Vision Transformer (Dosovitskiy et al., 2021) or ConvNets (He et al., 2016)) and the text decoder learns to maximize the conditional likelihood of the paired text $y$ under the forward autoregressive factorization: ",
154
+ "page_idx": 3
155
+ },
156
+ {
157
+ "type": "equation",
158
+ "img_path": "images/e9ec35e32aa0f2a59ac978c538cb21655fe039daf176dd560e2e4d3ab72fb7c5.jpg",
159
+ "text": "$$\n\\mathcal { L } _ { \\mathrm { C a p } } = - \\sum _ { t = 1 } ^ { T } \\log P _ { \\theta } ( y _ { t } | y _ { < t } , x ) .\n$$",
160
+ "text_format": "latex",
161
+ "page_idx": 3
162
+ },
163
+ {
164
+ "type": "text",
165
+ "text": "The encoder-decoder is trained with teacher-forcing (Williams & Zipser, 1989) to parallelize computation and maximize learning efficiency. Unlike prior methods, the captioner approach yields a joint image-text representation that can be used for vision-language understanding, and is also capable of image captioning applications with natural language generation. ",
166
+ "page_idx": 3
167
+ },
168
+ {
169
+ "type": "image",
170
+ "img_path": "images/0452d2b033b5bdea9b2d9263af43d843fd9daaaaabc2ed773cf561acf22f2576.jpg",
171
+ "image_caption": [
172
+ "Figure 2: Detailed illustration of CoCa architecture and training objectives. "
173
+ ],
174
+ "image_footnote": [],
175
+ "page_idx": 4
176
+ },
177
+ {
178
+ "type": "text",
179
+ "text": "3.2 Contrastive Captioners Pretraining ",
180
+ "text_level": 1,
181
+ "page_idx": 4
182
+ },
183
+ {
184
+ "type": "text",
185
+ "text": "Figure 2 depicts the proposed contrastive captioner (CoCa): a simple encoder-decoder approach that seamlessly combines the three training paradigms. Similar to standard image-text encoder-decoder models, CoCa encodes images to latent representations by a neural network encoder, for example, vision transformer (ViT) (Dosovitskiy et al., 2021) (used by default; it can also be other image encoders like ConvNets (He et al., 2016)), and decodes texts with a causal masking transformer decoder. Unlike standard decoder transformers, CoCa omits cross-attention in the first half of the decoder layers to encode unimodal text representations, and cascades the rest of the decoder layers, cross-attending to the image encoder for multimodal image-text representations. As a result, the CoCa decoder simultaneously produces both unimodal and multimodal text representations that allow us to apply both contrastive and generative objectives as ",
186
+ "page_idx": 4
187
+ },
188
+ {
189
+ "type": "equation",
190
+ "img_path": "images/7d8f1d26af8ddacc8ac8008b4a8131199d9273a4d6d2ba2d267d251e6ea8ecb9.jpg",
191
+ "text": "$$\n\\mathcal { L } _ { \\mathrm { C o C a } } = \\lambda _ { \\mathrm { C o n } } \\cdot \\mathcal { L } _ { \\mathrm { C o n } } + \\lambda _ { \\mathrm { C a p } } \\cdot \\mathcal { L } _ { \\mathrm { C a p } } ,\n$$",
192
+ "text_format": "latex",
193
+ "page_idx": 4
194
+ },
195
+ {
196
+ "type": "text",
197
+ "text": "where $\\lambda _ { \\mathrm { C o n } }$ and $\\lambda _ { \\mathrm { C a p } }$ are loss weighting hyper-parameters. We note that the single-encoder cross-entropy classification objective can be interpreted as a special case of the generative approach applied on image annotation data, when the vocabulary is the set of all label names. ",
198
+ "page_idx": 4
199
+ },
200
+ {
201
+ "type": "text",
202
+ "text": "Decoupled Text Decoder and CoCa Architecture. The captioning approach optimizes the conditional likelihood of text while the contrastive approach uses an unconditional text representation. To address this dilemma and combine these two methods into a single model, we propose a simple decoupled decoder design where we split the decoder into unimodal and multimodal components, by skipping the cross-attention mechanism in the unimodal decoder layers. That is, the bottom $n _ { \\mathrm { u n i } }$ unimodal decoder layers encode the input text as latent vectors with causally-masked self-attention, and the top $n _ { \\mathrm { m u l t i } }$ multimodal layers further apply causally-masked self-attention and together with cross-attention to the output of the visual encoder. All decoder layers prohibit tokens from attending to future tokens, and it is straightforward to use the multimodal text decoder output for the captioning objective $\\mathcal { L } _ { \\mathrm { C a p } }$ . For the contrastive objective ${ \\mathcal { L } } _ { \\mathrm { C o n } }$ , we append a learnable [CLS] token at the end of the input sentence and use its corresponding output of unimodal decoder as the text embedding. We split the decoder in half such that ${ \\mathit { \\Delta } } _ { I l } { _ { \\mathrm { u n i } } } = { \\mathit { \\Delta } } _ { I l { \\mathrm { m u l t i } } }$ . Following ALIGN (Jia et al., 2021), we pretrain with image resolution of 288 $\\times$ 288 and patch size 18 $\\times$ 18, resulting in a total of 256 image tokens. Our largest CoCa model (\"CoCa\" in short) follows the ViT-giant setup in Zhai et al. (2021a) with 1B-parameters in the image encoder and 2.1B-parameters altogether with the text decoder. We also explore two smaller variants of “CoCa-Base” and “CoCa-Large” detailed in Table 1. ",
203
+ "page_idx": 4
204
+ },
205
+ {
206
+ "type": "text",
207
+ "text": "Attentional Poolers. It is noteworthy that the contrastive loss uses a single embedding for each image while the decoder usually attends to a sequence of image output tokens in an encoder-decoder captioner (Wang et al., 2021b). Our preliminary experiments show that a single pooled image embedding helps visual recognition tasks as a global representation, while more visual tokens (thus more fine-grained) are beneficial for multimodal understanding tasks which require region-level features. Hence, CoCa adopts task-specific attentional pooling (Lee et al., 2019) to customize visual representations to be used for different types of training objectives and downstream tasks. Here, a pooler is a single multi-head attention layer with $n$ query learnable queries, with the encoder output as both keys and values. Through this, the model can learn to pool embeddings with different lengths for the two training objectives, as shown in Figure 2. The use of task-specific pooling not only addresses different needs for different tasks but also introduces the pooler as a natural task adapter. We use attentional poolers in pretraining for generative loss $n _ { \\mathrm { q u e r y } } = 2 5 6$ and contrastive loss $n _ { \\mathrm { q u e r y } } = 1$ . ",
208
+ "page_idx": 4
209
+ },
210
+ {
211
+ "type": "text",
212
+ "text": "",
213
+ "page_idx": 5
214
+ },
215
+ {
216
+ "type": "text",
217
+ "text": "Pretraining Efficiency. A key benefit of the decoupled autoregressive decoder design is that it can compute two training losses considered efficiently. Since unidirectional language models are trained with causal masking on complete sentences, the decoder can efficiently generate outputs for both contrastive and generative losses with a single forward propagation (compared to two passes for a bidirectional approach (Li et al., 2021)). Therefore, the majority of the compute is shared between the two losses and CoCa only induces minimal overhead compared to standard encoder-decoder models. On the other hand, while many existing methods (Zhai et al., 2021b; Pham et al., 2021a; Singh et al., 2021; Wang et al., 2021a; Li et al., 2021; 2022) train model components with multiple stages on various data sources and/or modalities, CoCa is pretrained end-to-end from scratch directly with various data sources (i.e., annotated images and noisy alt-text images) by treating all labels as texts for both contrastive and generative objectives. ",
218
+ "page_idx": 5
219
+ },
220
+ {
221
+ "type": "text",
222
+ "text": "3.3 Contrastive Captioners for Downstream Tasks ",
223
+ "text_level": 1,
224
+ "page_idx": 5
225
+ },
226
+ {
227
+ "type": "text",
228
+ "text": "Zero-shot Transfer. A pretrained CoCa model performs many tasks in a zero-shot manner by leveraging both image and text inputs, including zero-shot image classification, zero-shot image-text cross-retrieval, zero-shot video-text cross-retrieval. Following previous practices (Radford et al., 2021; Zhai et al., 2021b), “zero-shot” here is different from classical zero-shot learning in that during pretraining, the model may see relevant supervised information, but no supervised examples are used during the transfer protocol. For the pretraining data, we follow strict de-duplication procedures introduced in Jia et al. (2021); Zhai et al. (2021b) to filter all near-domain examples to our downstream tasks. ",
229
+ "page_idx": 5
230
+ },
231
+ {
232
+ "type": "text",
233
+ "text": "Frozen-feature Evaluation. As discussed in the previous section, CoCa adopts task-specific attentional pooling (Lee et al., 2019) (pooler for brevity) to customize visual representations for different types downstream tasks while sharing the backbone encoder. This enables the model to obtain strong performance as a frozen encoder where we only learn a new pooler to aggregate features. It can also benefit to multi-task problems that share the same frozen image encoder computation but different task-specific heads. As also discussed in He et al. (2021), linear-evaluation struggles to accurately measure learned representations and we find the attentional poolers are more practical for real-world applications. ",
234
+ "page_idx": 5
235
+ },
236
+ {
237
+ "type": "text",
238
+ "text": "CoCa for Video Action Recognition. We use a simple approach to enable a learned CoCa model for video action recognition tasks. We first take multiple frames of a video and feed each frame into the shared image encoder individually as shown in Figure 3. For frozen-feature evaluation or finetuning, we learn an additional pooler on top of the spatial and temporal feature tokens with a softmax cross-entropy loss. Note the pooler has a single query token thus the computation of pooling over all spatial and temporal tokens is not expensive. For zero-shot video-text retrieval, we use an even simpler approach by computing the mean embedding of 16 frames of the video (frames are uniformly sampled from a video). We also encode the captions of each video as target embeddings when computing retrieval metrics (similar to the image-text case). ",
239
+ "page_idx": 5
240
+ },
241
+ {
242
+ "type": "image",
243
+ "img_path": "images/a83babf72e5835130f91a898bc7ba50c550f43c92124d6e096ab88dee0b74c8d.jpg",
244
+ "image_caption": [
245
+ "Figure 3: CoCa for video recognition. "
246
+ ],
247
+ "image_footnote": [],
248
+ "page_idx": 5
249
+ },
250
+ {
251
+ "type": "table",
252
+ "img_path": "images/c0bfe2f363f37bfd36437db4dc41087309e772dd5eb21d88e7509109c8d5feea.jpg",
253
+ "table_caption": [],
254
+ "table_footnote": [
255
+ "Table 1: Size variants of CoCa. Both image encoder and text decoder are Transformers (Dosovitskiy et al., 2021; Vaswani et al., 2017). "
256
+ ],
257
+ "table_body": "<table><tr><td>Model</td><td colspan=\"3\">Image Encoder</td><td colspan=\"4\">Text Decoder</td><td colspan=\"2\">Image Text</td><td></td></tr><tr><td></td><td>Layers</td><td>MLP</td><td>Params</td><td>nuni</td><td>nmulti</td><td>MLP</td><td>Params</td><td>Hidden</td><td>Heads</td><td>Total Params</td></tr><tr><td>CoCa-Base</td><td>12</td><td>3072</td><td>86M</td><td>12</td><td>12</td><td>3072</td><td>297M</td><td>768</td><td>12</td><td>383M</td></tr><tr><td>CoCa-Large</td><td>24</td><td>4096</td><td>303M</td><td>12</td><td>12</td><td>4096</td><td>484M</td><td>1024</td><td>16</td><td>787M</td></tr><tr><td>CoCa</td><td>40</td><td>6144</td><td>1B</td><td>18</td><td>18</td><td>5632</td><td>1.1B</td><td>1408</td><td>16</td><td>2.1B</td></tr></table>",
258
+ "page_idx": 6
259
+ },
260
+ {
261
+ "type": "text",
262
+ "text": "4 Experiments ",
263
+ "text_level": 1,
264
+ "page_idx": 6
265
+ },
266
+ {
267
+ "type": "text",
268
+ "text": "In this section, we first describe the details of our experimental setup. The main results are presented next organized as visual recognition tasks, crossmodal alignment tasks, image captioning and multimodal understanding tasks. Our main results are conducted under three categories for downstream tasks: zero-shot transfer, frozen-feature evaluation and finetuning. We also present ablation experiments including training objectives and architecture designs. ",
269
+ "page_idx": 6
270
+ },
271
+ {
272
+ "type": "text",
273
+ "text": "4.1 Training Setup ",
274
+ "text_level": 1,
275
+ "page_idx": 6
276
+ },
277
+ {
278
+ "type": "text",
279
+ "text": "Data. As discussed in Section 3.2, CoCa is pretrained from scratch in a single stage on both web-scale alt-text data and annotated images by treating all labels simply as texts. We use the JFT-3B dataset (Zhai et al., 2021a) with label names as the paired texts, and the ALIGN dataset (Jia et al., 2021) with noisy alt-texts. Similar to Pham et al. (2021a), we randomly shuffle and concatenate label names of each image in JFT together with a prompt sampled from Radford et al. (2021). An example of the resulting text label of a JFT image would look like “a photo of the cat, animal”. Unlike prior models (Zhai et al., 2021b; Pham et al., 2021a) that also use the combination of these two datasets, we train all model parameters from scratch at the same time without pretraining an image encoder with supervised cross-entropy loss for simplicity and pretraining efficiency. To ensure fair evaluation, we follow the strict de-duplication procedures introduced in (Zhai et al., 2021b; Jia et al., 2021) to filter all near-domain examples (3.6M images are removed in total) to our downstream tasks. To tokenize text input, we use a sentence-piece model (Sennrich et al., 2015; Kudo, 2018) with a vocabulary size of 64k trained on the sampled pretraining dataset. ",
280
+ "page_idx": 6
281
+ },
282
+ {
283
+ "type": "text",
284
+ "text": "Optimization. Our models are implemented in the Lingvo framework (Shen et al., 2019) with GSPMD (Huang et al., 2019; Xu et al., 2020; Lepikhin et al., 2020; Xu et al., 2021) for scaling performance. Following (Pham et al., 2021a), we use a batch size of 65,536 image-text pairs, where half of each batch comes from JFT and ALIGN, respectively. All models are trained on the combined contrastive and captioning objectives in Eq.(4) for 500k steps, roughly corresponding to 5 epochs on JFT and 10 epochs on ALIGN. As shown later in our studies, we find a larger captioning loss weight is better and thus $\\lambda _ { \\mathrm { C a p } } = 2 . 0$ and $\\lambda _ { \\mathrm { C o n } } = 1 . 0$ . Following Jia et al. (2021), we apply a contrastive loss with a trainable temperature $\\tau$ with an initial value of 0.07. For memory efficiency, we use the Adafactor (Shazeer & Stern, 2018) optimizer with $\\beta _ { 1 } = 0 . 9 , \\beta _ { 2 } = 0 . 9 9 9$ and decoupled weight decay (Loshchilov $\\&$ Hutter, 2017) ratio of 0.01. We warm up the learning rate for the first 2% of training steps to a peak value of $8 \\times 1 0 ^ { - 4 }$ , and linearly decay it afterwards. Pretraining CoCa takes about 5 days on 2,048 CloudTPUv4 chips. Following Radford et al. (2021); Jia et al. (2021); Yuan et al. (2021), we continue pretraining for one epoch on a higher resolution of $5 7 6 \\times 5 7 6$ For finetuning evaluation, we mainly follow simple protocols and directly train CoCa on downstream tasks without further metric-specific tuning like CIDEr scores (details in Appendix A and B). ",
285
+ "page_idx": 6
286
+ },
287
+ {
288
+ "type": "text",
289
+ "text": "4.2 Main Results ",
290
+ "text_level": 1,
291
+ "page_idx": 6
292
+ },
293
+ {
294
+ "type": "text",
295
+ "text": "We extensively evaluate the capabilities of CoCa models on a wide range of downstream tasks as a pretrained foundation model. We mainly consider core tasks of three categories that examine (1) visual recognition, (2) crossmodal alignment, and (3) image captioning and multimodal understanding capabilities. Since CoCa produces both aligned unimodal representations and fused multimodal embeddings at the same time, it is easily transferable to all three task groups with minimal adaption. Figure 4 summarizes the performance on key benchmarks of CoCa compared to other dual-encoder and encoder-decoder foundation models and state-of-the-art task-specialized methods. CoCa sets new state-of-the-art results on tasks of all three categories with a single pretrained checkpoint. ",
296
+ "page_idx": 6
297
+ },
298
+ {
299
+ "type": "image",
300
+ "img_path": "images/8afb85322919b267b24952912ad57670ed1ab146b63bc1a405416a014800c4b6.jpg",
301
+ "image_caption": [
302
+ "Figure 4: Comparison of CoCa with other image-text foundation models (without task-specific customization) and multiple state-of-the-art task-specialized models. "
303
+ ],
304
+ "image_footnote": [],
305
+ "page_idx": 7
306
+ },
307
+ {
308
+ "type": "table",
309
+ "img_path": "images/d180a70a2dc175c32d995e237f4cdf67d8f2883ded3548c6ed18e24ee6464268.jpg",
310
+ "table_caption": [
311
+ "Table 2: Image classification and video action recognition with frozen encoder or finetuned encoder. Model reference: a(Jia et al., 2021) b(Yuan et al., 2021) c(Pham et al., 2021b) d(Dai et al., 2021) e(Zhai et al., 2021a) g(Wortsman et al., 2022) g(Arnab et al., 2021) h(Kondratyuk et al., 2021) i(Akbari et al., 2021) k(Wei et al., 2021) l(Zhang et al., 2021a). "
312
+ ],
313
+ "table_footnote": [],
314
+ "table_body": "<table><tr><td>Model</td><td>ImageNet</td><td>Model</td><td>K-400</td><td>K-600</td><td>K-700</td><td>Moments-in-Time</td></tr><tr><td>ALIGNa</td><td>88.6</td><td>ViViTg</td><td>84.8</td><td>84.3</td><td>1</td><td>38.0</td></tr><tr><td>Florenceb</td><td>90.1</td><td>MoViNeth</td><td>81.5</td><td>84.8</td><td>79.4</td><td>40.2</td></tr><tr><td>MetaPseudoLabels</td><td>90.2</td><td>VATTi</td><td>82.1</td><td>83.6</td><td></td><td>41.1</td></tr><tr><td>CoAtNetd</td><td>90.9</td><td>Florenceb</td><td>86.8</td><td>88.0</td><td></td><td>-</td></tr><tr><td>ViT-Ge</td><td>90.5</td><td>MaskFeatk</td><td>87.0</td><td>88.3</td><td>80.4</td><td></td></tr><tr><td>+ Model Soupsf</td><td>90.9</td><td>CoVeR1</td><td>87.2</td><td>87.9</td><td>78.5</td><td>46.1</td></tr><tr><td>CoCa (frozen)</td><td>90.6</td><td>CoCa (frozen)</td><td>88.0</td><td>88.5</td><td>81.1</td><td>47.4</td></tr><tr><td>CoCa (finetuned)</td><td>91.0</td><td>CoCa (finetuned)</td><td>88.9</td><td>89.4</td><td>82.7</td><td>49.0</td></tr></table>",
315
+ "page_idx": 7
316
+ },
317
+ {
318
+ "type": "text",
319
+ "text": "",
320
+ "page_idx": 7
321
+ },
322
+ {
323
+ "type": "text",
324
+ "text": "4.2.1 Visual Recognition Tasks ",
325
+ "text_level": 1,
326
+ "page_idx": 7
327
+ },
328
+ {
329
+ "type": "text",
330
+ "text": "Our visual recognition experiments are conducted on ImageNet (Deng et al., 2009) as image recognition benchmark, and multiple video datasets including Kinetics-400 (Kay et al., 2017), Kinetics-600 (Carreira et al., 2018), Kinetics-700 (Carreira et al., 2019), Moments-in-Time (Monfort et al., 2019) as test-beds for video action recognition; it is noteworthy that CoCa pretrains on image data only, without accessing any extra video datasets. We apply the CoCa encoder on video frames individually (Section 3.3) without early fusion of temporal information, yet the resulting CoCa-for-Video model performs better than many spatio-temporal early-fused video models. ",
331
+ "page_idx": 7
332
+ },
333
+ {
334
+ "type": "image",
335
+ "img_path": "images/e4ba9a5aa2ffe728cef292653cdae3e31a1370e6b9a5a24684ff8d520a7bcccc.jpg",
336
+ "image_caption": [
337
+ "Figure 5: Image classification scaling performance of model sizes. "
338
+ ],
339
+ "image_footnote": [],
340
+ "page_idx": 8
341
+ },
342
+ {
343
+ "type": "table",
344
+ "img_path": "images/5df74f421dac39ecff5b11c206f37c1cc592836193270c4eab7c05e5880056e5.jpg",
345
+ "table_caption": [],
346
+ "table_footnote": [
347
+ "Table 3: Zero-shot image-text retrieval results on Flickr30K (Plummer et al., 2015) and MSCOCO (Chen et al., 2015) datasets. "
348
+ ],
349
+ "table_body": "<table><tr><td></td><td colspan=\"6\">Flickr30K (1K test set)</td><td colspan=\"6\">MSCOCO (5K test set)</td></tr><tr><td></td><td colspan=\"3\">Image→ Text</td><td colspan=\"3\">Text → Image</td><td colspan=\"3\">Image→Text</td><td colspan=\"3\">Text → Image</td></tr><tr><td>Model</td><td>R@1</td><td>R@5</td><td>R@10</td><td>R@1</td><td>R@5</td><td>R@10</td><td>R@1</td><td>R@5</td><td>R@10</td><td>R@1</td><td>R@5</td><td>R@10</td></tr><tr><td>CLIP (Radford et al., 2021)</td><td>88.0</td><td>98.7</td><td>99.4</td><td>68.7</td><td>90.6</td><td>95.2</td><td>58.4</td><td>81.5</td><td>88.1</td><td>37.8</td><td>62.4</td><td>72.2</td></tr><tr><td>ALIGN (Jia et al., 2021)</td><td>88.6</td><td>98.7</td><td>99.7</td><td>75.7</td><td>93.8</td><td>96.8</td><td>58.6</td><td>83.0</td><td>89.7</td><td>45.6</td><td>69.8</td><td>78.6</td></tr><tr><td>FLAVA (Singh et al., 2021)</td><td>67.7</td><td>94.0</td><td></td><td>65.2</td><td>89.4</td><td>1</td><td>42.7</td><td>76.8</td><td>1</td><td>38.4</td><td>67.5</td><td>1</td></tr><tr><td>FILIP (Yao et al., 2021)</td><td>89.8</td><td>99.2</td><td>99.8</td><td>75.0</td><td>93.4</td><td>96.3</td><td>61.3</td><td>84.3</td><td>90.4</td><td>45.9</td><td>70.6</td><td>79.3</td></tr><tr><td>Florence (Yuan et al., 2021)</td><td>90.9</td><td>99.1</td><td>1</td><td>76.7</td><td>93.6</td><td></td><td>64.7</td><td>85.9</td><td>1</td><td>47.2</td><td>71.4</td><td>1</td></tr><tr><td>CoCa-Base</td><td>89.8</td><td>98.8</td><td>99.8</td><td>76.8</td><td>93.7</td><td>96.8</td><td>63.8</td><td>84.7</td><td>90.7</td><td>47.5</td><td>72.4</td><td>80.9</td></tr><tr><td>CoCa-Large</td><td>91.4</td><td>99.2</td><td>99.9</td><td>79.0</td><td>95.1</td><td>97.4</td><td>65.4</td><td>85.6</td><td>91.4</td><td>50.1</td><td>73.8</td><td>81.8</td></tr><tr><td>CoCa</td><td>92.5</td><td>99.5</td><td>99.9</td><td>80.4</td><td>95.7</td><td>97.7</td><td>66.3</td><td>86.2</td><td>91.8</td><td>51.2</td><td>74.2</td><td>82.0</td></tr></table>",
350
+ "page_idx": 8
351
+ },
352
+ {
353
+ "type": "text",
354
+ "text": "",
355
+ "page_idx": 8
356
+ },
357
+ {
358
+ "type": "text",
359
+ "text": "Frozen-feature. We apply a pretrained frozen CoCa model on both image classification and video action recognition. The encoder is used for both tasks while the decoder is discarded. As discussed in Section 3.3, an attentional pooling is learned together with a softmax cross-entropy loss layer on top of the embedding outputs from CoCa encoder. For video classification, a single query-token is learned to weight outputs of all tokens of spatial patches $\\times$ temporal frames. We set a learning rate of $5 \\times 1 0 ^ { - 4 }$ on both attentional pooler and softmax, batch size of 128, and a cosine learning rate schedule (details in Appendix A). For video action recognition, we compare CoCa with other approaches on the same setup (i.e., without extra supervised video data and without audio signals as model inputs). As shown in Table 2, without finetuning full encoder, CoCa already achieves competitive Top-1 classification accuracies compared to specialized image and outperforms prior best-performing specialized methods on video tasks. ",
360
+ "page_idx": 8
361
+ },
362
+ {
363
+ "type": "text",
364
+ "text": "Finetuning. Based on the architecture of frozen-feature evaluation, we further finetune CoCa encoders on image and video datasets individually with a smaller learning rate of $1 \\times 1 0 ^ { - 4 }$ . More experimental details are summarized in the Appendix A. The finetuned CoCa has improved performance across these tasks. Notably, CoCa obtains $9 1 . 0 \\%$ Top-1 accuracy on ImageNet, as well as better video action recognition results compared with recent video approaches. More importantly, CoCa models use much less parameters than other methods in the visual encoder as shown in Figure 5a. These results suggest the proposed framework efficiently combines text training signals and thus is able to learn high-quality visual representation better than the classical single-encoder approach. ",
365
+ "page_idx": 8
366
+ },
367
+ {
368
+ "type": "table",
369
+ "img_path": "images/343b567c1e1a4d76fd09c1efa23d8e6cb2344084121dfcec9f2a0dfcbc19cbb7.jpg",
370
+ "table_caption": [],
371
+ "table_footnote": [
372
+ "Table 4: Zero-shot image classification results on ImageNet (Deng et al., 2009), ImageNet-A (Hendrycks et al., 2021b), ImageNet-R (Hendrycks et al., 2021a), ImageNet-V2 (Recht et al., 2019), ImageNet-Sketch (Wang et al., 2019) and ObjectNet (Barbu et al., 2019). "
373
+ ],
374
+ "table_body": "<table><tr><td>Model</td><td></td><td></td><td></td><td>ImageNet ImageNet-A ImageNet-R ImageNet-V2</td><td>ImageNet-Sketch</td><td>ObjectNet</td><td>Average</td></tr><tr><td>CLIP (Radford et al., 2021)</td><td>76.2</td><td>77.2</td><td>88.9</td><td>70.1</td><td>60.2</td><td>72.3</td><td>74.3</td></tr><tr><td>ALIGN (Jia et al., 2021)</td><td>76.4</td><td>75.8</td><td>92.2</td><td>70.1</td><td>64.8</td><td>72.2</td><td>74.5</td></tr><tr><td>FILIP (Yao et al., 2021)</td><td>78.3</td><td>-</td><td></td><td>-</td><td></td><td>-</td><td>-</td></tr><tr><td>Florence (Yuan et al., 2021)</td><td>83.7</td><td>-</td><td>-</td><td>-</td><td>1</td><td>1</td><td></td></tr><tr><td>LiT (Zhai et al., 2021b)</td><td>84.5</td><td>79.4</td><td>93.9</td><td>78.7</td><td></td><td>81.1</td><td>-</td></tr><tr><td>BASIC (Pham et al., 2021a)</td><td>85.7</td><td>85.6</td><td>95.7</td><td>80.6</td><td>76.1</td><td>78.9</td><td>83.7</td></tr><tr><td>CoCa-Base</td><td>82.6</td><td>76.4</td><td>93.2</td><td>76.5</td><td>71.7</td><td>71.6</td><td>78.7</td></tr><tr><td>CoCa-Large</td><td>84.8</td><td>85.7</td><td>95.6</td><td>79.6</td><td>75.7</td><td>78.6</td><td>83.3</td></tr><tr><td>CoCa</td><td>86.3</td><td>90.2</td><td>96.5</td><td>80.7</td><td>77.6</td><td>82.7</td><td>85.7</td></tr></table>",
375
+ "page_idx": 9
376
+ },
377
+ {
378
+ "type": "text",
379
+ "text": "4.2.2 Crossmodal Alignment Tasks ",
380
+ "text_level": 1,
381
+ "page_idx": 9
382
+ },
383
+ {
384
+ "type": "text",
385
+ "text": "Unlike other fusion-based foundation methods (Wang et al., 2021b; Singh et al., 2021; Wang et al., 2022), CoCa is naturally applicable to crossmodal alignment tasks since it generates aligned image and text unimodal embeddings (see Appendix C for results on video-text retrieval). In particular, we are interested in the zero-shot setting where all parameters are frozen after pretraining and directly used to extract embeddings. Here, we use the same embeddings used for contrastive loss during pretraining, and thus the multimodal text decoder is not used. ",
386
+ "page_idx": 9
387
+ },
388
+ {
389
+ "type": "text",
390
+ "text": "Zero-Shot Image-Text Retrieval. We evaluate CoCa on the two standard image-text retrieval benchmarks: MSCOCO (Chen et al., 2015) and Flickr30K (Plummer et al., 2015). Following the CLIP setting (Radford et al., 2021), we first independently feed each image/text to the corresponding encoder and obtain embeddings for all image/text in the test set. We then retrieve based on cosine similarity scores over the whole test set. As shown in Table 3, CoCa significantly improves over prior methods on both image-to-text and text-to-image retrievals on all metrics. In addition, our model is parameter-efficient, with CoCa-Base already outperforming strong baselines (CLIP (Radford et al., 2021) and ALIGN (Jia et al., 2021)) and CoCa-Large outperforming Florence (Yuan et al., 2021) (which contains a parameter count comparable to ViT-Huge). This shows that CoCa learns good unimodal representations and aligns them well across modalities. ",
391
+ "page_idx": 9
392
+ },
393
+ {
394
+ "type": "text",
395
+ "text": "Zero-Shot Image Classification. Following prior work (Radford et al., 2021; Jia et al., 2021), we use the aligned image/text embeddings to perform zero-shot image classification by matching images with label names without finetuning. We follow the exact setup in Radford et al. (2021) and apply the same set of prompts used for label class names. As shown in Table 4, CoCa sets new state-of-the-art zero-shot classification results on ImageNet. Notably, CoCa uses fewer parameters than prior best model (Pham et al., 2021a) while smaller CoCa variants already outperform strong baselines (Radford et al., 2021; Yuan et al., 2021), as shown in Figure 5b. In addition, our model demonstrates effective generalization under zero-shot evaluation, consistent with prior findings (Radford et al., 2021; Jia et al., 2021), with CoCa improving on all six datasets considered. Lastly, while prior models (Zhai et al., 2021b; Pham et al., 2021a) found sequentially pretraining with single-encoder and dual-encoder methods in multiple stages is crucial to performance gains, our results show it is possible to attain strong performance by unifying training objectives and datasets in a single-stage framework. ",
396
+ "page_idx": 9
397
+ },
398
+ {
399
+ "type": "text",
400
+ "text": "4.2.3 Image Captioning and Multimodal Understanding Tasks ",
401
+ "text_level": 1,
402
+ "page_idx": 9
403
+ },
404
+ {
405
+ "type": "text",
406
+ "text": "Another key advantage of CoCa is its ability to process multimodal embeddings as an encoder-decoder model trained with the generative objective. Therefore, CoCa can perform both image captioning and multimodal understanding downstream tasks without any further fusion adaptation (Shen et al., 2021; Dou et al., 2021). Overall, experimental results suggest CoCa reaps the benefit of a encoder-decoder model to obtain strong multimodal understanding and generation capabilities, in addition to the vision and retrieval capabilities as a dual-encoder method. ",
407
+ "page_idx": 9
408
+ },
409
+ {
410
+ "type": "table",
411
+ "img_path": "images/9b74344f9caca59965763a731a4175963c8e505be0254b5479f09b58431350a2.jpg",
412
+ "table_caption": [
413
+ "Table 5: Multimodal understanding results comparing vision-language pretraining methods. $^ \\dagger$ OFA uses both image and text premises as inputs while other models utilize the image only. "
414
+ ],
415
+ "table_footnote": [],
416
+ "table_body": "<table><tr><td rowspan=\"2\">Model</td><td colspan=\"2\">VQA</td><td colspan=\"2\">SNLI-VE</td><td colspan=\"2\">NLVR2</td></tr><tr><td>test-dev</td><td>test-std</td><td>dev</td><td>test</td><td>dev</td><td>test-p</td></tr><tr><td>UNITER (Chen et al., 2020)</td><td>73.8</td><td>74.0</td><td>79.4</td><td>79.4</td><td>79.1</td><td>80.0</td></tr><tr><td>VinVL (Zhang et al., 2021b)</td><td>76.6</td><td>76.6</td><td>1</td><td>1</td><td>82.7</td><td>84.0</td></tr><tr><td>CLIP-ViL (Shen et al., 2021)</td><td>76.5</td><td>76.7</td><td>80.6</td><td>80.2</td><td>1</td><td>1</td></tr><tr><td>ALBEF (Li et al., 2021)</td><td>75.8</td><td>76.0</td><td>80.8</td><td>80.9</td><td>82.6</td><td>83.1</td></tr><tr><td>BLIP (Li et al., 2022)</td><td>78.3</td><td>78.3</td><td>1</td><td>1</td><td>82.2</td><td>82.2</td></tr><tr><td>OFA (Wang et al., 2022)</td><td>79.9</td><td>80.0</td><td>90.3t</td><td>90.2t</td><td>1</td><td>1</td></tr><tr><td>VLMo (Wang et al., 2021a)</td><td>79.9</td><td>80.0</td><td>1</td><td>1</td><td>85.6</td><td>86.9</td></tr><tr><td>SimVLM (Wang et al., 2021b)</td><td>80.0</td><td>80.3</td><td>86.2</td><td>86.3</td><td>84.5</td><td>85.2</td></tr><tr><td>Florence (Yuan et al., 2021)</td><td>80.2</td><td>80.4</td><td></td><td>1</td><td>1</td><td>1</td></tr><tr><td>METER (Dou et al., 2021)</td><td>80.3</td><td>80.5</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>CoCa</td><td>82.3</td><td>82.3</td><td>87.0</td><td>87.1</td><td>86.1</td><td>87.0</td></tr></table>",
417
+ "page_idx": 10
418
+ },
419
+ {
420
+ "type": "table",
421
+ "img_path": "images/9055537a687b81269b5346e50f353c87b31ea5ff3f3bfdad64dc0fc5e14f3a19.jpg",
422
+ "table_caption": [],
423
+ "table_footnote": [
424
+ "Table 6: Image captioning results on MSCOCO and NoCaps (B@4: BLEU@4, M: METEOR, C: CIDEr, S: SPICE). †Models finetuned with CIDEr optimization. "
425
+ ],
426
+ "table_body": "<table><tr><td></td><td colspan=\"4\">MSCOCO</td><td colspan=\"4\">NoCaps</td></tr><tr><td></td><td>B@4</td><td>M</td><td>C</td><td>S</td><td>Valid C</td><td>S</td><td>Test C</td><td>S</td></tr><tr><td>CLIP-ViL (Shen et al., 2021)</td><td>40.2</td><td>29.7</td><td>134.2</td><td>23.8</td><td></td><td></td><td></td><td></td></tr><tr><td>BLIP (Li et al., 2022)</td><td>40.4</td><td>1</td><td>136.7</td><td>1</td><td>1 113.2</td><td>1 14.8</td><td>=</td><td>1 1</td></tr><tr><td>VinVL(Zhang et al., 2021b)</td><td>41.0</td><td>31.1</td><td>140.9</td><td>25.4</td><td>105.1</td><td>14.4</td><td>103.7</td><td>14.4</td></tr><tr><td>SimVLM (Wang et al., 2021b)</td><td>40.6</td><td>33.7</td><td>143.3</td><td>25.4</td><td>112.2</td><td>1</td><td>110.3</td><td>14.5</td></tr><tr><td>LEMON (Hu et al., 2021)</td><td>41.5</td><td>30.8</td><td>139.1</td><td>24.1</td><td>117.3</td><td>15.0</td><td>114.3</td><td>14.9</td></tr><tr><td>LEMONscsT (Hu et al., 2021)t</td><td>42.6</td><td>31.4</td><td>145.5</td><td>25.5</td><td></td><td></td><td></td><td></td></tr><tr><td>OFA (Wang et al., 2022)</td><td>43.5</td><td>31.9</td><td>149.6</td><td>26.1</td><td></td><td></td><td></td><td></td></tr><tr><td>CoCa</td><td>40.9</td><td>33.9</td><td>143.6</td><td>24.7</td><td>122.4</td><td>15.5</td><td>120.6</td><td>15.5</td></tr></table>",
427
+ "page_idx": 10
428
+ },
429
+ {
430
+ "type": "text",
431
+ "text": "Multimodal Understanding. As shown in Wang et al. (2021b), the output of encoder-decoder models can jointly encode image and text inputs, and can be used for tasks that require reasoning over both modalities. We consider three popular multimodal understaning benchmarks: visual question answering (VQA v2 (Goyal et al., 2017)), visual entailment (SNLI-VE (Xie et al., 2019)), and visual reasoning (NLVR2 (Suhr et al., 2018)). We mainly follow the settings in Wang et al. (2021b) and train linear classifiers on top of the decoder outputs to predict answers (more details in Appendix B). Our results in Table 5 suggest that CoCa outperforms strong vision-language pretraining (VLP) baselines and obtains the best performance on all three tasks. While prior dual-encoder models (Radford et al., 2021; Yuan et al., 2021) do not contain fusion layers and thus require an additional VL pretraining stage for downstream multimodal understanding tasks, CoCa subsumes the three pretraining paradigms and obtains better performance on VL tasks with lightweight finetuning. ",
432
+ "page_idx": 10
433
+ },
434
+ {
435
+ "type": "text",
436
+ "text": "Image Captioning. In addition to multimodal classification tasks, CoCa is also directly applicable to image captioning tasks as an encoder-decoder model. We finetune CoCa with the captioning loss $\\mathcal { L } _ { \\mathrm { C a p } }$ only on MSCOCO (Chen et al., 2015) captioning task and evaluate on both MSCOCO Karpathy-test split and NoCaps (Agrawal et al., 2019) online evaluation. As shown by experiments in Table 6, CoCa outperforms strong baselines trained with cross-entropy loss on MSCOCO, and achieves results comparable to methods with CIDEr metric-specific optimization (Rennie et al., 2017). It is noteworthy that we do not use CIDEr-specific optimization (Rennie et al., 2017) for simplicity. On the challenging NoCaps benchmark, CoCa obtains better results on both validation and test splits (generated examples shown in Figure 6). These results showcase the generative capability of CoCa as an image-text foundation model. ",
437
+ "page_idx": 10
438
+ },
439
+ {
440
+ "type": "image",
441
+ "img_path": "images/1ff0c82bf14122484d0cfb4e5d355fdff17138baec9ee8df852e9170a1c62770.jpg",
442
+ "image_caption": [
443
+ "Figure 6: Curated samples of text captions generated by CoCa with NoCaps images as input. ",
444
+ "(f) Attentional pooler design ablation. "
445
+ ],
446
+ "image_footnote": [],
447
+ "page_idx": 11
448
+ },
449
+ {
450
+ "type": "table",
451
+ "img_path": "images/bbd124a4e6b16b9c1aa10ac07f6113927f01df0695e292cca5bb73091b3f91fb.jpg",
452
+ "table_caption": [],
453
+ "table_footnote": [],
454
+ "table_body": "<table><tr><td>loss</td><td>LE</td><td>FT</td></tr><tr><td>Lcls</td><td>81.0</td><td>85.1</td></tr><tr><td>LCap</td><td>82.1</td><td>84.9</td></tr></table>",
455
+ "page_idx": 11
456
+ },
457
+ {
458
+ "type": "table",
459
+ "img_path": "images/bcf2043e73fd443ae8e935a59a577f7359b30356f4272e554f9d63294a940a61.jpg",
460
+ "table_caption": [],
461
+ "table_footnote": [
462
+ "(b) Training objectives ablation. "
463
+ ],
464
+ "table_body": "<table><tr><td>loss</td><td>ZS</td><td>VQA</td><td>TPU cost</td></tr><tr><td>Lcon</td><td>70.7</td><td>59.2</td><td>1×</td></tr><tr><td>Lcap</td><td>1</td><td>68.9</td><td>1.17×</td></tr><tr><td>LcoCa</td><td>71.6</td><td>69.0</td><td>1.18×</td></tr></table>",
465
+ "page_idx": 11
466
+ },
467
+ {
468
+ "type": "text",
469
+ "text": "(a) Encoder-decoder vs. single-encoder models (trained on JFT). ",
470
+ "page_idx": 11
471
+ },
472
+ {
473
+ "type": "table",
474
+ "img_path": "images/3d10092ff63a58dfda6aea0a3216f6bdf3896313c88cf6ff5dca4ad0d1b65c73.jpg",
475
+ "table_caption": [],
476
+ "table_footnote": [
477
+ "(c) Training objectives weights. "
478
+ ],
479
+ "table_body": "<table><tr><td>入Cap : λcon ZS VQA</td><td></td><td></td></tr><tr><td>1:1</td><td>71.5 68.6</td><td></td></tr><tr><td>1:2</td><td>71.0 68.1</td><td></td></tr><tr><td>2:1</td><td>71.6 69.0</td><td></td></tr></table>",
480
+ "page_idx": 11
481
+ },
482
+ {
483
+ "type": "table",
484
+ "img_path": "images/66148123d736193f8aa750b770794e2bcdb05a1858507224457f5744f76283f3.jpg",
485
+ "table_caption": [],
486
+ "table_footnote": [],
487
+ "table_body": "<table><tr><td>nuni</td><td>ZS</td><td>VQA</td></tr><tr><td>3</td><td>70.2</td><td>69.0</td></tr><tr><td>6</td><td>71.6</td><td>69.0</td></tr><tr><td>9</td><td>71.4</td><td>68.8</td></tr></table>",
488
+ "page_idx": 11
489
+ },
490
+ {
491
+ "type": "table",
492
+ "img_path": "images/6e018ebaafd80866e97f2bb905b143222e498d5f0076beabf183897090c28e4f.jpg",
493
+ "table_caption": [],
494
+ "table_footnote": [],
495
+ "table_body": "<table><tr><td>variant</td><td>AE MSCOCO</td><td></td></tr><tr><td>1 [CLS]</td><td>80.7</td><td>41.4</td></tr><tr><td>+ text tokens 80.3</td><td></td><td>40.2</td></tr><tr><td>8 [CLS]</td><td>80.3</td><td>36.9</td></tr><tr><td>+ text tokens 80.4</td><td></td><td>40.3</td></tr></table>",
496
+ "page_idx": 11
497
+ },
498
+ {
499
+ "type": "table",
500
+ "img_path": "images/731133cfbe07fec0b131ffb748b8ba6e2ab5102ead34dfd941c86049b66ae4fd.jpg",
501
+ "table_caption": [],
502
+ "table_footnote": [],
503
+ "table_body": "<table><tr><td>variant</td><td>ZS</td><td>VQA</td></tr><tr><td>parallel</td><td>71.2</td><td>68.7</td></tr><tr><td>cascade</td><td>71.6</td><td>69.0</td></tr><tr><td>nquery = 0</td><td>71.5</td><td>69.0</td></tr><tr><td>nquery = 1</td><td>69.3</td><td>64.4</td></tr><tr><td>nquery = 32</td><td>71.2</td><td>68.2</td></tr></table>",
504
+ "page_idx": 11
505
+ },
506
+ {
507
+ "type": "text",
508
+ "text": "(d) Unimodal decoder layers. ",
509
+ "page_idx": 11
510
+ },
511
+ {
512
+ "type": "text",
513
+ "text": "(e) Contrastive text embedding design ablation. ",
514
+ "page_idx": 11
515
+ },
516
+ {
517
+ "type": "text",
518
+ "text": "Table 7: CoCa ablation experiments. On ImageNet classification, we report top-1 accuracy for: zero-shot (ZS), linear evaluation (LE), attentional evaluation (AE) using pooler on frozen feature, and finetuning (FT). On MSCOCO retrieval, we report the average of image-to-text and text-to-image R@1. On VQA, we report the dev-set vqa score. The default CoCa setting is bold. ",
519
+ "page_idx": 11
520
+ },
521
+ {
522
+ "type": "text",
523
+ "text": "4.3 Ablation Analysis ",
524
+ "text_level": 1,
525
+ "page_idx": 11
526
+ },
527
+ {
528
+ "type": "text",
529
+ "text": "We extensively ablate the properties of CoCa on a smaller model variant. Specifically, we train CoCa-Base with a reduced 12 decoder layers and a total batch size of 4,096. We mainly evaluate using zero-shot image classification and VQA, since the former covers both visual representation quality and crossmodal alignment, while the later is representative for multimodal reasoning. ",
530
+ "page_idx": 11
531
+ },
532
+ {
533
+ "type": "text",
534
+ "text": "Captioning vs. Classification. We first examine the effectiveness of captioning loss on image annotation datasets. To do this, we train a naive encoder-decoder model using $\\mathcal { L } _ { \\mathrm { C a p } }$ on the JFT-3B dataset, and compare with a standard ViT-Base single-encoder model trained with ${ \\mathcal { L } } _ { \\mathrm { C l s } }$ in Table 7a. We find encoder-decoder models to perform on par with single-encoder pretraining on both linear evaluation and finetuned results. This suggests that the generative pretraining subsumes classification pretraining, consistent with our intuition that ${ \\mathcal { L } } _ { \\mathrm { C l s } }$ is a special case of $\\mathcal { L } _ { \\mathrm { C a p } }$ when text vocabulary is the set of all possible class names. Thus, our CoCa model can be interpreted as an effective unification of the three paradigms. This explains why CoCa does not need a pretrained visual encoder to perform well. ",
535
+ "page_idx": 11
536
+ },
537
+ {
538
+ "type": "text",
539
+ "text": "Training Objectives. We study the effects of the two training objectives and compare CoCa with singleobjective variants in Table 7b. Compared to the contrastive-only model, CoCa significantly improves both zero-shot alignment and VQA (notice that the contrastive-only model requires additional fusion for VQA). CoCa performs on par with the captioning-only model on VQA while it additionally enables retrieval-style tasks such as zero-shot classification. Table 7c further studies loss ratios and suggests that the captioning loss not only improves VQA but also zero-shot alignment between modalities. We hypothesize that generative objectives learn fine-grained text representations that further improve text understanding. Finally, we compare training costs in Table 7b (measured in TPUv3-core-days; larger is slower) and find CoCa to be as efficient as the captioning-only model (a.k.a.naive encoder-decoder with same architecture as CoCa) due to the sharing of compute between two objectives. These suggest combining the two losses induces new capabilities and better performance with minimal extra cost. ",
540
+ "page_idx": 11
541
+ },
542
+ {
543
+ "type": "text",
544
+ "text": "",
545
+ "page_idx": 12
546
+ },
547
+ {
548
+ "type": "text",
549
+ "text": "Unimodal Textual Representation. CoCa introduces a novel decoder design and we ablate its components. In Table 7d, we vary the number of unimodal decoder layers (while keeping the total number of layers the same). Intuitively, fewer unimodal text layers leads to worse zero-shot classification due to lack of capacity for good unimodal text understanding, while fewer multimodal layers reduces the model’s power to reason over multimodal inputs such as VQA. Overall, we find decoupling the decoder in half maintains a good balance. One possibility is that global text representation for retrieval doesn’t require deep modules (Pham et al., 2021a) while early fusion for shallow layers may also be unnecessary for multimodal understanding. Another key design of unimodal textual representation is the application of [CLS] tokens. In particular, we experiment with the number of learnable [CLS] tokens as well as the aggregation design. For the later, we aggregate over either the [CLS] tokens only (denoted as N [CLS]) or the concatenation of [CLS] and the original input sentence (denoted as N [CLS] $^ +$ text tokens). Interestingly, in Table 7e we find training a single [CLS] token without the original input is preferred for both vision-only and crossmodal retrieval tasks. This indicates that learning an additional simple sentence representation mitigates interference between contrastive and captioning loss, and is powerful enough for strong generalization. ",
550
+ "page_idx": 12
551
+ },
552
+ {
553
+ "type": "text",
554
+ "text": "Attentional Poolers. CoCa exploits attentional poolers in its design both for different pretraining objectives and objective-specific downstream task adaptations. In pretraining, we compare a few design variants on using poolers for contrastive loss and generative loss: (1) the “parallel” design which extracts both contrastive and generative losses at the same time on Vision Transformer encoder outputs as shown in Figure 2, and (2) the “cascade” design which applies the contrastive pooler on top of the outputs of the generative pooler. Table 7f shows the results of these variants. Empirically, we find at small scale the “cascade” version (contrastive pooler on top of the generative pooler) performs better and is used by default in all CoCa models. We also study the effect of number of queries where $n _ { \\mathrm { q u e r y } } = 0$ means no generative pooler is used (thus all ViT output tokens are used for decoder cross-attention). Results show that both tasks prefer longer sequences of detailed image tokens at a cost of slightly more computation and parameters. As a result, we use a generative pooler of length 256 to improve multimodal understanding benchmarks while still maintaining the strong frozen-feature capability. ",
555
+ "page_idx": 12
556
+ },
557
+ {
558
+ "type": "text",
559
+ "text": "5 Conclusion ",
560
+ "text_level": 1,
561
+ "page_idx": 12
562
+ },
563
+ {
564
+ "type": "text",
565
+ "text": "In this work we present Contrastive Captioners (CoCa), a new image-text foundation model family that subsumes existing vision pretraining paradigms with natural language supervision. Pretrained on image-text pairs from various data sources in a single stage, CoCa efficiently combines contrastive and captioning objectives in an encoder-decoder model. CoCa obtains a series of state-of-the-art performance with a single checkpoint on a wide spectrum of vision and vision-language problems. Our work bridges the gap among various pretraining approaches and we hope it motivates new directions for image-text foundation models. ",
566
+ "page_idx": 12
567
+ },
568
+ {
569
+ "type": "text",
570
+ "text": "Broader Impact Statement ",
571
+ "text_level": 1,
572
+ "page_idx": 12
573
+ },
574
+ {
575
+ "type": "text",
576
+ "text": "This work presents an image-text pretraining approach on web-scale datasets that is capable of transferring to a wide range of downstream tasks in a zero-shot manner or with lightweight finetuning. While the pretrained models are capable of many vision and vision-language tasks, we note that our models use the same pretraining data as previous methods (Jia et al., 2021; Zhai et al., 2021a;b; Pham et al., 2021a) and additional analysis of the data and the resulting model is necessary before the use of the models in practice. We show CoCa models are more robust on corrupted images, but it could still be vulnerable to other image corruptions that are not yet captured by current evaluation sets or in real-world scenarios. For both the data and model, further community exploration is required to understand the broader impacts including but not limited to fairness, social bias and potential misuse. ",
577
+ "page_idx": 12
578
+ },
579
+ {
580
+ "type": "text",
581
+ "text": "References \nHarsh Agrawal, Karan Desai, Yufei Wang, Xinlei Chen, Rishabh Jain, Mark Johnson, Dhruv Batra, Devi Parikh, Stefan Lee, and Peter Anderson. nocaps: novel object captioning at scale. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 8948–8957, 2019. \nHassan Akbari, Liangzhe Yuan, Rui Qian, Wei-Hong Chuang, Shih-Fu Chang, Yin Cui, and Boqing Gong. Vatt: Transformers for multimodal self-supervised learning from raw video, audio and text. Advances in Neural Information Processing Systems, 34, 2021. \nAnders Andreassen, Yasaman Bahri, Behnam Neyshabur, and Rebecca Roelofs. The evolution of out-ofdistribution robustness throughout fine-tuning. arXiv preprint arXiv:2106.15831, 2021. \nAnurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Lučić, and Cordelia Schmid. Vivit: A video vision transformer. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6836–6846, 2021. \nHangbo Bao, Li Dong, and Furu Wei. Beit: Bert pre-training of image transformers. arXiv preprint arXiv:2106.08254, 2021. \nAndrei Barbu, David Mayo, Julian Alverio, William Luo, Christopher Wang, Dan Gutfreund, Josh Tenenbaum, and Boris Katz. Objectnet: A large-scale bias-controlled dataset for pushing the limits of object recognition models. Advances in neural information processing systems, 32, 2019. \nPaul Barham, Aakanksha Chowdhery, Jeff Dean, Sanjay Ghemawat, Steven Hand, Dan Hurt, Michael Isard, Hyeontaek Lim, Ruoming Pang, Sudip Roy, et al. Pathways: Asynchronous distributed dataflow for ml. arXiv preprint arXiv:2203.12533, 2022. \nRishi Bommasani, Drew A Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021. \nTom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. \nJoao Carreira, Eric Noland, Andras Banki-Horvath, Chloe Hillier, and Andrew Zisserman. A short note about kinetics-600. arXiv preprint arXiv:1808.01340, 2018. \nJoao Carreira, Eric Noland, Chloe Hillier, and Andrew Zisserman. A short note on the kinetics-700 human action dataset. arXiv preprint arXiv:1907.06987, 2019. \nXinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015. \nYen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. Uniter: Universal image-text representation learning. In ECCV, 2020. \nJaemin Cho, Jie Lei, Hao Tan, and Mohit Bansal. Unifying vision-and-language tasks via text generation. In International Conference on Machine Learning, pp. 1931–1942. PMLR, 2021. \nZihang Dai, Hanxiao Liu, Quoc V Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes. Advances in Neural Information Processing Systems, 34:3965–3977, 2021. \nJia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009. \nJacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. \nAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=YicbFdNTTy. \nZi-Yi Dou, Yichong Xu, Zhe Gan, Jianfeng Wang, Shuohang Wang, Lijuan Wang, Chenguang Zhu, Zicheng Liu, Michael Zeng, et al. An empirical study of training end-to-end vision-and-language transformers. arXiv preprint arXiv:2111.02387, 2021. \nRoss Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 580–587, 2014. \nYash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6904–6913, 2017. \nKaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. \nKaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners. arXiv preprint arXiv:2111.06377, 2021. \nDan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, et al. The many faces of robustness: A critical analysis of out-of-distribution generalization. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 8340–8349, 2021a. \nDan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15262–15271, 2021b. \nXiaowei Hu, Zhe Gan, Jianfeng Wang, Zhengyuan Yang, Zicheng Liu, Yumao Lu, and Lijuan Wang. Scaling up vision-language pre-training for image captioning. arXiv preprint arXiv:2111.12233, 2021. \nYanping Huang, Youlong Cheng, Ankur Bapna, Orhan Firat, Dehao Chen, Mia Chen, HyoukJoong Lee, Jiquan Ngiam, Quoc V Le, Yonghui Wu, et al. Gpipe: Efficient training of giant neural networks using pipeline parallelism. Advances in neural information processing systems, 32, 2019. \nChao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc Le, Yun-Hsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In International Conference on Machine Learning, pp. 4904–4916. PMLR, 2021. \nWoojeong Jin, Yu Cheng, Yelong Shen, Weizhu Chen, and Xiang Ren. A good prompt is worth millions of parameters? low-resource prompt-based learning for vision-language models. arXiv preprint arXiv:2110.08484, 2021. \nWill Kay, Joao Carreira, Karen Simonyan, Brian Zhang, Chloe Hillier, Sudheendra Vijayanarasimhan, Fabio Viola, Tim Green, Trevor Back, Paul Natsev, et al. The kinetics human action video dataset. arXiv preprint arXiv:1705.06950, 2017. \nWonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision, 2021. \nDan Kondratyuk, Liangzhe Yuan, Yandong Li, Li Zhang, Mingxing Tan, Matthew Brown, and Boqing Gong. Movinets: Mobile video networks for efficient video recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16020–16030, 2021. \nAlex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25, 2012. ",
582
+ "page_idx": 13
583
+ },
584
+ {
585
+ "type": "text",
586
+ "text": "",
587
+ "page_idx": 14
588
+ },
589
+ {
590
+ "type": "text",
591
+ "text": "Taku Kudo. Subword regularization: Improving neural network translation models with multiple subword candidates. arXiv preprint arXiv:1804.10959, 2018. ",
592
+ "page_idx": 15
593
+ },
594
+ {
595
+ "type": "text",
596
+ "text": "Juho Lee, Yoonho Lee, Jungtaek Kim, Adam Kosiorek, Seungjin Choi, and Yee Whye Teh. Set transformer: A framework for attention-based permutation-invariant neural networks. In International Conference on Machine Learning, pp. 3744–3753. PMLR, 2019. ",
597
+ "page_idx": 15
598
+ },
599
+ {
600
+ "type": "text",
601
+ "text": "Dmitry Lepikhin, HyoukJoong Lee, Yuanzhong Xu, Dehao Chen, Orhan Firat, Yanping Huang, Maxim Krikun, Noam Shazeer, and Zhifeng Chen. Gshard: Scaling giant models with conditional computation and automatic sharding. arXiv preprint arXiv:2006.16668, 2020. \nJunnan Li, Ramprasaath Selvaraju, Akhilesh Gotmare, Shafiq Joty, Caiming Xiong, and Steven Chu Hong Hoi. Align before fuse: Vision and language representation learning with momentum distillation. Advances in Neural Information Processing Systems, 34, 2021. \nJunnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pre-training for unified vision-language understanding and generation. arXiv preprint arXiv:2201.12086, 2022. \nJonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3431–3440, 2015. \nIlya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. \nDhruv Mahajan, Ross Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens Van Der Maaten. Exploring the limits of weakly supervised pretraining. In Proceedings of the European conference on computer vision (ECCV), pp. 181–196, 2018. \nMathew Monfort, Alex Andonian, Bolei Zhou, Kandan Ramakrishnan, Sarah Adel Bargal, Tom Yan, Lisa Brown, Quanfu Fan, Dan Gutfreund, Carl Vondrick, et al. Moments in time dataset: one million videos for event understanding. IEEE transactions on pattern analysis and machine intelligence, 42(2):502–508, 2019. \nHieu Pham, Zihang Dai, Golnaz Ghiasi, Kenji Kawaguchi, Hanxiao Liu, Adams Wei Yu, Jiahui Yu, YiTing Chen, Minh-Thang Luong, Yonghui Wu, Mingxing Tan, and Quoc V. Le. Combined scaling for open-vocabulary image classification, 2021a. URL https://arxiv.org/abs/2111.10050. \nHieu Pham, Zihang Dai, Qizhe Xie, and Quoc V Le. Meta pseudo labels. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11557–11568, 2021b. \nAJ Piergiovanni, Wei Li, Weicheng Kuo, Mohammad Saffar, Fred Bertsch, and Anelia Angelova. Answer-me: Multi-task open-vocabulary visual question answering. arXiv preprint arXiv:2205.00949, 2022. \nBryan A Plummer, Liwei Wang, Chris M Cervantes, Juan C Caicedo, Julia Hockenmaier, and Svetlana Lazebnik. Flickr30k entities: Collecting region-to-phrase correspondences for richer image-to-sentence models. In Proceedings of the IEEE international conference on computer vision, pp. 2641–2649, 2015. \nJesús Andrés Portillo-Quintero, José Carlos Ortiz-Bayliss, and Hugo Terashima-Marín. A straightforward framework for video retrieval using clip. arXiv preprint arXiv:2102.12443, 2021. \nAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pp. 8748–8763. PMLR, 2021. \nColin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683, 2019. \nBenjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? In International Conference on Machine Learning, pp. 5389–5400. PMLR, 2019. \nShaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In C. Cortes, N. Lawrence, D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 28. Curran Associates, Inc., 2015. URL https: //proceedings.neurips.cc/paper/2015/file/14bfa6bb14875e45bba028a21ed38046-Paper.pdf. \nSteven J Rennie, Etienne Marcheret, Youssef Mroueh, Jerret Ross, and Vaibhava Goel. Self-critical sequence training for image captioning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7008–7024, 2017. \nRico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909, 2015. \nNoam Shazeer and Mitchell Stern. Adafactor: Adaptive learning rates with sublinear memory cost. In International Conference on Machine Learning, pp. 4596–4604. PMLR, 2018. \nJonathan Shen, Patrick Nguyen, Yonghui Wu, Zhifeng Chen, et al. Lingvo: a modular and scalable framework for sequence-to-sequence modeling, 2019. \nSheng Shen, Liunian Harold Li, Hao Tan, Mohit Bansal, Anna Rohrbach, Kai-Wei Chang, Zhewei Yao, and Kurt Keutzer. How much can clip benefit vision-and-language tasks? arXiv preprint arXiv:2107.06383, 2021. \nKaren Simonyan and Andrew Zisserman. Two-stream convolutional networks for action recognition in videos. Advances in neural information processing systems, 27, 2014. \nAmanpreet Singh, Ronghang Hu, Vedanuj Goswami, Guillaume Couairon, Wojciech Galuba, Marcus Rohrbach, and Douwe Kiela. Flava: A foundational language and vision alignment model. arXiv preprint arXiv:2112.04482, 2021. \nLucas Smaira, João Carreira, Eric Noland, Ellen Clancy, Amy Wu, and Andrew Zisserman. A short note on the kinetics-700-2020 human action dataset. arXiv preprint arXiv:2010.10864, 2020. \nAlane Suhr, Stephanie Zhou, Ally Zhang, Iris Zhang, Huajun Bai, and Yoav Artzi. A corpus for reasoning about natural language grounded in photographs. arXiv preprint arXiv:1811.00491, 2018. \nHao Tan and Mohit Bansal. Lxmert: Learning cross-modality encoder representations from transformers. arXiv preprint arXiv:1908.07490, 2019. \nMaria Tsimpoukelli, Jacob L Menick, Serkan Cabi, SM Eslami, Oriol Vinyals, and Felix Hill. Multimodal few-shot learning with frozen language models. Advances in Neural Information Processing Systems, 34: 200–212, 2021. \nAshish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. \nOriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3156–3164, 2015. \nHaohan Wang, Songwei Ge, Zachary Lipton, and Eric P Xing. Learning robust global representations by penalizing local predictive power. Advances in Neural Information Processing Systems, 32, 2019. \nPeng Wang, An Yang, Rui Men, Junyang Lin, Shuai Bai, Zhikang Li, Jianxin Ma, Chang Zhou, Jingren Zhou, and Hongxia Yang. Unifying architectures, tasks, and modalities through a simple sequence-to-sequence learning framework. arXiv preprint arXiv:2202.03052, 2022. \nWenhui Wang, Hangbo Bao, Li Dong, and Furu Wei. Vlmo: Unified vision-language pre-training with mixture-of-modality-experts. arXiv preprint arXiv:2111.02358, 2021a. \nZirui Wang, Jiahui Yu, Adams Wei Yu, Zihang Dai, Yulia Tsvetkov, and Yuan Cao. Simvlm: Simple visual language model pretraining with weak supervision. arXiv preprint arXiv:2108.10904, 2021b. \nChen Wei, Haoqi Fan, Saining Xie, Chao-Yuan Wu, Alan Yuille, and Christoph Feichtenhofer. Masked feature prediction for self-supervised visual pre-training. arXiv preprint arXiv:2112.09133, 2021. \nRonald J Williams and David Zipser. A learning algorithm for continually running fully recurrent neural networks. Neural computation, 1(2):270–280, 1989. \nMitchell Wortsman, Gabriel Ilharco, Samir Yitzhak Gadre, Rebecca Roelofs, Raphael Gontijo-Lopes, Ari S Morcos, Hongseok Namkoong, Ali Farhadi, Yair Carmon, Simon Kornblith, et al. Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time. arXiv preprint arXiv:2203.05482, 2022. \nNing Xie, Farley Lai, Derek Doran, and Asim Kadav. Visual entailment: A novel task for fine-grained image understanding. arXiv preprint arXiv:1901.06706, 2019. \nZhenda Xie, Zheng Zhang, Yue Cao, Yutong Lin, Jianmin Bao, Zhuliang Yao, Qi Dai, and Han Hu. Simmim: A simple framework for masked image modeling. arXiv preprint arXiv:2111.09886, 2021. \nJun Xu, Tao Mei, Ting Yao, and Yong Rui. Msr-vtt: A large video description dataset for bridging video and language. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5288–5296, 2016. \nYuanzhong Xu, HyoukJoong Lee, Dehao Chen, Hongjun Choi, Blake Hechtman, and Shibo Wang. Automatic cross-replica sharding of weight update in data-parallel training. arXiv preprint arXiv:2004.13336, 2020. \nYuanzhong Xu, HyoukJoong Lee, Dehao Chen, Blake Hechtman, Yanping Huang, Rahul Joshi, Maxim Krikun, Dmitry Lepikhin, Andy Ly, Marcello Maggioni, et al. Gspmd: general and scalable parallelization for ml computation graphs. arXiv preprint arXiv:2105.04663, 2021. \nJianwei Yang, Chunyuan Li, Pengchuan Zhang, Bin Xiao, Ce Liu, Lu Yuan, and Jianfeng Gao. Unified contrastive learning in image-text-label space, 2022a. \nZhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Yumao Lu, Zicheng Liu, and Lijuan Wang. An empirical study of gpt-3 for few-shot knowledge-based vqa. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pp. 3081–3089, 2022b. \nLewei Yao, Runhui Huang, Lu Hou, Guansong Lu, Minzhe Niu, Hang Xu, Xiaodan Liang, Zhenguo Li, Xin Jiang, and Chunjing Xu. Filip: Fine-grained interactive language-image pre-training. arXiv preprint arXiv:2111.07783, 2021. \nLu Yuan, Dongdong Chen, Yi-Ling Chen, Noel Codella, Xiyang Dai, Jianfeng Gao, Houdong Hu, Xuedong Huang, Boxin Li, Chunyuan Li, et al. Florence: A new foundation model for computer vision. arXiv preprint arXiv:2111.11432, 2021. \nAndy Zeng, Adrian Wong, Stefan Welker, Krzysztof Choromanski, Federico Tombari, Aveek Purohit, Michael Ryoo, Vikas Sindhwani, Johnny Lee, Vincent Vanhoucke, and Pete Florence. Socratic models: Composing zero-shot multimodal reasoning with language. arXiv preprint arXiv:2204.00598, 2022. \nXiaohua Zhai, Alexander Kolesnikov, Neil Houlsby, and Lucas Beyer. Scaling vision transformers, 2021a. URL https://arxiv.org/abs/2106.04560. \nXiaohua Zhai, Xiao Wang, Basil Mustafa, Andreas Steiner, Daniel Keysers, Alexander Kolesnikov, and Lucas Beyer. Lit: Zero-shot transfer with locked-image text tuning. arXiv preprint arXiv:2111.07991, 2021b. \nBowen Zhang, Jiahui Yu, Christopher Fifty, Wei Han, Andrew M Dai, Ruoming Pang, and Fei Sha. Co-training transformer with videos and images improves action recognition. arXiv preprint arXiv:2112.07175, 2021a. \nPengchuan Zhang, Xiujun Li, Xiaowei Hu, Jianwei Yang, Lei Zhang, Lijuan Wang, Yejin Choi, and Jianfeng Gao. Vinvl: Revisiting visual representations in vision-language models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5579–5588, June 2021b. ",
602
+ "page_idx": 15
603
+ },
604
+ {
605
+ "type": "text",
606
+ "text": "",
607
+ "page_idx": 16
608
+ },
609
+ {
610
+ "type": "text",
611
+ "text": "",
612
+ "page_idx": 17
613
+ },
614
+ {
615
+ "type": "table",
616
+ "img_path": "images/b6d5370f65819bbc37a29ac16caf5e61ebcba7704dfc4b10b630950ce83577ab.jpg",
617
+ "table_caption": [
618
+ "A Visual Recognition Finetuning Details ",
619
+ "Table 8: Hyper-parameters used in the visual recognition experiments. "
620
+ ],
621
+ "table_footnote": [],
622
+ "table_body": "<table><tr><td></td><td colspan=\"2\">ImageNet</td><td colspan=\"2\">Kinetics-400/600/700 Frozen-feature Finetuning</td><td colspan=\"2\">Moments-in-Time</td></tr><tr><td>Hyper-parameter Frozen-feature Finetuning</td><td colspan=\"4\"></td><td colspan=\"2\">Frozen-feature Finetuning</td></tr><tr><td>Optimizer</td><td colspan=\"6\">Adafacter with Decoupled Weight Decay</td></tr><tr><td>Gradient clip</td><td colspan=\"6\">1.0</td></tr><tr><td>EMA decay rate</td><td colspan=\"6\">0.9999</td></tr><tr><td>LR decay schedule</td><td colspan=\"6\">Cosine Schedule Decaying to Zero</td></tr><tr><td>Loss</td><td colspan=\"6\">Softmax</td></tr><tr><td>MixUp</td><td colspan=\"6\">None</td></tr><tr><td>CutMix</td><td colspan=\"6\">None</td></tr><tr><td>AutoAugment</td><td colspan=\"6\">None None</td></tr><tr><td>RepeatedAugment</td><td colspan=\"6\"></td></tr><tr><td>RandAugment</td><td>2,20</td><td>2,20</td><td>None</td><td>None</td><td>None 0.0</td><td>None</td></tr><tr><td>Label smoothing</td><td>0.2</td><td>0.5</td><td>0.1</td><td>0.1</td><td>120k</td><td>0.0</td></tr><tr><td>Train steps</td><td>200k</td><td>200k</td><td>120k</td><td>120k</td><td></td><td>120k</td></tr><tr><td>Train batch size</td><td>512</td><td>512</td><td>128</td><td>128</td><td>128</td><td>128</td></tr><tr><td>Pooler LR</td><td>5e-4</td><td>5e-4</td><td>5e-4</td><td>5e-4</td><td>5e-4</td><td>5e-4</td></tr><tr><td>EncoderLR</td><td>0.0</td><td>5e-4</td><td>0.0</td><td>5e-4</td><td>0.0</td><td>5e-4</td></tr><tr><td>Warm-up steps</td><td>0</td><td>0</td><td>1000</td><td>1000</td><td>1000</td><td>1000</td></tr><tr><td>Weight decay rate</td><td>0.01</td><td>0.01</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td></tr></table>",
623
+ "page_idx": 18
624
+ },
625
+ {
626
+ "type": "text",
627
+ "text": "In addition to zero-shot transfer, we evaluate frozen-feature and finetuning performance of CoCa on visual recognition tasks. For frozen-feature evaluation, we add an attentional pooling layer (pooler) on top of the output sequence of visual features and an additional softmax cross entropy loss layer to learn classification of images and videos. For finetuning, we adapt the same architecture as frozen-feature evaluation (thus also with poolers) and finetune both encoder and pooler. All learning hyperparameters are listed in Table 8. ",
628
+ "page_idx": 18
629
+ },
630
+ {
631
+ "type": "text",
632
+ "text": "B Multimodal Understanding Finetuning Details ",
633
+ "text_level": 1,
634
+ "page_idx": 18
635
+ },
636
+ {
637
+ "type": "table",
638
+ "img_path": "images/23b5e95a43e335b6e8e57baf92d08ed1d7704d97c4af741b22c6cd02a47f390d.jpg",
639
+ "table_caption": [
640
+ "Table 9: Hyper-parameters used in the multimodal experiments. "
641
+ ],
642
+ "table_footnote": [],
643
+ "table_body": "<table><tr><td>Hyper-parameter</td><td>VQA</td><td>SNLI-VE</td><td>NLVR2</td><td>MSCoCO</td><td>NoCaps</td></tr><tr><td>Optimizer</td><td></td><td>Adafacter with Decoupled Weight Decay</td><td></td><td></td><td></td></tr><tr><td>Gradient clip</td><td></td><td></td><td>1.0</td><td></td><td></td></tr><tr><td>LR decay schedule</td><td></td><td></td><td>Cosine Schedule Decaying to Zero</td><td></td><td></td></tr><tr><td>RandAugment</td><td>1,10</td><td>1,10</td><td>None</td><td>None</td><td>None</td></tr><tr><td>Train steps</td><td>100k</td><td>50k</td><td>50k</td><td>50k</td><td>10k</td></tr><tr><td>Train batch size</td><td>64</td><td>128</td><td>64</td><td>128</td><td>128</td></tr><tr><td>Pooler LR</td><td>5e-4</td><td>1e-3</td><td>5e-4</td><td>NA</td><td>NA</td></tr><tr><td>Encoder LR</td><td>2e-5</td><td>5e-5</td><td>2e-5</td><td>1e-5</td><td>1e-5</td></tr><tr><td>Warm-up steps</td><td>1000</td><td>1000</td><td>1000</td><td>1000</td><td>1000</td></tr><tr><td>Weight decay rate</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr></table>",
644
+ "page_idx": 18
645
+ },
646
+ {
647
+ "type": "text",
648
+ "text": "CoCa is an encoder-decoder model and the final decoder outputs can be used for multimodal understanding/- generation. Thus, we evaluate on popular vision-language benchmarks. We mainly follow the same setup introduced in Wang et al. (2021b). All hyper-parameters are listed in Table 9. ",
649
+ "page_idx": 18
650
+ },
651
+ {
652
+ "type": "text",
653
+ "text": "For multimodal classification, we feed the image into the encoder and the corresponding text to the decoder. We then apply another attentional pooler with a single query to extract embedding from the decoder output, and train a linear classifier on top of the pooled embedding. For VQA v2 (Goyal et al., 2017), we follow prior work and formulate the task as a classification problem over 3,129 most frequent answers in the training set. ",
654
+ "page_idx": 18
655
+ },
656
+ {
657
+ "type": "table",
658
+ "img_path": "images/e991b1bd47b58041417474263ddab727e7642dc1ce0196581875ff5c659a5d58.jpg",
659
+ "table_caption": [
660
+ "Table 10: Zero-shot Video-Text Retrieval on MSR-VTT Full test set. "
661
+ ],
662
+ "table_footnote": [],
663
+ "table_body": "<table><tr><td></td><td colspan=\"6\">MSR-VTTFull</td></tr><tr><td></td><td colspan=\"3\">Text→Video</td><td colspan=\"3\">Video→Text</td></tr><tr><td>Method</td><td>R@1</td><td>R@5</td><td>R@10</td><td>R@1</td><td>R@5</td><td>R@10</td></tr><tr><td>CLIP (Portillo-Quintero et al., 2021)</td><td>21.4</td><td>41.1</td><td>50.4</td><td>40.3</td><td>69.7</td><td>79.2</td></tr><tr><td>Socratic Models (Zeng et al., 2022)</td><td>1</td><td></td><td></td><td>44.7</td><td>71.2</td><td>80.0</td></tr><tr><td>CLIP (Portillo-Quintero et al., 2021) (subset)</td><td>23.3</td><td>44.2</td><td>53.6</td><td>43.3</td><td>73.3</td><td>81.8</td></tr><tr><td>Socratic Models (Zeng et al., 2022) (subset)</td><td>1</td><td>1</td><td>1</td><td>46.9</td><td>73.5</td><td>81.3</td></tr><tr><td>CoCa (subset)</td><td>30.0</td><td>52.4</td><td>61.6</td><td>49.9</td><td>73.4</td><td>81.4</td></tr></table>",
664
+ "page_idx": 19
665
+ },
666
+ {
667
+ "type": "text",
668
+ "text": "We additionally enable cotraining with the generative loss on the concatenated pairs of textual questions and answers to improve model robustness. Similarly for SNLI-VE, the image and the textual hypothesis are fed to encoder and decoder separately, and the classifier is trained to predict the relation between them as entailment, neutral or contradiction. For NLVR2, we create two input pairs of each image and the text description, and concatenate them as input to the classifier. We do not use image augmentation for NLVR2. ",
669
+ "page_idx": 19
670
+ },
671
+ {
672
+ "type": "text",
673
+ "text": "For image captioning, we apply simple cross-entropy loss (same as the captioning loss used in pretraining) and finetune the model on the training split of MSCOCO to predict for MSCOCO test split and NoCaps online evaluation. We use beam search with beam size of 4 for all our experiments. ",
674
+ "page_idx": 19
675
+ },
676
+ {
677
+ "type": "text",
678
+ "text": "C Zero-Shot Video Retrieval ",
679
+ "text_level": 1,
680
+ "page_idx": 19
681
+ },
682
+ {
683
+ "type": "text",
684
+ "text": "We evaluate video-text retrieval using CoCa on MSR-VTT (Xu et al., 2016) using the full split. Table 10 shows that CoCa produces the highest retrieval metrics for both text-to-video and video-to-text retrieval. It is important to note that MSR-VTT videos are sourced from YouTube, and we require the original videos to compute our embeddings. Many of the videos have been made explicitly unavailable (Smaira et al., 2020), hence we compute retrieval over the subset of data that is publicly available at the time of evaluation. Using code $\\perp$ provided by the authors of Socratic Models (Zeng et al., 2022), we re-computed metrics on the available subset for those methods, indicated by “(subset)” for fairest comparison. ",
685
+ "page_idx": 19
686
+ }
687
+ ]
parse/test/Ee277P3AYC/Ee277P3AYC_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/Ee277P3AYC/Ee277P3AYC_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/XD0PHQ5ry4/XD0PHQ5ry4.md ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SELF: LANGUAGE-DRIVEN SELF-EVOLUTION FORLARGE LANGUAGE MODELS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Large Language Models (LLMs) have demonstrated remarkable versatility across various domains. To further advance LLMs, we propose ’SELF’ (Self-Evolution with Language Feedback), a novel approach that enables LLMs to self-improve through self-reflection, akin to human learning processes. SELF initiates with a meta-skill learning process that equips the LLMs with capabilities for selffeedback and self-refinement. Subsequently, the model undergoes an iterative process of self-evolution. In each iteration, it utilizes an unlabeled dataset of instructions to generate initial responses. These responses are enhanced through self-feedback and self-refinement. The model is then fine-tuned using this enhanced data. The model undergoes progressive improvement through this iterative self-evolution process. Moreover, the SELF framework enables the model to apply self-refinement during inference, which further improves response quality. Our experiments in mathematics and general tasks demonstrate that SELF can enhance the capabilities of LLMs without human intervention. The SELF framework indicates a promising direction for the autonomous evolution of LLMs, transitioning them from passive information receivers to active participants in their development.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Large Language Models (LLMs), like ChatGPT (OpenAI, 2022) and GPT-4 (OpenAI, 2023), stand at the forefront of the AI revolution, transforming our understanding of machine-human textual interactions and redefining numerous applications across diverse tasks. Despite their evident capabilities, achieving optimum performance remains a challenge.
12
+
13
+ The intrinsic learning mechanisms employed by humans inspire optimal LLM development. A selfdriven learning loop is inherent in humans when confronted with new challenges, involving initial attempts, introspection-derived feedback, and refinement of behavior as a result. In light of this intricate human learning cycle, one vital question arises: ”Can LLMs emulate human learning by harnessing the power of self-refinement to evolve their intrinsic abilities?” Fascinatingly, a recent study (Ye et al., 2023) in top-tier LLMs such as GPT-4 has revealed emergent meta-skills for selfrefinement, signaling a promising future direction for the self-evolution of LLMs. Despite this, current methods for LLM development typically rely on a single round of instruction fine-tuning (Wei et al., 2021; Zhou et al., 2023) with meticulously human-crafted datasets and reinforcement learning-based methods (Ouyang et al., 2022) that depend on an external reward model. These strategies not only require extensive resources and ongoing human intervention but also treat LLMs as mere passive repositories of information. These limitations prevent these models from realizing their intrinsic potential and evolving toward a genuinely autonomous, self-sustaining evolutionary state.
14
+
15
+ Our goal is to reveal the potential of LLMs for autonomous self-evolution by introducing a selfevolving learning framework called ”SELF” (Self-Evolution with Language Feedback). Fig. 1 illustrates how SELF emulates the self-driven learning process with introspection and self-refinement. Through self-feedback and self-refinement, LLMs undergo iterative self-evolution as they learn from the data they synthesize. Furthermore, SELF employs natural language feedback to improve the model’s responses during inference. This innovative framework can enhance models’ capabilities without relying on external reward models or human intervention. Self-feedback and self-refinement are integral components of the SELF framework. Equipped with these meta-skills, the model undergoes progressive self-evolution through iterative training with self-curated data. Evolution training data is collected by the model’s iterative response generation and refinement processes. A perpetually expanding repository of self-curated data allows the model to enhance its abilities continuously. Data quality and quantity are continually improved, enhancing the intrinsic capabilities of LLMs. These meta-skills enable LLMs to enhance response quality through self-refinement during inference. As a result of the SELF framework, LLMs are transformed from passive data recipients into active participants in their evolution. The SELF framework not only alleviates the necessity for labor-intensive manual adjustments but also fosters the continuous self-evolution of LLMs, paving the way for a more autonomous and efficient training paradigm.
16
+
17
+ ![](images/a952b4451ee074a19de4249b8c116c3eb1ff8c1d3513ebd12fa99d192fb551f1.jpg)
18
+ Figure 1: Evolutionary Journey of SELF: An initial LLM progressively evolve to a more advanced LLM equipped with a self-refinement meta-skill. By continual iterations (1st, 2nd, 3rd) of selfevolution, the LLM progresses in capability $( 2 4 . 4 9 \%$ to $3 1 . 3 1 \%$ ) on GSM8K.
19
+
20
+ We evaluate SELF in mathematical and general domains. In the mathematical domain, SELF notably improved the test accuracy on GSM8k (Cobbe et al., 2021) from $2 4 . 4 9 \%$ to $3 1 . 3 1 \%$ and on SVAMP (Patel et al., 2021) from $4 4 . 9 0 \%$ to $4 9 . 8 0 \%$ . In the general domain, SELF increased the win rate on Vicuna testset (Lianmin et al., 2023) from $6 5 . 0 \%$ to $7 5 . 0 \%$ and on Evol-Instruct testset $\mathrm { { X u } }$ et al., 2023) from $4 8 . 6 \%$ to $5 5 . 5 \%$ . There are several insights gained from our experiments. First, SELF can continuously enhance the performance of models in generating direct responses through iterative self-evolution training. Second, meta-skill learning is essential for the model to acquire the ability for self-feedback and self-refinement. By self-refinement during inference, the model can consistently improve its response. Finally, meta-skill learning enhances the model’s performance in generating direct responses. The model’s generalization can be improved by providing language feedback to correct its mistakes.
21
+
22
+ The following key points summarize our contributions: (1) SELF is a framework that empowers LLMs with self-evolving capabilities, allowing for autonomous model evolution without human intervention. (2) SELF facilitates self-refinement in smaller LLMs, even with challenging math problems. The capability of self-refinement was previously considered an emergent characteristic of top-tier LLMs. (3) We demonstrate SELF’s superiority, progressively demonstrating its ability to evolve intrinsic abilities on representative benchmarks and self-refinement capability.
23
+
24
+ # 2 RELATED WORKS
25
+
26
+ Self-consistency Self-consistency (Wang et al., 2022a) is a straightforward and effective method to improve LLMs for reasoning tasks. After sampling a variety of reasoning paths, the most consistent answer is selected. Self-consistency leverages the intuition that a complex reasoning problem typically admits multiple ways of thinking, leading to its unique correct answer. During decoding, self-consistency is closely tied to the self-refinement capability of LLMs, on which our method is based. Unlike self-consistency, self-refinement applies to a broader range of tasks, going beyond reasoning tasks with unique correct answers.
27
+
28
+ Online Self-improvement for LLMs Various research efforts have been undertaken to enhance the output quality of LLMs through online self-improvement (Shinn et al., 2023; Madaan et al., 2023; Ye et al., 2023; Chen et al., 2023; Ling et al., 2023). The main idea is to generate an initial output with an LLM. Then, the same LLM provides feedback on its output and employs this feedback to refine its initial output. This process can be iterative until the response quality is satisfied.
29
+
30
+ While simple and effective, online self-improvement necessitates multi-turn inference for refinement, leading to increased computational overhead. Most importantly, online self-improvement does not prevent the model from repeating previously encountered errors, as the model’s parameters remain unchanged. In contrast, SELF is designed to enable the model to learn from its self-improvement experiences.
31
+
32
+ Human Preference Alignment for LLMs The concept of ”Alignment”, introduced by (Leike et al., 2018), is to train agents to act in line with human intentions. Several research efforts (Ouyang et al., 2022; Bai et al., 2022; Scheurer et al., 2023) leverage Reinforcement Learning from Human Feedback (RLHF) (Christiano et al., 2017). RLHF begins with fitting a reward model to approximate human preferences. Subsequently, an LLM is finetuned through reinforcement learning to maximize the estimated human preference of the reward model. RLHF is a complex procedure that can be unstable. It often requires extensive hyperparameter tuning and heavily relies on humans for preference annotation. Reward Ranked Fine-tuning (RAFT) utilizes a reward model to rank responses sampled from an LLM. Subsequently, it fine-tunes the LLM using highly-ranked responses (Dong et al., 2023). However, scalar rewards provide limited insights into the detailed errors and optimization directions, which is incredibly impractical for evaluating complex reasoning tasks involving multiple reasoning steps (Lightman et al., 2023). Instead, in this work, we propose to leverage natural language feedback to guide LLMs for self-evolution effectively.
33
+
34
+ Reinforcement Learning Without Human Feedback in LLMs Recent advancements in LLMs have explored Reinforcement Learning (RL) approaches that do not rely on human feedback. LLMs are employed to assess and score the text they generate, which serves as a reward in the RL process (Pang et al., 2023). LLMs are updated progressively through online RL in interacting with the environment in Carta et al. (2023). The connection between conventional RL research and RLHF in LLMs is discussed by Sun (2023). While RL methods also enable automatic learning, they may not capture the nuanced understanding and adaptability offered by natural language feedback, a key component of SELF.
35
+
36
+ # 3 METHOD
37
+
38
+ As depicted in Fig. 1 and Fig. 2, the SELF framework aligns the model and enhances its inherent capabilities through a two-stage learning phase: (1) Meta-skill Learning Phase: This phase equips the model with essential meta-skills for self-feedback and self-refinement, laying a foundation for self-evolution. (2) Self-Evolution Phase: With the acquired meta-skills, the model progressively improves through multiple iterations of the self-evolution process. Each iteration begins with the model autonomously creating high-quality training data. Then, the model is fine-tuned using this data. The process is further illustrated in Alg. 1 in Appendix A.4.
39
+
40
+ # 3.1 META-SKILL LEARNING
41
+
42
+ The meta-skill learning stage aims to instill two essential meta-skills into LLMs:
43
+
44
+ (1) Self-Feedback Ability: This skill enables LLMs to evaluate their responses critically, laying the foundation for subsequent refinements. Self-feedback also enables the model to evaluate and filter out low-quality self-evolution training data $( \ S \ 3 . 2 . 1 )$ .
45
+
46
+ (2) Self-Refinement Ability: Self-refinement involves the model optimizing its responses based on self-feedback. This ability has two applications: (1) improving model performance by refining the models’ outputs during inference $( \ S \ 3 . 2 . 3 )$ and (2) enhancing the quality of the self-evolution training corpus $( \ S 3 . 2 . 1 )$ .
47
+
48
+ ![](images/cb8f3782319329cdd2aafedbf6a4a7e597739f26490c5f4ae0c16ae2a9818f30.jpg)
49
+ Figure 2: Illustration of SELF. The ”Meta-Skill Learning” (left) phase empowers the LLM to acquire meta-skills in self-feedback and self-refinement. The ”Self-Evolution” phase (right) utilizes metaskills for self-evolution training with self-curated data, enabling continuous model enhancement.
50
+
51
+ These meta-skills are acquired by fine-tuning the model using the Meta-Skill Training Corpus. Details are provided in $\ S \ 3 . 1 . 1$ . The resulting model is denoted as $M _ { m e t a }$ . Meta-skill learning establishes a foundation for the model to initiate subsequent self-evolution processes.
52
+
53
+ # 3.1.1 META-SKILL TRAINING CORPUS
54
+
55
+ The construction of the meta-skill learning corpus $D _ { m e t a }$ involves the following elements: (1) An initial unlabeled prompt corpus $D _ { \mathrm { u n l a b e l e d } }$ ; (2) An initial LLM denoted as $M _ { i n i t i a l }$ ; (3) A strong LLM or human labeler $L$ tasked with evaluating and refining the responses of $M _ { i n i t i a l }$ .
56
+
57
+ Specifically, the construction process operated in the following steps: (1) For each unlabeled prompt $p$ in $D _ { \mathrm { u n l a b e l e d } }$ , the initial model $M _ { i n i t i a l }$ generates a initial response $r$ . (2) The annotator $L$ provides evaluation feedback $f$ for the initial response $r$ , then produces a refined answer $\hat { r }$ according to the feedback $f$ . (3) Each instance in the meta-skill training data corpus $D _ { m e t a }$ takes the form $( p , r , f , \hat { r } )$ , representing the process of response evaluation and refinement. An example instance of $D _ { m e t a }$ is provided in Appendix A.3.
58
+
59
+ The data structure in $D _ { m e t a }$ differs from the standard question-answering format, potentially weakening the model’s ability to provide direct responses. We add a pseudo-labeled QA dataset denoted as $D _ { Q A }$ to alleviate this issue. This dataset consists of pairs of questions $p$ and refined answers $\hat { r }$ . Notably, $D _ { Q A }$ is derived from the LLM-labeled $D _ { m e t a }$ and does not include any human-annotated ground-truth data. This data integration strategy ensures a balanced emphasis on direct generation and self-refinement capability.
60
+
61
+ We prompt the LLM labeler $L$ with the following template to generate feedback and refinement 1:
62
+
63
+ # Prompt for feedback and refinement:
64
+
65
+ (Feedback) Please assess the quality of the response to the given question.
66
+ Here is the question: $p$ .
67
+ Here is the response: $r$ .
68
+ Firstly, provide a step-by-step analysis and verification for response starting with “Response Analysis:”.
69
+ Next, judge whether the response correctly answers the question in the format of “judgment: correct/incorrect”.
70
+ (Refinement) If the answer is correct, output it. Otherwise, output a refined answer based on the given response and your assessment.
71
+
72
+ # 3.2 SELF-EVOLUTION PROCESS
73
+
74
+ The model $M _ { m e t a }$ , equipped with meta-skills, undergoes progressive improvement through multiple iterations of the self-evolution process. Each iteration of the self-evolution process initiates with the model autonomously creating high-quality training data $( \ S \ 3 . 2 . 1 )$ . With an unlabeled dataset of prompts, the model generates initial responses and then refines them through self-feedback and selfrefinement. These refined responses, superior in quality, are then utilized as the training data for the model’s subsequent self-evolution training $( \ S \ 3 . 2 . 2 )$ .
75
+
76
+ # 3.2.1 SELF-EVOLUTION TRAINING DATA
77
+
78
+ A corpus of unlabeled prompts is needed for self-evolution training. Given that real-world prompts are often limited, we employ Self-Instruct (Wang et al., 2022b) to generate additional unlabeled prompts. We denote $M _ { s e l f } ^ { t }$ as the model at the $t$ -th iteration. In the first iteration of self-evolution, we initialize $M _ { s e l f } ^ { 0 }$ with $M _ { m e t a }$ . For each unlabeled prompt, the model $M _ { s e l f } ^ { t }$ generates a response, which is subsequently refined through its self-refinement ability to produce the final output $\hat { r } _ { s e l f }$ . The prompt and self-refined response pairs, denoted as $\left( p _ { s e l f } , \hat { r } _ { s e l f } \right)$ , are subsequently incorporated into the self-evolution training dataset $D _ { s e l f } ^ { t }$ for subsequent self-evolution processes.
79
+
80
+ Data Filtering with Self-feedback: To enhance the quality of $D _ { s e l f } ^ { t }$ self , we leverage the selffeedback capability of $M _ { s e l f } ^ { t }$ to filter out low-quality data. Specifically, $M _ { s e l f } ^ { t }$ applies self-feedback to the self-refined data $\hat { r } _ { s e l f }$ , and only those responses evaluated as qualified are retained.
81
+
82
+ After each iteration of self-evolution training, the model $M _ { s e l f }$ undergoes capability improvements. This leads to the creation of a higher-quality training corpus for subsequent iterations. Importantly, this autonomous data construction process obviates the need for more advanced LLMs or human annotators, significantly reducing manual labor and computational demands.
83
+
84
+ # 3.2.2 SELF-EVOLUTION TRAINING PROCESS
85
+
86
+ At each iteration $t$ , the model undergoes self-evolution training with the updated self-curated data, improving its performance and aligning it more closely with human values. Specifically, we experimented with two strategies for self-evolution training:
87
+
88
+ (1) Restart Training: In this approach, we integrate the meta-skill learning data $D _ { m e t a }$ and the accumulated self-curated data from all previous iterations — denoted as $\{ D _ { s e l f } ^ { \mathrm { { 0 } } } , D _ { s e l f } ^ { 1 } , . . . , D _ { s e l f } ^ { t } \}$ to initiate the training afresh from $M _ { i n i t i a l }$ .
89
+
90
+ (2) Continual Training: Here, utilizing the newly self-curated data $D _ { s e l f } ^ { t }$ , we continue the training of the model from the preceding iteration, represented as $M _ { s e l f } ^ { t - 1 }$ . We also incorporate $D _ { m e t a }$ into continual training to mitigate the potential catastrophic forgetting of meta-skills.
91
+
92
+ The impact of these two divergent training strategies is thoroughly analyzed in our experiments in Appendix A.8.
93
+
94
+ # 3.2.3 RESPONSE REFINEMENT DURING INFERENCE
95
+
96
+ Equipped with the meta-skills for self-feedback and self-refinement, the model can conduct selfrefinement during inference. Specifically, the model generates an initial response and then refines it using self-refinement, akin to the method described in $\ S \ 3 . 1$ . Response refinement during inference consistently improves the model’s performance as shown in $\ S 4 . 2$ .
97
+
98
+ # 4 EXPERIMENTS
99
+
100
+ We begin with an introduction to the experimental settings $( \ S 4 . 1 )$ , encompassing the evaluation data, baseline model, and model variations. In $\ S 4 . 2$ , we present our main experiment to show the efficacy of SELF. $\ S 4 . 3$ demonstrates the incremental performance enhancements observed throughout selfevolution processes.
101
+
102
+ Given space limitations, we conduct several experiments to verify the SELF framework and include their details in the Appendix. We verify the effect of different meta-skill training corpus construction methods in Appendix A.6. Appendix A.7 shows the impact of filtering strategies when constructing the self-evolution corpus. Appendix A.8 evaluates the impact of divergent self-evolution training strategies as described in $\ S 3 . 2 . 2$ . We demonstrate that SELF outperforms supervised fine-tuning in Appendix A.9. We explore how SELF performs with different starting model qualities in Appendix A.10 to exhibit the scalability of the SELF framework. In Appendix A.11, we investigate how the quality of the meta-skill learning corpus influences self-evolution training. We compare the effect of training with a single round of self-evolution versus training iteratively in Appendix A.12.
103
+
104
+ # 4.1 EXPERIMENT SETTINGS
105
+
106
+ # 4.1.1 EVALUATION BENCHMARKS
107
+
108
+ We focus on two representative mathematical benchmarks and two general benchmarks: GSM8K (Cobbe et al., 2021) contains high-quality, linguistically diverse grade school math word problems crafted by expert human writers, which incorporates approximately $7 . 5 \mathrm { K }$ training problems and 1K test problems. The performance is measured by accuracy $( \% )$ . SVAMP (Patel et al., 2021) is a challenge set for elementary Math Word Problems (MWP). It is composed of 1000 test samples. The evaluation metric is accuracy $( \% )$ . Vicuna testset (Lianmin et al., 2023) is a benchmark for assessing instruction-following models, containing 80 examples across nine skills in mathematics, reasoning, and coding. Evol-Instruct testset (Xu et al., 2023) includes 218 real-world human instructions from various sources, offering greater size and complexity than the Vicuna testset.
109
+
110
+ # 4.1.2 SETUP AND BASELINES
111
+
112
+ The complete SELF framework includes meta-skill training with $D _ { m e t a }$ , three iterations of selfevolution training, and optional self-refinement during inference. Our evaluation primarily focuses on assessing how self-evolution training can progressively enhance the capabilities of the underlying LLMs. We note that the SELF framework is compatible with all LLMs. In this study, we perform the experiment with Vicuna-7b (Chiang et al., 2023) , which stands out as one of the most versatile open instruction-following models. Vicuna-7b, fine-tuned from LLaMA-7b (Touvron et al., 2023), will be referred to simply as ’Vicuna’ in subsequent sections. One of our baseline model is Vicuna $^ +$ $D _ { Q A }$ which are Vicuna-7b fine-tuned with the pseudo-labeled question-answer data $D _ { Q A }$ $( \ S 3 . 1 . 1 )$ . We also compare SELF with the Self-Consistency (Wang et al., 2022a) approach. We note that all model training utilized the same training hyperparameters shown in Appendix A.1.1.
113
+
114
+ For building the meta-skill training corpus $D _ { m e t a }$ , we utilize GPT-4 due to its proven proficiency in refining responses (An et al., 2023). Please refer to Appendix A.1.2 for more details about $D _ { Q A }$ and unlabeled prompts utilized in self-evolution training.
115
+
116
+ Additionally, we compare SELF with RLHF. We utilize the RLHF implementation from $\mathrm { t r l } \mathbf { x } ^ { 2 }$ . We apply the same SFT model, Vicuna $+ D _ { Q A }$ as described above, for both SELF and RLHF. The reward model is initialized from Vicuna-7b and is fine-tuned using pair-wise comparison data derived from the meta-skill training corpus $D _ { m e t a }$ $\left( \ S 3 . 1 . 1 \right)$ , where the refined response $\hat { r }$ is presumed to be better than the original one $r$ .
117
+
118
+ # 4.2 MAIN RESULT
119
+
120
+ # 4.2.1 MATH TEST
121
+
122
+ Table 1: Experiment results on GSM8K and SVAMP comparing SELF with other baseline methods. Vicuna $+ D _ { Q A }$ means Vicuna fine-tuned on $D _ { Q A }$ .
123
+
124
+ <table><tr><td>Model</td><td>Self-Evolution</td><td>Self-Consistency</td><td>Self-Refinement</td><td>GSM8K(%)</td><td>SVAMP(%)</td></tr><tr><td rowspan="3">Vicuna</td><td rowspan="3"></td><td rowspan="3"></td><td></td><td>16.43</td><td>36.40</td></tr><tr><td></td><td>19.56</td><td>40.20</td></tr><tr><td></td><td>15.63</td><td>36.80</td></tr><tr><td rowspan="3">Vicuna + DQA</td><td rowspan="3"></td><td rowspan="3"></td><td></td><td>24.49</td><td>44.90</td></tr><tr><td></td><td>25.70</td><td>46.00</td></tr><tr><td>√</td><td>24.44</td><td>45.30</td></tr><tr><td rowspan="4">Vicuna + DQA + SELF(Ours)</td><td>&gt;&gt;</td><td></td><td></td><td>29.64</td><td>49.40</td></tr><tr><td></td><td>√</td><td></td><td></td><td></td></tr><tr><td>√</td><td></td><td>√</td><td>31.31</td><td>49.80</td></tr><tr><td>√</td><td>√</td><td>√</td><td>32.22</td><td>51.20</td></tr></table>
125
+
126
+ In Table 1, we present an experimental comparison of SELF against baseline models, as detailed in Section 4.1.2. This comparison elucidates SELF’s effectiveness in enhancing LLM performance through self-evolution and offers several key insights:
127
+
128
+ (1) Self-Evolution Enhances LLM: Vicuna $^ +$ $D _ { Q A } + \ S$ SELF significantly outperforms its baseline Vicuna $+ \ D _ { Q A }$ $( 2 4 . 4 9 \% \xrightarrow { + 5 . 1 5 \% } 2 9 . 6 4 \%$ on GSM8K and +4.5%−−−−→ 49.40% on SVAMP), showcasing self-evolution’s potential in LLMs’ optimization.
129
+
130
+ (2) SELF Instills Meta-Capability in LLMs: The integration of self-refinement into Vicuna $^ +$ $D _ { Q A } +$ SELF results in a notable performance boost $( 2 9 . 6 4 \%$ +1.67%−−−−−→ 31.31%), while baseline models show minimal or negative changes via self-refinement. We also provide a case analysis for the limited self-refinement ability in baseline models in Appendix A.2. This indicates that SELF instills advanced self-refinement capabilities into smaller models like Vicuna (7B), previously limited to larger LLMs (Ye et al., 2023) like GPT-4.
131
+
132
+ (3) Pseudo-Labeled $D _ { Q A }$ Enhances Performance: The inclusion of pseudo-labeled QA data $D _ { Q A }$ enhances Vicuna’s performance, suggesting that pseudo-labeled QA data help in learning taskspecific information.
133
+
134
+ (4) SELF can work with Self-Consistency: SELF works effectively with self-consistency, improving accuracy across models. The base Vicuna model, which may have uncertainties in its outputs, shows notable improvement with self-consistency, achieving a $+ 3 . 1 3 \%$ increase. As the model progresses through self-evolution training and becomes more capable of generating correct math answers, the benefit from self-consistency diminishes. Combining self-refinement with selfconsistency further elevates performance (e.g., $2 9 . 6 4 \% \xrightarrow { + 2 . 5 8 \% } 3 2 . 2 2 \%$ on GSM8K), indicating that these two strategies can complement each other effectively.
135
+
136
+ # 4.2.2 COMPARISON WITH RLHF
137
+
138
+ In Table 2, we compare the performance of SELF with RLHF. We note that the SELF result in Table 2 differs from those in Table 1. This discrepancy arises because the experiments in Table 2 utilized data solely from the initial round of self-evolution training. As Table 2 shows, RLHF achieves a $2 5 . 5 5 \%$ accuracy on GSM8K, which is lower than the $2 7 . 6 7 \%$ performed by SELF. We observe that the reward model often fails to identify the correctness of the response, which limits performance improvements. On the GSM8K test set, for incorrect answers produced by the SFT model (Vicuna $+ D _ { Q A } )$ , the reward model only identifies $24 \%$ of them as incorrect, i.e., the reward model assigns lower scalar rewards to incorrect answers compared to correct answers. In contrast, SELF utilizes informative natural language feedback to provide a more accurate assessment. It correctly identifies $72 \%$ of incorrect answers.
139
+
140
+ Table 2: Comparison of SELF and RLHF on GSM8K
141
+
142
+ <table><tr><td>Method</td><td>Acc.of Feedback(%)Acc.on GSM8K(%)</td><td></td></tr><tr><td>SFT (Vicuna + DQA)</td><td>-</td><td>24.49</td></tr><tr><td>RLHF</td><td>24</td><td>25.55</td></tr><tr><td>SELF</td><td>72</td><td>27.67</td></tr></table>
143
+
144
+ # 4.2.3 GENERAL TEST
145
+
146
+ We expanded the evaluation of the SELF framework to include general domain benchmarks, explicitly using the Vicuna and Evol-Instruct test sets. Three configurations of the Vicuna model are evaluated: Vicuna, Vicuna $+ D _ { Q A }$ , and Vicuna $+ \ D _ { Q A } + { \mathrm { S E L F } } .$ . We utilized GPT-4 to evaluate the models’ responses on both test sets. We follow the assessment methodology proposed by ( $\mathrm { { X u } }$ et al., 2023), which mitigated the order bias present in the evaluation procedures described in (Chiang et al., 2023).
147
+
148
+ The results are depicted in Figure 3. In this figure, blue represents the number of test cases where the model being evaluated is preferred over the baseline model (Vicuna), as assessed by GPT-4. Yellow denotes test cases where both models perform equally, and pink indicates the number of test cases where the baseline model is favored over the model being evaluated.
149
+
150
+ ![](images/0f0df84a5cebbb7242440327379cee1a05b5cb4c4c62bb5810cf112cd769ed20.jpg)
151
+ Figure 3: Results on Vicuna testset and Evol-Instruct testset
152
+
153
+ In the Vicuna testset, Vicuna $+ \ D _ { Q A }$ improved its win/tie/loss record from 52/11/17 to 58/7/15 with the addition of SELF. This translates to a win rate increase from $6 5 . 0 \%$ to $7 2 . 5 \%$ . After selfrefinement, the record improved to 60/7/13, corresponding to a win rate of $7 5 . 0 \%$ . In the EvolInstruct testset, Vicuna $+ D _ { Q A }$ initially had a win/tie/loss record of 106/37/75, a win rate of about $4 8 . 6 \%$ . With SELF, this improved to 115/29/74, increasing the win rate to approximately $5 2 . 8 \%$ . Applying self-refinement, the record improved further to 121/28/69, equating to a win rate of $5 5 . 5 \%$ .
154
+
155
+ These findings in general domains highlight the SELF framework’s adaptability and robustness, particularly when self-refinement is employed, showcasing its efficacy across varied test domains.
156
+
157
+ # 4.3 ABLATION STUDY FOR SELF
158
+
159
+ The SELF framework endows LLMs with an inherent capability through a structured, two-phase learning process. We conduct ablation experiments on SVAMP and GSM8K datasets to assess the incremental benefits of each stage. As depicted in Table 3, the framework facilitates gradual performance improvements through successive SELF stages. A checkmark $\checkmark$ in a column denotes the additive adoption of the corresponding setting in that training scenario. Observations are highlighted below:
160
+
161
+ Table 3: Performance comparisons of SELF under various training scenarios. Arrows indicate the improvement from direct generation to self-refinement: ”direct generation self-refinement”
162
+
163
+ <table><tr><td rowspan="2">SVAMP (%)</td><td rowspan="2">GSM8K (%)</td><td colspan="2">Meta-Skill Learning</td><td colspan="3">Self Evolution Process</td></tr><tr><td>DQA</td><td>Dmeta</td><td>1st round</td><td> 2nd round</td><td> 3rd round</td></tr><tr><td>36.4</td><td>16.43</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>44.9</td><td>24.49</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>25.39→28.28</td><td>&lt;&gt;</td><td></td><td></td><td></td><td></td></tr><tr><td>46.8→47.0</td><td></td><td>√</td><td>&gt;&gt;</td><td>&gt;&gt;</td><td></td><td></td></tr><tr><td>48.9 → 49.0</td><td>28.66→29.87</td><td>√</td><td>√</td><td></td><td>&gt;&gt;</td><td></td></tr><tr><td>49.4 -→ 50.2</td><td>29.64 -→ 31.31</td><td>√</td><td>√</td><td>√</td><td></td><td>√</td></tr></table>
164
+
165
+ (1) Integration of Meta-skill Training Data $D _ { m e t a }$ Elevates Direct QA: Incorporating data detailing the feedback-refinement process $( D _ { m e t a } )$ in meta-skill training notably enhances direct response quality $( + 1 . 9 \%$ on GSM8K and $+ 2 . 2 8 \%$ on SVAMP) in comparison to using $D _ { Q A }$ alone. This underscores the interesting finding that arming the model with self-refinement meta-capability implicitly elevates its capacity to discern the standard of a good answer and generate superior responses, even without explicit self-refinement.
166
+
167
+ (2) Continuous Improvement through Self-Evolution: The results reveal that three selfevolution rounds consecutively yield performance enhancements (e.g., $2 5 . 3 9 \%$ $\underline { { + 2 . 2 8 \% } } ,$ $2 7 . 6 7 \% \xrightarrow { + 0 . 9 9 \% } 2 8 . 6 6 \% \xrightarrow { + 0 . 9 8 \% } 2 9 . 6 4 \%$ +0.98%−−−−−→ 29.64% on GSM8K). This shows that the model actively evolves, refining its performance autonomously without additional manual intervention.
168
+
169
+ (3) Persistent Efficacy of Self-Refinement: Regardless of model variation, executing selfrefinement consistently results in notable performance improvements. This shows that the selfrefinement meta-capability learned by SELF is robust and consistent across various LLMs.
170
+
171
+ # 5 CONCLUSION
172
+
173
+ We present SELF (Self-Evolution with Language Feedback), a novel framework that enables LLMs to achieve progressive self-evolution through self-feedback and self-refinement. Unlike conventional methods, SELF transforms LLMs from passive information recipients to active participants in their evolution. Through meta-skill learning, SELF equips LLMs with the capability for selffeedback and self-refinement. This empowers the models to evolve their capabilities autonomously and align with human values, utilizing self-evolution training and online self-refinement. Experiments conducted on benchmarks underscore SELF’s capacity to progressively enhance model capabilities while reducing the need for human intervention. SELF represents a significant step in the development of autonomous artificial intelligence, leading to a future in which models are capable of continual learning and self-evolution. This framework lays the groundwork for a more adaptive, self-conscious, responsive, and human-aligned future in AI development.
174
+
175
+ # REFERENCES
176
+
177
+ Shengnan An, Zexiong Ma, Zeqi Lin, Nanning Zheng, Jian-Guang Lou, and Weizhu Chen. Learning from mistakes makes llm better reasoner. arXiv preprint arXiv:2310.20689, 2023.
178
+
179
+ Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, et al. Training a helpful and harmless assistant with reinforcement learning from human feedback. arXiv preprint arXiv:2204.05862, 2022.
180
+
181
+ Thomas Carta, Clement Romac, Thomas Wolf, Sylvain Lamprier, Olivier Sigaud, and Pierre-Yves ´ Oudeyer. Grounding large language models in interactive environments with online reinforcement learning. arXiv preprint arXiv:2302.02662, 2023.
182
+
183
+ Xinyun Chen, Maxwell Lin, Nathanael Scharli, and Denny Zhou. Teaching large language models ¨ to self-debug. arXiv preprint arXiv:2304.05128, 2023.
184
+
185
+ Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E. Gonzalez, Ion Stoica, and Eric P. Xing. Vicuna: An open-source chatbot impressing gpt-4 with $9 0 \% *$ chatgpt quality, March 2023. URL https: //lmsys.org/blog/2023-03-30-vicuna/.
186
+
187
+ Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. Advances in neural information processing systems, 30, 2017.
188
+
189
+ Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
190
+
191
+ Hanze Dong, Wei Xiong, Deepanshu Goyal, Rui Pan, Shizhe Diao, Jipeng Zhang, Kashun Shum, and Tong Zhang. Raft: Reward ranked finetuning for generative foundation model alignment. arXiv preprint arXiv:2304.06767, 2023.
192
+
193
+ Xinyang Geng and Hao Liu. Openllama: An open reproduction of llama, May 2023. URL https: //github.com/openlm-research/open_llama.
194
+
195
+ Rik Koncel-Kedziorski, Subhro Roy, Aida Amini, Nate Kushman, and Hannaneh Hajishirzi. MAWPS: A math word problem repository. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 1152–1157, San Diego, California, June 2016. Association for Computational Linguistics. doi: 10.18653/v1/N16-1136. URL https://aclanthology.org/N16-1136.
196
+
197
+ Jan Leike, David Krueger, Tom Everitt, Miljan Martic, Vishal Maini, and Shane Legg. Scalable agent alignment via reward modeling: a research direction. arXiv preprint arXiv:1811.07871, 2018.
198
+
199
+ Zheng Lianmin, Chiang Wei-Lin, and Zhuang Siyuan (Ryans). Vicuna-blog-eval, 2023. https: //github.com/lm-sys/vicuna-blog-eval.
200
+
201
+ Hunter Lightman, Vineet Kosaraju, Yura Burda, Harri Edwards, Bowen Baker, Teddy Lee, Jan Leike, John Schulman, Ilya Sutskever, and Karl Cobbe. Let’s verify step by step. arXiv preprint arXiv:2305.20050, 2023.
202
+
203
+ Zhan Ling, Yunhao Fang, Xuanlin Li, Zhiao Huang, Mingu Lee, Roland Memisevic, and Hao Su. Deductive verification of chain-of-thought reasoning. arXiv preprint arXiv:2306.03872, 2023.
204
+
205
+ Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, et al. Self-refine: Iterative refinement with self-feedback. arXiv preprint arXiv:2303.17651, 2023.
206
+
207
+ Shen-yun Miao, Chao-Chun Liang, and Keh-Yih Su. A diverse corpus for evaluating and developing english math word problem solvers. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 975–984, 2020.
208
+
209
+ OpenAI. Chatgpt, 2022. https://chat.openai.com/chat.
210
+
211
+ OpenAI. Gpt-4 technical report, 2023.
212
+
213
+ Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35: 27730–27744, 2022.
214
+
215
+ Jing-Cheng Pang, Pengyuan Wang, Kaiyuan Li, Xiong-Hui Chen, Jiacheng Xu, Zongzhang Zhang, and Yang Yu. Language model self-improvement by reinforcement learning contemplation. arXiv preprint arXiv:2305.14483, 2023.
216
+
217
+ Arkil Patel, Satwik Bhattamishra, and Navin Goyal. Are NLP models really able to solve simple math word problems? In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 2080– 2094, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021. naacl-main.168. URL https://aclanthology.org/2021.naacl-main.168.
218
+
219
+ Jer´ emy Scheurer, Jon Ander Campos, Tomasz Korbak, Jun Shern Chan, Angelica Chen, Kyunghyun ´ Cho, and Ethan Perez. Training language models with language feedback at scale. arXiv preprint arXiv:2303.16755, 2023.
220
+ Noah Shinn, Federico Cassano, Beck Labash, Ashwin Gopinath, Karthik Narasimhan, and Shunyu Yao. Reflexion: Language agents with verbal reinforcement learning, 2023.
221
+ Hao Sun. Reinforcement learning in the era of llms: What is essential? what is needed? an rl perspective on rlhf, prompting, and beyond. arXiv preprint arXiv:2310.06147, 2023.
222
+ Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee´ Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and \` efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023.
223
+ Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022a.
224
+ Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language model with self generated instructions. arXiv preprint arXiv:2212.10560, 2022b.
225
+ Jason Wei, Maarten Bosma, Vincent Y Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M Dai, and Quoc V Le. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652, 2021.
226
+ Can Xu, Qingfeng Sun, Kai Zheng, Xiubo Geng, Pu Zhao, Jiazhan Feng, Chongyang Tao, and Daxin Jiang. Wizardlm: Empowering large language models to follow complex instructions. arXiv preprint arXiv:2304.12244, 2023.
227
+ Seonghyeon Ye, Yongrae Jo, Doyoung Kim, Sungdong Kim, Hyeonbin Hwang, and Minjoon Seo. Selfee: Iterative self-revising llm empowered by self-feedback generation. Blog post, May 2023. URL https://kaistai.github.io/SelFee/.
228
+ Chunting Zhou, Pengfei Liu, Puxin Xu, Srini Iyer, Jiao Sun, Yuning Mao, Xuezhe Ma, Avia Efrat, Ping Yu, Lili Yu, et al. Lima: Less is more for alignment. arXiv preprint arXiv:2305.11206, 2023.
229
+
230
+ # A APPENDIX
231
+
232
+ A.1 IMPLEMENTATION DETAIL
233
+
234
+ # A.1.1 TRAINING HYPERPARAMETERS
235
+
236
+ Our experiments were conducted in a computing environment equipped with 8 V100 GPUs, each having a memory capacity of 32GB. Below is a table 4 outlining the training hyperparameters we used. It is noted that these parameters were consistently applied across all training methods in our experiments.
237
+
238
+ Table 4: Training hyperparameters
239
+
240
+ <table><tr><td>Hyperparameter</td><td>Global Batch Size</td><td>Learning Rate</td><td>Epochs</td><td>Max Length</td><td>Weight Decay</td></tr><tr><td>Value</td><td>128</td><td>2×10-5</td><td>3</td><td>2048</td><td>0</td></tr></table>
241
+
242
+ # A.1.2 DATA GENERATION
243
+
244
+ To produce the $D _ { Q A }$ dataset, we utilized $3 . 5 \mathrm { k }$ unlabeled training prompts for GSM8k and 2k training prompts 3 for the SVAMP. For the general test, we derived 6K conversations from a set of 90K ShareGPT dialogues to constitute the $D _ { Q A }$ data for the general test.
245
+
246
+ Regarding the prompts without labels used in the self-evolution training approach for math tests:
247
+
248
+ First round self-evolving phase: We made use of the leftover prompts from the training datasets, explicitly excluding those prompts that were utilized for meta-skill learning and labeled as $D _ { Q A }$ . Specifically, we took 4K remaining prompts on GSM8k and 1K on SVAMP.
249
+
250
+ Second/Third round: We utilized the Self-Instruct method as described in (Wang et al., 2022b) We created unlabeled prompts using the template shown in Fig, A.1.2—initially, 4 to 6 instances served as seed examples. In the second round of self-evolution training, we produced 10K prompts, which was augmented to 15K in the third iteration.
251
+
252
+ In the general test, considering the need for the model to exhibit broad proficiency across various domains, we leveraged a subset (15K) of unlabeled prompts from ShareGPT dialogues to construct the self-evolution training data.
253
+
254
+ You are an experienced instruction creator. You are asked to develop 3 diverse instructions according to the given examples.
255
+ Here are the requirements:
256
+ 1. The generated instructions should follow the task type in the given examples.
257
+ 2. The language used for the generated instructions should be diverse.
258
+ Given examples: {examples}
259
+ The generated instructions should be:
260
+ A. ...
261
+ B. ...
262
+ C. ...
263
+
264
+ # A.2 CASE STUDY ANALYSIS
265
+
266
+ This subsection delves into a detailed case study analysis that exhibits the comparative efficiencies of the original Vicuna and Vicuna $^ +$ SELF models. As depicted in Fig. A.2, both models predict answers and engage in self-feedback and self-refinement processes. An interesting observation is that while Vicuna’s refined answer retains inaccuracies, Vicuna $^ +$ SELF generates a solution that’s accurate and logically consistent by self-feedback and self-refinement.
267
+
268
+ # A.3 META-SKILL TRAINING CORPUS
269
+
270
+ As demonstrated in the provided case study within the A.3, the content represents a typical training example from our meta-skilling corpus. It showcases the initial response of the model, its selffeedback, and the subsequent refinement, enabling the model to self-feedback and self-refinement.
271
+
272
+ ![](images/187b7bd9fa8c55e71574afdc2c68e243d8b87de621844d6aaa47b225b1644273.jpg)
273
+ Figure 4: Case study of comparison between original Vicuna (left) and Vicuna+SELF (right) on an SVAMP. Both models generate direct predictions and undergo self-feedback and self-refinement. While Vicuna’s refinement retains the incorrect answer, Vicuna $^ +$ SELF showcases superior selfrefinement capability, ultimately producing a correct and logically consistent solution.
274
+
275
+ Question: Greg has an alarm set to ring three times a day as a reminder. When the alarm goes off, it continues to ring until Greg turns it off. The first time it went off today, it rang four times. The second time it went off, it rang for three times as long as the first time. The third time, it rang for half as long as the second time. How many times did the alarm ring in all?
276
+
277
+ Original Response: The alarm rang four times the first time, three times as long as the first time the second time, and half as long as the second time the third time. So, the total number of times the alarm rang is $4 + 3 ^ { * } 3 + 2 ^ { * } 2 = 2 4$ .
278
+
279
+ Feedback: The response correctly interprets the problem. The first time the alarm rang, it rang for 4 times. The second time it rang, it rang for 3 times as long as the first time, which is $3 ^ { * } 4 = 1 2$ times. The third time it rang, it rang for half as long as the second time, which is $1 2 / 2 = 6$ times. However, the final calculation is incorrect. The total number of times the alarm rang is not $4 + 3 ^ { * } 3 + 2 ^ { * } 2 = 2 4$ , but $4 + 1 2 + 6 = 2 2$ . Judgement: incorrect
280
+
281
+ Refined Response: The alarm rang four times the first time, three times as long as the first time the second time, and half as long as the second time the third time. So, the total number of times the alarm rang is $4 + 1 2 + 6 = 2 2$ .
282
+
283
+ # A.4 ALGORITHM
284
+
285
+ The subsequent algorithm, labeled as the ”Two-Phase SELF Process”, delineates a methodology to evolve a base language model using a progressively dual-phased approach: Meta-Skill Learning and Self-Evolving. Initially, the process involves training on a ”Meta-Skill Learning corpus,” which combines Question-Answer pairs and feedback-driven refinement data. After this phase, the algorithm proceeds to its ”Self-Evolving Phase,” where the model undergoes iterative refinements. The model employs data augmentation techniques for each iteration, generating self-refined outputs based on previously refined models. This self-evolving iteration is designed to capitalize on accumulated knowledge and refine the model using freshly generated data. The process culminates with an enhanced Language Model that has undergone multiple stages of self-evolution, showcasing im
286
+
287
+ provements over its initial form. The detailed steps and mechanisms involved are delineated in Alg.
288
+ 1.
289
+
290
+ # Algorithm 1: Two-Phase SELF Process
291
+
292
+ Data: (1) Question-Answer pairs $( D _ { Q A } )$ , (2) Meta-Skill training data $D _ { m e t a } )$ ) and (3) unlabeled prompts $( D _ { u n l a b e l e d } )$
293
+ Input: An initial Language Model $M _ { i n i t i a l }$
294
+ Result: A stronger Language Model $M _ { s e l f } ^ { k }$ after self-evolving
295
+ // Meta-Skill Learning Phase
296
+ Data: Meta-Skill learning corpus $( D _ { m e t a } )$ and Question-Answer pairs $( D _ { Q A } )$
297
+ $M _ { m e t a } =$ Supervised fine tuning $M _ { i n i t i a l }$ , $D _ { m e t a } \cup D _ { Q A }$ );
298
+ // Self-Evolving Phase
299
+ Initialize $M _ { 1 }$ with $M _ { m e t a }$ ;
300
+ foreach iteration $t$ in $I$ to Number of self-evolving iterations $T$ do // Data-Augmentation Initialize $D _ { \mathrm { s e l f } } ^ { t }$ as an empty set; foreach prompt $p _ { s e l f } ^ { i }$ in $t ^ { t h }$ Unlabeled prompts $D _ { u n l a b e l e d }$ do Generate self-refined output $\hat { r } _ { s e l f } ^ { i }$ using $M _ { s e l f } ^ { t - 1 }$ ; Use $M _ { s e l f } ^ { t - 1 }$ to filter the self-refined output; Add $( p _ { s e l f } ^ { i } , \hat { r } _ { s e l f } ^ { i } )$ to $D _ { \mathrm { s e l f } } ^ { t }$ , where $r _ { i }$ is the refined response; end $M _ { s e l f } ^ { t } = \mathrm { S u p e r v i s e d \_ f n e \_ t u n i n g } ( M _ { s e l f } ^ { t - 1 } , D _ { s e l f } ^ { t } ) ;$
301
+
302
+ # end
303
+
304
+ // Training Complete return Improved Language Model $M _ { s e l f } ^ { T }$ ;
305
+
306
+ # A.5 PROMPT FOR GENERATING FEEDBACK AND REFINEMENT IN GENERAL CASE
307
+
308
+ For the general test, aligned with the methodology described in 3, we deploy the following prompt to guide an LLM-based annotator in generating response feedback and refinement. This prompt serves as the foundation for the meta-skill learning corpus and assists in producing self-evolution training data in the general test setting.
309
+
310
+ # Prompt for feedback and refinement:
311
+
312
+ (Feedback) Please assess the quality of response to the given question.
313
+ Here is the question: $p$ .
314
+ Here is the response: $r$ .
315
+ Firstly provide an analysis and verification for response starting with “Response Analysis:”.
316
+ Next, then rate the response on a scale of 1 to 10 (1 is worst, 10 is best) in the format of ”Rating:” (Refinement) Finally output an improved answer based on your analysis if no response is rated 10.
317
+
318
+ # A.6 MULTIPLE V.S. SINGLE SELF-REFINEMENT
319
+
320
+ In this study, we examine the impact of two meta-skill training data organization methods on model performance: (1) Multiple Self-Refinement $( D _ { F R - m u l t i } )$ , which entails sampling three responses and instructing the model to select the best one for refinement, and (2) Single Self-Refinement $( D _ { F R } )$ , where the model generates and refines only one response.
321
+
322
+ We present the comparative performance of these methods in Table 5. Our findings indicate that both methods benefit from an increased volume of training data, demonstrating performance improvements. Notably, as the data volume grows, the multiple-response refinement approach demonstrates a smaller improvement in direct generation performance $( + 4 . 0 2 \% )$ compared to the single-response method $( + 5 . 8 4 \% )$ . Given the single-response method’s simplicity and computational efficiency — requiring the sampling of only one response during inference — and its superior performance relative to the multiple-response approach, we have adopted the single-response refinement strategy in our experiments.
323
+
324
+ Table 5: Performance comparison between single and multiple response refinement across varying volumes of meta-skill training data. The right arrow indicates the performance improvement by self-refinement: “direct generation self-refinement”.
325
+
326
+ <table><tr><td>Data Size</td><td></td><td>Vicuna+ DQA U DFD Vicuna + DQA U DFD-multi</td></tr><tr><td>3.5k</td><td>25.39 →28.28</td><td>25.92 → 27.29</td></tr><tr><td>7.5k</td><td>31.23→32.98</td><td>29.94→32.14</td></tr></table>
327
+
328
+ # A.7 SELF-EVOLUTION TRAINING DATA FILTERING ANALYSIS
329
+
330
+ Table 6: Analysis of filtering strategies on GSM8K. ”Acc. of Training Data” refers to the accuracy of self-generated data post-filtering/refinement, while ”Acc. on Test Set” indicates the model’s test performance after fine-tuning such data.
331
+
332
+ <table><tr><td>Filter Strategy</td><td>Acc. of Training Data (%)Acc. on Test Set (%)</td><td></td></tr><tr><td>Self-Refinement Revised (Unfiltered)</td><td>29.89</td><td>26.90</td></tr><tr><td>Meta-Skill Filtered</td><td>44.10</td><td>27.67</td></tr></table>
333
+
334
+ In Table 6, we explore the impact of different filtering strategies on the quality of training data and their contribution to self-evolution training. The following insights emerge from this comparison:
335
+
336
+ (1) Superiority of Meta-Skills Filtered: The combination of self-refinement and self-feedback filtering results in higher data accuracy $( 4 4 . 1 0 \% )$ and improved finetuned model performance $( 2 7 . 6 7 \% )$ . Despite the significant accuracy boost, the performance gain is modest due to the reduced data size (from 4k to 1.8k) post-filtering.
337
+
338
+ (2) Robustness of SELF: The substantial accuracy increase in self-generated data with the addition of self-feedback meta-skill underlines its strong filtering capability, contributing to improved finetuned model performance.
339
+
340
+ A.8 SELF-EVOLUTION TRAINING: CONTINUAL TRAINING V.S. RESTART TRAINING ’Restart Training’, which combines meta-skill learning corpus with all self-evolution training data, significantly improves direct generation $( + 3 . 1 8 \% )$ and self-refinement $( + 3 . 8 5 \% )$ . This approach helps maintain a balance between new learning and previously acquired knowledge.
341
+
342
+ Table 7: Analysis about varied self-evolution training methodologies on GSM8K
343
+
344
+ <table><tr><td>Training Approach</td><td>Direct Generation (%)</td><td>Self-Refinement (%)</td></tr><tr><td>Base Model</td><td>24.49</td><td>24.49</td></tr><tr><td>Restart Training</td><td>27.67</td><td>29.34</td></tr><tr><td>Continual Training (Mixed Data)</td><td>27.22</td><td>28.43</td></tr><tr><td>Continual Training (Dtelf Only)</td><td>24.87</td><td>25.85</td></tr></table>
345
+
346
+ ’Continual Training (Mixed Data)’, where the model is trained simultaneously with self-evolution data from all rounds, also shows notable enhancements in direct generation $( + 2 . 7 3 \% )$ and selfrefinement $( + 3 . 9 4 \% )$ . In contrast, ’Continual Training $( { \cal D } _ { s e l f } ^ { t } \ \mathrm { O n l y } ) ^ { , }$ , which trains the model sequentially with self-evolution data from each round, demonstrates more modest gains $( + 0 . 3 8 \%$ in direct generation, $+ 0 . 9 8 \%$ in self-refinement). The relatively lower performance of the latter approach highlights the importance of a mixed data strategy for effective self-evolution training.
347
+
348
+ A.9 SELF VS. SUPERVISED FINE-TUNING ON $7 . 5 \mathrm { K }$ GSM8K TRAINING DATA.
349
+
350
+ When fine-tuned on the GSM8K $7 . 5 \mathrm { k }$ training set, the Vicuna model achieves an accuracy of $3 5 . 7 0 \%$ lower than SELF $( 3 7 . 8 7 \% )$ .
351
+
352
+ Table 8: Comparison between SELF and Supervised Fine-Tuning
353
+
354
+ <table><tr><td rowspan="2">Direct Generation (%)</td><td rowspan="2">Self-Refinement (%)</td><td colspan="2">Meta-Skill Learning</td><td colspan="2">Self Evolution Process</td></tr><tr><td>DQA</td><td>Dmeta</td><td>1st round</td><td>2nd round</td></tr><tr><td>28.05</td><td></td><td>√</td><td></td><td></td><td></td></tr><tr><td>31.23</td><td>32.98</td><td>√</td><td></td><td></td><td></td></tr><tr><td>35.43</td><td>36.22</td><td>√</td><td></td><td></td><td></td></tr><tr><td>37.87</td><td>38.12</td><td>√</td><td>√</td><td></td><td>√</td></tr><tr><td>35.70</td><td></td><td>SFT</td><td>(GSM8K training data)</td><td></td><td></td></tr></table>
355
+
356
+ The result of $2 9 . 6 4 \%$ in Table 1 is derived from a meta-skill learning corpus of $3 . 5 \mathrm { k }$ . Experiments in Table 8 are conducted using an expanded $7 . 5 \mathrm { k }$ meta-skill data to ensure a fair comparison with the Supervised Fine-tuned model.
357
+
358
+ Table 8 shows that using $7 . 5 \mathrm { k }$ unlabeled training prompts to construct the meta-skill learning corpus, The baseline model Vicuna $+ D _ { Q A }$ achieves $2 8 . 0 5 \%$ . After meta-skill learning, the result of direct generation is $3 1 . 2 3 \%$ , which improves to $3 2 . 9 8 \%$ after self-refinement. In subsequent self-evolution rounds, performance continues to improve, reaching $3 7 . 8 7 \%$ to $3 8 . 1 2 \%$ in the second round. This surpasses the result of supervised fine-tuning $( 3 5 . 7 0 \% )$ .
359
+
360
+ Continuous Improvement of SELF vs. Supervised Fine-tuning: SELF’s main advantage is its ability for continuous improvement and adaptation. Unlike supervised fine-tuning, SELF does not rely on human or external LLM (GPT3.5/GPT4) to annotate training data in the self-evolution training.
361
+
362
+ # A.10 SCALABILITY OF SELF FRAMEWORK
363
+
364
+ To explore how SELF performs with different starting model qualities, we conduct experiments using the OpenLlama-3b model (Geng & Liu, 2023), a smaller LLM along with a stronger LLM, VicunaV1.5(finetuned from Llama2-7b)l (Chiang et al., 2023), on the GSM8K dataset. This allows us to assess SELF’s adaptability to model quality. Experiments with SELF are based on the first round of self-evolution. The results are as follows:
365
+
366
+ Table 9: Scalability of SELF Framework Across Different Models
367
+
368
+ <table><tr><td>Model</td><td>Direct Generation (%)</td><td>Self-Refinement (%)</td></tr><tr><td>OpenLlama-3b</td><td>2.04</td><td>1.01</td></tr><tr><td>OpenLlama-3b + DQA</td><td>12.13</td><td>10.97</td></tr><tr><td>OpenLlama-3b + DQA + SELF</td><td>15.32</td><td>15.78</td></tr><tr><td>Vicuna (Llama-7b)</td><td>16.43</td><td>15.63</td></tr><tr><td>Vicuna + DQA</td><td>24.49</td><td>24.44</td></tr><tr><td>Vicuna + DQA + SELF</td><td>27.67</td><td>29.34</td></tr><tr><td>VicunaV1.5 (Llama2-7b)</td><td>18.5</td><td>17.43</td></tr><tr><td>VicunaV1.5 + DQA</td><td>26.04</td><td>25.48</td></tr><tr><td>VicunaV1.5 + DQA + SELF</td><td>30.22</td><td>32.43</td></tr></table>
369
+
370
+ Applicability and Robustness of SELF Framework: The average improvement of $1 7 . 3 2 \%$ via direct generation and $1 6 . 8 7 \%$ after self-refinement underscores the framework’s scalability and efficacy. It reveals a consistent positive impact of the SELF Framework across diverse models.
371
+
372
+ SELF Framework exhibits enhanced performance on more powerful models: In the table 9, applying SELF to VicunaV1.5 exhibits the most significant performance, $3 0 . 2 2 \%$ of direct generation and $3 2 . 4 3 \%$ of self-refinement compared to Vicuna and OpenLlama-3b. It is evident that as the underlying model’s capabilities strengthen, the benefits introduced by the SELF framework also increase.
373
+
374
+ # A.11 IMPACT OF META-SKILL LEARNING QUALITY
375
+
376
+ We investigate how the quality of meta-skill learning influences the self-evolution process as follows:
377
+
378
+ Table 10: Comparison of Training Methods on GPT-3.5-turbo/GPT4
379
+
380
+ <table><tr><td>Training Stage</td><td>DirPt-3G.-turtion T4)</td><td>GPf-.5-urbent PT4)</td></tr><tr><td>Vicuna + meta-skill learning</td><td>24.84/25.39 (0.55个)</td><td>25.22/28.28 (3.06↑)</td></tr><tr><td>Vicuna + meta-skill learning + SELF</td><td>25.11/27.67 (2.561)</td><td>25.47/29.34 (3.871)</td></tr></table>
381
+
382
+ The presented table 10 highlights substantial performance advancements achieved by employing GPT-4 to generate the meta-skill corpus within our SELF framework, as opposed to GPT-3.5-turbo. Specifically, the performance of direct generation and self-refinement exhibit noteworthy improvements across both training stages when utilizing GPT-4. For example, in the ”Vicuna $^ +$ meta-skill learning” phase, the result of direct generation increases from $2 4 . 8 4 \%$ (GPT-3.5-turbo) to $2 5 . 3 9 \%$ (GPT-4), reflecting a significant gain of $0 . 5 5 \%$ . Similarly, in the ”Vicuna $^ +$ meta-skill learning $^ +$ SELF” stage, the result of self-refinement rises from $2 5 . 4 7 \%$ (GPT-3.5-turbo) to $2 9 . 3 4 \%$ (GPT-4), indicating a substantial enhancement of $3 . 8 7 \%$ .
383
+
384
+ This study underscores the crucial impact of high-quality meta-skill training data on Vicuna model performance within the SELF framework. Transitioning from GPT-3.5-turbo to GPT-4 for meta-skill corpus generation consistently improves Direct Generation and Self-Refinement metrics.
385
+
386
+ # A.12 SINGLE VS. MULTIPLE ROUNDS OF SELF-EVOLUTION
387
+
388
+ Given the same number of prompts, we compare the effect of training with a single round versus training iteratively, to assess the difference between a static and an improved model as a selfevolution training data generator as follows:
389
+
390
+ Table 11: Comparison of Single-Round Training and Iterative Training
391
+
392
+ <table><tr><td>Training Method</td><td>Direct Generation (%)</td><td>Self-Refinement (%)</td></tr><tr><td>SELF (Single Round)</td><td>28.40</td><td>30.55</td></tr><tr><td>SELF (Iterative)</td><td>29.64</td><td>31.31</td></tr></table>
393
+
394
+ Table 11 shows that in a single round, the performance is $2 8 . 4 0 \%$ for direct generation and $3 0 . 5 5 \%$ for self-refinement. The iterative approach shows higher scores $( 2 9 . 6 4 \% )$ for direct generation and $3 1 . 3 1 \%$ for self-refinement.
395
+
396
+ Advantages of Iterative Training: The iterative method benefits from improved LLMs in later rounds, producing higher-quality training data and, consequently, enhanced test performance.
parse/test/XD0PHQ5ry4/XD0PHQ5ry4_content_list.json ADDED
@@ -0,0 +1,971 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "SELF: LANGUAGE-DRIVEN SELF-EVOLUTION FORLARGE LANGUAGE MODELS",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Anonymous authors Paper under double-blind review ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "ABSTRACT ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "Large Language Models (LLMs) have demonstrated remarkable versatility across various domains. To further advance LLMs, we propose ’SELF’ (Self-Evolution with Language Feedback), a novel approach that enables LLMs to self-improve through self-reflection, akin to human learning processes. SELF initiates with a meta-skill learning process that equips the LLMs with capabilities for selffeedback and self-refinement. Subsequently, the model undergoes an iterative process of self-evolution. In each iteration, it utilizes an unlabeled dataset of instructions to generate initial responses. These responses are enhanced through self-feedback and self-refinement. The model is then fine-tuned using this enhanced data. The model undergoes progressive improvement through this iterative self-evolution process. Moreover, the SELF framework enables the model to apply self-refinement during inference, which further improves response quality. Our experiments in mathematics and general tasks demonstrate that SELF can enhance the capabilities of LLMs without human intervention. The SELF framework indicates a promising direction for the autonomous evolution of LLMs, transitioning them from passive information receivers to active participants in their development. ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "1 INTRODUCTION ",
27
+ "text_level": 1,
28
+ "page_idx": 0
29
+ },
30
+ {
31
+ "type": "text",
32
+ "text": "Large Language Models (LLMs), like ChatGPT (OpenAI, 2022) and GPT-4 (OpenAI, 2023), stand at the forefront of the AI revolution, transforming our understanding of machine-human textual interactions and redefining numerous applications across diverse tasks. Despite their evident capabilities, achieving optimum performance remains a challenge. ",
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "The intrinsic learning mechanisms employed by humans inspire optimal LLM development. A selfdriven learning loop is inherent in humans when confronted with new challenges, involving initial attempts, introspection-derived feedback, and refinement of behavior as a result. In light of this intricate human learning cycle, one vital question arises: ”Can LLMs emulate human learning by harnessing the power of self-refinement to evolve their intrinsic abilities?” Fascinatingly, a recent study (Ye et al., 2023) in top-tier LLMs such as GPT-4 has revealed emergent meta-skills for selfrefinement, signaling a promising future direction for the self-evolution of LLMs. Despite this, current methods for LLM development typically rely on a single round of instruction fine-tuning (Wei et al., 2021; Zhou et al., 2023) with meticulously human-crafted datasets and reinforcement learning-based methods (Ouyang et al., 2022) that depend on an external reward model. These strategies not only require extensive resources and ongoing human intervention but also treat LLMs as mere passive repositories of information. These limitations prevent these models from realizing their intrinsic potential and evolving toward a genuinely autonomous, self-sustaining evolutionary state. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "text",
42
+ "text": "Our goal is to reveal the potential of LLMs for autonomous self-evolution by introducing a selfevolving learning framework called ”SELF” (Self-Evolution with Language Feedback). Fig. 1 illustrates how SELF emulates the self-driven learning process with introspection and self-refinement. Through self-feedback and self-refinement, LLMs undergo iterative self-evolution as they learn from the data they synthesize. Furthermore, SELF employs natural language feedback to improve the model’s responses during inference. This innovative framework can enhance models’ capabilities without relying on external reward models or human intervention. Self-feedback and self-refinement are integral components of the SELF framework. Equipped with these meta-skills, the model undergoes progressive self-evolution through iterative training with self-curated data. Evolution training data is collected by the model’s iterative response generation and refinement processes. A perpetually expanding repository of self-curated data allows the model to enhance its abilities continuously. Data quality and quantity are continually improved, enhancing the intrinsic capabilities of LLMs. These meta-skills enable LLMs to enhance response quality through self-refinement during inference. As a result of the SELF framework, LLMs are transformed from passive data recipients into active participants in their evolution. The SELF framework not only alleviates the necessity for labor-intensive manual adjustments but also fosters the continuous self-evolution of LLMs, paving the way for a more autonomous and efficient training paradigm. ",
43
+ "page_idx": 0
44
+ },
45
+ {
46
+ "type": "image",
47
+ "img_path": "images/a952b4451ee074a19de4249b8c116c3eb1ff8c1d3513ebd12fa99d192fb551f1.jpg",
48
+ "image_caption": [
49
+ "Figure 1: Evolutionary Journey of SELF: An initial LLM progressively evolve to a more advanced LLM equipped with a self-refinement meta-skill. By continual iterations (1st, 2nd, 3rd) of selfevolution, the LLM progresses in capability $( 2 4 . 4 9 \\%$ to $3 1 . 3 1 \\%$ ) on GSM8K. "
50
+ ],
51
+ "image_footnote": [],
52
+ "page_idx": 1
53
+ },
54
+ {
55
+ "type": "text",
56
+ "text": "",
57
+ "page_idx": 1
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "We evaluate SELF in mathematical and general domains. In the mathematical domain, SELF notably improved the test accuracy on GSM8k (Cobbe et al., 2021) from $2 4 . 4 9 \\%$ to $3 1 . 3 1 \\%$ and on SVAMP (Patel et al., 2021) from $4 4 . 9 0 \\%$ to $4 9 . 8 0 \\%$ . In the general domain, SELF increased the win rate on Vicuna testset (Lianmin et al., 2023) from $6 5 . 0 \\%$ to $7 5 . 0 \\%$ and on Evol-Instruct testset $\\mathrm { { X u } }$ et al., 2023) from $4 8 . 6 \\%$ to $5 5 . 5 \\%$ . There are several insights gained from our experiments. First, SELF can continuously enhance the performance of models in generating direct responses through iterative self-evolution training. Second, meta-skill learning is essential for the model to acquire the ability for self-feedback and self-refinement. By self-refinement during inference, the model can consistently improve its response. Finally, meta-skill learning enhances the model’s performance in generating direct responses. The model’s generalization can be improved by providing language feedback to correct its mistakes. ",
62
+ "page_idx": 1
63
+ },
64
+ {
65
+ "type": "text",
66
+ "text": "The following key points summarize our contributions: (1) SELF is a framework that empowers LLMs with self-evolving capabilities, allowing for autonomous model evolution without human intervention. (2) SELF facilitates self-refinement in smaller LLMs, even with challenging math problems. The capability of self-refinement was previously considered an emergent characteristic of top-tier LLMs. (3) We demonstrate SELF’s superiority, progressively demonstrating its ability to evolve intrinsic abilities on representative benchmarks and self-refinement capability. ",
67
+ "page_idx": 1
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "2 RELATED WORKS ",
72
+ "text_level": 1,
73
+ "page_idx": 1
74
+ },
75
+ {
76
+ "type": "text",
77
+ "text": "Self-consistency Self-consistency (Wang et al., 2022a) is a straightforward and effective method to improve LLMs for reasoning tasks. After sampling a variety of reasoning paths, the most consistent answer is selected. Self-consistency leverages the intuition that a complex reasoning problem typically admits multiple ways of thinking, leading to its unique correct answer. During decoding, self-consistency is closely tied to the self-refinement capability of LLMs, on which our method is based. Unlike self-consistency, self-refinement applies to a broader range of tasks, going beyond reasoning tasks with unique correct answers. ",
78
+ "page_idx": 1
79
+ },
80
+ {
81
+ "type": "text",
82
+ "text": "Online Self-improvement for LLMs Various research efforts have been undertaken to enhance the output quality of LLMs through online self-improvement (Shinn et al., 2023; Madaan et al., 2023; Ye et al., 2023; Chen et al., 2023; Ling et al., 2023). The main idea is to generate an initial output with an LLM. Then, the same LLM provides feedback on its output and employs this feedback to refine its initial output. This process can be iterative until the response quality is satisfied. ",
83
+ "page_idx": 2
84
+ },
85
+ {
86
+ "type": "text",
87
+ "text": "While simple and effective, online self-improvement necessitates multi-turn inference for refinement, leading to increased computational overhead. Most importantly, online self-improvement does not prevent the model from repeating previously encountered errors, as the model’s parameters remain unchanged. In contrast, SELF is designed to enable the model to learn from its self-improvement experiences. ",
88
+ "page_idx": 2
89
+ },
90
+ {
91
+ "type": "text",
92
+ "text": "Human Preference Alignment for LLMs The concept of ”Alignment”, introduced by (Leike et al., 2018), is to train agents to act in line with human intentions. Several research efforts (Ouyang et al., 2022; Bai et al., 2022; Scheurer et al., 2023) leverage Reinforcement Learning from Human Feedback (RLHF) (Christiano et al., 2017). RLHF begins with fitting a reward model to approximate human preferences. Subsequently, an LLM is finetuned through reinforcement learning to maximize the estimated human preference of the reward model. RLHF is a complex procedure that can be unstable. It often requires extensive hyperparameter tuning and heavily relies on humans for preference annotation. Reward Ranked Fine-tuning (RAFT) utilizes a reward model to rank responses sampled from an LLM. Subsequently, it fine-tunes the LLM using highly-ranked responses (Dong et al., 2023). However, scalar rewards provide limited insights into the detailed errors and optimization directions, which is incredibly impractical for evaluating complex reasoning tasks involving multiple reasoning steps (Lightman et al., 2023). Instead, in this work, we propose to leverage natural language feedback to guide LLMs for self-evolution effectively. ",
93
+ "page_idx": 2
94
+ },
95
+ {
96
+ "type": "text",
97
+ "text": "Reinforcement Learning Without Human Feedback in LLMs Recent advancements in LLMs have explored Reinforcement Learning (RL) approaches that do not rely on human feedback. LLMs are employed to assess and score the text they generate, which serves as a reward in the RL process (Pang et al., 2023). LLMs are updated progressively through online RL in interacting with the environment in Carta et al. (2023). The connection between conventional RL research and RLHF in LLMs is discussed by Sun (2023). While RL methods also enable automatic learning, they may not capture the nuanced understanding and adaptability offered by natural language feedback, a key component of SELF. ",
98
+ "page_idx": 2
99
+ },
100
+ {
101
+ "type": "text",
102
+ "text": "3 METHOD ",
103
+ "text_level": 1,
104
+ "page_idx": 2
105
+ },
106
+ {
107
+ "type": "text",
108
+ "text": "As depicted in Fig. 1 and Fig. 2, the SELF framework aligns the model and enhances its inherent capabilities through a two-stage learning phase: (1) Meta-skill Learning Phase: This phase equips the model with essential meta-skills for self-feedback and self-refinement, laying a foundation for self-evolution. (2) Self-Evolution Phase: With the acquired meta-skills, the model progressively improves through multiple iterations of the self-evolution process. Each iteration begins with the model autonomously creating high-quality training data. Then, the model is fine-tuned using this data. The process is further illustrated in Alg. 1 in Appendix A.4. ",
109
+ "page_idx": 2
110
+ },
111
+ {
112
+ "type": "text",
113
+ "text": "3.1 META-SKILL LEARNING ",
114
+ "text_level": 1,
115
+ "page_idx": 2
116
+ },
117
+ {
118
+ "type": "text",
119
+ "text": "The meta-skill learning stage aims to instill two essential meta-skills into LLMs: ",
120
+ "page_idx": 2
121
+ },
122
+ {
123
+ "type": "text",
124
+ "text": "(1) Self-Feedback Ability: This skill enables LLMs to evaluate their responses critically, laying the foundation for subsequent refinements. Self-feedback also enables the model to evaluate and filter out low-quality self-evolution training data $( \\ S \\ 3 . 2 . 1 )$ . ",
125
+ "page_idx": 2
126
+ },
127
+ {
128
+ "type": "text",
129
+ "text": "(2) Self-Refinement Ability: Self-refinement involves the model optimizing its responses based on self-feedback. This ability has two applications: (1) improving model performance by refining the models’ outputs during inference $( \\ S \\ 3 . 2 . 3 )$ and (2) enhancing the quality of the self-evolution training corpus $( \\ S 3 . 2 . 1 )$ . ",
130
+ "page_idx": 2
131
+ },
132
+ {
133
+ "type": "image",
134
+ "img_path": "images/cb8f3782319329cdd2aafedbf6a4a7e597739f26490c5f4ae0c16ae2a9818f30.jpg",
135
+ "image_caption": [
136
+ "Figure 2: Illustration of SELF. The ”Meta-Skill Learning” (left) phase empowers the LLM to acquire meta-skills in self-feedback and self-refinement. The ”Self-Evolution” phase (right) utilizes metaskills for self-evolution training with self-curated data, enabling continuous model enhancement. "
137
+ ],
138
+ "image_footnote": [],
139
+ "page_idx": 3
140
+ },
141
+ {
142
+ "type": "text",
143
+ "text": "These meta-skills are acquired by fine-tuning the model using the Meta-Skill Training Corpus. Details are provided in $\\ S \\ 3 . 1 . 1$ . The resulting model is denoted as $M _ { m e t a }$ . Meta-skill learning establishes a foundation for the model to initiate subsequent self-evolution processes. ",
144
+ "page_idx": 3
145
+ },
146
+ {
147
+ "type": "text",
148
+ "text": "3.1.1 META-SKILL TRAINING CORPUS ",
149
+ "text_level": 1,
150
+ "page_idx": 3
151
+ },
152
+ {
153
+ "type": "text",
154
+ "text": "The construction of the meta-skill learning corpus $D _ { m e t a }$ involves the following elements: (1) An initial unlabeled prompt corpus $D _ { \\mathrm { u n l a b e l e d } }$ ; (2) An initial LLM denoted as $M _ { i n i t i a l }$ ; (3) A strong LLM or human labeler $L$ tasked with evaluating and refining the responses of $M _ { i n i t i a l }$ . ",
155
+ "page_idx": 3
156
+ },
157
+ {
158
+ "type": "text",
159
+ "text": "Specifically, the construction process operated in the following steps: (1) For each unlabeled prompt $p$ in $D _ { \\mathrm { u n l a b e l e d } }$ , the initial model $M _ { i n i t i a l }$ generates a initial response $r$ . (2) The annotator $L$ provides evaluation feedback $f$ for the initial response $r$ , then produces a refined answer $\\hat { r }$ according to the feedback $f$ . (3) Each instance in the meta-skill training data corpus $D _ { m e t a }$ takes the form $( p , r , f , \\hat { r } )$ , representing the process of response evaluation and refinement. An example instance of $D _ { m e t a }$ is provided in Appendix A.3. ",
160
+ "page_idx": 3
161
+ },
162
+ {
163
+ "type": "text",
164
+ "text": "The data structure in $D _ { m e t a }$ differs from the standard question-answering format, potentially weakening the model’s ability to provide direct responses. We add a pseudo-labeled QA dataset denoted as $D _ { Q A }$ to alleviate this issue. This dataset consists of pairs of questions $p$ and refined answers $\\hat { r }$ . Notably, $D _ { Q A }$ is derived from the LLM-labeled $D _ { m e t a }$ and does not include any human-annotated ground-truth data. This data integration strategy ensures a balanced emphasis on direct generation and self-refinement capability. ",
165
+ "page_idx": 3
166
+ },
167
+ {
168
+ "type": "text",
169
+ "text": "We prompt the LLM labeler $L$ with the following template to generate feedback and refinement 1: ",
170
+ "page_idx": 3
171
+ },
172
+ {
173
+ "type": "text",
174
+ "text": "Prompt for feedback and refinement: ",
175
+ "text_level": 1,
176
+ "page_idx": 4
177
+ },
178
+ {
179
+ "type": "text",
180
+ "text": "(Feedback) Please assess the quality of the response to the given question. \nHere is the question: $p$ . \nHere is the response: $r$ . \nFirstly, provide a step-by-step analysis and verification for response starting with “Response Analysis:”. \nNext, judge whether the response correctly answers the question in the format of “judgment: correct/incorrect”. \n(Refinement) If the answer is correct, output it. Otherwise, output a refined answer based on the given response and your assessment. ",
181
+ "page_idx": 4
182
+ },
183
+ {
184
+ "type": "text",
185
+ "text": "3.2 SELF-EVOLUTION PROCESS ",
186
+ "text_level": 1,
187
+ "page_idx": 4
188
+ },
189
+ {
190
+ "type": "text",
191
+ "text": "The model $M _ { m e t a }$ , equipped with meta-skills, undergoes progressive improvement through multiple iterations of the self-evolution process. Each iteration of the self-evolution process initiates with the model autonomously creating high-quality training data $( \\ S \\ 3 . 2 . 1 )$ . With an unlabeled dataset of prompts, the model generates initial responses and then refines them through self-feedback and selfrefinement. These refined responses, superior in quality, are then utilized as the training data for the model’s subsequent self-evolution training $( \\ S \\ 3 . 2 . 2 )$ . ",
192
+ "page_idx": 4
193
+ },
194
+ {
195
+ "type": "text",
196
+ "text": "3.2.1 SELF-EVOLUTION TRAINING DATA ",
197
+ "text_level": 1,
198
+ "page_idx": 4
199
+ },
200
+ {
201
+ "type": "text",
202
+ "text": "A corpus of unlabeled prompts is needed for self-evolution training. Given that real-world prompts are often limited, we employ Self-Instruct (Wang et al., 2022b) to generate additional unlabeled prompts. We denote $M _ { s e l f } ^ { t }$ as the model at the $t$ -th iteration. In the first iteration of self-evolution, we initialize $M _ { s e l f } ^ { 0 }$ with $M _ { m e t a }$ . For each unlabeled prompt, the model $M _ { s e l f } ^ { t }$ generates a response, which is subsequently refined through its self-refinement ability to produce the final output $\\hat { r } _ { s e l f }$ . The prompt and self-refined response pairs, denoted as $\\left( p _ { s e l f } , \\hat { r } _ { s e l f } \\right)$ , are subsequently incorporated into the self-evolution training dataset $D _ { s e l f } ^ { t }$ for subsequent self-evolution processes. ",
203
+ "page_idx": 4
204
+ },
205
+ {
206
+ "type": "text",
207
+ "text": "Data Filtering with Self-feedback: To enhance the quality of $D _ { s e l f } ^ { t }$ self , we leverage the selffeedback capability of $M _ { s e l f } ^ { t }$ to filter out low-quality data. Specifically, $M _ { s e l f } ^ { t }$ applies self-feedback to the self-refined data $\\hat { r } _ { s e l f }$ , and only those responses evaluated as qualified are retained. ",
208
+ "page_idx": 4
209
+ },
210
+ {
211
+ "type": "text",
212
+ "text": "After each iteration of self-evolution training, the model $M _ { s e l f }$ undergoes capability improvements. This leads to the creation of a higher-quality training corpus for subsequent iterations. Importantly, this autonomous data construction process obviates the need for more advanced LLMs or human annotators, significantly reducing manual labor and computational demands. ",
213
+ "page_idx": 4
214
+ },
215
+ {
216
+ "type": "text",
217
+ "text": "3.2.2 SELF-EVOLUTION TRAINING PROCESS ",
218
+ "text_level": 1,
219
+ "page_idx": 4
220
+ },
221
+ {
222
+ "type": "text",
223
+ "text": "At each iteration $t$ , the model undergoes self-evolution training with the updated self-curated data, improving its performance and aligning it more closely with human values. Specifically, we experimented with two strategies for self-evolution training: ",
224
+ "page_idx": 4
225
+ },
226
+ {
227
+ "type": "text",
228
+ "text": "(1) Restart Training: In this approach, we integrate the meta-skill learning data $D _ { m e t a }$ and the accumulated self-curated data from all previous iterations — denoted as $\\{ D _ { s e l f } ^ { \\mathrm { { 0 } } } , D _ { s e l f } ^ { 1 } , . . . , D _ { s e l f } ^ { t } \\}$ to initiate the training afresh from $M _ { i n i t i a l }$ . ",
229
+ "page_idx": 4
230
+ },
231
+ {
232
+ "type": "text",
233
+ "text": "(2) Continual Training: Here, utilizing the newly self-curated data $D _ { s e l f } ^ { t }$ , we continue the training of the model from the preceding iteration, represented as $M _ { s e l f } ^ { t - 1 }$ . We also incorporate $D _ { m e t a }$ into continual training to mitigate the potential catastrophic forgetting of meta-skills. ",
234
+ "page_idx": 4
235
+ },
236
+ {
237
+ "type": "text",
238
+ "text": "The impact of these two divergent training strategies is thoroughly analyzed in our experiments in Appendix A.8. ",
239
+ "page_idx": 4
240
+ },
241
+ {
242
+ "type": "text",
243
+ "text": "3.2.3 RESPONSE REFINEMENT DURING INFERENCE ",
244
+ "text_level": 1,
245
+ "page_idx": 5
246
+ },
247
+ {
248
+ "type": "text",
249
+ "text": "Equipped with the meta-skills for self-feedback and self-refinement, the model can conduct selfrefinement during inference. Specifically, the model generates an initial response and then refines it using self-refinement, akin to the method described in $\\ S \\ 3 . 1$ . Response refinement during inference consistently improves the model’s performance as shown in $\\ S 4 . 2$ . ",
250
+ "page_idx": 5
251
+ },
252
+ {
253
+ "type": "text",
254
+ "text": "4 EXPERIMENTS ",
255
+ "text_level": 1,
256
+ "page_idx": 5
257
+ },
258
+ {
259
+ "type": "text",
260
+ "text": "We begin with an introduction to the experimental settings $( \\ S 4 . 1 )$ , encompassing the evaluation data, baseline model, and model variations. In $\\ S 4 . 2$ , we present our main experiment to show the efficacy of SELF. $\\ S 4 . 3$ demonstrates the incremental performance enhancements observed throughout selfevolution processes. ",
261
+ "page_idx": 5
262
+ },
263
+ {
264
+ "type": "text",
265
+ "text": "Given space limitations, we conduct several experiments to verify the SELF framework and include their details in the Appendix. We verify the effect of different meta-skill training corpus construction methods in Appendix A.6. Appendix A.7 shows the impact of filtering strategies when constructing the self-evolution corpus. Appendix A.8 evaluates the impact of divergent self-evolution training strategies as described in $\\ S 3 . 2 . 2$ . We demonstrate that SELF outperforms supervised fine-tuning in Appendix A.9. We explore how SELF performs with different starting model qualities in Appendix A.10 to exhibit the scalability of the SELF framework. In Appendix A.11, we investigate how the quality of the meta-skill learning corpus influences self-evolution training. We compare the effect of training with a single round of self-evolution versus training iteratively in Appendix A.12. ",
266
+ "page_idx": 5
267
+ },
268
+ {
269
+ "type": "text",
270
+ "text": "4.1 EXPERIMENT SETTINGS ",
271
+ "text_level": 1,
272
+ "page_idx": 5
273
+ },
274
+ {
275
+ "type": "text",
276
+ "text": "4.1.1 EVALUATION BENCHMARKS ",
277
+ "text_level": 1,
278
+ "page_idx": 5
279
+ },
280
+ {
281
+ "type": "text",
282
+ "text": "We focus on two representative mathematical benchmarks and two general benchmarks: GSM8K (Cobbe et al., 2021) contains high-quality, linguistically diverse grade school math word problems crafted by expert human writers, which incorporates approximately $7 . 5 \\mathrm { K }$ training problems and 1K test problems. The performance is measured by accuracy $( \\% )$ . SVAMP (Patel et al., 2021) is a challenge set for elementary Math Word Problems (MWP). It is composed of 1000 test samples. The evaluation metric is accuracy $( \\% )$ . Vicuna testset (Lianmin et al., 2023) is a benchmark for assessing instruction-following models, containing 80 examples across nine skills in mathematics, reasoning, and coding. Evol-Instruct testset (Xu et al., 2023) includes 218 real-world human instructions from various sources, offering greater size and complexity than the Vicuna testset. ",
283
+ "page_idx": 5
284
+ },
285
+ {
286
+ "type": "text",
287
+ "text": "4.1.2 SETUP AND BASELINES",
288
+ "text_level": 1,
289
+ "page_idx": 5
290
+ },
291
+ {
292
+ "type": "text",
293
+ "text": "The complete SELF framework includes meta-skill training with $D _ { m e t a }$ , three iterations of selfevolution training, and optional self-refinement during inference. Our evaluation primarily focuses on assessing how self-evolution training can progressively enhance the capabilities of the underlying LLMs. We note that the SELF framework is compatible with all LLMs. In this study, we perform the experiment with Vicuna-7b (Chiang et al., 2023) , which stands out as one of the most versatile open instruction-following models. Vicuna-7b, fine-tuned from LLaMA-7b (Touvron et al., 2023), will be referred to simply as ’Vicuna’ in subsequent sections. One of our baseline model is Vicuna $^ +$ $D _ { Q A }$ which are Vicuna-7b fine-tuned with the pseudo-labeled question-answer data $D _ { Q A }$ $( \\ S 3 . 1 . 1 )$ . We also compare SELF with the Self-Consistency (Wang et al., 2022a) approach. We note that all model training utilized the same training hyperparameters shown in Appendix A.1.1. ",
294
+ "page_idx": 5
295
+ },
296
+ {
297
+ "type": "text",
298
+ "text": "For building the meta-skill training corpus $D _ { m e t a }$ , we utilize GPT-4 due to its proven proficiency in refining responses (An et al., 2023). Please refer to Appendix A.1.2 for more details about $D _ { Q A }$ and unlabeled prompts utilized in self-evolution training. ",
299
+ "page_idx": 5
300
+ },
301
+ {
302
+ "type": "text",
303
+ "text": "Additionally, we compare SELF with RLHF. We utilize the RLHF implementation from $\\mathrm { t r l } \\mathbf { x } ^ { 2 }$ . We apply the same SFT model, Vicuna $+ D _ { Q A }$ as described above, for both SELF and RLHF. The reward model is initialized from Vicuna-7b and is fine-tuned using pair-wise comparison data derived from the meta-skill training corpus $D _ { m e t a }$ $\\left( \\ S 3 . 1 . 1 \\right)$ , where the refined response $\\hat { r }$ is presumed to be better than the original one $r$ . ",
304
+ "page_idx": 5
305
+ },
306
+ {
307
+ "type": "text",
308
+ "text": "",
309
+ "page_idx": 6
310
+ },
311
+ {
312
+ "type": "text",
313
+ "text": "4.2 MAIN RESULT ",
314
+ "text_level": 1,
315
+ "page_idx": 6
316
+ },
317
+ {
318
+ "type": "text",
319
+ "text": "4.2.1 MATH TEST ",
320
+ "text_level": 1,
321
+ "page_idx": 6
322
+ },
323
+ {
324
+ "type": "table",
325
+ "img_path": "images/dfbacfc270b03ed1de435813dbe27596fa27b0bb715c56dc99c70b06865f761a.jpg",
326
+ "table_caption": [
327
+ "Table 1: Experiment results on GSM8K and SVAMP comparing SELF with other baseline methods. Vicuna $+ D _ { Q A }$ means Vicuna fine-tuned on $D _ { Q A }$ . "
328
+ ],
329
+ "table_footnote": [],
330
+ "table_body": "<table><tr><td>Model</td><td>Self-Evolution</td><td>Self-Consistency</td><td>Self-Refinement</td><td>GSM8K(%)</td><td>SVAMP(%)</td></tr><tr><td rowspan=\"3\">Vicuna</td><td rowspan=\"3\"></td><td rowspan=\"3\"></td><td></td><td>16.43</td><td>36.40</td></tr><tr><td></td><td>19.56</td><td>40.20</td></tr><tr><td></td><td>15.63</td><td>36.80</td></tr><tr><td rowspan=\"3\">Vicuna + DQA</td><td rowspan=\"3\"></td><td rowspan=\"3\"></td><td></td><td>24.49</td><td>44.90</td></tr><tr><td></td><td>25.70</td><td>46.00</td></tr><tr><td>√</td><td>24.44</td><td>45.30</td></tr><tr><td rowspan=\"4\">Vicuna + DQA + SELF(Ours)</td><td>&gt;&gt;</td><td></td><td></td><td>29.64</td><td>49.40</td></tr><tr><td></td><td>√</td><td></td><td></td><td></td></tr><tr><td>√</td><td></td><td>√</td><td>31.31</td><td>49.80</td></tr><tr><td>√</td><td>√</td><td>√</td><td>32.22</td><td>51.20</td></tr></table>",
331
+ "page_idx": 6
332
+ },
333
+ {
334
+ "type": "text",
335
+ "text": "In Table 1, we present an experimental comparison of SELF against baseline models, as detailed in Section 4.1.2. This comparison elucidates SELF’s effectiveness in enhancing LLM performance through self-evolution and offers several key insights: ",
336
+ "page_idx": 6
337
+ },
338
+ {
339
+ "type": "text",
340
+ "text": "(1) Self-Evolution Enhances LLM: Vicuna $^ +$ $D _ { Q A } + \\ S$ SELF significantly outperforms its baseline Vicuna $+ \\ D _ { Q A }$ $( 2 4 . 4 9 \\% \\xrightarrow { + 5 . 1 5 \\% } 2 9 . 6 4 \\%$ on GSM8K and +4.5%−−−−→ 49.40% on SVAMP), showcasing self-evolution’s potential in LLMs’ optimization. ",
341
+ "page_idx": 6
342
+ },
343
+ {
344
+ "type": "text",
345
+ "text": "(2) SELF Instills Meta-Capability in LLMs: The integration of self-refinement into Vicuna $^ +$ $D _ { Q A } +$ SELF results in a notable performance boost $( 2 9 . 6 4 \\%$ +1.67%−−−−−→ 31.31%), while baseline models show minimal or negative changes via self-refinement. We also provide a case analysis for the limited self-refinement ability in baseline models in Appendix A.2. This indicates that SELF instills advanced self-refinement capabilities into smaller models like Vicuna (7B), previously limited to larger LLMs (Ye et al., 2023) like GPT-4. ",
346
+ "page_idx": 6
347
+ },
348
+ {
349
+ "type": "text",
350
+ "text": "(3) Pseudo-Labeled $D _ { Q A }$ Enhances Performance: The inclusion of pseudo-labeled QA data $D _ { Q A }$ enhances Vicuna’s performance, suggesting that pseudo-labeled QA data help in learning taskspecific information. ",
351
+ "page_idx": 6
352
+ },
353
+ {
354
+ "type": "text",
355
+ "text": "(4) SELF can work with Self-Consistency: SELF works effectively with self-consistency, improving accuracy across models. The base Vicuna model, which may have uncertainties in its outputs, shows notable improvement with self-consistency, achieving a $+ 3 . 1 3 \\%$ increase. As the model progresses through self-evolution training and becomes more capable of generating correct math answers, the benefit from self-consistency diminishes. Combining self-refinement with selfconsistency further elevates performance (e.g., $2 9 . 6 4 \\% \\xrightarrow { + 2 . 5 8 \\% } 3 2 . 2 2 \\%$ on GSM8K), indicating that these two strategies can complement each other effectively. ",
356
+ "page_idx": 6
357
+ },
358
+ {
359
+ "type": "text",
360
+ "text": "4.2.2 COMPARISON WITH RLHF ",
361
+ "text_level": 1,
362
+ "page_idx": 6
363
+ },
364
+ {
365
+ "type": "text",
366
+ "text": "In Table 2, we compare the performance of SELF with RLHF. We note that the SELF result in Table 2 differs from those in Table 1. This discrepancy arises because the experiments in Table 2 utilized data solely from the initial round of self-evolution training. As Table 2 shows, RLHF achieves a $2 5 . 5 5 \\%$ accuracy on GSM8K, which is lower than the $2 7 . 6 7 \\%$ performed by SELF. We observe that the reward model often fails to identify the correctness of the response, which limits performance improvements. On the GSM8K test set, for incorrect answers produced by the SFT model (Vicuna $+ D _ { Q A } )$ , the reward model only identifies $24 \\%$ of them as incorrect, i.e., the reward model assigns lower scalar rewards to incorrect answers compared to correct answers. In contrast, SELF utilizes informative natural language feedback to provide a more accurate assessment. It correctly identifies $72 \\%$ of incorrect answers. ",
367
+ "page_idx": 6
368
+ },
369
+ {
370
+ "type": "table",
371
+ "img_path": "images/fee7092fdf0106ca7b235d615e9254a9ee9bef2048720f231f2a97d9aa7d1e47.jpg",
372
+ "table_caption": [
373
+ "Table 2: Comparison of SELF and RLHF on GSM8K "
374
+ ],
375
+ "table_footnote": [],
376
+ "table_body": "<table><tr><td>Method</td><td>Acc.of Feedback(%)Acc.on GSM8K(%)</td><td></td></tr><tr><td>SFT (Vicuna + DQA)</td><td>-</td><td>24.49</td></tr><tr><td>RLHF</td><td>24</td><td>25.55</td></tr><tr><td>SELF</td><td>72</td><td>27.67</td></tr></table>",
377
+ "page_idx": 7
378
+ },
379
+ {
380
+ "type": "text",
381
+ "text": "",
382
+ "page_idx": 7
383
+ },
384
+ {
385
+ "type": "text",
386
+ "text": "4.2.3 GENERAL TEST ",
387
+ "text_level": 1,
388
+ "page_idx": 7
389
+ },
390
+ {
391
+ "type": "text",
392
+ "text": "We expanded the evaluation of the SELF framework to include general domain benchmarks, explicitly using the Vicuna and Evol-Instruct test sets. Three configurations of the Vicuna model are evaluated: Vicuna, Vicuna $+ D _ { Q A }$ , and Vicuna $+ \\ D _ { Q A } + { \\mathrm { S E L F } } .$ . We utilized GPT-4 to evaluate the models’ responses on both test sets. We follow the assessment methodology proposed by ( $\\mathrm { { X u } }$ et al., 2023), which mitigated the order bias present in the evaluation procedures described in (Chiang et al., 2023). ",
393
+ "page_idx": 7
394
+ },
395
+ {
396
+ "type": "text",
397
+ "text": "The results are depicted in Figure 3. In this figure, blue represents the number of test cases where the model being evaluated is preferred over the baseline model (Vicuna), as assessed by GPT-4. Yellow denotes test cases where both models perform equally, and pink indicates the number of test cases where the baseline model is favored over the model being evaluated. ",
398
+ "page_idx": 7
399
+ },
400
+ {
401
+ "type": "image",
402
+ "img_path": "images/0f0df84a5cebbb7242440327379cee1a05b5cb4c4c62bb5810cf112cd769ed20.jpg",
403
+ "image_caption": [
404
+ "Figure 3: Results on Vicuna testset and Evol-Instruct testset "
405
+ ],
406
+ "image_footnote": [],
407
+ "page_idx": 7
408
+ },
409
+ {
410
+ "type": "text",
411
+ "text": "In the Vicuna testset, Vicuna $+ \\ D _ { Q A }$ improved its win/tie/loss record from 52/11/17 to 58/7/15 with the addition of SELF. This translates to a win rate increase from $6 5 . 0 \\%$ to $7 2 . 5 \\%$ . After selfrefinement, the record improved to 60/7/13, corresponding to a win rate of $7 5 . 0 \\%$ . In the EvolInstruct testset, Vicuna $+ D _ { Q A }$ initially had a win/tie/loss record of 106/37/75, a win rate of about $4 8 . 6 \\%$ . With SELF, this improved to 115/29/74, increasing the win rate to approximately $5 2 . 8 \\%$ . Applying self-refinement, the record improved further to 121/28/69, equating to a win rate of $5 5 . 5 \\%$ . ",
412
+ "page_idx": 7
413
+ },
414
+ {
415
+ "type": "text",
416
+ "text": "These findings in general domains highlight the SELF framework’s adaptability and robustness, particularly when self-refinement is employed, showcasing its efficacy across varied test domains. ",
417
+ "page_idx": 7
418
+ },
419
+ {
420
+ "type": "text",
421
+ "text": "4.3 ABLATION STUDY FOR SELF ",
422
+ "text_level": 1,
423
+ "page_idx": 7
424
+ },
425
+ {
426
+ "type": "text",
427
+ "text": "The SELF framework endows LLMs with an inherent capability through a structured, two-phase learning process. We conduct ablation experiments on SVAMP and GSM8K datasets to assess the incremental benefits of each stage. As depicted in Table 3, the framework facilitates gradual performance improvements through successive SELF stages. A checkmark $\\checkmark$ in a column denotes the additive adoption of the corresponding setting in that training scenario. Observations are highlighted below: ",
428
+ "page_idx": 7
429
+ },
430
+ {
431
+ "type": "table",
432
+ "img_path": "images/fcedfec595b1aad9335ac6e55e02c5d79dd068c14150d60ae3dfea0178611a96.jpg",
433
+ "table_caption": [
434
+ "Table 3: Performance comparisons of SELF under various training scenarios. Arrows indicate the improvement from direct generation to self-refinement: ”direct generation self-refinement” "
435
+ ],
436
+ "table_footnote": [],
437
+ "table_body": "<table><tr><td rowspan=\"2\">SVAMP (%)</td><td rowspan=\"2\">GSM8K (%)</td><td colspan=\"2\">Meta-Skill Learning</td><td colspan=\"3\">Self Evolution Process</td></tr><tr><td>DQA</td><td>Dmeta</td><td>1st round</td><td> 2nd round</td><td> 3rd round</td></tr><tr><td>36.4</td><td>16.43</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>44.9</td><td>24.49</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>25.39→28.28</td><td>&lt;&gt;</td><td></td><td></td><td></td><td></td></tr><tr><td>46.8→47.0</td><td></td><td>√</td><td>&gt;&gt;</td><td>&gt;&gt;</td><td></td><td></td></tr><tr><td>48.9 → 49.0</td><td>28.66→29.87</td><td>√</td><td>√</td><td></td><td>&gt;&gt;</td><td></td></tr><tr><td>49.4 -→ 50.2</td><td>29.64 -→ 31.31</td><td>√</td><td>√</td><td>√</td><td></td><td>√</td></tr></table>",
438
+ "page_idx": 8
439
+ },
440
+ {
441
+ "type": "text",
442
+ "text": "(1) Integration of Meta-skill Training Data $D _ { m e t a }$ Elevates Direct QA: Incorporating data detailing the feedback-refinement process $( D _ { m e t a } )$ in meta-skill training notably enhances direct response quality $( + 1 . 9 \\%$ on GSM8K and $+ 2 . 2 8 \\%$ on SVAMP) in comparison to using $D _ { Q A }$ alone. This underscores the interesting finding that arming the model with self-refinement meta-capability implicitly elevates its capacity to discern the standard of a good answer and generate superior responses, even without explicit self-refinement. ",
443
+ "page_idx": 8
444
+ },
445
+ {
446
+ "type": "text",
447
+ "text": "(2) Continuous Improvement through Self-Evolution: The results reveal that three selfevolution rounds consecutively yield performance enhancements (e.g., $2 5 . 3 9 \\%$ $\\underline { { + 2 . 2 8 \\% } } ,$ $2 7 . 6 7 \\% \\xrightarrow { + 0 . 9 9 \\% } 2 8 . 6 6 \\% \\xrightarrow { + 0 . 9 8 \\% } 2 9 . 6 4 \\%$ +0.98%−−−−−→ 29.64% on GSM8K). This shows that the model actively evolves, refining its performance autonomously without additional manual intervention. ",
448
+ "page_idx": 8
449
+ },
450
+ {
451
+ "type": "text",
452
+ "text": "(3) Persistent Efficacy of Self-Refinement: Regardless of model variation, executing selfrefinement consistently results in notable performance improvements. This shows that the selfrefinement meta-capability learned by SELF is robust and consistent across various LLMs. ",
453
+ "page_idx": 8
454
+ },
455
+ {
456
+ "type": "text",
457
+ "text": "5 CONCLUSION ",
458
+ "text_level": 1,
459
+ "page_idx": 8
460
+ },
461
+ {
462
+ "type": "text",
463
+ "text": "We present SELF (Self-Evolution with Language Feedback), a novel framework that enables LLMs to achieve progressive self-evolution through self-feedback and self-refinement. Unlike conventional methods, SELF transforms LLMs from passive information recipients to active participants in their evolution. Through meta-skill learning, SELF equips LLMs with the capability for selffeedback and self-refinement. This empowers the models to evolve their capabilities autonomously and align with human values, utilizing self-evolution training and online self-refinement. Experiments conducted on benchmarks underscore SELF’s capacity to progressively enhance model capabilities while reducing the need for human intervention. SELF represents a significant step in the development of autonomous artificial intelligence, leading to a future in which models are capable of continual learning and self-evolution. This framework lays the groundwork for a more adaptive, self-conscious, responsive, and human-aligned future in AI development. ",
464
+ "page_idx": 8
465
+ },
466
+ {
467
+ "type": "text",
468
+ "text": "REFERENCES ",
469
+ "text_level": 1,
470
+ "page_idx": 8
471
+ },
472
+ {
473
+ "type": "text",
474
+ "text": "Shengnan An, Zexiong Ma, Zeqi Lin, Nanning Zheng, Jian-Guang Lou, and Weizhu Chen. Learning from mistakes makes llm better reasoner. arXiv preprint arXiv:2310.20689, 2023. ",
475
+ "page_idx": 8
476
+ },
477
+ {
478
+ "type": "text",
479
+ "text": "Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, et al. Training a helpful and harmless assistant with reinforcement learning from human feedback. arXiv preprint arXiv:2204.05862, 2022. ",
480
+ "page_idx": 8
481
+ },
482
+ {
483
+ "type": "text",
484
+ "text": "Thomas Carta, Clement Romac, Thomas Wolf, Sylvain Lamprier, Olivier Sigaud, and Pierre-Yves ´ Oudeyer. Grounding large language models in interactive environments with online reinforcement learning. arXiv preprint arXiv:2302.02662, 2023. ",
485
+ "page_idx": 8
486
+ },
487
+ {
488
+ "type": "text",
489
+ "text": "Xinyun Chen, Maxwell Lin, Nathanael Scharli, and Denny Zhou. Teaching large language models ¨ to self-debug. arXiv preprint arXiv:2304.05128, 2023. ",
490
+ "page_idx": 9
491
+ },
492
+ {
493
+ "type": "text",
494
+ "text": "Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E. Gonzalez, Ion Stoica, and Eric P. Xing. Vicuna: An open-source chatbot impressing gpt-4 with $9 0 \\% *$ chatgpt quality, March 2023. URL https: //lmsys.org/blog/2023-03-30-vicuna/. ",
495
+ "page_idx": 9
496
+ },
497
+ {
498
+ "type": "text",
499
+ "text": "Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. Advances in neural information processing systems, 30, 2017. ",
500
+ "page_idx": 9
501
+ },
502
+ {
503
+ "type": "text",
504
+ "text": "Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. ",
505
+ "page_idx": 9
506
+ },
507
+ {
508
+ "type": "text",
509
+ "text": "Hanze Dong, Wei Xiong, Deepanshu Goyal, Rui Pan, Shizhe Diao, Jipeng Zhang, Kashun Shum, and Tong Zhang. Raft: Reward ranked finetuning for generative foundation model alignment. arXiv preprint arXiv:2304.06767, 2023. ",
510
+ "page_idx": 9
511
+ },
512
+ {
513
+ "type": "text",
514
+ "text": "Xinyang Geng and Hao Liu. Openllama: An open reproduction of llama, May 2023. URL https: //github.com/openlm-research/open_llama. ",
515
+ "page_idx": 9
516
+ },
517
+ {
518
+ "type": "text",
519
+ "text": "Rik Koncel-Kedziorski, Subhro Roy, Aida Amini, Nate Kushman, and Hannaneh Hajishirzi. MAWPS: A math word problem repository. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 1152–1157, San Diego, California, June 2016. Association for Computational Linguistics. doi: 10.18653/v1/N16-1136. URL https://aclanthology.org/N16-1136. ",
520
+ "page_idx": 9
521
+ },
522
+ {
523
+ "type": "text",
524
+ "text": "Jan Leike, David Krueger, Tom Everitt, Miljan Martic, Vishal Maini, and Shane Legg. Scalable agent alignment via reward modeling: a research direction. arXiv preprint arXiv:1811.07871, 2018. ",
525
+ "page_idx": 9
526
+ },
527
+ {
528
+ "type": "text",
529
+ "text": "Zheng Lianmin, Chiang Wei-Lin, and Zhuang Siyuan (Ryans). Vicuna-blog-eval, 2023. https: //github.com/lm-sys/vicuna-blog-eval. ",
530
+ "page_idx": 9
531
+ },
532
+ {
533
+ "type": "text",
534
+ "text": "Hunter Lightman, Vineet Kosaraju, Yura Burda, Harri Edwards, Bowen Baker, Teddy Lee, Jan Leike, John Schulman, Ilya Sutskever, and Karl Cobbe. Let’s verify step by step. arXiv preprint arXiv:2305.20050, 2023. ",
535
+ "page_idx": 9
536
+ },
537
+ {
538
+ "type": "text",
539
+ "text": "Zhan Ling, Yunhao Fang, Xuanlin Li, Zhiao Huang, Mingu Lee, Roland Memisevic, and Hao Su. Deductive verification of chain-of-thought reasoning. arXiv preprint arXiv:2306.03872, 2023. ",
540
+ "page_idx": 9
541
+ },
542
+ {
543
+ "type": "text",
544
+ "text": "Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, et al. Self-refine: Iterative refinement with self-feedback. arXiv preprint arXiv:2303.17651, 2023. ",
545
+ "page_idx": 9
546
+ },
547
+ {
548
+ "type": "text",
549
+ "text": "Shen-yun Miao, Chao-Chun Liang, and Keh-Yih Su. A diverse corpus for evaluating and developing english math word problem solvers. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 975–984, 2020. ",
550
+ "page_idx": 9
551
+ },
552
+ {
553
+ "type": "text",
554
+ "text": "OpenAI. Chatgpt, 2022. https://chat.openai.com/chat. ",
555
+ "page_idx": 9
556
+ },
557
+ {
558
+ "type": "text",
559
+ "text": "OpenAI. Gpt-4 technical report, 2023. ",
560
+ "page_idx": 9
561
+ },
562
+ {
563
+ "type": "text",
564
+ "text": "Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35: 27730–27744, 2022. ",
565
+ "page_idx": 9
566
+ },
567
+ {
568
+ "type": "text",
569
+ "text": "Jing-Cheng Pang, Pengyuan Wang, Kaiyuan Li, Xiong-Hui Chen, Jiacheng Xu, Zongzhang Zhang, and Yang Yu. Language model self-improvement by reinforcement learning contemplation. arXiv preprint arXiv:2305.14483, 2023. ",
570
+ "page_idx": 9
571
+ },
572
+ {
573
+ "type": "text",
574
+ "text": "Arkil Patel, Satwik Bhattamishra, and Navin Goyal. Are NLP models really able to solve simple math word problems? In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 2080– 2094, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021. naacl-main.168. URL https://aclanthology.org/2021.naacl-main.168. ",
575
+ "page_idx": 10
576
+ },
577
+ {
578
+ "type": "text",
579
+ "text": "Jer´ emy Scheurer, Jon Ander Campos, Tomasz Korbak, Jun Shern Chan, Angelica Chen, Kyunghyun ´ Cho, and Ethan Perez. Training language models with language feedback at scale. arXiv preprint arXiv:2303.16755, 2023. \nNoah Shinn, Federico Cassano, Beck Labash, Ashwin Gopinath, Karthik Narasimhan, and Shunyu Yao. Reflexion: Language agents with verbal reinforcement learning, 2023. \nHao Sun. Reinforcement learning in the era of llms: What is essential? what is needed? an rl perspective on rlhf, prompting, and beyond. arXiv preprint arXiv:2310.06147, 2023. \nHugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee´ Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and \\` efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023. \nXuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022a. \nYizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language model with self generated instructions. arXiv preprint arXiv:2212.10560, 2022b. \nJason Wei, Maarten Bosma, Vincent Y Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M Dai, and Quoc V Le. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652, 2021. \nCan Xu, Qingfeng Sun, Kai Zheng, Xiubo Geng, Pu Zhao, Jiazhan Feng, Chongyang Tao, and Daxin Jiang. Wizardlm: Empowering large language models to follow complex instructions. arXiv preprint arXiv:2304.12244, 2023. \nSeonghyeon Ye, Yongrae Jo, Doyoung Kim, Sungdong Kim, Hyeonbin Hwang, and Minjoon Seo. Selfee: Iterative self-revising llm empowered by self-feedback generation. Blog post, May 2023. URL https://kaistai.github.io/SelFee/. \nChunting Zhou, Pengfei Liu, Puxin Xu, Srini Iyer, Jiao Sun, Yuning Mao, Xuezhe Ma, Avia Efrat, Ping Yu, Lili Yu, et al. Lima: Less is more for alignment. arXiv preprint arXiv:2305.11206, 2023. ",
580
+ "page_idx": 10
581
+ },
582
+ {
583
+ "type": "text",
584
+ "text": "A APPENDIX ",
585
+ "text_level": 1,
586
+ "page_idx": 10
587
+ },
588
+ {
589
+ "type": "text",
590
+ "text": "A.1 IMPLEMENTATION DETAIL ",
591
+ "page_idx": 10
592
+ },
593
+ {
594
+ "type": "text",
595
+ "text": "A.1.1 TRAINING HYPERPARAMETERS ",
596
+ "text_level": 1,
597
+ "page_idx": 10
598
+ },
599
+ {
600
+ "type": "text",
601
+ "text": "Our experiments were conducted in a computing environment equipped with 8 V100 GPUs, each having a memory capacity of 32GB. Below is a table 4 outlining the training hyperparameters we used. It is noted that these parameters were consistently applied across all training methods in our experiments. ",
602
+ "page_idx": 10
603
+ },
604
+ {
605
+ "type": "table",
606
+ "img_path": "images/56404e52c44f9e3965987052158352570e3115d4403fdab1b1a66c36bc29ce5e.jpg",
607
+ "table_caption": [
608
+ "Table 4: Training hyperparameters "
609
+ ],
610
+ "table_footnote": [],
611
+ "table_body": "<table><tr><td>Hyperparameter</td><td>Global Batch Size</td><td>Learning Rate</td><td>Epochs</td><td>Max Length</td><td>Weight Decay</td></tr><tr><td>Value</td><td>128</td><td>2×10-5</td><td>3</td><td>2048</td><td>0</td></tr></table>",
612
+ "page_idx": 10
613
+ },
614
+ {
615
+ "type": "text",
616
+ "text": "A.1.2 DATA GENERATION ",
617
+ "text_level": 1,
618
+ "page_idx": 11
619
+ },
620
+ {
621
+ "type": "text",
622
+ "text": "To produce the $D _ { Q A }$ dataset, we utilized $3 . 5 \\mathrm { k }$ unlabeled training prompts for GSM8k and 2k training prompts 3 for the SVAMP. For the general test, we derived 6K conversations from a set of 90K ShareGPT dialogues to constitute the $D _ { Q A }$ data for the general test. ",
623
+ "page_idx": 11
624
+ },
625
+ {
626
+ "type": "text",
627
+ "text": "Regarding the prompts without labels used in the self-evolution training approach for math tests: ",
628
+ "page_idx": 11
629
+ },
630
+ {
631
+ "type": "text",
632
+ "text": "First round self-evolving phase: We made use of the leftover prompts from the training datasets, explicitly excluding those prompts that were utilized for meta-skill learning and labeled as $D _ { Q A }$ . Specifically, we took 4K remaining prompts on GSM8k and 1K on SVAMP. ",
633
+ "page_idx": 11
634
+ },
635
+ {
636
+ "type": "text",
637
+ "text": "Second/Third round: We utilized the Self-Instruct method as described in (Wang et al., 2022b) We created unlabeled prompts using the template shown in Fig, A.1.2—initially, 4 to 6 instances served as seed examples. In the second round of self-evolution training, we produced 10K prompts, which was augmented to 15K in the third iteration. ",
638
+ "page_idx": 11
639
+ },
640
+ {
641
+ "type": "text",
642
+ "text": "In the general test, considering the need for the model to exhibit broad proficiency across various domains, we leveraged a subset (15K) of unlabeled prompts from ShareGPT dialogues to construct the self-evolution training data. ",
643
+ "page_idx": 11
644
+ },
645
+ {
646
+ "type": "text",
647
+ "text": "You are an experienced instruction creator. You are asked to develop 3 diverse instructions according to the given examples. \nHere are the requirements: \n1. The generated instructions should follow the task type in the given examples. \n2. The language used for the generated instructions should be diverse. \nGiven examples: {examples} \nThe generated instructions should be: \nA. ... \nB. ... \nC. ... ",
648
+ "page_idx": 11
649
+ },
650
+ {
651
+ "type": "text",
652
+ "text": "A.2 CASE STUDY ANALYSIS ",
653
+ "text_level": 1,
654
+ "page_idx": 11
655
+ },
656
+ {
657
+ "type": "text",
658
+ "text": "This subsection delves into a detailed case study analysis that exhibits the comparative efficiencies of the original Vicuna and Vicuna $^ +$ SELF models. As depicted in Fig. A.2, both models predict answers and engage in self-feedback and self-refinement processes. An interesting observation is that while Vicuna’s refined answer retains inaccuracies, Vicuna $^ +$ SELF generates a solution that’s accurate and logically consistent by self-feedback and self-refinement. ",
659
+ "page_idx": 11
660
+ },
661
+ {
662
+ "type": "text",
663
+ "text": "A.3 META-SKILL TRAINING CORPUS ",
664
+ "text_level": 1,
665
+ "page_idx": 11
666
+ },
667
+ {
668
+ "type": "text",
669
+ "text": "As demonstrated in the provided case study within the A.3, the content represents a typical training example from our meta-skilling corpus. It showcases the initial response of the model, its selffeedback, and the subsequent refinement, enabling the model to self-feedback and self-refinement. ",
670
+ "page_idx": 11
671
+ },
672
+ {
673
+ "type": "image",
674
+ "img_path": "images/187b7bd9fa8c55e71574afdc2c68e243d8b87de621844d6aaa47b225b1644273.jpg",
675
+ "image_caption": [
676
+ "Figure 4: Case study of comparison between original Vicuna (left) and Vicuna+SELF (right) on an SVAMP. Both models generate direct predictions and undergo self-feedback and self-refinement. While Vicuna’s refinement retains the incorrect answer, Vicuna $^ +$ SELF showcases superior selfrefinement capability, ultimately producing a correct and logically consistent solution. "
677
+ ],
678
+ "image_footnote": [],
679
+ "page_idx": 12
680
+ },
681
+ {
682
+ "type": "text",
683
+ "text": "Question: Greg has an alarm set to ring three times a day as a reminder. When the alarm goes off, it continues to ring until Greg turns it off. The first time it went off today, it rang four times. The second time it went off, it rang for three times as long as the first time. The third time, it rang for half as long as the second time. How many times did the alarm ring in all? ",
684
+ "page_idx": 12
685
+ },
686
+ {
687
+ "type": "text",
688
+ "text": "Original Response: The alarm rang four times the first time, three times as long as the first time the second time, and half as long as the second time the third time. So, the total number of times the alarm rang is $4 + 3 ^ { * } 3 + 2 ^ { * } 2 = 2 4$ . ",
689
+ "page_idx": 12
690
+ },
691
+ {
692
+ "type": "text",
693
+ "text": "Feedback: The response correctly interprets the problem. The first time the alarm rang, it rang for 4 times. The second time it rang, it rang for 3 times as long as the first time, which is $3 ^ { * } 4 = 1 2$ times. The third time it rang, it rang for half as long as the second time, which is $1 2 / 2 = 6$ times. However, the final calculation is incorrect. The total number of times the alarm rang is not $4 + 3 ^ { * } 3 + 2 ^ { * } 2 = 2 4$ , but $4 + 1 2 + 6 = 2 2$ . Judgement: incorrect ",
694
+ "page_idx": 12
695
+ },
696
+ {
697
+ "type": "text",
698
+ "text": "Refined Response: The alarm rang four times the first time, three times as long as the first time the second time, and half as long as the second time the third time. So, the total number of times the alarm rang is $4 + 1 2 + 6 = 2 2$ . ",
699
+ "page_idx": 12
700
+ },
701
+ {
702
+ "type": "text",
703
+ "text": "A.4 ALGORITHM ",
704
+ "text_level": 1,
705
+ "page_idx": 12
706
+ },
707
+ {
708
+ "type": "text",
709
+ "text": "The subsequent algorithm, labeled as the ”Two-Phase SELF Process”, delineates a methodology to evolve a base language model using a progressively dual-phased approach: Meta-Skill Learning and Self-Evolving. Initially, the process involves training on a ”Meta-Skill Learning corpus,” which combines Question-Answer pairs and feedback-driven refinement data. After this phase, the algorithm proceeds to its ”Self-Evolving Phase,” where the model undergoes iterative refinements. The model employs data augmentation techniques for each iteration, generating self-refined outputs based on previously refined models. This self-evolving iteration is designed to capitalize on accumulated knowledge and refine the model using freshly generated data. The process culminates with an enhanced Language Model that has undergone multiple stages of self-evolution, showcasing im",
710
+ "page_idx": 12
711
+ },
712
+ {
713
+ "type": "text",
714
+ "text": "provements over its initial form. The detailed steps and mechanisms involved are delineated in Alg. \n1. ",
715
+ "page_idx": 13
716
+ },
717
+ {
718
+ "type": "text",
719
+ "text": "Algorithm 1: Two-Phase SELF Process ",
720
+ "text_level": 1,
721
+ "page_idx": 13
722
+ },
723
+ {
724
+ "type": "text",
725
+ "text": "Data: (1) Question-Answer pairs $( D _ { Q A } )$ , (2) Meta-Skill training data $D _ { m e t a } )$ ) and (3) unlabeled prompts $( D _ { u n l a b e l e d } )$ \nInput: An initial Language Model $M _ { i n i t i a l }$ \nResult: A stronger Language Model $M _ { s e l f } ^ { k }$ after self-evolving \n// Meta-Skill Learning Phase \nData: Meta-Skill learning corpus $( D _ { m e t a } )$ and Question-Answer pairs $( D _ { Q A } )$ \n$M _ { m e t a } =$ Supervised fine tuning $M _ { i n i t i a l }$ , $D _ { m e t a } \\cup D _ { Q A }$ ); \n// Self-Evolving Phase \nInitialize $M _ { 1 }$ with $M _ { m e t a }$ ; \nforeach iteration $t$ in $I$ to Number of self-evolving iterations $T$ do // Data-Augmentation Initialize $D _ { \\mathrm { s e l f } } ^ { t }$ as an empty set; foreach prompt $p _ { s e l f } ^ { i }$ in $t ^ { t h }$ Unlabeled prompts $D _ { u n l a b e l e d }$ do Generate self-refined output $\\hat { r } _ { s e l f } ^ { i }$ using $M _ { s e l f } ^ { t - 1 }$ ; Use $M _ { s e l f } ^ { t - 1 }$ to filter the self-refined output; Add $( p _ { s e l f } ^ { i } , \\hat { r } _ { s e l f } ^ { i } )$ to $D _ { \\mathrm { s e l f } } ^ { t }$ , where $r _ { i }$ is the refined response; end $M _ { s e l f } ^ { t } = \\mathrm { S u p e r v i s e d \\_ f n e \\_ t u n i n g } ( M _ { s e l f } ^ { t - 1 } , D _ { s e l f } ^ { t } ) ;$ ",
726
+ "page_idx": 13
727
+ },
728
+ {
729
+ "type": "text",
730
+ "text": "end ",
731
+ "text_level": 1,
732
+ "page_idx": 13
733
+ },
734
+ {
735
+ "type": "text",
736
+ "text": "// Training Complete return Improved Language Model $M _ { s e l f } ^ { T }$ ; ",
737
+ "page_idx": 13
738
+ },
739
+ {
740
+ "type": "text",
741
+ "text": "A.5 PROMPT FOR GENERATING FEEDBACK AND REFINEMENT IN GENERAL CASE ",
742
+ "text_level": 1,
743
+ "page_idx": 13
744
+ },
745
+ {
746
+ "type": "text",
747
+ "text": "For the general test, aligned with the methodology described in 3, we deploy the following prompt to guide an LLM-based annotator in generating response feedback and refinement. This prompt serves as the foundation for the meta-skill learning corpus and assists in producing self-evolution training data in the general test setting. ",
748
+ "page_idx": 13
749
+ },
750
+ {
751
+ "type": "text",
752
+ "text": "Prompt for feedback and refinement: ",
753
+ "text_level": 1,
754
+ "page_idx": 13
755
+ },
756
+ {
757
+ "type": "text",
758
+ "text": "(Feedback) Please assess the quality of response to the given question. \nHere is the question: $p$ . \nHere is the response: $r$ . \nFirstly provide an analysis and verification for response starting with “Response Analysis:”. \nNext, then rate the response on a scale of 1 to 10 (1 is worst, 10 is best) in the format of ”Rating:” (Refinement) Finally output an improved answer based on your analysis if no response is rated 10. ",
759
+ "page_idx": 13
760
+ },
761
+ {
762
+ "type": "text",
763
+ "text": "A.6 MULTIPLE V.S. SINGLE SELF-REFINEMENT",
764
+ "text_level": 1,
765
+ "page_idx": 13
766
+ },
767
+ {
768
+ "type": "text",
769
+ "text": "In this study, we examine the impact of two meta-skill training data organization methods on model performance: (1) Multiple Self-Refinement $( D _ { F R - m u l t i } )$ , which entails sampling three responses and instructing the model to select the best one for refinement, and (2) Single Self-Refinement $( D _ { F R } )$ , where the model generates and refines only one response. ",
770
+ "page_idx": 13
771
+ },
772
+ {
773
+ "type": "text",
774
+ "text": "We present the comparative performance of these methods in Table 5. Our findings indicate that both methods benefit from an increased volume of training data, demonstrating performance improvements. Notably, as the data volume grows, the multiple-response refinement approach demonstrates a smaller improvement in direct generation performance $( + 4 . 0 2 \\% )$ compared to the single-response method $( + 5 . 8 4 \\% )$ . Given the single-response method’s simplicity and computational efficiency — requiring the sampling of only one response during inference — and its superior performance relative to the multiple-response approach, we have adopted the single-response refinement strategy in our experiments. ",
775
+ "page_idx": 13
776
+ },
777
+ {
778
+ "type": "table",
779
+ "img_path": "images/f870a7cc8578846b2d65a7c97184b9704211ddcbf6c1577d8b483d29560100b4.jpg",
780
+ "table_caption": [
781
+ "Table 5: Performance comparison between single and multiple response refinement across varying volumes of meta-skill training data. The right arrow indicates the performance improvement by self-refinement: “direct generation self-refinement”. "
782
+ ],
783
+ "table_footnote": [],
784
+ "table_body": "<table><tr><td>Data Size</td><td></td><td>Vicuna+ DQA U DFD Vicuna + DQA U DFD-multi</td></tr><tr><td>3.5k</td><td>25.39 →28.28</td><td>25.92 → 27.29</td></tr><tr><td>7.5k</td><td>31.23→32.98</td><td>29.94→32.14</td></tr></table>",
785
+ "page_idx": 14
786
+ },
787
+ {
788
+ "type": "text",
789
+ "text": "A.7 SELF-EVOLUTION TRAINING DATA FILTERING ANALYSIS ",
790
+ "text_level": 1,
791
+ "page_idx": 14
792
+ },
793
+ {
794
+ "type": "table",
795
+ "img_path": "images/40a99c6b4fbc20108c5d356099859fd210cb11d2d869e6739d44a8fd9fa8422e.jpg",
796
+ "table_caption": [
797
+ "Table 6: Analysis of filtering strategies on GSM8K. ”Acc. of Training Data” refers to the accuracy of self-generated data post-filtering/refinement, while ”Acc. on Test Set” indicates the model’s test performance after fine-tuning such data. "
798
+ ],
799
+ "table_footnote": [],
800
+ "table_body": "<table><tr><td>Filter Strategy</td><td>Acc. of Training Data (%)Acc. on Test Set (%)</td><td></td></tr><tr><td>Self-Refinement Revised (Unfiltered)</td><td>29.89</td><td>26.90</td></tr><tr><td>Meta-Skill Filtered</td><td>44.10</td><td>27.67</td></tr></table>",
801
+ "page_idx": 14
802
+ },
803
+ {
804
+ "type": "text",
805
+ "text": "In Table 6, we explore the impact of different filtering strategies on the quality of training data and their contribution to self-evolution training. The following insights emerge from this comparison: ",
806
+ "page_idx": 14
807
+ },
808
+ {
809
+ "type": "text",
810
+ "text": "(1) Superiority of Meta-Skills Filtered: The combination of self-refinement and self-feedback filtering results in higher data accuracy $( 4 4 . 1 0 \\% )$ and improved finetuned model performance $( 2 7 . 6 7 \\% )$ . Despite the significant accuracy boost, the performance gain is modest due to the reduced data size (from 4k to 1.8k) post-filtering. ",
811
+ "page_idx": 14
812
+ },
813
+ {
814
+ "type": "text",
815
+ "text": "(2) Robustness of SELF: The substantial accuracy increase in self-generated data with the addition of self-feedback meta-skill underlines its strong filtering capability, contributing to improved finetuned model performance. ",
816
+ "page_idx": 14
817
+ },
818
+ {
819
+ "type": "text",
820
+ "text": "A.8 SELF-EVOLUTION TRAINING: CONTINUAL TRAINING V.S. RESTART TRAINING ’Restart Training’, which combines meta-skill learning corpus with all self-evolution training data, significantly improves direct generation $( + 3 . 1 8 \\% )$ and self-refinement $( + 3 . 8 5 \\% )$ . This approach helps maintain a balance between new learning and previously acquired knowledge. ",
821
+ "page_idx": 14
822
+ },
823
+ {
824
+ "type": "table",
825
+ "img_path": "images/35bc2231f4f2f18f50849d10d8ab701effaa8800f305db753a7acbc1075824f8.jpg",
826
+ "table_caption": [
827
+ "Table 7: Analysis about varied self-evolution training methodologies on GSM8K "
828
+ ],
829
+ "table_footnote": [],
830
+ "table_body": "<table><tr><td>Training Approach</td><td>Direct Generation (%)</td><td>Self-Refinement (%)</td></tr><tr><td>Base Model</td><td>24.49</td><td>24.49</td></tr><tr><td>Restart Training</td><td>27.67</td><td>29.34</td></tr><tr><td>Continual Training (Mixed Data)</td><td>27.22</td><td>28.43</td></tr><tr><td>Continual Training (Dtelf Only)</td><td>24.87</td><td>25.85</td></tr></table>",
831
+ "page_idx": 14
832
+ },
833
+ {
834
+ "type": "text",
835
+ "text": "",
836
+ "page_idx": 14
837
+ },
838
+ {
839
+ "type": "text",
840
+ "text": "’Continual Training (Mixed Data)’, where the model is trained simultaneously with self-evolution data from all rounds, also shows notable enhancements in direct generation $( + 2 . 7 3 \\% )$ and selfrefinement $( + 3 . 9 4 \\% )$ . In contrast, ’Continual Training $( { \\cal D } _ { s e l f } ^ { t } \\ \\mathrm { O n l y } ) ^ { , }$ , which trains the model sequentially with self-evolution data from each round, demonstrates more modest gains $( + 0 . 3 8 \\%$ in direct generation, $+ 0 . 9 8 \\%$ in self-refinement). The relatively lower performance of the latter approach highlights the importance of a mixed data strategy for effective self-evolution training. ",
841
+ "page_idx": 14
842
+ },
843
+ {
844
+ "type": "text",
845
+ "text": "A.9 SELF VS. SUPERVISED FINE-TUNING ON $7 . 5 \\mathrm { K }$ GSM8K TRAINING DATA. ",
846
+ "page_idx": 14
847
+ },
848
+ {
849
+ "type": "text",
850
+ "text": "When fine-tuned on the GSM8K $7 . 5 \\mathrm { k }$ training set, the Vicuna model achieves an accuracy of $3 5 . 7 0 \\%$ lower than SELF $( 3 7 . 8 7 \\% )$ . ",
851
+ "page_idx": 14
852
+ },
853
+ {
854
+ "type": "table",
855
+ "img_path": "images/3bbd0e35ae9fd4acd26118706cc8d052c6087926b264fee939efeef40af067b3.jpg",
856
+ "table_caption": [
857
+ "Table 8: Comparison between SELF and Supervised Fine-Tuning "
858
+ ],
859
+ "table_footnote": [],
860
+ "table_body": "<table><tr><td rowspan=\"2\">Direct Generation (%)</td><td rowspan=\"2\">Self-Refinement (%)</td><td colspan=\"2\">Meta-Skill Learning</td><td colspan=\"2\">Self Evolution Process</td></tr><tr><td>DQA</td><td>Dmeta</td><td>1st round</td><td>2nd round</td></tr><tr><td>28.05</td><td></td><td>√</td><td></td><td></td><td></td></tr><tr><td>31.23</td><td>32.98</td><td>√</td><td></td><td></td><td></td></tr><tr><td>35.43</td><td>36.22</td><td>√</td><td></td><td></td><td></td></tr><tr><td>37.87</td><td>38.12</td><td>√</td><td>√</td><td></td><td>√</td></tr><tr><td>35.70</td><td></td><td>SFT</td><td>(GSM8K training data)</td><td></td><td></td></tr></table>",
861
+ "page_idx": 15
862
+ },
863
+ {
864
+ "type": "text",
865
+ "text": "The result of $2 9 . 6 4 \\%$ in Table 1 is derived from a meta-skill learning corpus of $3 . 5 \\mathrm { k }$ . Experiments in Table 8 are conducted using an expanded $7 . 5 \\mathrm { k }$ meta-skill data to ensure a fair comparison with the Supervised Fine-tuned model. ",
866
+ "page_idx": 15
867
+ },
868
+ {
869
+ "type": "text",
870
+ "text": "Table 8 shows that using $7 . 5 \\mathrm { k }$ unlabeled training prompts to construct the meta-skill learning corpus, The baseline model Vicuna $+ D _ { Q A }$ achieves $2 8 . 0 5 \\%$ . After meta-skill learning, the result of direct generation is $3 1 . 2 3 \\%$ , which improves to $3 2 . 9 8 \\%$ after self-refinement. In subsequent self-evolution rounds, performance continues to improve, reaching $3 7 . 8 7 \\%$ to $3 8 . 1 2 \\%$ in the second round. This surpasses the result of supervised fine-tuning $( 3 5 . 7 0 \\% )$ . ",
871
+ "page_idx": 15
872
+ },
873
+ {
874
+ "type": "text",
875
+ "text": "Continuous Improvement of SELF vs. Supervised Fine-tuning: SELF’s main advantage is its ability for continuous improvement and adaptation. Unlike supervised fine-tuning, SELF does not rely on human or external LLM (GPT3.5/GPT4) to annotate training data in the self-evolution training. ",
876
+ "page_idx": 15
877
+ },
878
+ {
879
+ "type": "text",
880
+ "text": "A.10 SCALABILITY OF SELF FRAMEWORK ",
881
+ "text_level": 1,
882
+ "page_idx": 15
883
+ },
884
+ {
885
+ "type": "text",
886
+ "text": "To explore how SELF performs with different starting model qualities, we conduct experiments using the OpenLlama-3b model (Geng & Liu, 2023), a smaller LLM along with a stronger LLM, VicunaV1.5(finetuned from Llama2-7b)l (Chiang et al., 2023), on the GSM8K dataset. This allows us to assess SELF’s adaptability to model quality. Experiments with SELF are based on the first round of self-evolution. The results are as follows: ",
887
+ "page_idx": 15
888
+ },
889
+ {
890
+ "type": "table",
891
+ "img_path": "images/d13e0f90502cdbbbe73dab4415f7adf93d3e364b0b50b0b45ede5330b8a1b5e3.jpg",
892
+ "table_caption": [
893
+ "Table 9: Scalability of SELF Framework Across Different Models "
894
+ ],
895
+ "table_footnote": [],
896
+ "table_body": "<table><tr><td>Model</td><td>Direct Generation (%)</td><td>Self-Refinement (%)</td></tr><tr><td>OpenLlama-3b</td><td>2.04</td><td>1.01</td></tr><tr><td>OpenLlama-3b + DQA</td><td>12.13</td><td>10.97</td></tr><tr><td>OpenLlama-3b + DQA + SELF</td><td>15.32</td><td>15.78</td></tr><tr><td>Vicuna (Llama-7b)</td><td>16.43</td><td>15.63</td></tr><tr><td>Vicuna + DQA</td><td>24.49</td><td>24.44</td></tr><tr><td>Vicuna + DQA + SELF</td><td>27.67</td><td>29.34</td></tr><tr><td>VicunaV1.5 (Llama2-7b)</td><td>18.5</td><td>17.43</td></tr><tr><td>VicunaV1.5 + DQA</td><td>26.04</td><td>25.48</td></tr><tr><td>VicunaV1.5 + DQA + SELF</td><td>30.22</td><td>32.43</td></tr></table>",
897
+ "page_idx": 15
898
+ },
899
+ {
900
+ "type": "text",
901
+ "text": "Applicability and Robustness of SELF Framework: The average improvement of $1 7 . 3 2 \\%$ via direct generation and $1 6 . 8 7 \\%$ after self-refinement underscores the framework’s scalability and efficacy. It reveals a consistent positive impact of the SELF Framework across diverse models. ",
902
+ "page_idx": 15
903
+ },
904
+ {
905
+ "type": "text",
906
+ "text": "SELF Framework exhibits enhanced performance on more powerful models: In the table 9, applying SELF to VicunaV1.5 exhibits the most significant performance, $3 0 . 2 2 \\%$ of direct generation and $3 2 . 4 3 \\%$ of self-refinement compared to Vicuna and OpenLlama-3b. It is evident that as the underlying model’s capabilities strengthen, the benefits introduced by the SELF framework also increase. ",
907
+ "page_idx": 15
908
+ },
909
+ {
910
+ "type": "text",
911
+ "text": "A.11 IMPACT OF META-SKILL LEARNING QUALITY ",
912
+ "text_level": 1,
913
+ "page_idx": 16
914
+ },
915
+ {
916
+ "type": "text",
917
+ "text": "We investigate how the quality of meta-skill learning influences the self-evolution process as follows: ",
918
+ "page_idx": 16
919
+ },
920
+ {
921
+ "type": "table",
922
+ "img_path": "images/f930c153f723227bf365c3b69c1db3d0e7ed6ab2db05da544f5d555d80f70c46.jpg",
923
+ "table_caption": [
924
+ "Table 10: Comparison of Training Methods on GPT-3.5-turbo/GPT4 "
925
+ ],
926
+ "table_footnote": [],
927
+ "table_body": "<table><tr><td>Training Stage</td><td>DirPt-3G.-turtion T4)</td><td>GPf-.5-urbent PT4)</td></tr><tr><td>Vicuna + meta-skill learning</td><td>24.84/25.39 (0.55个)</td><td>25.22/28.28 (3.06↑)</td></tr><tr><td>Vicuna + meta-skill learning + SELF</td><td>25.11/27.67 (2.561)</td><td>25.47/29.34 (3.871)</td></tr></table>",
928
+ "page_idx": 16
929
+ },
930
+ {
931
+ "type": "text",
932
+ "text": "The presented table 10 highlights substantial performance advancements achieved by employing GPT-4 to generate the meta-skill corpus within our SELF framework, as opposed to GPT-3.5-turbo. Specifically, the performance of direct generation and self-refinement exhibit noteworthy improvements across both training stages when utilizing GPT-4. For example, in the ”Vicuna $^ +$ meta-skill learning” phase, the result of direct generation increases from $2 4 . 8 4 \\%$ (GPT-3.5-turbo) to $2 5 . 3 9 \\%$ (GPT-4), reflecting a significant gain of $0 . 5 5 \\%$ . Similarly, in the ”Vicuna $^ +$ meta-skill learning $^ +$ SELF” stage, the result of self-refinement rises from $2 5 . 4 7 \\%$ (GPT-3.5-turbo) to $2 9 . 3 4 \\%$ (GPT-4), indicating a substantial enhancement of $3 . 8 7 \\%$ . ",
933
+ "page_idx": 16
934
+ },
935
+ {
936
+ "type": "text",
937
+ "text": "This study underscores the crucial impact of high-quality meta-skill training data on Vicuna model performance within the SELF framework. Transitioning from GPT-3.5-turbo to GPT-4 for meta-skill corpus generation consistently improves Direct Generation and Self-Refinement metrics. ",
938
+ "page_idx": 16
939
+ },
940
+ {
941
+ "type": "text",
942
+ "text": "A.12 SINGLE VS. MULTIPLE ROUNDS OF SELF-EVOLUTION",
943
+ "text_level": 1,
944
+ "page_idx": 16
945
+ },
946
+ {
947
+ "type": "text",
948
+ "text": "Given the same number of prompts, we compare the effect of training with a single round versus training iteratively, to assess the difference between a static and an improved model as a selfevolution training data generator as follows: ",
949
+ "page_idx": 16
950
+ },
951
+ {
952
+ "type": "table",
953
+ "img_path": "images/a1c1f1130a2d75d1495db9ed0748a21a999796eda2fe0ec6c4fd9508b13af8d7.jpg",
954
+ "table_caption": [
955
+ "Table 11: Comparison of Single-Round Training and Iterative Training "
956
+ ],
957
+ "table_footnote": [],
958
+ "table_body": "<table><tr><td>Training Method</td><td>Direct Generation (%)</td><td>Self-Refinement (%)</td></tr><tr><td>SELF (Single Round)</td><td>28.40</td><td>30.55</td></tr><tr><td>SELF (Iterative)</td><td>29.64</td><td>31.31</td></tr></table>",
959
+ "page_idx": 16
960
+ },
961
+ {
962
+ "type": "text",
963
+ "text": "Table 11 shows that in a single round, the performance is $2 8 . 4 0 \\%$ for direct generation and $3 0 . 5 5 \\%$ for self-refinement. The iterative approach shows higher scores $( 2 9 . 6 4 \\% )$ for direct generation and $3 1 . 3 1 \\%$ for self-refinement. ",
964
+ "page_idx": 16
965
+ },
966
+ {
967
+ "type": "text",
968
+ "text": "Advantages of Iterative Training: The iterative method benefits from improved LLMs in later rounds, producing higher-quality training data and, consequently, enhanced test performance. ",
969
+ "page_idx": 16
970
+ }
971
+ ]
parse/test/XD0PHQ5ry4/XD0PHQ5ry4_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/XD0PHQ5ry4/XD0PHQ5ry4_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/ZG3RaNIsO8/ZG3RaNIsO8.md ADDED
@@ -0,0 +1,496 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CONNECTING LARGE LANGUAGE MODELS WITH EVOLUTIONARY ALGORITHMS YIELDS POWERFUL PROMPT OPTIMIZERS
2
+
3
+ Qingyan $\mathbf { G u o ^ { 1 2 \dag * } }$ , Ru $\mathbf { i } \ \mathbf { W } \mathbf { a n g } ^ { 2 \dagger }$ , Junliang $\mathbf { G u o ^ { 2 } }$ , Bei $\mathbf { L i ^ { 2 3 } }$ , Kaitao Song2, $\mathbf { X } \mathbf { u } \ \mathbf { T a n } ^ { 2 \ddagger }$ ,
4
+ Guoqing Liu2, Jiang Bian2, Yujiu Yang1‡
5
+ 1Tsinghua University 2Microsoft Research 3Northeastern University
6
+ gqy22@mails.tsinghua.edu.cn, libei_neu@outlook.com,
7
+ {ruiwa,junliangguo,kaitaosong,xuta,guoqingliu,jiabia}@microsoft.com
8
+ yang.yujiu@sz.tsinghua.edu.cn
9
+
10
+ # ABSTRACT
11
+
12
+ Large Language Models (LLMs) excel in various tasks, but they rely on carefully crafted prompts that often demand substantial human effort. To automate this process, in this paper, we propose a novel framework for discrete prompt optimization, called EVOPROMPT, which borrows the idea of evolutionary algorithms (EAs) as they exhibit good performance and fast convergence. To enable EAs to work on discrete prompts, which are natural language expressions that need to be coherent and human-readable, we connect LLMs with EAs. This approach allows us to simultaneously leverage the powerful language processing capabilities of LLMs and the efficient optimization performance of EAs. Specifically, abstaining from any gradients or parameters, EVOPROMPT starts from a population of prompts and iteratively generates new prompts with LLMs based on the evolutionary operators, improving the population based on the development set. We optimize prompts for both closed- and open-source LLMs including GPT-3.5 and Alpaca, on 31 datasets covering language understanding, generation tasks, as well as BIG-Bench Hard (BBH) tasks. EVOPROMPT significantly outperforms human-engineered prompts and existing methods for automatic prompt generation (e.g., up to $2 5 \%$ on BBH). Furthermore, EVOPROMPT demonstrates that connecting LLMs with EAs creates synergies, which could inspire further research on the combination of LLMs and conventional algorithms. Our code is available at https://github.com/beeevita/EvoPrompt.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Large language models (LLMs) show remarkable performance on multiple natural language processing (NLP) tasks (Touvron et al., 2023; Ouyang et al., 2022). To adapt to downstream tasks, simply adding an instruction to the input text, also called discrete prompt, steers LLMs to carry out the desired task with negligible impact on computational cost (Liu et al., 2023). Such approach also eliminates the need for all the parameters and gradients in LLMs, making it suitable for LLMs with block-box APIs such as GPT-3 and GPT-4 (Brown et al., 2020; OpenAI, 2023). Despite the convenience, the performance of the LLMs towards a certain task is significantly influenced by the prompt (Liu et al., 2023; Zhu et al., 2023). Accordingly, the key challenge of this approach lies in the design of the prompt, which has emerged as a crucial technique known as prompt engineering (Zhou et al., 2022). Given the wide variation in prompts across language models and tasks, the prompt design typically requires substantial human effort and expertise with subjective and relatively limited guidelines (Mishra et al., 2022a;b; Liu et al., 2023; Zamfirescu-Pereira et al., 2023; Wang et al., 2023).
17
+
18
+ To alleviate human effort on discrete prompt design, previous approaches usually rely on access to the token probabilities from the output layer of LLMs, which may not always be accessible through APIs (Deng et al., 2022; Zhang et al., 2023a). Some recent works consider enumerating diverse prompts and selecting the best ones (Zhou et al., 2022; Jiang et al., 2020), or modifying current prompts to improve them (Guo et al., 2023; Prasad et al., 2022; Pryzant et al., 2023). Such approaches either emphasize exploring diverse prompts, which may lead to indecisiveness and wasted resources, or focus on exploiting upon the current identified good prompts, which may result in stagnation and confine the search to local optima. Several conventional derivative-free algorithms are well-designed and strike a good balance between exploration and exploitation (Conn et al., 2009; Rios & Sahinidis, 2013). Among these, evolutionary algorithms (EAs) stand out as they are simple and efficient, as well as suitable for discrete prompt optimization (Storn & Price, 1997; Brest et al., 2006; Zhang & Sanderson, 2009; Vesterstrom & Thomsen, 2004). Sequences of phrases in prompts can be regarded as gene sequences in typical EAs, making them compatible with the natural evolutionary process.
19
+
20
+ In this paper, we borrow the idea of EAs and propose a discrete prompt tuning framework, EVOPROMPT. While evolutionary operators in EAs are typically designed for sequences, they tend to independently alter tokens to generate new candidate solutions. Unfortunately, this approach ignores the connections among tokens, which is crucial for maintaining coherence and readability in prompts. Taking advantage of LLMs’ expertise in NLP and the exceptional optimization capabilities of EAs, we connect these two approaches, where LLMs generate new candidate prompts following evolutionary operators, and EAs guide the optimization process to retain the optimal prompts.
21
+
22
+ Specifically, based on several initial prompts, we utilize LLMs to act as evolutionary operators to generate new prompt candidates, and the prompt with better performance on the development set is preserved. The above operations upon the updating population are iteratively applied to improve the quality. By elaborately designing the evolutionary operators and adjusting the update strategy, EVOPROMPT can be instantiated with various types of EAs. We optimize the prompts for two different LLMs (i.e., Alpaca (Taori et al., 2023), and GPT-3.5 (Brown et al., 2020)) on a diverse range of neural language understanding and generation tasks, as well as challenging BIG-Bench tasks, using a total of 31 datasets. EVOPROMPT consistently gets better prompts compared with both manually designed ones and previous automatic prompt generation methods. The main contributions of this paper include:
23
+
24
+ • We propose a novel framework for automatic discrete prompt optimization connecting LLMs and EAs, called EVOPROMPT, which enjoys the following advantages: 1) It does not require access to any parameters or gradients of LLMs; 2) It strikes a balance between exploration and exploitation leading to better results; 3) The generated prompts are human-readable. • Experiments conducted on 31 datasets demonstrate the effectiveness of EVOPROMPT compared with crafted prompts, as well as existing methods. We release the optimal prompts obtained by EVOPROMPT for these common tasks such as sentiment classification, topic classification, subjectivity classification, simplification, summarization and reasoning. • We demonstrate that LLMs are capable of implementing multiple types of EAs provided with appropriate instructions. We hope that our explorations will inspire further investigations on the combination of LLMs and conventional algorithms, paving the way for new and innovative applications of LLMs.
25
+
26
+ # 2 RELATED WORKS
27
+
28
+ Prompts in LLMs Prompting is an efficient method for employing LLMs in specialized tasks. However, the performance is heavily influenced by the choice of the prompt. Recently, automatic prompt optimization has obtained wide attention. Continuous prompt-based methods, which only tune parameters of some input tokens (Li & Liang, 2021; Liu et al., 2021b;a; Zhang et al., 2021) attract lots of attention. In spite of their effective performance, two drawbacks of such paradigms can not be ignored: 1) The optimization of continuous prompts requires parameters of LLMs that are inaccessible for black-box APIs. 2) Soft prompts often fall short of interpretability (Lester et al., 2021). Discrete prompts, simply adding several discrete tokens, such as “It was” (Schick & Schütze, 2021), or task-specific descriptive instructions, such as “Classify the comment into positive or negative.”, to the input text, can offer an interactive interface to humans with better interpretability and show promising performance in various NLP tasks (Liu et al., 2023).
29
+
30
+ Discrete Prompts Various approaches have been proposed for automatic discrete prompt searching and generation (Shin et al., 2020; Shi et al., 2022; Wallace et al., 2019; Deng et al., 2022; Zhang et al., 2023a), while these methods still rely on the gradients or the token probabilities from the output layer. More recently, considering the high variance of different prompts for downstream tasks, some works focus on exploration by enumerating and selecting the best prompt from a number of candidates, mainly augmented by re-sampling (Zhou et al., 2022; Jiang et al., 2020). Approaches based on prompt edit (Zhang et al., 2023a; Prasad et al., 2022) emphasize exploitation, which may potentially lead to local optima. Another approach collects the incorrectly predicted cases and analyzes the corresponding root cause to improve existing prompts (Pryzant et al., 2023; Guo et al., 2023), which also emphasizes exploitation. Additionally, such approaches are constrained to tasks with standard answers and cannot be directly applied to generation tasks. Our proposed EVOPROMPT empowered with evolutionary algorithms strikes a balance between exploration and exploitation without requiring any parameters or gradients.
31
+
32
+ LLMs and Optimization Algorithms LLMs demonstrate the potential to serve as black-box optimizers (Zheng et al., 2023); however, this black-box approach lacks explainability. Some works have revealed that LLMs have the capability to imitate specific operations in conventional algorithms. For instance, LLMs can perform “Gradient Descent” in discrete space by collecting incorrectly predicted samples (Pryzant et al., 2023; Guo et al., 2023). Meanwhile, it has been demonstrated that LLMs can imitate the mutation (Lehman et al., 2022) or crossover (Meyerson et al., 2023) operator in the genetic algorithm (GA). Chen et al. (2023) further integrates LLMs and GA for neural architecture search, while Lanzi & Loiacono (2023) introduce a similar approach to game design. Our work has taken a significant step forward by proposing a general framework that connects LLMs with evolutionary algorithms, which can be instantiated to a diverse range of evolutionary algorithms through customization of evolutionary and selection processes, thereby broadening its applicability and potential influence in the domain. We aspire this work to inspire broader applications of combining LLMs and conventional algorithms.
33
+
34
+ # 3 AUTOMATIC DISCRETE PROMPT OPTIMIZATION
35
+
36
+ # Algorithm 1 Discrete prompt optimization: EVOPROMPT
37
+
38
+ Require: Initial prompts $P _ { 0 } = \{ p _ { 1 } , p _ { 2 } , . . . , p _ { N } \}$ , size of population $N$ , a dev set $\mathcal { D }$ , $f _ { \mathcal { D } } ( \cdot )$ denotes the score of a prompt on the desired LLM evaluated on $\mathcal { D }$ , a pre-defined number of iterations $T$ , carefully designed evolutionary operators to generate a new prompt $\operatorname { E v o } ( { \cdot } )$
39
+ 1: Initial evaluation scores: $S _ { 0 } \gets \{ s _ { i } = f _ { \mathcal { D } } ( p _ { i } ) | i \in [ 1 , N ] \}$
40
+ 2: for $t = 1$ to $T$ do
41
+ 3: Selection: select a certain number of prompts from current population as parent prompts $p _ { r _ { 1 } } , . . . , p _ { r _ { k } } \sim P _ { t - 1 }$
42
+ 4: Evolution: generate a new prompt based on the selected parent prompts by leveraging LLM to perform evolutionary operators $\bar { p _ { i } ^ { \prime } } \gets \mathrm { E v o } ( p _ { r _ { 1 } } , \dots , p _ { r _ { k } } )$
43
+ 5: Evaluation: $s _ { i } ^ { \prime } \gets f ( p _ { i } ^ { \prime } , \mathcal { D } )$
44
+ 6: Update: $P _ { t } \gets \{ P _ { t - 1 } , p _ { i } ^ { \prime } \}$ and $S _ { t } \gets \{ S _ { t - 1 } , s _ { i } ^ { \prime } \}$ based on the evaluation scores
45
+ 7: end for
46
+ 8: Return the best prompt, $p ^ { * }$ , among the final population $P _ { T } \colon p ^ { * } \gets a r g m a x _ { p \in P _ { T } } f ( p , \mathcal { D } )$
47
+
48
+ Current advanced LLMs are typically interacted via black-box APIs, while the gradients and parameters are inaccessible. Evolutionary algorithms (EAs) are derivative-free algorithms with exceptional accuracy and rapid convergence. Accordingly, we consider introducing EAs into discrete prompt optimization. However, to generate new candidate solutions, evolutionary operators typically edit the elements in current solutions independently, without considering the connections between them. This makes it challenging to apply evolutionary operators on discrete prompts, which require coherence and readability. To address this challenge, we propose a synergistic approach that connects the natural language processing expertise of LLMs with the optimization capabilities of EAs, called EVOPROMPT. Specifically, LLMs generate new candidate prompts based on evolutionary operators, while EAs guide the optimization process to find the optimal prompts.
49
+
50
+ ![](images/1338592ccc61ce0436ed0715933d8bd7ddb27e71c773db01de182103b3d023de.jpg)
51
+ Figure 1: GA process implemented by LLMs $( \mathrm { E v o } ( \cdot )$ in Algorithm 1). In Step 1, LLMs perform crossover on the given two prompts (words in orange and blue are inherited from Prompt 1 and Prompt 2, respectively). In Step 2, LLMs perform mutation on the prompt.
52
+
53
+ In order to implement EVOPROMPT in practice, it is necessary to instantiate it with a specific algorithm of EAs. There are various types of EAs, and in this paper, we consider two widely used algorithms, including Genetic Algorithm (GA) (Holland, 1975) and Differential Evolution (DE) (Storn & Price, 1997). GA is among the most highly regarded evolutionary algorithms (Holland, 1975; 1992; Mitchell, 1998; Mirjalili et al., 2020) and DE has emerged as one of the most widely utilized algorithms for complex optimization challenges since its inception (Storn & Price, 1997; Price, 2013; Das & Suganthan, 2010; Pant et al., 2020). In the following, we will first outline the proposed EVOPROMPT, and then instantiate EVOPROMPT with GA and DE respectively.
54
+
55
+ # 3.1 FRAMEWORK OF EVOPROMPT
56
+
57
+ EAs typically start with an initial population of $N$ solutions (prompts in our setting), then iteratively generate new solutions using evolutionary operators (e.g., mutation and crossover) on the current population and update it based on a fitness function. Following typical EAs, EVOPROMPT mainly contains three steps:
58
+
59
+ • Initial population: Contrary to most existing automatic prompt methods that neglect priori human knowledge, we apply available manual prompts as the initial population to leverage the wisdom of humans. Besides, EAs typically start from random solutions, resulting in a diverse population and avoiding being trapped in a local optimum. Accordingly, we also introduce some prompts generated by LLMs (Zhou et al., 2022) into the initial population.
60
+ • Evolution: In each iteration, EVOPROMPT uses LLMs as evolutionary operators to generate a new prompt based on several parent prompts selected from the current population. To accomplish this, we design steps of the mutation and crossover operators for each specific type of EAs, along with corresponding instructions to guide the LLMs in generating new prompts based on these steps.
61
+ • Update: We evaluate the generated candidate prompts on a development set and retain those with superior performance, similar to the survival of the fittest in nature. The specific updating strategy may vary depending on the type of EAs used.
62
+
63
+ The algorithm stops when the number of iterations reaches a predefined value. The details of EVOPROMPT are outlined in Algorithm 1. When instantiating EVOPROMPT with a specific algorithm of EAs, the evolutionary processes need to be adjusted, and the key challenge is to design the evolutionary operators on discrete prompts.
64
+
65
+ # Differential Evolution (DE) Algorithm Implemented by LLMs
66
+
67
+ # Query:
68
+
69
+ ![](images/a3c012523256d63ca23bc99546d9f9d144dae78d44201f0a4a63df7e8706ded7.jpg)
70
+ Figure 2: DE process implemented by LLMs $( \mathrm { E v o } ( \cdot )$ in Algorithm 1). In Step 1, LLMs find the different parts (words in ■ and ■) between Prompt 1 and Prompt 2 $( \mathbf { b } - \mathbf { c }$ in typical DE). In Step 2, LLMs perform mutation (words in ■ ) on them (imitation of $\mathbf { F } ( \mathbf { b } - \mathbf { c } ) ,$ ). Next, LLMs incorporate the current best prompt as Prompt 3 with the mutated results in Step 2, to generate a new prompt (counterpart of $\mathbf { a } + \mathbf { F } ( \mathbf { b } - \mathbf { c } )$ in DE). Finally, LLMs perform crossover upon the current basic prompt $p _ { i }$ and the generated prompt in Step 3. See Figure 5 in Appendix B.2 for the complete response.
71
+
72
+ # 3.2 INSTANTIATION WITH GENETIC ALGORITHM
73
+
74
+ Selection In GA, parent solutions are conventionally selected using the roulette wheel selection method, guided by their fitness values (Lipowski & Lipowska, 2012). Analogously, we employ the roulette wheel selection to choose two parent prompts from the current population, based on their performance scores obtained on the development sets. Let $s _ { i }$ denote the performance score of the $i$ -th prompt within a population containing $N$ prompts. The probability of selecting the $i$ -th prompt as a parent can be expressed as $\begin{array} { r } { p _ { i } = s _ { i } / \sum _ { j = 1 } ^ { N } s _ { j } } \end{array}$ .
75
+
76
+ Evolution Conforming to the GA framework, we generate a new candidate prompt via two steps: 1) Crossover is performed between the parent prompts to produce a new offspring prompt that inherits characteristics from both parents; 2) Mutation is applied to the offspring prompt, introducing random alterations to certain elements. We formalize this two-stage operation into algorithmic instructions for guiding LLMs to implement $\operatorname { E v o } ( { \cdot } )$ in Algorithm 1. The entire process is illustrated in Figure 1.
77
+
78
+ Update We employ a straightforward selection strategy for updating the population: at each iteration, EVOPROMPT produces $N$ new prompts, which are merged with the existing population of $N$ prompts. Subsequently, the top $N$ prompts, based on their scores, are retained to form the updated population. Accordingly, the overall quality of the population undergoes continuous enhancement, culminating in the selection of the best one within the final population as the optimal prompt.
79
+
80
+ # 3.3 INSTANTIATION WITH DIFFERENTIAL EVOLUTION
81
+
82
+ Here, we begin with some preliminary knowledge of DE. Unlike GA, the solutions of DE are represented by numerical vectors. Each vector within the population is sequentially selected as a base vector, denoted as $\mathbf { x }$ , which subsequently undergoes mutation and crossover. During mutation, a mutated solution y is generated from a randomly selected solution a from the current population. The mutation is achieved by adding a scaled difference between two distinct, randomly selected solutions b and $\mathbf { c }$ to a, i.e., $\mathbf { y } = \mathbf { a } + F ( \mathbf { b } - \mathbf { c } )$ , where $F$ is the scaled parameter.
83
+
84
+ Crossover is to generate a trial solution $\mathbf { x } ^ { \prime } = [ x _ { 1 } ^ { \prime } , . . . , x _ { n } ^ { \prime } ]$ by choosing each parameter in the vector from either the basic solution $\mathbf { x }$ or the mutated solution y. Then, $\mathbf { x }$ is replaced with $\mathbf { x } ^ { \prime }$ if $\mathbf { x } ^ { \prime }$ is better than x. Within step-by-step evolution, DE ends with a population of high quality. A modified version of DE uses the current best solution as vector a to exploit information from the best one.
85
+
86
+ Evolution The evolutionary process of DE can be decoupled into three steps: 1) $F ( \mathbf { b } - \mathbf { c } )$ ; 2) ${ \bf y } = { \bf a } + F ( { \bf b } - { \bf c } ) ; 3 )$ Crossover of $\mathbf { x }$ and y. In EVOPROMPT based on DE, we follow the three steps to design the evolutionary process, as well as the corresponding instructions for LLMs to generate a new prompt based on these steps as illustrated in Figure 2:
87
+
88
+ • Inspired by the differential vector in DE, we consider mutating only the different parts of two randomly selected prompts in the current population (Step 1 and Step 2 in Figure 2). The prompts in the current population are considered the current best ones. Accordingly, the shared components of two prompts tend to have a positive impact on the performance, and thus need to be preserved. • A variant of DE employs the current best vector during the mutation process, where a mutated vector is generated by adding the scale of the differential vector to the current best vector. Building upon this idea, we generate a mutated prompt by selectively replacing parts of the current best one with the mutated different parts for combination. (Step 3 in Figure 2). • Crossover replaces certain components of a basic prompt (i.e., a candidate of the current population) with segments from the mutated prompt. This operation combines the features of two different prompts, potentially creating a new and improved solution (Step 4 in Figure 2).
89
+
90
+ Update Following the standard DE, each prompt $p _ { i }$ in the current population is chosen as a basic prompt in turn to generate a corresponding new prompt $p _ { i } ^ { \prime }$ using the instruction in Figure 2. Then, the prompt with a higher score, either $p _ { i }$ or $p _ { i } ^ { \prime }$ , is retained. Accordingly, the population size remains constant while the overall quality of the population is enhanced.
91
+
92
+ # 4 EXPERIMENTS
93
+
94
+ # 4.1 IMPLEMENTATION DETAILS AND BASELINES
95
+
96
+ With GPT-3.5 performing evolutionary operators, we optimize prompts using EVOPROMPT for the open-source Alpaca-7b (Taori et al., 2023) and closed-source GPT-3.5 (text-davinci-003) (Brown et al., 2020). We pick the prompt with the highest score on the development set and report its score on the test set. Results reported on Alpaca are averaged over 3 random seeds and the standard deviation is provided, while for GPT-3.5, we report results of one seed due to budget limitation. In our evaluation, we compare EVOPROMPT against three categories of prompt-based approaches, detailed as follows:
97
+
98
+ • Manual Instructions (MI): These serve as task-specific guidelines and are crafted based on established works, specifically referenced from Zhang et al. (2023b) for language understanding, Sanh et al. (2021) for summarization, and Zhang et al. (2023c) for text simplification. • PromptSource (Bach et al., 2022) and Natural Instructions (NI) (Mishra et al., 2022b): These repositories aggregate human-composed prompts across a diverse range of datasets. • APE (Zhou et al., 2022) and APO (Pryzant et al., 2023): APE employs an iterative Monte Carlo Search strategy, emphasizing on exploration. We reproduce it and initialize populations of equivalent sizes to that of EVOPROMPT. APO harnesses incorrectly predicted instances as “pseudo-gradient” to iteratively refine the original prompt, which emphasizes exploitation. We reproduce APO on binary classification tasks with the optimal manual prompt as the initial one.
99
+
100
+ Table 1: Main results on language understanding (accuracy) on Alpaca-7b.
101
+
102
+ <table><tr><td>Method</td><td>| SST-2</td><td>CR</td><td>MR</td><td>SST-5</td><td>AG&#x27;s News</td><td>TREC</td><td>Subj</td><td> Avg.</td></tr><tr><td>MI (Zhang et al., 2023b) NI (Mishra et al., 2022c)</td><td>93.68 92.86</td><td>91.40</td><td>88.75</td><td>42.90</td><td>70.63</td><td>50.60</td><td>49.75</td><td>71.07</td></tr><tr><td>PromptSource (Bach et al.,2022)</td><td></td><td>90.90</td><td>89.60</td><td>48.64</td><td>48.89</td><td>55.00</td><td>52.55</td><td>68.21</td></tr><tr><td></td><td>93.03</td><td>-</td><td>=</td><td>-</td><td>45.43</td><td>36.20</td><td></td><td>-</td></tr><tr><td>APE (Zhou et al., 2022)</td><td>93.45(0.14)</td><td>91.13(0.45)</td><td>89.98(0.29)</td><td>46.32(0.49)</td><td>71.76(2.81)</td><td>58.73(1.37)</td><td>64.18(0.59)</td><td>73.80</td></tr><tr><td>APO (Pryzant et al., 2023)</td><td>93.87(0.39)</td><td>91.20(0.04)</td><td>89.85(0.35)</td><td>1</td><td>1</td><td>1</td><td>70.55(1.02)</td><td>1</td></tr><tr><td>EVOPROMPT(GA)</td><td>95.13(0.21)</td><td>91.27(0.06)</td><td>90.07(0.25)</td><td>49.91(0.61)</td><td>72.81(0.61)</td><td>64.00(0.16)</td><td>70.55(2.58)</td><td>76.25</td></tr><tr><td>EVOPROMPT (DE)</td><td>94.75(0.21)</td><td>91.40(0.04)</td><td>90.22(0.09)</td><td>49.89(1.73)</td><td>73.82(0.35)</td><td>63.73(1.54)</td><td>75.55(2.26)</td><td>77.05</td></tr></table>
103
+
104
+ <table><tr><td rowspan="2">Method</td><td colspan="3">Alpaca</td><td colspan="3">GPT-3.5</td></tr><tr><td>| ROUGE-1</td><td>ROUGE-2</td><td>ROUGE-L</td><td>ROUGE-1</td><td>ROUGE-2</td><td>ROUGE-L</td></tr><tr><td>MI (Sanh et al., 2021) APE (Zhou et al., 2022)</td><td>35.92 35.44(0.79)</td><td>11.16</td><td>31.67</td><td>43.95</td><td>17.11</td><td>39.09</td></tr><tr><td>EvOPROMPT(GA) EVOPROMPT (DE)</td><td>38.46(1.45) 39.46(0.51)</td><td>10.60(0.38) 13.36(0.75) 13.93(0.33)</td><td>31.80(0.50) 34.20(1.40)</td><td>43.43 45.22</td><td>16.72 18.52</td><td>38.25 41.06</td></tr></table>
105
+
106
+ Table 2: Main results on SAMSum dataset (summarization task) for Alpaca-7b and GPT-3.5.
107
+
108
+ # 4.2 LANGUAGE UNDERSTANDING
109
+
110
+ Datasets and Settings We first conduct experiments on language understanding tasks across 7 datasets to validate our methods, including sentiment classification (SST-2 (Socher et al., 2013), MR (PANG, 2005), CR (Hu & Liu, 2004), SST-5 (Socher et al., 2013)), topic classification (AG’s News (Zhang et al., 2015), TREC (Voorhees & Tice, 2000)) and subjectivity classification (Subj (Pang & Lee, 2004)). To constrain the output label space, we prepend the demonstration consisting of one example per class before the test case. See Appendix B for more details.
111
+
112
+ Main Results Table 1, shows that: 1) Compared with previous works on prompt generation and human written instructions, EVOPROMPT based on both GA and DE delivers significantly better results. 2) EVOPROMPT (GA) is slightly better than EVOPROMPT (DE) on sentiment classification datasets. When it comes to topic classification datasets, EVOPROMPT (DE) performs better. Notably, on the subjectivity classification task (Subj), EVOPROMPT (DE) exhibits a substantial improvement over its GA counterpart, achieving a $5 \%$ accuracy advantage. This may be contributed by the exceptional ability of DE to evade local optima when the initial prompts are not of high quality.
113
+
114
+ # 4.3 LANGUAGE GENERATION
115
+
116
+ Datasets and Settings For language generation, we evaluate our EVOPROMPT on text summarization and simplification tasks. For summarization, we adopt SAMSum (Gliwa et al., 2019), a challenging and intricate dialogue summarization dataset, and report ROUGE-1/2/L scores on Alpaca-7b and GPT-3.5. For text simplification, which aims to simplify the source text while preserving its original meaning, we employ the ASSET dataset (Alva-Manchego et al., 2020), a
117
+
118
+ Table 3: Main results (SARI) on simplification (ASSET) for Alpaca-7b and GPT3.5.
119
+
120
+ <table><tr><td>Method</td><td>| Alpaca</td><td>GPT-3.5</td></tr><tr><td>MI (Zhang et al., 2023c)</td><td>43.03</td><td>43.80</td></tr><tr><td>APE (Zhou et al., 2022)</td><td>45.90(0.09)</td><td>46.71</td></tr><tr><td>EVOPROMPT (GA)</td><td>46.43(0.19)</td><td>47.36</td></tr><tr><td>EVOPROMPT (DE)</td><td>46.21(0.27)</td><td>47.40</td></tr></table>
121
+
122
+ benchmark known for its multiple reference translations. We apply SARI score (Xu et al., 2016) as the evaluation metric, an n-gram-based scoring system extensively utilized for text editing tasks. Additional details regarding our experimental setup can be found in Appendix B.
123
+
124
+ Main Results The summarization and simplification results are presented in Tables 2 and 3. EVOPROMPT achieves a substantial performance gain over manually designed prompts, exhibiting an improvement of over 3 points in SARI scores across both Alpaca and GPT-3.5 API. Furthermore, EVOPROMPT consistently outperforms the APE approach across the evaluated scenarios, indicating that the generated prompts effectively harness the capabilities of LLMs for superior performance. Moreover, EVOPROMPT (DE) notably outperforms EVOPROMPT (GA) in the summarization task, while demonstrating comparable performance in the text simplification task. This suggests that the DE variant is particularly effective for more complex language generation tasks like summarization.
125
+
126
+ ![](images/e5ead9d2a54fee97e970a2a5d948ebd04085531128bca9bad4d576caa783aad6.jpg)
127
+ Figure 3: Normalized scores on BBH tasks for EVOPROMPT (GA) and EVOPROMPT (DE).
128
+
129
+ # 4.4 BIG BENCH HARD (BBH)
130
+
131
+ Datasets and Settings To validate our methods on diverse tasks, we apply BBH (Suzgun et al., 2022) including a suite of 23 challenging BIG-Bench tasks requiring multi-step reasoning. Since these tasks are challenging, we focus on optimizing the prompts for GPT-3.5. We sample a subset from the test set as the development set and report the normalized scores1 in comparison to the prompt “Let’s think step by step.” (Kojima et al., 2022) with 3-shot Chain-of-Thought demonstrations (following Fu et al. (2023)) on the test set. We use task IDs to simplify the denotation of each task and remove one since the accuracy already reaches $100 \%$ with the manual prompt. Please see Appendix C.2 and Table 17 for details, as well as further comparisons with previous works.
132
+
133
+ Main Results EVOPROMPT obtains better prompts for all 22 tasks (Figure 3). Specifically, EVOPROMPT (DE) achieves up to a $2 5 \%$ improvement with an average of $3 . 5 \%$ , whereas EVOPROMPT (GA) reaches a peak improvement of $15 \%$ with a $2 . 5 \%$ average. Though for some tasks the GA counterpart outperforms the DE version, the performance gap remains relatively small (i.e., around $1 \%$ ). Meanwhile, EVOPROMPT (DE) surpasses EVOPROMPT (GA) by over $2 \%$ on 6 tasks. Accordingly, the DE version is generally a good choice for these challenging tasks.
134
+
135
+ # 5 ANALYSIS
136
+
137
+ # 5.1 DESIGNS IN GA
138
+
139
+ For EVOPROMPT (GA), we apply the roulette wheel selection strategy by default to select parental prompts, contributing to the offspring. To further explore the effect of various selection strategies, we compare our approach with another two popular strategies, i.e., tournament (Wikipedia contributors, 2023) and random selection, as presented in Table 4.
140
+
141
+ <table><tr><td> Strategy</td><td>SST-5</td><td>ASSET</td><td>Avg.</td></tr><tr><td>random</td><td>48.67(0.97)</td><td>46.32(0.32)</td><td>47.50</td></tr><tr><td>tournament</td><td>49.70(0.60)</td><td>46.29(0.18)</td><td>48.00</td></tr><tr><td>wheel</td><td>49.91(0.61)</td><td>46.43(0.19)</td><td>48.17</td></tr></table>
142
+
143
+ Table 4: Designs in EVOPROMPT (GA).
144
+
145
+ We observe that EVOPROMPT (GA) with roulette wheel achieves higher scores, showcasing the effectiveness of this selection method.
146
+
147
+ # 5.2 DESIGNS IN DE
148
+
149
+ For EVOPROMPT (DE), we delve into two key design considerations in adapting the evolutionary operators of DE to discrete prompts: 1) mutation on different parts, and 2) choosing the current top-performing prompt as “Prompt $3 ^ { \circ }$ in Figure 2. We assess the impact of these design choices on two datasets: Subj, an understanding dataset where EVOPROMPT (DE) outperforms EVOPROMPT (GA), and ASSET, a generation dataset where both variants demonstrate similar performance.
150
+
151
+ Mutation on Different Parts To illustrate the benefits of mutating only the different parts, we replace the first two steps in Figure 2 with the instruction “Randomly mutate Prompt 1 and Prompt $2 ^ { \circ }$ to allow mutation on all contents in Prompts 1 and 2, denoted as “All” in Table 5. Meanwhile, the original design in EVOPROMPT, which mutates only the different parts, is denoted
152
+
153
+ as “Diff”. As shown in Table 5, the design of mutation on only the different parts consistently yields performance gains across two tasks.
154
+
155
+ <table><tr><td>Mutation</td><td>Prompt 3</td><td>Subj</td><td>ASSET</td></tr><tr><td>Diff</td><td>best</td><td>75.55(2.26)</td><td>46.21(0.27)</td></tr><tr><td>All</td><td>best</td><td>69.87(0.82)</td><td>45.73(0.45)</td></tr><tr><td>Diff</td><td>random</td><td>69.82(2.47)</td><td>45.89(0.37)</td></tr><tr><td>Diff</td><td>eliminate</td><td>69.07(4.21)</td><td>45.90(0.23)</td></tr></table>
156
+
157
+ Table 5: Designs in EVOPROMPT (DE).
158
+
159
+ Selection of Prompt 3 Applying one of the variants of the DE algorithm, in EVOPROMPT (DE), we pick the best prompt in the current population as Prompt 3 in Figure 2. We validate this design via the following settings: 1) Prompt 3 is randomly sampled from the current population, denoted as “random” in Table 5; 2) Eliminate the use of Prompt 3 by letting the Basic Prompt directly cross over with the mutated different parts (i.e., remove Step 3 in Figure 2), denoted as “eliminate” in Tabel 5. Table 5 clearly demonstrates the importance of introducing Prompt 3. Moreover, it is shown that choosing the best prompt as Prompt 3 is more effective than random sampling.
160
+
161
+ # 5.3 POPULATION INITIALIZATION
162
+
163
+ We investigate the effect of initial population quality on EVOPROMPT. We conduct pilot experiments to sort the prompts (designed manually or generated by GPT-3.5) according to their performance on the dev set. We then select bottom, random and top prompts along with their corresponding variations as initial prompts. These variations are generated using the resampling template designed in Zhou et al. (2022), shown in Figure 4 in the Appendix B.2, which is used to introduce randomness to the initialization.
164
+
165
+ Table 6 demonstrates that: 1) Crafted design of initial prompts is not essential, as randomly selecting prompts can achieve a similar performance to select
166
+
167
+ <table><tr><td>Initialization</td><td>GA</td><td>DE</td></tr><tr><td>bottom-10</td><td>I 47.80(0.92)</td><td>48.64(0.15)</td></tr><tr><td>random-10</td><td>49.34(0.53)</td><td>50.03(1.08)</td></tr><tr><td>random-5 + var-5</td><td>49.84(1.49)</td><td>49.53(1.04)</td></tr><tr><td>top-10</td><td>49.62(1.00)</td><td>49.61(2.30)</td></tr><tr><td>top-5 + var-5</td><td>49.91(0.61)</td><td>49.89(1.73)</td></tr></table>
168
+
169
+ Table 6: Ablations of the initial population on SST-5, where top- $\mathbf { \nabla } \cdot n$ , random- $\mathbf { \nabla } \cdot n$ , bottom- $\boldsymbol { n }$ denotes the top-performing, randomly selected, bottom-performing n prompts, and var- $^ n$ denotes the number of generated $n$ variations.
170
+
171
+ ing the top-performing ones; 2) When selecting the top-performing prompts, introducing randomness by allowing GPT-3.5 to generate variations can lead to a slight improvement in overall performance; however, when randomly selecting prompts, there is no need to introduce additional randomness for EVOPROMPT (DE); 3) When using top-performing initial prompts, EVOPROMPT (GA) performs slightly better than EVOPROMPT (DE); however, when starting with bottom-performing initial prompts, EVOPROMPT (DE) outperforms EVOPROMPT (GA), which indicates that DE is a better choice when the available manual prompts are not of high quality.
172
+
173
+ # 6 CONCLUSIONS
174
+
175
+ We introduce EVOPROMPT to optimize discrete prompts, which connects LLMs with evolutionary algorithms. Extensive experiments on 31 datasets demonstrate the superiority of EVOPROMPT, yielding consistent performance gains over both manual instructions and existing methods. Besides, We validate that LLMs can serve as an effective, interpretable interface for implementing evolutionary algorithms like GA and DE. While this study focused on EAs, the extensibility of our approach opens avenues for applying LLMs to other conventional algorithms, such as particle swarm optimization (PSO) (Kennedy & Eberhart, 1995), ant colony optimization (ACO) (Dorigo & Gambardella, 1997) and more recent Quality-Diversity (QD) optimization algorithms. Our findings aim to inspire future research at the intersection of LLMs and traditional algorithms, encouraging innovative applications.
176
+
177
+ # ACKNOWLEDGEMENTS
178
+
179
+ This work was partly supported by the National Key Research and Development Program of China (No. 2020YFB1708200), and the Shenzhen Science and Technology Program (JCYJ20220818101001004).
180
+
181
+ # REFERENCES
182
+
183
+ Fernando Alva-Manchego, Louis Martin, Antoine Bordes, Carolina Scarton, Benoît Sagot, and Lucia Specia. Asset: A dataset for tuning and evaluation of sentence simplification models with multiple rewriting transformations. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 4668–4679, 2020.
184
+
185
+ Stephen Bach, Victor Sanh, Zheng Xin Yong, Albert Webson, Colin Raffel, Nihal V Nayak, Abheesht Sharma, Taewoon Kim, M Saiful Bari, Thibault Févry, et al. Promptsource: An integrated development environment and repository for natural language prompts. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pp. 93–104, 2022.
186
+
187
+ Janez Brest, Sao Greiner, Borko Boskovic, Marjan Mernik, and Viljem Zumer. Self-adapting control parameters in differential evolution: A comparative study on numerical benchmark problems. IEEE transactions on evolutionary computation, 10(6):646–657, 2006.
188
+
189
+ Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
190
+
191
+ Angelica Chen, David M Dohan, and David R So. Evoprompting: Language models for code-level neural architecture search. arXiv preprint arXiv:2302.14838, 2023.
192
+
193
+ Andrew R Conn, Katya Scheinberg, and Luis N Vicente. Introduction to derivative-free optimization. SIAM, 2009.
194
+
195
+ Swagatam Das and Ponnuthurai Nagaratnam Suganthan. Differential evolution: A survey of the state-of-the-art. IEEE transactions on evolutionary computation, 15(1):4–31, 2010.
196
+
197
+ Swagatam Das, Sankha Subhra Mullick, and Ponnuthurai N Suganthan. Recent advances in differential evolution–an updated survey. Swarm and evolutionary computation, 27:1–30, 2016.
198
+
199
+ Mingkai Deng, Jianyu Wang, Cheng-Ping Hsieh, Yihan Wang, Han Guo, Tianmin Shu, Meng Song, Eric Xing, and Zhiting Hu. Rlprompt: Optimizing discrete text prompts with reinforcement learning. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pp. 3369–3391, 2022.
200
+
201
+ Marco Dorigo and Luca Maria Gambardella. Ant colony system: a cooperative learning approach to the traveling salesman problem. IEEE Transactions on evolutionary computation, 1(1):53–66, 1997.
202
+
203
+ Yao Fu, Litu Ou, Mingyu Chen, Yuhao Wan, Hao Peng, and Tushar Khot. Chain-of-thought hub: A continuous effort to measure large language models’ reasoning performance. arXiv preprint arXiv:2305.17306, 2023.
204
+
205
+ Bogdan Gliwa, Iwona Mochol, Maciej Biesek, and Aleksander Wawer. Samsum corpus: A humanannotated dialogue dataset for abstractive summarization. arXiv preprint arXiv:1911.12237, 2019.
206
+
207
+ Yiduo Guo, Yaobo Liang, Chenfei Wu, Wenshan Wu, Dongyan Zhao, and Nan Duan. Learning to program with natural language. arXiv preprint arXiv:2304.10464, 2023.
208
+
209
+ John H. Holland. Adaptation in Natural and Artificial Systems. University of Michigan Press, Ann Arbor, 1975. ISBN 0262581116.
210
+
211
+ John H Holland. Adaptation in natural and artificial systems: an introductory analysis with applications to biology, control, and artificial intelligence. MIT press, 1992.
212
+
213
+ Minqing Hu and Bing Liu. Mining and summarizing customer reviews. In KDD, pp. 168–177, 2004.
214
+ Srinivasan Iyer, Xi Victoria Lin, Ramakanth Pasunuru, Todor Mihaylov, Daniel Simig, Ping Yu, Kurt Shuster, Tianlu Wang, Qing Liu, Punit Singh Koura, et al. Opt-iml: Scaling language model instruction meta learning through the lens of generalization. arXiv preprint arXiv:2212.12017, 2022.
215
+ Zhengbao Jiang, Frank F Xu, Jun Araki, and Graham Neubig. How can we know what language models know? Transactions of the Association for Computational Linguistics, 8:423–438, 2020.
216
+ James Kennedy and Russell Eberhart. Particle swarm optimization. In Proceedings of ICNN’95- international conference on neural networks, volume 4, pp. 1942–1948. IEEE, 1995.
217
+ Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. Advances in neural information processing systems, 35: 22199–22213, 2022.
218
+ Pier Luca Lanzi and Daniele Loiacono. Chatgpt and other large language models as evolutionary engines for online interactive collaborative game design. arXiv preprint arXiv:2303.02155, 2023.
219
+ Joel Lehman, Jonathan Gordon, Shawn Jain, Kamal Ndousse, Cathy Yeh, and Kenneth O. Stanley. Evolution through large models. arXiv preprint arXiv:2206.08896, 2022.
220
+ Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. In EMNLP, pp. 3045–3059, 2021.
221
+ Bei Li, Rui Wang, Junliang Guo, Kaitao Song, Xu Tan, Hany Hassan, Arul Menezes, Tong Xiao, Jiang Bian, and JingBo Zhu. Deliberate then generate: Enhanced prompting framework for text generation. arXiv preprint arXiv:2305.19835, 2023.
222
+ Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 4582–4597, 2021.
223
+ Adam Lipowski and Dorota Lipowska. Roulette-wheel selection via stochastic acceptance. Physica A: Statistical Mechanics and its Applications, 391(6):2193–2196, 2012.
224
+ Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pre-train, prompt, and predict: A systematic survey of prompting methods in natural language processing. ACM Computing Surveys, 55(9):1–35, 2023.
225
+ Xiao Liu, Kaixuan Ji, Yicheng Fu, Weng Lam Tam, Zhengxiao Du, Zhilin Yang, and Jie Tang. P-tuning v2: Prompt tuning can be comparable to fine-tuning universally across scales and tasks. arXiv preprint arXiv:2110.07602, 2021a.
226
+ Xiao Liu, Yanan Zheng, Zhengxiao Du, Ming Ding, Yujie Qian, Zhilin Yang, and Jie Tang. Gpt understands, too. arXiv preprint arXiv:2103.10385, 2021b.
227
+ Elliot Meyerson, Mark J Nelson, Herbie Bradley, Arash Moradi, Amy K Hoover, and Joel Lehman. Language model crossover: Variation through few-shot prompting. arXiv preprint arXiv:2302.12170, 2023.
228
+ Seyedali Mirjalili, Jin Song Dong, Ali Safa Sadiq, and Hossam Faris. Genetic algorithm: Theory, literature review, and application in image reconstruction. Nature-Inspired Optimizers: Theories, Literature Reviews and Applications, pp. 69–85, 2020.
229
+ Swaroop Mishra, Daniel Khashabi, Chitta Baral, Yejin Choi, and Hannaneh Hajishirzi. Reframing instructional prompts to gptk’s language. In Findings of the Association for Computational Linguistics: ACL 2022, pp. 589–612, 2022a.
230
+
231
+ Swaroop Mishra, Daniel Khashabi, Chitta Baral, and Hannaneh Hajishirzi. Cross-task generalization via natural language crowdsourcing instructions. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 3470–3487, 2022b.
232
+
233
+ Swaroop Mishra, Daniel Khashabi, Chitta Baral, and Hannaneh Hajishirzi. Cross-task generalization via natural language crowdsourcing instructions. In ACL, 2022c.
234
+
235
+ Melanie Mitchell. An introduction to genetic algorithms. MIT press, 1998.
236
+
237
+ Jean-Baptiste Mouret and Jeff Clune. Illuminating search spaces by mapping elites. arXiv preprint arXiv:1504.04909, 2015.
238
+
239
+ OpenAI. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023.
240
+
241
+ Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35: 27730–27744, 2022.
242
+
243
+ Bo PANG. Seeing stars: Exploiting class relationships for sentiment categorization with respect to rating scales. In ACL, 2005.
244
+
245
+ Bo Pang and Lillian Lee. A sentimental education: Sentiment analysis using subjectivity summarization based on minimum cuts. In Proceedings of the 42nd Annual Meeting of the Association for Computational Linguistics (ACL-04), pp. 271–278, 2004.
246
+
247
+ Millie Pant, Hira Zaheer, Laura Garcia-Hernandez, Ajith Abraham, et al. Differential evolution: A review of more than two decades of research. Engineering Applications of Artificial Intelligence, 90:103479, 2020.
248
+
249
+ Archiki Prasad, Peter Hase, Xiang Zhou, and Mohit Bansal. Grips: Gradient-free, edit-based instruction search for prompting large language models. arXiv preprint arXiv:2203.07281, 2022.
250
+
251
+ Kenneth V Price. Differential evolution. In Handbook of optimization: From classical to modern approach, pp. 187–214. Springer, 2013.
252
+
253
+ Reid Pryzant, Dan Iter, Jerry Li, Yin Tat Lee, Chenguang Zhu, and Michael Zeng. Automatic prompt optimization with" gradient descent" and beam search. arXiv preprint arXiv:2305.03495, 2023.
254
+
255
+ Chengwei Qin, Aston Zhang, Zhuosheng Zhang, Jiaao Chen, Michihiro Yasunaga, and Diyi Yang. Is chatgpt a general-purpose natural language processing task solver? arXiv preprint arXiv:2302.06476, 2023.
256
+
257
+ Luis Miguel Rios and Nikolaos V Sahinidis. Derivative-free optimization: a review of algorithms and comparison of software implementations. Journal of Global Optimization, 56:1247–1293, 2013.
258
+
259
+ Victor Sanh, Albert Webson, Colin Raffel, Stephen H Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, et al. Multitask prompted training enables zero-shot task generalization. arXiv preprint arXiv:2110.08207, 2021.
260
+
261
+ Timo Schick and Hinrich Schütze. Exploiting cloze-questions for few-shot text classification and natural language inference. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pp. 255–269, 2021.
262
+
263
+ Chufan Shi, Haoran Yang, Deng Cai, Zhisong Zhang, Yifan Wang, Yujiu Yang, and Wai Lam. A thorough examination of decoding methods in the era of llms. arXiv preprint arXiv:2402.06925, 2024.
264
+
265
+ Weijia Shi, Xiaochuang Han, Hila Gonen, Ari Holtzman, Yulia Tsvetkov, and Luke Zettlemoyer. Toward human readable prompt tuning: Kubrick’s the shining is a good movie, and a good prompt too? arXiv preprint arXiv:2212.10539, 2022.
266
+
267
+ Taylor Shin, Yasaman Razeghi, Robert L Logan IV, Eric Wallace, and Sameer Singh. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 4222–4235, 2020.
268
+
269
+ Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Y Ng, and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In EMNLP, pp. 1631–1642, 2013.
270
+ Rainer Storn and Kenneth Price. Differential evolution–a simple and efficient heuristic for global optimization over continuous spaces. Journal of global optimization, 11:341–359, 1997.
271
+ Mirac Suzgun, Nathan Scales, Nathanael Schärli, Sebastian Gehrmann, Yi Tay, Hyung Won Chung, Aakanksha Chowdhery, Quoc V Le, Ed H Chi, Denny Zhou, et al. Challenging big-bench tasks and whether chain-of-thought can solve them. arXiv preprint arXiv:2210.09261, 2022.
272
+ Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. https://github.com/tatsu-lab/stanford_alpaca, 2023.
273
+ Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023.
274
+ Jakob Vesterstrom and Rene Thomsen. A comparative study of differential evolution, particle swarm optimization, and evolutionary algorithms on numerical benchmark problems. In Proceedings of the 2004 congress on evolutionary computation (IEEE Cat. No. 04TH8753), volume 2, pp. 1980–1987. IEEE, 2004.
275
+ Ellen M Voorhees and Dawn M Tice. Building a question answering test collection. In Proceedings of the 23rd annual international ACM SIGIR conference on Research and development in information retrieval, pp. 200–207, 2000.
276
+ Eric Wallace, Shi Feng, Nikhil Kandpal, Matt Gardner, and Sameer Singh. Universal adversarial triggers for attacking and analyzing nlp. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 2153–2162, 2019.
277
+ Yifan Wang, Qingyan Guo, Xinzhe Ni, Chufan Shi, Lemao Liu, Haiyun Jiang, and Yujiu Yang. Hint-enhanced in-context learning wakes large language models up for knowledge-intensive tasks. arXiv preprint arXiv:2311.01949, 2023.
278
+ Wikipedia contributors. Tournament selection — Wikipedia, the free encyclopedia. https:// en.wikipedia.org/w/index.php?title=Tournament_selection&oldid=1160627612, 2023. [Online; accessed 26-September-2023].
279
+ Wei Xu, Courtney Napoles, Ellie Pavlick, Quanze Chen, and Chris Callison-Burch. Optimizing statistical machine translation for text simplification. Transactions of the Association for Computational Linguistics, 4:401–415, 2016.
280
+ JD Zamfirescu-Pereira, Richmond Y Wong, Bjoern Hartmann, and Qian Yang. Why johnny can’t prompt: how non-ai experts try (and fail) to design llm prompts. In Proceedings of the 2023 CHI Conference on Human Factors in Computing Systems, pp. 1–21, 2023.
281
+ Jingqiao Zhang and Arthur C. Sanderson. Jade: Adaptive differential evolution with optional external archive. IEEE Transactions on Evolutionary Computation, 13(5):945–958, 2009. doi: 10.1109/TEVC.2009.2014613.
282
+ Ningyu Zhang, Luoqiu Li, Xiang Chen, Shumin Deng, Zhen Bi, Chuanqi Tan, Fei Huang, and Huajun Chen. Differentiable prompt makes pre-trained language models better few-shot learners. In International Conference on Learning Representations, 2021.
283
+ Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, et al. Opt: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068, 2022.
284
+ Tianjun Zhang, Xuezhi Wang, Denny Zhou, Dale Schuurmans, and Joseph E Gonzalez. Tempera: Test-time prompt editing via reinforcement learning. In The Eleventh International Conference on Learning Representations, 2023a.
285
+ Wenxuan Zhang, Yue Deng, Bing Liu, Sinno Jialin Pan, and Lidong Bing. Sentiment analysis in the era of large language models: A reality check. arXiv preprint arXiv:2305.15005, 2023b.
286
+ Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level convolutional networks for text classification. NeurIPS, 28, 2015.
287
+ Yue Zhang, Leyang Cui, Deng Cai, Xinting Huang, Tao Fang, and Wei Bi. Multi-task instruction tuning of llama for specific scenarios: A preliminary study on writing assistance. arXiv preprint arXiv:2305.13225, 2023c.
288
+ Mingkai Zheng, Xiu Su, Shan You, Fei Wang, Chen Qian, Chang Xu, and Samuel Albanie. Can gpt-4 perform neural architecture search? arXiv preprint arXiv:2304.10970, 2023.
289
+ Yongchao Zhou, Andrei Ioan Muresanu, Ziwen Han, Keiran Paster, Silviu Pitis, Harris Chan, and Jimmy Ba. Large language models are human-level prompt engineers. In The Eleventh International Conference on Learning Representations, 2022.
290
+ Kaijie Zhu, Jindong Wang, Jiaheng Zhou, Zichen Wang, Hao Chen, Yidong Wang, Linyi Yang, Wei Ye, Neil Zhenqiang Gong, Yue Zhang, et al. Promptbench: Towards evaluating the robustness of large language models on adversarial prompts. arXiv preprint arXiv:2306.04528, 2023.
291
+
292
+ # Algorithm 2 Discrete prompt optimization: EVOPROMPT (GA)
293
+
294
+ Require: Initial prompts $P _ { 0 } = \{ p _ { 1 } , p _ { 2 } , . . . , p _ { N } \}$ , size of population $N$ , a dev set $\mathcal { D }$
295
+ 1: Initial fitness evaluation: $\dot { S _ { 0 } } \{ s _ { i } = f ( \dot { p _ { i } } , D ) | i \in [ 1 , N ] \}$
296
+ 2: for $t = 1$ to $T$ do ▷ $T$ : Number of iterations
297
+ 3: for $i = 1$ to $N$ do
298
+ 4: Selection based on fitness using roulette wheel: $p _ { r _ { 1 } } , p _ { r _ { 2 } } \sim P _ { t - 1 }$
299
+ 5: Evolution: $p _ { i } ^ { \prime } G A ( p _ { r _ { 1 } } , p _ { r _ { 2 } } )$ (Refer to Figure 1)
300
+ 6: Evaluation: $s _ { i } \gets f ( p _ { i } ^ { \prime } , \mathcal { D } )$
301
+ 7: end for
302
+ 8: $S _ { t } ^ { \prime } \gets \{ s _ { i } | i \in [ 1 , N ] \}$ , $P _ { t } ^ { \prime } \gets \{ p _ { i } ^ { \prime } | i \in [ 1 , N ] \}$
303
+ 9: Update score: $S _ { t } \gets \mathrm { T o p } { - } N \{ S _ { t - 1 } , S _ { t } ^ { \prime } \}$
304
+ 10: Update: $P _ { t } \gets \mathrm { T o p } { - } N \{ P _ { t - 1 } , P _ { t } ^ { \prime } \}$ using $S _ { t - 1 }$ , $S _ { t } ^ { \prime }$ ,
305
+ 11: nd for
306
+
307
+ 12: Return the best prompt, $p ^ { * }$ , among the final population $P _ { T } \colon p ^ { * } \gets a r g m a x _ { p \in P _ { T } } f ( p , \mathcal { D } )$
308
+
309
+ Algorithm 3 Discrete prompt optimization: EVOPROMPT (DE)
310
+
311
+ Require: Initial prompts $P _ { 0 } = \{ p _ { 1 } , p _ { 2 } , . . . , p _ { N } \}$ , size of population $N$ , a dev set $\mathcal { D }$
312
+ 1: for $t = 1$ to $T$ do ▷ $T$ : Number of iterations
313
+ 2: for $p _ { i }$ in $P _ { t - 1 }$ do
314
+ 3: Sample donors: $p _ { r 1 } , p _ { r 2 } \sim P _ { t - 1 }$ , $r 1 \neq r 2 \neq i$
315
+ 4: Evolution: $p _ { i } ^ { \prime } \gets D E ( p _ { i } , p _ { r _ { 1 } } , p _ { r _ { 2 } } , p _ { b e s t } )$ where $p _ { b e s t }$ is the current best prompt. (Refer to Figure 2)
316
+ 5: Selection: $p _ { i } ^ { * } = \arg \operatorname* { m a x } f ( p , \mathcal { D } )$ $\triangleright$ Keep the better one in the population $p { \in } \{ p _ { i } , p _ { i } ^ { \prime } \}$
317
+ 6: end for
318
+ 7: Update: $P _ { t } \gets \{ p _ { i } ^ { * } | i \in [ 1 , N ] \}$
319
+ 8: end for
320
+ 9: Return the best prompt, $p ^ { * }$ , among the final population $P _ { T } \colon p ^ { * } \gets a r g m a x _ { p \in P _ { T } } f ( p , \mathcal { D } )$
321
+
322
+ # A DETAILS OF ALGORITHM IMPLEMENTATION
323
+
324
+ We instantiate EVOPROMPT two representative evolutionary algorithms, GA and DE. Though both algorithms use consistent general selection processes, creating offspring, and updating, it is worth noting that the selection strategies, ways of mutation and crossover, and the updating strategies in these two algorithms are different. The specific algorithms for each of them are shown in Algorithm 2 and Algorithm 3.
325
+
326
+ # B EXPERIMENTAL SETTINGS
327
+
328
+ # B.1 DATASETS
329
+
330
+ Table 7 shows the statistics of the text classification, simplification and summarization datasets. For Big-Bench Hard, We use serial numbers to denote 22 tasks, the descriptions are reported in Table 17. Note that for the task of “web of lies”, the accuracy of the baseline is $100 \%$ , so here we have not included this task for prompt optimization. Additionally, both tasks of “logical deduction objects” and “tracking shuffled objects” have three sub-tasks.
331
+
332
+ # B.2 TEMPLATES
333
+
334
+ Templates for Task Implementation For different models, we apply different templates shown in Table 8, 9 and 10, referring to the previous works (Iyer et al., 2022; Taori et al., 2023; Zhang et al., 2023b; Li et al., 2023; Fu et al., 2023).
335
+
336
+ ![](images/c8e765e1d65b96530c559afd3eef90b03dc4525c5c7107cb0dc405b045ab59b7.jpg)
337
+ Figure 4: Template used for resampling (Zhou et al., 2022).
338
+
339
+ Table 7: Statistics for natural language understanding and generation datasets used in this work.
340
+
341
+ <table><tr><td>Dataset</td><td>Type</td><td>Label space</td><td>ITestl</td></tr><tr><td>SST-2</td><td>Sentiment</td><td>{positive, negative}</td><td>1,821</td></tr><tr><td>CR</td><td>Sentiment</td><td>{positive, negative}</td><td>2,000</td></tr><tr><td>MR</td><td>Sentiment</td><td>{positive, negative}</td><td>2.000</td></tr><tr><td>SST-5</td><td>Sentiment</td><td>{terrible,bad,okay, good,great}</td><td>2,210</td></tr><tr><td>AG&#x27;s News</td><td>News topic</td><td>{World, Sports, Business,Tech}</td><td>7,600</td></tr><tr><td>TREC</td><td>Question topic</td><td>{Description,Entity, Expression,Human,Location,Number}</td><td>500</td></tr><tr><td>Subj</td><td>Subjectivity</td><td>{subjective,objective}</td><td>2,000</td></tr><tr><td>SAMSum</td><td>Summarization</td><td></td><td>819</td></tr><tr><td>ASSET</td><td>Simplification</td><td></td><td>359</td></tr></table>
342
+
343
+ Template for Prompt Generation We apply the resampling template, shown in Figure 4, to generate variations of manual initial prompts. For our EVOPROMPT, the complete DE algorithm implemented by LLMs is shown in Figure 5. For both DE and GA, we prepend a one-shot example of the algorithm execution, guiding LLMs to operate precisely.
344
+
345
+ $\underline { { \underline { { \cdot } } } }$ INSTRUCTIONAL PROMPTS
346
+
347
+ Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
348
+
349
+ ### Instruction: <PROMPT>
350
+
351
+ ### Input: <INPUT> ### Response: <COMPLETE>
352
+
353
+ # Zero-shot Example:
354
+
355
+ Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
356
+
357
+ ### Instruction:
358
+ Please perform Sentiment Classification task. Given the sentence, assign a sentiment label from [’negative’, ’positive’]. Return label only without any other text.
359
+
360
+ ### Input: beautifully observed , miraculously unsentimental comedy-drama .
361
+
362
+ ### Response: <COMPLETE>
363
+
364
+ Table 8: Template used for Alpaca (referring to Taori et al. (2023)).
365
+
366
+ # B.3 HYPER PARAMETERS
367
+
368
+ The parameters for the experiments are shown in Table 11. For evolutionary algorithms implemented by GPT-3.5, following previous work (Shi et al., 2024), we use Top- $p$ decoding (temperature $= 0 . 5$ , $P = 0 . 9 5$ ). For the task implementation, we use greedy decoding and the default temperature for Alpaca. For the generation tasks implemented by GPT-3.5, the temperature is 0.0.
369
+
370
+ # Differential Evolution (DE) Algorithm Implemented by LLMs
371
+
372
+ # Query:
373
+
374
+ ![](images/c97c855feaee6ac66e25152d6c83b37a529a25555fd631903cfb37594ee0448e.jpg)
375
+ Figure 5: DE algorithm implemented by LLMs for discrete prompt optimization with complete response $( \mathrm { E v o } ( \cdot )$ in Algorithm 1). In Step 1, LLMs find the different parts (words in ■ and ■) between Prompt 1 and Prompt 2 $\mathbf { b } - \mathbf { c }$ in typical DE). In Step 2, LLMs perform mutation (words in ) on them (imitation of $\mathbf { F } ( \mathbf { b } - \mathbf { c } ) .$ ). Next, LLMs incorporate the current best prompt as Prompt 3 with the mutated results in Step 2, to generate a new prompt (counterpart of $\mathbf { a } + \mathbf { F } ( \mathbf { b } - \mathbf { c } )$ in DE). Finally, LLMs perform crossover upon the current basic prompt $p _ { i }$ and the generated prompt in Step 3.
376
+
377
+ <PROMPT>
378
+ <INPUT>
379
+ The simplification of the sentence is <COMPLETE>
380
+
381
+ # Zero-shot example:
382
+
383
+ Simplify the text.
384
+ Subsequently, in February 1941, 600 Jews were sent to Buchenwald and Mauthausen concentration camps. The simplification of the sentence is <COMPLETE>
385
+
386
+ TEMPLATE FOR SUMMARIZATION ==
387
+
388
+ <PROMPT>
389
+ <INPUT>
390
+ TL;DR: <COMPLETE>
391
+
392
+ # Zero-shot example:
393
+
394
+ How would you rephrase that in a few words?
395
+ Theresa: have you been at Tom’s new place? Luis: yes, it’s nice Marion: He invited us for a dinner Adam: where
396
+ is it? Marion: a bit outside the city Adam: where exactly? Marion: Fiesole Luis: very nice!
397
+ TL;DR: <COMPLETE>
398
+
399
+ Table 9: Templates of summarization (following Sanh et al. (2021); Qin et al. (2023)), simplification (following Li et al. (2023)) and the corresponding zero-shot examples.
400
+
401
+ =TEMPLATE FOR BIG-BENCH HARD =
402
+
403
+ # Zero-shot example:
404
+
405
+ Questions that involve enumerating objects and asking the model to count them.
406
+ Q: I have a flute, a piano, a trombone, four stoves, a violin, an accordion, a clarinet, a drum, two lamps, and a trumpet. How many musical instruments do I have?
407
+ A: Let’s think step by step.
408
+ <COMPLETE>
409
+
410
+ Table 10: Template for Big-Bench Hard (following Suzgun et al. (2022)) used for GPT-3.5 and the corresponding zero-shot examples. <DESC> refers to the specific description of each task.
411
+
412
+ ![](images/631aae5117fbcb54ccdc66a467e83316a62ec3f410355747560582340a1b9a59.jpg)
413
+ Figure 6: Effect of population size on SST-5 (left), Subj (middle), and ASSET (right). All the results are averaged over 3 random seeds.
414
+
415
+ Text Classification The population of prompts is initialized with widely used instructions in the previous works (Mishra et al., 2022b; Zhang et al., 2022). We paraphrase and rewrite them to initialize the population. The size of the development set is 200. We report the results on the full test set (the same as the previous related works (Deng et al., 2022; Zhang et al., 2023a)), as shown in Table 11.
416
+
417
+ Text Generation For the initial population, we collect instructions for summarization and simplification from Li et al. (2023); Sanh et al. (2021); Zhang et al.
418
+
419
+ (2023c) and augment them to the expected size (10 in our setting), either written manually or generated by GPT-3.5.
420
+
421
+ Table 11: Settings for experiments. |Shots| refers to the number of examples in the demonstration. For the text classification task, we set the value as 1, which means we prepend with 1 sample of each category, to constrain the output in the label space.
422
+
423
+ <table><tr><td></td><td>Task LM| IPopulationlIStepslIDevlIShotsl</td><td></td><td></td><td></td></tr><tr><td colspan="5">Text classification</td></tr><tr><td>Alpaca-7b 10</td><td></td><td>10</td><td>200</td><td>1</td></tr><tr><td colspan="5"> Text Generation</td></tr><tr><td rowspan="2">Alpaca-7b GPT-3.5</td><td>10</td><td>10</td><td>100</td><td>0</td></tr><tr><td>10</td><td>10</td><td>100</td><td>0</td></tr><tr><td colspan="3">Big-Bench Hard</td><td></td><td></td></tr><tr><td>GPT-3.5</td><td>10</td><td>10</td><td>50</td><td>3</td></tr></table>
424
+
425
+ # C ADDITIONAL RESULTS
426
+
427
+ # C.1 PARAMETERS IN EVOLUTIONARY ALGORITHMS
428
+
429
+ Effect of Population Size Intuitively, a trade-off exists between the performance and the overhead caused by the population size. We explore the performance of EVOPROMPT (DE) and EVOPROMPT (GA) respectively at varying population sizes from 4 to 12. The results are plotted in Figure 6.
430
+
431
+ For classification datasets, as the size increases, curves for DE and GA show an ascending trend. Furthermore, the increase in DE attributed to population diversity was greater than that in GA since DE focuses on different parts. Differences among prompts within populations bring about substantial mutations, leading DE to explore potential prompts since keeping common parts balances exploration and exploitation effectively.
432
+
433
+ For the relatively simple generation task (i.e., ASSET), a population size of 6 demonstrates a comparable performance to a population size of 10, though with a 2.5-fold increase in overhead. This suggests that for relatively simple tasks large populations are unnecessary, while for complex tasks (i.e., Subj), a larger population with diversity brings improvement.
434
+
435
+ Effect of Number of Iterations To further explore the process of convergence, for SST-5, Subj and ASSET, we plot the best and average scores on the development set for EVOPROMPT for DE and GA over the whole population after each iterative step (Figure 7). Curves of best and average scores gradually converge with an increasing trend as evolution proceeds, indicating that the population’s quality as a whole is steadily increasing as the evolution process.
436
+
437
+ ![](images/9f1cb9cb5ca72a2197491c3ccbe3da9dc94e1ea6933d6cf8b8cd361834b2281e.jpg)
438
+ Figure 7: The best and average scores of each iteration on SST-5 (left), Subj (middle), and ASSET (right) development set on Alpaca-7b. All the results are averaged over 3 random seeds.
439
+
440
+ ![](images/52e79b6e6ffefec55b2858409a141dddbd4018738db987512c323b5f4c88a5dc.jpg)
441
+ Figure 8: Normalized scores on BBH tasks for APE, EVOPROMPT (GA) and EVOPROMPT (DE).
442
+
443
+ # C.2 COMPARISON ON BBH TASKS
444
+
445
+ APE (Zhou et al., 2022) optimizes the Chain-of-Thought (CoT) prompt for reasoning tasks on InstructGPT. Considering that both InstructGPT and GPT-3.5 belong to the GPT family and we may observe similar trends, we evaluate the CoT prompt proposed by APE, “Let’s work this out in a step by step way to be sure we have the right answer.”, on reasoning tasks and plot the 3-shot performance in Figure 8. For simplicity, we use the same initial population for all the 22 BBH tasks without priori knowledge of each task. In future works, by incorporating task-specific prompts, either manually designed or generated by LLMs, we may further enhance the performance.
446
+
447
+ Table 12: Average accuracy over 23 BBH tasks for different methods.
448
+
449
+ <table><tr><td>Method</td><td>=Avg.</td></tr><tr><td>baseline APE</td><td>71.49 71.85</td></tr><tr><td>EVOPROMPT (GA) EVOPROMPT (DE)</td><td>74.18 75.03</td></tr></table>
450
+
451
+ Table 13: Number of iterations, tokens within the API requests (including prompt optimization and evaluation) and the corresponding score for our methods and APE. We choose the iteration that APE converges as the Same iteration for comparison. Until convergence means that the improvement of the average score is less than $0 . 3 \%$ for continuous two iterations.
452
+
453
+ <table><tr><td rowspan="2">=L I APE</td><td rowspan="2"></td><td colspan="2">SST-5</td><td colspan="2"></td><td></td></tr><tr><td></td><td>EVOPROMPT (GA) EVOPROMPT (DE)</td><td>APE</td><td>EVOPROMPT (GA)</td><td>EVOPROMPT (DE)</td></tr><tr><td colspan="7">Same iteration</td></tr><tr><td># iterations</td><td>9</td><td>9</td><td>9</td><td>15</td><td>15</td><td>15</td></tr><tr><td>#tokens</td><td>5.39 M</td><td>5.40M</td><td>5.52 M</td><td>5.66M</td><td>5.73M</td><td>5.93 M</td></tr><tr><td>score</td><td>45.79</td><td>50.23</td><td>49.23</td><td>67.20</td><td>70.10</td><td>79.35</td></tr><tr><td colspan="7">Until convergence</td></tr><tr><td># iterations</td><td>9</td><td>7</td><td>11</td><td>15</td><td>15</td><td>17</td></tr><tr><td>#tokens</td><td>5.39 M</td><td>4.20M</td><td>6.75M</td><td>5.66M</td><td>5.73M</td><td>6.72 M</td></tr><tr><td>score</td><td>45.79</td><td>50.23</td><td>51.13</td><td>67.20</td><td>70.10</td><td>79.35</td></tr></table>
454
+
455
+ ![](images/dd1556d69cbb55e5f9e57dc61c31197025bfbb17ab0221562e570d2c7e67edc0.jpg)
456
+ Figure 9: Statistics about the prompt length, including average values over the whole population (a), variance over the prompt length (b), and number of new words evolved after each step (c). Note that all the values are averaged over 8 datasets, including 7 understanding datasets and one simplification dataset, and 3 random seeds.
457
+
458
+ # C.3 COST ANALYSIS
459
+
460
+ Overhead mainly comes from prompt evaluation and generation. For evaluation, our overhead is $N * | D | * T$ , where $N$ is the size of the population, $| D |$ is the size of the development set, and $T$ is the number of iterations. These parameters differ from the task and can be found in Appendix B.3. For the cost from prompt generation, the cost mainly depends on the number of API results, $T * N$ . So the total number of API requests is $N * T * \left( 1 + | D | \right)$ , the same as APE. Moreover, given that the API of LLMs is typically billed based on the number of tokens used, we also estimate the total number of tokens used in the API requests during the prompt optimization process, as shown in Table 13. All the scores reported are over the test set on one random seed. We analyze the overhead mainly from two aspects: 1) the performance of our methods compared with APE under the same number of iterations; 2) the performance until convergence measured by the average score on the dev set.
461
+
462
+ We can observe that with the same number of iterations, both GA and DE outperform APE significantly while introducing only a slight overhead in terms of the number of tokens. The convergence rates of APE and GA are similar while DE is slightly slower, but it delivers better performance. This implies the relatively high ceiling of EVOPROMPT.
463
+
464
+ # C.4 ANALYSIS OF PROMPT
465
+
466
+ Diversity Analysis We further investigate the diversity of prompts generated by GA and DE after each iterative step respectively. We mainly plot the average prompt length, variance and number of new words mutated after each step, as shown in Figure 9. It can be observed that EVOPROMPT (DE) generates longer prompts with higher variances than EVOPROMPT (GA), which implies that DE prefers exploration for diversity. In the latter iterations, DE mutates more new words than GA, and thus shows better potential to escape from the local optimum.
467
+
468
+ Optimal Prompts We release the optimal prompts generated by EVOPROMPT for understanding (Table 14), text simplification (Table 16), summarization (Table 15) and BBH tasks (Table 17, 18) .
469
+
470
+ # D FUTURE WORKS
471
+
472
+ There are several promising directions for future investigation:
473
+
474
+ • Based on our framework, more applications can be explored, including game levels generation, text-to-images generation, non-trivial NP-hard problems (e.g. traveling salesman problem), etc. • There exist many variants of DE and we give priority to the most canonical and classical ones for current exploration. In future work, it will be interesting to consider more advanced DEvariants (Das et al., 2016; Das & Suganthan, 2010). For example, some recent DE-variants have been investigating adaptive control parameters. The main challenge in applying these variants to prompt optimization within the discrete language space lies in assessing the capacity of LLMs to adapt to these continuous control parameters.
475
+
476
+ Table 14: Manual Instructions (following Zhang et al. (2023b) and Zhang et al. (2023c)), Natural Instructions (Mishra et al., 2022b), PromptSource (Bach et al., 2022) as baselines and instructions with best performance on Alpaca-7b generated by EVOPROMPT (either DE or GA) on classification datasets.
477
+
478
+ <table><tr><td>Dataset</td><td>Method</td><td>Content</td><td>Score</td></tr><tr><td>SST-2</td><td>Manual Instruction</td><td>Pe</td><td>93.68</td></tr><tr><td></td><td>Natural Instruction</td><td>In thistask,you are given sentences from movie reviews.The task is to clasifyasentence as &quot;great&quot;ifthe92.86 sentiment of the sentence is positive or as &quot;terrible&quot;if the sentiment of the sentence is negative.</td><td></td></tr><tr><td></td><td>PromptSource</td><td>Does the following sentence have a positive or negative sentiment?</td><td>93.03</td></tr><tr><td></td><td>EVOPROMPT</td><td>Examine the movie reviews and classify them as either positive or negative.</td><td>95.61</td></tr><tr><td>CR</td><td>Manual Instruction</td><td> Pletie</td><td>91.40</td></tr><tr><td></td><td>Natural Instruction</td><td>In this task,you are given sentences from movie reviews.The task is to clasify asentence as &quot;great&quot; if the sentiment of the sentence is positive or as &quot;terible&quot;if the sentiment of the sentence is negative.</td><td>90.90</td></tr><tr><td></td><td>EVOPROMPT</td><td>Analyze customer reviews and categorize each sentence as either ’positive&#x27;or&#x27;negative&#x27;.</td><td>91.75</td></tr><tr><td>MR</td><td>Manual Instruction</td><td>Pletei</td><td>88.75</td></tr><tr><td></td><td>Natural Instruction</td><td>In this task,you are given sentences from movie reviews.The task is to classfy asentence as &quot;great&quot; if the sentiment of the sentence is positive or as &quot;terrible&quot;if the sentiment of the sentence is negative.</td><td>89.60</td></tr><tr><td></td><td>EVOPROMPT</td><td>Identify if a movie review is positive or negative byaccurately categorizing each input-output pair into either &#x27;positive’or&#x27;negative&#x27;.</td><td>91.35</td></tr><tr><td>SST-5</td><td>Manual Instruction</td><td>Plef</td><td></td></tr><tr><td></td><td>Natural Instruction</td><td>In this task,you are given sentences from movie reviews.Based on the given review,clasify it toone ofthe48.64 five classes:(1) terrible,(2) bad,(3)okay,(4) good,and(5) great.</td><td></td></tr><tr><td></td><td>EVOPROMPT</td><td>Have your friend evaluate the movie they had just seen and provide a summary opinion (e.g.terible,bad,52.26 okay, good, or great) to determine the sentiment of the movie review.</td><td></td></tr><tr><td>AG&#x27;s News</td><td>Manual Instruction</td><td>Plesepefossbd</td><td></td></tr><tr><td></td><td>Natural Instruction</td><td>In this task,you are given a news article.Your task is to classify the article toone out of the four topics &quot;World&quot;,&quot;Sports&quot;,&quot;Business&quot;,&quot;Tech&quot;if thearticle&quot;s main topicisrelevant to the world,sports,business,</td><td>48.89</td></tr><tr><td></td><td>PromptSource</td><td>and technology,correspondingly.If you are not sure about the topic,choose the closest option. What label best describes thisnewsarticle?</td><td>45.43</td></tr><tr><td></td><td>EVOPROMPT</td><td>Assess the entire concept of the news story and choose from the World,Sports,Business or Tech categories to categorize it into the correct category.</td><td>76.21</td></tr><tr><td>TREC</td><td>Manual Instruction</td><td>Please perform Question Classification task.Given the question,assgn a label from[&#x27;Description&#x27;,Entity&#x27;,50.60 &#x27;Expression&#x27;,&#x27;Human&#x27;,&#x27;Location&#x27;,&#x27;Number&#x27;].Return label only without any other text.</td><td></td></tr><tr><td></td><td>Natural Instruction</td><td>You are given a question. You need to detect which category better describes the question.Answer with &quot;Description&quot;,&quot;Entity&quot;,&quot;Expression&quot;,&quot;Human&quot;,&quot;Location&quot;,and &quot;Number&quot;.</td><td>55.00</td></tr><tr><td></td><td>PromptSource</td><td>Which category best describes the following question? Choose from the following list: Description,Entity, Abbreviation,Person, Quantity, Location.</td><td>36.20</td></tr><tr><td></td><td>EVOPROMPT</td><td>Recognize the inputs (explanations,entities,or humans)and provide the suitable outputs (numbers,descrip- tions,or entities)to answer the questions in a way that is understandable for non-native English speakers.</td><td>68.00</td></tr><tr><td>Subj</td><td>Manual Instruction</td><td>Plete</td><td>49.75</td></tr><tr><td></td><td>Natural Instruction</td><td>Inthis task,you are given sentences fromreviews.The task is to classifya sentence as &quot;subjective&quot; if the opinion of the sentence is subjective or as &quot;objective&quot; if the opinion of the sentence is objective.</td><td>52.55</td></tr><tr><td></td><td>EVOPROMPT</td><td>Construct input-output pairs to demonstrate the subjectivity of reviews and opinions,distinguishing between objective and subjective input while producing examples of personal opinions and illustrations of subjective views,so it can illustrate the subjectivity of judgments and perspectives.</td><td>77.60</td></tr></table>
479
+
480
+ Table 15: Manual Instructions (following Sanh et al. (2021) as the baseline and instructions with best performance on Alpaca-7b and GPT3.5 generated by EVOPROMPT (either DE or GA) on SAMSum.
481
+
482
+ <table><tr><td>Method</td><td>Model</td><td>Content</td><td>ROUGE-1/2/L</td></tr><tr><td rowspan="2">Manual Instruction</td><td>Alpaca-7b</td><td>How would you rephrase that in a few words?</td><td>35.92/11.16/31.67</td></tr><tr><td>GPT</td><td>How would you rephrase that in a few words?</td><td>43.95/17.11/39.09</td></tr><tr><td rowspan="2">EVOPROMPT</td><td>Alpaca-7b</td><td>Carefully examine the text or listen to the conversation to identify the key ideas,comprehend the main idea,and summarize the critical facts and ideas in the concise language without any unnecessary details or duplication.</td><td>39.86/14.24/36.09</td></tr><tr><td>GPT</td><td>Reduce the core by reading or listening carefulyto identifythe main ideas and key points,so46.49/19.49/41.96 readers can comprehend the important concepts and essential information.</td><td></td></tr></table>
483
+
484
+ Table 16: Manual Instructions (following Zhang et al. (2023c) as the baseline and instructions with best performance on Alpaca-7b and GPT3.5 generated by EVOPROMPT (either DE or GA) on ASSET dataset.
485
+
486
+ <table><tr><td>Method</td><td>Model</td><td>Content</td><td>SARI</td></tr><tr><td rowspan="2">Manual Instruction</td><td>Alpaca-7b</td><td>Simplify the text.</td><td>43.03</td></tr><tr><td>GPT-3.5</td><td>Simplify the text.</td><td>43.80</td></tr><tr><td rowspan="2">EVOPROMPT</td><td rowspan="2">Alpaca-7b GPT-3.5</td><td>Rewrite the input text into simple English to make it easier to comprehend for non-native English speakers. Rewrite the given sentence to make it more accessible and understandable for both native and non-native</td><td>46.67</td></tr><tr><td>English speakers.</td><td>47.40</td></tr></table>
487
+
488
+ Table 17: Instructions with the best performance on GPT3.5 generated by EVOPROMPT (either DE or GA) on BBH datasets. Duplicate IDs are due to the tasks with several sub-tasks.
489
+
490
+ <table><tr><td>Task ID</td><td>Task</td><td>Description</td><td>Prompt</td><td>Score</td></tr><tr><td>01</td><td>hyperbaton</td><td>Order adjectives correctly in English sentences.</td><td>Verify the answer by splitting it into components and inspecting each part closely and logically, so we can progress thoughtfully and methodically as we break the task into pieces and explore each part</td><td>81.20</td></tr><tr><td>02</td><td>temporal_sequences</td><td>Answer questions about which times certain events could have occurred.</td><td>systematically and rationally to reach our goal. Start by breaking this conundrum into manageable chunks,carefully analyzing each component of this problem and thoroughly inspecting each aspect collaboratively,tackling it together progressively to ensure the correct answer and the desired outcome.</td><td>78.80</td></tr><tr><td>03</td><td>object_counting</td><td>Questions that involve enumerating objects and asking the model to count them.</td><td>Examine this logically and assess this methodically, so that we can obtain a precise result by thinking critically and dissecting this math task systemati- cally.</td><td>87.60</td></tr><tr><td>04</td><td>disambiguation_qa</td><td>Clarify the meaning of sentences with ambiguous pronouns.</td><td>First,let us ponder and start off by taking our time, going step by step,and using our logic to approach this before we dive into the answer.</td><td>71.20</td></tr><tr><td>05</td><td>logical_deduction_three_objects</td><td>A logical deduction task which re- quires deducing the order of a se- quence of objects.</td><td>Let&#x27;s approach it cautiously,examining it thor- oughly and methodically,and then approach it in- crementally towards a resolution.</td><td>94.40</td></tr><tr><td>05</td><td>logical_deduction_five_objects</td><td>A logical deduction task which re- quires deducing the order of a se- quence of objects.</td><td>Split the problem into steps and thoughtfully progress through them to find the answer after the proof.</td><td>65.20</td></tr><tr><td>05</td><td>logical_deduction_seven_objects</td><td>A logical deduction task which re- quires deducing the order of a se-dissect this math task. quence of objects.</td><td>Let&#x27;s take astep-by-step approach to systematically54.40</td><td></td></tr></table>
491
+
492
+ • We hope our study can inspire further exploration of the connection between LLMs and other traditional algorithms, extending beyond EAs. The main challenge is adapting the specific elements of traditional algorithms to work within LLMs. For example, these elements may include direction of motion, velocity in partial swarm optimization (PSO) (Kennedy & Eberhart, 1995), the path in ant colony optimization algorithms (APO) (Dorigo & Gambardella, 1997), and characteristic in MAP-Elites (Mouret & Clune, 2015).
493
+
494
+ Table 18: Instructions with the best performance on GPT3.5 generated by EVOPROMPT (either DE or GA) on BBH datasets. Duplicate IDs are due to the tasks with several sub-tasks.
495
+
496
+ <table><tr><td>Task IDTask</td><td></td><td>Description</td><td>Prompt</td><td>Score</td></tr><tr><td>06</td><td>causal_judgement</td><td>bution.</td><td>Answer questions about causal atri-Atfrst,let&#x27;s handle things cautiously and resolve this by examining every detail and dealing with one problem at a time.</td><td>65.78</td></tr><tr><td>07</td><td>date_understanding</td><td>Infer the date from context.</td><td>Be realistic and practical like a detective,and use evidence tosolve theprobleminalogical,step-by- step approach.</td><td>85.60</td></tr><tr><td>08</td><td>ruin_names</td><td>ins&#x27;the input movie or musical artist</td><td>Select the humorous edit that &#x27;ru-Break down a math task into smaller sections and solve each one.</td><td>69.60</td></tr><tr><td>09</td><td>word_sorting</td><td>name. Sort a list of words.</td><td>Analyze each part of the problemlogically to solve56.40 it like a detective.</td><td></td></tr><tr><td>10</td><td>geometric_shapes</td><td>Name geometric shapes from their SVG paths.</td><td>We&#x27;ll methodically work through this problem to- 64.00 gether.</td><td></td></tr><tr><td>11</td><td>movie_recommendation</td><td>Recommend movies similar to the given list of movies.</td><td>Before exploring the answer,</td><td>86.00</td></tr><tr><td>12</td><td>salient_translation_error_detection</td><td>glish translation of a German source sentence.</td><td>Detect the type of error in an En-Break down the problem into individual steps in62.80 order to solve it.</td><td></td></tr><tr><td>13</td><td>formal_fallacies</td><td>ments from formal fallacies.</td><td>Distinguish deductively valid argu-Let&#x27;s be realistic and evaluate the situation system-56.00 atically,tackling it gradually.</td><td></td></tr><tr><td>14</td><td>penguins_in_a_table</td><td>Answer questions about a table ofLet&#x27;s start by taking a rational and organized ap- penguins and their attributes.</td><td>proach, breaking it down into smaller parts and thinking it through logically, while being realistic and handling it carefully and methodically to en-</td><td>84.25</td></tr><tr><td>15</td><td>dyck_languages</td><td>Correctly close a Dyck-n word.</td><td>sure the right solution. Let&#x27;s be realistic and solve this challenge carefully44.40 and slowly,taking it slow tocomplete itcorrectly,</td><td></td></tr><tr><td>16</td><td>multistep_arithmetic_two</td><td>Solve multi-step arithmetic prob-Before we dive into the answer, lems.</td><td>so we can be realistic and cautiously reach the goal.</td><td>51.60</td></tr><tr><td>17</td><td>navigate</td><td>Given a series of navigation instruc- tions,determine whether one would end up back at the starting point.</td><td>Let&#x27;s logically work together to systematically solve this math problem one step at a time in uni-</td><td>94.20</td></tr><tr><td>18</td><td>reasoning_about_colored_objects</td><td>Answer extremely simple questions about the colors of objects on a sur- face.</td><td>son. Using adetective&#x27;s mindset,break down each ele-88.00 ment of this mathematical reasoning challenge one step at a time and reason like a detective to uncover</td><td></td></tr><tr><td>19</td><td>boolean_expressions</td><td>Evaluate the result of a random Boolean expression.</td><td>the solution. Let&#x27;s gradually unravel this mathematical chal- 90.80 lenge by methodically addressing it by examining each element and investigating each factor.</td><td></td></tr><tr><td>20</td><td>tracking_shuffled_objects_three_objects</td><td>A task requiring determining the fi- nal positions of a set of objects given theirinitialpositionsandadescrip- tion of a sequence of swaps.</td><td>Progress slowly and carefully through this mathe-69.20 matical reasoning challenge one step at a time.</td><td></td></tr><tr><td>20</td><td>tracking_shuffled_objects_five_objects</td><td>nal positions of a set of objects given theirinitial positionsandadescrip-</td><td>Atask requiring determining the fi-Using_a logical,step-by-step approach,work81.20 through this task to find the correct answer.</td><td></td></tr><tr><td>20</td><td>tracking_shuffled_objects_seven_objects</td><td>tion of a sequence of swaps. nal positions of a set of objects given theirinitial positionsandadescrip-</td><td>Atask requiringdetermining thefi-Examine this issuelogicalland indetail,step-by-84.80 step,analyzing each part of the problem one at a time.</td><td></td></tr><tr><td>21</td><td>sports_understanding</td><td>tion of a sequence of swaps. Determinewhether anartificially constructed sentence relating to</td><td>Break down the problem into steps and start solv-96.80 ing it.</td><td></td></tr><tr><td>22</td><td>snarks</td><td>Determine which of two sentences is sarcastic.</td><td>Break down and analyze each part of the problem ina step by step way to ensure the right answer is obtained.</td><td>77.53</td></tr></table>
parse/test/aRtjVZvbpK/aRtjVZvbpK.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/aRtjVZvbpK/aRtjVZvbpK_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/aRtjVZvbpK/aRtjVZvbpK_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/aRtjVZvbpK/aRtjVZvbpK_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/di52zR8xgf/di52zR8xgf.md ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SDXL: IMPROVING LATENT DIFFUSION MODELS FOR HIGH-RESOLUTION IMAGE SYNTHESIS
2
+
3
+ Dustin Podell Zion English Kyle Lacey Andreas Blattmann Tim Dockhorn
4
+
5
+ Jonas Müller
6
+
7
+ Joe Penna
8
+
9
+ Robin Rombach
10
+
11
+ ![](images/46ebae109a0c251c6ab35ff3a41ef8f3783eba325eb6248aa9e5af7d01a16e58.jpg)
12
+
13
+ # ABSTRACT
14
+
15
+ We present Stable Diffusion XL (SDXL), a latent diffusion model for text-to-image synthesis. Compared to previous versions of Stable Diffusion, SDXL leverages a three times larger UNet backbone, achieved by significantly increasing the number of attention blocks and including a second text encoder. Further, we design multiple novel conditioning schemes and train SDXL on multiple aspect ratios. To ensure highest quality results, we also introduce a refinement model which is used to improve the visual fidelity of samples generated by SDXL using a post-hoc image-to-image technique. We demonstrate that SDXL improves dramatically over previous versions of Stable Diffusion and achieves results competitive with those of black-box state-of-the-art image generators such as Midjourney (Holz, 2023).
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ The last year has brought enormous leaps in deep generative modeling across various data domains, such as natural language (Touvron et al., 2023), audio (Huang et al., 2023), and visual media (Rombach et al., 2021; Ramesh et al., 2022; Saharia et al., 2022; Singer et al., 2022; Ho et al., 2022; Blattmann et al., 2023; Esser et al., 2023). In this report, we focus on the latter and unveil SDXL, a drastically improved version of Stable Diffusion. Stable Diffusion is a latent text-to-image diffusion model (DM) which serves as the foundation for an array of recent advancements in, e.g.,
20
+
21
+ 3D classification (Shen et al., 2023), controllable image editing (Zhang & Agrawala, 2023), image personalization (Gal et al., 2022), synthetic data augmentation (Stöckl, 2022), graphical user interface prototyping (Wei et al., 2023), etc. Remarkably, the scope of applications has been extraordinarily extensive, encompassing fields as diverse as music generation (Forsgren & Martiros, 2022) and reconstructing images from fMRI brain scans (Takagi & Nishimoto, 2023).
22
+
23
+ User studies demonstrate that SDXL consistently surpasses all previous versions of Stable Diffusion by a significant margin (see Fig. 1). In this report, we present the design choices which lead to this boost in performance encompassing $i$ ) a $3 \times$ larger UNet-backbone compared to previous Stable Diffusion models (Sec. 2.1), ii) two simple yet effective additional conditioning techniques (Sec. 2.2) which do not require any form of additional supervision, and iii) a separate diffusion-based refinement model which applies a noising-denoising process (Meng et al., 2021) to the latents produced by SDXL to improve the visual quality of its samples (Sec. 2.5).
24
+
25
+ A major concern in the field of visual media creation is that while black-box-models are often recognized as state-of-the-art, the opacity of their architecture prevents faithfully assessing and validating their performance. This lack of transparency hampers reproducibility, stifles innovation, and prevents the community from building upon these models to further the progress of science and art. Moreover, these closed-source strategies make it challenging to assess the biases and limitations of these models in an impartial and objective way, which is crucial for their responsible and ethical deployment. With SDXL we are releasing an open model that achieves competitive performance with black-box image generation models (see Fig. 11 & Fig. 12).
26
+
27
+ # 2 IMPROVING Stable Diffusion
28
+
29
+ In this section we present our improvements for the Stable Diffusion architecture. These are modular, and can be used individually or together to extend any model. Although the following strategies are implemented as extensions to latent diffusion models (LDMs) (Rombach et al., 2021), most of them are also applicable to their pixel-space counterparts.
30
+
31
+ ![](images/88c47eaa60ae0850c75188e6940d904f838466b9593145ce8c5186785f3f73fb.jpg)
32
+ Figure 1: Left: Comparing user preferences between SDXL and Stable Diffusion 1.5 & 2.1. While $S D X L$ already clearly outperforms Stable Diffusion 1.5 & 2.1, adding the additional refinement stage boosts performance. Right: Visualization of the two-stage pipeline: We generate initial latents of size $1 2 8 \times 1 2 8$ using SDXL. Afterwards, we utilize a specialized high-resolution refinement model and apply SDEdit (Meng et al., 2021) on the latents generated in the first step, using the same prompt. SDXL and the refinement model use the same autoencoder.
33
+
34
+ # 2.1 ARCHITECTURE & SCALE
35
+
36
+ Starting with the seminal works Ho et al. (2020) and Song et al. (2020b), which demonstrated that DMs are powerful generative models for image synthesis, the convolutional UNet (Ronneberger et al., 2015) architecture has been the dominant architecture for diffusion-based image synthesis. However, with the development of foundational DMs (Saharia et al., 2022; Ramesh et al., 2022; Rombach et al., 2021), the underlying architecture has constantly evolved: from adding self-attention and improved upscaling layers (Dhariwal & Nichol, 2021), over cross-attention for text-to-image synthesis (Rombach et al., 2021), to pure transformer-based architectures (Peebles & Xie, 2022).
37
+
38
+ Table 1: Comparison of SDXL and older Stable Diffusion models.
39
+
40
+ <table><tr><td>Model</td><td>SDXL</td><td>SD 1.4/1.5</td><td>SD 2.0/2.1</td></tr><tr><td># of UNet params</td><td>2.6B</td><td>860M</td><td>865M</td></tr><tr><td>Transformer blocks</td><td>[0,2,10]</td><td>[1,1,1,1]</td><td>[1, 1, 1, 1]</td></tr><tr><td>Channel mult.</td><td>[1,2,4]</td><td>[1,2,4,4]</td><td>[1,2, 4,4]</td></tr><tr><td>Text encoder</td><td>CLIP ViT-L &amp; OpenCLIP ViT-bigG</td><td>CLIP ViT-L</td><td>OpenCLIP ViT-H</td></tr><tr><td>Context dim.</td><td>2048</td><td>768</td><td>1024</td></tr><tr><td>Pooled text emb.</td><td>OpenCLIP ViT-bigG</td><td>N/A</td><td>N/A</td></tr></table>
41
+
42
+ We follow this trend and, following Hoogeboom et al. (2023), shift the bulk of the transformer computation to lower-level features in the UNet. In particular, and in contrast to the original Stable Diffusion architecture, we use a heterogeneous distribution of transformer blocks within the UNet: For efficiency reasons, we omit the transformer block at the highest feature level, use 2 and 10 blocks at the lower levels, and remove the lowest level $8 \times$ downsampling) in the UNet altogether — see Tab. 1 for a comparison between the architectures of Stable Diffusion 1.x & 2.x and SDXL. We opt for a more powerful pre-trained text encoder that we use for text conditioning. Specifically, we use OpenCLIP ViT-bigG (Ilharco et al., 2021) in combination with CLIP ViT-L (Radford et al., 2021), where we concatenate the penultimate text encoder outputs along the channel-axis (Balaji et al., 2022). Besides using cross-attention layers to condition the model on the text-input, we follow Nichol et al. (2021) and additionally condition the model on the pooled text embedding from the OpenCLIP model. These changes result in a model size of 2.6B parameters in the UNet, see Tab. 1. The text encoders have a total size of 817M parameters.
43
+
44
+ # 2.2 MICRO-CONDITIONING
45
+
46
+ Conditioning the Model on Image Size A notorious shortcoming of the LDM paradigm (Rombach et al., 2021) is the fact that training a model requires a minimal image size, due to its twostage architecture. The two main approaches to tackle this problem are either to discard all training images below a certain minimal resolution (for example, Stable Diffusion 1.4/1.5 discarded all images with any size below 512 pixels), or, alternatively, upscale images that are too small. However, depending on the desired image resolution, the former method can lead to significant portions of the training data being discarded, what will likely lead to a loss in performance and hurt generalization. We visualize such effects in Fig. 2 for the dataset on which SDXL was pretrained. For this particular choice of data, discarding all samples below our pretraining res
47
+
48
+ ![](images/f32ad75503e871fb14ad536999a35a0b92dea365a204de8d51d18a567a021b1f.jpg)
49
+ Figure 2: Height-vs-Width distribution of our pre-training dataset. Without the proposed sizeconditioning, $3 9 \%$ of the data would be discarded due to edge lengths smaller than 256 pixels as visualized by the dashed black lines. Color intensity in each visualized cell is proportional to the number of samples.
50
+
51
+ olution of $2 5 6 ^ { 2 }$ pixels would lead to a significant $39 \%$ of discarded data. The second method, on the other hand, usually introduces upscaling artifacts which may leak into the final model outputs, causing, for example, blurry samples.
52
+
53
+ Instead, we propose to condition the UNet model on the original image resolution, which is trivially available during training. In particular, we provide the original (i.e., before any rescaling) height and width of the images as an additional conditioning to the model $\mathbf { c } _ { \mathrm { s i z e } } = ( h _ { \mathrm { o r i g i n a l } } , w _ { \mathrm { o r i g i n a l } } )$ Each component is independently embedded using a Fourier feature encoding, and these encodings are concatenated into a single vector that we feed into the model by adding it to the timestep embedding (Dhariwal & Nichol, 2021).
54
+
55
+ At inference time, a user can then set the desired apparent resolution of the image via this sizeconditioning. Evidently (see Fig. 3), the model has learned to associate the conditioning $c _ { \mathrm { s i z e } }$ with resolution-dependent image features, which can be leveraged to modify the appearance of an output corresponding to a given prompt. Note that for the visualization shown in Fig. 3, we visualize samples generated by the $5 1 2 \times 5 1 2$ model (see Sec. 2.5 for details), since the effects of the size conditioning are less clearly visible after the subsequent multi-aspect (ratio) finetuning which we use for our final SDXL model.
56
+
57
+ ![](images/160c1ef3b4c33e1e6582722b3a94e8347d06c0b243e1262785aaf0581790c85b.jpg)
58
+ “A robot painted as graffiti on a brick wall. a sidewalk is in front of the wall, and grass is growing out of cracks in the concrete.”
59
+
60
+ ![](images/ad5376f262fd2e24fbe63609582f104c22374d236ccfc766771234e74a57b62f.jpg)
61
+ “Panda mad scientist mixing sparkling chemicals, artstation.”
62
+ Figure 3: The effects of varying the size-conditioning: We show draw 4 samples with the same random seed from $S D X L$ and vary the size-conditioning as depicted above each column. The image quality clearly increases when conditioning on larger image sizes. Samples from the $5 1 2 ^ { 2 }$ model, see Sec. 2.5. Note: For this visualization, we use the $5 1 2 \times 5 1 2$ pixel base model (see Sec. 2.5), since the effect of size conditioning is more clearly visible before $1 0 2 4 \times 1 0 2 4$ finetuning. Best viewed zoomed in.
63
+
64
+ We quantitatively assess the effects of this simple but effective conditioning technique by training and evaluating three LDMs on class conditional ImageNet (Deng et al., 2009) at spatial size $5 1 2 ^ { 2 }$ : For the first model (CIN-512- only) we discard all training examples with at least one edge smaller than 512 pixels what results in a train dataset of only 70k images. For CIN-nocond we use all training examples but without size conditioning. This additional conditioning is only used for CIN-size-cond. After training we generate $5 \mathrm { k }$ samples with 50 DDIM steps (Song et al.,
65
+
66
+ Table 2: Conditioning on the original spatial size of the training examples improves performance on class-conditional ImageNet Deng et al. (2009) on $5 1 2 ^ { 2 }$ resolution.
67
+
68
+ <table><tr><td>model</td><td>FID-5k↓</td><td>IS-5k↑</td></tr><tr><td>CIN-512-only</td><td>43.84</td><td>110.64</td></tr><tr><td>CIN-nocond</td><td>39.76</td><td>211.50</td></tr><tr><td>CIN-size-cond</td><td>36.53</td><td>215.34</td></tr></table>
69
+
70
+ 2020a) and (classifier-free) guidance scale of 5 (Ho & Salimans, 2022) for every model and compute IS Salimans et al. (2016) and FID Heusel et al. (2017) (against the full validation set). For CINsize-cond we generate samples always conditioned on $\mathbf { c } _ { \mathrm { s i z e } } = ( 5 1 2 , 5 1 2 )$ . Tab. 2 summarizes the results and verifies that CIN-size-cond improves upon the baseline models in both metrics. We attribute the degraded performance of CIN-512-only to bad generalization due to overfitting on the small training dataset while the effects of a mode of blurry samples in the sample distribution of CIN-nocond result in a reduced FID score. Note that, although we find these classical quantitative scores not to be suitable for evaluating the performance of foundational (text-to-image) DMs Saharia et al. (2022); Ramesh et al. (2022); Rombach et al. (2021) (see App. E), they remain reasonable metrics on ImageNet as the neural backbones of FID and IS have been trained on ImageNet itself.
71
+
72
+ Conditioning the Model on Cropping Parameters The first two rows of Fig. 4 illustrate a typical failure mode of previous $S D$ models: Synthesized objects can be cropped, such as the cut-off head of the cat in the left examples for $S D \ 1 - 5$ and $S D 2 \mathrm { - } 1$ . An intuitive explanation for this behavior is the use of random cropping during training of the model: As collating a batch in DL frameworks such as PyTorch (Paszke et al., 2019) requires tensors of the same size, a typical processing pipeline “A propaganda poster depicting a cat dressed as french emperor napoleon holding a piece of cheese.”
73
+
74
+ “a close-up of a fire spitting dragon, cinematic shot.”
75
+
76
+ ![](images/d3b2f4d34fdbf532b8ca77b7341620b72813d67ad021c78826823a54bb769152.jpg)
77
+ Figure 4: Comparison of the output of $S D X L$ with previous versions of Stable Diffusion. For each prompt, we show 3 random samples of the respective model for 50 steps of the DDIM sampler Song et al. (2020a) and cfg-scale $8 . 0 \mathrm { H o }$ & Salimans (2022). Additional samples in Fig. 15.
78
+
79
+ is to (i) resize an image such that the shortest size matches the desired target size, followed by (ii) randomly cropping the image along the longer axis. While random cropping is a natural form of data augmentation, it can leak into the generated samples, causing the malicious effects shown above.
80
+
81
+ To fix this problem, we propose another simple yet effective conditioning method: During dataloading, we uniformly sample crop coordinates ${ \mathcal { C } } _ { \mathrm { t o p } }$ and $c _ { \mathrm { l e f t } }$ (integers specifying the amount of pixels cropped from the top-left corner along the height and width axes, respectively) and feed them into the model as conditioning parameters via Fourier feature embeddings, similar to the size conditioning described above. The concatenated embedding ccrop is then used as an additional conditioning parameter. We emphasize that this technique is not limited to LDMs and could be used for any DM. Note that crop- and size-conditioning can be readily combined. In such a case, we concatenate the feature embedding along the channel dimension, before adding it to the timestep embedding in the UNet. Alg. 1 illustrates how we sample ccrop and ${ \bf c } _ { \mathrm { s i z e } }$ during training if such a combination is applied.
82
+
83
+ Given that in our experience large scale datasets are, on average, object-centric, we set $( c _ { \mathrm { t o p } } , c _ { \mathrm { l e f t } } ) = ( 0 , 0 )$ during inference and thereby obtain object-centered samples from the trained model.
84
+
85
+ See Fig. 5 for an illustration: By tuning $\left( c _ { \mathrm { t o p } } , c _ { \mathrm { l e f t } } \right)$ , we can successfully simulate the amount of cropping during inference. This is a form of conditioning-augmentation, and has been used in various forms with AR (Jun et al., 2020) models, and recently with diffusion models (Karras et al., 2022).
86
+
87
+ While other methods such as “data bucketing” (NovelAI, 2023) successfully tackle the same task, we still benefit from croppinginduced data augmentation, while making sure that it does not leak into the generation process - we actually use it to our advantage to gain more control over the image synthesis process. Furthermore, it is easy to implement and can
88
+
89
+ Require: Training dataset of images $\pmb { \mathcal { D } }$
90
+ Require: Target image size for training $\pmb { \mathscr { s } } = ( h _ { \mathrm { t g t } } , w _ { \mathrm { t g t } } )$
91
+ Require: Resizing function $\pmb { R }$
92
+ Require: cropping function function $_ { c }$
93
+ Require: Model train step $_ { \pmb { T } }$ converged False while not converged do x ∼ D woriginal ← width(x) horiginal ← height(x) $\mathbf { c } _ { \mathrm { s i z e } } \gets ( h _ { \mathrm { o r i g i n a l } } , w _ { \mathrm { o r i g i n a l } } )$ x ← R(x, s) ▷ resize smaller image size to target size s if horiginal ≤ woriginal then cleft ∼ U(0, width(x) − sw) ▷ sample cleft ctop = 0 else if $h _ { \mathrm { o r i g i n a l } } > w _ { \mathrm { o r i g i n a l } }$ then $\begin{array} { l } { c _ { \mathrm { t o p } } \sim \mathcal { U } ( 0 , \mathrm { h e i g h t } ( x ) - s _ { h } ) } \\ { c _ { \mathrm { l e f t } } = 0 } \end{array}$ ▷ sample ctop end if ${ \bf c } _ { \mathrm { c r o p } } \gets ( c _ { \mathrm { t o p } } , c _ { \mathrm { l e f t } } )$ $x C ( x , s , \mathbf { c } _ { \mathrm { c r o p } } )$ ▷ crop image to size s converged $ T ( x , \mathbf { c } _ { \mathrm { s i z e } } , \mathbf { c } _ { \mathrm { c } }$ rop) ▷ train model end while
94
+
95
+ ![](images/c2189d18b277d3a1592743e216609610fa47f18e547cbc6bc076b6765359368a.jpg)
96
+ “An astronaut riding a pig, highly realistic dslr photo, cinematic shot.”
97
+
98
+ ![](images/849f1b341544fe39ab6d9e92aa82e6f8be86381b7ea116165f56684f7115b148.jpg)
99
+ “A capybara made of lego sitting in a realistic, natural field.”
100
+ Figure 5: Varying the crop conditioning as discussed in Sec. 2.2. See Fig. 4 and Fig. 15 for samples from SD 1.5 and $S D 2 . 1$ which provide no explicit control of this parameter and thus introduce cropping artifacts. Samples from the $5 1 2 ^ { 2 }$ model, see Sec. 2.5.
101
+
102
+ be applied in an online fashion during training, without additional data preprocessing.
103
+
104
+ # 2.3 MULTI-ASPECT TRAINING
105
+
106
+ Real-world datasets include images of widely varying sizes and aspect-ratios (c.f. fig. 2) While the common output resolutions for text-to-image models are square images of $5 1 2 \times 5 1 2$ or $1 0 2 4 \times 1 0 2 4$ pixels, we argue that this is a rather unnatural choice, given the widespread distribution and use of landscape (e.g., 16:9) or portrait format screens.
107
+
108
+ Motivated by this observation, we finetune our model to handle multiple aspect-ratios simultaneously: We follow common practice (NovelAI, 2023) and partition the data into buckets of different aspect ratios, where we keep the pixel count as close to $1 0 2 4 ^ { 2 }$ pixels as possibly, varying height and width accordingly in multiples of 64. A full list of all aspect ratios used for training is provided in App. H. During optimization, a training batch is composed of images from the same bucket, and we alternate between bucket sizes for each training step. Additionally, the model receives the bucket size (or, target size) as a conditioning, represented as a tuple of integers ${ \bf c } _ { \mathrm { a r } } = ( h _ { \mathrm { t g t } } , w _ { \mathrm { t g t } } )$ which are embedded into a Fourier space similarly to the size- and crop-conditionings described above.
109
+
110
+ In practice, we apply multi-aspect training as a finetuning stage after pretraining the model at a fixed aspect-ratio and resolution and combine it with the conditioning techniques introduced in Sec. 2.2 via concatenation along the channel axis. Fig. 17 in App. I provides python-code for this operation. Note that crop-conditioning and multi-aspect training are complementary operations, and crop-conditioning then only works within the bucket boundaries (usually 64 pixels). For ease of implementation, however, we opt to keep this control parameter for multi-aspect models. We note that this mechanism can be extended to joint multi-aspect, multi-resolution training by varying the total pixel density. In practice, this means that the batch size can be adjusted dynamically depending on the current resolution, to make the best use of availalable VRAM.
111
+
112
+ # 2.4 IMPROVED AUTOENCODER
113
+
114
+ Stable Diffusion is a LDM, operating in a pretrained, learned (and fixed) latent space of an autoencoder (AE). While the bulk of the semantic composition is done by the LDM (Rombach et al., 2021), we can improve local, highfrequency details in generated images by improving the AE. To this end, we train the same AE architecture used for the original Stable Diffusion at a batch-size of 256 and additionally track the weights with an exponential moving average. The resulting AE outperforms the original model in all evaluated reconstruction metrics, see Tab. 3. A small ablation for the influence of these parameters is reported in App. J, we find
115
+
116
+ Table 3: Autoencoder reconstruction performance on the COCO2017 Lin et al. (2015) validation split, images of size $2 5 6 \times 2 5 6$ pixels. Note: Stable Diffusion 2.x uses an improved version of Stable Diffusion 1.x’s autoencoder, where the decoder was finetuned with a reduced weight on the perceptual loss Zhang et al. (2018), and used more compute. Note that our new autoencoder is trained from scratch.
117
+
118
+ <table><tr><td>model</td><td>PNSR ↑</td><td>SSIM↑</td><td>LPIPS↓</td><td>rFID↓</td></tr><tr><td>SDXL-VAE</td><td>24.7</td><td>0.73</td><td>0.88</td><td>4.4</td></tr><tr><td>SD-VAE 1.x</td><td>23.4</td><td>0.69</td><td>0.96</td><td>5.0</td></tr><tr><td>SD-VAE 2.x</td><td>24.5</td><td>0.71</td><td>0.92</td><td>4.7</td></tr></table>
119
+
120
+ that EMA is helpful in all our settings, while the effects of the large batch size are mixed. We use this AE for all of our experiments.
121
+
122
+ # 2.5 PUTTING EVERYTHING TOGETHER
123
+
124
+ We train the final model, SDXL, in a multi-stage procedure. SDXL uses the autoencoder from Sec. 2.4 and a discrete-time diffusion schedule (Ho et al., 2020; Sohl-Dickstein et al., 2015) with 1000 steps. First, we pretrain a base model (see Tab. 1) on an internal dataset whose height- and width-distribution is visualized in Fig. 2 for $6 0 0 0 0 0$ optimization steps at a resolution of $2 5 6 \times 2 5 6$ pixels and a batchsize of 2048, using size- and crop-conditioning as described in Sec. 2.2. We continue training on $\mathrm { 5 1 2 p x }$ for another 200 000 optimization steps, and finally utilize multi-aspect training (Sec. 2.3) in combination with an offset-noise (Guttenberg & CrossLabs, 2023; Lin et al., 2023) level of 0.05 to train the model on different aspect ratios (Sec. 2.3, App. H) of $\sim 1 0 2 4 \times 1 0 2 4$ pixel area.
125
+
126
+ ![](images/facf134b8a3ff73e32cf23a8510056dfc83738c383db9d24e0fa90ecc23dcfd8.jpg)
127
+ Figure 6: $1 0 2 4 ^ { 2 }$ samples (with zoom-ins) from SDXL without (left) and with (right) the refiner model (see Sec. 2.5). Prompt: “Epic long distance cityscape photo of New York City flooded by the ocean and overgrown buildings and jungle ruins in rainforest, at sunset, cinematic shot, highly detailed, 8k, golden light”. See Fig. 14 for additional samples.
128
+
129
+ Refinement Stage Empirically, we find that the resulting model sometimes yields samples of low local quality, see Fig. 6. To improve sample quality, we train a separate LDM in the same latent space, which is specialized on high-quality, high resolution data and employ a noising-denoising process as introduced by SDEdit (Meng et al., 2021) on the samples from the base model, or, alternatively, finish the denoising process with the refiner. We follow (Balaji et al., 2022) and specialize this refinement model on the first 200 (discrete) noise scales. During inference, we render latents from the base SDXL, and directly diffuse and denoise them in latent space with the refinement model (see Fig. 1), using the same text input. We note that this step is optional, but improves sample quality for detailed backgrounds and human faces, as demonstrated in Fig. 6 and Fig. 14.
130
+
131
+ To assess the performance of our model (with and without refinement stage), we conduct a user study, and let users pick their favorite generation from the following four models: SDXL, SDXL (with refiner), Stable Diffusion 1.5 and Stable Diffusion 2.1. The results demonstrate the SDXL with the refinement stage is the highest rated choice, and outperforms Stable Diffusion $1 . 5 \ \& \ 2 . 1$ by a significant margin (win rates: SDXL w/ refinement: $4 8 . 4 \hat { 4 } \%$ , SDXL base: $3 6 . 9 3 \%$ , Stable Diffusion 1.5: $7 . 9 1 \%$ , Stable Diffusion 2.1: $6 . 7 1 \%$ ). See Fig. 1, which also provides an overview of the full pipeline. However, when using classical performance metrics such as FID and CLIP scores the improvements of $S D X L$ over previous methods are not reflected as shown in Fig. 13 and discussed in App. E. This aligns with and further backs the findings of Kirstain et al. (2023).
132
+
133
+ ![](images/7ac219243c5378d06164ae7fd62d57d64a5f1fe32c3d41defebd60782c345ab6.jpg)
134
+ Figure 7: Adding multimodal control: Replacing the pooled text representations of CLIP Radford et al. (2021), which were used during training, with CLIP image features turns SDXL into a multimodal image generator for text-controlled image editing, which can even transfer abstract concepts such as "image grid" (bottom row) from the input image to its output. In contrast to previous work Balaji et al. (2022), this does not require joint image-text-conditioned pretraining but only 1000 finetuning steps of a single network layer.
135
+
136
+ # 2.6 MULTIMODAL CONTROL
137
+
138
+ Starting with SDEdit (Meng et al., 2021), adding image guidance beyond plain text has been a major focus of numerous recent works (Zhang & Agrawala, 2023; Mou et al., 2023; Ruiz et al., 2023; Kawar et al., 2023; Hertz et al., 2022), both with and without further training of the base model. In this section, we describe a simple and efficient approach to turning SDXL into a model guided by both text prompts and input images.
139
+
140
+ As described in Sec. 2.1, we modify the original Stable Diffusion architecture by considering not only the text embedding sequence, but also the pooled (global) text representation of the CLIP-G text encoder. By taking advantage of the fact that the pooled CLIP feature space is a (globally) shared image-text feature space, we can replace this global text representation with a global image representation from the CLIP-G image encoder. To account for the slight discrepancy between image and text embeddings, we fine-tune the embedding layer that maps the CLIP embedding to the UNet’s timestep embedding space (where they are added), and leave the remaining parameters frozen.
141
+
142
+ Fig. 7 demonstrates SDXL’s multimodal processing capabilities after this fine-tuning, where we prompt the model with both an input image and text input. For example, the model is able to extract the concept "grid" from an input image and transfer it to another output controlled by a text prompt (see bottom row, Fig. 7). We note that a similar approach was implemented in (Balaji et al., 2022), utilizing joint image and video training (from scratch) with high dropout rates on the image conditioning. In contrast, using a trained text-to-image model of SDXL, we can replace the pooled CLIP embeddings in a zero-shot manner and achieve high quality by finetuning only the embedding layer for a few thousand steps. Note that we only modify the base model and leave the refiner as is.
143
+
144
+ # 3 CONCLUSION & FUTURE WORK
145
+
146
+ This report presents an analysis of improvements to the foundation model Stable Diffusion for text-toimage synthesis. While we achieve significant improvements in synthesized image quality, prompt adherence and composition, we believe the model may be improved further in the following aspects:
147
+
148
+ Single stage: Currently, we generate the best samples from SDXL with a two-stage approach using our refinement model. This results in having to load two large models into memory, hampering accessibility and sampling speed. Future work should investigate ways to provide a single stage.
149
+
150
+ Text synthesis: While the scale and the larger text encoder (OpenCLIP ViT-bigG (Ilharco et al., 2021)) help to improve the text rendering capabilities over previous versions of Stable Diffusion, incorporating byte-level tokenizers (Xue et al., 2022; Liu et al., 2023) or simply scaling the model to larger sizes (Yu et al., 2022; Saharia et al., 2022) should further improve text synthesis.
151
+
152
+ Architecture: During the exploration stage of this work, we briefly experimented with transformerbased architectures such as UViT (Hoogeboom et al., 2023) and DiT (Peebles & Xie, 2022), but found no immediate benefit. We remain, however, optimistic that a careful hyperparameter study will eventually enable scaling to much larger transformer-dominated architectures.
153
+
154
+ Distillation: While our improvements over Stable Diffusion are significant, they come at the price of increased inference cost (both in VRAM and sampling speed). Future work will thus focus on decreasing the compute needed for inference, and increased sampling speed, for example through guidance- (Meng et al., 2023), knowledge- (Dockhorn et al., 2023; Kim et al., 2023; Li et al., 2023) and progressive distillation (Salimans & Ho, 2022; Berthelot et al., 2023; Meng et al., 2023).
155
+
156
+ Finally, our model is trained in the discrete-time formulation of (Ho et al., 2020), and requires offset-noise (Guttenberg & CrossLabs, 2023; Lin et al., 2023) for aesthetically pleasing results. The EDM-framework of Karras et al. (2022) is a promising candidate for future model training, as its formulation in continuous time allows for increased sampling flexibility and does not require noise-schedule corrections.
157
+
158
+ REFERENCES
159
+ Yogesh Balaji, Seungjun Nah, Xun Huang, Arash Vahdat, Jiaming Song, Karsten Kreis, Miika Aittala, Timo Aila, Samuli Laine, Bryan Catanzaro, Tero Karras, and Ming-Yu Liu. eDiff-I: Text-to-Image Diffusion Models with an Ensemble of Expert Denoisers. arXiv:2211.01324, 2022.
160
+ David Berthelot, Arnaud Autef, Jierui Lin, Dian Ang Yap, Shuangfei Zhai, Siyuan Hu, Daniel Zheng, Walter Talbot, and Eric Gu. TRACT: Denoising Diffusion Models with Transitive Closure Time-Distillation. arXiv:2303.04248, 2023.
161
+ Andreas Blattmann, Robin Rombach, Huan Ling, Tim Dockhorn, Seung Wook Kim, Sanja Fidler, and Karsten Kreis. Align your Latents: High-Resolution Video Synthesis with Latent Diffusion Models. arXiv:2304.08818, 2023.
162
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009.
163
+ Prafulla Dhariwal and Alex Nichol. Diffusion Models Beat GANs on Image Synthesis. arXiv:2105.05233, 2021.
164
+ Tim Dockhorn, Robin Rombach, Andreas Blattmann, and Yaoliang Yu. Distilling the Knowledge in Diffusion Models. CVPR Workshop on Generative Models for Computer Vision, 2023.
165
+ Patrick Esser, Johnathan Chiu, Parmida Atighehchian, Jonathan Granskog, and Anastasis Germanidis. Structure and content-guided video synthesis with diffusion models, 2023.
166
+ Weixi Feng, Xuehai He, Tsu-Jui Fu, Varun Jampani, Arjun Akula, Pradyumna Narayana, Sugato Basu, Xin Eric Wang, and William Yang Wang. Training-free structured diffusion guidance for compositional text-to-image synthesis. arXiv:2212.05032, 2023.
167
+ Seth Forsgren and Hayk Martiros. Riffusion - Stable diffusion for real-time music generation, 2022. URL https://riffusion.com/about.
168
+ Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H Bermano, Gal Chechik, and Daniel Cohen-Or. An image is worth one word: Personalizing text-to-image generation using textual inversion. arXiv:2208.01618, 2022.
169
+ Nicholas Guttenberg and CrossLabs. Diffusion with offset noise, 2023. URL https://www. crosslabs.org/blog/diffusion-with-offset-noise.
170
+ Amir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. Promptto-prompt image editing with cross attention control, 2022.
171
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium. arXiv:1706.08500, 2017.
172
+ Jonathan Ho and Tim Salimans. Classifier-Free Diffusion Guidance. arXiv:2207.12598, 2022.
173
+ Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising Diffusion Probabilistic Models. arXiv preprint arXiv:2006.11239, 2020.
174
+ Jonathan Ho, William Chan, Chitwan Saharia, Jay Whang, Ruiqi Gao, Alexey Gritsenko, Diederik P Kingma, Ben Poole, Mohammad Norouzi, David J Fleet, and Tim Salimans. Imagen Video: High Definition Video Generation with Diffusion Models. arXiv:2210.02303, 2022.
175
+ David Holz. Midjourney, 2023. URL https://www.midjourney.com/home/.
176
+ Emiel Hoogeboom, Jonathan Heek, and Tim Salimans. simple diffusion: End-to-end diffusion for high resolution images. arXiv preprint arXiv:2301.11093, 2023.
177
+ Rongjie Huang, Jiawei Huang, Dongchao Yang, Yi Ren, Luping Liu, Mingze Li, Zhenhui Ye, Jinglin Liu, Xiang Yin, and Zhou Zhao. Make-An-Audio: Text-To-Audio Generation with PromptEnhanced Diffusion Models. arXiv:2301.12661, 2023.
178
+ Aapo Hyvärinen and Peter Dayan. Estimation of Non-Normalized Statistical Models by Score Matching. Journal of Machine Learning Research, 6(4), 2005.
179
+ Gabriel Ilharco, Mitchell Wortsman, Ross Wightman, Cade Gordon, Nicholas Carlini, Rohan Taori, Achal Dave, Vaishaal Shankar, Hongseok Namkoong, John Miller, Hannaneh Hajishirzi, Ali Farhadi, and Ludwig Schmidt. OpenCLIP, July 2021. URL https://doi.org/10.5281/ zenodo.5143773.
180
+ Heewoo Jun, Rewon Child, Mark Chen, John Schulman, Aditya Ramesh, Alec Radford, and Ilya Sutskever. Distribution Augmentation for Generative Modeling. In International Conference on Machine Learning, pp. 5006–5019. PMLR, 2020.
181
+ Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the Design Space of DiffusionBased Generative Models. arXiv:2206.00364, 2022.
182
+ Bahjat Kawar, Shiran Zada, Oran Lang, Omer Tov, Huiwen Chang, Tali Dekel, Inbar Mosseri, and Michal Irani. Imagic: Text-based real image editing with diffusion models, 2023.
183
+ Bo-Kyeong Kim, Hyoung-Kyu Song, Thibault Castells, and Shinkook Choi. On Architectural Compression of Text-to-Image Diffusion Models. arXiv:2305.15798, 2023.
184
+ Yuval Kirstain, Adam Polyak, Uriel Singer, Shahbuland Matiana, Joe Penna, and Omer Levy. Picka-pic: An open dataset of user preferences for text-to-image generation. arXiv:2305.01569, 2023.
185
+ Yanyu Li, Huan Wang, Qing Jin, Ju Hu, Pavlo Chemerys, Yun Fu, Yanzhi Wang, Sergey Tulyakov, and Jian Ren. SnapFusion: Text-to-Image Diffusion Model on Mobile Devices within Two Seconds. arXiv:2306.00980, 2023.
186
+ Shanchuan Lin, Bingchen Liu, Jiashi Li, and Xiao Yang. Common Diffusion Noise Schedules and Sample Steps are Flawed. arXiv:2305.08891, 2023.
187
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, Lubomir Bourdev, Ross Girshick, James Hays, Pietro Perona, Deva Ramanan, C. Lawrence Zitnick, and Piotr Dollár. Microsoft coco: Common objects in context, 2015.
188
+ Rosanne Liu, Dan Garrette, Chitwan Saharia, William Chan, Adam Roberts, Sharan Narang, Irina Blok, RJ Mical, Mohammad Norouzi, and Noah Constant. Character-aware models improve visual text rendering, 2023.
189
+ Chenlin Meng, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. SDEdit: Guided Image Synthesis and Editing with Stochastic Differential Equations. arXiv:2108.01073, 2021.
190
+ Chenlin Meng, Robin Rombach, Ruiqi Gao, Diederik P. Kingma, Stefano Ermon, Jonathan Ho, and Tim Salimans. On distillation of guided diffusion models, 2023.
191
+ Chong Mou, Xintao Wang, Liangbin Xie, Yanze Wu, Jian Zhang, Zhongang Qi, Ying Shan, and Xiaohu Qie. T2i-adapter: Learning adapters to dig out more controllable ability for text-to-image diffusion models, 2023.
192
+ Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. GLIDE: Towards Photorealistic Image Generation and Editing with Text-Guided Diffusion Models. arXiv:2112.10741, 2021.
193
+ NovelAI. Novelai improvements on stable diffusion, 2023. URL https://blog.novelai. net/novelai-improvements-on-stable-diffusion-e10d38db82ac.
194
+ Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Köpf, Edward Yang, Zach DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library, 2019.
195
+ William Peebles and Saining Xie. Scalable Diffusion Models with Transformers. arXiv:2212.09748, 2022.
196
+ Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning Transferable Visual Models From Natural Language Supervision. arXiv:2103.00020, 2021.
197
+ Aditya Ramesh. How dall·e 2 works, 2022. URL http://adityaramesh.com/posts/ dalle2/dalle2.html.
198
+ Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation, 2021.
199
+ Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical TextConditional Image Generation with CLIP Latents. arXiv:2204.06125, 2022.
200
+ Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. HighResolution Image Synthesis with Latent Diffusion Models. arXiv preprint arXiv:2112.10752, 2021.
201
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-Net: Convolutional Networks for Biomedical Image Segmentation. arXiv:1505.04597, 2015.
202
+ Nataniel Ruiz, Yuanzhen Li, Varun Jampani, Yael Pritch, Michael Rubinstein, and Kfir Aberman. Dreambooth: Fine tuning text-to-image diffusion models for subject-driven generation, 2023.
203
+ Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S Sara Mahdavi, Rapha Gontijo Lopes, Tim Salimans, Jonathan Ho, David J Fleet, and Mohammad Norouzi. Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding. arXiv:2205.11487, 2022.
204
+ Tim Salimans and Jonathan Ho. Progressive Distillation for Fast Sampling of Diffusion Models. arXiv preprint arXiv:2202.00512, 2022.
205
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved Techniques for Training GANs. arXiv:1606.03498, 2016.
206
+ Sitian Shen, Zilin Zhu, Linqian Fan, Harry Zhang, and Xinxiao Wu. DiffCLIP: Leveraging Stable Diffusion for Language Grounded 3D Classification. arXiv:2305.15957, 2023.
207
+ Uriel Singer, Adam Polyak, Thomas Hayes, Xi Yin, Jie An, Songyang Zhang, Qiyuan Hu, Harry Yang, Oron Ashual, Oran Gafni, Devi Parikh, Sonal Gupta, and Yaniv Taigman. Make-A-Video: Text-to-Video Generation without Text-Video Data. arXiv:2209.14792, 2022.
208
+ Jascha Sohl-Dickstein, Eric A Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep Unsupervised Learning using Nonequilibrium Thermodynamics. arXiv:1503.03585, 2015.
209
+ Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv:2010.02502, 2020a.
210
+ Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-Based Generative Modeling through Stochastic Differential Equations. arXiv:2011.13456, 2020b.
211
+ Andreas Stöckl. Evaluating a synthetic image dataset generated with stable diffusion. arXiv:2211.01777, 2022.
212
+ Yu Takagi and Shinji Nishimoto. High-Resolution Image Reconstruction With Latent Diffusion Models From Human Brain Activity. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 14453–14463, 2023.
213
+
214
+ Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. LLaMA: Open and Efficient Foundation Language Models. arXiv:2302.13971, 2023.
215
+
216
+ Jialiang Wei, Anne-Lise Courbis, Thomas Lambolais, Binbin Xu, Pierre Louis Bernard, and Gérard Dray. Boosting gui prototyping with diffusion models. arXiv preprint arXiv:2306.06233, 2023.
217
+
218
+ Linting Xue, Aditya Barua, Noah Constant, Rami Al-Rfou, Sharan Narang, Mihir Kale, Adam Roberts, and Colin Raffel. Byt5: Towards a token-free future with pre-trained byte-to-byte models, 2022.
219
+
220
+ Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, Ben Hutchinson, Wei Han, Zarana Parekh, Xin Li, Han Zhang, Jason Baldridge, and Yonghui Wu. Scaling autoregressive models for content-rich text-to-image generation, 2022.
221
+
222
+ Lvmin Zhang and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models. arXiv:2302.05543, 2023.
223
+
224
+ Richard Zhang, Phillip Isola, Alexei A. Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric, 2018.
parse/test/di52zR8xgf/di52zR8xgf_content_list.json ADDED
@@ -0,0 +1,468 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "SDXL: IMPROVING LATENT DIFFUSION MODELS FOR HIGH-RESOLUTION IMAGE SYNTHESIS ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Dustin Podell Zion English Kyle Lacey Andreas Blattmann Tim Dockhorn ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "Jonas Müller ",
16
+ "page_idx": 0
17
+ },
18
+ {
19
+ "type": "text",
20
+ "text": "Joe Penna ",
21
+ "page_idx": 0
22
+ },
23
+ {
24
+ "type": "text",
25
+ "text": "Robin Rombach ",
26
+ "page_idx": 0
27
+ },
28
+ {
29
+ "type": "image",
30
+ "img_path": "images/46ebae109a0c251c6ab35ff3a41ef8f3783eba325eb6248aa9e5af7d01a16e58.jpg",
31
+ "image_caption": [],
32
+ "image_footnote": [],
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "ABSTRACT ",
38
+ "text_level": 1,
39
+ "page_idx": 0
40
+ },
41
+ {
42
+ "type": "text",
43
+ "text": "We present Stable Diffusion XL (SDXL), a latent diffusion model for text-to-image synthesis. Compared to previous versions of Stable Diffusion, SDXL leverages a three times larger UNet backbone, achieved by significantly increasing the number of attention blocks and including a second text encoder. Further, we design multiple novel conditioning schemes and train SDXL on multiple aspect ratios. To ensure highest quality results, we also introduce a refinement model which is used to improve the visual fidelity of samples generated by SDXL using a post-hoc image-to-image technique. We demonstrate that SDXL improves dramatically over previous versions of Stable Diffusion and achieves results competitive with those of black-box state-of-the-art image generators such as Midjourney (Holz, 2023). ",
44
+ "page_idx": 0
45
+ },
46
+ {
47
+ "type": "text",
48
+ "text": "1 INTRODUCTION ",
49
+ "text_level": 1,
50
+ "page_idx": 0
51
+ },
52
+ {
53
+ "type": "text",
54
+ "text": "The last year has brought enormous leaps in deep generative modeling across various data domains, such as natural language (Touvron et al., 2023), audio (Huang et al., 2023), and visual media (Rombach et al., 2021; Ramesh et al., 2022; Saharia et al., 2022; Singer et al., 2022; Ho et al., 2022; Blattmann et al., 2023; Esser et al., 2023). In this report, we focus on the latter and unveil SDXL, a drastically improved version of Stable Diffusion. Stable Diffusion is a latent text-to-image diffusion model (DM) which serves as the foundation for an array of recent advancements in, e.g., ",
55
+ "page_idx": 0
56
+ },
57
+ {
58
+ "type": "text",
59
+ "text": "3D classification (Shen et al., 2023), controllable image editing (Zhang & Agrawala, 2023), image personalization (Gal et al., 2022), synthetic data augmentation (Stöckl, 2022), graphical user interface prototyping (Wei et al., 2023), etc. Remarkably, the scope of applications has been extraordinarily extensive, encompassing fields as diverse as music generation (Forsgren & Martiros, 2022) and reconstructing images from fMRI brain scans (Takagi & Nishimoto, 2023). ",
60
+ "page_idx": 1
61
+ },
62
+ {
63
+ "type": "text",
64
+ "text": "User studies demonstrate that SDXL consistently surpasses all previous versions of Stable Diffusion by a significant margin (see Fig. 1). In this report, we present the design choices which lead to this boost in performance encompassing $i$ ) a $3 \\times$ larger UNet-backbone compared to previous Stable Diffusion models (Sec. 2.1), ii) two simple yet effective additional conditioning techniques (Sec. 2.2) which do not require any form of additional supervision, and iii) a separate diffusion-based refinement model which applies a noising-denoising process (Meng et al., 2021) to the latents produced by SDXL to improve the visual quality of its samples (Sec. 2.5). ",
65
+ "page_idx": 1
66
+ },
67
+ {
68
+ "type": "text",
69
+ "text": "A major concern in the field of visual media creation is that while black-box-models are often recognized as state-of-the-art, the opacity of their architecture prevents faithfully assessing and validating their performance. This lack of transparency hampers reproducibility, stifles innovation, and prevents the community from building upon these models to further the progress of science and art. Moreover, these closed-source strategies make it challenging to assess the biases and limitations of these models in an impartial and objective way, which is crucial for their responsible and ethical deployment. With SDXL we are releasing an open model that achieves competitive performance with black-box image generation models (see Fig. 11 & Fig. 12). ",
70
+ "page_idx": 1
71
+ },
72
+ {
73
+ "type": "text",
74
+ "text": "2 IMPROVING Stable Diffusion ",
75
+ "text_level": 1,
76
+ "page_idx": 1
77
+ },
78
+ {
79
+ "type": "text",
80
+ "text": "In this section we present our improvements for the Stable Diffusion architecture. These are modular, and can be used individually or together to extend any model. Although the following strategies are implemented as extensions to latent diffusion models (LDMs) (Rombach et al., 2021), most of them are also applicable to their pixel-space counterparts. ",
81
+ "page_idx": 1
82
+ },
83
+ {
84
+ "type": "image",
85
+ "img_path": "images/88c47eaa60ae0850c75188e6940d904f838466b9593145ce8c5186785f3f73fb.jpg",
86
+ "image_caption": [
87
+ "Figure 1: Left: Comparing user preferences between SDXL and Stable Diffusion 1.5 & 2.1. While $S D X L$ already clearly outperforms Stable Diffusion 1.5 & 2.1, adding the additional refinement stage boosts performance. Right: Visualization of the two-stage pipeline: We generate initial latents of size $1 2 8 \\times 1 2 8$ using SDXL. Afterwards, we utilize a specialized high-resolution refinement model and apply SDEdit (Meng et al., 2021) on the latents generated in the first step, using the same prompt. SDXL and the refinement model use the same autoencoder. "
88
+ ],
89
+ "image_footnote": [],
90
+ "page_idx": 1
91
+ },
92
+ {
93
+ "type": "text",
94
+ "text": "2.1 ARCHITECTURE & SCALE ",
95
+ "text_level": 1,
96
+ "page_idx": 1
97
+ },
98
+ {
99
+ "type": "text",
100
+ "text": "Starting with the seminal works Ho et al. (2020) and Song et al. (2020b), which demonstrated that DMs are powerful generative models for image synthesis, the convolutional UNet (Ronneberger et al., 2015) architecture has been the dominant architecture for diffusion-based image synthesis. However, with the development of foundational DMs (Saharia et al., 2022; Ramesh et al., 2022; Rombach et al., 2021), the underlying architecture has constantly evolved: from adding self-attention and improved upscaling layers (Dhariwal & Nichol, 2021), over cross-attention for text-to-image synthesis (Rombach et al., 2021), to pure transformer-based architectures (Peebles & Xie, 2022). ",
101
+ "page_idx": 1
102
+ },
103
+ {
104
+ "type": "table",
105
+ "img_path": "images/cd12cdf7ae4fdefcdcb06298dc9bf5c9d5f0def4d1a315f1d89f55723bc77b47.jpg",
106
+ "table_caption": [
107
+ "Table 1: Comparison of SDXL and older Stable Diffusion models. "
108
+ ],
109
+ "table_footnote": [],
110
+ "table_body": "<table><tr><td>Model</td><td>SDXL</td><td>SD 1.4/1.5</td><td>SD 2.0/2.1</td></tr><tr><td># of UNet params</td><td>2.6B</td><td>860M</td><td>865M</td></tr><tr><td>Transformer blocks</td><td>[0,2,10]</td><td>[1,1,1,1]</td><td>[1, 1, 1, 1]</td></tr><tr><td>Channel mult.</td><td>[1,2,4]</td><td>[1,2,4,4]</td><td>[1,2, 4,4]</td></tr><tr><td>Text encoder</td><td>CLIP ViT-L &amp; OpenCLIP ViT-bigG</td><td>CLIP ViT-L</td><td>OpenCLIP ViT-H</td></tr><tr><td>Context dim.</td><td>2048</td><td>768</td><td>1024</td></tr><tr><td>Pooled text emb.</td><td>OpenCLIP ViT-bigG</td><td>N/A</td><td>N/A</td></tr></table>",
111
+ "page_idx": 2
112
+ },
113
+ {
114
+ "type": "text",
115
+ "text": "We follow this trend and, following Hoogeboom et al. (2023), shift the bulk of the transformer computation to lower-level features in the UNet. In particular, and in contrast to the original Stable Diffusion architecture, we use a heterogeneous distribution of transformer blocks within the UNet: For efficiency reasons, we omit the transformer block at the highest feature level, use 2 and 10 blocks at the lower levels, and remove the lowest level $8 \\times$ downsampling) in the UNet altogether — see Tab. 1 for a comparison between the architectures of Stable Diffusion 1.x & 2.x and SDXL. We opt for a more powerful pre-trained text encoder that we use for text conditioning. Specifically, we use OpenCLIP ViT-bigG (Ilharco et al., 2021) in combination with CLIP ViT-L (Radford et al., 2021), where we concatenate the penultimate text encoder outputs along the channel-axis (Balaji et al., 2022). Besides using cross-attention layers to condition the model on the text-input, we follow Nichol et al. (2021) and additionally condition the model on the pooled text embedding from the OpenCLIP model. These changes result in a model size of 2.6B parameters in the UNet, see Tab. 1. The text encoders have a total size of 817M parameters. ",
116
+ "page_idx": 2
117
+ },
118
+ {
119
+ "type": "text",
120
+ "text": "2.2 MICRO-CONDITIONING ",
121
+ "text_level": 1,
122
+ "page_idx": 2
123
+ },
124
+ {
125
+ "type": "text",
126
+ "text": "Conditioning the Model on Image Size A notorious shortcoming of the LDM paradigm (Rombach et al., 2021) is the fact that training a model requires a minimal image size, due to its twostage architecture. The two main approaches to tackle this problem are either to discard all training images below a certain minimal resolution (for example, Stable Diffusion 1.4/1.5 discarded all images with any size below 512 pixels), or, alternatively, upscale images that are too small. However, depending on the desired image resolution, the former method can lead to significant portions of the training data being discarded, what will likely lead to a loss in performance and hurt generalization. We visualize such effects in Fig. 2 for the dataset on which SDXL was pretrained. For this particular choice of data, discarding all samples below our pretraining res",
127
+ "page_idx": 2
128
+ },
129
+ {
130
+ "type": "image",
131
+ "img_path": "images/f32ad75503e871fb14ad536999a35a0b92dea365a204de8d51d18a567a021b1f.jpg",
132
+ "image_caption": [
133
+ "Figure 2: Height-vs-Width distribution of our pre-training dataset. Without the proposed sizeconditioning, $3 9 \\%$ of the data would be discarded due to edge lengths smaller than 256 pixels as visualized by the dashed black lines. Color intensity in each visualized cell is proportional to the number of samples. "
134
+ ],
135
+ "image_footnote": [],
136
+ "page_idx": 2
137
+ },
138
+ {
139
+ "type": "text",
140
+ "text": "olution of $2 5 6 ^ { 2 }$ pixels would lead to a significant $39 \\%$ of discarded data. The second method, on the other hand, usually introduces upscaling artifacts which may leak into the final model outputs, causing, for example, blurry samples. ",
141
+ "page_idx": 2
142
+ },
143
+ {
144
+ "type": "text",
145
+ "text": "Instead, we propose to condition the UNet model on the original image resolution, which is trivially available during training. In particular, we provide the original (i.e., before any rescaling) height and width of the images as an additional conditioning to the model $\\mathbf { c } _ { \\mathrm { s i z e } } = ( h _ { \\mathrm { o r i g i n a l } } , w _ { \\mathrm { o r i g i n a l } } )$ Each component is independently embedded using a Fourier feature encoding, and these encodings are concatenated into a single vector that we feed into the model by adding it to the timestep embedding (Dhariwal & Nichol, 2021). ",
146
+ "page_idx": 2
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "At inference time, a user can then set the desired apparent resolution of the image via this sizeconditioning. Evidently (see Fig. 3), the model has learned to associate the conditioning $c _ { \\mathrm { s i z e } }$ with resolution-dependent image features, which can be leveraged to modify the appearance of an output corresponding to a given prompt. Note that for the visualization shown in Fig. 3, we visualize samples generated by the $5 1 2 \\times 5 1 2$ model (see Sec. 2.5 for details), since the effects of the size conditioning are less clearly visible after the subsequent multi-aspect (ratio) finetuning which we use for our final SDXL model. ",
151
+ "page_idx": 2
152
+ },
153
+ {
154
+ "type": "image",
155
+ "img_path": "images/160c1ef3b4c33e1e6582722b3a94e8347d06c0b243e1262785aaf0581790c85b.jpg",
156
+ "image_caption": [
157
+ "“A robot painted as graffiti on a brick wall. a sidewalk is in front of the wall, and grass is growing out of cracks in the concrete.” "
158
+ ],
159
+ "image_footnote": [],
160
+ "page_idx": 3
161
+ },
162
+ {
163
+ "type": "image",
164
+ "img_path": "images/ad5376f262fd2e24fbe63609582f104c22374d236ccfc766771234e74a57b62f.jpg",
165
+ "image_caption": [
166
+ "“Panda mad scientist mixing sparkling chemicals, artstation.” ",
167
+ "Figure 3: The effects of varying the size-conditioning: We show draw 4 samples with the same random seed from $S D X L$ and vary the size-conditioning as depicted above each column. The image quality clearly increases when conditioning on larger image sizes. Samples from the $5 1 2 ^ { 2 }$ model, see Sec. 2.5. Note: For this visualization, we use the $5 1 2 \\times 5 1 2$ pixel base model (see Sec. 2.5), since the effect of size conditioning is more clearly visible before $1 0 2 4 \\times 1 0 2 4$ finetuning. Best viewed zoomed in. "
168
+ ],
169
+ "image_footnote": [],
170
+ "page_idx": 3
171
+ },
172
+ {
173
+ "type": "text",
174
+ "text": "",
175
+ "page_idx": 3
176
+ },
177
+ {
178
+ "type": "text",
179
+ "text": "We quantitatively assess the effects of this simple but effective conditioning technique by training and evaluating three LDMs on class conditional ImageNet (Deng et al., 2009) at spatial size $5 1 2 ^ { 2 }$ : For the first model (CIN-512- only) we discard all training examples with at least one edge smaller than 512 pixels what results in a train dataset of only 70k images. For CIN-nocond we use all training examples but without size conditioning. This additional conditioning is only used for CIN-size-cond. After training we generate $5 \\mathrm { k }$ samples with 50 DDIM steps (Song et al., ",
180
+ "page_idx": 3
181
+ },
182
+ {
183
+ "type": "table",
184
+ "img_path": "images/1436763b4cfd6cbba473e4cc003046c5cdc1f9e73c3a2e2c81519dc97028586d.jpg",
185
+ "table_caption": [
186
+ "Table 2: Conditioning on the original spatial size of the training examples improves performance on class-conditional ImageNet Deng et al. (2009) on $5 1 2 ^ { 2 }$ resolution. "
187
+ ],
188
+ "table_footnote": [],
189
+ "table_body": "<table><tr><td>model</td><td>FID-5k↓</td><td>IS-5k↑</td></tr><tr><td>CIN-512-only</td><td>43.84</td><td>110.64</td></tr><tr><td>CIN-nocond</td><td>39.76</td><td>211.50</td></tr><tr><td>CIN-size-cond</td><td>36.53</td><td>215.34</td></tr></table>",
190
+ "page_idx": 3
191
+ },
192
+ {
193
+ "type": "text",
194
+ "text": "2020a) and (classifier-free) guidance scale of 5 (Ho & Salimans, 2022) for every model and compute IS Salimans et al. (2016) and FID Heusel et al. (2017) (against the full validation set). For CINsize-cond we generate samples always conditioned on $\\mathbf { c } _ { \\mathrm { s i z e } } = ( 5 1 2 , 5 1 2 )$ . Tab. 2 summarizes the results and verifies that CIN-size-cond improves upon the baseline models in both metrics. We attribute the degraded performance of CIN-512-only to bad generalization due to overfitting on the small training dataset while the effects of a mode of blurry samples in the sample distribution of CIN-nocond result in a reduced FID score. Note that, although we find these classical quantitative scores not to be suitable for evaluating the performance of foundational (text-to-image) DMs Saharia et al. (2022); Ramesh et al. (2022); Rombach et al. (2021) (see App. E), they remain reasonable metrics on ImageNet as the neural backbones of FID and IS have been trained on ImageNet itself. ",
195
+ "page_idx": 3
196
+ },
197
+ {
198
+ "type": "text",
199
+ "text": "Conditioning the Model on Cropping Parameters The first two rows of Fig. 4 illustrate a typical failure mode of previous $S D$ models: Synthesized objects can be cropped, such as the cut-off head of the cat in the left examples for $S D \\ 1 - 5$ and $S D 2 \\mathrm { - } 1$ . An intuitive explanation for this behavior is the use of random cropping during training of the model: As collating a batch in DL frameworks such as PyTorch (Paszke et al., 2019) requires tensors of the same size, a typical processing pipeline “A propaganda poster depicting a cat dressed as french emperor napoleon holding a piece of cheese.” ",
200
+ "page_idx": 3
201
+ },
202
+ {
203
+ "type": "text",
204
+ "text": "",
205
+ "page_idx": 4
206
+ },
207
+ {
208
+ "type": "text",
209
+ "text": "“a close-up of a fire spitting dragon, cinematic shot.” ",
210
+ "page_idx": 4
211
+ },
212
+ {
213
+ "type": "image",
214
+ "img_path": "images/d3b2f4d34fdbf532b8ca77b7341620b72813d67ad021c78826823a54bb769152.jpg",
215
+ "image_caption": [
216
+ "Figure 4: Comparison of the output of $S D X L$ with previous versions of Stable Diffusion. For each prompt, we show 3 random samples of the respective model for 50 steps of the DDIM sampler Song et al. (2020a) and cfg-scale $8 . 0 \\mathrm { H o }$ & Salimans (2022). Additional samples in Fig. 15. "
217
+ ],
218
+ "image_footnote": [],
219
+ "page_idx": 4
220
+ },
221
+ {
222
+ "type": "text",
223
+ "text": "is to (i) resize an image such that the shortest size matches the desired target size, followed by (ii) randomly cropping the image along the longer axis. While random cropping is a natural form of data augmentation, it can leak into the generated samples, causing the malicious effects shown above. ",
224
+ "page_idx": 4
225
+ },
226
+ {
227
+ "type": "text",
228
+ "text": "To fix this problem, we propose another simple yet effective conditioning method: During dataloading, we uniformly sample crop coordinates ${ \\mathcal { C } } _ { \\mathrm { t o p } }$ and $c _ { \\mathrm { l e f t } }$ (integers specifying the amount of pixels cropped from the top-left corner along the height and width axes, respectively) and feed them into the model as conditioning parameters via Fourier feature embeddings, similar to the size conditioning described above. The concatenated embedding ccrop is then used as an additional conditioning parameter. We emphasize that this technique is not limited to LDMs and could be used for any DM. Note that crop- and size-conditioning can be readily combined. In such a case, we concatenate the feature embedding along the channel dimension, before adding it to the timestep embedding in the UNet. Alg. 1 illustrates how we sample ccrop and ${ \\bf c } _ { \\mathrm { s i z e } }$ during training if such a combination is applied. ",
229
+ "page_idx": 4
230
+ },
231
+ {
232
+ "type": "text",
233
+ "text": "Given that in our experience large scale datasets are, on average, object-centric, we set $( c _ { \\mathrm { t o p } } , c _ { \\mathrm { l e f t } } ) = ( 0 , 0 )$ during inference and thereby obtain object-centered samples from the trained model. ",
234
+ "page_idx": 4
235
+ },
236
+ {
237
+ "type": "text",
238
+ "text": "See Fig. 5 for an illustration: By tuning $\\left( c _ { \\mathrm { t o p } } , c _ { \\mathrm { l e f t } } \\right)$ , we can successfully simulate the amount of cropping during inference. This is a form of conditioning-augmentation, and has been used in various forms with AR (Jun et al., 2020) models, and recently with diffusion models (Karras et al., 2022). ",
239
+ "page_idx": 4
240
+ },
241
+ {
242
+ "type": "text",
243
+ "text": "While other methods such as “data bucketing” (NovelAI, 2023) successfully tackle the same task, we still benefit from croppinginduced data augmentation, while making sure that it does not leak into the generation process - we actually use it to our advantage to gain more control over the image synthesis process. Furthermore, it is easy to implement and can ",
244
+ "page_idx": 4
245
+ },
246
+ {
247
+ "type": "text",
248
+ "text": "Require: Training dataset of images $\\pmb { \\mathcal { D } }$ \nRequire: Target image size for training $\\pmb { \\mathscr { s } } = ( h _ { \\mathrm { t g t } } , w _ { \\mathrm { t g t } } )$ \nRequire: Resizing function $\\pmb { R }$ \nRequire: cropping function function $_ { c }$ \nRequire: Model train step $_ { \\pmb { T } }$ converged False while not converged do x ∼ D woriginal ← width(x) horiginal ← height(x) $\\mathbf { c } _ { \\mathrm { s i z e } } \\gets ( h _ { \\mathrm { o r i g i n a l } } , w _ { \\mathrm { o r i g i n a l } } )$ x ← R(x, s) ▷ resize smaller image size to target size s if horiginal ≤ woriginal then cleft ∼ U(0, width(x) − sw) ▷ sample cleft ctop = 0 else if $h _ { \\mathrm { o r i g i n a l } } > w _ { \\mathrm { o r i g i n a l } }$ then $\\begin{array} { l } { c _ { \\mathrm { t o p } } \\sim \\mathcal { U } ( 0 , \\mathrm { h e i g h t } ( x ) - s _ { h } ) } \\\\ { c _ { \\mathrm { l e f t } } = 0 } \\end{array}$ ▷ sample ctop end if ${ \\bf c } _ { \\mathrm { c r o p } } \\gets ( c _ { \\mathrm { t o p } } , c _ { \\mathrm { l e f t } } )$ $x C ( x , s , \\mathbf { c } _ { \\mathrm { c r o p } } )$ ▷ crop image to size s converged $ T ( x , \\mathbf { c } _ { \\mathrm { s i z e } } , \\mathbf { c } _ { \\mathrm { c } }$ rop) ▷ train model end while ",
249
+ "page_idx": 4
250
+ },
251
+ {
252
+ "type": "image",
253
+ "img_path": "images/c2189d18b277d3a1592743e216609610fa47f18e547cbc6bc076b6765359368a.jpg",
254
+ "image_caption": [
255
+ "“An astronaut riding a pig, highly realistic dslr photo, cinematic shot.” "
256
+ ],
257
+ "image_footnote": [],
258
+ "page_idx": 5
259
+ },
260
+ {
261
+ "type": "image",
262
+ "img_path": "images/849f1b341544fe39ab6d9e92aa82e6f8be86381b7ea116165f56684f7115b148.jpg",
263
+ "image_caption": [
264
+ "“A capybara made of lego sitting in a realistic, natural field.” ",
265
+ "Figure 5: Varying the crop conditioning as discussed in Sec. 2.2. See Fig. 4 and Fig. 15 for samples from SD 1.5 and $S D 2 . 1$ which provide no explicit control of this parameter and thus introduce cropping artifacts. Samples from the $5 1 2 ^ { 2 }$ model, see Sec. 2.5. "
266
+ ],
267
+ "image_footnote": [],
268
+ "page_idx": 5
269
+ },
270
+ {
271
+ "type": "text",
272
+ "text": "be applied in an online fashion during training, without additional data preprocessing. ",
273
+ "page_idx": 5
274
+ },
275
+ {
276
+ "type": "text",
277
+ "text": "2.3 MULTI-ASPECT TRAINING ",
278
+ "text_level": 1,
279
+ "page_idx": 5
280
+ },
281
+ {
282
+ "type": "text",
283
+ "text": "Real-world datasets include images of widely varying sizes and aspect-ratios (c.f. fig. 2) While the common output resolutions for text-to-image models are square images of $5 1 2 \\times 5 1 2$ or $1 0 2 4 \\times 1 0 2 4$ pixels, we argue that this is a rather unnatural choice, given the widespread distribution and use of landscape (e.g., 16:9) or portrait format screens. ",
284
+ "page_idx": 5
285
+ },
286
+ {
287
+ "type": "text",
288
+ "text": "Motivated by this observation, we finetune our model to handle multiple aspect-ratios simultaneously: We follow common practice (NovelAI, 2023) and partition the data into buckets of different aspect ratios, where we keep the pixel count as close to $1 0 2 4 ^ { 2 }$ pixels as possibly, varying height and width accordingly in multiples of 64. A full list of all aspect ratios used for training is provided in App. H. During optimization, a training batch is composed of images from the same bucket, and we alternate between bucket sizes for each training step. Additionally, the model receives the bucket size (or, target size) as a conditioning, represented as a tuple of integers ${ \\bf c } _ { \\mathrm { a r } } = ( h _ { \\mathrm { t g t } } , w _ { \\mathrm { t g t } } )$ which are embedded into a Fourier space similarly to the size- and crop-conditionings described above. ",
289
+ "page_idx": 5
290
+ },
291
+ {
292
+ "type": "text",
293
+ "text": "In practice, we apply multi-aspect training as a finetuning stage after pretraining the model at a fixed aspect-ratio and resolution and combine it with the conditioning techniques introduced in Sec. 2.2 via concatenation along the channel axis. Fig. 17 in App. I provides python-code for this operation. Note that crop-conditioning and multi-aspect training are complementary operations, and crop-conditioning then only works within the bucket boundaries (usually 64 pixels). For ease of implementation, however, we opt to keep this control parameter for multi-aspect models. We note that this mechanism can be extended to joint multi-aspect, multi-resolution training by varying the total pixel density. In practice, this means that the batch size can be adjusted dynamically depending on the current resolution, to make the best use of availalable VRAM. ",
294
+ "page_idx": 5
295
+ },
296
+ {
297
+ "type": "text",
298
+ "text": "2.4 IMPROVED AUTOENCODER ",
299
+ "text_level": 1,
300
+ "page_idx": 6
301
+ },
302
+ {
303
+ "type": "text",
304
+ "text": "Stable Diffusion is a LDM, operating in a pretrained, learned (and fixed) latent space of an autoencoder (AE). While the bulk of the semantic composition is done by the LDM (Rombach et al., 2021), we can improve local, highfrequency details in generated images by improving the AE. To this end, we train the same AE architecture used for the original Stable Diffusion at a batch-size of 256 and additionally track the weights with an exponential moving average. The resulting AE outperforms the original model in all evaluated reconstruction metrics, see Tab. 3. A small ablation for the influence of these parameters is reported in App. J, we find ",
305
+ "page_idx": 6
306
+ },
307
+ {
308
+ "type": "table",
309
+ "img_path": "images/82ce5e85cbe8229a2c2b03066d9ece3435c8ec9e06fa0857984635ebdfb764ff.jpg",
310
+ "table_caption": [
311
+ "Table 3: Autoencoder reconstruction performance on the COCO2017 Lin et al. (2015) validation split, images of size $2 5 6 \\times 2 5 6$ pixels. Note: Stable Diffusion 2.x uses an improved version of Stable Diffusion 1.x’s autoencoder, where the decoder was finetuned with a reduced weight on the perceptual loss Zhang et al. (2018), and used more compute. Note that our new autoencoder is trained from scratch. "
312
+ ],
313
+ "table_footnote": [],
314
+ "table_body": "<table><tr><td>model</td><td>PNSR ↑</td><td>SSIM↑</td><td>LPIPS↓</td><td>rFID↓</td></tr><tr><td>SDXL-VAE</td><td>24.7</td><td>0.73</td><td>0.88</td><td>4.4</td></tr><tr><td>SD-VAE 1.x</td><td>23.4</td><td>0.69</td><td>0.96</td><td>5.0</td></tr><tr><td>SD-VAE 2.x</td><td>24.5</td><td>0.71</td><td>0.92</td><td>4.7</td></tr></table>",
315
+ "page_idx": 6
316
+ },
317
+ {
318
+ "type": "text",
319
+ "text": "that EMA is helpful in all our settings, while the effects of the large batch size are mixed. We use this AE for all of our experiments. ",
320
+ "page_idx": 6
321
+ },
322
+ {
323
+ "type": "text",
324
+ "text": "2.5 PUTTING EVERYTHING TOGETHER ",
325
+ "text_level": 1,
326
+ "page_idx": 6
327
+ },
328
+ {
329
+ "type": "text",
330
+ "text": "We train the final model, SDXL, in a multi-stage procedure. SDXL uses the autoencoder from Sec. 2.4 and a discrete-time diffusion schedule (Ho et al., 2020; Sohl-Dickstein et al., 2015) with 1000 steps. First, we pretrain a base model (see Tab. 1) on an internal dataset whose height- and width-distribution is visualized in Fig. 2 for $6 0 0 0 0 0$ optimization steps at a resolution of $2 5 6 \\times 2 5 6$ pixels and a batchsize of 2048, using size- and crop-conditioning as described in Sec. 2.2. We continue training on $\\mathrm { 5 1 2 p x }$ for another 200 000 optimization steps, and finally utilize multi-aspect training (Sec. 2.3) in combination with an offset-noise (Guttenberg & CrossLabs, 2023; Lin et al., 2023) level of 0.05 to train the model on different aspect ratios (Sec. 2.3, App. H) of $\\sim 1 0 2 4 \\times 1 0 2 4$ pixel area. ",
331
+ "page_idx": 6
332
+ },
333
+ {
334
+ "type": "image",
335
+ "img_path": "images/facf134b8a3ff73e32cf23a8510056dfc83738c383db9d24e0fa90ecc23dcfd8.jpg",
336
+ "image_caption": [
337
+ "Figure 6: $1 0 2 4 ^ { 2 }$ samples (with zoom-ins) from SDXL without (left) and with (right) the refiner model (see Sec. 2.5). Prompt: “Epic long distance cityscape photo of New York City flooded by the ocean and overgrown buildings and jungle ruins in rainforest, at sunset, cinematic shot, highly detailed, 8k, golden light”. See Fig. 14 for additional samples. "
338
+ ],
339
+ "image_footnote": [],
340
+ "page_idx": 6
341
+ },
342
+ {
343
+ "type": "text",
344
+ "text": "Refinement Stage Empirically, we find that the resulting model sometimes yields samples of low local quality, see Fig. 6. To improve sample quality, we train a separate LDM in the same latent space, which is specialized on high-quality, high resolution data and employ a noising-denoising process as introduced by SDEdit (Meng et al., 2021) on the samples from the base model, or, alternatively, finish the denoising process with the refiner. We follow (Balaji et al., 2022) and specialize this refinement model on the first 200 (discrete) noise scales. During inference, we render latents from the base SDXL, and directly diffuse and denoise them in latent space with the refinement model (see Fig. 1), using the same text input. We note that this step is optional, but improves sample quality for detailed backgrounds and human faces, as demonstrated in Fig. 6 and Fig. 14. ",
345
+ "page_idx": 7
346
+ },
347
+ {
348
+ "type": "text",
349
+ "text": "To assess the performance of our model (with and without refinement stage), we conduct a user study, and let users pick their favorite generation from the following four models: SDXL, SDXL (with refiner), Stable Diffusion 1.5 and Stable Diffusion 2.1. The results demonstrate the SDXL with the refinement stage is the highest rated choice, and outperforms Stable Diffusion $1 . 5 \\ \\& \\ 2 . 1$ by a significant margin (win rates: SDXL w/ refinement: $4 8 . 4 \\hat { 4 } \\%$ , SDXL base: $3 6 . 9 3 \\%$ , Stable Diffusion 1.5: $7 . 9 1 \\%$ , Stable Diffusion 2.1: $6 . 7 1 \\%$ ). See Fig. 1, which also provides an overview of the full pipeline. However, when using classical performance metrics such as FID and CLIP scores the improvements of $S D X L$ over previous methods are not reflected as shown in Fig. 13 and discussed in App. E. This aligns with and further backs the findings of Kirstain et al. (2023). ",
350
+ "page_idx": 7
351
+ },
352
+ {
353
+ "type": "image",
354
+ "img_path": "images/7ac219243c5378d06164ae7fd62d57d64a5f1fe32c3d41defebd60782c345ab6.jpg",
355
+ "image_caption": [
356
+ "Figure 7: Adding multimodal control: Replacing the pooled text representations of CLIP Radford et al. (2021), which were used during training, with CLIP image features turns SDXL into a multimodal image generator for text-controlled image editing, which can even transfer abstract concepts such as \"image grid\" (bottom row) from the input image to its output. In contrast to previous work Balaji et al. (2022), this does not require joint image-text-conditioned pretraining but only 1000 finetuning steps of a single network layer. "
357
+ ],
358
+ "image_footnote": [],
359
+ "page_idx": 7
360
+ },
361
+ {
362
+ "type": "text",
363
+ "text": "2.6 MULTIMODAL CONTROL ",
364
+ "text_level": 1,
365
+ "page_idx": 7
366
+ },
367
+ {
368
+ "type": "text",
369
+ "text": "Starting with SDEdit (Meng et al., 2021), adding image guidance beyond plain text has been a major focus of numerous recent works (Zhang & Agrawala, 2023; Mou et al., 2023; Ruiz et al., 2023; Kawar et al., 2023; Hertz et al., 2022), both with and without further training of the base model. In this section, we describe a simple and efficient approach to turning SDXL into a model guided by both text prompts and input images. ",
370
+ "page_idx": 7
371
+ },
372
+ {
373
+ "type": "text",
374
+ "text": "",
375
+ "page_idx": 8
376
+ },
377
+ {
378
+ "type": "text",
379
+ "text": "As described in Sec. 2.1, we modify the original Stable Diffusion architecture by considering not only the text embedding sequence, but also the pooled (global) text representation of the CLIP-G text encoder. By taking advantage of the fact that the pooled CLIP feature space is a (globally) shared image-text feature space, we can replace this global text representation with a global image representation from the CLIP-G image encoder. To account for the slight discrepancy between image and text embeddings, we fine-tune the embedding layer that maps the CLIP embedding to the UNet’s timestep embedding space (where they are added), and leave the remaining parameters frozen. ",
380
+ "page_idx": 8
381
+ },
382
+ {
383
+ "type": "text",
384
+ "text": "Fig. 7 demonstrates SDXL’s multimodal processing capabilities after this fine-tuning, where we prompt the model with both an input image and text input. For example, the model is able to extract the concept \"grid\" from an input image and transfer it to another output controlled by a text prompt (see bottom row, Fig. 7). We note that a similar approach was implemented in (Balaji et al., 2022), utilizing joint image and video training (from scratch) with high dropout rates on the image conditioning. In contrast, using a trained text-to-image model of SDXL, we can replace the pooled CLIP embeddings in a zero-shot manner and achieve high quality by finetuning only the embedding layer for a few thousand steps. Note that we only modify the base model and leave the refiner as is. ",
385
+ "page_idx": 8
386
+ },
387
+ {
388
+ "type": "text",
389
+ "text": "3 CONCLUSION & FUTURE WORK ",
390
+ "text_level": 1,
391
+ "page_idx": 8
392
+ },
393
+ {
394
+ "type": "text",
395
+ "text": "This report presents an analysis of improvements to the foundation model Stable Diffusion for text-toimage synthesis. While we achieve significant improvements in synthesized image quality, prompt adherence and composition, we believe the model may be improved further in the following aspects: ",
396
+ "page_idx": 8
397
+ },
398
+ {
399
+ "type": "text",
400
+ "text": "Single stage: Currently, we generate the best samples from SDXL with a two-stage approach using our refinement model. This results in having to load two large models into memory, hampering accessibility and sampling speed. Future work should investigate ways to provide a single stage. ",
401
+ "page_idx": 8
402
+ },
403
+ {
404
+ "type": "text",
405
+ "text": "Text synthesis: While the scale and the larger text encoder (OpenCLIP ViT-bigG (Ilharco et al., 2021)) help to improve the text rendering capabilities over previous versions of Stable Diffusion, incorporating byte-level tokenizers (Xue et al., 2022; Liu et al., 2023) or simply scaling the model to larger sizes (Yu et al., 2022; Saharia et al., 2022) should further improve text synthesis. ",
406
+ "page_idx": 8
407
+ },
408
+ {
409
+ "type": "text",
410
+ "text": "Architecture: During the exploration stage of this work, we briefly experimented with transformerbased architectures such as UViT (Hoogeboom et al., 2023) and DiT (Peebles & Xie, 2022), but found no immediate benefit. We remain, however, optimistic that a careful hyperparameter study will eventually enable scaling to much larger transformer-dominated architectures. ",
411
+ "page_idx": 8
412
+ },
413
+ {
414
+ "type": "text",
415
+ "text": "Distillation: While our improvements over Stable Diffusion are significant, they come at the price of increased inference cost (both in VRAM and sampling speed). Future work will thus focus on decreasing the compute needed for inference, and increased sampling speed, for example through guidance- (Meng et al., 2023), knowledge- (Dockhorn et al., 2023; Kim et al., 2023; Li et al., 2023) and progressive distillation (Salimans & Ho, 2022; Berthelot et al., 2023; Meng et al., 2023). ",
416
+ "page_idx": 8
417
+ },
418
+ {
419
+ "type": "text",
420
+ "text": "Finally, our model is trained in the discrete-time formulation of (Ho et al., 2020), and requires offset-noise (Guttenberg & CrossLabs, 2023; Lin et al., 2023) for aesthetically pleasing results. The EDM-framework of Karras et al. (2022) is a promising candidate for future model training, as its formulation in continuous time allows for increased sampling flexibility and does not require noise-schedule corrections. ",
421
+ "page_idx": 8
422
+ },
423
+ {
424
+ "type": "text",
425
+ "text": "REFERENCES \nYogesh Balaji, Seungjun Nah, Xun Huang, Arash Vahdat, Jiaming Song, Karsten Kreis, Miika Aittala, Timo Aila, Samuli Laine, Bryan Catanzaro, Tero Karras, and Ming-Yu Liu. eDiff-I: Text-to-Image Diffusion Models with an Ensemble of Expert Denoisers. arXiv:2211.01324, 2022. \nDavid Berthelot, Arnaud Autef, Jierui Lin, Dian Ang Yap, Shuangfei Zhai, Siyuan Hu, Daniel Zheng, Walter Talbot, and Eric Gu. TRACT: Denoising Diffusion Models with Transitive Closure Time-Distillation. arXiv:2303.04248, 2023. \nAndreas Blattmann, Robin Rombach, Huan Ling, Tim Dockhorn, Seung Wook Kim, Sanja Fidler, and Karsten Kreis. Align your Latents: High-Resolution Video Synthesis with Latent Diffusion Models. arXiv:2304.08818, 2023. \nJia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009. \nPrafulla Dhariwal and Alex Nichol. Diffusion Models Beat GANs on Image Synthesis. arXiv:2105.05233, 2021. \nTim Dockhorn, Robin Rombach, Andreas Blattmann, and Yaoliang Yu. Distilling the Knowledge in Diffusion Models. CVPR Workshop on Generative Models for Computer Vision, 2023. \nPatrick Esser, Johnathan Chiu, Parmida Atighehchian, Jonathan Granskog, and Anastasis Germanidis. Structure and content-guided video synthesis with diffusion models, 2023. \nWeixi Feng, Xuehai He, Tsu-Jui Fu, Varun Jampani, Arjun Akula, Pradyumna Narayana, Sugato Basu, Xin Eric Wang, and William Yang Wang. Training-free structured diffusion guidance for compositional text-to-image synthesis. arXiv:2212.05032, 2023. \nSeth Forsgren and Hayk Martiros. Riffusion - Stable diffusion for real-time music generation, 2022. URL https://riffusion.com/about. \nRinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H Bermano, Gal Chechik, and Daniel Cohen-Or. An image is worth one word: Personalizing text-to-image generation using textual inversion. arXiv:2208.01618, 2022. \nNicholas Guttenberg and CrossLabs. Diffusion with offset noise, 2023. URL https://www. crosslabs.org/blog/diffusion-with-offset-noise. \nAmir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. Promptto-prompt image editing with cross attention control, 2022. \nMartin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium. arXiv:1706.08500, 2017. \nJonathan Ho and Tim Salimans. Classifier-Free Diffusion Guidance. arXiv:2207.12598, 2022. \nJonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising Diffusion Probabilistic Models. arXiv preprint arXiv:2006.11239, 2020. \nJonathan Ho, William Chan, Chitwan Saharia, Jay Whang, Ruiqi Gao, Alexey Gritsenko, Diederik P Kingma, Ben Poole, Mohammad Norouzi, David J Fleet, and Tim Salimans. Imagen Video: High Definition Video Generation with Diffusion Models. arXiv:2210.02303, 2022. \nDavid Holz. Midjourney, 2023. URL https://www.midjourney.com/home/. \nEmiel Hoogeboom, Jonathan Heek, and Tim Salimans. simple diffusion: End-to-end diffusion for high resolution images. arXiv preprint arXiv:2301.11093, 2023. \nRongjie Huang, Jiawei Huang, Dongchao Yang, Yi Ren, Luping Liu, Mingze Li, Zhenhui Ye, Jinglin Liu, Xiang Yin, and Zhou Zhao. Make-An-Audio: Text-To-Audio Generation with PromptEnhanced Diffusion Models. arXiv:2301.12661, 2023. \nAapo Hyvärinen and Peter Dayan. Estimation of Non-Normalized Statistical Models by Score Matching. Journal of Machine Learning Research, 6(4), 2005. \nGabriel Ilharco, Mitchell Wortsman, Ross Wightman, Cade Gordon, Nicholas Carlini, Rohan Taori, Achal Dave, Vaishaal Shankar, Hongseok Namkoong, John Miller, Hannaneh Hajishirzi, Ali Farhadi, and Ludwig Schmidt. OpenCLIP, July 2021. URL https://doi.org/10.5281/ zenodo.5143773. \nHeewoo Jun, Rewon Child, Mark Chen, John Schulman, Aditya Ramesh, Alec Radford, and Ilya Sutskever. Distribution Augmentation for Generative Modeling. In International Conference on Machine Learning, pp. 5006–5019. PMLR, 2020. \nTero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the Design Space of DiffusionBased Generative Models. arXiv:2206.00364, 2022. \nBahjat Kawar, Shiran Zada, Oran Lang, Omer Tov, Huiwen Chang, Tali Dekel, Inbar Mosseri, and Michal Irani. Imagic: Text-based real image editing with diffusion models, 2023. \nBo-Kyeong Kim, Hyoung-Kyu Song, Thibault Castells, and Shinkook Choi. On Architectural Compression of Text-to-Image Diffusion Models. arXiv:2305.15798, 2023. \nYuval Kirstain, Adam Polyak, Uriel Singer, Shahbuland Matiana, Joe Penna, and Omer Levy. Picka-pic: An open dataset of user preferences for text-to-image generation. arXiv:2305.01569, 2023. \nYanyu Li, Huan Wang, Qing Jin, Ju Hu, Pavlo Chemerys, Yun Fu, Yanzhi Wang, Sergey Tulyakov, and Jian Ren. SnapFusion: Text-to-Image Diffusion Model on Mobile Devices within Two Seconds. arXiv:2306.00980, 2023. \nShanchuan Lin, Bingchen Liu, Jiashi Li, and Xiao Yang. Common Diffusion Noise Schedules and Sample Steps are Flawed. arXiv:2305.08891, 2023. \nTsung-Yi Lin, Michael Maire, Serge Belongie, Lubomir Bourdev, Ross Girshick, James Hays, Pietro Perona, Deva Ramanan, C. Lawrence Zitnick, and Piotr Dollár. Microsoft coco: Common objects in context, 2015. \nRosanne Liu, Dan Garrette, Chitwan Saharia, William Chan, Adam Roberts, Sharan Narang, Irina Blok, RJ Mical, Mohammad Norouzi, and Noah Constant. Character-aware models improve visual text rendering, 2023. \nChenlin Meng, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. SDEdit: Guided Image Synthesis and Editing with Stochastic Differential Equations. arXiv:2108.01073, 2021. \nChenlin Meng, Robin Rombach, Ruiqi Gao, Diederik P. Kingma, Stefano Ermon, Jonathan Ho, and Tim Salimans. On distillation of guided diffusion models, 2023. \nChong Mou, Xintao Wang, Liangbin Xie, Yanze Wu, Jian Zhang, Zhongang Qi, Ying Shan, and Xiaohu Qie. T2i-adapter: Learning adapters to dig out more controllable ability for text-to-image diffusion models, 2023. \nAlex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. GLIDE: Towards Photorealistic Image Generation and Editing with Text-Guided Diffusion Models. arXiv:2112.10741, 2021. \nNovelAI. Novelai improvements on stable diffusion, 2023. URL https://blog.novelai. net/novelai-improvements-on-stable-diffusion-e10d38db82ac. \nAdam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Köpf, Edward Yang, Zach DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library, 2019. \nWilliam Peebles and Saining Xie. Scalable Diffusion Models with Transformers. arXiv:2212.09748, 2022. \nAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning Transferable Visual Models From Natural Language Supervision. arXiv:2103.00020, 2021. \nAditya Ramesh. How dall·e 2 works, 2022. URL http://adityaramesh.com/posts/ dalle2/dalle2.html. \nAditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation, 2021. \nAditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical TextConditional Image Generation with CLIP Latents. arXiv:2204.06125, 2022. \nRobin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. HighResolution Image Synthesis with Latent Diffusion Models. arXiv preprint arXiv:2112.10752, 2021. \nOlaf Ronneberger, Philipp Fischer, and Thomas Brox. U-Net: Convolutional Networks for Biomedical Image Segmentation. arXiv:1505.04597, 2015. \nNataniel Ruiz, Yuanzhen Li, Varun Jampani, Yael Pritch, Michael Rubinstein, and Kfir Aberman. Dreambooth: Fine tuning text-to-image diffusion models for subject-driven generation, 2023. \nChitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S Sara Mahdavi, Rapha Gontijo Lopes, Tim Salimans, Jonathan Ho, David J Fleet, and Mohammad Norouzi. Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding. arXiv:2205.11487, 2022. \nTim Salimans and Jonathan Ho. Progressive Distillation for Fast Sampling of Diffusion Models. arXiv preprint arXiv:2202.00512, 2022. \nTim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved Techniques for Training GANs. arXiv:1606.03498, 2016. \nSitian Shen, Zilin Zhu, Linqian Fan, Harry Zhang, and Xinxiao Wu. DiffCLIP: Leveraging Stable Diffusion for Language Grounded 3D Classification. arXiv:2305.15957, 2023. \nUriel Singer, Adam Polyak, Thomas Hayes, Xi Yin, Jie An, Songyang Zhang, Qiyuan Hu, Harry Yang, Oron Ashual, Oran Gafni, Devi Parikh, Sonal Gupta, and Yaniv Taigman. Make-A-Video: Text-to-Video Generation without Text-Video Data. arXiv:2209.14792, 2022. \nJascha Sohl-Dickstein, Eric A Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep Unsupervised Learning using Nonequilibrium Thermodynamics. arXiv:1503.03585, 2015. \nJiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv:2010.02502, 2020a. \nYang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-Based Generative Modeling through Stochastic Differential Equations. arXiv:2011.13456, 2020b. \nAndreas Stöckl. Evaluating a synthetic image dataset generated with stable diffusion. arXiv:2211.01777, 2022. \nYu Takagi and Shinji Nishimoto. High-Resolution Image Reconstruction With Latent Diffusion Models From Human Brain Activity. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 14453–14463, 2023. ",
426
+ "page_idx": 9
427
+ },
428
+ {
429
+ "type": "text",
430
+ "text": "",
431
+ "page_idx": 10
432
+ },
433
+ {
434
+ "type": "text",
435
+ "text": "",
436
+ "page_idx": 11
437
+ },
438
+ {
439
+ "type": "text",
440
+ "text": "Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. LLaMA: Open and Efficient Foundation Language Models. arXiv:2302.13971, 2023. ",
441
+ "page_idx": 12
442
+ },
443
+ {
444
+ "type": "text",
445
+ "text": "Jialiang Wei, Anne-Lise Courbis, Thomas Lambolais, Binbin Xu, Pierre Louis Bernard, and Gérard Dray. Boosting gui prototyping with diffusion models. arXiv preprint arXiv:2306.06233, 2023. ",
446
+ "page_idx": 12
447
+ },
448
+ {
449
+ "type": "text",
450
+ "text": "Linting Xue, Aditya Barua, Noah Constant, Rami Al-Rfou, Sharan Narang, Mihir Kale, Adam Roberts, and Colin Raffel. Byt5: Towards a token-free future with pre-trained byte-to-byte models, 2022. ",
451
+ "page_idx": 12
452
+ },
453
+ {
454
+ "type": "text",
455
+ "text": "Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, Ben Hutchinson, Wei Han, Zarana Parekh, Xin Li, Han Zhang, Jason Baldridge, and Yonghui Wu. Scaling autoregressive models for content-rich text-to-image generation, 2022. ",
456
+ "page_idx": 12
457
+ },
458
+ {
459
+ "type": "text",
460
+ "text": "Lvmin Zhang and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models. arXiv:2302.05543, 2023. ",
461
+ "page_idx": 12
462
+ },
463
+ {
464
+ "type": "text",
465
+ "text": "Richard Zhang, Phillip Isola, Alexei A. Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric, 2018. ",
466
+ "page_idx": 12
467
+ }
468
+ ]
parse/test/di52zR8xgf/di52zR8xgf_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/di52zR8xgf/di52zR8xgf_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/lKK50q2MtV/lKK50q2MtV.md ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TOKENFLOW: CONSISTENT DIFFUSION FEATURES FOR CONSISTENT VIDEO EDITING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ ![](images/f04609e3652fecd354ddf1e20f13aab3418f0914dc2e7eada7aa5678f154ce53.jpg)
6
+ Figure 1: TokenFlow enables consistent, high-quality semantic edits of real-world videos. Given an input video (top row), our method edits it according to a target text prompt (middle and bottom rows), while preserving the semantic layout and motion in the original scene.
7
+
8
+ # ABSTRACT
9
+
10
+ The generative AI revolution has recently expanded to videos. Nevertheless, current state-of-the-art video models are still lagging behind image models in terms of visual quality and user control over the generated content. In this work, we present a framework that harnesses the power of a text-to-image diffusion model for the task of text-driven video editing. Specifically, given a source video and a target text-prompt, our method generates a high-quality video that adheres to the target text, while preserving the spatial layout and motion of the input video. Our method is based on a key observation that consistency in the edited video can be obtained by enforcing consistency in the diffusion feature space. We achieve this by explicitly propagating diffusion features based on inter-frame correspondences, readily available in the model. Thus, our framework does not require any training or fine-tuning, and can work in conjunction with any off-the-shelf text-toimage editing method. We demonstrate state-of-the-art editing results on a variety of real-world videos.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ The evolution of text-to-image models has recently facilitated advances in image editing and content creation, allowing users to control various proprieties of both generated and real images. Nevertheless, expanding this exciting progress to video is still lagging behind. A surge of large-scale text-to-video generative models has emerged, demonstrating impressive results in generating clips solely from textual descriptions. However, despite the progress made in this area, existing video models are still in their infancy, being limited in resolution, video length, or the complexity of video dynamics they can represent. In this paper, we harness the power of a state-of-the-art pre-trained text-to-image model for the task of text-driven editing of natural videos. Specifically, our goal is to generate high-quality videos that adhere to the target edit expressed by an input text prompt, while preserving the spatial layout and motion of the original video. The main challenge in leveraging an image diffusion model for video editing is to ensure that the edited content is consistent across all video frames – ideally, each physical point in the 3D world undergoes coherent modifications across time. Existing and concurrent video editing methods that are based on image diffusion models have demonstrated that global appearance coherency across the edited frames can be achieved by extending the self-attention module to include multiple frames (Wu et al., 2022; Khachatryan et al., 2023b; Ceylan et al., 2023; Qi et al., 2023). Nevertheless, this approach is insufficient for achieving the desired level of temporal consistency, as motion in the video is only implicitly preserved through the attention module. Consequently, professionals or semi-professionals users often resort to elaborate video editing pipelines that entail additional manual work. In this work, we propose a framework to tackle this challenge by explicitly enforcing the original inter-frame correspondences on the edit.
15
+
16
+ Intuitively, natural videos contain redundant information across frames, e.g., depict similar appearance and shared visual elements. Our key observation is that the internal representation of the video in the diffusion model exhibits similar properties. That is, the level of redundancy and temporal consistency of the frames in the RGB space and in the diffusion feature space are tightly correlated. Based on this observation, the pillar of our approach is to achieve consistent edit by ensuring that the features of the edited video are consistent across frames. Specifically, we enforce that the edited features convey the same inter-frame correspondences and redundancy as the original video features. To do so, we leverage the original inter-frame feature correspondences, which are readily available by the model. This leads to an effective method that directly propagates the edited diffusion features based on the original video dynamics. This approach allows us to harness the generative prior of state-of-the-art image diffusion model without additional training or fine-tuning, and can work in conjunction with an off-the-shelf diffusion-based image editing method (e.g., Meng et al. (2022); Hertz et al. (2022); Zhang & Agrawala (2023); Tumanyan et al. (2023)).
17
+
18
+ ummarize, we make the following key contributions:
19
+
20
+ • A technique, dubbed TokenFlow, that enforces semantic correspondences of diffusion features across frames, allowing to significantly increase temporal consistency in videos generated by a text-to-image diffusion model. • Novel empirical analysis studying the proprieties of diffusion features across a video. • State-of-the-art editing results on diverse videos, depicting complex motions.
21
+
22
+ # 2 RELATED WORK
23
+
24
+ Text-driven image & video synthesis Seminal works designed GAN architectures to synthesize images conditioned on text embeddings (Reed et al., 2016; Zhang et al., 2016). With the evergrowing scale of vision-language datasets and pretraining strategies (Radford et al., 2021; Schuhmann et al., 2022), there has been a remarkable progress in text-driven image generation capabilities. Users can sytnesize high-quality visual content using simple text prompts. Much of this progress is also attributed to diffusion models (Sohl-Dickstein et al., 2015; Croitoru et al., 2022; Dhariwal & Nichol, 2021; Ho et al., 2020; Nichol & Dhariwal, 2021) which have been established as stateof-the-art text-to-image generators (Nichol et al., 2021; Saharia et al., 2022; Ramesh et al., 2022; Rombach et al., 2022; Sheynin et al., 2022; Bar-Tal et al., 2023). Such models have been extended for text-to-video generation, by extending 2D architectures to the temporal dimension (e.g., using temporal attention Ho et al. (2022b)) and performing large-scale training on video datasets (Ho et al., 2022a; Blattmann et al., 2023; Singer et al., 2022). Recently, Gen-1 (Esser et al., 2023) tailored a diffusion model architecture for the task of video editing, by conditioning the network on structure/appearance representations. Nevertheless, due to their extensive computation and memory requirements, existing video diffusion models are still in infancy and are largely restricted to short clips, or exhibit lower visual quality compared to image models. On the other side of the spectrum, a promising recent trend of works leverage a pre-trained image diffusion model for video synthesis tasks, without additional training (Fridman et al., 2023; Wu et al., 2022; Lee et al., $2 0 2 3 \mathrm { a }$ ; Qi et al., 2023). Our work falls into this category, employing a pretrained text-to-image diffusion model for the task of video editing, without any training or finetuning.
25
+
26
+ Consistent video stylization A common approach for video stylization involves applying image editing techniques (e.g., style transfer) on a frame-by-frame basis, followed by a post-processing stage to address temporal inconsistencies in the edited video (Lai et al. (2018b); Lei et al. (2020; 2023)). Although these methods effectively reduce high-frequency temporal flickering, they are not designed to handle frames that exhibit substantial variations in content, which often occur when applying text-based image editing techniques (Qi et al., 2023). Kasten et al. (2021) propose to decompose a video into a set of 2D atlases, each provides a unified representation of the background or of a foreground object throughout the video. Edits applied to the 2D atlases are automatically mapped back to the video, thus achieving temporal consistency with minimal effort. Bar-Tal et al. (2022); Lee et al. (2023b) leverage this representation to perform text-driven editing. However, the atlas representation is limited to videos with simple motion and requires long training, limiting the applicability of this technique and of the methods built upon it. Our work is also related to classical works that demonstrated that small patches in a natural video extensively repeat across frames (Shahar et al., 2011; Cheung et al., 2005), and thus consistent editing can by simplified by editing a subset of keyframes and propagating the edit across the video by establishing patch correspondences using handcrafted features and optical flow (Ruder et al., 2016; Jamriska et al., 2019) or by ˇ training a patch-based GAN (Texler et al., 2020). Nevertheless, such propagation methods struggle to handle videos with illumination changes, or with complex dynamics. Importantly, they rely on a user provided consistent edit of the keyframes, which remains a labor-intensive task yet to be automated. Yang et al. (2023) combines keyframe editing with a propagation method by Jamriska ˇ et al. (2019). They edit keyframes using a text-to-image diffusion model while enforcing optical flow constraints on the edited keyframes. However, since optical flow estimation between distant frames is not reliable, their method fails to consistently edit keyframes that are far apart (as seen in our Supplementary Material - SM), and as a result, fails to consistently edit most videos.
27
+
28
+ ![](images/a6f7bde709f695d9c2f9b7374705195cf1cb15b06861e32eed54729b6ada3501.jpg)
29
+ Figure 3: Diffusion features across time. Left: Given an input video (top row), we apply DDIM inversion on each frame and extract features from the highest resolution decoder layer in $\epsilon _ { \theta }$ . We apply PCA on the features (i.e., output tokens from the self-attention module) extracted from all frames and visualize the first three components (second row). We further visualize an $x$ -t slice (marked in red on the original frame) for both RGB and features (bottom row). The feature representation is consistent across time – corresponding regions are encoded with similar features across the video. Middle: Frames and feature visualization for an edited video obtained by applying an image editing method (Tumanyan et al. (2023)) on each frame; inconsistent patterns in RGB are also evident in the feature space (e.g., on the dog’s body). Right: Our method enforces the edited video to convey the same level of feature consistency as the original video, which translates into a coherent and high-quality edit in RGB space.
30
+
31
+ Our work shares a similar motivation as this approach that benefits from the temporal redundancies in natural videos. We show that such redundancies are also present in the feature space of a text-to-image diffusion model, and leverage this property to achieve consistency.
32
+
33
+ Controlled generation via diffusion features manipulation Recently, a surge of works demonstrated how text-to-image diffusion models can be readily adapted to various editing and generation tasks, by performing simple operations on the intermediate feature representation of the diffusion network (Chefer et al., 2023; Hong et al., 2022; Ma et al., 2023; Tumanyan et al., 2023; Hertz et al., 2022; Patashnik et al., 2023; Cao et al., 2023). Luo et al. (2023); Zhang et al. (2023) demonstrated semantic appearance swapping using diffusion feature correspondences. Hertz et al. (2022) observed that by manipulating the cross-attention layers, it is possible to control the relation between the spatial layout of the image to each word in the text. Plugand-Play Diffusion $\mathrm { P n P } ,$ , Tumanyan et al. (2023)) analyzed the spatial features and the self-attention
34
+
35
+ ![](images/89a5ccf646fc1d40ac7986a6cc5a5a50d2ad5e66fb053d05e57b28b62229b3fa.jpg)
36
+ Figure 2: Fine-grained feature correspondences. Features (i.e., output tokens from the self-attention modules) extracted from of a source frame are used to reconstruct nearby frames. This is done by: (a) swapping each feature in the target by its nearest feature in the source, in all layers and all generation time steps, and (b) simple warping in RGB space, using a nearest neighbour field (c), computed between the source and target features extracted from the highest resolution decoder layer. The target is faithfully reconstructed, demonstrating the high level of spatial granularity and shared content between the features.
37
+
38
+ maps and found that they capture semantic information at high spatial granularity. Tune-A-Video (Wu et al., 2022) observed that by extending the self-attention module to operate on more than a single frame, it is possible to generate frames that share a common global appearance. Qi et al. (2023); Ceylan et al. (2023); Khachatryan et al. (2023a); Shin et al. (2023); Liu et al. (2023) leverage this property to achieve globally-coherent video edits. Nevertheless, as demonstrated in Sec. 5, inflating the self-attention module is insufficient for achieving fine-grained temporal consistency. Prior and concurrent works either compromise visual quality, or exhibit limited temporal consistency. In this work, we also perform video editing via simple operations in the feature space of a pre-trained text-to-image model, we explicitly encourage the features of the model to be temporally consistent through TokenFlow.
39
+
40
+ ![](images/458377da329e574050359aa65fbebaa07774b837d8ece61cbe02c2dad4f1c3a3.jpg)
41
+ Figure 4: TokenFlow pipeline. Top: Given an input video $\mathcal { T }$ , we DDIM invert each frame, extract its tokens, i.e., output features from the self-attention modules, from each timestep and layer, and compute inter-frame features correspondences using a nearest-neighbor (NN) search. Bottom: The edited video is generated as follows: at each denoising step $t$ , (I) we sample keyframes from the noisy video $J _ { t }$ and jointly edit them using an extended-attention block; the set of resulting edited tokens is $\mathbf { T } _ { b a s e }$ . (II) We propagate the edited tokens across the video according to the pre-computed correspondences of the original video features. To denoise $J _ { t }$ , we feed each frame to the network, and replace the generated tokens with the tokens obtained from the propagation step (II).
42
+
43
+ # 3 PRELIMINARIES
44
+
45
+ Diffusion Models Diffusion probabalistic models (DPM) (Sohl-Dickstein et al., 2015; Croitoru et al., 2022; Dhariwal & Nichol, 2021; Ho et al., 2020; Nichol & Dhariwal, 2021) are a class of generative models that aim to approximate a data distribution $q$ through a progressive denosing process. Starting from a Gaussian i.i.d noisy image $\pmb { x } _ { T } \sim \mathcal { N } ( 0 , I )$ , the diffusion model $\epsilon _ { \theta }$ , gradually denoises it, until reaching a clean image $\scriptstyle { \mathbf { { \vec { x } } } } _ { 0 }$ drawn from the target distribution $q$ . DPM can learn a conditional distribution by incorporating additional guiding signals, such as text conditioning. Song et al. (2020) derived DDIM, a deterministic sampling algorithm given an initial noise $\mathbf { \nabla } _ { \mathbf { x } _ { T } }$ . By applying this algorithm in the reverse order (a.k.a. DDIM inversion) starting from the clean $\scriptstyle { \mathbf { { \vec { x } } } } _ { 0 }$ , it allows to obtain the intermediate noisy images $\{ { \pmb x } _ { i } \} _ { t = 1 } ^ { T }$ used to generate it.
46
+
47
+ Stable Diffusion Stable Diffusion (SD) (Rombach et al., 2022) is a prominent text-to-image diffusion model that operates in a latent image space. A pretrained encoder maps RGB images to this space, and a decoder decodes latents back to high-resolution images. In more detail, SD is based on a U-Net architecture (Ronneberger et al., 2015), which comprises of residual, self-attention, and cross-attention blocks. The residual block convolves the activations from a previous layer, while cross-attention manipulates features according to the text prompt. In the self-attention block, features are projected into queries $Q$ , keys $\kappa$ , and values $V$ . The Attention operation (Vaswani et al., 2017) computes the affinities between the $d$ -dimensional projections $Q , K$ to yield the output of the layer:
48
+
49
+ $$
50
+ A \cdot V { \mathrm { ~ w h e r e ~ } } A = \operatorname { \mathrm { a t t } } \operatorname { e n t i o n } ( Q ; K ) { \mathrm { ~ a n d ~ } } \operatorname { A t t } \operatorname { e n t i o n } ( Q ; K ) = \operatorname { S o f t m a x } \left( { \frac { Q K ^ { T } } { \sqrt d } } \right)
51
+ $$
52
+
53
+ ![](images/78158ef427a4b9c6aeb795948abf5f9aef4d9b5245310066ae10307800e707e0.jpg)
54
+ Figure 5: Results. Sample results of our method. We refer the reader to our webpage and SM for more examples and full-video results.
55
+
56
+ # 4 METHOD
57
+
58
+ Given an input video $\pmb { \mathcal { I } } = [ \pmb { I } ^ { 1 } , . . . , \pmb { I } ^ { n } ]$ , and a text prompt $\mathcal { P }$ describing the target edit, our goal is to generate an edited video $\mathcal { I } = [ J ^ { 1 } , . . . , J ^ { n } ]$ that adheres to the text $\mathcal { P }$ , while preserving the original motion and semantic layout of $\boldsymbol { \mathscr { x } }$ . To achieve this, our framework leverages a pretrained and fixed text-to-image diffusion model $\epsilon _ { \theta }$ .
59
+
60
+ Na¨ıvely leveraging $\epsilon _ { \theta }$ for video editing, by applying an image editing method on each frame independently (e.g., Hertz et al. (2022); Tumanyan et al. (2023); Meng et al. (2022); Zhang & Agrawala (2023)), results in content inconsistencies across frames (e.g., Fig. 3 middle column). Our key finding is that these inconsistencies can be alleviated by enforcing consistency among the internal diffusion features across frames, during the editing process.
61
+
62
+ Natural videos typically depict coherent and shared content across time. We observe that the internal representation of natural videos in $\epsilon _ { \theta }$ has similar properties. This is illustrated in Fig. 3, where we visualize the features extracted from a given video (first column). As seen, the features depict a shared and consistent representation across frames, i.e., corresponding regions exhibit similar representation. We further observe that the original video features provide fine-grained correspondences between frames, using a simple nearest neighbour search (Fig 2). Moreover, we show that these corresponding features are interchangeable for the diffusion model – we can faithfully synthesize one frame by swapping its features by their corresponding ones in a nearby frame (Fig 2(a)).
63
+
64
+ Nevertheless, when an edit is applied to each frame individually, the consistency of the features breaks (Fig. 3 middle column). This implies that the level of consistency of in RGB space is correlated with the consistency of the internal features of the frames. Hence, our key idea is to manipulate the features of the edited video to preserve the level of consistency and inter-frame correspondences of the original video features.
65
+
66
+ As illustrated in Fig. 4, our framework, dubbed TokenFlow, alternates at each generation timestep between two main components: (i) sampling a set of keyframes and jointly editing them according to $\mathcal { P }$ ; this stage results in shared global appearance across the keyframes, and (ii) propagating the features from the keyframes to all of the frames based on the correspondences provided by the original video features; this stage explicitly preserves the consistency and fine-grained shared representation of the original video features. Both stages are done in combination with an image editing technique $\hat { \epsilon _ { \theta } }$ (e.g, Tumanyan et al. (2023)). Intuitively, the benefit of alternating between keyframe editing and propagation is twofold: first, sampling random keyframes at each generation step increases the robustness to a particular selection. Second, since each generation step results in more consistent features, the sampled keyframes in the next step will be edited more consistently.
67
+
68
+ ![](images/d03b8e24c8a84914cc242f71bf929986c1bcf23508e333fe62ed4ff885ca7aa2.jpg)
69
+ Figure 6: Comparison. We compare our method against Tune-A-Video (TAV, Wu et al. (2022)), PnPDiffusion (Tumanyan et al., 2023) applied per frame, Gen-1 (Esser et al., 2023), Text2Video-Zero (Khachatryan et al., 2023a) and Fate-Zero (Qi et al., 2023). We refer the reader to our supplementary material for full-video comparisons.
70
+
71
+ Pre-processing: extracting diffusion features. Given an input video $\boldsymbol { \mathscr { x } }$ , we apply DDIM inversion (see Sec. 3) on each frame $I ^ { i }$ , which yields a sequence of latents $[ \pmb { x } _ { 1 } ^ { i } , . . . , \pmb { x } _ { T } ^ { i } ]$ . For each generation timestep $t$ , we feed the latent $\mathbf { \Delta } _ { \mathbf { \boldsymbol { x } } _ { t } ^ { i } }$ of each frame $i \in [ n ]$ to the model and extract the tokens $\phi ( x _ { t } ^ { i } )$ from the self-attention module of every layer in the network $\epsilon _ { \theta }$ (fig. 4, top). We will later use these tokens to establish inter-frame correspondences between diffusion features.
72
+
73
+ # 4.1 KEYFRAME SAMPLING AND JOINT EDITING
74
+
75
+ Our observations imply that given the features of a single edited frame, we can generate the next frames by propagating its features to their corresponding locations. Most videos, however, can not be represented by a single keyframe. To account for that, we consider multiple keyframes, from which we obtain a set of features (tokens), $\pmb { T } _ { b a s e }$ , that will later be propagated to the entire video. Specifically, at each generation step, we randomly sample a set of keyframes $\{ J ^ { i } \} _ { i \in \kappa }$ in fixed frame intervals (see SM for details). We joinly edit the keyframes by extending the selfattention block to simultaneously process them $\breve { \mathbf { W } } \mathbf { u }$ et al., 2022), thus encouraging them to share a global appearance. In more detail, the input to the modified block are the self-attention features from all keyframes $\{ Q ^ { i } \} _ { i \in \kappa } , \{ K ^ { i } \} _ { i \in \kappa } , \{ V ^ { i } \} _ { i \in \kappa }$ where $Q ^ { i } , K ^ { i } , V ^ { i }$ are the queries, keys, and values of frame $i \in \kappa , \kappa = \{ i _ { 1 } , . . . i _ { k } \}$ . The keys of all frames are concatenated, and the extended-attention is:
76
+
77
+ $$
78
+ \operatorname { E x t a t } \tan \left( { Q } ^ { i } ; [ K ^ { i 1 } , \dots K ^ { i _ { k } } ] \right) = \operatorname { s o f t m a x } \left( \frac { { Q } ^ { i } \left[ K ^ { i _ { 1 } } , \dots K ^ { i _ { k } } \right] ^ { T } } { \sqrt { d } } \right)
79
+ $$
80
+
81
+ The output of the block for frame $i$ is given by:
82
+
83
+ $$
84
+ \phi ( \boldsymbol J ^ { i } ) = \hat { A } \cdot \big [ \boldsymbol V ^ { i _ { 1 } } , \ldots \boldsymbol V ^ { i _ { k } } \big ] \quad \mathrm { w h e r e } \quad \hat { A } = \mathrm { E x t a t t n } \Big ( \boldsymbol Q ^ { i } ; [ \boldsymbol K ^ { i _ { 1 } } , \ldots \boldsymbol K ^ { i _ { k } } ] \Big )
85
+ $$
86
+
87
+ Intuitively, each keyframe queries all other keyframes, and aggregates information from them. This results in a roughly unified appearance in the edited frames $\mathrm { \bar { W } } \mathrm { \bar { u } }$ et al., 2022; Khachatryan et al., 2023b; Ceylan et al., 2023; Qi et al., 2023). We define $\mathbf { T } _ { b a s e } = \{ \phi ( J ^ { i } ) \} _ { i \in \kappa }$ , for each layer in the network (Fig. 4 bottom middle).
88
+
89
+ # 4.2 EDIT PROPAGATION VIA TOKENFLOW
90
+
91
+ Given $\mathbf { T } _ { b a s e }$ , we propagate it across the video based on the token correspondences extracted from the original video. At each generation step $t$ , we compute the nearest neighbor (NN) of each original frame’s tokens, $\phi ( x _ { t } ^ { i } )$ , and its two adjacent keyframes’ tokens, $\phi ( x _ { t } ^ { i \bar { + } } ) , \phi ( x _ { t } ^ { i - } )$ where $^ { i + }$ is the index of the closest future keyframe, and $i -$ the index of the closest past keyframe. Denote the resulting NN fields $\gamma ^ { i + } , \gamma ^ { i - }$ :
92
+
93
+ $$
94
+ \gamma ^ { i \pm } [ p ] = \underset { q } { \arg \operatorname* { m i n } } \mathcal { D } \left( \phi ( \pmb { x } ^ { i } ) [ p ] , \phi ( \pmb { x } ^ { i \pm } ) [ q ] \right)
95
+ $$
96
+
97
+ Where $p , q$ are spatial locations in the token feature map, and $\mathcal { D }$ is cosine distance. For simplicity, we omit the generation timestep $t$ ; our method is applied in all time-steps and self-attention layers. Once we obtain $\gamma ^ { \pm }$ , we use it to propagate the edited frames’ tokens $\mathbf { T } _ { b a s e } ^ { - }$ to the rest of the video, by linearly combining the tokens in $\mathbf { T } _ { b a s e }$ corresponding to each spatial location $p$ and frame $i$ :
98
+
99
+ $$
100
+ \mathcal { F } _ { \gamma } ( \mathbf { T } _ { b a s e } , i , p ) = { w _ { i } \cdot \phi ( { \pmb J } ^ { i + } ) [ \gamma ^ { i + } [ p ] ] } + ( 1 - w _ { i } ) \cdot \phi ( { \pmb J } ^ { i - } ) [ \gamma ^ { i - } [ p ] ]
101
+ $$
102
+
103
+ Where $\phi ( J ^ { i \pm } ) \in \mathbf { T } _ { b a s e }$ and $w _ { i } \in ( 0 , 1 )$ is a scalar proportional to the distance between frame $i$ and its adjacent keyframes (see SM), ensuring a smooth transition. Note that $\mathcal { F }$ also modifies the tokens of the sampled keyframes. That is, we modify the self-attention blocks to output a linear combination of the tokens in $\mathbf { T } _ { b a s e }$ for all frames, including the keyframes, according to the original video token correspondences.
104
+
105
+ Overall algorithm We summarize our video editing algorithm in Alg. 1: We first perform DDIM inversion on the input video $\mathcal { T }$ and extract the sequence of noisy latents $\{ x _ { t } ^ { i } \} _ { t = 1 } ^ { T }$ for all frames $i \in [ n ]$ (fig 4, top). We then denoise the video, alternating between keyframes editing and TokenFlow propagation: At each generation step $t$ , we randomize $k \ < \ \bar { \ n }$ keyframe indices, and denoise them using an image editing technique (e.g., Tumanyan et al. (2023); Meng et al. (2022); Zhang & Agrawala (2023)) combined with extended-attention (Eq. 3, Fig. 4 (I)). We then denoise the entire video $\mathcal { T } _ { t }$ by combining the image-editing technique with TokenFlow (Eq. 5, Fig. 4 (II))
106
+
107
+ # Algorithm 1 TokenFlow editing
108
+
109
+ #
110
+
111
+ I = [I1 , ..., In ] ▷ Input Video P ▷ Target text prompt $\hat { \Psi }$ ▷ Diffusion-based image editing technique
112
+ $\{ \mathbf { x } _ { t } ^ { i } \} _ { t = 1 } ^ { T } , \{ \phi ( x _ { i } ) \} _ { i = 1 } ^ { n } \mathrm { D D I M - I n v } [ \mathbf { I } ^ { i } ] \quad \forall i \in [ n ] , \ t \in [ T ]$
113
+ $\mathbf { J } _ { T } ^ { 1 } , \ldots , \mathbf { J } _ { T } ^ { n } \mathbf { x } _ { T } ^ { 1 } , \ldots , \mathbf { x } _ { T } ^ { n }$
114
+ For $t = T , \dots , 1$ do $K = \{ i _ { 1 } , \ldots , i _ { k } \} $ sample keyframe indices $\mathcal { F } _ { \gamma } \gamma ^ { i \pm } \forall i \in [ n ]$ compute NN field $\{ \mathbf { J } _ { t - 1 } ^ { j } \} _ { j \in \kappa } \hat { \epsilon _ { \theta } } [ \{ \mathbf { J } _ { t } ^ { j } \} _ { j \in \kappa }$ ; ExtAttn] $\mathbf { T } _ { \mathrm { b a s e } } \phi ( \{ \mathbf { J } _ { t - 1 } ^ { j } \} _ { j \in \mathcal { K } } )$ extract keyframes’ tokens $\mathbf { J } _ { t - 1 } \hat { \epsilon _ { \theta } } [ \mathbf { J } _ { t } ; \mathrm { T o k e n F l o w } ( \mathcal { F } _ { \gamma } ( \mathbf { T } _ { \mathrm { b a s e } } ) ) ]$
115
+ Output: $\mathcal { I } = [ \mathbf { J } _ { 0 } ^ { 1 } , \ldots , \mathbf { J } _ { 0 } ^ { n } ]$
116
+
117
+ at every self-attention block in every layer of the network. Note that each layer includes a residual connection between the input and output of the self-attention block, thus performing TokenFlow at each layer is necessary.
118
+
119
+ # 5 RESULTS
120
+
121
+ We evaluate our method on DAVIS videos (Pont-Tuset et al., 2017) and on Internet videos depicting animals, food, humans, and various objects in motion. The spatial resolution of the videos is $3 8 4 \bar { \times }$ 672 or $5 1 2 \times 5 1 2$ pixels, and they consist of 40 to 200 frames. We use various text prompts on each video to obtain diverse editing results. Our evaluation dataset comprises of 61 text-video pairs. We utilize $\mathrm { P n P }$ -Diffusion (Tumanyan et al., 2023) as the frame editing method, and we use the same hyper-parameters for all our results. PnP-Diffusion may fail to accurately preserve the structure of each frame due to inaccurate DDIM inversion (see Fig. 3, middle column, right frame: the dog’s head is distorted). Our method improves robustness to this, as multiple frames contribute to the generation of each frame in the video. Our framework can be combined with any diffusion-based image editing technique that accurately preserves the structure of the images; results with different image editing techniques (e.g. Meng et al. (2022); Zhang & Agrawala (2023)) are available in the SM. Fig. 5 and 1 show sample frames from the edited videos. Our edits are temporally consistent and adhere to the edit prompt. The man’s head is changed to Van-Gogh or marble (top left); importantly, the man’s identity and the scene’s background are consistent throughout the video. The patterns of the polygonal wolf (bottom left) are the same across time: the body is consistently orange while the chest is blue. We refer the reader to the SM for implementation details and video results.
122
+
123
+ Baselines. We compare our method to state-of-the-art, and concurrent works: (i) Fate-Zero (Qi et al., 2023) and (ii) Text2Video-Zero (Khachatryan et al., 2023b), that utilize a text-to-image model for video editing using self-attention inflation. (iii) Re-render a Video (Yang et al., 2023) that edits keyframes by adding optical flow optimization to self-attention inflation of an image model, and then propagates the edit from the keyframes to the rest of the video using an off-the-shelf propagation method. (iv) Tune-a-Video (Wu et al., 2022) that fine-tunes the text-to-image model on the given test video. (v) Gen-1 (Esser et al., 2023), a video diffusion model that was trained on a large-scale image and video dataset. (vi) Per-frame diffusion-based image editing baseline, PnP-Diffusion (Tumanyan et al., 2023). We additionally consider the two following baselines: (i) Text2LIVE (Bar-Tal et al., 2022) which utilize a layered video representation (NLA) (Kasten et al., 2021) and perform test-time training using CLIP losses. Note that NLA requires foreground/background separation masks and takes $\bar { \sim } 1 0$ hours to train. (ii) Applying PnP-Diffusion on a single keyframe and propagating the edit to the entire video using Jamriska et al. (2019). ˇ
124
+
125
+ # 5.1 QUALITATIVE EVALUATION
126
+
127
+ Fig. 6 provides a qualitative comparison of our method to prominent baselines; please refer to SM for the full videos. Our method (bottom row) outputs videos that better adhere to the edit prompt while maintaining temporal consistency of the resulting edited video, while other methods struggle to meet both these goals. Tune-A-Video (second row) inflates the 2D image model into a video model, and fine-tunes it to overfit the motion of the video; thus, it is suitable for short clips. For long videos it struggles to capture the motion resulting with meaningless edits, e.g., the shiny metal sculpture. Applying $\mathrm { P n P }$ for each frame independently (third row) results in exquisite edits adhering to the edit prompt but, as expected, lack any temporal consistency. The results of Gen-1 (fourth row) also suffer from some temporal inconsistencies (the beak of the origami stork changes color). Moreover, their frame quality is significantly worse than that of a text-to-image diffusion model. The edits of Text2Video-Zero and Fate-Zero (fifth and sixth row) suffer from severe jittering as these methods rely heavily on the extended attention mechanism to implicitly encourage consistency. The results of Rerender-a-Video exhibit notable long-range inconsistencies and artifacts arising primarily from their reliance on optical flow estimation for distant frames (e.g. keyframes), which is known to be sub-optimal (See our video results in the SM; when the wolf turns its head, the nose color changes). We provide qualitative comparison to Text2LIVE and to a RGB propagation baseline in the SM.
128
+
129
+ # 5.2 QUANTITATIVE EVALUATION
130
+
131
+ Table 1: We evaluate our method in temporal consistency by computing warp-error and conducting a user study, and in fidelity to the target text prompt using CLIP similarity. See Sec. 5 for more details.
132
+
133
+ <table><tr><td></td><td>(x10-3)</td><td>Warp-err↓|User preference| of our method</td><td>CLIP score个</td></tr><tr><td>LDM recon. PnP-Diffusion Text2Video-Zero Tune-a-Video Fate-Zero</td><td>2.0 11.3 12.5 30.0 6.9</td><td>94% 78% 82% 71%</td><td>0.23 0.33 0.33 0.31 0.32</td></tr><tr><td>Gen1 Rerender-a-Video Ours w joint attention Ours w/o rand keyframes</td><td>一 1.8 5.9 3.7</td><td>70% 71% 90%</td><td>0.32 0.32 0.33 0.33</td></tr></table>
134
+
135
+ We evaluate our method in terms of: (i) edit fidelity measured by computing the average similarity between the CLIP embedding (Radford et al., 2021) of each edited frame and the target text prompt; (ii) temporal consistency. Following Ceylan et al. (2023); Lai et al. (2018a), temporal consistency is measured by (a) computing the optical flow of the original video using Teed & Deng (2020), warping the edited frames according to it, and measuring the warping error, and (b) a user study; We adopt a Two-alternative Forced Choice (2AFC) protocol suggested in Kolkin et al. (2019); Park et al. (2020), where participants are shown
136
+
137
+ the input video, ours and a baseline result, and are asked to determine which video is more temporally consistent and better preserves the motion of the original video. The survey consists of 2000-3000 judgments per baseline obtained using Amazon mechanical turk. We note that warpingerror could not be measured for Gen1 since their product platform does not output the same number of input frames. Table 1 compares our method to baselines. Our method achieves the highest CLIP score, showing a good fit between the edited video and the input guidance prompt. Furthermore, our method has a low warping error, indicating temporally consistent results. We note that Re-rendera-Video optimizes for the warping error and uses optical flow to propagate the edit, and hence has the lowest warping error; However, this reliance on optical flow often creates artifacts and longrange inconsistencies which are not reflected in the warping error. Nonetheless, they are apparent in the user study, that shows users significantly favoured our method over all baselines in terms of temporal consistency. Additionally, we consider the reference baseline of passing the original video through the LDM auto-encoder without performing editing (LDM recon.). This baseline provides an upper bound on the temporal consistency achievable by LDM auto-encoder. As expected, the CLIP similarity of this baseline is poor as it does not involve any editing. However, this baseline does not achieve zero warp error either due to the imperfect reconstruction of the LDM auto-encoder, which hallucinates high-frequency information.
138
+
139
+ ![](images/118f8fe8be7f7b41ada181ff7655e290dfbe1190ba898fa469674ce042b5f21b.jpg)
140
+ Figure 7: Limitations. Our method edits the video according to the feature correspondences of the original video, hence it cannot handle edits that requires structure deviations.
141
+
142
+ We further evaluate our correspondences and video representation by measuring the accuracy of video reconstruction using TokenFlow. Specifically, we reconstruct the video using the same pipeline of our editing method, only removing the keyframes editing part. Table 2 reports the PSNR and LPIPS distance of this reconstruction, compared to vanilla DDIM reconstruction. As seen, TokenFlow reconstruction slightly improves DDIM inversion, demonstrating robust frame representation. This improvement can be attributed to the keyframe randomization; It increases robustness to challenging frames since each frame is reconstructed from multiple other frames during the generation. Notably, our evaluation focuses on accurate correspondences within the feature space during generation, rather than RGB frame correspondences evaluation, which is not essential to our method.
143
+
144
+ # 5.3 ABLATION STUDY
145
+
146
+ First, we ablate the use of TokenFlow, Sec. 4.2, for enforcing temporal consistency. In this experiment, we replace TokenFlow with extended attention (Eq. 3) and compute it between each frames of the edited video and the keyframes (w joint attention). Second, we ablate the randomizing of the keyframe selection at each generation step (w/o random keyframes). In this experiment, we use the same keyframe indices (evenly spaced in time) across the generation. Table 1 (bottom) shows the quantitative results of our ablations, the resulting videos can be found in the SM. As seen, TokenFlow ensures higher degree of temporal consistency, indicating that solely relying on the extension of self-attention to multiple frames is insufficient for achieving fine-grained temporal consistency. Additionally, fixing the keyframes creates an artificial partition of the video into short clips between the fixed keyframes, which reflects poorly on the consistency of the result.
147
+
148
+ Table 2: We reconstruct the video using the TokenFlow pipeline, excluding keyframe editing. We evaluate the TokenFlow representation with PSNR and LPIPS metrics. Our reconstruction improves vanilla DDIM inversion, highlighting the robusteness of TokenFlow representation.
149
+
150
+ <table><tr><td></td><td>PSNR↑</td><td>LPIPS↓</td></tr><tr><td>LDM recon. DDIMinversion Ours</td><td>31.13 25.32 25.74</td><td>0.03 0.14 0.13</td></tr></table>
151
+
152
+ # 6 DISCUSSION
153
+
154
+ We presented a new framework for text-driven video editing using an image diffusion model. We study the internal representation of a video in the diffusion feature space, and demonstrate that consistent video editing can be achieved via consistent diffusion feature representation during the generation. Our method outperforms existing baselines, demonstrating a significant improvement in temporal consistency. As for limitations, our method is tailored to preserve the motion of the original video, and as such, it cannot handle edits that require structural changes (Fig 7.) Moreover, our method is built upon a diffusion-based image editing technique to allow the structure preservation of the original frames. When the image-editing technique fails to preserve the structure, our method enforces correspondences that are meaningless in the edited frames, resulting in visual artifacts. Lastly, the LDM decoder introduces some high frequency flickering (Blattmann et al., 2023). A possible solution for this would be to combine our framework with an improved decoder (e.g., Blattmann et al. (2023), Zhu et al. (2023)). We note that this minor level of flickering can be easily eliminated with exiting post-process deflickering (see SM). Our work shed new light on the internal representation of natural videos in the space of diffusion models (e.g., temporal redundancies), and how they can be leveraged for enhancing video synthesis. We believe it can inspire future research in harnessing image models for video tasks, and for the design of text-to-video models.
155
+
156
+ REFERENCES
157
+ Omer Bar-Tal, Dolev Ofri-Amar, Rafail Fridman, Yoni Kasten, and Tali Dekel. Text2live: Text-driven layered image and video editing. In European Conference on Computer Vision, pp. 707–723. Springer, 2022.
158
+ Omer Bar-Tal, Lior Yariv, Yaron Lipman, and Tali Dekel. Multidiffusion: Fusing diffusion paths for controlled image generation. arXiv preprint arXiv:2302.08113, 2023.
159
+ Andreas Blattmann, Robin Rombach, Huan Ling, Tim Dockhorn, Seung Wook Kim, Sanja Fidler, and Karsten Kreis. Align your latents: High-resolution video synthesis with latent diffusion models. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
160
+ Mingdeng Cao, Xintao Wang, Zhongang Qi, Ying Shan, Xiaohu Qie, and Yinqiang Zheng. Masactrl: Tuningfree mutual self-attention control for consistent image synthesis and editing, 2023.
161
+ Duygu Ceylan, Chun-Hao Paul Huang, and Niloy Jyoti Mitra. Pix2video: Video editing using image diffusion. ArXiv, abs/2303.12688, 2023.
162
+ Hila Chefer, Yuval Alaluf, Yael Vinker, Lior Wolf, and Daniel Cohen-Or. Attend-and-excite: Attention-based semantic guidance for text-to-image diffusion models. arXiv preprint arXiv:2301.13826, 2023.
163
+ V. Cheung, B.J. Frey, and N. Jojic. Video epitomes. In 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’05), 2005.
164
+ Florinel-Alin Croitoru, Vlad Hondru, Radu Tudor Ionescu, and Mubarak Shah. Diffusion models in vision: A survey. arXiv preprint arXiv:2209.04747, 2022.
165
+ Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems, 2021.
166
+ Patrick Esser, Johnathan Chiu, Parmida Atighehchian, Jonathan Granskog, and Anastasis Germanidis. Structure and content-guided video synthesis with diffusion models. arXiv preprint arXiv:2302.03011, 2023.
167
+ Rafail Fridman, Amit Abecasis, Yoni Kasten, and Tali Dekel. Scenescape: Text-driven consistent scene generation. arXiv preprint arXiv:2302.01133, 2023.
168
+ Amir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. Prompt-to-prompt image editing with cross attention control. arXiv preprint arXiv:2208.01626, 2022.
169
+ Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 2020.
170
+ Jonathan Ho, William Chan, Chitwan Saharia, Jay Whang, Ruiqi Gao, Alexey Gritsenko, Diederik P Kingma, Ben Poole, Mohammad Norouzi, David J Fleet, et al. Imagen video: High definition video generation with diffusion models. arXiv preprint arXiv:2210.02303, 2022a.
171
+ Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J Fleet. Video diffusion models. arXiv:2204.03458, 2022b.
172
+ Susung Hong, Gyuseong Lee, Wooseok Jang, and Seungryong Kim. Improving sample quality of diffusion models using self-attention guidance. arXiv preprint arXiv:2210.00939, 2022.
173
+ Ondˇrej Jamriska, ˇ Sˇ arka Sochorov ´ a, Ond ´ ˇrej Texler, Michal Luka´c, Jakub Fi ˇ ser, Jingwan Lu, Eli Shechtman, and ˇ Daniel Sykora. Stylizing video by example. ´ ACM Transactions on Graphics, 2019.
174
+ Yoni Kasten, Dolev Ofri, Oliver Wang, and Tali Dekel. Layered neural atlases for consistent video editing. ACM Transactions on Graphics (TOG), 2021.
175
+ Levon Khachatryan, Andranik Movsisyan, Vahram Tadevosyan, Roberto Henschel, Zhangyang Wang, Shant Navasardyan, and Humphrey Shi. Text2video-zero: Text-to-image diffusion models are zero-shot video generators. ArXiv, abs/2303.13439, 2023a.
176
+ Levon Khachatryan, Andranik Movsisyan, Vahram Tadevosyan, Roberto Henschel, Zhangyang Wang, Shant Navasardyan, and Humphrey Shi. Text2video-zero: Text-to-image diffusion models are zero-shot video generators. arXiv preprint arXiv:2303.13439, 2023b.
177
+ Nicholas Kolkin, Jason Salavon, and Gregory Shakhnarovich. Style transfer by relaxed optimal transport and self-similarity. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10051–10060, 2019.
178
+ Wei-Sheng Lai, Jia-Bin Huang, Oliver Wang, Eli Shechtman, Ersin Yumer, and Ming-Hsuan Yang. Learning blind video temporal consistency. In European Conference on Computer Vision, 2018a.
179
+ Wei-Sheng Lai, Jia-Bin Huang, Oliver Wang, Eli Shechtman, Ersin Yumer, and Ming-Hsuan Yang. Learning blind video temporal consistency. In Proceedings of the European conference on computer vision (ECCV), pp. 170–185, 2018b.
180
+ Yao-Chih Lee, Ji-Ze Genevieve Jang, Yi-Ting Chen, Elizabeth Qiu, and Jia-Bin Huang. Shape-aware textdriven layered video editing. arXiv preprint arXiv:2301.13173, 2023a.
181
+ Yao-Chih Lee, Ji-Ze Genevieve Jang Jang, Yi-Ting Chen, Elizabeth Qiu, and Jia-Bin Huang. Shape-aware text-driven layered video editing demo. arXiv preprint arXiv:2301.13173, 2023b.
182
+ Chenyang Lei, Yazhou Xing, and Qifeng Chen. Blind video temporal consistency via deep video prior. In Advances in Neural Information Processing Systems, 2020.
183
+ Chenyang Lei, Xuanchi Ren, Zhaoxiang Zhang, and Qifeng Chen. Blind video deflickering by neural filtering with a flawed atlas. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2023.
184
+ Shaoteng Liu, Yuecheng Zhang, Wenbo Li, Zhe Lin, and Jiaya Jia. Video-p2p: Video editing with crossattention control. ArXiv, abs/2303.04761, 2023.
185
+ Grace Luo, Lisa Dunlap, Dong Huk Park, Aleksander Holynski, and Trevor Darrell. Diffusion hyperfeatures: Searching through time and space for semantic correspondence. arXiv, 2023.
186
+ Wan-Duo Kurt Ma, JP Lewis, W Bastiaan Kleijn, and Thomas Leung. Directed diffusion: Direct control of object placement through attention guidance. arXiv preprint arXiv:2302.13153, 2023.
187
+ Chenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. SDEdit: Guided image synthesis and editing with stochastic differential equations. In International Conference on Learning Representations, 2022.
188
+ Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021.
189
+ Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, pp. 8162–8171. PMLR, 2021.
190
+ Taesung Park, Jun-Yan Zhu, Oliver Wang, Jingwan Lu, Eli Shechtman, Alexei A. Efros, and Richard Zhang. Swapping autoencoder for deep image manipulation. In Advances in Neural Information Processing Systems, 2020.
191
+ Or Patashnik, Daniel Garibi, Idan Azuri, Hadar Averbuch-Elor, and Daniel Cohen-Or. Localizing object-level shape variations with text-to-image diffusion models. arXiv preprint arXiv:2303.11306, 2023.
192
+ Jordi Pont-Tuset, Federico Perazzi, Sergi Caelles, Pablo Arbelaez, Alex Sorkine-Hornung, and Luc Van Gool. ´ The 2017 davis challenge on video object segmentation. arXiv preprint arXiv:1704.00675, 2017.
193
+ Chenyang Qi, Xiaodong Cun, Yong Zhang, Chenyang Lei, Xintao Wang, Ying Shan, and Qifeng Chen. Fatezero: Fusing attentions for zero-shot text-based video editing. arXiv:2303.09535, 2023.
194
+ Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning. PMLR, 2021.
195
+ Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
196
+ Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text to image synthesis. In International conference on machine learning, pp. 1060–1069. PMLR, 2016.
197
+ Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High-resolution ¨ image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10684–10695, 2022.
198
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, 2015.
199
+ Manuel Ruder, Alexey Dosovitskiy, and Thomas Brox. Artistic style transfer for videos. In Pattern Recognition - 38th German Conference (GCPR), 2016.
200
+ Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S Sara Mahdavi, Rapha Gontijo Lopes, et al. Photorealistic text-toimage diffusion models with deep language understanding. arXiv preprint arXiv:2205.11487, 2022.
201
+ Christoph Schuhmann, Romain Beaumont, Richard Vencu, Cade Gordon, Ross Wightman, Mehdi Cherti, Theo Coombes, Aarush Katta, Clayton Mullis, Mitchell Wortsman, Patrick Schramowski, Srivatsa Kundurthy, Katherine Crowson, Ludwig Schmidt, Robert Kaczmarczyk, and Jenia Jitsev. Laion-5b: An open largescale dataset for training next generation image-text models. ArXiv, abs/2210.08402, 2022.
202
+ Oded Shahar, Alon Faktor, and Michal Irani. Space-time super-resolution from a single video. In CVPR 2011, 2011.
203
+ Shelly Sheynin, Oron Ashual, Adam Polyak, Uriel Singer, Oran Gafni, Eliya Nachmani, and Yaniv Taigman. Knn-diffusion: Image generation via large-scale retrieval. arXiv preprint arXiv:2204.02849, 2022.
204
+ Chaehun Shin, Heeseung Kim, Che Hyun Lee, Sang gil Lee, and Sung-Hoon Yoon. Edit-a-video: Single video editing with object-aware consistency. ArXiv, abs/2303.07945, 2023.
205
+ Uriel Singer, Adam Polyak, Thomas Hayes, Xi Yin, Jie An, Songyang Zhang, Qiyuan Hu, Harry Yang, Oron Ashual, Oran Gafni, Devi Parikh, Sonal Gupta, and Yaniv Taigman. Make-a-video: Text-to-video generation without text-video data, 2022.
206
+ Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pp. 2256–2265. PMLR, 2015.
207
+ Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2020.
208
+ Zachary Teed and Jia Deng. Raft: Recurrent all-pairs field transforms for optical flow. In Computer Vision– ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part II 16. Springer, 2020.
209
+ Ondˇrej Texler, David Futschik, Michal Kucera, Ond ˇ ˇrej Jamriska, ˇ Sˇ arka Sochorov ´ a, Menglei Chai, Sergey ´ Tulyakov, and Daniel Sykora. Interactive video stylization using few-shot patch-based training. ´ ACM Transactions on Graphics, 2020.
210
+ Narek Tumanyan, Michal Geyer, Shai Bagon, and Tali Dekel. Plug-and-play diffusion features for text-driven image-to-image translation. Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2023.
211
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017.
212
+ Jay Zhangjie Wu, Yixiao Ge, Xintao Wang, Stan Weixian Lei, Yuchao Gu, Wynne Hsu, Ying Shan, Xiaohu Qie, and Mike Zheng Shou. Tune-a-video: One-shot tuning of image diffusion models for text-to-video generation. arXiv preprint arXiv:2212.11565, 2022.
213
+ Shuai Yang, Yifan Zhou, Ziwei Liu, and Chen Change Loy. Rerender a video: Zero-shot text-guided video-tovideo translation, 2023.
214
+ Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaogang Wang, Xiaolei Huang, and Dimitris N. Metaxas. Stackgan: Text to photo-realistic image synthesis with stacked generative adversarial networks. 2017 IEEE International Conference on Computer Vision (ICCV), pp. 5908–5916, 2016.
215
+ Junyi Zhang, Charles Herrmann, Junhwa Hur, Luisa Polania Cabrera, Varun Jampani, Deqing Sun, and MingHsuan Yang. A tale of two features: Stable diffusion complements dino for zero-shot semantic correspondence. arXiv preprint arxiv:2305.15347, 2023.
216
+ Lvmin Zhang and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models, 2023.
217
+ Zixin Zhu, Xuelu Feng, Dongdong Chen, Jianmin Bao, Le Wang, Yinpeng Chen, Lu Yuan, and Gang Hua. Designing a better asymmetric vqgan for stablediffusion, 2023.
218
+
219
+ Table 3: We report average runtime in seconds, of running ours and competing methods on a video of 40 frames.
220
+
221
+ <table><tr><td>TAV</td><td>Text2video-zero</td><td>Rerender-a-video</td><td>fatezero</td><td>PnP</td><td>ours (preprocess)</td><td>ours (sampling)</td><td>ours (total)</td></tr><tr><td>2684</td><td>198</td><td>285</td><td>349</td><td>208</td><td>50</td><td>187</td><td>237</td></tr></table>
222
+
223
+ We provide additional implementation details below. We refer the reader to the HTML file attached to our Supplementary Material for video results.
224
+
225
+ # A IMPLEMENTATION DETAILS
226
+
227
+ StableDiffusion. We use Stable Diffusion as our pre-trained text-to-image model; we use the StableDiffusion-v-2-1 checkpoint provided via official HuggingFace webpage.
228
+
229
+ DDIM inversion. In all of our experiments, we use DDIM deterministic sampling with 50 steps. For inverting the video, we follow Tumanyan et al. (2023) and use DDIM inversion with classifierfree guidance scale of 1 and 1000 forward steps; and extract the self-attention input tokens from this process similarly to Qi et al. (2023).
230
+
231
+ Runtime. Since we don’t compute the attention module on most video frames (i.e., we only compute the self-attention output on the keyframes) our method is efficient in run-time, and the sampling of the video reduces the time of per-frame editing by $2 0 \%$ . The inversion process with 1000 steps is the main bottleneck of our method in terms of run-time, and in many cases a significantly smaller amount of steps is suffieicent (e.g. 50). Table 3 reports runtime comparisons using 50 steps in all methods. Notably, our sampling time is indeed faster than that of per-frame editing (PnP).
232
+
233
+ Hyper-parameters. In equation 5 we set $w _ { i }$ to be:
234
+
235
+ $$
236
+ \begin{array} { c } { w _ { i } = \sigma ( d _ { - } / ( d _ { + } + d _ { - } ) ) } \\ { \mathrm { ~ w h e r e ~ } d _ { + } = | | i - i ^ { + } | | , d _ { - } = | | i - i ^ { - } | | } \end{array}
237
+ $$
238
+
239
+ where $\sigma$ is a sigmoid function, $i ^ { + }$ and $i ^ { - }$ are the future and past neighboring keyframes of $i$ , respectively.
240
+
241
+ For sampling the edited video we set the classifier-free guidance scale to 7.5. At each timestep, we sample random keyframes in frame intervals of 8. We note that using less keyframes (i.e., increasing the interval size) results in (i) runtime decreases (the joint keyframe editing step requires less memory, and is faster), and (ii) temporal consistency is improved (since the same tokens are shared across more frames). Nevertheless, too few keyframes will result in inaccurate correspondences which may result in artefacts.
242
+
243
+ Baselines. For running the baseline of Tune-a-video (Wu et al., 2022) we used their official repository. For Gen-1 (Esser et al., 2023) we used their platform on Runaway website. This platform outputs a video that is not in the same length and frame-rate as the input video; therefore, we could not compute the warping error on their results. For text-to-video-zero (Khachatryan et al., 2023b) we used their official repository, with their depth conditioning configuration. For Fate-Zero (Qi et al., 2023) with used their official repository, and verified the run configurations with the authors.
parse/test/lKK50q2MtV/lKK50q2MtV_content_list.json ADDED
@@ -0,0 +1,503 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "TOKENFLOW: CONSISTENT DIFFUSION FEATURES FOR CONSISTENT VIDEO EDITING ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Anonymous authors Paper under double-blind review ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "image",
15
+ "img_path": "images/f04609e3652fecd354ddf1e20f13aab3418f0914dc2e7eada7aa5678f154ce53.jpg",
16
+ "image_caption": [
17
+ "Figure 1: TokenFlow enables consistent, high-quality semantic edits of real-world videos. Given an input video (top row), our method edits it according to a target text prompt (middle and bottom rows), while preserving the semantic layout and motion in the original scene. "
18
+ ],
19
+ "image_footnote": [],
20
+ "page_idx": 0
21
+ },
22
+ {
23
+ "type": "text",
24
+ "text": "ABSTRACT ",
25
+ "text_level": 1,
26
+ "page_idx": 0
27
+ },
28
+ {
29
+ "type": "text",
30
+ "text": "The generative AI revolution has recently expanded to videos. Nevertheless, current state-of-the-art video models are still lagging behind image models in terms of visual quality and user control over the generated content. In this work, we present a framework that harnesses the power of a text-to-image diffusion model for the task of text-driven video editing. Specifically, given a source video and a target text-prompt, our method generates a high-quality video that adheres to the target text, while preserving the spatial layout and motion of the input video. Our method is based on a key observation that consistency in the edited video can be obtained by enforcing consistency in the diffusion feature space. We achieve this by explicitly propagating diffusion features based on inter-frame correspondences, readily available in the model. Thus, our framework does not require any training or fine-tuning, and can work in conjunction with any off-the-shelf text-toimage editing method. We demonstrate state-of-the-art editing results on a variety of real-world videos. ",
31
+ "page_idx": 0
32
+ },
33
+ {
34
+ "type": "text",
35
+ "text": "1 INTRODUCTION ",
36
+ "text_level": 1,
37
+ "page_idx": 0
38
+ },
39
+ {
40
+ "type": "text",
41
+ "text": "The evolution of text-to-image models has recently facilitated advances in image editing and content creation, allowing users to control various proprieties of both generated and real images. Nevertheless, expanding this exciting progress to video is still lagging behind. A surge of large-scale text-to-video generative models has emerged, demonstrating impressive results in generating clips solely from textual descriptions. However, despite the progress made in this area, existing video models are still in their infancy, being limited in resolution, video length, or the complexity of video dynamics they can represent. In this paper, we harness the power of a state-of-the-art pre-trained text-to-image model for the task of text-driven editing of natural videos. Specifically, our goal is to generate high-quality videos that adhere to the target edit expressed by an input text prompt, while preserving the spatial layout and motion of the original video. The main challenge in leveraging an image diffusion model for video editing is to ensure that the edited content is consistent across all video frames – ideally, each physical point in the 3D world undergoes coherent modifications across time. Existing and concurrent video editing methods that are based on image diffusion models have demonstrated that global appearance coherency across the edited frames can be achieved by extending the self-attention module to include multiple frames (Wu et al., 2022; Khachatryan et al., 2023b; Ceylan et al., 2023; Qi et al., 2023). Nevertheless, this approach is insufficient for achieving the desired level of temporal consistency, as motion in the video is only implicitly preserved through the attention module. Consequently, professionals or semi-professionals users often resort to elaborate video editing pipelines that entail additional manual work. In this work, we propose a framework to tackle this challenge by explicitly enforcing the original inter-frame correspondences on the edit. ",
42
+ "page_idx": 0
43
+ },
44
+ {
45
+ "type": "text",
46
+ "text": "",
47
+ "page_idx": 1
48
+ },
49
+ {
50
+ "type": "text",
51
+ "text": "Intuitively, natural videos contain redundant information across frames, e.g., depict similar appearance and shared visual elements. Our key observation is that the internal representation of the video in the diffusion model exhibits similar properties. That is, the level of redundancy and temporal consistency of the frames in the RGB space and in the diffusion feature space are tightly correlated. Based on this observation, the pillar of our approach is to achieve consistent edit by ensuring that the features of the edited video are consistent across frames. Specifically, we enforce that the edited features convey the same inter-frame correspondences and redundancy as the original video features. To do so, we leverage the original inter-frame feature correspondences, which are readily available by the model. This leads to an effective method that directly propagates the edited diffusion features based on the original video dynamics. This approach allows us to harness the generative prior of state-of-the-art image diffusion model without additional training or fine-tuning, and can work in conjunction with an off-the-shelf diffusion-based image editing method (e.g., Meng et al. (2022); Hertz et al. (2022); Zhang & Agrawala (2023); Tumanyan et al. (2023)). ",
52
+ "page_idx": 1
53
+ },
54
+ {
55
+ "type": "text",
56
+ "text": "ummarize, we make the following key contributions: ",
57
+ "page_idx": 1
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "• A technique, dubbed TokenFlow, that enforces semantic correspondences of diffusion features across frames, allowing to significantly increase temporal consistency in videos generated by a text-to-image diffusion model. • Novel empirical analysis studying the proprieties of diffusion features across a video. • State-of-the-art editing results on diverse videos, depicting complex motions. ",
62
+ "page_idx": 1
63
+ },
64
+ {
65
+ "type": "text",
66
+ "text": "2 RELATED WORK ",
67
+ "text_level": 1,
68
+ "page_idx": 1
69
+ },
70
+ {
71
+ "type": "text",
72
+ "text": "Text-driven image & video synthesis Seminal works designed GAN architectures to synthesize images conditioned on text embeddings (Reed et al., 2016; Zhang et al., 2016). With the evergrowing scale of vision-language datasets and pretraining strategies (Radford et al., 2021; Schuhmann et al., 2022), there has been a remarkable progress in text-driven image generation capabilities. Users can sytnesize high-quality visual content using simple text prompts. Much of this progress is also attributed to diffusion models (Sohl-Dickstein et al., 2015; Croitoru et al., 2022; Dhariwal & Nichol, 2021; Ho et al., 2020; Nichol & Dhariwal, 2021) which have been established as stateof-the-art text-to-image generators (Nichol et al., 2021; Saharia et al., 2022; Ramesh et al., 2022; Rombach et al., 2022; Sheynin et al., 2022; Bar-Tal et al., 2023). Such models have been extended for text-to-video generation, by extending 2D architectures to the temporal dimension (e.g., using temporal attention Ho et al. (2022b)) and performing large-scale training on video datasets (Ho et al., 2022a; Blattmann et al., 2023; Singer et al., 2022). Recently, Gen-1 (Esser et al., 2023) tailored a diffusion model architecture for the task of video editing, by conditioning the network on structure/appearance representations. Nevertheless, due to their extensive computation and memory requirements, existing video diffusion models are still in infancy and are largely restricted to short clips, or exhibit lower visual quality compared to image models. On the other side of the spectrum, a promising recent trend of works leverage a pre-trained image diffusion model for video synthesis tasks, without additional training (Fridman et al., 2023; Wu et al., 2022; Lee et al., $2 0 2 3 \\mathrm { a }$ ; Qi et al., 2023). Our work falls into this category, employing a pretrained text-to-image diffusion model for the task of video editing, without any training or finetuning. ",
73
+ "page_idx": 1
74
+ },
75
+ {
76
+ "type": "text",
77
+ "text": "Consistent video stylization A common approach for video stylization involves applying image editing techniques (e.g., style transfer) on a frame-by-frame basis, followed by a post-processing stage to address temporal inconsistencies in the edited video (Lai et al. (2018b); Lei et al. (2020; 2023)). Although these methods effectively reduce high-frequency temporal flickering, they are not designed to handle frames that exhibit substantial variations in content, which often occur when applying text-based image editing techniques (Qi et al., 2023). Kasten et al. (2021) propose to decompose a video into a set of 2D atlases, each provides a unified representation of the background or of a foreground object throughout the video. Edits applied to the 2D atlases are automatically mapped back to the video, thus achieving temporal consistency with minimal effort. Bar-Tal et al. (2022); Lee et al. (2023b) leverage this representation to perform text-driven editing. However, the atlas representation is limited to videos with simple motion and requires long training, limiting the applicability of this technique and of the methods built upon it. Our work is also related to classical works that demonstrated that small patches in a natural video extensively repeat across frames (Shahar et al., 2011; Cheung et al., 2005), and thus consistent editing can by simplified by editing a subset of keyframes and propagating the edit across the video by establishing patch correspondences using handcrafted features and optical flow (Ruder et al., 2016; Jamriska et al., 2019) or by ˇ training a patch-based GAN (Texler et al., 2020). Nevertheless, such propagation methods struggle to handle videos with illumination changes, or with complex dynamics. Importantly, they rely on a user provided consistent edit of the keyframes, which remains a labor-intensive task yet to be automated. Yang et al. (2023) combines keyframe editing with a propagation method by Jamriska ˇ et al. (2019). They edit keyframes using a text-to-image diffusion model while enforcing optical flow constraints on the edited keyframes. However, since optical flow estimation between distant frames is not reliable, their method fails to consistently edit keyframes that are far apart (as seen in our Supplementary Material - SM), and as a result, fails to consistently edit most videos. ",
78
+ "page_idx": 1
79
+ },
80
+ {
81
+ "type": "image",
82
+ "img_path": "images/a6f7bde709f695d9c2f9b7374705195cf1cb15b06861e32eed54729b6ada3501.jpg",
83
+ "image_caption": [
84
+ "Figure 3: Diffusion features across time. Left: Given an input video (top row), we apply DDIM inversion on each frame and extract features from the highest resolution decoder layer in $\\epsilon _ { \\theta }$ . We apply PCA on the features (i.e., output tokens from the self-attention module) extracted from all frames and visualize the first three components (second row). We further visualize an $x$ -t slice (marked in red on the original frame) for both RGB and features (bottom row). The feature representation is consistent across time – corresponding regions are encoded with similar features across the video. Middle: Frames and feature visualization for an edited video obtained by applying an image editing method (Tumanyan et al. (2023)) on each frame; inconsistent patterns in RGB are also evident in the feature space (e.g., on the dog’s body). Right: Our method enforces the edited video to convey the same level of feature consistency as the original video, which translates into a coherent and high-quality edit in RGB space. "
85
+ ],
86
+ "image_footnote": [],
87
+ "page_idx": 2
88
+ },
89
+ {
90
+ "type": "text",
91
+ "text": "",
92
+ "page_idx": 2
93
+ },
94
+ {
95
+ "type": "text",
96
+ "text": "Our work shares a similar motivation as this approach that benefits from the temporal redundancies in natural videos. We show that such redundancies are also present in the feature space of a text-to-image diffusion model, and leverage this property to achieve consistency. ",
97
+ "page_idx": 2
98
+ },
99
+ {
100
+ "type": "text",
101
+ "text": "Controlled generation via diffusion features manipulation Recently, a surge of works demonstrated how text-to-image diffusion models can be readily adapted to various editing and generation tasks, by performing simple operations on the intermediate feature representation of the diffusion network (Chefer et al., 2023; Hong et al., 2022; Ma et al., 2023; Tumanyan et al., 2023; Hertz et al., 2022; Patashnik et al., 2023; Cao et al., 2023). Luo et al. (2023); Zhang et al. (2023) demonstrated semantic appearance swapping using diffusion feature correspondences. Hertz et al. (2022) observed that by manipulating the cross-attention layers, it is possible to control the relation between the spatial layout of the image to each word in the text. Plugand-Play Diffusion $\\mathrm { P n P } ,$ , Tumanyan et al. (2023)) analyzed the spatial features and the self-attention ",
102
+ "page_idx": 2
103
+ },
104
+ {
105
+ "type": "image",
106
+ "img_path": "images/89a5ccf646fc1d40ac7986a6cc5a5a50d2ad5e66fb053d05e57b28b62229b3fa.jpg",
107
+ "image_caption": [
108
+ "Figure 2: Fine-grained feature correspondences. Features (i.e., output tokens from the self-attention modules) extracted from of a source frame are used to reconstruct nearby frames. This is done by: (a) swapping each feature in the target by its nearest feature in the source, in all layers and all generation time steps, and (b) simple warping in RGB space, using a nearest neighbour field (c), computed between the source and target features extracted from the highest resolution decoder layer. The target is faithfully reconstructed, demonstrating the high level of spatial granularity and shared content between the features. "
109
+ ],
110
+ "image_footnote": [],
111
+ "page_idx": 2
112
+ },
113
+ {
114
+ "type": "text",
115
+ "text": "maps and found that they capture semantic information at high spatial granularity. Tune-A-Video (Wu et al., 2022) observed that by extending the self-attention module to operate on more than a single frame, it is possible to generate frames that share a common global appearance. Qi et al. (2023); Ceylan et al. (2023); Khachatryan et al. (2023a); Shin et al. (2023); Liu et al. (2023) leverage this property to achieve globally-coherent video edits. Nevertheless, as demonstrated in Sec. 5, inflating the self-attention module is insufficient for achieving fine-grained temporal consistency. Prior and concurrent works either compromise visual quality, or exhibit limited temporal consistency. In this work, we also perform video editing via simple operations in the feature space of a pre-trained text-to-image model, we explicitly encourage the features of the model to be temporally consistent through TokenFlow. ",
116
+ "page_idx": 2
117
+ },
118
+ {
119
+ "type": "image",
120
+ "img_path": "images/458377da329e574050359aa65fbebaa07774b837d8ece61cbe02c2dad4f1c3a3.jpg",
121
+ "image_caption": [
122
+ "Figure 4: TokenFlow pipeline. Top: Given an input video $\\mathcal { T }$ , we DDIM invert each frame, extract its tokens, i.e., output features from the self-attention modules, from each timestep and layer, and compute inter-frame features correspondences using a nearest-neighbor (NN) search. Bottom: The edited video is generated as follows: at each denoising step $t$ , (I) we sample keyframes from the noisy video $J _ { t }$ and jointly edit them using an extended-attention block; the set of resulting edited tokens is $\\mathbf { T } _ { b a s e }$ . (II) We propagate the edited tokens across the video according to the pre-computed correspondences of the original video features. To denoise $J _ { t }$ , we feed each frame to the network, and replace the generated tokens with the tokens obtained from the propagation step (II). "
123
+ ],
124
+ "image_footnote": [],
125
+ "page_idx": 3
126
+ },
127
+ {
128
+ "type": "text",
129
+ "text": "",
130
+ "page_idx": 3
131
+ },
132
+ {
133
+ "type": "text",
134
+ "text": "3 PRELIMINARIES ",
135
+ "text_level": 1,
136
+ "page_idx": 3
137
+ },
138
+ {
139
+ "type": "text",
140
+ "text": "Diffusion Models Diffusion probabalistic models (DPM) (Sohl-Dickstein et al., 2015; Croitoru et al., 2022; Dhariwal & Nichol, 2021; Ho et al., 2020; Nichol & Dhariwal, 2021) are a class of generative models that aim to approximate a data distribution $q$ through a progressive denosing process. Starting from a Gaussian i.i.d noisy image $\\pmb { x } _ { T } \\sim \\mathcal { N } ( 0 , I )$ , the diffusion model $\\epsilon _ { \\theta }$ , gradually denoises it, until reaching a clean image $\\scriptstyle { \\mathbf { { \\vec { x } } } } _ { 0 }$ drawn from the target distribution $q$ . DPM can learn a conditional distribution by incorporating additional guiding signals, such as text conditioning. Song et al. (2020) derived DDIM, a deterministic sampling algorithm given an initial noise $\\mathbf { \\nabla } _ { \\mathbf { x } _ { T } }$ . By applying this algorithm in the reverse order (a.k.a. DDIM inversion) starting from the clean $\\scriptstyle { \\mathbf { { \\vec { x } } } } _ { 0 }$ , it allows to obtain the intermediate noisy images $\\{ { \\pmb x } _ { i } \\} _ { t = 1 } ^ { T }$ used to generate it. ",
141
+ "page_idx": 3
142
+ },
143
+ {
144
+ "type": "text",
145
+ "text": "Stable Diffusion Stable Diffusion (SD) (Rombach et al., 2022) is a prominent text-to-image diffusion model that operates in a latent image space. A pretrained encoder maps RGB images to this space, and a decoder decodes latents back to high-resolution images. In more detail, SD is based on a U-Net architecture (Ronneberger et al., 2015), which comprises of residual, self-attention, and cross-attention blocks. The residual block convolves the activations from a previous layer, while cross-attention manipulates features according to the text prompt. In the self-attention block, features are projected into queries $Q$ , keys $\\kappa$ , and values $V$ . The Attention operation (Vaswani et al., 2017) computes the affinities between the $d$ -dimensional projections $Q , K$ to yield the output of the layer: ",
146
+ "page_idx": 3
147
+ },
148
+ {
149
+ "type": "equation",
150
+ "img_path": "images/4d160876fc159f6b4192deccc5e912e73a9a99c8b42348ab306cc60effc48929.jpg",
151
+ "text": "$$\nA \\cdot V { \\mathrm { ~ w h e r e ~ } } A = \\operatorname { \\mathrm { a t t } } \\operatorname { e n t i o n } ( Q ; K ) { \\mathrm { ~ a n d ~ } } \\operatorname { A t t } \\operatorname { e n t i o n } ( Q ; K ) = \\operatorname { S o f t m a x } \\left( { \\frac { Q K ^ { T } } { \\sqrt d } } \\right)\n$$",
152
+ "text_format": "latex",
153
+ "page_idx": 3
154
+ },
155
+ {
156
+ "type": "image",
157
+ "img_path": "images/78158ef427a4b9c6aeb795948abf5f9aef4d9b5245310066ae10307800e707e0.jpg",
158
+ "image_caption": [
159
+ "Figure 5: Results. Sample results of our method. We refer the reader to our webpage and SM for more examples and full-video results. "
160
+ ],
161
+ "image_footnote": [],
162
+ "page_idx": 4
163
+ },
164
+ {
165
+ "type": "text",
166
+ "text": "4 METHOD ",
167
+ "text_level": 1,
168
+ "page_idx": 4
169
+ },
170
+ {
171
+ "type": "text",
172
+ "text": "Given an input video $\\pmb { \\mathcal { I } } = [ \\pmb { I } ^ { 1 } , . . . , \\pmb { I } ^ { n } ]$ , and a text prompt $\\mathcal { P }$ describing the target edit, our goal is to generate an edited video $\\mathcal { I } = [ J ^ { 1 } , . . . , J ^ { n } ]$ that adheres to the text $\\mathcal { P }$ , while preserving the original motion and semantic layout of $\\boldsymbol { \\mathscr { x } }$ . To achieve this, our framework leverages a pretrained and fixed text-to-image diffusion model $\\epsilon _ { \\theta }$ . ",
173
+ "page_idx": 4
174
+ },
175
+ {
176
+ "type": "text",
177
+ "text": "Na¨ıvely leveraging $\\epsilon _ { \\theta }$ for video editing, by applying an image editing method on each frame independently (e.g., Hertz et al. (2022); Tumanyan et al. (2023); Meng et al. (2022); Zhang & Agrawala (2023)), results in content inconsistencies across frames (e.g., Fig. 3 middle column). Our key finding is that these inconsistencies can be alleviated by enforcing consistency among the internal diffusion features across frames, during the editing process. ",
178
+ "page_idx": 4
179
+ },
180
+ {
181
+ "type": "text",
182
+ "text": "Natural videos typically depict coherent and shared content across time. We observe that the internal representation of natural videos in $\\epsilon _ { \\theta }$ has similar properties. This is illustrated in Fig. 3, where we visualize the features extracted from a given video (first column). As seen, the features depict a shared and consistent representation across frames, i.e., corresponding regions exhibit similar representation. We further observe that the original video features provide fine-grained correspondences between frames, using a simple nearest neighbour search (Fig 2). Moreover, we show that these corresponding features are interchangeable for the diffusion model – we can faithfully synthesize one frame by swapping its features by their corresponding ones in a nearby frame (Fig 2(a)). ",
183
+ "page_idx": 4
184
+ },
185
+ {
186
+ "type": "text",
187
+ "text": "Nevertheless, when an edit is applied to each frame individually, the consistency of the features breaks (Fig. 3 middle column). This implies that the level of consistency of in RGB space is correlated with the consistency of the internal features of the frames. Hence, our key idea is to manipulate the features of the edited video to preserve the level of consistency and inter-frame correspondences of the original video features. ",
188
+ "page_idx": 4
189
+ },
190
+ {
191
+ "type": "text",
192
+ "text": "As illustrated in Fig. 4, our framework, dubbed TokenFlow, alternates at each generation timestep between two main components: (i) sampling a set of keyframes and jointly editing them according to $\\mathcal { P }$ ; this stage results in shared global appearance across the keyframes, and (ii) propagating the features from the keyframes to all of the frames based on the correspondences provided by the original video features; this stage explicitly preserves the consistency and fine-grained shared representation of the original video features. Both stages are done in combination with an image editing technique $\\hat { \\epsilon _ { \\theta } }$ (e.g, Tumanyan et al. (2023)). Intuitively, the benefit of alternating between keyframe editing and propagation is twofold: first, sampling random keyframes at each generation step increases the robustness to a particular selection. Second, since each generation step results in more consistent features, the sampled keyframes in the next step will be edited more consistently. ",
193
+ "page_idx": 4
194
+ },
195
+ {
196
+ "type": "image",
197
+ "img_path": "images/d03b8e24c8a84914cc242f71bf929986c1bcf23508e333fe62ed4ff885ca7aa2.jpg",
198
+ "image_caption": [
199
+ "Figure 6: Comparison. We compare our method against Tune-A-Video (TAV, Wu et al. (2022)), PnPDiffusion (Tumanyan et al., 2023) applied per frame, Gen-1 (Esser et al., 2023), Text2Video-Zero (Khachatryan et al., 2023a) and Fate-Zero (Qi et al., 2023). We refer the reader to our supplementary material for full-video comparisons. "
200
+ ],
201
+ "image_footnote": [],
202
+ "page_idx": 5
203
+ },
204
+ {
205
+ "type": "text",
206
+ "text": "",
207
+ "page_idx": 5
208
+ },
209
+ {
210
+ "type": "text",
211
+ "text": "Pre-processing: extracting diffusion features. Given an input video $\\boldsymbol { \\mathscr { x } }$ , we apply DDIM inversion (see Sec. 3) on each frame $I ^ { i }$ , which yields a sequence of latents $[ \\pmb { x } _ { 1 } ^ { i } , . . . , \\pmb { x } _ { T } ^ { i } ]$ . For each generation timestep $t$ , we feed the latent $\\mathbf { \\Delta } _ { \\mathbf { \\boldsymbol { x } } _ { t } ^ { i } }$ of each frame $i \\in [ n ]$ to the model and extract the tokens $\\phi ( x _ { t } ^ { i } )$ from the self-attention module of every layer in the network $\\epsilon _ { \\theta }$ (fig. 4, top). We will later use these tokens to establish inter-frame correspondences between diffusion features. ",
212
+ "page_idx": 5
213
+ },
214
+ {
215
+ "type": "text",
216
+ "text": "4.1 KEYFRAME SAMPLING AND JOINT EDITING ",
217
+ "text_level": 1,
218
+ "page_idx": 5
219
+ },
220
+ {
221
+ "type": "text",
222
+ "text": "Our observations imply that given the features of a single edited frame, we can generate the next frames by propagating its features to their corresponding locations. Most videos, however, can not be represented by a single keyframe. To account for that, we consider multiple keyframes, from which we obtain a set of features (tokens), $\\pmb { T } _ { b a s e }$ , that will later be propagated to the entire video. Specifically, at each generation step, we randomly sample a set of keyframes $\\{ J ^ { i } \\} _ { i \\in \\kappa }$ in fixed frame intervals (see SM for details). We joinly edit the keyframes by extending the selfattention block to simultaneously process them $\\breve { \\mathbf { W } } \\mathbf { u }$ et al., 2022), thus encouraging them to share a global appearance. In more detail, the input to the modified block are the self-attention features from all keyframes $\\{ Q ^ { i } \\} _ { i \\in \\kappa } , \\{ K ^ { i } \\} _ { i \\in \\kappa } , \\{ V ^ { i } \\} _ { i \\in \\kappa }$ where $Q ^ { i } , K ^ { i } , V ^ { i }$ are the queries, keys, and values of frame $i \\in \\kappa , \\kappa = \\{ i _ { 1 } , . . . i _ { k } \\}$ . The keys of all frames are concatenated, and the extended-attention is: ",
223
+ "page_idx": 5
224
+ },
225
+ {
226
+ "type": "equation",
227
+ "img_path": "images/f058fc59d545f9c734b1998d7f0f447adf4644b01423bfbf57bdd53da3044aca.jpg",
228
+ "text": "$$\n\\operatorname { E x t a t } \\tan \\left( { Q } ^ { i } ; [ K ^ { i 1 } , \\dots K ^ { i _ { k } } ] \\right) = \\operatorname { s o f t m a x } \\left( \\frac { { Q } ^ { i } \\left[ K ^ { i _ { 1 } } , \\dots K ^ { i _ { k } } \\right] ^ { T } } { \\sqrt { d } } \\right)\n$$",
229
+ "text_format": "latex",
230
+ "page_idx": 5
231
+ },
232
+ {
233
+ "type": "text",
234
+ "text": "The output of the block for frame $i$ is given by: ",
235
+ "page_idx": 6
236
+ },
237
+ {
238
+ "type": "equation",
239
+ "img_path": "images/2e9e719b2074fb6bc101b6de80d700d17523906983eb04b288ba3b89581c30e6.jpg",
240
+ "text": "$$\n\\phi ( \\boldsymbol J ^ { i } ) = \\hat { A } \\cdot \\big [ \\boldsymbol V ^ { i _ { 1 } } , \\ldots \\boldsymbol V ^ { i _ { k } } \\big ] \\quad \\mathrm { w h e r e } \\quad \\hat { A } = \\mathrm { E x t a t t n } \\Big ( \\boldsymbol Q ^ { i } ; [ \\boldsymbol K ^ { i _ { 1 } } , \\ldots \\boldsymbol K ^ { i _ { k } } ] \\Big )\n$$",
241
+ "text_format": "latex",
242
+ "page_idx": 6
243
+ },
244
+ {
245
+ "type": "text",
246
+ "text": "Intuitively, each keyframe queries all other keyframes, and aggregates information from them. This results in a roughly unified appearance in the edited frames $\\mathrm { \\bar { W } } \\mathrm { \\bar { u } }$ et al., 2022; Khachatryan et al., 2023b; Ceylan et al., 2023; Qi et al., 2023). We define $\\mathbf { T } _ { b a s e } = \\{ \\phi ( J ^ { i } ) \\} _ { i \\in \\kappa }$ , for each layer in the network (Fig. 4 bottom middle). ",
247
+ "page_idx": 6
248
+ },
249
+ {
250
+ "type": "text",
251
+ "text": "4.2 EDIT PROPAGATION VIA TOKENFLOW ",
252
+ "text_level": 1,
253
+ "page_idx": 6
254
+ },
255
+ {
256
+ "type": "text",
257
+ "text": "Given $\\mathbf { T } _ { b a s e }$ , we propagate it across the video based on the token correspondences extracted from the original video. At each generation step $t$ , we compute the nearest neighbor (NN) of each original frame’s tokens, $\\phi ( x _ { t } ^ { i } )$ , and its two adjacent keyframes’ tokens, $\\phi ( x _ { t } ^ { i \\bar { + } } ) , \\phi ( x _ { t } ^ { i - } )$ where $^ { i + }$ is the index of the closest future keyframe, and $i -$ the index of the closest past keyframe. Denote the resulting NN fields $\\gamma ^ { i + } , \\gamma ^ { i - }$ : ",
258
+ "page_idx": 6
259
+ },
260
+ {
261
+ "type": "equation",
262
+ "img_path": "images/0616072f18e29016ee02f8bc4ba24020b8d0e180ed2bb3caa8c6ad99c1fb6f38.jpg",
263
+ "text": "$$\n\\gamma ^ { i \\pm } [ p ] = \\underset { q } { \\arg \\operatorname* { m i n } } \\mathcal { D } \\left( \\phi ( \\pmb { x } ^ { i } ) [ p ] , \\phi ( \\pmb { x } ^ { i \\pm } ) [ q ] \\right)\n$$",
264
+ "text_format": "latex",
265
+ "page_idx": 6
266
+ },
267
+ {
268
+ "type": "text",
269
+ "text": "Where $p , q$ are spatial locations in the token feature map, and $\\mathcal { D }$ is cosine distance. For simplicity, we omit the generation timestep $t$ ; our method is applied in all time-steps and self-attention layers. Once we obtain $\\gamma ^ { \\pm }$ , we use it to propagate the edited frames’ tokens $\\mathbf { T } _ { b a s e } ^ { - }$ to the rest of the video, by linearly combining the tokens in $\\mathbf { T } _ { b a s e }$ corresponding to each spatial location $p$ and frame $i$ : ",
270
+ "page_idx": 6
271
+ },
272
+ {
273
+ "type": "equation",
274
+ "img_path": "images/02141034ef24f0d32083bfea4c8b3fef06885ca5fbd8fa2f9541b2c8b27dcbd7.jpg",
275
+ "text": "$$\n\\mathcal { F } _ { \\gamma } ( \\mathbf { T } _ { b a s e } , i , p ) = { w _ { i } \\cdot \\phi ( { \\pmb J } ^ { i + } ) [ \\gamma ^ { i + } [ p ] ] } + ( 1 - w _ { i } ) \\cdot \\phi ( { \\pmb J } ^ { i - } ) [ \\gamma ^ { i - } [ p ] ]\n$$",
276
+ "text_format": "latex",
277
+ "page_idx": 6
278
+ },
279
+ {
280
+ "type": "text",
281
+ "text": "Where $\\phi ( J ^ { i \\pm } ) \\in \\mathbf { T } _ { b a s e }$ and $w _ { i } \\in ( 0 , 1 )$ is a scalar proportional to the distance between frame $i$ and its adjacent keyframes (see SM), ensuring a smooth transition. Note that $\\mathcal { F }$ also modifies the tokens of the sampled keyframes. That is, we modify the self-attention blocks to output a linear combination of the tokens in $\\mathbf { T } _ { b a s e }$ for all frames, including the keyframes, according to the original video token correspondences. ",
282
+ "page_idx": 6
283
+ },
284
+ {
285
+ "type": "text",
286
+ "text": "Overall algorithm We summarize our video editing algorithm in Alg. 1: We first perform DDIM inversion on the input video $\\mathcal { T }$ and extract the sequence of noisy latents $\\{ x _ { t } ^ { i } \\} _ { t = 1 } ^ { T }$ for all frames $i \\in [ n ]$ (fig 4, top). We then denoise the video, alternating between keyframes editing and TokenFlow propagation: At each generation step $t$ , we randomize $k \\ < \\ \\bar { \\ n }$ keyframe indices, and denoise them using an image editing technique (e.g., Tumanyan et al. (2023); Meng et al. (2022); Zhang & Agrawala (2023)) combined with extended-attention (Eq. 3, Fig. 4 (I)). We then denoise the entire video $\\mathcal { T } _ { t }$ by combining the image-editing technique with TokenFlow (Eq. 5, Fig. 4 (II)) ",
287
+ "page_idx": 6
288
+ },
289
+ {
290
+ "type": "text",
291
+ "text": "Algorithm 1 TokenFlow editing ",
292
+ "text_level": 1,
293
+ "page_idx": 6
294
+ },
295
+ {
296
+ "type": "text",
297
+ "text": "",
298
+ "text_level": 1,
299
+ "page_idx": 6
300
+ },
301
+ {
302
+ "type": "text",
303
+ "text": "I = [I1 , ..., In ] ▷ Input Video P ▷ Target text prompt $\\hat { \\Psi }$ ▷ Diffusion-based image editing technique \n$\\{ \\mathbf { x } _ { t } ^ { i } \\} _ { t = 1 } ^ { T } , \\{ \\phi ( x _ { i } ) \\} _ { i = 1 } ^ { n } \\mathrm { D D I M - I n v } [ \\mathbf { I } ^ { i } ] \\quad \\forall i \\in [ n ] , \\ t \\in [ T ]$ \n$\\mathbf { J } _ { T } ^ { 1 } , \\ldots , \\mathbf { J } _ { T } ^ { n } \\mathbf { x } _ { T } ^ { 1 } , \\ldots , \\mathbf { x } _ { T } ^ { n }$ \nFor $t = T , \\dots , 1$ do $K = \\{ i _ { 1 } , \\ldots , i _ { k } \\} $ sample keyframe indices $\\mathcal { F } _ { \\gamma } \\gamma ^ { i \\pm } \\forall i \\in [ n ]$ compute NN field $\\{ \\mathbf { J } _ { t - 1 } ^ { j } \\} _ { j \\in \\kappa } \\hat { \\epsilon _ { \\theta } } [ \\{ \\mathbf { J } _ { t } ^ { j } \\} _ { j \\in \\kappa }$ ; ExtAttn] $\\mathbf { T } _ { \\mathrm { b a s e } } \\phi ( \\{ \\mathbf { J } _ { t - 1 } ^ { j } \\} _ { j \\in \\mathcal { K } } )$ extract keyframes’ tokens $\\mathbf { J } _ { t - 1 } \\hat { \\epsilon _ { \\theta } } [ \\mathbf { J } _ { t } ; \\mathrm { T o k e n F l o w } ( \\mathcal { F } _ { \\gamma } ( \\mathbf { T } _ { \\mathrm { b a s e } } ) ) ]$ \nOutput: $\\mathcal { I } = [ \\mathbf { J } _ { 0 } ^ { 1 } , \\ldots , \\mathbf { J } _ { 0 } ^ { n } ]$ ",
304
+ "page_idx": 6
305
+ },
306
+ {
307
+ "type": "text",
308
+ "text": "at every self-attention block in every layer of the network. Note that each layer includes a residual connection between the input and output of the self-attention block, thus performing TokenFlow at each layer is necessary. ",
309
+ "page_idx": 6
310
+ },
311
+ {
312
+ "type": "text",
313
+ "text": "5 RESULTS ",
314
+ "text_level": 1,
315
+ "page_idx": 6
316
+ },
317
+ {
318
+ "type": "text",
319
+ "text": "We evaluate our method on DAVIS videos (Pont-Tuset et al., 2017) and on Internet videos depicting animals, food, humans, and various objects in motion. The spatial resolution of the videos is $3 8 4 \\bar { \\times }$ 672 or $5 1 2 \\times 5 1 2$ pixels, and they consist of 40 to 200 frames. We use various text prompts on each video to obtain diverse editing results. Our evaluation dataset comprises of 61 text-video pairs. We utilize $\\mathrm { P n P }$ -Diffusion (Tumanyan et al., 2023) as the frame editing method, and we use the same hyper-parameters for all our results. PnP-Diffusion may fail to accurately preserve the structure of each frame due to inaccurate DDIM inversion (see Fig. 3, middle column, right frame: the dog’s head is distorted). Our method improves robustness to this, as multiple frames contribute to the generation of each frame in the video. Our framework can be combined with any diffusion-based image editing technique that accurately preserves the structure of the images; results with different image editing techniques (e.g. Meng et al. (2022); Zhang & Agrawala (2023)) are available in the SM. Fig. 5 and 1 show sample frames from the edited videos. Our edits are temporally consistent and adhere to the edit prompt. The man’s head is changed to Van-Gogh or marble (top left); importantly, the man’s identity and the scene’s background are consistent throughout the video. The patterns of the polygonal wolf (bottom left) are the same across time: the body is consistently orange while the chest is blue. We refer the reader to the SM for implementation details and video results. ",
320
+ "page_idx": 6
321
+ },
322
+ {
323
+ "type": "text",
324
+ "text": "",
325
+ "page_idx": 7
326
+ },
327
+ {
328
+ "type": "text",
329
+ "text": "Baselines. We compare our method to state-of-the-art, and concurrent works: (i) Fate-Zero (Qi et al., 2023) and (ii) Text2Video-Zero (Khachatryan et al., 2023b), that utilize a text-to-image model for video editing using self-attention inflation. (iii) Re-render a Video (Yang et al., 2023) that edits keyframes by adding optical flow optimization to self-attention inflation of an image model, and then propagates the edit from the keyframes to the rest of the video using an off-the-shelf propagation method. (iv) Tune-a-Video (Wu et al., 2022) that fine-tunes the text-to-image model on the given test video. (v) Gen-1 (Esser et al., 2023), a video diffusion model that was trained on a large-scale image and video dataset. (vi) Per-frame diffusion-based image editing baseline, PnP-Diffusion (Tumanyan et al., 2023). We additionally consider the two following baselines: (i) Text2LIVE (Bar-Tal et al., 2022) which utilize a layered video representation (NLA) (Kasten et al., 2021) and perform test-time training using CLIP losses. Note that NLA requires foreground/background separation masks and takes $\\bar { \\sim } 1 0$ hours to train. (ii) Applying PnP-Diffusion on a single keyframe and propagating the edit to the entire video using Jamriska et al. (2019). ˇ ",
330
+ "page_idx": 7
331
+ },
332
+ {
333
+ "type": "text",
334
+ "text": "5.1 QUALITATIVE EVALUATION ",
335
+ "text_level": 1,
336
+ "page_idx": 7
337
+ },
338
+ {
339
+ "type": "text",
340
+ "text": "Fig. 6 provides a qualitative comparison of our method to prominent baselines; please refer to SM for the full videos. Our method (bottom row) outputs videos that better adhere to the edit prompt while maintaining temporal consistency of the resulting edited video, while other methods struggle to meet both these goals. Tune-A-Video (second row) inflates the 2D image model into a video model, and fine-tunes it to overfit the motion of the video; thus, it is suitable for short clips. For long videos it struggles to capture the motion resulting with meaningless edits, e.g., the shiny metal sculpture. Applying $\\mathrm { P n P }$ for each frame independently (third row) results in exquisite edits adhering to the edit prompt but, as expected, lack any temporal consistency. The results of Gen-1 (fourth row) also suffer from some temporal inconsistencies (the beak of the origami stork changes color). Moreover, their frame quality is significantly worse than that of a text-to-image diffusion model. The edits of Text2Video-Zero and Fate-Zero (fifth and sixth row) suffer from severe jittering as these methods rely heavily on the extended attention mechanism to implicitly encourage consistency. The results of Rerender-a-Video exhibit notable long-range inconsistencies and artifacts arising primarily from their reliance on optical flow estimation for distant frames (e.g. keyframes), which is known to be sub-optimal (See our video results in the SM; when the wolf turns its head, the nose color changes). We provide qualitative comparison to Text2LIVE and to a RGB propagation baseline in the SM. ",
341
+ "page_idx": 7
342
+ },
343
+ {
344
+ "type": "text",
345
+ "text": "5.2 QUANTITATIVE EVALUATION ",
346
+ "text_level": 1,
347
+ "page_idx": 7
348
+ },
349
+ {
350
+ "type": "table",
351
+ "img_path": "images/4abec822fb80a4d2d6f5cd7e92097318524ea2ba56e41e358ff713cef26d17ca.jpg",
352
+ "table_caption": [
353
+ "Table 1: We evaluate our method in temporal consistency by computing warp-error and conducting a user study, and in fidelity to the target text prompt using CLIP similarity. See Sec. 5 for more details. "
354
+ ],
355
+ "table_footnote": [],
356
+ "table_body": "<table><tr><td></td><td>(x10-3)</td><td>Warp-err↓|User preference| of our method</td><td>CLIP score个</td></tr><tr><td>LDM recon. PnP-Diffusion Text2Video-Zero Tune-a-Video Fate-Zero</td><td>2.0 11.3 12.5 30.0 6.9</td><td>94% 78% 82% 71%</td><td>0.23 0.33 0.33 0.31 0.32</td></tr><tr><td>Gen1 Rerender-a-Video Ours w joint attention Ours w/o rand keyframes</td><td>一 1.8 5.9 3.7</td><td>70% 71% 90%</td><td>0.32 0.32 0.33 0.33</td></tr></table>",
357
+ "page_idx": 7
358
+ },
359
+ {
360
+ "type": "text",
361
+ "text": "We evaluate our method in terms of: (i) edit fidelity measured by computing the average similarity between the CLIP embedding (Radford et al., 2021) of each edited frame and the target text prompt; (ii) temporal consistency. Following Ceylan et al. (2023); Lai et al. (2018a), temporal consistency is measured by (a) computing the optical flow of the original video using Teed & Deng (2020), warping the edited frames according to it, and measuring the warping error, and (b) a user study; We adopt a Two-alternative Forced Choice (2AFC) protocol suggested in Kolkin et al. (2019); Park et al. (2020), where participants are shown ",
362
+ "page_idx": 7
363
+ },
364
+ {
365
+ "type": "text",
366
+ "text": "the input video, ours and a baseline result, and are asked to determine which video is more temporally consistent and better preserves the motion of the original video. The survey consists of 2000-3000 judgments per baseline obtained using Amazon mechanical turk. We note that warpingerror could not be measured for Gen1 since their product platform does not output the same number of input frames. Table 1 compares our method to baselines. Our method achieves the highest CLIP score, showing a good fit between the edited video and the input guidance prompt. Furthermore, our method has a low warping error, indicating temporally consistent results. We note that Re-rendera-Video optimizes for the warping error and uses optical flow to propagate the edit, and hence has the lowest warping error; However, this reliance on optical flow often creates artifacts and longrange inconsistencies which are not reflected in the warping error. Nonetheless, they are apparent in the user study, that shows users significantly favoured our method over all baselines in terms of temporal consistency. Additionally, we consider the reference baseline of passing the original video through the LDM auto-encoder without performing editing (LDM recon.). This baseline provides an upper bound on the temporal consistency achievable by LDM auto-encoder. As expected, the CLIP similarity of this baseline is poor as it does not involve any editing. However, this baseline does not achieve zero warp error either due to the imperfect reconstruction of the LDM auto-encoder, which hallucinates high-frequency information. ",
367
+ "page_idx": 7
368
+ },
369
+ {
370
+ "type": "image",
371
+ "img_path": "images/118f8fe8be7f7b41ada181ff7655e290dfbe1190ba898fa469674ce042b5f21b.jpg",
372
+ "image_caption": [
373
+ "Figure 7: Limitations. Our method edits the video according to the feature correspondences of the original video, hence it cannot handle edits that requires structure deviations. "
374
+ ],
375
+ "image_footnote": [],
376
+ "page_idx": 8
377
+ },
378
+ {
379
+ "type": "text",
380
+ "text": "",
381
+ "page_idx": 8
382
+ },
383
+ {
384
+ "type": "text",
385
+ "text": "We further evaluate our correspondences and video representation by measuring the accuracy of video reconstruction using TokenFlow. Specifically, we reconstruct the video using the same pipeline of our editing method, only removing the keyframes editing part. Table 2 reports the PSNR and LPIPS distance of this reconstruction, compared to vanilla DDIM reconstruction. As seen, TokenFlow reconstruction slightly improves DDIM inversion, demonstrating robust frame representation. This improvement can be attributed to the keyframe randomization; It increases robustness to challenging frames since each frame is reconstructed from multiple other frames during the generation. Notably, our evaluation focuses on accurate correspondences within the feature space during generation, rather than RGB frame correspondences evaluation, which is not essential to our method. ",
386
+ "page_idx": 8
387
+ },
388
+ {
389
+ "type": "text",
390
+ "text": "5.3 ABLATION STUDY ",
391
+ "text_level": 1,
392
+ "page_idx": 8
393
+ },
394
+ {
395
+ "type": "text",
396
+ "text": "First, we ablate the use of TokenFlow, Sec. 4.2, for enforcing temporal consistency. In this experiment, we replace TokenFlow with extended attention (Eq. 3) and compute it between each frames of the edited video and the keyframes (w joint attention). Second, we ablate the randomizing of the keyframe selection at each generation step (w/o random keyframes). In this experiment, we use the same keyframe indices (evenly spaced in time) across the generation. Table 1 (bottom) shows the quantitative results of our ablations, the resulting videos can be found in the SM. As seen, TokenFlow ensures higher degree of temporal consistency, indicating that solely relying on the extension of self-attention to multiple frames is insufficient for achieving fine-grained temporal consistency. Additionally, fixing the keyframes creates an artificial partition of the video into short clips between the fixed keyframes, which reflects poorly on the consistency of the result. ",
397
+ "page_idx": 8
398
+ },
399
+ {
400
+ "type": "table",
401
+ "img_path": "images/4d523070c15a092be9ab3eecd97f933c92f8e7a9edf63442391573bd0e797d0f.jpg",
402
+ "table_caption": [
403
+ "Table 2: We reconstruct the video using the TokenFlow pipeline, excluding keyframe editing. We evaluate the TokenFlow representation with PSNR and LPIPS metrics. Our reconstruction improves vanilla DDIM inversion, highlighting the robusteness of TokenFlow representation. "
404
+ ],
405
+ "table_footnote": [],
406
+ "table_body": "<table><tr><td></td><td>PSNR↑</td><td>LPIPS↓</td></tr><tr><td>LDM recon. DDIMinversion Ours</td><td>31.13 25.32 25.74</td><td>0.03 0.14 0.13</td></tr></table>",
407
+ "page_idx": 8
408
+ },
409
+ {
410
+ "type": "text",
411
+ "text": "",
412
+ "page_idx": 8
413
+ },
414
+ {
415
+ "type": "text",
416
+ "text": "6 DISCUSSION ",
417
+ "text_level": 1,
418
+ "page_idx": 8
419
+ },
420
+ {
421
+ "type": "text",
422
+ "text": "We presented a new framework for text-driven video editing using an image diffusion model. We study the internal representation of a video in the diffusion feature space, and demonstrate that consistent video editing can be achieved via consistent diffusion feature representation during the generation. Our method outperforms existing baselines, demonstrating a significant improvement in temporal consistency. As for limitations, our method is tailored to preserve the motion of the original video, and as such, it cannot handle edits that require structural changes (Fig 7.) Moreover, our method is built upon a diffusion-based image editing technique to allow the structure preservation of the original frames. When the image-editing technique fails to preserve the structure, our method enforces correspondences that are meaningless in the edited frames, resulting in visual artifacts. Lastly, the LDM decoder introduces some high frequency flickering (Blattmann et al., 2023). A possible solution for this would be to combine our framework with an improved decoder (e.g., Blattmann et al. (2023), Zhu et al. (2023)). We note that this minor level of flickering can be easily eliminated with exiting post-process deflickering (see SM). Our work shed new light on the internal representation of natural videos in the space of diffusion models (e.g., temporal redundancies), and how they can be leveraged for enhancing video synthesis. We believe it can inspire future research in harnessing image models for video tasks, and for the design of text-to-video models. ",
423
+ "page_idx": 8
424
+ },
425
+ {
426
+ "type": "text",
427
+ "text": "REFERENCES \nOmer Bar-Tal, Dolev Ofri-Amar, Rafail Fridman, Yoni Kasten, and Tali Dekel. Text2live: Text-driven layered image and video editing. In European Conference on Computer Vision, pp. 707–723. Springer, 2022. \nOmer Bar-Tal, Lior Yariv, Yaron Lipman, and Tali Dekel. Multidiffusion: Fusing diffusion paths for controlled image generation. arXiv preprint arXiv:2302.08113, 2023. \nAndreas Blattmann, Robin Rombach, Huan Ling, Tim Dockhorn, Seung Wook Kim, Sanja Fidler, and Karsten Kreis. Align your latents: High-resolution video synthesis with latent diffusion models. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2023. \nMingdeng Cao, Xintao Wang, Zhongang Qi, Ying Shan, Xiaohu Qie, and Yinqiang Zheng. Masactrl: Tuningfree mutual self-attention control for consistent image synthesis and editing, 2023. \nDuygu Ceylan, Chun-Hao Paul Huang, and Niloy Jyoti Mitra. Pix2video: Video editing using image diffusion. ArXiv, abs/2303.12688, 2023. \nHila Chefer, Yuval Alaluf, Yael Vinker, Lior Wolf, and Daniel Cohen-Or. Attend-and-excite: Attention-based semantic guidance for text-to-image diffusion models. arXiv preprint arXiv:2301.13826, 2023. \nV. Cheung, B.J. Frey, and N. Jojic. Video epitomes. In 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’05), 2005. \nFlorinel-Alin Croitoru, Vlad Hondru, Radu Tudor Ionescu, and Mubarak Shah. Diffusion models in vision: A survey. arXiv preprint arXiv:2209.04747, 2022. \nPrafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems, 2021. \nPatrick Esser, Johnathan Chiu, Parmida Atighehchian, Jonathan Granskog, and Anastasis Germanidis. Structure and content-guided video synthesis with diffusion models. arXiv preprint arXiv:2302.03011, 2023. \nRafail Fridman, Amit Abecasis, Yoni Kasten, and Tali Dekel. Scenescape: Text-driven consistent scene generation. arXiv preprint arXiv:2302.01133, 2023. \nAmir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. Prompt-to-prompt image editing with cross attention control. arXiv preprint arXiv:2208.01626, 2022. \nJonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 2020. \nJonathan Ho, William Chan, Chitwan Saharia, Jay Whang, Ruiqi Gao, Alexey Gritsenko, Diederik P Kingma, Ben Poole, Mohammad Norouzi, David J Fleet, et al. Imagen video: High definition video generation with diffusion models. arXiv preprint arXiv:2210.02303, 2022a. \nJonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J Fleet. Video diffusion models. arXiv:2204.03458, 2022b. \nSusung Hong, Gyuseong Lee, Wooseok Jang, and Seungryong Kim. Improving sample quality of diffusion models using self-attention guidance. arXiv preprint arXiv:2210.00939, 2022. \nOndˇrej Jamriska, ˇ Sˇ arka Sochorov ´ a, Ond ´ ˇrej Texler, Michal Luka´c, Jakub Fi ˇ ser, Jingwan Lu, Eli Shechtman, and ˇ Daniel Sykora. Stylizing video by example. ´ ACM Transactions on Graphics, 2019. \nYoni Kasten, Dolev Ofri, Oliver Wang, and Tali Dekel. Layered neural atlases for consistent video editing. ACM Transactions on Graphics (TOG), 2021. \nLevon Khachatryan, Andranik Movsisyan, Vahram Tadevosyan, Roberto Henschel, Zhangyang Wang, Shant Navasardyan, and Humphrey Shi. Text2video-zero: Text-to-image diffusion models are zero-shot video generators. ArXiv, abs/2303.13439, 2023a. \nLevon Khachatryan, Andranik Movsisyan, Vahram Tadevosyan, Roberto Henschel, Zhangyang Wang, Shant Navasardyan, and Humphrey Shi. Text2video-zero: Text-to-image diffusion models are zero-shot video generators. arXiv preprint arXiv:2303.13439, 2023b. \nNicholas Kolkin, Jason Salavon, and Gregory Shakhnarovich. Style transfer by relaxed optimal transport and self-similarity. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10051–10060, 2019. \nWei-Sheng Lai, Jia-Bin Huang, Oliver Wang, Eli Shechtman, Ersin Yumer, and Ming-Hsuan Yang. Learning blind video temporal consistency. In European Conference on Computer Vision, 2018a. \nWei-Sheng Lai, Jia-Bin Huang, Oliver Wang, Eli Shechtman, Ersin Yumer, and Ming-Hsuan Yang. Learning blind video temporal consistency. In Proceedings of the European conference on computer vision (ECCV), pp. 170–185, 2018b. \nYao-Chih Lee, Ji-Ze Genevieve Jang, Yi-Ting Chen, Elizabeth Qiu, and Jia-Bin Huang. Shape-aware textdriven layered video editing. arXiv preprint arXiv:2301.13173, 2023a. \nYao-Chih Lee, Ji-Ze Genevieve Jang Jang, Yi-Ting Chen, Elizabeth Qiu, and Jia-Bin Huang. Shape-aware text-driven layered video editing demo. arXiv preprint arXiv:2301.13173, 2023b. \nChenyang Lei, Yazhou Xing, and Qifeng Chen. Blind video temporal consistency via deep video prior. In Advances in Neural Information Processing Systems, 2020. \nChenyang Lei, Xuanchi Ren, Zhaoxiang Zhang, and Qifeng Chen. Blind video deflickering by neural filtering with a flawed atlas. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2023. \nShaoteng Liu, Yuecheng Zhang, Wenbo Li, Zhe Lin, and Jiaya Jia. Video-p2p: Video editing with crossattention control. ArXiv, abs/2303.04761, 2023. \nGrace Luo, Lisa Dunlap, Dong Huk Park, Aleksander Holynski, and Trevor Darrell. Diffusion hyperfeatures: Searching through time and space for semantic correspondence. arXiv, 2023. \nWan-Duo Kurt Ma, JP Lewis, W Bastiaan Kleijn, and Thomas Leung. Directed diffusion: Direct control of object placement through attention guidance. arXiv preprint arXiv:2302.13153, 2023. \nChenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. SDEdit: Guided image synthesis and editing with stochastic differential equations. In International Conference on Learning Representations, 2022. \nAlex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021. \nAlexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, pp. 8162–8171. PMLR, 2021. \nTaesung Park, Jun-Yan Zhu, Oliver Wang, Jingwan Lu, Eli Shechtman, Alexei A. Efros, and Richard Zhang. Swapping autoencoder for deep image manipulation. In Advances in Neural Information Processing Systems, 2020. \nOr Patashnik, Daniel Garibi, Idan Azuri, Hadar Averbuch-Elor, and Daniel Cohen-Or. Localizing object-level shape variations with text-to-image diffusion models. arXiv preprint arXiv:2303.11306, 2023. \nJordi Pont-Tuset, Federico Perazzi, Sergi Caelles, Pablo Arbelaez, Alex Sorkine-Hornung, and Luc Van Gool. ´ The 2017 davis challenge on video object segmentation. arXiv preprint arXiv:1704.00675, 2017. \nChenyang Qi, Xiaodong Cun, Yong Zhang, Chenyang Lei, Xintao Wang, Ying Shan, and Qifeng Chen. Fatezero: Fusing attentions for zero-shot text-based video editing. arXiv:2303.09535, 2023. \nAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning. PMLR, 2021. \nAditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022. \nScott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text to image synthesis. In International conference on machine learning, pp. 1060–1069. PMLR, 2016. \nRobin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High-resolution ¨ image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10684–10695, 2022. \nOlaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, 2015. \nManuel Ruder, Alexey Dosovitskiy, and Thomas Brox. Artistic style transfer for videos. In Pattern Recognition - 38th German Conference (GCPR), 2016. \nChitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S Sara Mahdavi, Rapha Gontijo Lopes, et al. Photorealistic text-toimage diffusion models with deep language understanding. arXiv preprint arXiv:2205.11487, 2022. \nChristoph Schuhmann, Romain Beaumont, Richard Vencu, Cade Gordon, Ross Wightman, Mehdi Cherti, Theo Coombes, Aarush Katta, Clayton Mullis, Mitchell Wortsman, Patrick Schramowski, Srivatsa Kundurthy, Katherine Crowson, Ludwig Schmidt, Robert Kaczmarczyk, and Jenia Jitsev. Laion-5b: An open largescale dataset for training next generation image-text models. ArXiv, abs/2210.08402, 2022. \nOded Shahar, Alon Faktor, and Michal Irani. Space-time super-resolution from a single video. In CVPR 2011, 2011. \nShelly Sheynin, Oron Ashual, Adam Polyak, Uriel Singer, Oran Gafni, Eliya Nachmani, and Yaniv Taigman. Knn-diffusion: Image generation via large-scale retrieval. arXiv preprint arXiv:2204.02849, 2022. \nChaehun Shin, Heeseung Kim, Che Hyun Lee, Sang gil Lee, and Sung-Hoon Yoon. Edit-a-video: Single video editing with object-aware consistency. ArXiv, abs/2303.07945, 2023. \nUriel Singer, Adam Polyak, Thomas Hayes, Xi Yin, Jie An, Songyang Zhang, Qiyuan Hu, Harry Yang, Oron Ashual, Oran Gafni, Devi Parikh, Sonal Gupta, and Yaniv Taigman. Make-a-video: Text-to-video generation without text-video data, 2022. \nJascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pp. 2256–2265. PMLR, 2015. \nJiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2020. \nZachary Teed and Jia Deng. Raft: Recurrent all-pairs field transforms for optical flow. In Computer Vision– ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part II 16. Springer, 2020. \nOndˇrej Texler, David Futschik, Michal Kucera, Ond ˇ ˇrej Jamriska, ˇ Sˇ arka Sochorov ´ a, Menglei Chai, Sergey ´ Tulyakov, and Daniel Sykora. Interactive video stylization using few-shot patch-based training. ´ ACM Transactions on Graphics, 2020. \nNarek Tumanyan, Michal Geyer, Shai Bagon, and Tali Dekel. Plug-and-play diffusion features for text-driven image-to-image translation. Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2023. \nAshish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. \nJay Zhangjie Wu, Yixiao Ge, Xintao Wang, Stan Weixian Lei, Yuchao Gu, Wynne Hsu, Ying Shan, Xiaohu Qie, and Mike Zheng Shou. Tune-a-video: One-shot tuning of image diffusion models for text-to-video generation. arXiv preprint arXiv:2212.11565, 2022. \nShuai Yang, Yifan Zhou, Ziwei Liu, and Chen Change Loy. Rerender a video: Zero-shot text-guided video-tovideo translation, 2023. \nHan Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaogang Wang, Xiaolei Huang, and Dimitris N. Metaxas. Stackgan: Text to photo-realistic image synthesis with stacked generative adversarial networks. 2017 IEEE International Conference on Computer Vision (ICCV), pp. 5908–5916, 2016. \nJunyi Zhang, Charles Herrmann, Junhwa Hur, Luisa Polania Cabrera, Varun Jampani, Deqing Sun, and MingHsuan Yang. A tale of two features: Stable diffusion complements dino for zero-shot semantic correspondence. arXiv preprint arxiv:2305.15347, 2023. \nLvmin Zhang and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models, 2023. \nZixin Zhu, Xuelu Feng, Dongdong Chen, Jianmin Bao, Le Wang, Yinpeng Chen, Lu Yuan, and Gang Hua. Designing a better asymmetric vqgan for stablediffusion, 2023. ",
428
+ "page_idx": 9
429
+ },
430
+ {
431
+ "type": "text",
432
+ "text": "",
433
+ "page_idx": 10
434
+ },
435
+ {
436
+ "type": "text",
437
+ "text": "",
438
+ "page_idx": 11
439
+ },
440
+ {
441
+ "type": "table",
442
+ "img_path": "images/ccab66bea8453719b1250e05cc713cb726a59b5775090154571b04f97890ec34.jpg",
443
+ "table_caption": [
444
+ "Table 3: We report average runtime in seconds, of running ours and competing methods on a video of 40 frames. "
445
+ ],
446
+ "table_footnote": [],
447
+ "table_body": "<table><tr><td>TAV</td><td>Text2video-zero</td><td>Rerender-a-video</td><td>fatezero</td><td>PnP</td><td>ours (preprocess)</td><td>ours (sampling)</td><td>ours (total)</td></tr><tr><td>2684</td><td>198</td><td>285</td><td>349</td><td>208</td><td>50</td><td>187</td><td>237</td></tr></table>",
448
+ "page_idx": 12
449
+ },
450
+ {
451
+ "type": "text",
452
+ "text": "We provide additional implementation details below. We refer the reader to the HTML file attached to our Supplementary Material for video results. ",
453
+ "page_idx": 12
454
+ },
455
+ {
456
+ "type": "text",
457
+ "text": "A IMPLEMENTATION DETAILS ",
458
+ "text_level": 1,
459
+ "page_idx": 12
460
+ },
461
+ {
462
+ "type": "text",
463
+ "text": "StableDiffusion. We use Stable Diffusion as our pre-trained text-to-image model; we use the StableDiffusion-v-2-1 checkpoint provided via official HuggingFace webpage. ",
464
+ "page_idx": 12
465
+ },
466
+ {
467
+ "type": "text",
468
+ "text": "DDIM inversion. In all of our experiments, we use DDIM deterministic sampling with 50 steps. For inverting the video, we follow Tumanyan et al. (2023) and use DDIM inversion with classifierfree guidance scale of 1 and 1000 forward steps; and extract the self-attention input tokens from this process similarly to Qi et al. (2023). ",
469
+ "page_idx": 12
470
+ },
471
+ {
472
+ "type": "text",
473
+ "text": "Runtime. Since we don’t compute the attention module on most video frames (i.e., we only compute the self-attention output on the keyframes) our method is efficient in run-time, and the sampling of the video reduces the time of per-frame editing by $2 0 \\%$ . The inversion process with 1000 steps is the main bottleneck of our method in terms of run-time, and in many cases a significantly smaller amount of steps is suffieicent (e.g. 50). Table 3 reports runtime comparisons using 50 steps in all methods. Notably, our sampling time is indeed faster than that of per-frame editing (PnP). ",
474
+ "page_idx": 12
475
+ },
476
+ {
477
+ "type": "text",
478
+ "text": "Hyper-parameters. In equation 5 we set $w _ { i }$ to be: ",
479
+ "page_idx": 12
480
+ },
481
+ {
482
+ "type": "equation",
483
+ "img_path": "images/7d3a36c548d1a4d8dc5a35651d634bf799d3ab7653e19d50beb42426bf08bebc.jpg",
484
+ "text": "$$\n\\begin{array} { c } { w _ { i } = \\sigma ( d _ { - } / ( d _ { + } + d _ { - } ) ) } \\\\ { \\mathrm { ~ w h e r e ~ } d _ { + } = | | i - i ^ { + } | | , d _ { - } = | | i - i ^ { - } | | } \\end{array}\n$$",
485
+ "text_format": "latex",
486
+ "page_idx": 12
487
+ },
488
+ {
489
+ "type": "text",
490
+ "text": "where $\\sigma$ is a sigmoid function, $i ^ { + }$ and $i ^ { - }$ are the future and past neighboring keyframes of $i$ , respectively. ",
491
+ "page_idx": 12
492
+ },
493
+ {
494
+ "type": "text",
495
+ "text": "For sampling the edited video we set the classifier-free guidance scale to 7.5. At each timestep, we sample random keyframes in frame intervals of 8. We note that using less keyframes (i.e., increasing the interval size) results in (i) runtime decreases (the joint keyframe editing step requires less memory, and is faster), and (ii) temporal consistency is improved (since the same tokens are shared across more frames). Nevertheless, too few keyframes will result in inaccurate correspondences which may result in artefacts. ",
496
+ "page_idx": 12
497
+ },
498
+ {
499
+ "type": "text",
500
+ "text": "Baselines. For running the baseline of Tune-a-video (Wu et al., 2022) we used their official repository. For Gen-1 (Esser et al., 2023) we used their platform on Runaway website. This platform outputs a video that is not in the same length and frame-rate as the input video; therefore, we could not compute the warping error on their results. For text-to-video-zero (Khachatryan et al., 2023b) we used their official repository, with their depth conditioning configuration. For Fate-Zero (Qi et al., 2023) with used their official repository, and verified the run configurations with the authors. ",
501
+ "page_idx": 12
502
+ }
503
+ ]
parse/test/lKK50q2MtV/lKK50q2MtV_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/lKK50q2MtV/lKK50q2MtV_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/p09XyFxZkc/p09XyFxZkc.md ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LAVIE: HIGH-QUALITY VIDEO GENERATION WITH CASCADED LATENT DIFFUSION MODELS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ This work aims to learn a high-quality text-to-video (T2V) generative model by leveraging a pre-trained text-to-image (T2I) model as a basis. It is a highly desirable yet challenging task to simultaneously a) accomplish the synthesis of visually realistic and temporally coherent videos while b) preserving the strong creative generation nature of the pre-trained T2I model. To this end, we propose LaVie, an integrated video generation framework that operates on cascaded video latent diffusion models, comprising a base T2V model, a temporal interpolation model, and a video super-resolution model. Our key insights are two-fold: 1) We reveal that the incorporation of simple temporal self-attentions, coupled with rotary positional encoding, adequately captures the temporal correlations inherent in video data. 2) Additionally, we validate that the process of joint image-video fine-tuning plays a pivotal role in producing high-quality and creative outcomes. To enhance the performance of LaVie, we contribute a comprehensive and diverse video dataset named Vimeo25M, consisting of 25 million text-video pairs that prioritize quality, diversity, and aesthetic appeal. Extensive experiments demonstrate that LaVie achieves state-of-the-art performance both quantitatively and qualitatively. Furthermore, we showcase the versatility of pre-trained LaVie models in various long video generation and personalized video synthesis applications.
8
+
9
+ ![](images/b42c6e48b5f6d022d50616ac0f4962bfc07c5ccdb500185b9c966c70dd664890.jpg)
10
+ Figure 1: Text-to-video samples. LaVie is able to synthesize diverse, creative, high-definition videos with photorealistic and temporal coherent content by giving text descriptions.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ With the remarkable breakthroughs achieved by Diffusion Models (DMs) (Ho et al., 2020; Song et al., 2021a;b) in image synthesis, the generation of photorealistic images from text descriptions (T2I) (Ramesh et al., 2021; 2022; Saharia et al., 2022; Balaji et al., 2022; Rombach et al., 2022) has taken center stage, finding applications in various image processing domain such as image outpainting (Ramesh et al., 2022), editing (Zhang & Agrawala, 2023; Mokady et al., 2022; Parmar et al., 2023; Huang et al., 2023; Jiang et al., 2021b) and enhancement (Saharia et al.; Wang et al., 2023a). Building upon the successes of T2I models, there has been a growing interest in extending these techniques to the synthesis of videos controlled by text inputs (T2V) (Singer et al., 2023; Ho et al., 2022a; Blattmann et al., 2023; Zhou et al., 2022a; He et al., 2022), driven by their potential applications in domains such as filmmaking, video games, and artistic creation.
15
+
16
+ However, training an entire T2V system from scratch (Ho et al., 2022a) poses significant challenges as it requires extensive computational resources to optimize the entire network for learning spatiotemporal joint distribution. An alternative approach (Singer et al., 2023; Blattmann et al., 2023; Zhou et al., 2022a; He et al., 2022) leverages the prior spatial knowledge from pre-trained T2I models for faster convergence to adapt video data, which aims to expedite the training process and efficiently achieve high-quality results. However, in practice, finding the right balance among video quality, training cost, and model compositionality still remains challenging as it requires careful design of model architecture, training strategies and the collection of high-quality text-video datasets.
17
+
18
+ To this end, we introduce LaVie, an integrated video generation framework (with a total number of 3B parameters) that operates on cascaded video latent diffusion models. LaVie is a text-to-video foundation model built based on a pre-trained T2I model (i.e. Stable Diffusion (Rombach et al., 2022)), aiming to synthesize visually realistic and temporally coherent videos while preserving the strong creative generation nature of the pre-trained T2I model. Our key insights are two-fold: 1) simple temporal self-attention coupled with RoPE (Su et al., 2021) adequately captures temporal correlations inherent in video data. More complex architectural design only results in marginal visual improvements to the generated outcomes. 2) Joint image-video fine-tuning plays a key role in producing high-quality and creative results. Directly fine-tuning on video dataset severely hampers the concept-mixing ability of the model, leading to catastrophic forgetting and the gradual vanishing of learned prior knowledge. Moreover, joint image-video fine-tuning facilitates large-scale knowledge transferring from images to videos, encompassing scenes, styles, and characters. In addition, we found that current publicly available text-video dataset WebVid10M (Bain et al., 2021), is insufficient to support T2V task due to its low resolution and watermark-centered videos. Therefore, to enhance the performance of LaVie, we introduce a novel text-video dataset Vimeo25M which consists of 25 million high-resolution videos $\mathrm { ( > 7 2 0 p ) }$ with text descriptions. Our experiments demonstrate that training on Vimeo25M substantially boosts the performance of LaVie and empowers it to produce superior results in terms of quality, diversity, and aesthetic appeal (see Fig. 1).
19
+
20
+ # 2 PRELIMINARY OF DIFFUSION MODELS
21
+
22
+ Diffusion models (DMs) (Ho et al., 2020; Song et al., 2021a;b) aim to learn the underlying data distribution through a combination of two fundamental processes: diffusion and denoising. Given an input data sample $z \sim p ( z )$ , the diffusion process introduces random noises to construct a noisy sample $z _ { t } = \alpha _ { t } z + \sigma _ { t } \epsilon$ , where $\epsilon \sim \mathcal { N } ( 0 , \mathrm { I } )$ . This process is achieved by a Markov chain with $\mathrm { T }$ steps, and the noise scheduler is parametrized by the diffusion-time $t$ , characterized by $\alpha _ { t }$ and $\sigma _ { t }$ . Notably, the logarithmic signal-to-noise ratio $\lambda _ { t } \doteq l o g [ \alpha ^ { 2 } t / \sigma ^ { 2 } t ]$ monotonically decreases over time. In the subsequent denoising stage, $\epsilon$ -prediction and $v$ -prediction are employed to learn a denoiser function $\epsilon _ { \theta }$ , which is trained to minimize the mean square error loss by taking the diffused sample $z _ { t }$ as input:
23
+
24
+ $$
25
+ \begin{array} { r } { \mathbb { E } _ { \mathbf { z } \sim p ( z ) , \mathbf { \epsilon } \sim \mathcal { N } ( 0 , 1 ) , t } \left[ \left\| \epsilon - \epsilon _ { \theta } ( \mathbf { z } _ { t } , t ) \right\| _ { 2 } ^ { 2 } \right] . } \end{array}
26
+ $$
27
+
28
+ Latent diffusion models (LDMs) (Rombach et al., 2022) utilize a variational autoencoder architecture, wherein the encoder $\mathcal { E }$ is employed to compress the input data into low-dimensional latent codes $\mathcal { E } ( z )$ . Diverging from previous methods, LDMs conduct the diffusion and denoising processes in the latent space rather than the data space, resulting in substantial reductions in both training and inference time. Following the denoising stage, the final output is decoded as $\mathcal { D } ( z _ { 0 } )$ , representing the reconstructed data. The objective of LDMs can be formulated as follows:
29
+
30
+ $$
31
+ \begin{array} { r } { \mathbb { E } _ { \mathbf { z } \sim p ( z ) , \epsilon \sim \mathcal { N } ( 0 , 1 ) , t } \left[ \left\| \epsilon - \epsilon _ { \theta } \big ( \mathcal { E } ( \mathbf { z } _ { t } ) , t \big ) \right\| _ { 2 } ^ { 2 } \right] . } \end{array}
32
+ $$
33
+
34
+ Our proposed LaVie follows the idea of LDMs to encode each video frames into per frame latent code $\bar { \mathcal { E } } ( \bar { z } )$ . The diffusion process is operated in the latent spatio-temporal distribution space to model latent video distribution.
35
+
36
+ # 3 OUR APPROACH
37
+
38
+ Our proposed framework, LaVie, is a cascaded framework consisting of Video Latent Diffusion Models (V-LDMs) conditioned on text descriptions. The overall architecture of LaVie is depicted in
39
+
40
+ ![](images/2e1e40a0fbb70c9f55fbebe5c2138a7f9489113c0db570b17b5bd88b5314dcc9.jpg)
41
+ Figure 2: General pipeline. LaVie consists of three modules: a Base T2V model, a Temporal Interpolation (TI) model, and a Video Super Resolution (VSR) model. It also requires Encoder (E) and Decoder (D) from pretrained VAE. At the inference stage, given a sequence of noise and a text description, the base model aims to generate key frames aligning with the prompt and containing temporal correlation. The temporal interpolation model focuses on producing smoother results and synthesizing richer temporal details. The video super-resolution model enhances the visual quality as well as elevates the spatial resolution even further. Finally, we generate videos at $1 2 8 0 \times 2 0 4 \dot { 8 }$ resolution with 61 frames.
42
+
43
+ Fig. 2, and it comprises three distinct networks: a Base T2V model responsible for generating short, low-resolution key frames, a Temporal Interpolation (TI) model designed to interpolate the short videos and increase the frame rate, and a Video Super Resolution (VSR) model aimed at synthesizing high-definition results from the low-resolution videos. Each of these models is individually trained with text inputs serving as conditioning information. During the inference stage, given a sequence of latent noises and a textual prompt, LaVie is capable of generating a video consisting of 61 frames with a spatial resolution of $1 2 8 0 \times 2 0 4 8$ pixels, utilizing the entire system. In the subsequent sections, we will elaborate on the learning methodology employed in LaVie, as well as the architectural design of the models involved.
44
+
45
+ # 3.1 BASE T2V MODEL
46
+
47
+ Given the video dataset $p _ { \mathrm { v i d e o } }$ and the image dataset $p _ { \mathrm { i m a g e } }$ , we have a T-frame video denoted as $v \in \mathbb { R } ^ { T \times 3 \times H \times W }$ , where $v$ follows the distribution $p _ { \mathrm { v i d e o } }$ . Similarly, we have an image denoted as $\boldsymbol { x } \in \mathbb { R } ^ { 3 \times H \times W }$ , where $x$ follows the distribution $p _ { \mathrm { i m a g e } }$ . As the original LDM is designed as a 2D UNet and can only process image data, we introduce two modifications to model the spatio-temporal distribution. Firstly, for each 2D convolutional layer, we inflate the pre-trained kernel to incorporate an additional temporal dimension, resulting in a pseudo-3D convolutional layer. This inflation process converts any input tensor with the size $\mathbf { \hat { \boldsymbol { B } } } \times \hat { \boldsymbol { C } } \times \boldsymbol { H } \times \boldsymbol { W }$ to $B \times C \times 1 \times \mathbf { \bar { H } } \times W$ by introducing an extra temporal axis. Secondly, as illustrated in Fig. 3, we extend the original transformer block to a Spatio-Temporal Transformer (ST-Transformer) by including a temporal attention layer after each spatial layer. Furthermore, we incorporate the concept of Rotary Positional Encoding (RoPE) from the recent LLM (Touvron et al., 2023) to integrate the temporal attention layer. Unlike previous methods that introduce an additional Temporal Transformer to model time, our modification directly applies to the transformer block itself, resulting in a simpler yet effective approach. Through various experiments with different designs of the temporal module, such as spatio-temporal attention and temporal causal attention, we observed that increasing the complexity of the temporal module only marginally improved the results while significantly increasing model size and training time. Therefore, we opt to retain the simplest design of the network, generating videos with 16 frames at a resolution of $\mathrm { 3 2 0 \times 5 1 2 }$ .
48
+
49
+ The primary objective of the base model is to generate high-quality key frames while also preserving diversity and capturing the compositional nature of videos. We aim to enable our model to synthesize videos aligned with creative prompts, such as “Cinematic shot of Van Gogh’s selfie”. However, we observed that fine-tuning solely on video datasets, even with the initialization from a pre-trained LDM, fails to achieve this goal due to the phenomenon of catastrophic forgetting, where previous knowledge is rapidly forgotten after training for a few epochs. Hence, we apply a joint fine-tuning approach using both image and video data to address this issue. In practise, we concatenate $M$ images along the temporal axis to form a $T$ -frame video and train the entire base model to optimize the objectives of both the Text-to-Image (T2I) and Text-to-Video (T2V) tasks (as shown in Fig. 3 (c)). Consequently, our training objective consists of two components: a video loss ${ \mathcal { L } } _ { V }$ and an image loss
50
+
51
+ ![](images/eebf45002e83429990380ad3f46e653f387d5027c07b60b7a55fb8646b6671ae.jpg)
52
+ Figure 3: Spatio-temporal module. We show the Transformer block in Stable Diffusion in (a), our proposed ST-Transformer block in (b), and our joint image-video training scheme in (c).
53
+
54
+ $\mathcal { L } _ { I }$ . The overall objective can be formulated as:
55
+
56
+ $$
57
+ \begin{array} { r } { \mathcal { L } = \mathbb { E } \left[ \| \epsilon - \epsilon _ { \theta } ( \mathcal { E } ( \mathbf { v } _ { t } ) , t , c _ { V } ) \| _ { 2 } ^ { 2 } \right] + \alpha * \mathbb { E } \left[ \| \epsilon - \epsilon _ { \theta } ( \mathcal { E } ( \mathbf { x } _ { t } ) , t , c _ { I } ) \| _ { 2 } ^ { 2 } \right] , } \end{array}
58
+ $$
59
+
60
+ where $c _ { V }$ and $c _ { I }$ represent the text descriptions for videos and images, respectively, and $\alpha$ is the coefficient used to balance the two losses. By incorporating images into the fine-tuning process, we observe a significant improvement in video quality. Furthermore, as demonstrated in Fig. 4, our approach successfully transfers various concepts from images to videos, including different styles, scenes, and characters. An additional advantage of our method is that, since we do not modify the architecture of LDM and jointly train on both image and video data, the resulting base model is capable of handling both T2I and T2V tasks, thereby showcasing the generalizability of our proposed design.
61
+
62
+ # 3.2 TEMPORAL INTERPOLATION MODEL
63
+
64
+ Building upon our base video latent diffusion model, we introduce a temporal interpolation network to enhance the smoothness of our generated videos and synthesize richer temporal details. We accomplish this by training a diffusion UNet, designed specifically to quadruple the frame rate of the base video. This network takes a 16-frame base video as input and produces an upsampled output consisting of 61 frames. During the training phase, we duplicate the base video frames to match the target frame rate and concatenate them with the noisy high-frame-rate frames. This combined data is used to train the diffusion UNet, enabling it to learn the process of denoising and generate the interpolated frames. At inference time, the base video frames are concatenated with randomly initialized Gaussian noise. The diffusion UNet gradually removes this noise through the denoising process, resulting in the generation of the 61 interpolated frames. Notably, our approach differs from conventional video frame interpolation methods, as each frame generated through interpolation replaces the corresponding input frame. In other words, every frame in the output is newly synthesized, providing a distinct approach compared to techniques where the input frames remain unchanged during interpolation. Furthermore, our diffusion UNet is conditioned on the text prompt, which serves as additional guidance for the temporal interpolation process, enhancing the overall quality and coherence of the generated videos.
65
+
66
+ # 3.3 VIDEO SUPER RESOLUTION MODEL
67
+
68
+ To further enhance visual quality and elevate spatial resolution, we incorporate a video superresolution (VSR) model into our video generation pipeline. This involves training a LDM upsampler, specifically designed to increase the video resolution to $1 2 8 0 \times 2 0 4 8$ . Similar to the base model described in Sec. 3.1, we leverage a pre-trained diffusion-based image $\times 4$ upscaler as a prior1. To adapt the network architecture to process video inputs in 3D, we incorporate an additional temporal dimension, enabling temporal processing within the diffusion UNet. Within this network, we introduce temporal layers, namely temporal attention and a 3D convolutional layer, alongside the existing spatial layers. These temporal layers contribute to enhancing temporal coherence in the generated videos. By concatenating the low-resolution input frames within the latent space, the diffusion UNet takes into account additional text descriptions and noise levels as conditions, which allows for more flexible control over the texture and quality of the enhanced output.
69
+
70
+ ![](images/7322ecdede486ea6fa1cf33f94141d0a5f27837676bbc289d8ae739700f19b83.jpg)
71
+ Yoda playing guitar on the stage.
72
+ Figure 4: Diverse video generation results. We show more videos from our method to demonstrate the diversity of our generated samples.
73
+
74
+ While the spatial layers in the pre-trained upscaler remain fixed, our focus lies in fine-tuning the inserted temporal layers in the V-LDM. Inspired by CNN-based super-resolution networks (Chan et al., 2022a;b; Zhou et al., 2022b; 2020; Jiang et al., 2021a; 2022), our model undergoes patchwise training on $3 2 0 \times 3 2 0$ patches. By utilizing the low-resolution video as a strong condition, our upscaler UNet effectively preserves its intrinsic convolutional characteristics. This allows for efficient training on patches while maintaining the capability to process inputs of arbitrary sizes. Through the integration of the VSR model, our LaVie framework generates high-quality videos at a 2K resolution ${ 1 2 8 0 \times 2 0 4 8 } )$ , ensuring both visual excellence and temporal consistency in the final output.
75
+
76
+ # 4 EXPERIMENTS
77
+
78
+ In this section, we first introduce datasets in our experiments. Subsequently, we evaluate our method both qualitatively and quantitatively, comparing it to state-of-the-art approaches on the zero-shot text-to-video task. Finally, we showcase two applications of our method: long video generation and personalized video synthesis. In addition, we provide detailed implementation details in App. C, an in-depth analysis regarding the efficacy of joint image-video fine-tuning in App. D and show limitations of current approach in App. E.
79
+
80
+ # 4.1 DATASETS
81
+
82
+ To train our models, we leverage two publicly available datasets, namely Webvid10M (Bain et al., 2021) and Laion5B (Schuhmann et al., 2022). However, we encountered limitations when uitilizing WebVid10M for high-definition video generation, specifically regarding video resolution, diversity, and aesthetics. Therefore, we curate a new dataset called Vimeo25M, specifically designed to enhance the quality of text-to-video generation. By applying rigorous filtering criteria based on resolution and aesthetic scores, we obtained a total of 20 million videos and 400 million images for training purposes.
83
+
84
+ The Vimeo25M dataset is a collection of 25 million text-video pairs in high-definition, widescreen, and watermark-free formats. These pairs are automatically generated using Videochat (Li et al., 2023). The original videos are sourced from Vimeo2 and are classified into ten categories: Ads and Commercials, Animation, Branded Content, Comedy, Documentary, Experimental, Music, Narrative, Sports, and Travel. Example videos are shown in Fig. 7. To obtain the dataset, we utilized PySceneDetect3 for scene detection and segmentation of the primary videos. To ensure the quality of captions, we filtered out captions with fewer than three words and excluded video segments with fewer than 16 frames. Consequently, we obtained a total of 25 million individual video segments, each representing a single scene. More detailed dataset statistics are introduced in App. B.
85
+
86
+ # 4.2 QUALITATIVE ANALYSIS
87
+
88
+ We present qualitative results of our approach, LaVie, through diverse text descriptions illustrated in Fig. 4. LaVie demonstrates its capability to synthesize videos with a wide range of content, including animals, movie characters, and various objects. Notably, our model exhibits a strong ability to combine spatial and temporal concepts, as exemplified by the synthesis of actions like “Yoda playing guitar”, which do not exist in the training set. These results indicate that our model learns to compose different concepts by capturing the underlying distribution rather than simply memorizing the training data. We show more results in Fig. 12.
89
+
90
+ Furthermore, we compare our generated results with three state-of-the-art and showcases the visual quality comparison in Fig. 5. LaVie outperforms Make-A-Video in terms of visual fidelity. Regarding the synthesis in the “Van Gogh style”, we observe that LaVie captures the style more effectively than the other two approaches. We attribute this to two factors: 1) initialization from a pretrained LDM facilitates the learning of spatio-temporal joint distribution, and 2) joint image-video finetuning mitigates catastrophic forgetting observed in Video LDM and enables knowledge transfer from images to videos more effectively. However, due to the unavailability of the testing code for the other two approaches, conducting a systematic and fair comparison is challenging.
91
+
92
+ # 4.3 QUANTITATIVE EVALUATION
93
+
94
+ We perform a zero-shot quantitative evaluation on two benchmark datasets, UCF101 (Soomro et al., 2012) and MSR-VTT (Chen et al., 2021), to compare our approach with existing methods. However, due to the time-consuming nature of sampling a large number of high-definition videos (e.g., ${ \sim } 1 0 0 0 0 )$ ) using diffusion models, we limit our evaluation to using videos from the base models to reduce computational duration. Additionally, we observed that current evaluation metrics FVD may not fully capture the real quality of the generated videos. Therefore, to provide a comprehensive assessment, we conduct a large-scale human evaluation to compare the performance of our approach with state-of-the-art.
95
+
96
+ Zero-shot Evaluation on UCF101. We evaluate the quality of the synthesized results on UCF-101 dataset using the FVD, following the approach of TATS by employing the pretrained I3D (Carreira & Zisserman, 2017) model as the backbone. Similar to the methodology proposed in Video LDM, we utilize class names as text prompts and generate 100 samples per class, resulting in a total of 10,100 videos. During video sampling and evaluation, we generate 16 frames per video with a resolution of $3 2 0 \times 5 1 2$ . Each frame is then center-cropped to a square size of $2 7 0 \times 2 7 0$ and resized to $2 2 4 \times 2 2 4$ to fit the I3D model input requirements.
97
+
98
+ The results, presented in Tab.1, demonstrate that our model outperforms all baseline methods, except for Make-A-Video. However, it is important to note that we utilize a smaller training dataset (WebVid10M+Vimeo25M) compared to Make-A-Video, which employs WebVid10M and HD-VILA100M for training. Furthermore, in contrast to Make-A-Video, which manually designs a template sentence for each class, we directly use the class name as the text prompt, following the approach of Video LDM. When considering methods with the same experimental setting, our approach outperforms the state-of-the-art result of Video LDM by 24.31, highlighting the superiority of our method and underscoring the importance of the proposed dataset for zero-shot video generation.
99
+
100
+ ![](images/7a84d9f2986b0ddebcf0a9c74af8a913df2fece6d9a925578834461234de576b.jpg)
101
+
102
+ ![](images/29007d234744c3e05ed98af718fb2e905a57566ba78a6710835f63d53d228da8.jpg)
103
+ (a) Make-A-Video (top) & ours (bottom). “Hyper-realistic spaceship landing on mars.”.
104
+
105
+ ![](images/f7c890d61f12a8c90712b9806d9a3045f5632b1e7a5a4a231794753e8ef16d86.jpg)
106
+ (b) VideoLDM (top) & ours (bottom). “A car moving on an empty street, rainy evening, Van Gogh painting”.
107
+ (c) Imagen Video (top) & ours (bottom). “A cat eating food out of a bowl in style of Van Gogh”.
108
+ Figure 5: Comparison with state-of-the-art. We compared to (a) Make-A-Video, (b) Video LDM and (c) Imagen Video. In each sub-figure, bottom row shows our result. We compare with Make-AVideo at spatial-resolution $5 1 2 \times 5 1 2$ and with the other two methods at $3 2 0 \times 5 1 2$ .
109
+
110
+ Table 1: Comparison with SoTA w.r.t. FVD for zero-shot T2V generation on UCF101.
111
+
112
+ <table><tr><td>Methods</td><td>Pretrain on image</td><td>Image generator</td><td>Resolution</td><td>FVD (↓)</td></tr><tr><td>CogVideo (Chinese) (Hong et al., 2023)</td><td>No</td><td>CogView</td><td>480×480</td><td>751.34</td></tr><tr><td>CogVideo (English) (Hong et al., 2023)</td><td>No</td><td>CogView</td><td>480×480</td><td>701.59</td></tr><tr><td>Make-A-Video (Singer et al., 2023)</td><td>No</td><td>DALL·E2</td><td>256×256</td><td>367.23</td></tr><tr><td>VideoFusion (Luo et al., 2023)</td><td>Yes</td><td>DALL·E2</td><td>256×256</td><td>639.90</td></tr><tr><td>Magic Video (Zhou et al., 2022a)</td><td>Yes</td><td>Stable Diffusion</td><td>256×256</td><td>699.00</td></tr><tr><td>LVDM (He et al., 2022)</td><td>Yes</td><td>Stable Diffusion</td><td>256×256</td><td>641.80</td></tr><tr><td>Video LDM (Blattmann et al., 2023)</td><td>Yes</td><td>Stable Diffusion</td><td>320×512</td><td>550.61</td></tr><tr><td>Ours (w/o Vimeo25M)</td><td>Yes</td><td>Stable Diffusion</td><td>320×512</td><td>540.30</td></tr><tr><td>Ours</td><td>Yes</td><td>Stable Diffusion</td><td>320× 512</td><td>526.30</td></tr></table>
113
+
114
+ Table 2: Comparison with SoTA w.r.t. CLIPSIM for zero-shot T2V generation on MSR-VTT.
115
+
116
+ <table><tr><td>Methods</td><td>Zero-Shot</td><td>CLIPSIM (↑)</td></tr><tr><td>GODIVA (Wu et al., 2021)</td><td>No</td><td>0.2402</td></tr><tr><td>NUWA (Wu et al., 2022)</td><td>No</td><td>0.2439</td></tr><tr><td>CogVideo (Chinese) (Hong et al.,2023)</td><td>Yes</td><td>0.2614</td></tr><tr><td>CogVideo (English) (Hong et al., 2023)</td><td>Yes</td><td>0.2631</td></tr><tr><td>Make-A-Video (Singer et al., 2023)</td><td>Yes</td><td>0.3049</td></tr><tr><td> Video LDM (Blattmann et al., 2023)</td><td>Yes</td><td>0.2929</td></tr><tr><td>ModelScope (Wang et al., 2023b)</td><td>Yes</td><td>0.2930</td></tr><tr><td>Ours</td><td>Yes</td><td>0.2949</td></tr></table>
117
+
118
+ Zero-shot Evaluation on MSR-VTT. For the MSR-VTT dataset, we conduct our evaluation by randomly selecting one caption per video from the official test set, resulting in a total of 2,990 videos. We assess the text-video semantic similarity using the clip similarity (CLIPSIM) metric. To compute CLIPSIM, we calculate the clip text-image similarity for each frame, considering the given text prompts, and then calculate the average score. In this evaluation, we employ the ViT-B32 clip model as the backbone, following the methodology outlined in previous work (Blattmann et al., 2023) to ensure a fair comparison. Our experimental setup and details are consistent with the previous work. The results demonstrate that LaVie achieves superior or competitive performance compared to state-of-the-art methods, highlighting the effectiveness of our proposed training scheme and the utilization of the Vimeo25M dataset. These findings underscore the efficacy of our approach in capturing text-video semantic similarity.
119
+
120
+ Human Evaluation. Deviating from previous methods that primarily focus on evaluating general video quality, we contend that a more nuanced assessment is necessary to comprehensively evaluate the generated videos from various perspectives. In light of this, we compare our method with two existing approaches, VideoCrafter and ModelScope, leveraging the accessibility of their testing platforms. To conduct a thorough evaluation, we enlist the assistance of 30 human raters and employ two types of assessments. Firstly, we ask the raters to compare pairs of videos in three different scenarios: ours v.s. ModelScope, ours v.s. VideoCrafter, and ModelScope v.s. VideoCrafter. Raters are instructed to evaluate the overall video quality to vote which video in the pair has better quality. Secondly, we request raters to evaluate each video individually using five pre-defined metrics: motion smoothness, motion reasonableness, subject consistency, background consistency, and face, body, and hand quality. Raters are required to assign one of three labels, “good”, “normal”, or “bad” for each metric. All human studies are conducted without time limitations.
121
+
122
+ As presented in Tab. 3 and Tab. 4, our proposed method surpasses the other two approaches, achieving the highest preference among human raters. However, it is worth noting that all three approaches struggle to achieve a satisfactory score in terms of “motion smoothness” indicating the ongoing challenge of generating coherent and realistic motion. Furthermore, producing high-quality face, body, and hand visuals remains challenging.
123
+
124
+ Table 3: Human Preference on video quality.
125
+
126
+ <table><tr><td>Metrics</td><td>Ours &gt;ModelScope</td><td>Ours &gt;VideoCrafter</td><td>ModelScope&gt;VideoCrafter</td></tr><tr><td>Video quality</td><td>75.00%</td><td>75.58%</td><td>59.10%</td></tr></table>
127
+
128
+ Table 4: Human Evaluation on five pre-defined metrics. Each number signifies the proportion of examiners who voted for a particular category (good, normal, or bad) out of all votes.
129
+
130
+ <table><tr><td rowspan="2">Metrics</td><td colspan="3">VideoCraft</td><td colspan="3">ModelScope</td><td colspan="3">Ours</td></tr><tr><td>Bad</td><td>Normal</td><td>Good</td><td>Bad</td><td>Normal</td><td>Good</td><td>Bad</td><td>Normal</td><td>Good</td></tr><tr><td>Motion Smoothness</td><td>0.24</td><td>0.58</td><td>0.18</td><td>0.16</td><td>0.53</td><td>0.31</td><td>0.20</td><td>0.45</td><td>0.35</td></tr><tr><td>Motion Reasonableness</td><td>0.53</td><td>0.33</td><td>0.14</td><td>0.37</td><td>0.40</td><td>0.22</td><td>0.40</td><td>0.32</td><td>0.27</td></tr><tr><td>Subject Consistency</td><td>0.25</td><td>0.40</td><td>0.35</td><td>0.18</td><td>0.34</td><td>0.48</td><td>0.15</td><td>0.26</td><td>0.58</td></tr><tr><td>Background Consistency</td><td>0.10</td><td>0.40</td><td>0.50</td><td>0.08</td><td>0.28</td><td>0.63</td><td>0.06</td><td>0.22</td><td>0.72</td></tr><tr><td>Face/Body/Hand quality</td><td>0.69</td><td>0.24</td><td>0.06</td><td>0.51</td><td>0.31</td><td>0.18</td><td>0.46</td><td>0.30</td><td>0.24</td></tr></table>
131
+
132
+ # 4.4 MORE APPLICATIONS
133
+
134
+ In this section, we present two applications to showcase the capabilities of our pretrained models in downstream tasks: 1) long video generation, and 2) personalized video generation using LaVie.
135
+
136
+ ![](images/e110645a8a96d2ac3b525794baa9d77c72c0c2860128e674982fd84155c3ea41.jpg)
137
+ A car moving on an empty street, rainy evening, Van Gogh painting. $[ 4 \mathrm { \sim } 6 \mathrm { { s } ] }$
138
+ Figure 6: Long video generation. By employing autoregressive generation three times consecutively, we successfully extend the video length of our base model from 2s to 6s.
139
+
140
+ Long video generation. To extend the video generation beyond a single sequence, we propose a simple recursive method. Similar to the temporal interpolation network, we incorporate the first frame of a video into the input layer of a UNet. By fine-tuning the base model accordingly, we enable the utilization of the last frame of the generated video as a conditioning input during inference. This recursive approach allows us to generate an extended video sequence. Fig. 6 showcases the results of generating tens of video frames (excluding frame interpolation) using this recursive manner, applied five times. The results demonstrate that the quality of the generated video remains high, with minimal degradation in video quality. This reaffirms the effectiveness of our base model in generating visually appealing frames.
141
+
142
+ Personalized video generation. Although our approach is primarily designed for general text-tovideo generation, we demonstrate its versatility by adapting it to personalized video data through the integration of a personalized image generation approach, such as LoRA (Hu et al., 2022). In this adaptation, we fine-tune the spatial layers of our model using LoRA on self-collected images, while keeping the temporal modules frozen. As depicted in Fig. 14, the personalized video model for “Misaka Mikoto” is created after the fine-tuning process. The model is capable of synthesizing personalized videos based on various prompts. For instance, by providing the prompt “Misaka Mikoto walking in the city”, the model successfully generates scenes where “Misaka Mikoto” is depicted in novel places.
143
+
144
+ # 5 CONCLUSION
145
+
146
+ In this paper, we present LaVie, a text-to-video foundation model that produces high-quality and temporally coherent results. Our approach leverages a cascade of video diffusion models, extending a pre-trained LDM with simple designed temporal modules enhanced by Rotary Position Encoding (RoPE). To facilitate the generation of high-quality and diverse content, we introduce Vimeo25M, a novel and extensive video-text dataset that offers higher resolutions and improved aesthetics scores. By jointly fine-tuning on both image and video datasets, LaVie demonstrates a remarkable capacity to compose various concepts, including styles, characters, and scenes. We conduct comprehensive quantitative and qualitative evaluations for zero-shot text-to-video generation, which convincingly validate the superiority of our method over state-of-the-art approaches. Furthermore, we showcase the versatility of our pre-trained base model in long video generation and personalized video generation, which serve as additional evidence of the effectiveness and flexibility of LaVie.
147
+
148
+ # ETHIC STATEMENT
149
+
150
+ We acknowledge the ethical concerns that are shared with other T2I and T2V diffusion models. We aim to synthesize high-quality videos by giving text descriptions. Our approach can be used for movie production, making video games, artistic creation, generating synthetic data for other computer vision tasks, etc. We note that our framework has the potential to introduce unintended bias as a result of the training data.
151
+
152
+ # REPRODUCIBILITY STATEMENT
153
+
154
+ We intend to open-source our code, collected Vimeo25M dataset, as well as trained models.
155
+
156
+ # REFERENCES
157
+
158
+ Max Bain, Arsha Nagrani, Gul Varol, and Andrew Zisserman. Frozen in time: A joint video and ¨ image encoder for end-to-end retrieval. In ICCV, 2021.
159
+ Yogesh Balaji, Seungjun Nah, Xun Huang, Arash Vahdat, Jiaming Song, Karsten Kreis, Miika Aittala, Timo Aila, Samuli Laine, Bryan Catanzaro, et al. ediffi: Text-to-image diffusion models with an ensemble of expert denoisers. arXiv preprint arXiv:2211.01324, 2022.
160
+ Yoshua Bengio, Jer´ ome Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ˆ Proceedings of the 26th annual international conference on machine learning, 2009.
161
+ Sarthak Bhagat, Shagun Uppal, Zhuyun Yin, and Nengli Lim. Disentangling multiple features in video sequences using gaussian processes in variational autoencoders. In ECCV, 2020.
162
+ Andreas Blattmann, Robin Rombach, Huan Ling, Tim Dockhorn, Seung Wook Kim, Sanja Fidler, and Karsten Kreis. Align your latents: High-resolution video synthesis with latent diffusion models. In CVPR, 2023.
163
+ Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale GAN training for high fidelity natural image synthesis. In ICLR, 2019.
164
+ Tim Brooks, Janne Hellsten, Miika Aittala, Ting-Chun Wang, Timo Aila, Jaakko Lehtinen, Ming-Yu Liu, Alexei A Efros, and Tero Karras. Generating long videos of dynamic scenes. 2022.
165
+ Joao Carreira and Andrew Zisserman. Quo vadis, action recognition? a new model and the kinetics dataset. In CVPR, 2017.
166
+ Kelvin C.K. Chan, Shangchen Zhou, Xiangyu Xu, and Chen Change Loy. BasicVSR $^ { + + }$ : Improving video super-resolution with enhanced propagation and alignment. In CVPR, 2022a.
167
+ Kelvin C.K. Chan, Shangchen Zhou, Xiangyu Xu, and Chen Change Loy. Investigating tradeoffs in real-world video super-resolution. In CVPR, 2022b.
168
+ Haoran Chen, Jianmin Li, Simone Frintrop, and Xiaolin Hu. The msr-video to text dataset with clean annotations. arXiv preprint arXiv:2102.06448, 2021.
169
+ Aidan Clark, Jeff Donahue, and Karen Simonyan. Adversarial video generation on complex datasets. arXiv preprint arXiv:1907.06571, 2019.
170
+ Yatin Dandi, Aniket Das, Soumye Singhal, Vinay Namboodiri, and Piyush Rai. Jointly trained image and video generation using residual vectors. In WACV, 2020.
171
+ Emily L Denton and vighnesh Birodkar. Unsupervised learning of disentangled representations from video. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), NeurIPS, 2017.
172
+ Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In CVPR, 2021.
173
+ Songwei Ge, Thomas Hayes, Harry Yang, Xi Yin, Guan Pang, David Jacobs, Jia-Bin Huang, and Devi Parikh. Long video generation with time-agnostic vqgan and time-sensitive transformer. In ECCV, 2022.
174
+ Songwei Ge, Seungjun Nah, Guilin Liu, Tyler Poon, Andrew Tao, Bryan Catanzaro, David Jacobs, Jia-Bin Huang, Ming-Yu Liu, and Yogesh Balaji. Preserve your own correlation: A noise prior for video diffusion models. arXiv preprint arXiv:2305.10474, 2023.
175
+ Ian Goodfellow, Yoshua Bengio, Aaron Courville, and Yoshua Bengio. Deep learning, volume 1. MIT Press, 2016.
176
+ Yingqing He, Tianyu Yang, Yong Zhang, Ying Shan, and Qifeng Chen. Latent video diffusion models for high-fidelity long video generation. 2022.
177
+ Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020.
178
+ Jonathan Ho, William Chan, Chitwan Saharia, Jay Whang, Ruiqi Gao, Alexey Gritsenko, Diederik P Kingma, Ben Poole, Mohammad Norouzi, David J Fleet, et al. Imagen video: High definition video generation with diffusion models. arXiv preprint arXiv:2210.02303, 2022a.
179
+ Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J Fleet. Video diffusion models. arXiv preprint arXiv:2204.03458, 2022b.
180
+ Wenyi Hong, Ming Ding, Wendi Zheng, Xinghan Liu, and Jie Tang. Cogvideo: Large-scale pretraining for text-to-video generation via transformers. In The Eleventh International Conference on Learning Representations, 2023.
181
+ Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. In ICLR, 2022.
182
+ Ziqi Huang, Kelvin C.K. Chan, Yuming Jiang, and Ziwei Liu. Collaborative diffusion for multimodal face generation and editing. In CVPR, 2023.
183
+ Yuming Jiang, Kelvin CK Chan, Xintao Wang, Chen Change Loy, and Ziwei Liu. Robust referencebased super-resolution via c2-matching. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2103–2112, 2021a.
184
+ Yuming Jiang, Ziqi Huang, Xingang Pan, Chen Change Loy, and Ziwei Liu. Talk-to-edit: Finegrained facial editing via dialog. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 13799–13808, 2021b.
185
+ Yuming Jiang, Kelvin CK Chan, Xintao Wang, Chen Change Loy, and Ziwei Liu. Reference-based image and video super-resolution via $c ^ { 2 }$ -matching. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2022.
186
+ Yuming Jiang, Shuai Yang, Tong Liang Koh, Wayne Wu, Chen Change Loy, and Ziwei Liu. Text2performer: Text-driven human video generation. arXiv preprint arXiv:2303.13495, 2023.
187
+ Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In CVPR, 2019.
188
+ Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of StyleGAN. In CVPR, 2020.
189
+ Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. In ICLR, 2014.
190
+ KunChang Li, Yinan He, Yi Wang, Yizhuo Li, Wenhai Wang, Ping Luo, Yali Wang, Limin Wang, and Yu Qiao. Videochat: Chat-centric video understanding, 2023.
191
+ Yingzhen Li and Stephan Mandt. Disentangled sequential autoencoder. ICML, 2018.
192
+ Zhengxiong Luo, Dayou Chen, Yingya Zhang, Yan Huang, Liangsheng Wang, Yujun Shen, Deli Zhao, Jinren Zhou, and Tien-Ping Tan. Videofusion: Decomposed diffusion models for highquality video generation. 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
193
+ Ron Mokady, Amir Hertz, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. Null-text inversion for editing real images using guided diffusion models. arXiv preprint arXiv:2211.09794, 2022.
194
+ Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In ICML, 2021.
195
+ Gaurav Parmar, Krishna Kumar Singh, Richard Zhang, Yijun Li, Jingwan Lu, and Jun-Yan Zhu. Zero-shot image-to-image translation. In ACM SIGGRAPH 2023 Conference Proceedings, 2023.
196
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
197
+ Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, 2021.
198
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. The Journal of Machine Learning Research, 2020.
199
+ Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In ICML, 2021.
200
+ Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
201
+ Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High- ¨ resolution image synthesis with latent diffusion models. In CVPR, 2022.
202
+ Chitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement. IEEE Transactions on Pattern Analysis and Machine Intelligence.
203
+ Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. NeurIPS, 2022.
204
+ Masaki Saito, Eiichi Matsumoto, and Shunta Saito. Temporal generative adversarial nets with singular value clipping. In ICCV, 2017.
205
+ Christoph Schuhmann, Romain Beaumont, Richard Vencu, Cade Gordon, Ross Wightman, Mehdi Cherti, Theo Coombes, Aarush Katta, Clayton Mullis, Mitchell Wortsman, et al. Laion-5b: An open large-scale dataset for training next generation image-text models. Advances in Neural Information Processing Systems, 2022.
206
+ Uriel Singer, Adam Polyak, Thomas Hayes, Xi Yin, Jie An, Songyang Zhang, Qiyuan Hu, Harry Yang, Oron Ashual, Oran Gafni, Devi Parikh, Sonal Gupta, and Yaniv Taigman. Make-a-video: Text-to-video generation without text-video data. In ICLR, 2023.
207
+ Ivan Skorokhodov, Sergey Tulyakov, and Mohamed Elhoseiny. Stylegan-v: A continuous video generator with the price, image quality and perks of stylegan2. In CVPR, 2022.
208
+ Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2021a. URL https://openreview.net/ forum?id ${ \underline { { \underline { { \mathbf { \Pi } } } } } } =$ St1giarCHLP.
209
+ Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In ICLRs, 2021b.
210
+ Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah. Ucf101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402, 2012.
211
+ Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864, 2021.
212
+ Yu Tian, Jian Ren, Menglei Chai, Kyle Olszewski, Xi Peng, Dimitris N. Metaxas, and Sergey Tulyakov. A good image generator is what you need for high-resolution video synthesis. In ICLR, 2021.
213
+ Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee´ Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and \` efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023.
214
+ Sergey Tulyakov, Ming-Yu Liu, Xiaodong Yang, and Jan Kautz. MoCoGAN: Decomposing motion and content for video generation. In CVPR, 2018.
215
+ Aaron Van Den Oord, Oriol Vinyals, et al. Neural discrete representation learning. NeurIPS, 2017.
216
+ Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. In NIPS, 2016.
217
+ Jianyi Wang, Zongsheng Yue, Shangchen Zhou, Kelvin CK Chan, and Chen Change Loy. Exploiting diffusion prior for real-world image super-resolution. arXiv preprint arXiv:2305.07015, 2023a.
218
+ Jiuniu Wang, Hangjie Yuan, Dayou Chen, Yingya Zhang, Xiang Wang, and Shiwei Zhang. Modelscope text-to-video technical report. arXiv preprint arXiv:2308.06571, 2023b.
219
+ Yaohui Wang. Learning to Generate Human Videos. Theses, Inria - Sophia Antipolis ; Universite´ Cote d’Azur, September 2021.
220
+ Yaohui WANG, Piotr Bilinski, Francois Bremond, and Antitza Dantcheva. Imaginator: Conditional spatio-temporal gan for video generation. In WACV, 2020.
221
+ Yaohui Wang, Piotr Bilinski, Francois Bremond, and Antitza Dantcheva. G3AN: Disentangling appearance and motion for video generation. In CVPR, 2020.
222
+ Yaohui Wang, Francois Bremond, and Antitza Dantcheva. Inmodegan: Interpretable motion decomposition generative adversarial network for video generation. arXiv preprint arXiv:2101.03049, 2021.
223
+ Chenfei Wu, Lun Huang, Qianxi Zhang, Binyang Li, Lei Ji, Fan Yang, Guillermo Sapiro, and Nan Duan. Godiva: Generating open-domain videos from natural descriptions. arXiv preprint arXiv:2104.14806, 2021.
224
+ Chenfei Wu, Jian Liang, Lei Ji, Fan Yang, Yuejian Fang, Daxin Jiang, and Nan Duan. Nuwa: Visual ¨ synthesis pre-training for neural visual world creation. In European conference on computer vision, 2022.
225
+ Jianwen Xie, Ruiqi Gao, Zilong Zheng, Song-Chun Zhu, and Ying Nian Wu. Motion-based generator model: Unsupervised disentanglement of appearance, trackable and intrackable motions in dynamic patterns. In AAAI, 2020.
226
+ Wilson Yan, Yunzhi Zhang, Pieter Abbeel, and Aravind Srinivas. Videogpt: Video generation using vq-vae and transformers. arXiv preprint arXiv:2104.10157, 2021.
227
+ Sihyun Yu, Jihoon Tack, Sangwoo Mo, Hyunsu Kim, Junho Kim, Jung-Woo Ha, and Jinwoo Shin. Generating videos with dynamics-aware implicit generative adversarial networks. In ICLR, 2022.
228
+ Lvmin Zhang and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models, 2023.
229
+ Qihang Zhang, Ceyuan Yang, Yujun Shen, Yinghao Xu, and Bolei Zhou. Towards smooth video composition. 2022.
230
+ Daquan Zhou, Weimin Wang, Hanshu Yan, Weiwei Lv, Yizhe Zhu, and Jiashi Feng. Magicvideo: Efficient video generation with latent diffusion models. arXiv preprint arXiv:2211.11018, 2022a.
231
+ Shangchen Zhou, Jiawei Zhang, Wangmeng Zuo, and Chen Change Loy. Cross-scale internal graph neural network for image super-resolution. In NeurIPS, 2020.
232
+ Shangchen Zhou, Kelvin Chan, Chongyi Li, and Chen Change Loy. Towards robust blind face restoration with codebook lookup transformer. In NeurIPS, 2022b.
233
+
234
+ # A RELATED WORK
235
+
236
+ Unconditional video generation endeavors to generate videos by comprehensively learning the underlying distribution of the training dataset. Previous works have leveraged various types of deep generative models, including GANs (Goodfellow et al., 2016; Radford et al., 2015; Brock et al., 2019; Karras et al., 2019; 2020; Vondrick et al., 2016; Saito et al., 2017; Tulyakov et al., 2018; WANG et al., 2020; Wang et al., 2020; Wang, 2021; Wang et al., 2021; Clark et al., 2019; Brooks et al., 2022; Yu et al., 2022; Skorokhodov et al., 2022; Tian et al., 2021; Zhang et al., 2022; Dandi et al., 2020), VAEs (Kingma & Welling, 2014; Denton & Birodkar, 2017; Li & Mandt, 2018; Bhagat et al., 2020; Xie et al., 2020), and VQ-based models (Van Den Oord et al., 2017; Esser et al., 2021; Yan et al., 2021; Ge et al., 2022; Jiang et al., 2023). Recently, a notable advancement in video generation has been observed with the emergence of Diffusion Models (DMs) (Ho et al., 2020; Song et al., 2021a; Nichol & Dhariwal, 2021), which have demonstrated remarkable progress in image synthesis (Ramesh et al., 2021; 2022; Rombach et al., 2022). Building upon this success, several recent works (Ho et al., 2022b; He et al., 2022) have explored the application of DMs for video generation. These works showcase the promising capability of DMs to model complex video distributions by integrating spatio-temporal operations into image-based models, surpassing previous approaches in terms of video quality. However, learning the entire distribution of video datasets in an unconditional manner remains highly challenging. The entanglement of spatial and temporal content poses difficulties, making it still arduous to obtain satisfactory results.
237
+
238
+ Text-to-video generation, as a form of conditional video generation, focuses on the synthesis of high-quality videos using text descriptions as conditioning inputs. Existing approaches primarily extend text-to-image models by incorporating temporal modules, such as temporal convolutions and temporal attention, to establish temporal correlations between video frames. Notably, Make-AVideo (Singer et al., 2023) and Imagen Video (Ho et al., 2022a) are developed based on DALL·E2 (Ramesh et al., 2022) and Imagen (Saharia et al., 2022), respectively. PYoCo (Ge et al., 2023) proposed a noise prior approach and leverage a pre-trained eDiff-I (Balaji et al., 2022) as initialization. Conversely, other works (Blattmann et al., 2023; Zhou et al., 2022a; He et al., 2022) build upon Stable Diffusion (Rombach et al., 2022) owing to the accessibility of pre-trained models. In terms of training strategies, one approach involves training the entire model from scratch (Ho et al., 2022a; Singer et al., 2023) on both image and video data. Although this method can yield high-quality results by learning from both image and video distributions, it demands significant computational resources and entails lengthy optimization. Another approach is to construct the Text-to-Video (T2V) model based on pre-trained Stable Diffusion and subsequently fine-tune the model either entirely (Zhou et al., 2022a; He et al., 2022) or partially (Blattmann et al., 2023) on video data. These approaches aim to leverage the benefits of large-scale pre-trained T2I models to expedite convergence. However, we posit that relying exclusively on video data may not yield satisfactory results due to the substantial distribution gap between video and image datasets, potentially leading to challenges such as catastrophic forgetting. In contrast to prior works, our approach distinguishes itself by augmenting a pre-trained Stable Diffusion model with an efficient temporal module and jointly fine-tuning the entire model on both image and video datasets.
239
+
240
+ # B VIMEO25M DATASET STATISTICS
241
+
242
+ The statistics of the Vimeo25M dataset, including the distribution of video categories, the duration of video segments, and the length of captions, are presented in Fig. 8. The dataset demonstrates a diverse range of categories, with a relatively balanced quantity among the majority of categories. Moreover, most videos in the dataset have captions consisting of approximately 10 words.
243
+
244
+ Furthermore, we conducted a comparison of the aesthetics score between the Vimeo25M dataset and the WebVid10M dataset. As illustrated in Fig. 9 (a), approximately $1 6 . 8 9 \%$ of the videos in Vimeo25M received a higher aesthetics score (greater than 6), surpassing the $7 . 2 2 \%$ in WebVid10M. In the score range between 4 and 6, Vimeo25M achieved a percentage of $7 9 . 1 2 \%$ , which is also superior to the $7 2 . { \bar { 5 } } 8 \%$ in WebVid10M. Finally, Fig. 9 (b) depicts a comparison of the spatial resolution between the Vimeo25M and WebVid10M datasets. It is evident that the majority of videos in the Vimeo25M dataset possess a higher resolution than those in WebVid10M, thereby ensuring that the generated results exhibit enhanced quality.
245
+
246
+ ![](images/6b76798b7e542786b012ce0f0c7e226a02e2549dc21d17ce16e1d5106d9a8d58.jpg)
247
+ (c) A sunset with clouds in the sky.
248
+
249
+ ![](images/03b6ad0972a0f26db07c336a1e814928f346b6dde374b0bf0ae12ed36f50b1a3.jpg)
250
+ Figure 7: We show three video examples as well as text descriptions from Vimeo25M dataset.
251
+
252
+ ![](images/4f56387e4ea85d386d34ced99924594507b9aafdda4971365943540334633d47.jpg)
253
+ Figure 8: Vimeo25M general information statistics. We show statistics of video categories, clip durations, and caption word lengths in Vimeo25M.
254
+ Figure 9: Aesthetics score, video scale statistics. We compare Vimeo25M with WebVid10M in terms of (a) aesthetics score and (b) video spatial resolution.
255
+
256
+ # C IMPLEMENTATION DETAILS
257
+
258
+ The Autoencoder and LDM of Base T2V model is initialized from a pretrained Stable Diffusion 1.4. Prior to training, we preprocess each video to a resolution of $3 2 0 \times 5 1 2$ and train using 16 frames per video clip. Additionally, we concatenate 4 images to each video for joint image-video fine-tuning. To facilitate the fine-tuning process, we employ curriculum learning (Bengio et al., 2009). In the initial stage, we utilize WebVid10M as the primary video data source, along with Laion5B, as the content within these videos is relatively simpler compared to the other dataset. Subsequently, we gradually introduce Vimeo25M to train the model on more complex scenes, subjects, and motion.
259
+
260
+ Temporal Interpolation model is initialized from our pretrained base T2V model. In order to accommodate our concatenated inputs of high and low frame-rate frames, we extend the architecture by incorporating an additional convolutional layer. During training, we utilize WebVid10M as the primary dataset. In the later stages of training, we gradually introduce Vimeo25M, which allows us to leverage its watermark-free videos, thus assisting in eliminating watermarks in the interpolated output. While patches of dimensions $2 5 6 \times 2 5 6$ are utilized during training, the trained model can successfully interpolate base videos at a resolution of $3 2 0 \times 5 1 2$ during inference.
261
+
262
+ The spatial layers of our VSR model is initialized from the pre-trained diffusion-based image $\times 4$ upscaler, keeping these layers fixed throughout training. Only the newly inserted temporal layers, including temporal attention and 3D CNN layers, are trained. Similar to the base model, we employ the WebVid10M and Laion5B (with resolution $\geq 1 0 2 4 ,$ ) datasets for joint image-video training. To facilitate this, we transform the image data into video clips by applying random translations to simulate handheld camera movements. For training purposes, all videos and images are cropped into patches of size $3 2 0 \times 3 2 0$ . Once trained, the model can effectively process videos of arbitrary sizes, offering enhanced results.
263
+
264
+ # D FURTHER ANALYSIS
265
+
266
+ In this section, we conduct a qualitative analysis of the training scheme employed in our experiments. We compare our joint image-video fine-tuning approach with two other experimental settings: 1) fine-tuning the entire UNet architecture based on WebVid10M, and 2) training temporal modules while keeping the rest of the network frozen. The results, depicted in Fig. 10, highlight the advantages of our proposed approach. When fine-tuning the entire model on video data, we observe a phenomenon known as catastrophic forgetting. The concept of “teddy bear” gradually diminishes and the quality of its representation deteriorates significantly. Since the training videos contain very few instances of “teddy bear”, the model gradually adapts to the new data distribution, resulting in a loss of prior knowledge. In the second setting, we encounter difficulties in aligning the spatial knowledge from the image dataset with the newly learned temporal information from the video dataset. The significant distribution gap between the image and video datasets poses a challenge in effectively integrating the spatial and temporal aspects. The attempts made by the high-level temporal modules to modify the spatial distribution adversely affect the quality of the generated videos. In contrast, our proposed joint image-video fine-tuning approach effectively learns the joint distribution of image and video data. This enables the model to recall knowledge from the image dataset and apply the learned motion from the video dataset, resulting in higher-quality synthesized videos. The ability to leverage both datasets enhances the overall performance and quality of the generated results.
267
+
268
+ ![](images/ca611341629f1e68b7b69b6c24ad605c904ef85ee6a2b8263f2ba0069e3e63de.jpg)
269
+ Figure 10: Training scheme comparison. We show image results based on (a) training the entire model, (b) training temporal modules, and (c) joint image-video fine-tuning, respectively.
270
+
271
+ # E LIMITATIONS
272
+
273
+ While LaVie has demonstrated impressive results in general text-to-video generation, we acknowledge the presence of certain limitations. In this section, we highlight two specific challenges which are shown in Fig. 11:
274
+
275
+ Multi-subject generation: Our models encounter difficulties when generating scenes involving more than two subjects, such as “Albert Einstein discussing an academic paper with Spiderman”. There are instances where the model tends to mix the appearances of Albert Einstein and Spiderman,
276
+
277
+ (a) Albert Einstein discussing an academic paper with Spiderman.
278
+
279
+ ![](images/d9890b16c03189c07b2c994e38631eb752301804a2c192bf13ab0af80bf84941.jpg)
280
+ (b) Albert Einstein playing the violin.
281
+ Figure 11: Limitations. We show limitations on (a) mutiple-object generation and (b) failure of hands generation
282
+
283
+ instead of generating distinct individuals. We have observed that this issue is also prevalent in the T2I model (Rombach et al., 2022). One potential solution for improvement involves replacing the current language model, CLIP (Radford et al., 2021), with a more robust language understanding model like T5 (Raffel et al., 2020). This substitution could enhance the model’s ability to accurately comprehend and represent complex language descriptions, thereby mitigating the mixing of subjects in multi-subject scenarios.
284
+
285
+ Hands generation: Generating human bodies with high-quality hands remains a challenging task. The model often struggles to accurately depict the correct number of fingers, leading to less realistic hand representations. A potential solution to address this issue involves training the model on a larger and more diverse dataset containing videos with human subjects. By exposing the model to a wider range of hand appearances and variations, it could learn to generate more realistic and anatomically correct hands.
286
+
287
+ ![](images/b32e504cc5ed31d78ecf2cd66518eca865ccd02d1ef58c658b304b8f30b17e88.jpg)
288
+
289
+ ![](images/d2765cfdbd0e74a7a3a7c7d62be5c9f7f3b79267396065e1ff0353e4d9931f05.jpg)
290
+ The Bund, Shanghai, with the ship moving on the river, oil painting.
291
+
292
+ ![](images/eaf3f80e20913515c33f4c284d8df1fbec648e9dadf14b424cf55c9b391acbd6.jpg)
293
+ The Roman Colosseum with a huge crowd of people, lightning, volumetric light, highly detailed.
294
+
295
+ ![](images/5b3392ac28a6273d4bd432d2d6b8802ac461aa71f8f6ece3688090c825c04b5b.jpg)
296
+ A jellyfish floating through the ocean, with bioluminescent tentacles.
297
+
298
+ ![](images/0e034e101cf1a32f1ae6f791ebac87969367f2af511d28ce7c3511438fdb02b5.jpg)
299
+ A fantasy landscape, trending on artstation, 4k, high resolution.
300
+
301
+ ![](images/e0f0c5725efbf0888067a1494eb711264e8d7fad88fdcbafd1b388105c3cc975.jpg)
302
+ A super cool giant robot in Cyberpunk city, artstation .
303
+
304
+ ![](images/c1119caa48351b55c35058c2e4324fd367cf0e0221d9a23579e8a0a2f42fa0ce.jpg)
305
+ Hyper-realistic spaceship landing on mars.
306
+
307
+ A shark swimming in the ocean.
308
+
309
+ ![](images/24004e844df2a83008549c90f0c64ee3b44c8b39ca8711dac805869670c11ff8.jpg)
310
+ Figure 12: Diverse video generation results.
311
+
312
+ A future where humans have achieved teleportation technology .
313
+
314
+ ![](images/39c0a3df529f6bfc5c7b4c3e1bee7d294f42917147cf75431d645db257ef3be7.jpg)
315
+
316
+ ![](images/3d70fe0f4ca232a15a972b24633764915e3c80d50a33e61aa55f96cb3550b173.jpg)
317
+ Albert Einstein is reading a paper. [4∼6s]
318
+ Figure 13: Long video generation. By employing autoregressive generation three times consecutively, we successfully extend the video length of our base model from 2s to 6s.
319
+
320
+ ![](images/6bc9456d7e493e0b3826c25ead20bbf9628ef3cbac8008527b61751d7d70d4ad.jpg)
321
+ (c) Misaka Mikoto in the space
322
+ Figure 14: Personalized video generation. We show results by adopting a LoRA-based approach in our model for personalized video generation. Samples used to train our LoRA are shown in (a). We use “Misaka Mikoto” as text prompts. Results from our video LoRA are shown in (b) and (c). By inserting pre-trained temporal modules into LoRA, we are able to animate “Misaka Mikoto” and control the results by combining them with different prompts.
parse/test/p09XyFxZkc/p09XyFxZkc_content_list.json ADDED
@@ -0,0 +1,688 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "LAVIE: HIGH-QUALITY VIDEO GENERATION WITH CASCADED LATENT DIFFUSION MODELS ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Anonymous authors Paper under double-blind review ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "ABSTRACT ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "This work aims to learn a high-quality text-to-video (T2V) generative model by leveraging a pre-trained text-to-image (T2I) model as a basis. It is a highly desirable yet challenging task to simultaneously a) accomplish the synthesis of visually realistic and temporally coherent videos while b) preserving the strong creative generation nature of the pre-trained T2I model. To this end, we propose LaVie, an integrated video generation framework that operates on cascaded video latent diffusion models, comprising a base T2V model, a temporal interpolation model, and a video super-resolution model. Our key insights are two-fold: 1) We reveal that the incorporation of simple temporal self-attentions, coupled with rotary positional encoding, adequately captures the temporal correlations inherent in video data. 2) Additionally, we validate that the process of joint image-video fine-tuning plays a pivotal role in producing high-quality and creative outcomes. To enhance the performance of LaVie, we contribute a comprehensive and diverse video dataset named Vimeo25M, consisting of 25 million text-video pairs that prioritize quality, diversity, and aesthetic appeal. Extensive experiments demonstrate that LaVie achieves state-of-the-art performance both quantitatively and qualitatively. Furthermore, we showcase the versatility of pre-trained LaVie models in various long video generation and personalized video synthesis applications. ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "image",
26
+ "img_path": "images/b42c6e48b5f6d022d50616ac0f4962bfc07c5ccdb500185b9c966c70dd664890.jpg",
27
+ "image_caption": [
28
+ "Figure 1: Text-to-video samples. LaVie is able to synthesize diverse, creative, high-definition videos with photorealistic and temporal coherent content by giving text descriptions. "
29
+ ],
30
+ "image_footnote": [],
31
+ "page_idx": 0
32
+ },
33
+ {
34
+ "type": "text",
35
+ "text": "1 INTRODUCTION ",
36
+ "text_level": 1,
37
+ "page_idx": 0
38
+ },
39
+ {
40
+ "type": "text",
41
+ "text": "With the remarkable breakthroughs achieved by Diffusion Models (DMs) (Ho et al., 2020; Song et al., 2021a;b) in image synthesis, the generation of photorealistic images from text descriptions (T2I) (Ramesh et al., 2021; 2022; Saharia et al., 2022; Balaji et al., 2022; Rombach et al., 2022) has taken center stage, finding applications in various image processing domain such as image outpainting (Ramesh et al., 2022), editing (Zhang & Agrawala, 2023; Mokady et al., 2022; Parmar et al., 2023; Huang et al., 2023; Jiang et al., 2021b) and enhancement (Saharia et al.; Wang et al., 2023a). Building upon the successes of T2I models, there has been a growing interest in extending these techniques to the synthesis of videos controlled by text inputs (T2V) (Singer et al., 2023; Ho et al., 2022a; Blattmann et al., 2023; Zhou et al., 2022a; He et al., 2022), driven by their potential applications in domains such as filmmaking, video games, and artistic creation. ",
42
+ "page_idx": 0
43
+ },
44
+ {
45
+ "type": "text",
46
+ "text": "",
47
+ "page_idx": 1
48
+ },
49
+ {
50
+ "type": "text",
51
+ "text": "However, training an entire T2V system from scratch (Ho et al., 2022a) poses significant challenges as it requires extensive computational resources to optimize the entire network for learning spatiotemporal joint distribution. An alternative approach (Singer et al., 2023; Blattmann et al., 2023; Zhou et al., 2022a; He et al., 2022) leverages the prior spatial knowledge from pre-trained T2I models for faster convergence to adapt video data, which aims to expedite the training process and efficiently achieve high-quality results. However, in practice, finding the right balance among video quality, training cost, and model compositionality still remains challenging as it requires careful design of model architecture, training strategies and the collection of high-quality text-video datasets. ",
52
+ "page_idx": 1
53
+ },
54
+ {
55
+ "type": "text",
56
+ "text": "To this end, we introduce LaVie, an integrated video generation framework (with a total number of 3B parameters) that operates on cascaded video latent diffusion models. LaVie is a text-to-video foundation model built based on a pre-trained T2I model (i.e. Stable Diffusion (Rombach et al., 2022)), aiming to synthesize visually realistic and temporally coherent videos while preserving the strong creative generation nature of the pre-trained T2I model. Our key insights are two-fold: 1) simple temporal self-attention coupled with RoPE (Su et al., 2021) adequately captures temporal correlations inherent in video data. More complex architectural design only results in marginal visual improvements to the generated outcomes. 2) Joint image-video fine-tuning plays a key role in producing high-quality and creative results. Directly fine-tuning on video dataset severely hampers the concept-mixing ability of the model, leading to catastrophic forgetting and the gradual vanishing of learned prior knowledge. Moreover, joint image-video fine-tuning facilitates large-scale knowledge transferring from images to videos, encompassing scenes, styles, and characters. In addition, we found that current publicly available text-video dataset WebVid10M (Bain et al., 2021), is insufficient to support T2V task due to its low resolution and watermark-centered videos. Therefore, to enhance the performance of LaVie, we introduce a novel text-video dataset Vimeo25M which consists of 25 million high-resolution videos $\\mathrm { ( > 7 2 0 p ) }$ with text descriptions. Our experiments demonstrate that training on Vimeo25M substantially boosts the performance of LaVie and empowers it to produce superior results in terms of quality, diversity, and aesthetic appeal (see Fig. 1). ",
57
+ "page_idx": 1
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "2 PRELIMINARY OF DIFFUSION MODELS ",
62
+ "text_level": 1,
63
+ "page_idx": 1
64
+ },
65
+ {
66
+ "type": "text",
67
+ "text": "Diffusion models (DMs) (Ho et al., 2020; Song et al., 2021a;b) aim to learn the underlying data distribution through a combination of two fundamental processes: diffusion and denoising. Given an input data sample $z \\sim p ( z )$ , the diffusion process introduces random noises to construct a noisy sample $z _ { t } = \\alpha _ { t } z + \\sigma _ { t } \\epsilon$ , where $\\epsilon \\sim \\mathcal { N } ( 0 , \\mathrm { I } )$ . This process is achieved by a Markov chain with $\\mathrm { T }$ steps, and the noise scheduler is parametrized by the diffusion-time $t$ , characterized by $\\alpha _ { t }$ and $\\sigma _ { t }$ . Notably, the logarithmic signal-to-noise ratio $\\lambda _ { t } \\doteq l o g [ \\alpha ^ { 2 } t / \\sigma ^ { 2 } t ]$ monotonically decreases over time. In the subsequent denoising stage, $\\epsilon$ -prediction and $v$ -prediction are employed to learn a denoiser function $\\epsilon _ { \\theta }$ , which is trained to minimize the mean square error loss by taking the diffused sample $z _ { t }$ as input: ",
68
+ "page_idx": 1
69
+ },
70
+ {
71
+ "type": "equation",
72
+ "img_path": "images/826c11a80562a4ef68bb3eaa861f2f35621592aef17356d8668d8677f5c9e74e.jpg",
73
+ "text": "$$\n\\begin{array} { r } { \\mathbb { E } _ { \\mathbf { z } \\sim p ( z ) , \\mathbf { \\epsilon } \\sim \\mathcal { N } ( 0 , 1 ) , t } \\left[ \\left\\| \\epsilon - \\epsilon _ { \\theta } ( \\mathbf { z } _ { t } , t ) \\right\\| _ { 2 } ^ { 2 } \\right] . } \\end{array}\n$$",
74
+ "text_format": "latex",
75
+ "page_idx": 1
76
+ },
77
+ {
78
+ "type": "text",
79
+ "text": "Latent diffusion models (LDMs) (Rombach et al., 2022) utilize a variational autoencoder architecture, wherein the encoder $\\mathcal { E }$ is employed to compress the input data into low-dimensional latent codes $\\mathcal { E } ( z )$ . Diverging from previous methods, LDMs conduct the diffusion and denoising processes in the latent space rather than the data space, resulting in substantial reductions in both training and inference time. Following the denoising stage, the final output is decoded as $\\mathcal { D } ( z _ { 0 } )$ , representing the reconstructed data. The objective of LDMs can be formulated as follows: ",
80
+ "page_idx": 1
81
+ },
82
+ {
83
+ "type": "equation",
84
+ "img_path": "images/ce50b65092f35af3440ba52370803457f8b83c5395e56b0ca4151af0266f3df3.jpg",
85
+ "text": "$$\n\\begin{array} { r } { \\mathbb { E } _ { \\mathbf { z } \\sim p ( z ) , \\epsilon \\sim \\mathcal { N } ( 0 , 1 ) , t } \\left[ \\left\\| \\epsilon - \\epsilon _ { \\theta } \\big ( \\mathcal { E } ( \\mathbf { z } _ { t } ) , t \\big ) \\right\\| _ { 2 } ^ { 2 } \\right] . } \\end{array}\n$$",
86
+ "text_format": "latex",
87
+ "page_idx": 1
88
+ },
89
+ {
90
+ "type": "text",
91
+ "text": "Our proposed LaVie follows the idea of LDMs to encode each video frames into per frame latent code $\\bar { \\mathcal { E } } ( \\bar { z } )$ . The diffusion process is operated in the latent spatio-temporal distribution space to model latent video distribution. ",
92
+ "page_idx": 1
93
+ },
94
+ {
95
+ "type": "text",
96
+ "text": "3 OUR APPROACH",
97
+ "text_level": 1,
98
+ "page_idx": 1
99
+ },
100
+ {
101
+ "type": "text",
102
+ "text": "Our proposed framework, LaVie, is a cascaded framework consisting of Video Latent Diffusion Models (V-LDMs) conditioned on text descriptions. The overall architecture of LaVie is depicted in ",
103
+ "page_idx": 1
104
+ },
105
+ {
106
+ "type": "image",
107
+ "img_path": "images/2e1e40a0fbb70c9f55fbebe5c2138a7f9489113c0db570b17b5bd88b5314dcc9.jpg",
108
+ "image_caption": [
109
+ "Figure 2: General pipeline. LaVie consists of three modules: a Base T2V model, a Temporal Interpolation (TI) model, and a Video Super Resolution (VSR) model. It also requires Encoder (E) and Decoder (D) from pretrained VAE. At the inference stage, given a sequence of noise and a text description, the base model aims to generate key frames aligning with the prompt and containing temporal correlation. The temporal interpolation model focuses on producing smoother results and synthesizing richer temporal details. The video super-resolution model enhances the visual quality as well as elevates the spatial resolution even further. Finally, we generate videos at $1 2 8 0 \\times 2 0 4 \\dot { 8 }$ resolution with 61 frames. "
110
+ ],
111
+ "image_footnote": [],
112
+ "page_idx": 2
113
+ },
114
+ {
115
+ "type": "text",
116
+ "text": "Fig. 2, and it comprises three distinct networks: a Base T2V model responsible for generating short, low-resolution key frames, a Temporal Interpolation (TI) model designed to interpolate the short videos and increase the frame rate, and a Video Super Resolution (VSR) model aimed at synthesizing high-definition results from the low-resolution videos. Each of these models is individually trained with text inputs serving as conditioning information. During the inference stage, given a sequence of latent noises and a textual prompt, LaVie is capable of generating a video consisting of 61 frames with a spatial resolution of $1 2 8 0 \\times 2 0 4 8$ pixels, utilizing the entire system. In the subsequent sections, we will elaborate on the learning methodology employed in LaVie, as well as the architectural design of the models involved. ",
117
+ "page_idx": 2
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "3.1 BASE T2V MODEL ",
122
+ "text_level": 1,
123
+ "page_idx": 2
124
+ },
125
+ {
126
+ "type": "text",
127
+ "text": "Given the video dataset $p _ { \\mathrm { v i d e o } }$ and the image dataset $p _ { \\mathrm { i m a g e } }$ , we have a T-frame video denoted as $v \\in \\mathbb { R } ^ { T \\times 3 \\times H \\times W }$ , where $v$ follows the distribution $p _ { \\mathrm { v i d e o } }$ . Similarly, we have an image denoted as $\\boldsymbol { x } \\in \\mathbb { R } ^ { 3 \\times H \\times W }$ , where $x$ follows the distribution $p _ { \\mathrm { i m a g e } }$ . As the original LDM is designed as a 2D UNet and can only process image data, we introduce two modifications to model the spatio-temporal distribution. Firstly, for each 2D convolutional layer, we inflate the pre-trained kernel to incorporate an additional temporal dimension, resulting in a pseudo-3D convolutional layer. This inflation process converts any input tensor with the size $\\mathbf { \\hat { \\boldsymbol { B } } } \\times \\hat { \\boldsymbol { C } } \\times \\boldsymbol { H } \\times \\boldsymbol { W }$ to $B \\times C \\times 1 \\times \\mathbf { \\bar { H } } \\times W$ by introducing an extra temporal axis. Secondly, as illustrated in Fig. 3, we extend the original transformer block to a Spatio-Temporal Transformer (ST-Transformer) by including a temporal attention layer after each spatial layer. Furthermore, we incorporate the concept of Rotary Positional Encoding (RoPE) from the recent LLM (Touvron et al., 2023) to integrate the temporal attention layer. Unlike previous methods that introduce an additional Temporal Transformer to model time, our modification directly applies to the transformer block itself, resulting in a simpler yet effective approach. Through various experiments with different designs of the temporal module, such as spatio-temporal attention and temporal causal attention, we observed that increasing the complexity of the temporal module only marginally improved the results while significantly increasing model size and training time. Therefore, we opt to retain the simplest design of the network, generating videos with 16 frames at a resolution of $\\mathrm { 3 2 0 \\times 5 1 2 }$ . ",
128
+ "page_idx": 2
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "The primary objective of the base model is to generate high-quality key frames while also preserving diversity and capturing the compositional nature of videos. We aim to enable our model to synthesize videos aligned with creative prompts, such as “Cinematic shot of Van Gogh’s selfie”. However, we observed that fine-tuning solely on video datasets, even with the initialization from a pre-trained LDM, fails to achieve this goal due to the phenomenon of catastrophic forgetting, where previous knowledge is rapidly forgotten after training for a few epochs. Hence, we apply a joint fine-tuning approach using both image and video data to address this issue. In practise, we concatenate $M$ images along the temporal axis to form a $T$ -frame video and train the entire base model to optimize the objectives of both the Text-to-Image (T2I) and Text-to-Video (T2V) tasks (as shown in Fig. 3 (c)). Consequently, our training objective consists of two components: a video loss ${ \\mathcal { L } } _ { V }$ and an image loss ",
133
+ "page_idx": 2
134
+ },
135
+ {
136
+ "type": "image",
137
+ "img_path": "images/eebf45002e83429990380ad3f46e653f387d5027c07b60b7a55fb8646b6671ae.jpg",
138
+ "image_caption": [
139
+ "Figure 3: Spatio-temporal module. We show the Transformer block in Stable Diffusion in (a), our proposed ST-Transformer block in (b), and our joint image-video training scheme in (c). "
140
+ ],
141
+ "image_footnote": [],
142
+ "page_idx": 3
143
+ },
144
+ {
145
+ "type": "text",
146
+ "text": "$\\mathcal { L } _ { I }$ . The overall objective can be formulated as: ",
147
+ "page_idx": 3
148
+ },
149
+ {
150
+ "type": "equation",
151
+ "img_path": "images/32e617af87b0d167bd49e036fb8463c61bdab3aa72710da0205c58ca042af66f.jpg",
152
+ "text": "$$\n\\begin{array} { r } { \\mathcal { L } = \\mathbb { E } \\left[ \\| \\epsilon - \\epsilon _ { \\theta } ( \\mathcal { E } ( \\mathbf { v } _ { t } ) , t , c _ { V } ) \\| _ { 2 } ^ { 2 } \\right] + \\alpha * \\mathbb { E } \\left[ \\| \\epsilon - \\epsilon _ { \\theta } ( \\mathcal { E } ( \\mathbf { x } _ { t } ) , t , c _ { I } ) \\| _ { 2 } ^ { 2 } \\right] , } \\end{array}\n$$",
153
+ "text_format": "latex",
154
+ "page_idx": 3
155
+ },
156
+ {
157
+ "type": "text",
158
+ "text": "where $c _ { V }$ and $c _ { I }$ represent the text descriptions for videos and images, respectively, and $\\alpha$ is the coefficient used to balance the two losses. By incorporating images into the fine-tuning process, we observe a significant improvement in video quality. Furthermore, as demonstrated in Fig. 4, our approach successfully transfers various concepts from images to videos, including different styles, scenes, and characters. An additional advantage of our method is that, since we do not modify the architecture of LDM and jointly train on both image and video data, the resulting base model is capable of handling both T2I and T2V tasks, thereby showcasing the generalizability of our proposed design. ",
159
+ "page_idx": 3
160
+ },
161
+ {
162
+ "type": "text",
163
+ "text": "3.2 TEMPORAL INTERPOLATION MODEL ",
164
+ "text_level": 1,
165
+ "page_idx": 3
166
+ },
167
+ {
168
+ "type": "text",
169
+ "text": "Building upon our base video latent diffusion model, we introduce a temporal interpolation network to enhance the smoothness of our generated videos and synthesize richer temporal details. We accomplish this by training a diffusion UNet, designed specifically to quadruple the frame rate of the base video. This network takes a 16-frame base video as input and produces an upsampled output consisting of 61 frames. During the training phase, we duplicate the base video frames to match the target frame rate and concatenate them with the noisy high-frame-rate frames. This combined data is used to train the diffusion UNet, enabling it to learn the process of denoising and generate the interpolated frames. At inference time, the base video frames are concatenated with randomly initialized Gaussian noise. The diffusion UNet gradually removes this noise through the denoising process, resulting in the generation of the 61 interpolated frames. Notably, our approach differs from conventional video frame interpolation methods, as each frame generated through interpolation replaces the corresponding input frame. In other words, every frame in the output is newly synthesized, providing a distinct approach compared to techniques where the input frames remain unchanged during interpolation. Furthermore, our diffusion UNet is conditioned on the text prompt, which serves as additional guidance for the temporal interpolation process, enhancing the overall quality and coherence of the generated videos. ",
170
+ "page_idx": 3
171
+ },
172
+ {
173
+ "type": "text",
174
+ "text": "3.3 VIDEO SUPER RESOLUTION MODEL ",
175
+ "text_level": 1,
176
+ "page_idx": 3
177
+ },
178
+ {
179
+ "type": "text",
180
+ "text": "To further enhance visual quality and elevate spatial resolution, we incorporate a video superresolution (VSR) model into our video generation pipeline. This involves training a LDM upsampler, specifically designed to increase the video resolution to $1 2 8 0 \\times 2 0 4 8$ . Similar to the base model described in Sec. 3.1, we leverage a pre-trained diffusion-based image $\\times 4$ upscaler as a prior1. To adapt the network architecture to process video inputs in 3D, we incorporate an additional temporal dimension, enabling temporal processing within the diffusion UNet. Within this network, we introduce temporal layers, namely temporal attention and a 3D convolutional layer, alongside the existing spatial layers. These temporal layers contribute to enhancing temporal coherence in the generated videos. By concatenating the low-resolution input frames within the latent space, the diffusion UNet takes into account additional text descriptions and noise levels as conditions, which allows for more flexible control over the texture and quality of the enhanced output. ",
181
+ "page_idx": 3
182
+ },
183
+ {
184
+ "type": "image",
185
+ "img_path": "images/7322ecdede486ea6fa1cf33f94141d0a5f27837676bbc289d8ae739700f19b83.jpg",
186
+ "image_caption": [
187
+ "Yoda playing guitar on the stage. ",
188
+ "Figure 4: Diverse video generation results. We show more videos from our method to demonstrate the diversity of our generated samples. "
189
+ ],
190
+ "image_footnote": [],
191
+ "page_idx": 4
192
+ },
193
+ {
194
+ "type": "text",
195
+ "text": "While the spatial layers in the pre-trained upscaler remain fixed, our focus lies in fine-tuning the inserted temporal layers in the V-LDM. Inspired by CNN-based super-resolution networks (Chan et al., 2022a;b; Zhou et al., 2022b; 2020; Jiang et al., 2021a; 2022), our model undergoes patchwise training on $3 2 0 \\times 3 2 0$ patches. By utilizing the low-resolution video as a strong condition, our upscaler UNet effectively preserves its intrinsic convolutional characteristics. This allows for efficient training on patches while maintaining the capability to process inputs of arbitrary sizes. Through the integration of the VSR model, our LaVie framework generates high-quality videos at a 2K resolution ${ 1 2 8 0 \\times 2 0 4 8 } )$ , ensuring both visual excellence and temporal consistency in the final output. ",
196
+ "page_idx": 4
197
+ },
198
+ {
199
+ "type": "text",
200
+ "text": "4 EXPERIMENTS ",
201
+ "text_level": 1,
202
+ "page_idx": 4
203
+ },
204
+ {
205
+ "type": "text",
206
+ "text": "In this section, we first introduce datasets in our experiments. Subsequently, we evaluate our method both qualitatively and quantitatively, comparing it to state-of-the-art approaches on the zero-shot text-to-video task. Finally, we showcase two applications of our method: long video generation and personalized video synthesis. In addition, we provide detailed implementation details in App. C, an in-depth analysis regarding the efficacy of joint image-video fine-tuning in App. D and show limitations of current approach in App. E. ",
207
+ "page_idx": 4
208
+ },
209
+ {
210
+ "type": "text",
211
+ "text": "4.1 DATASETS ",
212
+ "text_level": 1,
213
+ "page_idx": 4
214
+ },
215
+ {
216
+ "type": "text",
217
+ "text": "To train our models, we leverage two publicly available datasets, namely Webvid10M (Bain et al., 2021) and Laion5B (Schuhmann et al., 2022). However, we encountered limitations when uitilizing WebVid10M for high-definition video generation, specifically regarding video resolution, diversity, and aesthetics. Therefore, we curate a new dataset called Vimeo25M, specifically designed to enhance the quality of text-to-video generation. By applying rigorous filtering criteria based on resolution and aesthetic scores, we obtained a total of 20 million videos and 400 million images for training purposes. ",
218
+ "page_idx": 4
219
+ },
220
+ {
221
+ "type": "text",
222
+ "text": "",
223
+ "page_idx": 5
224
+ },
225
+ {
226
+ "type": "text",
227
+ "text": "The Vimeo25M dataset is a collection of 25 million text-video pairs in high-definition, widescreen, and watermark-free formats. These pairs are automatically generated using Videochat (Li et al., 2023). The original videos are sourced from Vimeo2 and are classified into ten categories: Ads and Commercials, Animation, Branded Content, Comedy, Documentary, Experimental, Music, Narrative, Sports, and Travel. Example videos are shown in Fig. 7. To obtain the dataset, we utilized PySceneDetect3 for scene detection and segmentation of the primary videos. To ensure the quality of captions, we filtered out captions with fewer than three words and excluded video segments with fewer than 16 frames. Consequently, we obtained a total of 25 million individual video segments, each representing a single scene. More detailed dataset statistics are introduced in App. B. ",
228
+ "page_idx": 5
229
+ },
230
+ {
231
+ "type": "text",
232
+ "text": "4.2 QUALITATIVE ANALYSIS ",
233
+ "text_level": 1,
234
+ "page_idx": 5
235
+ },
236
+ {
237
+ "type": "text",
238
+ "text": "We present qualitative results of our approach, LaVie, through diverse text descriptions illustrated in Fig. 4. LaVie demonstrates its capability to synthesize videos with a wide range of content, including animals, movie characters, and various objects. Notably, our model exhibits a strong ability to combine spatial and temporal concepts, as exemplified by the synthesis of actions like “Yoda playing guitar”, which do not exist in the training set. These results indicate that our model learns to compose different concepts by capturing the underlying distribution rather than simply memorizing the training data. We show more results in Fig. 12. ",
239
+ "page_idx": 5
240
+ },
241
+ {
242
+ "type": "text",
243
+ "text": "Furthermore, we compare our generated results with three state-of-the-art and showcases the visual quality comparison in Fig. 5. LaVie outperforms Make-A-Video in terms of visual fidelity. Regarding the synthesis in the “Van Gogh style”, we observe that LaVie captures the style more effectively than the other two approaches. We attribute this to two factors: 1) initialization from a pretrained LDM facilitates the learning of spatio-temporal joint distribution, and 2) joint image-video finetuning mitigates catastrophic forgetting observed in Video LDM and enables knowledge transfer from images to videos more effectively. However, due to the unavailability of the testing code for the other two approaches, conducting a systematic and fair comparison is challenging. ",
244
+ "page_idx": 5
245
+ },
246
+ {
247
+ "type": "text",
248
+ "text": "4.3 QUANTITATIVE EVALUATION ",
249
+ "text_level": 1,
250
+ "page_idx": 5
251
+ },
252
+ {
253
+ "type": "text",
254
+ "text": "We perform a zero-shot quantitative evaluation on two benchmark datasets, UCF101 (Soomro et al., 2012) and MSR-VTT (Chen et al., 2021), to compare our approach with existing methods. However, due to the time-consuming nature of sampling a large number of high-definition videos (e.g., ${ \\sim } 1 0 0 0 0 )$ ) using diffusion models, we limit our evaluation to using videos from the base models to reduce computational duration. Additionally, we observed that current evaluation metrics FVD may not fully capture the real quality of the generated videos. Therefore, to provide a comprehensive assessment, we conduct a large-scale human evaluation to compare the performance of our approach with state-of-the-art. ",
255
+ "page_idx": 5
256
+ },
257
+ {
258
+ "type": "text",
259
+ "text": "Zero-shot Evaluation on UCF101. We evaluate the quality of the synthesized results on UCF-101 dataset using the FVD, following the approach of TATS by employing the pretrained I3D (Carreira & Zisserman, 2017) model as the backbone. Similar to the methodology proposed in Video LDM, we utilize class names as text prompts and generate 100 samples per class, resulting in a total of 10,100 videos. During video sampling and evaluation, we generate 16 frames per video with a resolution of $3 2 0 \\times 5 1 2$ . Each frame is then center-cropped to a square size of $2 7 0 \\times 2 7 0$ and resized to $2 2 4 \\times 2 2 4$ to fit the I3D model input requirements. ",
260
+ "page_idx": 5
261
+ },
262
+ {
263
+ "type": "text",
264
+ "text": "The results, presented in Tab.1, demonstrate that our model outperforms all baseline methods, except for Make-A-Video. However, it is important to note that we utilize a smaller training dataset (WebVid10M+Vimeo25M) compared to Make-A-Video, which employs WebVid10M and HD-VILA100M for training. Furthermore, in contrast to Make-A-Video, which manually designs a template sentence for each class, we directly use the class name as the text prompt, following the approach of Video LDM. When considering methods with the same experimental setting, our approach outperforms the state-of-the-art result of Video LDM by 24.31, highlighting the superiority of our method and underscoring the importance of the proposed dataset for zero-shot video generation. ",
265
+ "page_idx": 5
266
+ },
267
+ {
268
+ "type": "image",
269
+ "img_path": "images/7a84d9f2986b0ddebcf0a9c74af8a913df2fece6d9a925578834461234de576b.jpg",
270
+ "image_caption": [],
271
+ "image_footnote": [],
272
+ "page_idx": 6
273
+ },
274
+ {
275
+ "type": "image",
276
+ "img_path": "images/29007d234744c3e05ed98af718fb2e905a57566ba78a6710835f63d53d228da8.jpg",
277
+ "image_caption": [
278
+ "(a) Make-A-Video (top) & ours (bottom). “Hyper-realistic spaceship landing on mars.”. "
279
+ ],
280
+ "image_footnote": [],
281
+ "page_idx": 6
282
+ },
283
+ {
284
+ "type": "image",
285
+ "img_path": "images/f7c890d61f12a8c90712b9806d9a3045f5632b1e7a5a4a231794753e8ef16d86.jpg",
286
+ "image_caption": [
287
+ "(b) VideoLDM (top) & ours (bottom). “A car moving on an empty street, rainy evening, Van Gogh painting”. ",
288
+ "(c) Imagen Video (top) & ours (bottom). “A cat eating food out of a bowl in style of Van Gogh”. ",
289
+ "Figure 5: Comparison with state-of-the-art. We compared to (a) Make-A-Video, (b) Video LDM and (c) Imagen Video. In each sub-figure, bottom row shows our result. We compare with Make-AVideo at spatial-resolution $5 1 2 \\times 5 1 2$ and with the other two methods at $3 2 0 \\times 5 1 2$ . "
290
+ ],
291
+ "image_footnote": [],
292
+ "page_idx": 6
293
+ },
294
+ {
295
+ "type": "table",
296
+ "img_path": "images/d35134ced7ab0ebc81ee3cb91c1f83d31befe6459c3f3707569d9ea0d0819e94.jpg",
297
+ "table_caption": [
298
+ "Table 1: Comparison with SoTA w.r.t. FVD for zero-shot T2V generation on UCF101. "
299
+ ],
300
+ "table_footnote": [],
301
+ "table_body": "<table><tr><td>Methods</td><td>Pretrain on image</td><td>Image generator</td><td>Resolution</td><td>FVD (↓)</td></tr><tr><td>CogVideo (Chinese) (Hong et al., 2023)</td><td>No</td><td>CogView</td><td>480×480</td><td>751.34</td></tr><tr><td>CogVideo (English) (Hong et al., 2023)</td><td>No</td><td>CogView</td><td>480×480</td><td>701.59</td></tr><tr><td>Make-A-Video (Singer et al., 2023)</td><td>No</td><td>DALL·E2</td><td>256×256</td><td>367.23</td></tr><tr><td>VideoFusion (Luo et al., 2023)</td><td>Yes</td><td>DALL·E2</td><td>256×256</td><td>639.90</td></tr><tr><td>Magic Video (Zhou et al., 2022a)</td><td>Yes</td><td>Stable Diffusion</td><td>256×256</td><td>699.00</td></tr><tr><td>LVDM (He et al., 2022)</td><td>Yes</td><td>Stable Diffusion</td><td>256×256</td><td>641.80</td></tr><tr><td>Video LDM (Blattmann et al., 2023)</td><td>Yes</td><td>Stable Diffusion</td><td>320×512</td><td>550.61</td></tr><tr><td>Ours (w/o Vimeo25M)</td><td>Yes</td><td>Stable Diffusion</td><td>320×512</td><td>540.30</td></tr><tr><td>Ours</td><td>Yes</td><td>Stable Diffusion</td><td>320× 512</td><td>526.30</td></tr></table>",
302
+ "page_idx": 6
303
+ },
304
+ {
305
+ "type": "table",
306
+ "img_path": "images/c271a1a866a71a750381a65c6894107a66dd22b71546a8c20913c6d6b391a3a5.jpg",
307
+ "table_caption": [
308
+ "Table 2: Comparison with SoTA w.r.t. CLIPSIM for zero-shot T2V generation on MSR-VTT. "
309
+ ],
310
+ "table_footnote": [],
311
+ "table_body": "<table><tr><td>Methods</td><td>Zero-Shot</td><td>CLIPSIM (↑)</td></tr><tr><td>GODIVA (Wu et al., 2021)</td><td>No</td><td>0.2402</td></tr><tr><td>NUWA (Wu et al., 2022)</td><td>No</td><td>0.2439</td></tr><tr><td>CogVideo (Chinese) (Hong et al.,2023)</td><td>Yes</td><td>0.2614</td></tr><tr><td>CogVideo (English) (Hong et al., 2023)</td><td>Yes</td><td>0.2631</td></tr><tr><td>Make-A-Video (Singer et al., 2023)</td><td>Yes</td><td>0.3049</td></tr><tr><td> Video LDM (Blattmann et al., 2023)</td><td>Yes</td><td>0.2929</td></tr><tr><td>ModelScope (Wang et al., 2023b)</td><td>Yes</td><td>0.2930</td></tr><tr><td>Ours</td><td>Yes</td><td>0.2949</td></tr></table>",
312
+ "page_idx": 7
313
+ },
314
+ {
315
+ "type": "text",
316
+ "text": "Zero-shot Evaluation on MSR-VTT. For the MSR-VTT dataset, we conduct our evaluation by randomly selecting one caption per video from the official test set, resulting in a total of 2,990 videos. We assess the text-video semantic similarity using the clip similarity (CLIPSIM) metric. To compute CLIPSIM, we calculate the clip text-image similarity for each frame, considering the given text prompts, and then calculate the average score. In this evaluation, we employ the ViT-B32 clip model as the backbone, following the methodology outlined in previous work (Blattmann et al., 2023) to ensure a fair comparison. Our experimental setup and details are consistent with the previous work. The results demonstrate that LaVie achieves superior or competitive performance compared to state-of-the-art methods, highlighting the effectiveness of our proposed training scheme and the utilization of the Vimeo25M dataset. These findings underscore the efficacy of our approach in capturing text-video semantic similarity. ",
317
+ "page_idx": 7
318
+ },
319
+ {
320
+ "type": "text",
321
+ "text": "Human Evaluation. Deviating from previous methods that primarily focus on evaluating general video quality, we contend that a more nuanced assessment is necessary to comprehensively evaluate the generated videos from various perspectives. In light of this, we compare our method with two existing approaches, VideoCrafter and ModelScope, leveraging the accessibility of their testing platforms. To conduct a thorough evaluation, we enlist the assistance of 30 human raters and employ two types of assessments. Firstly, we ask the raters to compare pairs of videos in three different scenarios: ours v.s. ModelScope, ours v.s. VideoCrafter, and ModelScope v.s. VideoCrafter. Raters are instructed to evaluate the overall video quality to vote which video in the pair has better quality. Secondly, we request raters to evaluate each video individually using five pre-defined metrics: motion smoothness, motion reasonableness, subject consistency, background consistency, and face, body, and hand quality. Raters are required to assign one of three labels, “good”, “normal”, or “bad” for each metric. All human studies are conducted without time limitations. ",
322
+ "page_idx": 7
323
+ },
324
+ {
325
+ "type": "text",
326
+ "text": "As presented in Tab. 3 and Tab. 4, our proposed method surpasses the other two approaches, achieving the highest preference among human raters. However, it is worth noting that all three approaches struggle to achieve a satisfactory score in terms of “motion smoothness” indicating the ongoing challenge of generating coherent and realistic motion. Furthermore, producing high-quality face, body, and hand visuals remains challenging. ",
327
+ "page_idx": 7
328
+ },
329
+ {
330
+ "type": "table",
331
+ "img_path": "images/ddc6fc3ba0f2a5289a61e54724b3e561b89e67d4f302b5da25938ff5f97d2b37.jpg",
332
+ "table_caption": [
333
+ "Table 3: Human Preference on video quality. "
334
+ ],
335
+ "table_footnote": [],
336
+ "table_body": "<table><tr><td>Metrics</td><td>Ours &gt;ModelScope</td><td>Ours &gt;VideoCrafter</td><td>ModelScope&gt;VideoCrafter</td></tr><tr><td>Video quality</td><td>75.00%</td><td>75.58%</td><td>59.10%</td></tr></table>",
337
+ "page_idx": 7
338
+ },
339
+ {
340
+ "type": "table",
341
+ "img_path": "images/bac782bac5026cc5317d3d8b745460e25f107c952d8681099753e38ee54b1db6.jpg",
342
+ "table_caption": [
343
+ "Table 4: Human Evaluation on five pre-defined metrics. Each number signifies the proportion of examiners who voted for a particular category (good, normal, or bad) out of all votes. "
344
+ ],
345
+ "table_footnote": [],
346
+ "table_body": "<table><tr><td rowspan=\"2\">Metrics</td><td colspan=\"3\">VideoCraft</td><td colspan=\"3\">ModelScope</td><td colspan=\"3\">Ours</td></tr><tr><td>Bad</td><td>Normal</td><td>Good</td><td>Bad</td><td>Normal</td><td>Good</td><td>Bad</td><td>Normal</td><td>Good</td></tr><tr><td>Motion Smoothness</td><td>0.24</td><td>0.58</td><td>0.18</td><td>0.16</td><td>0.53</td><td>0.31</td><td>0.20</td><td>0.45</td><td>0.35</td></tr><tr><td>Motion Reasonableness</td><td>0.53</td><td>0.33</td><td>0.14</td><td>0.37</td><td>0.40</td><td>0.22</td><td>0.40</td><td>0.32</td><td>0.27</td></tr><tr><td>Subject Consistency</td><td>0.25</td><td>0.40</td><td>0.35</td><td>0.18</td><td>0.34</td><td>0.48</td><td>0.15</td><td>0.26</td><td>0.58</td></tr><tr><td>Background Consistency</td><td>0.10</td><td>0.40</td><td>0.50</td><td>0.08</td><td>0.28</td><td>0.63</td><td>0.06</td><td>0.22</td><td>0.72</td></tr><tr><td>Face/Body/Hand quality</td><td>0.69</td><td>0.24</td><td>0.06</td><td>0.51</td><td>0.31</td><td>0.18</td><td>0.46</td><td>0.30</td><td>0.24</td></tr></table>",
347
+ "page_idx": 7
348
+ },
349
+ {
350
+ "type": "text",
351
+ "text": "4.4 MORE APPLICATIONS ",
352
+ "text_level": 1,
353
+ "page_idx": 7
354
+ },
355
+ {
356
+ "type": "text",
357
+ "text": "In this section, we present two applications to showcase the capabilities of our pretrained models in downstream tasks: 1) long video generation, and 2) personalized video generation using LaVie. ",
358
+ "page_idx": 7
359
+ },
360
+ {
361
+ "type": "image",
362
+ "img_path": "images/e110645a8a96d2ac3b525794baa9d77c72c0c2860128e674982fd84155c3ea41.jpg",
363
+ "image_caption": [
364
+ "A car moving on an empty street, rainy evening, Van Gogh painting. $[ 4 \\mathrm { \\sim } 6 \\mathrm { { s } ] }$ ",
365
+ "Figure 6: Long video generation. By employing autoregressive generation three times consecutively, we successfully extend the video length of our base model from 2s to 6s. "
366
+ ],
367
+ "image_footnote": [],
368
+ "page_idx": 8
369
+ },
370
+ {
371
+ "type": "text",
372
+ "text": "Long video generation. To extend the video generation beyond a single sequence, we propose a simple recursive method. Similar to the temporal interpolation network, we incorporate the first frame of a video into the input layer of a UNet. By fine-tuning the base model accordingly, we enable the utilization of the last frame of the generated video as a conditioning input during inference. This recursive approach allows us to generate an extended video sequence. Fig. 6 showcases the results of generating tens of video frames (excluding frame interpolation) using this recursive manner, applied five times. The results demonstrate that the quality of the generated video remains high, with minimal degradation in video quality. This reaffirms the effectiveness of our base model in generating visually appealing frames. ",
373
+ "page_idx": 8
374
+ },
375
+ {
376
+ "type": "text",
377
+ "text": "Personalized video generation. Although our approach is primarily designed for general text-tovideo generation, we demonstrate its versatility by adapting it to personalized video data through the integration of a personalized image generation approach, such as LoRA (Hu et al., 2022). In this adaptation, we fine-tune the spatial layers of our model using LoRA on self-collected images, while keeping the temporal modules frozen. As depicted in Fig. 14, the personalized video model for “Misaka Mikoto” is created after the fine-tuning process. The model is capable of synthesizing personalized videos based on various prompts. For instance, by providing the prompt “Misaka Mikoto walking in the city”, the model successfully generates scenes where “Misaka Mikoto” is depicted in novel places. ",
378
+ "page_idx": 8
379
+ },
380
+ {
381
+ "type": "text",
382
+ "text": "5 CONCLUSION ",
383
+ "text_level": 1,
384
+ "page_idx": 8
385
+ },
386
+ {
387
+ "type": "text",
388
+ "text": "In this paper, we present LaVie, a text-to-video foundation model that produces high-quality and temporally coherent results. Our approach leverages a cascade of video diffusion models, extending a pre-trained LDM with simple designed temporal modules enhanced by Rotary Position Encoding (RoPE). To facilitate the generation of high-quality and diverse content, we introduce Vimeo25M, a novel and extensive video-text dataset that offers higher resolutions and improved aesthetics scores. By jointly fine-tuning on both image and video datasets, LaVie demonstrates a remarkable capacity to compose various concepts, including styles, characters, and scenes. We conduct comprehensive quantitative and qualitative evaluations for zero-shot text-to-video generation, which convincingly validate the superiority of our method over state-of-the-art approaches. Furthermore, we showcase the versatility of our pre-trained base model in long video generation and personalized video generation, which serve as additional evidence of the effectiveness and flexibility of LaVie. ",
389
+ "page_idx": 8
390
+ },
391
+ {
392
+ "type": "text",
393
+ "text": "ETHIC STATEMENT ",
394
+ "text_level": 1,
395
+ "page_idx": 9
396
+ },
397
+ {
398
+ "type": "text",
399
+ "text": "We acknowledge the ethical concerns that are shared with other T2I and T2V diffusion models. We aim to synthesize high-quality videos by giving text descriptions. Our approach can be used for movie production, making video games, artistic creation, generating synthetic data for other computer vision tasks, etc. We note that our framework has the potential to introduce unintended bias as a result of the training data. ",
400
+ "page_idx": 9
401
+ },
402
+ {
403
+ "type": "text",
404
+ "text": "REPRODUCIBILITY STATEMENT ",
405
+ "text_level": 1,
406
+ "page_idx": 9
407
+ },
408
+ {
409
+ "type": "text",
410
+ "text": "We intend to open-source our code, collected Vimeo25M dataset, as well as trained models. ",
411
+ "page_idx": 9
412
+ },
413
+ {
414
+ "type": "text",
415
+ "text": "REFERENCES ",
416
+ "text_level": 1,
417
+ "page_idx": 9
418
+ },
419
+ {
420
+ "type": "text",
421
+ "text": "Max Bain, Arsha Nagrani, Gul Varol, and Andrew Zisserman. Frozen in time: A joint video and ¨ image encoder for end-to-end retrieval. In ICCV, 2021. \nYogesh Balaji, Seungjun Nah, Xun Huang, Arash Vahdat, Jiaming Song, Karsten Kreis, Miika Aittala, Timo Aila, Samuli Laine, Bryan Catanzaro, et al. ediffi: Text-to-image diffusion models with an ensemble of expert denoisers. arXiv preprint arXiv:2211.01324, 2022. \nYoshua Bengio, Jer´ ome Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ˆ Proceedings of the 26th annual international conference on machine learning, 2009. \nSarthak Bhagat, Shagun Uppal, Zhuyun Yin, and Nengli Lim. Disentangling multiple features in video sequences using gaussian processes in variational autoencoders. In ECCV, 2020. \nAndreas Blattmann, Robin Rombach, Huan Ling, Tim Dockhorn, Seung Wook Kim, Sanja Fidler, and Karsten Kreis. Align your latents: High-resolution video synthesis with latent diffusion models. In CVPR, 2023. \nAndrew Brock, Jeff Donahue, and Karen Simonyan. Large scale GAN training for high fidelity natural image synthesis. In ICLR, 2019. \nTim Brooks, Janne Hellsten, Miika Aittala, Ting-Chun Wang, Timo Aila, Jaakko Lehtinen, Ming-Yu Liu, Alexei A Efros, and Tero Karras. Generating long videos of dynamic scenes. 2022. \nJoao Carreira and Andrew Zisserman. Quo vadis, action recognition? a new model and the kinetics dataset. In CVPR, 2017. \nKelvin C.K. Chan, Shangchen Zhou, Xiangyu Xu, and Chen Change Loy. BasicVSR $^ { + + }$ : Improving video super-resolution with enhanced propagation and alignment. In CVPR, 2022a. \nKelvin C.K. Chan, Shangchen Zhou, Xiangyu Xu, and Chen Change Loy. Investigating tradeoffs in real-world video super-resolution. In CVPR, 2022b. \nHaoran Chen, Jianmin Li, Simone Frintrop, and Xiaolin Hu. The msr-video to text dataset with clean annotations. arXiv preprint arXiv:2102.06448, 2021. \nAidan Clark, Jeff Donahue, and Karen Simonyan. Adversarial video generation on complex datasets. arXiv preprint arXiv:1907.06571, 2019. \nYatin Dandi, Aniket Das, Soumye Singhal, Vinay Namboodiri, and Piyush Rai. Jointly trained image and video generation using residual vectors. In WACV, 2020. \nEmily L Denton and vighnesh Birodkar. Unsupervised learning of disentangled representations from video. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), NeurIPS, 2017. \nPatrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In CVPR, 2021. \nSongwei Ge, Thomas Hayes, Harry Yang, Xi Yin, Guan Pang, David Jacobs, Jia-Bin Huang, and Devi Parikh. Long video generation with time-agnostic vqgan and time-sensitive transformer. In ECCV, 2022. \nSongwei Ge, Seungjun Nah, Guilin Liu, Tyler Poon, Andrew Tao, Bryan Catanzaro, David Jacobs, Jia-Bin Huang, Ming-Yu Liu, and Yogesh Balaji. Preserve your own correlation: A noise prior for video diffusion models. arXiv preprint arXiv:2305.10474, 2023. \nIan Goodfellow, Yoshua Bengio, Aaron Courville, and Yoshua Bengio. Deep learning, volume 1. MIT Press, 2016. \nYingqing He, Tianyu Yang, Yong Zhang, Ying Shan, and Qifeng Chen. Latent video diffusion models for high-fidelity long video generation. 2022. \nJonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020. \nJonathan Ho, William Chan, Chitwan Saharia, Jay Whang, Ruiqi Gao, Alexey Gritsenko, Diederik P Kingma, Ben Poole, Mohammad Norouzi, David J Fleet, et al. Imagen video: High definition video generation with diffusion models. arXiv preprint arXiv:2210.02303, 2022a. \nJonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J Fleet. Video diffusion models. arXiv preprint arXiv:2204.03458, 2022b. \nWenyi Hong, Ming Ding, Wendi Zheng, Xinghan Liu, and Jie Tang. Cogvideo: Large-scale pretraining for text-to-video generation via transformers. In The Eleventh International Conference on Learning Representations, 2023. \nEdward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. In ICLR, 2022. \nZiqi Huang, Kelvin C.K. Chan, Yuming Jiang, and Ziwei Liu. Collaborative diffusion for multimodal face generation and editing. In CVPR, 2023. \nYuming Jiang, Kelvin CK Chan, Xintao Wang, Chen Change Loy, and Ziwei Liu. Robust referencebased super-resolution via c2-matching. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2103–2112, 2021a. \nYuming Jiang, Ziqi Huang, Xingang Pan, Chen Change Loy, and Ziwei Liu. Talk-to-edit: Finegrained facial editing via dialog. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 13799–13808, 2021b. \nYuming Jiang, Kelvin CK Chan, Xintao Wang, Chen Change Loy, and Ziwei Liu. Reference-based image and video super-resolution via $c ^ { 2 }$ -matching. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2022. \nYuming Jiang, Shuai Yang, Tong Liang Koh, Wayne Wu, Chen Change Loy, and Ziwei Liu. Text2performer: Text-driven human video generation. arXiv preprint arXiv:2303.13495, 2023. \nTero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In CVPR, 2019. \nTero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of StyleGAN. In CVPR, 2020. \nDiederik P. Kingma and Max Welling. Auto-encoding variational bayes. In ICLR, 2014. \nKunChang Li, Yinan He, Yi Wang, Yizhuo Li, Wenhai Wang, Ping Luo, Yali Wang, Limin Wang, and Yu Qiao. Videochat: Chat-centric video understanding, 2023. \nYingzhen Li and Stephan Mandt. Disentangled sequential autoencoder. ICML, 2018. \nZhengxiong Luo, Dayou Chen, Yingya Zhang, Yan Huang, Liangsheng Wang, Yujun Shen, Deli Zhao, Jinren Zhou, and Tien-Ping Tan. Videofusion: Decomposed diffusion models for highquality video generation. 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. \nRon Mokady, Amir Hertz, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. Null-text inversion for editing real images using guided diffusion models. arXiv preprint arXiv:2211.09794, 2022. \nAlexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In ICML, 2021. \nGaurav Parmar, Krishna Kumar Singh, Richard Zhang, Yijun Li, Jingwan Lu, and Jun-Yan Zhu. Zero-shot image-to-image translation. In ACM SIGGRAPH 2023 Conference Proceedings, 2023. \nAlec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015. \nAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, 2021. \nColin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. The Journal of Machine Learning Research, 2020. \nAditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In ICML, 2021. \nAditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022. \nRobin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High- ¨ resolution image synthesis with latent diffusion models. In CVPR, 2022. \nChitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement. IEEE Transactions on Pattern Analysis and Machine Intelligence. \nChitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. NeurIPS, 2022. \nMasaki Saito, Eiichi Matsumoto, and Shunta Saito. Temporal generative adversarial nets with singular value clipping. In ICCV, 2017. \nChristoph Schuhmann, Romain Beaumont, Richard Vencu, Cade Gordon, Ross Wightman, Mehdi Cherti, Theo Coombes, Aarush Katta, Clayton Mullis, Mitchell Wortsman, et al. Laion-5b: An open large-scale dataset for training next generation image-text models. Advances in Neural Information Processing Systems, 2022. \nUriel Singer, Adam Polyak, Thomas Hayes, Xi Yin, Jie An, Songyang Zhang, Qiyuan Hu, Harry Yang, Oron Ashual, Oran Gafni, Devi Parikh, Sonal Gupta, and Yaniv Taigman. Make-a-video: Text-to-video generation without text-video data. In ICLR, 2023. \nIvan Skorokhodov, Sergey Tulyakov, and Mohamed Elhoseiny. Stylegan-v: A continuous video generator with the price, image quality and perks of stylegan2. In CVPR, 2022. \nJiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2021a. URL https://openreview.net/ forum?id ${ \\underline { { \\underline { { \\mathbf { \\Pi } } } } } } =$ St1giarCHLP. \nYang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In ICLRs, 2021b. \nKhurram Soomro, Amir Roshan Zamir, and Mubarak Shah. Ucf101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402, 2012. \nJianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864, 2021. \nYu Tian, Jian Ren, Menglei Chai, Kyle Olszewski, Xi Peng, Dimitris N. Metaxas, and Sergey Tulyakov. A good image generator is what you need for high-resolution video synthesis. In ICLR, 2021. \nHugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee´ Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and \\` efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023. \nSergey Tulyakov, Ming-Yu Liu, Xiaodong Yang, and Jan Kautz. MoCoGAN: Decomposing motion and content for video generation. In CVPR, 2018. \nAaron Van Den Oord, Oriol Vinyals, et al. Neural discrete representation learning. NeurIPS, 2017. \nCarl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. In NIPS, 2016. \nJianyi Wang, Zongsheng Yue, Shangchen Zhou, Kelvin CK Chan, and Chen Change Loy. Exploiting diffusion prior for real-world image super-resolution. arXiv preprint arXiv:2305.07015, 2023a. \nJiuniu Wang, Hangjie Yuan, Dayou Chen, Yingya Zhang, Xiang Wang, and Shiwei Zhang. Modelscope text-to-video technical report. arXiv preprint arXiv:2308.06571, 2023b. \nYaohui Wang. Learning to Generate Human Videos. Theses, Inria - Sophia Antipolis ; Universite´ Cote d’Azur, September 2021. \nYaohui WANG, Piotr Bilinski, Francois Bremond, and Antitza Dantcheva. Imaginator: Conditional spatio-temporal gan for video generation. In WACV, 2020. \nYaohui Wang, Piotr Bilinski, Francois Bremond, and Antitza Dantcheva. G3AN: Disentangling appearance and motion for video generation. In CVPR, 2020. \nYaohui Wang, Francois Bremond, and Antitza Dantcheva. Inmodegan: Interpretable motion decomposition generative adversarial network for video generation. arXiv preprint arXiv:2101.03049, 2021. \nChenfei Wu, Lun Huang, Qianxi Zhang, Binyang Li, Lei Ji, Fan Yang, Guillermo Sapiro, and Nan Duan. Godiva: Generating open-domain videos from natural descriptions. arXiv preprint arXiv:2104.14806, 2021. \nChenfei Wu, Jian Liang, Lei Ji, Fan Yang, Yuejian Fang, Daxin Jiang, and Nan Duan. Nuwa: Visual ¨ synthesis pre-training for neural visual world creation. In European conference on computer vision, 2022. \nJianwen Xie, Ruiqi Gao, Zilong Zheng, Song-Chun Zhu, and Ying Nian Wu. Motion-based generator model: Unsupervised disentanglement of appearance, trackable and intrackable motions in dynamic patterns. In AAAI, 2020. \nWilson Yan, Yunzhi Zhang, Pieter Abbeel, and Aravind Srinivas. Videogpt: Video generation using vq-vae and transformers. arXiv preprint arXiv:2104.10157, 2021. \nSihyun Yu, Jihoon Tack, Sangwoo Mo, Hyunsu Kim, Junho Kim, Jung-Woo Ha, and Jinwoo Shin. Generating videos with dynamics-aware implicit generative adversarial networks. In ICLR, 2022. \nLvmin Zhang and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models, 2023. \nQihang Zhang, Ceyuan Yang, Yujun Shen, Yinghao Xu, and Bolei Zhou. Towards smooth video composition. 2022. \nDaquan Zhou, Weimin Wang, Hanshu Yan, Weiwei Lv, Yizhe Zhu, and Jiashi Feng. Magicvideo: Efficient video generation with latent diffusion models. arXiv preprint arXiv:2211.11018, 2022a. \nShangchen Zhou, Jiawei Zhang, Wangmeng Zuo, and Chen Change Loy. Cross-scale internal graph neural network for image super-resolution. In NeurIPS, 2020. \nShangchen Zhou, Kelvin Chan, Chongyi Li, and Chen Change Loy. Towards robust blind face restoration with codebook lookup transformer. In NeurIPS, 2022b. ",
422
+ "page_idx": 9
423
+ },
424
+ {
425
+ "type": "text",
426
+ "text": "",
427
+ "page_idx": 10
428
+ },
429
+ {
430
+ "type": "text",
431
+ "text": "",
432
+ "page_idx": 11
433
+ },
434
+ {
435
+ "type": "text",
436
+ "text": "",
437
+ "page_idx": 12
438
+ },
439
+ {
440
+ "type": "text",
441
+ "text": "A RELATED WORK ",
442
+ "text_level": 1,
443
+ "page_idx": 13
444
+ },
445
+ {
446
+ "type": "text",
447
+ "text": "Unconditional video generation endeavors to generate videos by comprehensively learning the underlying distribution of the training dataset. Previous works have leveraged various types of deep generative models, including GANs (Goodfellow et al., 2016; Radford et al., 2015; Brock et al., 2019; Karras et al., 2019; 2020; Vondrick et al., 2016; Saito et al., 2017; Tulyakov et al., 2018; WANG et al., 2020; Wang et al., 2020; Wang, 2021; Wang et al., 2021; Clark et al., 2019; Brooks et al., 2022; Yu et al., 2022; Skorokhodov et al., 2022; Tian et al., 2021; Zhang et al., 2022; Dandi et al., 2020), VAEs (Kingma & Welling, 2014; Denton & Birodkar, 2017; Li & Mandt, 2018; Bhagat et al., 2020; Xie et al., 2020), and VQ-based models (Van Den Oord et al., 2017; Esser et al., 2021; Yan et al., 2021; Ge et al., 2022; Jiang et al., 2023). Recently, a notable advancement in video generation has been observed with the emergence of Diffusion Models (DMs) (Ho et al., 2020; Song et al., 2021a; Nichol & Dhariwal, 2021), which have demonstrated remarkable progress in image synthesis (Ramesh et al., 2021; 2022; Rombach et al., 2022). Building upon this success, several recent works (Ho et al., 2022b; He et al., 2022) have explored the application of DMs for video generation. These works showcase the promising capability of DMs to model complex video distributions by integrating spatio-temporal operations into image-based models, surpassing previous approaches in terms of video quality. However, learning the entire distribution of video datasets in an unconditional manner remains highly challenging. The entanglement of spatial and temporal content poses difficulties, making it still arduous to obtain satisfactory results. ",
448
+ "page_idx": 13
449
+ },
450
+ {
451
+ "type": "text",
452
+ "text": "Text-to-video generation, as a form of conditional video generation, focuses on the synthesis of high-quality videos using text descriptions as conditioning inputs. Existing approaches primarily extend text-to-image models by incorporating temporal modules, such as temporal convolutions and temporal attention, to establish temporal correlations between video frames. Notably, Make-AVideo (Singer et al., 2023) and Imagen Video (Ho et al., 2022a) are developed based on DALL·E2 (Ramesh et al., 2022) and Imagen (Saharia et al., 2022), respectively. PYoCo (Ge et al., 2023) proposed a noise prior approach and leverage a pre-trained eDiff-I (Balaji et al., 2022) as initialization. Conversely, other works (Blattmann et al., 2023; Zhou et al., 2022a; He et al., 2022) build upon Stable Diffusion (Rombach et al., 2022) owing to the accessibility of pre-trained models. In terms of training strategies, one approach involves training the entire model from scratch (Ho et al., 2022a; Singer et al., 2023) on both image and video data. Although this method can yield high-quality results by learning from both image and video distributions, it demands significant computational resources and entails lengthy optimization. Another approach is to construct the Text-to-Video (T2V) model based on pre-trained Stable Diffusion and subsequently fine-tune the model either entirely (Zhou et al., 2022a; He et al., 2022) or partially (Blattmann et al., 2023) on video data. These approaches aim to leverage the benefits of large-scale pre-trained T2I models to expedite convergence. However, we posit that relying exclusively on video data may not yield satisfactory results due to the substantial distribution gap between video and image datasets, potentially leading to challenges such as catastrophic forgetting. In contrast to prior works, our approach distinguishes itself by augmenting a pre-trained Stable Diffusion model with an efficient temporal module and jointly fine-tuning the entire model on both image and video datasets. ",
453
+ "page_idx": 13
454
+ },
455
+ {
456
+ "type": "text",
457
+ "text": "B VIMEO25M DATASET STATISTICS ",
458
+ "text_level": 1,
459
+ "page_idx": 13
460
+ },
461
+ {
462
+ "type": "text",
463
+ "text": "The statistics of the Vimeo25M dataset, including the distribution of video categories, the duration of video segments, and the length of captions, are presented in Fig. 8. The dataset demonstrates a diverse range of categories, with a relatively balanced quantity among the majority of categories. Moreover, most videos in the dataset have captions consisting of approximately 10 words. ",
464
+ "page_idx": 13
465
+ },
466
+ {
467
+ "type": "text",
468
+ "text": "Furthermore, we conducted a comparison of the aesthetics score between the Vimeo25M dataset and the WebVid10M dataset. As illustrated in Fig. 9 (a), approximately $1 6 . 8 9 \\%$ of the videos in Vimeo25M received a higher aesthetics score (greater than 6), surpassing the $7 . 2 2 \\%$ in WebVid10M. In the score range between 4 and 6, Vimeo25M achieved a percentage of $7 9 . 1 2 \\%$ , which is also superior to the $7 2 . { \\bar { 5 } } 8 \\%$ in WebVid10M. Finally, Fig. 9 (b) depicts a comparison of the spatial resolution between the Vimeo25M and WebVid10M datasets. It is evident that the majority of videos in the Vimeo25M dataset possess a higher resolution than those in WebVid10M, thereby ensuring that the generated results exhibit enhanced quality. ",
469
+ "page_idx": 13
470
+ },
471
+ {
472
+ "type": "image",
473
+ "img_path": "images/6b76798b7e542786b012ce0f0c7e226a02e2549dc21d17ce16e1d5106d9a8d58.jpg",
474
+ "image_caption": [
475
+ "(c) A sunset with clouds in the sky. "
476
+ ],
477
+ "image_footnote": [],
478
+ "page_idx": 14
479
+ },
480
+ {
481
+ "type": "image",
482
+ "img_path": "images/03b6ad0972a0f26db07c336a1e814928f346b6dde374b0bf0ae12ed36f50b1a3.jpg",
483
+ "image_caption": [
484
+ "Figure 7: We show three video examples as well as text descriptions from Vimeo25M dataset. "
485
+ ],
486
+ "image_footnote": [],
487
+ "page_idx": 14
488
+ },
489
+ {
490
+ "type": "image",
491
+ "img_path": "images/4f56387e4ea85d386d34ced99924594507b9aafdda4971365943540334633d47.jpg",
492
+ "image_caption": [
493
+ "Figure 8: Vimeo25M general information statistics. We show statistics of video categories, clip durations, and caption word lengths in Vimeo25M. ",
494
+ "Figure 9: Aesthetics score, video scale statistics. We compare Vimeo25M with WebVid10M in terms of (a) aesthetics score and (b) video spatial resolution. "
495
+ ],
496
+ "image_footnote": [],
497
+ "page_idx": 14
498
+ },
499
+ {
500
+ "type": "text",
501
+ "text": "C IMPLEMENTATION DETAILS ",
502
+ "text_level": 1,
503
+ "page_idx": 14
504
+ },
505
+ {
506
+ "type": "text",
507
+ "text": "The Autoencoder and LDM of Base T2V model is initialized from a pretrained Stable Diffusion 1.4. Prior to training, we preprocess each video to a resolution of $3 2 0 \\times 5 1 2$ and train using 16 frames per video clip. Additionally, we concatenate 4 images to each video for joint image-video fine-tuning. To facilitate the fine-tuning process, we employ curriculum learning (Bengio et al., 2009). In the initial stage, we utilize WebVid10M as the primary video data source, along with Laion5B, as the content within these videos is relatively simpler compared to the other dataset. Subsequently, we gradually introduce Vimeo25M to train the model on more complex scenes, subjects, and motion. ",
508
+ "page_idx": 14
509
+ },
510
+ {
511
+ "type": "text",
512
+ "text": "Temporal Interpolation model is initialized from our pretrained base T2V model. In order to accommodate our concatenated inputs of high and low frame-rate frames, we extend the architecture by incorporating an additional convolutional layer. During training, we utilize WebVid10M as the primary dataset. In the later stages of training, we gradually introduce Vimeo25M, which allows us to leverage its watermark-free videos, thus assisting in eliminating watermarks in the interpolated output. While patches of dimensions $2 5 6 \\times 2 5 6$ are utilized during training, the trained model can successfully interpolate base videos at a resolution of $3 2 0 \\times 5 1 2$ during inference. ",
513
+ "page_idx": 15
514
+ },
515
+ {
516
+ "type": "text",
517
+ "text": "The spatial layers of our VSR model is initialized from the pre-trained diffusion-based image $\\times 4$ upscaler, keeping these layers fixed throughout training. Only the newly inserted temporal layers, including temporal attention and 3D CNN layers, are trained. Similar to the base model, we employ the WebVid10M and Laion5B (with resolution $\\geq 1 0 2 4 ,$ ) datasets for joint image-video training. To facilitate this, we transform the image data into video clips by applying random translations to simulate handheld camera movements. For training purposes, all videos and images are cropped into patches of size $3 2 0 \\times 3 2 0$ . Once trained, the model can effectively process videos of arbitrary sizes, offering enhanced results. ",
518
+ "page_idx": 15
519
+ },
520
+ {
521
+ "type": "text",
522
+ "text": "D FURTHER ANALYSIS ",
523
+ "text_level": 1,
524
+ "page_idx": 15
525
+ },
526
+ {
527
+ "type": "text",
528
+ "text": "In this section, we conduct a qualitative analysis of the training scheme employed in our experiments. We compare our joint image-video fine-tuning approach with two other experimental settings: 1) fine-tuning the entire UNet architecture based on WebVid10M, and 2) training temporal modules while keeping the rest of the network frozen. The results, depicted in Fig. 10, highlight the advantages of our proposed approach. When fine-tuning the entire model on video data, we observe a phenomenon known as catastrophic forgetting. The concept of “teddy bear” gradually diminishes and the quality of its representation deteriorates significantly. Since the training videos contain very few instances of “teddy bear”, the model gradually adapts to the new data distribution, resulting in a loss of prior knowledge. In the second setting, we encounter difficulties in aligning the spatial knowledge from the image dataset with the newly learned temporal information from the video dataset. The significant distribution gap between the image and video datasets poses a challenge in effectively integrating the spatial and temporal aspects. The attempts made by the high-level temporal modules to modify the spatial distribution adversely affect the quality of the generated videos. In contrast, our proposed joint image-video fine-tuning approach effectively learns the joint distribution of image and video data. This enables the model to recall knowledge from the image dataset and apply the learned motion from the video dataset, resulting in higher-quality synthesized videos. The ability to leverage both datasets enhances the overall performance and quality of the generated results. ",
529
+ "page_idx": 15
530
+ },
531
+ {
532
+ "type": "image",
533
+ "img_path": "images/ca611341629f1e68b7b69b6c24ad605c904ef85ee6a2b8263f2ba0069e3e63de.jpg",
534
+ "image_caption": [
535
+ "Figure 10: Training scheme comparison. We show image results based on (a) training the entire model, (b) training temporal modules, and (c) joint image-video fine-tuning, respectively. "
536
+ ],
537
+ "image_footnote": [],
538
+ "page_idx": 15
539
+ },
540
+ {
541
+ "type": "text",
542
+ "text": "E LIMITATIONS ",
543
+ "text_level": 1,
544
+ "page_idx": 15
545
+ },
546
+ {
547
+ "type": "text",
548
+ "text": "While LaVie has demonstrated impressive results in general text-to-video generation, we acknowledge the presence of certain limitations. In this section, we highlight two specific challenges which are shown in Fig. 11: ",
549
+ "page_idx": 15
550
+ },
551
+ {
552
+ "type": "text",
553
+ "text": "Multi-subject generation: Our models encounter difficulties when generating scenes involving more than two subjects, such as “Albert Einstein discussing an academic paper with Spiderman”. There are instances where the model tends to mix the appearances of Albert Einstein and Spiderman, ",
554
+ "page_idx": 15
555
+ },
556
+ {
557
+ "type": "text",
558
+ "text": "(a) Albert Einstein discussing an academic paper with Spiderman. ",
559
+ "page_idx": 16
560
+ },
561
+ {
562
+ "type": "image",
563
+ "img_path": "images/d9890b16c03189c07b2c994e38631eb752301804a2c192bf13ab0af80bf84941.jpg",
564
+ "image_caption": [
565
+ "(b) Albert Einstein playing the violin. ",
566
+ "Figure 11: Limitations. We show limitations on (a) mutiple-object generation and (b) failure of hands generation "
567
+ ],
568
+ "image_footnote": [],
569
+ "page_idx": 16
570
+ },
571
+ {
572
+ "type": "text",
573
+ "text": "instead of generating distinct individuals. We have observed that this issue is also prevalent in the T2I model (Rombach et al., 2022). One potential solution for improvement involves replacing the current language model, CLIP (Radford et al., 2021), with a more robust language understanding model like T5 (Raffel et al., 2020). This substitution could enhance the model’s ability to accurately comprehend and represent complex language descriptions, thereby mitigating the mixing of subjects in multi-subject scenarios. ",
574
+ "page_idx": 16
575
+ },
576
+ {
577
+ "type": "text",
578
+ "text": "Hands generation: Generating human bodies with high-quality hands remains a challenging task. The model often struggles to accurately depict the correct number of fingers, leading to less realistic hand representations. A potential solution to address this issue involves training the model on a larger and more diverse dataset containing videos with human subjects. By exposing the model to a wider range of hand appearances and variations, it could learn to generate more realistic and anatomically correct hands. ",
579
+ "page_idx": 16
580
+ },
581
+ {
582
+ "type": "image",
583
+ "img_path": "images/b32e504cc5ed31d78ecf2cd66518eca865ccd02d1ef58c658b304b8f30b17e88.jpg",
584
+ "image_caption": [],
585
+ "image_footnote": [],
586
+ "page_idx": 17
587
+ },
588
+ {
589
+ "type": "image",
590
+ "img_path": "images/d2765cfdbd0e74a7a3a7c7d62be5c9f7f3b79267396065e1ff0353e4d9931f05.jpg",
591
+ "image_caption": [
592
+ "The Bund, Shanghai, with the ship moving on the river, oil painting. "
593
+ ],
594
+ "image_footnote": [],
595
+ "page_idx": 17
596
+ },
597
+ {
598
+ "type": "image",
599
+ "img_path": "images/eaf3f80e20913515c33f4c284d8df1fbec648e9dadf14b424cf55c9b391acbd6.jpg",
600
+ "image_caption": [
601
+ "The Roman Colosseum with a huge crowd of people, lightning, volumetric light, highly detailed. "
602
+ ],
603
+ "image_footnote": [],
604
+ "page_idx": 17
605
+ },
606
+ {
607
+ "type": "image",
608
+ "img_path": "images/5b3392ac28a6273d4bd432d2d6b8802ac461aa71f8f6ece3688090c825c04b5b.jpg",
609
+ "image_caption": [
610
+ "A jellyfish floating through the ocean, with bioluminescent tentacles. "
611
+ ],
612
+ "image_footnote": [],
613
+ "page_idx": 17
614
+ },
615
+ {
616
+ "type": "image",
617
+ "img_path": "images/0e034e101cf1a32f1ae6f791ebac87969367f2af511d28ce7c3511438fdb02b5.jpg",
618
+ "image_caption": [
619
+ "A fantasy landscape, trending on artstation, 4k, high resolution. "
620
+ ],
621
+ "image_footnote": [],
622
+ "page_idx": 17
623
+ },
624
+ {
625
+ "type": "image",
626
+ "img_path": "images/e0f0c5725efbf0888067a1494eb711264e8d7fad88fdcbafd1b388105c3cc975.jpg",
627
+ "image_caption": [
628
+ "A super cool giant robot in Cyberpunk city, artstation . "
629
+ ],
630
+ "image_footnote": [],
631
+ "page_idx": 17
632
+ },
633
+ {
634
+ "type": "image",
635
+ "img_path": "images/c1119caa48351b55c35058c2e4324fd367cf0e0221d9a23579e8a0a2f42fa0ce.jpg",
636
+ "image_caption": [
637
+ "Hyper-realistic spaceship landing on mars. "
638
+ ],
639
+ "image_footnote": [],
640
+ "page_idx": 17
641
+ },
642
+ {
643
+ "type": "text",
644
+ "text": "A shark swimming in the ocean. ",
645
+ "page_idx": 17
646
+ },
647
+ {
648
+ "type": "image",
649
+ "img_path": "images/24004e844df2a83008549c90f0c64ee3b44c8b39ca8711dac805869670c11ff8.jpg",
650
+ "image_caption": [
651
+ "Figure 12: Diverse video generation results. "
652
+ ],
653
+ "image_footnote": [],
654
+ "page_idx": 17
655
+ },
656
+ {
657
+ "type": "text",
658
+ "text": "A future where humans have achieved teleportation technology . ",
659
+ "page_idx": 17
660
+ },
661
+ {
662
+ "type": "image",
663
+ "img_path": "images/39c0a3df529f6bfc5c7b4c3e1bee7d294f42917147cf75431d645db257ef3be7.jpg",
664
+ "image_caption": [],
665
+ "image_footnote": [],
666
+ "page_idx": 18
667
+ },
668
+ {
669
+ "type": "image",
670
+ "img_path": "images/3d70fe0f4ca232a15a972b24633764915e3c80d50a33e61aa55f96cb3550b173.jpg",
671
+ "image_caption": [
672
+ "Albert Einstein is reading a paper. [4∼6s] ",
673
+ "Figure 13: Long video generation. By employing autoregressive generation three times consecutively, we successfully extend the video length of our base model from 2s to 6s. "
674
+ ],
675
+ "image_footnote": [],
676
+ "page_idx": 18
677
+ },
678
+ {
679
+ "type": "image",
680
+ "img_path": "images/6bc9456d7e493e0b3826c25ead20bbf9628ef3cbac8008527b61751d7d70d4ad.jpg",
681
+ "image_caption": [
682
+ "(c) Misaka Mikoto in the space ",
683
+ "Figure 14: Personalized video generation. We show results by adopting a LoRA-based approach in our model for personalized video generation. Samples used to train our LoRA are shown in (a). We use “Misaka Mikoto” as text prompts. Results from our video LoRA are shown in (b) and (c). By inserting pre-trained temporal modules into LoRA, we are able to animate “Misaka Mikoto” and control the results by combining them with different prompts. "
684
+ ],
685
+ "image_footnote": [],
686
+ "page_idx": 19
687
+ }
688
+ ]
parse/test/p09XyFxZkc/p09XyFxZkc_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/p09XyFxZkc/p09XyFxZkc_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/rcFXg2aqEj/rcFXg2aqEj.md ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LMDX: LANGUAGE MODEL-BASED DOCUMENT INFORMATION EXTRACTION AND LOCALIZATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Large Language Models (LLM) have revolutionized Natural Language Processing (NLP), improving state-of-the-art on many existing tasks and exhibiting emergent capabilities. However, LLMs have not yet been successfully applied on semistructured document information extraction, which is at the core of many document processing workflows and consists of extracting key entities from a visually rich document (VRD) given a predefined target schema. The main obstacles to LLM adoption in that task have been the absence of layout encoding within LLMs, critical for a high quality extraction, and the lack of a grounding mechanism ensuring the answer is not hallucinated. In this paper, we introduce Language Modelbased Document Information EXtraction and Localization (LMDX), a methodology to adapt arbitrary LLMs for document information extraction. LMDX can do extraction of singular, repeated, and hierarchical entities, both with and without training data, while providing grounding guarantees and localizing the entities within the document. Finally, we apply LMDX to the PaLM 2-Small LLM and evaluate it on VRDU and CORD benchmarks, setting a new state-of-the-art and showing how LMDX enables the creation of high quality, data-efficient parsers.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The recent advent of transformers (Vaswani et al., 2017) and self-supervised pretraining procedures has led to significant progress in Visually Rich Document (VRD) Understanding. Within that field, the task of document information extraction (IE), which consists of extracting key entities within a semi-structured document (e.g. invoice, tax form, paystub, receipt, etc) given a predefined schema, has received a lot of attention from industry and academia due to its importance and wide applicability to intelligent document processing workflows. However, document information extraction still remains challenging for current generation systems. In particular, information in semi-structured forms is organized in complex layout across many possible templates, which requires understanding of the document context, spatial alignment among the different segments of text, and tabular arrangement of structured entities (e.g. line items on an invoice, deduction items on a paystub, etc.). Content on the document can be printed or handwritten, with scanning artefacts like rotation and contrast issues. Moreover, since some business automation workflows require certain level of accuracy, they are often integrated with human-in-the-loop interactions for auditing and correction of predictions, requiring knowing the precise location of extracted entities to make it a tractable task for a human rater. Finally, since a quasi-infinite number of document types exist, and that organizations have limited annotation resources, most parsers are built with very small amount of data.
12
+
13
+ From those complexities emerge the following desiderata of document information extraction systems: they should support high-quality extraction of singular, repeated, and hierarchical entities, while localizing those entities in the document, and doing so with very low or no amount of training data. So far, no publicly disclosed system has been able to address all of those desiderata.
14
+
15
+ Many current approaches divide the problem in two stages: a text recognition/serialization step, usually achieved by an off-the-shelf Optical Character Recognition (OCR) service, followed by a parsing step, which finds the relevant entity values from the recognized text. Since the text serialization is imperfect, much attention has been given to fusing the text and layout together in the parsing step (Majumder et al., 2020; Garncarek et al., 2021; Hwang et al., 2021; Katti et al., 2018; Denk & Reisswig, 2019). Hong et al. (2021) proposes to encode the relative 2D distances of text blocks in the attention of the transformer, and learning from unlabeled documents with an area-masking strategy. Lee et al. (2022) proposes encoding the relative token positions with a graph neural network with edges constructed from a beta-skeleton algorithm. It further frames information extraction as a Named Entity Recognition (NER) task with an Inside-Outside-Begin (IOB) token tagging scheme (Ramshaw & Marcus, 1995; Palm et al., 2017) which allows them to localize the entities. However, IOB does not support extracting hierarchical entities, and is not robust to text serialization errors, where an entity is broken in disjoint segments.
16
+
17
+ Since text and layout do not contain all the information in the document (e.g. table boundaries, logos), leveraging the image modality has also been extensively explored (Xu et al., 2021; Lee et al., 2023; Appalaraju et al., 2021; 2023; Zhang et al., 2022). Xu et al. (2020) uses a separate image encoder before adding the output as feature to the token encodings, while Huang et al. (2022) jointly models the page image patches alongside the tokens, using a word-patch alignment self-supervised pretraining task to learn the connection between the modalities.
18
+
19
+ Other approaches treat extraction as a sequence generation problem. Powalski et al. (2021) adds an auto-regressive decoder on top of a text-layout-image encoder, all initialized from T5 (Raffel et al., 2020). Kim et al. (2022) foregoes the text recognition step completely, using a Vision Transformer encoder with an auto-regressive decoder pretrained on a pseudo-OCR task on a large document image corpora, and finetuned on the final extraction parse tree with Extensible Markup Language (XML) tags for the target extraction schema. While this approach allows to predict hierarchical entities, it does not allow localizing entities in the document.
20
+
21
+ None of the previously discussed approaches attempt to understand the semantics of the schema and its entity types, and instead opt to encode the schema in the model weights through training, hence requiring training data for unseen schemas and document types. QueryForm (Wang et al., 2023b) utilizes a prompt encoding both the schema and entity types, allowing the model to do zero-shot extraction. Likewise, Wei et al. (2023) inputs the raw entity types in the encoder itself, and uses a scoring matrix to predict the link classes between document tokens and types, with great few-shot performance. However, both approaches are not able to predict hierarchical entities.
22
+
23
+ In parallel, Large Language Models (OpenAI, 2023; Google et al., 2023; Hoffmann et al., 2022) have revolutionized Natural Language Processing, showing the capabilities to solve a task with simply an instruction (Wei et al., 2022) or a few examples added to the prompt (Brown et al., 2020). This paradigm opens the possibility of extracting entities with very little to no training data. Wang et al. (2023a) transforms the NER task to a sequence generation task suitable for LLMs by incorporating special tokens in the sequence, marking the entity boundaries, and proposes a self-verification strategy limiting the LLM hallucinations. However, this is applicable to text-only scenarios, with hallucinations still a possibility.
24
+
25
+ This motivates us to introduce Language Model-based Document Information EXtraction and Localization (LMDX), a methodology for leveraging off-the-shelf LLMs for information extraction and localization on semi-structured documents. Our contributions can be summarized as follows:
26
+
27
+ • We propose a prompt that enables LLMs to perform the document IE task on leaf and hierarchical entities with precise localization, including without any training data, and using only the simple text-in, text-out interface that all LLMs provide.
28
+ • We also propose a layout encoding scheme that communicate spatial information to the LLM without any change to its architecture.
29
+ • We introduce a decoding algorithm transforming the LLM responses into extracted entities and their bounding boxes on the document, while discarding all hallucination.
30
+ • We systematically evaluate the data efficiency of LMDX on multiple public benchmarks and establish a new state-of-the-art on those by a wide margin, especially at low-data regimes.
31
+
32
+ A comparison of LMDX characteristics and other popular document information extraction systems can be found at Table 1.
33
+
34
+ Table 1: Comparison of document information extraction systems.
35
+
36
+ <table><tr><td>Document Information Extraction Systems</td><td>Hierarchical entity</td><td>Entity localization</td><td>Zero-shot support</td></tr><tr><td>FormNet(v2),LayoutLM(v2),Docformer, Glean,.</td><td>X</td><td>√</td><td></td></tr><tr><td>QueryForm,PPN</td><td>X</td><td>√</td><td>√</td></tr><tr><td>Donut</td><td>√</td><td>X</td><td>X</td></tr><tr><td>LMDX (Ours)</td><td>√</td><td>√</td><td>√</td></tr></table>
37
+
38
+ # 2 METHODOLOGY
39
+
40
+ # 2.1 OVERVIEW
41
+
42
+ Overall, our pipeline is divided into five stages: OCR, chunking, prompt generation, LLM inference and decoding, detailed in the following sections. An overview with a simple example can be found in Figure 1, with the input and output of each stage showcased. In this example, the target schema contains two leaf entity types retailer and subtotal, and one hierarchical entity type line_item, composed of a product_id and a product_price.
43
+
44
+ ![](images/fe6dbefaf7d339341a4a6b63c3cdc34fe4058064a7b4bf3f905841e391e50a90.jpg)
45
+ Figure 1: Overview of the LMDX methodology.
46
+
47
+ # 2.2 OPTICAL CHARACTER RECOGNITION
48
+
49
+ We first use an off-the-shelf OCR service on the document image to obtain words and lines segments, along with their corresponding spatial position (bounding box) on the document. An example of output from that stage on a sample document is given in Appendix A.6.
50
+
51
+ # 2.3 CHUNKING
52
+
53
+ While some LLMs support long context (hundreds of thousands of tokens), not all LLMs can fit the entire document within its prompt. For those cases, the document is divided into document chunks so that each is small enough to be processed by the LLM. To achieve this, we first divide the document into individual pages, then we iteratively remove the last line segments (coming from OCR) until the prompt containing this chunk is below the maximum input token length of the LLM. Lastly, we group those removed lines as a new document page, and repeat the same logic until all chunks are below the input token limit of the LLM. At the end of this optional stage, we have $N$ chunks. The decision to first divide the document by page stems from the observation that entities rarely cross page boundaries, and as such this chunking scheme will have minimal impact on the final extraction quality. The algorithm is described in pseudo-code in Appendix A.1.
54
+
55
+ # 2.4 PROMPT GENERATION
56
+
57
+ The prompt generation stage takes in the $N$ document chunks and creates a LLM prompt for each of them. As seen in Figure 2, our prompt design contains the document representation, a description of the task, and the target schema representation containing the entities to extract. XML-like tags are used to define the start and end of each component.
58
+
59
+ ![](images/040a0ccca62f240d3351bed9b754fd739b63d70d91c51d9ba41a2765e4984218.jpg)
60
+ Figure 2: Structure of the LLM prompts.
61
+
62
+ Document Representation. The chunk content is represented in the prompt as the concatenation of all its segment texts, suffixed with the coordinates of those segments in the following format: $< s e g m e n t t e x t > ~ X X | Y Y _ { s e g m e n t }$ . Coordinate tokens are built by normalizing the segment’s X and Y coordinates, and quantizing them in $B$ buckets, assigning the index of that bucket as the token for a coordinate.
63
+
64
+ This coordinate-as-tokens scheme allows us to communicate the layout modality to the LLM, without any change to its architecture. There are many variation to that scheme: using OCR line versus OCR words as segment, the granularity of the quantization, and the number of coordinates to use per segment (e.g. $[ x _ { \mathrm { c e n t e r } } , y _ { \mathrm { c e n t e r } } ]$ versus $[ x _ { \mathrm { m i n } } , y _ { \mathrm { m i n } } , x _ { \mathrm { m a x } } , y _ { \mathrm { m a x } } ] )$ . Appendix A.4 shows how those variations affect the prompt token length. In all our experiments, we use line-level segments with 2 coordinates $[ x _ { \mathrm { c e n t e r } } , y _ { \mathrm { c e n t e r } } ]$ and $B = 1 0 0$ quantization buckets.
65
+
66
+ Task Description. The task description is simply a short explanation of the task to accomplish. In our experiments, we hard code it to the following: From the document, extract the text values and tags of the following entities:.
67
+
68
+ Schema Representation. The schema is represented as a structured JSON object, where the keys are the entity types to be extracted, and the values correspond to their occurrence (single or multiple) and sub-entities (for hierarchical entities). For instance, {"foo": "", "bar": [{"baz": []}]} means that the LLM should extract only a single entity of type foo and multiple hierarchical entities of type bar, that could each hold multiple entities of type baz.
69
+
70
+ After this step, we have $N$ prompts, one for each document chunk. A full example of a prompt on a document can be found in Appendix A.6.
71
+
72
+ # 2.5 COMPLETION TARGETS
73
+
74
+ In this section, we describe the expected LLM completion format, which can be observed in Figure 1. Like the schema, the completion is a JSON structured object with the keys being the entity types, and values being the extracted information from the document chunk. JSON was chosen as a format for the completion and schema since it supports hierarchical objects, is very token-efficient, and usually present in LLMs training data mixtures. Note that the keys in the completion have the same ordering, occurrence and class (hierarchical or leaf) as the entity types in the schema. The values of leaf entities must follow a specific format:
75
+
76
+ $$
77
+ < t e x t o n s e g m e n t _ { 1 } > ~ X X | Y Y _ { s e g m e n t _ { 1 } } \backslash n < t e x t o n ~ s e g m e n t _ { 2 } > ~ X X | Y Y _ { s e g m e n t _ { 2 } } \backslash n \dots n
78
+ $$
79
+
80
+ An entity can span multiple (potentially disjoint) OCR segments (lines or words). For each segment of the entity, the value contains the entity text on that segment, along with the coordinate tokens of that segment, which act as a segment identifier, allowing us to localize the entities and ground the model prediction (e.g. making sure the extracted value is not a hallucination), as will be detailed in
81
+
82
+ Section 2.7. Finally, missing entity types are completed by the model with null for singular types, and $[ ]$ for repeated types. Samples of completions can be found in Appendix A.6.
83
+
84
+ # 2.6 LLM INFERENCE
85
+
86
+ In this stage of the pipeline, we run inference on the LLM with the $N$ prompts. For each prompt, we sample $K$ completions from the LLM (for a total of $N K$ completions for the entire document) using TopK sampling. This randomness in the sampling allows to do error correction (e.g. if a response is not valid JSON, have hallucinated segment coordinate identifier, etc), and increase the extraction quality as will be shown in further sections. Note that we still want the inference to be fully deterministic so that LMDX’s extractions are the same across two identical documents. To do so, we rely on pseudo-random sampling using a fixed seed.
87
+
88
+ # 2.7 DECODING
89
+
90
+ In this stage, we parse the raw LLM completions into structured entities and their locations.
91
+
92
+ Conversion to structured entities. We begin by parsing each model completion as a JSON object. Completions that fail to parse are discarded. For each key-value pair in the JSON object, we interpret the key as the entity type and parse the value to get the entity text and bounding box (as detailed in the next paragraph). Predicted entity types that are not in the schema are discarded. If the model unexpectedly predicts multiple values for single-occurrence entity types, we use the most frequent value as the final predicted value. Hierarchical JSON object are recursively parsed as hierarchical entities in a similar manner. This algorithm is described in pseudo-code in Appendix A.3.
93
+
94
+ Entity Value Parsing. We expect the JSON value to include both text extractions and segment identifiers for each predicted entity, as described in Section 2.5. We first parse the value into its (segment text, segment identif ier) pairs. For each pair, we look up the corresponding segment in the original document using the segment identifier and verify that the extracted text is exactly included on that segment. The entity is discarded if that verification fails, ensuring LMDX discards all LLM hallucinations. Finally, once we have the entity location on all its segments, we get the entity bounding box by computing the smallest bounding box encompassing all the OCR words included in the entity. Entity values with any segments that fail to ground (invalid entity value format, non-existent segment identifier, or non-matching segment text) in the original document are discarded. The entity value parsing algorithm is described in pseudo-code in Appendix A.2, and parsing errors rates are detailed in Appendix A.9.
95
+
96
+ Prediction Merging. We first merge the predicted entities for the same document chunk from the $K$ LLM completions through majority voting (Wang et al., 2022). For each entity type, we gather the predicted entities, including empty predictions, across the $K$ completions. The most common prediction(s) are selected as the predicted value for that entity type. We then merge the predictions among the $N$ document chunks by concatenating them to obtain the document level predictions.
97
+
98
+ Prediction Merging for hierarchical entities. For hierarchical entities, we use the entire predicted tree value from a single LLM completion, as this method best preserves the parent-child relationship predicted by the model. For each top-level hierarchical entity type, we perform majority voting on all affiliated leaf, intermediate and top-level entity types among $K$ completions as if they are flattened. We then tally the votes with equal weight to determine which completion to use for the prediction, and select the most common one for that hierarchical entity.
99
+
100
+ # 3 EVALUATION
101
+
102
+ We evaluate the methodology from section 2 on public benchmarks using the PaLM 2-Small LLM, which we call $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ . Note that we use the small version of this LLM due to limited accelerator resources, but larger versions could be used, likely leading to higher extraction quality.
103
+
104
+ Our training process is composed of two phases. In the first phase we finetune PaLM 2-Small on a data mixture containing a variety of (document, schema, extraction) tuples. In particular, this data mixture contains the Payment dataset (Majumder et al., 2020), along with a diverse set of publicly available PDF form templates obtained from government websites that we filled with synthetic data using an internal tool, and annotated for schema and entities to extract. The goal of this phase is to obtain a Base Entity Extractor model by training the model to interpret the semantics of the entity types and extraction hierarchy specified in the schema, and find them within the document, along with learning the extraction syntax. Hence, the variety of schemas and documents in this phase is of utmost importance. This model is used for doing zero-shot extraction on a wide variety of document types.
105
+
106
+ During the second phase, starting from the base entity extractor checkpoint from the previous phase, we finetune the LLM on the target to specialize it to do high quality extraction on the target benchmark. At this stage, only the target benchmark data is included in the training mixture. Note that, for zero-shot experiments, this second phase is skipped. Furthermore, no document or schema contained in the base extraction training phase overlap with the documents and schemas used in the specialization training phase. For all training phases, we follow the input and target syntax described in section 2.4 and 2.5.
107
+
108
+ # 3.1 PARAMETERS
109
+
110
+ For training, we finetune PaLM 2-Small using a batch size of 8, a dropout probability of 0.1 and a learning rate of $1 0 ^ { - 6 }$ with a standard cross-entropy loss. Once training is done, we select the checkpoint with the lowest loss on the dev set, and report performance on the test set. For LLM inference, we use a temperature of 0.5 and a $\mathrm { T o p } _ { \mathrm { K } }$ of 40, sampling 16 responses for each chunk processed by the LLM, as described in section 2.6. Finally, for both training and inference, we use an input token length of 6144 and output token length of 2048. We use line-level segments and only two coordinates $[ \mathrm { x _ { c e n t e r } , \mathrm { y _ { c e n t e r } } } ]$ with 100 quantization buckets to save on the number of input and output tokens consumed by the coordinate-as-tokens scheme, as supported by Appendix A.4.
111
+
112
+ # 3.2 DATASETS
113
+
114
+ Visually Rich Document Understanding (VRDU). Wang et al. (2023c) introduces a public benchmark for entity extraction from visually-rich documents that includes two datasets: Registration Form, containing 6 semantically rich entity types, and Ad-buy Form, containing 14 entity types with one hierarchical line_item entity. For each dataset, VRDU proposes samples of 10, 50, 100 and 200 train documents to evaluate the data efficiency of models. It also offers different tasks to evaluate the generalization powers of extraction systems: Single Template Learning (STL) where train/test share the same single template, Unseen Template Learning (UTL) where train/test contain disjoint sets of templates, and Mixed Template Learning (MTL) where train/test contain overlapping sets of templates. For our experiments, we finetune $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ for 4000 steps on each dataset, training data size, and task setup independently and report Micro-F1 through the provided evaluation tool. We then compare $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ to its published state-of-the-art baselines.
115
+
116
+ Consolidated Receipt Dataset (CORD). Park et al. (2019) introduces a benchmark of Indonesian receipts from shops and restaurants, with a target schema of 30 fine-grained entities, grouped into menu, total and subtotal hierarchical entities. $\mathrm { C } \mathrm { \bar { O } R } { \mathrm { D } } ^ { 1 }$ does not provide a standard evaluation toolkit, so we adopt the normalized Tree Edit Distance accuracy (n-TED) metric (Zhang & Shasha, 1989), previously introduced by Kim et al. (2022) on that benchmark, since it is agnostic to the output scheme used and considers the hierarchical entities as part of the metric. For our experiments, we use the official 800train/100dev/100test split, but also sample the first $D = 1 \bar { 0 / 5 } 0 / 1 0 0 / 2 0 0$ documents from the train split to assess the data efficiency of LMDX on this benchmark. For each data setup, we finetune LMDX for 12000 steps. For comparison, we also train and evaluate state-ofthe-art baselines LayoutLMv3LARGE and Donut. Those baselines are detailed in Appendix A.8.
117
+
118
+ For all benchmarks. We use the publicly provided OCR for the LMDX model and baselines with text input, ensuring a fair comparison between them. Furthermore, we also compare $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ to large model baselines on all benchmarks in the zero-shot $( | \mathcal { D } | = 0 )$ setting: GPT-3.5 that we prompt with the raw OCR and extraction instruction, and LLaVA-v1.5-13B that we prompt with the document image and extraction instructions. Those baselines are fully detailed in Appendix A.7. Unlike LMDX, those large model baselines do not localize their predictions.
119
+
120
+ # 3.3 RESULTS
121
+
122
+ Table 2: Results of $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ on the different tasks and training data size setups $| \mathcal D |$ of VRDU, with best performing model results in bold.
123
+
124
+ <table><tr><td rowspan="3">D|</td><td rowspan="3">Model</td><td rowspan="3"></td><td colspan="4">Registration Form</td><td colspan="4">Ad-buy Form</td></tr><tr><td>Single</td><td>Unseen</td><td colspan="2">Mixed Template</td><td>Unseen</td><td colspan="3">Mixed Template</td></tr><tr><td>Micro-F1</td><td>Micro-F1</td><td>Micro-F1</td><td>Localization Accuracy</td><td>Micro-F1</td><td>Micro-F1</td><td>Line Item F1 (Hierarchical)</td><td>Localization Accuracy</td></tr><tr><td rowspan="3">0</td><td>LLaVA-v1.5-13B</td><td>X</td><td>5.29</td><td>5.05</td><td>5.00</td><td>N/A</td><td>0.38</td><td>0.34</td><td>0.00</td><td>N/A</td></tr><tr><td>GPT-3.5</td><td>X</td><td>67.23</td><td>67.49</td><td>63.86</td><td>N/A</td><td>29.84</td><td>30.05</td><td>7.65</td><td>N/A</td></tr><tr><td>LMDXPaLM 2-Small</td><td>√</td><td>73.81</td><td>74.94</td><td>71.65</td><td>93.21</td><td>39.33</td><td>39.74</td><td>21.21</td><td>88.18</td></tr><tr><td rowspan="6">10</td><td>FormNet</td><td>√</td><td>74.22</td><td>50.53</td><td>63.61</td><td></td><td>20.28</td><td>20.47</td><td>5.72</td><td>=</td></tr><tr><td>LayoutLM</td><td>√</td><td>65.91</td><td>25.54</td><td>36.41</td><td>98.71</td><td>19.92</td><td>20.20</td><td>6.95</td><td>92.60</td></tr><tr><td>LayoutLMv2</td><td></td><td>80.05</td><td>54.21</td><td>69.44</td><td>99.00</td><td>25.17</td><td>25.36</td><td>9.96</td><td>93.95</td></tr><tr><td>LayoutLMv3</td><td></td><td>72.51</td><td>21.17</td><td>60.72</td><td>99.20</td><td>10.01</td><td>10.16</td><td>5.92</td><td>90.68</td></tr><tr><td>LMDXPaLM 2-Small</td><td>√</td><td>90.88</td><td>86.87</td><td>87.72</td><td>99.75</td><td>54.82</td><td>54.35</td><td>39.35</td><td>94.51</td></tr><tr><td>FormNet</td><td>√</td><td>89.38</td><td>68.29</td><td>85.38</td><td></td><td>39.52</td><td>40.68</td><td>19.06</td><td></td></tr><tr><td rowspan="5">50</td><td>LayoutLM</td><td>√</td><td>86.21</td><td>55.86</td><td>80.15</td><td>99.69</td><td>38.42</td><td>39.76</td><td>19.50</td><td>95.24</td></tr><tr><td>LayoutLMv2</td><td>√</td><td>88.68</td><td>61.36</td><td>84.13</td><td>99.54</td><td>41.59</td><td>42.23</td><td>20.98</td><td>95.64</td></tr><tr><td>LayoutLMv3</td><td></td><td>87.24</td><td>47.85</td><td>81.36</td><td>99.39</td><td>38.43</td><td>39.49</td><td>19.53</td><td>95.28</td></tr><tr><td>LMDXPaLM 2-Small</td><td>√</td><td>93.06</td><td>88.43</td><td>91.42</td><td>99.87</td><td>75.70</td><td>75.08</td><td>65.42</td><td>98.28</td></tr><tr><td>FormNet</td><td>√</td><td>90.91</td><td>72.58</td><td>88.13</td><td>=</td><td>39.88</td><td>40.38</td><td>18.80</td><td>=</td></tr><tr><td rowspan="5">100</td><td>LayoutLM</td><td>√</td><td>88.70</td><td>63.68</td><td>86.02</td><td>99.63</td><td>41.46</td><td>42.38</td><td>21.26</td><td>95.09</td></tr><tr><td>LayoutLMv2</td><td>√</td><td>90.45</td><td>65.96</td><td>88.36</td><td>99.72</td><td>44.35</td><td>44.97</td><td>23.52</td><td>95.72</td></tr><tr><td>LayoutLMv3</td><td></td><td>89.23</td><td>57.69</td><td>87.32</td><td>99.72</td><td>41.54</td><td>42.63</td><td>22.08</td><td>95.88</td></tr><tr><td>LMDXPaLM 2-Small</td><td>√</td><td>93.97</td><td>89.70</td><td>92.41</td><td>99.92</td><td>75.99</td><td>78.05</td><td>69.77</td><td>98.69</td></tr><tr><td>FormNet</td><td>√</td><td></td><td>77.29</td><td>90.51</td><td></td><td>42.87</td><td>43.23</td><td>21.86</td><td></td></tr><tr><td rowspan="5">200</td><td></td><td>√</td><td>92.12 90.47</td><td>70.47</td><td>87.94</td><td>99.69</td><td>44.18</td><td>44.66</td><td>23.90</td><td>= 95.38</td></tr><tr><td>LayoutLM</td><td></td><td>91.41</td><td>72.03</td><td>89.19</td><td>99.75</td><td>46.31</td><td>46.54</td><td>25.46</td><td>95.78</td></tr><tr><td>LayoutLMv2</td><td></td><td>90.89</td><td>62.58</td><td>89.77</td><td>99.67</td><td>44.43</td><td>45.16</td><td>24.51</td><td>95.95</td></tr><tr><td>LayoutLMv3</td><td></td><td></td><td>90.22</td><td>92.78</td><td>99.87</td><td>78.42</td><td>79.82</td><td>72.09</td><td></td></tr><tr><td>LMDXPaLM 2-Small</td><td>√</td><td>93.97</td><td></td><td></td><td></td><td></td><td></td><td></td><td>98.65</td></tr></table>
125
+
126
+ Results for VRDU are presented in Table 2. For all data regimes and tasks, $\mathrm { L M D X } _ { \mathrm { P a L M } ; }$ 2-Small sets a new state-of-the-art by a wide margin. In particular, we find that $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ has higher extraction quality than GPT-3.5 and LLaVA-v1.5-13B while also localizing its predictions. $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ also exhibits similar extraction quality at zero-shot than baselines at 10-100 train dataset size (for instance $3 9 . 7 4 \%$ Micro-F1 on Ad-Buy Form Mixed Template vs $4 0 . 6 8 \%$ for FormNet at 50 train documents, or $7 3 . 8 1 \%$ Micro-F1 on Registration Single Template vs $7 4 . 2 2 \%$ for FormNet at 10 train documents). Moreover, $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ is much more data efficient than the baselines: it is at $5 . 0 6 \%$ Micro-F1 of its peak performance at 10 training documents for Registration Form Mixed Template $( 8 7 . 7 2 \%$ vs $9 2 . 7 8 \%$ Micro-F1) while LayoutLMv2, the strongest finetuned baseline, is within $1 9 . 7 5 \%$ of its peak performance $6 9 . 4 4 \%$ vs $8 9 . 1 9 \%$ Micro-F1). Lastly, $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ generalizes better to unseen templates than finetuned baselines: on Registration Form, $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ has a drop less than $5 \%$ Micro-F1 on Unseen Template compared to Single Template across data regimes, while baselines (LayoutLMv2) sees a drop between $19 \%$ and $27 \%$ .
127
+
128
+ On CORD (results in Table 3), we observe similar trends, highlighting the generalization of the results. At $| \mathcal { D } | = 1 0$ , $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ is $4 . 0 3 \%$ from its peak performance attained at $| \mathcal { D } | = 8 0 0$ versus $2 2 . 3 4 \%$ for the strongest baseline LayoutLMv3LARGE, showcasing LMDX’s data efficiency.
129
+
130
+ Performance on Hierarchical Entities. As seen on Ad-Buy Form Mixed in Table 2, $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ has much higher Line Item F1 than the finetuned baselines for all data regimes. In particular, $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ has similar line item grouping performance at zero-shot than the best finetuned baseline at 200 train documents $( 2 1 . 2 1 \%$ versus $2 5 . 4 6 \%$ Line Item F1 respectively). With all the training data, $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ scores a $7 2 . 0 9 \%$ F1 on line item, an absolute improvement of $4 6 . 6 3 \%$ over the best baseline LayoutLMv2. Finally, $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ , which encode spatial information, has much higher zero-shot Line Item F1 than large models baselines.
131
+
132
+ Localization Accuracy We compute the Localization Accuracy of $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ and all baselines that can localize entities using the formula: $\begin{array} { r } { A c c u r a c y _ { L o c a l i z a t i o n } = \frac { N _ { E + L } } { N _ { E } } } \end{array}$ NE+L where NE+L is the number of entities correctly extracted and localized, and $N _ { E }$ is the number of entities correctly extracted. This allows to evaluate the localization quality independently of the extraction quality. Since $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ localizes at the line level, localization verification is done at the line-level as well, i.e. localization is considered correct if the prediction bounding box is covered by the groundtruth line-level bounding box by more than $80 \%$ . We present the results in the Localization Accuracy Columns in Table 2. Overall, $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ can localize its predictions reliably at the line-level with the segment identifiers, with $8 8 \% - 9 3 \%$ accuracy at zero-shot, and $9 8 \% - 9 9 \%$ in finetuned cases, which is slightly higher than LayoutLM/LayoutLMv2/LayoutLMv3/FormNet baselines that can localize their predictions.
133
+
134
+ Table 3: $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ results on CORD. Normalized Tree Edit Distance Accuracy is reported.
135
+
136
+ <table><tr><td rowspan="2">Model</td><td rowspan="2">Localization</td><td colspan="6">n-TED Accuracy</td></tr><tr><td>|D|=0</td><td>|D|=10</td><td>|D|=50</td><td>|D|=100</td><td>|D|= 200</td><td>|D|= 800</td></tr><tr><td>LLaVA-v1.5-13B</td><td>X</td><td>4.78</td><td></td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>GPT-3.5</td><td>X</td><td>58.25</td><td>=</td><td>=</td><td>=</td><td>=</td><td></td></tr><tr><td>Donut</td><td>X</td><td>0.00</td><td>33.01</td><td>75.44</td><td>82.17</td><td>84.49</td><td>90.23</td></tr><tr><td>LayoutLMv3LARGE</td><td>√</td><td>0.00</td><td>73.87</td><td>87.29</td><td>91.83</td><td>94.44</td><td>96.21</td></tr><tr><td>LMDXPaLM2-Small</td><td>√</td><td>67.47</td><td>92.27</td><td>93.80</td><td>93.64</td><td>94.73</td><td>96.30</td></tr></table>
137
+
138
+ # 3.4 ABLATIONS
139
+
140
+ In this section, we ablate different facets of the LMDX methodology to highlight their relative importance. The results can be found in Table 4 and are discussed below. For all ablations, we evaluate on the VRDU Ad-Buy Form Mixed Template task, only changing the ablated facet.
141
+
142
+ Table 4: Ablations of Base Entity Extraction Training, Coordinate Tokens, and Sampling and their relative effects on extraction quality. All ablations are done on VRDU Ad-Buy Mixed Template.
143
+
144
+ <table><tr><td rowspan="2">|D</td><td>LMDXPaLM 2-Small</td><td colspan="2">Without Base EE Training</td><td colspan="2">Without Coordinate Tokens</td><td colspan="2">Without Sampling Strategy</td></tr><tr><td>Micro-F1</td><td>Micro-F1</td><td>△(%)</td><td>Micro-F1</td><td>△(%)</td><td>Micro-F1</td><td>△(%)</td></tr><tr><td>0</td><td>39.74</td><td>0.00</td><td>-39.74</td><td>27.59</td><td>-12.15</td><td>39.53</td><td>-0.21</td></tr><tr><td>10</td><td>54.35</td><td>42.91</td><td>-11.44</td><td>39.37</td><td>-14.98</td><td>52.85</td><td>-1.50</td></tr><tr><td>50</td><td>75.08</td><td>66.51</td><td>-8.57</td><td>62.35</td><td>-12.73</td><td>73.88</td><td>-1.20</td></tr><tr><td>100</td><td>78.05</td><td>68.87</td><td>-9.18</td><td>65.14</td><td>-12.91</td><td>77.30</td><td>-0.75</td></tr><tr><td>200</td><td>79.82</td><td>72.25</td><td>-7.57</td><td>65.70</td><td>-14.12</td><td>78.43</td><td>-1.39</td></tr></table>
145
+
146
+ Effects of Base Entity Extraction Training. In this ablation, we remove the first stage training on the varied data mixture and directly finetune on the VRDU target task. As seen on columns 3-4 of Table 4, ablating that training stage leads to significant drop in extraction quality in finetuned scenarios and the complete loss of zero-shot extraction ability due to the model not respecting the extraction format, hence failing decoding. As the train set size increases, the degraded performance lessens from $- 1 1 . 4 4 \%$ to $- 7 . 5 7 \%$ , as the model learns the task and desired completion format.
147
+
148
+ Effects of Coordinate Tokens. In this ablation, we replace the coordinate tokens, which communicate the position of each line within the document, by the index of that line. This index still acts as a unique identifier for the line segment (required for entity localization and grounding) but does not communicate any position information. An example of a prompt with line index can be found in Appendix A.6. As can be seen on columns 5-6 of Table 4, the coordinate tokens are substantially important to the extraction quality, ranging from $1 2 . 1 5 \%$ to $1 4 . 9 8 \%$ absolute micro-F1 improvement across the data regimes.
149
+
150
+ Effects of Sampling Strategy. In this ablation, we discard our strategy of sampling $K \ : = \ : 1 6$ completions per chunk, and instead sample a single response. As seen in columns 7-8 of Table 4, this leads to a $0 . 2 1 \%$ to $1 . 5 \%$ drop in micro-F1. While overall minor for quality, the sampling strategy also allows to correct extraction format mistakes (parsing error rates are given in Appendix A.9), leading to a successful extraction on all documents within the benchmarks.
151
+
152
+ # 3.5 IN-CONTEXT LEARNING PERFORMANCE
153
+
154
+ In this section, we study how in-context learning (ICL) compares to finetuning for LMDXPaLM 2-Small. To do so, we test two methodologies: Random, which randomly selects $| \mathcal D |$ documents and extractions from the train set, and Nearest Neighbors, which uses similarity based on SentenceT5 embeddings2 (Ni et al., 2021) to retrieve $| \mathcal D |$ documents to add in the LLM context. The results on CORD are shown in Table 5, where $\mathbf { n }$ -TED is reported. Overall, while both methods increase the performance significantly, nearest neighbors has a clear advantage, matching the best random ICL performance with only a single in-context example $( 8 7 . 7 3 \%$ versus $8 7 . 3 7 \%$ n-TED), and matching the finetuned performance at $| \mathcal { D } | = 1 0$ examples $9 2 . 8 2 \%$ versus $9 2 . 2 7 \%$ n-TED), as examples from the same template are retrieved (see Appendix A.10 for example retrievals). Note that, beyond $| \mathcal { D } | = 1 0$ examples, the performance stops improving, as no more examples can fit in the context window of PaLM 2-Small.
155
+
156
+ Table 5: In-Context Learning results on CORD with different retrieval methods.
157
+
158
+ <table><tr><td>ICL Method</td><td>|D|=0</td><td>|D|=1</td><td>|D|=3</td><td>|D|=5</td><td>|D|= 10</td><td>|D|= 20</td></tr><tr><td>Random</td><td>67.47</td><td>74.96</td><td>84.88</td><td>86.47</td><td>87.26</td><td>87.37</td></tr><tr><td>Nearest Neighbors</td><td>67.47</td><td>87.73</td><td>90.98</td><td>92.28</td><td>92.82</td><td>92.75</td></tr></table>
159
+
160
+ # 3.6 ERROR ANALYSIS AND LIMITATIONS
161
+
162
+ In this section, we perform an error analysis on the test set to identify common error patterns of LMDX. A very common error type we observe is caused by OCR lines grouping multiple semantically different segments. We show two instance of those cases observed in $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ on the VRDU Ad-Buy Form in Figure 3. In the first example, prediction for the entity line_item/program_desc includes text from the previous column "Channel" along with the value in the column "Description". From the OCR line bounding boxes, we can see that these two columns are grouped as the same OCR line. In the second example, the model confuses between the adjacent keys "Invoice Period" and "Flight Dates" and extracts invoice dates as flight dates. Similar to the first example, OCR line bounding boxes show that the invoice dates and the key "Flight Dates" are grouped together in the same line although they are semantically different. As $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a } }$ ll uses only coarse line layout information ([xcenter, ycenter] with 100 quantization buckets), the model fails in these cases, which is a current limitation of LMDX. We believe that incorporating the image modality will help make LMDX more performant and robust to those OCR errors.
163
+
164
+ ![](images/76eafd5c095f734981fcfaf8df063a86f947664560b7fa454b0fefaec8ae145b.jpg)
165
+ Figure 3: Typical error pattern of $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ . In both examples, the detected OCR lines are shown in red, the model predicted entities are shown in blue, and the groundtruth entities are shown in green. In both cases, the detected OCR lines merge two semantically distinct segments, causing the model to wrongly associate them in its predictions.
166
+
167
+ # 4 CONCLUSION
168
+
169
+ In this paper, we have introduced LMDX, a methodology that enables using LLMs for information extraction on visually rich documents, setting a new state-of-the-art on public benchmarks VRDU and CORD. LMDX is the first methodology to allow the extraction of singular, repeated and hierarchical entities, while localizing the entities in the document. LMDX is data efficient, and even allows high quality extraction at zero-shot on entirely new document types and schemas. Nonetheless, since it relies on a LLM, LMDX is more resource-intensive than previous approaches, and its coordinate-as-tokens scheme requires long inputs and outputs. As future work, we will explore applying the methodology to open-source LLMs and adding the image modality to the system using Large Vision-Language Models.
170
+
171
+ # 5 REPRODUCIBILITY STATEMENT
172
+
173
+ In order to increase reproducibility, we’ve provided all details of the LMDX methodology. We’ve included our LLM prompts and completions in Appendix A.6, along with all our algorithms for chunking and decoding in Appendix A.1, A.2 and A.3. Furthermore, we’ve provided the exact target schemas used in our experiments in Appendix A.5. For CORD specifically, we’ve used a metric with a public implementation (https://github.com/clovaai/donut/blob/master/ donut/util.py) and an easy to reproduce sampling strategy for the data-efficiency splits (first $D$ train documents). Finally, our baselines are publicly available (https://github.com/ microsoft/unilm/tree/master/layoutlmv3, https://github.com/clovaai/ donut) and thoroughly detailed in Appendix A.7 and A.8.
174
+
175
+ REFERENCES
176
+ Srikar Appalaraju, Bhavan Jasani, Bhargava Urala Kota, Yusheng Xie, and R. Manmatha. Docformer: End-to-end transformer for document understanding. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 993–1003, October 2021.
177
+ Srikar Appalaraju, Peng Tang, Qi Dong, Nishant Sankaran, Yichu Zhou, and R. Manmatha. Docformerv2: Local features for document understanding, 2023.
178
+ Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners, 2020.
179
+ Timo I. Denk and Christian Reisswig. Bertgrid: Contextualized embedding for 2d document representation and understanding, 2019.
180
+ Łukasz Garncarek, Rafał Powalski, Tomasz Stanisławek, Bartosz Topolski, Piotr Halama, Michał Turski, and Filip Gralin ski. LAMBERT: Layout-aware language modeling for information ex- ´ traction. In Document Analysis and Recognition – ICDAR 2021, pp. 532–547. Springer International Publishing, 2021. doi: 10.1007/978-3-030-86549-8_34. URL https://doi.org/ 10.1007%2F978-3-030-86549-8_34.
181
+ Rohan Anil Google, Andrew M. Dai, Orhan Firat, Melvin Johnson, Dmitry Lepikhin, Alexandre Passos, Siamak Shakeri, Emanuel Taropa, Paige Bailey, Zhifeng Chen, Eric Chu, Jonathan H. Clark, Laurent El Shafey, Yanping Huang, Kathy Meier-Hellstern, Gaurav Mishra, Erica Moreira, Mark Omernick, Kevin Robinson, Sebastian Ruder, Yi Tay, Kefan Xiao, Yuanzhong Xu, Yujing Zhang, Gustavo Hernandez Abrego, Junwhan Ahn, Jacob Austin, Paul Barham, Jan Botha, James Bradbury, Siddhartha Brahma, Kevin Brooks, Michele Catasta, Yong Cheng, Colin Cherry, Christopher A. Choquette-Choo, Aakanksha Chowdhery, Clément Crepy, Shachi Dave, Mostafa Dehghani, Sunipa Dev, Jacob Devlin, Mark Díaz, Nan Du, Ethan Dyer, Vlad Feinberg, Fangxiaoyu Feng, Vlad Fienber, Markus Freitag, Xavier Garcia, Sebastian Gehrmann, Lucas Gonzalez, Guy Gur-Ari, Steven Hand, Hadi Hashemi, Le Hou, Joshua Howland, Andrea Hu, Jeffrey Hui, Jeremy Hurwitz, Michael Isard, Abe Ittycheriah, Matthew Jagielski, Wenhao Jia, Kathleen Kenealy, Maxim Krikun, Sneha Kudugunta, Chang Lan, Katherine Lee, Benjamin Lee, Eric Li, Music Li, Wei Li, YaGuang Li, Jian Li, Hyeontaek Lim, Hanzhao Lin, Zhongtao Liu, Frederick Liu, Marcello Maggioni, Aroma Mahendru, Joshua Maynez, Vedant Misra, Maysam Moussalem, Zachary Nado, John Nham, Eric Ni, Andrew Nystrom, Alicia Parrish, Marie Pellat, Martin Polacek, Alex Polozov, Reiner Pope, Siyuan Qiao, Emily Reif, Bryan Richter, Parker Riley, Alex Castro Ros, Aurko Roy, Brennan Saeta, Rajkumar Samuel, Renee Shelby, Ambrose Slone, Daniel Smilkov, David R. So, Daniel Sohn, Simon Tokumine, Dasha Valter, Vijay Vasudevan, Kiran Vodrahalli, Xuezhi Wang, Pidong Wang, Zirui Wang, Tao Wang, John Wieting, Yuhuai Wu, Kelvin Xu, Yunhan Xu, Linting Xue, Pengcheng Yin, Jiahui Yu, Qiao Zhang, Steven Zheng, Ce Zheng, Weikang Zhou, Denny Zhou, Slav Petrov, and Yonghui Wu. Palm 2 technical report, 2023.
182
+
183
+ Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, Tom Hennigan, Eric Noland, Katie Millican, George van den Driessche, Bogdan Damoc, Aurelia Guy, Simon Osindero, Karen Simonyan, Erich Elsen, Jack W. Rae, Oriol Vinyals, and Laurent Sifre. Training compute-optimal large language models, 2022.
184
+
185
+ Teakgyu Hong, Donghyun Kim, Mingi Ji, Wonseok Hwang, Daehyun Nam, and Sungrae Park. BROS: A layout-aware pre-trained language model for understanding documents. CoRR, abs/2108.04539, 2021. URL https://arxiv.org/abs/2108.04539.
186
+ Yupan Huang, Tengchao Lv, Lei Cui, Yutong Lu, and Furu Wei. Layoutlmv3: Pre-training for document ai with unified text and image masking. In Proceedings of the 30th ACM International Conference on Multimedia, 2022.
187
+ Wonseok Hwang, Jinyeong Yim, Seunghyun Park, Sohee Yang, and Minjoon Seo. Spatial dependency parsing for semi-structured document information extraction. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pp. 330–343, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.findings-acl.28. URL https://aclanthology.org/2021.findings-acl.28.
188
+ Anoop Raveendra Katti, Christian Reisswig, Cordula Guder, Sebastian Brarda, Steffen Bickel, Johannes Höhne, and Jean Baptiste Faddoul. Chargrid: Towards understanding 2d documents, 2018.
189
+ Geewook Kim, Teakgyu Hong, Moonbin Yim, JeongYeon Nam, Jinyoung Park, Jinyeong Yim, Wonseok Hwang, Sangdoo Yun, Dongyoon Han, and Seunghyun Park. Ocr-free document understanding transformer. In European Conference on Computer Vision (ECCV), 2022.
190
+ Chen-Yu Lee, Chun-Liang Li, Timothy Dozat, Vincent Perot, Guolong Su, Nan Hua, Joshua Ainslie, Renshen Wang, Yasuhisa Fujii, and Tomas Pfister. FormNet: Structural encoding beyond sequential modeling in form document information extraction. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 3735–3754, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022. acl-long.260. URL https://aclanthology.org/2022.acl-long.260.
191
+ Chen-Yu Lee, Chun-Liang Li, Hao Zhang, Timothy Dozat, Vincent Perot, Guolong Su, Xiang Zhang, Kihyuk Sohn, Nikolay Glushnev, Renshen Wang, Joshua Ainslie, Shangbang Long, Siyang Qin, Yasuhisa Fujii, Nan Hua, and Tomas Pfister. FormNetV2: Multimodal graph contrastive learning for form document information extraction. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 9011– 9026, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/ 2023.acl-long.501. URL https://aclanthology.org/2023.acl-long.501.
192
+ Bodhisattwa Prasad Majumder, Navneet Potti, Sandeep Tata, James Bradley Wendt, Qi Zhao, and Marc Najork. Representation learning for information extraction from form-like documents. In ACL, 2020.
193
+ Jianmo Ni, Gustavo Hernández Ábrego, Noah Constant, Ji Ma, Keith B Hall, Daniel Cer, and Yinfei Yang. Sentence-t5: Scalable sentence encoders from pre-trained text-to-text models. arXiv preprint arXiv:2108.08877, 2021.
194
+ OpenAI. Gpt-4 technical report, 2023.
195
+ Rasmus Berg Palm, Ole Winther, and Florian Laws. Cloudscan - a configuration-free invoice analysis system using recurrent neural networks. In Proceedings of 2017 14th IAPR International Conference on Document Analysis and Recognition, pp. 406–413, United States, 2017. IEEE. ISBN 9781538635858. doi: 10.1109/ICDAR.2017.74.
196
+ Seunghyun Park, Seung Shin, Bado Lee, Junyeop Lee, Jaeheung Surh, Minjoon Seo, and Hwalsuk Lee. Cord: A consolidated receipt dataset for post-ocr parsing. In Workshop on Document Intelligence at NeurIPS 2019, 2019.
197
+ Rafał Powalski, Łukasz Borchmann, Dawid Jurkiewicz, Tomasz Dwojak, Michał Pietruszka, and Gabriela Pałka. Going full-tilt boogie on document understanding with text-image-layout transformer. In Josep Lladós, Daniel Lopresti, and Seiichi Uchida (eds.), Document Analysis and Recognition – ICDAR 2021, pp. 732–747, Cham, 2021. Springer International Publishing. ISBN 978-3-030-86331-9.
198
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-totext transformer. Journal of Machine Learning Research, 21(140):1–67, 2020. URL http: //jmlr.org/papers/v21/20-074.html.
199
+ Lance Ramshaw and Mitch Marcus. Text chunking using transformation-based learning. In Third Workshop on Very Large Corpora, 1995. URL https://aclanthology.org/W95-0107.
200
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In I. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper_files/paper/2017/ file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf.
201
+ Shuhe Wang, Xiaofei Sun, Xiaoya Li, Rongbin Ouyang, Fei Wu, Tianwei Zhang, Jiwei Li, and Guoyin Wang. Gpt-ner: Named entity recognition via large language models, 2023a.
202
+ Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022.
203
+ Zifeng Wang, Zizhao Zhang, Jacob Devlin, Chen-Yu Lee, Guolong Su, Hao Zhang, Jennifer Dy, Vincent Perot, and Tomas Pfister. QueryForm: A simple zero-shot form entity query framework. In Findings of the Association for Computational Linguistics: ACL 2023, pp. 4146–4159, Toronto, Canada, July 2023b. Association for Computational Linguistics. doi: 10.18653/v1/2023. findings-acl.255. URL https://aclanthology.org/2023.findings-acl.255.
204
+ Zilong Wang, Yichao Zhou, Wei Wei, Chen-Yu Lee, and Sandeep Tata. Vrdu: A benchmark for visually-rich document understanding. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, KDD ’23, pp. 5184–5193, New York, NY, USA, 2023c. Association for Computing Machinery. ISBN 9798400701030. doi: 10.1145/3580305.3599929. URL https://doi.org/10.1145/3580305.3599929.
205
+ Jason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, and Quoc V. Le. Finetuned language models are zero-shot learners, 2022.
206
+ Kaiwen Wei, Jie Yao, Jingyuan Zhang, Yangyang Kang, Fubang Zhao, Yating Zhang, Changlong Sun, Xin Jin, and Xin Zhang. Ppn: Parallel pointer-based network for key information extraction with complex layouts, 2023.
207
+ Yang Xu, Yiheng Xu, Tengchao Lv, Lei Cui, Furu Wei, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Wanxiang Che, Min Zhang, and Lidong Zhou. Layoutlmv2: Multi-modal pre-training for visually-rich document understanding. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics (ACL) 2021, 2021.
208
+ Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, and Ming Zhou. Layoutlm: Pretraining of text and layout for document image understanding. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 1192–1200, 2020.
209
+ Kaizhong Zhang and Dennis Shasha. Simple fast algorithms for the editing distance between trees and related problems. SIAM Journal on Computing, 18(6):1245–1262, 1989. doi: 10.1137/ 0218082. URL https://doi.org/10.1137/0218082.
210
+ Zhenrong Zhang, Jiefeng Ma, Jun Du, Licheng Wang, and Jianshu Zhang. Multimodal pre-training based on graph attention network for document understanding, 2022.
211
+
212
+ A APPENDIX
213
+
214
+ A.1 CHUNKING ALGORITHM
215
+
216
+ # Algorithm 1 Document Chunking
217
+
218
+ <table><tr><td>1: function CHUNK(D,L, F) 2: 3: C=Φ</td><td>D is a document containing multiple pages.L is token limit. F is a function that outputs prompt token length given some segments (e.g. lines). C is to record all produced chunks.</td></tr><tr><td>4: 5:</td><td>for i= 1 to |D.pages| do S = D.pages[i].segments</td></tr><tr><td>6: while S≠do 7:</td><td>for j=|S| to 1 do &gt; Start pruning from the end of the page.</td></tr><tr><td></td><td></td></tr><tr><td>8:</td><td>if F(S[1 : j])≤L then</td></tr><tr><td>9:</td><td>C=CU{S[1:j]}</td></tr><tr><td>10:</td><td>S=S[j+1:|SI]</td></tr><tr><td>11:</td><td></td></tr><tr><td>12:</td><td>Exit for loop</td></tr><tr><td>13:</td><td>end if</td></tr><tr><td></td><td>end for</td></tr><tr><td>14:</td><td>end while</td></tr><tr><td>15:</td><td>end for</td></tr><tr><td>16:</td><td></td></tr><tr><td>17: end function</td><td>return C</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></table>
219
+
220
+ A.2 ENTITY VALUE PARSING ALGORITHM
221
+
222
+ # Algorithm 2 Entity Value Parsing
223
+
224
+ <table><tr><td colspan="3">1:function PARSEENTITYVALUE(D, E) D is a document chunk.</td></tr><tr><td>2:</td><td colspan="3">&gt; E is raw extraction results for one entity type parsed from one LLM sample.</td></tr><tr><td>34</td><td colspan="3">G= G is to record all parsed entity values.</td></tr><tr><td></td><td>R=Regex(“(\d\d\/\d\d)&quot;)</td><td colspan="3">&gt;R is a regex that captures the segment identifiers.</td></tr><tr><td>5:</td><td></td><td colspan="3">M ={“s.x|s.y” -→ s|s E D.segments}DM holds a mapping between segment id and segment.</td></tr><tr><td>6:</td><td>for i=1to |E|do</td><td colspan="3"></td></tr><tr><td>7:</td><td>W=</td><td colspan="3">W is to hold all words for this entity.</td></tr><tr><td>8:</td><td>P = R.split(E[i])</td><td></td><td colspan="2">&gt;P is expected to be interleaved text values and segment ids.</td></tr><tr><td>9:</td><td>for j= 1 to |P|/2 do</td><td></td><td></td><td></td></tr><tr><td>10:</td><td></td><td>if P[j * 2]M then</td><td></td><td></td></tr><tr><td>11:</td><td></td><td>Go to next i</td><td>&gt; Segment ID is hallucinated. Grounding failure.</td><td></td></tr><tr><td>12:</td><td>end if</td><td></td><td></td><td></td></tr><tr><td>13:</td><td>S= M[P[j * 2]]</td><td></td><td>&gt;Retrieve the stored segment from M with parsed segment ID.</td><td></td></tr><tr><td>14:</td><td></td><td>T=P[j*2-1]</td><td>T is to hold the predicted text.</td><td></td></tr><tr><td>15:</td><td></td><td> if T not substring of S then</td><td></td><td></td></tr><tr><td>16:</td><td></td><td>Go to next i</td><td>&gt; Grounding failure, skip the current entity.</td><td></td></tr><tr><td>17:</td><td></td><td>end if</td><td></td><td></td></tr><tr><td>18:</td><td></td><td>W=WU (SnT)</td><td></td><td></td></tr><tr><td>19:</td><td>end for</td><td></td><td></td><td></td></tr><tr><td>20:</td><td></td><td>G&#x27;.value= Uwew w.text_value</td><td></td><td> G&#x27; is to hold the entity to return.</td></tr><tr><td>21:</td><td></td><td></td><td></td><td></td></tr><tr><td>22:</td><td></td><td></td><td>G&#x27;.bounding_box = {min(b.x),min(b.y), max(b.x),max(b.y)}wew,b=w.bounding_box</td><td></td></tr><tr><td>23:</td><td>G=GU{G</td><td></td><td></td><td></td></tr><tr><td>24:</td><td>end for</td><td></td><td></td><td></td></tr><tr><td></td><td>return G</td><td></td><td></td><td></td></tr><tr><td></td><td>25: end function</td><td></td><td></td><td></td></tr></table>
225
+
226
+ # A.3 DECODING ALGORITHM
227
+
228
+ # Algorithm 3 Responses Decoding
229
+
230
+ <table><tr><td>1:function DECODEFORTYPE(J,T,D) &gt;Jis one or more JSONobjects.</td></tr><tr><td>2: T is an entity type.</td></tr><tr><td>34 D is a document chunk.</td></tr><tr><td>E= &gt;E is to record all parsed and grounded entities.</td></tr><tr><td>5: for j=1 to|J| do</td></tr><tr><td>6: J&#x27;= J[j][T.type] &gt; J&#x27; is to hold entities for T&#x27;s type before grounding.</td></tr><tr><td>7: if T.subtypes = then T is leaf entity type.</td></tr><tr><td>8: E=EUParseEntityValue(D,J&#x27;)</td></tr><tr><td>9: else &gt;T is hierarchical entity type.</td></tr><tr><td>10: E&#x27;subtypes = UT&#x27;ET.subtypes DecodeForType(J&#x27;,T&#x27;,D) E&#x27; is hierarchical entity.</td></tr><tr><td></td></tr><tr><td>11: E=EU{E&#x27;}</td></tr><tr><td>12: end if</td></tr><tr><td>13: end for</td></tr><tr><td>14: return E</td></tr><tr><td>15:end function</td></tr><tr><td>16:</td></tr><tr><td>17: function MAJORITYVOTING(T, E) T is an entity type.</td></tr><tr><td>18: E is a 2D vector of entities of type T from all LLM responses.</td></tr><tr><td>19: V = [0.,,0,..,.0] ∈ RlEI Vis to record all votes.</td></tr><tr><td>20: L={T}</td></tr><tr><td>21: whileL≠do</td></tr><tr><td>22: T&#x27;=L[0]</td></tr><tr><td>23: E&#x27;=</td></tr><tr><td>24: for j=1 to|E| do</td></tr><tr><td>25: E&#x27;=E′U{ele∈E[j],e.type =T&#x27;} &gt;E&#x27;[j] holds entities with type T&#x27; from E[j].</td></tr><tr><td>26: end for</td></tr><tr><td>27: for i=1 to |E&#x27;|-1 do</td></tr><tr><td>28: for j=i+1 to|E&#x27;|do</td></tr><tr><td>29: if E&#x27;[]=E&#x27;j]then</td></tr><tr><td>30: V[=V+1</td></tr><tr><td>31: v=v+1</td></tr><tr><td>32: end if</td></tr><tr><td>33: end for</td></tr><tr><td>34: end for</td></tr><tr><td>35: L=L[1:|L]] &gt;Remove T&#x27; and inject its sub-types for recursion.</td></tr><tr><td>36: L = LUT&#x27;.subtypes</td></tr><tr><td>37: end while</td></tr><tr><td>38: return E[argmax(V)] Return the entity values with the highest votes.</td></tr><tr><td>39:end function</td></tr><tr><td>40:</td></tr><tr><td>41:function DECODEALLSAMPLES(S,T,D) &gt; S is all LLM response samples on D.</td></tr><tr><td>42: &gt;T is a list of entity types.</td></tr><tr><td>43: D is a document chunk.</td></tr><tr><td>44: return Ur&#x27;eT MajorityVoting(Us&#x27;∈s DecodeForType(ParseJson(S&#x27;),T&#x27;,D))</td></tr><tr><td>45:end function</td></tr></table>
231
+
232
+ # A.4 TOKEN LENGTH STATISTICS
233
+
234
+ Table 6 details the token length $\mathrm { 5 0 ^ { t h } }$ and $9 9 ^ { \mathrm { t h } }$ percentiles) of the prompt and completion targets for the train split of datasets used in our experiments. We select the line level segment, 2 coordinate scheme, no JSON indentation so that all datasets fit within our 6144 prompt token length and 2048 output token length.
235
+
236
+ Table 6: Prompt and target token length of different coordinate-as-tokens schemes on VRDU and CORD benchmarks, using the vocabulary of PaLM 2-S. We vary the number of coordinates and their quantization buckets in the localization tags, the segment level (e.g. line versus word), chunking style (e.g. page versus max input tokens) and JSON indentation in the schema and completion targets.
237
+
238
+ <table><tr><td colspan="9">VRDU Ad-Buy Form</td></tr><tr><td rowspan="2"># Coord.</td><td rowspan="2"># Quant.</td><td rowspan="2">Segment</td><td rowspan="2">Chunking</td><td rowspan="2"> JSON Indent</td><td colspan="2">Input</td><td colspan="2">Target</td></tr><tr><td>50th</td><td>99th</td><td>50th</td><td>99th</td></tr><tr><td></td><td>100</td><td>Line</td><td>Page</td><td>None</td><td>2377</td><td>3920</td><td>602</td><td>1916</td></tr><tr><td></td><td>100</td><td>Word</td><td>Page</td><td>None</td><td>3865</td><td>13978</td><td>718</td><td>2328</td></tr><tr><td>224</td><td>100</td><td>Line</td><td>Page</td><td>None</td><td>3329</td><td>5284</td><td>777</td><td>2473</td></tr><tr><td>2</td><td>1000</td><td>Line</td><td>Page</td><td>None</td><td>2687</td><td>4322</td><td>660</td><td>2095</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>Page</td><td>4</td><td>2417</td><td>3328</td><td>689</td><td>2234</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>6144 tokens</td><td>None</td><td>2377</td><td>3920</td><td>602</td><td>1916</td></tr></table>
239
+
240
+ VRDU Registration Form
241
+
242
+ <table><tr><td rowspan="2"># Coord.</td><td rowspan="2"># Quant.</td><td rowspan="2">Segment</td><td rowspan="2">Chunking</td><td rowspan="2">JSON Indent</td><td colspan="2">Input</td><td colspan="2">Target</td></tr><tr><td>50h</td><td>99th</td><td>50h</td><td>99th</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>Page</td><td>None</td><td>963</td><td>1578</td><td>79</td><td>147</td></tr><tr><td>2</td><td>100</td><td>Word</td><td>Page</td><td>None</td><td>3083</td><td>5196</td><td>101</td><td>349</td></tr><tr><td>4</td><td>100</td><td>Line</td><td>Page</td><td>None</td><td>1232</td><td>2017</td><td>91</td><td>177</td></tr><tr><td>2</td><td>1000</td><td>Line</td><td>Page</td><td>None</td><td>1052</td><td>1723</td><td>83</td><td>155</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>Page</td><td>4</td><td>977</td><td>1592</td><td>92</td><td>160</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>6144 tokens</td><td>None</td><td>963</td><td>1578</td><td>79</td><td>147</td></tr></table>
243
+
244
+ CORD
245
+
246
+ <table><tr><td rowspan="2"># Coord.</td><td rowspan="2"># Quant.</td><td rowspan="2"> Segment</td><td rowspan="2">Chunking</td><td rowspan="2">JSON Indent</td><td colspan="2">Input</td><td colspan="2">Target</td></tr><tr><td>50h</td><td>99th</td><td>50th</td><td>99th</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>Page</td><td>None</td><td>342</td><td>869</td><td>355</td><td>1495</td></tr><tr><td>2</td><td>100</td><td>Word</td><td>Page</td><td>None</td><td>396</td><td>1067</td><td>375</td><td>1638</td></tr><tr><td>4</td><td>100</td><td>Line</td><td>Page</td><td>None</td><td>408</td><td>1139</td><td>422</td><td>1801</td></tr><tr><td>2</td><td>1000</td><td>Line</td><td>Page</td><td>None</td><td>364</td><td>959</td><td>376</td><td>1957</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>Page</td><td>4</td><td>411</td><td>938</td><td>474</td><td>1997</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>6144 tokens</td><td>None</td><td>342</td><td>869</td><td>355</td><td>1495</td></tr></table>
247
+
248
+ # A.5 SCHEMAS
249
+
250
+ In this section, we present the schemas used for the experiments of this paper. The schema for VRDU Ad-Buy Form, VRDU Registration Form, and CORD can be found in Figure 4, Figure 5 and Figure 6 respectively.
251
+
252
+ ![](images/2f5574f4dab4d4bee3b92e6a1e0b491a8465a9b48efee1669f7f6d75277eda50.jpg)
253
+ Figure 4: VRDU Ad-Buy Form Schema.
254
+
255
+ ![](images/e52a04e6fc814bf3d043835a9a3be67dd8a551ae780091ab9d7e25722e51e563.jpg)
256
+ Figure 5: VRDU Registration Form Schema.
257
+
258
+ ![](images/a1316bdc95db1a831e4ca0e06068fb09ff8bca379ec5ecbbe30c1e0a234f0056.jpg)
259
+ Figure 6: CORD Schema. Note that the original entity types (shown as comments) have been renamed to more semantically meaningful names.
260
+
261
+ # A.6 SAMPLE PROMPTS AND COMPLETIONS
262
+
263
+ In this section, we present example of LMDX prompts and completions from the LLM on the VRDU Ad-Buy dataset to better showcase the format used. Figure 7 shows the original document with the line bounding boxes from OCR, Figure 8 shows the corresponding prompt and completion on that document with coordinate segment identifiers, and Figure 9 shows the same prompt and completion, but with line index segment identifiers (used in ablation studies to showcase how the LLM can interpret the layout).
264
+
265
+ ![](images/6ace8c51fd76c197e4ced05be07a81054d1a3412e843e0d2ce6bf4f79c542765.jpg)
266
+
267
+ ![](images/76bedd71417a488d5a108e74870fcb6d72666b5e7036c328135acd21e04a3ef3.jpg)
268
+ Figure 8: VRDU Ad-Buy Form sample prompt and completion with 2 coordinates for segment identifier. The document is truncated for easier visualization.
269
+
270
+ ![](images/a1430593e27f937b685bac9eb5a6d218c2e2fb73241dc87dc600e2f423278d6b.jpg)
271
+ Figure 9: VRDU Ad-Buy Form sample prompt and completion with line index for segment identifier, which does not communicate layout information. The document is truncated for easier visualization.
272
+
273
+ # A.7 COMMON BASELINES DETAILS
274
+
275
+ We compare LMDX to other Large Model baselines on all benchmarks in the zero-shot context.
276
+ Those baselines are detailed below.
277
+
278
+ GPT-3.5 Baseline. We evaluate the zero-shot extraction ability of GPT-3.5, a strong LLM baseline. To do so, we prompt it with the raw OCR text (no coordinate tokens or segment identifier like for LMDX), and extraction instructions alongside the schema in JSON format. We then parse the completions as JSON to get the predicted entities directly. Note that GPT-3.5’s predicted entities are also not localized within the document. A sample prompt can be observed in Figure 10.
279
+
280
+ LLaVA-v1.5-13B Baseline. We evaluate the zero-shot extraction ability of LLaVA-v1.5-13B, a strong vision-text large model. The prompt includes task description, instructions and target schema represented in JSON format as text input and the document page as image input. We provide examples of valid JSON values in the task instructions. For each page of a test document, we infer the extraction in a JSON format. We merge the individual page JSONs to obtain the final extraction for a document. Overall, in the the zero-shot setting, we notice the JSON parse error rate of the LLM completions is $10 \%$ which is higher than that of LMDX (as seen in the Appendix A.9). Along with invalid JSON format, the model errors also include several OCR errors and hallucinations of entity values. Note that LLaVA-v1.5-13B’s predicted entities are also not localized within the document. A sample prompt can be observed in Figure 11.
281
+
282
+ ![](images/63337f7810df1a77def09adc76310d7f7acb01dd7fa717fd615af0227b66c0ac.jpg)
283
+ Figure 10: Sample prompt for GPT-3.5 baseline for VRDU Registration Form.
284
+
285
+ # \${DOCUMENT_IMAGE}
286
+
287
+ Given the document, extract the text value of the entities included in the schema in json format.
288
+ - The extraction must respect the JSON schema.
289
+ - Only extract entities specified in the schema. Do not skip any
290
+
291
+ entity types.
292
+
293
+ - The values must only include text found in the document.
294
+ - Use null or [] for missing entity types.
295
+ - Do not indent the json you produce.
296
+ - Examples of valid string value format: "\$ 1234.50", "John Do", null.
297
+ - Examples of valid list value format: ["\$ 1234.50", "John Do"], [].
298
+ Schema: {"file_date": "", "foreign_principle_name": "",
299
+ "registrant_name": "", "registration_num": "", "signer_name": "",
300
+ "signer_title": ""} \`\`json
301
+
302
+ # A.8 CORD BASELINES DETAILS
303
+
304
+ LayoutLMv3LARGE Baseline. We follow the released implementation3 for the LayoutLMv3LARGE model and the training protocol described in Huang et al. (2022) as closely as possible. In particular, we train the model for 80 epochs for each experiment on CORD (namely, 10, 50, 100, 200, and 800-document training sets), on the IOB tags of the leaf entities. One difference in our training is that, due to computational resource constraints, we use batch_size $= 8$ and learning_rate $= \overset { \sim } { 2 } \cdot 1 0 ^ { - 5 }$ .
305
+
306
+ As the LayoutLMv3 model can only extract leaf entities, we design and heavily optimize a heuristic algorithm to group the leaf entities into hierarchical entities menu, subtotal and total. The best heuristics we could find are as follows:
307
+
308
+ • For the subtotal and total hierarchical entity types, since they appear only once per document, we group all their extracted sub-entities under a single subtotal and total entity, respectively. • For menu hierarchical entity type, we observe that those entities usually occur multiple times on a document, and each menu has at most one nm, num, unitprice, cnt, discountprice, price, itemsubtotal, etc sub-entities and potentially multiple sub_nm, sub_price and sub_cnt sub-entities. We also notice that the sub-entities aligned horizontally overwhelmingly belong to the same menu entity, and a menu entity can sometimes span over two or more consecutive horizontal lines. To leverage those observations, we perform a two-step grouping process for menu entities. First, we merge the extracted leaf sub-entities into horizontal groups, where a threshold of 0.5 on the intersection-over-union of the Y-axis was used for the determination of horizontal alignment. Second, we further merge the consecutive horizontal groups into menu entities, if and only if the horizontal groups do not have type duplication in any of the nm, num, unitprice, cnt, discountprice, price, itemsubtotal, and etc sub-entities (namely, those sub-entities only show up in at most one of the consecutive horizontal groups to be merged). We allow duplication of sub_nm, sub_price and sub_cnt sub-entity types. After those two steps, we obtain the final menu entities.
309
+
310
+ Donut Baseline. We follow Donut released implementation4 for the Donut benchmarking results on CORD. We use the default training configuration for all experiments on CORD (namely, 10, 50, 100, 200, and 800-document training sets), with the following difference: we reduce batch size from 8 to 4 due to computational resource constraints, and increase the number of train epochs from 30 to 60. For each experiment, checkpoint with the lowest loss on the dev set is selected and we report performance on test set. Normalized Tree Edit Distance accuracy scores produced by Donut evaluation code are reported (similar to all our other models).
311
+
312
+ # A.9 COMPLETION PARSING ERROR RATES
313
+
314
+ In this section, we report the various completion parsing error types and their occurrence rates.
315
+
316
+ Invalid JSON Formatting. This error refers to cases for which Python’s json.loads(completion) fails on a LLM’s completion. As observed in Table 7, the JSON parsing error rate is below $0 . 3 \%$ in all training settings.
317
+
318
+ Invalid Entity Value Format. This error refers to cases where the leaf entity value does not follow the expected "<text-segment- $I > X X | Y Y$ <text-segment- $2 > X X | Y Y ^ { \prime \prime }$ format. As observed in Table 7, the Invalid Entity Value Format Rate is below $0 . 0 5 \%$ in all training settings.
319
+
320
+ Hallucination / Entity Text Not Found. This error refers to cases where the segment identifier is valid, but the entity text does not appear on the predicted segment (hallucination). As observed in Table 7, the Entity Text Not Found error rate is below $0 . 6 \%$ in all training settings. As part of LMDX methodology, we discard any prediction whose text does not appear on the specified segment, ensuring we discard all hallucination.
321
+
322
+ Note that those numbers are computed at the completion level. Since multiple completions are sampled for each document chunk, the sampling scheme allows for correcting those errors and no document in the benchmarks fail extraction.
323
+
324
+ Table 7: Breakdown of parsing error rates from $\mathrm { L M D X } _ { \mathrm { P a L M } 2 - \mathrm { S m a l l } }$ responses on VRDU Ad-Buy Mixed and CORD datasets.
325
+
326
+ <table><tr><td>|D</td><td>Dataset</td><td>Invalid JSON</td><td>Invalid Entity Value Format</td><td>Entity Text Not Found</td></tr><tr><td rowspan="2">0</td><td>Ad-buy Form</td><td>0.18%</td><td>0.04%</td><td>0.59%</td></tr><tr><td>CORD</td><td>0.00%</td><td>0.00%</td><td>0.00%</td></tr><tr><td rowspan="2">10</td><td>Ad-buy Form</td><td>0.27%</td><td>0.04%</td><td>0.44%</td></tr><tr><td>CORD</td><td>0.00%</td><td>0.00%</td><td>0.00%</td></tr><tr><td rowspan="2">50</td><td>Ad-buy Form</td><td>0.24%</td><td>0.00%</td><td>0.17%</td></tr><tr><td>CORD</td><td>0.06%</td><td>0.00%</td><td>0.00%</td></tr><tr><td rowspan="2">100</td><td>Ad-buy Form</td><td>0.24%</td><td>0.00%</td><td>0.13%</td></tr><tr><td>CORD</td><td>0.00%</td><td>0.03%</td><td>0.00%</td></tr><tr><td rowspan="2">200</td><td>Ad-buy Form</td><td>0.25%</td><td>0.00%</td><td>0.09%</td></tr><tr><td>CORD</td><td>0.00%</td><td>0.00%</td><td>0.00%</td></tr></table>
327
+
328
+ # A.10 IN-CONTEXT LEARNING WITH NEAREST NEIGHBORS
329
+
330
+ In our study, nearest neighbors leads to a significant quality gain over randomly selecting examplars. In this section, we explore why that is the case in the context of VRD information extraction. Figures 12, 13 and 14 show typical retrievals using sentenceT5 embeddings on the OCR text for similarity. Unsurprisingly, nearest neighbors works well as it retrieves examplars from the same template as the target document, i.e. from the same merchant in the case of CORD documents (store and restaurant receipts). As those examples share the same layout, same boilerplate text, and same entities, it makes it a lot easier for the model to understand the correct extraction pattern.
331
+
332
+ ![](images/c9225defcae389aec689cdd8f29b0e966524e60618daccb5318b00628649e269.jpg)
333
+ Figure 12: Nearest Neighbors on CORD, Example 1, retrieving examplars from the same merchant.
334
+
335
+ ![](images/75b56b0e5d12b9cca8a2e40c30479574bbec4c7850e1042fb7d2176dc017260f.jpg)
336
+ Figure 13: Nearest Neighbors on CORD, Example 2, retrieving examplars from the same merchant.
337
+
338
+ ![](images/bbf25185c76bfc7ae315ca7b0dcf715461e8b469657307076c9499bf1f42dbc4.jpg)
339
+ Figure 14: Nearest Neighbors on CORD, Example 3, retrieving examplars from the same merchant.
parse/test/rcFXg2aqEj/rcFXg2aqEj_content_list.json ADDED
@@ -0,0 +1,838 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "LMDX: LANGUAGE MODEL-BASED DOCUMENT INFORMATION EXTRACTION AND LOCALIZATION ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Anonymous authors Paper under double-blind review ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "ABSTRACT ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "Large Language Models (LLM) have revolutionized Natural Language Processing (NLP), improving state-of-the-art on many existing tasks and exhibiting emergent capabilities. However, LLMs have not yet been successfully applied on semistructured document information extraction, which is at the core of many document processing workflows and consists of extracting key entities from a visually rich document (VRD) given a predefined target schema. The main obstacles to LLM adoption in that task have been the absence of layout encoding within LLMs, critical for a high quality extraction, and the lack of a grounding mechanism ensuring the answer is not hallucinated. In this paper, we introduce Language Modelbased Document Information EXtraction and Localization (LMDX), a methodology to adapt arbitrary LLMs for document information extraction. LMDX can do extraction of singular, repeated, and hierarchical entities, both with and without training data, while providing grounding guarantees and localizing the entities within the document. Finally, we apply LMDX to the PaLM 2-Small LLM and evaluate it on VRDU and CORD benchmarks, setting a new state-of-the-art and showing how LMDX enables the creation of high quality, data-efficient parsers. ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "1 INTRODUCTION ",
27
+ "text_level": 1,
28
+ "page_idx": 0
29
+ },
30
+ {
31
+ "type": "text",
32
+ "text": "The recent advent of transformers (Vaswani et al., 2017) and self-supervised pretraining procedures has led to significant progress in Visually Rich Document (VRD) Understanding. Within that field, the task of document information extraction (IE), which consists of extracting key entities within a semi-structured document (e.g. invoice, tax form, paystub, receipt, etc) given a predefined schema, has received a lot of attention from industry and academia due to its importance and wide applicability to intelligent document processing workflows. However, document information extraction still remains challenging for current generation systems. In particular, information in semi-structured forms is organized in complex layout across many possible templates, which requires understanding of the document context, spatial alignment among the different segments of text, and tabular arrangement of structured entities (e.g. line items on an invoice, deduction items on a paystub, etc.). Content on the document can be printed or handwritten, with scanning artefacts like rotation and contrast issues. Moreover, since some business automation workflows require certain level of accuracy, they are often integrated with human-in-the-loop interactions for auditing and correction of predictions, requiring knowing the precise location of extracted entities to make it a tractable task for a human rater. Finally, since a quasi-infinite number of document types exist, and that organizations have limited annotation resources, most parsers are built with very small amount of data. ",
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "From those complexities emerge the following desiderata of document information extraction systems: they should support high-quality extraction of singular, repeated, and hierarchical entities, while localizing those entities in the document, and doing so with very low or no amount of training data. So far, no publicly disclosed system has been able to address all of those desiderata. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "text",
42
+ "text": "Many current approaches divide the problem in two stages: a text recognition/serialization step, usually achieved by an off-the-shelf Optical Character Recognition (OCR) service, followed by a parsing step, which finds the relevant entity values from the recognized text. Since the text serialization is imperfect, much attention has been given to fusing the text and layout together in the parsing step (Majumder et al., 2020; Garncarek et al., 2021; Hwang et al., 2021; Katti et al., 2018; Denk & Reisswig, 2019). Hong et al. (2021) proposes to encode the relative 2D distances of text blocks in the attention of the transformer, and learning from unlabeled documents with an area-masking strategy. Lee et al. (2022) proposes encoding the relative token positions with a graph neural network with edges constructed from a beta-skeleton algorithm. It further frames information extraction as a Named Entity Recognition (NER) task with an Inside-Outside-Begin (IOB) token tagging scheme (Ramshaw & Marcus, 1995; Palm et al., 2017) which allows them to localize the entities. However, IOB does not support extracting hierarchical entities, and is not robust to text serialization errors, where an entity is broken in disjoint segments. ",
43
+ "page_idx": 0
44
+ },
45
+ {
46
+ "type": "text",
47
+ "text": "",
48
+ "page_idx": 1
49
+ },
50
+ {
51
+ "type": "text",
52
+ "text": "Since text and layout do not contain all the information in the document (e.g. table boundaries, logos), leveraging the image modality has also been extensively explored (Xu et al., 2021; Lee et al., 2023; Appalaraju et al., 2021; 2023; Zhang et al., 2022). Xu et al. (2020) uses a separate image encoder before adding the output as feature to the token encodings, while Huang et al. (2022) jointly models the page image patches alongside the tokens, using a word-patch alignment self-supervised pretraining task to learn the connection between the modalities. ",
53
+ "page_idx": 1
54
+ },
55
+ {
56
+ "type": "text",
57
+ "text": "Other approaches treat extraction as a sequence generation problem. Powalski et al. (2021) adds an auto-regressive decoder on top of a text-layout-image encoder, all initialized from T5 (Raffel et al., 2020). Kim et al. (2022) foregoes the text recognition step completely, using a Vision Transformer encoder with an auto-regressive decoder pretrained on a pseudo-OCR task on a large document image corpora, and finetuned on the final extraction parse tree with Extensible Markup Language (XML) tags for the target extraction schema. While this approach allows to predict hierarchical entities, it does not allow localizing entities in the document. ",
58
+ "page_idx": 1
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "None of the previously discussed approaches attempt to understand the semantics of the schema and its entity types, and instead opt to encode the schema in the model weights through training, hence requiring training data for unseen schemas and document types. QueryForm (Wang et al., 2023b) utilizes a prompt encoding both the schema and entity types, allowing the model to do zero-shot extraction. Likewise, Wei et al. (2023) inputs the raw entity types in the encoder itself, and uses a scoring matrix to predict the link classes between document tokens and types, with great few-shot performance. However, both approaches are not able to predict hierarchical entities. ",
63
+ "page_idx": 1
64
+ },
65
+ {
66
+ "type": "text",
67
+ "text": "In parallel, Large Language Models (OpenAI, 2023; Google et al., 2023; Hoffmann et al., 2022) have revolutionized Natural Language Processing, showing the capabilities to solve a task with simply an instruction (Wei et al., 2022) or a few examples added to the prompt (Brown et al., 2020). This paradigm opens the possibility of extracting entities with very little to no training data. Wang et al. (2023a) transforms the NER task to a sequence generation task suitable for LLMs by incorporating special tokens in the sequence, marking the entity boundaries, and proposes a self-verification strategy limiting the LLM hallucinations. However, this is applicable to text-only scenarios, with hallucinations still a possibility. ",
68
+ "page_idx": 1
69
+ },
70
+ {
71
+ "type": "text",
72
+ "text": "This motivates us to introduce Language Model-based Document Information EXtraction and Localization (LMDX), a methodology for leveraging off-the-shelf LLMs for information extraction and localization on semi-structured documents. Our contributions can be summarized as follows: ",
73
+ "page_idx": 1
74
+ },
75
+ {
76
+ "type": "text",
77
+ "text": "• We propose a prompt that enables LLMs to perform the document IE task on leaf and hierarchical entities with precise localization, including without any training data, and using only the simple text-in, text-out interface that all LLMs provide. \n• We also propose a layout encoding scheme that communicate spatial information to the LLM without any change to its architecture. \n• We introduce a decoding algorithm transforming the LLM responses into extracted entities and their bounding boxes on the document, while discarding all hallucination. \n• We systematically evaluate the data efficiency of LMDX on multiple public benchmarks and establish a new state-of-the-art on those by a wide margin, especially at low-data regimes. ",
78
+ "page_idx": 1
79
+ },
80
+ {
81
+ "type": "text",
82
+ "text": "A comparison of LMDX characteristics and other popular document information extraction systems can be found at Table 1. ",
83
+ "page_idx": 1
84
+ },
85
+ {
86
+ "type": "table",
87
+ "img_path": "images/69e37f70d0754718e7f5ee1d214da725a51842eee00cc7a351b2ecb89cc336ec.jpg",
88
+ "table_caption": [
89
+ "Table 1: Comparison of document information extraction systems. "
90
+ ],
91
+ "table_footnote": [],
92
+ "table_body": "<table><tr><td>Document Information Extraction Systems</td><td>Hierarchical entity</td><td>Entity localization</td><td>Zero-shot support</td></tr><tr><td>FormNet(v2),LayoutLM(v2),Docformer, Glean,.</td><td>X</td><td>√</td><td></td></tr><tr><td>QueryForm,PPN</td><td>X</td><td>√</td><td>√</td></tr><tr><td>Donut</td><td>√</td><td>X</td><td>X</td></tr><tr><td>LMDX (Ours)</td><td>√</td><td>√</td><td>√</td></tr></table>",
93
+ "page_idx": 2
94
+ },
95
+ {
96
+ "type": "text",
97
+ "text": "2 METHODOLOGY ",
98
+ "text_level": 1,
99
+ "page_idx": 2
100
+ },
101
+ {
102
+ "type": "text",
103
+ "text": "2.1 OVERVIEW ",
104
+ "text_level": 1,
105
+ "page_idx": 2
106
+ },
107
+ {
108
+ "type": "text",
109
+ "text": "Overall, our pipeline is divided into five stages: OCR, chunking, prompt generation, LLM inference and decoding, detailed in the following sections. An overview with a simple example can be found in Figure 1, with the input and output of each stage showcased. In this example, the target schema contains two leaf entity types retailer and subtotal, and one hierarchical entity type line_item, composed of a product_id and a product_price. ",
110
+ "page_idx": 2
111
+ },
112
+ {
113
+ "type": "image",
114
+ "img_path": "images/fe6dbefaf7d339341a4a6b63c3cdc34fe4058064a7b4bf3f905841e391e50a90.jpg",
115
+ "image_caption": [
116
+ "Figure 1: Overview of the LMDX methodology. "
117
+ ],
118
+ "image_footnote": [],
119
+ "page_idx": 2
120
+ },
121
+ {
122
+ "type": "text",
123
+ "text": "2.2 OPTICAL CHARACTER RECOGNITION ",
124
+ "text_level": 1,
125
+ "page_idx": 2
126
+ },
127
+ {
128
+ "type": "text",
129
+ "text": "We first use an off-the-shelf OCR service on the document image to obtain words and lines segments, along with their corresponding spatial position (bounding box) on the document. An example of output from that stage on a sample document is given in Appendix A.6. ",
130
+ "page_idx": 2
131
+ },
132
+ {
133
+ "type": "text",
134
+ "text": "2.3 CHUNKING ",
135
+ "text_level": 1,
136
+ "page_idx": 2
137
+ },
138
+ {
139
+ "type": "text",
140
+ "text": "While some LLMs support long context (hundreds of thousands of tokens), not all LLMs can fit the entire document within its prompt. For those cases, the document is divided into document chunks so that each is small enough to be processed by the LLM. To achieve this, we first divide the document into individual pages, then we iteratively remove the last line segments (coming from OCR) until the prompt containing this chunk is below the maximum input token length of the LLM. Lastly, we group those removed lines as a new document page, and repeat the same logic until all chunks are below the input token limit of the LLM. At the end of this optional stage, we have $N$ chunks. The decision to first divide the document by page stems from the observation that entities rarely cross page boundaries, and as such this chunking scheme will have minimal impact on the final extraction quality. The algorithm is described in pseudo-code in Appendix A.1. ",
141
+ "page_idx": 2
142
+ },
143
+ {
144
+ "type": "text",
145
+ "text": "2.4 PROMPT GENERATION ",
146
+ "text_level": 1,
147
+ "page_idx": 3
148
+ },
149
+ {
150
+ "type": "text",
151
+ "text": "The prompt generation stage takes in the $N$ document chunks and creates a LLM prompt for each of them. As seen in Figure 2, our prompt design contains the document representation, a description of the task, and the target schema representation containing the entities to extract. XML-like tags are used to define the start and end of each component. ",
152
+ "page_idx": 3
153
+ },
154
+ {
155
+ "type": "image",
156
+ "img_path": "images/040a0ccca62f240d3351bed9b754fd739b63d70d91c51d9ba41a2765e4984218.jpg",
157
+ "image_caption": [
158
+ "Figure 2: Structure of the LLM prompts. "
159
+ ],
160
+ "image_footnote": [],
161
+ "page_idx": 3
162
+ },
163
+ {
164
+ "type": "text",
165
+ "text": "Document Representation. The chunk content is represented in the prompt as the concatenation of all its segment texts, suffixed with the coordinates of those segments in the following format: $< s e g m e n t t e x t > ~ X X | Y Y _ { s e g m e n t }$ . Coordinate tokens are built by normalizing the segment’s X and Y coordinates, and quantizing them in $B$ buckets, assigning the index of that bucket as the token for a coordinate. ",
166
+ "page_idx": 3
167
+ },
168
+ {
169
+ "type": "text",
170
+ "text": "This coordinate-as-tokens scheme allows us to communicate the layout modality to the LLM, without any change to its architecture. There are many variation to that scheme: using OCR line versus OCR words as segment, the granularity of the quantization, and the number of coordinates to use per segment (e.g. $[ x _ { \\mathrm { c e n t e r } } , y _ { \\mathrm { c e n t e r } } ]$ versus $[ x _ { \\mathrm { m i n } } , y _ { \\mathrm { m i n } } , x _ { \\mathrm { m a x } } , y _ { \\mathrm { m a x } } ] )$ . Appendix A.4 shows how those variations affect the prompt token length. In all our experiments, we use line-level segments with 2 coordinates $[ x _ { \\mathrm { c e n t e r } } , y _ { \\mathrm { c e n t e r } } ]$ and $B = 1 0 0$ quantization buckets. ",
171
+ "page_idx": 3
172
+ },
173
+ {
174
+ "type": "text",
175
+ "text": "Task Description. The task description is simply a short explanation of the task to accomplish. In our experiments, we hard code it to the following: From the document, extract the text values and tags of the following entities:. ",
176
+ "page_idx": 3
177
+ },
178
+ {
179
+ "type": "text",
180
+ "text": "Schema Representation. The schema is represented as a structured JSON object, where the keys are the entity types to be extracted, and the values correspond to their occurrence (single or multiple) and sub-entities (for hierarchical entities). For instance, {\"foo\": \"\", \"bar\": [{\"baz\": []}]} means that the LLM should extract only a single entity of type foo and multiple hierarchical entities of type bar, that could each hold multiple entities of type baz. ",
181
+ "page_idx": 3
182
+ },
183
+ {
184
+ "type": "text",
185
+ "text": "After this step, we have $N$ prompts, one for each document chunk. A full example of a prompt on a document can be found in Appendix A.6. ",
186
+ "page_idx": 3
187
+ },
188
+ {
189
+ "type": "text",
190
+ "text": "2.5 COMPLETION TARGETS ",
191
+ "text_level": 1,
192
+ "page_idx": 3
193
+ },
194
+ {
195
+ "type": "text",
196
+ "text": "In this section, we describe the expected LLM completion format, which can be observed in Figure 1. Like the schema, the completion is a JSON structured object with the keys being the entity types, and values being the extracted information from the document chunk. JSON was chosen as a format for the completion and schema since it supports hierarchical objects, is very token-efficient, and usually present in LLMs training data mixtures. Note that the keys in the completion have the same ordering, occurrence and class (hierarchical or leaf) as the entity types in the schema. The values of leaf entities must follow a specific format: ",
197
+ "page_idx": 3
198
+ },
199
+ {
200
+ "type": "equation",
201
+ "img_path": "images/d1b3d371ed1125a5ead1bda7bdea0e2b54920d05c7ee83d346f61fa56d488f1e.jpg",
202
+ "text": "$$\n< t e x t o n s e g m e n t _ { 1 } > ~ X X | Y Y _ { s e g m e n t _ { 1 } } \\backslash n < t e x t o n ~ s e g m e n t _ { 2 } > ~ X X | Y Y _ { s e g m e n t _ { 2 } } \\backslash n \\dots n\n$$",
203
+ "text_format": "latex",
204
+ "page_idx": 3
205
+ },
206
+ {
207
+ "type": "text",
208
+ "text": "An entity can span multiple (potentially disjoint) OCR segments (lines or words). For each segment of the entity, the value contains the entity text on that segment, along with the coordinate tokens of that segment, which act as a segment identifier, allowing us to localize the entities and ground the model prediction (e.g. making sure the extracted value is not a hallucination), as will be detailed in ",
209
+ "page_idx": 3
210
+ },
211
+ {
212
+ "type": "text",
213
+ "text": "Section 2.7. Finally, missing entity types are completed by the model with null for singular types, and $[ ]$ for repeated types. Samples of completions can be found in Appendix A.6. ",
214
+ "page_idx": 4
215
+ },
216
+ {
217
+ "type": "text",
218
+ "text": "2.6 LLM INFERENCE ",
219
+ "text_level": 1,
220
+ "page_idx": 4
221
+ },
222
+ {
223
+ "type": "text",
224
+ "text": "In this stage of the pipeline, we run inference on the LLM with the $N$ prompts. For each prompt, we sample $K$ completions from the LLM (for a total of $N K$ completions for the entire document) using TopK sampling. This randomness in the sampling allows to do error correction (e.g. if a response is not valid JSON, have hallucinated segment coordinate identifier, etc), and increase the extraction quality as will be shown in further sections. Note that we still want the inference to be fully deterministic so that LMDX’s extractions are the same across two identical documents. To do so, we rely on pseudo-random sampling using a fixed seed. ",
225
+ "page_idx": 4
226
+ },
227
+ {
228
+ "type": "text",
229
+ "text": "2.7 DECODING ",
230
+ "text_level": 1,
231
+ "page_idx": 4
232
+ },
233
+ {
234
+ "type": "text",
235
+ "text": "In this stage, we parse the raw LLM completions into structured entities and their locations. ",
236
+ "page_idx": 4
237
+ },
238
+ {
239
+ "type": "text",
240
+ "text": "Conversion to structured entities. We begin by parsing each model completion as a JSON object. Completions that fail to parse are discarded. For each key-value pair in the JSON object, we interpret the key as the entity type and parse the value to get the entity text and bounding box (as detailed in the next paragraph). Predicted entity types that are not in the schema are discarded. If the model unexpectedly predicts multiple values for single-occurrence entity types, we use the most frequent value as the final predicted value. Hierarchical JSON object are recursively parsed as hierarchical entities in a similar manner. This algorithm is described in pseudo-code in Appendix A.3. ",
241
+ "page_idx": 4
242
+ },
243
+ {
244
+ "type": "text",
245
+ "text": "Entity Value Parsing. We expect the JSON value to include both text extractions and segment identifiers for each predicted entity, as described in Section 2.5. We first parse the value into its (segment text, segment identif ier) pairs. For each pair, we look up the corresponding segment in the original document using the segment identifier and verify that the extracted text is exactly included on that segment. The entity is discarded if that verification fails, ensuring LMDX discards all LLM hallucinations. Finally, once we have the entity location on all its segments, we get the entity bounding box by computing the smallest bounding box encompassing all the OCR words included in the entity. Entity values with any segments that fail to ground (invalid entity value format, non-existent segment identifier, or non-matching segment text) in the original document are discarded. The entity value parsing algorithm is described in pseudo-code in Appendix A.2, and parsing errors rates are detailed in Appendix A.9. ",
246
+ "page_idx": 4
247
+ },
248
+ {
249
+ "type": "text",
250
+ "text": "Prediction Merging. We first merge the predicted entities for the same document chunk from the $K$ LLM completions through majority voting (Wang et al., 2022). For each entity type, we gather the predicted entities, including empty predictions, across the $K$ completions. The most common prediction(s) are selected as the predicted value for that entity type. We then merge the predictions among the $N$ document chunks by concatenating them to obtain the document level predictions. ",
251
+ "page_idx": 4
252
+ },
253
+ {
254
+ "type": "text",
255
+ "text": "Prediction Merging for hierarchical entities. For hierarchical entities, we use the entire predicted tree value from a single LLM completion, as this method best preserves the parent-child relationship predicted by the model. For each top-level hierarchical entity type, we perform majority voting on all affiliated leaf, intermediate and top-level entity types among $K$ completions as if they are flattened. We then tally the votes with equal weight to determine which completion to use for the prediction, and select the most common one for that hierarchical entity. ",
256
+ "page_idx": 4
257
+ },
258
+ {
259
+ "type": "text",
260
+ "text": "3 EVALUATION ",
261
+ "text_level": 1,
262
+ "page_idx": 4
263
+ },
264
+ {
265
+ "type": "text",
266
+ "text": "We evaluate the methodology from section 2 on public benchmarks using the PaLM 2-Small LLM, which we call $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ . Note that we use the small version of this LLM due to limited accelerator resources, but larger versions could be used, likely leading to higher extraction quality. ",
267
+ "page_idx": 4
268
+ },
269
+ {
270
+ "type": "text",
271
+ "text": "Our training process is composed of two phases. In the first phase we finetune PaLM 2-Small on a data mixture containing a variety of (document, schema, extraction) tuples. In particular, this data mixture contains the Payment dataset (Majumder et al., 2020), along with a diverse set of publicly available PDF form templates obtained from government websites that we filled with synthetic data using an internal tool, and annotated for schema and entities to extract. The goal of this phase is to obtain a Base Entity Extractor model by training the model to interpret the semantics of the entity types and extraction hierarchy specified in the schema, and find them within the document, along with learning the extraction syntax. Hence, the variety of schemas and documents in this phase is of utmost importance. This model is used for doing zero-shot extraction on a wide variety of document types. ",
272
+ "page_idx": 4
273
+ },
274
+ {
275
+ "type": "text",
276
+ "text": "",
277
+ "page_idx": 5
278
+ },
279
+ {
280
+ "type": "text",
281
+ "text": "During the second phase, starting from the base entity extractor checkpoint from the previous phase, we finetune the LLM on the target to specialize it to do high quality extraction on the target benchmark. At this stage, only the target benchmark data is included in the training mixture. Note that, for zero-shot experiments, this second phase is skipped. Furthermore, no document or schema contained in the base extraction training phase overlap with the documents and schemas used in the specialization training phase. For all training phases, we follow the input and target syntax described in section 2.4 and 2.5. ",
282
+ "page_idx": 5
283
+ },
284
+ {
285
+ "type": "text",
286
+ "text": "3.1 PARAMETERS ",
287
+ "text_level": 1,
288
+ "page_idx": 5
289
+ },
290
+ {
291
+ "type": "text",
292
+ "text": "For training, we finetune PaLM 2-Small using a batch size of 8, a dropout probability of 0.1 and a learning rate of $1 0 ^ { - 6 }$ with a standard cross-entropy loss. Once training is done, we select the checkpoint with the lowest loss on the dev set, and report performance on the test set. For LLM inference, we use a temperature of 0.5 and a $\\mathrm { T o p } _ { \\mathrm { K } }$ of 40, sampling 16 responses for each chunk processed by the LLM, as described in section 2.6. Finally, for both training and inference, we use an input token length of 6144 and output token length of 2048. We use line-level segments and only two coordinates $[ \\mathrm { x _ { c e n t e r } , \\mathrm { y _ { c e n t e r } } } ]$ with 100 quantization buckets to save on the number of input and output tokens consumed by the coordinate-as-tokens scheme, as supported by Appendix A.4. ",
293
+ "page_idx": 5
294
+ },
295
+ {
296
+ "type": "text",
297
+ "text": "3.2 DATASETS ",
298
+ "text_level": 1,
299
+ "page_idx": 5
300
+ },
301
+ {
302
+ "type": "text",
303
+ "text": "Visually Rich Document Understanding (VRDU). Wang et al. (2023c) introduces a public benchmark for entity extraction from visually-rich documents that includes two datasets: Registration Form, containing 6 semantically rich entity types, and Ad-buy Form, containing 14 entity types with one hierarchical line_item entity. For each dataset, VRDU proposes samples of 10, 50, 100 and 200 train documents to evaluate the data efficiency of models. It also offers different tasks to evaluate the generalization powers of extraction systems: Single Template Learning (STL) where train/test share the same single template, Unseen Template Learning (UTL) where train/test contain disjoint sets of templates, and Mixed Template Learning (MTL) where train/test contain overlapping sets of templates. For our experiments, we finetune $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ for 4000 steps on each dataset, training data size, and task setup independently and report Micro-F1 through the provided evaluation tool. We then compare $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ to its published state-of-the-art baselines. ",
304
+ "page_idx": 5
305
+ },
306
+ {
307
+ "type": "text",
308
+ "text": "Consolidated Receipt Dataset (CORD). Park et al. (2019) introduces a benchmark of Indonesian receipts from shops and restaurants, with a target schema of 30 fine-grained entities, grouped into menu, total and subtotal hierarchical entities. $\\mathrm { C } \\mathrm { \\bar { O } R } { \\mathrm { D } } ^ { 1 }$ does not provide a standard evaluation toolkit, so we adopt the normalized Tree Edit Distance accuracy (n-TED) metric (Zhang & Shasha, 1989), previously introduced by Kim et al. (2022) on that benchmark, since it is agnostic to the output scheme used and considers the hierarchical entities as part of the metric. For our experiments, we use the official 800train/100dev/100test split, but also sample the first $D = 1 \\bar { 0 / 5 } 0 / 1 0 0 / 2 0 0$ documents from the train split to assess the data efficiency of LMDX on this benchmark. For each data setup, we finetune LMDX for 12000 steps. For comparison, we also train and evaluate state-ofthe-art baselines LayoutLMv3LARGE and Donut. Those baselines are detailed in Appendix A.8. ",
309
+ "page_idx": 5
310
+ },
311
+ {
312
+ "type": "text",
313
+ "text": "For all benchmarks. We use the publicly provided OCR for the LMDX model and baselines with text input, ensuring a fair comparison between them. Furthermore, we also compare $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ to large model baselines on all benchmarks in the zero-shot $( | \\mathcal { D } | = 0 )$ setting: GPT-3.5 that we prompt with the raw OCR and extraction instruction, and LLaVA-v1.5-13B that we prompt with the document image and extraction instructions. Those baselines are fully detailed in Appendix A.7. Unlike LMDX, those large model baselines do not localize their predictions. ",
314
+ "page_idx": 5
315
+ },
316
+ {
317
+ "type": "text",
318
+ "text": "",
319
+ "page_idx": 6
320
+ },
321
+ {
322
+ "type": "text",
323
+ "text": "3.3 RESULTS ",
324
+ "text_level": 1,
325
+ "page_idx": 6
326
+ },
327
+ {
328
+ "type": "table",
329
+ "img_path": "images/97422834c8dccfec513ea0d4aeede2541e243997a3282fca4252212ed4657cde.jpg",
330
+ "table_caption": [
331
+ "Table 2: Results of $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ on the different tasks and training data size setups $| \\mathcal D |$ of VRDU, with best performing model results in bold. "
332
+ ],
333
+ "table_footnote": [],
334
+ "table_body": "<table><tr><td rowspan=\"3\">D|</td><td rowspan=\"3\">Model</td><td rowspan=\"3\"></td><td colspan=\"4\">Registration Form</td><td colspan=\"4\">Ad-buy Form</td></tr><tr><td>Single</td><td>Unseen</td><td colspan=\"2\">Mixed Template</td><td>Unseen</td><td colspan=\"3\">Mixed Template</td></tr><tr><td>Micro-F1</td><td>Micro-F1</td><td>Micro-F1</td><td>Localization Accuracy</td><td>Micro-F1</td><td>Micro-F1</td><td>Line Item F1 (Hierarchical)</td><td>Localization Accuracy</td></tr><tr><td rowspan=\"3\">0</td><td>LLaVA-v1.5-13B</td><td>X</td><td>5.29</td><td>5.05</td><td>5.00</td><td>N/A</td><td>0.38</td><td>0.34</td><td>0.00</td><td>N/A</td></tr><tr><td>GPT-3.5</td><td>X</td><td>67.23</td><td>67.49</td><td>63.86</td><td>N/A</td><td>29.84</td><td>30.05</td><td>7.65</td><td>N/A</td></tr><tr><td>LMDXPaLM 2-Small</td><td>√</td><td>73.81</td><td>74.94</td><td>71.65</td><td>93.21</td><td>39.33</td><td>39.74</td><td>21.21</td><td>88.18</td></tr><tr><td rowspan=\"6\">10</td><td>FormNet</td><td>√</td><td>74.22</td><td>50.53</td><td>63.61</td><td></td><td>20.28</td><td>20.47</td><td>5.72</td><td>=</td></tr><tr><td>LayoutLM</td><td>√</td><td>65.91</td><td>25.54</td><td>36.41</td><td>98.71</td><td>19.92</td><td>20.20</td><td>6.95</td><td>92.60</td></tr><tr><td>LayoutLMv2</td><td></td><td>80.05</td><td>54.21</td><td>69.44</td><td>99.00</td><td>25.17</td><td>25.36</td><td>9.96</td><td>93.95</td></tr><tr><td>LayoutLMv3</td><td></td><td>72.51</td><td>21.17</td><td>60.72</td><td>99.20</td><td>10.01</td><td>10.16</td><td>5.92</td><td>90.68</td></tr><tr><td>LMDXPaLM 2-Small</td><td>√</td><td>90.88</td><td>86.87</td><td>87.72</td><td>99.75</td><td>54.82</td><td>54.35</td><td>39.35</td><td>94.51</td></tr><tr><td>FormNet</td><td>√</td><td>89.38</td><td>68.29</td><td>85.38</td><td></td><td>39.52</td><td>40.68</td><td>19.06</td><td></td></tr><tr><td rowspan=\"5\">50</td><td>LayoutLM</td><td>√</td><td>86.21</td><td>55.86</td><td>80.15</td><td>99.69</td><td>38.42</td><td>39.76</td><td>19.50</td><td>95.24</td></tr><tr><td>LayoutLMv2</td><td>√</td><td>88.68</td><td>61.36</td><td>84.13</td><td>99.54</td><td>41.59</td><td>42.23</td><td>20.98</td><td>95.64</td></tr><tr><td>LayoutLMv3</td><td></td><td>87.24</td><td>47.85</td><td>81.36</td><td>99.39</td><td>38.43</td><td>39.49</td><td>19.53</td><td>95.28</td></tr><tr><td>LMDXPaLM 2-Small</td><td>√</td><td>93.06</td><td>88.43</td><td>91.42</td><td>99.87</td><td>75.70</td><td>75.08</td><td>65.42</td><td>98.28</td></tr><tr><td>FormNet</td><td>√</td><td>90.91</td><td>72.58</td><td>88.13</td><td>=</td><td>39.88</td><td>40.38</td><td>18.80</td><td>=</td></tr><tr><td rowspan=\"5\">100</td><td>LayoutLM</td><td>√</td><td>88.70</td><td>63.68</td><td>86.02</td><td>99.63</td><td>41.46</td><td>42.38</td><td>21.26</td><td>95.09</td></tr><tr><td>LayoutLMv2</td><td>√</td><td>90.45</td><td>65.96</td><td>88.36</td><td>99.72</td><td>44.35</td><td>44.97</td><td>23.52</td><td>95.72</td></tr><tr><td>LayoutLMv3</td><td></td><td>89.23</td><td>57.69</td><td>87.32</td><td>99.72</td><td>41.54</td><td>42.63</td><td>22.08</td><td>95.88</td></tr><tr><td>LMDXPaLM 2-Small</td><td>√</td><td>93.97</td><td>89.70</td><td>92.41</td><td>99.92</td><td>75.99</td><td>78.05</td><td>69.77</td><td>98.69</td></tr><tr><td>FormNet</td><td>√</td><td></td><td>77.29</td><td>90.51</td><td></td><td>42.87</td><td>43.23</td><td>21.86</td><td></td></tr><tr><td rowspan=\"5\">200</td><td></td><td>√</td><td>92.12 90.47</td><td>70.47</td><td>87.94</td><td>99.69</td><td>44.18</td><td>44.66</td><td>23.90</td><td>= 95.38</td></tr><tr><td>LayoutLM</td><td></td><td>91.41</td><td>72.03</td><td>89.19</td><td>99.75</td><td>46.31</td><td>46.54</td><td>25.46</td><td>95.78</td></tr><tr><td>LayoutLMv2</td><td></td><td>90.89</td><td>62.58</td><td>89.77</td><td>99.67</td><td>44.43</td><td>45.16</td><td>24.51</td><td>95.95</td></tr><tr><td>LayoutLMv3</td><td></td><td></td><td>90.22</td><td>92.78</td><td>99.87</td><td>78.42</td><td>79.82</td><td>72.09</td><td></td></tr><tr><td>LMDXPaLM 2-Small</td><td>√</td><td>93.97</td><td></td><td></td><td></td><td></td><td></td><td></td><td>98.65</td></tr></table>",
335
+ "page_idx": 6
336
+ },
337
+ {
338
+ "type": "text",
339
+ "text": "Results for VRDU are presented in Table 2. For all data regimes and tasks, $\\mathrm { L M D X } _ { \\mathrm { P a L M } ; }$ 2-Small sets a new state-of-the-art by a wide margin. In particular, we find that $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ has higher extraction quality than GPT-3.5 and LLaVA-v1.5-13B while also localizing its predictions. $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ also exhibits similar extraction quality at zero-shot than baselines at 10-100 train dataset size (for instance $3 9 . 7 4 \\%$ Micro-F1 on Ad-Buy Form Mixed Template vs $4 0 . 6 8 \\%$ for FormNet at 50 train documents, or $7 3 . 8 1 \\%$ Micro-F1 on Registration Single Template vs $7 4 . 2 2 \\%$ for FormNet at 10 train documents). Moreover, $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ is much more data efficient than the baselines: it is at $5 . 0 6 \\%$ Micro-F1 of its peak performance at 10 training documents for Registration Form Mixed Template $( 8 7 . 7 2 \\%$ vs $9 2 . 7 8 \\%$ Micro-F1) while LayoutLMv2, the strongest finetuned baseline, is within $1 9 . 7 5 \\%$ of its peak performance $6 9 . 4 4 \\%$ vs $8 9 . 1 9 \\%$ Micro-F1). Lastly, $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ generalizes better to unseen templates than finetuned baselines: on Registration Form, $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ has a drop less than $5 \\%$ Micro-F1 on Unseen Template compared to Single Template across data regimes, while baselines (LayoutLMv2) sees a drop between $19 \\%$ and $27 \\%$ . ",
340
+ "page_idx": 6
341
+ },
342
+ {
343
+ "type": "text",
344
+ "text": "On CORD (results in Table 3), we observe similar trends, highlighting the generalization of the results. At $| \\mathcal { D } | = 1 0$ , $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ is $4 . 0 3 \\%$ from its peak performance attained at $| \\mathcal { D } | = 8 0 0$ versus $2 2 . 3 4 \\%$ for the strongest baseline LayoutLMv3LARGE, showcasing LMDX’s data efficiency. ",
345
+ "page_idx": 6
346
+ },
347
+ {
348
+ "type": "text",
349
+ "text": "Performance on Hierarchical Entities. As seen on Ad-Buy Form Mixed in Table 2, $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ has much higher Line Item F1 than the finetuned baselines for all data regimes. In particular, $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ has similar line item grouping performance at zero-shot than the best finetuned baseline at 200 train documents $( 2 1 . 2 1 \\%$ versus $2 5 . 4 6 \\%$ Line Item F1 respectively). With all the training data, $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ scores a $7 2 . 0 9 \\%$ F1 on line item, an absolute improvement of $4 6 . 6 3 \\%$ over the best baseline LayoutLMv2. Finally, $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ , which encode spatial information, has much higher zero-shot Line Item F1 than large models baselines. ",
350
+ "page_idx": 6
351
+ },
352
+ {
353
+ "type": "text",
354
+ "text": "Localization Accuracy We compute the Localization Accuracy of $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ and all baselines that can localize entities using the formula: $\\begin{array} { r } { A c c u r a c y _ { L o c a l i z a t i o n } = \\frac { N _ { E + L } } { N _ { E } } } \\end{array}$ NE+L where NE+L is the number of entities correctly extracted and localized, and $N _ { E }$ is the number of entities correctly extracted. This allows to evaluate the localization quality independently of the extraction quality. Since $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ localizes at the line level, localization verification is done at the line-level as well, i.e. localization is considered correct if the prediction bounding box is covered by the groundtruth line-level bounding box by more than $80 \\%$ . We present the results in the Localization Accuracy Columns in Table 2. Overall, $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ can localize its predictions reliably at the line-level with the segment identifiers, with $8 8 \\% - 9 3 \\%$ accuracy at zero-shot, and $9 8 \\% - 9 9 \\%$ in finetuned cases, which is slightly higher than LayoutLM/LayoutLMv2/LayoutLMv3/FormNet baselines that can localize their predictions. ",
355
+ "page_idx": 6
356
+ },
357
+ {
358
+ "type": "text",
359
+ "text": "",
360
+ "page_idx": 7
361
+ },
362
+ {
363
+ "type": "table",
364
+ "img_path": "images/d2753a2c2d95ad88d49623abd1fbb0ce28d08ab17941cc954cc883cb7929533e.jpg",
365
+ "table_caption": [
366
+ "Table 3: $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ results on CORD. Normalized Tree Edit Distance Accuracy is reported. "
367
+ ],
368
+ "table_footnote": [],
369
+ "table_body": "<table><tr><td rowspan=\"2\">Model</td><td rowspan=\"2\">Localization</td><td colspan=\"6\">n-TED Accuracy</td></tr><tr><td>|D|=0</td><td>|D|=10</td><td>|D|=50</td><td>|D|=100</td><td>|D|= 200</td><td>|D|= 800</td></tr><tr><td>LLaVA-v1.5-13B</td><td>X</td><td>4.78</td><td></td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>GPT-3.5</td><td>X</td><td>58.25</td><td>=</td><td>=</td><td>=</td><td>=</td><td></td></tr><tr><td>Donut</td><td>X</td><td>0.00</td><td>33.01</td><td>75.44</td><td>82.17</td><td>84.49</td><td>90.23</td></tr><tr><td>LayoutLMv3LARGE</td><td>√</td><td>0.00</td><td>73.87</td><td>87.29</td><td>91.83</td><td>94.44</td><td>96.21</td></tr><tr><td>LMDXPaLM2-Small</td><td>√</td><td>67.47</td><td>92.27</td><td>93.80</td><td>93.64</td><td>94.73</td><td>96.30</td></tr></table>",
370
+ "page_idx": 7
371
+ },
372
+ {
373
+ "type": "text",
374
+ "text": "3.4 ABLATIONS ",
375
+ "text_level": 1,
376
+ "page_idx": 7
377
+ },
378
+ {
379
+ "type": "text",
380
+ "text": "In this section, we ablate different facets of the LMDX methodology to highlight their relative importance. The results can be found in Table 4 and are discussed below. For all ablations, we evaluate on the VRDU Ad-Buy Form Mixed Template task, only changing the ablated facet. ",
381
+ "page_idx": 7
382
+ },
383
+ {
384
+ "type": "table",
385
+ "img_path": "images/dce8bbe020598c066d8638ab1a579c61d33076509c6331cb555529f1f53685d0.jpg",
386
+ "table_caption": [
387
+ "Table 4: Ablations of Base Entity Extraction Training, Coordinate Tokens, and Sampling and their relative effects on extraction quality. All ablations are done on VRDU Ad-Buy Mixed Template. "
388
+ ],
389
+ "table_footnote": [],
390
+ "table_body": "<table><tr><td rowspan=\"2\">|D</td><td>LMDXPaLM 2-Small</td><td colspan=\"2\">Without Base EE Training</td><td colspan=\"2\">Without Coordinate Tokens</td><td colspan=\"2\">Without Sampling Strategy</td></tr><tr><td>Micro-F1</td><td>Micro-F1</td><td>△(%)</td><td>Micro-F1</td><td>△(%)</td><td>Micro-F1</td><td>△(%)</td></tr><tr><td>0</td><td>39.74</td><td>0.00</td><td>-39.74</td><td>27.59</td><td>-12.15</td><td>39.53</td><td>-0.21</td></tr><tr><td>10</td><td>54.35</td><td>42.91</td><td>-11.44</td><td>39.37</td><td>-14.98</td><td>52.85</td><td>-1.50</td></tr><tr><td>50</td><td>75.08</td><td>66.51</td><td>-8.57</td><td>62.35</td><td>-12.73</td><td>73.88</td><td>-1.20</td></tr><tr><td>100</td><td>78.05</td><td>68.87</td><td>-9.18</td><td>65.14</td><td>-12.91</td><td>77.30</td><td>-0.75</td></tr><tr><td>200</td><td>79.82</td><td>72.25</td><td>-7.57</td><td>65.70</td><td>-14.12</td><td>78.43</td><td>-1.39</td></tr></table>",
391
+ "page_idx": 7
392
+ },
393
+ {
394
+ "type": "text",
395
+ "text": "Effects of Base Entity Extraction Training. In this ablation, we remove the first stage training on the varied data mixture and directly finetune on the VRDU target task. As seen on columns 3-4 of Table 4, ablating that training stage leads to significant drop in extraction quality in finetuned scenarios and the complete loss of zero-shot extraction ability due to the model not respecting the extraction format, hence failing decoding. As the train set size increases, the degraded performance lessens from $- 1 1 . 4 4 \\%$ to $- 7 . 5 7 \\%$ , as the model learns the task and desired completion format. ",
396
+ "page_idx": 7
397
+ },
398
+ {
399
+ "type": "text",
400
+ "text": "Effects of Coordinate Tokens. In this ablation, we replace the coordinate tokens, which communicate the position of each line within the document, by the index of that line. This index still acts as a unique identifier for the line segment (required for entity localization and grounding) but does not communicate any position information. An example of a prompt with line index can be found in Appendix A.6. As can be seen on columns 5-6 of Table 4, the coordinate tokens are substantially important to the extraction quality, ranging from $1 2 . 1 5 \\%$ to $1 4 . 9 8 \\%$ absolute micro-F1 improvement across the data regimes. ",
401
+ "page_idx": 7
402
+ },
403
+ {
404
+ "type": "text",
405
+ "text": "Effects of Sampling Strategy. In this ablation, we discard our strategy of sampling $K \\ : = \\ : 1 6$ completions per chunk, and instead sample a single response. As seen in columns 7-8 of Table 4, this leads to a $0 . 2 1 \\%$ to $1 . 5 \\%$ drop in micro-F1. While overall minor for quality, the sampling strategy also allows to correct extraction format mistakes (parsing error rates are given in Appendix A.9), leading to a successful extraction on all documents within the benchmarks. ",
406
+ "page_idx": 7
407
+ },
408
+ {
409
+ "type": "text",
410
+ "text": "3.5 IN-CONTEXT LEARNING PERFORMANCE ",
411
+ "text_level": 1,
412
+ "page_idx": 7
413
+ },
414
+ {
415
+ "type": "text",
416
+ "text": "In this section, we study how in-context learning (ICL) compares to finetuning for LMDXPaLM 2-Small. To do so, we test two methodologies: Random, which randomly selects $| \\mathcal D |$ documents and extractions from the train set, and Nearest Neighbors, which uses similarity based on SentenceT5 embeddings2 (Ni et al., 2021) to retrieve $| \\mathcal D |$ documents to add in the LLM context. The results on CORD are shown in Table 5, where $\\mathbf { n }$ -TED is reported. Overall, while both methods increase the performance significantly, nearest neighbors has a clear advantage, matching the best random ICL performance with only a single in-context example $( 8 7 . 7 3 \\%$ versus $8 7 . 3 7 \\%$ n-TED), and matching the finetuned performance at $| \\mathcal { D } | = 1 0$ examples $9 2 . 8 2 \\%$ versus $9 2 . 2 7 \\%$ n-TED), as examples from the same template are retrieved (see Appendix A.10 for example retrievals). Note that, beyond $| \\mathcal { D } | = 1 0$ examples, the performance stops improving, as no more examples can fit in the context window of PaLM 2-Small. ",
417
+ "page_idx": 7
418
+ },
419
+ {
420
+ "type": "text",
421
+ "text": "",
422
+ "page_idx": 8
423
+ },
424
+ {
425
+ "type": "table",
426
+ "img_path": "images/4968e9b86526d353f049d65f6a25ccce17325f9dc67576518f16e6a841d36a4d.jpg",
427
+ "table_caption": [
428
+ "Table 5: In-Context Learning results on CORD with different retrieval methods. "
429
+ ],
430
+ "table_footnote": [],
431
+ "table_body": "<table><tr><td>ICL Method</td><td>|D|=0</td><td>|D|=1</td><td>|D|=3</td><td>|D|=5</td><td>|D|= 10</td><td>|D|= 20</td></tr><tr><td>Random</td><td>67.47</td><td>74.96</td><td>84.88</td><td>86.47</td><td>87.26</td><td>87.37</td></tr><tr><td>Nearest Neighbors</td><td>67.47</td><td>87.73</td><td>90.98</td><td>92.28</td><td>92.82</td><td>92.75</td></tr></table>",
432
+ "page_idx": 8
433
+ },
434
+ {
435
+ "type": "text",
436
+ "text": "3.6 ERROR ANALYSIS AND LIMITATIONS ",
437
+ "text_level": 1,
438
+ "page_idx": 8
439
+ },
440
+ {
441
+ "type": "text",
442
+ "text": "In this section, we perform an error analysis on the test set to identify common error patterns of LMDX. A very common error type we observe is caused by OCR lines grouping multiple semantically different segments. We show two instance of those cases observed in $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ on the VRDU Ad-Buy Form in Figure 3. In the first example, prediction for the entity line_item/program_desc includes text from the previous column \"Channel\" along with the value in the column \"Description\". From the OCR line bounding boxes, we can see that these two columns are grouped as the same OCR line. In the second example, the model confuses between the adjacent keys \"Invoice Period\" and \"Flight Dates\" and extracts invoice dates as flight dates. Similar to the first example, OCR line bounding boxes show that the invoice dates and the key \"Flight Dates\" are grouped together in the same line although they are semantically different. As $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a } }$ ll uses only coarse line layout information ([xcenter, ycenter] with 100 quantization buckets), the model fails in these cases, which is a current limitation of LMDX. We believe that incorporating the image modality will help make LMDX more performant and robust to those OCR errors. ",
443
+ "page_idx": 8
444
+ },
445
+ {
446
+ "type": "image",
447
+ "img_path": "images/76eafd5c095f734981fcfaf8df063a86f947664560b7fa454b0fefaec8ae145b.jpg",
448
+ "image_caption": [
449
+ "Figure 3: Typical error pattern of $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ . In both examples, the detected OCR lines are shown in red, the model predicted entities are shown in blue, and the groundtruth entities are shown in green. In both cases, the detected OCR lines merge two semantically distinct segments, causing the model to wrongly associate them in its predictions. "
450
+ ],
451
+ "image_footnote": [],
452
+ "page_idx": 8
453
+ },
454
+ {
455
+ "type": "text",
456
+ "text": "4 CONCLUSION ",
457
+ "text_level": 1,
458
+ "page_idx": 8
459
+ },
460
+ {
461
+ "type": "text",
462
+ "text": "In this paper, we have introduced LMDX, a methodology that enables using LLMs for information extraction on visually rich documents, setting a new state-of-the-art on public benchmarks VRDU and CORD. LMDX is the first methodology to allow the extraction of singular, repeated and hierarchical entities, while localizing the entities in the document. LMDX is data efficient, and even allows high quality extraction at zero-shot on entirely new document types and schemas. Nonetheless, since it relies on a LLM, LMDX is more resource-intensive than previous approaches, and its coordinate-as-tokens scheme requires long inputs and outputs. As future work, we will explore applying the methodology to open-source LLMs and adding the image modality to the system using Large Vision-Language Models. ",
463
+ "page_idx": 8
464
+ },
465
+ {
466
+ "type": "text",
467
+ "text": "5 REPRODUCIBILITY STATEMENT ",
468
+ "text_level": 1,
469
+ "page_idx": 9
470
+ },
471
+ {
472
+ "type": "text",
473
+ "text": "In order to increase reproducibility, we’ve provided all details of the LMDX methodology. We’ve included our LLM prompts and completions in Appendix A.6, along with all our algorithms for chunking and decoding in Appendix A.1, A.2 and A.3. Furthermore, we’ve provided the exact target schemas used in our experiments in Appendix A.5. For CORD specifically, we’ve used a metric with a public implementation (https://github.com/clovaai/donut/blob/master/ donut/util.py) and an easy to reproduce sampling strategy for the data-efficiency splits (first $D$ train documents). Finally, our baselines are publicly available (https://github.com/ microsoft/unilm/tree/master/layoutlmv3, https://github.com/clovaai/ donut) and thoroughly detailed in Appendix A.7 and A.8. ",
474
+ "page_idx": 9
475
+ },
476
+ {
477
+ "type": "text",
478
+ "text": "REFERENCES \nSrikar Appalaraju, Bhavan Jasani, Bhargava Urala Kota, Yusheng Xie, and R. Manmatha. Docformer: End-to-end transformer for document understanding. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 993–1003, October 2021. \nSrikar Appalaraju, Peng Tang, Qi Dong, Nishant Sankaran, Yichu Zhou, and R. Manmatha. Docformerv2: Local features for document understanding, 2023. \nTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners, 2020. \nTimo I. Denk and Christian Reisswig. Bertgrid: Contextualized embedding for 2d document representation and understanding, 2019. \nŁukasz Garncarek, Rafał Powalski, Tomasz Stanisławek, Bartosz Topolski, Piotr Halama, Michał Turski, and Filip Gralin ski. LAMBERT: Layout-aware language modeling for information ex- ´ traction. In Document Analysis and Recognition – ICDAR 2021, pp. 532–547. Springer International Publishing, 2021. doi: 10.1007/978-3-030-86549-8_34. URL https://doi.org/ 10.1007%2F978-3-030-86549-8_34. \nRohan Anil Google, Andrew M. Dai, Orhan Firat, Melvin Johnson, Dmitry Lepikhin, Alexandre Passos, Siamak Shakeri, Emanuel Taropa, Paige Bailey, Zhifeng Chen, Eric Chu, Jonathan H. Clark, Laurent El Shafey, Yanping Huang, Kathy Meier-Hellstern, Gaurav Mishra, Erica Moreira, Mark Omernick, Kevin Robinson, Sebastian Ruder, Yi Tay, Kefan Xiao, Yuanzhong Xu, Yujing Zhang, Gustavo Hernandez Abrego, Junwhan Ahn, Jacob Austin, Paul Barham, Jan Botha, James Bradbury, Siddhartha Brahma, Kevin Brooks, Michele Catasta, Yong Cheng, Colin Cherry, Christopher A. Choquette-Choo, Aakanksha Chowdhery, Clément Crepy, Shachi Dave, Mostafa Dehghani, Sunipa Dev, Jacob Devlin, Mark Díaz, Nan Du, Ethan Dyer, Vlad Feinberg, Fangxiaoyu Feng, Vlad Fienber, Markus Freitag, Xavier Garcia, Sebastian Gehrmann, Lucas Gonzalez, Guy Gur-Ari, Steven Hand, Hadi Hashemi, Le Hou, Joshua Howland, Andrea Hu, Jeffrey Hui, Jeremy Hurwitz, Michael Isard, Abe Ittycheriah, Matthew Jagielski, Wenhao Jia, Kathleen Kenealy, Maxim Krikun, Sneha Kudugunta, Chang Lan, Katherine Lee, Benjamin Lee, Eric Li, Music Li, Wei Li, YaGuang Li, Jian Li, Hyeontaek Lim, Hanzhao Lin, Zhongtao Liu, Frederick Liu, Marcello Maggioni, Aroma Mahendru, Joshua Maynez, Vedant Misra, Maysam Moussalem, Zachary Nado, John Nham, Eric Ni, Andrew Nystrom, Alicia Parrish, Marie Pellat, Martin Polacek, Alex Polozov, Reiner Pope, Siyuan Qiao, Emily Reif, Bryan Richter, Parker Riley, Alex Castro Ros, Aurko Roy, Brennan Saeta, Rajkumar Samuel, Renee Shelby, Ambrose Slone, Daniel Smilkov, David R. So, Daniel Sohn, Simon Tokumine, Dasha Valter, Vijay Vasudevan, Kiran Vodrahalli, Xuezhi Wang, Pidong Wang, Zirui Wang, Tao Wang, John Wieting, Yuhuai Wu, Kelvin Xu, Yunhan Xu, Linting Xue, Pengcheng Yin, Jiahui Yu, Qiao Zhang, Steven Zheng, Ce Zheng, Weikang Zhou, Denny Zhou, Slav Petrov, and Yonghui Wu. Palm 2 technical report, 2023. ",
479
+ "page_idx": 9
480
+ },
481
+ {
482
+ "type": "text",
483
+ "text": "Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, Tom Hennigan, Eric Noland, Katie Millican, George van den Driessche, Bogdan Damoc, Aurelia Guy, Simon Osindero, Karen Simonyan, Erich Elsen, Jack W. Rae, Oriol Vinyals, and Laurent Sifre. Training compute-optimal large language models, 2022. ",
484
+ "page_idx": 10
485
+ },
486
+ {
487
+ "type": "text",
488
+ "text": "Teakgyu Hong, Donghyun Kim, Mingi Ji, Wonseok Hwang, Daehyun Nam, and Sungrae Park. BROS: A layout-aware pre-trained language model for understanding documents. CoRR, abs/2108.04539, 2021. URL https://arxiv.org/abs/2108.04539. \nYupan Huang, Tengchao Lv, Lei Cui, Yutong Lu, and Furu Wei. Layoutlmv3: Pre-training for document ai with unified text and image masking. In Proceedings of the 30th ACM International Conference on Multimedia, 2022. \nWonseok Hwang, Jinyeong Yim, Seunghyun Park, Sohee Yang, and Minjoon Seo. Spatial dependency parsing for semi-structured document information extraction. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pp. 330–343, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.findings-acl.28. URL https://aclanthology.org/2021.findings-acl.28. \nAnoop Raveendra Katti, Christian Reisswig, Cordula Guder, Sebastian Brarda, Steffen Bickel, Johannes Höhne, and Jean Baptiste Faddoul. Chargrid: Towards understanding 2d documents, 2018. \nGeewook Kim, Teakgyu Hong, Moonbin Yim, JeongYeon Nam, Jinyoung Park, Jinyeong Yim, Wonseok Hwang, Sangdoo Yun, Dongyoon Han, and Seunghyun Park. Ocr-free document understanding transformer. In European Conference on Computer Vision (ECCV), 2022. \nChen-Yu Lee, Chun-Liang Li, Timothy Dozat, Vincent Perot, Guolong Su, Nan Hua, Joshua Ainslie, Renshen Wang, Yasuhisa Fujii, and Tomas Pfister. FormNet: Structural encoding beyond sequential modeling in form document information extraction. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 3735–3754, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022. acl-long.260. URL https://aclanthology.org/2022.acl-long.260. \nChen-Yu Lee, Chun-Liang Li, Hao Zhang, Timothy Dozat, Vincent Perot, Guolong Su, Xiang Zhang, Kihyuk Sohn, Nikolay Glushnev, Renshen Wang, Joshua Ainslie, Shangbang Long, Siyang Qin, Yasuhisa Fujii, Nan Hua, and Tomas Pfister. FormNetV2: Multimodal graph contrastive learning for form document information extraction. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 9011– 9026, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/ 2023.acl-long.501. URL https://aclanthology.org/2023.acl-long.501. \nBodhisattwa Prasad Majumder, Navneet Potti, Sandeep Tata, James Bradley Wendt, Qi Zhao, and Marc Najork. Representation learning for information extraction from form-like documents. In ACL, 2020. \nJianmo Ni, Gustavo Hernández Ábrego, Noah Constant, Ji Ma, Keith B Hall, Daniel Cer, and Yinfei Yang. Sentence-t5: Scalable sentence encoders from pre-trained text-to-text models. arXiv preprint arXiv:2108.08877, 2021. \nOpenAI. Gpt-4 technical report, 2023. \nRasmus Berg Palm, Ole Winther, and Florian Laws. Cloudscan - a configuration-free invoice analysis system using recurrent neural networks. In Proceedings of 2017 14th IAPR International Conference on Document Analysis and Recognition, pp. 406–413, United States, 2017. IEEE. ISBN 9781538635858. doi: 10.1109/ICDAR.2017.74. \nSeunghyun Park, Seung Shin, Bado Lee, Junyeop Lee, Jaeheung Surh, Minjoon Seo, and Hwalsuk Lee. Cord: A consolidated receipt dataset for post-ocr parsing. In Workshop on Document Intelligence at NeurIPS 2019, 2019. \nRafał Powalski, Łukasz Borchmann, Dawid Jurkiewicz, Tomasz Dwojak, Michał Pietruszka, and Gabriela Pałka. Going full-tilt boogie on document understanding with text-image-layout transformer. In Josep Lladós, Daniel Lopresti, and Seiichi Uchida (eds.), Document Analysis and Recognition – ICDAR 2021, pp. 732–747, Cham, 2021. Springer International Publishing. ISBN 978-3-030-86331-9. \nColin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-totext transformer. Journal of Machine Learning Research, 21(140):1–67, 2020. URL http: //jmlr.org/papers/v21/20-074.html. \nLance Ramshaw and Mitch Marcus. Text chunking using transformation-based learning. In Third Workshop on Very Large Corpora, 1995. URL https://aclanthology.org/W95-0107. \nAshish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In I. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper_files/paper/2017/ file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf. \nShuhe Wang, Xiaofei Sun, Xiaoya Li, Rongbin Ouyang, Fei Wu, Tianwei Zhang, Jiwei Li, and Guoyin Wang. Gpt-ner: Named entity recognition via large language models, 2023a. \nXuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022. \nZifeng Wang, Zizhao Zhang, Jacob Devlin, Chen-Yu Lee, Guolong Su, Hao Zhang, Jennifer Dy, Vincent Perot, and Tomas Pfister. QueryForm: A simple zero-shot form entity query framework. In Findings of the Association for Computational Linguistics: ACL 2023, pp. 4146–4159, Toronto, Canada, July 2023b. Association for Computational Linguistics. doi: 10.18653/v1/2023. findings-acl.255. URL https://aclanthology.org/2023.findings-acl.255. \nZilong Wang, Yichao Zhou, Wei Wei, Chen-Yu Lee, and Sandeep Tata. Vrdu: A benchmark for visually-rich document understanding. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, KDD ’23, pp. 5184–5193, New York, NY, USA, 2023c. Association for Computing Machinery. ISBN 9798400701030. doi: 10.1145/3580305.3599929. URL https://doi.org/10.1145/3580305.3599929. \nJason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, and Quoc V. Le. Finetuned language models are zero-shot learners, 2022. \nKaiwen Wei, Jie Yao, Jingyuan Zhang, Yangyang Kang, Fubang Zhao, Yating Zhang, Changlong Sun, Xin Jin, and Xin Zhang. Ppn: Parallel pointer-based network for key information extraction with complex layouts, 2023. \nYang Xu, Yiheng Xu, Tengchao Lv, Lei Cui, Furu Wei, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Wanxiang Che, Min Zhang, and Lidong Zhou. Layoutlmv2: Multi-modal pre-training for visually-rich document understanding. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics (ACL) 2021, 2021. \nYiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, and Ming Zhou. Layoutlm: Pretraining of text and layout for document image understanding. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 1192–1200, 2020. \nKaizhong Zhang and Dennis Shasha. Simple fast algorithms for the editing distance between trees and related problems. SIAM Journal on Computing, 18(6):1245–1262, 1989. doi: 10.1137/ 0218082. URL https://doi.org/10.1137/0218082. \nZhenrong Zhang, Jiefeng Ma, Jun Du, Licheng Wang, and Jianshu Zhang. Multimodal pre-training based on graph attention network for document understanding, 2022. ",
489
+ "page_idx": 10
490
+ },
491
+ {
492
+ "type": "text",
493
+ "text": "",
494
+ "page_idx": 11
495
+ },
496
+ {
497
+ "type": "text",
498
+ "text": "A APPENDIX ",
499
+ "page_idx": 12
500
+ },
501
+ {
502
+ "type": "text",
503
+ "text": "A.1 CHUNKING ALGORITHM ",
504
+ "page_idx": 12
505
+ },
506
+ {
507
+ "type": "text",
508
+ "text": "Algorithm 1 Document Chunking ",
509
+ "text_level": 1,
510
+ "page_idx": 12
511
+ },
512
+ {
513
+ "type": "table",
514
+ "img_path": "images/2e4f9c63962e6b513c674453718a9c9fc4177ab769850dc8e779ff5438f53407.jpg",
515
+ "table_caption": [],
516
+ "table_footnote": [],
517
+ "table_body": "<table><tr><td>1: function CHUNK(D,L, F) 2: 3: C=Φ</td><td>D is a document containing multiple pages.L is token limit. F is a function that outputs prompt token length given some segments (e.g. lines). C is to record all produced chunks.</td></tr><tr><td>4: 5:</td><td>for i= 1 to |D.pages| do S = D.pages[i].segments</td></tr><tr><td>6: while S≠do 7:</td><td>for j=|S| to 1 do &gt; Start pruning from the end of the page.</td></tr><tr><td></td><td></td></tr><tr><td>8:</td><td>if F(S[1 : j])≤L then</td></tr><tr><td>9:</td><td>C=CU{S[1:j]}</td></tr><tr><td>10:</td><td>S=S[j+1:|SI]</td></tr><tr><td>11:</td><td></td></tr><tr><td>12:</td><td>Exit for loop</td></tr><tr><td>13:</td><td>end if</td></tr><tr><td></td><td>end for</td></tr><tr><td>14:</td><td>end while</td></tr><tr><td>15:</td><td>end for</td></tr><tr><td>16:</td><td></td></tr><tr><td>17: end function</td><td>return C</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></table>",
518
+ "page_idx": 12
519
+ },
520
+ {
521
+ "type": "text",
522
+ "text": "A.2 ENTITY VALUE PARSING ALGORITHM ",
523
+ "page_idx": 12
524
+ },
525
+ {
526
+ "type": "text",
527
+ "text": "Algorithm 2 Entity Value Parsing ",
528
+ "text_level": 1,
529
+ "page_idx": 12
530
+ },
531
+ {
532
+ "type": "table",
533
+ "img_path": "images/122c69b4a7a46436305c210b738e8b6c174627cb18d7b06f0223881ee69828c4.jpg",
534
+ "table_caption": [],
535
+ "table_footnote": [],
536
+ "table_body": "<table><tr><td colspan=\"3\">1:function PARSEENTITYVALUE(D, E) D is a document chunk.</td></tr><tr><td>2:</td><td colspan=\"3\">&gt; E is raw extraction results for one entity type parsed from one LLM sample.</td></tr><tr><td>34</td><td colspan=\"3\">G= G is to record all parsed entity values.</td></tr><tr><td></td><td>R=Regex(“(\\d\\d\\/\\d\\d)&quot;)</td><td colspan=\"3\">&gt;R is a regex that captures the segment identifiers.</td></tr><tr><td>5:</td><td></td><td colspan=\"3\">M ={“s.x|s.y” -→ s|s E D.segments}DM holds a mapping between segment id and segment.</td></tr><tr><td>6:</td><td>for i=1to |E|do</td><td colspan=\"3\"></td></tr><tr><td>7:</td><td>W=</td><td colspan=\"3\">W is to hold all words for this entity.</td></tr><tr><td>8:</td><td>P = R.split(E[i])</td><td></td><td colspan=\"2\">&gt;P is expected to be interleaved text values and segment ids.</td></tr><tr><td>9:</td><td>for j= 1 to |P|/2 do</td><td></td><td></td><td></td></tr><tr><td>10:</td><td></td><td>if P[j * 2]M then</td><td></td><td></td></tr><tr><td>11:</td><td></td><td>Go to next i</td><td>&gt; Segment ID is hallucinated. Grounding failure.</td><td></td></tr><tr><td>12:</td><td>end if</td><td></td><td></td><td></td></tr><tr><td>13:</td><td>S= M[P[j * 2]]</td><td></td><td>&gt;Retrieve the stored segment from M with parsed segment ID.</td><td></td></tr><tr><td>14:</td><td></td><td>T=P[j*2-1]</td><td>T is to hold the predicted text.</td><td></td></tr><tr><td>15:</td><td></td><td> if T not substring of S then</td><td></td><td></td></tr><tr><td>16:</td><td></td><td>Go to next i</td><td>&gt; Grounding failure, skip the current entity.</td><td></td></tr><tr><td>17:</td><td></td><td>end if</td><td></td><td></td></tr><tr><td>18:</td><td></td><td>W=WU (SnT)</td><td></td><td></td></tr><tr><td>19:</td><td>end for</td><td></td><td></td><td></td></tr><tr><td>20:</td><td></td><td>G&#x27;.value= Uwew w.text_value</td><td></td><td> G&#x27; is to hold the entity to return.</td></tr><tr><td>21:</td><td></td><td></td><td></td><td></td></tr><tr><td>22:</td><td></td><td></td><td>G&#x27;.bounding_box = {min(b.x),min(b.y), max(b.x),max(b.y)}wew,b=w.bounding_box</td><td></td></tr><tr><td>23:</td><td>G=GU{G</td><td></td><td></td><td></td></tr><tr><td>24:</td><td>end for</td><td></td><td></td><td></td></tr><tr><td></td><td>return G</td><td></td><td></td><td></td></tr><tr><td></td><td>25: end function</td><td></td><td></td><td></td></tr></table>",
537
+ "page_idx": 12
538
+ },
539
+ {
540
+ "type": "text",
541
+ "text": "A.3 DECODING ALGORITHM ",
542
+ "text_level": 1,
543
+ "page_idx": 13
544
+ },
545
+ {
546
+ "type": "text",
547
+ "text": "Algorithm 3 Responses Decoding ",
548
+ "text_level": 1,
549
+ "page_idx": 13
550
+ },
551
+ {
552
+ "type": "table",
553
+ "img_path": "images/02cc6f8de5afcc4bad75c520853785df5ae4bcfb801b5a7228e6ba7bf89bcb9d.jpg",
554
+ "table_caption": [],
555
+ "table_footnote": [],
556
+ "table_body": "<table><tr><td>1:function DECODEFORTYPE(J,T,D) &gt;Jis one or more JSONobjects.</td></tr><tr><td>2: T is an entity type.</td></tr><tr><td>34 D is a document chunk.</td></tr><tr><td>E= &gt;E is to record all parsed and grounded entities.</td></tr><tr><td>5: for j=1 to|J| do</td></tr><tr><td>6: J&#x27;= J[j][T.type] &gt; J&#x27; is to hold entities for T&#x27;s type before grounding.</td></tr><tr><td>7: if T.subtypes = then T is leaf entity type.</td></tr><tr><td>8: E=EUParseEntityValue(D,J&#x27;)</td></tr><tr><td>9: else &gt;T is hierarchical entity type.</td></tr><tr><td>10: E&#x27;subtypes = UT&#x27;ET.subtypes DecodeForType(J&#x27;,T&#x27;,D) E&#x27; is hierarchical entity.</td></tr><tr><td></td></tr><tr><td>11: E=EU{E&#x27;}</td></tr><tr><td>12: end if</td></tr><tr><td>13: end for</td></tr><tr><td>14: return E</td></tr><tr><td>15:end function</td></tr><tr><td>16:</td></tr><tr><td>17: function MAJORITYVOTING(T, E) T is an entity type.</td></tr><tr><td>18: E is a 2D vector of entities of type T from all LLM responses.</td></tr><tr><td>19: V = [0.,,0,..,.0] ∈ RlEI Vis to record all votes.</td></tr><tr><td>20: L={T}</td></tr><tr><td>21: whileL≠do</td></tr><tr><td>22: T&#x27;=L[0]</td></tr><tr><td>23: E&#x27;=</td></tr><tr><td>24: for j=1 to|E| do</td></tr><tr><td>25: E&#x27;=E′U{ele∈E[j],e.type =T&#x27;} &gt;E&#x27;[j] holds entities with type T&#x27; from E[j].</td></tr><tr><td>26: end for</td></tr><tr><td>27: for i=1 to |E&#x27;|-1 do</td></tr><tr><td>28: for j=i+1 to|E&#x27;|do</td></tr><tr><td>29: if E&#x27;[]=E&#x27;j]then</td></tr><tr><td>30: V[=V+1</td></tr><tr><td>31: v=v+1</td></tr><tr><td>32: end if</td></tr><tr><td>33: end for</td></tr><tr><td>34: end for</td></tr><tr><td>35: L=L[1:|L]] &gt;Remove T&#x27; and inject its sub-types for recursion.</td></tr><tr><td>36: L = LUT&#x27;.subtypes</td></tr><tr><td>37: end while</td></tr><tr><td>38: return E[argmax(V)] Return the entity values with the highest votes.</td></tr><tr><td>39:end function</td></tr><tr><td>40:</td></tr><tr><td>41:function DECODEALLSAMPLES(S,T,D) &gt; S is all LLM response samples on D.</td></tr><tr><td>42: &gt;T is a list of entity types.</td></tr><tr><td>43: D is a document chunk.</td></tr><tr><td>44: return Ur&#x27;eT MajorityVoting(Us&#x27;∈s DecodeForType(ParseJson(S&#x27;),T&#x27;,D))</td></tr><tr><td>45:end function</td></tr></table>",
557
+ "page_idx": 13
558
+ },
559
+ {
560
+ "type": "text",
561
+ "text": "A.4 TOKEN LENGTH STATISTICS ",
562
+ "text_level": 1,
563
+ "page_idx": 14
564
+ },
565
+ {
566
+ "type": "text",
567
+ "text": "Table 6 details the token length $\\mathrm { 5 0 ^ { t h } }$ and $9 9 ^ { \\mathrm { t h } }$ percentiles) of the prompt and completion targets for the train split of datasets used in our experiments. We select the line level segment, 2 coordinate scheme, no JSON indentation so that all datasets fit within our 6144 prompt token length and 2048 output token length. ",
568
+ "page_idx": 14
569
+ },
570
+ {
571
+ "type": "text",
572
+ "text": "Table 6: Prompt and target token length of different coordinate-as-tokens schemes on VRDU and CORD benchmarks, using the vocabulary of PaLM 2-S. We vary the number of coordinates and their quantization buckets in the localization tags, the segment level (e.g. line versus word), chunking style (e.g. page versus max input tokens) and JSON indentation in the schema and completion targets. ",
573
+ "page_idx": 14
574
+ },
575
+ {
576
+ "type": "table",
577
+ "img_path": "images/bb1a1500cad3762d6ff81a53d2a74cb0ac34c054d3821fccb07f72675da95f01.jpg",
578
+ "table_caption": [],
579
+ "table_footnote": [],
580
+ "table_body": "<table><tr><td colspan=\"9\">VRDU Ad-Buy Form</td></tr><tr><td rowspan=\"2\"># Coord.</td><td rowspan=\"2\"># Quant.</td><td rowspan=\"2\">Segment</td><td rowspan=\"2\">Chunking</td><td rowspan=\"2\"> JSON Indent</td><td colspan=\"2\">Input</td><td colspan=\"2\">Target</td></tr><tr><td>50th</td><td>99th</td><td>50th</td><td>99th</td></tr><tr><td></td><td>100</td><td>Line</td><td>Page</td><td>None</td><td>2377</td><td>3920</td><td>602</td><td>1916</td></tr><tr><td></td><td>100</td><td>Word</td><td>Page</td><td>None</td><td>3865</td><td>13978</td><td>718</td><td>2328</td></tr><tr><td>224</td><td>100</td><td>Line</td><td>Page</td><td>None</td><td>3329</td><td>5284</td><td>777</td><td>2473</td></tr><tr><td>2</td><td>1000</td><td>Line</td><td>Page</td><td>None</td><td>2687</td><td>4322</td><td>660</td><td>2095</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>Page</td><td>4</td><td>2417</td><td>3328</td><td>689</td><td>2234</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>6144 tokens</td><td>None</td><td>2377</td><td>3920</td><td>602</td><td>1916</td></tr></table>",
581
+ "page_idx": 14
582
+ },
583
+ {
584
+ "type": "table",
585
+ "img_path": "images/00b94939acde2ffe1fbc022e8a8b9054e83ec5d75c881233d17425fc900070d3.jpg",
586
+ "table_caption": [
587
+ "VRDU Registration Form "
588
+ ],
589
+ "table_footnote": [],
590
+ "table_body": "<table><tr><td rowspan=\"2\"># Coord.</td><td rowspan=\"2\"># Quant.</td><td rowspan=\"2\">Segment</td><td rowspan=\"2\">Chunking</td><td rowspan=\"2\">JSON Indent</td><td colspan=\"2\">Input</td><td colspan=\"2\">Target</td></tr><tr><td>50h</td><td>99th</td><td>50h</td><td>99th</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>Page</td><td>None</td><td>963</td><td>1578</td><td>79</td><td>147</td></tr><tr><td>2</td><td>100</td><td>Word</td><td>Page</td><td>None</td><td>3083</td><td>5196</td><td>101</td><td>349</td></tr><tr><td>4</td><td>100</td><td>Line</td><td>Page</td><td>None</td><td>1232</td><td>2017</td><td>91</td><td>177</td></tr><tr><td>2</td><td>1000</td><td>Line</td><td>Page</td><td>None</td><td>1052</td><td>1723</td><td>83</td><td>155</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>Page</td><td>4</td><td>977</td><td>1592</td><td>92</td><td>160</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>6144 tokens</td><td>None</td><td>963</td><td>1578</td><td>79</td><td>147</td></tr></table>",
591
+ "page_idx": 14
592
+ },
593
+ {
594
+ "type": "table",
595
+ "img_path": "images/f1ee1db60d6c999adcb20fcd70ab5441a6925a2081bf171f011893c1d1c49a16.jpg",
596
+ "table_caption": [
597
+ "CORD "
598
+ ],
599
+ "table_footnote": [],
600
+ "table_body": "<table><tr><td rowspan=\"2\"># Coord.</td><td rowspan=\"2\"># Quant.</td><td rowspan=\"2\"> Segment</td><td rowspan=\"2\">Chunking</td><td rowspan=\"2\">JSON Indent</td><td colspan=\"2\">Input</td><td colspan=\"2\">Target</td></tr><tr><td>50h</td><td>99th</td><td>50th</td><td>99th</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>Page</td><td>None</td><td>342</td><td>869</td><td>355</td><td>1495</td></tr><tr><td>2</td><td>100</td><td>Word</td><td>Page</td><td>None</td><td>396</td><td>1067</td><td>375</td><td>1638</td></tr><tr><td>4</td><td>100</td><td>Line</td><td>Page</td><td>None</td><td>408</td><td>1139</td><td>422</td><td>1801</td></tr><tr><td>2</td><td>1000</td><td>Line</td><td>Page</td><td>None</td><td>364</td><td>959</td><td>376</td><td>1957</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>Page</td><td>4</td><td>411</td><td>938</td><td>474</td><td>1997</td></tr><tr><td>2</td><td>100</td><td>Line</td><td>6144 tokens</td><td>None</td><td>342</td><td>869</td><td>355</td><td>1495</td></tr></table>",
601
+ "page_idx": 14
602
+ },
603
+ {
604
+ "type": "text",
605
+ "text": "A.5 SCHEMAS ",
606
+ "text_level": 1,
607
+ "page_idx": 15
608
+ },
609
+ {
610
+ "type": "text",
611
+ "text": "In this section, we present the schemas used for the experiments of this paper. The schema for VRDU Ad-Buy Form, VRDU Registration Form, and CORD can be found in Figure 4, Figure 5 and Figure 6 respectively. ",
612
+ "page_idx": 15
613
+ },
614
+ {
615
+ "type": "image",
616
+ "img_path": "images/2f5574f4dab4d4bee3b92e6a1e0b491a8465a9b48efee1669f7f6d75277eda50.jpg",
617
+ "image_caption": [
618
+ "Figure 4: VRDU Ad-Buy Form Schema. "
619
+ ],
620
+ "image_footnote": [],
621
+ "page_idx": 15
622
+ },
623
+ {
624
+ "type": "image",
625
+ "img_path": "images/e52a04e6fc814bf3d043835a9a3be67dd8a551ae780091ab9d7e25722e51e563.jpg",
626
+ "image_caption": [
627
+ "Figure 5: VRDU Registration Form Schema. "
628
+ ],
629
+ "image_footnote": [],
630
+ "page_idx": 15
631
+ },
632
+ {
633
+ "type": "image",
634
+ "img_path": "images/a1316bdc95db1a831e4ca0e06068fb09ff8bca379ec5ecbbe30c1e0a234f0056.jpg",
635
+ "image_caption": [
636
+ "Figure 6: CORD Schema. Note that the original entity types (shown as comments) have been renamed to more semantically meaningful names. "
637
+ ],
638
+ "image_footnote": [],
639
+ "page_idx": 16
640
+ },
641
+ {
642
+ "type": "text",
643
+ "text": "A.6 SAMPLE PROMPTS AND COMPLETIONS ",
644
+ "text_level": 1,
645
+ "page_idx": 17
646
+ },
647
+ {
648
+ "type": "text",
649
+ "text": "In this section, we present example of LMDX prompts and completions from the LLM on the VRDU Ad-Buy dataset to better showcase the format used. Figure 7 shows the original document with the line bounding boxes from OCR, Figure 8 shows the corresponding prompt and completion on that document with coordinate segment identifiers, and Figure 9 shows the same prompt and completion, but with line index segment identifiers (used in ablation studies to showcase how the LLM can interpret the layout). ",
650
+ "page_idx": 17
651
+ },
652
+ {
653
+ "type": "image",
654
+ "img_path": "images/6ace8c51fd76c197e4ced05be07a81054d1a3412e843e0d2ce6bf4f79c542765.jpg",
655
+ "image_caption": [],
656
+ "image_footnote": [],
657
+ "page_idx": 17
658
+ },
659
+ {
660
+ "type": "image",
661
+ "img_path": "images/76bedd71417a488d5a108e74870fcb6d72666b5e7036c328135acd21e04a3ef3.jpg",
662
+ "image_caption": [
663
+ "Figure 8: VRDU Ad-Buy Form sample prompt and completion with 2 coordinates for segment identifier. The document is truncated for easier visualization. "
664
+ ],
665
+ "image_footnote": [],
666
+ "page_idx": 18
667
+ },
668
+ {
669
+ "type": "image",
670
+ "img_path": "images/a1430593e27f937b685bac9eb5a6d218c2e2fb73241dc87dc600e2f423278d6b.jpg",
671
+ "image_caption": [
672
+ "Figure 9: VRDU Ad-Buy Form sample prompt and completion with line index for segment identifier, which does not communicate layout information. The document is truncated for easier visualization. "
673
+ ],
674
+ "image_footnote": [],
675
+ "page_idx": 19
676
+ },
677
+ {
678
+ "type": "text",
679
+ "text": "A.7 COMMON BASELINES DETAILS",
680
+ "text_level": 1,
681
+ "page_idx": 20
682
+ },
683
+ {
684
+ "type": "text",
685
+ "text": "We compare LMDX to other Large Model baselines on all benchmarks in the zero-shot context. \nThose baselines are detailed below. ",
686
+ "page_idx": 20
687
+ },
688
+ {
689
+ "type": "text",
690
+ "text": "GPT-3.5 Baseline. We evaluate the zero-shot extraction ability of GPT-3.5, a strong LLM baseline. To do so, we prompt it with the raw OCR text (no coordinate tokens or segment identifier like for LMDX), and extraction instructions alongside the schema in JSON format. We then parse the completions as JSON to get the predicted entities directly. Note that GPT-3.5’s predicted entities are also not localized within the document. A sample prompt can be observed in Figure 10. ",
691
+ "page_idx": 20
692
+ },
693
+ {
694
+ "type": "text",
695
+ "text": "LLaVA-v1.5-13B Baseline. We evaluate the zero-shot extraction ability of LLaVA-v1.5-13B, a strong vision-text large model. The prompt includes task description, instructions and target schema represented in JSON format as text input and the document page as image input. We provide examples of valid JSON values in the task instructions. For each page of a test document, we infer the extraction in a JSON format. We merge the individual page JSONs to obtain the final extraction for a document. Overall, in the the zero-shot setting, we notice the JSON parse error rate of the LLM completions is $10 \\%$ which is higher than that of LMDX (as seen in the Appendix A.9). Along with invalid JSON format, the model errors also include several OCR errors and hallucinations of entity values. Note that LLaVA-v1.5-13B’s predicted entities are also not localized within the document. A sample prompt can be observed in Figure 11. ",
696
+ "page_idx": 20
697
+ },
698
+ {
699
+ "type": "image",
700
+ "img_path": "images/63337f7810df1a77def09adc76310d7f7acb01dd7fa717fd615af0227b66c0ac.jpg",
701
+ "image_caption": [
702
+ "Figure 10: Sample prompt for GPT-3.5 baseline for VRDU Registration Form. "
703
+ ],
704
+ "image_footnote": [],
705
+ "page_idx": 20
706
+ },
707
+ {
708
+ "type": "text",
709
+ "text": "\\${DOCUMENT_IMAGE} ",
710
+ "text_level": 1,
711
+ "page_idx": 21
712
+ },
713
+ {
714
+ "type": "text",
715
+ "text": "Given the document, extract the text value of the entities included in the schema in json format. \n- The extraction must respect the JSON schema. \n- Only extract entities specified in the schema. Do not skip any ",
716
+ "page_idx": 21
717
+ },
718
+ {
719
+ "type": "text",
720
+ "text": "entity types. ",
721
+ "page_idx": 21
722
+ },
723
+ {
724
+ "type": "text",
725
+ "text": "- The values must only include text found in the document. \n- Use null or [] for missing entity types. \n- Do not indent the json you produce. \n- Examples of valid string value format: \"\\$ 1234.50\", \"John Do\", null. \n- Examples of valid list value format: [\"\\$ 1234.50\", \"John Do\"], []. \nSchema: {\"file_date\": \"\", \"foreign_principle_name\": \"\", \n\"registrant_name\": \"\", \"registration_num\": \"\", \"signer_name\": \"\", \n\"signer_title\": \"\"} \\`\\`json ",
726
+ "page_idx": 21
727
+ },
728
+ {
729
+ "type": "text",
730
+ "text": "",
731
+ "page_idx": 21
732
+ },
733
+ {
734
+ "type": "text",
735
+ "text": "A.8 CORD BASELINES DETAILS",
736
+ "text_level": 1,
737
+ "page_idx": 22
738
+ },
739
+ {
740
+ "type": "text",
741
+ "text": "LayoutLMv3LARGE Baseline. We follow the released implementation3 for the LayoutLMv3LARGE model and the training protocol described in Huang et al. (2022) as closely as possible. In particular, we train the model for 80 epochs for each experiment on CORD (namely, 10, 50, 100, 200, and 800-document training sets), on the IOB tags of the leaf entities. One difference in our training is that, due to computational resource constraints, we use batch_size $= 8$ and learning_rate $= \\overset { \\sim } { 2 } \\cdot 1 0 ^ { - 5 }$ . ",
742
+ "page_idx": 22
743
+ },
744
+ {
745
+ "type": "text",
746
+ "text": "As the LayoutLMv3 model can only extract leaf entities, we design and heavily optimize a heuristic algorithm to group the leaf entities into hierarchical entities menu, subtotal and total. The best heuristics we could find are as follows: ",
747
+ "page_idx": 22
748
+ },
749
+ {
750
+ "type": "text",
751
+ "text": "• For the subtotal and total hierarchical entity types, since they appear only once per document, we group all their extracted sub-entities under a single subtotal and total entity, respectively. • For menu hierarchical entity type, we observe that those entities usually occur multiple times on a document, and each menu has at most one nm, num, unitprice, cnt, discountprice, price, itemsubtotal, etc sub-entities and potentially multiple sub_nm, sub_price and sub_cnt sub-entities. We also notice that the sub-entities aligned horizontally overwhelmingly belong to the same menu entity, and a menu entity can sometimes span over two or more consecutive horizontal lines. To leverage those observations, we perform a two-step grouping process for menu entities. First, we merge the extracted leaf sub-entities into horizontal groups, where a threshold of 0.5 on the intersection-over-union of the Y-axis was used for the determination of horizontal alignment. Second, we further merge the consecutive horizontal groups into menu entities, if and only if the horizontal groups do not have type duplication in any of the nm, num, unitprice, cnt, discountprice, price, itemsubtotal, and etc sub-entities (namely, those sub-entities only show up in at most one of the consecutive horizontal groups to be merged). We allow duplication of sub_nm, sub_price and sub_cnt sub-entity types. After those two steps, we obtain the final menu entities. ",
752
+ "page_idx": 22
753
+ },
754
+ {
755
+ "type": "text",
756
+ "text": "Donut Baseline. We follow Donut released implementation4 for the Donut benchmarking results on CORD. We use the default training configuration for all experiments on CORD (namely, 10, 50, 100, 200, and 800-document training sets), with the following difference: we reduce batch size from 8 to 4 due to computational resource constraints, and increase the number of train epochs from 30 to 60. For each experiment, checkpoint with the lowest loss on the dev set is selected and we report performance on test set. Normalized Tree Edit Distance accuracy scores produced by Donut evaluation code are reported (similar to all our other models). ",
757
+ "page_idx": 22
758
+ },
759
+ {
760
+ "type": "text",
761
+ "text": "A.9 COMPLETION PARSING ERROR RATES",
762
+ "text_level": 1,
763
+ "page_idx": 23
764
+ },
765
+ {
766
+ "type": "text",
767
+ "text": "In this section, we report the various completion parsing error types and their occurrence rates. ",
768
+ "page_idx": 23
769
+ },
770
+ {
771
+ "type": "text",
772
+ "text": "Invalid JSON Formatting. This error refers to cases for which Python’s json.loads(completion) fails on a LLM’s completion. As observed in Table 7, the JSON parsing error rate is below $0 . 3 \\%$ in all training settings. ",
773
+ "page_idx": 23
774
+ },
775
+ {
776
+ "type": "text",
777
+ "text": "Invalid Entity Value Format. This error refers to cases where the leaf entity value does not follow the expected \"<text-segment- $I > X X | Y Y$ <text-segment- $2 > X X | Y Y ^ { \\prime \\prime }$ format. As observed in Table 7, the Invalid Entity Value Format Rate is below $0 . 0 5 \\%$ in all training settings. ",
778
+ "page_idx": 23
779
+ },
780
+ {
781
+ "type": "text",
782
+ "text": "Hallucination / Entity Text Not Found. This error refers to cases where the segment identifier is valid, but the entity text does not appear on the predicted segment (hallucination). As observed in Table 7, the Entity Text Not Found error rate is below $0 . 6 \\%$ in all training settings. As part of LMDX methodology, we discard any prediction whose text does not appear on the specified segment, ensuring we discard all hallucination. ",
783
+ "page_idx": 23
784
+ },
785
+ {
786
+ "type": "text",
787
+ "text": "Note that those numbers are computed at the completion level. Since multiple completions are sampled for each document chunk, the sampling scheme allows for correcting those errors and no document in the benchmarks fail extraction. ",
788
+ "page_idx": 23
789
+ },
790
+ {
791
+ "type": "table",
792
+ "img_path": "images/035eab9cd9c80395155fbc09cf9c519f80ebd1d79cf10cc5004b4697c8ff9b94.jpg",
793
+ "table_caption": [
794
+ "Table 7: Breakdown of parsing error rates from $\\mathrm { L M D X } _ { \\mathrm { P a L M } 2 - \\mathrm { S m a l l } }$ responses on VRDU Ad-Buy Mixed and CORD datasets. "
795
+ ],
796
+ "table_footnote": [],
797
+ "table_body": "<table><tr><td>|D</td><td>Dataset</td><td>Invalid JSON</td><td>Invalid Entity Value Format</td><td>Entity Text Not Found</td></tr><tr><td rowspan=\"2\">0</td><td>Ad-buy Form</td><td>0.18%</td><td>0.04%</td><td>0.59%</td></tr><tr><td>CORD</td><td>0.00%</td><td>0.00%</td><td>0.00%</td></tr><tr><td rowspan=\"2\">10</td><td>Ad-buy Form</td><td>0.27%</td><td>0.04%</td><td>0.44%</td></tr><tr><td>CORD</td><td>0.00%</td><td>0.00%</td><td>0.00%</td></tr><tr><td rowspan=\"2\">50</td><td>Ad-buy Form</td><td>0.24%</td><td>0.00%</td><td>0.17%</td></tr><tr><td>CORD</td><td>0.06%</td><td>0.00%</td><td>0.00%</td></tr><tr><td rowspan=\"2\">100</td><td>Ad-buy Form</td><td>0.24%</td><td>0.00%</td><td>0.13%</td></tr><tr><td>CORD</td><td>0.00%</td><td>0.03%</td><td>0.00%</td></tr><tr><td rowspan=\"2\">200</td><td>Ad-buy Form</td><td>0.25%</td><td>0.00%</td><td>0.09%</td></tr><tr><td>CORD</td><td>0.00%</td><td>0.00%</td><td>0.00%</td></tr></table>",
798
+ "page_idx": 23
799
+ },
800
+ {
801
+ "type": "text",
802
+ "text": "A.10 IN-CONTEXT LEARNING WITH NEAREST NEIGHBORS",
803
+ "text_level": 1,
804
+ "page_idx": 24
805
+ },
806
+ {
807
+ "type": "text",
808
+ "text": "In our study, nearest neighbors leads to a significant quality gain over randomly selecting examplars. In this section, we explore why that is the case in the context of VRD information extraction. Figures 12, 13 and 14 show typical retrievals using sentenceT5 embeddings on the OCR text for similarity. Unsurprisingly, nearest neighbors works well as it retrieves examplars from the same template as the target document, i.e. from the same merchant in the case of CORD documents (store and restaurant receipts). As those examples share the same layout, same boilerplate text, and same entities, it makes it a lot easier for the model to understand the correct extraction pattern. ",
809
+ "page_idx": 24
810
+ },
811
+ {
812
+ "type": "image",
813
+ "img_path": "images/c9225defcae389aec689cdd8f29b0e966524e60618daccb5318b00628649e269.jpg",
814
+ "image_caption": [
815
+ "Figure 12: Nearest Neighbors on CORD, Example 1, retrieving examplars from the same merchant. "
816
+ ],
817
+ "image_footnote": [],
818
+ "page_idx": 24
819
+ },
820
+ {
821
+ "type": "image",
822
+ "img_path": "images/75b56b0e5d12b9cca8a2e40c30479574bbec4c7850e1042fb7d2176dc017260f.jpg",
823
+ "image_caption": [
824
+ "Figure 13: Nearest Neighbors on CORD, Example 2, retrieving examplars from the same merchant. "
825
+ ],
826
+ "image_footnote": [],
827
+ "page_idx": 24
828
+ },
829
+ {
830
+ "type": "image",
831
+ "img_path": "images/bbf25185c76bfc7ae315ca7b0dcf715461e8b469657307076c9499bf1f42dbc4.jpg",
832
+ "image_caption": [
833
+ "Figure 14: Nearest Neighbors on CORD, Example 3, retrieving examplars from the same merchant. "
834
+ ],
835
+ "image_footnote": [],
836
+ "page_idx": 24
837
+ }
838
+ ]
parse/test/rcFXg2aqEj/rcFXg2aqEj_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/rcFXg2aqEj/rcFXg2aqEj_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/wLg9JrwFvL/wLg9JrwFvL.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/wLg9JrwFvL/wLg9JrwFvL_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/wLg9JrwFvL/wLg9JrwFvL_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/wLg9JrwFvL/wLg9JrwFvL_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/y886UXPEZ0/y886UXPEZ0_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/yzkSU5zdwD/yzkSU5zdwD.md ADDED
@@ -0,0 +1,408 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Emergent Abilities of Large Language Models
2
+
3
+ Jason Wei 1
4
+ Yi Tay 1
5
+ Rishi Bommasani 2
6
+ Colin Raffel 3
7
+ Barret Zoph 1
8
+ Sebastian Borgeaud 4
9
+ Dani Yogatama 4
10
+ Maarten Bosma 1
11
+ Denny Zhou1
12
+ Donald Metzler 1
13
+ Ed H. Chi 1
14
+ Tatsunori Hashimoto 2
15
+ Oriol Vinyals 4
16
+ Percy Liang 2
17
+ Jeff Dean 1
18
+ William Fedus 1
19
+
20
+ jasonwei@google.com yitay@google.com nlprishi@stanford.edu craffel@gmail.com barretzoph@google.com
21
+ sborgeaud@deepmind.com
22
+ dyogatama@deepmind.com bosma@google.com dennyzhou@google.com metzler@google.com edchi@google.com thashim@stanford.edu vinyals@deepmind.com pliang@stanford.edu jeff@google.com liamfedus@google.com
23
+
24
+ 1Google Research $^ 2$ Stanford University 3UNC Chapel Hill $^ 4$ DeepMind
25
+
26
+ Reviewed on OpenReview: https://openreview.net/forum?id=yzkSU5zdwD
27
+
28
+ # Abstract
29
+
30
+ Scaling up language models has been shown to predictably improve performance and sample efficiency on a wide range of downstream tasks. This paper instead discusses an unpredictable phenomenon that we refer to as emergent abilities of large language models. We consider an ability to be emergent if it is not present in smaller models but is present in larger models. Thus, emergent abilities cannot be predicted simply by extrapolating the performance of smaller models. The existence of such emergence raises the question of whether additional scaling could potentially further expand the range of capabilities of language models.
31
+
32
+ # 1 Introduction
33
+
34
+ Language models have revolutionized natural language processing (NLP) in recent years. It is now well-known that increasing the scale of language models (e.g., training compute, model parameters, etc.) can lead to better performance and sample efficiency on a range of downstream NLP tasks (Devlin et al., 2019; Brown et al., 2020, inter alia). In many cases, the effect of scale on performance can often be methodologically predicted via scaling laws—for example, scaling curves for cross-entropy loss have been shown to empirically span more than seven orders of magnitude (Kaplan et al., 2020; Hoffmann et al., 2022). On the other hand, performance for certain downstream tasks counterintuitively does not appear to continuously improve as a function of scale, and such tasks cannot be predicted ahead of time (Ganguli et al., 2022).
35
+
36
+ In this paper, we will discuss the unpredictable phenomena of emergent abilities of large language models. Emergence as an idea has been long discussed in domains such as physics, biology, and computer science (Anderson, 1972; Hwang et al., 2012; Forrest, 1990; Corradini & O’Connor, 2010; Harper & Lewis, 2012, inter alia). We will consider the following general definition of emergence, adapted from Steinhardt (2022) and rooted in a 1972 essay called “More Is Different” by Nobel prize-winning physicist Philip Anderson (Anderson, 1972):
37
+
38
+ Emergence is when quantitative changes in a system result in qualitative changes in behavior.
39
+
40
+ Here we will explore emergence with respect to model scale, as measured by training compute and number of model parameters. Specifically, we define emergent abilities of large language models as abilities that are not present in smaller-scale models but are present in large-scale models; thus they cannot be predicted by simply extrapolating the performance improvements on smaller-scale models (§2).1 We survey emergent abilities as observed in a range of prior work, categorizing them in settings such as few-shot prompting (§3) and augmented prompting strategies (§4). Emergence motivates future research on why such abilities are acquired and whether more scaling will lead to further emergent abilities, which we highlight as important questions for the field (§5).
41
+
42
+ # 2 Emergent Abilities Definition
43
+
44
+ As a broad concept, emergence is often used informally and can be reasonably interpreted in many different ways. In this paper, we will consider a focused definition of emergent abilities of large language models:
45
+
46
+ An ability is emergent if it is not present in smaller models but is present in larger models.
47
+
48
+ Emergent abilities would not have been directly predicted by extrapolating a scaling law (i.e. consistent performance improvements) from small-scale models. When visualized via a scaling curve ( $x$ -axis: model scale, $y$ -axis: performance), emergent abilities show a clear pattern—performance is near-random until a certain critical threshold of scale is reached, after which performance increases to substantially above random. This qualitative change is also known as a phase transition—a dramatic change in overall behavior that would not have been foreseen by examining smaller-scale systems (Huberman & Hogg, 1987).
49
+
50
+ Today’s language models have been scaled primarily along three factors: amount of computation, number of model parameters, and training dataset size (Kaplan et al., 2020; Hoffmann et al., 2022). In this paper, we will analyze scaling curves by plotting the performance of different models where training compute for each model is measured in FLOPs on the $x$ -axis (Hoffmann et al., 2022). Because language models trained with more compute tend to also have more parameters, we additionally show plots with number of model parameters as the $x$ -axis in Appendix D (see Figure 11 and Figure 12, as well as Figure 4 and Figure 10). Using training FLOPs or model parameters as the $x$ -axis produces curves with similar shapes due to the fact that most dense Transformer language model families have scaled training compute roughly proportionally with model parameters (Kaplan et al., 2020).
51
+
52
+ Training dataset size is also an important factor, but we do not plot capabilities against it because many language model families use a fixed number of training examples for all model sizes (Brown et al., 2020; Rae et al., 2021; Chowdhery et al., 2022). Although we focus on training computation and model size here, there is not a single proxy that adequately captures all aspects of scale. For example, Chinchilla (Hoffmann et al., 2022) has one-fourth as many parameters as Gopher (Rae et al., 2021) but uses similar training compute; and sparse mixture-of-expert models have more parameters per training/inference compute than dense models (Fedus et al., 2021; Du et al., 2021). Overall, it may be wise to view emergence as a function of many correlated variables. For example, later in Figure 4 we will also plot emergence as a function of WikiText103 perplexity (Merity et al., 2016), which happens to closely correlate with training computation for Gopher/ Chinchilla (though this correlation may not hold in the long-run).
53
+
54
+ Note that the scale at which an ability is first observed to emerge depends on a number of factors and is not an immutable property of the ability. For instance, emergence may occur with less training compute or fewer model parameters for models trained on higher-quality data. Conversely, emergent abilities also crucially depend on other factors such as not being limited by the amount of data, its quality, or the number of parameters in the model. Today’s language models are likely not trained optimally (Hoffmann et al., 2022), and our understanding of how to best train models will evolve over time. Our goal in this paper is not to characterize or claim that a specific scale is required to observe emergent abilities, but rather, we aim to discuss examples of emergent behavior in prior work.
55
+
56
+ # 3 Few-Shot Prompted Tasks
57
+
58
+ We first discuss emergent abilities in the prompting paradigm, as pop
59
+ ularized by GPT-3 (Brown et al., 2020).2 In prompting, a pre-trained
60
+ language model is given a prompt (e.g. a natural language instruction)
61
+ of a task and completes the response without any further training
62
+ or gradient updates to its parameters. Brown et al. (2020) proposed
63
+ few-shot prompting, which includes a few input-output examples in
64
+ the model’s context (input) as a preamble before asking the model to
65
+ perform the task for an unseen inference-time example. An example prompt is shown in Figure 1.
66
+
67
+ ![](images/c346c9024b0ccf0b80a8318cc247a3174326c392a0082019019356df76aaac02.jpg)
68
+ Figure 1: Example of an input and output for few-shot prompting.
69
+
70
+ The ability to perform a task via few-shot prompting is emergent when a model has random performance until a certain scale, after which performance increases to well-above random. Figure 2 shows eight such emergent abilities spanning five language model families from various work.
71
+
72
+ BIG-Bench. Figure 2A–D depicts four emergent few-shot prompted tasks from BIG-Bench, a crowd-sourced suite of over 200 benchmarks for language model evaluation (BIG-Bench, 2022). Figure 2A shows an arithmetic benchmark that tests 3-digit addition and subtraction, as well as 2-digit multiplication. GPT-3 and LaMDA (Thoppilan et al., 2022) have close-to-zero performance for several orders of magnitude of training compute, before performance jumps to sharply above random at $2 \cdot 1 0 ^ { 2 2 }$ training FLOPs (13B parameters) for GPT-3, and $1 0 ^ { 2 3 }$ training FLOPs (68B parameters) for LaMDA. Similar emergent behavior also occurs at around the same model scale for other tasks, such as transliterating from the International Phonetic Alphabet (Figure 2B), recovering a word from its scrambled letters (Figure 2C), and Persian question-answering (Figure 2D). Even more emergent abilities from BIG-Bench are given in Appendix E.
73
+
74
+ TruthfulQA. Figure 2E shows few-shot prompted performance on the TruthfulQA benchmark, which measures the ability to answer questions truthfully (Lin et al., 2021). This benchmark is adversarially curated against GPT-3 models, which do not perform above random, even when scaled to the largest model size. Small Gopher models also do not perform above random until scaled up to the largest model of $5 \cdot 1 0 ^ { 2 3 }$ training FLOPs (280B parameters), for which performance jumps to more than 20% above random (Rae et al., 2021).
75
+
76
+ Grounded conceptual mappings. Figure 2F shows the task of grounded conceptual mappings, where language models must learn to map a conceptual domain, such as a cardinal direction, represented in a textual grid world (Patel & Pavlick, 2022). Again, performance only jumps to above random using the largest GPT-3 model.
77
+
78
+ Multi-task language understanding. Figure 2G shows the Massive Multi-task Language Understanding (MMLU) benchmark, which aggregates 57 tests covering a range of topics including math, history, law, and more (Hendrycks et al., 2021a). For GPT-3, Gopher, and Chinchilla, models of ${ \sim } 1 0 ^ { 2 2 }$ training FLOPs ( $\sim$ 10B parameters) or smaller do not perform better than guessing on average over all the topics, scaling up to 3–5 $1 0 ^ { 2 3 }$ training FLOPs (70B–280B parameters) enables performance to substantially surpass random. This result is striking because it could imply that the ability to solve knowledge-based questions spanning a large collection of topics might require scaling up past this threshold (for dense language models without retrieval or access to external memory).
79
+
80
+ ![](images/1b4377b0b544d9bed4b24f3abce5207967f4ea121be74bd814adafafb3a3a270.jpg)
81
+ Figure 2: Eight examples of emergence in the few-shot prompting setting. Each point is a separate model. The ability to perform a task via few-shot prompting is emergent when a language model achieves random performance until a certain scale, after which performance significantly increases to well-above random. Note that models that used more training compute also typically have more parameters—hence, we show an analogous figure with number of model parameters instead of training FLOPs as the $x$ -axis in Figure 11. A–D: BIG-Bench (2022), 2-shot. E: Lin et al. (2021) and Rae et al. (2021). F: Patel & Pavlick (2022). G: Hendrycks et al. (2021a), Rae et al. (2021), and Hoffmann et al. (2022). H: Brown et al. (2020), Hoffmann et al. (2022), and Chowdhery et al. (2022) on the WiC benchmark (Pilehvar & Camacho-Collados, 2019).
82
+
83
+ Word in Context. Finally, Figure 2H shows the Word in Context (WiC) benchmark (Pilehvar & CamachoCollados, 2019), which is a semantic understanding benchmark. Notably, GPT-3 and Chinchilla fail to achieve one-shot performance of better than random, even when scaled to their largest model size of $\mathrm { \sim 5 \cdot 1 0 ^ { 2 3 } }$ FLOPs. Although these results so far may suggest that scaling alone may not enable models to solve WiC, above-random performance eventually emerged when PaLM was scaled to $2 . 5 \cdot 1 0 ^ { 2 4 }$ FLOPs (540B parameters), which was much larger than GPT-3 and Chinchilla.
84
+
85
+ # 4 Augmented Prompting Strategies
86
+
87
+ Although few-shot prompting is perhaps currently the most common way of interacting with large language models, recent work has proposed several other prompting and finetuning strategies to further augment the abilities of language models. If a technique shows no improvement or is harmful when compared to the baseline of not using the technique until applied to a model of a large-enough scale, we also consider the technique an emergent ability.
88
+
89
+ ![](images/8c497b313a94ae80f2c59472262c192bfc65b6355a66e84a9aa7c9452f70628f.jpg)
90
+ Figure 3: Specialized prompting or finetuning methods can be emergent in that they do not have a positive effect until a certain model scale. A: Wei et al. (2022b). B: Wei et al. (2022a). C: Nye et al. (2021). D: Kadavath et al. (2022). An analogous figure with number of parameters on the $x$ -axis instead of training FLOPs is given in Figure 12. The model shown in A-C is LaMDA (Thoppilan et al., 2022), and the model shown in D is from Anthropic.
91
+
92
+ Multi-step reasoning. Reasoning tasks, especially those involving multiple steps, have been challenging for language models and NLP models more broadly (Rae et al., 2021; Bommasani et al., 2021; Nye et al., 2021). A recent prompting strategy called chain-of-thought prompting enables language models to solve such problems by guiding them to produce a sequence of intermediate steps before giving the final answer (Cobbe et al., 2021; Wei et al., 2022b; Zhou et al., 2022). As shown in Figure 3A, chain of thought prompting only surpasses standard prompting without intermediate steps when scaled to $1 0 ^ { 2 3 }$ training FLOPs ( $\sim$ 100B parameters). A similar emergence in performance gain was also observed when augmenting few-shot prompting with explanations that came after the final answer (Lampinen et al., 2022).
93
+
94
+ Instruction following. Another growing line of work aims to better enable language models to perform new tasks simply by reading instructions describing the task (without few-shot exemplars). By finetuning on a mixture of tasks phrased as instructions, language models have been shown to respond appropriately to instructions describing an unseen task (Ouyang et al., 2022; Wei et al., 2022a; Sanh et al., 2022). As shown in Figure 3B, Wei et al. (2022a) found that this instruction-finetuning technique hurts performance for models of $7 \cdot 1 0 ^ { 2 1 }$ training FLOPs (8B parameters) or smaller, and only improves performance when scaled to $1 0 ^ { 2 3 }$ training FLOPs ( ${ \sim } 1 0 0 \mathrm { B }$ parameters) (though Sanh et al. (2022) found shortly after that this instruction-following behavior could be also induced by finetuning smaller encoder-decoder T5 models).
95
+
96
+ Program execution. Consider computational tasks involving multiple steps, such as adding large numbers or executing computer programs. Nye et al. (2021) show that finetuning language models to predict intermediate outputs (“scratchpad”) enables them to successfully execute such multi-step computations. As shown in Figure 3C, on 8-digit addition, using a scratchpad only helps for models of ${ \sim } 9 \cdot 1 0 ^ { 1 9 }$ training FLOPs (40M parameters) or larger.
97
+
98
+ Model calibration. Finally, an important direction for deployment of language models studies is calibration, which measures whether models can predict which questions they will be able to answer correctly. Kadavath et al. (2022) compared two ways of measuring calibration: a True/False technique, where models first propose answers and then evaluate the probability “P(True)” that their answers are correct, and more-standard methods of calibration, which use the probability of the correct answer compared with other answer options. As shown in Figure 3D, the superiority of the True/False technique only emerges when scaled to the largest model scale of $\mathrm { \sim 3 \cdot 1 0 ^ { 2 3 } }$ training FLOPs (52B parameters).
99
+
100
+ Table 1: List of emergent abilities of large language models and the scale (both training FLOPs and number of model parameters) at which the abilities emerge.
101
+
102
+ <table><tr><td rowspan="2"></td><td colspan="2">Emergent scale</td><td rowspan="2">Model</td><td rowspan="2">Reference</td></tr><tr><td>Train.FLOPs Params.</td><td></td></tr><tr><td colspan="2">Few-shot prompting abilities</td><td></td><td></td><td></td></tr><tr><td>·Addition/subtraction (3 digit)</td><td>2.3E+22</td><td>13B</td><td>GPT-3</td><td>Brown et al. (2020)</td></tr><tr><td>· Addition/subtraction (4-5 digit)</td><td>3.1E+23</td><td>175B</td><td></td><td></td></tr><tr><td>·MMLU Benchmark (57 topic avg.)</td><td>3.1E+23</td><td>175B</td><td>GPT-3</td><td>Hendrycks et al. (2021a)</td></tr><tr><td>Toxicity classification (CivilComments)</td><td>1.3E+22</td><td>7.1B</td><td>Gopher</td><td>Rae et al. (2021)</td></tr><tr><td>Truthfulness (Truthful QA)</td><td>5.0E+23</td><td>280B</td><td></td><td></td></tr><tr><td>MMLU Benchmark (26 topics)</td><td>5.0E+23</td><td>280B</td><td></td><td></td></tr><tr><td>Grounded conceptual mappings</td><td>3.1E+23</td><td>175B</td><td>GPT-3</td><td>Patel &amp; Pavlick (2022)</td></tr><tr><td>· MMLU Benchmark (30 topics)</td><td>5.0E+23</td><td>70B</td><td></td><td>Chinchilla Hoffmann et al. (2022)</td></tr><tr><td>·Word in Context(WiC) benchmark</td><td>2.5E+24</td><td>540B</td><td>PaLM</td><td>Chowdhery et al. (2022)</td></tr><tr><td>· Many BIG-Bench tasks (see Appendix E)</td><td>Many</td><td>Many</td><td>Many</td><td>BIG-Bench (2022)</td></tr><tr><td colspan="2">Augmented prompting abilities</td><td></td><td></td><td></td></tr><tr><td>·Instruction following (finetuning)</td><td>1.3E+23</td><td>68B</td><td>FLAN</td><td>Wei et al. (2022a)</td></tr><tr><td>· Scratchpad: 8-digit addition (finetuning)</td><td>8.9E+19</td><td>40M</td><td>LaMDA</td><td>Nye et al. (2021)</td></tr><tr><td>·Using open-book knowledge for fact checking</td><td>1.3E+22</td><td>7.1B</td><td>Gopher</td><td>Rae et al. (2021)</td></tr><tr><td>Chain of thought: Math word problems</td><td>1.3E+23</td><td>68B</td><td>LaMDA</td><td>Wei et al. (2022b)</td></tr><tr><td>,Chain of thought: StrategyQA</td><td>2.9E+23</td><td>62B</td><td>PaLM</td><td>Chowdhery et al. (2022)</td></tr><tr><td>Differentiable search index</td><td>3.3E+22</td><td>11B</td><td>T5</td><td>Tay et al. (2022)</td></tr><tr><td>Self-consistency decoding</td><td>1.3E+23</td><td>68B</td><td>LaMDA</td><td>Wang et al. (2022b)</td></tr><tr><td>·Leveraging explanations in prompting</td><td>5.0E+23</td><td>280B</td><td>Gopher</td><td>Lampinen et al. (2022)</td></tr><tr><td>· Least-to-most prompting</td><td>3.1E+23</td><td>175B</td><td>GPT-3</td><td>Zhou et al. (2022)</td></tr><tr><td>· Zero-shot chain of thought reasoning</td><td>3.1E+23</td><td>175B</td><td>GPT-3</td><td>Kojima et al. (2022)</td></tr><tr><td>· Calibration via P(True)</td><td>2.6E+23</td><td>52B</td><td></td><td>Anthropic Kadavath et al. (2022)</td></tr></table>
103
+
104
+ # 5 Discussion
105
+
106
+ We have seen that a range of abilities—in the few-shot prompting setup or otherwise—have thus far only been observed when evaluated on a sufficiently large language model. Hence, their emergence cannot be predicted by simply extrapolating performance on smaller-scale models. Emergent few-shot prompted tasks are also unpredictable in the sense that these tasks are not explicitly included in pre-training, and we likely do not know the full scope of few-shot prompted tasks that language models can perform. This raises the question of whether further scaling could potentially endow even-larger language models with new emergent abilities. Tasks that language models cannot currently do are prime candidates for future emergence; for instance, there are dozens of tasks in BIG-Bench for which even the largest GPT-3 and PaLM models do not achieve above-random performance (see Appendix E.4).
107
+
108
+ The ability for scale to unpredictably enable new techniques is not just theoretical. Consider the Word in Context (WiC) benchmark (Pilehvar $\&$ Camacho-Collados, 2019) shown in Figure 2H, as a historical example. Here, scaling GPT-3 to around $3 \cdot 1 0 ^ { 2 3 }$ training FLOPs (175B parameters) failed to unlock above-random one-shot prompting performance.3 Regarding this negative result, Brown et al. (2020) cited the model architecture of GPT-3 or the use of an autoregressive language modeling objective (rather than using a denoising training objective) as potential reasons, and suggested training a model of comparable size with bidirectional architecture as a remedy. However, later work found that further scaling a decoder-only language model was actually enough to enable above-random performance on this task. As is shown in Figure 2H, scaling PaLM (Chowdhery et al., 2022) from $3 \cdot 1 0 ^ { 2 3 }$ training FLOPs (62B parameters) to $3 \cdot 1 0 ^ { 2 4 }$ training FLOPs (540B parameters) led to a significant jump in performance, without the significant architectural changes suggested by Brown et al. (2020).
109
+
110
+ # 5.1 Potential explanations of emergence
111
+
112
+ Although there are dozens of examples of emergent abilities, there are currently few compelling explanations for why such abilities emerge in the way they do. For certain tasks, there may be natural intuitions for why emergence requires a model larger than a particular threshold scale. For instance, if a multi-step reasoning task requires $\textit { l }$ steps of sequential computation, this might require a model with a depth of at least $O \left( l \right)$ layers. It is also reasonable to assume that more parameters and more training enable better memorization that could be helpful for tasks requiring world knowledge.4 As an example, good performance on closed-book question-answering may require a model with enough parameters to capture the compressed knowledge base itself (though language model-based compressors can have higher compression ratios than conventional compressors (Bellard, 2021)).
113
+
114
+ It is also important to consider the evaluation metrics used to measure emergent abilities (BIG-Bench, 2022). For instance, using exact string match as the evaluation metric for long-sequence targets may disguise compounding incremental improvements as emergence. Similar logic may apply for multi-step or arithmetic reasoning problems, where models are only scored on whether they get the final answer to a multi-step problem correct, without any credit given to partially correct solutions. However, the jump in final answer accuracy does not explain why the quality of intermediate steps suddenly emerges to above random, and using evaluation metrics that do not give partial credit are at best an incomplete explanation, because emergent abilities are still observed on many classification tasks (e.g., the tasks in Figure 2D–H).
115
+
116
+ As an alternative evaluation, we measure cross-entropy loss, which is used in scaling laws for pre-training, for the six emergent BIG-Bench tasks, as detailed in Appendix A. This analysis follows the same experimental setup from BIG-Bench (2022) and affirms their conclusions for the six emergent tasks we consider. Namely, cross-entropy loss improves even for small model scales where the downstream metrics (exact match, BLEU, and accuracy) are close to random and do not improve, which shows that improvements in the log-likelihood of the target sequence can be masked by such downstream metrics. However, this analysis does not explain why downstream metrics are emergent or enable us to predict the scale at which emergence occurs. Overall, more work is needed to tease apart what enables scale to unlock emergent abilities.
117
+
118
+ # 5.2 Beyond scaling
119
+
120
+ Although we may observe an emergent ability to occur at a certain scale, it is possible that the ability could be later achieved at a smaller scale—in other words, model scale is not the singular factor for unlocking an emergent ability. As the science of training large language models progresses, certain abilities may be unlocked for smaller models with new architectures, higher-quality data, or improved training procedures. For example, there are 14 BIG-Bench tasks $^ 5$ for which LaMDA 137B and GPT-3 175B models perform at near-random, but PaLM 62B in fact achieves above-random performance, despite having fewer model parameters and training FLOPs. While there is not an empirical study ablating every difference between PaLM 62B and prior models (the computational cost would be too high), potential reasons for the better performance of PaLM could include high-quality training data (e.g., more multilingual and code data than LaMDA) and architectural differences (e.g., split digit-encodings; see Section 2 in Chowdhery et al. (2022)).
121
+
122
+ Moreover, once an ability is discovered, further research may make the ability available for smaller scale models. Consider the nascent direction of enabling language models to follow natural language instructions describing a task (Wei et al., 2022a; Sanh et al., 2022; Ouyang et al., 2022, inter alia). Although Wei et al. (2022a) initially found that instruction-based finetuning only worked for 68B parameter or larger decoder-only models, Sanh et al. (2022) induced similar behavior in a 11B model with an encoder-decoder architecture, which typically has higher performance after finetuning than decoder-only architectures (Wang et al., 2022a). As another example, Ouyang et al. (2022) proposed a finetuning and reinforcement learning from human feedback approach for the InstructGPT models, which enabled a 1.3B model to outperform much larger models in human-rater evaluations on a broad set of use cases.
123
+
124
+ There has also been work on improving the general few-shot prompting abilities of language models (Gao et al., 2021; Schick & Schütze, 2021, inter alia). Theoretical and interpretability research (Wei et al., 2021a; Saunshi et al., 2021) on why a language modeling objective facilitates certain downstream behavior could in turn have implications on how to enable emergence beyond simply scaling. For instance, certain features of pre-training data (e.g., long-range coherence, having many rare classes) have also been shown to correlate with emergent few-shot prompting and could potentially enable it in smaller models (Xie et al., 2022; Chan et al., 2022), and few-shot learning can require certain model architectures in some scenarios (Chan et al., 2022). Computational linguistics work has further shown how threshold frequencies of training data can activate emergent syntactic rule-learning when model parameters and training FLOPs are held constant (Wei et al., 2021b), which has even been shown to have striking “aha” moments similar to those in the psycholinguistics literature (Abend et al., 2017; Zhang et al., 2021). As we continue to train ever-larger language models, lowering the scale threshold for emergent abilities will become more important for making research on such abilities to available to the community more broadly (Bommasani et al., 2021; Ganguli et al., 2022; Liang et al., 2022).
125
+
126
+ Naturally, there are limitations to a program consisting only of increasing scale (training compute, model parameters, and dataset size). For instance, scaling may eventually be bottle-necked by hardware constraints, and some abilities may not have emerged at this point. Other abilities may never emerge—for instance, tasks that are far out of the distribution of even a very large training dataset might not ever achieve any significant performance. Finally, an ability could emerge and then plateau; in other words, there is no guarantee that scaling enables an ability to reach the desired level.
127
+
128
+ # 5.3 Another view of emergence
129
+
130
+ While scale (e.g., training FLOPs or model parameters) has been highly correlated with language model performance on many downstream metrics so far, scale need not be the only lens to view emergent abilities. For example, the emergence of task-specific abilities can be analyzed as a function of the language model’s perplexity on a general text corpus such as WikiText103 (Merity et al., 2016). Figure 4 shows such a plot with WikiText103 perplexity of the language model on the $x$ -axis and performance on the MMLU benchmark on the $y$ -axis, side-by-side with plots of training FLOPs and model parameters on the $x$ -axis.
131
+
132
+ Because WikiText103 perplexity and training FLOPs happen to be highly correlated for the models considered here (Gopher and Chinchilla), the plots of emergent abilities look similar for both. However, this correlation between WikiText103 perplexity and scale may not hold in the future as new techniques beyond vanilla dense Transformer models are developed (e.g., retrieval-augmented models may have strong WikiText103 perplexity with less training compute and fewer model parameters (Borgeaud et al., 2021)). Also note that using WikiText103 perplexity to compare across model families can be complicated due to factors such as differences in training data composition. Overall, emergent abilities should probably be viewed as a function of many correlated variables.
133
+
134
+ # 5.4 Emergent risks
135
+
136
+ Importantly, similar to how emergent abilities have been observed in the few-shot prompting setting without explicitly being included in pre-training, risks could also emerge (Bommasani et al., 2021; Steinhardt, 2021; Ganguli et al., 2022). For instance, societal risks of large language models such as truthfulness, bias, and toxicity are a growing area of research (Weidinger et al., 2021). Such risks are important considerations whether or not they can be precisely characterized as “emergent” based on the definition in $\ S 2$ , and, in some scenarios, do increase with model scale (see the Inverse Scaling Prize6). Since work on emergent abilities incentivizes scaling language models, it is important to be aware of risks that increase with model scale even if they are not emergent.
137
+
138
+ Here, we summarize several prior findings on the relationship between specific social risks and model scale. On WinoGender (Rudinger et al., 2017), which measures gender bias in occupations such as “nurse” or “electrician,” scaling has improved performance so far (Du et al., 2021; Chowdhery et al., 2022), though
139
+
140
+ ![](images/f693cf9ae464ad7207e08d6dbac91492192693ccfb4027d9923364189f3aa1eb.jpg)
141
+ Figure 4: Top row: the relationships between training FLOPs, model parameters, and perplexity (ppl) on WikiText103 (Merity et al., 2016) for Chinchilla and Gopher. Bottom row: Overall performance on the massively multi-task language understanding benchmark (MMLU; Hendrycks et al., 2021a) as a function of training FLOPs, model parameters, and WikiText103 perplexity.
142
+
143
+ BIG-Bench (2022) found in BBQ bias benchmark (Parrish et al., 2022) that bias can increase with scaling for ambiguous contexts. As for toxicity, Askell et al. (2021) found that while larger language models could produce more toxic responses from the RealToxicityPrompts dataset (Gehman et al., 2020), this behavior could be mitigated by giving models prompts with examples of being “helpful, harmless, and honest.” For extracting training data from language models, larger models were found to be more likely to memorize training data (Carlini et al., 2021; 2022), though deduplication methods have been proposed and can simultaneously reduce memorization while improving performance (Kandpal et al., 2022; Lee et al., 2022a). The TruthfulQA benchmark (Lin et al., 2021) showed that GPT-3 models were more likely to mimic human falsehoods as they got larger, though Rae et al. (2021) later showed on a multiple-choice version that scaling Gopher to 280B enabled emergent performance substantially better than random.
144
+
145
+ Beyond the above, emergent risks also include phenomena that might only exist in future language models or that have not yet been characterized in current language models. Some such behaviors, as discussed in detail in Hendrycks et al. (2021b), could be backdoor vulnerabilities, inadvertent deception, or harmful content synthesis. Approaches involving data filtering, forecasting, governance, and automatically discovering harmful behaviors have been proposed for discovering and mitigating emergent risks (Bender et al., 2021; Weidinger et al., 2021; Steinhardt, 2021; Ganguli et al., 2022; Perez et al., 2022, inter alia). For a more detailed discussion of the risks of large language models, including emergent risks, see Bender et al. (2021); Steinhardt (2021); Bommasani et al. (2021); Ganguli et al. (2022).
146
+
147
+ # 5.5 Sociological changes
148
+
149
+ Finally, the emergent abilities discussed here focus on model behavior and are just one of several types of emergence in NLP (Manning et al., 2020; Teehan et al., 2022). Another notable type of qualitative change is sociological, in which increasing scale has shifted how the community views and uses language models. For instance, NLP has historically focused on task-specific models (Jurafsky & Martin, 2009). Recently, scaling has led to an explosion in research on and development of models that are “general purpose” in that they are single models that aim to perform a range of tasks not explicitly encoded in the training data (e.g., GPT-3, Chinchilla, and PaLM) (Manning, 2022).
150
+
151
+ One key set of results in the emergent sociological shift towards general-purpose models is when scaling enables a few-shot prompted general-purpose model to outperform prior state of the art held by finetuned task-specific models. As a few examples, GPT-3 175B achieved new state of the art on the TriviaQA and PiQA question-answering benchmarks (Brown et al., 2020); PaLM 540B achieved new state of the art on three arithmetic reasoning benchmarks (Chowdhery et al., 2022); and the multimodal Flamingo 80B model achieved new state of the art on six visual question answering benchmarks (Alayrac et al., 2022). In all of these cases, state-of-the-art performance was achieved by few-shot prompting a language model of unprecendented scale (scaling curves for these examples are shown in Appendix Figure 13). These abilities are not necessarily emergent since they have smooth, predictable scaling curves—however, they do underscore an emergent sociological shift towards general-purpose models in the NLP community.
152
+
153
+ The ability for general-purpose models to perform unseen tasks given only a few examples has also led to many new applications of language models outside the NLP research community. For instance, language models have been used via prompting to translate natural language instructions into actions executable by robots (Ahn et al., 2022; Huang et al., 2022), interact with users (Coenen et al., 2021; Wu et al., 2021; 2022a; Lee et al., 2022b), and facilitate multi-modal reasoning (Zeng et al., 2022; Alayrac et al., 2022). Large language models have also been deployed in the real-world both in products, such as GitHub CoPilot,7 and directly as services themselves, such as OpenAI’s GPT-3 API.8
154
+
155
+ # 5.6 Directions for future work
156
+
157
+ Future work on emergent abilities could involve train more-capable language models, as well as methods for better enabling language models to perform tasks. Some potential directions include but are not limited to the following.
158
+
159
+ Further model scaling. Further scaling up models has so far appeared to increase the capabilities of language models, and is a straightforward direction for future work. However, simply scaling up language models is computationally expensive and requires solving substantial hardware challenges, and so other approaches will likely play a key role in the future of the emergent abilities of large language models.
160
+
161
+ Improved model architectures and training. Improving model architecture and training procedures may facilitate high-quality models with emergent abilities while mitigating computational cost. One direction is using sparse mixture-of-experts architectures (Lepikhin et al., 2021; Fedus et al., 2021; Artetxe et al., 2021; Zoph et al., 2022), which scale up the number of parameters in a model while maintaining constant computational costs for an input. Other directions for better computational efficiency could involve variable amounts of compute for different inputs (Graves, 2016; Dehghani et al., 2018), using more localized learning strategies than backpropagation through all weights in a neural network (Jaderberg et al., 2017), and augmenting models with external memory (Guu et al., 2020; Borgeaud et al., 2021; Wu et al., 2022b, inter alia). These nascent directions have already shown promise in many settings but have not yet seen widespread adoption, which will likely require further work.
162
+
163
+ Data scaling. Training long enough on a large-enough dataset has been shown to be key for the ability of language models to acquire syntactic, semantic, and other world knowledge (Zhang et al., 2021; Wei et al., 2021b; Razeghi et al., 2022). Recently, Hoffmann et al. (2022) argued that prior work (Kaplan et al., 2020) underestimated the amount of training data needed to train a compute-optimal model, underscoring the importance of training data. Collecting large datasets so that models can be trained for longer could allow a greater range of emergent abilities under a fixed model size constraint.
164
+
165
+ Better techniques for and understanding of prompting. Although few-shot prompting (Brown et al., 2020) is simple and effective, general improvements to prompting may further expand the abilities of language models. For instance, simple modifications such as calibrating output probabilities (Zhao et al., 2021;
166
+
167
+ Holtzman et al., 2021) or using a noisy channel (Min et al., 2021) have improved performance on a range of tasks. Augmenting few-shot exemplars with intermediate steps (Reynolds & McDonell, 2021; Nye et al., 2021; Wei et al., 2022b) has also enabled models to perform multi-step reasoning tasks not possible in the standard prompting formulation from Brown et al. (2020). Moreover, better exploration of what makes prompting successful (Wei et al., 2021a; Xie et al., 2022; Min et al., 2022; Olsson et al., 2022) could lead to insights on how to elicit emergent abilities at a smaller model scale. Sufficient understanding of why models work generally lags the development and popularization of techniques such as few-shot prompting, and it is also likely that the best practices for prompting will change as more-powerful models are developed over time.
168
+
169
+ Frontier tasks. Although language models can perform a wide range of tasks, there are still many tasks that even the largest language models to date cannot perform with above-random accuracy. Dozens of such tasks from BIG-Bench are enumerated in Appendix E.4; these tasks often involve abstract reasoning (e.g., playing Chess, challenging math, etc). Future research could potentially investigate why these abilities have not yet emerged, and how to enable models to perform these tasks. Looking forward, another growing direction could be multilingual emergence; results on multilingual BIG-Bench tasks indicate that both model scale and training data play a role in emergence (e.g., Figure 2D shows that both using PaLM’s training dataset and scaling to 62B parameters is required for question-answering in Persian). Other frontier tasks could include prompting in multiple modalities (Alayrac et al., 2022; Ramesh et al., 2022).
170
+
171
+ Understanding emergence. Beyond research on unlocking further emergent tasks, an important open question for future research is how and why emergent abilities occur in large language models. In this paper, we conducted initial analyses regarding scaling of the cross-entropy loss on BIG-Bench (Appendix A.1), different metrics for generative tasks (Appendix A.2), and for which types of tasks emergence occurs (Appendix A.3 and Appendix B). These analyses did not provide complete answers to why emergence occurs or how to predict it. Future research could potentially analyze emergence in new ways (e.g., analyze the relationship between emergent tasks and similar data in training; create a synthetic task that requires multiple compositional sub-tasks and evaluate how each of those sub-tasks improve with scale and unlock emergence when combined). Overall, understanding emergence is an important direction because it could potentially allow us predict what abilities future models may have, as well as provide new insights into how to train more-capable language models.
172
+
173
+ # 6 Conclusions
174
+
175
+ We have discussed emergent abilities of language models, for which meaningful performance has only been thus far observed at a certain computational scale. Emergent abilities can span a variety of language models, task types, and experimental scenarios. Such abilities are a recently discovered outcome of scaling up language models, and the questions of how they emerge and whether more scaling will enable further emergent abilities seem to be important future research directions for the field of NLP.
176
+
177
+ # Broader Impact Statement
178
+
179
+ In this paper, we surveyed results in the existing literature, without proposing new methods or models. As discussed in (§5), emergent abilities are unpredictable in several ways, and include emergent risks (§5.4). We believe these phenomena warrant careful study and raise important questions for the field.
180
+
181
+ # Acknowledgments
182
+
183
+ We thank Charles Sutton, Slav Petrov, Douglas Eck, Jason Freidenfelds, Jascha Sohl-Dickstein, Ethan Dyer, Dale Schuurmans, and Xavier Garcia for useful discussions and feedback on the manuscript.
184
+
185
+ # References
186
+
187
+ Omri Abend, Tom Kwiatkowski, Nathaniel J Smith, Sharon Goldwater, and Mark Steedman. Bootstrapping language acquisition. Cognition, 164:116–143, 2017. URL https://homepages.inf.ed.ac.uk/ sgwater/papers/cognition17-bootstrapping.pdf.
188
+
189
+ Michael Ahn, Anthony Brohan, Noah Brown, Yevgen Chebotar, Omar Cortes, Byron David, Chelsea Finn, Keerthana Gopalakrishnan, Karol Hausman, Alex Herzog, et al. Do as I can, not as I say: Grounding language in robotic affordances. arXiv preprint arXiv:2204.01691, 2022. URL https://arxiv.org/ abs/2204.01691.
190
+ Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katie Millican, Malcolm Reynolds, et al. Flamingo: A visual language model for few-shot learning. arXiv preprint arXiv:2204.14198, 2022. URL https://arxiv.org/abs/2204.14198.
191
+ Philip W. Anderson. More is different: Broken symmetry and the nature of the hierarchical structure of science. Science, 177(4047):393–396, 1972. URL http://www.lanais.famaf.unc.edu.ar/cursos/ em/Anderson-MoreDifferent-1972.pdf.
192
+ Mikel Artetxe, Shruti Bhosale, Naman Goyal, Todor Mihaylov, Myle Ott, Sam Shleifer, Xi Victoria Lin, Jingfei Du, Srinivasan Iyer, Ramakanth Pasunuru, et al. Efficient large scale language modeling with mixtures of experts. arXiv preprint arXiv:2112.10684, 2021. URL https://arxiv.org/abs/2112.10684.
193
+ Amanda Askell, Yuntao Bai, Anna Chen, Dawn Drain, Deep Ganguli, Tom Henighan, Andy Jones, Nicholas Joseph, Ben Mann, Nova DasSarma, et al. A general language assistant as a laboratory for alignment. arXiv preprint arXiv:2112.00861, 2021. URL https://arxiv.org/abs/2112.00861.
194
+ Fabrice Bellard. gpt2tc: Text completion and compression using GPT-2, 2021. URL https://bellard. org/libnc/gpt2tc.html. Accessed Apr. 26, 2022.
195
+ Emily M. Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. On the dangers of stochastic parrots: Can language models be too big? Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency, 2021. URL https://dl.acm.org/doi/pdf/10.1145/3442188. 3445922.
196
+ BIG-Bench. Beyond the imitation game: Measuring and extrapolating the capabilities of language models. arXiv preprint arXiv:2206.04615, 2022. URL https://arxiv.org/abs/2206.04615.
197
+ Rishi Bommasani, Drew A. Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S. Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021. URL https://arxiv.org/abs/2108. 07258.
198
+ Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George van den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, et al. Improving language models by retrieving from trillions of tokens. arXiv preprint arXiv:2112.04426, 2021. URL https: //arxiv.org/abs/2112.04426.
199
+ Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D. Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. NeurIPS, 2020. URL https://papers.nips.cc/paper/2020/hash/ 1457c0d6bfcb4967418bfb8ac142f64a-Abstract.html.
200
+ Nicholas Carlini, Florian Tramer, Eric Wallace, Matthew Jagielski, Ariel Herbert-Voss, Katherine Lee, Adam Roberts, Tom Brown, Dawn Song, Ulfar Erlingsson, et al. Extracting training data from large language models. USENIX Security, 2021. URL https://www.usenix.org/conference/usenixsecurity21/ presentation/carlini-extracting.
201
+ Nicholas Carlini, Daphne Ippolito, Matthew Jagielski, Katherine Lee, Florian Tramer, and Chiyuan Zhang. Quantifying memorization across neural language models. arXiv preprint arXiv:2202.07646, 2022. URL https://arxiv.org/abs/2202.07646.
202
+ Stephanie C.Y. Chan, Adam Santoro, Andrew K. Lampinen, Jane X. Wang, Aaditya Singh, Pierre H. Richemond, Jay McClelland, and Felix Hill. Data distributional properties drive emergent few-shot learning in transformers. arXiv preprint arXiv:2205.05055, 2022. URL https://arxiv.org/abs/2205.05055.
203
+ Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, et al. PaLM: Scaling language modeling with Pathways. arXiv preprint arXiv:2204.02311, 2022. URL https://arxiv.org/abs/2204.02311.
204
+ Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. URL https://arxiv.org/abs/2110.14168.
205
+ Andy Coenen, Luke Davis, Daphne Ippolito, Emily Reif, and Ann Yuan. Wordcraft: A human-AI collaborative editor for story writing. arXiv preprint arXiv:2107.07430, 2021. URL https://arxiv.org/abs/2107. 07430.
206
+ Antonella Corradini and Timothy O’Connor. Emergence in science and philosophy, volume 6. Routledge, 2010. URL https://books.google.com/books?hl=en&lr=&id=55RaBwAAQBAJ&oi= fnd&pg=PP1&dq=Emergence+in+science+and+philosophy&ots=2_8VNDXLfv&sig=1aisq_ WouF95Cx58WWMZ0Gq3RNk.
207
+ Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Łukasz Kaiser. Universal transformers. arXiv preprint arXiv:1807.03819, 2018. URL https://arxiv.org/abs/1807.03819.
208
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. NAACL, 2019. URL https://aclanthology.org/ N19-1423.
209
+ Nan Du, Yanping Huang, Andrew M. Dai, Simon Tong, Dmitry Lepikhin, Yuanzhong Xu, Maxim Krikun, Yanqi Zhou, Adams Wei Yu, Orhan Firat, et al. GLaM: Efficient scaling of language models with mixtureof-experts. arXiv preprint arXiv:2112.06905, 2021. URL https://arxiv.org/abs/2112.06905.
210
+ William Fedus, Barret Zoph, and Noam Shazeer. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. arXiv preprint arXiv:2101.03961, 2021. URL https://arxiv.org/ abs/2101.03961.
211
+ Stephanie Forrest. Emergent computation: Self-organizing, collective, and cooperative phenomena in natural and artificial computing networks. Physica D: Nonlinear Phenomena, 42(1-3):1–11, 1990. URL https://www.sciencedirect.com/science/article/abs/pii/016727899090063U.
212
+ Deep Ganguli, Danny Hernandez, Liane Lovitt, Nova DasSarma, Tom Henighan, Andy Jones, Nicholas Joseph, Jackson Kernion, Ben Mann, Amanda Askell, et al. Predictability and surprise in large generative models. arXiv preprint arXiv:2202.07785, 2022. URL https://arxiv.org/abs/2202.07785.
213
+ Tianyu Gao, Adam Fisch, and Danqi Chen. Making pre-trained language models better few-shot learners. ACL, 2021. doi: 10.18653/v1/2021.acl-long.295. URL https://aclanthology.org/2021.acl-long.295.
214
+ Samuel Gehman, Suchin Gururangan, Maarten Sap, Yejin Choi, and Noah A. Smith. RealToxicityPrompts: Evaluating neural toxic degeneration in language models. In Findings of EMNLP, 2020. doi: 10.18653/v1/ 2020.findings-emnlp.301. URL https://aclanthology.org/2020.findings-emnlp.301.
215
+ Alex Graves. Adaptive computation time for recurrent neural networks. arXiv preprint arXiv:1603.08983, 2016. URL https://arxiv.org/abs/1603.08983.
216
+ Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. REALM: Retrieval-augmented language model pre-training. ICML, 2020. URL https://arxiv.org/abs/2002.08909.
217
+ David A. Harper and Paul A. Lewis. New perspectives on emergence in economics. New Perspectives on Emergence in Economics, pp. 2–3, 2012. URL https://www.sciencedirect. com/science/article/pii/S0167268112000200?casa_token ${ } = { }$ fLs2nCYo_64AAAAA: H2sSpSygJmEqXgmpM4jLyeppph3C4TgEsaSXm5RkOpT0r4q2A1x9Su3u4uycK4sIC6a8NdLiSw.
218
+ Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. ICLR, 2021a. URL https://openreview.net/ forum?id=d7KBjmI3GmQ.
219
+ Dan Hendrycks, Nicholas Carlini, John Schulman, and Jacob Steinhardt. Unsolved problems in ML safety. arXiv preprint arXiv:2109.13916, 2021b. URL https://arxiv.org/abs/2109.13916.
220
+ Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556, 2022. URL https://arxiv.org/abs/2203. 15556.
221
+ Ari Holtzman, Peter West, Vered Shwartz, Yejin Choi, and Luke Zettlemoyer. Surface form competition: Why the highest probability answer isn’t always right. EMNLP, 2021. URL https://aclanthology. org/2021.emnlp-main.564.
222
+ Wenlong Huang, Pieter Abbeel, Deepak Pathak, and Igor Mordatch. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. arXiv preprint arXiv:2201.07207, 2022. URL https://arxiv.org/pdf/2201.07207.
223
+ Bernardo A. Huberman and Tad Hogg. Phase transitions in artificial intelligence systems. Artificial Intelligence, 33(2):155–171, 1987. URL https://www.sciencedirect.com/science/article/ abs/pii/0004370287900336.
224
+ Harold Y. Hwang, Yoh Iwasa, Masashi Kawasaki, Bernhard Keimer, Naoto Nagaosa, and Yoshinori Tokura. Emergent phenomena at oxide interfaces. Nature Materials, 11(2):103–113, 2012. URL https://www. nature.com/articles/nmat3223.
225
+ Max Jaderberg, Wojciech Marian Czarnecki, Simon Osindero, Oriol Vinyals, Alex Graves, David Silver, and Koray Kavukcuoglu. Decoupled neural interfaces using synthetic gradients. ICML, 2017. URL https://arxiv.org/abs/1608.05343.
226
+ Dan Jurafsky and James H. Martin. Speech and Language Processing: An Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition. Prentice Hall series in Artificial Intelligence. Pearson Prentice Hall, 2009. ISBN 9780131873216. URL https://books.google.com/books?id= fZmj5UNK8AQC.
227
+ Saurav Kadavath, Tom Conerly, Amanda Askell, Tom Henighan, Dawn Drain, Ethan Perez, Nicholas Schiefer, Zac Hatfield Dodds, Nova DasSarma, Eli Tran-Johnson, et al. Language models (mostly) know what they know. arXiv preprint arXiv:2207.05221, 2022. URL https://arxiv.org/abs/2207.05221.
228
+ Nikhil Kandpal, Eric Wallace, and Colin Raffel. Deduplicating training data mitigates privacy risks in language models. arXiv preprint arXiv:2202.06539, 2022. URL https://arxiv.org/abs/2202.06539.
229
+ Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020. URL https://arxiv.org/abs/2001.08361.
230
+ Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. arXiv preprint arXiv:2205.11916, 2022. URL https://arxiv.org/ abs/2205.11916.
231
+ Andrew K. Lampinen, Ishita Dasgupta, Stephanie C.Y. Chan, Kory Matthewson, Michael Henry Tessler, Antonia Creswell, James L. McClelland, Jane X. Wang, and Felix Hill. Can language models learn from explanations in context? arXiv preprint arXiv:2204.02329, 2022. URL https://arxiv.org/abs/ 2204.02329.
232
+ Katherine Lee, Daphne Ippolito, Andrew Nystrom, Chiyuan Zhang, Douglas Eck, Chris Callison-Burch, and Nicholas Carlini. Deduplicating training data makes language models better. ACL, 2022a. URL https://arxiv.org/abs/2107.06499.
233
+ Mina Lee, Percy Liang, and Qian Yang. Coauthor: Designing a human-AI collaborative writing dataset for exploring language model capabilities. CHI, 2022b. URL https://arxiv.org/abs/2201.06796.
234
+ Dmitry Lepikhin, HyoukJoong Lee, Yuanzhong Xu, Dehao Chen, Orhan Firat, Yanping Huang, Maxim Krikun, Noam Shazeer, and Zhifeng Chen. Gshard: Scaling giant models with conditional computation and automatic sharding. ICLR, 2021. URL https://openreview.net/forum?id=qrwe7XHTmYb.
235
+ Percy Liang. Semi-supervised learning for natural language. PhD thesis, Massachusetts Institute of Technology, 2005. URL https://www-cs.stanford.edu/\~pliang/papers/meng-thesis.pdf.
236
+ Percy Liang, Rishi Bommasani, Kathleen A. Creel, and Rob Reich. The time is now to develop community norms for the release of foundation models, 2022. URL https://crfm.stanford.edu/2022/05/17/ community-norms.html.
237
+ Stephanie Lin, Jacob Hilton, and Owain Evans. TruthfulQA: Measuring how models mimic human falsehoods. arXiv preprint arXiv:2109.07958, 2021. URL https://arxiv.org/abs/2109.07958.
238
+ Christopher D. Manning. Human language understanding & reasoning. Daedalus, 151(2):127–138, 2022. URL https://www.amacad.org/publication/human-language-understanding-reasoning.
239
+ Christopher D. Manning, Kevin Clark, John Hewitt, Urvashi Khandelwal, and Omer Levy. Emergent linguistic structure in artificial neural networks trained by self-supervision. Proceedings of the National Academy of Sciences, 117(48):30046–30054, 2020. URL https://www.pnas.org/doi/10.1073/pnas. 1907367117.
240
+ Bryan McCann, Nitish Shirish Keskar, Caiming Xiong, and Richard Socher. The natural language decathlon: Multitask learning as question answering. arXiv preprint arXiv:1806.08730, 2018. URL https://arxiv. org/abs/1806.08730.
241
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models, 2016. URL https://huggingface.co/datasets/wikitext.
242
+ Scott Miller, Jethran Guinness, and Alex Zamanian. Name tagging with word clusters and discriminative training. In NAACL, 2004. URL https://aclanthology.org/N04-1043.
243
+ Sewon Min, Mike Lewis, Hannaneh Hajishirzi, and Luke Zettlemoyer. Noisy channel language model prompting for few-shot text classification. arXiv preprint arXiv:2108.04106, 2021. URL https://arxiv.org/abs/ 2108.04106.
244
+ Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe, Mike Lewis, Hannaneh Hajishirzi, and Luke Zettlemoyer. Rethinking the role of demonstrations: What makes in-context learning work? arXiv preprint arXiv:2202.12837, 2022. URL https://arxiv.org/abs/2202.12837.
245
+ Maxwell Nye, Anders Johan Andreassen, Guy Gur-Ari, Henryk Michalewski, Jacob Austin, David Bieber, David Dohan, Aitor Lewkowycz, Maarten Bosma, David Luan, et al. Show your work: Scratchpads for intermediate computation with language models. arXiv preprint arXiv:2112.00114, 2021. URL https://openreview.net/forum?id=iedYJm92o0a.
246
+ Catherine Olsson, Nelson Elhage, Neel Nanda, Nicholas Joseph, Nova DasSarma, Tom Henighan, et al. In-context learning and induction heads. Transformer Circuits, 2022. URL https: //transformer-circuits.pub/2022/in-context-learning-and-induction-heads/ index.html.
247
+ Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. arXiv preprint arXiv:2203.02155, 2022. URL https://arxiv.org/abs/2203.02155.
248
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. BLEU: a method for automatic evaluation of machine translation. In ACL, 2002. URL https://aclanthology.org/P02-1040.pdf.
249
+ Alicia Parrish, Angelica Chen, Nikita Nangia, Vishakh Padmakumar, Jason Phang, Jana Thompson, Phu Mon Htut, and Samuel Bowman. BBQ: A hand-built bias benchmark for question answering. In Findings of ACL, 2022. URL https://arxiv.org/abs/2110.08193.
250
+ Roma Patel and Ellie Pavlick. Mapping language models to grounded conceptual spaces. ICLR, 2022. URL https://openreview.net/forum?id=gJcEM8sxHK.
251
+ Ethan Perez, Saffron Huang, Francis Song, Trevor Cai, Roman Ring, John Aslanides, Amelia Glaese, Nat McAleese, and Geoffrey Irving. Red teaming language models with language models. arXiv preprint arXiv:2202.03286, 2022. URL https://arxiv.org/abs/2202.03286.
252
+ Mohammad Taher Pilehvar and Jose Camacho-Collados. WiC: the word-in-context dataset for evaluating context-sensitive meaning representations. NAACL, 2019. URL https://aclanthology.org/ N19-1128.
253
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8), 2019. URL https://d4mucfpksywv.cloudfront.net/better-language-models/language_models_ are_unsupervised_multitask_learners.pdf.
254
+ Jack W. Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, et al. Scaling language models: Methods, analysis & insights from training Gopher. arXiv preprint arXiv:2112.11446, 2021. URL https://arxiv.org/abs/ 2112.11446.
255
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 2020. URL https://jmlr.org/papers/v21/20-074.html.
256
+ Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022. URL https://arxiv.org/ abs/2204.06125.
257
+ Yasaman Razeghi, Robert L Logan IV, Matt Gardner, and Sameer Singh. Impact of pretraining term frequencies on few-shot reasoning. arXiv preprint arXiv:2202.07206, 2022. URL https://arxiv.org/ abs/2202.07206.
258
+ Laria Reynolds and Kyle McDonell. Prompt programming for large language models: Beyond the few-shot paradigm. Extended Abstracts of the 2021 CHI Conference on Human Factors in Computing Systems, 2021. URL https://arxiv.org/abs/2102.07350.
259
+ Rachel Rudinger, Chandler May, and Benjamin Van Durme. Social bias in elicited natural language inferences. In Proceedings of the First ACL Workshop on Ethics in Natural Language Processing, 2017. URL https://aclanthology.org/W17-1609.
260
+ Victor Sanh, Albert Webson, Colin Raffel, Stephen Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, et al. Multitask prompted training enables zero-shot task generalization. ICLR, 2022. URL https://openreview.net/forum?id=9Vrb9D0WI4.
261
+ Nikunj Saunshi, Sadhika Malladi, and Sanjeev Arora. A mathematical exploration of why language models help solve downstream tasks. ICLR, 2021. URL https://arxiv.org/abs/2010.03648.
262
+ Timo Schick and Hinrich Schütze. It’s not just size that matters: Small language models are also few-shot learners. NAACL, June 2021. URL https://aclanthology.org/2021.naacl-main.185.
263
+ Jacob Steinhardt. On the risks of emergent behavior in foundation models, October 2021. URL https://bounded-regret.ghost.io/ on-the-risks-of-emergent-behavior-in-foundation-models/. Accessed Apr 13, 2022.
264
+ Jacob Steinhardt. Future ml systems will be qualitatively different, 2022. URL https://bounded-regret. ghost.io/future-ml-systems-will-be-qualitatively-different/. Accessed May 20, 2022.
265
+ Yi Tay, Vinh Q. Tran, Mostafa Dehghani, Jianmo Ni, Dara Bahri, Harsh Mehta, Zhen Qin, Kai Hui, Zhe Zhao, Jai Gupta, et al. Transformer memory as a differentiable search index. arXiv preprint arXiv:2202.06991, 2022. URL https://arxiv.org/abs/2202.06991.
266
+ Ryan Teehan, Miruna Clinciu, Oleg Serikov, Eliza Szczechla, Natasha Seelam, Shachar Mirkin, and Aaron Gokaslan. Emergent structures and training dynamics in large language models. In ACL Big Science Workshop, 2022. URL https://aclanthology.org/2022.bigscience-1.11/.
267
+ Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, et al. LaMDA: Language models for dialog applications. arXiv preprint arXiv:2201.08239, 2022. URL https://arxiv.org/abs/2201.08239.
268
+ Trieu H. Trinh and Quoc V. Le. A simple method for commonsense reasoning. arXiv preprint arXiv:1806.02847, 2018. URL https://arxiv.org/abs/1806.02847.
269
+ Thomas Wang, Adam Roberts, Daniel Hesslow, Teven Le Scao, Hyung Won Chung, Iz Beltagy, Julien Launay, and Colin Raffel. What language model architecture and pretraining objective work best for zero-shot generalization? arXiv preprint arXiv:2204.05832, 2022a. URL https://arxiv.org/abs/2204.05832.
270
+ Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022b. URL https: //arxiv.org/abs/2203.11171.
271
+ Colin Wei, Sang Michael Xie, and Tengyu Ma. Why do pretrained language models help in downstream tasks? An analysis of head and prompt tuning. NeurIPS, 2021a. URL https://openreview.net/ forum?id=MDMV2SxCboX.
272
+ Jason Wei, Dan Garrette, Tal Linzen, and Ellie Pavlick. Frequency effects on syntactic rule learning in transformers. EMNLP, 2021b. doi: 10.18653/v1/2021.emnlp-main.72. URL https://aclanthology. org/2021.emnlp-main.72.
273
+ Jason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, and Quoc V. Le. Finetuned language models are zero-shot learners. ICLR, 2022a. URL https: //openreview.net/forum?id=gEZrGCozdqR.
274
+ Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. arXiv preprint arXiv:2201.11903, 2022b. URL https://arxiv.org/abs/2201.11903.
275
+ Laura Weidinger, John Mellor, Maribeth Rauh, Conor Griffin, Jonathan Uesato, Po-Sen Huang, Myra Cheng, Mia Glaese, Borja Balle, Atoosa Kasirzadeh, et al. Ethical and social risks of harm from language models. arXiv preprint arXiv:2112.04359, 2021. URL https://arxiv.org/abs/2112.04359.
276
+ Tongshuang Wu, Michael Terry, and Carrie J. Cai. AI chains: Transparent and controllable human-AI interaction by chaining large language model prompts. arXiv preprint arXiv:2110.01691, 2021. URL https://arxiv.org/abs/2110.01691.
277
+ Tongshuang Wu, Ellen Jiang, Aaron Donsbach, Jeff Gray, Alejandra Molina, Michael Terry, and Carrie J. Cai. PromptChainer: Chaining large language model prompts through visual programming. arXiv preprint arXiv:2203.06566, 2022a. URL https://arxiv.org/abs/2203.06566.
278
+ Yuhuai Wu, Markus N Rabe, DeLesley Hutchins, and Christian Szegedy. Memorizing transformers. arXiv preprint arXiv:2203.08913, 2022b.
279
+ Sang Michael Xie, Aditi Raghunathan, Percy Liang, and Tengyu Ma. An explanation of in-context learning as implicit bayesian inference. ICLR, 2022. URL https://arxiv.org/abs/2111.02080.
280
+ Andy Zeng, Adrian Wong, Stefan Welker, Krzysztof Choromanski, Federico Tombari, Aveek Purohit, Michael Ryoo, Vikas Sindhwani, Johnny Lee, Vincent Vanhoucke, et al. Socratic models: Composing zero-shot multimodal reasoning with language. arXiv preprint arXiv:2204.00598, 2022. URL https://arxiv. org/abs/2204.00598.
281
+ Yian Zhang, Alex Warstadt, Xiaocheng Li, and Samuel R. Bowman. When do you need billions of words of pretraining data? In ACL, 2021. doi: 10.18653/v1/2021.acl-long.90. URL https://aclanthology. org/2021.acl-long.90.
282
+ Zihao Zhao, Eric Wallace, Shi Feng, Dan Klein, and Sameer Singh. Calibrate before use: Improving few-shot performance of language models. ICML, 2021. URL https://arxiv.org/abs/2102.09690.
283
+ Denny Zhou, Nathanael Schärli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuurmans, Olivier Bousquet, Quoc Le, and Ed Chi. Least-to-most prompting enables complex reasoning in large language models. arXiv preprint arXiv:2205.10625, 2022. URL https://arxiv.org/abs/2205.10625.
284
+ Barret Zoph, Irwan Bello, Sameer Kumar, Nan Du, Yanping Huang, Jeff Dean, Noam Shazeer, and William Fedus. Designing effective sparse expert models. arXiv preprint arXiv:2202.08906, 2022. URL https: //arxiv.org/abs/2202.08906.
285
+
286
+ # A BIG-Bench analysis
287
+
288
+ # A.1 Cross-entropy loss analysis
289
+
290
+ Here we study how scaling curves may appear differently depending on the evaluation metric used to measure performance. We will focus on the six few-shot prompted BIG-Bench tasks that we consider emergent for LaMDA models. Three of these tasks are generative and use Exact Match (EM) or BLEU (Papineni et al., 2002) as the evaluation metric. The other three tasks are classification and use accuracy (acc) as the evaluation metric.
291
+
292
+ In the scaling curves for these tasks, peformance in EM/BLEU/acc is close to random for small models ( $\leq 1 0 ^ { 2 2 }$ FLOPs / $\geq$ 27B params). We will compare these scaling curves against alternative plots that have a different $y$ -axis measured by cross-entropy loss. Cross-entropy loss differs from EM/BLEU/acc in that it captures improvements in performance (the predicted distribution getting closer to ground truth) even when the EM/BLEU/acc is random. For example, if two examples are both wrong as measured by EM/BLEU/acc, one example may be closer to the ground truth in terms of probabilities, and this information is captured by the cross-entropy loss.
293
+
294
+ These plots are expected to look like one of the following:
295
+
296
+ • Outcome 1: For the model scales where EM/BLEU/acc is random, cross-entropy loss also does not improve as scale increases. This outcome implies that for these scales, the model truly does not get any better at the tasks.
297
+ • Outcome 2: For the model scales where EM/BLEU/acc is random, cross-entropy loss does improve. This outcome implies that the models do get better at the task, but these improvements are not reflected in the downstream metric of interest. The broader implication is that scaling small models improves the models in a way that is not reflected in EM/BLEU/Acc, and that there is some critical model scale where these improvements enable the downstream metric to increase to above random as an emergent ability.
298
+
299
+ We find that all six BIG-Bench tasks fall under Outcome 2, and detail this analysis below. Overall, the conclusion from this analysis is that small models do improve in some ways that downstream metrics that EM/BLEU/Acc do not capture. However, these tasks are still considered emergent, and this analysis does not provide any straightforward indicators of how to predict such emergent behaviors.
300
+
301
+ # A.1.1 Generative tasks
302
+
303
+ Figure 5 shows the cross-entropy loss on the three generative BIG-Bench tasks (modified arithmetic, IPA transliterate, and word unscramble) alongside the downstream evaluation metrics used in Figure 2. For all three tasks, notice that while the error rate is nearly 100% for small models ( $\leq 1 0 ^ { 2 2 }$ FLOPs / $\geq$ 27B params), the cross-entropy loss does actually improve for these model sizes. At the point of emergence as measured by error rate, we also see an “elbow” in performance improvement for cross-entropy loss.
304
+
305
+ # A.1.2 Classification tasks
306
+
307
+ Figure 6 (middle row) shows the cross-entropy loss of the three classification BIG-Bench tasks. Similar to the generative tasks, when the error rate is close to random, cross-entropy loss consistently still improves for models trained with more compute. This again shows that performance as computed by accuracy can mask consistent improvements in the likelihood of the target sequences.
308
+
309
+ We also perform an additional analysis of the multiple choice emergent tasks in Figure 6 (bottom row), which shows the log probabilities of the correct response and incorrect response(s). We find that the crossentropy loss decreases for both the correct and incorrect responses in the three emergent multiple choice tasks. Counterintuitively, both log-probabilities can decrease in tandem even when the probability across all available multiple choice responses is normalized. The reason is that larger models produce less-extreme probabilities (i.e., values approaching 0 or $^ { 1 }$ ) and therefore the average log-probabilities have fewer extremely small values. However, we note that for each of these three tasks, that the average log-probability of the correct and incorrect responses eventually deviates at a certain scale, during which performance on the task increases substantially.
310
+
311
+ ![](images/e432f54d55b67fc08b287e988135282af601ef9ed66be78d1873c421ad58d7d7.jpg)
312
+ Figure 5: Adjacent plots for error rate and cross-entropy loss on three emergent generative tasks in BIG-Bench for LaMDA. We show error rate for both greedy decoding ( $T = 0$ ) as well as random sampling ( $T = 1$ ). Error rate is (1 - exact match score) for modified arithmetic and word unscramble, and (1 - BLEU score) for IPA transliterate.
313
+
314
+ ![](images/3522eb8afaa14e11834b5f1d8663dd5d2f6bf310457ef2751a15559bd44a7a2f.jpg)
315
+ Figure 6: Adjacent plots for error rate, cross-entropy loss, and log probabilities of correct and incorrect responses on three classification tasks on BIG-Bench that we consider to demonstrate emergent abilities. Logical arguments only has 32 samples, which may contribute to noise. Error rate is (1 - accuracy).
316
+
317
+ # A.2 Different metrics for generative tasks
318
+
319
+ In §5.1 we asked whether the apparent emergent abilities on generative tasks were due to using a particular metric such as exact string match, which does not award partially correct sequences. Here, we show three emergent generative BIG-Bench tasks using all evaluation metrics provided by BIG-Bench, which includes metrics such as BLEU, ROUGE, and BLEURT, that award partial credit for answers that do not exactly match the target. For all three tasks, the emergent behavior appears to be independent of which evaluation metric is used. Hence, we conclude that using exact string match instead of another evaluation metric that awards partial credit is not a complete explanation of emergence on generative tasks. Two emergent generative BIG-Bench tasks, word unscramble and repeat copy logic, are excluded here because exact match is the only most sensible evaluation metric for those tasks, which measure the ability to manipulate words in the input (and hence metrics like BLEU and ROUGE that give word-level partial credit are not valid).
320
+
321
+ ![](images/2fa7f27141c0b2284e245f9f109345583b93f88f66f200ee2ad1ab86da71392e.jpg)
322
+ Figure 7: Multiple evaluation metrics for emergent BIG-Bench tasks that are generative in nature. For all three tasks, emergent behavior is apparent for all evaluation metrics.
323
+
324
+ # A.3 BIG-Bench task analysis
325
+
326
+ BIG-Bench contains over 200 tasks, and each task has associated keywords identified by the authors who submitted the task (e.g., “common sense”, “multilingual”). Given this, we asked the question, which types of BIG-Bench tasks are more likely to be emergent (compared with scaling smoothly)? For this analysis, we manually classified all 210 BIG-Bench tasks as thus far emergent or not. We used the definition of emergence given in §3, which is that the task had near-random performance until a certain scale, after which performance increases to substantially above random (as opposed to smoothly increasing). Because this definition is potentially subjective based on the definition of “near-random” (and any heuristic we decide on would encode these subjective biases), two co-authors of the paper worked together and agreed with confidence on all the tasks labeled as emergent. For full transparency, this set of annotations is listed in Appendix E.
327
+
328
+ In Figure 8, we show the number of tasks that are emergent for each keyword in BIG-Bench. Furthermore, we stratify them by tasks that first emerged with LaMDA 137B or GPT-3 175B, as well as tasks that were not emergent until using PaLM models. The non-emergent tasks in this plot include either “smoothly increasing” tasks (performance predictably increased with model size) or “flat” tasks (all models achieved approximately random performance). The remaining 40 BIG-Bench tasks not included in this chart did not fit into any of the above categories (e.g., too noisy due to very few eval examples, performance not correlated with model scale, etc.).
329
+
330
+ Since the number of tasks per keyword varied substantially among keywords, and most keywords had less than twenty tasks, the “most emergent” keywords differed depending on whether we compare number of emergent tasks or percentage of emergent tasks per keyword. Tracking the absolute number of emergent tasks per keyword is problematic since it effectively just captures the most common keywords used across BigBench. We therefore tracked which keywords had the highest percent of emergent tasks, which were analogical reasoning, word sense disambiguation, truthfulness, social reasoning, and emotional understanding. While one might expect a priori that reasoning-related tasks would more likely to be emergent, only two of the top five tasks were reasoning and other keyword tags like logical reasoning and causal reasoning did not have a particularly high fraction of emergent tasks. Moreover, arithmetic and mathematics had relatively low percentage of emergent tasks, which was unexpected since some of the earliest examples of emergence were on arithmetic (Brown et al., 2020). Overall, there are no clear trends for which types of tasks are most emergent.
331
+
332
+ Finally, examining which keywords have the most tasks with flat scaling curves can also align with prior intuitions. For instance, visual reasoning has the largest fraction of tasks with flat scaling curves (8/13), since language models are not designed for visual reasoning. Other categories with a large fraction of flat scaling curve tasks are non-language, repeated interaction, context length, computer code, and multi-step—all targeting weaknesses of large language models. These flat categories could be directions for future work in emergence in large language models.
333
+
334
+ ![](images/a557bf4d161682e68eeeff216ac46aadeaf6ec9e5e11fd69fd3823a49e748523.jpg)
335
+ Figure 8: Proportion of emergent tasks for keywords in BIG-Bench (each task can be associated with multiple keywords). We only included keywords with at least five tasks. Smoothly increasing: performance improved predictably as model scale increased. Emergent with LaMDA/GPT: performance was near-random until used with LaMDA 137B or GPT-3 175B. Emergent with PaLM: performance was near-random for all previous models, until using a PaLM model (8B, 62B, or 540B). Flat: no model performs better than random.
336
+
337
+ # B Further MMLU analysis
338
+
339
+ In §5.3, we saw how emergent performance on MMLU for Gopher and Chinchilla could be viewed as a function of training FLOPs, model parameters, and WikiText103 perplexity. Because MMLU is actually a suite of 57 topics spanning four categories, we ask the question of whether certain categories were more conducive to emergence than others. This is similar in nature to the BIG-Bench analysis done in the prior section (Appendix A.3). One difference here is that the MMLU categories are mutually exclusive—each topic only has one category, whereas a single BIG-Bench task often had multiple keyword tags. However, there are only four categories and 57 tasks for MMLU (compared with $2 0 0 +$ tasks and dozens of keywords for BIG-Bench).
340
+
341
+ In Figure 10, we stratify the performance of MMLU among the four categories given in the benchmark (Humanities, STEM, Social Science, and other), and plot them with multiple $x$ -axes: training FLOPs, model parameters, and WikiText103 perplexity. It is clear that Social Science and Humanities have the largest jump in performance from the second-largest to the largest model, and STEM has the smallest jump in performance. For a given $x$ -axis (training FLOPs, model parameters, WikiText103 ppl), all four categories had similar plot shapes. This result is also summarized in Figure 9.
342
+
343
+ ![](images/0894c6d767569434fd99f733b2ff8296c6a5080f3d0e9fd011a998da62997e51.jpg)
344
+ Figure 9: Performance of largest Chinchilla and Gopher models (70B and 280B, respectively) compared with the second-largest model (7B parameters for both Chiinchlla and Gopher). The 7B Chinchilla and Gopher models perform around random (25%) for all four categories. So the categories that improved the most from 7B to 70B/280B are humanities and social science, whereas STEM (Science, Technology, Engineering, and Mathematics) improved the least.
345
+
346
+ ![](images/0afe3a6dc5ec052dd93e5e28a5a59a1e10a64ab45382ace4b2d1466fc2e1f69d.jpg)
347
+ Figure 10: Emergence of Chinchilla and Gopher on MMLU. In the four rows, performance is stratified into four supercategories. For both Chinchilla and Gopher, Social Science had the highest level of emergence while STEM was the least emergent.
348
+
349
+ # C All Model Details
350
+
351
+ Table 2 below summarizes the parameter count, number of training tokens, and the training FLOPs for the models highlighted in our work. The models span from the smallest LaMDA model with 2.1M parameters to the largest PaLM model with 540B parameters and 2.5E+24 training FLOPs—roughly 8x the computational budget of GPT-3.
352
+
353
+ Table 2: Parameters, training examples, and training FLOPs of large language models.
354
+
355
+ <table><tr><td>Model</td><td>Parameters</td><td>Train tokens</td><td>Train FLOPs</td></tr><tr><td>GPT-3</td><td>125M</td><td>300B</td><td>2.25E+20</td></tr><tr><td></td><td>350M</td><td>300B</td><td>6.41E+20</td></tr><tr><td></td><td>760M</td><td>300B</td><td>1.37E+21</td></tr><tr><td></td><td>1.3B</td><td>300B</td><td>2.38E+21</td></tr><tr><td></td><td>2.7B</td><td>300B</td><td>4.77E+21</td></tr><tr><td></td><td>6.7B</td><td>300B</td><td>1.20E+22</td></tr><tr><td></td><td>13B</td><td>300B</td><td>2.31E+22</td></tr><tr><td></td><td>175B</td><td>300B</td><td>3.14E+23</td></tr><tr><td>LaMDA</td><td>2.1M</td><td>262B</td><td>3.30E+18</td></tr><tr><td></td><td>17M</td><td>313B</td><td>3.16E+19</td></tr><tr><td></td><td>57M</td><td>262B</td><td>8.90E+19</td></tr><tr><td></td><td>134M</td><td>170B</td><td>1.37E+20</td></tr><tr><td></td><td>262M</td><td>264B</td><td>4.16E+20</td></tr><tr><td></td><td>453M</td><td>150B</td><td>4.08E+20</td></tr><tr><td></td><td>1.1B</td><td>142B</td><td>9.11E+20</td></tr><tr><td></td><td>2.1B</td><td>137B</td><td>1.72E+21</td></tr><tr><td></td><td>3.6B</td><td>136B</td><td>2.96E+21</td></tr><tr><td></td><td>8.6B</td><td>132B</td><td>6.78E+21</td></tr><tr><td></td><td>29B</td><td>132B</td><td>2.30E+22</td></tr><tr><td></td><td>69B</td><td>292B</td><td>1.20E+23</td></tr><tr><td></td><td>137B</td><td>674B</td><td>5.54E+23</td></tr><tr><td>Gopher</td><td>417M</td><td>300B</td><td>7.51E+20</td></tr><tr><td></td><td>1.4B</td><td>300B</td><td>2.52E+21</td></tr><tr><td></td><td>7.1B</td><td>300B</td><td>1.28E+22</td></tr><tr><td></td><td>280B</td><td>325B</td><td>5.46E+23</td></tr><tr><td>Chinchilla</td><td>417M</td><td>314B</td><td>7.86E+20</td></tr><tr><td></td><td>1.4B</td><td>314B</td><td>2.63E+21</td></tr><tr><td></td><td>7.1B</td><td>[sic] 199B</td><td>8.47E+21</td></tr><tr><td></td><td>70B</td><td>1.34T</td><td>5.63E+23</td></tr><tr><td>PaLM</td><td>8B</td><td>780B</td><td>3.74E+22</td></tr><tr><td></td><td>62B</td><td>780B</td><td>2.90E+23</td></tr><tr><td></td><td>540B</td><td>780B</td><td>2.53E+24</td></tr><tr><td>Anthropic LM</td><td>800M</td><td>850B</td><td>4.08E+21</td></tr><tr><td></td><td>3B</td><td>850B</td><td>1.53E+22</td></tr><tr><td></td><td>12B</td><td>850B</td><td>6.12E+22</td></tr><tr><td></td><td>52B</td><td>850B</td><td>2.65E+22</td></tr></table>
356
+
357
+ # D Scaling with Parameter Count
358
+
359
+ Figures 11, 12, and 13 shows emergent abilities with an $x$ -axis of number of model parameters.
360
+
361
+ ![](images/bd0e7c53261d54605d50991a376357e0e85c669a2bfa463fa2a0a2b3aff4faa6.jpg)
362
+ Figure 11: Eight examples of emergence in the few-shot prompting setting. Each point is a separate model. The ability to perform a task via few-shot prompting is emergent when a language model achieves random performance until a certain scale, after which performance significantly increases to well-above random. Note that models with more parameters also typically use more training compute—hence, we show an analogous figure with training FLOPs instead of number of model parameters as the $x$ -axis in Figure 2. A–D: BIG-Bench (2022), 2-shot. E: Lin et al. (2021) and Rae et al. (2021). F: Patel & Pavlick (2022). G: Hendrycks et al. (2021a), Rae et al. (2021), and Hoffmann et al. (2022). H: Brown et al. (2020), Hoffmann et al. (2022), and Chowdhery et al. (2022) on the WiC benchmark (Pilehvar & Camacho-Collados, 2019).
363
+
364
+ ![](images/cd1ae9ff857954161b763d37281f9acd20b9ad6edf5b583a6807ed76bf1af2cb.jpg)
365
+ Figure 12: Specialized prompting or finetuning methods can be emergent in that they do not have a positive effect until a certain model scale. A: Wei et al. (2022b). B: Wei et al. (2022a). C: Nye et al. (2021). D: Kadavath et al. (2022). The model shown in A-C is LaMDA (Thoppilan et al., 2022), and the model shown in D is from Anthropic.
366
+
367
+ ![](images/2f8e07a62d92f6308d8f287f0d2b9f5f079660af46539bfa822d27842ae35d9f.jpg)
368
+ Figure 13: On some benchmarks, task-general models (not explicitly trained to perform a task) surpass prior state-of-the-art performance held by a task-specific model. A & B: Brown et al. (2020). C: Chowdhery et al. (2022). D: Alayrac et al. (2022).
369
+
370
+ # E BIG-Bench Task Classification
371
+
372
+ This appendix contains the task classification annotations used for Figure 8 in Appendix A.3. Each task only appears in a single category. That is, if a task was initially emergent with GPT-3 or LaMDA, we excluded it from the PaLM emergence category.
373
+
374
+ Notably, Appendix E.4 lists the tasks where no model performs better than random (i.e., flat scaling curve). These tasks are potential candidates for future emergence, since a model in the future might achieve above-random performance on them.
375
+
376
+ # E.1 Smoothly increasing
377
+
378
+ abstract narrative understanding, auto categorization, bbq lite json, cause and effect, chess state tracking, conlang translation, context definition alignment, contextual parametric knowledge conflicts, coqa conversational question answering, cryobiology spanish, date understanding, emojis emotion prediction, empirical judgments, entailed polarity, evaluating information essentiality, forecasting subquestions, gem, general knowledge, hindi question answering, human organs senses, implicatures, implicit relations, intent recognition, linguistic mappings, list functions, matrixshapes, mult data wrangling, multiemo, natural instructions, nonsense words grammar, object counting, operators, penguins in a table, physics, polish sequence labeling, qa wikidata, reasoning about colored objects, rephrase, riddle sense, sentence ambiguity, similarities abstraction, simp turing concept, simple arithmetic, simple arithmetic json, simple arithmetic json multiple choice, simple arithmetic json subtasks, simple arithmetic multiple targets json, simple ethical questions, squad shifts, subject verb agreement, swedish to german proverbs, undo permutation, unit conversion, unnatural in context learning, bridging anaphora resolution barqa, disfl qa, novel concepts, periodic elements
379
+
380
+ # E.2 Emergent with GPT-3 or LaMDA
381
+
382
+ analytic entailment, codenames, common morpheme, fact checker, figure of speech detection, gender inclusive sentences german, hindu knowledge, international phonetic alphabet transliterate, irony identification, logical args, logical deduction, misconceptions, modified arithmetic, phrase relatedness, physical intuition, question answer creation, repeat copy logic, self evaluation tutoring, social iqa, sports understanding, strange stories, strategyqa, swahili english proverbs, word sorting, word unscrambling
383
+
384
+ # E.3 Emergent wih PaLM
385
+
386
+ anachronisms, analogical similarity, ascii word recognition, auto debugging, causal judgment, code line description, conceptual combinations, crass ai, cryptonite, cs algorithms, disambiguation qa, elementary math qa, emoji movie, english proverbs, english russian proverbs, geometric shapes, goal step wikihow, gre reading comprehension, hinglish toxicity, hyperbaton, identify odd metaphor, international phonetic alphabet nli, language identification, linguistics puzzles, logic grid puzzle, logical fallacy detection, logical sequence, metaphor boolean, metaphor understanding, movie dialog same or different, odd one out, parsinlu qa, parsinlu reading comprehension, physics questions, question selection, snarks, sufficient information, temporal sequences, timedial, understanding fables, unit interpretation, vitaminc fact verification
387
+
388
+ # E.4 Flat (no model better than random)
389
+
390
+ abstraction and reasoning corpus, authorship verification, checkmate in one, chinese remainder theorem, cifar10 classification, color, com2sense, cycled letters, discourse marker prediction, formal fallacies syllogisms negation, hhh alignment, kanji ascii, kannada, key value maps, language games, mathematical induction, minute mysteries qa, misconceptions russian, mnist ascii, multistep arithmetic, navigate, paragraph segmentation, play dialog same or different, presuppositions as nli, program synthesis, python programming challenge, real or fake text, roots optimization and games, salient translation error detection, self awareness, semantic parsing in context sparc, semantic parsing spider, simple text editing, sudoku, symbol interpretation, talkdown, tense, text navigation game, topical chat, tracking shuffled objects, twenty questions, web of lies, which wiki edit, winowhy, word problems on sets and graphs
391
+
392
+ # E.5 Other
393
+
394
+ Better than random and not correlated with scale: boolean expressions, crash blossom, dynamic counting, entailed polarity hindi, epistemic reasoning, factuality of summary, fantasy reasoning, gender sensitivity chinese, gender sensitivity english, high low game, identify math theorems, intersect geometry, muslim violence bias, persian idioms, protein interacting sites, scientific press release, self evaluation courtroom, social support, spelling bee, taboo, training on test set, truthful qa, yes no black white, dark humor detection, dyck languages, moral permissibility, ruin names
395
+
396
+ Model gets worse with scale: bbq lite, bias from probabilities, diverse social bias, movie recommendation, unqover
397
+
398
+ Not enough examples: known unknowns, suicide risk, what is the tao
399
+
400
+ Incomplete evals: convinceme, long context integration, medical questions russian
401
+
402
+ Other: arithmetic (emergent at 1B, which is none of the above categories), few-shot nlg (not sure why BLEURT is negative here)
403
+
404
+ # F PaLM 62B is emergent but GPT-3 and LaMDA are not
405
+
406
+ We made the point in §5.2 that scale is not the only factor in emergence, since PaLM 62B shows emergence on many BIG-Bench tasks for which GPT-3 175B and LaMDA 137B do not, even though PaLM 62B has fewer model parameter and less training FLOPs.
407
+
408
+ This is the list of tasks: anachronisms, ascii word recognition, conceptual combinations, cryptonite, disambiguation qa, emoji movie, goal step wikihow, gre reading comprehension, linguistics puzzles, logic grid puzzle, metaphor boolean, metaphor understanding, odd one out, parsinlu qa.
parse/test/yzkSU5zdwD/yzkSU5zdwD_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/yzkSU5zdwD/yzkSU5zdwD_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/yzkSU5zdwD/yzkSU5zdwD_model.json ADDED
The diff for this file is too large to render. See raw diff