Datasets:
Add files using upload-large-folder tool
Browse files- md/test/2vAhX71UCL/2vAhX71UCL.md +358 -0
- md/test/8s8K2UZGTZ/8s8K2UZGTZ.md +299 -0
- md/test/AFDcYJKhND/AFDcYJKhND.md +0 -0
- md/test/AL1fq05o7H/AL1fq05o7H.md +0 -0
- md/test/FQepisCUWu/FQepisCUWu.md +253 -0
- md/test/H4yQefeXhp/H4yQefeXhp.md +305 -0
- md/test/IkmD3fKBPQ/IkmD3fKBPQ.md +294 -0
- md/test/KuPixIqPiq/KuPixIqPiq.md +0 -0
- md/test/LzPWWPAdY4/LzPWWPAdY4.md +421 -0
- md/test/MLBdiWu4Fw/MLBdiWu4Fw.md +440 -0
- md/test/OEL4FJMg1b/OEL4FJMg1b.md +247 -0
- md/test/SXMTK2eltf/SXMTK2eltf.md +212 -0
- md/test/SqW42eR2wC/SqW42eR2wC.md +856 -0
- md/test/ehfRiF0R3a/ehfRiF0R3a.md +0 -0
- md/test/iwd9sQWnXb/iwd9sQWnXb.md +339 -0
- md/test/rAnB7JSMXL/rAnB7JSMXL.md +275 -0
- md/test/rlloVZoKrX/rlloVZoKrX.md +0 -0
- md/test/rzQGHXNReU/rzQGHXNReU.md +203 -0
- md/test/y01KGvd9Bw/y01KGvd9Bw.md +0 -0
- md/test/y0GJXRungR/y0GJXRungR.md +0 -0
md/test/2vAhX71UCL/2vAhX71UCL.md
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DREAMIX: VIDEO DIFFUSION MODELS ARE GENERAL VIDEO EDITORS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
Input Video
|
| 6 |
+
|
| 7 |
+

|
| 8 |
+
Figure 1: Video Editing with Dreamix: By conditioning on the text prompt “A bear dancing and jumping to upbeat music, moving his whole body“, Dreamix transforms the eating monkey (top row) into a dancing bear (bottom row), affecting motion and appearance. It maintains fidelity to color, object and camera pose, and results in a temporally consistent video. We strongly encourage the reviewer to view the supplementary videos
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
Text-driven image and video diffusion models have recently achieved unprecedented generation realism. While diffusion models have been successfully applied for image editing, none can edit motion in video. We present the first diffusionbased method that is able to perform text-based motion and appearance editing of general, real-world videos. Our approach uses a video diffusion model to combine, at inference time, the low-resolution spatio-temporal information from the original video with new, high resolution information that it synthesized to align with the guiding text prompt. As maintaining high-fidelity to the original video requires retaining some of its high-resolution information, we add a preliminary stage of finetuning the model on the original video, significantly boosting fidelity. We propose to improve motion editability by using a mixed objective that jointly finetunes with full temporal attention and with temporal attention masking. We extend our method for animating images, bringing them to life by adding motion to existing or new objects, and camera movements. Extensive experiments showcase our method’s remarkable ability to edit motion in videos.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Recent advancements in generative models Ho et al. (2020); Chang et al. (2022); Yu et al. (2022a); Chang et al. (2023) and multimodal vision-language models Radford et al. (2021), paved the way to large-scale text-to-image models capable of unprecedented generation realism and diversity Ramesh et al. (2022); Rombach et al. (2022); Saharia et al. (2022b); Nichol et al. (2021); Avrahami et al. (2022b). These models have ushered in a new era of creativity, applications, and research. Although these models offer new creative processes, they are limited to synthesizing new images rather than editing existing ones. To bridge this gap, intuitive image editing methods offer text-based editing of generated and real images while maintaining some of their original attributes Hertz et al. (2022); Tumanyan et al. (2022); Brooks et al. (2022); Kawar et al. (2022); Valevski et al. (2022). Similarly to images, text-to-video models have recently been proposed Ho et al. (2022c;a); Singer et al. (2022); Yu et al. (2022b), but very few methods use them for video editing and none can edit the motion in videos.
|
| 17 |
+
|
| 18 |
+
In text-guided video editing, the user provides an input video and a text prompt describing the desired attributes of the resulting video (Fig. 1). The objectives are three-fold: i) alignment: the edited video should conform with the input text prompt ii) fidelity: the edited video should preserve the content of the original input iii) quality: the edited video should be of high-quality. Video editing is more challenging than image editing, as it requires synthesizing new motion, not merely modifying appearance. It also requires temporal consistency. As a result, applying image-level editing methods e.g. SDEdit Meng et al. (2021) or Prompt-to-Prompt Hertz et al. (2022) sequentially on the video frames is insufficient.
|
| 19 |
+
|
| 20 |
+
We present a new method, Dreamix, to adapt a text-conditioned video diffusion model (VDM) for video editing, in a manner inspired by UniTune Valevski et al. (2022). The core of our method is enabling a text-conditioned VDM to maintain high fidelity to an input video via two main ideas. First, instead of using pure-noise as initialization for the model, we use a degraded version of the original video, keeping only low spatio-temporal information by downscaling it and adding noise. This is similar to SDEdit but the degradation includes not merely noise, but also downscaling. Second, we further improve the fidelity to the original video by finetuning the model on the original video. Finetuning ensures the model has knowledge of the high-resolution attributes of the original video. Naively finetuning on the input video results in relatively low motion editability as the model learns to prefer the original motion instead of following the text prompt. We propose a novel use for the mixed finetuning approach, suggested in VDM Ho et al. (2022c) and Imagen-Video Ho et al. (2022a), in which the VDMs are trained on both images and video. In our approach, we finetune the model on both the original video but also on its (unordered) frames individually. This allows us to perform significantly larger motion edits with high fidelity to the original video.
|
| 21 |
+
|
| 22 |
+
As a further contribution, we leverage our video editing model to add motion to still images (see Fig. 2) e.g., animating the objects and background in an image or creating dynamic camera motion. To do so, we first create a coarse video by simple image processing operations, e.g., frame replication or geometric image transformation. We then edit it with our Dreamix video editor. Our framework can also perform subject-driven video generation (see Fig. 2), extending the scope of current imagebased methods e.g., DreamboothRuiz et al. (2022) to video and motion editing. We evaluate our method extensively, demonstrating its remarkable capabilities unmatched by the baseline methods.
|
| 23 |
+
|
| 24 |
+
To summarize, our main contributions are:
|
| 25 |
+
|
| 26 |
+
1. Proposing the first method for text-based editing of real-world videos that can edit their motion and not merely their appearance.
|
| 27 |
+
2. Repurposing mixed training as a finetuning objective that significantly improves motion editing.
|
| 28 |
+
3. Presenting a new framework for text-guided image animation, by applying our video editor method on top of simple image preprocessing operations.
|
| 29 |
+
4. Extending the scope of subject-driven generation methods to motion generation.
|
| 30 |
+
|
| 31 |
+
# 2 RELATED WORK
|
| 32 |
+
|
| 33 |
+
# 2.1 DIFFUSION MODELS FOR SYNTHESIS
|
| 34 |
+
|
| 35 |
+
Deep diffusion models recently emerged as a powerful new paradigm for image generation Ho et al. (2020); Song et al. (2020), and have their roots in score-matching Hyvarinen & Dayan ¨ (2005); Vincent (2011); Sohl-Dickstein et al. (2015). They outperform Dhariwal & Nichol (2021) the previous state-of-the-art approach, generative adversarial networks (GANs) Goodfellow et al. (2020). While they have multiple formulations, EDM Karras et al. (2022) showed they are equivalent. Outstanding progress was made in text-to-image generation Saharia et al. (2022b); Ramesh et al. (2022); Rombach et al. (2022); Avrahami et al. (2022b), where new images are sampled conditioned on an input text prompt. Extending diffusion models to video generation is a challenging computational and algorithmic task. Early work include Ho et al. (2022c) and text-to-video extensions by Ho et al. (2022a); Singer et al. (2022). Another line of work extends synthesis to various image reconstruction tasks Saharia et al. (2022c;a); Ho et al. (2022b); Lugmayr et al. (2022); Chung et al. (2022), Horwitz & Hoshen (2022) extracts confidence intervals for reconstruction tasks.
|
| 36 |
+
|
| 37 |
+

|
| 38 |
+
|
| 39 |
+
Figure 2: Image-to-Video editing with Dreamix: Dreamix instills complex motion in a static image (first row), adding a moving shark and making the turtle swim. In this case, visual fidelity to object location and background was preserved but the turtle direction was flipped. In the subject-driven case (second row), Dreamix extracts the visual features of a subject given multiple images and animates it in different scenarios such as weightlifting
|
| 40 |
+
|
| 41 |
+
# 2.2 DIFFUSION MODELS FOR EDITING
|
| 42 |
+
|
| 43 |
+
Image editing with generative models has been studied extensively, in past years many of the models were based on GANs Vinker et al. (2021); Patashnik et al. (2021); Gal et al. (2021); Roich et al. (2022); Wang et al. (2018b); Park et al. (2019); Bau et al. (2020); Skorokhodov et al. (2022); Jamriska et al. ˇ (2019); Wang et al. (2018a); Tzaban et al. (2022); Xu et al. (2022); Liu et al. (2022). Another recent line of works demonstrated preliminary generation and editing capabilities using masked image models Yu et al. (2022b); Villegas et al. (2022); Yao et al. (2021); Nash et al. (2022). However, most of the recent editing methods adopt diffusion models Avrahami et al. (2022c;a); Voynov et al. (2022). SDEdit Meng et al. (2021) proposed to add targeted noise to an input image, and then use diffusion models for reversing the process. Prompt-to-Prompt Hertz et al. (2022); Tumanyan et al. (2022); Mokady et al. (2022) perform semantic edits by mixing activations extracted with the original and target prompts. For InstructPix2Pix Brooks et al. (2022) this is only needed for constructing the training dataset. Other works (e.g. Gal et al. (2022); Ruiz et al. (2022)) use finetuning and optimization to allow for personalization of the model, learning a special token describing the content. UniTune Valevski et al. (2022) and Imagic Kawar et al. (2022) finetune on a single image, allowing better editability while maintaining good fidelity. However, the methods are image-centric and do not use temporal information. Neural Atlases Kasten et al. (2021) and Text2Live Bar-Tal et al. (2022) allow some texture-based video editing, however, unlike our method they cannot edit the motion of a video. A concurrent paper, Tune-a-Video Wu et al. (2022) preforms video editing by inflating a text-to-image model to learn temporal consistency. Despite their promising results, they use a text-to-image backbone that can edit video appearance but not motion. Their results are also not fully temporally consistent. In contrast, our method uses a text-to-video backbone, enabling motion editing while maintaining smoothness and temporal consistency.
|
| 44 |
+
|
| 45 |
+
# 3 BACKGROUND: VIDEO DIFFUSION MODELS
|
| 46 |
+
|
| 47 |
+
Denoising Model Training. Diffusion models rely on a deep denoising neural network denoted by $D _ { \theta }$ . Let us denote the ground truth video as $v$ , an i.i.d Gaussian noise tensor of the same dimensions as the video as $\epsilon \sim N ( 0 , { \bf I } )$ , and the noise level at time $s$ as $\sigma _ { s }$ . The noisy video is given by: $z _ { s } = \gamma _ { s } v + \sigma _ { s } \epsilon$ , where $\gamma _ { s } = \sqrt { 1 - \sigma _ { s } ^ { 2 } }$ . Furthermore, let us denote a conditioning text prompt as $t$ and a conditioning video $c$ (for super-resolution, $c$ is a low-resolution version of $v$ ). The objective of the denoising network $D _ { \theta }$ is to recover the ground truth video $v$ given the noisy input video $z _ { s }$ , the time $s$ , prompt $t$ and conditioning video $c$ . The model is trained on a (large) training corpus $\nu$ consisting of pairs of video $v$ and text prompts $t$ .
|
| 48 |
+
|
| 49 |
+
Sampling from Diffusion Models. The key challenge in diffusion models is to use the denoiser network $D _ { \theta }$ to sample from the distribution of videos conditioned on the text prompt $t$ and conditioning video $c$ , $P ( v | t , c )$ . While the derivation of such sampling rule is non-trivial (see e.g. Karras et al. (2022)), the implementation of such sampling is relatively simple in practice. We follow Ho et al. (2022a) in using stochastic DDIM sampling. At a heuristic level, at each step, we first use the denoiser network to estimate the noise. We then remove a fraction of the estimated noise and finally add randomly generated Gaussian noise, with magnitude corresponding to half of the removed noise.
|
| 50 |
+
|
| 51 |
+

|
| 52 |
+
Input Video
|
| 53 |
+
Figure 3: Video Motion Editing: Dreamix can significantly change the actions and motions of subjects in a video (e.g. making a puppy leap) while maintaining temporal consistency and preserving the unedited details
|
| 54 |
+
|
| 55 |
+
Cascaded Video Diffusion Models. Training high-resolution text-to-video models is very challenging due to the high computational complexity. Several diffusion models overcome this by using cascaded architectures. We use a model that follows the architecture of Ho et al. (2022a), which consists of a cascade of 7 models. The base model maps the input text prompt into a 5-second video of $2 4 \times 4 0 \times 1 6$ frames. It is then followed by 3 spatial super-resolution models and 3 temporal super-resolution models. For implementation details, see Appendix C.
|
| 56 |
+
|
| 57 |
+
# 4 EDITING BY VIDEO DIFFUSION MODELS
|
| 58 |
+
|
| 59 |
+
We propose a new method for video editing using text-guided video diffusion models. We extended it to image animation in Sec. 5.
|
| 60 |
+
|
| 61 |
+
# 4.1 VIDEO EDITING BY INVERTING CORRUPTIONS
|
| 62 |
+
|
| 63 |
+
We wish to edit an input video using the guidance of a text prompt $t$ describing the video after the edit. In order to do so we leverage the power of a cascade of VDMs. The key idea is to first corrupt the video by downsampling followed by adding noise. We then apply the sampling process of the cascaded diffusion models from the time step corresponding to the noise level, conditioned on $t .$ , which upscales the video to the final spatio-temporal resolution. The effect is that the VDM will use the low-resolution details provided by the degraded input video, but synthesize new high spatiotemporal resolution information using the text prompt guidance. While this procedure is essentially a text-guided version of SDEdit Meng et al. (2021), for complex edits e.g., motion editing this by itself does not result in sufficiently high-fidelity videos. To mitigate this issue, we use a mixed-finetuning objective described in Sec. 4.2.
|
| 64 |
+
|
| 65 |
+
Input Video Degradation. We downsample the input video to the resolution of the base model (16 frames of $2 4 \times 4 0$ ). We then add i.i.d Gaussian noise with variance $\sigma _ { s } ^ { 2 }$ to further corrupt the input video. The noise strength is equivalent to time $s$ in the diffusion process of the base model. For $s = 0$ , no noise is added, while for $s = 1$ , the video is replaced by pure Gaussian noise. Note, that even when no noise is added, the input video is highly corrupted due to the extreme downsampling ratio.
|
| 66 |
+
|
| 67 |
+
Text-Guided Corruption Inversion. We can now use the cascaded VDMs to map the corrupted, low-resolution video into a high-resolution video that aligns with the text. The core idea here is that given a noisy, very low spatio-temporal resolution video, there are many perfectly feasible, high-resolution videos that correspond to it. We use the target text prompt $t$ to select the feasible outputs that not only correspond to the low-resolution of the original video but are also aligned to edits desired by the user. The base model starts with the corrupted video, which has the same noise as the diffusion process at time $s$ . We use the model to reverse the diffusion process up to time 0. We then upscale the video through the entire cascade of super-resolution models (see Appendix C). All models are conditioned on the prompt $t$ .
|
| 68 |
+
|
| 69 |
+

|
| 70 |
+
Figure 4: Mixed Video-Image Finetuning: Finetuning the VDM on the input video alone limits the extent of motion change. Instead, we use a mixed objective that beside the original objective (bottom left) also finetunes on the unordered set of frames. We use “masked temporal attention“ to prevent the temporal attention and convolution from changing (bottom right). This allows adding motion to a static video
|
| 71 |
+
|
| 72 |
+
# 4.2 MIXED VIDEO-IMAGE FINETUNING
|
| 73 |
+
|
| 74 |
+
The naive method presented in Sec. 4.1 relies on a corrupted version of the input video which does not include enough information to preserve high-resolution details such as fine textures or object identity. We tackle this by adding a preliminary stage of finetuning the model on the input video $v$ . Note that this only needs to be done once for the video, which can then be edited by many prompts without further finetuning. We would like the model to separately update its prior both on the appearance and the motion of the input video. Our approach therefore treats the input video, both as a single video clip and as an unordered set of $M$ frames, denoted by $\boldsymbol { u } = \{ x _ { 1 } , x _ { 2 } , . . , x _ { M } \}$ . We use a rare string $t ^ { * }$ as the text prompt, following Ruiz et al. (2022). We finetune the denoising models by a combination of two objectives. The first objective updates the model prior on both motion and appearance by requiring it to reconstruct the input video $v$ given its noisy versions $z _ { s }$ .
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
\mathcal { L } _ { \theta } ^ { v i d } ( v ) = \mathbb { E } _ { \epsilon \sim N ( 0 , \mathbf { I } ) , s \in \mathcal { U } ( 0 , 1 ) } \Vert D _ { \theta ^ { \prime } } ( z _ { s } , s , t ^ { * } , c ) - v \Vert ^ { 2 }
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
Additionally, we train the model to reconstruct each of the frames individually given their noisy version. This enhances the appearance prior of the model, separately from the motion. Technically, the model is trained on a sequence of frames $u$ by replacing the temporal attention layers by trivial fixed masks ensuring the model only pays attention within each frame, and also by masking the residual temporal convolution blocks. We denote the attention masked denoising model as $D _ { \theta } ^ { a }$ . The masked attention objective is:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
\mathcal { L } _ { \theta } ^ { f r a m e } ( u ) = \mathbb { E } _ { \epsilon \sim N ( 0 , \mathbf { I } ) , s \in \mathcal { U } ( 0 , 1 ) } \Vert D _ { \theta ^ { \prime } } ^ { a } ( z _ { s } , s , t ^ { * } , c ) - u \Vert ^ { 2 }
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
We train the joint objective:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\theta = a r g \operatorname* { m i n } _ { \theta ^ { \prime } } \alpha \mathcal { L } _ { \theta ^ { \prime } } ^ { v i d } ( v ) + ( 1 - \alpha ) \mathcal { L } _ { \theta ^ { \prime } } ^ { f r a m e } ( u )
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
Where $\alpha$ is a constant factor, see Fig. 4. Training on a single video or a handful of frames can easily lead to overfitting, reducing the editing ability of the original model. To mitigate overfitting, we use a small number of finetuning iterations and a low learning rate (see Appendix C). Note that while such a training objective was used by Imagen-VideoHo et al. (2022a) and VDMHo et al. (2022c), its purpose was different. There, the aim was to increase dataset size and diversity by training on large image datasets. Here, the aim is to enforce the style of the video in the model, while allowing motion editing.
|
| 93 |
+
|
| 94 |
+

|
| 95 |
+
Figure 5: Inference Overview: Our method supports multiple applications by converting the input into a uniform video format (left). For image-to-video, the input image is duplicated and transformed using perspective transformations, synthesizing a coarse video with some camera motion. For subject-driven video generation, the input is omitted - finetuning alone takes care of the fidelity. This coarse video is then edited using our general “Dreamix Video Editor“ (right): we first corrupt the video by downsampling followed by adding noise. We then apply the finetuned text-guided VDM, which upscales the video to the final spatio-temporal resolution
|
| 96 |
+
|
| 97 |
+
# 5 APPLICATIONS OF DREAMIX
|
| 98 |
+
|
| 99 |
+
The method proposed in Sec. 4, can edit motion and appearance in real-world videos. In this section, we propose a framework for using our Dreamix video editor for general, text-conditioned image-tovideo editing, see Fig. 5 for an overview.
|
| 100 |
+
|
| 101 |
+
Dreamix for Single Images. Provided our general video editing method, Dreamix, we now propose a framework for image animation conditioned on a text prompt. The idea is to transform the image or a set of images into a coarse, corrupted video and edit it using Dreamix. For example, given a single image $x$ as input, we can transform it to a video by replicating it 16 times to form a static video $v = \mathbf { \bar { [ } } x , x , x . . . \bar { x } ]$ . We can then edit its appearance and motion using Dreamix conditioned on a text prompt. Here, we do not wish to incorporate the motion of the input video (as it is static and meaningless) and therefore use only the masked temporal attention finetuning $( \alpha = 0$ ). To create “cinematic” effects, we can further control the output video by simulating camera motion, such as panning and zoom. We perform this by sampling a smooth sequence of 16 perspective transformations $T _ { 1 } , T _ { 2 } . . T _ { 1 6 }$ and apply each on the original image. When the perspective requires pixels outside the input image, we simply outpaint them using reflection padding. We concatenate the sequence of transformed images into a low quality input video $v ~ \stackrel { - } { = } ~ [ T _ { 1 } ( \stackrel { - } { x } ) , T _ { 2 } ( x ) . . T _ { 1 6 } ( x ) ]$ . While this does not result in realistic video, Dreamix can transform it into a high-quality edited video. See Appendix D for details on the applied transformations.
|
| 102 |
+
|
| 103 |
+
Dreamix for subject-driven video generation. We propose to use Dreamix for text-conditioned video generation given an image collection. Differently from existing methods, e.g., Dreambooth Ruiz et al. (2022), it can add motion and not only change appearance. The input to our method is a set of images, each containing the subject of interest. This can also use different frames from the same video, as long as they show the same subject. Higher diversity of viewing angles and backgrounds is beneficial for the performance of the method. We then use the finetuning method from Sec. 4.2, where we only use the masked attention finetuning $( \alpha = 0$ ). After finetuning, we use the text-to-video model without a conditioning video, but rather only using a text prompt (which includes the special token $t ^ { * }$ ).
|
| 104 |
+
|
| 105 |
+
# 6 EXPERIMENTS
|
| 106 |
+
|
| 107 |
+
In this section, we establish that Dreamix is able to edit motion in real-world videos and images, a major improvement over the existing methods. To fully experience our results, please see the supplementary videos.
|
| 108 |
+
|
| 109 |
+
“The Merced river is overflowing, birds flying in the sky, camera is zooming out to reveal an American Buffalo bathing in the river”
|
| 110 |
+
|
| 111 |
+

|
| 112 |
+
“A bear walking”Figure 6:Input ImagesAdditional Image-to-Video Results: First row - the image is zoomed out to reveal a bathing buffalo. Dreamix can also instill motion in a static image as in the second row where the glass is gradually filled with coffee. Third row - animating a subject based on a small number of independent images
|
| 113 |
+
|
| 114 |
+
Table 1: User Study: Users rated editing results by quality, fidelity to the base video and alignment with the text prompt. Based on visual inspection, we require an edit to score greater than 2.5 in all dimensions to be successful and observe that Dreamix is the only method to achieve the desired trade off
|
| 115 |
+
|
| 116 |
+
<table><tr><td>Method</td><td>Quality</td><td>Fidelity</td><td>Alignment Success</td><td></td></tr><tr><td>PnP</td><td></td><td>2.16 ±1.13 3.78 ±0.99</td><td>3.39 ±1.38</td><td>20%</td></tr><tr><td>TaVid</td><td></td><td>1.99 ±0.92 3.29 ±1.21</td><td>2.69 ±1.55</td><td>13%</td></tr><tr><td>Ours</td><td>3.58±1.043.55 ±1.093.79 ±1.33</td><td></td><td></td><td>76%</td></tr><tr><td></td><td>Uncond. 3.43 ±1.09 2.49±1.12 4.28 ±1.02</td><td></td><td></td><td>45%</td></tr></table>
|
| 117 |
+
|
| 118 |
+
# 6.1 QUALITATIVE RESULTS
|
| 119 |
+
|
| 120 |
+
Video Editing. In Fig. 1, we change the motion to dancing and the appearance from monkey to bear while keeping the coarse attributes of the video fixed. Dreamix can also generate new motion that does not necessarily align with the input video (puppy in Fig. 3, orangutan in supplementary material (SM)), and can control camera movements (zoom-out example in the SM). Dreamix can generate smooth visual modifications that align with the temporal information in the input video. This includes adding effects (field and saxophone in the SM), adding or replacing objects (hat, skateboard, and robot in the SM), and changing the background (truck in the SM).
|
| 121 |
+
|
| 122 |
+
Image-driven Videos. When the input is a single image, Dreamix can use its video prior to add new moving objects (camel in SM), inject motion into the input (turtle in Fig. 2 and coffee in Fig. 6), or new camera movements (buffalo in Fig. 6). Although Singer et al. (2022); Yu et al. (2022b) perform image-driven animations, they can only add very simple motions (e.g. animating water or snowfall). Our method is unique in adding large motions and moving objects into general, real-world images.
|
| 123 |
+
|
| 124 |
+
Subject-driven Video Generation. Dreamix can take an image collection showing the same subject and generate new videos with this subject in motion. This is unique, as previous approaches could only output still images. We demonstrate this on a range of subjects and actions including: the weight-lifting toy fireman in Fig. 2, walking and drinking bear in Fig. 6 and SM. It can place the subjects in new surroundings, e.g., moving caterpillar on a leaf or even under a magnifying glass (see SM).
|
| 125 |
+
|
| 126 |
+
Table 2: Baseline Comparisons: Our method achieves better temporal consistency than $\mathrm { P n P }$ and Tune-a-Video (TaVid). Moreover, Dreamix is successful at motion editing while other methods cannot. This is reflected in the better quality (low LPIPS) and alignment (high CLIP Score). While the unconditional method seems to outperform Dreamix, it has poor fidelity as it is not conditioned on the input video
|
| 127 |
+
|
| 128 |
+
<table><tr><td>Metric</td><td>PnP TaVid Ours</td><td>Uncond.</td></tr><tr><td>LPIPS↓</td><td>0.209 0.145 0.112</td><td>0.101</td></tr><tr><td></td><td>CLIP Sc0re ↑ 0.304 0.303 0.317</td><td>0.320</td></tr><tr><td>Fidelity</td><td>See user study (Tab.1) for evaluation</td><td></td></tr></table>
|
| 129 |
+
|
| 130 |
+

|
| 131 |
+
Figure 7: Comparison to Baseline Methods for Motion Edits: Although the quality and alignment of unconditional generation are high, there is no resemblance to the original video (low fidelity). While $\mathrm { P n P }$ and Tune-a-Video preserve the scene, they fail to edit the motion according to the prompt (no waving) and suffer from poor temporal consistency (flickering). Our method is able to edit the motion according to the prompt while preserving the fidelity and generating a high quality video. Moreover, video-based methods (Uncond. and ours) exhibit motion blur, also present in real videos
|
| 132 |
+
|
| 133 |
+
# 6.2 BASELINE COMPARISONS
|
| 134 |
+
|
| 135 |
+
Baselines. We compare our method against three baselines: Unconditional. Directly mapping the text prompt to a video, without conditioning on the input video using a model similar to ImagenVideo. Plug-and-Play $( P n P )$ . Applying PnPTumanyan et al. (2022) on each video frame independently. Tune-a-Video (TaVid). Finetuning Tune-a-VideoWu et al. (2022) on the input video.
|
| 136 |
+
|
| 137 |
+
Data. We created a dataset of 29 videos taken from YouTube-8M Abu-El-Haija et al. (2016) and 127 text prompts, spanning different categories (see Appendix E).
|
| 138 |
+
|
| 139 |
+
Quantitative Comparison. We measure alignment by the frame-level CLIP Score Hessel et al. (2021) and quality (stability) with LPIPS Zhang et al. (2018) between consecutive frames. As automatic metrics do not measure fidelity and are imperfectly aligned with human judgement, we also conduct a user study. A panel of 20 evaluators rated each video/prompt pair on a scale of $1 - 5$ to evaluate its quality, fidelity and alignment. When visually inspecting the results we discover that videos that received a score lower than 2.5 in any of the dimensions are usually clear failure cases. Therefore we also report the percentage of items where all dimensions are larger than 2.5 (i.e. “Success“). See Appendix F.2 for additional details on the evaluation protocol.
|
| 140 |
+
|
| 141 |
+
Table 3: Ablation Study: Left: Users were asked to compare text-guided video edits of with (w/ Ft) and without (w/o Ft) finetuning. “None“ indicates failure of both methods according to user. Apart from style-based edits, where high fidelity is not needed, finetuning significantly improves the results. Right: Users were asked to compare video finetuning (Vid) with mixed video-image finetuning (Mix). Mixed finetuning significantly improves the results for most cases
|
| 142 |
+
|
| 143 |
+
<table><tr><td>Tyie</td><td>difs w/o Ft. w/Ft. None</td><td></td><td></td><td>Vid Mix</td></tr><tr><td>Motion</td><td>36</td><td>17% 72%</td><td>11%</td><td>35% 65%</td></tr><tr><td>Object</td><td>44</td><td>36% 48%</td><td>16%</td><td>62% 38%</td></tr><tr><td>Background</td><td>32</td><td>19% 77%</td><td>9%</td><td>36% 64%</td></tr><tr><td>Style</td><td>15</td><td>67% 27%</td><td>6%</td><td>26% 74%</td></tr></table>
|
| 144 |
+
|
| 145 |
+
The evaluation and user study are presented in Tab. 2 and Tab. 1. Image-based methods (PnP, Tune-a-Video) exhibit impaired temporal consistency, resulting in low quality. Moreover, they are unable to perform motion edits, resulting in poor alignment and high fidelity. Video-based methods maintain temporal consistency while allowing motion editing. Although unconditional generation outperforms our method in the automatic evaluations (Tab. 2), it has poor fidelity (Tab. 1) as it is not conditioned on the input video. Overall, our method has the highest success rate.
|
| 146 |
+
|
| 147 |
+
Qualitative Comparison. Figure 7 presents an example of motion editing by Dreamix compared to the baselines. The text-to-video model achieves low fidelity edits as it is not conditioned on the original video. PnP preserves the scene but fails to perform the edit and lacks consistency between different frames. Tune-a-Video exhibits better temporal consistency but still fails to perform the motion edit. Dreamix performs well on all three objectives, adding the desired motion while preserving fidelity and high-quality.
|
| 148 |
+
|
| 149 |
+
# 6.3 ABLATION STUDY
|
| 150 |
+
|
| 151 |
+
We ablate the use of finetuning and the mixed video-image finetuning by performing a user study using the dataset described above. The ablation indeed supports the idea of using finetuning in cases where high-editability is required. We can see that Motion changes require high-editability and are thus improved by finetuning. Moreover, as the noising corrupts the video, preserving fine-details in background, color or texture edits requires finetuning. In contrast, denoising without finetuning worked well for style edits, where finetuning was often detrimental. This is expected as style edits are often conflicted with high fidelity preservation (e.g. changing the texture of an object means reducing fidelity). The ablation shows that in most cases mixed finetuning improves the results by a wide margin. Results are presented in Tab. 3, a visual ablation is found in Appendix F.2.
|
| 152 |
+
|
| 153 |
+
# 7 LIMITATIONS
|
| 154 |
+
|
| 155 |
+
While Dreamix is the first diffusion-based video method that can edit motion, it has limitations.
|
| 156 |
+
|
| 157 |
+
Computational Cost. VDMs are computationally expensive. Finetuning our model using 4 TPU v4 accelerators requires around 30 minutes per video. Once finetuned, sampling takes roughly 2 minutes on similar hardware. Speeding it up will allow Dreamix to be used for more applications.
|
| 158 |
+
|
| 159 |
+
Comparison to Image-based Methods. Dreamix uses VDMs while previous approaches used image-level methods. As VDMs are nascent and have lower resolution than image DMs, this presents an interesting trade-off. Dreamix has the ability to edit motion and has high temporal consistency, while previous methods e.g., PnP and Tune-a-Video, can have higher spatial resolution. Although Tune-a-Video can achieve high alignment for texture editing on videos with limited motion, it suffers from poor temporal consistency (see SM). This highlights the importance of using a VDM backbone that provides temporal consistency and enables motion editing.
|
| 160 |
+
|
| 161 |
+
# 8 CONCLUSION
|
| 162 |
+
|
| 163 |
+
We presented the first diffusion-based method that can edit motion in real-world videos. Our method can be applied to image animation and subject-driven video generation. Extensive experiments demonstrated the unprecedented capabilities of our method.
|
| 164 |
+
|
| 165 |
+
REFERENCES
|
| 166 |
+
Sami Abu-El-Haija, Nisarg Kothari, Joonseok Lee, Paul Natsev, George Toderici, Balakrishnan Varadarajan, and Sudheendra Vijayanarasimhan. Youtube- $. 8 \mathrm { m }$ : A large-scale video classification benchmark. arXiv preprint arXiv:1609.08675, 2016. 8, 15
|
| 167 |
+
Omri Avrahami, Ohad Fried, and Dani Lischinski. Blended latent diffusion. arXiv preprint arXiv:2206.02779, 2022a. 3
|
| 168 |
+
Omri Avrahami, Thomas Hayes, Oran Gafni, Sonal Gupta, Yaniv Taigman, Devi Parikh, Dani Lischinski, Ohad Fried, and Xi Yin. Spatext: Spatio-textual representation for controllable image generation. arXiv preprint arXiv:2211.14305, 2022b. 1, 2
|
| 169 |
+
Omri Avrahami, Dani Lischinski, and Ohad Fried. Blended diffusion for text-driven editing of natural images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18208–18218, 2022c. 3
|
| 170 |
+
Omer Bar-Tal, Dolev Ofri-Amar, Rafail Fridman, Yoni Kasten, and Tali Dekel. Text2live: Textdriven layered image and video editing. In Computer Vision–ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23–27, 2022, Proceedings, Part XV, pp. 707–723. Springer, 2022. 3
|
| 171 |
+
David Bau, Hendrik Strobelt, William Peebles, Jonas Wulff, Bolei Zhou, Jun-Yan Zhu, and Antonio Torralba. Semantic photo manipulation with a generative image prior. arXiv preprint arXiv:2005.07727, 2020. 3
|
| 172 |
+
Tim Brooks, Aleksander Holynski, and Alexei A Efros. Instructpix2pix: Learning to follow image editing instructions. arXiv preprint arXiv:2211.09800, 2022. 1, 3
|
| 173 |
+
Huiwen Chang, Han Zhang, Lu Jiang, Ce Liu, and William T Freeman. Maskgit: Masked generative image transformer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11315–11325, 2022. 1
|
| 174 |
+
Huiwen Chang, Han Zhang, Jarred Barber, AJ Maschinot, Jose Lezama, Lu Jiang, Ming-Hsuan Yang, Kevin Murphy, William T Freeman, Michael Rubinstein, et al. Muse: Text-to-image generation via masked generative transformers. arXiv preprint arXiv:2301.00704, 2023. 1
|
| 175 |
+
Hyungjin Chung, Byeongsu Sim, and Jong Chul Ye. Come-closer-diffuse-faster: Accelerating conditional diffusion models for inverse problems through stochastic contraction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12413–12422, 2022. 2
|
| 176 |
+
Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems, 34:8780–8794, 2021. 2
|
| 177 |
+
Rinon Gal, Or Patashnik, Haggai Maron, Gal Chechik, and Daniel Cohen-Or. Stylegan-nada: Clipguided domain adaptation of image generators. arXiv preprint arXiv:2108.00946, 2021. 3
|
| 178 |
+
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 preprint arXiv:2208.01618, 2022. 3
|
| 179 |
+
Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. Communications of the ACM, 63(11):139–144, 2020. 2
|
| 180 |
+
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. 1, 2, 3
|
| 181 |
+
Jack Hessel, Ari Holtzman, Maxwell Forbes, Ronan Le Bras, and Yejin Choi. Clipscore: A reference-free evaluation metric for image captioning. arXiv preprint arXiv:2104.08718, 2021. 8, 17
|
| 182 |
+
|
| 183 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020. 1, 2
|
| 184 |
+
|
| 185 |
+
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. 1, 2, 4, 5, 14, 15
|
| 186 |
+
Jonathan Ho, Chitwan Saharia, William Chan, David J Fleet, Mohammad Norouzi, and Tim Salimans. Cascaded diffusion models for high fidelity image generation. J. Mach. Learn. Res., 23: 47–1, 2022b. 2
|
| 187 |
+
Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J Fleet. Video diffusion models. arXiv preprint arXiv:2204.03458, 2022c. 1, 2, 5
|
| 188 |
+
Eliahu Horwitz and Yedid Hoshen. Conffusion: Confidence intervals for diffusion models. arXiv preprint arXiv:2211.09795, 2022. 2
|
| 189 |
+
Aapo Hyvarinen and Peter Dayan. Estimation of non-normalized statistical models by score match-¨ ing. Journal of Machine Learning Research, 6(4), 2005. 2
|
| 190 |
+
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, 38 (4), 2019. 3
|
| 191 |
+
Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusionbased generative models. arXiv preprint arXiv:2206.00364, 2022. 2, 3
|
| 192 |
+
Yoni Kasten, Dolev Ofri, Oliver Wang, and Tali Dekel. Layered neural atlases for consistent video editing. ACM Transactions on Graphics (TOG), 40(6):1–12, 2021. 3
|
| 193 |
+
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. arXiv preprint arXiv:2210.09276, 2022. 1, 3
|
| 194 |
+
Feng-Lin Liu, Shu-Yu Chen, Yu-Kun Lai, Chunpeng Li, Yue-Ren Jiang, Hongbo Fu, and Lin Gao. DeepFaceVideoEditing: Sketch-based deep editing of face videos. ACM Transactions on Graphics, 41(4):167:1–167:16, 2022. 3
|
| 195 |
+
Andreas Lugmayr, Martin Danelljan, Andres Romero, Fisher Yu, Radu Timofte, and Luc Van Gool. Repaint: Inpainting using denoising diffusion probabilistic models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11461–11471, 2022. 2
|
| 196 |
+
Chenlin Meng, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. Sdedit: Image synthesis and editing with stochastic differential equations. arXiv preprint arXiv:2108.01073, 2021. 2, 3, 4
|
| 197 |
+
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. 3
|
| 198 |
+
Charlie Nash, Joao Carreira, Jacob Walker, Iain Barr, Andrew Jaegle, Mateusz Malinowski, and ˜ Peter Battaglia. Transframer: Arbitrary frame prediction with generative models. arXiv preprint arXiv:2203.09494, 2022. 3
|
| 199 |
+
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. 1
|
| 200 |
+
Taesung Park, Ming-Yu Liu, Ting-Chun Wang, and Jun-Yan Zhu. Semantic image synthesis with spatially-adaptive normalization. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 2337–2346, 2019. 3
|
| 201 |
+
Or Patashnik, Zongze Wu, Eli Shechtman, Daniel Cohen-Or, and Dani Lischinski. Styleclip: Textdriven manipulation of stylegan imagery. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 2085–2094, 2021. 3
|
| 202 |
+
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. 1, 17
|
| 203 |
+
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, 21(1):5485–5551, 2020. 14
|
| 204 |
+
Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022. 1, 2
|
| 205 |
+
Daniel Roich, Ron Mokady, Amit H Bermano, and Daniel Cohen-Or. Pivotal tuning for latent-based editing of real images. ACM Transactions on Graphics (TOG), 42(1):1–13, 2022. 3
|
| 206 |
+
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. 1, 2
|
| 207 |
+
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. 2022. 2, 3, 5, 6
|
| 208 |
+
Chitwan Saharia, William Chan, Huiwen Chang, Chris Lee, Jonathan Ho, Tim Salimans, David Fleet, and Mohammad Norouzi. Palette: Image-to-image diffusion models. In ACM SIGGRAPH 2022 Conference Proceedings, pp. 1–10, 2022a. 2
|
| 209 |
+
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-to-image diffusion models with deep language understanding. arXiv preprint arXiv:2205.11487, 2022b. 1, 2
|
| 210 |
+
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, 2022c. 2
|
| 211 |
+
Uriel Singer, Adam Polyak, Thomas Hayes, Xi Yin, Jie An, Songyang Zhang, Qiyuan Hu, Harry Yang, Oron Ashual, Oran Gafni, et al. Make-a-video: Text-to-video generation without text-video data. arXiv preprint arXiv:2209.14792, 2022. 1, 2, 7
|
| 212 |
+
Ivan Skorokhodov, Sergey Tulyakov, and Mohamed Elhoseiny. Stylegan-v: A continuous video generator with the price, image quality and perks of stylegan2. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3626–3636, 2022. 3
|
| 213 |
+
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. 2
|
| 214 |
+
Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020. 2
|
| 215 |
+
Narek Tumanyan, Michal Geyer, Shai Bagon, and Tali Dekel. Plug-and-play diffusion features for text-driven image-to-image translation. arXiv preprint arXiv:2211.12572, 2022. 1, 3, 8
|
| 216 |
+
Rotem Tzaban, Ron Mokady, Rinon Gal, Amit Bermano, and Daniel Cohen-Or. Stitch it in time: Gan-based facial editing of real videos. In SIGGRAPH Asia 2022 Conference Papers, pp. 1–9, 2022. 3
|
| 217 |
+
Dani Valevski, Matan Kalman, Yossi Matias, and Yaniv Leviathan. Unitune: Text-driven image editing by fine tuning an image generation model on a single image. arXiv preprint arXiv:2210.09477, 2022. 1, 2, 3
|
| 218 |
+
Ruben Villegas, Mohammad Babaeizadeh, Pieter-Jan Kindermans, Hernan Moraldo, Han Zhang, Mohammad Taghi Saffar, Santiago Castro, Julius Kunze, and Dumitru Erhan. Phenaki: Variable length video generation from open domain textual description. arXiv preprint arXiv:2210.02399, 2022. 3
|
| 219 |
+
Pascal Vincent. A connection between score matching and denoising autoencoders. Neural computation, 23(7):1661–1674, 2011. 2
|
| 220 |
+
Yael Vinker, Eliahu Horwitz, Nir Zabari, and Yedid Hoshen. Image shape manipulation from a single augmented training sample. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 13769–13778, October 2021. 3
|
| 221 |
+
Andrey Voynov, Kfir Aberman, and Daniel Cohen-Or. Sketch-guided text-to-image diffusion models. arXiv preprint arXiv:2211.13752, 2022. 3
|
| 222 |
+
Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Guilin Liu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Video-to-video synthesis. arXiv preprint arXiv:1808.06601, 2018a. 3
|
| 223 |
+
Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Highresolution image synthesis and semantic manipulation with conditional gans. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8798–8807, 2018b. 3
|
| 224 |
+
Jay Zhangjie Wu, Yixiao Ge, Xintao Wang, 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. 3, 8
|
| 225 |
+
Yiran Xu, Badour AlBahar, and Jia-Bin Huang. Temporally consistent semantic video editing. In Computer Vision–ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23–27, 2022, Proceedings, Part XV, pp. 357–374. Springer, 2022. 3
|
| 226 |
+
Xu Yao, Alasdair Newson, Yann Gousseau, and Pierre Hellier. A latent transformer for disentangled face editing in images and videos. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 13789–13798, 2021. 3
|
| 227 |
+
Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, et al. Scaling autoregressive models for contentrich text-to-image generation. arXiv preprint arXiv:2206.10789, 2022a. 1
|
| 228 |
+
Lijun Yu, Yong Cheng, Kihyuk Sohn, Jose Lezama, Han Zhang, Huiwen Chang, Alexander G ´ Hauptmann, Ming-Hsuan Yang, Yuan Hao, Irfan Essa, et al. Magvit: Masked generative video transformer. arXiv preprint arXiv:2212.05199, 2022b. 1, 3, 7
|
| 229 |
+
Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 586–595, 2018. 8, 17
|
| 230 |
+
|
| 231 |
+
# A ATTACHED VIDEOS
|
| 232 |
+
|
| 233 |
+
In addition to this appendix, we include a number of videos, we highly encourage the reviewer to view them. The included videos are:
|
| 234 |
+
|
| 235 |
+
1. “1 dreamix overview video.mp4“ - An overview video of our method with audio narration.
|
| 236 |
+
2. “2 dreamix video editing examples.mp4“ - A number of video editing examples generated by our method (Dreamix).
|
| 237 |
+
3. “3 dreamix image2video examples.mp4“ - A number of image-to-video examples generated by our method (Dreamix).
|
| 238 |
+
4. “4 dreamix subject driven video generation examples.mp4“ - A number of subject-driven video generation examples generated by our method (Dreamix).
|
| 239 |
+
5. “5 dreamix baseline comparisons.mp4“ - A number of videos comparing our method (Dreamix) to the other baselines.
|
| 240 |
+
|
| 241 |
+
Note: to match the conference requirement of maximum 100MB for the supplementary, all the videos are compressed, the uncompressed versions will be released in the final revision.
|
| 242 |
+
|
| 243 |
+
# B SOCIAL IMPACT
|
| 244 |
+
|
| 245 |
+
Our primary aim in this work is to advance research on tools to enable users to animate their personal content. While the development of end-user applications is out of the scope of this work, we recognize both the opportunities and risks that may follow from our contributions. As discussed above, we anticipate multiple possible applications for this work that have the potential to augment and extend creative practices. The personalized component of our approach brings particular promise as it will enable users to better align content with their intent, despite potential biases present in general VDMs. On the other hand, our method carries similar risks as other highly capable media generation approaches. Malicious parties may try to use edited videos to mis-lead viewers or to engage in targeted harassment. Future research must continue investigating these concerns.
|
| 246 |
+
|
| 247 |
+
# C IMPLEMENTATION DETAILS
|
| 248 |
+
|
| 249 |
+
# C.1 ARCHITECTURE
|
| 250 |
+
|
| 251 |
+
All of our experiments were preformed on a VDM that is similar to Imagen-Video Ho et al. (2022a), a pertrained cascaded text-to-video diffusion model, with the following components:
|
| 252 |
+
|
| 253 |
+
1. A T5-XXLRaffel et al. (2020) text encoder, that computes embeddings from the textual prompt. This embeddings are then used as conditioning by all other models.
|
| 254 |
+
2. A base video diffusion model, conditioned on text. It generates videos at $1 6 \times 2 4 \times 4 0 \times 3$ resolution (frames $X$ height $X$ width $X$ channels) at 3 fps.
|
| 255 |
+
3. 6 super-resolution video diffusion models, each conditioned on the text and the output video of the previous model. Each model is either spatial (SSR), i.e. upscales resolution, or temporal (TSR), i.e. fills in intermediate frames between the input frames. The order of super resolution models is TSR $( 2 \mathbf { x } )$ , SSR $( 2 \mathbf { x } )$ , SSR(4x), TSR $( 2 \mathbf { x } )$ , TSR $( 2 \mathbf { x } )$ , and SSR(4x). The multiplier in the parenthesis for output frames (for TSR), and for output pixels in height and width (for SSR). The final output video is in $1 2 8 \times 7 6 8 \times 1 2 8 0 \times 3$ at 24 fps.
|
| 256 |
+
|
| 257 |
+
Note that the diffusion models are pretrained on both videos and images, with frozen temporal attention and convolution for the latter. Our mixed finetuning approach treats video frames as if they were images.
|
| 258 |
+
|
| 259 |
+
Distillation. For some of these models, we use a distilled version to allow for faster sampling times. The base model is a distilled model with 64 sampling steps. The first two SSR models are nondistilled models with 128 sampling steps (due to finetuning considerations, see below). All other SR models use 8 sampling steps. All models use classifier-free-guidance weight of 1.0 (meaning that classifier free guidance is turned off).
|
| 260 |
+
|
| 261 |
+
# C.2 FINETUNING
|
| 262 |
+
|
| 263 |
+
To reduce finetuning time, we only finetune the base model and the first 2 SSR models. In our experiments, finetuning the first 2 SSR models using the distilled models (with 8 sampling steps) did not yield good quality. We therefore use the non-distilled versions of these models for all experiments (including non-finetuned experiments). When using “Mixed Video-Image Finetuning“ we use $\alpha = 0 . 3 5$ , and finetune for 300 steps. For all our experiments we use a learning rate of $6 \cdot \mathrm { { 1 0 ^ { - 6 } } }$ .
|
| 264 |
+
|
| 265 |
+
# C.3 SAMPLING
|
| 266 |
+
|
| 267 |
+
We use a DDIM sampler with stochastic noise correction, following Ho et al. (2022a). For the last highest resolution SSR, for capacity reasons, we use the model to sample a sub-chunks of 32 frames of the input lower resolution videos, and then we concatenate all the outputs together back to 128 frame videos.
|
| 268 |
+
|
| 269 |
+
# D IMAGE-TO-VIDEO TRANSFORMATIONS
|
| 270 |
+
|
| 271 |
+
We only use perspective transformations to create “cinematic” effects, e.g., panning, zooming, and camera shake. In our supplementary, we included Image-to-Video examples with different perspective transformations applied to them. We detail these transformations in Tab. 4. Some of the examples did not use the perspective transformations at all. Also, ensuring the smoothness of the transformed sequence is unnecessary as this is fixed by the diffusion and super-resolution processes.
|
| 272 |
+
|
| 273 |
+
Table 4: Perspective Transformations
|
| 274 |
+
|
| 275 |
+
<table><tr><td>Video</td><td>Timestamp Transformation</td><td></td><td>Effect</td></tr><tr><td>Plant</td><td>00:00</td><td>Translate</td><td>Pan</td></tr><tr><td>Turtle</td><td>00:11</td><td>Rand. translate</td><td>Shake</td></tr><tr><td>Coffee</td><td>00:22</td><td>Translate</td><td>Pan</td></tr><tr><td>Camel</td><td>00:33</td><td>None</td><td>None</td></tr><tr><td>Volcano</td><td>00:43</td><td>Rand. translate</td><td>Shake</td></tr><tr><td>Bear</td><td>00:54</td><td>Perspective</td><td>Pan</td></tr><tr><td>Penguins</td><td>01:05</td><td>None</td><td>None</td></tr><tr><td>Unicorn</td><td>01:15</td><td>Scale</td><td>Zoom out</td></tr><tr><td>Buffalo</td><td>01:26</td><td>Scale</td><td>Zoom out</td></tr><tr><td>Bigfoot</td><td>01:37</td><td>Translate</td><td>Pan</td></tr></table>
|
| 276 |
+
|
| 277 |
+
# E EVALUATION DATASET
|
| 278 |
+
|
| 279 |
+
In all evaluations described in the paper, we used a dataset of 29 videos with 127 edit prompts. The dataset videos were selected from YouTube-8M Abu-El-Haija et al. (2016) and show animals, people performing actions, vehicles, and other objects. The edit prompt categories are motion, object, background, and style. In the motion category the prompts perform motion editing (e.g. adding motion with the prompt “An orangutan next to a pond waving both arms in the air”), the object category performs object level edits (e.g. adding a party hat with the prompt “A puppy walking with a party hat”), the background category performs edits of the background (e.g. adding a river with the prompt “A blue pickup truck crossing a deep river”), and the style category performs style-transfer like edits (e.g. changing the style to cartoon with the prompt “A cartoon of a man playing a saxophone”).
|
| 280 |
+
|
| 281 |
+
# F HUMAN EVALUATION DETAILS
|
| 282 |
+
|
| 283 |
+
We performed human evaluations for the baseline comparison and the ablation analysis. The evaluations were conducted by a panel of 20 human raters using the dataset described in ??. The video
|
| 284 |
+
|
| 285 |
+
resolution shown to raters was $3 5 0 \times 2 0 0$ , except for tune-a-video where we used a resolution of $2 0 0 \times 2 0 0$ (because we observed it performs better with square outputs).
|
| 286 |
+
|
| 287 |
+
# F.1 ABLATION STUDY
|
| 288 |
+
|
| 289 |
+
In the ablation study the raters were asked to select the best edited video out of 12 hyperparameter combinations:
|
| 290 |
+
|
| 291 |
+
• no finetuning, with $s \in { 0 . 4 , 0 . 7 , 0 . 8 , 0 . 8 5 }$
|
| 292 |
+
• video finetuning for 64 steps, with $s \in { 0 . 8 , 0 . 9 , 0 . 9 5 , 0 . 9 8 }$
|
| 293 |
+
• mixed finetuning, with $( f t _ { s t e p s } , s ) \in ( 1 5 0 , 0 . 9 8 ) , ( 2 0 0 , 0 . 9 8 ) , ( 2 0 0 , 1 . 0 ) , ( 3 0 0 , 1 . 0 )$
|
| 294 |
+
|
| 295 |
+
A visual example of the tradeoff between the amount of noise and the amount of finetuning is shown in Fig. 8.
|
| 296 |
+
|
| 297 |
+

|
| 298 |
+
Figure 8: Noise-Finetuning Tradeoffs: We compare the effect of noise magnitude and number of finetuning iterations on edited videos. The original frame is on the bottom left, the rest were generated by different parameters for the prompt ”An orangutan with orange hair bathing in a bathroom”. We can observe that higher noise allows for larger edits but reduces fidelity. More finetuning iterations improve fidelity at higher noises. The best results are obtained for high noise and a large number of finetuning iterations
|
| 299 |
+
|
| 300 |
+
# F.2 BASELINE COMPARISON
|
| 301 |
+
|
| 302 |
+
In the baseline comparisons described in the paper, raters evaluated videos on quality, fidelity and alignment. The raters saw the original video alongside an edited video and answered the following questions on a scale of $1 - 5$ :
|
| 303 |
+
|
| 304 |
+
1. “Rate the overall visual quality and smoothness of the edited video.”
|
| 305 |
+
2. “How well does the edited video match the textual edit description provided?”
|
| 306 |
+
3. “How well does the edited video preserve unedited details of the original video?”
|
| 307 |
+
|
| 308 |
+
# F.3 DIRECT COMPARISON
|
| 309 |
+
|
| 310 |
+
We also conducted a direct comparisons between the different editing methods. In this comparison raters saw the videos simultaneously and selected the best edit. We conducted the comparison once with a fixed set of hyperparameters for Dreamix, and once more showing a single Dreamix video chosen among 12 hyperparameters sets. Results can be seen in Tab. 5.
|
| 311 |
+
|
| 312 |
+
Table 5: Direct comparison of editing methods: Users were shown editing results of different editing methods were asked to pick the best one. In the ”Multiple HP” column, the Dreamix video was chosen from a set of 12 hyperparameters. We show the number of times each method got a majority vote (out of 5 ratings)
|
| 313 |
+
|
| 314 |
+
<table><tr><td>Method</td><td></td><td>Single HP Multiple HP</td></tr><tr><td>Plug-and-Play</td><td>2%</td><td>1%</td></tr><tr><td>Tune-a-Video</td><td>6%</td><td>6%</td></tr><tr><td>Ours</td><td>34%</td><td>77%</td></tr><tr><td>No good edit / Uncond.</td><td>58%</td><td>16%</td></tr></table>
|
| 315 |
+
|
| 316 |
+
# G QUANTITATIVE EVALUATION
|
| 317 |
+
|
| 318 |
+
In the quantitative baseline comparison described in the paper we reported alignment and quality. We measure alignment by the frame-level CLIP Score Hessel et al. (2021). That is, we compute the cosine similarity between the CLIP Radford et al. (2021) embedding and the CLIP text embedding for each frame. For each video we take the average over all frames, finally we report the mean over all the videos. For quality (stability) we compute the LPIPS Zhang et al. (2018) distance between all pairs of consecutive frames. For each video we take the average over all pairs of consecutive frames, finally we report the mean over all the videos. To perform a fair comparison with Tune-a-Video (which outputs videos of 24 frames at 5 fps) we subsampled the rest of the methods to match this framerate. Additionally, before passing through CLIP and LPIPS, all the frames are preprocessed to match the required format (i.e. resize to 224, center crop to 224, ImageNet normalization).
|
| 319 |
+
|
| 320 |
+
# H IMAGE ATTRIBUTION
|
| 321 |
+
|
| 322 |
+
• Desert - https://unsplash.com/photos/PP8Escz15d8
|
| 323 |
+
• Fuji mountain https://unsplash.com/photos/9Qwbfa_RM94
|
| 324 |
+
• Tree in snow - https://unsplash.com/photos/aQNy0za7x0k
|
| 325 |
+
• Hut in snow - https://unsplash.com/photos/qV2p17GHKbs
|
| 326 |
+
• Lake with trees - https://unsplash.com/photos/dIQlgwq6V3Y
|
| 327 |
+
• Plant - https://unsplash.com/photos/LrPKL7jOldI
|
| 328 |
+
• Turtle - https://unsplash.com/photos/za9MCg787eI
|
| 329 |
+
• Yosemite - https://unsplash.com/photos/NRQV-hBF10M
|
| 330 |
+
• Foggy forest - https://unsplash.com/photos/pKNqyx_v62s
|
| 331 |
+
• Coffee - https://unsplash.com/photos/SMPe5xfbPT0
|
| 332 |
+
• Monkey - https://www.pexels.com/video/a-brown-monkey-eating-bread-2436088/
|
| 333 |
+
|
| 334 |
+
# I ADDITIONAL RESULTS
|
| 335 |
+
|
| 336 |
+
Below we present additional results of our method, for the best experience see the included videos.
|
| 337 |
+
|
| 338 |
+

|
| 339 |
+
Figure 9: Additional Video Editing Results (1/5)
|
| 340 |
+
|
| 341 |
+

|
| 342 |
+
Figure 10: Additional Video Editing Examples (2/5)
|
| 343 |
+
|
| 344 |
+

|
| 345 |
+
Figure 11: Additional Video Editing Examples (3/5)
|
| 346 |
+
|
| 347 |
+

|
| 348 |
+
Figure 12: Additional Video Editing Examples (4/5)
|
| 349 |
+
|
| 350 |
+

|
| 351 |
+
Figure 13: Additional Video Editing Examples (5/5)
|
| 352 |
+
|
| 353 |
+

|
| 354 |
+
Figure 14: Additional Image-to-Video Examples
|
| 355 |
+
|
| 356 |
+

|
| 357 |
+
“A bear is drinking from a glass”
|
| 358 |
+
Figure 15: Additional Subject-Driven Video Generation
|
md/test/8s8K2UZGTZ/8s8K2UZGTZ.md
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Teaching models to express their uncertainty in words
|
| 2 |
+
|
| 3 |
+
Stephanie Lin University of Oxford
|
| 4 |
+
|
| 5 |
+
sylin07@gmail.com
|
| 6 |
+
|
| 7 |
+
Jacob Hilton OpenAI
|
| 8 |
+
|
| 9 |
+
jhilton@openai.com
|
| 10 |
+
|
| 11 |
+
Owain Evans University of Oxford
|
| 12 |
+
|
| 13 |
+
owaine@gmail.com
|
| 14 |
+
|
| 15 |
+
Reviewed on OpenReview: https: // openreview. net/ forum? id= 8s8K2UZGTZ
|
| 16 |
+
|
| 17 |
+
# Abstract
|
| 18 |
+
|
| 19 |
+
We show that a GPT-3 model can learn to express uncertainty about answers using natural language – without use of model logits. When given a question, the model generates both an answer and a level of confidence (e.g. “ $9 0 \%$ confidence” or “high confidence”). These levels map to probabilities that are well calibrated. The model also remains moderately calibrated under distribution shift, and is sensitive to uncertainty in its own answers, rather than imitating human examples.
|
| 20 |
+
|
| 21 |
+
For testing calibration, we introduce the CalibratedMath suite of tasks. We compare the calibration of uncertainty expressed in words (“verbalized probability”) to uncertainty extracted from model logits. Both kinds of uncertainty are capable of generalizing calibration under distribution shift. We also provide evidence that GPT-3’s ability to generalize calibration depends on pre-trained latent representations that correlate with epistemic uncertainty over its answers.
|
| 22 |
+
|
| 23 |
+
# 1 Introduction
|
| 24 |
+
|
| 25 |
+
Current state-of-the-art language models perform well on a wide range of challenging question-answering tasks (Brown et al., 2020; Chowdhery et al., 2022; Hoffmann et al., 2022). They can even outperform the average human on the MMLU benchmark (which consists of exam-like questions across 57 categories) and on BIG-Bench (which consists of $1 5 0 +$ diverse tasks). Yet when models generate long-form text, they often produce false statements or “hallucinations” (Lin et al., 2021; Maynez et al., 2020; Shuster et al., 2021). This reduces their value to human users, as users cannot tell when a model is being truthful or not.
|
| 26 |
+
|
| 27 |
+
The problem of truthfulness motivates calibration for language models (Nguyen & O’Connor, 2015). If models convey calibrated uncertainty about their statements, then users know how much to trust a given statement. This is important for current models (which often hallucinate falsehoods) but also for any model that makes statements where there is no known ground truth (e.g. open problems in science or mathematics, or economic forecasts as in Zou et al. (2022)).
|
| 28 |
+
|
| 29 |
+
Previous work on calibration focuses on the model log-probabilities or “logits” (Guo et al., 2017; Jiang et al., 2021). Yet the log-probabilities of models like GPT-3 represent uncertainty over tokens (ways of expressing a claim) and not epistemic uncertainty over claims themselves. If a claim can be paraphrased in many different ways, then each paraphrase may have a low log-probability.1 By contrast, when humans express uncertainty, this is epistemic uncertainty about the claim itself.2 In this paper, we take a step toward teaching models to
|
| 30 |
+
|
| 31 |
+

|
| 32 |
+
Figure 1: 2Illustration of verbalized probability and the CalibratedMath task. The prompt is in MSE for confidence = (1 − 0.5)bold and GPT-3’s output is in blue. GPT-3 is prompted with a question and outputs an answer (“3”) and ← Model is scored on calibration of confidence (not on whether answer is correct)a level of confidence in its answer (“Medium”). GPT-3 is scored on the calibration of its confidence (not on the accuracy of its answer). In this example, the answer is correct but the confidence is only “Medium”. Using our MSE metric (Section 2.3), this confidence would score $( 1 - 0 . 5 ) ^ { 2 } = 0 . 2 5$ .
|
| 33 |
+
|
| 34 |
+
The model is prompted with a question and outputs an answer (‘3’ in this case) and a express epistemic uncertainty using natural language. We call this “verbalized uncertainty” or “verbalized probability”.
|
| 35 |
+
|
| 36 |
+
the answer is correct, but the model’s confidence is only “Medium” (what translates to The goal of verbalized probability is to express uncertainty as part of a model’s natural language output a probability of 0.5) and so the MSE is 0.25.without directly mimicking human training data. Models should be calibrated about the likelihood that their own statements are correct, which differs from the uncertainty that a human might have when making a similar statement. For example, GPT-3 outperforms most humans on a computer security quiz (Hendrycks et al., 2020) but is much worse than humans at arithmetic questions of the form “ $2 \times 3 \times 7 =$ ?”. Thus, we expect pre-trained models will need to be finetuned to produce calibrated verbalized probability.
|
| 37 |
+
|
| 38 |
+
We focus on the simple case of verbalized uncertainty where the model outputs a probability or “confidence” as a single token (Fig. 1). This case is a step towards more sophisticated expression of uncertainty in natural language. Moreover, this case relates to methods that finetune model logits for calibration (Jiang et al., 2021), which we also investigate in this paper.
|
| 39 |
+
|
| 40 |
+
Training models in verbalized probability is a component of making models “honest” (Evans et al., 2021; Askell et al., 2021a; Christiano, 2021). We define a model as honest if it can communicate everything it represents internally in natural language (and will not misrepresent any internal states). Honesty helps with AI alignment: if an honest model has a misinformed or malign internal state, then it could communicate this state to humans who can act accordingly. Calibration is compatible with a certain kind of dishonesty, because a model could be calibrated by simply imitating a calibrated individual (without having the same “beliefs” as the individual). However, if GPT-3 achieves good calibration on diverse questions after finetuning as in Section 3.1, it seems unlikely that it dishonestly misrepresents its confidence.
|
| 41 |
+
|
| 42 |
+
# 1.1 Contributions
|
| 43 |
+
|
| 44 |
+
We introduce a new test suite for calibration. CalibratedMath is a suite of elementary mathematics problems. For each question, a model must produce both a numerical answer and a confidence in its answer (see Figure 1). There are many types of question, which vary substantially in content and in difficulty for GPT-3. This allows us to test how calibration generalizes under distribution shifts (by shifting the question type) and makes for a challenging test (see Figure 3). Since GPT-3’s math abilities differ greatly from humans, GPT-3 cannot simply imitate human expressions of uncertainty.
|
| 45 |
+
|
| 46 |
+
GPT-3 can learn to express calibrated uncertainty using words (“verbalized probability”). We finetune GPT-3 to produce verbalized probabilities. It achieves reasonable calibration both in- and out-of-distribution, outperforming a fairly strong baseline (Figure 5 and Table 1).
|
| 47 |
+
|
| 48 |
+
This calibration performance is not explained by learning to output logits. GPT-3 does not simply learn to output the uncertainty information contained in its logits (Section 3.4). We also show that certain superficial heuristics (e.g. the size of the integers in the arithmetic question) cannot explain the performance of verbalized probability.
|
| 49 |
+
|
| 50 |
+
<table><tr><td>pKind ity</td><td>Definition</td><td>Example</td><td>Supervised</td><td> Desrables</td></tr><tr><td>(nuverbalizedrd)</td><td>Express uncertainty</td><td>Q: What is 952 - 55?</td><td>Match</td><td>Handle multiple</td></tr><tr><td>Answer lgt</td><td></td><td>A: Wis</td><td>None</td><td>Requirsgo</td></tr><tr><td>Indirect logit</td><td>Logprob of ‘True'</td><td>Q: What is 952 - 55? rue/7ul</td><td>Cross-entropy goundtiut</td><td> Handles multiple</td></tr></table>
|
| 51 |
+
|
| 52 |
+
language and so could express continuous distributions. We compare verbalized probability to finetuning the model logits. We show how to finetune GPT-3 to express epistemic uncertainty via its model logits (see “Indirect logit” in Table 2) and find that this also generalizes calibration under distribution shift (Table 1).
|
| 53 |
+
|
| 54 |
+
# 2 Setup
|
| 55 |
+
|
| 56 |
+
# 2.1 Calibration and Three Kinds of Probability
|
| 57 |
+
|
| 58 |
+
We want to test the calibration of language models for uncertainty over their own answers to questions. The basic idea is that if a calibrated model assigns $9 0 \%$ to an answer, then the answer is correct $9 0 \%$ of the time. Formally, let $M$ be a model, $q$ be a question, $a _ { M }$ be the model’s answer, and $p _ { M } = \operatorname* { P r } ( a _ { M } | q )$ be the assigned probability that $a _ { M }$ is correct. Then these assigned probabilities are (perfectly) calibrated if:
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\mathrm { P r } ( a _ { M } | p _ { M } = p ) = p
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
for $p \in [ 0 , 1 ]$ (Guo et al., 2017). In this paper, we test calibration on different sets of questions to evaluate how well calibration generalizes under distribution shift (Ovadia et al., 2019).
|
| 65 |
+
|
| 66 |
+
We consider three sources for the probability $p _ { M }$ that the model’s answer is correct, as shown in Figure 2. Two of the kinds of probability (“answer logit” and “indirect logit”) are based on the log-probabilities that a language model assigns to tokens. Thus they cannot be used for models without a tractable likelihood on outputs (e.g. information retrieval models that call out to external resources). By contrast, verbalized probabilities apply to any model that outputs natural language. Moreover, verbalized probabilities mirror human expression of uncertainty. This allows models to respond to prompts from non-technical users (e.g. “How sure are you about what you just said?”, “I’ve told you my confidence on a scale from 1-5. Can you do the same?”). This also allows models to decide when and how to provide uncertainty information (depending on the human audience).
|
| 67 |
+
|
| 68 |
+
# 2.2 CalibratedMath
|
| 69 |
+
|
| 70 |
+
CalibratedMath is a test suite consisting of 21 arithmetic tasks, including addition, multiplication, rounding, arithmetic progressions, and finding remainders (see full details in Table 3). For each task, questions and answers are programmatically generated. The answers are always integers and for some tasks there are multiple correct answers (e.g. “Name any prime number below 208?”). The 21 tasks are further divided
|
| 71 |
+
|
| 72 |
+
Training: Add-subtract
|
| 73 |
+
|
| 74 |
+
Distribution shift
|
| 75 |
+
|
| 76 |
+
Evaluation: Multi-answer
|
| 77 |
+
|
| 78 |
+
<table><tr><td>Q: What is 952 - 55? A: 897 Confidence: 61%</td></tr><tr><td>Q: What comes next: 3, 12, 21, 30.. A:42 Confidence: 22%</td></tr><tr><td>Q: What is 6 + 5 + 7? A:17 Confidence: 36%</td></tr></table>
|
| 79 |
+
|
| 80 |
+
<table><tr><td>Q: Name any number smaller than 621? A:518 Confidence: _</td></tr><tr><td>Q: Name any prime number smaller than 56? A:7 Confidence: </td></tr><tr><td>Q: Name two numbers that sum to 76? A: 69 and 7 Confidence: </td></tr></table>
|
| 81 |
+
|
| 82 |
+
for GPT-3 to answer (but not necessarily easier in terms of calibration)into sub-tasks based on the number of digits in each operand and the number format. The sub-tasks vary in difficulty for GPT-3. For example, multiplication is harder than addition and gets more difficult as the number of digits is increased. The fact that some sub-tasks are predictably easier or harder for GPT-3 is crucial for a challenging test of calibration.
|
| 83 |
+
|
| 84 |
+
As in prior work on calibration in ML (Ovadia et al., 2019; Karandikar et al., 2021), we focus on how well calibration generalizes under distribution shift. Our main experiments use the “Add-subtract” training set (Figure 3). This consists of tasks in CalibratedMath that involve addition or subtraction and have a unique correct answer. The evaluation set (called “Multi-answer”) consists of questions with multiple correct answers that sometimes involve multiplication and division. There is a distribution shift between training and evaluation, with the following two aspects:
|
| 85 |
+
|
| 86 |
+
Shift in task difficulty: GPT-3 is more likely to answer questions in the evaluation set (Multianswer) correctly than the training set (Add-subtract). Median accuracy is $6 5 \%$ for Multi-answer and $2 1 \%$ for Add-subtract (for full details see Figure 8). Thus, to be well calibrated, the model should assign higher probabilities on average to answers in the evaluation set than the training set. This is essentially a shift in the “label distribution” from training to evaluation. (We expect language models other than GPT-3 to have a similar distribution shift for the same reason.) • Shift in content: The training and evaluation sets differ in the mathematical concepts they employ and whether or not there are multiple correct answers.
|
| 87 |
+
|
| 88 |
+
Though not shown in Figure 3, models trained on Add-subtract are also evaluated on a second evaluation set called “Multiply-divide”. Questions in Multiply-divide have unique correct answers but are more difficult than those in Add-subtract and include distinct concepts related to multiplication and division (Table 3).
|
| 89 |
+
|
| 90 |
+
# 2.3 Metrics
|
| 91 |
+
|
| 92 |
+
Our goal is to measure the model’s calibration when expressing uncertainty about its own zero-shot answers. In all our experiments, the model’s zero-shot answers are held fixed. The goal is not to improve the model’s
|
| 93 |
+
|
| 94 |
+
answers but instead to improve calibration in expressing uncertainty over these answers.3 Calibration is measured using two metrics:
|
| 95 |
+
|
| 96 |
+
Mean squared error (MSE). Following Section 2.1, for each question the model $M$ assigns a probability $p _ { M }$ to its own answer $a _ { M }$ being correct. The MSE compares $p _ { M }$ to the groundtruth of whether $a _ { M }$ is correct or not:
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
\mathbb { E } _ { q } [ ( p _ { M } - \mathbb { I } ( a _ { M } ) ) ^ { 2 } ]
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
Note that a model can be perfectly calibrated (per Equation 1) and not have a MSE of zero. The MSE combines calibration error with “sharpness” (Kuleshov $\&$ Liang, 2015), while the MAD (below) just measures the former. (The MSE is called the “Brier Score” in probabilistic forecasting.)
|
| 103 |
+
|
| 104 |
+
Mean absolute deviation calibration error (MAD). The MAD estimates how closely the model approximates Equation 1 based on a finite sample. Model probabilities are divided into $K$ bins with equal numbers of samples, so the bins have denser coverage where there are more samples (Nguyen $\&$ O’Connor, 2015). Within each bin $b _ { i }$ , we calculate the proportion of correct answers ( $\cdot \mathrm { a c c } ( b _ { i } ) ^ { \prime }$ or “accuracy”) and average probability assigned to answers in $b _ { i }$ ( $\cdot _ { \mathrm { c o n f } ( b _ { i } ) } ,$ or the “average confidence”). Then the MAD is given by:
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
{ \frac { 1 } { K } } \sum _ { i = 1 } ^ { K } | \mathrm { a c c } ( b _ { i } ) - \mathrm { c o n f } ( b _ { i } ) |
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
While this is not a proper scoring rule, it offers a simple numeric summary of the calibration curves shown in Section 3 (Hendrycks et al., 2018; Nixon et al., 2019).
|
| 111 |
+
|
| 112 |
+
# 3 Experiments
|
| 113 |
+
|
| 114 |
+
For our experiments, we used the 175-billion parameter GPT-3 model (“davinci”) via the OpenAI API (Brown et al., 2020). We tried out smaller models but their performance on arithmetic questions is too weak for CalibratedMath to be challenging.4
|
| 115 |
+
|
| 116 |
+
How can we finetune a pre-trained model to output calibrated verbalized probabilities? We finetune GPT-3 using supervised learning. This approach is less principled and flexible than using reinforcement learning (with rewards derived from a proper scoring rule). However, supervised learning was easier to implement using OpenAI’s API, and provides an interesting test of generalization outside the training distribution.
|
| 117 |
+
|
| 118 |
+
# 3.1 Supervised finetuning
|
| 119 |
+
|
| 120 |
+
To finetune GPT-3 to produce verbalized probabilities, we need a labeled training set. Each input is a question followed by GPT-3’s answer and the label is a (calibrated) confidence (see Figure 3). The basic intuition is that for questions GPT-3 is likely to get wrong, its confidence should be low. Thus, we use GPT-3’s empirical accuracy on each type of question as the label. We recognize that this approach can lead to suboptimal labels. For example, it might use a low-confidence label for $\mathbf { \nabla \cdot } 1 0 \times 1 0 = 1 0 0 \mathbf { \mathit { \Omega } } ^ { \mathrm { { : } } }$ because most two-digit multiplications are hard for GPT-3. But we will show that the approach works well enough for our purposes.
|
| 121 |
+
|
| 122 |
+
Formally, let $q$ be a question from sub-task $T$ . Let $a _ { M }$ be GPT-3’s answer to $q$ . We define $\hat { p } _ { T }$ associated with the input $\left( q , a _ { M } \right)$ to be GPT-3’s empirical accuracy on sub-task $T$ :
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
\hat { p } _ { T } = \mathbb { E } _ { q \in T } [ \mathbb { I } ( a _ { M } ) ]
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+

|
| 129 |
+
Figure 4: Calibration scores on the Multi-answer and Multiply-divide evaluation sets. The same results are shown in Table 1 below.
|
| 130 |
+
|
| 131 |
+
which we estimate using random samples generated from $T$ . The full training set is then constructed as follows. For each sub-task $T$ we randomly sample 100 questions and generate GPT-3’s zero-shot answers (using greedy decoding) for a total of $| T | \times 1 0 0 \approx 1 0 \mathrm { k }$ inputs. We then compute the $\hat { p } _ { T }$ for each $T$ and use it to construct the label for each sample from $T$ .
|
| 132 |
+
|
| 133 |
+
The label is a simple transformation of $\hat { p } _ { T }$ . For the “verbalized numbers” setup, the label is given by $\lfloor 1 0 0 * \hat { p } _ { T } \rfloor$ . In the “verbalized words” setup, we use a set of five words (e.g. “lowest”, “low”, “medium”, “high”, “highest”) to express the degree of confidence. We map $\hat { p } _ { T }$ to one of five words corresponding to probability intervals of width 0.2. Categories can then be mapped back to probability values by taking the midpoint of the corresponding interval. (We found that using meaningful words – such as “lowest” etc. – worked slightly less well than meaningless names. See Appendix B.1.)
|
| 134 |
+
|
| 135 |
+
# 3.1.1 Indirect logit and baselines
|
| 136 |
+
|
| 137 |
+
For the indirect logit (defined in Figure 2), we use the same random sample of 100 questions from each sub-task (along with GPT-3’s zero-shot answer). However, in this case the label for each individual questionanswer pair is the boolean True/False value indicating whether the model’s answer was correct, for which we have the groundtruth. Thus we can optimize the cross-entropy loss. Further details for the supervised finetuning setup are given in Appendix B.3.
|
| 138 |
+
|
| 139 |
+
We compare the two finetuned setups (verbalized probability and indirect logit) to the “zero-shot answer logit” (see Fig. 2). We also include a “constant baseline”. This baseline uses a constant probability on the evaluation set, where the value of the constant is the best-scoring value on the training set (in terms of MSE)5. Metrics are shown in Table 1 and Figure 4, while calibration curves are in Figure 5.
|
| 140 |
+
|
| 141 |
+
# 3.2 Results
|
| 142 |
+
|
| 143 |
+
Verbalized probability generalizes well to both eval sets. The main result is shown in Table 1 and Figures 4 and 5. After finetuning on the Add-subtract training set, verbalized probabilities generalize reasonably well to both the Multiply-divide and Multi-answer evaluation sets. So the model remains moderately calibrated under a substantial distribution shift. In terms of MSE, the model outperforms the two logit setups on Multi-answer and matches the constant baseline on Multiply-divide.6 We ran an additional experiment to probe generalization, where we flipped around the training set (training on Multiply-divide and evaluating on both Add-subtract and Multi-answer). Again, verbalized probability generalizes reasonably
|
| 144 |
+
|
| 145 |
+
Table 1: Calibration scores on evaluation sets. The finetuned setups were trained on the Add-subtract set. We test how well calibration generalizes under distribution shift. Scores are in percentage terms and lower is better. Note: the MSE is not for answers to questions but for the probability the answers are correct.
|
| 146 |
+
|
| 147 |
+

|
| 148 |
+
Figure 5: Calibration curves for training (left) and evaluation (center and right). Curves are generated using the same procedure as the MAD (Section 2.3). The probabilities for each question are divided into bins, and the y-value for a bin is the proportion of questions for which the answer was true (i.e. the model accuracy). The size of markers indicates the bin size. We see that the two logit setups are very underconfident on the Multi-answer evaluation, while all three setups are better calibrated on the Multiply-divide evaluation.
|
| 149 |
+
|
| 150 |
+
well and outperforms other setups on Multi-answer (see Appendix C.3). Finally, we find that verbalized probability performs similarly whether the model outputs tokens for words or numbers (see Appendix C.4).
|
| 151 |
+
|
| 152 |
+
Verbalized probability overfits to training. Calibration for verbalized probability is much better indistribution. The model is underconfident in its answers to Multi-answer because these answers are more likely to be correct than those for the Add-subtract training set.7
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
Figure 6: Calibration curves for few-shot learning (verbalized probability). Compares stochastic $k$ -shot for varying $k$ (using Expected Value decoding) to supervised finetuning (10k datapoints with greedy decoding) on the evaluation sets. 50-shot is almost as calibrated as the finetuned setup.
|
| 156 |
+
|
| 157 |
+
Indirect logit generalizes well to Multiply-divide. The indirect logit achieves impressive calibration on the Multiply-divide evaluation set, where it outperforms other models. However, it does worse than verbalized probability on the Multi-answer evaluation. This is likely because it is more difficult to avoid overfitting given our setup.8 Further work could explore how the indirect logit compares to verbalized probability with different training setups (e.g. a more diverse distribution on probabilities and questions).
|
| 158 |
+
|
| 159 |
+
# 3.3 Stochastic Few-shot
|
| 160 |
+
|
| 161 |
+
In order to learn more about how verbalized probability generalizes, we tested GPT-3’s calibration in a stochastic $k$ -shot setting, while varying $k$ from 1 to 50. We used the following procedure. For each question in the evaluation set, we randomly sample $k$ new examples from the Add-subtract training set and include them in the context.9 In order to generate verbalized probabilities, we do not use greedy decoding (as in the finetuning experiments) but instead find the weighted sum of the model’s top five tokens (where the weights are the model probabilities for the tokens). This “Expected Value decoding” is less in the spirit of verbalized probabilities, but gives us a sense of the model’s capabilities (see Appendix C.2). The resulting calibration curves are shown in Figure 6.
|
| 162 |
+
|
| 163 |
+
On both evaluation sets, GPT-3 starts out visibly uncalibrated, but begins to show improvement at $k = 2 5$ and above. At $k = 5 0$ , performance is already close to that of the finetuned models, which are trained on over 2.5k samples. One potential explanation is that GPT-3 already has latent representations for questions and answers that relate to calibrated confidence, and the few-shot examples allow it to locate the task (Reynolds & McDonell, 2021). We discuss this in the following section.
|
| 164 |
+
|
| 165 |
+
# 3.4 Explaining the performance of verbalized probability
|
| 166 |
+
|
| 167 |
+
We have shown that GPT-3 learns to express uncertainty in words and generalize calibration to new tasks. But what exactly has GPT-3 learned and would the learned features enable generalization beyond our experiments?
|
| 168 |
+
|
| 169 |
+
Does GPT-3 just learn to output the logits? One possibility is that the verbalized probability results are fully explained by GPT-3 learning to output information in its logits. However, we have already seen that verbalized probability generalizes better than the answer logit on the Multi-answer evaluation. Moreover, on the Multiply-divide evaluation, the correlation in performance between verbalized probability and answer logit across sub-tasks is only modest (see Appendix C.4). So GPT-3 must be using more than just the information in the logits.
|
| 170 |
+
|
| 171 |
+
Does GPT-3 just learn simple heuristics (e.g. low probability for questions with large integers)? Another possibility is that verbalized probability results are explained by GPT-3 learning simple heuristics for the difficulty of questions. For example, suppose GPT-3 simply learned to output lower probabilities for questions with larger integers (because they are more difficult). This would not lead to robust generalization, as some questions with small integers are difficult. We ran an experiment to test whether simple heuristics can generate calibrated probabilities. We trained a logistic regression model on the Add-subtract training set with the same target probabilities as in Section 3.1. The model has hand-crafted features that we know are predictive of difficulty for GPT-3: the number of digits of integers in the question, the operator (e.g. “ $^ +$ ” or “round to nearest 10”), and the number format (e.g. “1000” or “1,000”). This heuristic model performed worse than verbalized probability on both the Multi-answer and Multiply-divide evaluation sets (Table 2). So the results for verbalized probability cannot be fully explained by these heuristics.
|
| 172 |
+
|
| 173 |
+
Evidence that GPT-3 uses latent (pre-existing) features of questions. So what does explain GPT3’s ability to generalize calibration? There is tentative evidence that GPT-3 learns to use features of inputs that it already possessed before finetuning. We refer to these features as “latent” representations, because they are not “active” in pre-trained GPT-3 (which is poorly calibrated).
|
| 174 |
+
|
| 175 |
+
Via OpenAI’s Embeddings API (Neelakanta, 2022), we can extract an embedding for each question-answer pair in CalibratedMath using a GPT-3 model finetuned for semantic similarity. $^ { 1 0 }$ Figure 7 shows a (trained) projection of GPT-3’s embeddings into two dimensions on the Multiply-divide evaluation set, where we see that samples are already reasonably well separated into correct and incorrect classes. Since a linear 2D projection is able to uncover this structure, we view this as evidence that the embedding already encoded features that were relevant to calibration.
|
| 176 |
+
|
| 177 |
+
The “Linear probe” row in Table 2 explores this further by attaching a linear probe to GPT-3’s embeddings and predicting whether GPT-3’s embedded answer was correct or incorrect. While performance is worse than the finetuned verbalized model, the probe still exhibits generalization to the Multiply-divide evaluation set, again indicating that GPT-3 learned relevant features during pre-training that are now present in the embedding.
|
| 178 |
+
|
| 179 |
+
Finally, from Section 3.3, GPT-3 is able to generalize its calibration on both evaluation sets after seeing only $k = 5 0$ examples. Given the high number of tasks and difficulty levels in CalibratedMath, a context containing 50 examples can only cover a tiny fraction of the space of inputs. It would therefore be difficult to meta-learn new features that would generalize robustly to the evaluation sets.
|
| 180 |
+
|
| 181 |
+
# 4 Discussion
|
| 182 |
+
|
| 183 |
+
# 4.1 Directions for future work
|
| 184 |
+
|
| 185 |
+
Our results show that GPT-3 has some ability to generalize (verbalized) calibration under distribution shift. However, while our training and evaluation sets differed significantly in the label distribution, the content and format of questions did not shift much. Future work could test whether calibration generalizes to
|
| 186 |
+
|
| 187 |
+

|
| 188 |
+
Figure 7: Linear projection of GPT-3 embeddings into two dimensions with colors denoting true (green) or false (blue). Each point is the embedding of an input pair of form (question, GPT-3 answer) from the Multiply-divide evaluation set that has been projected into 2D. A point is green if the GPT-3 answer is correct and blue otherwise. We see the classes become better separated as training progresses and after 5 epochs they are reasonably well separated by a linear boundary.
|
| 189 |
+
|
| 190 |
+
Table 2: Calibration performance of alternative models. Verbalized probability outperforms simple heuristics, but the linear probe on pre-trained embedding model performs well.
|
| 191 |
+
|
| 192 |
+
<table><tr><td>Setup</td><td colspan="2">Multi-answer</td><td>Multiply-divide</td><td></td></tr><tr><td></td><td>MSE</td><td>MAD</td><td>MSE</td><td>MAD</td></tr><tr><td>Verbalized probability (finetune)</td><td>29.0</td><td>24.0</td><td>12.7</td><td>10.6</td></tr><tr><td>Log.reg.with heuristic features</td><td>29.7</td><td>31.2</td><td>17.7</td><td>18.5</td></tr><tr><td>Linear probe on GPT3 embedding</td><td>31.2</td><td>30.1</td><td>14.0</td><td>14.2</td></tr></table>
|
| 193 |
+
|
| 194 |
+
other subject areas (e.g. history or biology) and to other formats (e.g. chat, long-form question answering, forecasting).
|
| 195 |
+
|
| 196 |
+
Using models with the same capacity as GPT-3 but different architectures and pre-training would allow experiments into cross-model calibration. If a model with significantly different internal representations can give similarly calibrated uncertainties for GPT-3’s statements, this would raise questions about whether GPT-3 is actually expressing its own epistemic state. While we attempted this experiment using the 7Bparameter GPT-3 model, the difference in capacity (as observed in performance on arithmetic tasks) was a significant confounder. (For related experiments see Kadavath et al. (2022), which came out after this paper.)
|
| 197 |
+
|
| 198 |
+
# 5 Related work
|
| 199 |
+
|
| 200 |
+
Calibration in new domains. Prior work on calibration focuses primarily on the classification setting, where models output a probability distribution over the set of possible classes (Guo et al., 2017; Mukhoti et al., 2020; Minderer et al., 2021), corresponding to what we call the “answer logit”. To generalize calibration to a new target domain, methods often require samples from the target or from additional source domains (Gong et al., 2021; Csurka, 2017; Wang et al., 2021). We study how calibration generalizes when a pre-trained model is finetuned on a single source domain and must generalize zero-shot to a new domain.
|
| 201 |
+
|
| 202 |
+
Pre-trained language models. Hendrycks et al. (2020) analyze GPT-3’s behavior on a benchmark of tasks that vary in both subject matter and difficulty, showing that GPT-3’s calibration (for the answer logit) generalizes fairly poorly in both the zero-shot and few-shot settings. To improve the calibration of pre-trained language models, Desai & Durrett (2020) use label smoothing to reduce overconfidence on out-ofdomain data. Kong et al. (2020) introduce on- and off-manifold regularization to handle in-distribution and out-of-distribution calibration, respectively, but focus on OOD detection rather than generalization. Other work focuses on the closely related problem of teaching models to abstain from answering when a model has high uncertainty about its answer. Kamath et al. (2020) train an auxiliary “calibrator” to predict whether the primary model correctly answers any given question using a mix of in-domain and out-of-domain data. In cases where the calibrator predicts an error, the model can refuse to answer. Additional studies explore the use of manually crafted prompts that instruct models to defer or qualify their answers when uncertain (Askell et al., 2021b; Lin et al., 2021). These methods typically correct for models being overconfident on out-of-domain examples. In comparison, GPT-3’s accuracy on our target domain is much higher than its accuracy on the source domain; its predictions therefore tend to be underconfident. The shift between target and source is also much larger, where we move from a single-answer to a multi-answer setting.
|
| 203 |
+
|
| 204 |
+
Natural language generation. In the specific case of natural language generation, Jiang et al. (2021) study calibration by framing multiple-choice and extractive QA as generative tasks, where a language model’s uncertainty can be extracted from its logits over all tokens in an answer sequence. The authors introduce methods for both fine-tuning and post-hoc calibration of logits. To handle answers that can be worded in more than one way, a round-trip translation model is used to generate paraphrases for each answer, and the model’s uncertainty is calculated as its total probability across all such paraphrases. While this approach leads to better calibration, it adds additional overhead and doesn’t handle the situation where a question has multiple answers that can’t be exhaustively listed.
|
| 205 |
+
|
| 206 |
+
Verbalized uncertainty. Branwen (2020) demonstrates GPT-3’s ability to express verbalized uncertainty on simple trivia questions in the in-domain, few-shot setting, using an instructive prompt. Mielke et al. (2022) also study verbalized uncertainty (referred to as “linguistic confidence” or “verbalized metacognition”). Their setup differs from ours in that they train an external calibrator to predict whether a given language model’s answers are correct as a binary classification problem, and then use the calibration to guide the language model’s generations such that they express the appropriate level of confidence. In contrast, we use the same model to both return answers and to give verbalized confidences on a numerical scale.
|
| 207 |
+
|
| 208 |
+
# Acknowledgments
|
| 209 |
+
|
| 210 |
+
We thank William Saunders, Dan Hendrycks, Mark Xue, Jeff Wu, Paul Christiano, Daniel Ziegler, Collin Burns and Rai (Michael Pokorny) for helpful comments and discussions. We thank the anonymous reviewers at TMLR for detailed and constructive feedback.
|
| 211 |
+
|
| 212 |
+
# References
|
| 213 |
+
|
| 214 |
+
Amanda Askell, Yuntao Bai, Anna Chen, Dawn Drain, Deep Ganguli, Tom Henighan, Andy Jones, Nicholas Joseph, Ben Mann, Nova DasSarma, Nelson Elhage, Zac Hatfield-Dodds, Danny Hernandez, Jackson Kernion, Kamal Ndousse, Catherine Olsson, Dario Amodei, Tom Brown, Jack Clark, Sam McCandlish, Chris Olah, and Jared Kaplan. A general language assistant as a laboratory for alignment, 2021a.
|
| 215 |
+
Amanda Askell, Yuntao Bai, Anna Chen, Dawn Drain, Deep Ganguli, Tom Henighan, Andy Jones, Nicholas Joseph, Ben Mann, Nova DasSarma, Nelson Elhage, Zac Hatfield-Dodds, Danny Hernandez, Jackson Kernion, Kamal Ndousse, Catherine Olsson, Dario Amodei, Tom Brown, Jack Clark, Sam McCandlish, Chris Olah, and Jared Kaplan. A general language assistant as a laboratory for alignment, 2021b. URL https://arxiv.org/abs/2112.00861.
|
| 216 |
+
Gwern Branwen. Gpt-3 nonfiction - calibration, 2020. https://www.gwern.net/GPT-3-nonfiction# calibration, Last accessed on 2022-04-24.
|
| 217 |
+
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.
|
| 218 |
+
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.
|
| 219 |
+
Paul Christiano. ARC’s first technical report: Eliciting latent knowledge, 2021. https://www.alignmentforum.org/posts/qHCDysDnvhteW7kRd/ arc-s-first-technical-report-eliciting-latent-knowledge, Last accessed on 2022-04-30.
|
| 220 |
+
Gabriela Csurka. Domain adaptation for visual applications: A comprehensive survey, 2017. URL https: //arxiv.org/abs/1702.05374.
|
| 221 |
+
Shrey Desai and Greg Durrett. Calibration of pre-trained transformers. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 295–302, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.21. URL https://aclanthology.org/2020.emnlp-main.21.
|
| 222 |
+
Owain Evans, Owen Cotton-Barratt, Lukas Finnveden, Adam Bales, Avital Balwit, Peter Wills, Luca Righetti, and William Saunders. Truthful AI: Developing and governing AI that does not lie. arXiv preprint arXiv:2110.06674, 2021. URL https://arxiv.org/abs/2110.06674.
|
| 223 |
+
Yunye Gong, Xiao Lin, Yi Yao, Thomas G. Dietterich, Ajay Divakaran, and Melinda Gervasio. Confidence calibration for domain generalization under covariate shift. 2021. doi: 10.48550/ARXIV.2104.00742. URL https://arxiv.org/abs/2104.00742.
|
| 224 |
+
Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q. Weinberger. On calibration of modern neural networks, 2017.
|
| 225 |
+
Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. Deep anomaly detection with outlier exposure, 2018. URL https://arxiv.org/abs/1812.04606.
|
| 226 |
+
Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. arXiv preprint arXiv:2009.03300, 2020.
|
| 227 |
+
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.
|
| 228 |
+
Zhengbao Jiang, Jun Araki, Haibo Ding, and Graham Neubig. How Can We Know When Language Models Know? On the Calibration of Language Models for Question Answering. Transactions of the Association for Computational Linguistics, 9:962–977, 09 2021. ISSN 2307-387X. doi: 10.1162/tacl_a_00407. URL https://doi.org/10.1162/tacl_a_00407.
|
| 229 |
+
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.
|
| 230 |
+
Amita Kamath, Robin Jia, and Percy Liang. Selective question answering under domain shift. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 5684–5696, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.503. URL https: //aclanthology.org/2020.acl-main.503.
|
| 231 |
+
Archit Karandikar, Nicholas Cain, Dustin Tran, Balaji Lakshminarayanan, Jonathon Shlens, Michael C Mozer, and Becca Roelofs. Soft calibration objectives for neural networks. arXiv preprint arXiv:2108.00106, 2021.
|
| 232 |
+
Lingkai Kong, Haoming Jiang, Yuchen Zhuang, Jie Lyu, Tuo Zhao, and Chao Zhang. Calibrated language model fine-tuning for in- and out-of-distribution data. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 1326–1340, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.102. URL https://aclanthology. org/2020.emnlp-main.102.
|
| 233 |
+
Volodymyr Kuleshov and Percy S Liang. Calibrated structured prediction. Advances in Neural Information Processing Systems, 28, 2015.
|
| 234 |
+
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.
|
| 235 |
+
Joshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. On faithfulness and factuality in abstractive summarization. arXiv preprint arXiv:2005.00661, 2020.
|
| 236 |
+
Sabrina J. Mielke, Arthur Szlam, Emily Dinan, and Y-Lan Boureau. Reducing conversational agents’ overconfidence through linguistic calibration. Transactions of the Association for Computational Linguistics, 10:857–872, 2022. doi: 10.1162/tacl_a_00494. URL https://aclanthology.org/2022.tacl-1.50.
|
| 237 |
+
Matthias Minderer, Josip Djolonga, Rob Romijnders, Frances Hubis, Xiaohua Zhai, Neil Houlsby, Dustin Tran, and Mario Lucic. Revisiting the calibration of modern neural networks. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. Wortman Vaughan (eds.), Advances in Neural Information Processing Systems, volume 34, pp. 15682–15694. Curran Associates, Inc., 2021. URL https: //proceedings.neurips.cc/paper/2021/file/8420d359404024567b5aefda1231af24-Paper.pdf.
|
| 238 |
+
Jishnu Mukhoti, Viveka Kulharia, Amartya Sanyal, Stuart Golodetz, Philip Torr, and Puneet Dokania. Calibrating deep neural networks using focal loss. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 15288–15299. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/ file/aeb7b30ef1d024a76f21a1d40e30c302-Paper.pdf.
|
| 239 |
+
Arvind Neelakanta. Introducing text and code embeddings in the openai api, 2022. https://openai.com/ blog/introducing-text-and-code-embeddings/, Last accessed on 2022-04-30.
|
| 240 |
+
Khanh Nguyen and Brendan O’Connor. Posterior calibration and exploratory analysis for natural language processing models. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 1587–1598, Lisbon, Portugal, September 2015. Association for Computational Linguistics. doi: 10.18653/v1/D15-1182. URL https://aclanthology.org/D15-1182.
|
| 241 |
+
Jeremy Nixon, Mike Dusenberry, Ghassen Jerfel, Timothy Nguyen, Jeremiah Liu, Linchuan Zhang, and Dustin Tran. Measuring calibration in deep learning, 2019. URL https://arxiv.org/abs/1904.01685.
|
| 242 |
+
OpenAI. Fine-tuning, 2021. https://beta.openai.com/docs/guides/fine-tuning/advanced-usage, Last accessed on 2022-04-30.
|
| 243 |
+
Yaniv Ovadia, Emily Fertig, Jie Ren, Zachary Nado, D. Sculley, Sebastian Nowozin, Joshua V. Dillon, Balaji Lakshminarayanan, and Jasper Snoek. Can You Trust Your Model’s Uncertainty? Evaluating Predictive Uncertainty under Dataset Shift. Curran Associates Inc., Red Hook, NY, USA, 2019.
|
| 244 |
+
Laria Reynolds and Kyle McDonell. Prompt programming for large language models: Beyond the few-shot paradigm, 2021. URL https://arxiv.org/abs/2102.07350.
|
| 245 |
+
Kurt Shuster, Spencer Poff, Moya Chen, Douwe Kiela, and Jason Weston. Retrieval augmentation reduces hallucination in conversation. arXiv preprint arXiv:2104.07567, 2021.
|
| 246 |
+
Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, May 2021.
|
| 247 |
+
Jindong Wang, Cuiling Lan, Chang Liu, Yidong Ouyang, and Tao Qin. Generalizing to unseen domains: A survey on domain generalization. In Zhi-Hua Zhou (ed.), Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, IJCAI-21, pp. 4627–4635. International Joint Conferences on Artificial Intelligence Organization, 8 2021. doi: 10.24963/ijcai.2021/628. URL https://doi.org/10. 24963/ijcai.2021/628. Survey Track.
|
| 248 |
+
Andy Zou, Tristan Xiao, Ryan Jia, Joe Kwon, Mantas Mazeika, Richard Li, Dawn Song, Jacob Steinhardt, Owain Evans, and Dan Hendrycks. Forecasting future world events with neural networks. arXiv preprint arXiv:2206.15474, 2022.
|
| 249 |
+
|
| 250 |
+
# A CalibratedMath
|
| 251 |
+
|
| 252 |
+
Table 3: Breakdown of tasks in the CalibratedMath benchmark. ‘# Levels’ refers to the count of difficulty levels within each operation, where the difficulty is determined by the number of digits in each operand and the formatting used for the numbers. Models are trained on tasks from the ‘Add/Sub’ group, then evaluated on either the ‘Mult/Div’ or the ‘Multi[-answer]’ group.
|
| 253 |
+
|
| 254 |
+
<table><tr><td>Group</td><td>Operation</td><td>#LevelsExample</td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>Add/Sub</td><td>Addition</td><td>24</td><td>Q: What is 14 + 27? A: 41</td></tr><tr><td>Add/Sub</td><td>Subtraction</td><td>24</td><td>Q: What is 109 - 3? A: 106</td></tr><tr><td>Mult/Div</td><td>Multiplication</td><td>9</td><td>Q: What is 8 * 64? A: 512</td></tr><tr><td>Mult/Div</td><td>Division</td><td>12</td><td>Q: What is 512 / 8? A: 64</td></tr><tr><td>Mult/Div</td><td>Floor division</td><td>12</td><td>Q: What is 515 /8? A: 64</td></tr><tr><td>Mult/Div</td><td>Modulo Remainder</td><td>12 12</td><td>Q: What is 515 mod 8? A: 3</td></tr><tr><td>Mult/Div</td><td></td><td></td><td>Q: What is the remainder when 515 is divided by 8? A: 3</td></tr><tr><td>Mult/Div</td><td>Percentages Fraction reduction</td><td>6 7</td><td>Q: What is 25% of 1024? A: 256</td></tr><tr><td>Mult/Div Add/Sub</td><td>Rounding</td><td>6</td><td>Q: What is 15/24 in reduced form? A: 5/8</td></tr><tr><td>Add/Sub</td><td> Arithmetic sequences</td><td>6</td><td>Q: What is 10,248 rounded to the nearest 10? A: 10,250</td></tr><tr><td>Add/Sub</td><td>3-step addition</td><td>1</td><td>Q: What comes next: 4, 14, 24, 34...? A: 44</td></tr><tr><td>Mult/Div</td><td> 3-step multiplication</td><td>1</td><td>Q: What is 2 +3 + 7? A: 12 Q: What is 2 * 3 * 7? A: 42</td></tr><tr><td>Add/Sub</td><td>Addition (alt)</td><td>24</td><td></td></tr><tr><td>Add/Sub</td><td>Subtraction (alt)</td><td>24</td><td>Q: What is 10 more than 23,298? A: 23,308</td></tr><tr><td>Multi</td><td>Less than</td><td>2</td><td>Q: What is 24 less than 96? A: 72</td></tr><tr><td>Multi</td><td>Greater than</td><td>2</td><td>Q: Name any number smaller than 10o? A: 37</td></tr><tr><td>Multi</td><td>Prime</td><td>2</td><td>Q: Name any number larger than 10o? A: 241 Q: Name any prime number smaller than 10o? A: 7</td></tr><tr><td>Multi</td><td>Square</td><td>2</td><td>Q: Name any perfect square smaller than 10o? A: 64</td></tr><tr><td>Multi</td><td>Two-sum</td><td>2</td><td>Q: Name two numbers that sum to 25? A: 11 and 14</td></tr><tr><td>Multi</td><td>Multiple</td><td>6</td><td></td></tr><tr><td></td><td></td><td></td><td>Q: Name a single multiple of 7 between 80 and 99? A: 91</td></tr></table>
|
| 255 |
+
|
| 256 |
+

|
| 257 |
+
GPT-3 performance shift from train to eval
|
| 258 |
+
Figure 8: Distribution shift of GPT-3’s zero-shot ability to answer arithmetic questions between training (Add-subtract) and evaluation sets (Multi-answer and Multiply-divide). For the training set “Add-subtract”, we calculate the accuracy ( $\%$ of correct answers) across each task and level of difficulty (see Table 3) and display this as a histogram. We see that the most frequent accuracies are close to 0 (which are question types such that GPT-3 gets nearly all instances wrong). The same process is repeated for the evaluation sets (Multi-answer and Multiply-divide). We see that GPT-3 does even worse on Multiply-divide but does much better on Multi-answer. Thus to be well calibrated on the Multi-answer evaluation set, GPT-3 would need to use higher probabilities (on average) than on the training set.
|
| 259 |
+
|
| 260 |
+
# B Experimental setup
|
| 261 |
+
|
| 262 |
+
# B.1 Verbalized probability with words
|
| 263 |
+
|
| 264 |
+
In one version of verbalized probability, models express uncertainty using words rather than numbers (see Figure 1 for an example). This leaves the question of which words to use for supervised finetuning. While we tried ordered categories (Confidence: “lowest”, “low”, “medium”, “high”, “highest”), we found that using random names without explicit orderings (“john”, “sam”, “matt”, “dan”, “tom”) led to very slightly better performance. So we use these random names throughout.
|
| 265 |
+
|
| 266 |
+
# B.2 Prompts
|
| 267 |
+
|
| 268 |
+

|
| 269 |
+
|
| 270 |
+
Figure 9: Few-shot prompt. The example shows a 5-shot prompt. The answers and target probabilities come from the estimation step described in Section 3. The prompt is randomized before every query.
|
| 271 |
+
|
| 272 |
+
# B.3 Supervised fine-tuning
|
| 273 |
+
|
| 274 |
+
The supervised fine-tuning dataset consists of approximately 10k examples, where 100 examples are sampled from each sub-task in the training set. Models are trained for one epoch to prevent overfitting, using the default hyperparameters from OpenAI’s fine-tuning API with learning_rate_multiplier $\ c = ~ 0 . 1$ (OpenAI, 2021). We additionally carry out a form of early stopping that takes into account the difference between the sub-task level targets $\hat { p } _ { T }$ , and a model’s binary accuracy of $0 / 1$ on any individual question.
|
| 275 |
+
|
| 276 |
+
Consider a sub-task $T$ from which we sample two questions, the first of which the model answers correctly. Then $\hat { p } _ { T }$ would equal 0.5. If the model correctly gives uncertainties of 1 and 0 on the two samples, its per-sample MSE would be 0. However, it would incur a loss against the target $\hat { p } _ { T }$ . Reducing this loss would lead to worse performance on the per-sample MSE. This happens because $\hat { p } _ { T }$ is a proxy for what the model’s uncertainty should be on any given question. As we continue to fit to $\hat { p } _ { T }$ , we see that per-sample MSE flattens or increases on the training set, even though the loss against $\hat { p } _ { T }$ continues to decrease. We use this as a signal to stop training after around $n = 2 7 0 0$ examples. A comparison of calibration by the number of samples seen is shown in Figure 11 on the two evaluation sets, although we use the training set only to determine the stopping point.
|
| 277 |
+
|
| 278 |
+
# C Additional results
|
| 279 |
+
|
| 280 |
+

|
| 281 |
+
C.1 Verbalized calibration curves by number of training samples
|
| 282 |
+
Figure 10: Calibration curves by number of training examples. We train the model to produce verbalized probabilities (numbers) on the Add-subtract training set. Curves show calibration performance for the Multiply-divide (top) and Multi-answer (bottom) evaluation sets using Expected Value decoding over output tokens (rather than greedy decoding). Beyond around $n = 2 7 0 0$ , continuing to train does not improve generalization.
|
| 283 |
+
|
| 284 |
+
# C.2 Comparing results using greedy and EV uncertainties
|
| 285 |
+
|
| 286 |
+
By verbally expressing uncertainty using a number (e.g. “Confidence: 84%”), models can cover a wide range of probability values even if greedy decoding is used. In comparison, expressing uncertainty using words limits models to five categories in our setup, corresponding to the discrete confidence scores [10%, $3 0 \%$ , $5 0 \%$ , $7 0 \%$ , 90%]. Taking an expected value (EV) over output tokens allows models to give intermediate scores (e.g. $0 . 5 \times$ “High” $( 7 0 \% ) \ : + \ : 0 . 5 \times$ “Medium” $( 5 0 \% ) = 6 0 \%$ confidence). The difference between greedy and EV uncertainties is more pronounced when the number of finetuning or $k$ -shot examples is low.
|
| 287 |
+
|
| 288 |
+

|
| 289 |
+
Figure 11: Calibration curves using greedy and EV uncertainties.
|
| 290 |
+
|
| 291 |
+
# C.3 Changing the training set from Add-subtract to Multiply-divide
|
| 292 |
+
|
| 293 |
+
Table 5: Calibration performance of models with a different training set. In contrast to the results in the main text (where models are trained on Add-subtract), here we train models on the Multiply-divide set and we evaluate on both Add-subtract and Multi-answer. We find that calibration on the Multi-answer evaluation set is worse than when training on Add-subtract. One reason is that there is a bigger shift in the “label distribution” from training to evaluation. GPT-3’s answers are less accurate on Multiply-divide and so probabilities above $5 0 \%$ are barely represented in the training set but make up most tasks in Multianswer. The label distributions (i.e. distribution of accuracy for GPT-3 on the arithmetic tasks) are shown in Figure 8.
|
| 294 |
+
|
| 295 |
+
<table><tr><td colspan="2">Setup</td><td colspan="2">Add-subtract</td><td>Multi-answer</td></tr><tr><td colspan="5"></td></tr><tr><td></td><td>MSE</td><td>MAD</td><td>MSE</td><td>MAD</td></tr><tr><td>Verbalized numbers (finetune)</td><td>17.0</td><td>9.9</td><td>36.3</td><td>40.7</td></tr><tr><td>Verbalized words (finetune)</td><td>16.4</td><td>6.8</td><td>30.5</td><td>30.2</td></tr><tr><td>Answer logit (zero-shot)</td><td>15.5</td><td>14.3</td><td>37.4</td><td>33.7</td></tr><tr><td>Indirect logit (finetune)</td><td>17.3</td><td>15.0</td><td>43.9</td><td>49.9</td></tr><tr><td>Constant baseline</td><td>20.1</td><td>8.5</td><td>40.1</td><td>39.5</td></tr></table>
|
| 296 |
+
|
| 297 |
+

|
| 298 |
+
C.4 Correlations between probability types
|
| 299 |
+
Figure 12: Correlation between verbalized probability and logit setups. Using the Multiply-divide evaluation set, we calculate each setup’s MSE on each task and difficulty level, then plot the results. The colorbar shows GPT-3’s accuracy on the arithmetic questions. While correlation between the two verbalized uncertainty types – expressing uncertainty either in numbers (e.g. $4 5 \%$ ) or words (“Confidence: Low”) is high, correlation to the other two types is moderate. This provides more evidence that the finetuned verbalized model isn’t simply reproducing the answer logit.
|
md/test/AFDcYJKhND/AFDcYJKhND.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/test/AL1fq05o7H/AL1fq05o7H.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/test/FQepisCUWu/FQepisCUWu.md
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CHATEVAL: TOWARDS BETTER LLM-BASED EVALUATORS THROUGH MULTI-AGENT DEBATE
|
| 2 |
+
|
| 3 |
+
Chi-Min $\mathbf { C h a n ^ { 1 } }$ , Weize Chen1, Yusheng $\mathbf { S u } ^ { 1 }$ , Jianxuan $\mathbf { Y u } ^ { 1 }$ , Wei $\mathbf { X } \mathbf { u } \mathbf { e } ^ { 2 }$ , Shanghang Zhang3, Jie $\mathbf { F u ^ { 2 } }$ , Zhiyuan $\mathbf { L i u ^ { 1 * } }$
|
| 4 |
+
|
| 5 |
+
1 Tsinghua University
|
| 6 |
+
2 Hong Kong University of Science and Technology
|
| 7 |
+
3 Peking University
|
| 8 |
+
zorowin123@gmail.com
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
Text evaluation has historically posed significant challenges, often demanding substantial labor and time cost. With the emergence of large language models (LLMs), researchers have explored LLMs’ potential as alternatives for human evaluation. While these single-agent-based approaches show promise, experimental results suggest that further advancements are needed to bridge the gap between their current effectiveness and human-level evaluation quality. Recognizing that best practices of human evaluation processes often involve multiple human annotators collaborating in the evaluation, we resort to a multi-agent debate framework, moving beyond single-agent prompting strategies. In this paper, we build a multi-agent referee team called ChatEval to autonomously discuss and evaluate the quality of different texts. Our experiments on two benchmarks illustrate that ChatEval delivers superior accuracy and correlation in alignment with human assessment. Furthermore, we find that the diverse role prompts (different personas) are essential in the multi-agent debate process; that is, utilizing the same role description in the prompts can lead to a degradation in performance. Our qualitative analysis also shows that ChatEval transcends mere textual scoring, offering a human-mimicking evaluation process for reliable assessments.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Evaluating the quality of text generated by language models or written by humans has long been a challenging endeavor, consistently garnering substantial attention (Celikyilmaz et al., 2020). Traditional methodologies predominantly rely on human annotation of texts (Callison-Burch, 2009), an approach considered overly demanding in terms of time and cost. Automatic evaluation metrics based on n-grams, such as Rouge (Lin, 2004), BLEU (Papineni et al., 2002), and METEOR (Banerjee & Lavie, 2005), have been proposed to tackle this issue (Kondrak, 2005). However, these methods have been shown to exhibit a relatively weak correlation with human judgments, particularly in the context of tasks involving open-ended generation or requiring domain-specific expertise (Novikova et al., 2017).
|
| 17 |
+
|
| 18 |
+
In view of the impressive text understanding and instruction-following capabilities of recent LLMs, a body of literature (Liu et al., 2023b; Chiang & Lee, 2023; Gao et al., 2023; Shen et al., 2023) has adopted LLM as an evaluator to assess the quality of responses to open-ended questions or traditional NLG tasks, including dialogue response generation and summarization. This methodology is dubbed LLM-as-a-judge (Zheng et al., 2023). Findings from these researches indicate that LLM can mimic human behavior and provide evaluations that correspond with human judgments, revealing a potentially scalable and transparent alternative to costly and laborious human evaluations.
|
| 19 |
+
|
| 20 |
+
While a single powerful LLM can already tackle various missions, emerging studies suggest that multiple LLMs can further improve one another through debate and cooperation (Li et al., 2023a; Liang et al., 2023). By incorporating multiple LLMs into an integrated group and designing specific interaction mechanisms, different LLMs can engage in proposing and deliberating unique responses and thought processes across several rounds. This approach leads to enhanced factuality of generated responses (Du et al., 2023) and improvement in the completion of arduous tasks (Li et al., 2023a; Qian et al., 2023). Furthermore, the multi-agent group also addresses and mitigates the Degeneration-of-Thought (DOT) problem (Liang et al., 2023).
|
| 21 |
+
|
| 22 |
+

|
| 23 |
+
Figure 1: When several referees participate in the evaluation process, they can discuss with each other and finally give a judgment that is better aligned with human annotators.
|
| 24 |
+
|
| 25 |
+
In the human evaluation processes, relying on a single perspective can introduce bias and instability in the results (Karpinska et al., 2021). Recognizing this, best practices often involve multiple human annotators collaborating in the evaluation (Van Der Lee et al., 2019). Drawing inspiration from this collaborative and iterative human evaluation approach, we propose ChatEval, a system that enables each agent to employ varied communication strategies in collaborative discussion, working towards formulating final judgments. Furthermore, to enrich the evaluation dynamics, every agent within ChatEval is endowed with a unique persona. This deliberate design ensures that each agent focuses on distinct perspectives or brings specific expertise to the table. By doing so, the collective evaluation benefits from a more comprehensive lens, capturing nuances and subtleties that a single perspective might overlook. Another underlying intuition of our work stems from renowned concepts in sociology and biology, including Collective Intelligence(Woolley et al., 2010) and Cognitive Synergy(Luppi et al., 2022), where multiple cognitive processes or systems interact and cooperate in a way that produces a combined effect greater than the sum of their separate effects.
|
| 26 |
+
|
| 27 |
+
To summarize, the main contribution of our work is as follows:
|
| 28 |
+
|
| 29 |
+
1. We propose a multi-agent-based framework called ChatEval that aligns better with human preferences compared with single-agent-based approaches as depicted in Figure 1.
|
| 30 |
+
2. We propose various communication strategies and demonstrate the necessity of diverse role prompts in multi-agent debate scenarios.
|
| 31 |
+
3. In the qualitative study, we demonstrate that our agents exhibit human-like behavior, capitalizing on the richness and complexity of language interaction. This elevates ChatEval from being merely a evaluation tool to an embodiment of interactive natural language dialogue.
|
| 32 |
+
|
| 33 |
+
# 2 METHODOLOGY
|
| 34 |
+
|
| 35 |
+
In this section, we elaborate on the principal components in ChatEval including debater agents, diverse role specification, communication strategy, and provide a detailed overview of each component’s role and functionality.
|
| 36 |
+
|
| 37 |
+

|
| 38 |
+
Figure 2: The overall schematic diagram of our proposed three different kinds of communication strategy. The direction of the arrows represents the flow of information, meaning that what this person says will be appended to the chat history of the person pointed to by the arrow.
|
| 39 |
+
|
| 40 |
+
Debater Agents. Debater agents are one of the most significant components in our framework. We treat each individual LLM as an agent and ask them to generate their response from the given prompts1. Responses from other agents are served as chat history which will be replaced in the prompt template. After configuring the agents, we then start the group debate where each agent autonomously receives responses from the others and, in turn, delivers its own responses to them. It should be noted that the whole process does not require human intervention.
|
| 41 |
+
|
| 42 |
+
Diverse Role Specification. As presented in Section 1, diverse role specification is necessary for the framework as well. Although all the agents share a common prompt template, we substitute the role description slot with diverse role prompts, specifying distinct personalities for different agents. We take inspiration from Wu et al. (2023) and formulate an analogous role description.
|
| 43 |
+
|
| 44 |
+
Communication Strategy. How to maintain the chat history is another significant issue in ChatEval. In our work, we use a more intuitive term to illustrate the maintenance of the chat history called communication strategy. In a nutshell, different communication strategies can be seen as different approaches to maintaining and manipulating their chat history. As is shown in Figure 2, We primarily design three different communication strategies and the full description and algorithm of the above communication strategies can be found in Appendix C.
|
| 45 |
+
|
| 46 |
+
# 3 EXPERIMENTS
|
| 47 |
+
|
| 48 |
+
We evaluate ChatEval on two benchmarks, FairEval and Topical-Chat which represent the categories of open-ended question answer and dialogue response generation, respectively. For the LLMs in ChatEval, we choose to use ChatGPT(GPT-3.5-turbo) and GPT-4 considering their strong capability shown in the past literature, we also test our frame work on smaller open-sourced model such as Llama2-Chat-7B and Vicuna, the results of which are shown in Appendix D, and the detailed settings for the experiments are discussed in Appendix B.
|
| 49 |
+
|
| 50 |
+
# 3.1 BENCHMARKS
|
| 51 |
+
|
| 52 |
+
The detailed introduction of different categories and benchmarks are listed as follows:
|
| 53 |
+
|
| 54 |
+
Open-ended Question Answer is a key component within the field of NLP and generative AI. It necessitates an AI system to provide comprehensive, detailed, and human-like responses to questions that don’t have a predefined or fixed set of possible answers. The work of Chiang et al. (2023) encompasses a collection of 80 open-ended questions originating from a wide array of categories, including common-sense, counterfactual, coding, etc. We then take the human annotation results from Wu et al. (2023) to conduct the experiments in this paper. For each question, they direct three annotators to evaluate the replies given by Vicuna-13B and ChatGPT through the given rules and finally derive the results by the majority votes among the annotators.
|
| 55 |
+
|
| 56 |
+
Dialogue Response Generation is a task involves creating a coherent and contextually appropriate response to a given input dialogue. We draw upon the Topical-Chat (Gopalakrishnan et al., 2019) dataset for our study. We then take the human annotation results from Mehri & Eskenazi (2020) where they carry out the annotations on 60 dialogue contexts with each response generated by 6 different systems. Human evaluators analyzed these responses based on natural, coherence, engagingness, groundedness, and understandable, where we take the first four dimensions for experiments in our paper following Zhong et al. (2022).
|
| 57 |
+
|
| 58 |
+
# 3.2 BASELINES
|
| 59 |
+
|
| 60 |
+
We evaluate ChatEval against following methods. As the main portion of our comparison, we primarily focuses on the single-agent-based method. Single-Agent means that we directly query an LLM to generate the response towards the evaluation2. Multi-Agent means that we employ multiple LLMs, either in an ensemble or through a debate approach. When we do the ensemble, we apply the single-agent method multiple times using different role prompts across the same instance and then aggregate their results through averaging to derive the final outcome. By default, we configure the communication strategy to one-by-one, agent numbers to 2, and discussion turns to 2 in this section and employ position calibration techniques in both single-agent and multi-agent settings. We will discuss more debate configurations in Section 4 for completeness. For the open-ended question answer task, we also compare our method with a simple ensemble method and FairEval (Wang et al., 2023b). They propose various strategies to improve the evaluation performance of a LLM including Multiple Evidence Calibration (MEC) and Balanced Position Calibration (BPC). For the dialogue response generation task, we also compare our method with G-EVAL (Liu et al., 2023b). They utilize CoT and probability-weighted summation for their method. Additionally, we include results from n-gram-based metrics, such as ROUGE (Lin, 2004), BLEU (Papineni et al., 2002) and embedding-based metrics such as BERTScore (Zhang et al., 2019).
|
| 61 |
+
|
| 62 |
+
# 3.3 RESULTS FOR OPEN-ENDED QUESTION ANSWERS
|
| 63 |
+
|
| 64 |
+
We adopt the same evaluation approach as Wang et al. (2023b) to assess the annotation results produced by different methods and annotators. Specifically, we calculate the Accuracy (Acc.), which measures the proportion of correctly classified instances out of the total instances, and the Kappa correlation coefficient (Kap.) (McHugh, 2012) which gauges the agreement between results from models and human annotators while taking into account the possibility of agreement occurring by chance. Both metrics provide insights into the reliability and consistency of the annotations. We take the human annotation results and FairEval’s (Wang et al., 2023b) best results from their paper. As is shown in Table 1, different annotators can reach a relatively high agreement and perform better than any other LLM-based approach. Still, the average human annotations accuracy which is $7 1 . 7 \%$ shows there exists a certain degree of discrepancy among different unique individuals revealing that text evaluation is absolutely an arduous task. The second part and the third part of Table 1 show the results of FairEval’s method and the results of our proposed method respectively. We find that (1) ChatEval can enhance the performance of the evaluation process, achieving higher alignment with human preference compared with single-agent evaluation. Specifically, the multi-agent-based method improves the accuracy by $6 . 2 \%$ for ChatGPT and $2 . 5 \%$ for GPT-4; (2) ChatEval surpasses FairEval’s best results within both ChatGPT and GPT-4 settings showing the effectiveness of our proposed method; (3) Compared to ChatEval, a basic ensemble fails to markedly improve the evaluator’s performance, highlighting the crucial role of natural language interaction in our framework.
|
| 65 |
+
|
| 66 |
+
# 3.4 RESULTS FOR DIALOGUE RESPONSE GENERATION
|
| 67 |
+
|
| 68 |
+
For the dialogue response generation benchmarks, we align the evaluation method with Zhong et al. (2022), calculating the turn-level Spearman and Kendall-Tau correlation in correspondence with human judgments on four aspects (naturalness, coherence, engagingness and groundedness). Results can be found in Table 2. In the first part of Table 2, we demonstrate that n-gram-based metrics and embedding-based metrics perform overall poorly on all the aspects evaluated illustrating that these methods can hardly reveal human preference. In the second part of Table 2, we show the results from the G-eval (Liu et al., 2023b) paper. They first ask the LLM to generate intermediate thought and finally calculate the weighted summation of the output scores based on the probability. The results show that their method outperforms previous traditional metrics depicting the fact that the LLM-based evaluator is effective and reliable for evaluating the dialogue response generation task. While their method delivers sound results, our proposed approach raises the bar in terms of performance for GPT-4. Specifically, ChatEval improves the average Spearman and KendallTau correlation by 0.096 $( 1 6 . 3 \% )$ and 0.057 $( 1 0 . 0 \% )$ respectively. Additionally, compared with the single-agent method, ChatEval amplifies the performance both for ChatGPT and GPT-4, showing the effectiveness of our method which is aligned with the results in Section 3.3.
|
| 69 |
+
|
| 70 |
+
Table 1: Accuracy (Acc.) and Kappa correlation coefficient (Kap.) of different methods on FairEval. We present our results with average and standard deviation by running the experiment five times.
|
| 71 |
+
|
| 72 |
+
<table><tr><td>Evaluator</td><td>Methods</td><td>Acc.(%)</td><td>Kap.</td></tr><tr><td>Human</td><td></td><td></td><td></td></tr><tr><td>Annotator1</td><td></td><td>68.8</td><td>0.5</td></tr><tr><td>Annotator2</td><td></td><td>76.3</td><td>0.62</td></tr><tr><td>Annotator3</td><td></td><td>70</td><td>0.5</td></tr><tr><td>FairEval</td><td></td><td></td><td></td></tr><tr><td>ChatGPT</td><td>MEC+BPC</td><td>58.7</td><td>0.31</td></tr><tr><td>GPT-4</td><td>MEC+BPC</td><td>62.5</td><td>0.37</td></tr><tr><td>Ours</td><td></td><td></td><td></td></tr><tr><td>ChatGPT</td><td>Single-Agent</td><td>53.7±1.4</td><td>0.27±0.02</td></tr><tr><td>ChatGPT</td><td>Multi-Agent (Ensemble)</td><td>55.5±0.7</td><td>0.29±0.01</td></tr><tr><td>ChatGPT</td><td>Multi-Agent (ChatEval)</td><td>60.0±0.9</td><td>0.30±0.02</td></tr><tr><td>GPT-4</td><td>Single-Agent</td><td>60.8±0.7</td><td>0.36±0.01</td></tr><tr><td>GPT-4</td><td>Multi-Agent (Ensemble)</td><td>61.5±0.5</td><td>0.38±0.01</td></tr><tr><td>GPT-4</td><td>Multi-Agent (ChatEval)</td><td>63.8±0.9</td><td>0.40±0.01</td></tr></table>
|
| 73 |
+
|
| 74 |
+
Table 2: Turn-level Spearman $( \rho )$ and Kendall-Tau $( \tau )$ correlations of different methods on TopicalChat benchmark, SA means Single-Agent, EN means Multi-Agent (Ensemble) and MA means Multi-Agent (ChatEval). Our ChatGPT settings should be compared to G-EVAL-3.5, and GPT-4 settings should be compared to G-EVAL-4.
|
| 75 |
+
|
| 76 |
+
<table><tr><td rowspan="2">Metrics</td><td colspan="2">Naturalness</td><td colspan="2">Coherence</td><td colspan="2">Engagingness</td><td colspan="2">Groundedness</td><td colspan="2">Average</td></tr><tr><td>P</td><td>T</td><td>P</td><td>T</td><td></td><td>T</td><td></td><td>T</td><td>p</td><td>T</td></tr><tr><td>ROUGE-L</td><td>0.146</td><td>0.176</td><td>0.203</td><td>0.193</td><td>0.300</td><td>0.295</td><td>0.327</td><td>0.310</td><td>0.244</td><td>0.244</td></tr><tr><td>BLEU-4</td><td>0.175</td><td>0.180</td><td>0.235</td><td>0.131</td><td>0.316</td><td>0.232</td><td>0.310</td><td>0.213</td><td>0.259</td><td>0.189</td></tr><tr><td>BERTScore</td><td>0.209</td><td>0.226</td><td>0.233</td><td>0.214</td><td>0.335</td><td>0.317</td><td>0.317</td><td>0.291</td><td>0.274</td><td>0.262</td></tr><tr><td>G-EVAL-3.5</td><td>0.539</td><td>0.532</td><td>0.544</td><td>0.519</td><td>0.691</td><td>0.660</td><td>0.567</td><td>0.586</td><td>0.585</td><td>0.574</td></tr><tr><td>G-EVAL-4</td><td>0.565</td><td>0.549</td><td>0.605</td><td>0.594</td><td>0.631</td><td>0.627</td><td>0.551</td><td>0.531</td><td>0.588</td><td>0.575</td></tr><tr><td>ChatGPT(SA)</td><td>0.474</td><td>0.421</td><td>0.527</td><td>0.482</td><td>0.599</td><td>0.549</td><td>0.576</td><td>0.558</td><td>0.544</td><td>0.503</td></tr><tr><td>ChatGPT(EN)</td><td>0.421</td><td>0.359</td><td>0.486</td><td>0.442</td><td>0.611</td><td>0.551</td><td>0.661</td><td>0.628</td><td>0.545</td><td>0.495</td></tr><tr><td>ChatGPT(MA)</td><td>0.441</td><td>0.396</td><td>0.500</td><td>0.454</td><td>0.664</td><td>0.607</td><td>0.602</td><td>0.583</td><td>0.552</td><td>0.510</td></tr><tr><td>GPT-4(SA)</td><td>0.532</td><td>0.483</td><td>0.591</td><td>0.535</td><td>0.734</td><td>0.676</td><td>0.774</td><td>0.750</td><td>0.658</td><td>0.611</td></tr><tr><td>GPT-4(EN)</td><td>0.512</td><td>0.450</td><td>0.607</td><td>0.544</td><td>0.755</td><td>0.693</td><td>0.781</td><td>0.756</td><td>0.664</td><td>0.611</td></tr><tr><td>GPT-4(MA)</td><td>0.630</td><td>0.571</td><td>0.619</td><td>0.561</td><td>0.765</td><td>0.695</td><td>0.722</td><td>0.700</td><td>0.684</td><td>0.632</td></tr></table>
|
| 77 |
+
|
| 78 |
+
# 4 ANALYSIS
|
| 79 |
+
|
| 80 |
+
In this section, we further explore the key components encompassed in ChatEval. We discuss the importance of diverse role prompts in Section 4.1, the effect of different communication strategies in Section 4.2, the impact of role numbers and discussion turns in Section 4.3 and carry out the qualitative study in Section 4.4. If not specified otherwise, we choose the FairEval benchmark and ChatGPT as the backbone LLM for the analysis.
|
| 81 |
+
|
| 82 |
+
Previously in Table 1 and 2, we demonstrate that ChatEval equipped with diverse role configurations can significantly improve the performance of evaluation. We further consider whether it is necessary to design diverse role prompts for the evaluation system. To answer so, we carry out the experiments by replacing all the role prompts with ”You are now an Annotator, one of the referees in the text evaluation task.” and keeping other prompts unchanged. We experiment with the one-byone communication strategy and 2 agents with 2 discussion turns. The results in Table 3 illustrate that ChatEval with the same role prompt design underperforms that with diverse role prompt design and cannot effectively enhance the performance compared with single-agent setting, highlighting the cruciality of diverse role prompt design in the multi-agent debate framework.
|
| 83 |
+
|
| 84 |
+
Based on the findings above, we are convinced that diverse role prompts are crucial for our framework. Furthermore, we delved deeper to study the effects of different portraits assigned to agents. To analyze this, we referred to the categories proposed by Wang et al. (2023b). We designed specific roles for different groups and compared their evaluation quality with our default setting3. We selected four categories from which we could clearly derive specific roles for this experiment. Specifically, the four categories we chose are: generic, coding, writing, and knowledge. As a simple example, when we design the coding group, we recruit experts like Guido van Rossum by specifying ”You are Guido van Rossum. You are the creator of the Python programming language. $I { \ldots } I ^ { \prime \prime }$ in the role prompts. By designating different roles and backgrounds in the role prompts, we can assemble referee teams with specific expertise in various domains.
|
| 85 |
+
|
| 86 |
+
As shown in Figure 3, our specially designed knowledge, writing, and coding groups can outperform or match the evaluations of other groups in corresponding categories. As for the generic group, we found that it performs well overall compared to its counterparts. The results further underscore the effectiveness of the role prompts and reveal potential avenues for further optimizing the framework, such as using mechanisms like dynamic role prompt specification.
|
| 87 |
+
|
| 88 |
+
Table 3: Effect of diverse role specification on FairEval benchmark.
|
| 89 |
+
|
| 90 |
+
<table><tr><td>Evaluator</td><td>Methods</td><td>Acc.(%)</td><td>Kap.</td></tr><tr><td>ChatGPT</td><td>Single-Agent</td><td>53.8</td><td>0.27</td></tr><tr><td>ChatGPT</td><td>Multi-Agent (without Diverse Role Prompts)</td><td>53.8</td><td>0.25</td></tr><tr><td>ChatGPT</td><td>Multi-Agent (with Diverse Role Prompts)</td><td>60</td><td>0.33</td></tr></table>
|
| 91 |
+
|
| 92 |
+

|
| 93 |
+
Figure 3: Evaluation quality of different groups on different categories.
|
| 94 |
+
|
| 95 |
+
# 4.2 THE STUDY OF COMMUNICATION STRATEGIES
|
| 96 |
+
|
| 97 |
+
As shown in Figure 2, we also design three different communication strategy termed as one-byone, simultaneous-talk, simultaneous-talk-with-summarizer. The detailed descriptions and formal formulations can be found in Appendix C. As depicted in Figure 4, distinct communication strategies exhibit varying behaviors depending on the role-turn configuration. However, they peak at a similar performance range of $6 0 . 0 \% { - } 6 2 . 5 \%$ in accuracy. Furthermore, the simultaneous-talk-withsummarizer strategy appears to offer slightly better scalability, as evidenced by its consistent upward trajectory with increasing role numbers and discussion turns. It is hypothesized that this is because the summarization-style history doesn’t expand rapidly with the context length, thereby preserving the reasoning capability of the LLMs. Meanwhile, variations in performance among three different communication strategies underscore the influence of different strategies on the effectiveness of the evaluation quality, revealing the potential for further exploration and optimization of ChatEval. Thus, future studies could be aimed at a more comprehensive understanding of different communication strategies, and how they could be effectively employed to enhance performance. This could serve as an avenue for substantial improvements and novel insights in the multi-agent debate framework.
|
| 98 |
+
|
| 99 |
+
# 4.3 THE IMPACT OF ROLE NUMBERS AND DISCUSSION TURNS
|
| 100 |
+
|
| 101 |
+
We then study the impact of different role numbers and discussion turns. From Figure 4a, 4b and 4c, a discernible trend is observed in the relationship between the role number and both Acc. and Kap. As the role number increases, there is a corresponding growth in performance, underscoring the effectiveness of incorporating diverse roles.
|
| 102 |
+
|
| 103 |
+
Conversely, no significant upward trend is detected with respect to the increase in discussion turns, as is shown in Figure 4d and 4e. This observation aligns with the findings in Liang et al. (2023); Du et al. (2023), highlighting a consistent phenomenon where continual discussion often leads to stagnation or even degradation of performance. As we mentioned before in Section 4.2, such a trend may be attributed to issues associated with the rapidly ever-increasing context length, which consequently diminishes the performance. These results prompt a more nuanced understanding of the balance needed between role-turn dynamics to optimize the performance of ChatEval.
|
| 104 |
+
|
| 105 |
+

|
| 106 |
+
Figure 4: Comparison of different configuration of ChatEval on FairEval Benchmark. We use One, Sim and wSum to denote one-by-one, simultaneously-talk and simultaneously-talk-with-summarizer respectively.
|
| 107 |
+
|
| 108 |
+
Figure 5 showcases the debate process towards the evaluation of two assistants’ responses to the open-ended question ”What are the most effective ways to deal with stress?”. We can find that both of the responses produce similar strategies and equally compelling descriptions for dealing with stress, making it challenging to discern significant disparity in terms of quality. It is in this context of nuanced evaluation that the significance of the ChatEval process emerges.
|
| 109 |
+
|
| 110 |
+
We can pinpoint several human-like behaviors exhibited by the agents that can enrich our comprehension of the evaluation process; (1) Opening Statement: Alice initiates the debate with a clear stance, establishing the foundational argument and guiding the trajectory of the subsequent discourse. (2) Alternative Proposal: Bob introduces an alternative viewpoint, emphasizing the need to consider diverse interpretations. This not only broadens the discussion but also stimulates critical thinking. In the context of a debate, the introduction of an alternative proposal prevents the stagnation of thought, challenges pre-existing bias, and uncovers considerations that might otherwise be overlooked, ensuring that the discussions are well-rounded. (3) Stance Maintenance: Alice’s persistent adherence to her initial stance, even when faced with opposing views, exemplifies commitment and challenges other participants to refine their perspectives. This behaviour ensures the conversation remains robust, focused, and continually evolving, driving all participants to a higher level of engagement and critical thinking. (4) Seeking Consensus: The discussion’s climax reveals a collective agreement amongst the participants, which is reached through mutual understanding and compromise, underlining the value of each presented viewpoint.
|
| 111 |
+
|
| 112 |
+
In light of the above, ChatEval stands out not just as a tool for comparison but as an embodiment of interactive natural language dialogue. By simulating human argumentative interactions, it differentiates itself from static, single-presented opinions. This dynamic interaction showcases the richness and complexity of language, capturing nuances often missed in singular viewpoints. As such, ChatEval offers a reliable evaluation process that not only mirrors human discourse but also highlights the transformative power of collaborative dialogue. This positions it uniquely, underscoring its significant potential to execute text evaluation tasks both reliably and effectively.
|
| 113 |
+
|
| 114 |
+

|
| 115 |
+
|
| 116 |
+
Figure 5: An illustrative example from ChatEval presenting a discussion process involving participants Alice $( \frac { \frac { 5 } { 7 } } { 1 5 } )$ , Bob $( \frac { \frac { 4 } { x } } { \frac { 4 } { y } } )$ and Carol $( \mathbf { \Sigma } _ { [ \bar { \tau } ] } ^ { \bar { \tau } } )$ . They initiate a group talk with the purpose of determining the superior response from two assistants. Due to spatial constraints within the layout, we use [...] to omit some redundant text.
|
| 117 |
+
|
| 118 |
+
# 5 RELATED WORK
|
| 119 |
+
|
| 120 |
+
Automatic NLG evaluation In the landscape of NLG, evaluating the quality of texts represents a particularly arduous task. For a significant period, evaluation was primarily dependent on human annotations that is labor-intensive and limited by scalability issues. Automatic NLG evaluation attempts to address these challenges by leveraging computational models to assess the quality of texts. Previous work lies on the following categories: (1) $n$ -gram-based metrics: ROUGE (Lin, 2004) is a set of metrics that compute the amount of overlap between n-grams in the machine-generated summaries and the reference summaries. BLEU (Papineni et al., 2002) compare the generated texts with reference translations, based on the co-occurrence of n-grams in both texts. In spite of being easily and widely used, the above method is incapable of capturing syntactic and semantic similarity (Stent et al., 2005). (2) embedding-based metrics: Word embeddings are vector representations of words that capture their semantic properties. A bunch of work leverages word embeddings to evaluate the semantic similarity between two pieces of texts. BERTScore (Zhang et al., 2019) use contextualized word embeddings from transformer models like BERT (Devlin et al., 2018), BLEURT (Sellam et al., 2020) utilize supervised training data to enhance the performance. MoverScore (Zhao et al., 2019) combine contextualized word embeddings with Earth Mover’s Distance (Rubner et al., 2000). (3) LLM-based metrics: Amidst the flourishing advancement of LLM which embodies a wealth of information derived from extensive training data, using LLM as an evaluator has experienced notable progress. GPTScore (Fu et al., 2023) utilize conditional probability to assign the texts a score representing its quality. Wang et al. (2023a) explore the potential of utilizing ChatGPT as an NLG evaluator by prompting it to score texts directly. Wang et al. (2023c) curate a reliable dataset containing pairwise comparison and evaluation explanation which can be used to train a foundation model making it a better evaluator. Bai et al. (2023) propose decentralized evaluation to provide fairer evaluation results. G-EVAL (Liu et al., 2023b) propose probability-weighted techniques to calibrate the score given by a single LLM.
|
| 121 |
+
|
| 122 |
+
Communicative Agents Most recently, significant attention has been dedicated to the development of communicative agents. These agents, often acted by LLMs like ChatGPT or GPT-4, are designed to interact and communicate effectively with other agents or human users using natural language. The primary goal is to facilitate more productive and efficient interaction and collaboration as different agents can autonomously communicate and negotiate to tackle a more complex task collectively. Several studies have explored various aspects of communicative agents. Li et al. (2023a); Chen et al. (2023) propose a cooperative agent framework enabling agents to autonomously cooperate to solve complex tasks. Park et al. (2023) create a sandbox environment consisting of 25 individual virtual entities endowed with a character description and memory system. Every intelligent agent is capable of autonomously interacting with other agents and the environment simulating reliable human behavior. Dong et al. (2023); Qian et al. (2023) incorporate a waterfall model to manage a multiagent virtual team towards software development. Liu et al. (2023a) utilize a sandbox environment to curate reliable datasets in better alignment with human preference and train a socially-aligned LLM. Liang et al. (2023) and Du et al. (2023) also make use of the multi-agent debate framework in other scenarios such as translation and arithmetic problems resulting in better results. Wang et al. (2023d) propose an alternative method called self-collaboration to enable the communication of agents by utilizing a single LLM prompted by multi-persona descriptions. Mandi et al. (2023) propose a novel framework designed for the collaboration of multiple robots, utilizing multiple LLMs to enhance coordination and strategic planning among the robots. Concurrent with our work, Li et al. (2023b); Zhang et al. (2023) also propose a similar approach. However, they probe different dimensions of improving LLM-based evaluators and do not explore the effectiveness of natural language interaction.
|
| 123 |
+
|
| 124 |
+
# 6 CONCLUSION
|
| 125 |
+
|
| 126 |
+
In this paper, we present evidence that ChatEval contributes to improving the evaluation performance concerning text quality, aligning more closely with human preferences. We emphasize the necessity of the diverse role specification and propose distinct communication strategies as integral components within ChatEval. Our qualitative analysis of the discussion process conveys insightful intuitions about how texts are evaluated by ChatEval and substantiates our approach’s ability to support comprehensive evaluations akin to human judgment, thereby demonstrating the reliability and efficacy of our framework.
|
| 127 |
+
|
| 128 |
+
#
|
| 129 |
+
|
| 130 |
+
REFERENCES
|
| 131 |
+
Yushi Bai, Jiahao Ying, Yixin Cao, Xin Lv, Yuze He, Xiaozhi Wang, Jifan Yu, Kaisheng Zeng, Yijia Xiao, Haozhe Lyu, et al. Benchmarking foundation models with language-model-as-an-examiner. arXiv preprint arXiv:2306.04181, 2023.
|
| 132 |
+
Satanjeev Banerjee and Alon Lavie. Meteor: An automatic metric for mt evaluation with improved correlation with human judgments. In Proceedings of the acl workshop on intrinsic and extrinsic evaluation measures for machine translation and/or summarization, pp. 65–72, 2005.
|
| 133 |
+
Chris Callison-Burch. Fast, cheap, and creative: Evaluating translation quality using amazon’s mechanical turk. In Proceedings of the 2009 conference on empirical methods in natural language processing, pp. 286–295, 2009.
|
| 134 |
+
Asli Celikyilmaz, Elizabeth Clark, and Jianfeng Gao. Evaluation of text generation: A survey. CoRR, abs/2006.14799, 2020. URL https://arxiv.org/abs/2006.14799.
|
| 135 |
+
Weize Chen, Yusheng Su, Jingwei Zuo, Cheng Yang, Chenfei Yuan, Chen Qian, Chi-Min Chan, Yujia Qin, Yaxi Lu, Ruobing Xie, Zhiyuan Liu, Maosong Sun, and Jie Zhou. Agentverse: Facilitating multi-agent collaboration and exploring emergent behaviors in agents, 2023.
|
| 136 |
+
Cheng-Han Chiang and Hung-yi Lee. Can large language models be an alternative to human evaluations? arXiv preprint arXiv:2305.01937, 2023.
|
| 137 |
+
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.
|
| 138 |
+
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.
|
| 139 |
+
Yihong Dong, Xue Jiang, Zhi Jin, and Ge Li. Self-collaboration code generation via chatgpt. arXiv preprint arXiv:2304.07590, 2023.
|
| 140 |
+
Yilun Du, Shuang Li, Antonio Torralba, Joshua B Tenenbaum, and Igor Mordatch. Improving factuality and reasoning in language models through multiagent debate. arXiv preprint arXiv:2305.14325, 2023.
|
| 141 |
+
Jinlan Fu, See-Kiong Ng, Zhengbao Jiang, and Pengfei Liu. Gptscore: Evaluate as you desire. arXiv preprint arXiv:2302.04166, 2023.
|
| 142 |
+
Mingqi Gao, Jie Ruan, Renliang Sun, Xunjian Yin, Shiping Yang, and Xiaojun Wan. Human-like summarization evaluation with chatgpt. arXiv preprint arXiv:2304.02554, 2023.
|
| 143 |
+
Karthik Gopalakrishnan, Behnam Hedayatnia, Qinlang Chen, Anna Gottardi, Sanjeev Kwatra, Anushree Venkatesh, Raefer Gabriel, and Dilek Hakkani-Tur. Topical-chat: Towards knowledge- ¨ grounded open-domain conversations. 2019.
|
| 144 |
+
Marzena Karpinska, Nader Akoury, and Mohit Iyyer. The perils of using mechanical turk to evaluate open-ended text generation. arXiv preprint arXiv:2109.06835, 2021.
|
| 145 |
+
Grzegorz Kondrak. N-gram similarity and distance. In International symposium on string processing and information retrieval, pp. 115–126. Springer, 2005.
|
| 146 |
+
Guohao Li, Hasan Abed Al Kader Hammoud, Hani Itani, Dmitrii Khizbullin, and Bernard Ghanem. Camel: Communicative agents for” mind” exploration of large scale language model society. arXiv preprint arXiv:2303.17760, 2023a.
|
| 147 |
+
Ruosen Li, Teerth Patel, and Xinya Du. Prd: Peer rank and discussion improve large language model based evaluations. arXiv preprint arXiv:2307.02762, 2023b.
|
| 148 |
+
Tian Liang, Zhiwei He, Wenxiang Jiao, Xing Wang, Yan Wang, Rui Wang, Yujiu Yang, Zhaopeng Tu, and Shuming Shi. Encouraging divergent thinking in large language models through multiagent debate. arXiv preprint arXiv:2305.19118, 2023.
|
| 149 |
+
Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. In Text summarization branches out, pp. 74–81, 2004.
|
| 150 |
+
Ruibo Liu, Ruixin Yang, Chenyan Jia, Ge Zhang, Denny Zhou, Andrew M Dai, Diyi Yang, and Soroush Vosoughi. Training socially aligned language models in simulated human society. arXiv preprint arXiv:2305.16960, 2023a.
|
| 151 |
+
Yang Liu, Dan Iter, Yichong Xu, Shuohang Wang, Ruochen Xu, and Chenguang Zhu. Gpteval: Nlg evaluation using gpt-4 with better human alignment. arXiv preprint arXiv:2303.16634, 2023b.
|
| 152 |
+
Andrea I Luppi, Pedro AM Mediano, Fernando E Rosas, Negin Holland, Tim D Fryer, John T O’Brien, James B Rowe, David K Menon, Daniel Bor, and Emmanuel A Stamatakis. A synergistic core for human brain evolution and cognition. Nature Neuroscience, 25(6):771–782, 2022.
|
| 153 |
+
Zhao Mandi, Shreeya Jain, and Shuran Song. Roco: Dialectic multi-robot collaboration with large language models. arXiv preprint arXiv:2307.04738, 2023.
|
| 154 |
+
Mary L McHugh. Interrater reliability: the kappa statistic. Biochemia medica, 22(3):276–282, 2012.
|
| 155 |
+
Shikib Mehri and Maxine Eskenazi. Usr: An unsupervised and reference free evaluation metric for dialog generation. arXiv preprint arXiv:2005.00456, 2020.
|
| 156 |
+
Jekaterina Novikova, Ondˇrej Dusek, Amanda Cercas Curry, and Verena Rieser. Why we need ˇ new evaluation metrics for NLG. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 2241–2252, Copenhagen, Denmark, September 2017. Association for Computational Linguistics. doi: 10.18653/v1/D17-1238. URL https:// aclanthology.org/D17-1238.
|
| 157 |
+
Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting of the Association for Computational Linguistics, pp. 311–318, 2002.
|
| 158 |
+
Joon Sung Park, Joseph C O’Brien, Carrie J Cai, Meredith Ringel Morris, Percy Liang, and Michael S Bernstein. Generative agents: Interactive simulacra of human behavior. arXiv preprint arXiv:2304.03442, 2023.
|
| 159 |
+
Chen Qian, Xin Cong, Cheng Yang, Weize Chen, Yusheng Su, Juyuan Xu, Zhiyuan Liu, and Maosong Sun. Communicative agents for software development. arXiv preprint arXiv:2307.07924, 2023.
|
| 160 |
+
Yossi Rubner, Carlo Tomasi, and Leonidas J Guibas. The earth mover’s distance as a metric for image retrieval. International journal of computer vision, 40:99–121, 2000.
|
| 161 |
+
Thibault Sellam, Dipanjan Das, and Ankur P Parikh. Bleurt: Learning robust metrics for text generation. arXiv preprint arXiv:2004.04696, 2020.
|
| 162 |
+
Chenhui Shen, Liying Cheng, Yang You, and Lidong Bing. Are large language models good evaluators for abstractive summarization? arXiv preprint arXiv:2305.13091, 2023.
|
| 163 |
+
Amanda Stent, Matthew Marge, and Mohit Singhai. Evaluating evaluation methods for generation in the presence of variation. In International conference on intelligent text processing and computational linguistics, pp. 341–351. Springer, 2005.
|
| 164 |
+
Chris Van Der Lee, Albert Gatt, Emiel Van Miltenburg, Sander Wubben, and Emiel Krahmer. Best practices for the human evaluation of automatically generated text. In Proceedings of the 12th International Conference on Natural Language Generation, pp. 355–368, 2019.
|
| 165 |
+
Jiaan Wang, Yunlong Liang, Fandong Meng, Haoxiang Shi, Zhixu Li, Jinan Xu, Jianfeng Qu, and Jie Zhou. Is chatgpt a good nlg evaluator? a preliminary study. arXiv preprint arXiv:2303.04048, 2023a.
|
| 166 |
+
Peiyi Wang, Lei Li, Liang Chen, Dawei Zhu, Binghuai Lin, Yunbo Cao, Qi Liu, Tianyu Liu, and Zhifang Sui. Large language models are not fair evaluators. arXiv preprint arXiv:2305.17926, 2023b.
|
| 167 |
+
Yidong Wang, Zhuohao Yu, Zhengran Zeng, Linyi Yang, Cunxiang Wang, Hao Chen, Chaoya Jiang, Rui Xie, Jindong Wang, Xing Xie, et al. Pandalm: An automatic evaluation benchmark for llm instruction tuning optimization. arXiv preprint arXiv:2306.05087, 2023c.
|
| 168 |
+
Zhenhailong Wang, Shaoguang Mao, Wenshan Wu, Tao Ge, Furu Wei, and Heng Ji. Unleashing cognitive synergy in large language models: A task-solving agent through multi-persona selfcollaboration. arXiv preprint arXiv:2307.05300, 2023d.
|
| 169 |
+
Anita Williams Woolley, Christopher F Chabris, Alex Pentland, Nada Hashmi, and Thomas W Malone. Evidence for a collective intelligence factor in the performance of human groups. science, 330(6004):686–688, 2010.
|
| 170 |
+
Ning Wu, Ming Gong, Linjun Shou, Shining Liang, and Daxin Jiang. Large language models are diverse role-players for summarization evaluation. arXiv preprint arXiv:2303.15078, 2023.
|
| 171 |
+
Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q Weinberger, and Yoav Artzi. Bertscore: Evaluating text generation with bert. arXiv preprint arXiv:1904.09675, 2019.
|
| 172 |
+
Xinghua Zhang, Bowen Yu, Haiyang Yu, Yangyu Lv, Tingwen Liu, Fei Huang, Hongbo Xu, and Yongbin Li. Wider and deeper llm networks are fairer llm evaluators, 2023.
|
| 173 |
+
Wei Zhao, Maxime Peyrard, Fei Liu, Yang Gao, Christian M Meyer, and Steffen Eger. Moverscore: Text generation evaluating with contextualized embeddings and earth mover distance. arXiv preprint arXiv:1909.02622, 2019.
|
| 174 |
+
Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric Xing, et al. Judging llm-as-a-judge with mt-bench and chatbot arena. arXiv preprint arXiv:2306.05685, 2023.
|
| 175 |
+
Ming Zhong, Yang Liu, Da Yin, Yuning Mao, Yizhu Jiao, Pengfei Liu, Chenguang Zhu, Heng Ji, and Jiawei Han. Towards a unified multi-dimensional evaluator for text generation. arXiv preprint arXiv:2210.07197, 2022.
|
| 176 |
+
|
| 177 |
+
# A PROMPT TEMPLATE AND DIVERSE ROLE PROMPTS
|
| 178 |
+
|
| 179 |
+
The overall prompt template is shown in Table 4, we draw inspiration from Wu et al. (2023) and design several different role descriptions as follows.
|
| 180 |
+
|
| 181 |
+
General Public You are now General Public, one of the referees in this task. You are interested in the story and looking for updates on the investigation. Please think critically by yourself and note that it’s your responsibility to choose one of which is the better first.
|
| 182 |
+
|
| 183 |
+
Critic You are now Critic, one of the referees in this task. You will check fluent writing, clear sentences, and good wording in summary writing. Your job is to question others judgment to make sure their judgment is well-considered and offer an alternative solution if two responses are at the same level.
|
| 184 |
+
|
| 185 |
+
News Author You are News Author, one of the referees in this task. You will focus on the consistency with the original article. Please help other people to determine which response is the better one.
|
| 186 |
+
|
| 187 |
+
Psychologist You are Psychologist, one of the referees in this task. You will study human behavior and mental processes in order to understand and explain human behavior. Please help other people to determine which response is the better one.
|
| 188 |
+
|
| 189 |
+
Scientist You are Scientist, one of the referees in this task. You are a professional engaged in systematic study who possesses a strong background in the scientific method, critical thinking, and problem-solving abilities. Please help other people to determine which response is the better one.
|
| 190 |
+
|
| 191 |
+
# B IMPLEMENTATION DETAILS
|
| 192 |
+
|
| 193 |
+
We choose to utilize models from OpenAI’s GPT family as our LLMs in ChatEval, including GPT-4 and ChatGPT (GPT-3.5-turbo) and set the temperature to 0 to ensure reproducibility. The rationale
|
| 194 |
+
|
| 195 |
+
[Question]
|
| 196 |
+
{source text}
|
| 197 |
+
[The Start of Assistant 1’s Answer]
|
| 198 |
+
{compared text one}
|
| 199 |
+
[The End of Assistant 1’s Answer]
|
| 200 |
+
[The Start of Assistant 2’s Answer]
|
| 201 |
+
{compared text two}
|
| 202 |
+
[The End of Assistant 2’s Answer]
|
| 203 |
+
[System]
|
| 204 |
+
We would like to request your feedback on the performance of two AI assistants in response to the user question displayed above.
|
| 205 |
+
Please consider the helpfulness, relevance, accuracy, and level of detail of their responses. Each assistant receives an overall score on a scale of 1 to 10, where a higher score indicates better overall performance.
|
| 206 |
+
There are a few other referees assigned the same task, it’s your responsibility to discuss with them and think critically before you make your final judgment.
|
| 207 |
+
Here is your discussion history:
|
| 208 |
+
{chat history}
|
| 209 |
+
{role description}
|
| 210 |
+
Now it’s your time to talk, please make your talk short and clear, {agent name}
|
| 211 |
+
|
| 212 |
+
Table 4: The prompt template for FairEval Dataset. We replace the colored slot with real text before querying the LLMs. Note that we use the same template when conducting single-agent-based experiments and ignore the chat history and role description slot.
|
| 213 |
+
|
| 214 |
+
behind this selection is the exceptional performance these models offer, being among the most advanced and powerful in the world. Additionally, their accessibility and ease of use through APIs enable us to directly call and interact with the models during our research, significantly simplifying the process. In our current research, we focus on homogeneous groups of LLMs. That is, within a given multi-agent group, all LLMs belong to the same GPT family model, either all GPT-4 or all ChatGPT. We acknowledge the potential of heterogeneous groups for future research, which could provide fascinating insights into how strong models and weak models can cooperate in a multi-agent setting. Additionally, unlike previous work like Du et al. (2023), we do not explicitly ask the debater agents to reach a consensus at the end of the debate. In situations where the response format relies on direct comparison, we derive the final results from the majority vote among various annotators. Conversely, if the response format requires a direct score, we calculate the average score obtained from multiple annotators. This methodological approach ensures the impartiality and balance of our evaluation process.
|
| 215 |
+
|
| 216 |
+
# C FORMAL DEPICTION OF DIFFERENT COMMUNICATION STRATEGY
|
| 217 |
+
|
| 218 |
+
In this paper, we predominantly adopt the following three different communication strategies, which are:
|
| 219 |
+
|
| 220 |
+
1. One-By-One. During each round of the debate, the debater agents take turns in a set order to generate their response based on the current observation. When it’s time for a debater agent to respond, we directly concatenate what previous other agents have said into its chat history slot. Please refer to Algorithm 1.
|
| 221 |
+
2. Simultaneous-Talk. Unlike the one-by-one strategy, we carry out an alternative communication strategy called simultaneous-talk, where debater agents are prompted to asynchronously generate responses in each iteration of the discussion to nullify the impact of the speaking order. Please refer to Algorithm 2.
|
| 222 |
+
3. Simultaneous-Talk-with-Summarizer. The main difference between this strategy and simultaneous-talk is that we additionally employ another LLM as a summarizer. At the end of each iteration of the debate, we prompt this extra LLM to summarize the messages
|
| 223 |
+
|
| 224 |
+
conveyed so far and we replace the chat history slots of all debater agents with this summarization. Please refer to Algorithm 3.
|
| 225 |
+
|
| 226 |
+
# Algorithm 1: One-by-One
|
| 227 |
+
|
| 228 |
+
input : agents number $N$ , discuss turn $T$ , a group of debate agents $[ D _ { 1 } , \cdots , D _ { N } ]$ , chat history of each agent $[ H _ { 1 } , \cdots , H _ { N } ]$ , answer extracter (either majority vote or average score) EXT output: Final results for text evaluation $A N S$ 1 for $t \gets 0$ to $T$ do 2 for $n \gets 1$ to $N$ do 3 $h _ { n } \gets D _ { n } ( H _ { n } )$ ; // utilize agents to generate responses 4 for $m \gets n$ to $N$ do 5 if $m > { I }$ then 6 $H _ { m } \gets H _ { m } + h _ { n } ;$ ; // concatenate current response to later agents’ chat history 7 end 8 end 9 end 10 end 11 $A N S \gets E X T ( [ H _ { 1 } , \cdot \cdot \cdot , H _ { N } ] )$ ; 12 return $A N S$ ;
|
| 229 |
+
|
| 230 |
+
# Algorithm 2: Simultaneous-Talk
|
| 231 |
+
|
| 232 |
+
input : agents number $N$ , discuss turn $T$ , a group of debate agents $[ D _ { 1 } , \cdots , D _ { N } ]$ , chat history of each agent $[ H _ { 1 } , \cdots , H _ { N } ]$ , answer extracter (either majority vote or average score) $E X T$ , buffer $B U F$ output: Final results for text evaluation $A N S$ 1 for $t \gets 0$ to $T$ do 2 for $n \gets 1$ to $N$ do 3 $h _ { n } \gets D _ { n } ( H _ { n } )$ ; // utilize agents to generate responses 4 $b u f b u f + h _ { n } ;$ ; // add the responses in current turn to the buffer 5 end 6 for $n \gets 1$ to $N$ do 7 $H _ { n } \gets H _ { n } + b u f$ ; // add the buffer to all agents’ chat history 8 end 9 end 10 $A N S \gets E X T ( [ H _ { 1 } , \cdot \cdot \cdot , H _ { N } ] ) ;$ ; 11 return AN S;
|
| 233 |
+
|
| 234 |
+
# D GENERALIZATION TO SMALLER MODELS
|
| 235 |
+
|
| 236 |
+
Our primary focus in the paper is on the framework implemented with the most powerful LLMs such as ChatGPT and GPT-4. However, we also carry out the experiments on Llama2-Chat-7b and Vicuna-7b-v1.5. As indicated in the Table 5, Llama2-Chat achieves only marginal performance under single-agent CoT methods. Despite reaching an accuracy of $3 7 . 5 \%$ , the negative kappa coefficient suggests that the observed agreement is less than what would be expected by chance. However, it is noteworthy that through the application of a multi-agent debate, Llama2-Chat demonstrates a modest improvement, albeit still marginally above chance levels.
|
| 237 |
+
|
| 238 |
+
input : agents number $N$ , discuss turn $T$ , a group of debate agents $[ D _ { 1 } , \cdots , D _ { N } ]$ , chat history of each agent $[ H _ { 1 } , \cdots , H _ { N } ]$ , answer extracter (either majority vote or average score) $E X T$ , buffer $B U F$ , summarizer $S U M$ output: Final results for text evaluation $A N S$ 1 for $t \gets 0$ to $T$ do 2 for $n \gets 1$ to $N$ do 3 $h _ { n } \gets D _ { n } ( H _ { n } )$ ; // utilize agents to generate responses 4 $b u f b u f + h _ { n } $ ; // add the responses in current turn to the buffer 5 end 6 for $n \gets 1$ to $N$ do 7 $H _ { n } \gets H _ { n } + S U M ( B U F )$ ; // add the summarized buffer to all agents’ chat history 8 end 9 end 10 $A N S \gets E X T ( [ H _ { 1 } , \cdot \cdot \cdot , H _ { N } ] ) ;$ ; 11 return $A N S$ ;
|
| 239 |
+
|
| 240 |
+
In contrast, Vicuna exhibits more robust performance improvement compared to Llama2-Chat. ChatEval notably enhances its capabilities, achieving an accuracy of $5 2 . 3 \%$ and a kappa coefficient of 0.19, indicative of fair agreement beyond chance. While both models show limitations in their performance, these results demonstrate the effectiveness of ChatEval and underscore its positive impact.
|
| 241 |
+
|
| 242 |
+
Algorithm 3: Simultaneous-Talk-with-Summarizer
|
| 243 |
+
Table 6: Average Cost on FairEval.
|
| 244 |
+
|
| 245 |
+
<table><tr><td>Evaluator</td><td>Cost</td><td>Time</td></tr><tr><td></td><td colspan="2"></td></tr><tr><td>Human GPT-4(SA)</td><td>$90 $2.90</td><td>240min 10min</td></tr><tr><td>GPT-4(EN)</td><td>$8.70</td><td>10min</td></tr><tr><td>GPT-4(MA)</td><td>$12.30</td><td>36min</td></tr><tr><td>ChatGPT(SA)</td><td></td><td></td></tr><tr><td></td><td>$0.11</td><td>3min</td></tr><tr><td>ChatGPT(EN)</td><td>$0.33</td><td>3min</td></tr><tr><td>ChatGPT(MA)</td><td>$0.41</td><td>11min</td></tr><tr><td>G-EVAL-3.5</td><td>$2.20</td><td>3min</td></tr><tr><td>G-EVAL-4</td><td>$58</td><td>10min</td></tr><tr><td>FairEval-ChatGPT</td><td>$0.34</td><td>3min</td></tr><tr><td>FairEval-GPT-4</td><td>$6.38</td><td>10min</td></tr></table>
|
| 246 |
+
|
| 247 |
+
Table 5: Accuracy (Acc.) and Kappa correlation coefficient (Kap.) of smaller models on FairEval.
|
| 248 |
+
|
| 249 |
+
<table><tr><td>Evaluator</td><td>Acc. (%)</td><td>Kap.</td></tr><tr><td>Llama2-Chat-7B (SA)</td><td>37.5±1.3</td><td>-0.01±0.01</td></tr><tr><td>Llama2-Chat-7B (MA)</td><td>40.0±1.1</td><td>0.05±0.01</td></tr><tr><td>Vicuna-7B-v1.5 (SA)</td><td>45.0±1.5</td><td>0.12±0.01</td></tr><tr><td>Vicuna-7B-v1.5 (MA)</td><td>52.3±1.3</td><td>0.19±0.01</td></tr></table>
|
| 250 |
+
|
| 251 |
+
# E AVERAGE COST
|
| 252 |
+
|
| 253 |
+
We release the average cost of our framework and other methods against with employing human evaluators. In the Table 6, it is evident that the evaluator based on LLMs significantly reduces both time and financial expenditures. Although the ChatEval framework incurs higher costs than the SA and MA ensemble methods due to multiple inference rounds necessary for final judgment derivation, it remains more cost-effective than employing human evaluators. We consider this an acceptable trade-off for the benefits provided.
|
md/test/H4yQefeXhp/H4yQefeXhp.md
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DMV3D: DENOISING MULTI-VIEW DIFFUSION USING3D LARGE RECONSTRUCTION MODEL
|
| 2 |
+
|
| 3 |
+
Yinghao $\mathbf { X } \mathbf { u } ^ { 1 , 2 * }$ Hao Tan1 Fujun Luan1 Sai $\mathbf { B _ { i } ^ { \bullet 1 } }$ Peng Wang1,3 Jiahao $\mathbf { L i } ^ { 1 , 5 }$ Zifan Shi1,4 Kalyan Sunkavalli1 Gordon Wetzstein2 Zexiang $\mathbf { X } \mathbf { u } ^ { \mathrm { { 1 \dag } } }$ Kai Zhang1† 1Adobe Research 2Stanford 3HKU 4HKUST 5TTIC
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We propose DMV3D, a novel 3D generation approach that uses a transformerbased 3D large reconstruction model to denoise multi-view diffusion. Our reconstruction model incorporates a triplane NeRF representation and can denoise noisy multi-view images via NeRF reconstruction and rendering, achieving singlestage 3D generation in ${ \sim } 3 0 \mathrm { s }$ on single A100 GPU. We train DMV3D on largescale multi-view image datasets of highly diverse objects using only image reconstruction losses, without accessing 3D assets. We demonstrate state-ofthe-art results for the single-image reconstruction problem where probabilistic modeling of unseen object parts is required for generating diverse reconstructions with sharp textures. We also show high-quality text-to-3D generation results outperforming previous 3D diffusion models. Our project website is at: https: //justimyhxu.github.io/projects/dmv3d/.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
The advancements in 2D diffusion models (Ho et al., 2020; Song et al., 2020a; Rombach et al., 2022a) have greatly simplified the image content creation process and revolutionized 2D design workflows. Recently, diffusion models have also been extended to 3D asset creation in order to reduce the manual workload involved for applications like VR, AR, robotics, and gaming. In particular, many works have explored using pre-trained 2D diffusion models for generating NeRFs (Mildenhall et al., 2020) with score distillation sampling (SDS) loss (Poole et al., 2022; Lin et al., 2023a). However, SDS-based methods require long (often hours of) per-asset optimization and can frequently lead to geometry artifacts, such as the multi-face Janus problem.
|
| 12 |
+
|
| 13 |
+
On the other hand, attempts to train 3D diffusion models have also been made to enable diverse 3D asset generation without time-consuming per-asset optimization (Nichol et al., 2022; Jun & Nichol, 2023). These methods typically require access to ground-truth 3D models/point clouds for training, which are hard to obtain for real images. Besides, the latent 3D diffusion approach (Jun & Nichol, 2023) often leads to an unclean and hard-to-denoise latent space (Chen et al., 2023b) on highly diverse category-free 3D datasets due to two-stage training, making high-quality rendering a challenge. To circumvent this, single-stage models have been proposed (Anciukevicius et al. ˇ , 2023; Karnewar et al., 2023), but are mostly category-specific and focus on simple classes.
|
| 14 |
+
|
| 15 |
+
Our goal is to achieve fast, realistic, and generic 3D generation. To this end, we propose DMV3D, a novel single-stage category-agnostic diffusion model that can generate 3D (triplane) NeRFs from text or single-image input conditions via direct model inference. Our model allows for the generation of diverse high-fidelity 3D objects within 30 seconds per asset (see Fig. 1). In particular, DMV3D is a 2D multi-view image diffusion model that integrates 3D NeRF reconstruction and rendering into its denoiser, trained without direct 3D supervision, in an end-to-end manner. This avoids both separately training 3D NeRF encoders for latent-space diffusion (as in two-stage models) and tedious per-asset optimization (as in SDS methods).
|
| 16 |
+
|
| 17 |
+
In essence, our approach uses a 3D reconstruction model as the 2D multi-view denoiser in a multiview diffusion framework. This is inspired by RenderDiffusion (Anciukevicius et al. ˇ , 2023) – achieving 3D generation through single-view diffusion. However, their single-view framework relies on category-specific priors and canonical poses and thus cannot easily be scaled up to generate arbitrary objects. In contrast, we consider a sparse set of four multi-view images that surround an object, adequately describing a 3D object without strong self-occlusions. This design choice is inspired by the observation that humans can easily imagine a complete 3D object from a few surrounding views with little uncertainty. However, utilizing such inputs essentially requires addressing the task of sparse-view 3D reconstruction – a long-standing problem and known to be highly challenging even without noise in the inputs.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Top left: our approach achieves fast 3D generation ${ \sim } 3 0 \mathrm { s }$ on A100 GPU) from text or single-image input; the latter one, combined with 2D segmentation methods (like SAM (Kirillov et al., 2023)), can reconstruct objects segmented from natural images. Bottom: as a probabilistic single-image-to-3D model, we can produce multiple reasonable 3D assets from the same image. Top right: we demonstrate a scene comprising diverse 3D objects generated by our models.
|
| 21 |
+
|
| 22 |
+
We address this by leveraging large transformer models that have been shown to be effective and scalable in solving various challenging problems (Jun & Nichol, 2023; Nichol et al., 2022; Hong et al., 2023; Brown et al., 2020; Shen et al., 2023). In particular, built upon the recent 3D Large Reconstruction Model (LRM) (Hong et al., 2023), we introduce a novel model for joint reconstruction and denoising. More specifically, our transformer model can, from a sparse set of noisy multi-view images, reconstruct a clean (noise-free) NeRF model that allows for rendering (denoised) images at arbitrary viewpoints. Our model is conditioned on the diffusion time step, designed to handle any noise levels in the diffusion process. It can thus be directly plugged as the multi-view image denoiser in an multi-view image diffusion framework.
|
| 23 |
+
|
| 24 |
+
We enable 3D generation conditioned on single images/texts. For image conditioning, we fix one of the sparse views as the noise-free input and denoise other views, similar to 2D image inpainting (Xie et al., 2023). We apply attention-based text conditioning and classifier-free guidance, commonly used in 2D diffusion models, to enable text-to-3D generation. We train our model on large-scale datasets consisting of both synthetic renderings from Objaverse (Deitke et al., 2023) and real captures from MVImgNet (Yu et al., 2023) with only image-space supervision. Our model achieves state-of-the-art results on single-image 3D reconstruction, outperforming prior SDS-based methods and 3D diffusion models. We also demonstrate high-quality text-to-3D results outperforming previous 3D diffusion models. In sum, our main contributions are:
|
| 25 |
+
|
| 26 |
+
• A novel single-stage diffusion framework that leverages multi-view 2D image diffusion model to achieve 3D generation;
|
| 27 |
+
• An LRM-based multi-view denoiser that can reconstruct noise-free triplane NeRFs from noisy multi-view images;
|
| 28 |
+
• A general probabilistic approach for high-quality text-to-3D generation and single-image reconstruction that uses fast direct model inference ( ${ \sim } 3 0 \mathrm { s }$ on single A100 GPU).
|
| 29 |
+
|
| 30 |
+
Our work offers a novel perspective to address 3D generation tasks, which bridges 2D and 3D generative models and unifies 3D reconstruction and generation. This opens up opportunities to build a foundation model for tackling a variety of 3D vision and graphics problems.
|
| 31 |
+
|
| 32 |
+

|
| 33 |
+
Figure 2: $\mathbf { S A M + D M V 3 D }$ . We can use SAM (Kirillov et al., 2023) to segment any objects from a real scene photo and reconstruct their 3D shape and appearance with our method, showcasing our model’s potential in enabling 3D-aware image editing experiences.
|
| 34 |
+
|
| 35 |
+
# 2 RELATED WORK
|
| 36 |
+
|
| 37 |
+
Sparse-view Reconstruction. Neural representations (Mescheder et al., 2019; Park et al., 2019; Mildenhall et al., 2020; Sitzmann et al., 2019; 2020; Chen et al., 2022; Muller et al. ¨ , 2022) offer a promising platform for scene representation and neural rendering (Tewari et al., 2022). Applied to novel-view synthesis, these approaches have been successful in single-scene overfitting scenarios where lots of multi-view training images are available. Recent efforts (Yu et al., 2021; Chen et al., 2021; Long et al., 2022; Wang et al., 2021; Lin et al., 2023b; Jain et al., 2021) have extended these ideas to operate with a sparse set of views, showcasing improved generalization capabilities to unseen scenes. As non-generative methods, these approaches struggle on covering the multiple modes in the large-scale datasets and thus can not generate diverse realistic results. In particular, the recently-proposed LRM (Hong et al., 2023) tackles the inherent ambiguous single-image-to-3D problem in a deterministic way, resulting in blurry and washed-out textures for unseen part of the objects due to mode averaging. We resolve this issue by building a probabilistic image-conditioned 3D generation model through denosing multi-view diffusion.
|
| 38 |
+
|
| 39 |
+
3D Generative Adversarial Networks (GANs). GANs have made remarkable advancements in 2D image synthesis (Brock et al., 2018; Karras et al., 2018; 2019; 2020; 2021). 3D GANs (NguyenPhuoc et al., 2019; Schwarz et al., 2020; Chan et al., 2021; 2022; Niemeyer & Geiger, 2021; Gu et al., 2021; Skorokhodov et al., 2022; Xu et al., 2022; 2023; Shi et al., 2022; Gao et al., 2022; Skorokhodov et al., 2023) extend these capabilities to generating 3D-aware assets from unstructured collections of single-view 2D images in an unsupervised manner. GAN architectures, however, are difficult to train and generally best suited for modeling datasets of limited scale and diversity (Dhariwal & Nichol, 2021).
|
| 40 |
+
|
| 41 |
+
3D-aware Diffusion Models (DMs). DMs have emerged as foundation models for visual computing, offering unprecedented quality, fine-grained control, and versatility for 2D image generation (Ho et al., 2020; Song et al., 2020b; Rombach et al., 2022a; Po et al., 2023). Several strategies have been proposed to extend DMs to the 3D domain. Some of these approaches (Nichol et al., 2022; Jun & Nichol, 2023; Shue et al., 2023; Gupta et al., 2023; Ntavelis et al., 2023) use direct 3D supervision. The quality and diversity of their results, however, is far from that achieved by 2D DMs. This is partly due to the computational challenge of scaling diffusion network models up from 2D to 3D, but perhaps more so by the limited amount of available 3D training data. Other approaches in this category build on optimization using a differentiable 3D scene representation along with the priors encoded in 2D DMs (Poole et al., 2022; Lin et al., 2023a; Wang et al., 2022; 2023). While showing some success, the quality and diversity of their results is limited by the SDS–based loss function (Poole et al., 2022). Another class of methods uses 2D DM–based imageto-image translation using view conditioning (Liu et al., 2023b; Chan et al., 2023; Gu et al., 2023). While these approaches promote multi-view consistency, they do not enforce it, leading to flicker and other view-inconsistent effects. Finally, several recent works have shown success in training 3D diffusion models directly on single-view or multi-view image datasets (Karnewar et al., 2023; Chen et al., 2023b; Shen et al., 2023) for relatively simple scenes with limited diversity.
|
| 42 |
+
|
| 43 |
+
Prior RenderDiffusion (Anciukevicius et al.ˇ , 2023) and concurrent Viewset Diffusion (Szymanowicz et al., 2023) work are closest to our method. Both solve the 3D generation problem using 2D DMs with 3D-aware denoisers. Neither of these methods, however, has been demonstrated to work on highly diverse datasets containing multi-view data of $> 1 { \mathbf { M } }$ objects. Our novel LRM-based (Hong et al., 2023) 3D denoiser architecture overcomes this challenge and enables state-of-the-art results for scalable, diverse, and high-quality 3D generation.
|
| 44 |
+
|
| 45 |
+

|
| 46 |
+
Figure 3: Overview of our method. We denoise multiple views (three shown in the figure to reduce clutterness; four used in experiments) for 3D generation. Our multi-view denoiser is a large transformer model that reconstructs a noise-free triplane NeRF from input noisy images with camera poses (parameterized by Plucker rays). During training, we supervise the triplane NeRF with a rendering loss at input and novel viewpoints. During inference, we render denoised images at input viewpoints and combine them with inputs to obtain less noisy inputs for the next denoising step. We output the clean triplane NeRF at final denoising step, enabling 3D generation. Refer to Sec. 3.3 for how to extend this model to condition on single image or text.
|
| 47 |
+
|
| 48 |
+
# 3 METHOD
|
| 49 |
+
|
| 50 |
+
We now present our single-stage 3D diffusion model. In particular, we introduce a novel diffusion framework that uses a reconstruction-based denoiser to denoise noisy multi-view images for 3D generation (Sec. 3.1). Based on this, we propose a novel LRM-based (Hong et al., 2023) multiview denoiser conditioning on diffusion time step to progressively denoise multi-view images via 3D NeRF reconstruction and rendering (Sec. 3.2). We further extend our model to support text and image conditioning, enabling controllable generation (Sec. 3.3).
|
| 51 |
+
|
| 52 |
+
# 3.1 MULTI-VIEW DIFFUSION AND DENOISING
|
| 53 |
+
|
| 54 |
+
Diffusion. Denoising Diffusion Probabilistic Models (DDPM) transforms the data distribution $\mathbf { { x } } _ { 0 } \sim \mathbf { { \mu } }$ $q ( { \pmb x } )$ using a Gaussian noise schedule in the forward diffusion process. The generation process is the reverse process where images are gradually denoised. The diffused data sample √ √ $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ at timestep $t$ can be written as $\pmb { x } _ { t } = \sqrt { \bar { \alpha } _ { t } } \pmb { x } _ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon$ , where $\epsilon \sim \mathcal { N } ( 0 , \mathbf { I } )$ represents Gaussian noise and the monotonically decreasing $\bar { \alpha } _ { t }$ controls the Signal-Noise-Ratio (SNR) of noisy sample $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ .
|
| 55 |
+
|
| 56 |
+
Multi-view diffusion. The original $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ distribution addressed in 2D DMs is the (single) image distribution in a dataset. We instead consider the (joint) distribution of multi-view images $\mathcal { I } ~ = ~ \{ \mathbf { I } _ { 1 } , . . . , \mathbf { I } _ { N } \}$ , where each set of $\mathcal { T }$ are image observations of the same 3D scene (asset) from viewpoints $\dot { \mathcal { C } } = \{ c _ { 1 } , . . . , c _ { N } \}$ . The diffusion process is equivalent to diffusing each image independently with the same noise schedule:
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
\mathcal { T } _ { t } = \{ \sqrt { \bar { \alpha } _ { t } } \mathbf { I } + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon _ { \mathbf { I } } \vert \mathbf { I } \in \mathcal { I } \}
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
Note that this diffusion process is identical to the original one in DDPM, despite that we consider a specific type of data distribution $\mathbf { \boldsymbol { x } } = \mathcal { T }$ denoting per-object 2D multi-view images.
|
| 63 |
+
|
| 64 |
+
Reconstruction-based denoising. The reverse of the 2D diffusion process is essentially denoising. In this work, we propose to leverage 3D reconstruction and rendering to achieve 2D multi-view image denoising, while outputting a clean 3D model for 3D generation. In particular, we leverage a 3D reconstruction module $\operatorname { E } ( \cdot )$ to reconstruct a 3D representation S from the noisy multi-view images $\mathcal { T } _ { t }$ , and render denoised images with a differentiable rendering module $\operatorname { R } ( \cdot )$ :
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
{ \bf I } _ { r , t } = \mathrm { R } ( \mathrm { S } _ { t } , c ) , \quad \mathrm { S } _ { t } = \mathrm { E } ( \mathcal { T } _ { t } , t , \mathcal { C } )
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
where $\mathbf { I } _ { \boldsymbol { r } , t }$ represents a rendered image from $\mathrm { S } _ { t }$ at a specific viewpoint $^ c$ .
|
| 71 |
+
|
| 72 |
+
Denoising the multi-view input $\mathcal { T } _ { t }$ is done by rendering $\mathrm { S } _ { t }$ at the viewpoints $\mathcal { C }$ , leading to the prediction of noise-free $\mathcal { T } _ { 0 }$ . This is equivalent to $\scriptstyle { \pmb x } _ { 0 }$ prediction in 2D DMs (Song et al., 2020a);
|
| 73 |
+
|
| 74 |
+
one can solve for ${ \mathbf { \Delta x } } _ { t - 1 }$ from the input $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ and prediction $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ to enable progressive denoising during inference. However, unlike pure 2D generation, we find only supervising $\mathcal { T } _ { 0 }$ prediction at input viewpoints cannot guarantee high-quality 3D generation (see Tab. 3), often leading to degenerate 3D solutions where input images are pasted on view-aligned planes. Therefore, we propose to supervise novel-view renderings from the 3D model $\mathrm { S } _ { t }$ as well, which leads to the following training objective:
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
\mathrm { L } _ { r e c o n } ( t ) = \mathbb { E } _ { \mathbf { I } , \mathbf { c } \sim \mathbb { Z } _ { f u l l } , \mathcal { C } _ { f u l l } } \ell \big ( \mathbf { I } , \mathrm { R } ( \mathrm { E } ( \mathcal { T } _ { t } , t , \mathcal { C } ) , \mathbf { c } ) \big )
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
where $\mathcal { T } _ { f u l l }$ and $\mathcal { C } _ { f u l l }$ represent the full set of images and poses (from both randomly selected input and novel views), and $\ell ( \cdot , \cdot )$ is an image reconstruction loss penalizing the difference between groundtruth I and rendering $\mathrm { R } ( \mathrm { E } ( \mathcal { T } _ { t } , t , \mathcal { C } ) , c )$ . Note that our framework is general – potentially any 3D representations (S) can be applied. In this work, we consider a (triplane) NeRF (Chan et al., 2022) representation (where $\operatorname { R } ( \cdot )$ becomes neural volumetric rendering (Mildenhall et al., 2020)) and propose a LRM-based reconstructor $\operatorname { E } ( \cdot )$ (Hong et al., 2023).
|
| 81 |
+
|
| 82 |
+
# 3.2 RECONSTRUCTOR-BASED MULTI-VIEW DENOISER
|
| 83 |
+
|
| 84 |
+
We build our multi-view denoiser upon LRM (Hong et al., 2023) and uses large transformer model to reconstruct a clean triplane NeRF (Chan et al., 2022) from noisy sparse-view posed images. Renderings from the reconstructed triplane NeRF are then used as denoising outputs.
|
| 85 |
+
|
| 86 |
+
Reconstruction and Rendering. As shown in Fig. 3, we use a Vision Transformer (DINO (Caron et al., 2021)) to convert input images $\mathcal { T } = \{ \mathbf { I } _ { 1 } , . . . , \mathbf { I } _ { N } \}$ to 2D tokens, and then use a transformer to map a learnable triplane positional embedding to the final triplane representing the 3D shape and appearance of an asset; the predicted triplane is then used to decode volume density and color with an MLP (not shown in Fig. 3 to avoid clutterness) for differentiable volume rendering. The transformer model consists of a series of triplane-to-images cross-attention and triplane-to-triplane self-attention layers as in the LRM work (Hong et al., 2023). We further enable time conditioning for diffusion-based progressive denoising and introduce a new technique for camera conditioning.
|
| 87 |
+
|
| 88 |
+
Time Conditioning. Our transformer-based model requires different designs for time-conditioning, compared to CNN-based DDPM (Ho et al., 2020). Inspired by DiT (Peebles & Xie, 2022), we condition on time by injecting the adaLN-Zero block (Ho et al., 2020) into the self- and crossattention layers of our model to effectively handle inputs with different noise levels.
|
| 89 |
+
|
| 90 |
+
Camera Conditioning. Training our model on datasets with highly diverse camera intrinsics and extrinsics, e.g., MVImgNet (Yu et al., 2023), requires an effective design of input camera conditioning to facilitate the model’s understanding of cameras for 3D reasoning. A basic strategy is, as in the case of time conditioning, to use adaLN-Zero block (Peebles & Xie, 2022) on the camera parameters (as done in Hong et al. (2023); Li et al. (2023)). However, we find that conditioning on camera and time simultaneously with the same strategy tends to weaken the effects of these two conditions and often leads to an unstable training process and slow convergence. Instead, we propose a novel approach – parameterizing cameras with sets of pixel-aligned rays. In particular, following Sitzmann et al. (2021); Chen et al. (2023a), we parameterize rays using Plucker coordinates as $\pmb { r } = ( \pmb { o } \times \pmb { d } , \pmb { d } )$ , where $^ o$ and $^ d$ are the origin and direction of a pixel ray computed from the camera parameters, and $\times$ denotes cross-product. We concatenate the Plucker coordinates with image pixels, and send them to the ViT transformer for 2D image tokenization, achieving effective camera conditioning.
|
| 91 |
+
|
| 92 |
+
# 3.3 CONDITIONING ON SINGLE IMAGE OR TEXT
|
| 93 |
+
|
| 94 |
+
The methods described thus far enable our model to function as an unconditional generative model. We now introduce how to model the conditional probabilistic distribution with a conditional denoiser $\mathrm { E } ( \mathcal { T } _ { t } , t , \mathcal { C } , y )$ , where $y$ is text or image, enabling controllable 3D generation.
|
| 95 |
+
|
| 96 |
+
Image Conditioning. We propose a simple but effective image-conditioning strategy that requires no changes to our model architecture. We keep the first view ${ \bf I } _ { 1 }$ (in the denoiser input) noise-free to serve as the conditioning image, while applying diffusion and denoising on other views. In this case, the denoiser essentially learns to fill in the missing pixels within the noisy unseen views using cues extracted from the first input view, similar to the task of image inpainting which has been shown to be addressable by 2D DMs (Rombach et al., 2022a). In addition, to improve the generalizability of our image-conditioned model, we generate triplanes in a coordinate frame aligned with the conditioning view and render other images using poses relative to the conditioning one. We normalize the input view’s pose in the same way as LRM (Hong et al., 2023) during training, and specify the input view’s pose in the same way too during inference.
|
| 97 |
+
|
| 98 |
+
Text Conditioning. To add text conditioning into our model, we adopt a strategy similar to that presented in Stable Diffusion (Rombach et al., 2022a). We use the CLIP text encoder (Radford et al., 2021) to generate text embeddings and inject them into our denoiser using cross-attention. Specifically, we include an additional cross-attention layer after each self-attention block in the ViT and each cross-attention block in the triplane decoder.
|
| 99 |
+
|
| 100 |
+
# 3.4 TRAINING AND INFERENCE
|
| 101 |
+
|
| 102 |
+
Training. During the training phase, we uniformly sample time steps $t$ within the range $[ 1 , T ]$ , and add noise according to a cosine schedule. We sample input images with random camera poses. We also randomly sample additional novel viewpoints to supervise the renderings (as discussed in Sec. 3.1) for better quality. We minimize the following training objective with conditional signal $y$ :
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
\mathrm { L } = \mathbb { E } _ { t \sim U [ 1 , T ] , ( \mathbf { I } , c ) \sim ( { \mathcal T } _ { f u l l } , { \mathcal C } _ { f u l l } ) } \ \ell \big ( \mathbf { I } , \mathrm { R } ( \mathrm { E } ( { \mathcal T } _ { t } , t , { \mathcal D } , y ) , c ) \big )
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
For the image reconstruction loss $\ell ( \cdot , \cdot )$ , we use a combination of L2 loss and LPIPS loss (Zhang et al., 2018), with loss weights being 1 and 2, respectively.
|
| 109 |
+
|
| 110 |
+
Inference. For inference, we select four viewpoints that uniformly surround the object in a circle to ensure a good coverage of the generated 3D assets. We fix the camera Field-of-Views to 50 degrees for the four views. Since we predict triplane NeRF aligned with the conditioning image’s camera frame, we also fix the conditioning image’s camera extrinsics to have identity orientation and $( 0 , - 2 , 0 )$ position, following the practice of LRM (Hong et al., 2023). We output the triplane NeRF from the final denoising step as the generated 3D model. We utilize DDIM (Song et al., 2020a) algorithm to improve the inference speed.
|
| 111 |
+
|
| 112 |
+
# 4 EXPERIMENTS
|
| 113 |
+
|
| 114 |
+
In this section, we present an extensive evaluation of our method. In particular, we briefly describe our experiment settings (Sec. 4.1), compare our results with previous works (Sec. 4.2), and show additional analysis and ablation studies (Sec. 4.3).
|
| 115 |
+
|
| 116 |
+
# 4.1 SETTINGS
|
| 117 |
+
|
| 118 |
+
Implementation details. We use AdamW optimizer to train our model with an initial learning rate of $\bar { 4 } e ^ { - 4 }$ . We also apply a warm-up of $3 K$ steps and a cosine decay on the learning rate. We train our denoiser with $2 5 6 \times 2 5 6$ input images and render $1 2 8 \times 1 2 8$ image crops for supervision. To save GPU memory for NeRF rendering, we use the deferred back-propagation technique (Zhang et al., 2022). Our final model is a large transformer with 44 attention layers (counting all the self- and cross-attention layers in the encoder and decoder) outputting $6 4 \times 6 4 \times 3$ triplanes with 32 channels. We use 128 NVIDIA A100 GPUs to train this model with a batch size of 8 per GPU for $1 0 0 K$ steps, taking about 7 days. Since the final model takes a lot of resources, it is impractical for us to evaluate the design choices with this large model for our ablation study. Therefore, we also train a small model that consists of 36 attention layers to conduct our ablation study. The small model is trained with 32 NVIDIA A100 GPUs for $2 0 0 K$ steps (4 days). Please refer to Tab. 6 in the appendix for an overview of the hyper-parameter settings.
|
| 119 |
+
|
| 120 |
+
Datasets. Our model requires only multi-view posed images to train. We use rendered multi-view images of $\mathrm { \sim } 7 3 0 \mathrm { k }$ objects from the Objaverse (Deitke et al., 2023) dataset. For each object, we render 32 images under uniform lighting at random viewpoints with a fixed $5 0 ^ { \circ }$ FOV, following the settings of LRM (Hong et al., 2023). To train our text-to-3D model, we use the object captions provided by Cap3D (Luo et al., 2023), which covers a subset of ${ \sim } 6 6 0 \mathrm { k }$ objects. For image-conditioned (single-view reconstruction) model, we combine the Objaverse data with additional real captures of ${ \sim } 2 2 0 \mathrm { k }$ objects from the MVImgNet (Yu et al., 2023) dataset, enhancing our model’s generalization to out-of-domain inputs (see Fig. 7). We preprocess the MVImgNet dataset in the same way as
|
| 121 |
+
|
| 122 |
+
Table 1: Evaluation Metrics of single-image 3D reconstruction on ABO and GSO datasets.
|
| 123 |
+
|
| 124 |
+
<table><tr><td colspan="7">ABO dataset</td><td colspan="4">GSO dataset</td></tr><tr><td></td><td>FID↓</td><td>CLIP ↑</td><td>PSNR ↑</td><td>LPIPS↓</td><td>CD←</td><td>FID↓</td><td>CLIP 个</td><td>PSNR↑</td><td>LPIPS↓</td><td>CD↓</td></tr><tr><td>Point-E</td><td>112.29</td><td>0.806</td><td>17.03</td><td>0.363</td><td>0.127</td><td>123.70</td><td>0.741</td><td>15.60</td><td>0.308</td><td>0.099</td></tr><tr><td>Shap-E</td><td>79.80</td><td>0.864</td><td>15.29</td><td>0.331</td><td>0.097</td><td>97.05</td><td>0.805</td><td>14.36</td><td>0.289</td><td>0.085</td></tr><tr><td>Zero-1-to-3</td><td>31.59</td><td>0.927</td><td>17.33</td><td>0.194</td><td>1</td><td>32.44</td><td>0.896</td><td>17.36</td><td>0.182</td><td>一</td></tr><tr><td>One-2-3-45</td><td>190.81</td><td>0.748</td><td>12.00</td><td>0.514</td><td>0.163</td><td>139.24</td><td>0.713</td><td>12.42</td><td>0.448</td><td>0.123</td></tr><tr><td>Magic123</td><td>34.93</td><td>0.928</td><td>18.47</td><td>0.180</td><td>0.136</td><td>34.06</td><td>0.901</td><td>18.68</td><td>0.159</td><td>0.113</td></tr><tr><td>Ours (S)</td><td>36.77</td><td>0.915</td><td>22.62</td><td>0.194</td><td>0.059</td><td>35.16</td><td>0.888</td><td>21.80</td><td>0.150</td><td>0.046</td></tr><tr><td>Ours</td><td>27.88</td><td>0.949</td><td>24.15</td><td>0.127</td><td>0.046</td><td>30.01</td><td>0.928</td><td>22.57</td><td>0.126</td><td>0.040</td></tr></table>
|
| 125 |
+
|
| 126 |
+

|
| 127 |
+
Figure 4: Qualitative comparisons on single-image reconstruction.
|
| 128 |
+
|
| 129 |
+
LRM (Hong et al., 2023): for each capture, we crop out the object of interest for all views, remove the background, and normalize the cameras to tightly fit the captured object into the box $[ - 1 , 1 ] ^ { 3 }$ . In general, these datasets contain a large variety of synthetic and real objects, allowing us to train a generic category-free 3D generative model.
|
| 130 |
+
|
| 131 |
+
We evaluate our image-conditioned model on novel synthetic datasets, including 100 objects from the Google Scanned Object (GSO) (Downs et al., 2022) and 100 objects from the Amazon Berkeley Object (ABO) (Collins et al., 2022) datasets. This allows for direct comparison of single-view reconstruction with the groundtruth. For each object, we select 20 views that uniformly cover an object from the upper hemisphere to compute metrics; we pick a slightly skewed side view as input.
|
| 132 |
+
|
| 133 |
+
# 4.2 RESULTS AND COMPARISONS
|
| 134 |
+
|
| 135 |
+
Single-image reconstruction. We compare our image-conditioned model with previous methods, including Point-E (Nichol et al., 2022), Shap-E (Jun & Nichol, 2023), Zero-1-to-3 (Liu et al., 2023b), One-2-3-45 (Liu et al., 2023a), and Magic123 (Qian et al., 2023), on single-image reconstruction. We evaluate the novel-view rendering quality from all methods using PSNR, LPIPS (Zhang et al., 2018), CLIP similarity score (Radford et al., 2021) and FID (Heusel et al., 2017), computed between the rendered and GT images. In addition, we also compute the Chamfer distance (CD) for geometry evaluation, for which we use marching cubes to extract meshes from NeRFs. Note that accurate quantitative evaluation of 3D generation remains a challenge in the field due to the generative nature of this problem; we use the most applicable metrics from earlier works to assess our model and baselines.
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
Figure 5: Qualitative comparisons on Text-to-3D.
|
| 139 |
+
|
| 140 |
+
Tab. 1 reports the quantitative results on the GSO and ABO testing sets respectively. Note that our models (even ours (S)) can outperforms all baseline methods, achieving the best scores across all metrics for both datasets. Our high generation quality is reflected by the qualitative results shown in Fig. 4; our model generates realistic results with higher-quality geometry and sharper appearance details than all baselines.
|
| 141 |
+
|
| 142 |
+
In particular, the two-stage 3D DMs, Shap-E (3D encoder $^ +$ latent diffusion) and Point-E (point diffusion $^ +$ points-to-SDF regression), lead to lower-quality 3D assets, often with incomplete shapes and blurry textures; this suggests the inherent difficulties in denoising 3D points or pretrained 3D latent spaces, a problem our model avoids. On the other hand, Zero-1-to-3 leads to better quantitative results than Shap-E and Point-E on appearnce, because it’s a 2D diffusion model finetuned from the pretrained Stable Diffusion (Rombach et al., 2022b) to generate novel-view images. However, Zero-1-to-3 alone cannot output a 3D model needed by many 3D applications and their rendered images suffer from severe inconsistency across viewpoints. This inconsistency also leads to the low reconstruction and rendering quality from One-2-3-45, which attempts to reconstruct meshes from Zero-1-to-3’s image outputs. On the other hand, the per-asset optimization-based method Magic123 can achieve rendering quality comparable to Zero-1-to-3 while offering a 3D mdoel. However, these methods require long (hours of) optimization time and also often suffer from unrealistic Janus artifacts (see the high heels object in Fig. 4). In contrast, our approach is a single-stage model with 2D image training objectives and directly generates a 3D NeRF model (without per-asset optimization) while denoising multi-view diffusion. Our scalable model learns strong data priors from massive training data and produces realistic 3D assets without Janus artifacts. In general, our approach leads to fast 3D generation and state-of-the-art single-image 3D reconstruction results.
|
| 143 |
+
|
| 144 |
+
Text-to-3D. We also evaluate our text-to-3D generation results and compare with 3D diffusion models Shap-E (Jun & Nichol, 2023) and Point-E (Nichol et al., 2022), that are also category-agnostic and support fast direct inference. For this experiment, we use Shap-E’s 50 text prompts for the generation, and evaluate the results with CLIP precisions (Jain et al., 2022) and averaged precision using two different ViT models, shown in Tab. 2. From the table, we can see that our model achieves the best precision. We also show qualitative results in Fig. 5, in which our results clearly contain more geometry and appearance details and look more realistic than the compared ones.
|
| 145 |
+
|
| 146 |
+
Table 2: Evaluation Metrics on Text-to-3D.
|
| 147 |
+
|
| 148 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">VIT-B/32</td><td colspan="2">ViT-L/14</td></tr><tr><td>R-Prec</td><td>AP</td><td>R-Prec</td><td>AP</td></tr><tr><td>Point-E</td><td>33.33</td><td>40.06</td><td>46.4</td><td>54.13</td></tr><tr><td>Shap-E</td><td>38.39</td><td>46.02</td><td>51.40</td><td>58.03</td></tr><tr><td>Ours</td><td>39.72</td><td>47.96</td><td>55.14</td><td>61.32</td></tr></table>
|
| 149 |
+
|
| 150 |
+
# 4.3 ANALYSIS, ABLATION, AND APPLICATION
|
| 151 |
+
|
| 152 |
+
We analyze our image-conditioned model and verify our design choices using our small model architecture for better energy efficiency. Refer to Tab. 6 in the appendix for an overview of the hyper-parameter settings for this small model.
|
| 153 |
+
|
| 154 |
+
Table 3: Ablation on GSO dataset (DMV3D-S).
|
| 155 |
+
|
| 156 |
+

|
| 157 |
+
Figure 6: Robustness to out-of-domain inputs: synthetic (top left), real (bottom left, top right), and generated images (bottom right).
|
| 158 |
+
|
| 159 |
+
#Views. We show quantitative and qualitative comparisons of our models trained with different numbers (1, 2, 4, 6) of input views in Tab. 3 and Fig. 8. We can see that our model consistently achieves better quality when using more images, benefiting from capturing more shape and appearance information. However, the performance improvement of 6 views over four views is marginal, where some metrics (like PSNR, FID) from the 4-view model is even better. We therefore use four views as the default setting to generate all of our main results.
|
| 160 |
+
|
| 161 |
+
Multiple instance generation. Similar to other DMs, our model can generate various instances from the same input image with different random seeds as shown in Fig. 1, demonstrating the diversity of our generation results. In general, we find the multiple instance results can all reproduce the frontal input view while containing varying shape and appearance in the unseen back side.
|
| 162 |
+
|
| 163 |
+
Input sources. Our model is category-agnostic and generally works on various input sources as shown in many previous figures (Fig. 1,2,4). We show additional results in Fig. 6 with various inputs out of our training domains, including synthetic renderings, real captures, and generated images. Our method can robustly reconstruct the geometry and appearance of all cases.
|
| 164 |
+
|
| 165 |
+
Ablation of MVImgNet. We compare our models trained with and without the real MVImgNet dataset on two challenging examples. As shown in Fig. 7, we can see that the model without MVImgNet can lead to unrealistic flat shapes, showcasing the importance of diverse training data.
|
| 166 |
+
|
| 167 |
+
Ablations of novel-view supervision and Plucker rays. We compare with our ablated models including one trained without the novel-view supervision, and one without the Plucker ray conditioning (using the adaLN-Zero block conditioning instead). We can also see that the novel view rendering supervision is critical for our model. Without it, all quantitative scores drop by a large margin due to that the model cheats by pasting the input images on view-aligned planes instead of reconstructing plausible 3D shapes. In addition, our design of Plucker coordinate-based camera conditioning is also effective, leading to better quantitative results than the ablated model.
|
| 168 |
+
|
| 169 |
+
Application. The flexibility and generality of our method can potentially enable broad 3D applications. One useful image editing application is to lift any objects in a 2D photo to 3D by segment them (using methods like SAM (Kirillov et al., 2023)) and reconstruct the 3D model with our method, as shown in Fig. 1 and 2.
|
| 170 |
+
|
| 171 |
+
# 5 CONCLUSION
|
| 172 |
+
|
| 173 |
+
We present a novel single-stage diffusion model for 3D generation which generates 3D assets by denoising multi-view image diffusion. Our multi-view denoiser is based on a large transformer model (Hong et al., 2023), which takes noisy multi-view images to reconstruct a clean triplane NeRF, outputting denoised images through volume rendering. Our framework supports text- and image-conditioning inputs, achieving fast 3D generation via direct diffusion inference without perasset optimization. Our method outperforms previous 3D diffusion models for text-to-3D generation and achieves state-of-the-art quality on single-view reconstruction on various testing datasets.
|
| 174 |
+
|
| 175 |
+
Ethics Statement. Our generative model is trained on the Objaverse data and MVImgNet data. The dataset (about 1M) is smaller than the dataset in training 2D diffusion models (about 100M to 1000M). The lack of data can raise two considerations. First, it can possibly bias towards the training data distribution. Secondly, it might not be powerful enough to cover all the vast diversity in testing images and testing texts. Our model has certain generalization ability but might not cover as much modes as the 2D diffusion model can. Given that our model does not have the ability to identify the content that is out of its knowledge, it might introduce unsatisfying user experience. Also, our model can possibly leak the training data if the text prompt or image input highly align with some data samples. This potential leakage raises legal and security considerations, and is shared among all generative models (such as LLM and 2D diffusion models).
|
| 176 |
+
|
| 177 |
+
Reproducibility Statement. We provide detailed implementation of our training method in the main text and also provide the model configurations in Table 6 of the appendix. We will help resolve uncertainty of our implementation in open discussions.
|
| 178 |
+
|
| 179 |
+
Acknowledgement. We would like to thank Nathan Carr, Duygu Ceylan, Paul Guerrero, ChunHao Huang, and Niloy Mitra for discussions about this project. We also thank Yuan Liu for providing testing images from Syncdreamer.
|
| 180 |
+
|
| 181 |
+
# REFERENCES
|
| 182 |
+
|
| 183 |
+
Titas Anciukevicius, Zexiang Xu, Matthew Fisher, Paul Henderson, Hakan Bilen, Niloy J Mitra, and ˇ Paul Guerrero. Renderdiffusion: Image diffusion for 3d reconstruction, inpainting and generation. In IEEE Conf. Comput. Vis. Pattern Recog., 2023.
|
| 184 |
+
Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale gan training for high fidelity natural image synthesis. arXiv preprint arXiv:1809.11096, 2018.
|
| 185 |
+
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, 2020.
|
| 186 |
+
Mathilde Caron, Hugo Touvron, Ishan Misra, Herve J ´ egou, Julien Mairal, Piotr Bojanowski, and ´ Armand Joulin. Emerging properties in self-supervised vision transformers. In Proceedings of the International Conference on Computer Vision (ICCV), 2021.
|
| 187 |
+
Eric R Chan, Marco Monteiro, Petr Kellnhofer, Jiajun Wu, and Gordon Wetzstein. pi-gan: Periodic implicit generative adversarial networks for 3d-aware image synthesis. In IEEE Conf. Comput. Vis. Pattern Recog., 2021.
|
| 188 |
+
Eric R Chan, Connor Z Lin, Matthew A Chan, Koki Nagano, Boxiao Pan, Shalini De Mello, Orazio Gallo, Leonidas J Guibas, Jonathan Tremblay, Sameh Khamis, et al. Efficient geometry-aware 3d generative adversarial networks. In IEEE Conf. Comput. Vis. Pattern Recog., 2022.
|
| 189 |
+
Eric R Chan, Koki Nagano, Matthew A Chan, Alexander W Bergman, Jeong Joon Park, Axel Levy, Miika Aittala, Shalini De Mello, Tero Karras, and Gordon Wetzstein. Generative novel view synthesis with 3d-aware diffusion models. Int. Conf. Comput. Vis., 2023.
|
| 190 |
+
Anpei Chen, Zexiang Xu, Fuqiang Zhao, Xiaoshuai Zhang, Fanbo Xiang, Jingyi Yu, and Hao Su. Mvsnerf: Fast generalizable radiance field reconstruction from multi-view stereo. In Int. Conf. Comput. Vis., 2021.
|
| 191 |
+
Anpei Chen, Zexiang Xu, Andreas Geiger, Jingyi Yu, and Hao Su. Tensorf: Tensorial radiance fields. In European Conference on Computer Vision (ECCV), 2022.
|
| 192 |
+
Eric Ming Chen, Sidhanth Holalkere, Ruyu Yan, Kai Zhang, and Abe Davis. Ray conditioning: Trading photo-realism for photo-consistency in multi-view image generation. In Int. Conf. Comput. Vis., 2023a.
|
| 193 |
+
Hansheng Chen, Jiatao Gu, Anpei Chen, Wei Tian, Zhuowen Tu, Lingjie Liu, and Hao Su. Singlestage diffusion nerf: A unified approach to 3d generation and reconstruction. arXiv preprint arXiv:2304.06714, 2023b.
|
| 194 |
+
Jasmine Collins, Shubham Goel, Kenan Deng, Achleshwar Luthra, Leon Xu, Erhan Gundogdu, Xi Zhang, Tomas F Yago Vicente, Thomas Dideriksen, Himanshu Arora, et al. Abo: Dataset and benchmarks for real-world 3d object understanding. In IEEE Conf. Comput. Vis. Pattern Recog., pp. 21126–21136, 2022.
|
| 195 |
+
Matt Deitke, Dustin Schwenk, Jordi Salvador, Luca Weihs, Oscar Michel, Eli VanderBilt, Ludwig Schmidt, Kiana Ehsani, Aniruddha Kembhavi, and Ali Farhadi. Objaverse: A universe of annotated 3d objects. In IEEE Conf. Comput. Vis. Pattern Recog., pp. 13142–13153, 2023.
|
| 196 |
+
Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in neural information processing systems, 34:8780–8794, 2021.
|
| 197 |
+
Laura Downs, Anthony Francis, Nate Koenig, Brandon Kinman, Ryan Hickman, Krista Reymann, Thomas B McHugh, and Vincent Vanhoucke. Google scanned objects: A high-quality dataset of 3d scanned household items. In 2022 International Conference on Robotics and Automation (ICRA), pp. 2553–2560. IEEE, 2022.
|
| 198 |
+
Jun Gao, Tianchang Shen, Zian Wang, Wenzheng Chen, Kangxue Yin, Daiqing Li, Or Litany, Zan Gojcic, and Sanja Fidler. Get3d: A generative model of high quality 3d textured shapes learned from images. Adv. Neural Inform. Process. Syst., 2022.
|
| 199 |
+
Jiatao Gu, Lingjie Liu, Peng Wang, and Christian Theobalt. Stylenerf: A style-based 3d-aware generator for high-resolution image synthesis. arXiv preprint arXiv:2110.08985, 2021.
|
| 200 |
+
Jiatao Gu, Alex Trevithick, Kai-En Lin, Joshua M Susskind, Christian Theobalt, Lingjie Liu, and Ravi Ramamoorthi. Nerfdiff: Single-image view synthesis with nerf-guided distillation from 3d-aware diffusion. In Int. Conf. Mach. Learn., 2023.
|
| 201 |
+
Anchit Gupta, Wenhan Xiong, Yixin Nie, Ian Jones, and Barlas Oguz. 3dgen: Triplane latent ˘ diffusion for textured mesh generation. arXiv preprint arXiv:2303.05371, 2023.
|
| 202 |
+
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. In Adv. Neural Inform. Process. Syst., 2017.
|
| 203 |
+
Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598, 2022.
|
| 204 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Adv. Neural Inform. Process. Syst., 2020.
|
| 205 |
+
Yicong Hong, Kai Zhang, Jiuxiang Gu, Sai Bi, Yang Zhou, Difan Liu, Feng Liu, Kalyan Sunkavalli, Trung Bui, and Hao Tan. Lrm: Large reconstruction model for single image to 3d. arXiv preprint arXiv:2311.04400, 2023.
|
| 206 |
+
Ajay Jain, Matthew Tancik, and Pieter Abbeel. Putting nerf on a diet: Semantically consistent few-shot view synthesis. In Int. Conf. Comput. Vis., 2021.
|
| 207 |
+
Ajay Jain, Ben Mildenhall, Jonathan T. Barron, Pieter Abbeel, and Ben Poole. Zero-shot text-guided object generation with dream fields. 2022.
|
| 208 |
+
Heewoo Jun and Alex Nichol. Shap-e: Generating conditional 3d implicit functions. arXiv preprint arXiv:2305.02463, 2023.
|
| 209 |
+
Animesh Karnewar, Andrea Vedaldi, David Novotny, and Niloy J Mitra. Holodiffusion: Training a 3d diffusion model using 2d images. In IEEE Conf. Comput. Vis. Pattern Recog., 2023.
|
| 210 |
+
Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. In Int. Conf. Learn. Represent., 2018.
|
| 211 |
+
Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In IEEE Conf. Comput. Vis. Pattern Recog., 2019.
|
| 212 |
+
|
| 213 |
+
Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of StyleGAN. In IEEE Conf. Comput. Vis. Pattern Recog., 2020.
|
| 214 |
+
Tero Karras, Miika Aittala, Samuli Laine, Erik Hark ¨ onen, Janne Hellsten, Jaakko Lehtinen, and ¨ Timo Aila. Alias-free generative adversarial networks. In Adv. Neural Inform. Process. Syst., 2021.
|
| 215 |
+
Alexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao, Chloe Rolland, Laura Gustafson, Tete Xiao, Spencer Whitehead, Alexander C Berg, Wan-Yen Lo, et al. Segment anything. arXiv preprint arXiv:2304.02643, 2023.
|
| 216 |
+
Jiahao Li, Hao Tan, Kai Zhang, Zexiang Xu, Fujun Luan, Yinghao Xu, Yicong Hong, Kalyan Sunkavalli, Greg Shakhnarovich, and Sai Bi. Instant3d: Fast text-to-3d with sparse-view generation and large reconstruction model. https://arxiv.org/abs/2311.06214, 2023.
|
| 217 |
+
Chen-Hsuan Lin, Jun Gao, Luming Tang, Towaki Takikawa, Xiaohui Zeng, Xun Huang, Karsten Kreis, Sanja Fidler, Ming-Yu Liu, and Tsung-Yi Lin. Magic3d: High-resolution text-to-3d content creation. In IEEE Conf. Comput. Vis. Pattern Recog., pp. 300–309, 2023a.
|
| 218 |
+
Kai-En Lin, Lin Yen-Chen, Wei-Sheng Lai, Tsung-Yi Lin, Yi-Chang Shih, and Ravi Ramamoorthi. Vision transformer for nerf-based view synthesis from a single input image. In IEEE Winter Conf. Appl. Comput. Vis., 2023b.
|
| 219 |
+
Minghua Liu, Chao Xu, Haian Jin, Linghao Chen, Mukund Varma T, Zexiang Xu, and Hao Su. One-2-3-45: Any single image to 3d mesh in 45 seconds without per-shape optimization, 2023a.
|
| 220 |
+
Ruoshi Liu, Rundi Wu, Basile Van Hoorick, Pavel Tokmakov, Sergey Zakharov, and Carl Vondrick. Zero-1-to-3: Zero-shot one image to 3d object. arXiv preprint arXiv:2303.11328, 2023b.
|
| 221 |
+
Xiaoxiao Long, Cheng Lin, Peng Wang, Taku Komura, and Wenping Wang. Sparseneus: Fast generalizable neural surface reconstruction from sparse views. 2022.
|
| 222 |
+
Tiange Luo, Chris Rockwell, Honglak Lee, and Justin Johnson. Scalable 3d captioning with pretrained models. arXiv preprint arXiv:2306.07279, 2023.
|
| 223 |
+
Lars Mescheder, Michael Oechsle, Michael Niemeyer, Sebastian Nowozin, and Andreas Geiger. Occupancy networks: Learning 3d reconstruction in function space. In IEEE Conf. Comput. Vis. Pattern Recog., 2019.
|
| 224 |
+
Ben Mildenhall, Pratul P Srinivasan, Matthew Tancik, Jonathan T Barron, Ravi Ramamoorthi, and Ren Ng. Nerf: Representing scenes as neural radiance fields for view synthesis. In Eur. Conf. Comput. Vis., 2020.
|
| 225 |
+
Thomas Muller, Alex Evans, Christoph Schied, and Alexander Keller. Instant neural graphics ¨ primitives with a multiresolution hash encoding. ACM Trans. Graph., 41(4):102:1–102:15, July 2022. doi: 10.1145/3528223.3530127. URL https://doi.org/10.1145/3528223. 3530127.
|
| 226 |
+
Thu Nguyen-Phuoc, Chuan Li, Lucas Theis, Christian Richardt, and Yong-Liang Yang. Hologan: Unsupervised learning of 3d representations from natural images. In Int. Conf. Comput. Vis., 2019.
|
| 227 |
+
Alex Nichol, Heewoo Jun, Prafulla Dhariwal, Pamela Mishkin, and Mark Chen. Point-e: A system for generating 3d point clouds from complex prompts. arXiv preprint arXiv:2212.08751, 2022.
|
| 228 |
+
Michael Niemeyer and Andreas Geiger. Giraffe: Representing scenes as compositional generative neural feature fields. In IEEE Conf. Comput. Vis. Pattern Recog., 2021.
|
| 229 |
+
Evangelos Ntavelis, Aliaksandr Siarohin, Kyle Olszewski, Chaoyang Wang, Luc Van Gool, and Sergey Tulyakov. Autodecoding latent 3d diffusion models. arXiv preprint arXiv:2307.05445, 2023.
|
| 230 |
+
|
| 231 |
+
Jeong Joon Park, Peter Florence, Julian Straub, Richard Newcombe, and Steven Lovegrove. Deepsdf: Learning continuous signed distance functions for shape representation. In IEEE Conf. Comput. Vis. Pattern Recog., 2019.
|
| 232 |
+
|
| 233 |
+
William Peebles and Saining Xie. Scalable diffusion models with transformers. arXiv preprint arXiv:2212.09748, 2022.
|
| 234 |
+
Ryan Po, Wang Yifan, Vladislav Golyanik, Kfir Aberman, Jonathan T Barron, Amit H Bermano, Eric Ryan Chan, Tali Dekel, Aleksander Holynski, Angjoo Kanazawa, et al. State of the art on diffusion models for visual computing. arXiv preprint arXiv:2310.07204, 2023.
|
| 235 |
+
Ben Poole, Ajay Jain, Jonathan T. Barron, and Ben Mildenhall. Dreamfusion: Text-to-3d using 2d diffusion. arXiv, 2022.
|
| 236 |
+
Guocheng Qian, Jinjie Mai, Abdullah Hamdi, Jian Ren, Aliaksandr Siarohin, Bing Li, HsinYing Lee, Ivan Skorokhodov, Peter Wonka, Sergey Tulyakov, et al. Magic123: One image to high-quality 3d object generation using both 2d and 3d diffusion priors. arXiv preprint arXiv:2306.17843, 2023.
|
| 237 |
+
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.
|
| 238 |
+
Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High- ¨ resolution image synthesis with latent diffusion models. In IEEE Conf. Comput. Vis. Pattern Recog., 2022a.
|
| 239 |
+
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, 2022b.
|
| 240 |
+
Katja Schwarz, Yiyi Liao, Michael Niemeyer, and Andreas Geiger. Graf: Generative radiance fields for 3d-aware image synthesis. In Adv. Neural Inform. Process. Syst., 2020.
|
| 241 |
+
Bokui Shen, Xinchen Yan, Charles R Qi, Mahyar Najibi, Boyang Deng, Leonidas Guibas, Yin Zhou, and Dragomir Anguelov. Gina-3d: Learning to generate implicit neural assets in the wild. In IEEE Conf. Comput. Vis. Pattern Recog., pp. 4913–4926, 2023.
|
| 242 |
+
Zifan Shi, Sida Peng, Yinghao Xu, Geiger Andreas, Yiyi Liao, and Yujun Shen. Deep generative models on 3d representations: A survey. arXiv preprint arXiv:2210.15663, 2022.
|
| 243 |
+
J. Ryan Shue, Eric Ryan Chan, Ryan Po, Zachary Ankner, Jiajun Wu, and Gordon Wetzstein. 3d neural field generation using triplane diffusion. In IEEE Conf. Comput. Vis. Pattern Recog., 2023.
|
| 244 |
+
Vincent Sitzmann, Michael Zollhofer, and Gordon Wetzstein. Scene representation networks: ¨ Continuous 3d-structure-aware neural scene representations. Advances in Neural Information Processing Systems, 32, 2019.
|
| 245 |
+
Vincent Sitzmann, Julien Martel, Alexander Bergman, David Lindell, and Gordon Wetzstein. Implicit neural representations with periodic activation functions. Advances in neural information processing systems, 33:7462–7473, 2020.
|
| 246 |
+
Vincent Sitzmann, Semon Rezchikov, Bill Freeman, Josh Tenenbaum, and Fredo Durand. Light field networks: Neural scene representations with single-evaluation rendering. Advances in Neural Information Processing Systems, 34:19313–19325, 2021.
|
| 247 |
+
Ivan Skorokhodov, Sergey Tulyakov, Yiqun Wang, and Peter Wonka. Epigraf: Rethinking training of 3d gans. In Adv. Neural Inform. Process. Syst., 2022.
|
| 248 |
+
Ivan Skorokhodov, Aliaksandr Siarohin, Yinghao Xu, Jian Ren, Hsin-Ying Lee, Peter Wonka, and Sergey Tulyakov. 3d generation on imagenet. In International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id $\bar { }$ U2WjB9xxZ9q.
|
| 249 |
+
Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020a.
|
| 250 |
+
Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. arXiv preprint arXiv:2011.13456, 2020b.
|
| 251 |
+
Stanislaw Szymanowicz, Christian Rupprecht, and Andrea Vedaldi. Viewset diffusion:(0-) imageconditioned 3d generative models from 2d data. arXiv preprint arXiv:2306.07881, 2023.
|
| 252 |
+
Ayush Tewari, Justus Thies, Ben Mildenhall, Pratul Srinivasan, Edgar Tretschk, Wang Yifan, Christoph Lassner, Vincent Sitzmann, Ricardo Martin-Brualla, Stephen Lombardi, et al. Advances in neural rendering. In Computer Graphics Forum, volume 41, pp. 703–735. Wiley Online Library, 2022.
|
| 253 |
+
Haochen Wang, Xiaodan Du, Jiahao Li, Raymond A. Yeh, and Greg Shakhnarovich. Score jacobian chaining: Lifting pretrained 2d diffusion models for 3d generation. arXiv preprint arXiv:2212.00774, 2022.
|
| 254 |
+
Qianqian Wang, Zhicheng Wang, Kyle Genova, Pratul P Srinivasan, Howard Zhou, Jonathan T Barron, Ricardo Martin-Brualla, Noah Snavely, and Thomas Funkhouser. Ibrnet: Learning multiview image-based rendering. In IEEE Conf. Comput. Vis. Pattern Recog., 2021.
|
| 255 |
+
Zhengyi Wang, Cheng Lu, Yikai Wang, Fan Bao, Chongxuan Li, Hang Su, and Jun Zhu. Prolificdreamer: High-fidelity and diverse text-to-3d generation with variational score distillation. arXiv preprint arXiv:2305.16213, 2023.
|
| 256 |
+
Shaoan Xie, Zhifei Zhang, Zhe Lin, Tobias Hinz, and Kun Zhang. Smartbrush: Text and shape guided object inpainting with diffusion model. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 22428–22437, 2023.
|
| 257 |
+
Yinghao Xu, Sida Peng, Ceyuan Yang, Yujun Shen, and Bolei Zhou. 3d-aware image synthesis via learning structural and textural representations. In IEEE Conf. Comput. Vis. Pattern Recog., 2022.
|
| 258 |
+
Yinghao Xu, Menglei Chai, Zifan Shi, Sida Peng, Ivan Skorokhodov, Aliaksandr Siarohin, Ceyuan Yang, Yujun Shen, Hsin-Ying Lee, Bolei Zhou, et al. Discoscene: Spatially disentangled generative radiance fields for controllable 3d-aware scene synthesis. In IEEE Conf. Comput. Vis. Pattern Recog., 2023.
|
| 259 |
+
Alex Yu, Vickie Ye, Matthew Tancik, and Angjoo Kanazawa. pixelnerf: Neural radiance fields from one or few images. In IEEE Conf. Comput. Vis. Pattern Recog., 2021.
|
| 260 |
+
Xianggang Yu, Mutian Xu, Yidan Zhang, Haolin Liu, Chongjie Ye, Yushuang Wu, Zizheng Yan, Chenming Zhu, Zhangyang Xiong, Tianyou Liang, et al. Mvimgnet: A large-scale dataset of multi-view images. In IEEE Conf. Comput. Vis. Pattern Recog., pp. 9150–9161, 2023.
|
| 261 |
+
Kai Zhang, Nick Kolkin, Sai Bi, Fujun Luan, Zexiang Xu, Eli Shechtman, and Noah Snavely. Arf: Artistic radiance fields, 2022.
|
| 262 |
+
Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In CVPR, 2018.
|
| 263 |
+
|
| 264 |
+
# A APPENDIX
|
| 265 |
+
|
| 266 |
+
# A.1 ROBUSTNESS EVALUATION.
|
| 267 |
+
|
| 268 |
+
We evaluate our model on GSO (Downs et al., 2022) renderings that use different camera Field-OfViews (FOVs) and lighting conditions to justify its robustness. Specifically, while the MVImgNet dataset include diverse camera FOVs and lighting conditions, the Objaverse renderings we are also trained on share a constant $5 0 ^ { \circ }$ FOV and uniform lighting. We evaluate the robustness of our imageconditioned model by testing images with other FOV angles and complex environmental lightings. As shown in Tab. 4, our model is relatively robust to the FOV of the captured images, though quality indeed drops when the actual FOV deviates more from the $5 0 ^ { \circ }$ FOV we assume during inference (see Sec. 3.4). However, it exhibits lower sensitivity to lighting variations, leading to similar quality across different lighting conditions. When the lighting is non-uniform, our model bakes the shading effects into the NeRF appearance, yielding plausible renderings.
|
| 269 |
+
|
| 270 |
+
Table 4: Robustness on GSO dataset.
|
| 271 |
+
|
| 272 |
+
<table><tr><td rowspan="2">Lighting/Fov</td><td colspan="5">Appearance</td><td>Geometry</td></tr><tr><td>FID↓</td><td>CLIP ↑</td><td>PSNR ↑</td><td>SSIM ↑</td><td>LPIPS ↓</td><td>CD↓</td></tr><tr><td>Ours</td><td>30.01</td><td>0.928</td><td>22.57</td><td>0.845</td><td>0.126</td><td>0.0395</td></tr><tr><td>Fov10</td><td>35.69</td><td>0.912</td><td>19.136</td><td>0.820</td><td>0.207</td><td>0.0665</td></tr><tr><td>Fov30</td><td>32.309</td><td>0.921</td><td>20.428</td><td>0.839</td><td>0.166</td><td>0.0527</td></tr><tr><td>Fov70</td><td>32.095</td><td>0.921</td><td>20.961</td><td>0.860</td><td>0.154</td><td>0.0616</td></tr><tr><td>Fov90</td><td>34.438</td><td>0.912</td><td>19.952</td><td>0.855</td><td>0.190</td><td>0.0754</td></tr><tr><td>city</td><td>33.31</td><td>0.916</td><td>21.19</td><td>0.831</td><td>0.142</td><td>0.0437</td></tr><tr><td>night</td><td>36.32</td><td>0.907</td><td>20.383</td><td>0.829</td><td>0.161</td><td>0.0413</td></tr><tr><td>sunrise</td><td>33.264</td><td>0.917</td><td>21.080</td><td>0.843</td><td>0.140</td><td>0.0423</td></tr><tr><td>studio</td><td>36.32</td><td>0.927</td><td>21.383</td><td>0.839</td><td>0.141</td><td>0.0428</td></tr></table>
|
| 273 |
+
|
| 274 |
+
# A.2 QUANTATIVE EVALUATION ON MVIMGNET.
|
| 275 |
+
|
| 276 |
+
MVImgNet (Yu et al., 2023) contains a diverse set of real data, which helps improve our generalization capabilities for real data or out-of-domain data, as demonstrated in Fig 7. We also perform quantative evaluation on the model with and without MVImgNet on the GSO dataset (Downs et al., 2022) in Tab. 5. The reconstructed results in terms of appearance and geometry are similar to the previous results only trained with Objaverse, indicating that MVImgNet improves generalization without compromising the quality of reconstruction. We train both settings for an equal number of 100K iterations with exactly the same learning rate schedules and computes.
|
| 277 |
+
|
| 278 |
+

|
| 279 |
+
Figure 7: Qualitative comparison of our model trained with and without MVImgNet.
|
| 280 |
+
|
| 281 |
+
Table 5: Ablation of MVImgNet.
|
| 282 |
+
|
| 283 |
+
<table><tr><td rowspan="2">#Views</td><td colspan="5">Appearance</td><td rowspan="2">Geometry</td></tr><tr><td>FID←</td><td>CLIP 个</td><td>PSNR ↑</td><td>SSIM个</td><td>LPIPS↓</td></tr><tr><td>w. MvImageNet</td><td>30.01</td><td>0.928</td><td>22.57</td><td>0.845</td><td>0.126</td><td>CD↓ 0.0395</td></tr><tr><td>w.o MvImageNet</td><td>27.76</td><td>0.924</td><td>21.85</td><td>0.850</td><td>0.128</td><td>0.0378</td></tr></table>
|
| 284 |
+
|
| 285 |
+
# A.3 IMPLEMENTATION DETAILS.
|
| 286 |
+
|
| 287 |
+
Our experiments are implemented in the PyTorch and the codebase is built upon guided diffusion (Dhariwal & Nichol, 2021). For the AdamW optimizer, we use a weight-decay 0.05 and beta (0.9, 0.95). Table 6 presents the detailed configuration of our various image-conditioned models. The architecture of the text-conditioned model closely mirrors that of the image-conditioned models, with the primary distinction being the approach to injecting the condition signal. For textconditioned models, we employ the CLIP text encoder to derive text embeddings, integrating them into our denoiser through cross-attention layers. Specifically, in each transformer block within the encoder and decoder, a new cross-attention layer is introduced between the original attention and FFN. In such a case, text-conditioned models consistently exhibit larger sizes than their imageconditioned counterparts, resulting in a slightly slower inference speed. During inference, we adopt a classifier-free guidance approach Ho & Salimans (2022) with a scale of 5 to generate 3D assets conditioned on text.
|
| 288 |
+
|
| 289 |
+
<table><tr><td colspan="2"></td><td>Small 256×256</td><td>Large</td></tr><tr><td>Encoder</td><td>Image resolution Patch size Att. Layers Att. channels</td><td>16 12 768</td><td>256×256 8 12 768</td></tr><tr><td>Decoder</td><td>Triplane tokens Att hanels Triplane upsample Triplane shape</td><td>32 ×32×3 74(12a+12c) 1 32 × 32 × 3 × 32</td><td>32 × 32 × 3 10246a+16c) 2 64× 64×3×32</td></tr><tr><td>Renderer</td><td>Rendering patch size Ray-marching steps MLP layers MLP width Activation</td><td>64 48 10 64 ReLU</td><td>128 128 10 64 ReLU</td></tr><tr><td>Diffusion</td><td>Times steps Prediction target Schedule Learning rate</td><td>1000 xo cosine 4e-4</td><td>1000 xo cosine 4e-4</td></tr><tr><td>Traininig</td><td>Optimizer Warm-up steps Batch size per GPU #GPUS Iterations Training time</td><td>AdamW 3000 8 32 200K 4days</td><td>AdamW 3000 8 128 100K 7 days</td></tr><tr><td>Dataset</td><td>Source Mixing ratio Resolution</td><td>MVImgNet & Objaverse 1:3 256</td><td>MVImgNet & Objaverse 1:3 256</td></tr></table>
|
| 290 |
+
|
| 291 |
+
Table 6: Implementation details for our models. Att. denotes the attention. $a$ and $c$ represents the self-attention and cross attention.
|
| 292 |
+
|
| 293 |
+
# A.4 VIEW NUMBERS
|
| 294 |
+
|
| 295 |
+
We have compared the effects of using different numbers of views quantitatively in Tab. 3. Here, we also present qualitative results in Fig. 8. When there is only one view, the predicted novel view is very blurry. However, when the view number increases to four, the results become much clearer. When using six views, the improvement compared to four views is not significant, consistent to the metrics reported in Tab. 3, indicating performance saturation. Therefore, our model uses four views as the default configuration.
|
| 296 |
+
|
| 297 |
+
# A.5 MORE COMPARISON.
|
| 298 |
+
|
| 299 |
+
We also include more qualitative comparison on single-view image reconstruction in Fig. 9.
|
| 300 |
+
|
| 301 |
+

|
| 302 |
+
Figure 8: Qualitative comparison on different view numbers.
|
| 303 |
+
|
| 304 |
+

|
| 305 |
+
Figure 9: Qualitative comparison on single-image reconstruction.
|
md/test/IkmD3fKBPQ/IkmD3fKBPQ.md
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LARGE LANGUAGE MODELS CANNOT SELF-CORRECT REASONING YET
|
| 2 |
+
|
| 3 |
+
Jie Huang1,2∗ Xinyun Chen1∗ Swaroop Mishra1 Huaixiu Steven Zheng1 Adams Wei $\mathbf { Y u } ^ { 1 }$ Xinying Song1 Denny Zhou1
|
| 4 |
+
|
| 5 |
+
1Google DeepMind 2University of Illinois at Urbana-Champaign jeffhj@illinois.edu, {xinyunchen, dennyzhou}@google.com
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Large Language Models (LLMs) have emerged as a groundbreaking technology with their unparalleled text generation capabilities across various applications. Nevertheless, concerns persist regarding the accuracy and appropriateness of their generated content. A contemporary methodology, self-correction, has been proposed as a remedy to these issues. Building upon this premise, this paper critically examines the role and efficacy of self-correction within LLMs, shedding light on its true potential and limitations. Central to our investigation is the notion of intrinsic self-correction, whereby an LLM attempts to correct its initial responses based solely on its inherent capabilities, without the crutch of external feedback. In the context of reasoning, our research indicates that LLMs struggle to selfcorrect their responses without external feedback, and at times, their performance even degrades after self-correction. Drawing from these insights, we offer suggestions for future research and practical applications in this field.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
The rapid advancements in the domain of artificial intelligence have ushered in the era of Large Language Models (LLMs). These models, characterized by their expansive parameter counts and unparalleled capabilities in text generation, have showcased promising results across a multitude of applications (Chowdhery et al., 2023; Anil et al., 2023; OpenAI, 2023, inter alia). However, concerns about their accuracy, reasoning capabilities, and the safety of their generated content have drawn significant attention from the community (Bang et al., 2023; Alkaissi & McFarlane, 2023; Zheng et al., 2023; Shi et al., 2023; Carlini et al., 2021; Huang et al., 2022; Shao et al., 2023; Li et al., 2023; Wei et al., 2023; Zhou et al., 2023b; Zou et al., 2023, inter alia).
|
| 14 |
+
|
| 15 |
+
Amidst this backdrop, the concept of “self-correction” has emerged as a promising solution, where LLMs refine their responses based on feedback to their previous outputs (Madaan et al., 2023; Welleck et al., 2023; Shinn et al., 2023; Kim et al., 2023; Bai et al., 2022; Ganguli et al., 2023; Gao et al., 2023; Paul et al., 2023; Chen et al., 2023b; Pan et al., 2023, inter alia). However, the underlying mechanics and efficacy of self-correction in LLMs remain underexplored. A fundamental question arises: If an LLM possesses the ability to self-correct, why doesn’t it simply offer the correct answer in its initial attempt? This paper delves deeply into this paradox, critically examining the self-correction capabilities of LLMs, with a particular emphasis on reasoning (Wei et al., 2022; Zhou et al., 2023b; Huang & Chang, 2023).
|
| 16 |
+
|
| 17 |
+
To study this, we first define the concept of intrinsic self-correction, a scenario wherein the model endeavors to rectify its initial responses based solely on its inherent capabilities, without the crutch of external feedback. Such a setting is crucial because high-quality external feedback is often unavailable in many real-world applications. Moreover, it is vital to understand the intrinsic capabilities of LLMs. Contrary to the optimism surrounding self-correction (Madaan et al., 2023; Kim et al., 2023; Shinn et al., 2023; Pan et al., 2023, inter alia), our findings indicate that LLMs struggle to self-correct their reasoning in this setting. In most instances, the performance after self-correction even deteriorates. This observation is in contrast to prior research such as Kim et al. (2023); Shinn et al. (2023). Upon closer examination, we observe that the improvements in these studies result from using oracle labels to guide the self-correction process, and the improvements vanish when oracle labels are not available.
|
| 18 |
+
|
| 19 |
+
Besides the reliance on oracle labels, we also identify other issues in the literature regarding measuring the improvement achieved by self-correction. First, we note that self-correction, by design, utilizes multiple LLM responses, thus making it crucial to compare it to baselines with equivalent inference costs. From this perspective, we investigate multi-agent debate (Du et al., 2023; Liang et al., 2023) as a means to improve reasoning, where multiple LLM instances (can be multiple copies of the same LLM) critique each other’s responses. However, our results reveal that its efficacy is no better than self-consistency (Wang et al., 2022) when considering an equivalent number of responses, highlighting the limitations of such an approach.
|
| 20 |
+
|
| 21 |
+
Another important consideration for self-correction involves prompt design. Specifically, each selfcorrection process involves designing prompts for both the initial response generation and the selfcorrection steps. Our evaluation reveals that the self-correction improvement claimed by some existing work stems from the sub-optimal prompt for generating initial responses, where self-correction corrects these responses with more informative instructions about the initial task in the feedback prompt. In such cases, simply integrating the feedback into the initial instruction can yield better results, and self-correction again decreases performance.
|
| 22 |
+
|
| 23 |
+
In light of our findings, we provide insights into the nuances of LLMs’ self-correction capabilities and initiate discussions to encourage future research focused on exploring methods that can genuinely correct reasoning.
|
| 24 |
+
|
| 25 |
+
# 2 BACKGROUND AND RELATED WORK
|
| 26 |
+
|
| 27 |
+
With the LLM evolution, the notion of self-correction gained prominence. The discourse on selfcorrection pivots around whether these advanced models can recognize the correctness of their outputs and provide refined answers (Bai et al., 2022; Madaan et al., 2023; Welleck et al., 2023, inter alia). For example, in the context of mathematical reasoning, an LLM might initially solve a complex problem but make an error in one of the calculation steps. In an ideal self-correction scenario, the model is expected to recognize the potential mistake, revisit the problem, correct the error, and consequently produce a more accurate solution.
|
| 28 |
+
|
| 29 |
+
Yet, the definition of “self-correction” varies across the literature, leading to ambiguity. A pivotal distinction lies in the source of feedback (Pan et al., 2023), which can purely come from the LLM, or can be drawn from external inputs. Internal feedback relies on the model’s inherent knowledge and parameters to reassess its outputs. In contrast, external feedback incorporates inputs from humans, other models (Wang et al., 2023b; Paul et al., 2023, inter alia), or external tools and knowledge sources (Gou et al., 2023; Chen et al., 2023b; Olausson et al., 2023; Gao et al., 2023, inter alia).
|
| 30 |
+
|
| 31 |
+
In this work, we focus on examining the self-correction capability of LLMs for reasoning. Reasoning is a fundamental aspect of human cognition, enabling us to understand the world, draw inferences, make decisions, and solve problems. To enhance the reasoning performance of LLMs, Kim et al. (2023); Shinn et al. (2023) use oracle labels about the answer correctness to guide the self-correction process. However, in practice, high-quality external feedback such as answer correctness is often unavailable. For effective self-correction, the ability to judge the correctness of an answer is crucial and should ideally be performed by the LLM itself. Consequently, our focus shifts to self-correction without any external or human feedback. We term this setting intrinsic self-correction. For brevity, unless explicitly stated otherwise (e.g., self-correction with oracle feedback), all references to “selfcorrection” in the remainder of this paper pertain to intrinsic self-correction.
|
| 32 |
+
|
| 33 |
+
In the following sections, we will evaluate a variety of existing self-correction techniques. We demonstrate that existing techniques actually decrease reasoning performance when oracle labels are not used (Section 3), perform worse than methods without self-correction when utilizing the same number of model responses (Section 4), and lead to less effective outcomes when using informative prompts for generating initial responses (Section 5). We present an overview of issues in the evaluation setups of previous LLM self-correction works in Table 1, with detailed discussions in the corresponding sections.
|
| 34 |
+
|
| 35 |
+
Table 1: Summary of issues in previous LLM self-correction evaluation.
|
| 36 |
+
|
| 37 |
+
<table><tr><td>Method</td><td>Issue</td></tr><tr><td>RCI (Kim et al.,2023); Reflexion (Shinn et al.,2023)</td><td>Use of oracle labels (Section 3)</td></tr><tr><td>Multi-Agent Debate (Du et al.,2023)</td><td>Unfair comparison to self-consistency (Section 4)</td></tr><tr><td>Self-Refine (Madaan et al., 2023)</td><td>Sub-optimal prompt design (Section 5)</td></tr></table>
|
| 38 |
+
|
| 39 |
+
# 3 LLMS CANNOT SELF-CORRECT REASONING INTRINSICALLY
|
| 40 |
+
|
| 41 |
+
In this section, we evaluate existing self-correction methods and compare their performance with and without oracle labels regarding the answer correctness.
|
| 42 |
+
|
| 43 |
+
# 3.1 EXPERIMENTAL SETUP
|
| 44 |
+
|
| 45 |
+
Benchmarks. We use datasets where existing self-correction methods with oracle labels have demonstrated significant performance improvement, including
|
| 46 |
+
|
| 47 |
+
• GSM8K (Cobbe et al., 2021): GSM8K comprises a test set of 1,319 linguistically diverse grade school math word problems, curated by human problem writers. There is a notable improvement of approximately $7 \%$ as evidenced by Kim et al. (2023) after self-correction. • CommonSenseQA (Talmor et al., 2019): This dataset offers a collection of multi-choice questions that test commonsense reasoning. An impressive increase of around $15 \%$ is showcased through the self-correction process, as demonstrated by Kim et al. (2023). Following Kojima et al. (2022); Kim et al. (2023), we utilize the dev set for our evaluation, which encompasses 1,221 questions. • HotpotQA (Yang et al., 2018): HotpotQA is an open-domain multi-hop question answering dataset. Shinn et al. (2023) demonstrate significant performance improvement through selfcorrection. We test models’ performance in a closed-book setting and evaluate them using the same set as Shinn et al. (2023). This set contains 100 questions, with exact match serving as the evaluation metric.
|
| 48 |
+
|
| 49 |
+
Test Models and Setup. We first follow Kim et al. (2023); Shinn et al. (2023) to evaluate the performance of self-correction with oracle labels, using GPT-3.5-Turbo (gpt-3.5-turbo-0613) and GPT-4 accessed on 2023/08/29. For intrinsic self-correction, to provide a more thorough analysis, we also evaluate GPT-4-Turbo $( \mathtt { g p t } - 4 - 1 1 0 6 \mathrm { - p r e v i e w } )$ and Llama-2 $( \mathtt { L 1 a m a - 2 - 7 0 b - c h a t } )$ (Touvron et al., 2023). For GPT-3.5-Turbo, we employ the full evaluation set. For other models, to reduce the cost, we randomly sample 200 questions for each dataset (100 for HotpotQA) for testing. We prompt the models to undergo a maximum of two rounds of self-correction. We use a temperature of 1 for GPT-3.5-Turbo and GPT-4, and a temperature of 0 for GPT-4-Turbo and Llama-2, to provide evaluation across different decoding algorithms.
|
| 50 |
+
|
| 51 |
+
Prompts. Following Kim et al. (2023); Shinn et al. (2023), we apply a three-step prompting strategy for self-correction: 1) prompt the model to perform an initial generation (which also serves as the results for Standard Prompting); 2) prompt the model to review its previous generation and produce feedback; 3) prompt the model to answer the original question again with the feedback.
|
| 52 |
+
|
| 53 |
+
For our experiments, we mostly adhere to the prompts from the source papers. For GSM8K and CommonSenseQA, we integrate format instructions into the prompts of Kim et al. (2023) to facilitate a more precise automatic evaluation (detailed prompts can be found in Appendix A). For HotpotQA, we use the same prompt as Shinn et al. (2023). We also assess the performance of various selfcorrection prompts for intrinsic self-correction. For example, we use “Assume that this answer could be either correct or incorrect. Review the answer carefully and report any serious problems you find.” as the default feedback prompt for the evaluation on GPT-4-Turbo and Llama-2.
|
| 54 |
+
|
| 55 |
+
# 3.2 RESULTS
|
| 56 |
+
|
| 57 |
+
Self-Correction with Oracle Labels. Following previous works (Kim et al., 2023; Shinn et al., 2023), we use the correct label to determine when to stop the self-correction loop. This means we utilize the ground-truth label to verify whether each step’s generated answer is correct. If the answer is already correct, no (further) self-correction will be performed. Table 2 summarizes the results of self-correction under this setting, showcasing significant performance improvements, consistent with the findings presented in Kim et al. (2023); Shinn et al. (2023).
|
| 58 |
+
|
| 59 |
+
Table 2: Results of GPT-3.5 and GPT-4 on reasoning benchmarks with oracle labels.
|
| 60 |
+
|
| 61 |
+
<table><tr><td colspan="2"></td><td>GSM8K</td><td>CommonSenseQA</td><td>HotpotQA</td></tr><tr><td rowspan="2">GPT-3.5</td><td rowspan="2">Standard Prompting Self-Correct (Oracle)</td><td>75.9</td><td>75.8</td><td>26.0</td></tr><tr><td>84.3</td><td>89.7</td><td>29.0</td></tr><tr><td rowspan="2">GPT-4</td><td>Standardreromprilge</td><td>95.5</td><td>820</td><td></td></tr><tr><td></td><td></td><td></td><td>490</td></tr></table>
|
| 62 |
+
|
| 63 |
+
Table 3: Results of GPT-3.5 and GPT-4 on reasoning benchmarks with intrinsic self-correction.
|
| 64 |
+
|
| 65 |
+
<table><tr><td></td><td></td><td>#calls</td><td>GSM8K</td><td>CommonSenseQA</td><td>HotpotQA</td></tr><tr><td rowspan="3">GPT-3.5</td><td>Standard Prompting</td><td>1</td><td>75.9</td><td>75.8</td><td>26.0</td></tr><tr><td>Self-Correct (round 1)</td><td>3</td><td>75.1</td><td>38.1</td><td>25.0</td></tr><tr><td>Self-Correct (round 2)</td><td>5</td><td>74.7</td><td>41.8</td><td>25.0</td></tr><tr><td rowspan="3">GPT-4</td><td>Standard Prompting</td><td>1</td><td>95.5</td><td>82.0</td><td>49.0</td></tr><tr><td>Self-Correct (round 1)</td><td>3</td><td>91.5</td><td>79.5</td><td>49.0</td></tr><tr><td>Self-Correct (round 2)</td><td>5</td><td>89.0</td><td>80.0</td><td>43.0</td></tr></table>
|
| 66 |
+
|
| 67 |
+
However, these results require careful consideration. For reasoning tasks, like solving mathematical problems, the availability of oracle labels seems counter-intuitive. If we are already in possession of the ground truth, there seems to be little reason to deploy LLMs for problem-solving. Therefore, the results can only be regarded as indicative of an oracle’s performance.
|
| 68 |
+
|
| 69 |
+
Intrinsic Self-Correction. Per the above discussion, performance improvements achieved using oracle labels do not necessarily reflect true self-correction ability. Therefore, we turn our focus to the results in the intrinsic self-correction setting as defined in Section 2. To achieve this, we eliminate the use of labels, requiring LLMs to independently determine when to stop the self-correction process, i.e., whether to retain their previous answers.
|
| 70 |
+
|
| 71 |
+
Tables 3 and 4 report the accuracies and the number of model calls. We observe that, after selfcorrection, the accuracies of all models drop across all benchmarks.
|
| 72 |
+
|
| 73 |
+
To provide a more comprehensive assessment, we also design several different self-correction prompts to determine if there are better prompts that could enhance reasoning performance. Nonetheless, as shown in Tables 5 and 6, without the use of oracle labels, self-correction consistently results in a decrease in performance.
|
| 74 |
+
|
| 75 |
+
# 3.3 WHY DOES THE PERFORMANCE NOT INCREASE, BUT INSTEAD DECREASE?
|
| 76 |
+
|
| 77 |
+
Empirical Analysis. Figure 1 summarizes the results of changes in answers after two rounds of self-correction, with two examples of GPT-3.5 illustrated in Figure 2. For GSM8K, $7 4 . 7 \%$ of the time, GPT-3.5 retains its initial answer. Among the remaining instances, the model is more likely to modify a correct answer to an incorrect one than to revise an incorrect answer to a correct one. The fundamental issue is that LLMs cannot properly judge the correctness of their reasoning. For CommonSenseQA, there is a higher chance that GPT-3.5 alters its answer. The primary reason for this is that false answer options in CommonSenseQA often appear somewhat relevant to the question, and using the self-correction prompt might bias the model to choose another option, leading to a high “correct $\Rightarrow$ incorrect” ratio. Similarly, Llama-2 also frequently converts a correct answer into an incorrect one. Compared to GPT-3.5 and Llama-2, both GPT-4 and GPT-4-Turbo are more likely to retain their initial answers. This may be because GPT-4 and GPT-4-Turbo have higher confidence in their initial answers, or because they are more robust and thus less prone to being biased by the self-correction prompt.1
|
| 78 |
+
|
| 79 |
+
Table 4: Results of GPT-4-Turbo and Llama-2 with intrinsic self-correction.
|
| 80 |
+
|
| 81 |
+
<table><tr><td></td><td></td><td></td><td>#calls|GSM8K</td><td>CommonSenseQA</td></tr><tr><td></td><td> Standard Prompting</td><td>1</td><td>91.5</td><td>84.0</td></tr><tr><td>GPT-4-Turbo</td><td>Self-Correct (round 1)</td><td>3</td><td>88.0</td><td>81.5</td></tr><tr><td></td><td>Self-Correct (round 2)</td><td>5</td><td>90.0</td><td>83.0</td></tr><tr><td></td><td> Standard Prompting</td><td>1</td><td>62.0</td><td>64.0</td></tr><tr><td>Llama-2</td><td>Self-Correct (round 1)</td><td>3</td><td>43.5</td><td>37.5</td></tr><tr><td></td><td>Self-Correct (round 2)</td><td>5</td><td>36.5</td><td>36.5</td></tr></table>
|
| 82 |
+
|
| 83 |
+
Table 5: Results of GPT-4-Turbo with different feedback prompts.
|
| 84 |
+
|
| 85 |
+
<table><tr><td></td><td>|#calls|GSM8K</td><td></td><td>CommonSenseQA</td></tr><tr><td>Standard Prompting</td><td>1</td><td>91.5</td><td>84.0</td></tr><tr><td colspan="4">Feedback Prompt: Assume that this answer could be either correct or incorrect. Review the answer carefully and report any serious problems you find.</td></tr><tr><td>Self-Correct (round 1) Self-Correct (round 2)</td><td>3 5</td><td>88.0 90.0</td><td>81.5 83.0</td></tr><tr><td colspan="4">Feedback Prompt: Review your previous answer and determine whether it's correct. If wrong, find the problems with your answer.</td></tr><tr><td>Self-Correct (round 1) Self-Correct (round 2)</td><td>3 5</td><td>90.0 90.0</td><td>74.5 81.0</td></tr><tr><td colspan="4">Feedback Prompt: Verify whether your ans wer is correct, and provide an explanation.</td></tr><tr><td>Self-Correct (round 1) Self-Correct (round 2)</td><td>3 5</td><td>91.0 91.0</td><td>81.5 83.5</td></tr></table>
|
| 86 |
+
|
| 87 |
+
Table 6: Results of Llama-2 with different feedback prompts.
|
| 88 |
+
|
| 89 |
+
<table><tr><td></td><td>|#calls|GSM8K</td><td></td><td>CommonSenseQA</td></tr><tr><td>Standard Prompting</td><td>1</td><td>62.0</td><td>64.0</td></tr><tr><td colspan="4">Feedback Prompt: Assume that this answer could be either correct or incorrect. Review the answer carefully and report any serious problems you find.</td></tr><tr><td>Self-Correct (round 1) Self-Correct (round 2)</td><td>3 5</td><td>43.5 36.5</td><td>37.5 36.5</td></tr><tr><td></td><td></td><td></td><td>Feedback Prompt: Review your previous answer and determine whether it's correct.</td></tr><tr><td colspan="4"> If wrong, find the problems with your answer.</td></tr><tr><td>Self-Correct (round 1) Self-Correct (round 2)</td><td>3</td><td>46.5 30.5</td><td>26.0</td></tr><tr><td></td><td>5</td><td></td><td>37.0</td></tr><tr><td colspan="4"> Feedback Prompt: Verify whether your ans wer is correct, and provide an explanation.</td></tr><tr><td>Self-Correct (round 1)</td><td>3</td><td>58.0</td><td>24.0</td></tr><tr><td>Self-Correct (round 2)</td><td>5</td><td>41.5</td><td>43.0</td></tr></table>
|
| 90 |
+
|
| 91 |
+

|
| 92 |
+
Figure 1: Analysis of the changes in answers after two rounds of self-correction. No Change: The answer remains unchanged; Correct $\Rightarrow$ Incorrect: A correct answer is changed to an incorrect one; Incorrect $\Rightarrow$ Correct: An incorrect answer is revised to a correct one; Incorrect $\Rightarrow$ Incorrect: An incorrect answer is altered but remains incorrect.
|
| 93 |
+
|
| 94 |
+

|
| 95 |
+
Figure 2: Examples on GSM8K with GPT-3.5. Left: successful self-correction; Right: failed selfcorrection. Full prompts and responses can be viewed in Figures 3 and 4 of Appendix A.
|
| 96 |
+
|
| 97 |
+
Let’s take another look at the results presented in Table 2. These results use ground-truth labels to prevent the model from altering a correct answer to an incorrect one. However, determining how to prevent such mischanges is, in fact, the key to ensuring the success of self-correction.
|
| 98 |
+
|
| 99 |
+
Intuitive Explanation. If the model is well-aligned and paired with a thoughtfully designed initial prompt, the initial response should already be optimal relative to the prompt and the specific decoding algorithm. Introducing feedback can be viewed as adding an additional prompt, potentially skewing the model towards generating a response that is tailored to this combined input. In an intrinsic self-correction setting, on the reasoning tasks, this supplementary prompt may not offer any extra advantage for answering the question. In fact, it might even bias the model away from producing an optimal response to the initial prompt, resulting in a performance drop.
|
| 100 |
+
|
| 101 |
+
Table 7: Results of multi-agent debate and self-consistency.
|
| 102 |
+
|
| 103 |
+
<table><tr><td></td><td># responses</td><td>GSM8K</td></tr><tr><td>Standard Prompting</td><td>1</td><td>76.7</td></tr><tr><td>Self-Consistency</td><td>3</td><td>82.5</td></tr><tr><td>Multi-Agent Debate (round 1)</td><td>6</td><td>83.2</td></tr><tr><td>Self-Consistency</td><td>6</td><td>85.3</td></tr><tr><td>Multi-Agent Debate (round 2) Self-Consistency</td><td>9 9</td><td>83.0 88.2</td></tr></table>
|
| 104 |
+
|
| 105 |
+
Table 8: Results of Constrained Generation.
|
| 106 |
+
|
| 107 |
+
<table><tr><td></td><td>#calls</td><td>CommonGen-Hard</td></tr><tr><td>Standard Prompting* Self-Correct*</td><td>1 7</td><td>44.0* 67.0*</td></tr><tr><td>Standard Prompting*</td><td>1</td><td>53.0</td></tr><tr><td>Self-Correct* Standard Prompting (ours) Self-Correct*</td><td>7 1 7</td><td>61.1 81.8 75.1</td></tr></table>
|
| 108 |
+
|
| 109 |
+
\* Prompts and results from Madaan et al. (2023).
|
| 110 |
+
|
| 111 |
+
# 4 MULTI-AGENT DEBATE DOES NOT OUTPERFORM SELF-CONSISTENCY
|
| 112 |
+
|
| 113 |
+
Another potential approach for LLMs to self-correct their reasoning involves allowing the models to critique and debate through multiple model calls (Du et al., 2023; Liang et al., 2023; Chen et al., 2023a). Du et al. (2023) implement a multi-agent debate method by leveraging multiple instances of a single ChatGPT model and demonstrate significant improvements on reasoning tasks. We adopt their method to test performance on GSM8K. For an unbiased implementation, we use the exact same prompt as Du et al. (2023) and replicate their experiment with the $\mathfrak { g p t } - 3 . 5 \mathrm { - t u r b o - } 0 3 0 1$ model, incorporating 3 agents and 2 rounds of debate. The only distinction is that, to reduce result variance, we test on the complete test set of GSM8K, compared to their usage of 100 examples. For reference, we also report the results of self-consistency (Wang et al., 2022), which prompts models to generate multiple responses and performs majority voting to select the final answer.
|
| 114 |
+
|
| 115 |
+
Table 7 presents the results. The results indicate that both multi-agent debate and self-consistency achieve significant improvements over standard prompting. However, when comparing multi-agent debate to self-consistency, we observe that the performance of multi-agent is only slightly better than that of self-consistency with the same number of agents (3 responses, the baseline also compared in Du et al. (2023)). Furthermore, for self-consistency with an equivalent number of responses, multi-agent debate significantly underperforms simple self-consistency using majority voting.
|
| 116 |
+
|
| 117 |
+
In fact, rather than labeling the multi-agent debate as a form of “debate” or “critique”, it is more appropriate to perceive it as a means to achieve “consistency” across multiple model generations. Fundamentally, its concept mirrors that of self-consistency; the distinction lies in the voting mechanism, whether voting is model-driven or purely based on counts. The observed improvement is evidently not attributed to “self-correction”, but rather to “self-consistency”. If we aim to argue that LLMs can self-correct reasoning through multi-agent debate, it is preferable to exclude the effects of selection among multiple generations.
|
| 118 |
+
|
| 119 |
+
# 5 PROMPT DESIGN ISSUES IN SELF-CORRECTION EVALUATION
|
| 120 |
+
|
| 121 |
+
In Section 3, we observe that although self-correction decreases reasoning performance with all types of feedback prompts we have evaluated, performance varies with different feedback prompts. In this section, we further emphasize the importance of proper prompt design in generating initial LLM responses to fairly measure the performance improvement achieved by self-correction. For example, if a task requires that the model response should meet criteria that can be easily specified in the initial instruction (e.g., the output should contain certain words, the generated code should be efficient, the sentiment should be positive, etc.), instead of including such requirements only in the feedback prompt, an appropriate comparison would be to directly and explicitly incorporate these requirements into the prompt for generating initial responses. Otherwise, when the instruction for generating initial predictions is not informative enough, even if the performance improves, it is unclear whether the improvement merely comes from more detailed instructions in the feedback prompt or from the self-correction step itself.
|
| 122 |
+
|
| 123 |
+
To illustrate such prompt design issues in the self-correction evaluation of some prior work, we take the Constrained Generation task in Madaan et al. (2023) as an example, where the task requires models to generate coherent sentences using all 20-30 input concepts. The original prompt in Madaan et al. (2023) (Figure 7) does not clearly specify that the LLM needs to include all concepts in the prompt; thus, they show that self-correction improves task performance by asking the model to identify missing concepts and then guiding it to incorporate these concepts through feedback.
|
| 124 |
+
|
| 125 |
+
Based on this observation, we add the following instruction “Write a reasonable paragraph that includes $^ { * } A L L ^ { * }$ of the above concepts” to the prompt for initial response generation (refer to Figure 8 for the full prompt). Following Madaan et al. (2023), we use concept coverage as the metric. We reference their results and replicate their experiments using gpt-3.5-turbo-0613. Table 8 demonstrates that our new prompt, denoted as Standard Prompting (ours), significantly outperforms the results after self-correction of Madaan et al. (2023), and applying their self-correction prompt on top of model responses from our stronger version of the standard prompting again leads to a decrease in performance.
|
| 126 |
+
|
| 127 |
+
# 6 CONCLUSION AND DISCUSSION
|
| 128 |
+
|
| 129 |
+
Our work shows that current LLMs struggle to self-correct their reasoning without external feedback. This implies that expecting these models to inherently recognize and rectify their reasoning mistakes is overly optimistic so far. In light of these findings, it is imperative for the community to approach the concept of self-correction with a discerning perspective, acknowledging its potential and recognizing its boundaries. By doing so, we can better equip the self-correction technique to address the limitations of LLMs and develop the next generation of LLMs with enhanced capabilities. In the following, we provide insights into scenarios where self-correction shows the potential strengths and offer guidelines on the experimental design of future self-correction techniques to ensure a fair comparison.
|
| 130 |
+
|
| 131 |
+
Leveraging external feedback for correction. In this work, we demonstrate that current LLMs cannot improve their reasoning performance through intrinsic self-correction. Therefore, when valid external feedback is available, it is beneficial to leverage it properly to enhance model performance. For example, Chen et al. (2023b) show that LLMs can significantly improve their code generation performance through self-debugging by including code execution results in the feedback prompt to fix issues in the predicted code. In particular, when the problem description clearly specifies the intended code execution behavior, e.g., with unit tests, the code executor serves as the perfect verifier to judge the correctness of predicted programs, while the error messages also provide informative feedback that guides the LLMs to improve their responses. Gou et al. (2023) demonstrate that LLMs can more effectively verify and correct their responses when interacting with various external tools such as search engines and calculators. Cobbe et al. (2021); Lightman et al. (2023); Wang et al. (2023b) train a verifier or a critique model on a high-quality dataset to verify or refine LLM outputs, which can be used to provide feedback for correcting prediction errors. Besides automatically generated external feedback, we also often provide feedback ourselves when interacting with LLMs, guiding them to produce the content we desire. Designing techniques that enable LLMs to interact with the external environment and learn from different kinds of available feedback is a promising direction for future work.
|
| 132 |
+
|
| 133 |
+
Evaluating self-correction against baselines with comparable inference costs. By design, selfcorrection requires additional LLM calls, thereby increasing the costs for encoding and generating extra tokens. Section 4 demonstrates that the performance of asking the LLM to produce a final response based on multiple previous responses, such as with the multi-agent debate approach, is inferior to that of self-consistency (Wang et al., 2022) with the same number of responses. Regarding this, we encourage future work proposing new self-correction methods to always include an in-depth inference cost analysis to substantiate claims of performance improvement. Moreover, strong baselines that leverage multiple model responses, like self-consistency, should be used for comparison. An implication for future work is to develop models with a higher probability of decoding the optimal solution in their answer distributions, possibly through some alignment techniques. This would enable the model to generate better responses without necessitating multiple generations.
|
| 134 |
+
|
| 135 |
+
Putting equal efforts into prompt design. As discussed in Section 5, to gain a better understanding of the improvements achieved by self-correction, it is important to include a complete task description in the prompt for generating initial responses, rather than leaving part of the task description for the feedback prompt. Broadly speaking, equal effort should be invested in designing the prompts for initial response generation and for self-correction; otherwise, the results could be misleading.
|
| 136 |
+
|
| 137 |
+
# 7 LIMITATIONS AND BROADER IMPACT
|
| 138 |
+
|
| 139 |
+
Although we have conducted a comprehensive evaluation spanning a variety of self-correction strategies, prompts, and benchmarks, our work focuses on evaluating reasoning of LLMs. Thus, it is plausible that there exist self-correction strategies that could enhance LLM performance in other domains. For example, prior works have demonstrated the successful usage of self-correction that aligns model responses with specific preferences, such as altering the style of responses or enhancing their safety (Bai et al., 2022; Ganguli et al., 2023; Madaan et al., 2023). A key distinction arises in the capability of LLMs to accurately assess their responses in relation to the given tasks. For example, LLMs can properly evaluate whether a response is inappropriate (Ganguli et al., 2023), but they may struggle to identify errors in their reasoning.
|
| 140 |
+
|
| 141 |
+
Furthermore, several prior works have already shown that LLM self-correction performance becomes significantly weaker without access to external feedback (Gou et al., 2023; Zhou et al., 2023a) and can be easily biased by misleading feedback (Wang et al., 2023a), which is consistent with our findings in this work. However, we still identified prevailing ambiguity in the wider community. Some existing literature may inadvertently contribute to this confusion, either by relegating crucial details about label usage to less prominent sections or by failing to clarify that their designed selfcorrection strategies actually incorporate external feedback. Regarding this, our paper serves as a call to action, urging researchers to approach this domain with a discerning and critical perspective. We also encourage future research to explore approaches that can genuinely enhance reasoning.
|
| 142 |
+
|
| 143 |
+
# REPRODUCIBILITY STATEMENT
|
| 144 |
+
|
| 145 |
+
Our experiments utilize GPT-3.5 and GPT-4, which are accessible via the public API at https: //platform.openai.com/docs/models, as well as Llama-2, an open-source model. To facilitate reproducibility, we detail the specific kernels used, e.g., gpt-3.5-turbo-0613, or provide the access times for each experiment. We use prompts from previous works when possible. For our designed prompts, we include the exact prompts in Appendix A.
|
| 146 |
+
|
| 147 |
+
# ACKNOWLEDGEMENT
|
| 148 |
+
|
| 149 |
+
We would like to thank Chen Liang, William Cohen, Uri Alon, and other colleagues at Google DeepMind for valuable discussion and feedback.
|
| 150 |
+
|
| 151 |
+
# REFERENCES
|
| 152 |
+
|
| 153 |
+
Hussam Alkaissi and Samy I McFarlane. Artificial hallucinations in chatgpt: implications in scientific writing. Cureus, 15(2), 2023.
|
| 154 |
+
|
| 155 |
+
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.
|
| 156 |
+
|
| 157 |
+
Yuntao Bai, Saurav Kadavath, Sandipan Kundu, Amanda Askell, Jackson Kernion, Andy Jones, Anna Chen, Anna Goldie, Azalia Mirhoseini, Cameron McKinnon, et al. Constitutional ai: Harmlessness from ai feedback. arXiv preprint arXiv:2212.08073, 2022.
|
| 158 |
+
|
| 159 |
+
Yejin Bang, Samuel Cahyawijaya, Nayeon Lee, Wenliang Dai, Dan Su, Bryan Wilie, Holy Lovenia, Ziwei Ji, Tiezheng Yu, Willy Chung, et al. A multitask, multilingual, multimodal evaluation of chatgpt on reasoning, hallucination, and interactivity. In Proceedings of the 13th International Joint Conference on Natural Language Processing and the 3rd Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 675–718, 2023.
|
| 160 |
+
|
| 161 |
+
Nicholas Carlini, Florian Tramer, Eric Wallace, Matthew Jagielski, Ariel Herbert-Voss, Katherine Lee, Adam Roberts, Tom B Brown, Dawn Song, Ulfar Erlingsson, et al. Extracting training data from large language models. In USENIX Security Symposium, volume 6, 2021.
|
| 162 |
+
|
| 163 |
+
Justin Chih-Yao Chen, Swarnadeep Saha, and Mohit Bansal. Reconcile: Round-table conference improves reasoning via consensus among diverse llms. arXiv preprint arXiv:2309.13007, 2023a.
|
| 164 |
+
|
| 165 |
+
Xinyun Chen, Maxwell Lin, Nathanael Scharli, and Denny Zhou. Teaching large language models ¨ to self-debug. arXiv preprint arXiv:2304.05128, 2023b.
|
| 166 |
+
|
| 167 |
+
Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Ben Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garcia, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. Palm: Scaling language modeling with pathways. Journal of Machine Learning Research, 24(240):1–113, 2023. URL http: //jmlr.org/papers/v24/22-1144.html.
|
| 168 |
+
|
| 169 |
+
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.
|
| 170 |
+
|
| 171 |
+
Yilun Du, Shuang Li, Antonio Torralba, Joshua B Tenenbaum, and Igor Mordatch. Improving factuality and reasoning in language models through multiagent debate. arXiv preprint arXiv:2305.14325, 2023.
|
| 172 |
+
|
| 173 |
+
Deep Ganguli, Amanda Askell, Nicholas Schiefer, Thomas Liao, Kamile Luko ˙ siˇ ut¯ e, Anna Chen, ˙ Anna Goldie, Azalia Mirhoseini, Catherine Olsson, Danny Hernandez, et al. The capacity for moral self-correction in large language models. arXiv preprint arXiv:2302.07459, 2023.
|
| 174 |
+
|
| 175 |
+
Luyu Gao, Zhuyun Dai, Panupong Pasupat, Anthony Chen, Arun Tejasvi Chaganty, Yicheng Fan, Vincent Zhao, Ni Lao, Hongrae Lee, Da-Cheng Juan, et al. Rarr: Researching and revising what language models say, using language models. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 16477–16508, 2023.
|
| 176 |
+
|
| 177 |
+
Zhibin Gou, Zhihong Shao, Yeyun Gong, Yelong Shen, Yujiu Yang, Nan Duan, and Weizhu Chen. Critic: Large language models can self-correct with tool-interactive critiquing. arXiv preprint arXiv:2305.11738, 2023.
|
| 178 |
+
|
| 179 |
+
Jie Huang and Kevin Chen-Chuan Chang. Towards reasoning in large language models: A survey. In Findings of the Association for Computational Linguistics: ACL 2023. Association for Computational Linguistics, 2023.
|
| 180 |
+
|
| 181 |
+
Jie Huang, Hanyin Shao, and Kevin Chen-Chuan Chang. Are large pre-trained language models leaking your personal information? In Findings of the Association for Computational Linguistics: EMNLP 2022, pp. 2038–2047, Abu Dhabi, United Arab Emirates, 2022. Association for Computational Linguistics.
|
| 182 |
+
|
| 183 |
+
Geunwoo Kim, Pierre Baldi, and Stephen McAleer. Language models can solve computer tasks. Advances in Neural Information Processing Systems, 2023.
|
| 184 |
+
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.
|
| 185 |
+
Haoran Li, Dadi Guo, Wei Fan, Mingshi Xu, Jie Huang, Fanpu Meng, and Yangqiu Song. Multistep jailbreaking privacy attacks on chatgpt. In Findings of the Association for Computational Linguistics: EMNLP 2023, pp. 4138–4153, 2023.
|
| 186 |
+
Tian Liang, Zhiwei He, Wenxiang Jiao, Xing Wang, Yan Wang, Rui Wang, Yujiu Yang, Zhaopeng Tu, and Shuming Shi. Encouraging divergent thinking in large language models through multiagent debate. arXiv preprint arXiv:2305.19118, 2023.
|
| 187 |
+
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.
|
| 188 |
+
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. Advances in Neural Information Processing Systems, 2023.
|
| 189 |
+
Theo X Olausson, Jeevana Priya Inala, Chenglong Wang, Jianfeng Gao, and Armando SolarLezama. Demystifying gpt self-repair for code generation. arXiv preprint arXiv:2306.09896, 2023.
|
| 190 |
+
OpenAI. Gpt-4 technical report, 2023.
|
| 191 |
+
Liangming Pan, Michael Saxon, Wenda Xu, Deepak Nathani, Xinyi Wang, and William Yang Wang. Automatically correcting large language models: Surveying the landscape of diverse selfcorrection strategies. arXiv preprint arXiv:2308.03188, 2023.
|
| 192 |
+
Debjit Paul, Mete Ismayilzada, Maxime Peyrard, Beatriz Borges, Antoine Bosselut, Robert West, and Boi Faltings. Refiner: Reasoning feedback on intermediate representations. arXiv preprint arXiv:2304.01904, 2023.
|
| 193 |
+
Hanyin Shao, Jie Huang, Shen Zheng, and Kevin Chen-Chuan Chang. Quantifying association capabilities of large language models and its implications on privacy leakage. arXiv preprint arXiv:2305.12707, 2023.
|
| 194 |
+
Freda Shi, Xinyun Chen, Kanishka Misra, Nathan Scales, David Dohan, Ed H Chi, Nathanael Scharli, and Denny Zhou. Large language models can be easily distracted by irrelevant context. ¨ In International Conference on Machine Learning, pp. 31210–31227. PMLR, 2023.
|
| 195 |
+
Noah Shinn, Federico Cassano, Beck Labash, Ashwin Gopinath, Karthik Narasimhan, and Shunyu Yao. Reflexion: Language agents with verbal reinforcement learning. Advances in Neural Information Processing Systems, 2023.
|
| 196 |
+
Alon Talmor, Jonathan Herzig, Nicholas Lourie, and Jonathan Berant. Commonsenseqa: A question answering challenge targeting commonsense knowledge. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4149–4158, 2019.
|
| 197 |
+
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023.
|
| 198 |
+
Boshi Wang, Xiang Yue, and Huan Sun. Can chatgpt defend its belief in truth? evaluating llm reasoning via debate. In Findings of the Association for Computational Linguistics: EMNLP 2023, pp. 11865–11881, 2023a.
|
| 199 |
+
Tianlu Wang, Ping Yu, Xiaoqing Ellen Tan, Sean O’Brien, Ramakanth Pasunuru, Jane Dwivedi-Yu, Olga Golovneva, Luke Zettlemoyer, Maryam Fazel-Zarandi, and Asli Celikyilmaz. Shepherd: A critic for language model generation. arXiv preprint arXiv:2308.04592, 2023b.
|
| 200 |
+
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V Le, Ed H Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. In The Eleventh International Conference on Learning Representations, 2022.
|
| 201 |
+
Alexander Wei, Nika Haghtalab, and Jacob Steinhardt. Jailbroken: How does llm safety training fail? arXiv preprint arXiv:2307.02483, 2023.
|
| 202 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Fei Xia, Ed Chi, Quoc V Le, Denny Zhou, et al. Chain-of-thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35:24824–24837, 2022.
|
| 203 |
+
Sean Welleck, Ximing Lu, Peter West, Faeze Brahman, Tianxiao Shen, Daniel Khashabi, and Yejin Choi. Generating sequences by learning to self-correct. In The Eleventh International Conference on Learning Representations, 2023.
|
| 204 |
+
Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William Cohen, Ruslan Salakhutdinov, and Christopher D Manning. Hotpotqa: A dataset for diverse, explainable multi-hop question answering. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics, 2018.
|
| 205 |
+
Shen Zheng, Jie Huang, and Kevin Chen-Chuan Chang. Why does chatgpt fall short in providing truthful answers? ArXiv preprint, abs/2304.10513, 2023.
|
| 206 |
+
Aojun Zhou, Ke Wang, Zimu Lu, Weikang Shi, Sichun Luo, Zipeng Qin, Shaoqing Lu, Anya Jia, Linqi Song, Mingjie Zhan, et al. Solving challenging math word problems using gpt-4 code interpreter with code-based self-verification. arXiv preprint arXiv:2308.07921, 2023a.
|
| 207 |
+
Denny Zhou, Nathanael Scharli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuur- ¨ mans, Claire Cui, Olivier Bousquet, Quoc V Le, et al. Least-to-most prompting enables complex reasoning in large language models. In The Eleventh International Conference on Learning Representations, 2023b.
|
| 208 |
+
Andy Zou, Zifan Wang, J Zico Kolter, and Matt Fredrikson. Universal and transferable adversarial
|
| 209 |
+
|
| 210 |
+
attacks on aligned language models. arXiv preprint arXiv:2307.15043, 2023.
|
| 211 |
+
|
| 212 |
+
# A PROMPTS AND EXAMPLE OUTPUTS
|
| 213 |
+
|
| 214 |
+
Can you solve the following math problem? Christina is planning a birthday party and needs .75 gift bags per invited guest, because 1/4 of attendees don't show up. She invited 16 friends. Gift bags are $\$ 2$ each. How much will she spend? Explain your reasoning. Your final answer should be a single numerical number, in the form \boxed{answer}, at the end of your response.
|
| 215 |
+
|
| 216 |
+
If Christina invited 16 friends, then 1/4 of them won't show up, which means there will be $1 6 { \it \star } 1 / 4 { \it \Delta \phi } = 4$ friends who won't attend the party. To determine how many gift bags to buy, we need to subtract the number of friends who won't show up from the total number of invited guests. The number of invited guests is $1 6 ~ - ~ 4 ~ = ~ 1 2$ . Since Christina needs 0.75 gift bags per invited guest, we can multiply this quantity by the number of invited guests to find the total number of gift bags needed, which is $0 . 7 5 \ \star \ 1 2 \ = \ 9$ gift bags. If each gift bag is $\$ 2$ , then Christina will spend a total of $2 \ \star \ 9 \ = \ \mathfrak { H } < < 2 \star 9 = 1 8 > > 1 8$ on gift bags. Therefore, Christina will spend $\$ 18$ on gift bags. Answer: \boxed{18}. (Incorrect)
|
| 217 |
+
|
| 218 |
+
# Review your previous answer and find problems with your answer.
|
| 219 |
+
|
| 220 |
+
Upon reviewing my previous answer, I recognize a mistake. I incorrectly stated that Christina needs 0.75 gift bags per invited guest. The given information states that 1/4 of the attendees won't show up, so the correct calculation should take this into account. To calculate the number of gift bags needed, we will multiply the number of invited guests by the ratio of attendees who will actually show up $( 7 5 \% )$ . The number of invited guests is 16, and if 1/4 of them won't show up, then the ratio of attendees who will show up is 1 - $1 / 4 = 3 / 4$ . Multiplying the number of invited guests by the ratio of attendees who will show up gives us: 16 $\star$ $( 3 / 4 ) = 1 2$ gift bags needed. Since each gift bag costs $\$ 2$ , the total amount Christina will spend on gift bags is: $1 2 \star \hat { \varsigma } 2 = \hat { \varsigma } < < 1 2 \star 2 = 2 4 > > 2 4$ .
|
| 221 |
+
|
| 222 |
+
# Based on the problems you found, improve your answer. Please reiterate your answer, with your final answer a single numerical number, in the form \boxed{answer}.
|
| 223 |
+
|
| 224 |
+
Upon reviewing my previous answer, I recognize a mistake. I incorrectly stated that Christina needs 0.75 gift bags per invited guest. The given information states that 1/4 of the attendees won't show up, so the correct calculation should take this into account. To calculate the number of gift bags needed, we will multiply the number of invited guests by the ratio of attendees who will actually show up $( 7 5 \% )$ . The number of invited guests is 16, and if 1/4 of them won't show up, then the ratio of attendees who will show up is $\begin{array} { l l l l } { 1 } & { - } & { 1 / 4 } & { = } & { 3 / 4 } \end{array}$ . Multiplying the number of invited guests by the ratio of attendees who will show up gives us: 16 $\star$ $( 3 / 4 ) = 1 2$ gift bags needed. Since each gift bag costs $\$ 2$ , the total amount Christina will spend on gift bags is: $1 2 \star \hat { \varsigma } 2 = \hat { \varsigma } < < 1 2 \star 2 = 2 4 > > 2 4$ . Therefore, Christina will spend $\$ 24$ on gift bags. Answer: \boxed{24}. (Correct)
|
| 225 |
+
|
| 226 |
+
Can you solve the following math problem? Terry eats 2 yogurts a day. They are currently on sale at 4 yogurts for $\$ 5.00$ . How much does he spend on yogurt over 30 days? Explain your reasoning. Your final answer should be a single numerical number, in the form \boxed{answer}, at the end of your response.
|
| 227 |
+
|
| 228 |
+
First, we need to calculate how many sets of 4 yogurts Terry buys in 30 days. Since Terry eats 2 yogurts a day, he will need $2 / 4 = 0 . 5$ sets of 4 yogurts per day. Next, we multiply the number of sets by the price of each set to calculate how much Terry spends per day. Each set of 4 yogurts costs $\$ 5.00$ , so Terry spends $0 . 5 \star \hat { 5 } 5 . 0 0 \ = \ \hat { 5 } < < 0 . 5 \star 5 = 2 . 5 0 > > 2 . 5 0$ on yogurt per day. Finally, we multiply the amount Terry spends per day by the number of days to find the total amount he spends on yogurt over 30 days. Terry spends $\$ 2 .50$ per day for 30 days, so he spends $9 2 . 5 0 { { \mathrm { ~ \star ~ } } } 3 0 =$ $\$ 123,456$ on yogurt over 30 days. So, Terry spends $\varsigma$ \boxed $\left\{ 7 5 . 0 0 \right\} \lessgtr$ on yogurt over 30 days. (Correct)
|
| 229 |
+
|
| 230 |
+
# Review your previous answer and find problems with your answer.
|
| 231 |
+
|
| 232 |
+
Upon reviewing my previous answer, I realized that I made a mistake in calculating Terry's spending on yogurt over 30 days. I incorrectly stated that Terry spends $\$ 2 .50$ per day for 30 days, resulting in a total of $\$ 75,00$ . However, since Terry eats 2 yogurts a day and the yogurts are sold in sets of 4 for $\$ 5.00$ , Terry would actually need to buy 1 set of 4 yogurts to last for 2 days. Therefore, his spending on yogurt per set would be $\$ 5.00$ for 2 days, or $\$ 5.00/2=52.50$ per day. To calculate the total amount spent on yogurt over 30 days, we would multiply the amount spent per day ( $\$ 2 .50$ ) by the number of sets needed in 30 days (which is 30 divided by 2 days per set). Therefore, the correct calculation would be $\begin{array} { l l l l l l l } { { \lessgtr 2 . 5 0 } } & { { \star } } & { { ( 3 0 / 2 ) } } & { { = } } & { { \lessgtr 2 . 5 0 } } & { { \star } } & { { 1 5 } } & { { = } } & { { \lessgtr 3 7 . 5 0 } } \end{array}$ . Apologies for the mistake. The correct answer is Terry spends $\varsigma$ \boxed{37.50}\$ on yogurt over 30 days.
|
| 233 |
+
|
| 234 |
+
# Based on the problems you found, improve your answer. Please reiterate your answer, with your final answer a single numerical number, in the form \boxed{answer}.
|
| 235 |
+
|
| 236 |
+
Apologies for the error in my previous response. Upon reviewing the problem, here is the correct answer: Since Terry eats 2 yogurts a day and the yogurts are sold in sets of 4 for $\$ 5.00$ , Terry needs to buy 1 set of 4 yogurts to last for 2 days. Therefore, Terry's spending on yogurt per set is $\$ 5.00$ for 2 days, or $\$ 5,00/2=92.50$ per day. To calculate the total amount spent on yogurt over 30 days, we multiply the amount spent per day ( $\$ 2 .50)$ ) by the number of sets needed in 30 days. In this case, Terry needs $3 0 / 2 \ = \ 1 5$ sets of yogurts over 30 days. Multiplying $\$ 2 .50$ by 15, we find that Terry spends a total of $\$ 2.50\star 15 =\$ 37.50$ on yogurt over 30 days. Therefore, the final answer is Terry spends $\$ 5$ \boxed $\{ 3 7 . 5 0 \} \ : \lessgtr$ on yogurt over 30 days. (Incorrect)
|
| 237 |
+
|
| 238 |
+
Figure 4: Example on GSM8K where self-correction changes a correct answer to an incorrect one.
|
| 239 |
+
|
| 240 |
+
Can you solve the following math problem? Toulouse has twice as many sheep as Charleston. Charleston has 4 times as many sheep as Seattle. How many sheep do Toulouse, Charleston, and Seattle have together if Seattle has 20 sheep? Explain your reasoning. Your final answer should be a single numerical number, in the form \boxed{answer}, at the end of your response.
|
| 241 |
+
|
| 242 |
+
Let's start by figuring out how many sheep Charleston has. We are given that Charleston has 4 times as many sheep as Seattle, so we can calculate this by multiplying Seattle's number of sheep by 4: Charleston $= 4 \star 2 0 =$ 80 sheep. Next, we are told that Toulouse has twice as many sheep as Charleston. Therefore, we can find Toulouse's number of sheep by multiplying Charleston's number of sheep by 2: Toulouse $= 2 \times 8 0 = 1 6 0$ sheep. Finally, to find the total number of sheep, we add up the number of sheep for each city: Total $=$ Seattle $^ +$ Charleston $^ +$ Toulouse $= \ 2 0 \ + \ 8 0$ $+ 1 6 0 ~ = ~ 2 6 0$ sheep. Therefore, Toulouse, Charleston, and Seattle have a total of 260 sheep. Answer: \boxed{260}. (Correct)
|
| 243 |
+
|
| 244 |
+
# Review your previous answer and find problems with your answer.
|
| 245 |
+
|
| 246 |
+
I apologize for the mistake in my previous response. Let's go through the problem again and find the correct answer. We are given that Charleston has 4 times as many sheep as Seattle. If Seattle has 20 sheep, then Charleston would have: Charleston $= 4 \times 2 0 = 8 0$ sheep. Next, we are told that Toulouse has twice as many sheep as Charleston. Therefore, Toulouse would have: Toulouse $= 2 \times 8 0 = 1 6 0$ sheep. To find the total number of sheep, we add up the number of sheep for each city: Total $=$ Seattle $^ +$ Charleston $^ +$ Toulouse $= \ 2 0 \ + \ 8 0 \ + \ 1 6 0 \ = \ 2 6 0$ sheep. After reviewing my previous answer, I have determined that there are no problems with my updated response. The correct answer is 260 sheep.
|
| 247 |
+
|
| 248 |
+
Based on the problems you found, improve your answer. Please reiterate your answer, with your final answer a single numerical number, in the form \boxed{answer}.
|
| 249 |
+
|
| 250 |
+
Apologies for the confusion. Let me provide an improved answer. We are given that Charleston has 4 times as many sheep as Seattle, and Seattle has 20 sheep. So, Charleston would have $4 \ \star \ 2 0 \ = \ 8 0$ sheep. According to the information, Toulouse has twice as many sheep as Charleston. Therefore, Toulouse would have $2 \times 8 0 = 1 6 0$ sheep. To determine the total number of sheep, we add up the number of sheep for each city: Total $=$ Seattle $^ +$ Charleston $^ +$ Toulouse $= 2 0 + 8 0 + 1 6 0 = 2 6 0$ sheep. After reviewing the previous answer, the correct final answer is \boxed{260}. (Correct)
|
| 251 |
+
|
| 252 |
+
Q: A fencing thrust with a sharp sword towards a person would result in what?
|
| 253 |
+
Answer Choices: (A) injury (B) small cuts (C) fever (D) competition (E) puncture wound.
|
| 254 |
+
Explain your reasoning. You must choose only one option from A to E. Your final answer should be a single letter from A to E, in the form (answer), at the end of your response.
|
| 255 |
+
|
| 256 |
+
A: A fencing thrust with a sharp sword towards a person would result in a puncture wound. This is because a fencing thrust involves forcefully stabbing with a sword, which can penetrate the skin and create a deep, narrow wound. Puncture wounds can be very dangerous as they can damage internal organs and cause bleeding. Therefore, the most appropriate answer is (E) puncture wound. (Correct)
|
| 257 |
+
|
| 258 |
+
# Review your previous answer and find problems with your answer.
|
| 259 |
+
|
| 260 |
+
Upon reviewing my previous answer, I realize that there are some problems with it. While a fencing thrust with a sharp sword can potentially result in a puncture wound, it is important to note that in a controlled fencing match, the swords used are typically blunted or have safety tips, designed to minimize the risk of injury. Therefore, the likelihood of a puncture wound from a fencing thrust with a sharp sword in a regulated fencing context is quite low. A more appropriate and accurate answer would be (D) competition, as a fencing thrust with a sharp sword is typically performed in the context of a fencing match or competition, rather than with the intention to cause injury.
|
| 261 |
+
|
| 262 |
+
Based on the problems you found, improve your answer. You must choose only one option from A to E. Please reiterate your answer, with your final answer a single letter from A to E, in the form (answer).
|
| 263 |
+
|
| 264 |
+
Based on the problems with my previous answer, I apologize for the incorrect response. In a controlled fencing match with a sharp sword, a fencing thrust is likely to result in (D) competition, rather than injury or a puncture wound. Therefore, the correct final answer is (D) competition. (Incorrect)
|
| 265 |
+
|
| 266 |
+
Figure 6: Example on CommonSenseQA where self-correction changes a correct answer to an incorrect one.
|
| 267 |
+
|
| 268 |
+
Concepts: ['footage', 'motion', 'ruin', 'tilt', 'window']
|
| 269 |
+
|
| 270 |
+
Sentence: time lapse footage with tilt up motion of the sun streaking through window of ruin
|
| 271 |
+
|
| 272 |
+
###
|
| 273 |
+
|
| 274 |
+
Concepts: ['cause', 'hate', 'hut', 'local', 'love']
|
| 275 |
+
|
| 276 |
+
Sentence: new beach huts on the island have caused some controversy some locals love them others hate them
|
| 277 |
+
|
| 278 |
+
[8 more in-context examples]
|
| 279 |
+
|
| 280 |
+
###
|
| 281 |
+
|
| 282 |
+
Concepts: ['vest', 'snow','remove', 'silhouette', 'dunk', 'step', 'item', 'toddler', 'plaster', 'wall', 'piece', 'tool', 'circle', 'pull','wrap', 'headphone', 'deck', 'suit', 'press', 'mother', 'pit', 'cupcake', 'priest', 'rink', 'counter', 'rest','piano', 'wine', 'serve', 'winter']
|
| 283 |
+
|
| 284 |
+
Sentence: A toddler wearing a vest and snow boots steps onto the icy deck, removes a circle-shaped piece of plaster from the wall, and pulls out a tool from their winter suit to wrap their head around a headphone.
|
| 285 |
+
|
| 286 |
+
Figure 7: Example output for Constrained Generation using the prompt from Madaan et al. (2023). The constraint that the output needs to contain all the concepts is not explicitly mentioned in the prompt for initial response generation. However, in the feedback & refine prompts, the constraint is implied by “what concepts from the concept list are missing from the sentence?” (refer to Figures 25 and 26 of Madaan et al. (2023) for the feedback & refine prompts).
|
| 287 |
+
|
| 288 |
+
Concepts: ['vest', 'snow','remove', 'silhouette', 'dunk', 'step', 'item', 'toddler', 'plaster', 'wall', 'piece', 'tool', 'circle', 'pull','wrap', 'headphone', 'deck', 'suit', 'press', 'mother', 'pit', 'cupcake', 'priest', 'rink', 'counter', 'rest','piano', 'wine', 'serve', 'winter']
|
| 289 |
+
|
| 290 |
+
# Write a reasonable paragraph that includes \*ALL\* of the above concepts.
|
| 291 |
+
|
| 292 |
+
In the winter wonderland, a mother dressed in a warm vest watched her toddler play in the snow. As the child attempted to remove the snow from the ground, their silhouette created an enchanting image against the white backdrop. Nearby, a group of friends gathered around a basketball hoop, taking turns to dunk the ball with skillful steps. One of them, holding an item resembling a tool, used it to plaster a piece of the wall that had been damaged. Meanwhile, on the other side of the park, a circle of children pulled their hats tightly to wrap around their heads, protecting their ears from the cold wind as they listened to music through their colorful headphones. On the deck of a nearby house, a man in a sleek suit pressed a button, causing a hidden mechanism to reveal a grand piano. As the music filled the air, the host served glasses of wine to the guests, creating a warm and inviting atmosphere in the winter evening. In the distance, a priest skated gracefully in an ice rink, his movements mirroring the smoothness of his words during a sermon. At the counter of a bakery, a customer ordered a cupcake and watched as the baker skillfully decorated it with a winter-themed design. Not far away, a group of friends gathered around a pit, roasting marshmallows and enjoying the warmth of the fire. The scene painted a picture of joy, friendship, and the beauty of winter.
|
| 293 |
+
|
| 294 |
+
Figure 8: Example output for Constrained Generation using a prompt casually written by the authors.
|
md/test/KuPixIqPiq/KuPixIqPiq.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/test/LzPWWPAdY4/LzPWWPAdY4.md
ADDED
|
@@ -0,0 +1,421 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LOFTQ: LORA-FINE-TUNING-AWARE QUANTIZA-TION FOR LARGE LANGUAGE MODELS
|
| 2 |
+
|
| 3 |
+
Yixiao Li1 ∗ Yifan Yu1 ∗ Chen Liang1
|
| 4 |
+
|
| 5 |
+
Pengcheng He2
|
| 6 |
+
|
| 7 |
+
Nikos Karampatziakis2
|
| 8 |
+
|
| 9 |
+
Weizhu Chen2
|
| 10 |
+
|
| 11 |
+
Tuo Zhao1
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
Quantization is an indispensable technique for serving Large Language Models (LLMs) and has recently found its way into LoRA fine-tuning (Dettmers et al., 2023). In this work we focus on the scenario where quantization and LoRA finetuning are applied together on a pre-trained model. In such cases it is common to observe a consistent gap in the performance on downstream tasks between full fine-tuning and quantization plus LoRA fine-tuning approach. In response, we propose LoftQ (LoRA-Fine-Tuning-aware Quantization), a novel quantization framework that simultaneously quantizes an LLM and finds a proper lowrank initialization for LoRA fine-tuning. Such an initialization alleviates the discrepancy between the quantized and full-precision model and significantly improves generalization in downstream tasks. We evaluate our method on natural language understanding, question answering, summarization, and natural language generation tasks. Experiments show that our method is highly effective and outperforms existing quantization methods, especially in the challenging 2-bit and 2/4-bit mixed precision regimes. The code is available on https://github.com/yxli2123/LoftQ.1 2
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
The advent of Pre-trained Language Models (PLMs) has marked a transformative shift in the field of Natural Language Processing (NLP), offering versatile solutions across various applications (He et al., 2021b; Lewis et al., 2019; Touvron et al., 2023). They have showcased unparalleled proficiency in executing a variety of language tasks, including Natural Language Understanding (NLU) and Natural Language Generation (NLG). These models typically have millions or even billions of parameters, necessitating substantial computational and memory requirements. However, the extensive computational and memory demands of these models pose significant challenges, especially for deployments where resources are often constrained and need to be shared among many users.
|
| 20 |
+
|
| 21 |
+
To mitigate the extensive storage requirements of pre-trained models, quantization serves as a pivotal compression technique (Zafrir et al., 2019; Shen et al., 2020; Bai et al., 2022; Dettmers et al., 2022), converting high-precision numerical values into a discrete set of values. Typically, model parameters, originally stored in a 16-bit float format, are transformed into a 4-bit integer format through quantization, resulting in a substantial $7 5 \%$ reduction in storage overhead. Additionally, to facilitate the adaptation of quantized pre-trained models to downstream tasks efficiently, Low-Rank Adaptation (LoRA) is a viable approach (Hu et al., 2021). This technique is a parameter-efficient fine-tuning method traditionally applied to high-precision pre-trained models. It is based on the hypothesis that the differences between fully fine-tuned weights and pre-trained weights exhibit low-rank properties. This allows these differences to be represented using low-rank matrices. As a result, the original pre-trained weights remain unaltered, with adaptations confined solely to these low-rank matrices, enabling effective task adaptation.
|
| 22 |
+
|
| 23 |
+
When quantizing pre-trained models, practitioners often concentrate primarily on the quantization technique, inadvertently neglecting the importance of subsequent LoRA fine-tuning (Dettmers et al., 2023; Diao et al., 2023). For example, QLoRA inherits the fixup initialization (Zhang et al., 2019) used in LoRA, which (Dettmers et al., 2023) attaches zero initialized low-rank adapters (see Section 2.3) to the quantized pre-trained model. The inevitable discrepancy introduced by quantization during the approximation of the original high-precision numbers, a scenario particularly pronounced in low-bit situations such as the 2-bit regime, can adversely impact the initialization of LoRA finetuning. As illustrated in Figure 1a, the quantized pre-trained model obtained by QLoRA exhibits severe degradation below the 3-bit level. This deviation in initialization often results in an inferior fine-tuning performance. As illustrated in Figure 1b, the fine-tuning performance drops as the quantization bit decreases when applying QLoRA. Moreover, it is noteworthy that QLoRA fails below the 3-bit level.
|
| 24 |
+
|
| 25 |
+
In this paper, we introduce a novel quantization framework, called LoRA-Fine-Tuning-aware Quantization (LoftQ). It is designed specifically for pre-trained models that require quantization and LoRA fine-tuning. This framework actively integrates low-rank approximation, working in tandem with quantization to jointly approximate the original high-precision pre-trained weights. This synergy significantly enhances alignment with the original pre-trained weights as illustrated in Figure 2. Consequently, our method provides an advantageous initialization point for subsequent LoRA fine-tuning, leading to improvements in downstream tasks.
|
| 26 |
+
|
| 27 |
+

|
| 28 |
+
Figure 1: QLoRA performance with different bits. Left: QLoRA initialization of LLAMA-2-13b on WikiText-2. Right: Apply QLoRA to LLAMA-2-13b on WikiText-2 language modeling task. Smaller perplexity indicates better performance.
|
| 29 |
+
|
| 30 |
+
We evaluate our quantization framework by conducting extensive experiments on downstream tasks, such as NLU, question answering, summarization, and NLG. Experiments show that LoftQ consistently outperforms QLoRA across all precision levels. For instance, with 4-bit quantization, we achieve a 1.1 and 0.8 gain in Rouge-1 for XSum (Narayan et al., 2018) and CNN/DailyMail (Hermann et al., 2015), respectively. LoftQ excels particularly in low-bit scenarios and works effectively with different quantization methods. For example, we achieve over an $8 \%$ gain on MNLI (Wang et al., 2019) and more than $10 \%$ on SQuADv1.1 (Rajpurkar et al., 2016) with both 2-bit NormalFloat and the 2-bit uniform quantization. We have not seen our approach performs worse than QLoRA.
|
| 31 |
+
|
| 32 |
+
# 2 BACKGROUND
|
| 33 |
+
|
| 34 |
+
# 2.1 TRANSFORMER MODELS
|
| 35 |
+
|
| 36 |
+
A transformer model contains a sequence of layers, where each layer consists of two sub-layers: a multi-head self-attention (MHA) and a fully connected feed forward network (FFN) (Vaswani et al., 2017). Given the input $\ b { X } \in \mathbb { R } ^ { n \times d }$ , where $n$ is the sequence length and $d$ is the hidden dimension of the model, MHA computes the $h$ attention heads in parallel:
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\mathrm { M H A } ( X ) = \mathrm { C o n c a t } ( \mathrm { h e a d } _ { 1 } , . . . , \mathrm { h e a d } _ { h } ) W _ { o } ,
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\mathrm { h e a d } _ { i } = \mathrm { S o f t m a x } ( X W _ { q _ { i } } ( X W _ { k _ { i } } ) ^ { \top } / \sqrt { d _ { h } } ) X W _ { v _ { i } } \mathrm { f o r } i = 1 , . . . , h ,
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
where $W _ { q _ { i } } , W _ { k _ { i } } , W _ { v _ { i } } \in \mathbb { R } ^ { d \times d _ { h } }$ are query, key, and value matrices, $W _ { o } \in \mathbb { R } ^ { d \times d }$ is the output matrix, and $d _ { h } = d / h$ . FFN comprises two linear transformations and an activation function, and is defined as $\mathrm { F F N } ( X ) = \sigma ( X W _ { f _ { 1 } } \bar { + } b _ { 1 } ) W _ { f _ { 2 } } + b _ { 2 }$ , where $W _ { f _ { 1 } } \in \mathbb { R } ^ { d \times d _ { m } }$ , $W _ { f _ { 2 } } \in \mathbb { R } ^ { d _ { m } \times d }$ , and $\sigma ( \cdot )$ is the activation function. A residual connection is used and followed by layer normalization.
|
| 47 |
+
|
| 48 |
+

|
| 49 |
+
Figure 2: Initialization discrepancy between the LoRA initialization and the original pre-trained weight matrix, described by the spectral norm and Frobenius norm of the difference. The weight matrix in the above figures is randomly selected in BART-large. The initialization is obtained by QLoRA and LoftQ, with Uniform and NormalFloat quantization methods applied at both 2-bit and 4-bit levels. LoftQ successfully mitigates the discrepancy, especially at the 2-bit level.
|
| 50 |
+
|
| 51 |
+
# 2.2 QUANTIZATION
|
| 52 |
+
|
| 53 |
+
Quantization. Given a high-precision number, e.g., such as 32-bit floating point number, $X ^ { \mathrm { H P } } \in \mathbb { R }$ , $N$ -bit quantization encodes it to an integer $X ^ { \mathrm { I N T } } \in \{ 0 , 1 , . . . , 2 ^ { N } - 1 \}$ . This process can be expressed as
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
X ^ { \mathrm { I N T } } = \mathrm { r o u n d } \left( ( 2 ^ { N } - 1 ) F \left( X ^ { \mathrm { H P } } \right) \right) ,
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
where $F ( \cdot ) \colon \mathbb { R } \mapsto [ 0 , 1 ]$ is a normalization function. Uniform quantization assumes $F ( X ) = ( X -$ $X _ { \mathrm { m i n } } ) / ( X _ { \mathrm { m a x } } - X _ { \mathrm { m i n } } )$ . Dettmers et al. (2023) proposes 4-bit NormalFloat Quantization (NF4). It assumes $X \sim { \mathcal { N } } ( 0 , \sigma ^ { 2 } )$ and hence $F ( X ) = \Phi ( X / \sigma )$ , where $\Phi ( \cdot )$ is the cumulative distribution function of the standard normal distribution.
|
| 60 |
+
|
| 61 |
+
Dequantization. A lookup table $\tau$ , where
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
\mathcal { T } [ i ] = F ^ { - 1 } \left( \frac { i } { 2 ^ { N } - 1 } \right) , i = 0 , 1 , . . . , 2 ^ { N } - 1 ,
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
is used to decode the integer $X ^ { \mathrm { I N T } }$ to its simulated high-precision counterpart $X ^ { \mathbf { D } } \in \mathbb { R }$ . Therefore, the dequantization can be expressed as
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
X ^ { \mathrm { D } } = { \mathcal { T } } [ X ^ { \mathrm { I N T } } ] .
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
Simulated Quantization for Matrices. While it is possible to perform multiplication directly between quantized representations, it is common to apply simulated quantization for matrices (Bai et al., 2020; Shen et al., 2020). There, quantized weight matrices are stored as encoded integers in memory, and are temporarily dequantized to simulated high-precision matrices by the lookup table when engaged in multiplication operations. In simulated quantization, it is only necessary to analyze the map from aend-to-end process by $q _ { N } \big ( \cdot \big ) \colon \mathbb { R } ^ { m \times n } \mapsto \mathbb { R } _ { N } ^ { m \times n }$ a simu, where $\mathbb { R } _ { N } : \{ \bar { T } [ i ] \in \mathbb { R } | 0 \le i < 2 ^ { N } \}$ We denote this.
|
| 74 |
+
|
| 75 |
+
# 2.3 LOW-RANK ADAPTATION
|
| 76 |
+
|
| 77 |
+
LoRA (Hu et al., 2021) updates two small weight matrices $A$ and $B$ that are attached to a frozen pre-trained weight matrix $W$ . Hence, a linear transformation, $Y = X W$ , is reformulated as
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
\boldsymbol { Y } = \boldsymbol { X } \boldsymbol { W } + \boldsymbol { X } \boldsymbol { A } \boldsymbol { B } ^ { \intercal } ,
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
where $\begin{array} { r } { X \in \mathbb { R } ^ { n \times d _ { 1 } } , W \in \mathbb { R } ^ { d _ { 1 } \times d _ { 2 } } , A \in \mathbb { R } ^ { d _ { 1 } \times r } , B \in \mathbb { R } ^ { d _ { 2 } \times r } , } \end{array}$ , and $r \ll \operatorname* { m i n } \{ d _ { 1 } , d _ { 2 } \}$ . Initially,
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
A \sim \mathcal { N } ( 0 , \sigma ^ { 2 } ) , B = 0 ,
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
so as to align to the pre-trained weights. During the fine-tuning, $W$ is fixed while $A$ and $B$ are updated by some SGD-type optimization method.
|
| 90 |
+
|
| 91 |
+
It is worth noting that if low-rank adapters $A$ and $B$ are attached to a quantized backbone $Q =$ $q _ { N } ( W )$ and are initialized by (5), the starting weight $Q + A B ^ { \top }$ is no longer equal to the pre-trained weight $W$ due to the discrepancy introduced by the quantization.
|
| 92 |
+
|
| 93 |
+
# 3 METHOD
|
| 94 |
+
|
| 95 |
+
We propose LoRA-Fine-Tuning-aware Quantization (LoftQ), a quantization framework for LLMs. It alternatively applies quantization and low-rank approximation to approximate original pre-trained weights. This quantization framework provides a promising initialization for LoRA fine-tuning, which alleviates the quantization discrepancy in QLoRA and improves generalization in downstream tasks significantly.
|
| 96 |
+
|
| 97 |
+
# 3.1 LORA-AWARE QUANTIZATION
|
| 98 |
+
|
| 99 |
+
We use an $N$ -bit quantized weight $Q \in \mathbb { R } _ { N } ^ { d _ { 1 } \times d _ { 2 } }$ and low-rank approximations $A \in \mathbb { R } ^ { d _ { 1 } \times r } , B \in$ $\mathbb { R } ^ { d _ { 2 } \times r }$ to approximate the original high-precision pre-trained weight $W \in \mathbb { R } ^ { d _ { 1 } \times d _ { 2 } }$ as the initialization of LoRA fine-tuning. Specifically, before fine-tuning, we initialize the network by minimizing the following objective:
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\operatorname* { m i n } _ { Q , A , B } \left\| \boldsymbol W - \boldsymbol Q - \boldsymbol A \boldsymbol B ^ { \intercal } \right\| _ { F } ,
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
where $\left\| \cdot \right\| _ { F }$ denotes the Frobenious norm. This objective in (6) takes LoRA fine-tuning into consideration by jointly optimizing the initial values of the quantized backbone $Q$ and low-rank adapters $A , B$ . Contrarily, practitioners typically convert the pre-trained weight $W$ into a quantized weight $Q$ outright, neglecting the subsequent LoRA fine-tuning process. This oversight leads to notable performance degradation in downstream tasks arising from the quantization discrepancy.
|
| 106 |
+
|
| 107 |
+
# 3.2 ALTERNATING OPTIMIZATION
|
| 108 |
+
|
| 109 |
+
We solve the minimization problem in (6) by alternating between quantization and singular value decomposition (SVD). To begin with, we set $A _ { 0 }$ , and $B _ { 0 }$ equal to 0.
|
| 110 |
+
|
| 111 |
+
Quantization. At the $t$ -th step, we quantize the difference between the original pre-trained weight matrix $W$ and the low-rank approximation $A _ { t - 1 } B _ { t - 1 } ^ { \top }$ from the previous step to obtain the quantized weight matrix $Q _ { t }$ by
|
| 112 |
+
|
| 113 |
+
$$
|
| 114 |
+
Q _ { t } = q _ { N } ( W - A _ { t - 1 } B _ { t - 1 } ^ { \top } ) ,
|
| 115 |
+
$$
|
| 116 |
+
|
| 117 |
+
where $q _ { N } ( \cdot )$ maps a high-precision weight matrix to a quantized matrix.
|
| 118 |
+
|
| 119 |
+
We remark that our algorithm is compatible with different quantization functions $q _ { N } ( \cdot )$ . We apply NF4 and the uniform quantization in Section 4 as examples. We also remark that $Q _ { t }$ is not an exact solution of the minimization in (6), given the fixed $A _ { t - 1 } B _ { t - 1 } ^ { \top }$ , but it is an efficient approximation.
|
| 120 |
+
|
| 121 |
+
SVD. After obtaining the $t$ -th quantized weight $Q _ { t }$ , SVD is applied to the residual of the quantization denoted by $R _ { t } = W - Q _ { t }$ by
|
| 122 |
+
|
| 123 |
+
$$
|
| 124 |
+
R _ { t } = \sum _ { i = 1 } ^ { d } { \sigma _ { t , i } u _ { t , i } v _ { t , i } ^ { \top } } ,
|
| 125 |
+
$$
|
| 126 |
+
|
| 127 |
+
where $d = \operatorname* { m i n } \{ d _ { 1 } , d _ { 2 } \}$ , $\sigma _ { t , 1 } \geq \sigma _ { t , 2 } \geq \ldots \geq \sigma _ { t , d }$ are the singular values of $R _ { t } , u _ { t , i }$ ’s and $v _ { t , i }$ ’s are the associated left and right singular vectors of $R _ { t }$ . We then obtain a rank- $r$ approximation of $R _ { t }$ by $A _ { t } B _ { t } ^ { \top }$ , where
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
\begin{array} { r l } & { A _ { t } = [ \sqrt { \sigma _ { t , 1 } } u _ { t , 1 } , . . . , \sqrt { \sigma _ { t , r } } u _ { t , r } ] , } \\ & { B _ { t } = [ \sqrt { \sigma _ { t , 1 } } v _ { t , 1 } , . . . , \sqrt { \sigma _ { t , r } } v _ { t , r } ] . } \end{array}
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
We summarize our method in Algorithm 1. It is worth noting that $T = 1$ is a special case where $Q _ { 1 }$ is the exact quantized weight obtained by QLoRA, and low-rank approximations $A _ { 1 } , B _ { 1 }$ are obtained by the SVD of the quantization residual $W - Q _ { 1 }$ . $T = 1$ is sufficient to mitigate the quantization discrepancy, and alternating optimization helps to find a closer initialization to the pre-trained weight $W$ , which further improves the performance (see Section 3).
|
| 134 |
+
|
| 135 |
+
We remark that the computational cost of LoftQ is negligible because it is applied to individual weight matrices and can be executed in parallel. We also remark one can apply LoftQ only once to a pre-trained model and reuse the initialization obtained by LoftQ for different downstream tasks.
|
| 136 |
+
|
| 137 |
+
# 3.3 APPLYING TO LORA FINE-TUNING
|
| 138 |
+
|
| 139 |
+
We store the $Q _ { T } \in \mathbb { R } _ { N } ^ { d _ { 1 } \times d _ { 2 } }$ obtained by LoftQ using an integer matrix $M$ by (1) and a lookup table $\tau$ by (2). We initialize the backbone with the integer matrix $M$ and initialize the low-rank adapters with $A _ { T } , B _ { T }$ obtained by LoftQ.
|
| 140 |
+
|
| 141 |
+
# Algorithm 1 LoftQ
|
| 142 |
+
|
| 143 |
+
input Pre-trained weight $W$ , target rank $r$ , $N$ -bit quantization function $q _ { N } ( \cdot )$ , alternating step $T$
|
| 144 |
+
1: Initialize $A _ { 0 } 0 , B _ { 0 } 0$
|
| 145 |
+
2: for $\mathbf { t } = 1$ to $T$ do
|
| 146 |
+
3: Obtain quantized weight $Q _ { t } q _ { N } ( W - A _ { t - 1 } B _ { t - 1 } ^ { \top } )$
|
| 147 |
+
4: Obtain low-rank approximation $A _ { t } , B _ { t } \gets \operatorname { S V D } ( W - Q _ { t } )$ by (9)
|
| 148 |
+
|
| 149 |
+
5: end for output $Q _ { T } , A _ { T } , B _ { T }$
|
| 150 |
+
|
| 151 |
+
During LoRA fine-tuning, we freeze the integer weight $M$ and optimize the low-rank adapters with an efficient optimization algorithm, e.g., AdamW (Loshchilov & Hutter, 2017). In forward propagation, the integer weight $M$ is temporarily dequantized to the simulated high-precision weight $Q _ { T }$ by its lookup table, as described in (3). In back propagation, gradients and optimizer state are only related to low-rank adapters $A , B$ , which reduces considerable training cost.
|
| 152 |
+
|
| 153 |
+
# 4 EXPERIMENTS
|
| 154 |
+
|
| 155 |
+
We evaluate our method on NLU and NLG tasks. We apply LoftQ for quantizing DeBERTaV3-base (He et al., 2021b), BART-large (Lewis et al., 2019), and LLAMA-2 series (Touvron et al., 2023).
|
| 156 |
+
|
| 157 |
+
Implementation Details. Following the prior works of LoRA variants (Zhang et al., 2023; He et al., 2021a), we freeze all the backbone weight matrices and add low-rank adapters to weight matrices in MHA and FFN of all layers. We quantize the weight matrices that are attached by lowrank adapters. All the quantized models and adapters used in this paper are available on https: //huggingface.co/LoftQ. Our implementation is based on publicly available Huggingface Transformers code-base (Paszke et al., 2019). All the experiments are conducted on NVIDIA A100 GPUs.
|
| 158 |
+
|
| 159 |
+
Quantization Methods. We apply two quantization methods to demonstrate LoftQ is compatible with different quantization functions:
|
| 160 |
+
|
| 161 |
+
• Uniform quantization is a classic quantization method. It uniformly divides a continuous interval into $2 ^ { N }$ categories and stores a local maximum absolute value for dequantization. • NF4 and its 2-bit variant NF2 are quantization methods used in QLoRA (Dettmers et al., 2023). They assume that the high-precision values are drawn from a Gaussian distribution and map these values to discrete slots that have equal probability.
|
| 162 |
+
|
| 163 |
+
We perform 2-bit and 4-bit quantization on all models, achieving compression ratios of $2 5 - 3 0 \%$ and $1 5 - 2 0 \%$ at the 4-bit and 2-bit levels, respectively. The compression ratios and trainable parameter ratios for all models are detailed in the Appendix A.
|
| 164 |
+
|
| 165 |
+
Baselines. We compare LoftQ with the following baseline methods:
|
| 166 |
+
|
| 167 |
+
• Full fine-tuning is the most common approach for adapting a pre-trained model to downstream tasks. The model is initialized with pre-trained weights and all parameters are updated through an SGD-type optimization method.
|
| 168 |
+
• Full precision LoRA (LoRA) is a lightweight method for task adaptation, where it stores the backbone using 16-bit numbers and optimizes the low-rank adaptors only. The adaptors are applied to the same matrices as in LoftQ.
|
| 169 |
+
• QLoRA is similar to LoRA except the backbone is quantized into low-bit regime. The lowrank adapters are initialized using (5) and are applied to the same matrices as in LoftQ.
|
| 170 |
+
|
| 171 |
+
# 4.1 ENCODER-ONLY MODEL: DEBERTAV3
|
| 172 |
+
|
| 173 |
+
Models and Datasets. We quantize the DeBERTaV3-base (He et al., 2021b) with LoftQ, then finetune and evaluate the model on the General Language Understanding Evaluation (GLUE) benchmark (Wang et al., 2019), SQuADv1.1 (Rajpurkar et al., 2016), and ANLI (Nie et al., 2019). The specific tasks of GLUE are given in Appendix C. Following previous works (Zhang et al., 2023), we exclude WNLI in the experiments.
|
| 174 |
+
|
| 175 |
+
Implementation Details. We select the learning rates from $\{ 1 \times 1 0 ^ { - 5 } , 5 \times 1 0 ^ { - 5 } , 1 \times 1 0 ^ { - 4 } 5 \times 1 0 ^ { - 4 } \}$ . We quantize the entire backbone. Given that GLUE, SQuADv1.1, and ANLI are relatively easy NLU tasks, we also quantize the embedding layer for higher compression efficiency. We apply the NormalFloat and the uniform quantization for LoftQ and QLoRA at both 2-bit and 4-bit levels. We use rank 16 and 32 for low-rank adapters. More implementation details, such as the training epochs and batch sizes, are presented in Appendix D.2.
|
| 176 |
+
|
| 177 |
+
Main Results. Table 1 and Table 2 summarize the results for 2-bit quantization on the GLUE, SQuADv1.1, and ANLI datasets, by NF2 and the uniform quantization, respectively. Our method consistently outperforms QLoRA on all settings with respect to different ranks, quantization methods, and datasets. When using the uniform quantization (Table 2), our method achieves $8 8 . 0 \%$ accuracy on MNLI-m, surpassing the QLoRA baseline by $8 \%$ . For tasks like SST and SQuADv1.1, our method even approaches the full fine-tuning performance at 2-bit level. The 4-bit quantization experiment results are presented in Appendix D.1 as both LoftQ and QLoRA achieve performance close to full fine-tuning.
|
| 178 |
+
|
| 179 |
+
Table 1: Results with 2-bit LoftQ of DeBERTaV3-base models on GLUE development set, SQuADv1.1 development set, ANLI test set using NF2 quantization. We report the median over four seeds. N.A. indicates the model does not converge. The best results on each dataset are shown in bold.
|
| 180 |
+
|
| 181 |
+
<table><tr><td>Rank</td><td>Method</td><td>MNLI m/mm</td><td>QNLI Acc</td><td>RTE Acc</td><td>SST Acc</td><td>MRPC Acc</td><td>CoLA Matt</td><td>QQP Acc</td><td>STSB P/S Corr</td><td>SQuAD EM/F1</td><td>ANLI Acc</td></tr><tr><td></td><td>Full FT</td><td>90.5/90.6</td><td>94.0</td><td>82.0</td><td>95.3</td><td>89.5/93.3</td><td>69.2</td><td>92.4/89.8</td><td>91.6/91.1</td><td>88.5/92.8</td><td>59.8</td></tr><tr><td>16</td><td>LoRA</td><td>90.4/90.5</td><td>94.6</td><td>85.1</td><td>95.1</td><td>89.9/93.6</td><td>69.9</td><td>92.0/89.4</td><td>91.7/91.1</td><td>87.3/93.1</td><td>60.2</td></tr><tr><td>16</td><td>QLoRA</td><td>75.4775.6</td><td>824</td><td>55</td><td>86.5</td><td>73.8/82.8</td><td>N</td><td>86.3/82.3</td><td>83.0/82.8</td><td>61.5/71.2</td><td>N</td></tr><tr><td>32</td><td>LoRA</td><td>78.5/78.7</td><td>804</td><td>567</td><td>869</td><td>73.8/82.7</td><td>N</td><td>87.182.7</td><td>83.6/83.3</td><td>64.6773.8</td><td></td></tr></table>
|
| 182 |
+
|
| 183 |
+
Table 2: Results with 2-bit LoftQ of DeBERTaV3-base models on GLUE development set, SQuADv1.1 development set using Uniform quantization . We report the median over four seeds. N.A. indicates the model does not converge. The best results on each task are shown in bold.
|
| 184 |
+
|
| 185 |
+
<table><tr><td>Rank</td><td>Method</td><td>MNLI m/mm</td><td>QNLI Acc</td><td>RTE Acc</td><td>SST Acc</td><td>MRPC Acc</td><td>CoLA Matt</td><td>QQP Acc</td><td>STSB P/S Corr</td><td>SQuAD Em/F1</td></tr><tr><td></td><td>Full FT</td><td>90.5/90.6</td><td>94.0</td><td>82.0</td><td>95.3</td><td>89.5/93.3</td><td>69.2</td><td>92.4/89.8</td><td>91.6/91.1</td><td>88.5/92.8</td></tr><tr><td>16</td><td>LoRA</td><td>90.4/90.5</td><td>94.6</td><td>85.1</td><td>95.1</td><td>89.9/93.6</td><td>69.9</td><td>92.0/89.4</td><td>91.7/91.1</td><td>87.3/93.1</td></tr><tr><td>16</td><td>QLoRA</td><td>76.5/76.3</td><td>88</td><td>567</td><td>86</td><td>75.7784.7</td><td></td><td>87.182.6</td><td>83.5/83.4</td><td>89.5/776</td></tr><tr><td>32</td><td>LoRA</td><td>79.9779.5</td><td>87</td><td>578</td><td>8.9</td><td>76.5/84.2</td><td>N</td><td>8.6/84.7</td><td>84.1/84.0</td><td>71.6/80.2</td></tr></table>
|
| 186 |
+
|
| 187 |
+
Our method is also more stable compared to QLoRA in the low-bit regime. For instance, while QLoRA fails to converge on CoLA for both quantization methods and ranks, LoftQ converges in all cases and achieves a score of 60.5 using uniform quantization at rank 32. LoftQ stands out in its ability to consistently attain robust and improved performance by effectively preserving the starting point of pre-trained weights.
|
| 188 |
+
|
| 189 |
+
# 4.2 ENCODER-DECODER MODEL: BART
|
| 190 |
+
|
| 191 |
+
Models and Datasets. We quantize BART-large model (Lewis et al., 2020) with LoftQ, then finetune and evaluate the model on two commonly used summarization datasets: XSum (Narayan et al., 2018) and CNN/DailyMail(Hermann et al., 2015).
|
| 192 |
+
|
| 193 |
+
Implementation Details. We apply LoftQ to weight matrices in MHA and FFN of both encoder and decoder layers. We report ROUGE 1/2/L scores, which are the metrics for summarization tasks (Lin, 2004). We conduct quantization experiments in both 2-bit and 4-bit scenarios. We experiment with both NormalFloat and the uniform quantization in both 2-bit and 4-bit scenarios. In each precision, we choose rank equal to 8 and 16 for a fair comparison with the full precision LoRA baseline (Zhang et al., 2023). Please see Appendix E for detailed configurations.
|
| 194 |
+
|
| 195 |
+
Main Results. Table 3 summarizes our 4-bit quantization experiment results on the XSum and CNN/DailyMail test sets. Our method consistently outperforms QLoRA at both ranks on both datasets. It even surpasses full precision LoRA at both ranks on Xsum. We will discuss this unexpected results in Section 5. The 2-bit quantization results are shown in Table 4. Our observation is consistent with the NLU experiments, that LoftQ demonstrates the convergence to reasonable results, while QLoRA does not converge. This indicates our method is robuster by narrowing the initialization gap.
|
| 196 |
+
|
| 197 |
+
Table 3: Results with 4-bit LoftQ of BART-large on XSum and CNN/DailyMail. We report ROUGE1/2/L. Lead-3 means choosing the first 3 sentences as the summary. N.A. indicates the model does not converge. Full FT: full fine-tuning. We report the median over five seeds.
|
| 198 |
+
|
| 199 |
+
<table><tr><td>Quantization</td><td>Rank</td><td>Method</td><td>XSum</td><td>CNN/DailyMail</td></tr><tr><td rowspan="2">Full Precision</td><td></td><td>Lead-3 Full FT</td><td>16.30/1.60/11.95 45.14/22.27/37.25</td><td>40.42/17.62/36.67 44.16/21.28/40.90</td></tr><tr><td>8</td><td>LoRA</td><td>43.40/20.20/35.20</td><td>44.72/21.58/41.84</td></tr><tr><td rowspan="3">NF4</td><td>16 8</td><td>LoRA QLoRA</td><td>43.95/20.72/35.68 42.91/19.72/34.82</td><td>45.03/21.84/42.15 43.10/20.22/40.06</td></tr><tr><td></td><td>LoftQ</td><td>44.08/20.72/35.89</td><td>43.81/20.95/40.84</td></tr><tr><td>16</td><td>QLoRA</td><td>43.29/20.0/35.15</td><td>43.42/20.67/40.4</td></tr><tr><td rowspan="3">Uniform</td><td>8</td><td></td><td></td><td></td></tr><tr><td></td><td>QLoRA</td><td>41.84/18.71/3374</td><td>43.73/20.91/40.77</td></tr><tr><td>16</td><td>QLoRA</td><td>4.45/19.36/34.38</td><td>4300/20.19/40.02</td></tr></table>
|
| 200 |
+
|
| 201 |
+
Table 4: Results with 2-bit LoftQ of BART-large on XSum and CNN/DailyMail using NF2 quantization. N.A. indicates the model does not converge. We report ROUGE-1/2/L, the higher the better. We report the median over five seeds.
|
| 202 |
+
|
| 203 |
+
<table><tr><td>Rank</td><td>Method</td><td>XSum</td><td>CNN/DailyMail</td></tr><tr><td>8</td><td>QLoRA LoftQ</td><td>N.A. 39.63/16.65/31.62</td><td>N.A. 42.24/19.44/29.04</td></tr><tr><td>16</td><td>QLoRA</td><td>40.81/17.85/32.80</td><td>42.52/19.81/39.51</td></tr></table>
|
| 204 |
+
|
| 205 |
+
# 4.3 DECODER-ONLY MODEL: LLAMA-2
|
| 206 |
+
|
| 207 |
+
Models and Datasets. We quantize LLAMA-2-7b and LLAMA-2-13b (Touvron et al., 2023) with LoftQ. We then fine-tune and evaluate the models on two NLG datasets: GSM8K (Cobbe et al., 2021) and WikiText-2 (Merity et al., 2016). Please see Appendix F for more details about the datasets.
|
| 208 |
+
|
| 209 |
+
Implementation Details. Similarly, we apply LoftQ to weight matrices in MHA and FFN of all layers. In WikiText-2 evaluation, we report perplexity. In case of overfitting, we apply weight decay to low-rank adapters for all settings. In GSM8K evaluation, we extract numerical answers in the generated solutions and then calculate the accuracy using those numerical answers. We conduct experiments with both NF2 and NF4. Please see Appendix F for detailed configurations.
|
| 210 |
+
|
| 211 |
+
Main Results. Table 5 presents a summary of our experiments on LLAMA-2-7b and LLAMA-2- 13b using 2-bit, 4-bit, and mixed-precision NormalFloat quantization methods on WikiText-2 and GSM8K datasets. In WikiText-2, our method consistently outperforms QLoRA across all quantization precision settings on both models. When dealing with the challenging 2-bit precision, where QLoRA fails to converge, LoftQ manages to achieve a perplexity of 7.85. In GSM8K, our method achieves better or on par performance compared to QLoRA across different model sizes and quantization precision levels. For example, our method achieves $2 6 . 5 \%$ accuracy using 2-bit precision of LLAMA-2-7b, where QLoRA does not converge.
|
| 212 |
+
|
| 213 |
+
To provide a customized trade-off between the performance and precision, we also explore mixedprecision (equivalent to 3 bits) quantization where matrices in the first half layers are quantized using 4 bits, and the rest matrices remain 2 bits. We witness a remarkable $4 . 1 \%$ accuracy boost on the GSM8K dataset using LLAMA-2-7b and a $4 . 7 \%$ boost using LLAMA-2-13b. This result underscores the potential of LoftQ for complex mixed-precision quantization scenarios.
|
| 214 |
+
|
| 215 |
+
Table 5: Results of LoftQ using NormalFloat for LLAMA-2 series on WikiText-2 and GSM8K. 3/2.5/2.25-bit indicates mixed-precision quantization: 4-bit precision for the first 16/8/4 layers and 2-bit precision for the rest of layers. We report the perplexity (the smaller the better) for WikiText-2 and accuracy for GSM8K. The rank of low-rank adapters is 64. N.A. indicates the model does not converge. We report the median over five random seeds.
|
| 216 |
+
|
| 217 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Bit</td><td colspan="2">wikiLLAMA-2-7M8K↑</td><td colspan="2">wikiLLAMA-2-13M8K↑</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>LoRA</td><td>16</td><td>5.08</td><td>38.5</td><td>5.12</td><td>48.8</td></tr><tr><td rowspan="2">QLoRA LoftQ</td><td>4</td><td>5.70</td><td>38.2</td><td>5.22</td><td>48.8</td></tr><tr><td>4</td><td>5.24</td><td>38.0</td><td>5.16</td><td>49.1</td></tr><tr><td rowspan="2">QLoRA LoftQ</td><td>3</td><td>5.73</td><td>32.1</td><td>5.22</td><td>40.7</td></tr><tr><td>3</td><td>5.63</td><td>36.2</td><td>5.13</td><td>45.4</td></tr><tr><td rowspan="2">QLoRA LoftQ</td><td>2.5</td><td>N.A.</td><td>N.A.</td><td>19.39</td><td>N.A.</td></tr><tr><td>2.5</td><td>5.78</td><td>31.1</td><td>5.22</td><td>41.1</td></tr><tr><td rowspan="2">QLoRA LoftQ</td><td>2.25</td><td>N.A.</td><td>N.A.</td><td>N.A.</td><td>N.A.</td></tr><tr><td>2.25</td><td>6.13</td><td>27.5</td><td>5.45</td><td>38.1</td></tr><tr><td rowspan="2">QLoRA LoftQ</td><td>2</td><td>N.A</td><td>N.A.</td><td>N.A.</td><td></td></tr><tr><td>2</td><td>7.85</td><td>26.5</td><td>7.69</td><td>N.A. 33.4</td></tr></table>
|
| 218 |
+
|
| 219 |
+
# 4.4 ANALYSIS
|
| 220 |
+
|
| 221 |
+
Effectiveness of Alternating Optimization. We conduct experiments with different alternating step $T$ to verify the effectiveness of the alternating optimization and to find the best value $T$ as a hyperparameter for different models. Across all tasks and models, we observed that alternating optimization yields substantial improvements even with a minimal alternating step. This suggests that it rapidly narrows the discrepancy between quantized weights and pre-trained weights, making our method easy to apply. For example, LoftQ achieves 21.14 Rouge-2 score on XSum using only 1 step. Interestingly, we noticed that increasing the alternating step beyond a certain point tends to result in diminishing returns. We suspect this phenomenon occurs because, as the gap becomes smaller, it becomes more challenging for alternating optimization to consistently minimize the gap at each step. This challenge emerges because of the inherent errors introduced by the quantization method. Nevertheless, results from Figure 3 indicate our method is not sensitive to the alternating step $T$ and is able to consistently enhance downstream fine-tuning performance.
|
| 222 |
+
|
| 223 |
+

|
| 224 |
+
Figure 3: Comparison of different alternating step $T$ used in LoftQ. $T = 0$ indicates we use QLoRA method that initializes low-rank adapters by (5). $T = 1 , 5 , 1 0$ indicates we use different $T$ for LoftQ described in Algorithm 1. Left: Uniform 2-bit DeBERTaV3-base. Middle: NF2 2-bit LLAMA-2- 13b. Right: NF4 BART-large.
|
| 225 |
+
|
| 226 |
+
# 5 DISCUSSION
|
| 227 |
+
|
| 228 |
+
Start with quantization or SVD in the alternating optimization? An alternative algorithm to the alternating optimization is that we first obtain the low-rank approximation $A _ { t } , B _ { t }$ and then obtain the quantized weight $Q _ { t }$ by switching Line 3 and Line 4 in Algorithm 1. We note this is a valid alternative method as both still jointly minimize the objective in (6). Table 6 summarizes the performance of this alternative method. It is noteworthy that the alternative method still outperforms QLoRA significantly, even though it is worse than the primary version. This observation underscores the potential for performance improvement by achieving a closer approximation of pre-trained weights within the low-precision regime.
|
| 229 |
+
|
| 230 |
+
LoftQ better than Full-precision LoRA? We find LoftQ outperforms full precision LoRA in XSum and GSM8K (see Table 3 and Table 5). Beside the overfitting caused by lack of regularization, anonther possible explanation for this unexpected phenomenon is that the initial low-rank adapters obtained by LoftQ are non-zero while they are all zero in full precision LoRA as described in (5). Such zero initialization could make the fine-tuning unstable, and therefore it performs worse than LoftQ. We leave the study of the robustness of LoftQ as future work.
|
| 231 |
+
|
| 232 |
+
Table 6: Results of 2-bit uniformly quantized DeBERTaV3-base on part of GLUE. LoftQ(SVD First) indicates the alternative LoftQ that swiches Line 3 and Line 4 in Algorithm 1. We report the median over four random seeds. The best results on each task are shown in bold.
|
| 233 |
+
|
| 234 |
+
<table><tr><td>Method</td><td>Rank</td><td>MNLI</td><td>QNLI</td><td>SST2</td></tr><tr><td>Full FT</td><td></td><td>90.5/90.6</td><td>94.0</td><td>95.3</td></tr><tr><td>QLoRA</td><td>32</td><td>79.9/79.5</td><td>83.8</td><td>86.6</td></tr><tr><td>LoftQ(SVD First)</td><td>32</td><td>87.8/87.7</td><td>84.9</td><td>89.7</td></tr><tr><td>LoftQ(Quantiztion First)</td><td>32</td><td>88.0/88.1</td><td>92.2</td><td>94.7</td></tr></table>
|
| 235 |
+
|
| 236 |
+
# 6 RELATED WORK
|
| 237 |
+
|
| 238 |
+
Quantization-Aware Training (QAT) is often used to obtain quantized models that are adapted in downstream tasks (Peri et al., 2020; Liu et al., 2023). It involves quantization and full model fine-tuning at the same time. However, QAT requires massive training cost, such as the gradient and optimization state. Moreover, it is difficult to compute the gradient of quantized weights. Our method, with the help of LoRA, sidesteps the aforementioned issues, providing a light approach for downstream task adaptation.
|
| 239 |
+
|
| 240 |
+
Post-Training Quantization (PTQ) is a category of popular quantization frameworks (Frantar et al., 2022; Xiao et al., 2023), which can also be used for task adaptation. It calibrates the high-precision model with a small subset of the training dataset. Therefore, the subsequent quantization is guided by the training dataset, providing task-specific quantized models. Besides, it does not involve any gradient backpropagation, so it is cost-efficient. However, it usually results in lower accuracy compared to QAT.
|
| 241 |
+
|
| 242 |
+
# 7 CONCLUSION
|
| 243 |
+
|
| 244 |
+
We propose LoftQ, a quantization framework for LLMs, which alternatively applies quantization and low-rank approximation to the original high-precision pre-trained weights, to obtain an initialization for the subsequent LoRA fine-tuning. Experiments on natural language understanding, question answering, summarization, and natural language generation show that our framework remarkably surpasses existing methods, e.g., QLoRA, for quantizing encoder-only, encoder-decoder, and decoder-only models. We have not observed our method exhibiting worse performance over QLoRA. Moreover, our quantization framework demonstrates effectiveness and robustness particularly in low-bit quantization regimes, e.g., the 2-bit level.
|
| 245 |
+
|
| 246 |
+
REFERENCES
|
| 247 |
+
Haoli Bai, Wei Zhang, Lu Hou, Lifeng Shang, Jing Jin, Xin Jiang, Qun Liu, Michael Lyu, and Irwin King. Binarybert: Pushing the limit of bert quantization. arXiv preprint arXiv:2012.15701, 2020.
|
| 248 |
+
Haoli Bai, Lu Hou, Lifeng Shang, Xin Jiang, Irwin King, and Michael R Lyu. Towards efficient posttraining quantization of pre-trained language models. Advances in Neural Information Processing Systems, 35:1405–1418, 2022.
|
| 249 |
+
Roy Bar-Haim, Ido Dagan, Bill Dolan, Lisa Ferro, Danilo Giampiccolo, Bernardo Magnini, and Idan Szpektor. The second pascal recognising textual entailment challenge. 2006.
|
| 250 |
+
Luisa Bentivogli, Peter Clark, Ido Dagan, and Danilo Giampiccolo. The fifth pascal recognizing textual entailment challenge. In TAC, 2009.
|
| 251 |
+
Daniel Cer, Mona Diab, Eneko Agirre, Inigo Lopez-Gazpio, and Lucia Specia. SemEval-2017 task ˜ 1: Semantic textual similarity multilingual and crosslingual focused evaluation. In Proceedings of the 11th International Workshop on Semantic Evaluation (SemEval-2017), pp. 1–14, Vancouver, Canada, August 2017. Association for Computational Linguistics. doi: 10.18653/v1/S17-2001.
|
| 252 |
+
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.
|
| 253 |
+
Ido Dagan, Oren Glickman, and Bernardo Magnini. The pascal recognising textual entailment challenge. In Machine Learning Challenges Workshop, 2007.
|
| 254 |
+
Tim Dettmers, Mike Lewis, Younes Belkada, and Luke Zettlemoyer. Llm. int8 (): 8-bit matrix multiplication for transformers at scale. arXiv preprint arXiv:2208.07339, 2022.
|
| 255 |
+
Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. Qlora: Efficient finetuning of quantized llms. arXiv preprint arXiv:2305.14314, 2023.
|
| 256 |
+
Shizhe Diao, Rui Pan, Hanze Dong, Ka Shun Shum, Jipeng Zhang, Wei Xiong, and Tong Zhang. Lmflow: An extensible toolkit for finetuning and inference of large foundation models. arXiv preprint arXiv:2306.12420, 2023.
|
| 257 |
+
William B. Dolan and Chris Brockett. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005), 2005.
|
| 258 |
+
Elias Frantar, Saleh Ashkboos, Torsten Hoefler, and Dan Alistarh. Gptq: Accurate post-training quantization for generative pre-trained transformers. arXiv preprint arXiv:2210.17323, 2022.
|
| 259 |
+
Danilo Giampiccolo, Bernardo Magnini, Ido Dagan, and Bill Dolan. The third PASCAL recognizing textual entailment challenge. In Proceedings of the ACL-PASCAL Workshop on Textual Entailment and Paraphrasing, pp. 1–9, Prague, June 2007. Association for Computational Linguistics.
|
| 260 |
+
Junxian He, Chunting Zhou, Xuezhe Ma, Taylor Berg-Kirkpatrick, and Graham Neubig. Towards a unified view of parameter-efficient transfer learning. arXiv preprint arXiv:2110.04366, 2021a.
|
| 261 |
+
Pengcheng He, Jianfeng Gao, and Weizhu Chen. Debertav3: Improving deberta using electra-style pre-training with gradient-disentangled embedding sharing. arXiv preprint arXiv:2111.09543, 2021b.
|
| 262 |
+
Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. Advances in neural information processing systems, 28, 2015.
|
| 263 |
+
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. arXiv preprint arXiv:2106.09685, 2021.
|
| 264 |
+
Hector Levesque, Ernest Davis, and Leora Morgenstern. The winograd schema challenge. In Thirteenth international conference on the principles of knowledge representation and reasoning, 2012.
|
| 265 |
+
|
| 266 |
+
Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. Bart: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461, 2019.
|
| 267 |
+
|
| 268 |
+
Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 7871–7880, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.703.
|
| 269 |
+
Yixiao Li, Yifan Yu, Qingru Zhang, Chen Liang, Pengcheng He, Weizhu Chen, and Tuo Zhao. Losparse: Structured compression of large language models based on low-rank and sparse approximation. arXiv preprint arXiv:2306.11222, 2023.
|
| 270 |
+
Chin-Yew Lin. ROUGE: A package for automatic evaluation of summaries. In Text Summarization Branches Out, pp. 74–81, Barcelona, Spain, July 2004. Association for Computational Linguistics.
|
| 271 |
+
Zechun Liu, Barlas Oguz, Changsheng Zhao, Ernie Chang, Pierre Stock, Yashar Mehdad, Yangyang Shi, Raghuraman Krishnamoorthi, and Vikas Chandra. Llm-qat: Data-free quantization aware training for large language models. arXiv preprint arXiv:2305.17888, 2023.
|
| 272 |
+
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
|
| 273 |
+
Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models, 2016.
|
| 274 |
+
Shashi Narayan, Shay B. Cohen, and Mirella Lapata. Don’t give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. ArXiv, abs/1808.08745, 2018.
|
| 275 |
+
Yixin Nie, Adina Williams, Emily Dinan, Mohit Bansal, Jason Weston, and Douwe Kiela. Adversarial nli: A new benchmark for natural language understanding. ArXiv, abs/1910.14599, 2019. URL https://api.semanticscholar.org/CorpusID:207756753.
|
| 276 |
+
Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary 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. In Advances in Neural Information Processing Systems 32, pp. 8024–8035. Curran Associates, Inc., 2019.
|
| 277 |
+
Dheeraj Peri, Jhalak Patel, and Josh Park. Deploying quantization-aware trained networks using tensorrt. In GPU Technology Conference, 2020.
|
| 278 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. SQuAD: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 2383–2392, Austin, Texas, November 2016. Association for Computational Linguistics. doi: 10.18653/v1/D16-1264.
|
| 279 |
+
Sheng Shen, Zhen Dong, Jiayu Ye, Linjian Ma, Zhewei Yao, Amir Gholami, Michael W Mahoney, and Kurt Keutzer. Q-bert: Hessian based ultra low precision quantization of bert. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 8815–8821, 2020.
|
| 280 |
+
Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew $\mathrm { N g }$ , and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pp. 1631–1642, Seattle, Washington, USA, October 2013. Association for Computational Linguistics.
|
| 281 |
+
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023.
|
| 282 |
+
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.
|
| 283 |
+
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, 2019.
|
| 284 |
+
Alex Warstadt, Amanpreet Singh, and Samuel R. Bowman. Neural network acceptability judgments. Transactions of the Association for Computational Linguistics, 7:625–641, 2019. doi: 10.1162/ tacl a 00290.
|
| 285 |
+
Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 1112–1122, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-1101.
|
| 286 |
+
Guangxuan Xiao, Ji Lin, Mickael Seznec, Hao Wu, Julien Demouth, and Song Han. Smoothquant: Accurate and efficient post-training quantization for large language models. In International Conference on Machine Learning, pp. 38087–38099. PMLR, 2023.
|
| 287 |
+
Ofir Zafrir, Guy Boudoukh, Peter Izsak, and Moshe Wasserblat. Q8bert: Quantized 8bit bert. In 2019 Fifth Workshop on Energy Efficient Machine Learning and Cognitive Computing-NeurIPS Edition (EMC2-NIPS), pp. 36–39. IEEE, 2019.
|
| 288 |
+
Hongyi Zhang, Yann N Dauphin, and Tengyu Ma. Fixup initialization: Residual learning without normalization. arXiv preprint arXiv:1901.09321, 2019.
|
| 289 |
+
Qingru Zhang, Minshuo Chen, Alexander Bukharin, Pengcheng He, Yu Cheng, Weizhu Chen, and Tuo Zhao. Adaptive budget allocation for parameter-efficient fine-tuning. arXiv preprint arXiv:2303.10512, 2023.
|
| 290 |
+
|
| 291 |
+
# A MODEL COMPRESSION RATIO AND MEMORY FOOTPRINT
|
| 292 |
+
|
| 293 |
+
We report the compression ratio after applying LoftQ in Table 7. It is defined as backbone size + LoRA adapter size compression ration $=$ pre-trained size
|
| 294 |
+
|
| 295 |
+
We also measure the GPU memory cost during training. Given that GPU memory varies by models, tasks, sequence lengths, batch sizes, etc. We report LLAMA-2 on GSM8K as an example in Table 8.
|
| 296 |
+
|
| 297 |
+
Table 7: Compression ratios of backbones.
|
| 298 |
+
|
| 299 |
+
<table><tr><td>Model</td><td>Compression ratio (%)</td><td>Trainable ratio (%)</td><td>Rank</td><td>Bits</td><td>Quantization method</td></tr><tr><td>DeBERTaV3-base</td><td>15.6</td><td>3.1</td><td>16</td><td></td><td>Uniform</td></tr><tr><td>DeBERTaV3-base</td><td>18.8</td><td>6.3</td><td>32</td><td></td><td>Uniform</td></tr><tr><td>DeBERTaV3-base</td><td>17.2</td><td>3.1</td><td>16</td><td>222</td><td>NF2</td></tr><tr><td>DeBERTaV3-base</td><td>20.4</td><td>6.3</td><td>32</td><td>2</td><td>NF2</td></tr><tr><td>BART-large</td><td>15.3</td><td>1.2</td><td>8</td><td>4</td><td>NF2</td></tr><tr><td>BART-large</td><td>16.7</td><td>2.5</td><td>16</td><td>4</td><td>NF2</td></tr><tr><td>BART-large</td><td>27.8</td><td>1.2</td><td>8</td><td>4</td><td>NF4</td></tr><tr><td>BART-large</td><td>29.0</td><td>2.5</td><td>16</td><td>4</td><td>NF4</td></tr><tr><td>BART-large</td><td>26.2</td><td>1.2</td><td>8</td><td>4</td><td>Uniform</td></tr><tr><td>BART-large</td><td>27.5</td><td>2.5</td><td>16</td><td>4</td><td>Uniform</td></tr><tr><td>LLAMA-2-7b</td><td>16.6</td><td>2.4</td><td>64</td><td>2</td><td>Nf2</td></tr><tr><td>LLAMA-2-7b</td><td>29.0</td><td>2.4</td><td>64</td><td>4</td><td>Nf4</td></tr><tr><td>LLAMA-2-13b</td><td>16.0</td><td>1.9</td><td>64</td><td>2</td><td>Nf2</td></tr><tr><td>LLAMA-2-13b</td><td>28.5</td><td>1.9</td><td>64</td><td>4</td><td>Nf4</td></tr></table>
|
| 300 |
+
|
| 301 |
+
Table 8: GPU memory footprint
|
| 302 |
+
|
| 303 |
+
<table><tr><td>Model</td><td>Dataset</td><td> Seq length</td><td>Batch size</td><td>GPU Mem</td></tr><tr><td>LLAMA-2-7b</td><td>GSM8K</td><td>384</td><td>1</td><td>15GB</td></tr><tr><td>LLAMA-2-13b</td><td>GSM8K</td><td>384</td><td>1</td><td>24GB</td></tr></table>
|
| 304 |
+
|
| 305 |
+
# B QUANTIZATION TIME
|
| 306 |
+
|
| 307 |
+
We report the execution time of LoftQ applying to a single weight matrix in Table 9. The time is tested on Intel(R) Xeon(R) CPU E5-2650 v4 $\textcircled { a } 2 . 2 0 \mathrm { G H z }$ .
|
| 308 |
+
|
| 309 |
+
Table 9: Execution time of LoftQ applying to different weight matrices.
|
| 310 |
+
|
| 311 |
+
<table><tr><td>Model</td><td>Size</td><td>Step T</td><td>Quantization method</td><td>Time</td></tr><tr><td>DeBERTaV3-base</td><td>768×768</td><td>5</td><td>Uniform</td><td>1s</td></tr><tr><td>BART-large</td><td>1024×1024</td><td>5</td><td>NF4</td><td>1s</td></tr><tr><td>LLAMA-2-7b</td><td>4096 × 4096</td><td>5</td><td>NF4</td><td>21s</td></tr><tr><td>LLAMA-2-13b</td><td>5120 × 5120</td><td>5</td><td>NF4</td><td>43s</td></tr></table>
|
| 312 |
+
|
| 313 |
+
# C GLUE DATASET STATISTICS
|
| 314 |
+
|
| 315 |
+
We present the dataset statistics of GLUE Wang et al. (2019) in the following table.
|
| 316 |
+
|
| 317 |
+
GLUE includes two single-sentence classification tasks: SST-2 (Socher et al., 2013) and CoLA (Warstadt et al., 2019), and three similarity and paraphrase tasks: MRPC (Dolan & Brockett, 2005), STS-B (Cer et al., 2017), and QQP. GLUE also includes four natural language inference tasks in GLUE: MNLI (Williams et al., 2018), QNLI (Rajpurkar et al., 2016), RTE (Dagan et al., 2007; BarHaim et al., 2006; Giampiccolo et al., 2007; Bentivogli et al., 2009), and WNLI (Levesque et al., 2012).
|
| 318 |
+
|
| 319 |
+
Table 10: Summary of the GLUE benchmark.
|
| 320 |
+
|
| 321 |
+
<table><tr><td>Corpus</td><td>Task</td><td>#Train</td><td>#Dev</td><td>#Test</td><td>#Label</td><td>Metrics</td></tr><tr><td colspan="7">Single-Sentence Classification (GLUE)</td></tr><tr><td>CoLA</td><td> Acceptability</td><td>8.5k</td><td>1k</td><td>1k</td><td>2</td><td>Matthews corr</td></tr><tr><td>SST</td><td>Sentiment</td><td>67k</td><td>872</td><td>1.8k</td><td>2</td><td>Accuracy</td></tr><tr><td colspan="7">Pairwise Text Classification (GLUE)</td></tr><tr><td>MNLI</td><td>NLI</td><td>393k</td><td>20k</td><td>20k</td><td>3</td><td>Accuracy</td></tr><tr><td>RTE</td><td>NLI</td><td>2.5k</td><td>276</td><td>3k</td><td>2</td><td>Accuracy</td></tr><tr><td>QQP</td><td>Paraphrase</td><td>364k</td><td>40k</td><td>391k</td><td>2</td><td>Accuracy/F1</td></tr><tr><td>MRPC</td><td>Paraphrase</td><td>3.7k</td><td>408</td><td>1.7k</td><td>2</td><td>Accuracy/F1</td></tr><tr><td>QNLI</td><td>QA/NLI</td><td>108k</td><td>5.7k</td><td>5.7k</td><td>2</td><td>Accuracy</td></tr><tr><td colspan="7">Text Similarity (GLUE)</td></tr><tr><td>STS-B</td><td>Similarity</td><td>7k</td><td>1.5k</td><td>1.4k</td><td>1</td><td>Pearson/Spearman corr</td></tr></table>
|
| 322 |
+
|
| 323 |
+
# D NATURAL LANGUAGE UNDERSTANDING
|
| 324 |
+
|
| 325 |
+
# D.1 GLUE WITH 4-BIT
|
| 326 |
+
|
| 327 |
+
We show the 4-bits results in the Table 11. Both methods can achieve performance close to fullfinetuning.
|
| 328 |
+
|
| 329 |
+
Table 11: Results with 4-bit LoftQ of DeBERTaV3-base models on GLUE development set using NF4 quantization. We report the median over four seeds. Results with N.A. indicate the model does not converge. The best results on each dataset are shown in bold
|
| 330 |
+
|
| 331 |
+
<table><tr><td>Method</td><td>Rank</td><td>MNLI m /mm</td><td>SST-2 Acc</td><td>QNLI Acc</td><td>ANLI Acc</td></tr><tr><td>Full FT</td><td>-</td><td>90.5/90.6</td><td>95.3</td><td>94.0</td><td>59.8</td></tr><tr><td>QLoRA</td><td>32</td><td>89.9/89.9</td><td>95.3</td><td>94.2</td><td>59.4</td></tr><tr><td>LoftQ</td><td>32</td><td>89.9/90.0</td><td>95.3</td><td>94.1</td><td>59.9</td></tr></table>
|
| 332 |
+
|
| 333 |
+
# D.2 TRAINING DETAILS
|
| 334 |
+
|
| 335 |
+
Implementation Details. The implementation of LoftQ is based on publicly available Huggingface (Paszke et al., 2019) code-base 3.
|
| 336 |
+
|
| 337 |
+
Hyper-parameter Details. We select the learning rate of $\{ 1 \times 1 0 ^ { - 5 } , 5 \times 1 0 ^ { - 5 } , 1 \times 1 0 ^ { - 4 } , 5 \times 1 0 ^ { - 4 } \}$ , and use the selected learning rate for both uniform quantization experiments and nf2 quantization experiments. We use batch size of 32 for all GLUE tasks and ANLI. We use batch size of 16 for SQuADv1.1. We use LoftQ of 5 iterations for all GLUE tasks.
|
| 338 |
+
|
| 339 |
+
Table 12 summarizes the detailed hyperparameters for each task used in training DeBERTaV3-base using uniform quantization. Table 13 summarizes the detailed hyperparameters for each task used in training DeBERTaV3-base using nf2 quantization.
|
| 340 |
+
|
| 341 |
+
Table 12: Hyper-parameter setup of LoftQ for GLUE benchmark for training DeBERTaV3-base using Uniform quantization.
|
| 342 |
+
|
| 343 |
+
<table><tr><td>Hyper-parameter</td><td>MNLI</td><td>RTE</td><td>QNLI</td><td>MRPC</td><td>QQP</td><td>SST-2</td><td>CoLA</td><td>STS-B</td><td>SQuADv1.1</td><td>ANLI</td></tr><tr><td># epochs</td><td>5</td><td>20</td><td>10</td><td>60</td><td>10</td><td>10</td><td>60</td><td>60</td><td>10</td><td>12</td></tr><tr><td>Learning rate</td><td>1 ×10-4</td><td>5×10-4</td><td>5×10-5</td><td>1×10-4</td><td>5×10-5</td><td>5×10-5</td><td>5×10-5</td><td>5×10-5</td><td>5×10-5</td><td>5×10-5</td></tr></table>
|
| 344 |
+
|
| 345 |
+
3https://github.com/huggingface/transformers/tree/main/examples/pytorch
|
| 346 |
+
|
| 347 |
+
Table 13: Hyper-parameter setup of LoftQ for GLUE benchmark for training DeBERTaV3-base using NF2 quantization.
|
| 348 |
+
|
| 349 |
+
<table><tr><td>Hyper-parameter</td><td>MNLI</td><td>RTE</td><td>QNLI</td><td>MRPC</td><td>QQP</td><td>SST-2</td><td>CoLA</td><td>STS-B</td><td>SQuADv1.1</td><td>ANLI</td></tr><tr><td># epochs</td><td>5</td><td>20</td><td>10</td><td>60</td><td>10</td><td>10</td><td>60</td><td>60</td><td>10</td><td>12</td></tr><tr><td>Learning rate</td><td>1 ×10-4</td><td>5×10-5</td><td>5×10-5</td><td>1 ×10-4</td><td>5×10-5</td><td>5×10-5</td><td>5×10-5</td><td>1×10-4</td><td>5×10-5</td><td>5×10-5</td></tr></table>
|
| 350 |
+
|
| 351 |
+
# E SUMMARIZATION
|
| 352 |
+
|
| 353 |
+
# E.1 TRAINING DETAILS
|
| 354 |
+
|
| 355 |
+
We choose Adam as the optimizer and try learning rate from $\{ 1 \times 1 0 ^ { - 5 } , 5 \times 1 0 ^ { - 5 } , 7 \times 1 0 ^ { - 5 } , 2 \times$ $1 0 ^ { - 4 } , 3 \times 1 0 ^ { - 4 } , 4 \times 1 0 ^ { - 4 } \dot \}$ . We show the optimal learning rate for different settings in Table 14. We use LoftQ of 1 iteration for all BART-large experiments. Table 14 and Table 15 summarize the learning rate and other hyper-parameters for CNN/DailyMail and XSum.
|
| 356 |
+
|
| 357 |
+
Table 14: Hyper-parameter setup of LoftQ BART-large on CNN/DailyMail
|
| 358 |
+
|
| 359 |
+
<table><tr><td rowspan="2">Hyperparameter</td><td colspan="2">NF4</td><td colspan="2"> 4-bit Uniform</td><td colspan="2">NF2</td></tr><tr><td>rank8</td><td>rank16</td><td>rank8</td><td>rank16</td><td>rank8</td><td>rank16</td></tr><tr><td>Learning rate</td><td>2e-4</td><td>2e-4</td><td>2e-4</td><td>3e-4</td><td>2e-4</td><td>2e-4</td></tr><tr><td>Epoch</td><td>15</td><td>15</td><td>15</td><td>15</td><td>15</td><td>15</td></tr><tr><td>Batch size</td><td>64</td><td>64</td><td>64</td><td>64</td><td>64</td><td>64</td></tr></table>
|
| 360 |
+
|
| 361 |
+
Table 15: Hyper-parameter setup of LoftQ BART-large on XSum
|
| 362 |
+
|
| 363 |
+
<table><tr><td rowspan="2">Hyperparameter</td><td colspan="2">NF4</td><td colspan="2"> 4-bit Uniform</td><td colspan="2">NF2</td></tr><tr><td>rank8</td><td>rank16</td><td>rank8</td><td>rank16</td><td>rank8</td><td>rank16</td></tr><tr><td>Learning rate</td><td>2e-4</td><td>2e-4</td><td>2e-4</td><td>2e-4</td><td>2e-4</td><td>2e-4</td></tr><tr><td>Epoch</td><td>25</td><td>25</td><td>25</td><td>25</td><td>25</td><td>25</td></tr><tr><td>Batch size</td><td>32</td><td>32</td><td>32</td><td>32</td><td>32</td><td>32</td></tr></table>
|
| 364 |
+
|
| 365 |
+
# F NATURAL LANGUAGE GENERATION
|
| 366 |
+
|
| 367 |
+
We set the batch size as 32 for WikiText-2 and 16 for GSM8K. We train 2 epochs on WikiText-2 and 6 epochs on GSM8K. We select learning rate from $\{ 1 \times 1 0 ^ { - 5 } , 5 \times 1 0 ^ { - 5 } , \bar { 7 } \times 1 0 ^ { - 5 } , 1 \times 1 0 ^ { - 4 } , 3 \times$ $1 0 ^ { - 4 } , 4 \times 1 0 ^ { - 4 } \}$ . Specific settings are summarized in Table 16 and Table 17.
|
| 368 |
+
|
| 369 |
+
# G COMPARISON TO PRUNING
|
| 370 |
+
|
| 371 |
+
Pruning is also a widely used compression method. Here we compare LoftQ with the state-of-theart pruning method Li et al. (2023). We show the comparison in Table 18. We can see our method significantly outperforms the pruning methods on DeBERTaV3-base model. We also remark that LoftQ can consistently reduce the memory of both training and storage. In contrast, pruning requires training the entire full-precision matrix, which implies that it can not achieve any memory savings during the training stage.
|
| 372 |
+
|
| 373 |
+
# H EXTENSION TO CONVOLUTIONAL LAYERS
|
| 374 |
+
|
| 375 |
+
Low-rank adapters can also be applied to convolutional layers. Given an input feature map $X ~ \in ~ \mathbb { R } ^ { h \times w \times \dot { c } _ { 1 } }$ and $c _ { 2 }$ 2D convolutional kernels $K _ { i } \in \mathbb { R } ^ { c _ { 1 } \times d \times d } , i \mathrm { ~ = ~ } 1 , 2 , . . . , \dot { c } _ { 2 }$ , the output of the convolutional layer is
|
| 376 |
+
|
| 377 |
+
$$
|
| 378 |
+
Y = { \mathrm { s t a c k } } ( X \otimes K _ { 1 } , . . . , X \otimes K _ { c _ { 2 } } ) ,
|
| 379 |
+
$$
|
| 380 |
+
|
| 381 |
+
where $Y \in \mathbb { R } ^ { h \times w \times c _ { 2 } }$ and $\otimes$ denotes the 2D convolution operation.
|
| 382 |
+
|
| 383 |
+
Table 16: Hyper-parameter setup of LoftQ LLAMA-2-series on GSM8K
|
| 384 |
+
|
| 385 |
+
<table><tr><td>Model</td><td>Hyperparameter</td><td>NF4</td><td>NF2</td><td>Mixed-precision</td></tr><tr><td>LLAMA-2-7b</td><td> learning rate</td><td>3×10-4</td><td>3×10-4</td><td>3×10-4</td></tr><tr><td>LLAMA-2-13b</td><td>learning rate</td><td>1×10-4</td><td>1×10-4</td><td>3×10-4</td></tr></table>
|
| 386 |
+
|
| 387 |
+
Table 17: Hyper-parameter setup of LoftQ LLAMA-2-series on WikiText-2
|
| 388 |
+
|
| 389 |
+
<table><tr><td>Model</td><td> Hyperparameter</td><td>NF4</td><td>NF2</td><td>Mixed-precision</td></tr><tr><td>LLAMA-2-7b</td><td> learning rate</td><td>3×10-4</td><td>3×10-4</td><td>3×10-4</td></tr><tr><td>LLAMA-2-13b</td><td> learning rate</td><td>1×10-4</td><td>1×10-4</td><td>3×10-4</td></tr></table>
|
| 390 |
+
|
| 391 |
+
Table 18: Results of LoftQ using 2-bits uniform quantization compared with LoSparse with DeBERTaV3-base models on some of GLUE development sets. Here Ratio is the proportion of total remaining weights. Results with N.A. indicate the model does not converge.
|
| 392 |
+
|
| 393 |
+
<table><tr><td>Method</td><td>Ratio</td><td>MNLI m/mm</td><td>SST-2 Acc</td><td>QNLI Acc</td></tr><tr><td>Full FT</td><td>100%</td><td>90.5 /90.6</td><td>95.3</td><td>94.0</td></tr><tr><td>LoSparse</td><td>15%</td><td>84.3/82.9</td><td>87.6</td><td>904</td></tr><tr><td>LoftQ</td><td>15.%</td><td>87.3/87.1</td><td>940</td><td>94</td></tr></table>
|
| 394 |
+
|
| 395 |
+
We can reformulate Equation (10) into matrix multiplication as
|
| 396 |
+
|
| 397 |
+
$$
|
| 398 |
+
\boldsymbol { Y } = \boldsymbol { Z } \times \boldsymbol { H } ^ { \intercal } ,
|
| 399 |
+
$$
|
| 400 |
+
|
| 401 |
+
where $Z \in \mathbb { R } ^ { h w \times c _ { 1 } d ^ { 2 } } , H \in \mathbb { R } ^ { c _ { 2 } \times c _ { 1 } d ^ { 2 } }$ , by extending and flattening the input $X$ together with concatenating and flattening kernels. We first extend a vector $x _ { i , j } \in \mathbb { R } ^ { c _ { 1 } }$ by its neighbor vectors within the kernel window:
|
| 402 |
+
|
| 403 |
+
$$
|
| 404 |
+
\begin{array} { r } { x _ { i , j } ^ { ' } = \mathrm { C o n c a t } ( \mathrm { x _ { i - \frac { d } { 2 } , j - \frac { d } { 2 } } } , . . . , \mathrm { x _ { i + \frac { d } { 2 } , j + \frac { d } { 2 } } } ) . } \end{array}
|
| 405 |
+
$$
|
| 406 |
+
|
| 407 |
+
Now, $X$ becomes $X ^ { \prime } \in \mathbb { R } ^ { h \times w \times c _ { 1 } d ^ { 2 } }$ . We then flatten $X ^ { \prime }$ into $Z \in \mathbb { R } ^ { h w \times c _ { 1 } d ^ { 2 } }$ . For kernels, we first concatenate $\{ K _ { 1 } , . . . , K _ { c _ { 2 } } \}$ into $H ^ { \prime } \in \mathbb { R } ^ { c _ { 2 } \times c _ { 1 } \times d \times d }$ . We then flatten $H ^ { \prime }$ into $H$ .
|
| 408 |
+
|
| 409 |
+
Note that $H$ can be approximated by a low-rank matrix
|
| 410 |
+
|
| 411 |
+
$$
|
| 412 |
+
R = U V ^ { \top } ,
|
| 413 |
+
$$
|
| 414 |
+
|
| 415 |
+
where $U \in \mathbb { R } ^ { c _ { 2 } \times r } , V \in \mathbb { R } ^ { c _ { 1 } d ^ { 2 } \times r } , r \ll \operatorname* { m i n } \{ c _ { 2 } , c _ { 1 } d ^ { 2 } \}$ by SVD. Therefore, the original convolution layer can be approximated as
|
| 416 |
+
|
| 417 |
+
$$
|
| 418 |
+
\begin{array} { r l } & { \widehat { \boldsymbol { Y } } = \boldsymbol { Z } \times ( \boldsymbol { U } \boldsymbol { V } ^ { \intercal } ) ^ { \intercal } } \\ & { \quad = ( \boldsymbol { Z } \times \boldsymbol { V } ) \times \boldsymbol { U } ^ { \intercal } } \\ & { \quad = \boldsymbol { M } \times \boldsymbol { U } ^ { \intercal } . } \end{array}
|
| 419 |
+
$$
|
| 420 |
+
|
| 421 |
+
Note that $Z \times V$ can be restored into a convolution operation where we have $r$ kernels $D _ { i } \in$ $\mathbb { R } ^ { c _ { 1 } \times d \times d } , i = 1 , 2 , . . . , r$ and $M \times U ^ { \top }$ can also be restored into a convolution operation where we have $c _ { 2 }$ kernels $U _ { i } \in \mathbb { R } ^ { r \times 1 \times 1 } , i = 1 , 2 , , . . . , c _ { 2 }$ .
|
md/test/MLBdiWu4Fw/MLBdiWu4Fw.md
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# INTERNVID: A LARGE-SCALE VIDEO-TEXT DATASET FOR MULTIMODAL UNDERSTANDING AND GENERATION
|
| 2 |
+
|
| 3 |
+
Yi Wang∗1, Yinan $\mathbf { H e ^ { * 1 } }$ , Yizhuo $\mathbf { L i } ^ { * 4 , 1 }$ , Kunchang $\mathbf { L i } ^ { 6 , 1 }$ , Jiashuo $\mathbf { Y u } ^ { 1 }$ , Xin $\mathbf { M a } ^ { 3 , 1 }$ Xinhao $\mathbf { L i } ^ { 2 , 1 }$ , Guo Chen2,1, Xinyuan Chen1, Yaohui Wang1, Ping Luo4,1, Ziwei Liu5,1 Yali Wang†6,1, Limin Wang†2,1, Yu Qiao†1 1OpenGVLab, Shanghai AI Laboratory 2Nanjing University 3Monash University 4The University of Hong Kong 5Nanyang Technological University 6Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences https://github.com/OpenGVLab/InternVideo/tree/main/Data/InternVid
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
This paper introduces InternVid, a large-scale video-centric multimodal dataset that enables learning powerful and transferable video-text representations for multimodal understanding and generation. InternVid contains over 7 million videos lasting nearly 760K hours, yielding 234M video clips accompanied by detailed descriptions of total 4.1B words. Our core contribution is to develop a scalable approach to autonomously build a high-quality video-text dataset with large language models (LLM), thereby showcasing its efficacy in learning video-language representation at scale. Specifically, we utilize a multi-scale approach to generate video-related descriptions. Furthermore, we introduce ViCLIP, a video-text representation learning model based on ViT-L. Learned on InternVid via contrastive learning, this model demonstrates leading zero-shot action recognition and competitive video retrieval performance. Beyond basic video understanding tasks like recognition and retrieval, our dataset and model have broad applications. They are particularly beneficial for generating interleaved video-text data for learning a video-centric dialogue system, advancing video-to-text and text-to-video generation research. These proposed resources provide a tool for researchers and practitioners interested in multimodal video understanding and generation.
|
| 8 |
+
|
| 9 |
+

|
| 10 |
+
Figure 1: Examples (we give three frames of each video clip), the corresponding generated captions, and ASR transcripts in InternVid. In the captions, we highlight nouns in blue and verbs in green. Non-English transcripts are translated to English using LLM (Brown et al., 2020).
|
| 11 |
+
|
| 12 |
+
# 1 INTRODUCTION
|
| 13 |
+
|
| 14 |
+
Learning transferable video-text representations is both challenging and essential for video understanding in various real-world applications, such as autonomous driving, intelligent surveillance, human-computer interaction, to name a few. While contrastive learning using web-scale data has been successful in image-text representation, it remains underexplored in the video-text domain.
|
| 15 |
+
|
| 16 |
+
A key reason for this limited exploration is the lack of a high quality video-language dataset for pretraining at scale. Current research relies on datasets like HowTo100M (Miech et al., 2019), HD-VILA (Xue et al., 2022), and YT-Temporal (Zellers et al., 2021; 2022), whose texts are generated using automatic speech recognition (ASR). Despite their large scale, these datasets often have low semantic correlations between the videos and corresponding textual descriptions (Miech et al., 2019; Xue et al., 2022; Zellers et al., 2021; 2022). Empirical studies demonstrate that improving this correlation (e.g. aligning videos with subtitles to improve their matching) significantly benefits downstream tasks such as video retrieval and video question answering (Bain et al., 2021). Recent works have utilized WebVid10M (Bain et al., 2021), a dataset with higher-quality alt-texts, to address the low video-text correlation issue. However, its limited scale and dynamics hinder its use in current data and model scaling studies. Specifically, only 10M video-text pairs are provided, and the depicted scenes contain relatively few actions or activities.
|
| 17 |
+
|
| 18 |
+
We propose a large-scale video-centric dataset InternVid to address the challenge of scaling up videolanguage modeling while maintaining high video-text correspondence. Visual examples are given in Figure 1. Note the ASR transcripts barely depict visual elements in videos while the generated captions do. The dataset contains highly-correlated video-text pairs and includes over 7 million videos, totaling 760,000 hours and resulting in 234 million video clips, with various subsets for different needs. These videos cover 16 scenarios and around 6 thousand motion descriptions. To improve video-text matching, we generate captions using a multiscale approach. In the coarse scale, we caption the middle frame of each video and use the description as the video caption. In the fine scale, we produce and summarize frame-by-frame captions with a language model.
|
| 19 |
+
|
| 20 |
+
Leveraging InternVid, we scale a video-language transformer (ViT-L) in contrastive learning from a data perspective, and its experiments prove InternVid enables learning scalable video-text models. We introduce video masking to the model to accelerate the whole learning without compromising its effectiveness. The video and text encoders are initialized from the CLIP pretrained model with the same scale. With InternVid, we learn a video-text model for several epochs, achieving impressive zero-shot performance. Compared with previous Video CLIP variants, our proposed ViCLIP shows notable performance improvement, especially in zero-shot settings.
|
| 21 |
+
|
| 22 |
+
In addition to large-scale video-language contrastive pretraining, we discover its effectiveness in producing interleaved video-text data for learning a video-centric dialogue system like Flamingo (Alayrac et al., 2022; Awadalla et al., 2023), and advancing video generation. Since the text-annotated clips are extracted from videos, we naturally collect clips and their corresponding text based on the sampling locations. This results in approximately 7 million interleaved data pieces, suitable for instruction tuning as multi-turn video-centric dialogue. For video generation, we filter the core set and obtain 18 million video clips. Alongside WebVid-10M, InternVid can significantly improve a stable-diffusion based video generation model to new heights.
|
| 23 |
+
|
| 24 |
+
In summary, our contributions are threefold.
|
| 25 |
+
|
| 26 |
+
• We introduce a new web-scale video-language dataset InternVid. This dataset, aimed at advancing video-related multimodal understanding and generation at scale, is created using a multi-scale video captioning approach powered by LLM, ensuring high-quality video-text data with minimal human intervention. It includes computational features (video-text correlation and visual aesthetics) across the whole dataset and gives way to diverse subsets to cater to varying training needs. • We learn a new video-language model, ViCLIP, which is trained on InternVid using ViT-L. It incorporates both contrastive learning and mask modeling, allowing for efficient learning of transferrable video-language representation. This model achieves state-of-the-art zero-shot action recognition in Kinetics, scoring 75.7, 73.5, and 66.4 on K400, K600, and K700 with the average top1 and top5 accuracies, respectively. It gets competitive performance on video retrieval, setting a new baseline for video-text understanding. • InternVid fosters the development of multimodal dialogue systems and text-to-video generation. ViCLIP learned on InternVid could serve as a backbone of video-centric dialogue systems (Zhu et al., 2023a; Li et al., 2023c; Liu et al., 2023), conducting tasks as action recognition, temporal understanding, reasoning, and creativity within an open-ended environment. Furthermore, we provide a subset, InternVid-Aes, aiding in generating high-resolution watermark-free videos. Utilizing InternVid-Aes, both visual and quantitative outcomes of a text-to-video baseline can be noticeably enhanced (FVD: $7 0 5 . 3 6 1 6 . 5$ ).
|
| 27 |
+
|
| 28 |
+
<table><tr><td></td><td>Dataset Caption</td><td>Domain</td><td>#Videos</td><td></td><td>#Clips</td><td>Lenclip</td><td>Lencap</td><td>Dur(h)</td><td>Res</td></tr><tr><td>MSR-VTT (Xu et al.,2016)</td><td></td><td>Manual</td><td>open</td><td>7.2K</td><td>10K</td><td>15.0</td><td>9.3</td><td>40</td><td>240P</td></tr><tr><td>DideMo (Anne Hendricks et al.,2017)</td><td></td><td>Manual</td><td>Flickr</td><td>10.5K</td><td>27K</td><td>6.9</td><td>8.0</td><td>87</td><td>=</td></tr><tr><td>LSMDC (Rohrbach et al., 2017)</td><td></td><td>Manual</td><td>movie</td><td>200</td><td>118K</td><td>4.8</td><td>7.0</td><td>158</td><td>1080P</td></tr><tr><td>YouCook2 (Zhou et al., 2018)</td><td></td><td>Manual</td><td>cooking</td><td>2K</td><td>14K</td><td>19.6</td><td>8.8</td><td>176</td><td>=</td></tr><tr><td>How2 (Sanabria et al., 2018)</td><td></td><td>Manual</td><td>instruct</td><td>13.2K</td><td>80K</td><td>90.0</td><td>20.0</td><td>2K</td><td></td></tr><tr><td>ANet Caption (Krishna et al., 2017)</td><td></td><td>Manual</td><td>action</td><td>20K</td><td>100K</td><td>36.0</td><td>13.5</td><td>849</td><td></td></tr><tr><td>VideoCC3M(Nagrani et al., 2022)</td><td></td><td>Transfer</td><td>open</td><td>6.3M</td><td>10.3M</td><td>10</td><td>/</td><td>17.5K</td><td>=</td></tr><tr><td>WebVid10M(Bain et al.,2021)</td><td></td><td>Alt-text</td><td>open</td><td>10.7M</td><td>10.7M</td><td>18.0</td><td>12.0</td><td>52K</td><td>360P</td></tr><tr><td>WTS70M (Stroud et al., 2020)</td><td></td><td>Metadata</td><td>action</td><td>70M</td><td>70M</td><td>10</td><td>-</td><td>194K</td><td>-</td></tr><tr><td>HowTol00M (Miech et al.,2019)</td><td></td><td>ASR</td><td>instruct</td><td>1.2M</td><td>136M</td><td>3.6</td><td>4.0</td><td>134.5K</td><td>240P</td></tr><tr><td>HD-VILA-100M (Xue et al., 2022)</td><td></td><td>ASR</td><td>open</td><td>3.3M</td><td>103M</td><td>13.4</td><td>32.5</td><td>371.5K</td><td>720P</td></tr><tr><td>YT-Temporal-180M (Zellers et al.,2021)</td><td></td><td>ASR</td><td>open</td><td>6M</td><td>180M</td><td>-</td><td></td><td>=</td><td>=</td></tr><tr><td></td><td>InternVid (ours)</td><td>Generated</td><td>open</td><td>7.1M</td><td>234M</td><td>11.7</td><td>17.6</td><td>760.3K</td><td>720P</td></tr></table>
|
| 29 |
+
|
| 30 |
+
Table 1: Statistics of InternVid and its comparison with existing video-language datasets.
|
| 31 |
+
|
| 32 |
+
# 2 RELATED WORK
|
| 33 |
+
|
| 34 |
+
Multimodal Datasets. Vision-text data are necessary to enable crossmodal learning. To learn visonlanguage representation effectively, these datasets should be large at scale and high at vision-text correlations. To this end, researches usually leverage existing web images with alt-text (Thomee et al., 2016; Sharma et al., 2018; Changpinyo et al., 2021; Hu et al., 2022; Desai et al., 2021; Schuhmann et al., 2022) and videos with ASR transcriptions (Miech et al., 2019; Zellers et al., 2021; 2022; Xue et al., 2022; Bain et al., 2021; Srinivasan et al., 2021) for scalable learning.
|
| 35 |
+
|
| 36 |
+
For video-centric multimodal datasets, HowTo100M (Miech et al., 2019) collected instructional YouTube videos and exploited the corresponding ASR subtitles for learning joint representations. Nagrani et al. (2022) proposed VideoCC3M by transferring image-text datasets to video ones. Zellers et al. (2021; 2022) and Xue et al. (2022) proposed YT-Temporal and HD-VILA for Audio-Visual-Text joint learning and high-resolution video crossmodal learning, respectively. On the other hand, Bain et al. (2021) found video-text alignment matters more than their quantities, so they produced WebVid (Bain et al., 2021) where 10M videos with the corresponding alt-texts. This is frequently employed in recent video-language pretraining approaches (Li et al., 2023d; Cheng et al., 2023).
|
| 37 |
+
|
| 38 |
+
Video Understanding. Pretraining large-scale video-text models and fine-tuning them for downstream tasks has become the norm in the video-language field (Miech et al., 2020; Li & Wang, 2020; Xu et al., 2021; Li et al., 2023d; 2022a; Xu et al., 2021; Hu et al., 2022; Dou et al., 2022; Shen et al., 2021; Yao et al., 2021; Sun et al., 2019; Zhu & Yang, 2020; Wang et al., 2022b; Chen et al., 2022; Zellers et al., 2021; 2022; Zeng et al., 2023b;a; Chen et al., 2023a;b; He et al., 2023; Chen et al., 2023c). Early techniques (Sun et al., 2019; Zhu & Yang, 2020) used pretrained visual and language encoders to obtain offline video and text features, but recent methods (Li & Wang, 2020; Miech et al., 2020; Hu et al., 2022; Dou et al., 2022; Tong et al., 2022; Wang et al., 2023) highlight the advantages of end-to-end training. Common practices include two or three pretraining tasks, such as masked language modeling (Li et al., 2022b), video-text matching (Wang et al., 2022a), video-text contrastive learning (Xu et al., 2021; Wang et al., 2022b), masked video modeling (Tong et al., 2022; Wang et al., 2023; 2022b), and video-text masked modeling (Fu et al., 2021).
|
| 39 |
+
|
| 40 |
+
In the multimodal video context, VIOLET (Fu et al., 2021) combined masked language and video modeling, while All-in-one (Wang et al., 2022a) proposed a unified pretraining with a shared backbone. LAVENDER (Li et al., 2022b) unified tasks through masked language modeling. Despite their success in multimodal benchmarks, these methods’ reliance on limited video-text data hampers performance in video-only tasks like action recognition. Conversely, InternVideo (Wang et al., 2022b) and UMT (Li et al., 2023d) combined masked modeling with crossmodal contrastive learning, leading to competitive performance in both video-only and video-language tasks. MERLOT Reserve (Zellers et al., 2022) exploited 20 million video-text-audio pairs for training joint video representations using contrastive matching, setting new standards in video recognition and visual commonsense reasoning. To address modality entanglement in crossmodal learning, mPLUG-2 (Xu et al., 2023) introduced a shared module across image, video, and text to encourage modality collaboration while reserving modality-specific modules for their differences.
|
| 41 |
+
|
| 42 |
+

|
| 43 |
+
Figure 2: The proposed multiscale video caption pipeline. The captions in coarse and fine scales are marked in green and blue, respectively.
|
| 44 |
+
|
| 45 |
+
# 3 INTERNVID: A VIDEO-CENTRIC MULTIMODAL DATASET
|
| 46 |
+
|
| 47 |
+
A high-quality video-text dataset at scale is a premise to conduct large-scale video-language learning and associated tasks. We build this dataset considering three factors: substantial temporal dynamics, rich and diverse semantics, and strong video-text correlations. To improve the temporal dynamics in the dataset, we gather videos retrieved using action/activity-based query words. For rich and varied semantics, we not only crawl trending videos across various categories but also deliberately increase the proportion of data consciously collected from various countries and languages. To strengthen video-text correlations, we employ image captioning and language models to generate video descriptions from frame-specific annotations. Next, we elaborate the dataset construction process and discuss its characteristics.
|
| 48 |
+
|
| 49 |
+
# 3.1 DATA CURATION
|
| 50 |
+
|
| 51 |
+
We collect videos from YouTube considering the diversity and richness of its data, and its support for academic usage. We obtain 7 million public YouTube videos with an average duration of 6.4 minutes, covering 16 topics. To avoid the overlap with the existing datasets, we acquire videos by creating a database of YouTube video IDs and excluding any videos already present in publicly available datasets (released prior to April 2023). The data curation strategies are two-fold. On one hand, We select popular channels and the corresponding hot or high-rated videos from the categories e.g. news, gaming, etc., resulting in 2 million videos. On the other hand, we create a list of motion descriptions. With it, we obtain 5.1 million videos by choosing the top retrieved ones.
|
| 52 |
+
|
| 53 |
+
Defining Actions for Queries. We define around 6K action phrases from American Time Use Survey (ATUS), public video datasets, and text corpus. Then they are refined both manually and automatically. We employ actions from ATUS from 2017 to 2022 (Heilbron et al., 2015), merging them and removing the duplicates. For the used video datasets, we leverage Kinetics (Carreira & Zisserman, 2017), SomethingSomething (Goyal et al., 2017; Mahdisoltani et al., 2018), UCF101 (Soomro et al., 2012), and so on. This provides us with 1103 action labels. Moreover, we access several visual grounding corpus (Song et al., 2021; Yang et al., 2022; Li et al., 2017). A language model (Brown et al., 2020) is employed to extract actions and their corresponding targets (if exist) to form phrases from the corpus, leading to 5001 actions with manual checking. Totally, we collect 6104 action queries for searching videos.
|
| 54 |
+
|
| 55 |
+
Collection Strategies. For quality control, we establish crawling rules. We collect videos that are between 10 seconds and 30 minutes in duration and have resolutions ranging from 360P to 720P. Videos with resolutions above 720P are processed to 720P. To enrich the dataset descriptions, we gather videos with their audio, subtitles, titles, summaries, and other metadata.
|
| 56 |
+
|
| 57 |
+
Trimming. We segment videos into clips using scene variance. We directly employ the corresponding filter in PySceneDetect with a threshold as 27. During this procedure, we also filter out clips in still or extreme dynamics (e.g. a browse of a photo gallery). After the filtering, we get 234M clips.
|
| 58 |
+
|
| 59 |
+
# 3.2 MULTISCALE VIDEO CAPTIONING
|
| 60 |
+
|
| 61 |
+
To generate video captions that are scalable, rich, and diverse, we employ a multiscale method with two distinct captioning strategies, as depicted in Figure 2. On the finer scale, we simplify the video captioning process by concentrating on the common objects, actions, and scene descriptions within the video clip. We deliberately overlook intricate details such as subtle facial expressions & movements, and other nuanced elements. On the coarser scale, we adopt the single-frame bias assumption from
|
| 62 |
+
|
| 63 |
+

|
| 64 |
+
|
| 65 |
+
Figure 3: Video statistics in InternVid. It encompasses a diverse set of categories, gathered from multiple countries and averaging a duration of five minutes.
|
| 66 |
+
|
| 67 |
+

|
| 68 |
+
Figure 4: Clip statistics in InternVid. InternVid contains a diverse distribution of clip durations and caption lengths. It also offers aesthetic scores and multimodal similarity scores for each clip.
|
| 69 |
+
|
| 70 |
+
(Lei et al., 2022) and exclusively caption the central frame of the video. Given our focus on brief clips (around 10 seconds) filtered via scene segmentation, most videos predominantly display consistent objects without substantial appearance alterations. This circumvents the identity-preserving issue when dealing with videos from image perspectives. We employ the lightweight image captioning model Tag2Text (Huang et al., 2023b) for the finer scale, which describes videos at low fps in a frame-by-frame manner. These individual image captions are then synthesized into a comprehensive video description using a pretrained language model T5-summary (Raffel et al., 2020; Chiang et al., 2023). At the coarser scale, we use BLIP2 (Li et al., 2023b) to caption the middle frame of the clip.
|
| 71 |
+
|
| 72 |
+
# 3.3 STATISTICS AND FEATURES
|
| 73 |
+
|
| 74 |
+
We present the statistics of InternVid with other video-language datasets in Table 1. We collected videos from 16 mainstream categories, as in Figure 3. Unlike prior studies (Miech et al., 2019; Xue et al., 2022; Zellers et al., 2021), we emphasize diversity by selecting videos from countries with different languages instead of only English. In terms of duration, every video lasts 351.9s on average. Almost half $(49 \% )$ of the videos are five minutes or less, while a quarter $( 2 6 \% )$ fall between five and ten minutes. Among the curated videos, $85 \%$ were high-resolution (720P), while the remaining $15 \%$ had lower resolutions ranging from 360P to 720P. Though the lower-resolution videos may not support high-quality video generation, they can still be useful in video-text representation learning.
|
| 75 |
+
|
| 76 |
+
InternVid exhibits diverse clip durations and caption lengths at the clip level. The aesthetic scores and clip-caption similarities are distributed uniformly, as shown in Figure 4. The majority of clips are 0-10 seconds in length, accounting for $85 \%$ of all clips (Figure 4: left). Approximately half of the clips have captions with 10-20 words. The statistics of the captions and transcripts is given in App. C.
|
| 77 |
+
|
| 78 |
+
We measured the aesthetic scores and clip-caption similarity of all clips using the models in (Schuhmann et al., 2022) and (Li et al., 2023d), respectively, as given in Figure 4: right. Based on these scores, we can build different versions of InternVid for various purposes. We uniformly sampled four frames of each clip, calculated their aesthetic scores, and took the maximum score as the video aesthetic score. For clip-caption similarity, we computed the cosine similarity between video embeddings and text ones, again using a uniform sampling of four frames for each clip. Most clips score around 4-6 in aesthetics, accounting for approximately $7 5 \%$ of the data. For UMT-SIM 1, over $80 \%$ of the clips scored between 0.3-0.4.
|
| 79 |
+
|
| 80 |
+
# 3.4 INTERLEAVED VIDEO-TEXT DATA GENERATION
|
| 81 |
+
|
| 82 |
+
Utilizing video-caption data, we can develop an interleaved video-text dataset for generative multimodal pretraining. Previous researches (Alayrac et al., 2022; Awadalla et al., 2023; Huang et al., $2 0 2 3 \mathrm { a }$ ; Zhu et al., 2023b) confirm that pretraining on the interleaved image-text sequences results in significant multimodal in-context abilities. Our work makes the initial step in creating a large-scale interleaved video-text dataset InternVid-ICL, containing 7.1M interleaved video-text data pairs. We give three methods for organizing clips and their captions: (1): Arrange clips and their descriptions sequentially based on their temporal order within the same video, as illustrated in Figure 5 (a). (2): Enhance diversity in interleaved video-text items by assigning ASR text to a used clip in addition to its caption, as demonstrated in Figure 5 (b). (3): Extend method (1) by concatenating two interleaved multimodal items, creating a video-centric dialogue simulating user queries involving multiple videos (Figure 5 (c)). One visual example of these arrangements is provided in Table 8.
|
| 83 |
+
|
| 84 |
+

|
| 85 |
+
Figure 5: Interleaved video-text data generation in InternVid with three formats.
|
| 86 |
+
|
| 87 |
+

|
| 88 |
+
Figure 6: Framework of ViCLIP.
|
| 89 |
+
|
| 90 |
+
# 4 VICLIP: LEARNING VIDEO-TEXT REPRESENTATION AT SCALE
|
| 91 |
+
|
| 92 |
+
Built upon CLIP (Radford et al., 2021), we make a simple video-text pretraining baseline ViCLIP. It consists of a video encoder (ViT) (Dosovitskiy et al., 2021) and a text encoder, as given in Figure 6. Both modules are initialized from the corresponding CLIP components. We update the native attention in the video encoder to spatiotemporal attention while maintaining other designs. For efficient learning, we apply masking to videos in pre-training. The optimization target is the contrastive loss between input video and text embeddings.
|
| 93 |
+
|
| 94 |
+
Video & Text Encoders with Masking Learning. Our video encoder uses a ViT with spatiotemporal attention. We apply random patch masking following MAE-based methods (Tong et al., 2022; Wang et al., 2023) to the input videos. It significantly alleviates the computational burden. The used text encoder is also a transformer followed by (Radford et al., 2021; Schuhmann et al., 2022).
|
| 95 |
+
|
| 96 |
+
Unmasked Video-Text Pretraining. We feed all visual tokens into the video transformer instead of just the masked ones towards the end of the pretraining process. This helps bridge the gap between pretraining and downstream applications where the full video is used as input. We perform unmasked training for 0.5 epochs with a learning rate of 4e-6.
|
| 97 |
+
|
| 98 |
+
Training Objectives. Our framework optimizes video-text alignment. It minimizes InfoNCE loss (Oord et al., 2018) using global video and text features, as
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\mathcal { L } _ { \mathbf { C } } = \mathcal { L } _ { \mathbf { C } } ^ { \mathbf { V } \mathbf { T } } + \mathcal { L } _ { \mathbf { C } } ^ { \mathbf { T } \mathbf { V } } = - \sum _ { i = 1 } ^ { N } \log \frac { \exp ( \sin ( f _ { i } ^ { \mathbf { V } } , f _ { i } ^ { \mathbf { T } } ) / \tau ) } { \sum _ { j = 1 } ^ { N } \exp ( \sin ( f _ { i } ^ { \mathbf { V } } , f _ { j } ^ { \mathbf { T } } ) / \tau ) } - \sum _ { i = 1 } ^ { N } \log \frac { \exp ( \sin ( f _ { i } ^ { \mathbf { T } } , f _ { i } ^ { \mathbf { V } } ) / \tau ) } { \sum _ { j = 1 } ^ { N } \exp ( \sin ( f _ { i } ^ { \mathbf { T } } , f _ { j } ^ { \mathbf { V } } ) / \tau ) } ,
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
where $f ^ { \mathbf { V } }$ and $f ^ { \mathbf { T } }$ denote the learned video and text embeddings, respectively. $\mathrm { s i m } ( \cdot )$ computes the cosine similarity between two features. $\tau$ is the learnable temperature.
|
| 105 |
+
|
| 106 |
+
# 5 EXPERIMENTS
|
| 107 |
+
|
| 108 |
+
We learn ViCLIP on subsets of InternVid and evaluated its performance on video-related benchmarks using full-finetuned and zero-shot settings. We sample subsets InternVid-10M, InternVid-50M, and InternVid-200M randomly. Sampling details are given in App. E.1.
|
| 109 |
+
|
| 110 |
+
Table 2: Zero-shot action recognition results on Kinetics 400/600/700.
|
| 111 |
+
|
| 112 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Training Data</td><td colspan="2">top-1(4AVG (t) top-1 (6AVG(↑) +p-1 7AVG (t)</td><td colspan="2"></td><td colspan="2"></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>CLIP (Radford et al., 2021)</td><td>CLIP400M (Radford et al., 2021)</td><td>58.42</td><td>70.14</td><td>55.11</td><td>67.16</td><td>46.12</td><td>58.38</td></tr><tr><td>CLIP (Radford et al., 2021)</td><td>DataComp-1B (Gadre et al.,2023)</td><td>56.14</td><td>67.67</td><td>54.15</td><td>65.83</td><td>45.36</td><td>57.01</td></tr><tr><td>EVA-CLIP-L (Sun et al.,2023)Merged-2B (Sun et al.,2023)</td><td></td><td>=</td><td>65.00</td><td>=</td><td>64.90</td><td>-</td><td>59.10</td></tr><tr><td></td><td>EVA-CLIP-E(Sun et al.,2023)LAION-2B(Schuhmann et al.,222)</td><td></td><td>69.80</td><td>-</td><td>69.30</td><td>=</td><td>63.40</td></tr><tr><td>ViCLIP</td><td>+WebVid10M (Bain et al.,2021)</td><td>59.88</td><td>71.03</td><td>58.66</td><td>69.84</td><td>50.23</td><td>61.86</td></tr><tr><td>ViCLIP</td><td>+InternVid-10M</td><td>56.68</td><td>68.17</td><td>54.67</td><td>66.28</td><td>46.53</td><td>58.73</td></tr><tr><td>ViCLIP</td><td>+InternVid-50M</td><td>57.18</td><td>68.93</td><td>55.36</td><td>67.07</td><td>47.00</td><td>59.36</td></tr><tr><td>ViCLIP</td><td>+InternVid-200M</td><td>59.80</td><td>71.09</td><td>57.80</td><td>69.34</td><td>49.30</td><td>61.25</td></tr><tr><td>ViCLIP</td><td>+InternVid-10M-DIV</td><td>63.00</td><td>74.15</td><td>60.68</td><td>72.07</td><td>52.50</td><td>64.59</td></tr><tr><td>ViCLIP</td><td>+InternVid-10M-FLT</td><td>64.80</td><td>75.70</td><td>62.20</td><td>73.53</td><td>54.30</td><td>66.38</td></tr></table>
|
| 113 |
+
|
| 114 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Training Data</td><td colspan="2">top-1 (K400p5(t)</td><td colspan="2">top-1 SthSthy2-5 (t)</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>CLIP (Radford et al., 2021)</td><td>CLIP400M (Radford et al., 2021)</td><td>86.7</td><td>97.2</td><td>70.1</td><td>92.5</td></tr><tr><td>CLIP (Radford et al., 2021)</td><td>DataComp-1B (Gadre et al., 2023)</td><td>85.6</td><td>96.8</td><td>68.9</td><td>91.8</td></tr><tr><td>ViCLIP</td><td>+WebVidi0M (Bain et al.,2021)</td><td>85.0</td><td>96.8</td><td>68.7</td><td>91.9</td></tr><tr><td>ViCLIP</td><td>+InternVid-10M-FLT</td><td>86.8</td><td>97.5</td><td>71.2</td><td>93.2</td></tr><tr><td>ViCLIP</td><td>+InternVid-10M-FLT+K710</td><td>88.0</td><td>97.8</td><td>71.8</td><td>93.6</td></tr><tr><td>ViCLIP</td><td>+InternVid-200M</td><td>87.9</td><td>97.9</td><td>73.6</td><td>94.9</td></tr><tr><td>ViCLIP</td><td>+InternVid-200M+K710</td><td>88.7</td><td>98.2</td><td>74.2</td><td>95.0</td></tr></table>
|
| 115 |
+
|
| 116 |
+
Table 3: Fine-tuned action recognition results on Kinetics 400 and SomethingSomethingV2.
|
| 117 |
+
|
| 118 |
+
# 5.1 TRANSFERABLE VIDEO REPRESENTATION PERFORMANCE
|
| 119 |
+
|
| 120 |
+
Action Recognition. In addition to OpenAI’s CLIP-L (CLIP400M (Radford et al., 2021)) and LAION (DataComp-1B (Gadre et al., 2023)), we also include EVA-CLIP-L/14 and EVA-CLIP-E/14 (Sun et al., 2023) for comparison. More experimental settings are given in App. E.2.
|
| 121 |
+
|
| 122 |
+
Zero-Shot. Table 2 shows that when trained on InternVid-10M-FLT, ViCLIP outperforms all other methods, including EVA-CLIP-E. This result validates InternVid’s effectiveness in learning videotext embeddings. Note that ViCLIP with InternVid-10M-FLT sets new records on zero-shot action recognition in Kinetics 400/600/700, demonstrating a significant performance boost compared to ViCLIP with WebVid10M or other models. Moreover, ViCLIP trained on InternVid-10M-FLT exceeds its performance on InternVid-200M. Normally, we would expect the model trained on InternVid-200M to perform better than those on -10M-DIV or -FLT, given that the latter two subsets derive from the former. Unless this discrepancy results from improper learning, we conjecture that false negative samples could severely impede video-text contrastive learning if we don’t purposefully reduce the number of clips taken from the same video. Specifically, we hypothesize that clips from the same video share similar representations and captions. Contrastive learning, however, assumes these clips to be different. This situation also undermines the significance of using a large batch size in current training since it increases the probability of encountering more false negatives.
|
| 123 |
+
|
| 124 |
+
Fine-tuned. In Table 3, note when comparing ViCLIP trained on InternVid with image CLIP models or ViCLIP trained with WebVid, there is a clear increase in accuracy. Unlike the zero-shot results, when ViCLIP is pretrained with a larger number (200M) of video-text data pairs, it achieves higher accuracy in fine-tuned recognition tasks $( 8 7 . 9 \%$ in K400 and $7 3 . 6 \%$ in SthSthV2) compared to when pretrained $8 6 . 8 \%$ in K400 and $7 1 . 2 \%$ in SthSthV2) with fewer data (10M). This suggests that InternVid provides greater benefits for fine-tuned action-related tasks. The decrease in performance of ViCLIP with WebVid highlights the importance of addressing the distribution gap between WebVid and the action videos used for evaluation, emphasizing the need to collect videos with evident temporal dynamics.
|
| 125 |
+
|
| 126 |
+
Video-Text Retrieval. We evaluate the video retrieval performance of baselines and ViCLIP using different pretraining datasets on five popular benchmarks (Heilbron et al., 2015; Xu et al., 2016; Rohrbach et al., 2015; Anne Hendricks et al., 2017; Chen & Dolan, 2011), as shown in Table 4 and 5. We uniformly sample eight frames from the input videos. For the CLIP models from OpenAI (Radford et al., 2021) and LAION (Schuhmann et al., 2022), we utilize their officially released ViT-L models and extract video embeddings by averaging the computed frame-wise image embeddings. Our ViCLIP directly predicts video embeddings. For evaluating retrieval performance, we report $R @ { \cal I }$ scores for both text-to-video (t2v) and video-to-text (v2t) tasks in 4 and 5.
|
| 127 |
+
|
| 128 |
+
Both Table 4 and 5 demonstrate that video-language pretraining is crucial for enhancing fine-tuned and zero-shot retrieval performance. This point is substantiated by the comparison between CLIP and ViCLIP using InternVid-50M. Table 4 exhibits a boost of nearly 4-10 points across different benchmarks in the zero-shot setting. Meanwhile, Table 5 shows an increase of approximately 10 points across all $\mathbb { R } \ @ 1$ scores in the fine-tuned setting.
|
| 129 |
+
|
| 130 |
+
Table 4: Results of zero-shot video retrieval on MSR-VTT, LSMDC, DiDeMo, MSVD, and ANet.
|
| 131 |
+
|
| 132 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Data</td><td colspan="2">MSR-VTT</td><td colspan="2">TLSMDCT</td><td colspan="2">DiDeM2T</td><td colspan="2">T2MSVD2T</td><td colspan="2">T2ANev2T</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>CLIP (Radford et al., 2021)</td><td>CLIP400M (Radford et al., 2021)</td><td>29.0</td><td>25.8</td><td>13.9</td><td>15.2</td><td>11.5</td><td>19.1</td><td>37.9</td><td>60.0</td><td>8.3</td><td>12.2</td></tr><tr><td>CLIP (Radford et al.,2021)</td><td>DataComp-1B(Gadre et al.,2023)</td><td>30.4</td><td>24.2</td><td>13.9</td><td>11.9</td><td>12.7</td><td>18.7</td><td>40.5</td><td>57.2</td><td>9.1</td><td>13.2</td></tr><tr><td>CLIP4Clip (Luo et al.,2022)</td><td>+HowTo100M(Miech et al.,2019)</td><td>32.0</td><td>-</td><td>15.1</td><td>=</td><td></td><td>-</td><td>38.5</td><td>-</td><td></td><td>-</td></tr><tr><td>ViCLIP</td><td>+Web Vid10M (Bain et al.,2021)</td><td>35.6</td><td>33.1</td><td>16.5</td><td>13.4</td><td>14.5</td><td>23.3</td><td>45.3</td><td>69.0</td><td>12.4</td><td>19.0</td></tr><tr><td>ViCLIP</td><td>+InternVid-10M</td><td>36.4</td><td>37.1</td><td>17.1</td><td>15.0</td><td>16.4</td><td>25.9</td><td>45.2</td><td>69.8</td><td>13.5</td><td>23.4</td></tr><tr><td>ViCLIP</td><td>+InternVid-50M</td><td>39.7</td><td>40.7</td><td>18.0</td><td>16.7</td><td>16.7</td><td>26.4</td><td>46.5</td><td>72.2</td><td>13.6</td><td>23.2</td></tr><tr><td>ViCLIP</td><td>+InternVid-200M</td><td>39.3</td><td>39.5</td><td>18.3</td><td>16.6</td><td>17.1</td><td>25.5</td><td>47.3</td><td>70.0</td><td>13.7</td><td>21.6</td></tr><tr><td>ViCLIP</td><td>+InternVid-10M-DIV</td><td>41.5</td><td>41.6</td><td>18.5</td><td>17.4</td><td>17.7</td><td>26.2</td><td>48.6</td><td>71.9</td><td>14.8</td><td>23.4</td></tr><tr><td>ViCLIP</td><td>+InternVid-10M-FLT</td><td>42.4</td><td>41.3</td><td>20.1</td><td>16.9</td><td>18.4</td><td>27.9</td><td>49.1</td><td>75.1</td><td>15.1</td><td>24.0</td></tr></table>
|
| 133 |
+
|
| 134 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Data</td><td colspan="2">MSR-VTTTLSMDCT</td><td colspan="2"></td><td colspan="2">DiDeM2T</td><td colspan="2">TMSVD2T</td><td colspan="2">T2ANv2T</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>CLIP (Radford et al., 2021)</td><td>CLIP400M (Radford et al.,021)</td><td>38.2</td><td>38.7</td><td>22.5</td><td>22.6</td><td>32.2</td><td>33.9</td><td>67.3</td><td>69.9</td><td>26.1</td><td>26.9</td></tr><tr><td>CLIP (Radford et al.,2021)</td><td>DataComp-1B(Gadre et al.,2023)</td><td>37.2</td><td>37.5</td><td>18.7</td><td>18.5</td><td>33.5</td><td>34.2</td><td>66.3</td><td>70.2</td><td>24.5</td><td>25.8</td></tr><tr><td>CLIP4Clip (Luo et al.,2022)</td><td>+HowTo100M Miech et al. (2019)</td><td>45.6</td><td>45.9</td><td>24.3</td><td>23.8</td><td>43.0</td><td>43.6</td><td>45.2</td><td>48.4</td><td>40.3</td><td>41.6</td></tr><tr><td>ViCLIP</td><td>+WebVid10M(Bain et al.,2021)</td><td>50.8</td><td>49.3</td><td>27.3</td><td>28.4</td><td>48.1</td><td>48.5</td><td>76.7</td><td>81.2</td><td>44.5</td><td>43.2</td></tr><tr><td>ViCLIP</td><td>+InternVid-10M</td><td>51.8</td><td>49.7</td><td>28.5</td><td>29.4</td><td>49.5</td><td>50.6</td><td>77.2</td><td>80.0</td><td>49.7</td><td>48.4</td></tr><tr><td>ViCLIP</td><td>+InternVid-50M</td><td>52.8</td><td>52.2</td><td>30.9</td><td>30.9</td><td>49.4</td><td>48.7</td><td>78.1</td><td>80.0</td><td>49.7</td><td>49.0</td></tr><tr><td>ViCLIP</td><td>+InternVid-200M</td><td>53.7</td><td>53.4</td><td>29.3</td><td>31.3</td><td>51.1</td><td>50.8</td><td>79.9</td><td>78.4</td><td>52.8</td><td>51.1</td></tr><tr><td>ViCLIP</td><td>+InternVid-10M-DIV</td><td>55.0</td><td>53.3</td><td>32.0</td><td>30.0</td><td>51.7</td><td>52.1</td><td>75.8</td><td>77.8</td><td>50.4</td><td>48.9</td></tr><tr><td>ViCLIP</td><td>+InternVid-10M-FLT</td><td>52.5</td><td>51.8</td><td>33.0</td><td>32.5</td><td>49.4</td><td>50.2</td><td>77.2</td><td>79.0</td><td>49.8</td><td>48.1</td></tr></table>
|
| 135 |
+
|
| 136 |
+
Table 5: Results of fine-tuned video retrieval on MSR-VTT, LSMDC, DiDeMo, MSVD, and ANet.
|
| 137 |
+
|
| 138 |
+
Zero-Shot. Table 4 reveals InternVid-10M outperforms WebVid when employing the same method, ViCLIP, with an average increase of $6 . 3 \%$ in $\mathbb { R } \ @ 1$ across nearly all benchmarks. This improvement can be further amplified by diversifying the training clips used, as InternVid-10M-DIV and -FLT surpass WebVid on ViCLIP with gains in $\mathbf { R } \ @ 1$ of $1 4 . 0 \%$ and $1 7 . 1 \%$ , respectively. These results underline, once again, the effectiveness of the correspondence between our generated video captions and their corresponding videos. Comparing CLIP4Clip using HowTo100M with ViCLIP using WebVid10M or InternVid-10M shows that the correlation between video and text influences performance more significantly than their quantity. Moreover, the zero-shot performance demonstrates that the video-text representation learned using InternVid is transferable. This claim is supported by its superior performance across multiple video retrieval benchmarks.
|
| 139 |
+
|
| 140 |
+
Fine-Tuned. Table 5 exhibits a noticeable improvement when transitioning from InternVid-10M to WebVid10M while using ViCLIP for both $\mathbf { \Omega } ^ { \mathsf { t 2 v } }$ and v2t retrieval across almost all datasets. On average, there is a $3 . 7 \%$ increase in t2v $\mathbf { R } \ @ 1$ across all benchmarks, with particularly significant rise observed in ActivityNet (an increase of over $1 1 . 9 \%$ ). However, ViCLIP using WebVid10M yields better v2t $\mathbf { R } \ @ 1$ scores than when using InternVid-10M (81.2 vs. 80.0). We believe this does not alter the overall trend that InternVid-10M generally provides more advantage to ViCLIP than WebVid10M does.
|
| 141 |
+
|
| 142 |
+
The benefits of used video data become even more apparent when comparing InternVid-10M-DIV or InternVid-10M-FLT with WebVid10M. Their overall increases are $5 . 8 \%$ and $5 . 1 \%$ , respectively. Despite these improvements, issues related to data diversity persist.
|
| 143 |
+
|
| 144 |
+
Data Scaling and Issues. Figure 7 and 8 illustrate how ViCLIP’s performance changes in zeroshot and fine-tuning settings when varying the scale of InternVid. In both scenarios, increasing the data scale results in significant increases in performance. As shown in Figure 7, ViCLIP’s discriminative ability linearly increases with the increasing volume of training videos used $1 0 \mathbf { M } $ 200M). Meanwhile, Figure 8 shows that the retrieval performance increase becomes marginal when scaling the training data beyond 50M. It’s vital to note our model is trained using only contrastive loss without employing popular designs such as matching head and its corresponding loss. Consequently, this retrieval result doesn’t allow for any definitive conclusions about whether there exists a turning point after which scaling up the training videos becomes less beneficial currently. More explorations are necessary in these retrieval experiments. However, these findings generally suggest that enhancing the scale of pretraining data can improve the transferability of the learned representation.
|
| 145 |
+
|
| 146 |
+
# 5.2 OTHER APPLICATIONS
|
| 147 |
+
|
| 148 |
+
Text-to-Video Generation. Our InternVid dataset improves existing text-to-video (t2v) generation models by providing high-quality video-text pairs. We extend spatiotemporal modeling on the latent space of a text-to-image diffusion model (Rombach et al., 2022) as a t2v baseline. We train the baseline with two settings: one using WebVid10M, and the other using InternVid-Aes-18M in addition to WebVid10M. InternVid-Aes-18M is a subset of InternVid consisting of clips with an aesthetic score of at least 4. Quantitative (Table 6) and qualitative (Figure 12) evaluations demonstrate the effectiveness of InternVid in video generation tasks. Evaluation protocols are given in App. E.3.
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
Figure 7: Zero-shot action recognition (top-1 ac-Figure 8: Video retrieval average performance curacy) on Kinetics-400 / -600 / -700. (text-to-video $\mathbb { R } \ @ 1$ ) across five datasets.
|
| 152 |
+
|
| 153 |
+

|
| 154 |
+
|
| 155 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Training Data</td><td colspan="3">FIUCF-101</td><td rowspan="2">CMSRMTT</td></tr><tr><td>IS (↑)</td><td></td><td>FVD (↓)</td></tr><tr><td></td><td>VideoCrafter²WebVid10M(Bain et al.,2021)18.26</td><td></td><td>66.95</td><td>910.87</td><td>0.2875</td></tr><tr><td></td><td>VideoFusion³WebVid10M(Bain et al.,2021)17.49</td><td></td><td>75.77</td><td>639.90</td><td>0.2795</td></tr><tr><td>t2v baseline</td><td>WebVid10M(Bain et al.,2021) 13.97</td><td></td><td>98.25</td><td>705.25</td><td>0.2657</td></tr><tr><td>t2v baseline</td><td>WebVid10M+InternVid18M</td><td></td><td></td><td></td><td>21.04+7.07 60.25-38.00 616.51-88.740.2951+0.0294</td></tr></table>
|
| 156 |
+
|
| 157 |
+
Table 6: Zero-shot text-to-video generation performance.
|
| 158 |
+
|
| 159 |
+
In Table 6, we observe that t2v baseline trained on WebVid10M performs poorly in terms of IS, FID, and CLIPSIM when compared to other approaches. However, with the addition of InternVid-Aes, t2v baseline demonstrates significant improvements in these metrics and outperforms other methods by a considerable margin. In Figure 12, we observe that the t2v baseline using both WebVid10M and InternVid-Aes-18M significantly outperforms others in visual quality and temporal coherence. These results demonstrate the potential of InternVid for high-quality video generation.
|
| 160 |
+
|
| 161 |
+
Video-Centric Dialogue System. Inspired by recent vision-centric dialogue systems (Li et al., 2023c; Muhammad Maaz & Khan, 2023; Li et al., 2023a), we integrate our pretrained ViCLIP (with InternVid) into VideoChat (Li et al., 2023c) to show how our data and model can empower multimodal dialogue methods with effective video modeling capability. In implementation, we inherit nearly all designs of VideoChat-Embed, just replacing its visual encoder with our ViCLIP (trained on InternVid). We evaluate VideoChat-ViCLIP in spatial understanding (Figure 13), action recognition (Figure 14), temporal understanding (Figure 15), video reasoning (Figure 16), and video creative (Figure 17) tasks. Our qualitative evaluations demonstrate its decent video-to-text capabilities.
|
| 162 |
+
|
| 163 |
+
Table 7: Performance benchmarking of text generation models.
|
| 164 |
+
|
| 165 |
+
<table><tr><td>Evaluation Aspect</td><td>Correormeation</td><td>Drientation</td><td> Conestading</td><td> Temprading</td><td>Consistency</td><td>Avg</td></tr><tr><td>VideoChat (Eva-g)</td><td>2.23</td><td>2.50</td><td>2.53</td><td>1.94</td><td>2.24</td><td>2.29</td></tr><tr><td>Video-ChatGPT</td><td>2.40</td><td>2.52</td><td>2.62</td><td>1.98</td><td>2.37</td><td>2.38</td></tr><tr><td>VideoChat-ViCLIP</td><td>2.86</td><td>2.52</td><td>3.08</td><td>2.36</td><td>2.40</td><td>2.64</td></tr></table>
|
| 166 |
+
|
| 167 |
+
In terms of quantitative comparison, as shown in Table 5.2, VideoChat-ViCLIP notably outperforms the vanilla VideoChat (using Eva- $\mathbf { g }$ as the vision encoder) and others across all evaluation aspects of the video conversation evaluation in the work of Muhammad Maaz & Khan (2023). Specifically, the model shows remarkable improvements in the correctness of information (from 2.23 to 2.86), contextual understanding (from 2.53 to 3.08), and temporal understanding (from 1.94 to 2.36). The average score also increases from 2.29 to 2.64, showing an overall performance gain.
|
| 168 |
+
|
| 169 |
+
# 6 CONCLUSION
|
| 170 |
+
|
| 171 |
+
Our dataset, InternVid, is designed for multimodal research (both understanding and generation) focused on videos. It consists of over 200 million video clips sourced from 7 million high-resolution YouTube videos. We use existing models with a multiscale approach to generate clip-level descriptions. Our studies confirm the efficacy of captions, and the large volume of video-text data enables crossmodal learning and text-to-video generation at scale. By training with our data, we develop a video-text representation baseline ViCLIP using ViT-L and analyze briefly how the data scale affects learned crossmodal embeddings. In addition to perception tasks, we show that InternVid improves text-to-video generation and supports multimodal dialogue systems. With its data, annotations, metadata, and computed scores, we believe InternVid can fuel a variety of studies and applications.
|
| 172 |
+
|
| 173 |
+
# ACKNOWLEDGEMENTS
|
| 174 |
+
|
| 175 |
+
This work is partially supported by the National Key R&D Program of China (No. 2022ZD0160101), National Natural Science Foundation of China (No. 62076119, No. 61921006)), the Science and Technology Commission of Shanghai Municipality under Grant No. 23QD1400800 and No. 23YF1461900, and the Ministry of Education, Singapore, under its MOE AcRF Tier 2 (MOET2EP20221- 0012) and NTU NAP.
|
| 176 |
+
|
| 177 |
+
# REFERENCES
|
| 178 |
+
|
| 179 |
+
Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katie Millican, Malcolm Reynolds, Roman Ring, Eliza Rutherford, Serkan Cabi, Tengda Han, Zhitao Gong, Sina Samangooei, Marianne Monteiro, Jacob Menick, Sebastian Borgeaud, Andy Brock, Aida Nematzadeh, Sahand Sharifzadeh, Mikolaj Binkowski, Ricardo Barreira, Oriol Vinyals, Andrew Zisserman, and Karen Simonyan. Flamingo: a visual language model for few-shot learning. ArXiv, abs/2204.14198, 2022.
|
| 180 |
+
Lisa Anne Hendricks, Oliver Wang, Eli Shechtman, Josef Sivic, Trevor Darrell, and Bryan Russell. Localizing moments in video with natural language. In ICCV, pp. 5803–5812, 2017.
|
| 181 |
+
Anas Awadalla, Irena Gao, Joshua Gardner, Jack Hessel, Yusuf Hanafy, Wanrong Zhu, Kalyani Marathe, Yonatan Bitton, Samir Gadre, Jenia Jitsev, et al. Openflamingo, 2023.
|
| 182 |
+
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, pp. 1728–1738, 2021.
|
| 183 |
+
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, pp. 22563–22575, 2023.
|
| 184 |
+
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, 33:1877–1901, 2020.
|
| 185 |
+
Joao Carreira and Andrew Zisserman. Quo vadis, action recognition? a new model and the kinetics dataset. In CVPR, 2017.
|
| 186 |
+
Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual $1 2 \mathrm { m }$ : Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In CVPR, pp. 3558–3568, 2021.
|
| 187 |
+
David L Chen and William B Dolan. Collecting highly parallel data for paraphrase evaluation. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies-Volume 1, pp. 190–200. Association for Computational Linguistics, 2011.
|
| 188 |
+
Guo Chen, Sen Xing, Zhe Chen, Yi Wang, Kunchang Li, Yizhuo Li, Yi Liu, Jiahao Wang, YinDong Zheng, Bingkun Huang, et al. Internvideo-ego4d: A pack of champion solutions to ego4d challenges. arXiv preprint arXiv:2211.09529, 2022.
|
| 189 |
+
Guo Chen, Yin-Dong Zheng, Jiahao Wang, Jilan Xu, Yifei Huang, Junting Pan, Yi Wang, Yali Wang, Yu Qiao, Tong Lu, et al. Videollm: Modeling video sequence with large language models. arXiv preprint arXiv:2305.13292, 2023a.
|
| 190 |
+
Sihan Chen, Xingjian He, Longteng Guo, Xinxin Zhu, Weining Wang, Jinhui Tang, and Jing Liu. Valor: Vision-audio-language omni-perception pretraining model and dataset. arXiv preprint arXiv:2304.08345, 2023b.
|
| 191 |
+
Sihan Chen, Handong Li, Qunbo Wang, Zijia Zhao, Mingzhen Sun, Xinxin Zhu, and Jing Liu. Vast: A vision-audio-subtitle-text omni-modality foundation model and dataset. arXiv preprint arXiv:2305.18500, 2023c.
|
| 192 |
+
Feng Cheng, Xizi Wang, Jie Lei, David Crandall, Mohit Bansal, and Gedas Bertasius. Vindlu: A recipe for effective video-and-language pretraining. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10739–10750, 2023.
|
| 193 |
+
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/.
|
| 194 |
+
Tri Dao, Dan Fu, Stefano Ermon, Atri Rudra, and Christopher Re. Flashattention: Fast and memory- ´ efficient exact attention with io-awareness. NeurIPS, 35:16344–16359, 2022.
|
| 195 |
+
Karan Desai, Gaurav Kaul, Zubin Aysola, and Justin Johnson. Redcaps: Web-curated image-text data created by the people, for the people. arXiv preprint arXiv:2111.11431, 2021.
|
| 196 |
+
Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
|
| 197 |
+
Zi-Yi Dou, Yichong Xu, Zhe Gan, Jianfeng Wang, Shuohang Wang, Lijuan Wang, Chenguang Zhu, Pengchuan Zhang, Lu Yuan, Nanyun Peng, et al. An empirical study of training end-to-end vision-and-language transformers. In CVPR, 2022.
|
| 198 |
+
Tsu-Jui Fu, Linjie Li, Zhe Gan, Kevin Lin, William Yang Wang, Lijuan Wang, and Zicheng Liu. Violet: End-to-end video-language transformers with masked visual-token modeling. arXiv preprint arXiv:2111.12681, 2021.
|
| 199 |
+
Samir Yitzhak Gadre, Gabriel Ilharco, Alex Fang, Jonathan Hayase, Georgios Smyrnis, Thao Nguyen, Ryan Marten, Mitchell Wortsman, Dhruba Ghosh, Jieyu Zhang, et al. Datacomp: In search of the next generation of multimodal datasets. arXiv preprint arXiv:2304.14108, 2023.
|
| 200 |
+
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 Computer Vision–ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23–27, 2022, Proceedings, Part XVII, pp. 102–118. Springer, 2022.
|
| 201 |
+
Raghav Goyal, Samira Ebrahimi Kahou, Vincent Michalski, Joanna Materzynska, Susanne Westphal, Heuna Kim, Valentin Haenel, Ingo Fruend, Peter Yianilos, Moritz Mueller-Freitag, et al. The” something something” video database for learning and evaluating visual common sense. In ICCV, pp. 5842–5850, 2017.
|
| 202 |
+
Xingjian He, Sihan Chen, Fan Ma, Zhicheng Huang, Xiaojie Jin, Zikang Liu, Dongmei Fu, Yi Yang, Jing Liu, and Jiashi Feng. Vlab: Enhancing video language pre-training by feature adapting and blending. arXiv preprint arXiv:2305.13167, 2023.
|
| 203 |
+
Fabian Caba Heilbron, Victor Escorcia, Bernard Ghanem, and Juan Carlos Niebles. Activitynet: A large-scale video benchmark for human activity understanding. In 2015 IEEE conference on computer vision and pattern recognition (CVPR), pp. 961–970. IEEE, 2015.
|
| 204 |
+
Xiaowei Hu, Zhe Gan, Jianfeng Wang, Zhengyuan Yang, Zicheng Liu, Yumao Lu, and Lijuan Wang. Scaling up vision-language pre-training for image captioning. In CVPR, pp. 17980–17989, 2022.
|
| 205 |
+
Shaohan Huang, Li Dong, Wenhui Wang, Yaru Hao, Saksham Singhal, Shuming Ma, Tengchao Lv, Lei Cui, Owais Khan Mohammed, Qiang Liu, et al. Language is not all you need: Aligning perception with language models. arXiv preprint arXiv:2302.14045, 2023a.
|
| 206 |
+
Xinyu Huang, Youcai Zhang, Jinyu Ma, Weiwei Tian, Rui Feng, Yuejie Zhang, Yaqian Li, Yandong Guo, and Lei Zhang. Tag2text: Guiding vision-language model via image tagging. arXiv preprint arXiv:2303.05657, 2023b.
|
| 207 |
+
Ranjay Krishna, Kenji Hata, Frederic Ren, Li Fei-Fei, and Juan Carlos Niebles. Dense-captioning events in videos. In ICCV, pp. 706–715, 2017.
|
| 208 |
+
|
| 209 |
+
Jie Lei, Tamara L Berg, and Mohit Bansal. Revealing single frame bias for video-and-language learning. arXiv preprint arXiv:2206.03428, 2022.
|
| 210 |
+
|
| 211 |
+
Bo Li, Yuanhan Zhang, Liangyu Chen, Jinghao Wang, Fanyi Pu, Jingkang Yang, Chunyuan Li, and Ziwei Liu. Mimic-it: Multi-modal in-context instruction tuning. arXiv preprint arXiv:2306.05425, 2023a.
|
| 212 |
+
Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. Blip-2: Bootstrapping language-image pretraining with frozen image encoders and large language models. arXiv preprint arXiv:2301.12597, 2023b.
|
| 213 |
+
Kunchang Li, Yali Wang, Yinan He, Yizhuo Li, Yi Wang, Limin Wang, and Yu Qiao. Uniformerv2: Spatiotemporal learning by arming image vits with video uniformer. arXiv preprint arXiv:2211.09552, 2022a.
|
| 214 |
+
KunChang Li, Yinan He, Yi Wang, Yizhuo Li, Wenhai Wang, Ping Luo, Yali Wang, Limin Wang, and Yu Qiao. Videochat: Chat-centric video understanding. arXiv preprint arXiv:2305.06355, 2023c.
|
| 215 |
+
Kunchang Li, Yali Wang, Yizhuo Li, Yi Wang, Yinan He, Limin Wang, and Yu Qiao. Unmasked teacher: Towards training-efficient video foundation models. arXiv preprint arXiv:2303.16058, 2023d.
|
| 216 |
+
Linjie Li, Zhe Gan, Kevin Lin, Chung-Ching Lin, Zicheng Liu, Ce Liu, and Lijuan Wang. Lavender: Unifying video-language understanding as masked language modeling. arXiv preprint arXiv:2206.07160, 2022b.
|
| 217 |
+
Tianhao Li and Limin Wang. Learning spatiotemporal features via video and text pair discrimination. CoRR, abs/2001.05691, 2020. URL https://arxiv.org/abs/2001.05691.
|
| 218 |
+
Zhenyang Li, Ran Tao, Efstratios Gavves, Cees G. M. Snoek, and Arnold W. M. Smeulders. Tracking by natural language specification. CVPR, 2017.
|
| 219 |
+
Zhaoyang Liu, Yinan He, Wenhai Wang, Weiyun Wang, Yi Wang, Shoufa Chen, Qinglong Zhang, Yang Yang, Qingyun Li, Jiashuo Yu, et al. Internchat: Solving vision-centric tasks by interacting with chatbots beyond language. arXiv preprint arXiv:2305.05662, 2023.
|
| 220 |
+
Huaishao Luo, Lei Ji, Ming Zhong, Yang Chen, Wen Lei, Nan Duan, and Tianrui Li. Clip4clip: An empirical study of clip for end to end video clip retrieval and captioning. Neurocomputing, 2022.
|
| 221 |
+
Zhengxiong Luo, Dayou Chen, Yingya Zhang, Yan Huang, Liang Wang, Yujun Shen, Deli Zhao, Jingren Zhou, and Tieniu Tan. Videofusion: Decomposed diffusion models for high-quality video generation. In CVPR, pp. 10209–10218, 2023.
|
| 222 |
+
Farzaneh Mahdisoltani, Guillaume Berger, Waseem Gharbieh, David Fleet, and Roland Memisevic. On the effectiveness of task granularity for transfer learning. arXiv preprint arXiv:1804.09235, 2018.
|
| 223 |
+
Antoine Miech, Dimitri Zhukov, Jean-Baptiste Alayrac, Makarand Tapaswi, Ivan Laptev, and Josef Sivic. Howto $1 0 0 \mathrm { m }$ : Learning a text-video embedding by watching hundred million narrated video clips. In ICCV, pp. 2630–2640, 2019.
|
| 224 |
+
Antoine Miech, Jean-Baptiste Alayrac, Lucas Smaira, Ivan Laptev, Josef Sivic, and Andrew Zisserman. End-to-end learning of visual representations from uncurated instructional videos. In CVPR, 2020.
|
| 225 |
+
Salman Khan Muhammad Maaz, Hanoona Rasheed and Fahad Khan. Video-chatgpt: Towards detailed video understanding via large vision and language models. ArXiv 2306.05424, 2023.
|
| 226 |
+
Arsha Nagrani, Paul Hongsuck Seo, Bryan Seybold, Anja Hauth, Santiago Manen, Chen Sun, and Cordelia Schmid. Learning audio-video modalities from image captions. In ECCV, pp. 407–426. Springer, 2022.
|
| 227 |
+
Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
|
| 228 |
+
|
| 229 |
+
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 ICML, pp. 8748–8763. PMLR, 2021.
|
| 230 |
+
|
| 231 |
+
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. JMLR, 21(1):5485–5551, 2020.
|
| 232 |
+
Anna Rohrbach, Marcus Rohrbach, Niket Tandon, and Bernt Schiele. A dataset for movie description. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3202–3212, 2015.
|
| 233 |
+
Anna Rohrbach, Atousa Torabi, Marcus Rohrbach, Niket Tandon, Christopher Pal, Hugo Larochelle, Aaron Courville, and Bernt Schiele. Movie description. IJCV, 123:94–120, 2017.
|
| 234 |
+
Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High- ¨ resolution image synthesis with latent diffusion models. In CVPR, pp. 10684–10695, 2022.
|
| 235 |
+
Ramon Sanabria, Ozan Caglayan, Shruti Palaskar, Desmond Elliott, Lo¨ıc Barrault, Lucia Specia, and Florian Metze. How2: a large-scale dataset for multimodal language understanding. arXiv preprint arXiv:1811.00347, 2018.
|
| 236 |
+
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. arXiv preprint arXiv:2210.08402, 2022.
|
| 237 |
+
Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In ACL, pp. 2556–2565, 2018.
|
| 238 |
+
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.
|
| 239 |
+
Sijie Song, Xudong Lin, Jiaying Liu, Zongming Guo, and Shih-Fu Chang. Co-grounding networks with semantic attention for referring expression comprehension in videos. In CVPR, June 2021.
|
| 240 |
+
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.
|
| 241 |
+
Krishna Srinivasan, Karthik Raman, Jiecao Chen, Michael Bendersky, and Marc Najork. Wit: Wikipedia-based image text dataset for multimodal multilingual machine learning. In Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 2443–2449, 2021.
|
| 242 |
+
Jonathan C Stroud, Zhichao Lu, Chen Sun, Jia Deng, Rahul Sukthankar, Cordelia Schmid, and David A Ross. Learning video representations from textual web supervision. arXiv preprint arXiv:2007.14937, 2020.
|
| 243 |
+
Chen Sun, Austin Myers, Carl Vondrick, Kevin P. Murphy, and Cordelia Schmid. Videobert: A joint model for video and language representation learning. ICCV, 2019.
|
| 244 |
+
Quan Sun, Yuxin Fang, Ledell Wu, Xinlong Wang, and Yue Cao. Eva-clip: Improved training techniques for clip at scale. arXiv preprint arXiv:2303.15389, 2023.
|
| 245 |
+
Bart Thomee, David A Shamma, Gerald Friedland, Benjamin Elizalde, Karl Ni, Douglas Poland, Damian Borth, and Li-Jia Li. Yfcc100m: The new data in multimedia research. Communications of the ACM, 59(2):64–73, 2016.
|
| 246 |
+
Zhan Tong, Yibing Song, Jue Wang, and Limin Wang. Videomae: Masked autoencoders are dataefficient learners for self-supervised video pre-training. In NeurIPS, 2022. doi: 10.48550/arXiv. 2203.12602. URL https://doi.org/10.48550/arXiv.2203.12602.
|
| 247 |
+
Alex Jinpeng Wang, Yixiao Ge, Rui Yan, Yuying Ge, Xudong Lin, Guanyu Cai, Jianping Wu, Ying Shan, Xiaohu Qie, and Mike Zheng Shou. All in one: Exploring unified video-language pre-training. arXiv preprint arXiv:2203.07303, 2022a.
|
| 248 |
+
Limin Wang, Bingkun Huang, Zhiyu Zhao, Zhan Tong, Yinan He, Yi Wang, Yali Wang, and Yu Qiao. Videomae v2: Scaling video masked autoencoders with dual masking. In CVPR, 2023.
|
| 249 |
+
Yi Wang, Kunchang Li, Yizhuo Li, Yinan He, Bingkun Huang, Zhiyu Zhao, Hongjie Zhang, Jilan Xu, Yi Liu, Zun Wang, Sen Xing, Guo Chen, Junting Pan, Jiashuo Yu, Yali Wang, Limin Wang, and Yu Qiao. Internvideo: General video foundation models via generative and discriminative learning. arXiv preprint arXiv:2212.03191, 2022b.
|
| 250 |
+
Jay Zhangjie Wu, Yixiao Ge, Xintao Wang, 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.
|
| 251 |
+
Haiyang Xu, Qinghao Ye, Ming Yan, Yaya Shi, Jiabo Ye, Yuanhong Xu, Chenliang Li, Bin Bi, Qi Qian, Wei Wang, et al. mplug-2: A modularized multi-modal foundation model across text, image and video. arXiv preprint arXiv:2302.00402, 2023.
|
| 252 |
+
Hu Xu, Gargi Ghosh, Po-Yao Huang, Dmytro Okhonko, Armen Aghajanyan, Florian Metze, Luke Zettlemoyer, and Christoph Feichtenhofer. Videoclip: Contrastive pre-training for zero-shot video-text understanding. arXiv preprint arXiv:2109.14084, 2021.
|
| 253 |
+
Jun Xu, Tao Mei, Ting Yao, and Yong Rui. Msr-vtt: A large video description dataset for bridging video and language. In CVPR, pp. 5288–5296, 2016.
|
| 254 |
+
Hongwei Xue, Tiankai Hang, Yanhong Zeng, Yuchong Sun, Bei Liu, Huan Yang, Jianlong Fu, and Baining Guo. Advancing high-resolution video-language representation with large-scale video transcriptions. In CVPR, pp. 5036–5045, 2022.
|
| 255 |
+
Antoine Yang, Antoine Miech, Josef Sivic, Ivan Laptev, and Cordelia Schmid. Tubedetr: Spatiotemporal video grounding with transformers. In CVPR, pp. 16442–16453, 2022.
|
| 256 |
+
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.
|
| 257 |
+
Rowan Zellers, Ximing Lu, Jack Hessel, Youngjae Yu, Jae Sung Park, Jize Cao, Ali Farhadi, and Yejin Choi. Merlot: Multimodal neural script knowledge models. NeurIPS, 34:23634–23651, 2021.
|
| 258 |
+
Rowan Zellers, Jiasen Lu, Ximing Lu, Youngjae Yu, Yanpeng Zhao, Mohammadreza Salehi, Aditya Kusupati, Jack Hessel, Ali Farhadi, and Yejin Choi. Merlot reserve: Neural script knowledge through vision and language and sound. In CVPR, pp. 16375–16387, 2022.
|
| 259 |
+
Ziyun Zeng, Yixiao Ge, Zhan Tong, Xihui Liu, Shu-Tao Xia, and Ying Shan. Tvtsv2: Learning out-of-the-box spatiotemporal visual representations at scale. arXiv preprint arXiv:2305.14173, 2023a.
|
| 260 |
+
Ziyun Zeng, Yuying Ge, Xihui Liu, Bin Chen, Ping Luo, Shu-Tao Xia, and Yixiao Ge. Learning transferable spatiotemporal representations from natural script knowledge. In CVPR, pp. 23079– 23089, 2023b.
|
| 261 |
+
Luowei Zhou, Chenliang Xu, and Jason Corso. Towards automatic learning of procedures from web instructional videos. In AAAI, 2018.
|
| 262 |
+
Deyao Zhu, Jun Chen, Xiaoqian Shen, Xiang Li, and Mohamed Elhoseiny. Minigpt-4: Enhancing vision-language understanding with advanced large language models. arXiv preprint arXiv:2304.10592, 2023a.
|
| 263 |
+
Linchao Zhu and Yi Yang. Actbert: Learning global-local video-text representations. CVPR, 2020.
|
| 264 |
+
Wanrong Zhu, Jack Hessel, Anas Awadalla, Samir Yitzhak Gadre, Jesse Dodge, Alex Fang, Youngjae Yu, Ludwig Schmidt, William Yang Wang, and Yejin Choi. Multimodal c4: An open, billion-scale corpus of images interleaved with text. arXiv preprint arXiv:2304.06939, 2023b.
|
| 265 |
+
|
| 266 |
+
tt
|
| 267 |
+
|
| 268 |
+

|
| 269 |
+
Figure 9: The word cloud (Top-200) of the generated captions in the InternVid dataset reveals that the captions predominantly highlight the rich actions of the objects.
|
| 270 |
+
Figure 10: The word clouds of the ASR transcripts of four different languages (English, Chinese, Korean, and German). We collect videos from various countries or regions with 11 different languages. Here we list four of them to show how these transcripts are distributed in words.
|
| 271 |
+
|
| 272 |
+
# A DATA AVAILABILITY STATEMENT
|
| 273 |
+
|
| 274 |
+
We are committed to maintaining transparency and compliance in our data collection and sharing methods. In accordance with these principles, please note the following:
|
| 275 |
+
|
| 276 |
+
Publicly Available Data: The data utilized in our studies is publicly available. We do not use any exclusive or private data sources.
|
| 277 |
+
|
| 278 |
+
Data Sharing Policy: Our data sharing policy builds upon the precedent set by prior works like Kinetics, HD-VILA, and others. Instead of providing the original raw data, we only supply the YouTube video IDs necessary for downloading the respective content.
|
| 279 |
+
|
| 280 |
+
Usage Rights: The data released by us is intended exclusively for research purposes. Any potential commercial usage is not sanctioned under this agreement.
|
| 281 |
+
|
| 282 |
+
Compliance with YouTube Policies: Our data collection and release practices are strictly in accord with YouTube’s data privacy policies. We ensure that no user data or privacy rights are violated during the process.
|
| 283 |
+
|
| 284 |
+
Data Licence: We employ the protocol of CC BY 4.0.
|
| 285 |
+
|
| 286 |
+
# B LIMITATIONS & SOCIETAL IMPACT
|
| 287 |
+
|
| 288 |
+
All video data used in our research are downloaded from YouTube using Safe for Work (SFW) queries and channels. To ensure appropriate content, we employ a simple NSFW filter: a binary classifier designed to recognize and exclude non-ethical videos. For privacy considerations and in respect of data sharing practices, we share only the YouTube ID of the videos, similar to previous academic works. This approach aligns with YouTube’s data protocols and ensures no violation of privacy or data usage rules. Despite these precautions, our work has some limitations, primarily related to data diversity and representativeness. Although YouTube is an extensive source encompassing a wide range of video categories, certain specific types of footage may be excluded or scarcely collected, including: public area surveillance, sports competitions, movies, documentaries, etc. The exclusion of such categories is often due to copyright restrictions or other limits imposed by the platform. Therefore, while our dataset provides a broad view of everyday video content, its coverage does not extend to every possible category or type of video. These limitations should be taken into account when considering the generalizability of our results across all types of video data.
|
| 289 |
+
|
| 290 |
+
# C MORE STATISTICS IN INTERNVID
|
| 291 |
+
|
| 292 |
+
Actionness. InternVid contains way more verbs than the WebVid10M. We used NLTK toolkit to analyze the number of verbs in captions, focusing on tagging all unique verbs. We found a total of 109,485 verbs in the WebVid10M, while InternVid contained 212,155 ones. While the counts may not be that accurate due to our simple counting, we believe they provide a rough indication of the actionness of the two datasets.
|
| 293 |
+
|
| 294 |
+
Video Caption and Transcript Distribution. To analyze the word distribution of our generated captions and multilingual (ASR) transcripts, we compute their distributions. The resulting word distribution of the captions is presented in Figure 9, which includes objects (tv, car, door, plant, etc.), attributes (green, young, large, long, etc.), locations (middle, behind, south, next, etc.), scenes (room, stage, kitchen, office, etc.), actions/events (walking, eating, cutting, holding, etc.), and more.
|
| 295 |
+
|
| 296 |
+
We also include four word distributions of different languages in Figure 10, reflecting trends in different countries and offering potential data customization along with the provided metadata.
|
| 297 |
+
|
| 298 |
+
Aesthetic Scores and Clip-Caption Similarity. We uniformly sampled four frames of each clip, calculated their aesthetic scores, and took the maximum score as the video aesthetic score. For clip-caption similarity, we computed the cosine similarity between video embeddings and text ones, again using a uniform sampling of four frames for each clip.
|
| 299 |
+
|
| 300 |
+
Potential Biases. We focus on age, gender, and race distributions, as these are commonly recognized areas where bias can occur. Our methodology consisted of counting keywords related to these categories in the generated video captions. It’s important to note that these synthetic captions may not fully reflect the truth of the corresponding videos, thereby creating a gap between our analysis and the actual reality.Here are the results of our analysis:
|
| 301 |
+
|
| 302 |
+
• Age distribution: We counted nouns related to children, grown-ups, and the elderly. We found that $3 0 . 7 1 \%$ of the video captions contained such descriptions. Within this subset, the majority were about adults $( 8 4 . 5 9 \% )$ , followed by children $( 1 5 . 3 1 \% )$ and barely any mentions of senior citizens $( 0 . 0 8 \% )$ .
|
| 303 |
+
• Gender distribution: We counted nouns specifically related to males and females. According to our findings, $3 3 . 7 \%$ of video captions contained some form of gender-related text. Among these, $6 4 . 2 7 \%$ pertained to men and $3 5 . 7 3 \%$ pertained to women.
|
| 304 |
+
• Race distribution: Only around $2 . 5 1 \%$ of video captions contained descriptions related to race. This could be due to the limitations of our captioning pipeline, which might not be capable of capturing such attributes accurately. Further exploration using a dedicated race recognition model is needed for more accurate statistics.
|
| 305 |
+
|
| 306 |
+
# D INTERNVID-ICL: INTERLEAVED VIDEO-TEXT FOR IN-CONTEXT VIDEO LEARNING
|
| 307 |
+
|
| 308 |
+

|
| 309 |
+
Table 8: Interleaved video-text data format (b) in InternVid. The caption and ASR transcript of each clip is shown in black and gray, respectively. We can achieve interleaved video-text data format (a) by abandoning ASR transcripts. To obtain data format (c), we concatenate multiple videos with interleaved video-text data (a).
|
| 310 |
+
|
| 311 |
+
Visual Examples. As given in the paper, we provide examples video+text interleaved entries for in-cntext learning as Flamingo. Table 8 gives an example about format (a): arrange clips and their descriptions sequentially based on their temporal order within the same video. Note the videos are randomly dropped with a probability (0.3) for constructing richer text context compared with the original video-text pair combinations in sequential.
|
| 312 |
+
|
| 313 |
+
# E IMPLEMENTATION DETAILS
|
| 314 |
+
|
| 315 |
+
# E.1 DIVERSITY SAMPLING IN CONSTRUCTING INTERNVID SUBSETS
|
| 316 |
+
|
| 317 |
+
For DIV (diversity sampling), we aim to sample video clips from all long videos available to maximize data diversity. This was done by counting the frequencies of long videos in the segmented clip pool and sampling clips with probabilities inverse to these frequencies. Here is a pseudocode example of this process:
|
| 318 |
+
|
| 319 |
+
from collections import Counter import json import random import numpy as np data $=$ json.load(open("/path/to/to_sample")) 6 video_id $=$ set([x["video"].split("/")[-1][:11] for x in data]) video_id_counter $=$ Counter([x["video"].split("/")[-1][:11] for x in data ]) sampling_weights $=$ [1.0 / video_id_counter[x["video"].split("/") [-1][:11]] for $\mathbf { x }$ in data] np.random.seed(42) 10 sampling_weights $=$ np.array(sampling_weights)
|
| 320 |
+
|
| 321 |
+
Table 9: Video-text retrieval fine-tuning settings.
|
| 322 |
+
|
| 323 |
+
<table><tr><td>config</td><td colspan="4">MSRVTT DiDeMo ANet LSMDC MSVD</td></tr><tr><td>optimizer optimizer momentum weight decay</td><td colspan="4">AdamW β1, β2=0.9,0.999 0.02</td></tr><tr><td>learning rate schedule learning rate batch size</td><td>2e-5</td><td>cosine decay 4e-5 2e-5 256</td><td>2e-5</td><td>4e-5</td></tr><tr><td>warmup epochs total epochs</td><td>7</td><td>1 8 5 12</td><td>10</td><td>20</td></tr><tr><td>input frame max text length</td><td>32 0.3</td><td>96 64 0.2 0.3</td><td>64 0.3</td><td>150 0.2</td></tr><tr><td>drop path flip augmentation</td><td colspan="4"></td></tr><tr><td>augmentation</td><td colspan="5">yes MultiScaleCrop [0.5,1]</td></tr></table>
|
| 324 |
+
|
| 325 |
+
sampling_weights $=$ sampling_weights / sampling_weights.sum() sampled_index $=$ np.random.choice(len(data), 10647458, replace=False, p= sampling_weights) 13 data $=$ [data[i] for i in sampled_index] 14 json.dump(data, open("/path/to/sampled", "w"))
|
| 326 |
+
|
| 327 |
+
For FLT (filtering), we applied a series of filtering strategies to video data alongside DIV sampling. These included: a) Removing video clips shorter than 1s (approximately $2 3 . 1 5 \%$ of the total) or longer than 120s (around $0 . 8 4 \%$ of the total). b) Computing CLIPScore for each video clip using a randomly sampled frame from the clip with OpenAI’s CLIP-ViT-L/14, then selecting clips within the top $30 \%$ of CLIPScores. c) Sampling 10M out of the remaining clips using DIV sampling.
|
| 328 |
+
|
| 329 |
+
# E.2 VICLIP
|
| 330 |
+
|
| 331 |
+
Implementation. ViCLIP is learned with 64 NVIDIA A100 GPUs for 3 days with 50M video-text pairs. We introduce DeepSpeed and FlashAttention (Dao et al., 2022) for training and inference.
|
| 332 |
+
|
| 333 |
+
Action Recognition. In the zero-shot action recognition, we sample 8 frames in each video. Following the settings in CLIP and EVA-CLIP, we report the mean of top-1 and top-5 accuracy for Kinetics-400 / -600 / -700. In Section 5.1, we show ViCLIP learnt on WebVid or InternVid is an effective zero-shot action recognition model.
|
| 334 |
+
|
| 335 |
+
In the full fine-tuned setting, we conduct two experiments with two receipts. In Table 3, for the experiments where the training data excluded K710, we followed the common practice of finetuning the pretrained ViCLIP with the training data from the evaluation dataset. On the other hand, for the experiments where the training data included K710, we adopted a training trick inspired by (Li et al., 2022a). We first finetuned the pretrained ViCLIP with K710 (Li et al., 2022a), and then proceeded with the common supervised finetuning setting. By incorporating the supervised finetuning with K710, ViCLIP demonstrated better performance in the fine-tuned tasks compared to experiments that did not include K710.
|
| 336 |
+
|
| 337 |
+
Video Retrieval. In the full-finetuning setting, we tune the pretrained ViCLIP with not only video-text contrastive loss but also video-text matching loss on the training data of the evaluated benchmarks. During both training and testing, we sample 12 frames. Detailed hyper-parameters are given in Table 9. In the zero-shot setting, we sample only 8 frames for evaluations.
|
| 338 |
+
|
| 339 |
+
# E.3 VIDEO GENERATION BASELINE
|
| 340 |
+
|
| 341 |
+
We used the spatiotemporal modeling approach from (Wu et al., 2022) and built our text-to-video generation baseline on the work of (Rombach et al., 2022). Our approach consists of a U-Net with a transformer that models its latents, using interleaved spatiotemporal attention (ST-Attn), cross-attention for visual-text, a feed-forward network (FFN), and temporal attention (T-Attn), as illustrated in Figure 11. To adapt the 2D convolutional layers in (Rombach et al., 2022) to 3D, we extended $3 \times 3$ kernels into $1 \times 3 \times 3$ ones. We also extended the original spatial attentions to spatiotemporal ones. We initialized our baseline using all text-to-image diffusion model parameters, while the newly added temporal attention layers used default parameters.
|
| 342 |
+
|
| 343 |
+

|
| 344 |
+
Figure 11: Framework of our text-to-video generation baseline.
|
| 345 |
+
|
| 346 |
+
<table><tr><td rowspan="3">Captioning</td><td colspan="4">Retrieval</td><td colspan="6">Action Recognition</td></tr><tr><td colspan="2">Zero-Shot MSR-VTT</td><td colspan="2">Fine-Tuned MSR-VTT</td><td colspan="2">K400</td><td colspan="2">Zero-Shot K600</td><td colspan="2">K700</td></tr><tr><td>T2V</td><td>V2T</td><td>T2V</td><td>V2T</td><td>top-1</td><td>AVG</td><td>top-1</td><td>AVG</td><td>top-1</td><td>AVG</td></tr><tr><td rowspan="2">VideoChat Ours</td><td>33.9</td><td>32.3</td><td></td><td></td><td>54.68</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>38.6</td><td>38.5</td><td>46.6 49.0</td><td>47.1 49.2</td><td>58.52</td><td>67.74 71.11</td><td>51.70 55.37</td><td>64.91 68.27</td><td>43.67 47.09</td><td>56.51 59.98</td></tr></table>
|
| 347 |
+
|
| 348 |
+
Table 10: Video retrieval and action recognition results of ViCLIP-B trained on InternVid-FLT-10M with the captions generated by VideoChat and our captioning approach.
|
| 349 |
+
|
| 350 |
+
For the ST-Attn implementation, we used frame embeddings from the U-Net encoder instead of video embeddings as in (Wu et al., 2022). We concatenated the embeddings of the previous and current frame for values and keys in attention, while using the current frame embedding alone as queries. The rest of the implementation remained the same as the original.
|
| 351 |
+
|
| 352 |
+
Text-to-Video Evaluation. To evaluate our text-to-video model, we conducted zero-shot experiments on the UCF-101 and MSRVTT datasets, following the method from (Blattmann et al., 2023). For UCF-101, we used the class names as text prompts and generated 20 samples per class (total of 2,020 videos). For MSRVTT, we randomly selected one caption per video from the official test set (total of 2,990 videos). To ensure a fair comparison, we used the official implementation of VideoCrafter and VideoFusion (Luo et al., 2023) to generate the same number of videos with the same text prompts. During video sampling and evaluation, we generated 16 frames per video.
|
| 353 |
+
|
| 354 |
+
We assess the overall quality of the synthesized results on UCF-101 using framewise-FID, FVD, and Inception Score (IS), and evaluate the text-video semantic similarity on MSRVTT using clip similarity (CLIPSIM). For framewise-FID and IS, we use the pretrained Inceptionv3 network weights as our image encoder. For FVD, we use the pretrained InceptionI3d model and followed the TATS method (Ge et al., 2022). To compute CLIPSIM, we calculate the clip text-image similarity for each frame with respect to the given text prompts and computed the average score. We use the ViT-B-32 clip model as the backbone, consistent with previous work (Blattmann et al., 2023).
|
| 355 |
+
|
| 356 |
+
# F MORE RESULTS
|
| 357 |
+
|
| 358 |
+
# F.1 EFFECTIVENESS OF OUR MULTISCALE CAPTIONING APPROACH
|
| 359 |
+
|
| 360 |
+
To further validate the effectiveness of our proposed captioning method, we establish a video caption baseline using the video multimodal model VideoChat (Li et al., 2023c) for comparison. We input the video clip into the model with the prompt "Please describe the content in the given video." and apply it to InternVid-10M-FLT, resulting in 10 million new captions generated by VideoChat. Subsequently, we train two versions of ViCLIP-Base using InternVid-10M-FLT, each version trained with one of the two types of captions.
|
| 361 |
+
|
| 362 |
+
Table 10 demonstrates that ViCLIP-B trained using our captions outperforms the version trained using captions from VideoChat in both video retrieval (MSR-VTT) and action recognition (K400/600/700). These results are particularly noteworthy considering that the only difference in training lies in the captions generated by the two different approaches. Therefore, these findings further confirm the superior performance of our proposed captioning method compared to the baseline VideoChat.
|
| 363 |
+
|
| 364 |
+
Table 11: Zero-shot action recognition results of ViCLIP using different captions on Kinetics 400/600/700.
|
| 365 |
+
|
| 366 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Data</td><td colspan="2">top-K40AVG</td><td colspan="2">top-K60AVG</td><td colspan="2">top-K70AVG</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ViCLIP</td><td>+InternVid-2M</td><td>51.70</td><td>64.69</td><td>49.20</td><td>62.34</td><td>40.90</td><td>53.70</td></tr><tr><td>ViCLIP</td><td>+InternVid-2M-BLIP2</td><td>38.40</td><td>51.58</td><td>36.40</td><td>49.19</td><td>29.10</td><td>40.68</td></tr></table>
|
| 367 |
+
|
| 368 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Data</td><td colspan="2">MSR-VTT TLSMD2TDVDeV2T T2VVT T2VNV2T</td><td colspan="2"></td><td colspan="2"></td><td colspan="2"></td><td colspan="2"></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ViCLIP</td><td>+InternVid-2M</td><td>31.8</td><td>33.7</td><td>14.312.7</td><td></td><td></td><td>13.6 21.5 39.6 62.5</td><td></td><td></td><td>9.9</td><td>16.8</td></tr><tr><td></td><td>ViCLIP +InternVid-2M-BLIP2 21.7</td><td></td><td>21.9</td><td>5.2</td><td>5.1</td><td>7.1</td><td></td><td>12.7 24.6 42.1</td><td></td><td>6.4</td><td>10.2</td></tr></table>
|
| 369 |
+
|
| 370 |
+
Table 12: Results of zero-shot video retrieval from ViCLIPusing different captions on MSR-VTT, LSMDC, DiDeMo, MSVD, and ActivityNet.
|
| 371 |
+
|
| 372 |
+
We also ablate the necessary of including fine-level captions (by tag2text) more than only using coarse ones (by BLIP2). Specifically, an ablation is performed on two subsets of the dataset (InternVid-2M and InternVid-2MBLIP), each having 2 million video-text pairs. InternVid-2M utilized fused captions, combining both coarseand fine-level ones. In contrast, InternVid-2M-BLIP only used the coarse-level captions produced by BLIP2 on the central frames. For the mentioned using fine-level captions, concatenating the framewise captions from tag2text as the video captions is not a promising opinion as these captions are quite long and full of reptitions, unsuitable for contrastive learning. Thus, we do not include this setting in experiments.
|
| 373 |
+
|
| 374 |
+
Zero-shot experiments are conducted on these models. Due to computational constraints, the ViCLIP-B is trained with a batch size of 4096 using 8 A100 GPUs, with a mask ratio set to 0.9. All remaining training parameters were consistent with those in the main paper. Contrasting the results from Table 11 and 12, it’s evident that the use of combined coarse and fine-level captions in video-text contrastive learning rendered superior zero-shot performance than utilizing the coarse level ones alone. It shows the effectiveness of our given video captioning pipeline.
|
| 375 |
+
|
| 376 |
+
How the LM impacts motion-related words when summarizing framewise captions into video ones. From a statistical perspective, generating video captions from frame-level captions using a language model has a negligible effect on the number of motion-related words captured for video-based understanding. To illustrate this, we counted the unique verbs (using nltk package) in the captions from a $1 0 \mathrm { m }$ subset of InternVid under two settings: 1) In the first setting, the captions are video captions generated by the language model. 2) In the second setting, the captions are frame-wise ones from BLIP2 and tag2text. We found that the number of unique verbs in the video captions is 109859, whereas for the frame-wise captions it is slightly higher at 109895. This small discrepancy suggests that almost no motion-related words are lost during the caption generation process by LM. Therefore, we believe our approach maintains most of the important motion-related information needed for video understanding.
|
| 377 |
+
|
| 378 |
+
# F.2 MODEL SCALING
|
| 379 |
+
|
| 380 |
+
We provide a comparison between two versions of ViCLIP, -L (300M) and -B (80M), when trained on InternVid in Tables 13, 14, and 15. These tables distinctly demonstrate that moving from the base to large model, ViCLIP’s zero-shot and finetuned video retrieval performance, as well as zero-shot action recognition, can be consistently improved. These tables clearly demonstrate the benefits of model scaling, and we aim to explore this area further in future work as resources permit.
|
| 381 |
+
|
| 382 |
+
# F.3 LINEAR PROBING
|
| 383 |
+
|
| 384 |
+
we present the linear action recognition results on Kinetics-400 in Table 16. It’s noteworthy that ViCLIP, trained on InternVid-10M-FLT/-200M, delivers a much higher top-1 accuracy compared to when trained on WebVid-10M (with a more than 10-point increase), mirroring our findings in fine-tuned action recognition settings. Comparing with other approaches, ViCLIP-L offers performance close to TVTSv2-H/-B, which incorporate extra learnable parameters for spatiotemporal modeling. Moreover, it significantly outperforms VideoMAEv2-H. This result can be attributed to the fact that MAE-based methodologies generally underperform in linear evaluations.
|
| 385 |
+
|
| 386 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Data</td><td colspan="2">MSR-VTT TLSMD2T DiDeM2T T2VSVDT T2VNV2T</td><td colspan="2"></td><td colspan="2"></td><td colspan="2"></td><td colspan="2"></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ViCLIP-B</td><td>+InternVid-200M</td><td>37.436.1</td><td></td><td></td><td></td><td></td><td></td><td></td><td>16.5 15.2 16.6 22.6 44.3 67.0 13.3 21.7</td><td></td><td></td></tr><tr><td>ViCLIP-L</td><td>+InternVid-200M</td><td>39.339.5</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>18.316.617.1 25.5 47.3 70.0 13.7 21.6</td></tr><tr><td></td><td>ViCLIP-B +InternVid-10M-FLT 38.6 38.5</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>18.517.0 16.3 25.0 44.8 67.2 13.0 21.8</td></tr><tr><td></td><td>ViCLIP-L +InternVid-10M-FLT 42.4 41.3 20.1 16.9 18.4 27.9 49.1 75.1 15.1 24.0</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 387 |
+
|
| 388 |
+
Table 13: Scaling model in zero-shot video retrieval on MSR-VTT, LSMDC, DiDeMo, MSVD, and ActivityNet.
|
| 389 |
+
|
| 390 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Data</td><td colspan="2">MSV-VTT T2SMD2T DiVeM2T T2VSVDT T2ANV2T</td><td colspan="2"></td><td colspan="2"></td><td colspan="2"></td><td colspan="2"></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ViCLIP-B</td><td>+InternVid-200M</td><td>50.7 49.4 25.3 25.4 41.1 40.8 69.0 69.3 37.7 35.8</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ViCLIP-L</td><td>+InternVid-200M</td><td>53.7 53.4 29.3 29.3 51.1 50.879.978.4 52.8 51.1</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>ViCLIP-B +IntermVid-10M-FLT 49.0 49.2 24.4 23.7 40.0 41.4 72.2 73.7 38.3 37.0</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>ViCLIP-L +IntermVid-10M-FLT 52.5 51.8 33.0 33.0 49.4 50.2 77.2 79.049.8 48.1</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 391 |
+
|
| 392 |
+
Table 14: Scaling model in fine-tuned video retrieval on MSR-VTT, LSMDC, DiDeMo, MSVD, and ActivityNet.
|
| 393 |
+
|
| 394 |
+
# F.4 IMPACT OF VIDEOS FROM DIFFERENT LANGUAGE SOURCES
|
| 395 |
+
|
| 396 |
+
Unlike previous models that are benchmarked mostly on English-based datasets, InternVid encompasses clips from a variety of languages. This necessitates a further analysis to determine the potential impact this diversity might have. Currently, we hypothesize that the language of the video may not significantly impact the generated captions as our deployed image caption models generate English descriptions based purely on input frames. However, in terms of video distributions, there may exist differences (such as in behaviors, activities, and events) between videos stemming from different countries due to varied cultural backgrounds.
|
| 397 |
+
|
| 398 |
+
To examine this hypothesis, we select two 2 million subsets of InternVid: one consisting of only English videos (InternVid-2M-EN) and another with only Chinese videos (InternVid-2M-CN). It’s important to note that whether the videos are in English or Chinese, we generate captions in English. Our ViCLIP-B model is pretrained on these subsets, and we conduct zero-shot experiments as described below. Due to resource constraints, we trained the ViCLIP-B with a batchsize of 4096 using 8 A100 GPUs with a mask ratio set to 0.9. The remaining training settings were kept consistent with those outlined in the paper. As given in Table 17 and 18, we find that the model pretrained with InternVid-2M-EN outperformed that with InternVid-2M-CN notably in both zero-shot action recognition on K400/600/700 and video retrieval. This result can be attributed to the fact that InternVid-2M-EN has a data distribution much closer to downstream task data than InternVid-2M-CN, as all used task videos are sourced from English sources.
|
| 399 |
+
|
| 400 |
+
# F.5 TEXT-TO-VIDEO GENERATION
|
| 401 |
+
|
| 402 |
+
In Figure 12, we observe that the t2v baseline using both WebVid10M and InternVid-Aes-18M significantly outperforms others in visual quality and temporal coherence. Note that the t2v baseline using InternVid does not contain watermarks, which is a data bias in WebVid10M. We give more visual comparisons between our baseline and other approaches in the supp.
|
| 403 |
+
|
| 404 |
+
# F.6 VIDEO-CENTRIC DIALOGUE SYSTEM
|
| 405 |
+
|
| 406 |
+
We give qualitative evaluations of VideoChat-ViCLIP in spatial understanding (Figure 13), action recognition (Figure 14), temporal understanding (Figure 15), video reasoning (Figure 16), and video creative (Figure 17) tasks.
|
| 407 |
+
|
| 408 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Data</td><td colspan="2">K400</td><td colspan="2">K600</td><td colspan="2">K700</td></tr><tr><td>top-1</td><td>AVG</td><td>top-1</td><td>AVG</td><td>top-1</td><td>AVG</td></tr><tr><td>ViCLIP-B</td><td>+InternVid-200M</td><td>56.58</td><td>69.20</td><td>53.57</td><td>66.20</td><td>45.82</td><td>58.28</td></tr><tr><td>ViCLIP-L</td><td>+InternVid-200M</td><td>59.80</td><td>71.09</td><td>57.80</td><td>69.34</td><td>49.30</td><td>61.25</td></tr><tr><td>ViCLIP-B</td><td>+InternVid-10M-FLT</td><td>58.52</td><td>71.11</td><td>55.37</td><td>68.27</td><td>47.09</td><td>59.98</td></tr><tr><td>ViCLIP-L</td><td>+InternVid-10M-FLT</td><td>64.80</td><td>75.70</td><td>62.20</td><td>73.53</td><td>54.30</td><td>66.38</td></tr></table>
|
| 409 |
+
|
| 410 |
+
Table 15: Scaling model in zero-shot action recognition results on Kinetics 400/600/700.
|
| 411 |
+
|
| 412 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Data</td><td colspan="2">K400</td></tr><tr><td>top-1</td><td>AVG</td></tr><tr><td>VideoMAE-B (Tong et al., 2022)</td><td>Kinetics-400</td><td>20.4</td><td>=</td></tr><tr><td>VideoMAEv2-H(Wang et al.,2023)</td><td>Kinetics+SthSth+AVA+WebVid2M</td><td>25.8</td><td>=</td></tr><tr><td>TVTS-B (Zeng et al.,2023b)</td><td>+YT-Temporal-180M</td><td>60.8</td><td>=</td></tr><tr><td>TVTSv2-B (Zeng et al., 2023a)</td><td>+YT-Temporal-180M+WebVid-2M</td><td>70.1</td><td></td></tr><tr><td>TVTSv2-H (Zeng et al., 2023a)</td><td>+YT-Temporal-180M+WebVid-2M</td><td>73.1</td><td>=</td></tr><tr><td>ViCLIP-L</td><td>+WebVid-10M</td><td>60.0</td><td>82.9</td></tr><tr><td>ViCLIP-L</td><td>+InternVid-10M-FLT</td><td>71.1</td><td>90.4</td></tr><tr><td>ViCLIP-L</td><td>+InternVid-200M</td><td>71.7</td><td>90.9</td></tr></table>
|
| 413 |
+
|
| 414 |
+
Table 16: Linear action recognition results on Kinetics-400.
|
| 415 |
+
|
| 416 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Data</td><td colspan="2">top-K40AVG</td><td colspan="2">top-K60AVG</td><td colspan="2">top-K70AVG</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ViCLIP</td><td>+InternVid-2M-EN</td><td>40.20</td><td>53.68</td><td>37.40</td><td>51.00</td><td>29.60</td><td>42.06</td></tr><tr><td>ViCLIP</td><td>+InternVid-2M-CN</td><td>35.9</td><td>49.73</td><td>33.70</td><td>47.05</td><td>26.90</td><td>39.02</td></tr></table>
|
| 417 |
+
|
| 418 |
+
Table 17: Zero-shot action recognition results of ViCLIP using different pretraining sources on Kinetics 400/600/700.
|
| 419 |
+
|
| 420 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Data</td><td colspan="2"></td><td colspan="2">MSR-V2T T2SMDCDiDeM2T T2VSVDT T2AN2T</td><td colspan="2"></td><td colspan="2"></td><td colspan="2"></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>ViCLIP +InternVid-2M-EN 24.1 24.1</td><td></td><td></td><td>9.8</td><td>9.1</td><td></td><td></td><td></td><td>10.3 15.6 31.4 50.57.1</td><td></td><td>12.0</td></tr><tr><td></td><td>ViCLIP +IntermVid-2M-CN 22.2 22.2</td><td></td><td></td><td>8.4</td><td>8.7</td><td>9.9</td><td></td><td></td><td>15.1 29.6 48.55.7</td><td></td><td>9.7</td></tr></table>
|
| 421 |
+
|
| 422 |
+
Table 18: Results of zero-shot video retrieval of ViCLIP using different pretraining sources on MSR-VTT, LSMDC, DiDeMo, MSVD, and ActivityNet.
|
| 423 |
+
|
| 424 |
+

|
| 425 |
+
Figure 12: Comparison of samples from t2v baseline to others. We provide zero-shot text-to-video generation results of different methods trained on both WebVid10M and the additional InternVid-Aes18M. The used prompt is: a bald man in a black t-shirt is playing a guitar.
|
| 426 |
+
|
| 427 |
+

|
| 428 |
+
Figure 13: Video spatial understanding task. This figure demonstrates the spatial understanding and temporal localization capabilities of VideoChat-ViCLIP trained with our dataset.
|
| 429 |
+
|
| 430 |
+

|
| 431 |
+
Figure 14: Video action recognition task. The video comes from Kinetics-400, with the label ”playing guitar”.
|
| 432 |
+
|
| 433 |
+

|
| 434 |
+
Figure 15: Temporal understanding task. VideoChat-ViCLIP can easily handle temporal understanding tasks and make predictions based on these temporal sequences due to its training on rich temporal information on InternVid.
|
| 435 |
+
|
| 436 |
+

|
| 437 |
+
Figure 16: Video reasoning task. Our dialogue system has the ability to understand common sense and make causal inferences based on the contents of the video.
|
| 438 |
+
|
| 439 |
+

|
| 440 |
+
Figure 17: Video creative task. This figure shows the performance of VideoChat-ViCLIP on creative and generative tasks within our dataset, like generating poetry based on video content.
|
md/test/OEL4FJMg1b/OEL4FJMg1b.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DRAGONDIFFUSION: ENABLING DRAG-STYLE MANIPULATION ON DIFFUSION MODELS
|
| 2 |
+
|
| 3 |
+
Chong $\mathbf { M o u } ^ { 1 , 3 }$ Xintao Wang2 Jiechong Song1 Ying Shan2 Jian Zhang1,3∗
|
| 4 |
+
|
| 5 |
+
1School of Electronic and Computer Engineering, Shenzhen Graduate School, Peking University 2ARC Lab, Tencent PCG 3Peking University Shenzhen Graduate School-Rabbitpre AIGC Joint Research Laboratory {eechongm, xintao.alpha}@gmail.com, {songjiechong, zhangjian.sz}@pku.edu.cn
|
| 6 |
+
|
| 7 |
+

|
| 8 |
+
Figure 1: The image editing tasks that our DragonDiffusion can achieve without training.
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
Despite the ability of text-to-image (T2I) diffusion models to generate highquality images, transferring this ability to accurate image editing remains a challenge. In this paper, we propose a novel image editing method, DragonDiffusion, enabling Drag-style manipulation on Diffusion models. Specifically, we treat image editing as the change of feature correspondence in a pre-trained diffusion model. By leveraging feature correspondence, we develop energy functions that align with the editing target, transforming image editing operations into gradient guidance. Based on this guidance approach, we also construct multi-scale guidance that considers both semantic and geometric alignment. Furthermore, we incorporate a visual cross-attention strategy based on a memory bank design to ensure consistency between the edited result and original image. Benefiting from these efficient designs, all content editing and consistency operations come from the feature correspondence without extra model fine-tuning. Extensive experiments demonstrate that our method has promising performance on various image editing tasks, including within a single image (e.g., object moving, resizing, and content dragging) or across images (e.g., appearance replacing and object pasting).
|
| 13 |
+
|
| 14 |
+
Code is available at https://github.com/MC-E/DragonDiffusion.
|
| 15 |
+
|
| 16 |
+
# 1 INTRODUCTION
|
| 17 |
+
|
| 18 |
+
Thanks to the large-scale training data and huge computing power, generative models have developed rapidly, especially text-to-image (T2I) diffusion models Saharia et al. (2022); Rombach et al. (2022); Nichol et al. (2022); Ramesh et al. (2022), which aims to generate images conditioned on a given text/prompt. However, this generative capability is usually diverse, and it is challenging to design suitable prompts to generate images consistent with what the user has in mind Mou et al. (2023); Zhang et al. (2023), let alone fine-grained image editing based on the text condition.
|
| 19 |
+
|
| 20 |
+
In the community of image editing, previous methods are usually designed based on GANs Abdal et al. (2019; 2020); Alaluf et al. (2022) due to the compact and editable latent space, e.g., the $\mathcal { W }$ space in StyleGAN Karras et al. (2019). Recently, DragGAN Pan et al. (2023) proposes a pointto-point dragging scheme, which can achieve refined content dragging. However, it is limited by the capacity and generalization of GANs. Compared to GANs, diffusion model Ho et al. (2020) has higher stability and superior generation quality. Due to the lack of a concise and editable latent space, numerous diffusion-based image editing methods Hertz et al. (2022); Feng et al. (2022); Balaji et al. (2022) are built based on T2I diffusion models via correspondence between text and image features. Recently, self-guidance Epstein et al. (2024) proposes a differentiable approach that employs crossattention maps between text and image to locate and calculate the size of objects within images. Then, gradient guidance is utilized to edit these properties. However, the correspondence between text and image features is weak, heavily relying on the design of prompts. Moreover, in complex or multi-object scenarios, text struggles to build accurate correspondence with a specific object. In this paper, we aim to investigate whether the diffusion model can achieve drag-style image editing, which is a fine-grained and generalized editing ability not limited to point dragging.
|
| 21 |
+
|
| 22 |
+
In the large-scale T2I diffusion model, besides the correspondence between text features and intermediate image features, there is also a strong correspondence across image features. This characteristic is studied in DIFT Tang et al. (2023), which demonstrates that this correspondence is high-level, enabling point-to-point correspondence of relevant image content. Therefore, we are intrigued by the possibility of utilizing this strong correspondence across image features to achieve image editing. In this paper, we regard image editing as the change of feature correspondence and convert it into gradient guidance via energy functions Dhariwal & Nichol (2021) in score-based diffusion Song et al. (2020b). Additionally, the content consistency between editing results and original images is also ensured by feature correspondence in a visual cross-attention design. Here, we notice that there is a concurrent work, DragDiffusion Shi et al. (2023), studying this issue. It uses LORA Ryu (2023) to maintain consistency with the original image and optimizes the latent in a specific diffusion step to perform point dragging. Unlike DragDiffusion, our image editing is achieved by energy functions and a visual cross-attention design, without extra model fine-tuning or new blocks. In addition, we can complete various drag-style image editing tasks beyond the point dragging, as shown in Fig. 1.
|
| 23 |
+
|
| 24 |
+
In summary, the contributions of this paper are as follows:
|
| 25 |
+
|
| 26 |
+
• We achieve drag-style image editing via image feature correspondence in the pre-trained diffusion model. We also study the roles of the features in different layers and develop multi-scale guidance that considers both semantic and geometric correspondence. • We design a memory bank, further utilizing the image feature correspondence to maintain the consistency between editing results and original images. In conjunction with gradient guidance, our method allows a direct transfer of T2I generation ability in diffusion models to image editing tasks without the need for extra model fine-tuning or new blocks. Extensive experiments demonstrate that our method has promising performance in various image editing tasks, including editing within a single image (e.g., object moving, resizing, and content dragging) or across images (e.g., appearance replacing and object pasting).
|
| 27 |
+
|
| 28 |
+
# 2 RELATED WORK
|
| 29 |
+
|
| 30 |
+
# 2.1 DIFFUSION MODELS
|
| 31 |
+
|
| 32 |
+
Recently, diffusion models Ho et al. (2020) have achieved great success in the community of image synthesis. It is designed based on thermodynamics Sohl-Dickstein et al. (2015); Song & Ermon (2019), including a diffusion process and a reverse process. In the diffusion process, a natural image $\mathbf { x } _ { \mathrm { 0 } }$ is converted to a Gaussian distribution $\mathbf { x } _ { T }$ by adding random Gaussian noise with $T$ iterations. The reverse process is to recover $\mathbf { x } _ { \mathrm { 0 } }$ from $\mathbf { x } _ { T }$ by several denoising steps. Therefore, the diffusion model is to train a denoiser, conditioned on the current noisy image $\mathbf { x } _ { t }$ and time step $t$ :
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
\begin{array} { r } { \mathbb { E } _ { \mathbf { x } _ { 0 } , t , \epsilon _ { t } \sim \mathcal { N } ( 0 , 1 ) } \left[ | | \epsilon _ { t } - \epsilon _ { \pmb { \theta } } ( \mathbf { x } _ { t } , t ) | | _ { 2 } ^ { 2 } \right] , } \end{array}
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
where $\epsilon _ { \pmb { \theta } }$ is the function of the denoiser. Recently, some text-conditioned diffusion models (e.g., GLID Nichol et al. (2022) and StableDiffusion(SD) Rombach et al. (2022)) are proposed. Especially SD, transforming $\mathbf { x } _ { t }$ to the latent space $\mathbf { z } _ { t }$ , significantly improves the generation performance. From
|
| 39 |
+
|
| 40 |
+
the continuous perspective Song et al. (2020b), diffusion models can be viewed as a score function (i.e., $\epsilon _ { \pmb { \theta } } ( \mathbf { x } _ { t } , t ) \approx \nabla _ { \mathbf { x } _ { t } } \log q ( \mathbf { x } _ { t } ) )$ that samples from the corresponding distribution Song & Ermon (2020) according to Langevin dynamics Sohl-Dickstein et al. (2015); Song & Ermon (2019).
|
| 41 |
+
|
| 42 |
+
# 2.2 ENERGY FUNCTION IN DIFFUSION MODEL
|
| 43 |
+
|
| 44 |
+
From the continuous perspective of score-based diffusion, the external condition y can be combined by a conditional score function, i.e., $\nabla _ { \mathbf { x } _ { t } } \log q ( \mathbf { x } _ { t } | \mathbf { y } )$ , to sample from a more enriched distribution. The conditional score function can be further decomposed as:
|
| 45 |
+
|
| 46 |
+
$$
|
| 47 |
+
\nabla _ { \mathbf { x } _ { t } } \log q ( \mathbf { x } _ { t } | \mathbf { y } ) = \nabla _ { \mathbf { x } _ { t } } \log \left( \frac { q ( \mathbf { y } | \mathbf { x } _ { t } ) q ( \mathbf { x } _ { t } ) } { q ( \mathbf { y } ) } \right) \propto \nabla _ { \mathbf { x } _ { t } } \log q ( \mathbf { x } _ { t } ) + \nabla _ { \mathbf { x } _ { t } } \log q ( \mathbf { y } | \mathbf { x } _ { t } ) ,
|
| 48 |
+
$$
|
| 49 |
+
|
| 50 |
+
where the first term is the unconditional denoiser, and the second term refers to the conditional gradient produced by an energy function $\mathcal { E } ( \mathbf { x } _ { t } ; t , \mathbf { y } ) = q ( \mathbf { x } _ { t } | \mathbf { y } )$ . $\mathcal { E }$ can be selected based on the generation target, such as a classifier Dhariwal & Nichol (2021) to specify the category of generation results. Energy function has been used in various controllable generation tasks, e.g., sketch-guided generation Voynov et al. (2023), mask-guided generation Singh et al. (2023), universal guidance Yu et al. (2023); Bansal et al. (2023), and image editing Epstein et al. (2024). These methods, inspire us to transform editing operations into conditional gradients, achieving fine-grained image editing.
|
| 51 |
+
|
| 52 |
+
# 2.3 IMAGE EDITING
|
| 53 |
+
|
| 54 |
+
In image editing, numerous previous methods Abdal et al. (2019; 2020); Alaluf et al. (2022) invert images into the latent space of StyleGAN Karras et al. (2019) and then edit the image by manipulating latent vectors. Motivated by the success of diffusion model Ho et al. (2020), various diffusionbased image editing methods Avrahami et al. (2022); Hertz et al. (2022); Kawar et al. (2023); Meng et al. (2021); Brooks et al. (2023) are proposed. Most of them use text as the editing control. For example, Kawar et al. (2023); Valevski et al. (2023); Kwon & Ye (2022) perform model fine-tuning on a single image and then generate the editing result by target text. Prompt2Prompt Hertz et al. (2022) achieves specific object editing by exchanging text-image attention maps. SDEdit Meng et al. (2021) performs image editing by adding noise to the original image and then denoising under new text conditions. InstructPix2Pix Brooks et al. (2023) finetunes the diffusion model with text as the editing instruction. Recently, Self-guidance Epstein et al. (2024) transforms image editing operations into gradients through the correspondence between text and image features. However, the correspondence between text and image is weak, unable to perform fine-grained editing. Recently, DragGAN Pan et al. (2023) presents a point-to-point dragging scheme. Nevertheless, its editing quality and generalization are limited by GANs. How to utilize the high-quality and diverse generation ability of diffusion models for fine-grained image editing is still an open challenge.
|
| 55 |
+
|
| 56 |
+
# 3 METHOD
|
| 57 |
+
|
| 58 |
+
# 3.1 PRELIMINARY: HOW TO CONSTRUCT ENERGY FUNCTION IN DIFFUSION
|
| 59 |
+
|
| 60 |
+
Modeling an energy function $\mathcal { E } ( \mathbf { x } _ { t } ; t , \mathbf { y } )$ to produce the conditional gradient $\nabla _ { \mathbf { x } _ { t } } \log q ( \mathbf { y } | \mathbf { x } _ { t } )$ in Eq. 2, remains an open question. $\mathcal { E }$ measures the distance between $\mathbf { x } _ { t }$ and the condition y. Some methods Dhariwal & Nichol (2021); Voynov et al. (2023); Zhao et al. (2022) train a time-dependent distance measuring function, e.g., a classifier Dhariwal $\&$ Nichol (2021) to predict the probability that $\mathbf { x } _ { t }$ belongs to category y. However, the training cost and annotation difficulty are intractable in our image editing task. Some tuning-free methods $\mathrm { Y u }$ et al. (2023); Bansal et al. (2023) propose using the clean image $\mathbf { x } _ { 0 \mid t }$ predicted at each time step $t$ to replace $\mathbf { x } _ { t }$ for distance measuring, i.e., $\mathcal { E } ( \mathbf { x } _ { t } ; t , \mathbf { y } ) \approx \mathcal { D } ( \mathbf { x } _ { 0 \mid t } ; t , \mathbf { y } )$ . Nevertheless, there is a bias between $\mathbf { x } _ { 0 \mid t }$ and $\mathbf { x } _ { \mathrm { 0 } }$ , and there is hardly a suitable $\mathcal { D }$ for distance measuring in image editing tasks. Hence, the primary issue is whether we can circumvent the training requirement and construct an energy function to measure the distance between $\mathbf { x } _ { t }$ and the editing target. Recent work Tang et al. (2023) has shown that the feature correspondence in the diffusion UNet-denoiser $\epsilon _ { \theta }$ is high-level, enabling point-to-point correspondence measuring. Inspired by this characteristic, we propose reusing $\epsilon _ { \theta }$ as a tuning-free energy function to transform image editing operations into the change of feature correspondence.
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
Figure 2: Overview of our DragonDiffusion, containing a memory bank and score-based gradient guidance on the pre-trained SD Rombach et al. (2022) without extra training or modules.
|
| 64 |
+
|
| 65 |
+
# 3.2 OVERVIEW
|
| 66 |
+
|
| 67 |
+
The editing objective of our DragonDiffusion involves two issues: changing the content to be edited and preserving unedited content. For example, if a user wants to move the cup in an image, the generated result only needs to change the position of the cup, while the appearance of the cup and other unedited content should not change. An overview of our method is presented in Fig. 2, which is built on the pre-trained SD Rombach et al. (2022) to support image editing with and without reference images. Since SD is a latent diffusion model (LDM), we first encode the original image $\mathbf { x } _ { \mathrm { 0 } }$ into the latent space $\mathbf { z } _ { 0 }$ , which is then reversed to $\mathbf { z } _ { T }$ by DDIM inversion Song et al. (2020a). If the reference image $\mathbf { x } _ { 0 } ^ { r e f }$ exists, it will also be involved in the inversion to produce ${ \bf z } _ { T } ^ { r e f }$ In this process, we store some intermediate features and latent at each time step to build a memory bank, which is used to provide guidance for subsequent image editing. In generation, we transform the information stored in the memory bank into content editing and consistency guidance through two paths, i.e., visual cross-attention and gradient guidance. Both of these paths are built based on feature correspondence in the pre-trained SD, without extra model fine-tuning or new blocks.
|
| 68 |
+
|
| 69 |
+
# 3.3 DDIM INVERSION WITH MEMORY BANK
|
| 70 |
+
|
| 71 |
+
In our image editing process, the starting point $\mathbf { z } _ { T }$ , produced by DDIM inversion Song et al. (2020a), can provide a good generation prior to maintain consistency with the original image. However, relying solely on the final step of this approximate inversion can hardly provide accurate generation guidance. Therefore, we fully utilize the information in DDIM inversion by building a memory bank to store the latent $\mathbf { z } _ { t } ^ { g u d }$ at each inversion step $t$ , as well as corresponding keys ${ \bf K } _ { t } ^ { g u d }$ and values $\mathbf { V } _ { t } ^ { g u d }$ in the self-attention module of the decoder within the UNet denoiser. Note that in some cross-image editing tasks (e.g., appearance replacing, object pasting), reference images are required. In these tasks, the memory bank needs to be doubled to store the information of the reference images. Here, we utilize zreft , Kreft , and $\mathbf { V } _ { t } ^ { r e f }$ to represent them. The information stored in the memory bank will provide more accurate guidance for the subsequent image editing process.
|
| 72 |
+
|
| 73 |
+
# 3.4 GRADIENT-GUIDANCE-BASED EDITING DESIGN
|
| 74 |
+
|
| 75 |
+
Inspired by classifier guidance Dhariwal & Nichol (2021), we build energy functions to transform image editing operations into gradient guidance in diffusion sampling. An intuitive illustration is presented in Fig. 3, showing a continuous sampling space of the score-based diffusion Song et al. (2020b). The sampling starting point $\mathbf { z } _ { T }$ , obtained from DDIM inversion, will approximately return to the original point only according to the gradient/score predicted by the denoiser. After incorporating the gradient guidance generated by the energy function that matches the editing target, the additional guidance gradient will change the path to reach a sampling result that meets the editing target.
|
| 76 |
+
|
| 77 |
+

|
| 78 |
+
: Original Gradient : Corrected Gradient Figure 3: Illustration of continuous sampling space in score-based diffusion. Bright colors indicate areas where target data is densely distributed. The orange and green paths respectively refer to the diffusion paths without and with external gradient guidance.
|
| 79 |
+
|
| 80 |
+
# 3.4.1 ENERGY FUNCTION VIA FEATURE CORRESPONDENCE
|
| 81 |
+
|
| 82 |
+
In our DragonDiffusion, energy functions are designed to provide gradient guidance for image editing, mainly including content editing and consistency terms. Specifically, at the $t$ -th time step, we reuse the UNet denoiser $\epsilon _ { \pmb { \theta } }$ to extract intermediate features $\mathbf { F } _ { t } ^ { g e \hat { n } }$ from the latent ${ \bf z } _ { t } ^ { g e n }$ at the current time step. The same operation is used to extract guided features $\mathbf { F } _ { t } ^ { g u d }$ from $\mathbf { z } _ { t } ^ { g u d }$ in memory bank. Following DIFT Tang et al. (2023), decoder. The image editing operatio $\mathbf { F } _ { t } ^ { g e n }$ and Fgud pres come from intermediate by two binary masks (i.e., $\mathbf { m } ^ { g u d }$ s inand $\mathbf { m } ^ { g e n }$ Net) to locate the original content position and target dragging position, respectively. Therefore, the energy function is built by constraining the correspondence between these two regions in $\mathbf { F } _ { t } ^ { g u d }$ and $\mathbf { F } _ { t } ^ { g e n }$ . Here, we utilize cosine distance $\cos ( \cdot ) \in [ - 1 , 1 ]$ to measure the similarity and normalize it to $[ 0 , 1 ]$ :
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\begin{array} { r } { \mathcal { S } _ { l o c a l } ( \mathbf { F } _ { t } ^ { g e n } , \mathbf { m } ^ { g e n } , \mathbf { F } _ { t } ^ { g u d } , \mathbf { m } ^ { g u d } ) = 0 . 5 \cdot \cos \Big ( \mathbf { F } _ { t } ^ { g e n } [ \mathbf { m } ^ { g e n } ] , ~ \mathrm { s g } ( \mathbf { F } _ { t } ^ { g u d } [ \mathbf { m } ^ { g u d } ] ) \Big ) + 0 . 5 , } \end{array}
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
where $\operatorname { s g } ( \cdot )$ is the gradient clipping operation. Eq. 3 is mainly used for dense constraints on the spatial location of content. In addition, a global appearance similarity is defined as:
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
S _ { g l o b a l } ( { \bf F } _ { t } ^ { g e n } , { \bf m } ^ { g e n } , { \bf F } _ { t } ^ { g u d } , { \bf m } ^ { g u d } ) = 0 . 5 \cdot \cos \left( \frac { \sum { \bf F } _ { t } ^ { g e n } [ { \bf m } ^ { g e n } ] } { \sum { \bf m } ^ { g e n } } , ~ \mathrm { s g } ( \frac { \sum { \bf F } _ { t } ^ { g u d } [ { \bf m } ^ { g u d } ] } { \sum { \bf m } ^ { g u d } } ) \right) + 0 . 5 ,
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
which utilizes the mean of the features in a region as a global appearance representation. When we want to have fine control over the spatial position of an object or a rough global control over its appearance, we only need to constrain the similarity in Eq. 3 and Eq. 4 to be as large as possible. Therefore, the energy function to produce editing guidance is defined as:
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\mathcal { E } _ { e d i t } = \frac { 1 } { \alpha + \beta \cdot \mathscr { S } ( \mathbf { F } _ { t } ^ { g e n } , \mathbf { m } ^ { g e n } , \mathbf { F } _ { t } ^ { g u d } , \mathbf { m } ^ { g u d } ) } , \quad \mathscr { S } \in \{ S _ { l o c a l } , \mathscr { S } _ { g l o b a l } \} ,
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
where $\alpha$ and $\beta$ are two hyper-parameters, which are set as 1 and 4, respectively. In addition to editing, we hope the unedited content remains consistent with the original image. We use a mask $\mathbf { m } ^ { s h a r e }$ to locate areas without editing. The similarity between the editing result and the original image in $\mathbf { m } ^ { s h a r e }$ can also be calculated by the cosine similarity as $\{ { S _ { l o c a l } } ( { { \bf { F } } _ { t } ^ { g e n } } , { { \bf { m } } ^ { s h a r e } } , { { \bf { F } } _ { t } ^ { g u d } } , { { \bf { m } } ^ { s h a r e } } )$ . Therefore, the energy function to produce content consistency guidance is defined as:
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\mathcal { E } _ { c o n t e n t } = \frac { 1 } { \alpha + \beta \cdot S _ { l o c a l } ( \mathbf { F } _ { t } ^ { g e n } , \mathbf { m } ^ { s h a r e } , \mathbf { F } _ { t } ^ { g u d } , \mathbf { m } ^ { s h a r e } ) } .
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
In addition to $\mathcal { E } _ { e d i t }$ and $\mathcal { E } _ { c o n t e n t }$ , an optional guidance term $\mathcal { E } _ { o p t }$ may need to be added in some tasks to achieve the editing goal. Finally, the base energy function is defined as:
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
\mathcal { E } = w _ { e } \cdot \mathcal { E } _ { e d i t } + w _ { c } \cdot \mathcal { E } _ { c o n t e n t } + w _ { o } \cdot \mathcal { E } _ { o p t } ,
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
where $w _ { e } , w _ { c }$ , and $w _ { o }$ are hyper-parameters to balance these guidance terms. They vary slightly in different editing tasks but are fixed within the same task. Finally, regarding $[ \mathbf { m } ^ { g e n } , \mathbf { \bar { m } } ^ { s h a \bar { r e } } ]$ as condition, the conditional score function in Eq. 2 can be written as:
|
| 113 |
+
|
| 114 |
+
$$
|
| 115 |
+
\nabla _ { \mathbf z _ { t } ^ { g e n } } \log q ( \mathbf z _ { t } ^ { g e n } | \mathbf y ) \propto \nabla _ { \mathbf z _ { t } ^ { g e n } } \log q ( \mathbf z _ { t } ^ { g e n } ) + \nabla _ { \mathbf z _ { t } ^ { g e n } } \log q ( \mathbf y | \mathbf z _ { t } ^ { g e n } ) , ~ \mathbf y = [ \mathbf m ^ { g e n } , \mathbf m ^ { s h a r e } ] .
|
| 116 |
+
$$
|
| 117 |
+
|
| 118 |
+
The conditional gradient $\nabla _ { \mathbf { z } _ { t } ^ { g e n } } \log q ( \mathbf { y } | \mathbf { z } _ { t } ^ { g e n } )$ can be computed by $\nabla _ { \mathbf { z } _ { t } ^ { g e n } } \mathcal { E }$ , which will also multiplies by a learning rate $\eta$ . In experiments, we find that the gradient guidance in later diffusion generation steps hinders the generation of textures. Therefore, we only add gradient guidance in the first $n$ steps of diffusion generation. Experientially, we set $n = 3 0$ in 50 sampling steps.
|
| 119 |
+
|
| 120 |
+
# 3.4.2 MULTI-SCALE FEATURE CORRESPONDANCE
|
| 121 |
+
|
| 122 |
+
The decoder of the UNet denoiser contains four blocks of different scales. DIFT Tang et al. (2023) finds that the second layer contains more semantic information, while the third layer contains more geometric information. We also studied the role of features from different layers in image editing tasks, as shown in Fig. 4. In the experiment, we set $\mathbf { z } _ { T }$ as random Gaussian noise and set $\mathbf { m } ^ { g e n }$ , $\mathbf { m } ^ { g u d }$ as zeros matrixes. $\mathbf { m } ^ { s h a r e }$ is set as a ones matrix. In this way, generation relies solely on content consistency guidance (i.e., Eq. 6) to restore image content. We can find that the guidance from the first layer is too high-level to reconstruct the original image accurately. The guidance from the fourth layer has weak feature correspondence, resulting in significant differences between the reconstructed and original images. The features from the second and third layers are more suitable to produce guidance signals, and each has its own specialty. Concretely, the features in the second layer contain more semantic information and can reconstruct images that are semantically similar to the original image but with some differences in content details. The features in the third layer tend to express low-level characteristics, but they cannot provide effective supervision for high-level texture, resulting in blurry results. In our design, we combine these two levels (i.e., high and low) of guidance by proposing a multi-scale supervision approach. Specifically, we compute gradient guidance on the second and third layers. The reconstructed results in Fig. 4 also demonstrate that this combination can balance the generation of low-level and high-level visual characteristics.
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 4: Illustration of using features from different layers as guidance to restore the original image. $\mathbf { z } _ { T }$ is randomly initialized. The generation is solely guided by content consistency guidance in Eq. 6.
|
| 126 |
+
|
| 127 |
+
# 3.4.3 IMPLEMENTATION DETAILS FOR EACH APPLICATION
|
| 128 |
+
|
| 129 |
+
Object moving. In the task of object moving, $\mathbf { m } ^ { g e n }$ and $\mathbf { m } ^ { g u d }$ locate the same object in different spatial positions. $\mathbf { m } ^ { s h a r e }$ is the complement $\left( \mathbf { C } _ { \mathbf { u } } \right)$ of the union (∪) of $\mathbf { m } ^ { g e n }$ and $\mathbf { \hat { m } } ^ { g u d }$ , i.e., $\mathbf { m } ^ { s h a r e } = \mathbf { C } _ { \mathbf { u } } ( \mathbf { m } ^ { g e n } \cup \mathbf { m } ^ { g u d } )$ . However, solely using the content editing and consistency guidance in Eq. 5 and Eq. 6 can lead to some issues, as shown in the second image of Fig. 5. Concretely, although the bread is moved according to the editing signal, some of the bread content is still preserved in its original position in the generated
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
Figure 5: Visualization of the effectiveness of inpainting guidance $( \mathcal { E } _ { o p t } )$ in the object moving task, presenting that $\mathcal { E } _ { o p t }$ can guide the inpainting of the area where the object is initially located.
|
| 133 |
+
|
| 134 |
+
result. This is because the energy function does not constrain the area where the moved object was initially located, causing inpainting to easily restore the original object. To rectify this issue, we use the optional energy term (i.e., $\mathcal { E } _ { o p t }$ in Eq. 7) to constrain the inpainting content to be dissimilar to the moved object and similar to a predefined reference region. Here, we use $\mathbf { m } ^ { r e f }$ to locate the reference region and define $\mathbf { m } ^ { i p t } = \hat { \{ p | p \in \mathbf { m } ^ { g u d } } $ and $p \not \in \mathbf { m } ^ { g e n } \}$ to locate the inpainting region. Finally, $\mathcal { E } _ { o p t }$ in this task is defined as:
|
| 135 |
+
|
| 136 |
+
$$
|
| 137 |
+
\mathcal { E } _ { o p t } = \frac { w _ { i } } { \alpha + \beta \cdot S _ { g l o b a l } ( { \bf F } _ { t } ^ { g e n } , { \bf m } ^ { i p t } , { \bf F } _ { t } ^ { g u d } , { \bf m } ^ { r e f } ) } + S _ { l o c a l } ( { \bf F } _ { t } ^ { g e n } , { \bf m } ^ { i p t } , { \bf F } _ { t } ^ { g u d } , { \bf m } ^ { i p t } ) ,
|
| 138 |
+
$$
|
| 139 |
+
|
| 140 |
+
where $w _ { i }$ is a weight parameter, set as 2.5 in our implementation. The third image in Fig. 5 shows that this design can effectively achieve the editing goal without impeachable artifact.
|
| 141 |
+
|
| 142 |
+
Object resizing. The score function in this task is the same as the object moving, except that a scale factor $\gamma > 0$ is added during feature extraction. Specifically, we use interpolation to transform $\mathbf { m } ^ { g u d }$ and $\mathbf { F } _ { t } ^ { g u d }$ to the target size, and then extract $\mathbf { F } _ { t } ^ { g u d } [ \mathbf { m } ^ { g u d } ]$ as the feature of the resized object. To locate the target object with the same size in $\mathbf { F } _ { t } ^ { g e n }$ , we resize $\mathbf { m } ^ { g e n }$ with the same scale factor $\gamma$ Then we extract a new of the original size from the center of the resized . Note that if $\gamma < 1$ , we use 0 to pad the vacant area.
|
| 143 |
+
|
| 144 |
+
Appearance replacing. This task aims to replace the appearance between objects of the same category across images. Therefore, the capacity of the memory bank needs to be doubled to store extra information from the image containing the reference appearance, i.e., ${ \bf z } _ { t } ^ { r e f } , { \bf K } _ { t } ^ { r e f }$ , and $\mathbf { V } _ { t } ^ { r e f }$ . $\mathbf { m } ^ { g e n }$ and $\mathbf { m } ^ { g u d }$ respectively locate the editing object in the original image and the reference object in the reference image. $\mathbf { m } ^ { s h a r e }$ is set as the complement of $\mathbf { m } ^ { g e n }$ , i.e., ${ \mathbf { C } } _ { \mathbf { u } } ( \mathbf { m } ^ { g e n } )$ . To constrain appearance, we choose $\mathscr { S } _ { g l o b a l } ( \mathbf { F } _ { t } ^ { g e n } , \mathbf { m } ^ { g e n } , \mathbf { F } _ { t } ^ { r e f } , \mathbf { m } ^ { g u d } )$ in Eq. 5. This task has no need for $\mathcal { E } _ { o p t }$ .
|
| 145 |
+
|
| 146 |
+
Object pasting. Object pasting aims to paste an object from an image onto any position in another image. Although it can be completed by simple copy-paste, it often results in inconsistencies between the paste area and other areas due to differences in light and perspective, as shown in Fig. 6. As can be seen, the result obtained by copy-paste exists discontinuities, while the result generated by our DragonDiffusion can achieve a more harmonized integration of the scene and the pasted object. In implementation, similar to the appearance replacing, the memory bank needs to store information of the reference image, which contains the target object. $\mathbf { m } ^ { g e n }$ and $\mathbf { m } ^ { g u d }$ respectively mark the position of the object in the edited image and reference image. $\mathbf { m } ^ { s h a r e }$ is set as ${ \mathbf { C } } _ { \mathbf { u } } ( \mathbf { m } ^ { g e n } )$ .
|
| 147 |
+
|
| 148 |
+
Point dragging. In this task, we want to drag image content via several points, as DragGAN Pan et al. (2023). In this case, $\mathbf { m } ^ { g e n }$ and $\mathbf { m } ^ { g u d }$ locate neighboring areas centered around the destination and starting points. Here, we extract a $3 \times 3$ previous tasks, mshare is manually defined.
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
Figure 6: Visual comparison between our DragonDiffusion and direct copypaste in cross-image object pasting.
|
| 152 |
+
|
| 153 |
+
rectangular patch centered around each point as the neighboring area. Unlike the
|
| 154 |
+
|
| 155 |
+
# 3.5 VISUAL CROSS-ATTENTION
|
| 156 |
+
|
| 157 |
+
As mentioned previously, two strategies are used to ensure the consistency between the editing result and the original image: (1) DDIM inversion to initialize $\mathbf { z } _ { T }$ ; (2) content consistency guidance in Eq. 6. However, it is still challenging to maintain high consistency. Inspired by the consistency preserving in some video and image editing works Wu et al. (2022); Cao et al. (2023); Wang et al. (2023), we design a visual cross-attention guidance. Instead of generating guidance information through an independent inference branch, we reuse the intermediate features of the inversion process stored in the memory bank. Specifically, similar to the injection of text conditions in SD Rombach et al. (2022), we replace the key and value in the self-attention module of the UNet decoder with the corresponding key and value collected by the memory bank in DDIM inversion. Note that in the appearance replacing and object pasting tasks, the memory bank stores two sets of keys and values from the original image $( \dot { \mathbf { K } } _ { t } ^ { g u \bar { d } } , \mathbf { V } _ { t } ^ { g u \bar { d } } )$ and the reference image $( \mathbf { K } _ { t } ^ { r e f } , \mathbf { V } _ { t } ^ { r e f } )$ . In this case, we concatenate the two sets of keys and values in the length dimension. The visual cross-attention at each time step is defined as follows. $\textcircled{4}$ refers to the concatenation operation.
|
| 158 |
+
|
| 159 |
+
$$
|
| 160 |
+
\left\{ \begin{array} { l l } { \mathbf { Q } _ { t } = \mathbf { Q } _ { t } ^ { g e n } ; \mathbf { K } _ { t } = \mathbf { K } _ { t } ^ { g u d } \operatorname { o r } \big ( \mathbf { K } _ { t } ^ { g u d } ( \widehat { \mathbf { c } } ) \mathbf { K } _ { t } ^ { r e f } \big ) ; \mathbf { V } _ { t } = \mathbf { V } _ { t } ^ { g u d } \operatorname { o r } \big ( \mathbf { V } _ { t } ^ { g u d } ( \widehat { \mathbf { c } } ) \mathbf { V } _ { t } ^ { r e f } \big ) } \\ { \operatorname { A t t } ( \mathbf { Q } _ { t } , \mathbf { K } _ { t } , \mathbf { V } _ { t } ) = \operatorname { s o f t m a x } \big ( \frac { \mathbf { Q } _ { t } \mathbf { K } _ { t } ^ { T } } { \sqrt { d } } \big ) \mathbf { V } _ { t } . } \end{array} \right.
|
| 161 |
+
$$
|
| 162 |
+
|
| 163 |
+
# 4 EXPERIMENTS
|
| 164 |
+
|
| 165 |
+
In experiments, we use StableDiffusion-V1.5 Rombach et al. (2022) as the base model. The inference adopts DDIM sampling with 50 steps, and we set the classifier-free guidance scale as 5.
|
| 166 |
+
|
| 167 |
+
# 4.1 COMPARISONS
|
| 168 |
+
|
| 169 |
+
In this part, we compare our DragonDiffusion with other methods on various image editing tasks.
|
| 170 |
+
|
| 171 |
+
Content dragging. In this task, we compare our method with the recent UserControllableLT Endo (2022), DragGAN Pan et al. (2023), and DragDiffusion Shi et al. (2023). We first present the time complexity of different methods in Tab. 1. Specifically, We divide the time complexity of different methods into two parts, i.e., the preparing and inference stages. The preparing stage involves Diffusion/GAN inversion and model fine-tuning. The inference stage generates the editing result. The time complexity is tested on one point dragging, with the image resolution being $5 1 2 \times 5 1 2$ .
|
| 172 |
+
|
| 173 |
+
Table 1: Quantitative evaluation on face manipulation with 68 and 17 points. The accuracy is calculated by Euclidean distance between edited points and target points. The initial distance (i.e., $5 7 . 1 9$ and $3 6 . 3 6 )$ is the upper bound, without editing. FID Seitzer (2020) is utilized to quantize the editing quality of different methods. The time complexity is computed on the ‘1 point’ dragging.
|
| 174 |
+
|
| 175 |
+
<table><tr><td></td><td>Preparing complexity↓</td><td>Inference complexity↓</td><td>Unaligned face</td><td>17 Points↓ From 57.19</td><td>68 Points↓ From 36.36</td><td>FID↓ 17/68 points</td></tr><tr><td rowspan="2">UserControllableLT DragGAN</td><td>1.2s</td><td>0.05s</td><td>X</td><td>32.32</td><td>24.15</td><td>51.20/50.32</td></tr><tr><td>52.40s</td><td>6.71s</td><td>X</td><td>15.96</td><td>10.60</td><td>39.27/39.50</td></tr><tr><td>DragDiffusion</td><td>48.25s</td><td>19.71s</td><td>√</td><td>22.95</td><td>17.32</td><td>38.06/36.55</td></tr><tr><td>DragonDiffusion(ours)</td><td>3.62s</td><td>15.93s</td><td>√</td><td>18.51</td><td>13.94</td><td>35.75/34.58</td></tr></table>
|
| 176 |
+
|
| 177 |
+

|
| 178 |
+
Figure 7: Qualitative comparison between our DragonDiffusion and other methods in face manipulation (target points are blue), object pasting, appearance replacing, and object moving.
|
| 179 |
+
|
| 180 |
+
The experiment is conducted on an NVIDIA A100 GPU with Float32 precision. The results present that our method is relatively efficient in the preparing stage, requiring only 3.62s to prepare $\mathbf { z } _ { T }$ and memory bank. The inference complexity is also acceptable for diffusion generation.
|
| 181 |
+
|
| 182 |
+
Following DragGAN Pan et al. (2023), the performance evaluation is conducted on the face keypoint manipulation with 17 and 68 points. The test set is randomly formed by 800 aligned faces from CelebA-HQ Karras et al. (2018) training set. Note that we do not set fixed regions for all methods, due to the difficulty in manually providing a mask for each face. In addition to accuracy, we also compute the FID Seitzer (2020) between face editing results and CelebA-HQ training set to represent the editing quality. The quantitative and qualitative comparison is presented in Tab. 1 and Fig. 7, respectively. One can see that our DragonDiffusion achieves promising results in editing accuracy and content consistency. Although DragGAN achieves better editing accuracy, it has limitations in content consistency and robustness in areas outside faces (e.g., the headwear is distorted). The limitations of GAN-based DragGAN and UserControllableLT also exist in requiring alignment before editing, as shown in Fig. 8. It can be seen that if editing without alignment, the results of DragGAN will suffer from severe degradation. The alignment operation is not friendly to our editing goal, as it will change the original image content, e.g., filtering out the background. In comparison, our method has promising editing accuracy, and the generation prior from SD enables better robustness and generalization for different content. In this task, our method also has better performance than DragDiffusion. More results are shown in the appendix.
|
| 183 |
+
|
| 184 |
+

|
| 185 |
+
Figure 9: Effectiveness of different components in our DragonDiffusion in the object moving task.
|
| 186 |
+
|
| 187 |
+
Other applications. For object pasting, we compare our method with Paint-by-example Yang et al. (2023). For appearance replacing and object moving, we compare our method with SelfGuidance Epstein et al. (2024). The visual comparison in Fig. 7 shows that our method can achieve comparable performance to the training method (i.e., Paint-by-example) in object pasting.
|
| 188 |
+
|
| 189 |
+
Compared to self-guidance, our method has better editing accuracy and content consistency. Due to the lack of consistency constraints, Self-Guidance produces some unexpected artifacts. Moreover, Self-Guidance has obvious deviation in complex scenes, due to the coarse correspondence between text and image features. More results are presented in Appendix.
|
| 190 |
+
|
| 191 |
+
# 4.2 ABLATION STUDY
|
| 192 |
+
|
| 193 |
+

|
| 194 |
+
Figure 8: Editing comparison between our DragonDiffusion and DragGAN Pan et al. (2023) on the unaligned body and face.
|
| 195 |
+
|
| 196 |
+
In this part, we demonstrate the effectiveness of some components in our DragonDiffusion, as shown in Fig. 9. We conduct the experiment on the object moving task. Specifically, (1) we verify the importance of the inversion prior by randomly initializing $\mathbf { z } _ { T }$ instead of obtaining from DDIM inversion. As can be seen, the random $\mathbf { z } _ { T }$ leads to a significant difference between the editing result and the original image. (2) We remove the content consistency guidance (i.e., $\mathcal { E } _ { { c o n t e n t } } )$ in Eq. 7, which causes local distortion in the editing result, e.g., the finger is twisted. (3) We remove the visual cross-attention. It can be seen that visual cross-attention plays an important role in maintaining the consistency between the edited object and the original object. Using a memory bank to provide $\mathbf { K } _ { t }$ and $\mathbf { V } _ { t }$ can greatly reduce the additional cost. In Appendix, we show an ablation study for memory bank. Therefore, these components work together on both edited and unedited content, forming the fine-grained image editing model DragonDiffusion, which does not require extra training or modules.
|
| 197 |
+
|
| 198 |
+
# 5 CONCLUSION
|
| 199 |
+
|
| 200 |
+
Despite the ability of existing large-scale text-to-image (T2I) diffusion models to generate highquality images from detailed textual descriptions, they often lack the ability to precisely edit the generated or real images. In this paper, we aim to develop a drag-style and general image editing scheme based on the strong correspondence of intermediate image features in the pre-trained diffusion model. To this end, we model image editing as the change of feature correspondence and design energy functions to transform the editing operations into gradient guidance. Based on the gradient guidance strategy, we also propose multi-scale guidance to consider both semantic and geometric alignment. Moreover, a visual cross-attention is added based on a memory bank design, which can enhance the consistency between the original image and the editing result. Due to the reuse of intermediate information from the inversion process, this content consistency strategy almost has no additional cost. Extensive experiments demonstrate that our proposed DragonDiffusion can perform various image editing tasks, including object moving, resizing, appearance replacing, object pasting, and content dragging. At the same time, the complexity of our DragonDiffusion is acceptable, and it does not require extra model fine-tuning or additional modules.
|
| 201 |
+
|
| 202 |
+
REFERENCES
|
| 203 |
+
Rameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan: How to embed images into the stylegan latent space? In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4432–4441, 2019.
|
| 204 |
+
Rameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan $^ { + + }$ : How to edit the embedded images? In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 8296–8305, 2020.
|
| 205 |
+
Yuval Alaluf, Omer Tov, Ron Mokady, Rinon Gal, and Amit Bermano. Hyperstyle: Stylegan inversion with hypernetworks for real image editing. In Proceedings of the IEEE/CVF conference on computer Vision and pattern recognition, pp. 18511–18521, 2022.
|
| 206 |
+
Omri Avrahami, Dani Lischinski, and Ohad Fried. Blended diffusion for text-driven editing of natural images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18208–18218, 2022.
|
| 207 |
+
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.
|
| 208 |
+
Arpit Bansal, Hong-Min Chu, Avi Schwarzschild, Soumyadip Sengupta, Micah Goldblum, Jonas Geiping, and Tom Goldstein. Universal guidance for diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 843–852, 2023.
|
| 209 |
+
Tim Brooks, Aleksander Holynski, and Alexei A Efros. Instructpix2pix: Learning to follow image editing instructions. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18392–18402, 2023.
|
| 210 |
+
Mingdeng Cao, Xintao Wang, Zhongang Qi, Ying Shan, Xiaohu Qie, and Yinqiang Zheng. Masactrl: Tuning-free mutual self-attention control for consistent image synthesis and editing. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 22560–22570, 2023.
|
| 211 |
+
Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in neural information processing systems, 34:8780–8794, 2021.
|
| 212 |
+
Yuki Endo. User-controllable latent transformer for stylegan image layout editing. In Computer Graphics Forum, volume 41, pp. 395–406. Wiley Online Library, 2022.
|
| 213 |
+
Dave Epstein, Allan Jabri, Ben Poole, Alexei Efros, and Aleksander Holynski. Diffusion selfguidance for controllable image generation. Advances in Neural Information Processing Systems, 36, 2024.
|
| 214 |
+
Weixi Feng, Xuehai He, Tsu-Jui Fu, Varun Jampani, Arjun Reddy Akula, Pradyumna Narayana, Sugato Basu, Xin Eric Wang, and William Yang Wang. Training-free structured diffusion guidance for compositional text-to-image synthesis. In Proceedings of the International Conference on Learning Representations, 2022.
|
| 215 |
+
Amir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman, Yael Pritch, and Daniel Cohen-or. Prompt-to-prompt image editing with cross-attention control. In Proceedings of the International Conference on Learning Representations, 2022.
|
| 216 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020.
|
| 217 |
+
Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. In Proceedings of the International Conference on Learning Representations, 2018.
|
| 218 |
+
Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 4401–4410, 2019.
|
| 219 |
+
|
| 220 |
+
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. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6007–6017, 2023.
|
| 221 |
+
|
| 222 |
+
Gihyun Kwon and Jong Chul Ye. Diffusion-based image translation using disentangled style and content representation. In Proceedings of the International Conference on Learning Representations, 2022.
|
| 223 |
+
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 Proceedings of the International Conference on Learning Representations, 2021.
|
| 224 |
+
Chong Mou, Xintao Wang, Liangbin Xie, 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. arXiv preprint arXiv:2302.08453, 2023.
|
| 225 |
+
Alexander Quinn 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. In International Conference on Machine Learning, pp. 16784–16804, 2022.
|
| 226 |
+
Xingang Pan, Ayush Tewari, Thomas Leimkuhler, Lingjie Liu, Abhimitra Meka, and Christian ¨ Theobalt. Drag your gan: Interactive point-based manipulation on the generative image manifold. In ACM SIGGRAPH 2023 Conference Proceedings, pp. 1–11, 2023.
|
| 227 |
+
Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
|
| 228 |
+
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.
|
| 229 |
+
Simo Ryu. Low-rank adaptation for fast text-to-image diffusion fine-tuning, 2023.
|
| 230 |
+
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. Advances in neural information processing systems, 35:36479–36494, 2022.
|
| 231 |
+
Maximilian Seitzer. pytorch-fid: FID Score for PyTorch. https://github.com/mseitzer/ pytorch-fid, August 2020. Version 0.3.0.
|
| 232 |
+
Yujun Shi, Chuhui Xue, Jiachun Pan, Wenqing Zhang, Vincent YF Tan, and Song Bai. Dragdiffusion: Harnessing diffusion models for interactive point-based image editing. arXiv preprint arXiv:2306.14435, 2023.
|
| 233 |
+
Jaskirat Singh, Stephen Gould, and Liang Zheng. High-fidelity guided image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5997–6006, 2023.
|
| 234 |
+
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.
|
| 235 |
+
Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In Proceedings of the International Conference on Learning Representations, 2020a.
|
| 236 |
+
Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in neural information processing systems, 32, 2019.
|
| 237 |
+
Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. Advances in neural information processing systems, 33:12438–12448, 2020.
|
| 238 |
+
Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In Proceedings of the International Conference on Learning Representations, 2020b.
|
| 239 |
+
Luming Tang, Menglin Jia, Qianqian Wang, Cheng Perng Phoo, and Bharath Hariharan. Emergent correspondence from image diffusion. Advances in Neural Information Processing Systems, 36: 1363–1389, 2023.
|
| 240 |
+
Dani Valevski, Matan Kalman, Eyal Molad, Eyal Segalis, Yossi Matias, and Yaniv Leviathan. Unitune: Text-driven image editing by fine tuning a diffusion model on a single image. ACM Transactions on Graphics (TOG), 42(4):1–10, 2023.
|
| 241 |
+
Andrey Voynov, Kfir Aberman, and Daniel Cohen-Or. Sketch-guided text-to-image diffusion models. In ACM SIGGRAPH 2023 Conference Proceedings, pp. 1–11, 2023.
|
| 242 |
+
Wen Wang, Kangyang Xie, Zide Liu, Hao Chen, Yue Cao, Xinlong Wang, and Chunhua Shen. Zeroshot video editing using off-the-shelf image diffusion models. arXiv preprint arXiv:2303.17599, 2023.
|
| 243 |
+
Jay Zhangjie Wu, Yixiao Ge, Xintao Wang, 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.
|
| 244 |
+
Binxin Yang, Shuyang Gu, Bo Zhang, Ting Zhang, Xuejin Chen, Xiaoyan Sun, Dong Chen, and Fang Wen. Paint by example: Exemplar-based image editing with diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18381– 18391, 2023.
|
| 245 |
+
Jiwen Yu, Yinhuai Wang, Chen Zhao, Bernard Ghanem, and Jian Zhang. Freedom: Training-free energy-guided conditional diffusion model. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 23174–23184, 2023.
|
| 246 |
+
Lvmin Zhang, Anyi Rao, and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 3836–3847, 2023.
|
| 247 |
+
Min Zhao, Fan Bao, Chongxuan Li, and Jun Zhu. Egsde: Unpaired image-to-image translation via energy-guided stochastic differential equations. Advances in Neural Information Processing Systems, 35:3609–3623, 2022.
|
md/test/SXMTK2eltf/SXMTK2eltf.md
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GPT-DRIVER: LEARNING TO DRIVE WITH GPT
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We present a simple yet effective approach that can transform the OpenAI GPT-3.5 model into a reliable motion planner for autonomous vehicles. Motion planning is a core challenge in autonomous driving, aiming to plan a driving trajectory that is safe and comfortable. Existing motion planners predominantly leverage heuristic methods to forecast driving trajectories, yet these approaches demonstrate insufficient generalization capabilities in the face of novel and unseen driving scenarios. In this paper, we propose a novel approach to motion planning that capitalizes on the strong reasoning capabilities and generalization potential inherent to Large Language Models (LLMs). The fundamental insight of our approach is the reformulation of motion planning as a language modeling problem, a perspective not previously explored. Specifically, we represent the planner inputs and outputs as language tokens, and leverage the LLM to generate driving trajectories through a language description of coordinate positions. Furthermore, we propose a novel prompting-reasoning-finetuning strategy to stimulate the numerical reasoning potential of the LLM. With this strategy, the LLM can describe highly precise trajectory coordinates and also its internal decision-making process in natural language. We evaluate our approach on the large-scale nuScenes dataset, and extensive experiments substantiate the effectiveness, generalization ability, and interpretability of our GPT-based motion planner. Code will be released.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Autonomous driving stands as one of the most ambitious and challenging frontiers in modern technology, aiming to revolutionize transportation systems globally. Central to this endeavor is the concept of motion planning, a cornerstone in autonomous driving technology that seeks to devise safe and comfortable driving trajectories for autonomous vehicles. The intricacies of motion planning arise from its need to accommodate diverse driving scenarios and make reasonable driving decisions. As autonomous vehicles interact with various environments and unpredictable human drivers, the robustness and explainability of motion planners become essential for driving safety and reliability.
|
| 12 |
+
|
| 13 |
+
Existing motion planning approaches generally fall into two categories. The rule-based methods (Treiber et al., 2000; Thrun et al., 2006; Bacha et al., 2008; Leonard et al., 2008; Urmson et al., 2008; Chen et al., 2015; Sauer et al., 2018; Fan et al., 2018) designed explicit rules to determine driving trajectories. These methods have clear interpretability but generally fail to handle extreme driving scenarios that are not covered by rules. Alternatively, the learning-based approaches (Bojarski et al., 2016; Codevilla et al., 2018; 2019; Rhinehart et al., 2019; Zeng et al., 2019; Sadat et al., 2020; Casas et al., 2021; Hu et al., 2022; 2023; Dauner et al., 2023) resorted to a data-driven strategy and learned their models from large-scale human driving trajectories. While exhibiting good performance, these approaches sacrifice interpretability by viewing motion planning as a black-box forecasting problem. Essentially, both prevailing rule-based and learning-based approaches are devoid of the common sense reasoning ability innate to human drivers, which restricts their capabilities in tackling longtailed driving scenarios.
|
| 14 |
+
|
| 15 |
+
Recent advances in Large Language Models (LLMs) (Brown et al., 2020; Ouyang et al., 2022; OpenAI, 2023; Touvron et al., 2023a;b) have demonstrated great generalization power and common sense reasoning ability emerged from these language models, indicating their potential in addressing problems in the realm of autonomous driving. An important question naturally arises: How can we leverage LLMs to resolve the motion planning problem? The major challenge is that motion planners are required to process heterogeneous inputs, e.g., ego-vehicle information, maps, and perception results, and they need to predict high-precision waypoint coordinates that represent a future driving trajectory. While LLMs excel at language understanding and generation, they cannot directly handle these heterogeneous data. Moreover, it is yet to be established whether LLMs are capable of precise numerical reasoning, e.g. forecasting precise coordinate values that are demanded by motion planning.
|
| 16 |
+
|
| 17 |
+
To this end, we propose a novel approach that successfully unleashes the power of LLMs to address the motion planning problem in autonomous driving. The critical insight is that we can reformulate motion planning as a language modeling problem. Specifically, we propose to tackle the heterogeneous planner inputs by transforming them into unified language tokens, and we instruct a GPT-3.5 model to understand these tokens and then articulate the waypoint coordinates of a future driving trajectory through natural language description. We further elucidate the essence of language modeling in motion planning from the perspective of tokenizers. Moreover, to stimulate the numerical reasoning potential of GPT-3.5, we propose a prompting-reasoning-finetuning strategy, where GPT-3.5 is initially prompted in the context of autonomous driving, and then performs chain-of-thought reasoning to generate sensible outputs, and finally the model is fine-tuned with human driving trajectories to ensure alignments with human driving behaviors. With this strategy, GPT-3.5 is able to forecast highly precise waypoint coordinates with only a centimeter-level error. The chain-of-thought reasoning further enhances transparency in decision-making and makes our approach more interpretable than other learning-based methods. Benefiting from the state-of-the-art GPT-3.5 model, our approach also exhibits good generalization and common sense reasoning ability.
|
| 18 |
+
|
| 19 |
+
We summarize our contributions as follows:
|
| 20 |
+
|
| 21 |
+
· We propose GPT-Driver, a GPT-based motion planner, innovatively transforming the motion planning task into a language modeling problem. We also provide an intuitive interpretation of language modeling in motion planning through the lens of the GPT tokenizer.
|
| 22 |
+
|
| 23 |
+
· We propose a novel prompting-reasoning-finetuning strategy in the context of autonomous driving, which enables precise numerical reasoning and transparent decision-making of our approach.
|
| 24 |
+
|
| 25 |
+
· Our GPT-Driver demonstrates superior motion planning performance, few-shot generalization ability, and interpretability compared to the state-of-the-art motion planners on the nuScenes dataset.
|
| 26 |
+
|
| 27 |
+
# 2 RELATED WORKS
|
| 28 |
+
|
| 29 |
+
Motion planning in autonomous driving. Motion planning aims to forecast safe and comfortable driving routes for autonomous vehicles. Existing approaches can be divided into three categories: rule-based, optimization-based, and learning-based methods. The rule-based approaches (Treiber et al., 2000; Thrun et al., 2006; Bacha et al., 2008; Leonard et al., 2008; Urmson et al., 2008; Chen et al., 2015; Sauer et al., 2018; Fan et al., 2018; Dauner et al., 2023) resort to pre-defined rules to determine future driving trajectories. Intelligent Driver Model (Treiber et al., 2000) (IDM) is a seminal work that proposed a heuristic motion model to follow a leading vehicle in traffic while maintaining a safe distance. Despite being simple and interpretable, IDM lacks sufficient capability to handle complicated driving behaviors such as U-turns. The optimization-based approaches (Li et al., 2022; Liniger et al., 2015; Scheffe et al., 2022) formulate motion planning as an optimal control problem. In contrast, the learning-based approaches (Bojarski et al., 2016; Codevilla et al., 2018; 2019; Rhinehart et al., 2019; Zeng et al., 2019; Sadat et al., 2020; Casas et al., 2021; Hu et al., 2022; 2023) proposed to handle complex driving scenarios by learning from large-scale human driving data. Neural motion planner (Zeng et al., 2019) suggested using a learned cost volume to assess each feasible driving trajectory. P3 (Sadat et al., 2020), MP3 (Casas et al., 2021), ST-P3 (Hu et al., 2022), and UniAD (Hu et al., 2023) proposed end-to-end learning of planning and other tasks in autonomous driving. These approaches rely on deep neural networks to predict future driving trajectories, while the decision-making process is implicitly encoded in neural networks and thus less interpretable.
|
| 30 |
+
|
| 31 |
+
Our GPT-Driver is a learning-based motion planner. In contrast to other learning-based approaches, we leverage the generalization and reasoning ability of the GPT-3.5 model, which enables our model to tackle those long-tailed driving scenarios that are generally challenging to other methods. Our method also has better interpretability thanks to the novel prompting-reasoning-finetuning strategy.
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
Figure 1: Overview of GPT-Driver. We reformulate motion planning as a language modeling problem. We convert observations and ego-states into language prompts, guiding the LLM to produce a planned trajectory alongside its decision-making process in natural language. Subsequently, this planned trajectory is reverted to the numerical format for motion planning.
|
| 35 |
+
|
| 36 |
+
Large language models. Large Language Models (LLMs) are artificial intelligence systems trained on Internet-scale data to understand and generate human-like text, showcasing remarkable abilities in natural language processing. GPT (Brown et al., 2020) is a pioneering work that proposed the Generative Pre-trained Transformer to tackle language understanding and generation problems. The following versions GPT-3.5 and GPT-4 (OpenAI, 2023) demonstrated impressive chatting and reasoning ability. LLaMA and LLaMA 2 (Touvron et al., 2023a;b) are open-source foundation language models. To better harness the capabilities of LLMs, InstructGPT (Ouyang et al., 2022) proposed to train LLMs to follow instructions with human feedback. (Wei et al., 2022) proposed chain-of-thought prompting to enhance the reasoning ability of LLMs. ReAct (Yao et al., 2022) exploited the synergy of reasoning and acting in LLMs. These methods have bolstered the language understanding and decision-making capabilities of LLMs. Despite the success of LLMs in language understanding, exploiting the power of LLMs in autonomous driving remains an open challenge, as the inputs and outputs of autonomous systems are not language. In this paper, we tackle this challenge by reformulating the traditional driving problem into a language modeling problem. Moreover, we propose a novel prompting-reasoning-finetuning strategy tailored for autonomous driving, which is significantly different from the existing works (Yao et al., 2022; Wei et al., 2022) and amplifies the reasoning capabilities of the LLM-based planner.
|
| 37 |
+
|
| 38 |
+
There is also a series of works (Ahn et al., 2022; Fu et al., 2023; Huang et al., 2022; Song et al., 2022) using LLMs for task-level planning, i.e., planning high-level actions for embodied agents. In contrast, our method focuses on motion planning, i.e. planning waypoint-based low-level driving trajectories for autonomous vehicles. Unlike the natural language descriptions used for high-level actions, trajectories are represented as sets of numerical coordinates, posing a greater challenge for LLMs. To the best of our knowledge, our work is the first to demonstrate GPT-3.5’s capability for detailed numerical reasoning in motion planning.
|
| 39 |
+
|
| 40 |
+
# 3 GPT-DRIVER
|
| 41 |
+
|
| 42 |
+
In this section, we present GPT-Driver, an LLM-based motion planner for autonomous driving. An overview of our GPT-Driver is shown in Figure 1. We first introduce the basic concept and problem definition of motion planning in the context of autonomous driving (Section 3.1). Then, we demonstrate how to reformulate motion planning as a language modeling problem (Section 3.2). Finally, we introduce how to address this language modeling problem using a novel promptingreasoning-finetuning strategy (Section 3.3).
|
| 43 |
+
|
| 44 |
+
# 3.1 PROBLEM DEFINITION
|
| 45 |
+
|
| 46 |
+
The objective of motion planning in autonomous driving is to plan a safe and comfortable driving trajectory $\tau$ with observations $\mathcal { O }$ and ego-states $s$ as input. The motion planning process $F$ can be formulated as:
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
{ \mathcal { T } } = F ( { \mathcal { O } } , S ) .
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
A planned trajectory $\tau$ can be represented as a set of waypoints of $t$ timesteps: $\mathcal { T } \in R ^ { t \times 2 }$ :
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\mathcal { T } = \{ ( x _ { 1 } , y _ { 1 } ) , \cdot \cdot \cdot , ( x _ { t } , y _ { t } ) \} ,
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
where $( x _ { i } , y _ { i } )$ is a 2D waypoint coordinate that denotes the vehicle’s anticipated location at the timestep $i$ . The ego-states $S$ generally consist of a historical trajectory of this vehicle and its current status such as velocity and acceleration. The observations $\mathcal { O }$ contain the outputs of perception and prediction systems, e.g., detected object bounding boxes and their future motions.
|
| 59 |
+
|
| 60 |
+
The learning-based motion planners generally learn the trajectory $\tau$ by imitating a human driver’s driving trajectory $\hat { \tau }$ with $L 1$ regression, where the loss function $\mathcal { L } _ { \boldsymbol { r } \boldsymbol { e } \boldsymbol { g } }$ can be formulated as:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\mathcal { L } _ { r e g } = \sum _ { i = 1 } ^ { T } ( | x _ { i } - \hat { x } _ { i } | + | y _ { i } - \hat { y } _ { i } | ) ,
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
where $( x _ { i } , y _ { i } )$ and $( \hat { x } _ { i } , \hat { y } _ { i } )$ are waypoints of the planned trajectory $\tau$ and the human trajectory $\tau ^ { \prime }$ respectively. Albeit simple, these approaches attempt to simultaneously regress waypoints across different scales, e.g. coordinate values ranging from 0 to over 50, which generally results in imprecise coordinate estimations of the more distant waypoints. To this end, we propose a novel approach that supplants the traditional $L 1$ trajectory regression with a language modeling framework.
|
| 67 |
+
|
| 68 |
+
# 3.2 MOTION PLANNING AS LANGUAGE MODELING
|
| 69 |
+
|
| 70 |
+
The crucial insight of this paper is to transform motion planning into a language modeling problem. Given a driving trajectory $\tau$ , we can represent it as a sequence of words that describe this trajectory:
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
{ \mathcal { T } } = K ( \{ ( x _ { 1 } , y _ { 1 } ) , \cdots , ( x _ { t } , y _ { t } ) \} ) = \{ w _ { 1 } , \cdots , w _ { n } \} ,
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
where $w _ { i }$ is the $i$ -th word in this sequence. Please note that each coordinate value $x$ or $y$ in Equation 2 can be freely transformed into a set of words $\{ w \}$ using a language tokenizer $K$ . For instance, a coordinate value 23.17 can be transformed into three words: “23”, “.”, and “17” using the GPT-3.5 tokenizer. With this language representation, we can then reformulate the motion planning problem as a language modeling problem:
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\mathcal { L } _ { L M } = - \sum _ { i = 1 } ^ { N } \log P ( \hat { w } _ { i } | w _ { 1 } , \cdot \cdot \cdot , w _ { i - 1 } ) ,
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where $w$ and $\hat { w }$ are the words from the planned trajectory $\tau$ and the human driving trajectory $\hat { \tau }$ respectively. By learning to maximize the occurrence probability $P$ of the words $\hat { w }$ derived from the human driving trajectory $\hat { \tau }$ , motion planners can generate human-like driving trajectories.
|
| 83 |
+
|
| 84 |
+
We can derive a natural interpretation of how language modeling works in motion planning through the lens of tokenization. Take the coordinate value 23.17 as an example. Through tokenization, it is decomposed into “23” which is the integer part of this value, “.”, and “17” which is the decimal part of this value. Hence, the process of predicting this waypoint coordinate is essentially first estimating a coarse location at the meter level (“23” here) and then estimating a fine-grained location at the centimeter level (“17” here). Moreover, the estimations are established by classifications of the correct tokens in the vocabulary, rather than regression of their absolute values.
|
| 85 |
+
|
| 86 |
+

|
| 87 |
+
Figure 2: An example of input prompts provided to the LLM. The upper text box offers a universal context related to motion planning for every driving scenario. The lower text box provides a language description of the observations and ego-states specific to this particular frame. Parameterized inputs are highlighted in red.
|
| 88 |
+
|
| 89 |
+
We note that language modeling has been employed in other tasks of computer vision and robotics, such as object detection (Chen et al., 2021; Xue et al., 2022; Wang et al., 2023) and robotic control (Brohan et al., 2023). However, these approaches heavily rely on specially designed tokens and tokenizers, which makes their methods less intuitive and hard to generalize to other tasks. In contrast, our key observation is that a commonly used language tokenizer such as the GPT tokenizer already has sufficient capability to estimate very precise numerical values for motion planning. This unique finding makes our approach significantly simpler than prior methods, and also makes our approach more generalizable and compatible with natural language.
|
| 90 |
+
|
| 91 |
+
# 3.3 PROMPTING-REASONING-FINETUNING
|
| 92 |
+
|
| 93 |
+
Despite the potential of language modeling in motion planning, simply adopting (Wei et al., 2022; Ouyang et al., 2022; Yao et al., 2022) and prompting GPT-3.5 to generate trajectories didn’t work in practice (See Section 4.5). To this end, we introduce a novel prompting-reasoning-finetuning strategy that stimulates the potential of language modeling to address the motion planning problem. Specifically, we introduce a method that utilizes the GPT tokenizer $K$ to convert observations $\mathcal { O }$ and ego-states $s$ into language prompts. These prompts are then fed into the GPT-3.5 model $F _ { G P T }$ . We instruct the model to articulate its decision-making process explicitly and produce planned trajectories $\tau$ in natural language. Finally, we fine-tune the GPT model’s outputs to ensure alignment with human driving trajectories. The prompting-reasoning-finetuning process can be formulated as
|
| 94 |
+
|
| 95 |
+

|
| 96 |
+
Figure 3: An example of the expected outputs of the LLM. The chain-of-thought reasoning and the planned trajectory are highlighted in red.
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
\{ \mathcal { T } , \mathcal { R } \} = F _ { G P T } ( K ( \mathcal { O } , \mathcal { S } ) ) ,
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
where $\mathcal { T } = \{ w _ { 1 } , \cdot \cdot \cdot , w _ { n } \}$ is a language description of the trajectory in Equation 4, and $\mathcal { R }$ denotes a language description of the chain-of-thought reasoning and decision-making process. In contrast to the traditional motion planning methods that solely generate planned trajectories, our approach generates both the trajectories $\tau$ and the explicit reasoning process $\mathcal { R }$ , which makes our model’s decision-making process more transparent. Hence, our approach demonstrates better interpretability than the existing methods.
|
| 103 |
+
|
| 104 |
+
In subsequent sections, we delve into details of the prompting, reasoning, and fine-tuning process.
|
| 105 |
+
|
| 106 |
+
Prompting. A key obstacle in using LLMs for motion planning is the disparity in data types: while motion planners process heterogeneous inputs of observations and ego-states, LLMs are primarily designed to handle language inputs. To overcome the above limitations, we resort to the parameterized representations of observations and ego-states and convert them into language descriptions. In particular, we utilize detected objects that are parameterized by their class names and locations as perception results. For each object, we formulate a sentence capturing these attributes. These sentences collectively form the perception prompts. Similarly, we can craft prediction prompts by converting the parameterized future trajectories of detected objects into natural language descriptions. We can also generate the prompts for ego-states by articulating the ego vehicle’s current status such as velocity and heading. Furthermore, we provide general context information about motion planning, such as the coordinate system, objective, etc. Finally, we rephrase these prompts in a more concise format using ChatGPT-4 and utilize them as the inputs to the GPT-3.5 model. An example of prompts is shown in Figure 2.
|
| 107 |
+
|
| 108 |
+
Reasoning. A common weakness of current motion planners is their limited interpretability, since these planners generate planned trajectories from black-box neural networks without elucidating the reasoning behind their decisions. To address this problem, we propose a novel chain-of-thought reasoning strategy specifically designed for autonomous driving. In particular, we summarize the chain-of-thought reasoning process in autonomous driving into 3 steps: First, from the perception results, the motion planner needs to identify those critical objects that may affect its driving dynamics. Second, by analyzing the future motions of these critical objects from the prediction results, the planner should infer when, where, and how this critical object may influence the ego vehicle. Third, on top of the insights gained from the previous analyses, the planner needs to draw a high-level driving decision and then convert it into a planned trajectory. This three-step reasoning framework offers a more structured approach to motion planning and ensures greater transparency throughout the planning procedure. An example is shown in Figure 3.
|
| 109 |
+
|
| 110 |
+
Fine-tuning. To align the LLM’s outputs with human driving behaviors, we employ a simple finetuning strategy using the OpenAI fine-tuning API. Specifically, we collect human driving trajectories $\hat { \tau }$ for each scenario from driving logs. To generate the ground truth guidance of chain-of-thought reasoning $\hat { \mathcal { R } }$ , we initially compute a hypothetical ego-trajectory based on the current velocity and acceleration of the ego vehicle, assuming there is no interference. Then, we identify the critical objects and their potential effects by examining if any objects, based on their present positions and predicted future paths, overlap with the hypothetical ego-trajectory. We found this strategy works well in practice, enabling us to bypass the tedious task of manually annotating the reasoning process. Finally, we can fine-tune the LLM’s outputs $\{ \mathcal { T } , \mathcal { R } \}$ with the ground truth $\{ \bar { \hat { T } } , \hat { \mathcal { R } } \}$ using the language modeling loss $\mathcal { L } _ { L M }$ defined in Equation 5. During inference, we transform the language output of a planned trajectory back to its numerical format for evaluation.
|
| 111 |
+
|
| 112 |
+
# 4 EXPERIMENTS
|
| 113 |
+
|
| 114 |
+
In this section, we demonstrate the effectiveness, generalization ability, and interpretability of our GPT-Driver through extensive experiments on the large-scale and real-world nuScenes dataset (Caesar et al., 2020). We first introduce the experimental settings and evaluation metrics, and then compare our approach against state-of-the-art motion planning methods on the nuScenes dataset. Finally, we conduct studies to evaluate the generalization and interpretability of our approach.
|
| 115 |
+
|
| 116 |
+
# 4.1 EXPERIMENTAL SETUP
|
| 117 |
+
|
| 118 |
+
The nuScenes dataset is a large-scale and real-world autonomous driving dataset. It contains 1000 driving scenarios and approximately 40000 key frames encompassing a diverse range of locations and weather conditions. We follow the general practice in prior works (Hu et al., 2022; 2023; Jiang et al., 2023) and split the whole dataset into training, validation, and testing sets. We use the training set to fine-tune our model and evaluate our model’s performance on the validation set, which ensures a fair comparison with prior works.
|
| 119 |
+
|
| 120 |
+
For a fair comparison with other methods, we adopt the evaluation metrics in UniAD (Hu et al., 2023) to evaluate our planned trajectories. It contains two metrics: L2 error (in meters) and collision rate (in percentage). The average L2 error is computed by measuring each waypoint’s distance in the planned and ground-truth trajectories. It reflects the proximity of a planned trajectory to a human driving trajectory. The collision rate is computed by placing an ego-vehicle box on each waypoint of the planned trajectory and then checking for collisions with the ground truth bounding boxes of other objects. It reflects the safety of a planned trajectory. We follow the common practice in previous works and evaluate the motion planning result in the 3-second time horizon.
|
| 121 |
+
|
| 122 |
+
# 4.2 COMPARISON AGAINST THE STATE-OF-THE-ART METHODS
|
| 123 |
+
|
| 124 |
+
End-to-end driving approaches like UniAD (Hu et al., 2023) perform motion planning based on their internal perception and prediction outputs. For a fair comparison with this work, we build our model on top of the perception and prediction results from their model. We also tried leveraging the perfect perception and prediction results from the dataset for motion planning.
|
| 125 |
+
|
| 126 |
+
Table 1 shows the motion planning performance of our GPT-Driver against the state-of-the-art methods. It is clear that our GPT-Driver significantly outperforms the prior works in the L2 metric by a large margin, demonstrating the effectiveness of our approach in generating human-like driving trajectories. L2 is a strong indicator of the imitation learning ability of motion planners. Our approach surpasses the state-of-the-art approaches in L2, indicating that the fine-tuned LLM has a stronger imitation learning ability compared to MLP-based planners. The collision rate serves as a strong indicator of the safety of motion planning. Our approach also aligns closely with the stateof-the-art methods in the collision metric, indicating our capability to plan safe driving trajectories. Please note that other baseline methods heavily rely on tricks such as post-optimization to lower the collision rate. By contrast, our approach doesn’t rely on these tricks. Moreover, when replacing the perfect perception and prediction with the learned ones, the planning performance only drops slightly, which indicates the robustness of our GPT-Driver to perception and prediction errors. It is worth noting that these state-of-the-art planners (Hu et al., 2023) heavily rely on dense occupancy grids and maps, in addition to detection and prediction, which makes their systems intricate and time-consuming. In contrast, our approach only takes language descriptions of detections and predictions as input observations, which is much simpler than prior methods. Our method also has the potential to incorporate vectorized maps to further boost the performance.
|
| 127 |
+
|
| 128 |
+
# 4.3 FEW-SHOT MOTION PLANNING
|
| 129 |
+
|
| 130 |
+
To further validate the generalization ability of our GPT-Driver, we designed a few-shot motion planning experiment. Specifically, we sampled $1 \%$ , $1 0 \%$ , $5 0 \%$ of the training scenarios and utilized them for fine-tuning our model and training the state-of-the-art motion planner in UniAD. For a fair comparison, both UniAD and our approach leverage the same pretrained detection and prediction modules as inputs, and all other parameters remain the same. Table 2 illustrates the few-shot motion planning results. Our approach attains decent motion planning results on the validation set when exposed to only $1 0 \%$ of the full training scenarios, while UniAD failed to obtain good performance when the training data is limited. In contrast to other learning-based planners that heavily rely on large amounts of data, our GPT-Driver fine-tuned on a few training scenarios could generalize well to the full validation set, which indicates its strong generalization and few-shot learning ability.
|
| 131 |
+
|
| 132 |
+
Table 1: Motion planning performance compared to the state-of-the-art methods. $\dagger$ : Using perception and prediction results from UniAD. $^ \ddag$ : Using perfect perception and prediction from dataset annotations. Our approach significantly outperforms prior works by a large margin in L2 and performs on par with the top methods in collision rate.
|
| 133 |
+
|
| 134 |
+
<table><tr><td rowspan="2">Method</td><td colspan="4">L2(m)↓</td><td colspan="4">Collision (%)↓</td></tr><tr><td>1s</td><td>2s</td><td>3s</td><td>Avg.</td><td>1s</td><td>2s</td><td>3s</td><td>Avg.</td></tr><tr><td>NMP (Zeng et al., 2019)</td><td>1</td><td>1</td><td>2.31</td><td>-</td><td>-</td><td>1</td><td>1.92</td><td>-</td></tr><tr><td>SA-NMP (Zeng et al., 2019)</td><td></td><td></td><td>2.05</td><td>-</td><td></td><td></td><td>1.59</td><td>-</td></tr><tr><td>FF (Hu et al., 2021)</td><td>0.55</td><td>1.20</td><td>2.54</td><td>1.43</td><td>0.06</td><td>0.17</td><td>1.07</td><td>0.43</td></tr><tr><td>EO (Khurana et al., 2022)</td><td>0.67</td><td>1.36</td><td>2.78</td><td>1.60</td><td>0.04</td><td>0.09</td><td>0.88</td><td>0.33</td></tr><tr><td>ST-P3 (Hu et al., 2022)</td><td>1.33</td><td>2.11</td><td>2.90</td><td>2.11</td><td>0.23</td><td>0.62</td><td>1.27</td><td>0.71</td></tr><tr><td>UniAD (Hu et al., 2023)</td><td>0.48</td><td>0.96</td><td>1.65</td><td>1.03</td><td>0.05</td><td>0.17</td><td>0.71</td><td>0.31</td></tr><tr><td>GPT-Drivert</td><td>0.21</td><td>0.43</td><td>0.79</td><td>0.48</td><td>0.16</td><td>0.27</td><td>0.63</td><td>0.35</td></tr><tr><td>GPT-Drivert</td><td>0.20</td><td>0.42</td><td>0.72</td><td>0.45</td><td>0.14</td><td>0.25</td><td>0.60</td><td>0.33</td></tr></table>
|
| 135 |
+
|
| 136 |
+
Table 2: Few-shot motion planning results compared to the state-of-the-art planner UniAD. Our approach performs significantly better than UniAD when the training data is limited and demonstrates better generalization ability.
|
| 137 |
+
|
| 138 |
+
<table><tr><td rowspan="3">Method</td><td colspan="4">Avg.L2(m)↓</td><td colspan="4">Avg. Collision (%)</td></tr><tr><td>1%</td><td>10%</td><td>50%</td><td>100%</td><td>1%</td><td>10%</td><td>50%</td><td>100%</td></tr><tr><td>UniAD (Hu et al.,2023)</td><td>5.37</td><td>1.80</td><td>1.42</td><td>1.03</td><td>6.86</td><td>1.31</td><td>0.49</td><td>0.31</td></tr><tr><td>GPT-Driver</td><td>0.84</td><td>0.60</td><td>0.54</td><td>0.48</td><td>0.64</td><td>0.45</td><td>0.37</td><td>0.35</td></tr></table>
|
| 139 |
+
|
| 140 |
+
# 4.4 INTERPRETABILITY
|
| 141 |
+
|
| 142 |
+
To demonstrate the interpretability of our GPT-Driver, we visualized the reasoning outputs and the planned trajectories of our model in Figure 4. From the figure, we can observe that our method is able to identify critical objects and assess their potential effects from all perception and prediction inputs, and then based on these observations it can generate a coherent high-level action as well as a sensible driving trajectory. For example, in the first sub-figure, our GPT-Driver could identify all obstacles such as barriers and traffic cones, and further neglect the far-away white bus that has no effect on our driving route. Then it can generate a turn-right action with a deceleration to avoid collisions with these obstacles. Finally, it plans a smooth and safe turning trajectory. In contrast to previous methods that only generate planned trajectories, our approach generates not only the trajectories but also the reasoning process of how it predicts these trajectories. Thus our approach can demonstrate better interpretability.
|
| 143 |
+
|
| 144 |
+
# 4.5 FINE-TUNING VS. IN-CONTEXT LEARNING
|
| 145 |
+
|
| 146 |
+
In-context learning and fine-tuning are two prevalent strategies to instruct an LLM for specific tasks. While our fine-tuning strategy works well in motion planning, it raises the question of whether incontext learning could achieve comparable results in this task. To answer this question, we designed an in-context learning experiment where we used both the inputs and the expected outputs in the training set as new exemplar inputs to instruct the LLM. The results in Table 3 suggest that finetuning performs significantly better than in-context learning. This is mainly because the model’s context window is quite limited in in-context learning, e.g. GPT-3.5 can accommodate a maximum of only 5 exemplar inputs every time in our case. Hence, our fine-tuning strategy is indispensable.
|
| 147 |
+
|
| 148 |
+

|
| 149 |
+
Figure 4: Visualization of the GPT-Driver’s outputs (text boxes on the right) on the validation set. Planned trajectories and notable objects are highlighted accordingly in red on the left images. Please note that the images are only for illustration and are never used in our approach. The visualizations indicate that our method can effectively recognize critical objects and their potential impact from all perception and prediction inputs, and subsequently plan a sensible driving trajectory.
|
| 150 |
+
|
| 151 |
+
Table 3: Design choices of in-context learning and fine-tuning. The results indicate fine-tuning is a more effective strategy for instructing the LLM in motion planning.
|
| 152 |
+
|
| 153 |
+
<table><tr><td rowspan="3">Method</td><td colspan="4">L2(m)↓</td><td colspan="4">Collision (%)↓</td></tr><tr><td>1s</td><td>2s</td><td>3s</td><td>Avg.</td><td>1s</td><td>2s</td><td>3s</td><td>Avg.</td></tr><tr><td> GPT-Driver (in-context learning)</td><td>2.41</td><td>3.11</td><td></td><td>4.003.17</td><td>4.20</td><td>5.13</td><td>6.58</td><td>5.30</td></tr><tr><td>GPT-Driver (fine-tuning)</td><td>0.21</td><td>0.43</td><td>0.79</td><td>0.48</td><td>0.16</td><td>0.27</td><td>0.63</td><td>0.35</td></tr></table>
|
| 154 |
+
|
| 155 |
+
# 4.6 LIMITATIONS
|
| 156 |
+
|
| 157 |
+
Due to the limitations of the OpenAI APIs, we are unable to obtain the inference time of our model. Thus it remains uncertain whether our approach can meet the real-time demands of commercial driving applications. Typically, the GPT-based planner would exhibit a longer inference time compared to existing MLP-based planners. Nevertheless, we argue that there are many techniques that could resolve this problem, e.g. distilling a smaller LLM, etc. We leave this for future work.
|
| 158 |
+
|
| 159 |
+
Another limitation lies in the evaluation of motion planning. As open-loop motion planning doesn’t fully emulate error accumulation in the driving process, recently close-loop motion planning has become increasingly popular to evaluate the performances of motion planners. We leave close-loop motion planning of our GPT-Driver for future work.
|
| 160 |
+
|
| 161 |
+
# 5 CONCLUSION
|
| 162 |
+
|
| 163 |
+
In this paper, we introduce GPT-Driver, an innovative method that transforms the OpenAI GPT-3.5 model into a dependable motion planner for autonomous driving. We reformulate motion planning as a language modeling problem, and we propose a novel prompting-reasoning-finetuning strategy to tackle this problem. Through extensive experiments on the large-scale autonomous driving dataset, our approach has demonstrated superior planning performance, generalization, and interpretability compared to existing works. Future works include optimizing the inference time and involving more sensor observations such as high-definition maps in input prompts.
|
| 164 |
+
|
| 165 |
+
# REFERENCES
|
| 166 |
+
|
| 167 |
+
Michael Ahn, Anthony Brohan, Noah Brown, Yevgen Chebotar, Omar Cortes, Byron David, Chelsea Finn, Chuyuan Fu, Keerthana Gopalakrishnan, Karol Hausman, et al. Do as i can, not as i say: Grounding language in robotic affordances. arXiv preprint arXiv:2204.01691, 2022.
|
| 168 |
+
|
| 169 |
+
Andrew Bacha, Cheryl Bauman, Ruel Faruque, Michael Fleming, Chris Terwelp, Charles Reinholtz, Dennis Hong, Al Wicks, Thomas Alberi, David Anderson, et al. Odin: Team victortango’s entry in the darpa urban challenge. Journal of field Robotics, 25(8):467–492, 2008.
|
| 170 |
+
Mariusz Bojarski, Davide Del Testa, Daniel Dworakowski, Bernhard Firner, Beat Flepp, Prasoon Goyal, Lawrence D Jackel, Mathew Monfort, Urs Muller, Jiakai Zhang, et al. End to end learning for self-driving cars. arXiv preprint arXiv:1604.07316, 2016.
|
| 171 |
+
Anthony Brohan, Noah Brown, Justice Carbajal, Yevgen Chebotar, Xi Chen, Krzysztof Choromanski, Tianli Ding, Danny Driess, Avinava Dubey, Chelsea Finn, et al. Rt-2: Vision-language-action models transfer web knowledge to robotic control. arXiv preprint arXiv:2307.15818, 2023.
|
| 172 |
+
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.
|
| 173 |
+
Holger Caesar, Varun Bankiti, Alex H Lang, Sourabh Vora, Venice Erin Liong, Qiang Xu, Anush Krishnan, Yu Pan, Giancarlo Baldan, and Oscar Beijbom. nuscenes: A multimodal dataset for autonomous driving. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 11621–11631, 2020.
|
| 174 |
+
Sergio Casas, Abbas Sadat, and Raquel Urtasun. Mp3: A unified model to map, perceive, predict and plan. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 14403–14412, 2021.
|
| 175 |
+
Chenyi Chen, Ari Seff, Alain Kornhauser, and Jianxiong Xiao. Deepdriving: Learning affordance for direct perception in autonomous driving. In Proceedings of the IEEE international conference on computer vision, pp. 2722–2730, 2015.
|
| 176 |
+
Ting Chen, Saurabh Saxena, Lala Li, David J Fleet, and Geoffrey Hinton. Pix2seq: A language modeling framework for object detection. arXiv preprint arXiv:2109.10852, 2021.
|
| 177 |
+
Felipe Codevilla, Matthias Muller, Antonio L ¨ opez, Vladlen Koltun, and Alexey Dosovitskiy. End- ´ to-end driving via conditional imitation learning. In 2018 IEEE international conference on robotics and automation (ICRA), pp. 4693–4700. IEEE, 2018.
|
| 178 |
+
Felipe Codevilla, Eder Santana, Antonio M Lopez, and Adrien Gaidon. Exploring the limitations of ´ behavior cloning for autonomous driving. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9329–9338, 2019.
|
| 179 |
+
Daniel Dauner, Marcel Hallgarten, Andreas Geiger, and Kashyap Chitta. Parting with misconceptions about learning-based vehicle motion planning. arXiv preprint arXiv:2306.07962, 2023.
|
| 180 |
+
Haoyang Fan, Fan Zhu, Changchun Liu, Liangliang Zhang, Li Zhuang, Dong Li, Weicheng Zhu, Jiangtao Hu, Hongye Li, and Qi Kong. Baidu apollo em motion planner. arXiv preprint arXiv:1807.08048, 2018.
|
| 181 |
+
Daocheng Fu, Xin Li, Licheng Wen, Min Dou, Pinlong Cai, Botian Shi, and Yu Qiao. Drive like a human: Rethinking autonomous driving with large language models. arXiv preprint arXiv:2307.07162, 2023.
|
| 182 |
+
Peiyun Hu, Aaron Huang, John Dolan, David Held, and Deva Ramanan. Safe local motion planning with self-supervised freespace forecasting. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12732–12741, 2021.
|
| 183 |
+
Shengchao Hu, Li Chen, Penghao Wu, Hongyang Li, Junchi Yan, and Dacheng Tao. St-p3: End-toend vision-based autonomous driving via spatial-temporal feature learning. In European Conference on Computer Vision, pp. 533–549. Springer, 2022.
|
| 184 |
+
|
| 185 |
+
Yihan Hu, Jiazhi Yang, Li Chen, Keyu Li, Chonghao Sima, Xizhou Zhu, Siqi Chai, Senyao Du, Tianwei Lin, Wenhai Wang, et al. Planning-oriented autonomous driving. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 17853–17862, 2023.
|
| 186 |
+
|
| 187 |
+
Wenlong Huang, Fei Xia, Ted Xiao, Harris Chan, Jacky Liang, Pete Florence, Andy Zeng, Jonathan Tompson, Igor Mordatch, Yevgen Chebotar, et al. Inner monologue: Embodied reasoning through planning with language models. arXiv preprint arXiv:2207.05608, 2022.
|
| 188 |
+
Bo Jiang, Shaoyu Chen, Qing Xu, Bencheng Liao, Jiajie Chen, Helong Zhou, Qian Zhang, Wenyu Liu, Chang Huang, and Xinggang Wang. Vad: Vectorized scene representation for efficient autonomous driving. arXiv preprint arXiv:2303.12077, 2023.
|
| 189 |
+
Tarasha Khurana, Peiyun Hu, Achal Dave, Jason Ziglar, David Held, and Deva Ramanan. Differentiable raycasting for self-supervised occupancy forecasting. In European Conference on Computer Vision, pp. 353–369. Springer, 2022.
|
| 190 |
+
John Leonard, Jonathan How, Seth Teller, Mitch Berger, Stefan Campbell, Gaston Fiore, Luke Fletcher, Emilio Frazzoli, Albert Huang, Sertac Karaman, et al. A perception-driven autonomous urban vehicle. Journal of Field Robotics, 25(10):727–774, 2008.
|
| 191 |
+
Bai Li, Yakun Ouyang, Li Li, and Youmin Zhang. Autonomous driving on curvy roads without reliance on frenet frame: A cartesian-based trajectory planning method. IEEE Transactions on Intelligent Transportation Systems, 23(9):15729–15741, 2022.
|
| 192 |
+
Alexander Liniger, Alexander Domahidi, and Manfred Morari. Optimization-based autonomous racing of 1: 43 scale rc cars. Optimal Control Applications and Methods, 36(5):628–647, 2015.
|
| 193 |
+
OpenAI. Gpt-4 technical report. 2023.
|
| 194 |
+
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.
|
| 195 |
+
Nicholas Rhinehart, Rowan McAllister, Kris Kitani, and Sergey Levine. Precog: Prediction conditioned on goals in visual multi-agent settings. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 2821–2830, 2019.
|
| 196 |
+
Abbas Sadat, Sergio Casas, Mengye Ren, Xinyu Wu, Pranaab Dhawan, and Raquel Urtasun. Perceive, predict, and plan: Safe motion planning through interpretable semantic representations. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XXIII 16, pp. 414–430. Springer, 2020.
|
| 197 |
+
Axel Sauer, Nikolay Savinov, and Andreas Geiger. Conditional affordance learning for driving in urban environments. In Conference on Robot Learning, pp. 237–252. PMLR, 2018.
|
| 198 |
+
Patrick Scheffe, Theodor Mario Henneken, Maximilian Kloock, and Bassam Alrifaee. Sequential convex programming methods for real-time optimal trajectory planning in autonomous vehicle racing. IEEE Transactions on Intelligent Vehicles, 8(1):661–672, 2022.
|
| 199 |
+
Chan Hee Song, Jiaman Wu, Clayton Washington, Brian M Sadler, Wei-Lun Chao, and Yu Su. Llmplanner: Few-shot grounded planning for embodied agents with large language models. arXiv preprint arXiv:2212.04088, 2022.
|
| 200 |
+
Sebastian Thrun, Mike Montemerlo, Hendrik Dahlkamp, David Stavens, Andrei Aron, James Diebel, Philip Fong, John Gale, Morgan Halpenny, Gabriel Hoffmann, et al. Stanley: The robot that won the darpa grand challenge. Journal of field Robotics, 23(9):661–692, 2006.
|
| 201 |
+
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 \`
|
| 202 |
+
|
| 203 |
+
efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023a.
|
| 204 |
+
|
| 205 |
+
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023b.
|
| 206 |
+
Martin Treiber, Ansgar Hennecke, and Dirk Helbing. Congested traffic states in empirical observations and microscopic simulations. Physical review E, 62(2):1805, 2000.
|
| 207 |
+
Chris Urmson, Joshua Anhalt, Drew Bagnell, Christopher Baker, Robert Bittner, MN Clark, John Dolan, Dave Duggins, Tugrul Galatali, Chris Geyer, et al. Autonomous driving in urban environments: Boss and the urban challenge. Journal of field Robotics, 25(8):425–466, 2008.
|
| 208 |
+
Wenhai Wang, Zhe Chen, Xiaokang Chen, Jiannan Wu, Xizhou Zhu, Gang Zeng, Ping Luo, Tong Lu, Jie Zhou, Yu Qiao, et al. Visionllm: Large language model is also an open-ended decoder for vision-centric tasks. arXiv preprint arXiv:2305.11175, 2023.
|
| 209 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Fei Xia, Ed Chi, Quoc V Le, Denny Zhou, et al. Chain-of-thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35:24824–24837, 2022.
|
| 210 |
+
Yujing Xue, Jiageng Mao, Minzhe Niu, Hang Xu, Michael Bi Mi, Wei Zhang, Xiaogang Wang, and Xinchao Wang. Point2seq: Detecting 3d objects as sequences. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8521–8530, 2022.
|
| 211 |
+
Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. React: Synergizing reasoning and acting in language models. arXiv preprint arXiv:2210.03629, 2022.
|
| 212 |
+
Wenyuan Zeng, Wenjie Luo, Simon Suo, Abbas Sadat, Bin Yang, Sergio Casas, and Raquel Urtasun. End-to-end interpretable neural motion planner. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8660–8669, 2019.
|
md/test/SqW42eR2wC/SqW42eR2wC.md
ADDED
|
@@ -0,0 +1,856 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Offline Inverse Constrained Reinforcement Learning for Safe-Critical Decision Making in Healthcare
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Reinforcement Learning (RL) applied in healthcare can lead to unsafe medical
|
| 11 |
+
2 decisions and treatment, such as excessive dosages or abrupt changes, often due
|
| 12 |
+
3 to agents overlooking common-sense constraints. Consequently, Constrained
|
| 13 |
+
4 Reinforcement Learning (CRL) is a natural choice for safe decisions. However,
|
| 14 |
+
5 specifying the exact cost function is inherently difficult in healthcare. Recent
|
| 15 |
+
6 Inverse Constrained Reinforcement Learning (ICRL) is a promising approach that
|
| 16 |
+
7 infers constraints from expert demonstrations. ICRL algorithms model Markovian
|
| 17 |
+
8 decisions in an interactive environment. These settings do not align with the
|
| 18 |
+
9 practical requirement of a decision-making system in healthcare, where decisions
|
| 19 |
+
10 rely on historical treatment recorded in an offline dataset. To tackle these issues, we
|
| 20 |
+
11 propose the Constraint Transformer (CT). Specifically, 1) utilize causal attention
|
| 21 |
+
12 mechanism to incorporate historical decisions and observations into the constraint
|
| 22 |
+
13 modeling and employ a non-Markovian layer for weighted constraints to capture
|
| 23 |
+
14 critical states, 2) generative world model to perform exploratory data augmentation,
|
| 24 |
+
15 thereby enabling offline RL methods to generate unsafe decision sequences. In
|
| 25 |
+
16 multiple medical scenarios, empirical results demonstrate that CT can capture
|
| 26 |
+
17 unsafe states and achieve strategies that approximate lower mortality rates, reducing
|
| 27 |
+
18 the occurrence probability of unsafe behaviors.
|
| 28 |
+
|
| 29 |
+
# 19 1 Introduction
|
| 30 |
+
|
| 31 |
+
20 In recent years, the doctor-to-patient ratio imbalance has drawn attention, with the U.S. having
|
| 32 |
+
21 only 223.1 physicians per 100,000 people [1]. AI-assisted therapy emerges as a promising solution,
|
| 33 |
+
22 offering timely diagnosis, personalized care, and reducing dependence on experienced physicians.
|
| 34 |
+
23 Therefore, the development of an effective AI healthcare assistant is crucial.
|
| 35 |
+
24 Reinforcement learning (RL) offers a promising approach
|
| 36 |
+
25 to develop AI assistants by addressing sequential decision
|
| 37 |
+
26 making tasks. However, this method can still lead to
|
| 38 |
+
27 unsafe behaviors, such as administering excessive drug
|
| 39 |
+
28 dosages, inappropriate adjustments of medical parameters,
|
| 40 |
+
29 or abrupt changes in medication dosages. These behaviors,
|
| 41 |
+
30 such as “too high” or “sudden change” can significantly
|
| 42 |
+
31 endanger patients, potentially resulting in acute hypoten
|
| 43 |
+
32 sion, hypertension, arrhythmias, and organ damage, with
|
| 44 |
+
33 fatal consequences [4, 5, 6]. For example, in sepsis treat
|
| 45 |
+
34 ment, patients receiving vasopressors (vaso) at dosages
|
| 46 |
+
35 exceeding $1 \mu g / ( k g \cdot m i n )$ have a mortality rate of $9 0 \%$
|
| 47 |
+
36 [7]. Moreover, the “sudden change” in vaso can rapidly
|
| 48 |
+
37 affect blood vessels, causing acute fluctuations in blood
|
| 49 |
+
|
| 50 |
+
Table 1: The proportion of unsafe behaviors occurrences in vaso suggested by physician and DDPG. The typical range for vaso is $0 . 1 \sim 0 . 2 \mu g / ( k g \cdot m i n )$ , with doses exceeding 0.5 considered high [2]. A cutoff value of 0.75 is identified as a critical threshold associated with increased mortality [3].
|
| 51 |
+
|
| 52 |
+
<table><tr><td colspan="2">Drug dosage (μg/(kg ·min)) Physician</td><td>DDPG</td></tr><tr><td>vaso >0.75</td><td>2.27%</td><td>7.44%个</td></tr><tr><td>vaso >0.9</td><td>1.71%</td><td>7.40%</td></tr><tr><td>△vaso >0.75</td><td></td><td>2.45%21.00%个</td></tr><tr><td>△vaso>0.9</td><td></td><td>1.88%20.62%个</td></tr></table>
|
| 53 |
+
|
| 54 |
+
$\Delta$ vaso: The change in vaso between two-time points.
|
| 55 |
+
|
| 56 |
+
38 pressure and posing life-threatening risks to patients [8]. Our experiments demonstrate that the work
|
| 57 |
+
|
| 58 |
+
39 [9] applying the Deep Deterministic Policy Gradient (DDPG) algorithm in sepsis indeed exhibits “too high” and “sudden change” 140 unsafe behaviors in vaso recommendations, as shown in Table 1.
|
| 59 |
+
|
| 60 |
+
41 This paper aims to achieve safe healthcare policy learning to mitigate unsafe behaviors. The most
|
| 61 |
+
42 common method for learning safe policies is Constrained Reinforcement Learning (CRL) [10, 11],
|
| 62 |
+
43 with the key to its success lying in the constraints representation. However, in healthcare, we can
|
| 63 |
+
44 only design the cost function based on prior knowledge, which limits its application due to a lack of
|
| 64 |
+
45 personalization, universality, and reliance on prior knowledge. For more details about issues, please
|
| 65 |
+
46 refer to Appendix A. Therefore, Inverse Constrained Reinforcement Learning (ICRL) [12] emerges as
|
| 66 |
+
47 a promising approach, as it can infer the constraints adhered to by experts from their demonstrations.
|
| 67 |
+
48 However, directly applying ICRL in healthcare presents several challenges:
|
| 68 |
+
49 1) The Markov decision is not compatible with medi
|
| 69 |
+
50 cal decisions. ICRL algorithms model Markov decisions,
|
| 70 |
+
51 where the next state depends only on the current state and
|
| 71 |
+
52 not on the history [13, 14]. However, in healthcare, the
|
| 72 |
+
53 historical states of patients are crucial for medical decision
|
| 73 |
+
54 making [15], as demonstrated in the experiments shown
|
| 74 |
+
55 in Figure 1. Therefore, ICRL algorithms based on Markov
|
| 75 |
+
56 assumption can not capture patient history, and ignore in
|
| 76 |
+
57 dividual patient differences, thereby limiting effectiveness.
|
| 77 |
+
58 2) Interactive environment is not available for health
|
| 78 |
+
59 care or medical decisions. ICRL algorithms [12, 16]
|
| 79 |
+
60 follow an online learning paradigm, allowing agents to
|
| 80 |
+
61 explore and learn from interactive environments. How
|
| 81 |
+
62 ever, unrestricted exploration in healthcare often entails
|
| 82 |
+
63 unsafe behaviors that could breach constraints and result
|
| 83 |
+
|
| 84 |
+

|
| 85 |
+
Figure 1: The distribution of vaso for patients with the same state. The physician makes different decisions due to referencing historical information, while the agent based on Markov decision-making can only make the same decision.
|
| 86 |
+
|
| 87 |
+
64 in substantial losses. Therefore, it is necessary to infer constraints using only offline datasets.
|
| 88 |
+
|
| 89 |
+
65 In this paper, we introduce offline Constraint Transformer (CT), a novel ICRL framework that
|
| 90 |
+
66 incorporates patients’ historical information into constraint modeling and learns from offline data to
|
| 91 |
+
67 infer constraints in healthcare. Specifically,
|
| 92 |
+
68 1) Inspired by the recent success of transformers in sequence modeling [17, 18, 19], we incorporate
|
| 93 |
+
69 historical decisions and observations into constraint modeling using a causal attention mechanism. To
|
| 94 |
+
70 capture key events in trajectories, we introduce a non-Markovian transformer to generate constraints
|
| 95 |
+
71 and importance weights, and then define constraints using weighted sums. CT takes trajectories as
|
| 96 |
+
72 input, allowing for the observation of patients’ historical information and evaluation of key states.
|
| 97 |
+
73 2) To learn from an offline dataset, we introduce a model-based offline RL method that simultaneously
|
| 98 |
+
74 learns a policy model and a generative world model via auto-regressive imitation of the actions and
|
| 99 |
+
75 observations in medical decisions. The policy model employs a stochastic policy with entropy
|
| 100 |
+
76 regularization to prevent it from overfitting and improve its robustness. Utilizing expert datasets,
|
| 101 |
+
77 the generative world model uses an auto-regressive exploration generation paradigm to effectively
|
| 102 |
+
78 discover a set of violating trajectories. Then, CT can infer constraints in healthcare through these
|
| 103 |
+
79 unsafe trajectories and expert trajectories.
|
| 104 |
+
80 In the medical scenarios of sepsis and mechanical ventilation, we conduct experimental evaluations of
|
| 105 |
+
1 offline CT. Experimental evaluations demonstrate that offline CT can capture patients’ unsafe states
|
| 106 |
+
82 and assign higher penalties, thereby providing more interpretable constraints compared to previous
|
| 107 |
+
83 works [9, 20, 21]. Compared to unconstrained and custom constraints, CT achieves strategies that
|
| 108 |
+
84 closely approximate lower mortality rates with a higher probability (improving by $8 . 8 5 \%$ compared to
|
| 109 |
+
85 DDPG). To investigate the avoidance of unsafe behaviors with offline CT, we evaluate the probabilities
|
| 110 |
+
86 of “too high” and “sudden changes” occurring in the sepsis. The experimental results show that CRL
|
| 111 |
+
87 with CT can reduce the probability of unsafe behaviors to zero.
|
| 112 |
+
|
| 113 |
+
# 2 Related Works
|
| 114 |
+
|
| 115 |
+
Reinforcement Learning in Healthcare. RL has made great progress in the realm of healthcare, such as sepsis treatment [9, 20, 21, 22], mechanical ventilation [23, 24, 25], sedation [26] and anesthesia [27, 28]. However, these works mentioned above have not addressed potential safety issues such as sudden changes or too high doses of medication. Therefore, the development of policies that are both safe and applicable across various healthcare domains is crucial.
|
| 116 |
+
|
| 117 |
+
94 Inverse Constrained Reinforcement Learning. Previous works inferred constraint functions by
|
| 118 |
+
95 determining the feasibility of actions under current states. In discrete state-action spaces, Chou et al.
|
| 119 |
+
96 [29] and Park et al. [30] learned constraint sets to differentiate constrained state-action pairs. Scobee
|
| 120 |
+
97 & Sastry [31] proposed inferring constraint sets based on the principle of maximum entropy, while
|
| 121 |
+
98 some studies [32, 33] extended this approach to stochastic environments using maximum causal
|
| 122 |
+
99 entropy [34]. In continuous domains, Malik et al. [12], Gaurav et al. [16], and Qiao et al. [35] used
|
| 123 |
+
100 neural networks to approximate constraints. Some works [11, 29] applied Bayesian Monte Carlo and
|
| 124 |
+
101 variational inference to infer the posterior distribution of constraints in high-dimensional state spaces.
|
| 125 |
+
102 Xu et al. [36] modeled uncertainty perception constraints for arbitrary and epistemic uncertainties.
|
| 126 |
+
103 However, these methods can only be applied online and lack historical dependency.
|
| 127 |
+
104 Transformers for Reinforcement Learning. Transformer has produced exciting progress on RL
|
| 128 |
+
105 sequential decision problems [17, 18, 37, 38]. These works no longer explicitly learn Q-functions
|
| 129 |
+
106 or policy gradients, but focus on action sequence prediction models driven by target rewards. Chen
|
| 130 |
+
107 et al. [18] and Janner et al. [37] perform auto-regressive modeling of trajectories to achieve policy
|
| 131 |
+
108 learning in an offline environment. Furthermore, Zheng et al. [17] unify offline pretraining and
|
| 132 |
+
109 online fine-tuning within the Transformer framework. Liu et al. [38] and Kim et al. [19] integrate the
|
| 133 |
+
110 transformer architecture into constraint learning and preference learning. The transformer architecture,
|
| 134 |
+
111 with its sequence modeling capability and independence from the Markov assumption, can capture
|
| 135 |
+
112 temporal dependencies in medical decision-making. Thus, it is well-suited for trajectory learning and
|
| 136 |
+
113 personalized learning in medical settings.
|
| 137 |
+
|
| 138 |
+
# 3 Problem Formulation
|
| 139 |
+
|
| 140 |
+
115 We model the medical environment with a Constrained Markov Decision Process (CMDP) $\mathcal { M } ^ { c }$ [39],
|
| 141 |
+
116 which can be defined by a tuple $( \mathcal { S } , \mathcal { A } , \mathcal { P } , \mathcal { R } , \mathcal { C } , \gamma , \kappa , \rho _ { 0 } )$ . Similar to studies [23, 40], we extract data
|
| 142 |
+
117 within 72 hours of patient admission, with each 4-hour interval constituting a window or time step.
|
| 143 |
+
118 The state indicators of the patient at each time step are denoted as $s \in S$ . The administered drug
|
| 144 |
+
119 doses or instrument parameters of interest are considered as actions $a \in { \mathcal { A } }$ , while reward function
|
| 145 |
+
120 $\mathcal { R }$ is used to describe the quality of the patient’s condition and provided by experts based on prior
|
| 146 |
+
121 work [9, 23]. At each time step $t$ , an agent performs an action $a _ { t }$ at a patient’s state $s _ { t }$ . This process
|
| 147 |
+
122 generates the reward $\boldsymbol { r } _ { t } \sim \mathcal { R } ( \boldsymbol { s } _ { t } , \boldsymbol { a } _ { t } )$ , the cost $c _ { t } \sim \mathcal { C }$ and the next state $s _ { t + 1 } \sim \mathcal { P } \left( \cdot \mid s _ { t } , a _ { t } \right)$ , where
|
| 148 |
+
123 $\mathcal { P }$ defines the transition probabilities. $\gamma$ denotes the discount factor. $\kappa \in \mathbb { R } _ { + }$ denotes the bound of
|
| 149 |
+
124 cumulative costs. $\rho _ { 0 }$ defines the initial state distribution. The goal of the CRL policy $\pi$ is to maximize
|
| 150 |
+
125 the reward return while limiting the cost in a threshold $\kappa$ :
|
| 151 |
+
|
| 152 |
+
$$
|
| 153 |
+
\arg \operatorname* { m a x } _ { \pi } \mathbb { E } _ { \pi , \rho _ { 0 } } [ \sum _ { t = 1 } ^ { T } \gamma ^ { t } r _ { t } ] , \mathrm { s . t . } \mathbb { E } _ { \pi , \rho _ { 0 } } [ \sum _ { t = 1 } ^ { T } \gamma ^ { t } c _ { t } ] \leq \kappa .
|
| 154 |
+
$$
|
| 155 |
+
|
| 156 |
+
126 where $T$ is the length of the trajectory $\tau$ . CRL commonly assumes that constraint signals are directly
|
| 157 |
+
127 observable. However, in healthcare, such signals are not easily obtainable. Therefore, Our objective
|
| 158 |
+
128 is to infer reasonable constraints for CRL to achieve safe policy learning in healthcare.
|
| 159 |
+
129 Safe-Critical Decision Making with Constraint Inference in Healthcare. Our general goal is for
|
| 160 |
+
130 our policy to approximate the optimal policy, which refers to the strategy under which the patient’s
|
| 161 |
+
131 mortality rate is minimized (achieving a zero mortality rate is often difficult since there are patients
|
| 162 |
+
132 who can not recover, regardless of all potential future treatment sequences [41]). Decision-making
|
| 163 |
+
133 with constraints can formulate safer strategies by discovering and avoiding unsafe states, thereby
|
| 164 |
+
134 approaching the optimal policy.
|
| 165 |
+
135 However, most offline RL algorithms rely on online evaluation, where the agent is evaluated in
|
| 166 |
+
136 an interactive environment, whereas in medical scenarios, only offline evaluation can be utilized.
|
| 167 |
+
137 In previous works [5, 9, 40, 42], they qualitatively analyzed by comparing the differences (DIFF)
|
| 168 |
+
138 between the drug dosage recommended by our policy $\pi$ and the dosage administered by clinical
|
| 169 |
+
139 physicians $\hat { \pi }$ , and its relationship with mortality rates, through graphical analysis. In the graph
|
| 170 |
+
140 depicting the relationship between the DIFF and mortality rate, at the point when DIFF is zero, the
|
| 171 |
+
141 lower the mortality rate of patients, the better the performance of the policy [40]. To provide a more
|
| 172 |
+
142 accurate quantitative evaluation, we introduce the concept of the probability of approaching the
|
| 173 |
+
143 optimal policy, defined as $\omega$ :
|
| 174 |
+
|
| 175 |
+
$$
|
| 176 |
+
\omega = { \frac { \mathrm { N u m b e r ~ o f ~ s u r v i v o r s ~ a m o n g ~ t h e ~ t o p ~ } N \mathrm { ~ p a t i e n t s } } { N } }
|
| 177 |
+
$$
|
| 178 |
+
|
| 179 |
+
144 We randomly collect $2 N$ patients (with an equal number of known survivors and non-survivors under
|
| 180 |
+
145 doctor’s policy $\hat { \pi }$ ) from the offline dataset. We then calculate the DIFF and sort it in ascending order.
|
| 181 |
+
146 The optimality of the policy can be evaluated through the following two points: 1) The higher the
|
| 182 |
+
147 survival probability (i.e., $\omega$ ) of the top $N$ patients, the lower the mortality rate can be achieved by
|
| 183 |
+
148 executing $\pi ; 2$ ) The smaller the DIFF among the surviving patients in the top $N$ , the greater the
|
| 184 |
+
149 probability that $\pi$ is optimal.
|
| 185 |
+
|
| 186 |
+
# 4 Method
|
| 187 |
+
|
| 188 |
+
To infer constraints and achieve safe decision-making in healthcare, we introduce the Offline Constraint Transformer (Figure 2), a novel ICRL framework.
|
| 189 |
+
|
| 190 |
+
153 Inverse Constrained Reinforcement Learning. ICRL aims to recover the cost function $\mathcal { C } ^ { * }$ by
|
| 191 |
+
154 leveraging a set of trajectories $\mathcal { D } _ { e } = \{ \tau _ { e } ^ { ( i ) } \} _ { i } ^ { N }$ sampled from an expert policy $\pi _ { e }$ , where $N$ denotes
|
| 192 |
+
155 the number of the trajectories. ICRL is commonly based on the Maximum Entropy framework [31],
|
| 193 |
+
156 and the likelihood function is articulated as [12]:
|
| 194 |
+
|
| 195 |
+
$$
|
| 196 |
+
p ( \mathcal D _ { e } \mid \mathcal C ) = \frac { 1 } { \left( Z _ { \mathcal M } c \right) ^ { N } } \prod _ { i = 1 } ^ { N } \exp \Big [ R ( \tau ^ { ( i ) } ) \Big ] \mathbb { I } ^ { \mathcal { M } ^ { c } } ( \tau ^ { ( i ) } )
|
| 197 |
+
$$
|
| 198 |
+
|
| 199 |
+
157 Here, $\begin{array} { r } { Z _ { \mathcal { M } } = \int \exp ( \beta r ( \tau ) ) \mathbb { I } ^ { \mathcal { M } } ( \tau ) d \tau } \end{array}$ is the normalizing term. The indicator $\mathbb { I } ^ { \mathcal { M } ^ { c } } ( \tau ^ { ( i ) } )$ signifies the
|
| 200 |
+
158 extent to which the trajectory $\tau ^ { ( i ) }$ satisfies the constraints. It can be approximated using a neural
|
| 201 |
+
159 network $\zeta _ { \theta } ( \tau ^ { \left( i \right) } )$ parameterized with $\theta$ , defined as $\begin{array} { r } { \zeta _ { \theta } ( \tau ^ { ( i ) } ) = \prod _ { t = 0 } ^ { T } \zeta _ { \theta } ( s _ { t } ^ { i } , a _ { t } ^ { i } ) } \end{array}$ . Consequently, the
|
| 202 |
+
160 cost function can be formulated as $C _ { \theta } = 1 - \zeta _ { \theta }$ . Substituting the neural network for the indicator, we
|
| 203 |
+
161 can update $\theta$ through the gradient of the log-likelihood function:
|
| 204 |
+
|
| 205 |
+
$$
|
| 206 |
+
\nabla _ { \theta } \mathcal { L } \left( \theta \right) = \mathbb { E } _ { \tau ^ { ( i ) } \sim \pi _ { e } } \left[ \nabla _ { \theta } \log [ \zeta _ { \theta } ( \tau ^ { ( i ) } ) ] \right] - \mathbb { E } _ { \hat { \tau } \sim \pi _ { \mathcal { M } } \hat { \zeta } _ { \theta } } \left[ \nabla _ { \theta } \log [ \zeta _ { \theta } ( \hat { \tau } ^ { ( i ) } ) ] \right]
|
| 207 |
+
$$
|
| 208 |
+
|
| 209 |
+
162 where $\mathcal { M } ^ { \hat { \zeta } _ { \theta } }$ denotes the MDP obtained after augmenting $\mathcal { M }$ with the cost function $C _ { \theta }$ , using the
|
| 210 |
+
163 executing policy $\pi _ { \mathcal { M } } \hat { \varsigma } _ { \theta }$ . And $\hat { \tau }$ are sampled from the policy. In practice, ICRL can be conceptualized
|
| 211 |
+
164 as a bi-level optimization task [11]. We can 1) update this policy based on Equation 1, and 2) employ
|
| 212 |
+
165 Equation 4 for constraint learning. Intuitively, the objective of Equation 4 is to distinguish between
|
| 213 |
+
166 trajectories generated by expert policies and imitation policies that may violate the constraints.
|
| 214 |
+
167 Specifically, task 1) involves updating the policy using advanced CRL methods. Significant progress
|
| 215 |
+
168 has been made in some works such as BCQ-Lagrangian (BCQ-Lag), COpiDICE [43], VOCE [44],
|
| 216 |
+
169 and CDT [38]. Meanwhile, task 2) focuses on learning the constraint function, as shown in Figure
|
| 217 |
+
170 2. Our research primarily improves the latter process due to two main challenges facing ICRL
|
| 218 |
+
171 in healthcare: Challenge 1) pertains to the limitations of the Markov property, and Challenge 2)
|
| 219 |
+
172 involves the issue of inferring constraints only from offline datasets. To address these challenges, we
|
| 220 |
+
173 propose the offline CT as our solution.
|
| 221 |
+
174 Offline Constraint Transformer. To address the first challenge, we delve into the inherent issues of
|
| 222 |
+
175 applying the Markov property to healthcare and draw inspiration from the successes of Transformer
|
| 223 |
+
176 in decision-making, redefining the representation of the constraints. To realize the offline training, we
|
| 224 |
+
177 consider the essence of ICRL updates, proposing a model-based RL to generate unsafe behaviors
|
| 225 |
+
178 used to train CT. We outline three parts: establishing the constraint representation model (Section
|
| 226 |
+
179 4.1), creating an offline RL for violating data (Section 4.2), and learning safe policies (Section 4.3).
|
| 227 |
+
|
| 228 |
+

|
| 229 |
+
Figure 2: The overview of the safe healthcare policy learning with offline CT.
|
| 230 |
+
|
| 231 |
+
# 4.1 Constraint Transformer
|
| 232 |
+
|
| 233 |
+
ICRL methods relying on the Markov property overlook patients’ historical information, focusing only on the current state. However, both current and historical states, along with vital sign changes are crucial for a human doctor’s decision-making process [15]. To emulate the observational approach of humans, we draw inspiration from the Decision Transformer (DT) [18] to incorporate historical information into constraints for a more comprehensive observation and judgment. We propose a constraint modeling approach based on a
|
| 234 |
+
|
| 235 |
+

|
| 236 |
+
Figure 3: The structure of the Constraint Transformer.
|
| 237 |
+
|
| 238 |
+
causal attention mechanism, as shown in Figure 3. The structure comprises a causal Transformer for sequential modeling and a non-Markovian layer for weighted constraints learning.
|
| 239 |
+
|
| 240 |
+
196 Sequential Modeling for Constraints Inference. For a trajectory segment of length $T$ , $2 T$ input
|
| 241 |
+
197 embeddings are generated, with each position containing state $s$ and action $a$ embeddings. Addi
|
| 242 |
+
198 tionally, these embeddings undergo linear and normalization layers before being fed into the causal
|
| 243 |
+
199 Transformer, which produces output embeddings $\{ d _ { t } \} _ { t = 1 } ^ { T }$ determined by preceding input embeddings
|
| 244 |
+
200 from $( s _ { 1 } , a _ { 1 } , . . . , s _ { T } , a _ { T } )$ . Here, $d _ { t }$ depends only on the previous $t$ states and actions.
|
| 245 |
+
201 Modeling Non-Markovian for Weighted Constraints Learning. Although $d _ { t }$ represents the cost
|
| 246 |
+
202 function $c _ { t }$ derived from observations over long trajectories, it doesn’t pinpoint which previous key
|
| 247 |
+
203 actions or states led to its increase. In healthcare, identifying key actions or states is vital for analyzing
|
| 248 |
+
204 risky behaviors and status, and enhancing model interpretability. To address this, we draw inspiration
|
| 249 |
+
205 from the design of the preference attention layer in [19] and introduce an additional attention layer.
|
| 250 |
+
206 This layer is employed to define the cost weight for non-Markovians. It takes the output embeddings
|
| 251 |
+
207 from the causality transformer as input and generates the corresponding cost and importance weights.
|
| 252 |
+
208 The output of the attention layer is computed by weighting the values through the normalized dot
|
| 253 |
+
209 product between the query and other keys:
|
| 254 |
+
|
| 255 |
+
$$
|
| 256 |
+
\sum _ { t = 1 } ^ { T } \mathrm { s o f t m a x } \left( \{ \langle q _ { t } , k _ { t ^ { \prime } } \rangle \} _ { t ^ { \prime } = 1 } ^ { T } \right) _ { t } \cdot c _ { t } = \sum _ { t = 1 } ^ { T } w _ { t } \cdot c _ { t }
|
| 257 |
+
$$
|
| 258 |
+
|
| 259 |
+
210 Here, the key $\boldsymbol { k } _ { t } \in \mathbb { R } ^ { m }$ , query $q _ { t } \in \mathbb { R } ^ { m }$ , and value $c _ { t } \in \mathbb { R } ^ { m }$ are derived from the $t$ -th input $d _ { t }$
|
| 260 |
+
211 through linear transformations, where $m$ denotes the embedding dimension. Furthermore, for each
|
| 261 |
+
212 time step $t$ , since $d _ { t }$ depends only on the previous state-action pairs $\{ ( s _ { i } , a _ { i } ) \} _ { i = 1 } ^ { t }$ and serves as the
|
| 262 |
+
213 input embedding for the attention layer, $c _ { t }$ is also associated solely with the preceding $t$ time steps.
|
| 263 |
+
214 The representation of the cost function as a weighted sum is defined as $\begin{array} { r } { C \left( \tau \right) = \sum _ { t = 1 } ^ { T } w _ { t } \cdot c _ { t } } \end{array}$ . Then,
|
| 264 |
+
215 we can also determine the constraint function values for each preceding subsequence. Introducing the
|
| 265 |
+
216 newly defined cost function, we redefine Equation 4 for CT as:
|
| 266 |
+
|
| 267 |
+
$$
|
| 268 |
+
\nabla _ { \phi } \mathcal { L } \left( \phi \right) = \mathbb { E } _ { \hat { \tau } \sim \mathcal { D } _ { v } } \left[ \nabla _ { \phi } \log [ C _ { \phi } ( \hat { \tau } ) ] \right] - \mathbb { E } _ { \tau \sim \mathcal { D } _ { e } } \left[ \nabla _ { \phi } \log [ C _ { \phi } ( \tau ) ] \right]
|
| 269 |
+
$$
|
| 270 |
+
|
| 271 |
+
217 where $\phi$ is the parameter of CT, $\mathcal { D } _ { e }$ and $\mathcal { D } _ { v }$ represent the expert data and the violating data. This
|
| 272 |
+
218 formulation implies that the constraint should be minimized on the expert policy and maximized on
|
| 273 |
+
219 the violating policy. We construct an expert and a violating dataset to evaluate Equation 6 in offline.
|
| 274 |
+
220 The expert data can be acquired from existing medical datasets or hospitals. Regarding the violating
|
| 275 |
+
221 dataset, we introduce a generative model to establish it, as detailed in Section 4.2.
|
| 276 |
+
223 To train CT offline, we introduce a model
|
| 277 |
+
224 based offline RL method (Figure 4) to gen
|
| 278 |
+
225 erate violating data that refers to unsafe
|
| 279 |
+
226 behavioral data and can be represented as
|
| 280 |
+
227 $\tau _ { v } = ( s _ { 1 } , a _ { 1 } , r _ { 1 } , s _ { 2 } , \ldots ) \in \mathcal { D } _ { v }$ . The model
|
| 281 |
+
228 simultaneously learns a policy model and a
|
| 282 |
+
229 generative world model via auto-regressive imitation of the actions and observations in healthcare.
|
| 283 |
+
230 The model processes a trajectory, $\tau _ { e } \in \mathcal { D } _ { e }$ , as a sequence of tokens encompassing the return-to-go,
|
| 284 |
+
231 $t$ tates, and actions, defined as is the sum of future rewar $( \hat { R } _ { 1 } , s _ { 1 } , a _ { 1 } , . . . , \hat { R } _ { T } , s _ { T } , a _ { T } )$ $\begin{array} { r } { \hat { R } _ { t } \ = \ \sum _ { t ^ { \prime } = t } ^ { T } r _ { t ^ { \prime } } } \end{array}$ b. the return-to-go t each timestep $\hat { R } _ { t }$ $t$ at timestep it employs
|
| 285 |
+
233 the tokens from the preceding $K$ timesteps as its input, where $K$ represents the context length.
|
| 286 |
+
234 Thus, the input tokens for it at timestep $t$ are denoted as $h _ { t } = \{ \hat { R } _ { - K : t } , s _ { - K : t } , a _ { - K : t - 1 } \}$ , where
|
| 287 |
+
235 $\hat { R } _ { - K : t } = \{ \hat { R } _ { K } , . . . , \hat { R } _ { t } \}$ , $\boldsymbol { s } _ { - K : t } = \{ \boldsymbol { s } _ { K } , . . . , \boldsymbol { s } _ { t } \}$ and $a _ { - K : t - 1 } = \{ a _ { K } , . . . , a _ { t - 1 } \}$ .
|
| 288 |
+
|
| 289 |
+

|
| 290 |
+
Figure 4: The structure of the model-based offline RL.
|
| 291 |
+
|
| 292 |
+
Policy Model. The input tokens are encoded through a linear layer for each modality. Subsequently, the encoded tokens pass through a casual transformer to predict future action tokens. We use a stochastic policy [38] to achieve policy learning. Additionally, we utilize a Shannon entropy regularizer $\mathcal { H } \left[ \pi _ { \vartheta } ( \cdot \vert h ) \right]$ to prevent policy overfitting and enhance robustness. The optimization objective is to minimize the negative log-likelihood loss while maximizing the entropy with weight $\lambda$ :
|
| 293 |
+
|
| 294 |
+
$$
|
| 295 |
+
\operatorname* { m i n } _ { \vartheta } \quad \mathbb { E } _ { h _ { t } \sim \mathcal { D } _ { e } } [ - \log \pi _ { \vartheta } ( \cdot \vert h _ { t } ) - \lambda \mathcal { H } \left[ \pi _ { \vartheta } ( \cdot \vert h _ { t } ) \right] ]
|
| 296 |
+
$$
|
| 297 |
+
|
| 298 |
+
where the policy $\pi _ { \vartheta } \left( \cdot \mid h _ { t } \right) = \mathcal { N } \left( \mu _ { \vartheta } \left( h _ { t } \right) , \Sigma _ { \vartheta } \left( h _ { t } \right) \right)$ adopts the stochastic Gaussian policy representation and $\vartheta$ is the parameter.
|
| 299 |
+
|
| 300 |
+
244 Generative World Model. To predict states and rewards, we use $x _ { t } = \{ h _ { t } \cup a _ { t } \}$ as input encoded
|
| 301 |
+
245 by linear layers. The encoded tokens pass through the casual transformer to predict hidden tokens.
|
| 302 |
+
246 Then we utilize two linear layers to fit the rewards and states. The optimization objective for the two
|
| 303 |
+
247 linear layers $\ell$ with the parameters $\varphi$ and $\mu$ can be defined as:
|
| 304 |
+
|
| 305 |
+
$$
|
| 306 |
+
\operatorname* { m i n } _ { \varphi , \mu } \quad \mathbb { E } _ { s _ { t } , r _ { t - 1 } \in x _ { t } \sim \mathcal { D } _ { e } } [ ( s _ { t } - \ell _ { \varphi } ( x _ { t } ) ) ^ { 2 } + ( r _ { t - 1 } - \ell _ { \mu } ( x _ { t } ) ) ^ { 2 } ]
|
| 307 |
+
$$
|
| 308 |
+
|
| 309 |
+
48 Generating Violating Data. In RL, excessively high rewards, surpassing those provided by domain
|
| 310 |
+
49 experts, may incentivize agents to violate the constraints in order to maximize the total reward [11].
|
| 311 |
+
50 Therefore, we set a high initial target reward $\hat { R } _ { 1 }$ to obtain violation data. We feed $\hat { R } _ { 1 }$ and initial state
|
| 312 |
+
51 $s _ { 1 } ^ { ( i ) }$ into the model-based offline RL to generate $\tau _ { v } ^ { \left( i \right) }$ in an auto-regressive manner, as depicted in
|
| 313 |
+
52 model-based offline RL of Figure 2, where $\widetilde { a }$ , $\widetilde { r }$ and $\widetilde s$ are predicted by the model. The target reward
|
| 314 |
+
53 $\hat { R }$ e edecreases incrementally and can be represented as $\hat { R } _ { t + 1 } = \hat { R } _ { t } - \widetilde { r } _ { t }$ . Considering the average error
|
| 315 |
+
54 in trajectory prediction, we generate trajectories with the length $K = 1 0$ , as detailed in Appendix
|
| 316 |
+
55 B.3. Repeating $N$ initial states, we can get violating data $\mathcal { D } _ { v } = \{ \tau _ { v } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ .
|
| 317 |
+
|
| 318 |
+
Note that certain other generative models, such as Variational Auto-Encoder (VAE) [45], Generative Adversarial Networks (GAN) [46, 47], and Denoising Diffusion Probabilistic Models (DDPM) [48, 49], may be better at generating data. We introduce the model-based offline RL primarily because it has been shown to generate violating data with exploration [38] and possess the ability to process time-series features efficiently.
|
| 319 |
+
|
| 320 |
+
# 4.3 Safe-Critical Decision Making with Constraints.
|
| 321 |
+
|
| 322 |
+
To train offline CT, we gather the medical expert dataset $\mathcal { D } _ { e }$ from the environment. Then, we employ gradient descent to train the model-based offline RL, guided by Equation 7 and Equation 8, continuing until the model converges. Using this RL model, we automatically generate violating data denoted as $\mathcal { D } _ { v }$ . Subsequently, CT is optimized based on Equation 6 to get the cost function $C$ , leveraging samples from both $\mathcal { D } _ { e }$ and $\mathcal { D } _ { v }$ . To learn a safe policy, we train the policy $\pi$ using $C$ until it converges based on Equation 1. The detailed training procedure is presented in Algorithm 1.
|
| 323 |
+
|
| 324 |
+
# 5 Experiment
|
| 325 |
+
|
| 326 |
+
In this section, we first provide a brief overview of the task, as well as data extraction and preprocessing. Subsequently, in Section 5.1, we demonstrate that CT can describe constraints in healthcare and capture critical patient states. We emphasize its applicability to various CRL methods and its ability to approach the optimal policy for reducing mortality rates in Section 5.2. Finally, Section 5.3 discusses the realization of the objective of safe medical policies.
|
| 327 |
+
|
| 328 |
+
Input: Expert trajectories $\mathcal { D } _ { e }$ , context length $K$ , target reward $\hat { R } _ { 1 }$ , samples $N$ , episode length $T$
|
| 329 |
+
1: Train model-based offline RL $\mathcal { M }$ : Update $\vartheta$ , $\varphi$ and $\mu$ using the Equation (7) and Equation (8)
|
| 330 |
+
2: for $\mathrm { t } = 1 , . . . , \mathrm { T }$ do
|
| 331 |
+
3: Sample initial states $S _ { 1 }$ from $\mathcal { D } _ { e }$
|
| 332 |
+
4: Generate the violating dataset: $\mathcal { D } _ { v } \mathcal { M }$ .generate_data $( S _ { 1 } , \hat { R } _ { 1 } , K )$
|
| 333 |
+
5: Sample set of trajectories $\{ \tau _ { e } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ and $\{ \tau _ { v } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ from $\mathcal { D } _ { e }$ and $\mathcal { D } _ { v }$
|
| 334 |
+
6: Train offline CT: Use $\{ \tau _ { e } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ and $\{ \tau _ { v } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ to update $\phi$ based on Equation (6)
|
| 335 |
+
7: Safe policy learning: Update $\pi$ using the cost function $C _ { \phi } ( \tau )$ based on Equation (1)
|
| 336 |
+
8: end for
|
| 337 |
+
|
| 338 |
+
Output: $\pi$ and $C ( \tau )$
|
| 339 |
+
|
| 340 |
+
Tasks. We primarily use the sepsis task that is commonly used in previous works [9, 20, 42, 22], and supplement some experiments on the mechanical ventilator task [23, 50]. The detailed definition of the two tasks mentioned above can be found in Appendix B.1 and B.2.
|
| 341 |
+
|
| 342 |
+
Data Extraction and Pre-processing. Our medical dataset is derived from the Medical Information Mart for Intensive Care III (MIMIC-III) database [51]. For each patient, we gather relevant physiological parameters, including demographics, lab values, vital signs, and intake/output events. Data is grouped into 4-hour windows, with each window representing a time step. In cases of multiple data points within a step, we record either the average or the sum. We eliminate variables with significant missing values and use the $k$ -nearest neighbors method to fill in the rest. Notably, the training dataset consists of data from surviving patients, while the validation set includes survivors and non-survivors.
|
| 343 |
+
|
| 344 |
+
Model-based Offline RL Evaluation. To ensure the rigor of the experiments, we evaluate the validity of the model-based offline RL, as detailed in Appendix B.3.
|
| 345 |
+
|
| 346 |
+
# 5.1 Can Offline CT Learn Effective Constraints?
|
| 347 |
+
|
| 348 |
+
In this section, we primarily assess the efficacy of the cost function learned by offline CT in sepsis, focusing particularly on its capability to evaluate patient mortality rates and capture critical events. First, we employ the cost function to compute cost values for the validation dataset. Subsequently, we statistically analyze the relationship between these cost values and mortality rates. As shown in Figure 5, there is an increase in patient mortality rates with rising cost values. It’s noteworthy that such increases in mortality rates are often attributed to suboptimal medical decisions. Therefore, these experimental findings affirm that the cost values effectively reflect the quality of medical decision-making. To observe the impact of the attention layer (non-Markovian layer), we conduct experiments by removing the attention layer from CT. The results reveal that the penalty values do not correlate proportionally with mortality rates. This indicates that the attention layer plays a crucial role in assessing constraints.
|
| 349 |
+
|
| 350 |
+

|
| 351 |
+
Figure 5: The relationship between cost and mortality.
|
| 352 |
+
|
| 353 |
+

|
| 354 |
+
Figure 6: The relationship between physiological indicators and cost values. As SOFA and lactate levels become increasingly unsafe, the cost increases. Mean BP and HR at lower values within the safe range incur a lower cost, but as they move into unsafe ranges, the cost increases, penalizing previous state-action pairs. The cost can differentiate between relatively safe and unsafe regions.
|
| 355 |
+
|
| 356 |
+
301 To assess the capability of the cost function to capture key events, we analyze the relationship
|
| 357 |
+
302 between physiological indicators and cost values. We focus on four key indicators in sepsis treatment:
|
| 358 |
+
303 Sequential Organ Failure Assessment (SOFA) score [52], lactate levels [53], Mean Arterial Pressure
|
| 359 |
+
304 (MeanBP) [54], and Heart Rate (HR) [55]. The SOFA score and lactate levels are critical indicators
|
| 360 |
+
305 for assessing sepsis severity, with higher values indicating greater patient risk. MeanBP and HR
|
| 361 |
+
306 are essential physiological metrics, typically ranging from 70 to $\boldsymbol { 1 0 0 } \ \mathrm { m m H g }$ and 60 to 100 beats,
|
| 362 |
+
307 respectively. Deviations from these ranges can signify patient risk. As depicted in Figure 6, the cost
|
| 363 |
+
308 values effectively distinguish between high-risk and safe conditions, reflecting changes in patient
|
| 364 |
+
309 status. Additional details on other parameters’ relationship with cost are in Appendix B.4.
|
| 365 |
+
|
| 366 |
+
# 5.2 Can Offline CT Improve the Performance of CRL?
|
| 367 |
+
|
| 368 |
+
Baselines. We adopt the DDPG method as the baseline in sepsis research [9], and the Double Deep Q-Learning (DDQN) and Conservative Q-Learning (CQL) methods as baselines in ventilator research [23]. Since there are no other offline inverse reinforcement learning works available for reference, we have included two additional settings: no cost and custom cost. In the case of no cost, the cost is set to zero, while the design of custom constraints is outlined in Appendix A. These settings help evaluate whether CT can infer effective constraints.
|
| 369 |
+
|
| 370 |
+
Metrics. To assess effectiveness, we use $\omega$ to indicate the probability that the policy is optimal and analyze the relationship between DIFF and mortality rate through a graph. Recently, Kondrup et al. [23] use the Fitted Q Evaluation (FQE) [56] to evaluate the policy in healthcare. However, the value estimates of FQE depend solely on the dataset $\mathcal { D }$ and the actions chosen by the policy $\pi$ used to train FQE. This reliance can lead to inaccurate estimates when evaluating unseen state-action pairs. Therefore, we do not adopt this method as an evaluation metric.
|
| 371 |
+
|
| 372 |
+
Results. We combine our method CT with common CRL algorithms (e.g., VOCE, COpiDICE, BCQ-Lag, and CDT), and compare them with both no-cost and custom cost settings. Each CRL model is trained using no cost, custom cost, and CT separately, with other parameters set the same during training. For evaluation metrics, we use IV difference (IV DIFF), vaso difference (VASO DIFF), and combined [IV, VASO] difference (ACTION DIFF) as the metrics to be ranked. We measure the mean and variance of $\omega \%$ in 10 sets of random seeds, and the results are shown in Table 2. From the results, we can conclude: (1) In different CRL methods, CT consistently makes the strategy closer to the one with lower mortality rates, with a probability $8 . 8 5 \%$ higher than DDPG. (2) We find that $\mathrm { C D T + C T }$ achieves better results on all three metrics. CDT is also a transformer-based method, which indicates that transformer-based architecture indeed exhibits more outstanding performance in healthcare.
|
| 373 |
+
|
| 374 |
+
Figure 7 illustrates the relationship between IV and VASO DIFF with mortality rates under the DDPG and $\mathrm { C D T + C T }$ methods in sepsis. In VASO DIFF, when the gap is zero, the mortality rate under $\mathrm { C D T + C T }$ is lower than that under DDPG, indicating that following the former strategy could lead to a lower mortality rate. Similarly, in IV DIFF, the same trend is observed. Notably, for the IV strategy, the lowest mortality rate for DDPG does not occur at the point where the difference is zero, indicating a significant estimation bias.
|
| 375 |
+
|
| 376 |
+
Table 2: Performance of sepsis strategies under various offline CRL models and different constraints.
|
| 377 |
+
|
| 378 |
+
<table><tr><td>w%</td><td>COST</td><td></td><td></td><td>IV DIFF↑ VASO DIFF↑ACTION DIFF↑</td></tr><tr><td>DDPG</td><td>=</td><td>50.95±1.34</td><td>51.45±0.75</td><td>51.15±1.15</td></tr><tr><td rowspan="3">VOCE</td><td>No cost</td><td>47.45±0.52</td><td>46.35±1.82</td><td>51.00±0.86</td></tr><tr><td>Custom cost</td><td>46.45±0.46</td><td>52.00±0.98</td><td>49.40±1.04</td></tr><tr><td>CT</td><td></td><td>53.33±0.94 59.04±1.13</td><td>56.15±1.08</td></tr><tr><td rowspan="3">CopiDICE</td><td>No cost</td><td>48.30±0.91</td><td>60.10±0.6</td><td>51.25±0.70</td></tr><tr><td>Custom cost</td><td>53.05±1.35</td><td>55.20±0.24</td><td>53.90±1.04</td></tr><tr><td>CT</td><td>51.95±0.41</td><td>60.85±1.08</td><td>54.60±0.60</td></tr><tr><td rowspan="3">BCQ-Lag</td><td>No cost</td><td>47.50±1.32</td><td>51.05±0.61</td><td>49.35±1.08</td></tr><tr><td>Custom cost</td><td></td><td>51.54±0.16 56.23±1.43</td><td>53.69±1.62</td></tr><tr><td>CT</td><td>52.45±1.01</td><td>55.34±1.20</td><td>54.39±0.86</td></tr><tr><td rowspan="3">CDT</td><td>No cost</td><td>56.50±0.81</td><td>62.45±1.20</td><td>58.90±1.34</td></tr><tr><td>Custom cost</td><td>54.70±1.12</td><td>59.85±1.51</td><td>57.80±1.00</td></tr><tr><td>CT</td><td>57.15±1.67</td><td>65.20±1.22</td><td>60.00±1.49</td></tr><tr><td>CDT</td><td>Without CT</td><td>56.50±0.81</td><td>62.45±1.20</td><td>58.90±1.34</td></tr><tr><td>CDT</td><td></td><td>No attention layer 55.25±1.46 64.00±1.54</td><td></td><td>57.90±0.78</td></tr><tr><td>Gemerative</td><td></td><td></td><td>55.49±2.55 56.60±1.33</td><td>57.00±2.06</td></tr></table>
|
| 379 |
+
|
| 380 |
+

|
| 381 |
+
Blue: Safe policy is closer to the optimal policy. ↑: higher is better.
|
| 382 |
+
Figure 7: The relationship between DIFF and the mortality rate in sepsis. The $\mathbf { X }$ -axis represents the DIFF. The y-axis indicates the mortality rate of patients at a given DIFF. The solid line represents the mean, while the shaded area indicates the Standard Error of the Mean (SEM).
|
| 383 |
+
|
| 384 |
+
In addition, corresponding experiments are conducted on the mechanical ventilator, as shown in Figure 8. Compared to previous methods DDQN and CQL, under the $\mathrm { C D T + C T }$ approach, a noticeable trend is observed where the proportion of mortality rates increases with increasing differences. When
|
| 385 |
+
|
| 386 |
+
360 there is a significant difference in DIFF, the results may be unreliable, possibly due to the limited data distribution in the tail.
|
| 387 |
+
|
| 388 |
+

|
| 389 |
+
Figure 8: The relationship between the DIFF of actions and mortality in mechanical ventilator. The actions mainly consist of Positive End Expiratory Pressure (PEEP) and Fraction of Inspired Oxygen (FiO2), which are crucial parameters in ventilator settings.
|
| 390 |
+
|
| 391 |
+
# 5.3 Can CRL with Offline CT Learn Safe Policies?
|
| 392 |
+
|
| 393 |
+
We have confirmed the existence of two unsafe strategy issues, namely “too high” and “sudden change” in the treatment of sepsis, particularly in vaso in Section 1. To validate whether the $\mathrm { C R L + C T }$ approach could address these concerns, we employ the same statistical methods to
|
| 394 |
+
|
| 395 |
+
Table 3: The proportion of “too high” and “sudden change” occurrences in drug dosage recommended by RL methods.
|
| 396 |
+
|
| 397 |
+
<table><tr><td>Drug dosage (μg/(𝑘g: min) Physician DDPG No cost</td><td></td><td></td><td colspan="3">CDT</td></tr><tr><td></td><td></td><td></td><td></td><td>Custom cost</td><td>CT</td></tr><tr><td>vaso > 0.75</td><td>2.27%</td><td></td><td>7.44%0.13%</td><td>0%</td><td>0%</td></tr><tr><td>vaso >0.9</td><td>1.71%</td><td></td><td>7.40%0.09%</td><td>(max = 0.00)</td><td>(max = 0.11)</td></tr><tr><td>△vaso>0.75</td><td></td><td></td><td>2.45%21.00%0.64%</td><td>0%</td><td>0%</td></tr><tr><td>△vaso >0.9</td><td></td><td></td><td></td><td></td><td>1.88% 20.62% 0.48% (max△=0.00) (max△=0.10)</td></tr></table>
|
| 398 |
+
|
| 399 |
+
evaluate our methodology, shown in Table 3. To elucidate the efficacy of CT, we compare it with CDT+No-cost and CDT $^ +$ Custom-cost approaches. We find that only the custom cost and CT methods successfully mitigated the risks associated with “too high” and “sudden change” behaviors. However, the custom cost approach opts to avoid administering drugs to mitigate these risks. Without these drugs, the patient’s condition may not be alleviated, potentially leading to patient mortality. The $\mathrm { C D T + C T }$ approach can give a more appropriate drug dosage.
|
| 400 |
+
|
| 401 |
+
Ablation Study. To investigate the impact of each component on the model’s performance, we conducted experiments by sequentially removing each component from the $\mathrm { C D T + C T }$ model. The results are presented in the lower half of Table 2. Both CT and its non-Markovian layer (attention layer) are indispensable and crucial components; removing either one results in a decrease in performance. Additionally, we observed that even a pure generative model outperforms DDPG in terms of performance. This is primarily because it inherently operates as a sequence-based reinforcement learning model, possessing exploration and consideration for long-term history. Therefore, this further underscores the effectiveness of sequence-based approaches in healthcare applications.
|
| 402 |
+
|
| 403 |
+
# 6 Conclusion
|
| 404 |
+
|
| 405 |
+
In this paper, we propose offline CT, a novel ICRL algorithm designed to address safety issues in healthcare. This method utilizes a causal attention mechanism to observe patients’ historical information, similar to the approach taken by actual doctors and employs non-Markovian importance weights to effectively capture critical states. To achieve offline learning, we introduce a model-based offline RL for exploratory data augmentation to discover unsafe decisions and train CT. Experiments in sepsis and mechanical ventilation demonstrate that our method avoids risky behaviors while achieving strategies that closely approximate the lowest mortality rates.
|
| 406 |
+
|
| 407 |
+
Limitations. There are also several limitations of offline CT: (1) Lack of rigorous theoretical analysis: We did not precisely define the types of constraint sets, thereby conducting rigorous theoretical analysis on constraint sets remains challenging; (2) Need for more computational resources: Due to the Transformer architecture, more computational resources are required; (3) Fewer evaluation metrics: There is a lack of more medical-specific evaluation metrics in the experimental evaluation section; (4) Unrealistic assumptions of expert demonstrations: we assume that expert demonstrations are optimal in both constraint satisfaction and reward maximization. However, in reality, this assumption may not always hold. Therefore, researching a more effective approach to address the aforementioned issues holds promise for the field of secure medical reinforcement learning.
|
| 408 |
+
|
| 409 |
+
References
|
| 410 |
+
[1] Stephen Petterson, Robert McNellis, Kathleen Klink, David Meyers, and Andrew Bazemore. The state of primary care in the united states: A chartbook of facts and statistics. Washington, DC: Robert Graham Center, 2018.
|
| 411 |
+
[2] Estevão Bassi, Marcelo Park, Luciano Cesar Pontes Azevedo, et al. Therapeutic strategies for high-dose vasopressor-dependent shock. Critical care research and practice, 2013, 2013.
|
| 412 |
+
[3] Thomas Auchet, Marie-Alix Regnier, Nicolas Girerd, and Bruno Levy. Outcome of patients with septic shock and high-dose vasopressor therapy. Annals of Intensive Care, 7:1–9, 2017.
|
| 413 |
+
[4] Davide Tommaso Andreis and Mervyn Singer. Catecholamines for inflammatory shock: a jekyll-and-hyde conundrum. Intensive care medicine, 42:1387–1397, 2016.
|
| 414 |
+
[5] Yan Jia, John Burden, Tom Lawton, and Ibrahim Habli. Safe reinforcement learning for sepsis treatment. In 2020 IEEE International conference on healthcare informatics (ICHI), pages 1–7. IEEE, 2020.
|
| 415 |
+
[6] Rui Shi, Olfa Hamzaoui, Nello De Vita, Xavier Monnet, and Jean-Louis Teboul. Vasopressors in septic shock: which, when, and how much? Annals of Translational Medicine, 8(12), 2020.
|
| 416 |
+
[7] Claude Martin, Sophie Medam, Francois Antonini, Julie Alingrin, Malik Haddam, Emmanuelle Hammad, Bertrand Meyssignac, Coralie Vigne, Laurent Zieleskiewicz, and Marc Leone. Norepinephrine: not too much, too long. Shock, 44(4):305–309, 2015.
|
| 417 |
+
[8] Kristin Lavigne Fadale, Denise Tucker, Jennifer Dungan, and Valerie Sabol. Improving nurses’ vasopressor titration skills and self-efficacy via simulation-based learning. Clinical Simulation in Nursing, 10(6):e291–e299, 2014.
|
| 418 |
+
[9] Yong Huang, Rui Cao, and Amir Rahmani. Reinforcement learning for sepsis treatment: A continuous action space solution. In Machine Learning for Healthcare Conference, pages 631–647. PMLR, 2022.
|
| 419 |
+
[10] Yongshuai Liu, Avishai Halev, and Xin Liu. Policy learning with constraints in model-free reinforcement learning: A survey. In The 30th International Joint Conference on Artificial Intelligence (IJCAI), 2021.
|
| 420 |
+
[11] Guiliang Liu, Yudong Luo, Ashish Gaurav, Kasra Rezaee, and Pascal Poupart. Benchmarking constraint inference in inverse reinforcement learning. arXiv preprint arXiv:2206.09670, 2022.
|
| 421 |
+
[12] Shehryar Malik, Usman Anwar, Alireza Aghasi, and Ali Ahmed. Inverse constrained reinforcement learning. In International conference on machine learning, pages 7390–7399. PMLR, 2021.
|
| 422 |
+
[13] Masaaki Kijima. Markov processes for stochastic modeling. Springer, 2013.
|
| 423 |
+
[14] Zhiyue Zhang, Hongyuan Mei, and Yanxun Xu. Continuous-time decision transformer for healthcare applications. In International Conference on Artificial Intelligence and Statistics, pages 6245–6262. PMLR, 2023.
|
| 424 |
+
[15] Catherine Plaisant, Brett Milash, Anne Rose, Seth Widoff, and Ben Shneiderman. Lifelines: visualizing personal histories. In Proceedings of the SIGCHI conference on Human factors in computing systems, pages 221–227, 1996.
|
| 425 |
+
[16] Ashish Gaurav, Kasra Rezaee, Guiliang Liu, and Pascal Poupart. Learning soft constraints from constrained expert demonstrations. arXiv preprint arXiv:2206.01311, 2022.
|
| 426 |
+
[17] Qinqing Zheng, Amy Zhang, and Aditya Grover. Online decision transformer. In international conference on machine learning, pages 27042–27059. PMLR, 2022.
|
| 427 |
+
[18] Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Misha Laskin, Pieter Abbeel, Aravind Srinivas, and Igor Mordatch. Decision transformer: Reinforcement learning via sequence modeling. Advances in neural information processing systems, 34:15084–15097, 2021.
|
| 428 |
+
|
| 429 |
+
[19] Changyeon Kim, Jongjin Park, Jinwoo Shin, Honglak Lee, Pieter Abbeel, and Kimin Lee. Preference transformer: Modeling human preferences using transformers for rl. arXiv preprint arXiv:2303.00957, 2023. [20] Aniruddh Raghu, Matthieu Komorowski, Imran Ahmed, Leo Celi, Peter Szolovits, and Marzyeh Ghassemi. Deep reinforcement learning for sepsis treatment. arXiv preprint arXiv:1711.09602, 2017. [21] Xuefeng Peng, Yi Ding, David Wihl, Omer Gottesman, Matthieu Komorowski, H Lehman Liwei, Andrew Ross, Aldo Faisal, and Finale Doshi-Velez. Improving sepsis treatment strategies by combining deep and kernel-based reinforcement learning. In AMIA Annual Symposium Proceedings, volume 2018, page 887. American Medical Informatics Association, 2018. [22] Thanh Cong Do, Hyung Jeong Yang, Seok Bong Yoo, and In-Jae Oh. Combining reinforcement learning with supervised learning for sepsis treatment. In The 9th International Conference on Smart Media and Applications, pages 219–223, 2020. [23] Flemming Kondrup, Thomas Jiralerspong, Elaine Lau, Nathan de Lara, Jacob Shkrob, My Duc Tran, Doina Precup, and Sumana Basu. Towards safe mechanical ventilation treatment using deep offline reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pages 15696–15702, 2023. [24] Wei Gong, Linxiao Cao, Yifei Zhu, Fang Zuo, Xin He, and Haoquan Zhou. Federated inverse reinforcement learning for smart icus with differential privacy. IEEE Internet of Things Journal, 2023. [25] Chao Yu, Guoqi Ren, and Yinzhao Dong. Supervised-actor-critic reinforcement learning for intelligent mechanical ventilation and sedative dosing in intensive care units. BMC medical informatics and decision making, 20:1–8, 2020. [26] Niloufar Eghbali, Tuka Alhanai, and Mohammad M Ghassemi. Patient-specific sedation management via deep reinforcement learning. Frontiers in Digital Health, 3:608893, 2021. [27] Giulia Calvi, Eleonora Manzoni, and Mirco Rampazzo. Reinforcement q-learning for closedloop hypnosis depth control in anesthesia. In 2022 30th Mediterranean Conference on Control and Automation (MED), pages 164–169. IEEE, 2022. [28] Gabriel Schamberg, Marcus Badgeley, Benyamin Meschede-Krasa, Ohyoon Kwon, and Emery N Brown. Continuous action deep reinforcement learning for propofol dosing during general anesthesia. Artificial Intelligence in Medicine, 123:102227, 2022. [29] Glen Chou, Dmitry Berenson, and Necmiye Ozay. Learning constraints from demonstrations. In Algorithmic Foundations of Robotics XIII: Proceedings of the 13th Workshop on the Algorithmic Foundations of Robotics 13, pages 228–245. Springer, 2020. [30] Daehyung Park, Michael Noseworthy, Rohan Paul, Subhro Roy, and Nicholas Roy. Inferring task goals and constraints using bayesian nonparametric inverse reinforcement learning. In Conference on robot learning, pages 1005–1014. PMLR, 2020. [31] Dexter RR Scobee and S Shankar Sastry. Maximum likelihood constraint inference for inverse reinforcement learning. arXiv preprint arXiv:1909.05477, 2019. [32] David L McPherson, Kaylene C Stocking, and S Shankar Sastry. Maximum likelihood constraint inference from stochastic demonstrations. In 2021 IEEE Conference on Control Technology and Applications (CCTA), pages 1208–1213. IEEE, 2021. 492 [33] Mattijs Baert, Pietro Mazzaglia, Sam Leroux, and Pieter Simoens. Maximum causal entropy inverse constrained reinforcement learning. arXiv preprint arXiv:2305.02857, 2023. [34] Brian D Ziebart, J Andrew Bagnell, and Anind K Dey. Modeling interaction via the principle of maximum causal entropy. 2010. [35] Guanren Qiao, Guiliang Liu, Pascal Poupart, and Zhiqiang Xu. Multi-modal inverse constrained reinforcement learning from a mixture of demonstrations. Advances in Neural Information Processing Systems, 36, 2024.
|
| 430 |
+
|
| 431 |
+
[36] Sheng Xu and Guiliang Liu. Uncertainty-aware constraint inference in inverse constrained reinforcement learning. In The Twelfth International Conference on Learning Representations, 2023.
|
| 432 |
+
502 [37] Michael Janner, Qiyang Li, and Sergey Levine. Offline reinforcement learning as one big sequence modeling problem. Advances in neural information processing systems, 34:1273– 1286, 2021. [38] Zuxin Liu, Zijian Guo, Yihang Yao, Zhepeng Cen, Wenhao Yu, Tingnan Zhang, and Ding Zhao. Constrained decision transformer for offline safe reinforcement learning. arXiv preprint arXiv:2302.07351, 2023. [39] Eitan Altman. Constrained markov decision processes with total cost criteria: Lagrangian approach and dual linear program. Mathematical methods of operations research, 48:387–417, 1998. [40] Aniruddh Raghu, Matthieu Komorowski, Leo Anthony Celi, Peter Szolovits, and Marzyeh Ghassemi. Continuous state-space models for optimal sepsis treatment: a deep reinforcement learning approach. In Machine Learning for Healthcare Conference, pages 147–163. PMLR, 2017.
|
| 433 |
+
515 [41] Mehdi Fatemi, Taylor W Killian, Jayakumar Subramanian, and Marzyeh Ghassemi. Medical dead-ends and learning to identify high-risk states and treatments. Advances in Neural Information Processing Systems, 34:4856–4870, 2021.
|
| 434 |
+
518 [42] Matthieu Komorowski, Leo A Celi, Omar Badawi, Anthony C Gordon, and A Aldo Faisal. The artificial intelligence clinician learns optimal treatment strategies for sepsis in intensive care. Nature medicine, 24(11):1716–1720, 2018. [43] Jongmin Lee, Cosmin Paduraru, Daniel J Mankowitz, Nicolas Heess, Doina Precup, Kee-Eung Kim, and Arthur Guez. Coptidice: Offline constrained reinforcement learning via stationary distribution correction estimation. arXiv preprint arXiv:2204.08957, 2022.
|
| 435 |
+
524 [44] Jiayi Guan, Guang Chen, Jiaming Ji, Long Yang, Zhijun Li, et al. Voce: Variational optimization with conservative estimation for offline safe reinforcement learning. Advances in Neural Information Processing Systems, 36, 2024.
|
| 436 |
+
527 [45] Yongju Kim, Hyung Keun Park, Jaimyun Jung, Peyman Asghari-Rad, Seungchul Lee, Jin You Kim, Hwan Gyo Jung, and Hyoung Seop Kim. Exploration of optimal microstructure and mechanical properties in continuous microstructure space using a variational autoencoder. Materials & Design, 202:109544, 2021. [46] Tim Hsu, William K Epting, Hokon Kim, Harry W Abernathy, Gregory A Hackett, Anthony D Rollett, Paul A Salvador, and Elizabeth A Holm. Microstructure generation via generative adversarial network for heterogeneous, topologically complex 3d materials. Jom, 73:90–102, 2021. [47] Akshay Iyer, Biswadip Dey, Arindam Dasgupta, Wei Chen, and Amit Chakraborty. A conditional generative model for predicting material microstructures from processing methods. arXiv preprint arXiv:1910.02133, 2019. [48] Florinel-Alin Croitoru, Vlad Hondru, Radu Tudor Ionescu, and Mubarak Shah. Diffusion models in vision: A survey. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2023. [49] Christian Düreth, Paul Seibert, Dennis Rücker, Stephanie Handford, Markus Kästner, and Maik Gude. Conditional diffusion-based microstructure reconstruction. Materials Today Communications, 35:105608, 2023. [50] Arne Peine, Ahmed Hallawa, Johannes Bickenbach, Guido Dartmann, Lejla Begic Fazlic, Anke Schmeink, Gerd Ascheid, Christoph Thiemermann, Andreas Schuppert, Ryan Kindle, et al. Development and validation of a reinforcement learning algorithm to dynamically optimize mechanical ventilation in critical care. NPJ digital medicine, 4(1):32, 2021.
|
| 437 |
+
|
| 438 |
+
548 [51] Alistair EW Johnson, Tom J Pollard, Lu Shen, Li-wei H Lehman, Mengling Feng, Mohammad
|
| 439 |
+
549 Ghassemi, Benjamin Moody, Peter Szolovits, Leo Anthony Celi, and Roger G Mark. Mimic-iii,
|
| 440 |
+
550 a freely accessible critical care database. Scientific data, 3(1):1–9, 2016.
|
| 441 |
+
551 [52] Yonglin Li, Chunjiang Yan, Ziyan Gan, Xiaotu Xi, Zhanpeng Tan, Jun Li, and Guowei Li.
|
| 442 |
+
552 Prognostic values of sofa score, qsofa score, and lods score for patients with sepsis. Annals of
|
| 443 |
+
553 palliative medicine, 9(3):1037044–1031044, 2020.
|
| 444 |
+
554 [53] Seung Mok Ryoo, JungBok Lee, Yoon-Seon Lee, Jae Ho Lee, Kyoung Soo Lim, Jin Won
|
| 445 |
+
555 Huh, Sang-Bum Hong, Chae-Man Lim, Younsuck Koh, and Won Young Kim. Lactate level
|
| 446 |
+
556 versus lactate clearance for predicting mortality in patients with septic shock defined by sepsis-3.
|
| 447 |
+
557 Critical care medicine, 46(6):e489–e495, 2018.
|
| 448 |
+
558 [54] Nishant Raj Pandey, Yu-yao Bian, and Song-tao Shou. Significance of blood pressure variability
|
| 449 |
+
559 in patients with sepsis. World journal of emergency medicine, 5(1):42, 2014.
|
| 450 |
+
560 [55] Marta Carrara, Bernardo Bollen Pinto, Giuseppe Baselli, Karim Bendjelid, and Manuela Ferrario.
|
| 451 |
+
561 Baroreflex sensitivity and blood pressure variability can help in understanding the different
|
| 452 |
+
562 response to therapy during acute phase of septic shock. Shock, 50(1):78–86, 2018.
|
| 453 |
+
563 [56] Hoang Le, Cameron Voloshin, and Yisong Yue. Batch policy learning under constraints. In
|
| 454 |
+
564 International Conference on Machine Learning, pages 3703–3712. PMLR, 2019.
|
| 455 |
+
565 [57] Mervyn Singer, Clifford S Deutschman, Christopher Warren Seymour, Manu Shankar-Hari,
|
| 456 |
+
566 Djillali Annane, Michael Bauer, Rinaldo Bellomo, Gordon R Bernard, Jean-Daniel Chiche,
|
| 457 |
+
567 Craig M Coopersmith, et al. The third international consensus definitions for sepsis and septic
|
| 458 |
+
568 shock (sepsis-3). Jama, 315(8):801–810, 2016.
|
| 459 |
+
569 [58] Flavio Lopes Ferreira, Daliana Peres Bota, Annette Bross, Christian Mélot, and Jean-Louis
|
| 460 |
+
570 Vincent. Serial evaluation of the sofa score to predict outcome in critically ill patients. Jama,
|
| 461 |
+
571 286(14):1754–1758, 2001.
|
| 462 |
+
573 We base our design on prior knowledge that intravenous (IV) intake exceeding $2 0 0 0 m L / 4 h$ or
|
| 463 |
+
574 vasopressor (Vaso) dosage surpassing $1 g / ( k g \cdot m i n )$ is generally considered unsafe in sepsis treatment
|
| 464 |
+
575 [6]. To design a reasonable constraint function, we refer to the constraint function designed by Liu et
|
| 465 |
+
576 al. in the Bullet safety gym environments[38]. We define the cost function as shown in Equation 9.
|
| 466 |
+
577 Thus, during the treatment of sepsis, if the agent exceeds the maximum dosage thresholds of the two
|
| 467 |
+
578 medications, it incurs a cost due to constraint violation.
|
| 468 |
+
|
| 469 |
+
$$
|
| 470 |
+
c \left( s , a \right) = \mathbf { 1 } \left( a _ { I V } > a _ { I V \operatorname* { m a x } } \right) + \mathbf { 1 } \left( a _ { V a s o } > a _ { V a s o \operatorname* { m a x } } \right)
|
| 471 |
+
$$
|
| 472 |
+
|
| 473 |
+
579 where, $s$ and $a$ represent the patient’s state and action, respectively. $a _ { I V \mathrm { \ m a x } } = 2 0 0 0$ indicates that
|
| 474 |
+
580 the maximum fluid intake through IV is $2 0 0 0 m L$ , and $a _ { V a s o \ m a x } = 1$ signifies that the maximum
|
| 475 |
+
581 Vaso dosage is $1 \mu g / ( k g \cdot m i n )$ .
|
| 476 |
+
582 We applied our custom constraint function in the CDT [38] method, and the results are shown in
|
| 477 |
+
583 Figure 9. Compared to the Vaso dosage recommended by doctors, our strategy exhibits excessive
|
| 478 |
+
584 suppression of the Vaso. The maximum dosage of Vaso is $0 . 0 0 1 1 \mu g / ( k g \cdot m i n )$ , which is minimal
|
| 479 |
+
585 and insufficient to provide the patient with effective therapeutic effects.
|
| 480 |
+
586 Therefore, Equation 9 is not suitable. The primary issues may include uniform constraint strength
|
| 481 |
+
587 for excessive drug dosages, for instance, the cost for IV exceeding $\mathrm { 2 0 0 0 ~ m L }$ and IV exceeding
|
| 482 |
+
588 $\mathrm { 3 0 0 0 ~ m L }$ is the same at 1; lack of generalization, where the constraint cost does not vary with the
|
| 483 |
+
589 ou patient’s tolerance. If a patient has an intolerance to VASO, the maximum value for VASO maybe 0,d—Policy 2
|
| 484 |
+
590 which cannot be captured by the self-imposed constraint function. Moreover, it lacks generalization,
|
| 485 |
+
591 requiring redesign of the constraint function when addressing other unsafe medical issues; and it’s
|
| 486 |
+
essential to ensure the correctness of the underlying medical knowledge premises.constraint function to express general unsafe behaviors.
|
| 487 |
+
|
| 488 |
+

|
| 489 |
+
Figure 9: Drug dosage distribution under custom constraint functions in sepsis.
|
| 490 |
+
|
| 491 |
+
# 93 B Experiment Supplement
|
| 492 |
+
|
| 493 |
+
# B.1 Sepsis Problem Define
|
| 494 |
+
|
| 495 |
+
Our definition is similar to [40]. We extract data from adult patients meeting the criteria for sepsis-3 criteria [57] and collect their data within the first 72 hours of admission.
|
| 496 |
+
|
| 497 |
+
State Space. We use a 4-hour window and select 48 patient indicators as the state for a one-time unit of the patient. The state indicators include Demographics/Static, Lab Values, Vital Signs, and Intake and Output Events, detailed as follows [40]:
|
| 498 |
+
|
| 499 |
+
• Demographics/Static: Shock Index, Elixhauser, SIRS, Gender, Re-admission, GCS - Glasgow Coma Scale, SOFA - Sequential Organ Failure Assessment, Age
|
| 500 |
+
|
| 501 |
+
• Lab Values Albumin: Arterial pH, Calcium, Glucose, Hemoglobin, Magnesium, PTT - Partial Thromboplastin Time, Potassium, SGPT - Serum Glutamic-Pyruvic Transaminase, Arterial Blood Gas, BUN Blood Urea Nitrogen, Chloride, Bicarbonate, INR - International Normalized Ratio, Sodium, Arterial Lactate, CO2, Creatinine, Ionised Calcium, PT - Prothrombin Time, Platelets Count, SGOT Serum Glutamic-Oxaloacetic Transaminase, Total bilirubin, White Blood Cell Count
|
| 502 |
+
• Vital Signs: Diastolic Blood Pressure, Systolic Blood Pressure, Mean Blood Pressure, PaCO2, PaO2, FiO2, PaO/FiO2 ratio, Respiratory Rate, Temperature (Celsius), Weight $( \bf k g )$ , Heart Rate, SpO2
|
| 503 |
+
• Intake and Output Events: Fluid Output - 4 hourly period, Total Fluid Output, Mechanical Ventilation
|
| 504 |
+
|
| 505 |
+
613 Action Space. Regarding the treatment of sepsis, there are two main types of medications: in
|
| 506 |
+
614 travenous fluids and vasopressors. We select the total amount of intravenous fluids for each time
|
| 507 |
+
615 unit and the maximum dose of vasopressors as the two dimensions of the action space, defined as
|
| 508 |
+
616 (sum(IV), max (Vaso)). Each dimension is a continuous value greater than 0.
|
| 509 |
+
|
| 510 |
+
617 Reward Function. We refer to the reward function used in [9], as shown in the following equation:
|
| 511 |
+
|
| 512 |
+
$$
|
| 513 |
+
r ( s _ { t } , s _ { t + 1 } ) = \lambda _ { 1 } \operatorname { t a n h } ( s _ { t } ^ { \mathrm { S O F A } } - 6 ) + \lambda _ { 2 } ( s _ { t + 1 } ^ { \mathrm { S O F A } } - s _ { t } ^ { \mathrm { S O F A } } ) )
|
| 514 |
+
$$
|
| 515 |
+
|
| 516 |
+
618 Where $\lambda _ { 0 }$ and $\lambda _ { 1 }$ are hyperparameters set to $- 0 . 2 5$ and $- 0 . 2$ , respectively. This reward function is
|
| 517 |
+
619 designed based on the SOFA score, as it is a key indicator of the health status for sepsis patients and
|
| 518 |
+
620 widely used in clinical settings. The formula describes a penalty when the SOFA score increases and
|
| 519 |
+
621 a reward when the SOFA score decreases. We set 6 as the cutoff value because the mortality rate
|
| 520 |
+
622 sharply increases when the SOFA score exceeds 6 [58].
|
| 521 |
+
|
| 522 |
+
# B.2 Mechanical Ventilation Treatment Problem Define
|
| 523 |
+
|
| 524 |
+
The RL problem definition for Mechanical Ventilation Treatment is referenced from [23].
|
| 525 |
+
|
| 526 |
+
# State Space.
|
| 527 |
+
|
| 528 |
+
• Demographics/Static: Elixhauser, SIRS, Gender, Re-admission, GCS, SOFA, Age
|
| 529 |
+
• Lab Values Albumin: Arterial pH, Glucose, Hemoglobin, Magnesium, PTT, BUN Blood Urea Nitrogen, Chloride, Bicarbonate, INR, Sodium, Arterial Lactate, CO2, Creatinine, Ionised Calcium, PT, Platelets Count, White Blood Cell Count, Hb
|
| 530 |
+
• Vital Signs: Diastolic Blood Pressure, Systolic Blood Pressure, Mean Blood Pressure, Temperature, Weight (kg), Heart Rate, SpO2
|
| 531 |
+
• Intake and Output Events: Urine output, vasopressors, intravenous fluids, cumulative fluid balance
|
| 532 |
+
|
| 533 |
+
634 Action Space. The action space mainly consists of Positive End Expiratory Pressure (PEEP) and 635 Fraction of Inspired Oxygen (FiO2), which are crucial parameters in ventilator settings. Here, we 636 consider a discrete space configuration, with each parameter divided into 7 intervals. Therefore, our action space is $7 \times 7$ , depicted as 4.
|
| 534 |
+
|
| 535 |
+
Table 4: The action space of the mechanical ventilator.
|
| 536 |
+
|
| 537 |
+
<table><tr><td>Action</td><td>0</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td></tr><tr><td>PEEP(cmH20)</td><td>0-5</td><td>5-7</td><td>7-9</td><td>9-11</td><td>11-13</td><td>13-15</td><td>>15</td></tr><tr><td>FiO2(Percentage(%))</td><td>25-30</td><td>30-35</td><td>35-40</td><td>40-45</td><td>45-50</td><td>50-55</td><td>>55</td></tr></table>
|
| 538 |
+
|
| 539 |
+
638 Reward Function. The primary objective of setting respiratory parameters is to ensure the patient’s
|
| 540 |
+
639 survival. We adopt the same reward function design as the work [23], defined as Equation 11. This
|
| 541 |
+
640 reward function first considers the terminal reward: if the patient dies, the reward $r$ is set to $- 1$ ;
|
| 542 |
+
641 otherwise, it is $+ 1$ in the terminal state. Additionally, to provide more frequent rewards, intermediate
|
| 543 |
+
642 rewards are considered. Intermediate rewards mainly focus on the Apache II score, which evaluates
|
| 544 |
+
643 various parameters to describe the patient’s health status. This reward function utilizes the increase or
|
| 545 |
+
644 decrease in this score to reward the agent.
|
| 546 |
+
|
| 547 |
+
$$
|
| 548 |
+
r \left( s _ { t } , a _ { t } , s _ { t + 1 } \right) = { \left\{ \begin{array} { l l } { + 1 } & { { \mathrm { ~ i f ~ } } t = T { \mathrm { ~ a n d ~ } } m _ { t } = 1 } \\ { - 1 } & { { \mathrm { ~ i f ~ } } t = T { \mathrm { ~ a n d ~ } } m _ { t } = 0 } \\ { { \frac { \left( A _ { t + 1 } - A _ { t } \right) } { \operatorname* { m a x } _ { A } - \operatorname* { m i n } _ { A } } } } & { { \mathrm { ~ o t h e r w i s e } } } \end{array} \right. }
|
| 549 |
+
$$
|
| 550 |
+
|
| 551 |
+
645 In Equation 11, $T$ represents the length of the patient’s trajectory, $m$ indicates whether the patient
|
| 552 |
+
646 ultimately dies, $A$ denotes the Apache $\mathrm { I I }$ score, and $\operatorname* { m a x } _ { A }$ and $\operatorname* { m i n } _ { A }$ respectively denote the maximum
|
| 553 |
+
647 and minimum values.
|
| 554 |
+
|
| 555 |
+
# B.3 The Evaluation of Model-based Offline RL
|
| 556 |
+
|
| 557 |
+
Generating data within a reasonable range. To validate model-based offline RL, we first check whether the values it produces fall within the legal range. The results are depicted in Figure 10. After analyzing the generated data, we find that the majority of state values have a probability of over $9 9 \%$ of being within the legal range. A few values related to gender and re-admission range between $6 0 \%$ and $7 0 \%$ . This could be due to these two indicators having limited correlation with other metrics, making them more challenging for the model to assess.
|
| 558 |
+
|
| 559 |
+

|
| 560 |
+
Figure 10: The accuracy of predicting different state values within the legal range.
|
| 561 |
+
|
| 562 |
+

|
| 563 |
+
Figure 11: The relationship between average prediction error and trajectory length.
|
| 564 |
+
|
| 565 |
+
Generating violating data. In addition, we evaluate the violating actions generated by the model, as shown in Figure 12. When compared with expert strategies and penalty distributions, we find that the actions generated by the model mostly fall within the legal range. However, it occasionally produces behaviors that are inappropriate for the current state, constituting violating data. This indicates that our generative model can produce legally violating data.
|
| 566 |
+
|
| 567 |
+

|
| 568 |
+
Figure 12: The distribution and penalty values of violating data and expert data.
|
| 569 |
+
|
| 570 |
+
660 The length of a trajectory. Regarding the selection of trajectory length, we consider the relationship
|
| 571 |
+
661 between the average prediction error, the error of the last point in the trajectory, and the trajectory
|
| 572 |
+
662 length. We use the model-based offline RL to generate trajectories and compare them with expert
|
| 573 |
+
663 data using the Euclidean distance to measure their differences. We evaluate the average error and
|
| 574 |
+
664 the error of the last point in the trajectory, as shown in Figure 11. We observe that with an increase
|
| 575 |
+
665 in trajectory length, the average prediction error at each time step decreases, while the state error
|
| 576 |
+
666 stabilizes. Taking into account the observation length and prediction accuracy, we ultimately choose
|
| 577 |
+
667 to generate trajectories with lengths ranging from 10 to 15.
|
| 578 |
+
|
| 579 |
+
# 668 B.4 The Evaluation of Cost function in Sepsis
|
| 580 |
+
|
| 581 |
+
To validate that the CT method captures key states, we conduct statistical analysis on the relationship between state values and penalty values. We collect penalty values under different state values for all patients, and the complete information is shown in Figure 13. We find that the CT method successfully captures unsafe states and imposes higher penalties accordingly. The safe range of state values is shown in Table 5.
|
| 582 |
+
|
| 583 |
+
To validate the role of the attention layer in capturing states in CT, we conducted tests, and the experimental results are presented in Figure 14 and 13. We found that the attention layer plays a crucial role in state capture. For instance, in the case of an increase in the SOFA score, without the attention layer, this increase cannot be captured, while with the attention layer, it clearly captures the change. Thus, this indicates that SOFA, as a key diagnostic indicator of sepsis, with the help of the attention layer, CT can accurately capture its changes.
|
| 584 |
+
|
| 585 |
+
Table 5: State indicators and their normal ranges.
|
| 586 |
+
|
| 587 |
+
<table><tr><td>Indicator</td><td>Safe Range</td><td>Indicator</td><td>Safe Range</td><td>Indicator</td><td>Safe Range</td></tr><tr><td>Albumin</td><td>3.5~5.1</td><td>HCO3</td><td>25~40</td><td>SGOT</td><td>0~40</td></tr><tr><td>Arterial_BE</td><td>-3~+3</td><td>Glucose</td><td>70~140</td><td>SGPT</td><td>0~40</td></tr><tr><td>Arterial_lactate</td><td>0.5~1.7</td><td>HR</td><td>60~100</td><td>SIRS</td><td>√</td></tr><tr><td>Arterial_PH</td><td>7.35~7.45</td><td>Hb</td><td>12~16</td><td>SOFA</td><td>√</td></tr><tr><td>BUN</td><td>7~22</td><td>INR</td><td>0.8~1.5</td><td>Shock_Index</td><td>√</td></tr><tr><td>CO2_mEqL</td><td>20~34</td><td>MeanBP</td><td>70~100</td><td>Sodium</td><td>135~145</td></tr><tr><td>Calcium</td><td>8.6~10.6</td><td>PT</td><td>11~13</td><td>SpO2</td><td>95~99</td></tr><tr><td>Chloride</td><td>96~106</td><td>PTT</td><td>23~37</td><td>SysBP</td><td>90~139</td></tr><tr><td>Creatinine</td><td>0.5~1.5</td><td>PaO2_FiO2</td><td>400~500</td><td>Temp_C</td><td>36.0~37.0</td></tr><tr><td>DiaBP</td><td>60~89</td><td>Platelets_count</td><td>125~350</td><td>WBC_count</td><td>4~10</td></tr><tr><td>FiO2</td><td>0.5~0.6</td><td>Potassium</td><td>4.1~5.6</td><td>PaCO2</td><td>35~45</td></tr><tr><td>GCS</td><td>个</td><td>RR</td><td>12~20</td><td>PaO2</td><td>80~100</td></tr></table>
|
| 588 |
+
|
| 589 |
+
$\uparrow$ indicates higher values are more normal, while $\downarrow$ indicates lower values are more normal. The maximum value for GCS is 15. The minimum value for SIRS, SOFA, and Shock_Index is 0.
|
| 590 |
+
|
| 591 |
+
# B.5 Experimental Settings
|
| 592 |
+
|
| 593 |
+
To train the $\mathrm { C R L + C T }$ model, we use a total of 3 NVIDIA GeForce RTX 3090 GPUs, each with 24GB of memory. Training a $\mathrm { C R L + C T }$ model typically takes 5-6 hours. We employ 5 random seeds for validation. We use the Adam optimization algorithm to optimize all our networks, updating the learning rate using a decay factor parameterization at each iteration. The main hyperparameters are summarized in Table 6 and 7.
|
| 594 |
+
|
| 595 |
+

|
| 596 |
+
Figure 13: The relationship between all states and cost values
|
| 597 |
+
|
| 598 |
+

|
| 599 |
+
Figure 14: The performance contrast between CT with and without an attention layer. The blue line represents the absence of an attention layer, while the green line indicates the presence of an attention layer.
|
| 600 |
+
|
| 601 |
+
Table 6: List of the utilized hyperparameters in CT.
|
| 602 |
+
|
| 603 |
+
<table><tr><td>Offline CTParameters</td><td>values</td></tr><tr><td>Genetivate Model</td><td></td></tr><tr><td>Embedding_dim</td><td>128</td></tr><tr><td>Layer</td><td>3</td></tr><tr><td>Head</td><td>8</td></tr><tr><td>Learning rate</td><td>1e-4</td></tr><tr><td>Pre-train steps</td><td>5000</td></tr><tr><td>Batch size</td><td>256</td></tr><tr><td>CT</td><td></td></tr><tr><td>Embedding_dim</td><td>64</td></tr><tr><td>Layer</td><td>3</td></tr><tr><td>Head</td><td>1</td></tr><tr><td>Learning rate</td><td>1e-6</td></tr><tr><td>Update steps</td><td>30000</td></tr><tr><td>Batch size</td><td>512</td></tr><tr><td>CDT</td><td></td></tr><tr><td>Learning rate</td><td>1e-4</td></tr><tr><td>Embedding_dim</td><td>128</td></tr><tr><td>Layers</td><td>3</td></tr><tr><td>Heads</td><td>8</td></tr><tr><td>Update steps</td><td>60000</td></tr></table>
|
| 604 |
+
|
| 605 |
+
Table 7: List of the utilized hyperparameters in CRL.
|
| 606 |
+
|
| 607 |
+
<table><tr><td>Parameters</td><td>Sepsis</td><td>Parameters</td><td>Mechanical Ventilation</td></tr><tr><td>General</td><td></td><td>General</td><td></td></tr><tr><td>Expert data patient number</td><td>14313</td><td>Expert data patient number</td><td>13846</td></tr><tr><td>Validation data patient number</td><td>6275</td><td>Validation data patient number</td><td>5954</td></tr><tr><td>Max Length</td><td>10</td><td>Max Length</td><td>10</td></tr><tr><td>Action_dim</td><td>2</td><td>Action_dim</td><td>2</td></tr><tr><td>State_dim</td><td>48</td><td>State_dim</td><td>36</td></tr><tr><td>Gamma</td><td>0.99</td><td>Gamma</td><td>0.99</td></tr><tr><td>DDPG</td><td></td><td>DDQN</td><td></td></tr><tr><td>Learning rate</td><td>1e-3</td><td>Learning rate</td><td>1e-4</td></tr><tr><td>Policy Network</td><td>256,256</td><td>Policy Network</td><td>64,64</td></tr><tr><td>Replay memory size</td><td>20000</td><td>Update steps</td><td>500000</td></tr><tr><td>Update steps</td><td>20000</td><td></td><td></td></tr><tr><td>VOCE</td><td></td><td>CQL</td><td></td></tr><tr><td>Learning rate</td><td>1e-3</td><td>Learning rate</td><td>1e-4</td></tr><tr><td>Policy Network</td><td>256,256</td><td>Policy Network</td><td>64,64</td></tr><tr><td>Alpha scale</td><td>10</td><td>Update steps</td><td>500000</td></tr><tr><td>KL constraint</td><td>0.01</td><td>Alphas</td><td>0.05,0.1,0.5,1,2</td></tr><tr><td>Dual constraint</td><td>0.1</td><td></td><td></td></tr><tr><td>Update steps</td><td>4000</td><td></td><td></td></tr><tr><td>CopiDICE</td><td></td><td></td><td></td></tr><tr><td>Learning rate</td><td>1e-4</td><td></td><td></td></tr><tr><td>Policy Network</td><td>256,256</td><td></td><td></td></tr><tr><td>Alpha</td><td>0.5</td><td></td><td></td></tr><tr><td>Cost limit</td><td>10</td><td></td><td></td></tr><tr><td>Update steps</td><td>100000</td><td></td><td></td></tr><tr><td>BCQ-Lag</td><td></td><td></td><td></td></tr><tr><td>Learning rate</td><td>1e-3</td><td></td><td></td></tr><tr><td>Policy Network</td><td>256,256</td><td></td><td></td></tr><tr><td>Cost limit</td><td>10</td><td></td><td></td></tr><tr><td>Lambda</td><td>0.75</td><td></td><td></td></tr><tr><td>Beta</td><td>0.5</td><td></td><td></td></tr><tr><td>Update steps</td><td>100000</td><td></td><td></td></tr></table>
|
| 608 |
+
|
| 609 |
+
# 686 NeurIPS Paper Checklist
|
| 610 |
+
|
| 611 |
+
# 1. Claims
|
| 612 |
+
|
| 613 |
+
Question: Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
|
| 614 |
+
|
| 615 |
+
Answer: [Yes]
|
| 616 |
+
|
| 617 |
+
Justification: In the abstract and introduction, we delineate the main motivations and contributions of this paper and its application in the field of safe reinforcement learning in healthcare.
|
| 618 |
+
|
| 619 |
+
Guidelines:
|
| 620 |
+
|
| 621 |
+
• The answer NA means that the abstract and introduction do not include the claims made in the paper.
|
| 622 |
+
• The abstract and/or introduction should clearly state the claims made, including the contributions made in the paper and important assumptions and limitations. A No or NA answer to this question will not be perceived well by the reviewers.
|
| 623 |
+
• The claims made should match theoretical and experimental results, and reflect how much the results can be expected to generalize to other settings.
|
| 624 |
+
• It is fine to include aspirational goals as motivation as long as it is clear that these goals are not attained by the paper.
|
| 625 |
+
|
| 626 |
+
# 2. Limitations
|
| 627 |
+
|
| 628 |
+
Question: Does the paper discuss the limitations of the work performed by the authors?
|
| 629 |
+
|
| 630 |
+
Answer: [Yes]
|
| 631 |
+
|
| 632 |
+
Justification: In the final section, this paper discusses the limitations of the method.
|
| 633 |
+
|
| 634 |
+
Guidelines:
|
| 635 |
+
|
| 636 |
+
• The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those are not discussed in the paper.
|
| 637 |
+
• The authors are encouraged to create a separate "Limitations" section in their paper.
|
| 638 |
+
• The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification, asymptotic approximations only holding locally). The authors should reflect on how these assumptions might be violated in practice and what the implications would be.
|
| 639 |
+
• The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on a few datasets or with a few runs. In general, empirical results often depend on implicit assumptions, which should be articulated.
|
| 640 |
+
The authors should reflect on the factors that influence the performance of the approach. For example, a facial recognition algorithm may perform poorly when image resolution is low or images are taken in low lighting. Or a speech-to-text system might not be used reliably to provide closed captions for online lectures because it fails to handle technical jargon.
|
| 641 |
+
• The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size.
|
| 642 |
+
• If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness.
|
| 643 |
+
• While the authors might fear that complete honesty about limitations might be used by reviewers as grounds for rejection, a worse outcome might be that reviewers discover limitations that aren’t acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play an important role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations.
|
| 644 |
+
|
| 645 |
+
# 3. Theory Assumptions and Proofs
|
| 646 |
+
|
| 647 |
+
Question: For each theoretical result, does the paper provide the full set of assumptions and a complete (and correct) proof?
|
| 648 |
+
|
| 649 |
+
Answer: [Yes]
|
| 650 |
+
|
| 651 |
+
Justification: We have documented the relevant theories and assumptions in the paper or supplementary materials.
|
| 652 |
+
|
| 653 |
+
Guidelines:
|
| 654 |
+
|
| 655 |
+
• The answer NA means that the paper does not include theoretical results.
|
| 656 |
+
• All the theorems, formulas, and proofs in the paper should be numbered and crossreferenced.
|
| 657 |
+
• All assumptions should be clearly stated or referenced in the statement of any theorems.
|
| 658 |
+
• The proofs can either appear in the main paper or the supplemental material, but if they appear in the supplemental material, the authors are encouraged to provide a short proof sketch to provide intuition.
|
| 659 |
+
• Inversely, any informal proof provided in the core of the paper should be complemented by formal proofs provided in appendix or supplemental material.
|
| 660 |
+
• Theorems and Lemmas that the proof relies upon should be properly referenced.
|
| 661 |
+
|
| 662 |
+
# 4. Experimental Result Reproducibility
|
| 663 |
+
|
| 664 |
+
Question: Does the paper fully disclose all the information needed to reproduce the main experimental results of the paper to the extent that it affects the main claims and/or conclusions of the paper (regardless of whether the code and data are provided or not)?
|
| 665 |
+
|
| 666 |
+
Answer: [Yes]
|
| 667 |
+
|
| 668 |
+
Justification: Our approach is reproducible, and our code can be made publicly available after the paper is published, including the relevant data processing procedures.
|
| 669 |
+
|
| 670 |
+
Guidelines:
|
| 671 |
+
|
| 672 |
+
• The answer NA means that the paper does not include experiments.
|
| 673 |
+
• If the paper includes experiments, a No answer to this question will not be perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not.
|
| 674 |
+
• If the contribution is a dataset and/or model, the authors should describe the steps taken to make their results reproducible or verifiable.
|
| 675 |
+
Depending on the contribution, reproducibility can be accomplished in various ways. For example, if the contribution is a novel architecture, describing the architecture fully might suffice, or if the contribution is a specific model and empirical evaluation, it may be necessary to either make it possible for others to replicate the model with the same dataset, or provide access to the model. In general. releasing code and data is often one good way to accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g., in the case of a large language model), releasing of a model checkpoint, or other means that are appropriate to the research performed. While NeurIPS does not require releasing code, the conference does require all submissions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. For example (a) If the contribution is primarily a new algorithm, the paper should make it clear how to reproduce that algorithm. (b) If the contribution is primarily a new model architecture, the paper should describe the architecture clearly and fully. (c) If the contribution is a new model (e.g., a large language model), then there should either be a way to access this model for reproducing the results or a way to reproduce the model (e.g., with an open-source dataset or instructions for how to construct the dataset). (d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome to describe the particular way they provide for reproducibility. In the case of closed-source models, it may be that access to the model is limited in some way (e.g., to registered users), but it should be possible for other researchers to have some path to reproducing or verifying the results.
|
| 676 |
+
|
| 677 |
+
# 5. Open access to data and code
|
| 678 |
+
|
| 679 |
+
Question: Does the paper provide open access to the data and code, with sufficient instructions to faithfully reproduce the main experimental results, as described in supplemental material?
|
| 680 |
+
|
| 681 |
+
Answer: [Yes]
|
| 682 |
+
|
| 683 |
+
Justification: Our code can be made publicly available after the paper is published.
|
| 684 |
+
|
| 685 |
+
Guidelines:
|
| 686 |
+
|
| 687 |
+
• The answer NA means that paper does not include experiments requiring code.
|
| 688 |
+
• Please see the NeurIPS code and data submission guidelines (https://nips.cc/ public/guides/CodeSubmissionPolicy) for more details.
|
| 689 |
+
• While we encourage the release of code and data, we understand that this might not be possible, so “No” is an acceptable answer. Papers cannot be rejected simply for not including code, unless this is central to the contribution (e.g., for a new open-source benchmark).
|
| 690 |
+
• The instructions should contain the exact command and environment needed to run to reproduce the results. See the NeurIPS code and data submission guidelines (https: //nips.cc/public/guides/CodeSubmissionPolicy) for more details.
|
| 691 |
+
• The authors should provide instructions on data access and preparation, including how to access the raw data, preprocessed data, intermediate data, and generated data, etc.
|
| 692 |
+
• The authors should provide scripts to reproduce all experimental results for the new proposed method and baselines. If only a subset of experiments are reproducible, they should state which ones are omitted from the script and why.
|
| 693 |
+
• At submission time, to preserve anonymity, the authors should release anonymized versions (if applicable).
|
| 694 |
+
• Providing as much information as possible in supplemental material (appended to the paper) is recommended, but including URLs to data and code is permitted.
|
| 695 |
+
|
| 696 |
+
# 6. Experimental Setting/Details
|
| 697 |
+
|
| 698 |
+
Question: Does the paper specify all the training and test details (e.g., data splits, hyperparameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?
|
| 699 |
+
|
| 700 |
+
Answer: [Yes]
|
| 701 |
+
|
| 702 |
+
Justification: We provided a detailed description of the experimental setup and metrics.
|
| 703 |
+
|
| 704 |
+
Guidelines:
|
| 705 |
+
|
| 706 |
+
• The answer NA means that the paper does not include experiments. • The experimental setting should be presented in the core of the paper to a level of detail that is necessary to appreciate the results and make sense of them. • The full details can be provided either with the code, in appendix, or as supplemental material.
|
| 707 |
+
|
| 708 |
+
# 7. Experiment Statistical Significance
|
| 709 |
+
|
| 710 |
+
Question: Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?
|
| 711 |
+
|
| 712 |
+
Answer: [Yes]
|
| 713 |
+
|
| 714 |
+
Justification: We tested our method with multiple random seeds and calculated the standard error.
|
| 715 |
+
|
| 716 |
+
Guidelines:
|
| 717 |
+
|
| 718 |
+
• The answer NA means that the paper does not include experiments.
|
| 719 |
+
• The authors should answer "Yes" if the results are accompanied by error bars, confidence intervals, or statistical significance tests, at least for the experiments that support the main claims of the paper.
|
| 720 |
+
• The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall run with given experimental conditions).
|
| 721 |
+
• The method for calculating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.)
|
| 722 |
+
• The assumptions made should be given (e.g., Normally distributed errors).
|
| 723 |
+
• It should be clear whether the error bar is the standard deviation or the standard error of the mean.
|
| 724 |
+
• It is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have a $96 \%$ CI, if the hypothesis of Normality of errors is not verified.
|
| 725 |
+
• For asymmetric distributions, the authors should be careful not to show in tables or figures symmetric error bars that would yield results that are out of range (e.g. negative error rates).
|
| 726 |
+
• If error bars are reported in tables or plots, The authors should explain in the text how they were calculated and reference the corresponding figures or tables in the text.
|
| 727 |
+
|
| 728 |
+
# 8. Experiments Compute Resources
|
| 729 |
+
|
| 730 |
+
Question: For each experiment, does the paper provide sufficient information on the computer resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?
|
| 731 |
+
|
| 732 |
+
Answer: [Yes]
|
| 733 |
+
|
| 734 |
+
Justification: We explain the required computational resources and related information in the appendix.
|
| 735 |
+
|
| 736 |
+
Guidelines:
|
| 737 |
+
|
| 738 |
+
• The answer NA means that the paper does not include experiments.
|
| 739 |
+
• The paper should indicate the type of compute workers CPU or GPU, internal cluster, or cloud provider, including relevant memory and storage.
|
| 740 |
+
• The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute.
|
| 741 |
+
• The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g., preliminary or failed experiments that didn’t make it into the paper).
|
| 742 |
+
|
| 743 |
+
# 9. Code Of Ethics
|
| 744 |
+
|
| 745 |
+
Question: Does the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics https://neurips.cc/public/EthicsGuidelines?
|
| 746 |
+
|
| 747 |
+
Answer: [Yes]
|
| 748 |
+
|
| 749 |
+
Justification: Although our work is related to healthcare, we train and test our models on offline data, adhering to ethical standards.
|
| 750 |
+
|
| 751 |
+
Guidelines:
|
| 752 |
+
|
| 753 |
+
• The answer NA means that the authors have not reviewed the NeurIPS Code of Ethics.
|
| 754 |
+
• If the authors answer No, they should explain the special circumstances that require a deviation from the Code of Ethics.
|
| 755 |
+
• The authors should make sure to preserve anonymity (e.g., if there is a special consideration due to laws or regulations in their jurisdiction).
|
| 756 |
+
|
| 757 |
+
# 10. Broader Impacts
|
| 758 |
+
|
| 759 |
+
Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?
|
| 760 |
+
|
| 761 |
+
Answer:[Yes]
|
| 762 |
+
|
| 763 |
+
Justification: Our work has a positive impact on safe healthcare, promoting the expansion of artificial intelligence technology into the medical field.
|
| 764 |
+
|
| 765 |
+
Guidelines:
|
| 766 |
+
|
| 767 |
+
• The answer NA means that there is no societal impact of the work performed. • If the authors answer NA or No, they should explain why their work has no societal impact or why the paper does not address societal impact.
|
| 768 |
+
|
| 769 |
+
• Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific
|
| 770 |
+
groups), privacy considerations, and security considerations.
|
| 771 |
+
The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is a direct path to
|
| 772 |
+
any negative applications, the authors should point it out. For example, it is legitimate to point out that an improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster.
|
| 773 |
+
The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology.
|
| 774 |
+
• If there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms to monitor how a system learns from feedback over time, improving the efficiency and accessibility of ML).
|
| 775 |
+
|
| 776 |
+
# 11. Safeguards
|
| 777 |
+
|
| 778 |
+
Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?
|
| 779 |
+
|
| 780 |
+
Answer: [NA]
|
| 781 |
+
|
| 782 |
+
Justification: Our work does not pose security risks because it is based on publicly available datasets and models.
|
| 783 |
+
|
| 784 |
+
Guidelines:
|
| 785 |
+
|
| 786 |
+
• The answer NA means that the paper poses no such risks.
|
| 787 |
+
• Released models that have a high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters.
|
| 788 |
+
• Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images.
|
| 789 |
+
• We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make a best faith effort.
|
| 790 |
+
|
| 791 |
+
# 12. Licenses for existing assets
|
| 792 |
+
|
| 793 |
+
Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?
|
| 794 |
+
|
| 795 |
+
Answer: [Yes]
|
| 796 |
+
|
| 797 |
+
Justification: The code, data, and models we referenced are all cited, and we followed the licenses and terms of use throughout the process.
|
| 798 |
+
|
| 799 |
+
Guidelines:
|
| 800 |
+
|
| 801 |
+
• The answer NA means that the paper does not use existing assets.
|
| 802 |
+
• The authors should cite the original paper that produced the code package or dataset.
|
| 803 |
+
• The authors should state which version of the asset is used and, if possible, include a URL.
|
| 804 |
+
• The name of the license (e.g., CC-BY 4.0) should be included for each asset.
|
| 805 |
+
• For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided.
|
| 806 |
+
• If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswithcode.com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of a dataset.
|
| 807 |
+
• For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided.
|
| 808 |
+
• If this information is not available online, the authors are encouraged to reach out to the asset’s creators.
|
| 809 |
+
|
| 810 |
+
# 13. New Assets
|
| 811 |
+
|
| 812 |
+
Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?
|
| 813 |
+
|
| 814 |
+
Answer: [Yes]
|
| 815 |
+
|
| 816 |
+
Justification: We will provide detailed data extraction code and model code as part of the submission files.
|
| 817 |
+
|
| 818 |
+
Guidelines:
|
| 819 |
+
|
| 820 |
+
• The answer NA means that the paper does not release new assets.
|
| 821 |
+
• Researchers should communicate the details of the dataset/code/model as part of their submissions via structured templates. This includes details about training, license, limitations, etc.
|
| 822 |
+
• The paper should discuss whether and how consent was obtained from people whose asset is used.
|
| 823 |
+
• At submission time, remember to anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file.
|
| 824 |
+
|
| 825 |
+
# 14. Crowdsourcing and Research with Human Subjects
|
| 826 |
+
|
| 827 |
+
Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well as details about compensation (if any)?
|
| 828 |
+
|
| 829 |
+
Answer: [NA]
|
| 830 |
+
|
| 831 |
+
Justification: This paper does not involve crowdsourcing nor research with human subjects.
|
| 832 |
+
|
| 833 |
+
Guidelines:
|
| 834 |
+
|
| 835 |
+
• The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.
|
| 836 |
+
• Including this information in the supplemental material is fine, but if the main contribution of the paper involves human subjects, then as much detail as possible should be included in the main paper.
|
| 837 |
+
• According to the NeurIPS Code of Ethics, workers involved in data collection, curation, or other labor should be paid at least the minimum wage in the country of the data collector.
|
| 838 |
+
|
| 839 |
+
# 15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects
|
| 840 |
+
|
| 841 |
+
Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or an equivalent approval/review based on the requirements of your country or institution) were obtained?
|
| 842 |
+
|
| 843 |
+
Answer: [NA]
|
| 844 |
+
|
| 845 |
+
Justification: This paper does not involve crowdsourcing nor research with human subjects.
|
| 846 |
+
|
| 847 |
+
Guidelines:
|
| 848 |
+
|
| 849 |
+
• The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.
|
| 850 |
+
• Depending on the country in which research is conducted, IRB approval (or equivalent) may be required for any human subjects research. If you obtained IRB approval, you should clearly state this in the paper.
|
| 851 |
+
|
| 852 |
+
998 • We recognize that the procedures for this may vary significantly between institutions
|
| 853 |
+
999 and locations, and we expect authors to adhere to the NeurIPS Code of Ethics and the
|
| 854 |
+
1000 guidelines for their institution.
|
| 855 |
+
1001 • For initial submissions, do not include any information that would break anonymity (if
|
| 856 |
+
1002 applicable), such as the institution conducting the review.
|
md/test/ehfRiF0R3a/ehfRiF0R3a.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/test/iwd9sQWnXb/iwd9sQWnXb.md
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LARGE LANGUAGE MODELS ARE EFFECTIVE TEXT RANKERS WITH PAIRWISE RANKING PROMPTING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Ranking documents using Large Language Models (LLMs) by directly feeding the query and candidate documents into the prompt is an interesting and practical problem. However, there has been limited success so far, as researchers have found it difficult to outperform fine-tuned baseline rankers on benchmark datasets. We analyze pointwise and listwise ranking prompts used by existing methods and argue that off-the-shelf LLMs do not fully understand these challenging ranking formulations. In this paper, we propose to significantly reduce the burden on LLMs by using a new technique called Pairwise Ranking Prompting (PRP). Our results are the first in the literature to achieve state-of-the-art ranking performance on standard benchmarks using moderate-sized open-sourced LLMs. On TREC-DL2020, PRP based on the Flan-UL2 model with 20B parameters outperforms the previous best approach in the literature, which is based on the blackbox commercial GPT-4 that has $5 0 \mathrm { x }$ (estimated) model size, by over $5 \%$ at $\mathrm { N D C G } @ 1$ . On TREC-DL2019, PRP performs favorably with supervised models and is only inferior to the GPT-4 solution among LLM-based methods on the ${ \mathrm { N D C G } } @ 5$ and $\mathrm { N D C G } @ 1 0$ metrics, while outperforming other LLM-based solutions, such as InstructGPT which has 175B parameters, by over $10 \%$ for all ranking metrics. By using the same prompt template on seven BEIR tasks, PRP beats supervised baselines and outperforms the blackbox commercial ChatGPT solution by $4 . 2 \%$ and pointwise LLM-based solutions by over $10 \%$ on average $\mathrm { N D C G } @ 1 0$ . Furthermore, we propose several variants of PRP to improve efficiency and show that it is possible to achieve competitive results even with linear complexity. We also discuss other benefits of PRP, such as supporting both generation and scoring LLM APIs, as well as being insensitive to input ordering.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Large Language Model (LLMs) such as GPT-3 (Brown et al., 2020) and PaLM (Chowdhery et al., 2022) have demonstrated impressive performance on a wide range of natural language tasks, achieving comparable or better performance when compared with their supervised counterparts that are potentially trained with millions of labeled examples, even in the zero-shot setting (Kojima et al., 2022; Agrawal et al., 2022; Huang et al., 2022; Hou et al., 2023).
|
| 12 |
+
|
| 13 |
+
However, there is limited success for the important text ranking problem using LLMs (Ma et al., 2023). Existing results usually significantly underperform well-trained baseline rankers (e.g., Nogueira et al. (2020); Zhuang et al. (2023)). The only exception is a recent approach proposed by Sun et al. (2023), which depends on the blackbox, giant, and commercial GPT-4 system. Besides the technical concerns such as sensitivity to input order (ranking metrics can drop by more than $50 \%$ when the input document order changes), we argue that relying on such blackbox systems is not ideal for academic researchers due to significant cost constraints and access limitations to these systems, though we do acknowledge the value of such explorations in showing the capacity of LLMs for ranking tasks.
|
| 14 |
+
|
| 15 |
+
In this work, we first discuss why it is difficult for LLMs to perform ranking tasks with existing methods, specifically, the pointwise and listwise formulations. For pointwise approaches, ranking requires LLMs to output calibrated prediction probabilities before sorting, which is known to be very difficult and is not supported by the generation-only LLM APIs (such as GPT-4). For listwise approaches, even with instructions that look very clear to humans, LLMs can frequently generate conflicting or useless outputs. Empirically we find that listwise ranking prompts from existing work generate completely useless outputs on moderate-sized LLMs. Such observations show that existing popular LLMs do not fully understand ranking tasks, potentially due to the lack of ranking awareness during their pre-training and (instruction) fine-tuning procedures.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Two existing prompting methods for ranking: (a) the pointwise relevance generation approach and (b) the listwise permutation approach.
|
| 19 |
+
|
| 20 |
+
We propose the Pairwise Ranking Prompting (PRP) paradigm, which uses the query and a pair of documents in the prompt for LLMs to perform ranking tasks, with the motivation to significantly reduce the task complexity for LLMs and resolve the calibration issue. PRP is based on simple prompt design and naturally supports both generation and scoring LLMs APIs. We describe several variants of PRP to address efficiency concerns. PRP results are the first in the literature that can achieve state-of-the-art ranking performance by using moderate-sized, open-sourced LLMs on standard benchmark datasets. On TREC-DL2020, PRP based on the FLAN-UL2 model with 20B parameters outperforms the previous best approach in the literature, based on the blackbox commercial GPT-4 that has (an estimated) 50X model size, by over $5 \%$ at $\mathrm { N D C G } @ 1$ . On TREC-DL2019, PRP is only inferior to the GPT-4 solution on the ${ \mathrm { N D C G } } @ 5$ and $\mathrm { N D C G } @ 1 0$ metrics, but can outperform existing solutions, such as InstructGPT which has 175B parameters, by over $10 \%$ for nearly all ranking metrics. We also show competitive results using FLAN-T5 models with 3B and 13B parameters, demonstrating the power and generality of PRP. The observations are further validated on seven BEIR datasets covering various domains, where PRP performs competitively with supervised rankers and outperforms other LLM based approaches by a large margin. We further discuss other benefits of PRP, such as being insensitive to input ordering.
|
| 21 |
+
|
| 22 |
+
In summary, the contributions of this paper are three-fold:
|
| 23 |
+
|
| 24 |
+
• We, for the first time in published literature, show pairwise ranking prompting effectiveness for ranking with LLMs. It is able to produce state-of-the-art ranking performance on a wide range of datasets with simple prompting and scoring mechanism.
|
| 25 |
+
Our results are based on moderate-sized, open-sourced LLMs, comparing with existing solutions that use blackbox, commercial, and much larger models. The finding will facilitate future research in this direction.
|
| 26 |
+
• We study several efficiency improvements and show promising empirical performance.
|
| 27 |
+
|
| 28 |
+
# 2 DIFFICULTIES OF RANKING TASKS FOR LLMS
|
| 29 |
+
|
| 30 |
+
As discussed in Section 1, to date there is limited evidence showing LLM-based rankers can outperform fine-tuned ones. We discuss why this is the case by overviewing and analyzing existing methods, which can be categorized into pointwise or listwise approaches.
|
| 31 |
+
|
| 32 |
+
# 2.1 POINTWISE APPROACHES
|
| 33 |
+
|
| 34 |
+
Pointwise approaches are the major methods prior to very recent listwise approaches discussed in Section 2.2. There are two popular methods, relevance generation (Liang et al., 2022) and query
|
| 35 |
+
|
| 36 |
+
generation (Sachan et al., 2022). Figure 1 (a) shows the prompt used for relevance generation. The relevance score $s _ { i }$ is defined as:
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
s _ { i } = { \left\{ \begin{array} { l l } { 1 + p { \left( \mathrm { Y e s } \right) } , { \mathrm { i f ~ o u t p u t ~ Y e s } } } \\ { 1 - p { \left( \mathrm { N o } \right) } , { \mathrm { i f ~ o u t p u t ~ N o } } } \end{array} \right. }
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
where $p ( { \mathrm { Y e s } } )$ and $p ( \mathrm { N o } )$ denote the probabilities of LLMs generating ‘Yes’ and ‘No’ respectively. Meanwhile query generation approach asks LLMs to generate a query based on the document ("Please write a question based on this passage. Passage: {{passage}} Question:"), and measures the probability of generating the actual query. Readers can refer to Sachan et al. (2022) for more details.
|
| 43 |
+
|
| 44 |
+
There are two major issues with pointwise approaches. First, pointwise relevance prediction requires the model to output calibrated pointwise predictions so that they can be used for comparisons in sorting. This is not only very difficult to achieve across prompts (Desai & Durrett, 2020), but also unnecessary for ranking, which only requires relative ordering. In fact, a major focus of the learning to rank field (Liu, 2009) in the information retrieval field is based on this observation. Also, pointwise methods will not work for generation API, which is common, such as GPT-4, since it requires the log probability of the desired predictions to perform sorting.
|
| 45 |
+
|
| 46 |
+
# 2.2 LISTWISE APPROACHES
|
| 47 |
+
|
| 48 |
+
Very recently, two parallel works (Sun et al., 2023; Ma et al., 2023) explore listwise approaches, by directly inserting the query and a list of documents into a prompt. Both methods feed a partial list of 10 or 20 documents every time and perform a sliding window approach due to the prompt length constraints. Figure 1 (b) shows a simplified version of the listwise ranking prompt. Both works explored text-davinci-003, i.e., InstructGPT (Ouyang et al., 2022) with 175B parameters, showing significantly worse performance than fine-tuned baseline rankers. Sun et al. (2023) were able to further explore gpt-3.5-turbo (the model behind ChatGPT) and GPT-4. Only the GPT-4 based approach could achieve competitive results, which is based on the blackbox, commercial, and giant (1T estimated parameters (VanBuskirk, 2023; Baktash & Dawodi, 2023)) system, without academic publication discussing technical details (OpenAI (2023) mainly focused on evaluations).
|
| 49 |
+
|
| 50 |
+
The issues are again due to the difficulty of the listwise ranking task for LLMs. Sun et al. (2023) show that there are frequent prediction failures with the following patterns:
|
| 51 |
+
|
| 52 |
+
• Missing: When LLMs only outputs a partial list of the input documents.
|
| 53 |
+
• Rejection: LLMs refuse to perform the ranking task and produce irrelevant outputs.
|
| 54 |
+
• Repetition: LLMs output the same document more than once.
|
| 55 |
+
• Inconsistency: The same list of documents have different output rankings when they are fed in with different order or context.
|
| 56 |
+
|
| 57 |
+
In fact, we tried the same prompt from (Sun et al., 2023) on the FLAN-UL2 model with 20B parameters, and found very few of the outputs to be usable. The model will either just output few documents (e.g., "[1]"), an ordered list based on id (e.g. $" [ 3 ] > [ 2 ] > [ 1 ] \ldots " ,$ ), or text which is not parseable.
|
| 58 |
+
|
| 59 |
+
Different from pointwise approaches, listwise approaches can only use the generation API – getting the log probability of all listwise permutations is prohibitively expensive. In other words, there is no good solution if the generation API does not output desired results, which is common. These methods will fall back to the initial ranking, and due to the high failure rate, the results are highly sensitive to input ordering.
|
| 60 |
+
|
| 61 |
+
These observations are not entirely surprising. Existing popular LLMs are generally not specifically pre-trained or fine-tuned against ranking tasks. However, we next show that LLMs do have a sense of pairwise relative comparisons, which is much simpler than requiring a calibrated pointwise relevance estimation or outputting a permutation for a list of documents.
|
| 62 |
+
|
| 63 |
+
# 3 PAIRWISE RANKING PROMPTING
|
| 64 |
+
|
| 65 |
+
We propose Pairwise Ranking Prompting (PRP) for ranking with LLMs. We describe the basic pairwise prompting unit, how it supports both generation and scoring APIs, and propose several variants of PRP with different ranking strategies and efficiency properties.
|
| 66 |
+
|
| 67 |
+

|
| 68 |
+
Figure 2: An illustration of pairwise ranking prompting. The scores in scoring mode represent the log-likelihood of the model generating the target text given the prompt.
|
| 69 |
+
|
| 70 |
+
# 3.1 PROMPTING DESIGN
|
| 71 |
+
|
| 72 |
+
Our pairwise ranking prompt is simple and intuitive, as shown in Figure 2. The exact prompt template is shown in Appendix F. This pairwise prompting will serve the basic computation unit in all PRP variants, which we denote as $u ( q , d _ { 1 } , d _ { 2 } )$ for a query $q$ and two documents $d _ { 1 }$ and $d _ { 2 }$ .
|
| 73 |
+
|
| 74 |
+
PRP naturally supports both generation API and scoring API. The latter is made possible since we only have two expected outputs ("Passage A" and "Passage B") for LLM inquiries. Since using scoring mode can mitigate potential issues when the generation API generates irrelevant outputs, our main results are based on the scoring mode, though we show there are very few prediction failures and provide comparisons between these two modes in Appendix B.
|
| 75 |
+
|
| 76 |
+
Since it is known that LLMs can be sensitive to text orders in the prompt (Lu et al., 2022; Liu et al., 2023a), for each pair of documents, we will inquire the LLM twice by swapping their order: $u ( q , d _ { 1 } , d _ { 2 } )$ and $u ( q , d _ { 2 } , d _ { 1 } )$ .
|
| 77 |
+
|
| 78 |
+
The output of the pairwise ranking prompting is a local ordering of $d _ { 1 } > d _ { 2 }$ or $d _ { 2 } > d _ { 1 }$ if both promptings make consistent decisions, and $d _ { 1 } = d _ { 2 }$ otherwise. Next we discuss three variants of PRP using the output of pairwise ranking prompting as the computation unit. We note that pairwise comparison can serve as the basic computation unit of many algorithms (e.g., selection algorithm) and leave other alternatives for future work.
|
| 79 |
+
|
| 80 |
+
# 3.2 ALL PAIR COMPARISONS
|
| 81 |
+
|
| 82 |
+
We enumerate all pairs and perform a global aggregation to generate a score $s _ { i }$ for each document $d _ { i }$ We call this approach PRP-Allpair. Specifically, we have:
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
s _ { i } = 1 \cdot \sum _ { j \neq i } \mathbb { I } _ { d _ { i } > d _ { j } } + 0 . 5 \cdot \sum _ { j \neq i } \mathbb { I } _ { d _ { i } = d _ { j } } .
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
Intuitively, if the LLM consistently prefers $d _ { i }$ over another document $d _ { j } , d _ { i }$ gets one point. When LLM is not sure by producing conflicting or irrelevant results (for the generation API), each document gets half a point. There might be ties for the aggregated scores, in which case we fall back to initial ranking. In this work, we use equation 2 which works for both scoring and generation APIs, and note there could be other ways to weight the scoring function, such as leveraging prediction probabilities in scoring mode.
|
| 89 |
+
|
| 90 |
+
PRP-Allpair favors simple implementation (all LLM API calls can be executed in parallel), and is highly insensitive to input ordering. The clear drawback is its costly $O ( N ^ { 2 } )$ calls to LLM APIs, where $N$ is the number of documents to be ranked for each query.
|
| 91 |
+
|
| 92 |
+

|
| 93 |
+
Figure 3: An illustration of one pass of our sliding window approach. Starting from right to left, we compare each document pair and swap it if the LLM output disagrees with the initial ranking. We can see that the sliding window approach is able to bring up initially lower ranked "Passage $\mathbf { A } "$ (shown in green) to the top of the ranking. $K$ such passes will ensure a high-performing top- $K$ ranking.
|
| 94 |
+
|
| 95 |
+
# 3.3 SORTING-BASED
|
| 96 |
+
|
| 97 |
+
We note that efficient sorting algorithms, such as Quicksort and Heapsort, depend on pairwise comparisons. We can use the pairwise preferences from LLMs as the comparator for sorting algorithms. We use Heapsort in this paper due to its guaranteed $O ( N \log N )$ computation complexity. We call this approach PRP-Sorting.
|
| 98 |
+
|
| 99 |
+
PRP-Sorting favors lower computation complexity than PRP-Allpair while also being large insensitive to input orders. However, since it performs local comparisons/swaps on-the-fly and pairwise comparisons are not guaranteed to be transitive, its performance needs to be empirically evaluated.
|
| 100 |
+
|
| 101 |
+
# 3.4 SLIDING WINDOW
|
| 102 |
+
|
| 103 |
+
We introduce a sliding window approach that is able to further bring down the computation complexity. One sliding window pass is similar to one pass in the Bubble Sort algorithm: Given an initial ranking, we start from the bottom of the list, compare and swap document pairs with a stride of 1 on-thefly based on LLM outputs. One pass only requires $O ( N )$ time complexity. See Figure 3 for an illustration.
|
| 104 |
+
|
| 105 |
+
By noticing that ranking usually only cares about Top- $K$ ranking metrics, where $K$ is small, we can perform $K$ passes. For $N = 1 0 0$ and $K = 1 0$ , it still only requires $10 \%$ LLM API calls of the PRP-Allpair. We call this approach PRP-Sliding-K.
|
| 106 |
+
|
| 107 |
+
PRP-Sliding-K has favorable time complexity but may have high dependency on input order. In experiments we show surprisingly good results with PRP-Sliding-10, without being very sensitive to input ordering empirically (Appendix A).
|
| 108 |
+
|
| 109 |
+
# 3.5 REMARKS
|
| 110 |
+
|
| 111 |
+
In this work, we focus on open-sourced LLMs that are easily accessible to academic researchers, and do not require inquiry of commercial LLM APIs, alleviating some monetary constraints. Also, the LLMs do not need to be finetuned in the prompting-based setting. However, we do acknowledge the cost to prompting LLMs in general.
|
| 112 |
+
|
| 113 |
+
Here we briefly summarize the properties of pointwise, pairwise, and listwise ranking promptings in Table 1, showing pairwise ranking prompting has several favorable properties.
|
| 114 |
+
|
| 115 |
+
Table 1: Comparison of pointwise, listwise, and pairwise approaches. $N$ is the number of documents to be ranked for each query. $O ( N )$ for listwise approach is based on sliding window since other options are not practical. "Require Calibration" means LLMs need accurate probability estimation to do good ranking, see Section 2.1. $K$ is in terms of top- $K$ ranking metrics that is usually small $( < = 1 0$ even if thousands of items are being ranked (Zhuang et al., 2023).
|
| 116 |
+
|
| 117 |
+
<table><tr><td>Method</td><td># of LLM API Calls</td><td></td><td></td><td>Generation API 丨Scoring API丨Require Calibration</td></tr><tr><td>Pointwise</td><td>O(N)</td><td>No</td><td>Yes</td><td>Yes</td></tr><tr><td>Listwise</td><td>O(N)</td><td>Yes</td><td>No</td><td>No</td></tr><tr><td>Pairwise</td><td>O(N²),O(Nlog N),O(K N)</td><td>Yes</td><td>Yes</td><td>No</td></tr></table>
|
| 118 |
+
|
| 119 |
+
# 4 EXPERIMENTS ON TREC DL DATASETS
|
| 120 |
+
|
| 121 |
+
# 4.1 DATASETS AND METRICS
|
| 122 |
+
|
| 123 |
+
TREC is a widely used benchmark dataset in information retrieval research. We use the test sets of the 2019 and 2020 competitions: TREC-DL2019 and TREC-DL2020, which provide dense human relevance annotations for each of their 43 and 54 queries. Both use the MS MARCO v1 passage corpus, which contains 8.8 million passages. All comparisons are based on the reranking of top 100 passages retrieved by BM25 (Lin et al., 2021) for each query. This is the same setting as existing work (Sun et al., 2023; Ma et al., 2023).
|
| 124 |
+
|
| 125 |
+
# 4.2 METHODS
|
| 126 |
+
|
| 127 |
+
We evaluate PRP variants based on open-sourced LLMs, including FLAN-T5-XL, FLAN-T5- XXL (Chung et al., 2022), and FLAN-UL2 (Tay et al., 2022a), which have significantly smaller model sizes (3B, 11B, 20B) than alternatives, and are easily accessible to academic researchers. We report PRP variants including PRP-Allpair, PRP-Sorting, and PRP-Sliding-K.
|
| 128 |
+
|
| 129 |
+
We consider the following supervised baselines, all trained on the in-domain MS MARCO dataset:
|
| 130 |
+
|
| 131 |
+
• monoBERT (Nogueira & Cho, 2019): A cross-encoder re-ranker based on BERT-large. • monoT5 (Nogueira et al., 2020): A sequence-to-sequence re-ranker that uses T5 to calculate the relevance score with pointwise ranking loss. • RankT5 (Zhuang et al., 2023): A re-ranker that uses T5 and listwise ranking loss.
|
| 132 |
+
|
| 133 |
+
We also consider the following unsupervised LLM-based baselines:
|
| 134 |
+
|
| 135 |
+
• Unsupervied Passage Re-ranker (UPR) (Sachan et al., 2022): The pointwise approach based on query generation, see Section 2.1.
|
| 136 |
+
• Relevance Generation (RG) (Liang et al., 2022): The pointwise approach based on relevance generation, see Section 2.1.
|
| 137 |
+
RankGPT (Sun et al., 2023): The listwise prompting based approach using various GPT based LLMs. As discussed in Section 2.2, we tried the proposed listwise prompt on FLANT5 and FLAN-UL2 models and the outputs are not usable, so we only report results with large blackbox LLMs as in their paper.
|
| 138 |
+
• Listwise Reranker with a Large language model (LRL) (Ma et al., 2023): A similar approach to RankGPT with slightly different prompt design.
|
| 139 |
+
|
| 140 |
+
# 4.3 MAIN RESULTS
|
| 141 |
+
|
| 142 |
+
Our main results are shown in Table 2. Overall we are able to achieve very encouraging results using PRP. We have the following observations:
|
| 143 |
+
|
| 144 |
+
• PRP variants based on FLAN-UL2 with 20B parameters can achieve best results on all metrics on TREC-DL2020, and are only second to the blackbox, commercial gpt-4 based solution on NDCG $\textcircled { \alpha } 5$ and NDCG $@ 1 0$ on TREC-DL2019, which has an estimated 50X larger model size. Our best methods outperform RankGPT based on text-davinci-003 with 175B parameters by over $10 \%$ on all ranking metrics, and are competitive to supervised methods on all ranking metrics.
|
| 145 |
+
|
| 146 |
+
Table 2: Results on TREC-DL2019 and TREC-DL2020 datasets by reranking top 100 documents retrieved by BM25. Best overall model is in boldface, best and second best unsupervised LLM method are underlined and italicized respectively, for each metric. All unsupervised LLM methods use BM25 to resolve prediction conflicts or failures. \*OpenAI has not publicly released the model parameters and the numbers are based on public estimates (VanBuskirk, 2023; Baktash & Dawodi, 2023)
|
| 147 |
+
|
| 148 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">LLM</td><td rowspan="2">Size</td><td colspan="3">NDCG@1TRDC-DL201NDCG@ 10</td><td colspan="3">NDCG@1T NEC-DL202NDCG@ 10</td></tr><tr><td colspan="3"></td><td colspan="3"></td></tr><tr><td>BM25</td><td>NA</td><td>|NA</td><td>1 54.26</td><td>52.78</td><td>50.58</td><td>57.72</td><td>50.67</td><td>47.96</td></tr><tr><td colspan="9">Supervised Methods</td></tr><tr><td colspan="9"></td></tr><tr><td>monoBERT monoT5</td><td>BERT T5</td><td>340M 220M</td><td>79.07</td><td>73.25 73.77</td><td>70.50 71.48</td><td>78.70 77.47</td><td>70.74 69.40</td><td>67.28 66.99</td></tr><tr><td>monoT5</td><td>T5</td><td>3B</td><td>79.84 79.07</td><td>73.74</td><td>71.83</td><td>80.25</td><td>72.32</td><td>68.89</td></tr><tr><td>RankT5</td><td>T5</td><td>3B</td><td>79.07</td><td>75.66</td><td>72.95</td><td>80.86</td><td>73.05</td><td>69.63</td></tr><tr><td colspan="9"></td></tr><tr><td></td><td rowspan="10">gpt-3</td><td>175B</td><td colspan="3">Unsupervised LLMMethods</td><td></td><td></td><td></td></tr><tr><td>LRL RankGPT</td><td>text-davinci-003</td><td></td><td></td><td>65.80</td><td>50.00</td><td></td><td>62.24 48.73</td></tr><tr><td></td><td>175B</td><td>50.78</td><td>50.77</td><td>49.76</td><td></td><td>48.36</td><td></td></tr><tr><td>RankGPT</td><td>text-davinci-003 175B</td><td>69.77 82.17</td><td>64.73</td><td>61.50 65.80</td><td>69.75</td><td>58.76</td><td>57.05</td></tr><tr><td>RankGPT RankGPT</td><td>gpt-3.5-turbo 154B*</td><td>82.56</td><td>71.15</td><td>75.59</td><td>79.32 78.40</td><td>66.76</td><td>62.91</td></tr><tr><td>UPR</td><td>1T* FLAN-T5-XXL</td><td>62.79</td><td>79.16</td><td>62.00</td><td>64.20</td><td>74.11</td><td>70.56</td></tr><tr><td>RG</td><td>11B 11B</td><td>67.05</td><td>62.07 65.41</td><td>64.48</td><td>65.74</td><td>62.05</td><td>60.34</td></tr><tr><td>UPR</td><td>FLAN-T5-XXL FLAN-UL2 20B</td><td>53.10</td><td>57.68</td><td>58.95</td><td>64.81</td><td>66.40 61.50</td><td>62.58 60.02</td></tr><tr><td>RG</td><td>FLAN-UL2 20B</td><td>70.93</td><td>66.81</td><td>64.61</td><td>75.62</td><td>66.85</td><td>65.39</td></tr><tr><td>PRP-Allpair</td><td></td><td>74.03</td><td>71.73</td><td>69.75</td><td>79.01</td><td></td><td></td></tr><tr><td>PRP-Sorting</td><td>FLAN-T5-XL FLAN-T5-XL</td><td>3B 3B</td><td>77.52</td><td>71.88</td><td>69.28</td><td>74.38</td><td>72.22 69.44</td><td>68.12 65.87</td></tr><tr><td>PRP-Sliding-10</td><td>FLAN-T5-XL</td><td>3B</td><td>75.58</td><td>71.23</td><td>68.66</td><td>75.62</td><td>69.00</td><td>66.59</td></tr><tr><td>PRP-Allpair</td><td>FLAN-T5-XXL</td><td>11B</td><td>72.09</td><td>71.28</td><td>69.87</td><td>82.41</td><td>74.16</td><td>69.85</td></tr><tr><td>PRP-Sorting</td><td>FLAN-T5-XXL</td><td>11B</td><td>74.42</td><td>69.62</td><td>67.81</td><td>72.53</td><td>71.28</td><td>67.77</td></tr><tr><td>PRP-Sliding-10</td><td>FLAN-T5-XXL</td><td>11B</td><td>64.73</td><td>69.49</td><td>67.00</td><td>75.00</td><td>70.76</td><td>67.35</td></tr><tr><td>PRP-Allpair</td><td>FLAN-UL2</td><td>20B</td><td>73.64</td><td>74.77</td><td>72.42</td><td>85.19</td><td>74.73</td><td>70.68</td></tr><tr><td>PRP-Sorting</td><td>FLAN-UL2</td><td>20B</td><td>74.42</td><td>73.60</td><td>71.88</td><td>84.57</td><td>72.52</td><td>69.43</td></tr><tr><td>PRP-Sliding-10</td><td>FLAN-UL2</td><td>20B</td><td>78.29</td><td>75.49</td><td>72.65</td><td>85.80</td><td>75.35</td><td>70.46</td></tr></table>
|
| 149 |
+
|
| 150 |
+
• Results on FLAN-T5-XL and FLAN-T5-XXL are also competitive, showing that PRP generalizes to smaller LLMs due to the significant simplicity of the pairwise ranking comparisons. They generally work even better than the gpt-3.5.turbo based solution (10X - 50X in size) on the more stable ${ \mathrm { N D C G } } @ 5$ and ${ \mathrm { N D C G } } \ @ 1 0$ metrics, and outperforms text-davinci-003 based solution on all ranking metrics.
|
| 151 |
+
• It is encouraging to see good results from efficient PRP variants. For example, the sliding window variants generally get very robust ranking performance and we get some of the best metrics from this variant. This observation alleviates some efficiency concerns of pairwise ranking approaches.
|
| 152 |
+
|
| 153 |
+
# 5 EXPERIMENTS ON BEIR DATASETS
|
| 154 |
+
|
| 155 |
+
# 5.1 DATASETS AND METRICS
|
| 156 |
+
|
| 157 |
+
BEIR (Thakur et al., 2021) consists of diverse retrieval tasks and domains. Following (Sun et al., 2023) we choose the test sets of Covid, Touche, DBPedia, SciFact, Signal, News, and Robust04. Following the convention of related research, we report NDCG $@ 1 0$ for each dataset and the average ${ \mathrm { N D C G } } \ @ 1 0$ .
|
| 158 |
+
|
| 159 |
+
# 5.2 METHODS
|
| 160 |
+
|
| 161 |
+
We use the same prompt template from TREC datasets for all BEIR datasets, which is consistent for all compared unsupervised LLM-based baselines. This is in contrast to methods such as (Dai et al.,
|
| 162 |
+
|
| 163 |
+
Table 3: Results $( \mathrm { N D C G } @ 1 0 )$ on BEIR datasets. All models re-rank the same BM25 top-100 passages. Best overall model is in boldface, best and second best unsupervised LLM method are underlined and italicized respectively, for each metric. All unsupervised LLM methods use BM25 to resolve prediction conflicts or failures.
|
| 164 |
+
|
| 165 |
+
<table><tr><td>Method</td><td>LLM</td><td>Size</td><td>Covid</td><td>Touche</td><td>DBPedia</td><td>SciFact</td><td>Signal</td><td>News</td><td>Robust04</td><td>Avg</td></tr><tr><td>BM25</td><td>|NA</td><td>|NA</td><td> 59.47</td><td>44.22</td><td>31.80</td><td>67.89</td><td>33.05</td><td>39.52</td><td>40.70</td><td>45.23</td></tr><tr><td colspan="9">Supervised Methods</td></tr><tr><td>monoBERT</td><td>BERT T5</td><td>340M 220M</td><td>70.01 78.34</td><td>31.75 30.82</td><td>41.87 42.42</td><td>71.36 73.40</td><td>31.44 31.67</td><td>44.62 46.83</td><td>49.35 51.72</td><td>48.63 50.74</td></tr><tr><td>monoT5 monoT5</td><td>T5</td><td>3B</td><td>80.71</td><td>32.41</td><td>44.45</td><td>76.57</td><td>32.55</td><td>48.49</td><td>56.71</td><td>53.13</td></tr><tr><td>RankT5 TART-Rerank</td><td>T5 T5</td><td>3B 3B</td><td>82.00 75.10</td><td>37.62 27.46</td><td>44.19 42.53</td><td>76.86 74.84</td><td>31.80 25.84</td><td>48.15 40.01</td><td>52.76 50.75</td><td>53.34 48.08</td></tr><tr><td colspan="9">Unsupervised LLM Methods</td></tr><tr><td colspan="9">FLAN-T5-XXL</td></tr><tr><td>UPR RG</td><td>FLAN-T5-XXL</td><td>11B 11B</td><td>72.64 70.31</td><td>21.56 22.10</td><td>35.14 31.32</td><td>73.54 63.43</td><td>30.81 26.89</td><td>42.99</td><td>47.85</td><td>46.36</td></tr><tr><td>UPR</td><td>FLAN-UL2</td><td>20B</td><td>70.69</td><td>23.68</td><td>34.64</td><td>71.09</td><td>30.33</td><td>37.34</td><td>51.56</td><td>43.28</td></tr><tr><td>RG</td><td>FLAN-UL2</td><td>20B</td><td>70.22</td><td>24.67</td><td>30.56</td><td>64.74</td><td>29.68</td><td>41.78</td><td>47.52</td><td>45.68</td></tr><tr><td>RankGPT</td><td>gpt-3.5-turbo</td><td>154B</td><td>76.67</td><td>36.18</td><td>44.47</td><td>70.43</td><td>32.12</td><td>43.78 48.85</td><td>53.00 50.62</td><td>45.24</td></tr><tr><td></td><td>FLAN-T5-XL</td><td>3B</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>51.33</td></tr><tr><td>PRP-Allpair PRP-Sorting</td><td>FLAN-T5-XL</td><td>3B</td><td>81.86 80.41</td><td>26.93 28.23</td><td>44.63 42.84</td><td>73.25</td><td>32.08</td><td>46.52</td><td>54.02</td><td>51.33</td></tr><tr><td>PRP-Sliding-10</td><td>FLAN-T5-XL</td><td>3B</td><td>77.58</td><td>40.48</td><td>44.77</td><td>67.94 73.43</td><td>30.95 35.62</td><td>42.95 46.45</td><td>50.07 50.74</td><td>49.06 52.72</td></tr><tr><td>PRP-Allpair</td><td>FLAN-T5-XXL</td><td>11B</td><td>79.62</td><td>29.81</td><td>41.41</td><td>74.23</td><td>32.22</td><td>47.68</td><td>56.76</td><td>51.67</td></tr><tr><td>PRP-Sorting</td><td>FLAN-T5-XXL</td><td>11B</td><td>78.75</td><td>29.61</td><td>39.23</td><td>70.10</td><td>31.28</td><td>44.68</td><td>53.01</td><td></td></tr><tr><td>PRP-Sliding-10</td><td>FLAN-T5-XXL</td><td>11B</td><td>74.39</td><td>41.60</td><td>42.19</td><td>72.46</td><td>35.12</td><td>47.26</td><td>52.38</td><td>49.52 52.20</td></tr><tr><td>PRP-Allpair</td><td>FLAN-UL2</td><td>20B</td><td>82.30</td><td>29.71</td><td>45.94</td><td>75.70</td><td>32.26</td><td>48.04</td><td>55.49</td><td>52.78</td></tr><tr><td>PRP-Sorting</td><td>FLAN-UL2</td><td>20B</td><td>82.29</td><td>25.80</td><td>44.53</td><td>67.07</td><td>32.04</td><td>45.37</td><td>51.45</td><td>49.79</td></tr><tr><td>PRP-Sliding-10</td><td>FLAN-UL2</td><td>20B</td><td>79.45</td><td>37.89</td><td>46.47</td><td>73.33</td><td>35.20</td><td>49.11</td><td>53.43</td><td>53.55</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></tr></table>
|
| 166 |
+
|
| 167 |
+
2022) that require prior knowledge to design different prompts for different datasets, which may be difficult in practice and will lead to unfair comparisons.
|
| 168 |
+
|
| 169 |
+
For supervised methods, in addition to the baselines in Section 4.2, we add TART (Asai et al., 2023), a supervised instruction-tuned passage re-ranker trained on 37 datasets, including over 5 million instances. The model is initialized from FLAN-T5-XL.
|
| 170 |
+
|
| 171 |
+
For unsupervised LLM methods, we also report RG and UPR as in Section 4.2. We include RankGPT with gpt-3.5-turbo. We do not include the GPT-4 numbers reported in (Sun et al., 2023), which used GPT-4 to rerank top results from gpt-3.5-turbo due to the significant cost. It essentially performed an ensemble of two re-ranking models, which is unfair and impractical. We also do not include LRL since it was not evaluated on the BEIR collection. See more discussions of baselines in Appendix E.
|
| 172 |
+
|
| 173 |
+
# 5.3 MAIN RESULTS
|
| 174 |
+
|
| 175 |
+
The main results are shown in Table 3. Overall we are able to achieve encouraging results using PRP, validating its robustness across different domains. We have the following observations:
|
| 176 |
+
|
| 177 |
+
• PRP variants based on FLAN-UL2 with 20B parameters can achieve best overall results on the collection.
|
| 178 |
+
• PRP variants generate the best ranking metrics on all datasets among unsupervised LLM methods. PRP outperforms the blackbox commercial RankGPT solution by $4 . 2 \%$ , and pointwise LLM-based solutions by over $10 \%$ in general. Noticably, PRP-Sliding-10 with FLAN-UL2 outperforms RankGPT on all 7 datasets, showing its strong generalization.
|
| 179 |
+
• PRP performs favorably with supervised methods. PRP-Sliding-10 with FLAN-UL2 can slightly outperform the state-of-the-art RankT5 ranker on average, and outperform RankT5 on 5 out of 7 datasets.
|
| 180 |
+
• Results on FLAN-T5-XL and FLAN-T5-XXL are again competitive, some variants can outperform RankGPT.
|
| 181 |
+
|
| 182 |
+
# 5.4 ABLATION STUDIES
|
| 183 |
+
|
| 184 |
+
We perform several ablative studies to gain a deeper understanding of the PRP framework. We show the robustness of PRP to input ordering in Appendix A, the applicability of PRP for both generation and scoring API in Appendix B, and provide more study on the sliding window approach in Appendix C.
|
| 185 |
+
|
| 186 |
+
# 6 DISCUSSION
|
| 187 |
+
|
| 188 |
+
The design of PRP in this paper biases towards simplicity and generality, and the performance may further improve via more sophisticated prompt design, and leveraging extra information such as the score values from scoring API (which will then not be applicable to generation API).
|
| 189 |
+
|
| 190 |
+
We note there is no label leakage issues as we leverage open-sourced LLMs with clear documentations, while it is not clear for blackbox commercial LLMs. Please see more discussions on limitations and future work of PRP in Appendix D.
|
| 191 |
+
|
| 192 |
+
# 7 RELATED WORK
|
| 193 |
+
|
| 194 |
+
We did a detailed review and analysis of the most relevant existing efforts for ranking with LLMs, including pointwise and listwise approaches in Section 2. These works and ours focus on the challenging unsupervised text ranking setting with LLMs without providing any examplers, conducting any fine-tuning, or training of an additional model. Prior to the recent efforts related to ranking with LLMs, most work focus on the supervised learning to rank problem (Liu, 2009; Qin et al., 2021) by fine-tuning Pre-trained Language Models (PLMs) such as T5 (Nogueira et al., 2020; Zhuang et al., 2023) or BERT (Nogueira & Cho, 2019; Zhuang et al., 2021), which serve as very strong baselines.
|
| 195 |
+
|
| 196 |
+
There has been a strong recent interest in exploring information retrieval in general with LLMs based approaches (Zhu et al., 2023), due to the importance of the applications and the power of LLMs to understand textual queries and documents (Dai et al., 2022; Tay et al., 2022b; Wang et al., 2023; Jagerman et al., 2023; Bonifacio et al., 2022). Several works leverage the generation power of LLMs to generate training data to train an additional downstream retrieval or ranking model, typically in the few-shot setting (Dai et al., 2022), which is a very different setting from ours. Recent methods in this family of methods such as Inpars (Bonifacio et al., 2022) still significantly underperforms fine-tuned baselines. ExaRanker (Ferraretto et al., 2023) uses LLMs to generate explanations for ranking decisions, and uses such explanations in ranking model fine-tuning, showing limited ranking performance benefits (the major benefit was on data efficiency). HyDE (Gao et al., 2022) uses LLMs to augment queries by generating hypothetical documents for unsupervised retrieval. These works do not directly explore the retrieval or ranking capability of LLMs, but mainly use LLMs as auxiliary tools to complement traditional paradigms, possibly limiting the benefits that LLMs can provide. New paradigms such as Differentiable Search Index (DSI) (Tay et al., 2022b; Wang et al., 2022) directly use Transformer memory to index documents for retrieval. Though novel, they mainly focus on retrieval, and the performance gap from supervised baselines is still large.
|
| 197 |
+
|
| 198 |
+
Using pairwise comparisons with LLMs is a general paradigm, such as reward modeling using pairwise preferences (Christiano et al., 2017). LLMs are used as evaluators to compare generative outputs (such as text summary) (Liu et al., 2023b). 1SL (MacAvaney & Soldaini, 2023) estimates relevance with reference to an anchor positive query-document pair per query, even for the test set, so the setting may not be practical and is very different from our standard text ranking setting. A concurrent work (Dai et al., 2023) studied pairwise prompting in recommender systems, showing impressive performance especially in cold-start settings. However, it is a substantially different application and their method still fall behind state-of-the-art models with sufficient data. The novelty of our work lies in leveraging the general and simple pairwise prompting paradigm to the important text ranking task, granting LLMs capabilities that no prior work can, by performing competitively with state-of-the-art fine-tuned models and methods that only work with giant blackbox LLMs.
|
| 199 |
+
|
| 200 |
+
# 8 CONCLUSION
|
| 201 |
+
|
| 202 |
+
In this paper, we propose to use pairwise prompting with LLMs for text ranking tasks. To the best of our knowledge, these are the first published results demonstrating very competitive ranking performance using moderate-sized, open-sourced LLMs. The key insights are the observation of the difficulties of LLMs handling ranking tasks in the existing pointwise and listwise formulations. Our proposed Pairwise Ranking Prompting (PRP) is effective in reducing the burden of LLMs and shows robust performance on 9 datasets. We also discuss efficiency concerns and ways to mitigate them, and several benefits of PRP, such as insensitivity to input ordering and support for both generation and scoring LLM APIs.
|
| 203 |
+
|
| 204 |
+
# REFERENCES
|
| 205 |
+
|
| 206 |
+
Monica Agrawal, Stefan Hegselmann, Hunter Lang, Yoon Kim, and David Sontag. Large language models are zero-shot clinical information extractors. arXiv preprint arXiv:2205.12689, 2022.
|
| 207 |
+
Akari Asai, Timo Schick, Patrick Lewis, Xilun Chen, Gautier Izacard, Sebastian Riedel, Hannaneh Hajishirzi, and Wen-tau Yih. Task-aware retrieval with instructions. In Findings of the Association for Computational Linguistics: ACL 2023, pp. 3650–3675, 2023.
|
| 208 |
+
Jawid Ahmad Baktash and Mursal Dawodi. GPT-4: A review on advancements and opportunities in natural language processing. arXiv preprint arXiv:2305.03195, 2023.
|
| 209 |
+
Luiz Bonifacio, Hugo Abonizio, Marzieh Fadaee, and Rodrigo Nogueira. InPars: Unsupervised dataset generation for information retrieval. In Proceedings of the 45th International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 2387–2392, 2022.
|
| 210 |
+
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.
|
| 211 |
+
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.
|
| 212 |
+
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.
|
| 213 |
+
Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language models. arXiv preprint arXiv:2210.11416, 2022.
|
| 214 |
+
Sunhao Dai, Ninglu Shao, Haiyuan Zhao, Weijie Yu, Zihua Si, Chen Xu, Zhongxiang Sun, Xiao Zhang, and Jun Xu. Uncovering chatgpt’s capabilities in recommender systems. In Proceedings of the 17th ACM Conference on Recommender Systems, RecSys ’23, pp. 1126–1132, 2023.
|
| 215 |
+
Zhuyun Dai, Vincent Y Zhao, Ji Ma, Yi Luan, Jianmo Ni, Jing Lu, Anton Bakalov, Kelvin Guu, Keith B Hall, and Ming-Wei Chang. Promptagator: Few-shot dense retrieval from 8 examples. arXiv preprint arXiv:2209.11755, 2022.
|
| 216 |
+
Shrey Desai and Greg Durrett. Calibration of pre-trained transformers. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 295–302, 2020.
|
| 217 |
+
Fernando Ferraretto, Thiago Laitz, Roberto Lotufo, and Rodrigo Nogueira. ExaRanker: Synthetic explanations improve neural rankers. In Proceedings of the 46th International ACM SIGIR Conference on Research and Development in Information Retrieval, 2023.
|
| 218 |
+
Luyu Gao, Xueguang Ma, Jimmy Lin, and Jamie Callan. Precise zero-shot dense retrieval without
|
| 219 |
+
|
| 220 |
+
relevance labels. arXiv preprint arXiv:2212.10496, 2022.
|
| 221 |
+
|
| 222 |
+
Yupeng Hou, Junjie Zhang, Zihan Lin, Hongyu Lu, Ruobing Xie, Julian McAuley, and Wayne Xin Zhao. Large language models are zero-shot rankers for recommender systems. arXiv preprint arXiv:2305.08845, 2023.
|
| 223 |
+
Wenlong Huang, Pieter Abbeel, Deepak Pathak, and Igor Mordatch. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. In International Conference on Machine Learning, pp. 9118–9147. PMLR, 2022.
|
| 224 |
+
Rolf Jagerman, Honglei Zhuang, Zhen Qin, Xuanhui Wang, and Michael Bendersky. Query expansion by prompting large language models. arXiv preprint arXiv:2305.03653, 2023.
|
| 225 |
+
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.
|
| 226 |
+
Percy Liang, Rishi Bommasani, Tony Lee, Dimitris Tsipras, Dilara Soylu, Michihiro Yasunaga, Yian Zhang, Deepak Narayanan, Yuhuai Wu, Ananya Kumar, et al. Holistic evaluation of language models. arXiv preprint arXiv:2211.09110, 2022.
|
| 227 |
+
Jimmy Lin, Xueguang Ma, Sheng-Chieh Lin, Jheng-Hong Yang, Ronak Pradeep, and Rodrigo Nogueira. Pyserini: A Python toolkit for reproducible information retrieval research with sparse and dense representations. In Proceedings of the 44th Annual International ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR 2021), pp. 2356–2362, 2021.
|
| 228 |
+
Nelson F Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. Lost in the middle: How language models use long contexts. arXiv preprint arXiv:2307.03172, 2023a.
|
| 229 |
+
Tie-Yan Liu. Learning to rank for information retrieval. Foundation and Trends
|
| 230 |
+
Yuxuan Liu, Tianchi Yang, Shaohan Huang, Zihan Zhang, Haizhen Huang, Furu Wei, Weiwei Deng, Feng Sun, and Qi Zhang. Calibrating llm-based evaluator. arXiv preprint arXiv:2309.13308, 2023b.
|
| 231 |
+
Yao Lu, Max Bartolo, Alastair Moore, Sebastian Riedel, and Pontus Stenetorp. Fantastically ordered prompts and where to find them: Overcoming few-shot prompt order sensitivity. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 8086–8098, 2022.
|
| 232 |
+
Xueguang Ma, Xinyu Zhang, Ronak Pradeep, and Jimmy Lin. Zero-shot listwise document reranking with a large language model. arXiv preprint arXiv:2305.02156, 2023.
|
| 233 |
+
Sean MacAvaney and Luca Soldaini. One-shot labeling for automatic relevance estimation. In Proceedings of the 46th International ACM SIGIR Conference on Research and Development in Information Retrieval, 2023.
|
| 234 |
+
Rodrigo Nogueira and Kyunghyun Cho. Passage re-ranking with BERT. arXiv preprint arXiv:1901.04085, 2019.
|
| 235 |
+
Rodrigo Nogueira, Zhiying Jiang, Ronak Pradeep, and Jimmy Lin. Document ranking with a pretrained sequence-to-sequence model. In Findings of the Association for Computational Linguistics: EMNLP 2020, pp. 708–718, 2020.
|
| 236 |
+
OpenAI. Gpt-4 technical report, 2023.
|
| 237 |
+
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.
|
| 238 |
+
Zhen Qin, Le Yan, Honglei Zhuang, Yi Tay, Rama Kumar Pasumarthi, Xuanhui Wang, Michael Bendersky, and Marc Najork. Are neural rankers still outperformed by gradient boosted decision trees? In International Conference on Learning Representations, 2021.
|
| 239 |
+
|
| 240 |
+
Devendra Singh Sachan, Mike Lewis, Mandar Joshi, Armen Aghajanyan, Wen-tau Yih, Joelle Pineau, and Luke Zettlemoyer. Improving passage retrieval with zero-shot question generation. arXiv preprint arXiv:2204.07496, 2022.
|
| 241 |
+
|
| 242 |
+
Weiwei Sun, Lingyong Yan, Xinyu Ma, Pengjie Ren, Dawei Yin, and Zhaochun Ren. Is ChatGPT good at search? investigating large language models as re-ranking agent. arXiv preprint arXiv:2304.09542, 2023.
|
| 243 |
+
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.
|
| 244 |
+
Yi Tay, Mostafa Dehghani, Vinh Q Tran, Xavier Garcia, Dara Bahri, Tal Schuster, Huaixiu Steven Zheng, Neil Houlsby, and Donald Metzler. Unifying language learning paradigms. arXiv preprint arXiv:2205.05131, 2022a.
|
| 245 |
+
Yi Tay, Vinh 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. Advances in Neural Information Processing Systems, 35:21831–21843, 2022b.
|
| 246 |
+
Nandan Thakur, Nils Reimers, Andreas Rücklé, Abhishek Srivastava, and Iryna Gurevych. BEIR: A heterogeneous benchmark for zero-shot evaluation of information retrieval models. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 2), 2021. URL https://openreview.net/forum?id ${ . } = { }$ wCu6T5xFjeJ.
|
| 247 |
+
Adam VanBuskirk. GPT-3.5 Turbo vs GPT-4: What’s the difference? https://blog.wordbot.io/ai-artificial-intelligence/ gpt-3-5-turbo-vs-gpt-4-whats-the-difference, 2023. Accessed: 2023- 06-06.
|
| 248 |
+
Henning Wachsmuth, Shahbaz Syed, and Benno Stein. Retrieval of the best counterargument without prior topic knowledge. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 241–251. Association for Computational Linguistics, 2018.
|
| 249 |
+
Liang Wang, Nan Yang, and Furu Wei. Query2doc: Query expansion with large language models. arXiv preprint arXiv:2303.07678, 2023.
|
| 250 |
+
Yujing Wang, Yingyan Hou, Haonan Wang, Ziming Miao, Shibin Wu, Qi Chen, Yuqing Xia, Chengmin Chi, Guoshuai Zhao, Zheng Liu, et al. A neural corpus indexer for document retrieval. Advances in Neural Information Processing Systems, 35:25600–25614, 2022.
|
| 251 |
+
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.
|
| 252 |
+
Yutao Zhu, Huaying Yuan, Shuting Wang, Jiongnan Liu, Wenhan Liu, Chenlong Deng, Zhicheng Dou, and Ji-Rong Wen. Large language models for information retrieval: A survey. arXiv preprint arXiv:2308.07107, 2023.
|
| 253 |
+
Honglei Zhuang, Zhen Qin, Shuguang Han, Xuanhui Wang, Michael Bendersky, and Marc Najork. Ensemble distillation for BERT-based ranking models. In Proceedings of the 2021 ACM SIGIR International Conference on Theory of Information Retrieval, pp. 131–136, 2021.
|
| 254 |
+
Honglei Zhuang, Zhen Qin, Rolf Jagerman, Kai Hui, Ji Ma, Jing Lu, Jianmo Ni, Xuanhui Wang, and Michael Bendersky. RankT5: Fine-tuning T5 for text ranking with ranking losses. In Proceedings of the 46th International ACM SIGIR Conference on Research and Development in Information Retrieval, 2023.
|
| 255 |
+
|
| 256 |
+
# APPENDIX
|
| 257 |
+
|
| 258 |
+
# A ROBUSTNESS TO INPUT ORDERING
|
| 259 |
+
|
| 260 |
+
One issue of listwise ranking prompting approaches is their sensitivity to input ordering. This is because the ranking will fall back to the initial order when LLM prediction fails, which is very common for the difficult listwise formulation. In Table 4 we show results of different methods by inverting the initial order from BM25.
|
| 261 |
+
|
| 262 |
+
Table 4: Input order sensitivity results on the TREC-DL2019 dataset.
|
| 263 |
+
|
| 264 |
+
<table><tr><td>Method 一</td><td>LLM</td><td>Init Order</td><td>I| NDCG@1</td><td>NDCG@5</td><td>NDCG@10</td></tr><tr><td>RankGPT RankGPT</td><td>gpt-3.5-turbo gpt-3.5-turbo</td><td>BM25 Inverse BM25</td><td>82.17 36.43</td><td>71.15 31.79</td><td>65.80 32.77</td></tr><tr><td>PRP-Allpair PRP-Allpair</td><td>FLAN-UL2-20B FLAN-UL2-20B</td><td>BM25 Inverse BM25</td><td>73.64 74.42</td><td>74.77 74.48</td><td>72.42 72.40</td></tr><tr><td>PRP-Sliding-1 PRP-Sliding-1</td><td>FLAN-UL2-20B FLAN-UL2-20B</td><td>BM25 Inverse BM25</td><td>78.29 71.32</td><td>62.15 32.72</td><td>57.58 26.04</td></tr><tr><td>PRP-Sliding-10 PRP-Sliding-10</td><td>FLAN-UL2-20B FLAN-UL2-20B</td><td>BM25 Inverse BM25</td><td>78.29 71.32</td><td>75.49 67.91</td><td>72.65 64.84</td></tr></table>
|
| 265 |
+
|
| 266 |
+
As expected, PRP-Allpair is quite robust to initial ordering, and PRP-Sliding-1 will suffer for metrics other than NDCG $@ 1$ . PRP-Sliding-10 is quite robust since it focuses on Top-K ranking metrics.
|
| 267 |
+
|
| 268 |
+
# B COMPARISON OF SCORING MODE AND GENERATION MODE
|
| 269 |
+
|
| 270 |
+
Our results above are all based on the scoring mode, since PRP only need to get scores for two candidate outputs ("Passage A" and "Passage B") and it is easy to get probabilities from open-sourced LLMs. Here we compare against PRP performance using scoring vs generation mode in Table 5, which will shed light on how PRP works on generation-only LLM APIs.
|
| 271 |
+
|
| 272 |
+
Table 5: Results on TREC-DL2019 and TREC-DL2020 datasets using scoring vs generation mode for PRP.
|
| 273 |
+
|
| 274 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">LLM</td><td rowspan="2">Mode</td><td colspan="3">NDCG@1 NDC-DL20NDCG@ 10</td><td colspan="3">NDCG@1TRDC-DL20NDCG@10</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>PRP-Allpair</td><td>FLAN-T5-XL</td><td>Scoring.</td><td>74.03</td><td>71.73</td><td>69.75</td><td>79.01</td><td>72.22</td><td>68.12</td></tr><tr><td>PRP-Allpair</td><td>FLAN-T5-XL</td><td>Generation</td><td>74.03</td><td>71.68</td><td>69.59</td><td>79.01</td><td>71.54</td><td>67.75</td></tr><tr><td>PRP-Allpair</td><td>FLAN-T5-XXL</td><td>Scoring</td><td>72.09</td><td>71.28</td><td>69.87</td><td>82.41</td><td>74.16</td><td>69.85</td></tr><tr><td>PRP-Allpair</td><td>FLAN-T5-XXL</td><td>Generation</td><td>72.09</td><td>71.61</td><td>69.94</td><td>80.56</td><td>73.69</td><td>69.53</td></tr><tr><td>PRP-Allpair</td><td>FLAN-UL2</td><td>Scoring</td><td>73.64</td><td>74.77</td><td>72.42</td><td>85.19</td><td>74.73</td><td>70.68</td></tr><tr><td>PRP-Allpair</td><td>FLAN-UL2</td><td>Generation</td><td>73.64</td><td>74.84</td><td>72.37</td><td>85.19</td><td>74.74</td><td>70.69</td></tr></table>
|
| 275 |
+
|
| 276 |
+
We can see that PRP is extremely robust to scoring vs generation API, even for smaller LLMs, showing its applicability to different LLMs systems. The results are intuitive - LLMs make few generation mistakes due to the simplicity of PRP. We found that there are only about $0 . 0 2 \%$ predictions that do not follow the desired format, which is neglectable and in stark contrast to the the listwise approaches.
|
| 277 |
+
|
| 278 |
+
# C MORE RESULTS ON PRP-SLIDING-K
|
| 279 |
+
|
| 280 |
+
We show more results on PRP-Sliding-K variants to better understand the behaviors, including multiple backward passes and a forward pass variant1. The results are shown in Table 6 and Table 7 on TREC-DL2019 and TREC-DL2020 with consistent behaviors.
|
| 281 |
+
|
| 282 |
+
The results are easy to interpret:
|
| 283 |
+
|
| 284 |
+
• The behavior is similar to BubbleSort: Strong NDCG $@ 1$ can already be achieved with one backward pass. As we conduct more passes, other Top-K ranking metrics get better.
|
| 285 |
+
|
| 286 |
+
Table 6: Sliding window results on the TREC-DL2019 dataset.
|
| 287 |
+
|
| 288 |
+
<table><tr><td>Method</td><td>LLM</td><td>Strategy</td><td>NDCG@1</td><td>NDCG@5</td><td>NDCG@10</td></tr><tr><td>PRP-Sliding</td><td>FLAN-UL2-20B</td><td>1Forward</td><td>63.95</td><td>57.31</td><td>54.10</td></tr><tr><td>PRP-Sliding</td><td>FLAN-UL2-20B</td><td>1Backward</td><td>78.29</td><td>62.15</td><td>57.58</td></tr><tr><td>PRP-Sliding</td><td>FLAN-UL2-20B</td><td>2 Backward</td><td>78.29</td><td>67.01</td><td>61.52</td></tr><tr><td>PRP-Sliding</td><td>FLAN-UL2-20B</td><td>3Backward</td><td>78.29</td><td>70.72</td><td>64.60</td></tr><tr><td>PRP-Sliding</td><td>FLAN-UL2-20B</td><td>10 Backward</td><td>78.29</td><td>75.49</td><td>72.65</td></tr></table>
|
| 289 |
+
|
| 290 |
+
Table 7: Sliding window results on the TREC-DL2020 dataset.
|
| 291 |
+
|
| 292 |
+
<table><tr><td>Method</td><td>LLM</td><td>Strategy</td><td>NDCG@1</td><td>NDCG@5</td><td>NDCG@10</td></tr><tr><td>PRP-Sliding</td><td>FLAN-UL2-20B</td><td>1Forward</td><td>65.74</td><td>54.72</td><td>51.21</td></tr><tr><td>PRP-Sliding</td><td>FLAN-UL2-20B</td><td>1Backward</td><td>85.80</td><td>61.60</td><td>57.06</td></tr><tr><td>PRP-Sliding</td><td>FLAN-UL2-20B</td><td>2 Backward</td><td>85.80</td><td>66.51</td><td>61.11</td></tr><tr><td>PRP-Sliding</td><td>FLAN-UL2-20B</td><td>3Backward</td><td>85.80</td><td>71.06</td><td>63.45</td></tr><tr><td>PRP-Sliding</td><td>FLAN-UL2-20B</td><td>10 Backward</td><td>85.80</td><td>75.35</td><td>70.46</td></tr></table>
|
| 293 |
+
|
| 294 |
+
• Forward pass does not work well, which is intuitive, since it mainly performs demotion and is much less efficient in bringing good results to the top.
|
| 295 |
+
|
| 296 |
+
# D MORE DISCUSSION ON LIMITATIONS AND FUTURE WORK
|
| 297 |
+
|
| 298 |
+
Cost and Efficiency. We discussed different efficient variants of PRP. Also, our results are based on LLMs that are easily approachable for academic researchers (Taori et al., 2023), alleviating the need to call commercial APIs. However, further reducing the number of calls to LLMs is still an interesting research direction, such as leveraging active learning techniques.
|
| 299 |
+
|
| 300 |
+
Domain adaptation. The datasets used in this paper are for the standard and important relevancebased text ranking. How LLMs can be adapted to non-standard ranking datasets, such as counter arguments in the ArguAna dataset (Wachsmuth et al., 2018), need more investigation. Our work can facilitate such explorations by providing approachable baselines.
|
| 301 |
+
|
| 302 |
+
Other Models. We do not use GPT models (though we compare with them using results from other papers) in this work due to various constraints. Testing the performance of our methods on such models is meaningful benchmarking effort.
|
| 303 |
+
|
| 304 |
+
Ranking-aware LLMs. We, as other existing work, focus on unsupervised ranking with off-theshelf LLMs, and show that pairwise ranking is the ideal prompting unit. How to make LLMs more ranking-aware, in a data efficient manner, while maintaining their generality for other tasks, is a challenging research direction.
|
| 305 |
+
|
| 306 |
+
Data leakage. We mainly use open-sourced FLAN models (Wei et al., 2021) with clear documentations, which neither observed ranking supervision from any of the datasets we evaluated upon, nor was instruction fine-tuned on any ranking tasks. Also, the labels in the datasets are dense human annotations for each query against many documents, which are not used in the open-sourced LLMs and are very different from the potential usage of document corpus during pre-training. These are in contrast to methods based blackbox LLMs such as ChatGPT or GPT-4 (Sun et al., 2023) where the tuning details are unclear. We do note that FLAN models have a question answering task based on MSMARCO, which is not ranking specific, and is different from TREC-DL datasets in terms of queries and annotations, and is different from BEIR collection in all aspects. On the other hand, whether blackbox LLMs directly use TREC-DL datasets or BEIR datasets is unclear.
|
| 307 |
+
|
| 308 |
+
# E MORE DISCUSSION ON BASELINE AND DATASET SELECTION
|
| 309 |
+
|
| 310 |
+
For the BEIR evaluation, we choose not to include the Promptagator $^ { + + }$ ranker (Dai et al., 2022) since 1) It uses different prompts and fine-tuned models for each task, different from all other LLM methods. 2) The method was evaluated on a different set of BEIR tasks. Even for the shared tasks, it reranks top 200 results from a stronger retriever than BM25 so the numbers are not comparable. Nevertheless, zero-shot Promptagator $^ { + + }$ performed significantly worse than the monoT5 baseline in the paper (to be fair, the paper’s focus was mainly on few-shot scenarios), while PRP compares favorably with monoT5.
|
| 311 |
+
|
| 312 |
+
The only dataset we did not include, but (Sun et al., 2023) included, from the BEIR collection, is the NFCorpus dataset. This is because the metrics using BM25 reported in (Sun et al., 2023) on NFCorpus does not match ours and the public consensus numbers (while the numbers match for all selected datasets), so we exclude NFCorpus to avoid unfair comparisons possibly due to errors during their evaluation.
|
| 313 |
+
|
| 314 |
+
# F REPRODUCIBILITY
|
| 315 |
+
|
| 316 |
+
# F.1 PAIRWISE RANKING PROMPTING TEMPLATE
|
| 317 |
+
|
| 318 |
+
We note that we used the same prompt template for all 9 datasets evaluated in the paper, showing the generality and power of pairwise ranking prompting in text ranking. Below is the prompt template:
|
| 319 |
+
|
| 320 |
+
Given a query {query}, which of the following two passages is more relevant to the query?
|
| 321 |
+
Passage A: {document1}
|
| 322 |
+
Passage B: {document2}
|
| 323 |
+
Output Passage A or Passage B:
|
| 324 |
+
|
| 325 |
+
# F.2 CODE AND DATA RELEASE
|
| 326 |
+
|
| 327 |
+
As we focus on open-sourced LLMs, and only use standard aggregation methods (win counting, sorting, and sliding window), our experimental results are easy to reproduce. We plan to release the code (including the prompt and the rank aggregation functions). Further we plan to release pairwise inference results on all 9 datasets and the 3 open-source LLMs to facilitate future research. In specific, we will release the data in the following json format, which includes query/document information for each pair (including ids, text, label, retrieval rank and scores), together with the actual prompt, the generated text, and its score. Below is an example on the Trec-DL2020 dataset with Flan-UL2:
|
| 328 |
+
|
| 329 |
+
"document_pair": [{"document_id": "8512412", "retriever_rank": " $" 5 0"$ , "retriever_score": "8.984600", "document": "When in Doubt, Take a Cab. Taxis might be expensive in Puerto Rico, but they are safe and available. At night, it’s definitely the best way to get around. Look for the white taxis with the distinctive garita, or sentry box, icon painted on them.They are usually found at designated taxi stands.hen in Doubt, Take a Cab. Taxis might be expensive in Puerto Rico, but they are safe and available. At night, it’s definitely the best way to get around. Look for the white taxis with the distinctive garita, or sentry box, icon painted on them.", "relevance": -1}, {"document_id": "6623205", "retriever_rank": "66", "retriever_score": "8.812100", "document": "Thankfully, there are a couple of ways to prevent your whites from turning yellow: 1 Never bleach white clothing that is polyester or a polyester/cotton blend. 2 The chemical reaction between the bleach and the polyester almost always yields a yellowed result. 3 Consider a water softener if you have well-water.hankfully, there are a couple of ways to prevent your whites from turning yellow: 1 Never bleach white clothing that is polyester or a polyester/cotton blend. 2 Consider a water softener if you have well-water. 3 Minimize your use of bleach altogether.", "relevance": 1.0}],
|
| 330 |
+
|
| 331 |
+
"query_id": "1108651",
|
| 332 |
+
|
| 333 |
+
"query": "what the best way to get clothes white", "prompt": "Given a query “what the best way to get clothes white”, which of the following two passages is more relevant to the query?
|
| 334 |
+
|
| 335 |
+
Passage A: When in Doubt, Take a Cab. Taxis might be expensive in Puerto Rico, but they are safe and available. At night, it’s definitely the best way to get around. Look for the white taxis with the distinctive garita, or sentry box, icon painted on them.They are usually found at designated taxi stands.hen in Doubt, Take a Cab. Taxis might be expensive in Puerto Rico, but they are safe and available. At night, it’s definitely the best way to get around. Look for the white taxis with the distinctive garita, or sentry box, icon painted on them.
|
| 336 |
+
|
| 337 |
+
Passage B: Thankfully, there are a couple of ways to prevent your whites from turning yellow: 1 Never bleach white clothing that is polyester or a polyester/cotton blend. 2 The chemical reaction between the bleach and the polyester almost always yields a yellowed result. 3 Consider a water softener if you have well-water.hankfully, there are a couple of ways to prevent your whites from turning yellow: 1 Never bleach white clothing that is polyester or a polyester/cotton blend. 2 Consider a water softener if you have well-water. 3 Minimize your use of bleach altogether.
|
| 338 |
+
|
| 339 |
+
Output Passage A or Passage B:", "generated_text": "Passage B", "prediction_score": -0.0025123630184680223
|
md/test/rAnB7JSMXL/rAnB7JSMXL.md
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Convolutions Attention MLPs Patches Are All You Need?
|
| 2 |
+
|
| 3 |
+
Asher Trockman, J. Zico Kolter1 Carnegie Mellon University and $^ 1$ Bosch Center for AI
|
| 4 |
+
|
| 5 |
+
Reviewed on OpenReview: https: // openreview. net/ forum? id= rAnB7JSMXL
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Although convolutional neural networks have been the dominant architecture for computer vision for many years, Vision Transformers (ViTs) have recently shown promise as an alternative. Subsequently, many new models have been proposed which replace the self-attention layer within the ViT architecture with novel operations (such as MLPs), all of which have also been relatively performant. We note that these architectures all share a common component—the patch embedding layer—which enables the use of a simple isotropic template with alternating steps of channel- and spatial-dimension mixing. This raises a question: is the success of ViT-style models due to novel, highly-expressive operations like self-attention, or is it at least in part due to using patches? In this paper, we present some evidence for the latter: specifically, we propose the ConvMixer, an extremely simple and parameter-efficient fully-convolutional model in which we replace the self-attention and MLP layers within the ViT with less-expressive depthwise and pointwise convolutional layers, respectively. Despite its unusual simplicity, ConvMixer outperforms the ViT, MLP-Mixer, and their variants for similar data set sizes and parameter counts, in addition to outperforming classical vision models like ResNet. We argue that this contributes to the evidence that patches are sufficient for designing simple and effective vision models. Our code is available at https://github.com/locuslab/convmixer.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
For many years, convolutional neural networks have been the dominant architecture for deep learning systems applied to computer vision tasks. But recently, architectures based upon Transformer models, e.g., the so-called VisionTransformer architecture (Dosovitskiy et al., 2020), have demonstrated compelling performance in many of these tasks, often outperforming classical convolutional architectures, especially for large data sets. An understandable assumption, then, is that it is only a matter of time before Transformers become the dominant architecture for vision domains, just as they have for language processing. In order to apply Transformers to images, however, the representation had to be changed: because the computational cost of the self-attention layers used in Transformers would scale quadratically with the number of pixels per image if applied naively at the per-pixel level, the compromise was to first split the image into multiple “patches”, linearly embed them, and then apply the transformer directly to this collection of patches.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Acc. vs. params., trained $\&$ tested on ImNet-1k; ResNets newly-trained (same procedure as ConvMixers).
|
| 17 |
+
|
| 18 |
+

|
| 19 |
+
Figure 2: ConvMixer uses “tensor layout” patch embeddings to preserve locality, and then applies $d$ copies of a simple fully-convolutional block consisting of large-kernel depthwise convolution followed by pointwise convolution, before finishing with global pooling and a simple linear classifier.
|
| 20 |
+
Figure 3: Implementation of ConvMixer in PyTorch; see Appendix E for more implementations.
|
| 21 |
+
|
| 22 |
+
1 import torch.nn as nn 2 3 class Residual(nn.Module): 4 def __init__(self, fn): 5 super().__init__() 6 self.fn $=$ fn 7 8 def forward(self, x): 9 return self. $\mathbf { f } \mathbf { n } ( \mathbf { x } ) ~ + ~ \mathbf { x }$ 10 11 def ConvMixer(dim, depth, kernel_size $^ { = 9 }$ , patch_size $^ { = 7 }$ , n_classes 1000): 12 return nn.Sequential( 13 nn.Conv2d(3, dim, kernel_size=patch_size, stride=patch_size), 14 nn.GELU(), 15 nn.BatchNorm2d(dim), 16 $^ *$ [nn.Sequential( 17 Residual(nn.Sequential( 18 nn.Conv2d(dim, dim, kernel_size, groups $=$ dim, padding="same"), 19 nn.GELU(), 20 nn.BatchNorm2d(dim) 21 )), 22 nn.Conv2d(dim, dim, kernel_size $^ { = 1 }$ ), 23 nn.GELU(), 24 nn.BatchNorm2d(dim) 25 ) for i in range(depth)], 26 nn.AdaptiveAvgPool2d((1,1)), 27 nn.Flatten(), 28 nn.Linear(dim, n_classes) 29 )
|
| 23 |
+
|
| 24 |
+
Many subsequent works have modified the architecture of the ViT, replacing self-attention with novel operations and making other small changes, all of which have been relatively performant. These architectures follow a common and very simple “template”: they are isotropic, maintaining equal size and resolution throughout the network, and apply alternating steps of spatial and channel mixing. They also all use patch embeddings, which moves all downsampling to the beginning of the network and enables the simple, isotropic mixing design.
|
| 25 |
+
|
| 26 |
+
In this work, we explore the question of whether, fundamentally, the strong performance of vision transformers may result more from this patch-based representation and its simplifying consequences for architecture design, than from the use of novel and highly-expressive operations such as self-attention and MLPs. We develop a very simple convolutional architecture which we dub the “ConvMixer” due to its similarity to the recently-proposed MLP-Mixer (Tolstikhin et al., 2021). This architecture is similar to the Vision Transformer (and MLP-Mixer) in many respects: it directly operates on patches, it maintains an equal-resolution-andsize representation throughout all layers, it does no downsampling of the representation at successive layers, and it separates “channel-wise mixing” from the “spatial mixing” of information. But unlike the Vision Transformer and MLP-Mixer, our architecture does all these operations via only standard convolutions. As depthwise and pointwise convolution are less expressive than self-attention and MLPs respectively, we believe this suggests that the patch-based isotropic mixing architecture is a powerful primitive that works well with almost any choice of well-behaved mixing operations.
|
| 27 |
+
|
| 28 |
+
The chief result we show in this paper is that this ConvMixer architecture, despite its extreme simplicity (it can be implemented in 280 characters of dense PyTorch code; see Appendix E), outperforms both “standard” computer vision models such as ResNets of similar parameter counts and some corresponding Vision Transformer and MLP-Mixer variants, even with a slate of additions intended to make those architectures more performant on smaller data sets. Importantly, this is despite the fact that we did not design our experiments to maximize accuracy nor speed, in contrast to the models we compared against. Our results suggest that, at least to some extent, the patch representation itself may be a critical component to the “superior” performance of newer architectures like Vision Transformers. While these results are naturally just a snapshot, and more experiments are required to exactly disentangle the effect of patch embeddings from other factors, we believe that this provides a strong “convolutional-but-patch-based” baseline to compare against for more advanced architectures in the future.
|
| 29 |
+
|
| 30 |
+
# 2 A simple model: ConvMixer
|
| 31 |
+
|
| 32 |
+
Our model, dubbed ConvMixer, consists of a patch embedding layer followed by repeated applications of a simple fully-convolutional block. We maintain the spatial structure of the patch embeddings, as illustrated in Fig. 2. Patch embeddings with patch size $p$ and embedding dimension $h$ can be implemented as convolution with $c _ { \mathrm { i n } }$ input channels, $h$ output channels, kernel size $p$ , and stride $p$ :
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
z _ { 0 } = \mathsf { B N } ( \sigma \{ \mathsf { C o n v } _ { c _ { \mathrm { i n } } h } ( X , \mathsf { s t r i d e } = p , \mathsf { k s i z e } { = } p ) \} )
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
The ConvMixer block itself consists of depthwise convolution (i.e., grouped convolution with groups equal to the number of channels, $h$ ) followed by pointwise (i.e., kernel size $1 \times 1$ ) convolution. As we will explain in Sec. 3, ConvMixers work best with unusually large kernel sizes for the depthwise convolution. Each of the convolutions is followed by an activation and post-activation BatchNorm:
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
\begin{array} { r } { z _ { l } ^ { \prime } = \mathsf { B N } \left( \sigma \{ \mathsf { C o n v D e p t h w i s e } ( z _ { l - 1 } ) \} \right) + z _ { l - 1 } } \\ { z _ { l + 1 } = \mathsf { B N } \left( \sigma \{ \mathsf { C o n v P o i n t w i s e } ( z _ { l } ^ { \prime } ) \} \right) } \end{array}
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
After many applications of this block, we perform global pooling to get a feature vector of size $h$ , which we pass to a softmax classifier. See Fig. 3 for an implementation of ConvMixer in PyTorch.
|
| 45 |
+
|
| 46 |
+
Design parameters. An instantiation of ConvMixer depends on four parameters: (1) the “width” or hidden dimension $h$ (i.e., the dimension of the patch embeddings), (2) the depth $d$ , or the number of repetitions of the ConvMixer layer, (3) the patch size $p$ which controls the internal resolution of the model, and (4) the kernel size $k$ of the depthwise convolutional layer. We name ConvMixers after their hidden dimension and depth, like ConvMixer- $h / d$ . We refer to the original input size $n$ divided by the patch size $p$ as the internal resolution; note, however, that ConvMixers support variable-sized inputs.
|
| 47 |
+
|
| 48 |
+
Motivation. Our architecture is based on the idea of mixing, as in Tolstikhin et al. (2021). In particular, we chose depthwise convolution to mix spatial locations and pointwise convolution to mix channel locations. A key idea from previous work is that MLPs and self-attention can mix distant spatial locations, i.e., they can have an arbitrarily large receptive field. Consequently, we used convolutions with an unusually large kernel size to mix distant spatial locations.
|
| 49 |
+
|
| 50 |
+
While self-attention and MLPs are theoretically more flexible, allowing for large receptive fields and contentaware behavior, the inductive bias of convolution is well-suited to vision tasks and leads to high data efficiency. By using such a standard operation, we also get a glimpse into the effect of the patch representation itself in contrast to the conventional pyramid-shaped, progressively-downsampling design of convolutional networks.
|
| 51 |
+
|
| 52 |
+
Table 1: Models trained and evaluated on $2 2 4 \times 2 2 4$ ImageNet-1k only. See more in Appendix A.
|
| 53 |
+
|
| 54 |
+
<table><tr><td colspan="8">Current“Most Interesting” ConvMixer Configurations us. Other Simple Models</td></tr><tr><td>Network</td><td>Pateh</td><td>Kernel1</td><td>#Param</td><td>Throughput</td><td>Act</td><td>#Epochs</td><td></td></tr><tr><td>ConvMixer-1536/20</td><td>7</td><td>9</td><td>51.6</td><td>134</td><td>G</td><td>150</td><td>81.37</td></tr><tr><td>ConvMixer-768/32</td><td>7</td><td>7</td><td>21.1</td><td>206</td><td>R</td><td>300</td><td>80.16</td></tr><tr><td>ConvMixer-1536/20</td><td>14</td><td>9</td><td>52.3</td><td>538</td><td>G</td><td>150</td><td>78.92</td></tr><tr><td>ResNet-152</td><td>1</td><td>3</td><td>60.2</td><td>828</td><td>R</td><td>150</td><td>79.64</td></tr><tr><td>DeiT-B</td><td>16</td><td>1</td><td>86</td><td>792</td><td>G</td><td>300</td><td>81.8</td></tr><tr><td>ResMLP-B24/8</td><td>8</td><td>1</td><td>129</td><td>181</td><td>G</td><td>400</td><td>81.0</td></tr></table>
|
| 55 |
+
|
| 56 |
+
# 3 Experiments
|
| 57 |
+
|
| 58 |
+
Training setup. We primarily evaluate ConvMixers on ImageNet-1k classification without any pretraining or additional data. We added ConvMixer to the timm framework (Wightman, 2019) and trained it with nearly-standard settings for the common training procedure from this library: we used RandAugment (Cubuk et al., 2020), mixup (Zhang et al., 2017), CutMix (Yun et al., 2019), random erasing (Zhong et al., 2020), and gradient norm clipping in addition to default timm augmentation. We used the AdamW (Loshchilov & Hutter, 2018) optimizer and a simple triangular learning rate schedule. Due to limited compute, we did virtually no hyperparameter tuning on ImageNet and trained for fewer epochs than competitors. Consequently, our models could be over- or under-regularized, and the accuracies we report likely underestimate the capabilities of our model.
|
| 59 |
+
|
| 60 |
+
Results. A ConvMixer-1536/20 with 52M parameters can achieve 81.4% top-1 accuracy on ImageNet, and a ConvMixer-768/32 with 21M parameters $8 0 . 2 \%$ (see Table 1). Wider ConvMixers seem to converge in fewer epochs, but are more memory- and compute-hungry. They also work best with large kernel sizes: ConvMixer-1536/20 lost $\approx 1 \%$ accuracy when reducing the kernel size from $k = 9$ to $k = 3$ (we discuss kernel sizes more in Appendix A, B, & C). ConvMixers with smaller patches are substantially better in our experiments, similarly to Sandler et al. (2019); we believe larger patches require deeper ConvMixers. With everything held equal except increasing the patch size from 7 to 14, ConvMixer-1536/20 achieves $7 8 . 9 \%$ top-1 accuracy but is around 4 $\times$ faster. We trained one model with ReLU to demonstrate that GELU (Hendrycks & Gimpel, 2016), which is popular in recent isotropic models, isn’t necessary.
|
| 61 |
+
|
| 62 |
+
Comparisons. Our model and ImageNet1k-only training setup closely resemble that of recent patch-based models like DeiT (Touvron et al., 2020). Due to ConvMixer’s simplicity, we focus on comparing to only the most basic isotropic patch-based architectures adapted to the ImageNet-1k setting, namely DeiT and ResMLP. Attempting a fair comparison with a standard baseline, we trained ResNets using exactly the same parameters as ConvMixers; while this choice of parameters is suboptimal (Wightman et al., 2021), it is likely also suboptimal for ConvMixers, since we did no hyperparameter tuning aside from our recent adoption of hyperparameters from Wightman et al. (2021) for some models (presented separately in Appendix A). Looking at Table 1 and Fig. 1, ConvMixers achieve competitive accuracies for a given parameter budget: ConvMixer1536/20 outperforms both ResNet-152, ResMLP-B24, and DeiT-B despite having substantially fewer parameters. ConvMixer-768/32 uses just a third of the parameters of ResNet-152, but is similarly accurate. Note that unlike ConvMixer, the DeiT and ResMLP results involved hyperparameter tuning, and when substantial resources are dedicated to tuning ResNets, including training for twice as many epochs, they only outperform an equivalently-sized ConvMixer by $\approx 0 . 2 \%$ (Wightman et al., 2021). However, ConvMixers are substantially slower at inference than the competitors, likely due to their smaller patch size; hyperparameter tuning and optimizations could narrow this gap. For more discussion and comparisons, see Table 2 and Appendix A.
|
| 63 |
+
|
| 64 |
+
Hyperparameters. For almost all experiments presented in the main text, we used only one set of “common sense” hyperparameters for the regularization methods. Recently, we adapted hyperparameters from the A1 procedure in Wightman et al. (2021), published after our work, which were better than
|
| 65 |
+
|
| 66 |
+
our initial guess, e.g., giving $+ 0 . 8 \%$ for ConvMixer-1536/20, or $8 2 . 2 \%$ top-1 accuracy (see Appendix A).
|
| 67 |
+
However, we note that such optimal ResNet hyperparameters are likely not optimal for ConvMixers.
|
| 68 |
+
|
| 69 |
+
Additional experiments. We present additional ImageNet experiments in Appendix B; notably, we provide more evidence for the advantage of large-kernel convolutions. We also performed smaller-scale experiments on CIFAR-10, where ConvMixers achieve over 96% accuracy with as few as 0.7M parameters, demonstrating the data efficiency of the convolutional inductive bias. Details of these experiments are presented in Appendix C.
|
| 70 |
+
|
| 71 |
+
# 4 Related work
|
| 72 |
+
|
| 73 |
+
Isotropic architectures. Vision transformers have inspired a new paradigm of “isotropic” architectures, i.e., those with equal size and shape throughout the network, which use patch embeddings for the first layer. These models look similar to repeated transformer-encoder blocks (Vaswani et al., 2017) with different operations replacing the self-attention and MLP operations. For example, MLP-Mixer (Tolstikhin et al., 2021) replaces them both with MLPs applied across different dimensions (i.e., spatial and channel location mixing); ResMLP (Touvron et al., 2021a) is a data-efficient variation on this theme. CycleMLP (Chen et al., 2021), gMLP (Liu et al., 2021a), and vision permutator (Hou et al., 2021), replace one or both blocks with various novel operations. These are all quite performant, which is typically attributed to the novel choice of operations. In contrast, Melas-Kyriazi (2021) proposed an MLP-based isotropic vision model, and also hypothesized patch embeddings could be behind its performance. ResMLP tried replacing its linear interaction layer with (small-kernel) convolution and achieved good performance, but kept its MLP-based cross-channel layer and did not explore convolutions further. As our investigation of ConvMixers suggests, these works may conflate the effect of the new operations (like self-attention and MLPs) with the effect of the use of patch embeddings and the resulting isotropic architecture.
|
| 74 |
+
|
| 75 |
+
After our investigation, Liu et al. (2022) proposed an architecture similar to ConvMixer, the isotropic ConvNeXt. Similarly to our work, they provide evidence that the success of ViTs comes from design choices other than the use of self-attention, such as patches; however, ConvMixer goes a step further and eliminates even the MLPs, which suggests that neither of the original ViT operations are crucial to the success of the more general architecture design. Further, Yu et al. (2022) replaced self-attention with a simple pooling operation and demonstrated its effectiveness; they also argued this supports the effectiveness of the ViT template. In contrast, our work suggests the template is even more general, not even requiring MLPs.
|
| 76 |
+
|
| 77 |
+
A study predating vision transformers investigates isotropic (or “isometric”) MobileNets (Sandler et al., 2019), and even implements patch embeddings under another name. Their architecture simply repeats an isotropic MobileNetv3 block. They identify a tradeoff between patch size and accuracy that matches our experience, and train similarly performant models (see Appendix A, Table 2). However, their block is substantially more complex than ours; simplicity and motivation sets our work apart.
|
| 78 |
+
|
| 79 |
+
Patches aren’t all you need? Several papers have increased vision transformer performance by replacing standard patch embeddings with a different stem: Xiao et al. (2021) and Yuan et al. (2021a) use a standard convolutional stem, while Yuan et al. (2021b) repeatedly combines nearby patch embeddings. However, this conflates the effect of using patch embeddings with the effect of adding convolution or similar inductive biases e.g., locality. We attempt to focus on the use of patches.
|
| 80 |
+
|
| 81 |
+
CNNs meet ViTs. Many efforts have been made to incorporate features of convolutional networks into vision transformers and vice versa. Self-attention can emulate convolution (Cordonnier et al., 2019) and can be initialized or regularized to be like it (d’Ascoli et al., 2021); other works simply add convolution operations to transformers (Dai et al., 2021; Guo et al., 2021), or include downsampling to be more like traditional pyramid-shaped convolutional networks (Wang et al., 2021). Conversely, self-attention or attention-like operations can supplement or replace convolution in ResNet-style models (Bello et al., 2019; Ramachandran et al., 2019; Bello, 2021). While all of these attempts have been successful in one way or another, they are orthogonal to this work, which aims to emphasize the effect of the architecture common to most ViTs by showcasing it with a less-expressive operation.
|
| 82 |
+
|
| 83 |
+
# 5 Conclusion
|
| 84 |
+
|
| 85 |
+
We presented ConvMixers, an extremely simple class of models that independently mixes the spatial and channel locations of patch embeddings using only standard convolutions. We also highlighted that using large kernel sizes, inspired by the large receptive fields of ViTs and MLP-Mixers, provides a substantial performance boost. While neither our model nor our experiments were designed to maximize accuracy or speed, i.e., we did not search for good hyperparameters, ConvMixers outperform the Vision Transformer and MLP-Mixer, and are competitive with ResNets, DeiTs, and ResMLPs.
|
| 86 |
+
|
| 87 |
+
We provided evidence that the increasingly common “isotropic” architecture with a simple patch embedding stem is itself a powerful template for deep learning. Patch embeddings allow all the downsampling to happen at once, immediately decreasing the internal resolution and thus increasing the effective receptive field size, making it easier to mix distant spatial information. Our title, while an exaggeration, points out that attention isn’t the only export from language processing into computer vision: tokenizing inputs, i.e., using patch embeddings, is also a powerful and important takeaway.
|
| 88 |
+
|
| 89 |
+
While our model is not state-of-the-art, we find its simple patch-mixing design to be compelling. We hope that ConvMixers can serve as a baseline for future patch-based architectures with novel operations, or that they can provide a basic template for new conceptually simple and performant models.
|
| 90 |
+
|
| 91 |
+
Given that such simple architectures as ConvMixer can be successful, we question the role of continued architecture searches; in particular, are more complicated architectures fundamentally better at modeling phenomena, or are they ultimately just more computationally efficient? Much of the variance in accuracies may be explained by more advanced training pipelines and augmentation techniques, as demonstrated by Wightman et al. (2021) and our work.
|
| 92 |
+
|
| 93 |
+
Future work. We are optimistic that a deeper ConvMixer with larger patches could reach a desirable tradeoff between accuracy, parameters, and throughput after longer training and more regularization and hyperparameter tuning, similarly to how Wightman et al. (2021) enhanced ResNet performance through carefully-designed training regimens. Low-level optimization of large-kernel depthwise convolution could substantially increase throughput, and small enhancements to our architecture like the addition of bottlenecks or a more expressive classifier could trade simplicity for performance.
|
| 94 |
+
|
| 95 |
+
Due to its large internal resolution and isotropic design, ConvMixer may be especially well-suited for semantic segmentation, and it would be useful to run experiments on this task with a ConvMixer-like model and on other tasks such as object detection. More experiments could be designed to more clearly extricate the effect of patch embeddings from other architectural choices. In particular, for a more in-depth comparison to ViTs and MLP-Mixers, which excel when trained on very large data sets, it is important to investigate the performance of ConvMixers in the regime of large-scale pre-training.
|
| 96 |
+
|
| 97 |
+
More work is necessary to extricate the effect of the patch embeddings from the rest of the architecture. In particular, we have preliminary evidence that it is not necessary to separate the spatial and channel mixing steps; patches followed by any stack of nonlinear operations (say, plain convolution) may be sufficient for simple, performant models.
|
| 98 |
+
|
| 99 |
+
Note on paper length. We acknowledge that this paper is shorter than most, and this is intentional. In the main text, we have presented our main thesis, proposed an extremely simple architecture used to validate the thesis, included a complete implementation, highlighted the results that we believe to be most relevant, and finished with concluding thoughts. The work here is very simple, and thus we believe that a short paper is ultimately more effective at conveying the main messages. While additional experiments and results are included in the appendix, we fully argue that the results in the main text are sufficient to establish our point, and that the supplementary material is genuinely of secondary importance. Hence, we felt the shorter length was more than sufficient.
|
| 100 |
+
|
| 101 |
+
# References
|
| 102 |
+
|
| 103 |
+
Irwan Bello. Lambdanetworks: Modeling long-range interactions without attention. arXiv preprint arXiv:2102.08602, 2021.
|
| 104 |
+
|
| 105 |
+
Irwan Bello, Barret Zoph, Ashish Vaswani, Jonathon Shlens, and Quoc V Le. Attention augmented convolutional networks. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 3286–3295, 2019.
|
| 106 |
+
Shoufa Chen, Enze Xie, Chongjian Ge, Ding Liang, and Ping Luo. Cyclemlp: A mlp-like architecture for dense prediction. arXiv preprint arXiv:2107.10224, 2021.
|
| 107 |
+
Jean-Baptiste Cordonnier, Andreas Loukas, and Martin Jaggi. On the relationship between self-attention and convolutional layers. arXiv preprint arXiv:1911.03584, 2019.
|
| 108 |
+
Ekin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical automated data augmentation with a reduced search space. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pp. 702–703, 2020.
|
| 109 |
+
Zihang Dai, Hanxiao Liu, Quoc V Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes. arXiv preprint arXiv:2106.04803, 2021.
|
| 110 |
+
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 preprint arXiv:2103.10697, 2021.
|
| 111 |
+
Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020.
|
| 112 |
+
Jianyuan Guo, Kai Han, Han Wu, Chang Xu, Yehui Tang, Chunjing Xu, and Yunhe Wang. Cmt: Convolutional neural networks meet vision transformers. arXiv preprint arXiv:2107.06263, 2021.
|
| 113 |
+
Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
|
| 114 |
+
Qibin Hou, Zihang Jiang, Li Yuan, Ming-Ming Cheng, Shuicheng Yan, and Jiashi Feng. Vision permutator: A permutable mlp-like architecture for visual recognition, 2021.
|
| 115 |
+
Hanxiao Liu, Zihang Dai, David R So, and Quoc V Le. Pay attention to mlps. arXiv preprint arXiv:2105.08050, 2021a.
|
| 116 |
+
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, 2021b.
|
| 117 |
+
Zhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, and Saining Xie. A convnet for the 2020s. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11976–11986, 2022.
|
| 118 |
+
Ilya Loshchilov and Frank Hutter. Fixing weight decay regularization in adam. 2018.
|
| 119 |
+
Luke Melas-Kyriazi. Do you even need attention? a stack of feed-forward layers does surprisingly well on imagenet, 2021.
|
| 120 |
+
Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jonathon Shlens. Stand-alone self-attention in vision models. arXiv preprint arXiv:1906.05909, 2019.
|
| 121 |
+
Mark Sandler, Jonathan Baccash, Andrey Zhmoginov, and Andrew Howard. Non-discriminative data or weak model? on the relative importance of data and model resolution. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, pp. 0–0, 2019.
|
| 122 |
+
Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, et al. Mlp-mixer: An all-mlp architecture for vision. arXiv preprint arXiv:2105.01601, 2021.
|
| 123 |
+
Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020.
|
| 124 |
+
Hugo Touvron, Piotr Bojanowski, Mathilde Caron, Matthieu Cord, Alaaeldin El-Nouby, Edouard Grave, Armand Joulin, Gabriel Synnaeve, Jakob Verbeek, and Hervé Jégou. Resmlp: Feedforward networks for image classification with data-efficient training. arXiv preprint arXiv:2105.03404, 2021a.
|
| 125 |
+
Hugo Touvron, Matthieu Cord, Alexandre Sablayrolles, Gabriel Synnaeve, and Hervé Jégou. Going deeper with image transformers. arXiv preprint arXiv:2103.17239, 2021b.
|
| 126 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
|
| 127 |
+
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 preprint arXiv:2102.12122, 2021.
|
| 128 |
+
Ross Wightman. Pytorch image models. https://github.com/rwightman/pytorch-image-models, 2019.
|
| 129 |
+
Ross Wightman, Hugo Touvron, and Hervé Jégou. Resnet strikes back: An improved training procedure in timm, 2021.
|
| 130 |
+
Tete Xiao, Mannat Singh, Eric Mintun, Trevor Darrell, Piotr Dollár, and Ross Girshick. Early convolutions help transformers see better. arXiv preprint arXiv:2106.14881, 2021.
|
| 131 |
+
Weihao Yu, Mi Luo, Pan Zhou, Chenyang Si, Yichen Zhou, Xinchao Wang, Jiashi Feng, and Shuicheng Yan. Metaformer is actually what you need for vision. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10819–10829, 2022.
|
| 132 |
+
Kun Yuan, Shaopeng Guo, Ziwei Liu, Aojun Zhou, Fengwei Yu, and Wei Wu. Incorporating convolution designs into visual transformers. arXiv preprint arXiv:2103.11816, 2021a.
|
| 133 |
+
Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zihang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. arXiv preprint arXiv:2101.11986, 2021b.
|
| 134 |
+
Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6023–6032, 2019.
|
| 135 |
+
Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017.
|
| 136 |
+
Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. Random erasing data augmentation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 13001–13008, 2020.
|
| 137 |
+
|
| 138 |
+
# A Comparison to other models
|
| 139 |
+
|
| 140 |
+
Table 2: Throughputs measured on an RTX8000 GPU using batch size 64 and fp16. ConvMixers and ResNets trained ourselves. Other statistics: DeiT (Touvron et al., 2020), ResMLP (Touvron et al., 2021a), Swin (Liu et al., 2021b), ViT (Dosovitskiy et al., 2020), MLP-Mixer (Tolstikhin et al., 2021), Isotropic MobileNets (Sandler et al., 2019). We think models with matching colored dots (•) are informative to compare with each other. †Throughput tested, but not trained. Activations: ReLU, GELU. $\star$ Using new, better regularization hyperparameters based on Wightman et al. (2021)’s A1 procedure.
|
| 141 |
+
|
| 142 |
+
<table><tr><td colspan="8">Comparison with other simple models trained on ImageNet-1k only with input size 224.</td></tr><tr><td>Network</td><td>Pateh</td><td>Kernel</td><td>Params</td><td>Throughput (img/sec)</td><td>Act</td><td>#Epochs</td><td></td></tr><tr><td>ConvMixer-1536/20★</td><td>7</td><td>9</td><td>51.6</td><td>134</td><td>G</td><td>150</td><td>82.20</td></tr><tr><td>ConvMixer-1536/20·</td><td>7</td><td>9</td><td>51.6</td><td>134</td><td>G</td><td>150</td><td>81.37</td></tr><tr><td>ConvMixer-1536/20*</td><td>7</td><td>3</td><td>49.4</td><td>246</td><td>G</td><td>150</td><td>81.60</td></tr><tr><td>ConvMixer-1536/20</td><td>7</td><td>3</td><td>49.4</td><td>246</td><td>G</td><td>150</td><td>80.43</td></tr><tr><td>ConvMixer-1536/20</td><td>14</td><td>9</td><td>52.3</td><td>538</td><td>G</td><td>150</td><td>78.92</td></tr><tr><td>ConvMixer-1536/24*</td><td>14</td><td>9</td><td>62.3</td><td>447</td><td>G</td><td>150</td><td>80.21</td></tr><tr><td>ConvMixer-768/32*</td><td>7</td><td>7</td><td>21.1</td><td>206</td><td>G</td><td>150</td><td>80.74</td></tr><tr><td>ConvMixer-768/32·</td><td>7</td><td>7</td><td>21.1</td><td>206</td><td>R</td><td>300</td><td>80.16</td></tr><tr><td>ConvMixer-1024/16</td><td>7</td><td>9</td><td>19.4 14.6</td><td>244</td><td>G G</td><td>100</td><td>79.45</td></tr><tr><td>ConvMixer-1024/12</td><td>7</td><td>8</td><td>5.4</td><td>358</td><td>G</td><td>90</td><td>77.75</td></tr><tr><td>ConvMixer-512/16</td><td>7</td><td>8</td><td></td><td>599</td><td>G</td><td>90</td><td>73.76</td></tr><tr><td>ConvMixer-512/12 ·</td><td>7</td><td>8</td><td>4.2 20.2</td><td>798 1235</td><td>R</td><td>90 300</td><td>72.59</td></tr><tr><td>ConvMixer-768/32</td><td>14</td><td>3</td><td>24.4</td><td>750</td><td>G</td><td></td><td>74.93</td></tr><tr><td>ConvMixer-1024/20·</td><td>14</td><td>9</td><td></td><td></td><td></td><td>150</td><td>76.94</td></tr><tr><td>ResNet-152*</td><td></td><td>3</td><td>60.2 60.2</td><td>828</td><td>R R</td><td>150</td><td>81.15</td></tr><tr><td>ResNet-152·</td><td></td><td>3</td><td>44.6</td><td>828 1187</td><td>R</td><td>150</td><td>79.64</td></tr><tr><td>ResNet-101· ResNet-50</td><td>一</td><td>3 3</td><td>25.6</td><td>1739</td><td>R</td><td>150 150</td><td>78.33 76.32</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DeiT-Bt</td><td>7</td><td></td><td>86.7</td><td>83</td><td>G</td><td></td><td>一</td></tr><tr><td>DeiT-St</td><td>7</td><td></td><td>22.1</td><td>174</td><td>G</td><td></td><td></td></tr><tr><td>DeiT-Tit</td><td>7</td><td></td><td>5.7</td><td>336</td><td>G</td><td></td><td></td></tr><tr><td>DeiT-B·</td><td>16</td><td></td><td>86</td><td>792</td><td>G</td><td>300</td><td>81.8</td></tr><tr><td>DeiT-S· DeiT-Ti·</td><td>16</td><td></td><td>22</td><td>1610</td><td>G</td><td>300</td><td>79.8</td></tr><tr><td></td><td>16</td><td></td><td>5.7</td><td>2603</td><td>G</td><td>300</td><td>72.2</td></tr><tr><td>ResMLP-S12/8 ·</td><td>8</td><td></td><td>22.1</td><td>872</td><td>G</td><td>400</td><td>79.1</td></tr><tr><td>ResMLP-B24/8· ResMLP-B24</td><td>8</td><td></td><td>129</td><td>181</td><td>G</td><td>400</td><td>81.0</td></tr><tr><td></td><td>16</td><td></td><td>116</td><td>1597</td><td>G</td><td>400</td><td>81.0</td></tr><tr><td>Swin-S·</td><td>4</td><td></td><td>50</td><td>576</td><td>G</td><td>300</td><td>83.0</td></tr><tr><td>Swin-T ·</td><td>4</td><td></td><td>29</td><td>878</td><td>G</td><td>300</td><td>81.3</td></tr><tr><td>ViT-B/16·</td><td>16</td><td></td><td>86</td><td>789</td><td>G</td><td>300</td><td>77.9</td></tr><tr><td>Mixer-B/16·</td><td>16</td><td></td><td>59</td><td>1025</td><td>G</td><td>300</td><td>76.44</td></tr><tr><td>Isotropic MobileNetv3·</td><td>8 16</td><td>3</td><td>20</td><td>355</td><td>R</td><td></td><td>80.6</td></tr><tr><td>Isotropic MobileNetv3·</td><td></td><td>3</td><td>20</td><td>1296</td><td>R</td><td></td><td>77.6</td></tr></table>
|
| 143 |
+
|
| 144 |
+
Experiment overview. We did not design our experiments to maximize accuracy: We chose “common sense” parameters for timm and its augmentation settings, found that it worked well for a ConvMixer-1024/12, and stuck with them for the proceeding experiments. We admit this is not an optimal strategy, however, we were aware from our early experiments on CIFAR-10 that results seemed robust to various small changes. We did not have access to sufficient compute to attempt to tune hyperparameters for each model: e.g., larger ConvMixers could probably benefit from more regularization than we chose, and smaller ones from less regularization. Keeping the parameters the same across ConvMixer instances seemed more reasonable than guessing for each.
|
| 145 |
+
|
| 146 |
+
However, to some extent, we changed the number of epochs per model: for earlier experiments, we merely wanted a “proof of concept”, and used only 90–100 epochs. Once we saw potential, we increased this to 150 epochs and trained some larger models, namely ConvMixer-1024/20 with $p ~ = ~ 1 4$ patches and ConvMixer-1536/20 with $p \ = \ 7$ patches. Then, believing that we should explore deeper-but-less-wide ConvMixers, and knowing from CIFAR-10 that the deeper models converged more slowly, we trained ConvMixer-768/32s with $p = 1 4$ and $p = 7$ for 300 epochs. Of course, training time was a consideration: ConvMixer-1536/20 took about 9 days to train (on 10 $\times$ RTX8000s) 150 epochs, and ConvMixer-768/32 is over twice as fast, making 300 epochs more feasible.
|
| 147 |
+
|
| 148 |
+
If anything, we believe that in the worst case, the lack of parameter tuning in our experiments resulted in underestimating the accuracies of ConvMixers. Further, due to our limited compute and the fact that large models (particularly ConvMixers) are expensive to train on large data sets, we generally trained our models for fewer epochs than competition like DeiT and ResMLP (see Table 2).
|
| 149 |
+
|
| 150 |
+
In this revision, we have added some additional results (denoted with a $\star$ in Table 2) using hyperparameters loosely based on the precisely-crafted “A1 training procedure” from Wightman et al. (2021). In particular, we adjusted parameters for RandAug, Mixup, CutMix, Random Erasing, and weight decay to match those in the procedure. Importantly, we still only trained for 150 epochs, rather than the 600 epochs used in Wightman et al. (2021), and we did not use binary cross-entropy loss nor repeated augmentation. While we do not think optimal hyperparameters for ResNet would also be optimal for ConvMixer, these settings are significantly better than the ones we initially chose. This further highlights the capabilities of ConvMixers, and we are optimistic that further tuning could lead to still-better performance. Throughout the paper, we still refer to ConvMixers trained using our initial “one shot” selection of hyperparameters.
|
| 151 |
+
|
| 152 |
+
A note on throughput. We measured throughput using batches of 64 images in half precision on a single RTX8000 GPU, averaged over 20 such batches. In particular, we measured CUDA execution time rather than “wall-clock” time. We noticed discrepancies in the relative throughputs of models, e.g., Touvron et al. (2020) reports that ResNet-152 is 2 $\times$ faster than DeiT-B, but our measurements show that the two models have nearly the same throughput. We therefore speculate that our throughputs may underestimate the performance of ResNets and ConvMixers relative to the transformers. The difference may be due to using RTX8000 rather than V100 GPUs, or other low-level differences. Our throughputs were similar for batch sizes 32 and 128.
|
| 153 |
+
|
| 154 |
+
ResNets. As a simple baseline to which to compare ConvMixers, we trained three standard ResNets using exactly the same training setup and parameters as ConvMixer-1536/20. We also trained ResNet- $1 5 2 ^ { \star }$ using the new A1-based procedure for comparison against ConvMixer-1536/ $2 0 ^ { \star }$ . Despite having fewer parameters and being architecturally much simpler, ConvMixers substantially outperform these ResNets in terms of accuracy. A possible confounding factor is that ConvMixers use GELU, which may boost performance, while ResNets use ReLU. In an attempt to rule out this confound, we used ReLU in a later ConvMixer768/32 experiment and found that it still achieved competitive accuracy. We also note that the choice of ReLU vs. GELU was not important on CIFAR-10 experiments (see Table 7). However, ConvMixers do have substantially less throughput.
|
| 155 |
+
|
| 156 |
+
DeiTs. We believe that DeiT is the most reasonable comparison in terms of vision transformers: It only adds additional regularization, as opposed to architectural additions in the case of CaiT (Touvron et al., 2021b), and is then essentially a “vanilla” ViT modulo the distillation token (we don’t consider distilled architectures). In terms of a fixed parameter budget, ConvMixers generally outperform DeiTs. For example, ConvMixer1536/20 is only $0 . 4 3 \%$ less accurate than DeiT-B despite having over 30M fewer parameters; ConvMixer
|
| 157 |
+
|
| 158 |
+
768/32 is $0 . 3 6 \%$ more accurate than DeiT-S despite having 0.9M fewer parameters; and ConvMixer-512/16 is $0 . 3 9 \%$ more accurate than DeiT-Ti for nearly the same number of parameters. Admittedly, none of the ConvMixers are very competitive in terms of throughput, with the closest being the ConvMixer-512/16 which is $4 \times$ slower than DeiT-Ti.
|
| 159 |
+
|
| 160 |
+
A confounding factor is the difference in patch size between DeiT and ConvMixer; DeiT uses $p = 1 6$ while ConvMixer uses $p = 7$ . This means DeiT is substantially faster. However, ConvMixers using larger patches are not as competitive. While we were not able to train DeiTs with larger patch sizes, it is possible that they would outperform ConvMixers on the parameter count vs. accuracy curve; however, we tested their throughput for $p = 7$ , and they are even slower than ConvMixers. Given the difference between convolution and self-attention, we are not sure it is salient to control for patch size differences.
|
| 161 |
+
|
| 162 |
+
DeiTs were subject to more hyperparameter tuning than ConvMixers, as well as longer training times. They also used stochastic depth while we did not, which can in some cases contribute percent differences in model accuracy (Touvron et al., 2021a). It is therefore possible that further hyperparameter tuning and more epochs for ConvMixers could close the gap between the two architectures for large patches, e.g., $p = 1 6$ .
|
| 163 |
+
|
| 164 |
+
ResMLPs. Similarly to DeiT for ViT, we believe that ResMLP is the most relevant MLP-Mixer variant to compare against. Unlike DeiT, we can compare against instances of ResMLP with similar patch size: ResMLP-B24/8 has $p = 8$ patches, and underperforms ConvMixer-1536/20 by $0 . 3 7 \%$ , despite having over twice the number of parameters; it also has similarly low throughput. ConvMixer-768/32 also outperforms ResMLP-S12/8 for millions fewer parameters, but 4 $\times$ less throughput.
|
| 165 |
+
|
| 166 |
+
ResMLP did not significantly improve in terms of accuracy for halving the patch size from 16 to 8, which shows that smaller patches do not always lead to better accuracy for a fixed architecture and regularization strategy (e.g., training a $p = 8$ DeiT may be challenging).
|
| 167 |
+
|
| 168 |
+
Swin Transformers. While we intend to focus on the most basic isotropic, patch-based architectures for fair comparisons with ConvMixer, it is also interesting to compare to a more complicated model that is closer to state-of-the-art. For a similar parameter budget, ConvMixer is around 1.2-1.6% less accurate than the Swin Transformer, while also being 4-6 $\times$ slower. However, considering we did not attempt to tune or optimize our model in any way, we find it surprising that an exceedingly simple patch-based model that uses only plain convolution does not lag too far behind Swin Transformer.
|
| 169 |
+
|
| 170 |
+
Isotropic MobileNets. These models are closest in design to ours, despite using a repeating block that is substantially more complex than the ConvMixer one. Despite this, for a similar number of parameters, we can get similar performance. Notably, isotropic MobileNets seem to suffer less from larger patch sizes than ConvMixers, which makes us optimistic that sufficient parameter tuning could lead to more performant large-patch ConvMixers. As Sandler et al. (2019) did not provide an implementation, we cannot be sure if ours is exactly the same; e.g., we were unsure if 5x5 stride-5 convolutions were replaced with 3x3 or 5x5 stride-1 convolutions, so we chose 3x3. The throughputs in Table 2 are based on our implementation. We also trained a patch-size-16 Isotropic MobileNet using exactly the same pipeline used for our ConvMixers, which achieved only $7 0 . 7 6 \%$ accuracy.
|
| 171 |
+
|
| 172 |
+
Other models. We included ViT and MLP-Mixer instances in our table, though they are not competitive with ConvMixer, DeiT, or ResMLP, even though MLP-Mixer has comparable regularization to ConvMixer. That is, ConvMixer seems to outperform MLP-Mixer and ViT, while being closer to complexity to them in terms of design and training regime than the other competitors, DeiT and ResMLP.
|
| 173 |
+
|
| 174 |
+
Kernel size. While we found some evidence that larger kernels are better on CIFAR-10, we wanted to see if this finding transferred to ImageNet. Consequently, we trained our best-performing model, ConvMixer1536/20, with kernel size $k = 3$ rather than $k = 9$ . This resulted in a decrease of $0 . 9 4 \%$ top-1 accuracy, which we believe is quite significant relative to the mere 2.2M additional parameters. However, $k = 3$ is substantially faster than $k = 9$ for spatial-domain convolution; we speculate that low-level optimizations could close the performance gap to some extent, e.g., by using implicit instead of explicit padding. Since large-kernel convolutions throughout a model are unconventional, there has likely been low demand for such optimizations.
|
| 175 |
+
|
| 176 |
+
# B Additional Experiments on ImageNet
|
| 177 |
+
|
| 178 |
+
In this section, we present additional experiments on ImageNet-1k. We primarily used ConvMixer-512/12 trained using the new A1-like ( $\star$ ) technique. Note that the throughputs in this section were recorded using Tesla V100 GPUs, while those in Table 2 used RTX8000s (hence, the two measurements should not be compared across tables).
|
| 179 |
+
|
| 180 |
+
Table 3: We investigate the effect of different patch sizes on throughput and accuracy. Smaller patches result in higher accuracy at the expense of throughput.
|
| 181 |
+
|
| 182 |
+
<table><tr><td colspan="5">Effect of Patch Size</td></tr><tr><td>Network</td><td>Patch</td><td>Kermel</td><td>Thrmghput</td><td>IN</td></tr><tr><td>ConvMixer-512/12</td><td>5</td><td>9</td><td>388</td><td>75.60</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>9</td><td>644</td><td>74.60</td></tr><tr><td>ConvMixer-512/12</td><td>9</td><td>9</td><td>1120</td><td>73.55</td></tr><tr><td>ConvMixer-512/12</td><td>12</td><td>9</td><td>1908</td><td>71.79</td></tr><tr><td>ConvMixer-512/12</td><td>16</td><td>9</td><td>2892</td><td>69.65</td></tr></table>
|
| 183 |
+
|
| 184 |
+
Patch sizes. Larger patch sizes result in lower accuracy, while smaller patches increase accuracy. However, ConvMixers using smaller patches are substantially slower. For most of our experiments, we used $7 \times 7$ patches; however, in some cases, it may be desirable to use slightly larger $9 \times 9$ patches in exchange for a bit less accuracy (see Table 3).
|
| 185 |
+
|
| 186 |
+
Table 4: We tested ConvMixers with ResNet-style stems and ResNets with patch embedding stems; in both cases, patch embeddings worked better.
|
| 187 |
+
|
| 188 |
+
<table><tr><td colspan="3">Patch Embeddings vs. ResNet-Style Stems</td></tr><tr><td>Network</td><td>Stem</td><td></td></tr><tr><td>ResNet50 ResNet50</td><td>ResNet Stem Patches (4 × 4)</td><td>78.32 78.74</td></tr><tr><td>ConvMixer-512/12 ConvMixer-512/12</td><td>ResNet Stem Patches (12 × 12)</td><td>71.24 71.79</td></tr></table>
|
| 189 |
+
|
| 190 |
+
Disentangling the effect of patches. We found that using a patch embedding stem with a ResNet improves accuracy relative to the default stem, while using a ResNet stem with a ConvMixer hurts accuracy (see Table 4). This provides some evidence that patches are a good choice of input representation, and may even improve the performance of existing models compared to their default input representation. For the ConvMixer, we used a ResNet stem with $1 2 \times 1 2$ -kernel convolutions with stride 6 followed by max pooling; this ensured that ResNet-stem ConvMixer had the same internal resolution as the version using patches.
|
| 191 |
+
|
| 192 |
+
Kernel sizes. Here, we investigate whether larger kernel sizes are really beneficial to ConvMixers. In Table 5, we see that $9 \times 9$ kernels strongly outperform $3 \times 3$ kernels. This may be unsurprising, as the model with $9 \times 9$ kernels has significantly more parameters; to control for this, we trained a ConvMixer-512/14 with $3 \times 3$ kernels which has a comparable number of parameters. However, this still does not achieve the performance of the $9 \times 9$ -kernel model. Further, conventional wisdom states that three stacked $3 \times 3$ convolutional layers (with GELUs between the layers) has the same receptive field as $9 \times 9$ convolution while being more expressive. Consequently, we replaced plain $3 \times 3$ convolutions with three stacked 3 $\times$ convolutions; however, this still did not surpass the accuracy of $9 \times 9$ convolutions. Finally, using the same intuition, we stack three ConvMixer-512/12s and tried a ConvMixer-512/36; only then do we outperform large-kernel convolutions. This is perhaps unsurprising, given the 24 additional pointwise layers.
|
| 193 |
+
|
| 194 |
+
Table 5: Here, we investigate whether larger kernels are really more effective than smaller ones. Our results suggest that larger kernels are advantageous compared to a variety of “control” experiments.
|
| 195 |
+
|
| 196 |
+
<table><tr><td colspan="6">Effect of Kernel Size</td></tr><tr><td>Network</td><td>Patch</td><td>Kernel</td><td>#Paras</td><td>Troghpgt</td><td>p-N</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>7</td><td>4.07</td><td>724</td><td>74.54</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>15</td><td>5.15</td><td>401</td><td>75.25</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>9</td><td>4.27</td><td>644</td><td>74.60</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>3</td><td>3.83</td><td>992</td><td>72.96</td></tr><tr><td>ConvMixer-512/14</td><td>7</td><td>3</td><td>4.37</td><td>856</td><td>74.03</td></tr><tr><td>ConvMier-512U convs)</td><td>7</td><td>3</td><td>3.95</td><td>732</td><td>74.53</td></tr><tr><td>ConvMixer-512/36</td><td>7</td><td>3</td><td>10.3</td><td>338</td><td>77.67</td></tr></table>
|
| 197 |
+
|
| 198 |
+
Table 6: We investigated choices of activation functions and normalization layers, as well as training with reduced data augmentation. While reducing augmentation improves performance on this small model, we did not adopt this change elsewhere.
|
| 199 |
+
|
| 200 |
+
<table><tr><td colspan="2">Ablation of ConvMixer-512/12 on ImageNet</td></tr><tr><td>Ablation</td><td>ImNet Acc. (%)</td></tr><tr><td>Baseline</td><td>74.60</td></tr><tr><td>BatchNorm →LayerNorm GELU→ReLU</td><td>74.51</td></tr><tr><td>- Mixup and CutMix</td><td>74.44 75.65</td></tr><tr><td>-RandAug</td><td>75.26</td></tr></table>
|
| 201 |
+
|
| 202 |
+
Architectural choices. In Table 6, we demonstrate that the choice of activation function (ReLU vs.
|
| 203 |
+
GELU) and norm layer (BatchNorm vs. LayerNorm) does not have a large impact on performance.
|
| 204 |
+
|
| 205 |
+
Data augmentation. We also investigate removing some of the data augmentations from the A1 recipe (see Table 6). We saw a substantial performance boost from removing Mixup and CutMix, and to a lesser extent, RandAugment as well. This is likely due to the relatively small model used for the comparison (ConvMixer-512/12), for which this level of augmentation may be excessive. We did not adopt these changes for other experiments. For comparison, a DeiT trained exactly the same way as the baseline ConvMixer achieves $7 0 . 2 8 \%$ accuracy, while a DeiT without RandAug, CutMix, and MixUp gets $6 9 . 6 5 \%$ accuracy. That is, it seems augmentations are more important to DeiT than to ConvMixer.
|
| 206 |
+
|
| 207 |
+
Input size. Unlike ViTs, MLP-Mixers, ResMLPs, and other recent models, ConvMixers can handle variable input sizes with no modifications whatsoever. In Fig. 4, we show the effect of input size on the inference time of a ConvMixer-768/32 using a batch size of 32, averaged over 16 trials on an RTX 3080Ti GPU in half precision. Note the rapid growth of inference time for kernel sizes 7 and 9 compared to 3 and 5; we believe this shows that the underlying implementation of depthwise convolution is suboptimal for large kernel sizes.
|
| 208 |
+
|
| 209 |
+
# C Additional Experiments on CIFAR-10
|
| 210 |
+
|
| 211 |
+
Residual connections. We experimented with leaving out one, the other, or both residual connections before settling on the current configuration, and consequently chose to leave out the second residual connection. Our baseline model without the connection achieves 95.88% accuracy, while including the connection reduces it to $9 4 . 7 8 \%$ . Surprisingly, we see only a $0 . 3 1 \%$ decrease in accuracy for removing all residual connections. We acknowledge that these findings for residual connections may not generalize to deeper ConvMixers trained on larger data sets.
|
| 212 |
+
|
| 213 |
+

|
| 214 |
+
Figure 4: Inference time vs. input size for ConvMixer-768/32 with a variety of kernel sizes.
|
| 215 |
+
|
| 216 |
+
Table 7: Small ablation study of training a ConvMixer-256/8 on CIFAR-10.
|
| 217 |
+
|
| 218 |
+
<table><tr><td colspan="2">Ablation of ConvMixer-256/8 on CIFAR-10</td></tr><tr><td>Ablation</td><td>CIFAR-10</td></tr><tr><td>Baseline</td><td>95.88</td></tr><tr><td>- Residual in Eq. 2 + Residual in Eq. 3 BatchNorm →LayerNorm GELU→ReLU</td><td>95.57 94.78 94.44 95.51</td></tr><tr><td>- Mixup and CutMix - Random Erasing RandAug</td><td>95.92 95.24</td></tr></table>
|
| 219 |
+
|
| 220 |
+
Normalization. Our model is conceptually similar to the vision transformer and MLP-Mixer, both of which use LayerNorm instead of BatchNorm. We attempted to use LayerNorm instead, and saw a decrease in performance of around 1% as well as slower convergence (see Table 7). However, this was for a relatively shallow model, and we cannot guarantee that LayerNorm would not hinder ImageNet-scale models to an even larger degree. We note that the authors of ResMLP also saw a relatively small increase in accuracy for replacing LayerNorm with BatchNorm, but for a larger-scale experiment (Touvron et al., 2021a). We conclude that BatchNorm is no more crucial to our architecture than other regularizations or parameter settings (e.g., kernel size).
|
| 221 |
+
|
| 222 |
+
Having settled on an architecture, we proceeded to adjust its parameters $h , d , p , k$ as well as weight decay on CIFAR-10 experiments. (Initially, we took the unconventional approach of excluding weight decay since we were already using strong regularization in the form of RandAug and mixup.) We acknowledge that tuning our architecture on CIFAR-10 does not necessarily generalize to performance on larger data sets, and that this is a limitation of our study.
|
| 223 |
+
|
| 224 |
+
# C.1 Results
|
| 225 |
+
|
| 226 |
+
ConvMixers are quite performant on CIFAR-10, easily achieving $> 9 1 \%$ accuracy for as little as 100, 000 parameters, or $> 9 6 \%$ accuracy for only 887, 000 parameters (see Table 8). With additional refinements e.g., a more expressive classifier or bottlenecks, we think that ConvMixer could be even more competitive. For all experiments, we trained for 200 epochs on CIFAR-10 with RandAug, mixup, cutmix, random erasing, gradient norm clipping, and the standard augmentations in timm. We remove some of these augmentations in Table 7, finding that RandAug and random scaling (“default” in timm) are very important, each accounting for over 3% of the accuracy.
|
| 227 |
+
|
| 228 |
+
Scaling ConvMixer. We adjusted the hidden dimension $h$ and the depth $d$ , finding that deeper networks take longer to converge while wider networks converge faster. That said, increasing the width or the depth is an effective way to increase accuracy; a doubling of depth incurs less compute than a doubling of width. The number of parameters in a ConvMixer is given exactly by:
|
| 229 |
+
|
| 230 |
+
$$
|
| 231 |
+
\# \mathsf { p a r a m s } = h [ d ( k ^ { 2 } + h + 6 ) + c _ { \mathsf { i n } } p ^ { 2 } + n _ { \mathsf { c l a s s e s } } + 3 ] + n _ { \mathsf { c l a s s e s } } ,
|
| 232 |
+
$$
|
| 233 |
+
|
| 234 |
+
including affine scaling parameters in BatchNorm layers, convolutional kernels, and the classifier.
|
| 235 |
+
|
| 236 |
+
Kernel size. We initially hypothesized that large kernels would be important for ConvMixers, as they would allow the mixing of distant spatial information similarly to unconstrained MLPs or self-attention layers. We tried to investigate the effect of kernel size on CIFAR-10: we fixed the model to be a ConvMixer-256/8, and increased the kernel size by 2s from 3 to 15.
|
| 237 |
+
|
| 238 |
+
Using a kernel size of 3, the ConvMixer only achieves $9 3 . 6 1 \%$ accuracy. Simply increasing it to 5 gives an additional $1 . 5 0 \%$ accuracy, and further to 7 an additional $0 . 6 1 \%$ . The gains afterwards are relatively marginal, with kernel size 15 giving an additional 0.28% accuracy. It could be that with more training iterations or more regularization, the effect of larger kernels would be more pronounced. Nonetheless, we concluded that ConvMixers benefit from larger-than-usual kernels, and thus used kernel sizes 7 or 9 in most of our later experiments.
|
| 239 |
+
|
| 240 |
+
It is conventional wisdom that large-kernel convolutions can be “decomposed” into stacked small-kernel convolutions with activations between them, and it is therefore standard practice to use $k = 3$ convolutions, stacking more of them to increase the receptive field size with additional benefits from nonlinearities. This raises a question: is the benefit of larger kernels in ConvMixer actually better than simply increasing the depth with small kernels? First, we note that deeper networks are generally harder to train, so by increasing the kernel size independently of the depth, we may recover some of the benefits of depth without making it harder for signals to “propagate back” through the network. To test this, we trained a ConvMixer-256/10 with $k = 3$ (698K parameters) in the same setting as a ConvMixer-256/8 with $k = 9$ (707K parameters), i.e., we increased depth in a small-kernel model to roughly match the parameters of a large-kernel model. The ConvMixer-256/10 achieved 94.29% accuracy (1.5% less), which provides more evidence for the importance of larger kernels in ConvMixers. Next, instead of fixing the parameter budget, we tripled the depth (using the intuition that 3 stacked $k = 3$ convolutions have the receptive field of a $k = 9$ convolution), giving a ConvMixer-256/24 with 1670K parameters, and got $9 5 . 1 6 \%$ accuracy, i.e., still less.
|
| 241 |
+
|
| 242 |
+
Patch size. CIFAR-10 inputs are so small that we initially only used $p = 1$ , i.e., the patch embedding layer does little more than compute $h$ linear combinations of the input image. Using $p = 2$ , we see a reduction in accuracy of about $0 . 8 0 \%$ ; this is a worthy tradeoff in terms of training and inference time. Further increasing the patch size leads to rapid decreases in accuracy, with only $9 2 . 6 1 \%$ for $p = 4$ .
|
| 243 |
+
|
| 244 |
+
Since the “internal resolution” is decreased by a factor of $p$ when increasing the patch size, we assumed that larger kernels would be less important for larger $p$ . We investigated this by again increasing the kernel size from 3 to 11 for ConvMixer-256/8 with $p = 2$ : however, this time, the improvement going from 3 to 5 is only $1 . 1 3 \%$ , and larger kernels than 5 provide only marginal benefit.
|
| 245 |
+
|
| 246 |
+
Weight decay. We did many of our initial experiments with minimal weight decay. However, this was not optimal: by tuning weight decay, we can get an additional $0 . 1 5 \%$ of accuracy for no cost. Consequently, we used weight decay (without tuning) for our larger-scale experiments on ImageNet.
|
| 247 |
+
|
| 248 |
+
Table 8: An investigation of ConvMixer design parameters $h , d , p , k$ and weight decay on CIFAR-10
|
| 249 |
+
|
| 250 |
+
<table><tr><td colspan="7"> Tiny ConvMixers trained on CIFAR-10.</td></tr><tr><td>Width h</td><td>Depth d</td><td>Patch Size p</td><td>Kernel Size k</td><td># Params (×103)</td><td>Weight Decay</td><td>CIFAR-10 Acc. (%)</td></tr><tr><td>128</td><td>4</td><td>1</td><td>8</td><td>103</td><td>0</td><td>91.26</td></tr><tr><td>128</td><td>8</td><td>1</td><td>8</td><td>205</td><td>0</td><td>93.83</td></tr><tr><td>128</td><td>12</td><td>1</td><td>8</td><td>306</td><td>0</td><td>94.83</td></tr><tr><td>256</td><td>4</td><td>1</td><td>8</td><td>338</td><td>0</td><td>93.37</td></tr><tr><td>256</td><td>8</td><td>1</td><td>8</td><td>672</td><td>0</td><td>95.60</td></tr><tr><td>256</td><td>12</td><td>1</td><td>8</td><td>1006</td><td>0</td><td>96.39</td></tr><tr><td>256</td><td>16</td><td>1</td><td>8</td><td>1339</td><td>0</td><td>96.74</td></tr><tr><td>256</td><td>20</td><td>1</td><td>8</td><td>1673</td><td>0</td><td>96.67</td></tr><tr><td colspan="7">{Kernel adjustments</td></tr><tr><td>256</td><td>8</td><td>1</td><td>3</td><td>559</td><td>0</td><td>93.61</td></tr><tr><td>256</td><td>8</td><td>1</td><td>5</td><td>592</td><td>0</td><td>95.19</td></tr><tr><td>256</td><td>8</td><td>1</td><td>7</td><td>641</td><td>0</td><td>95.80</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>0</td><td>95.88</td></tr><tr><td>256</td><td>8</td><td>1</td><td>11</td><td>788</td><td>0</td><td>95.70</td></tr><tr><td>256</td><td>8</td><td>1</td><td>13</td><td>887</td><td>0</td><td>96.04</td></tr><tr><td>256</td><td>8</td><td>1</td><td>15</td><td>1001</td><td>0</td><td>96.08</td></tr><tr><td colspan="7">↓Patch adjustments</td></tr><tr><td></td><td>8</td><td>2</td><td>9</td><td>709</td><td>0</td><td>95.00</td></tr><tr><td>256 256</td><td>8</td><td>4</td><td>9</td><td>718</td><td>0</td><td>92.61</td></tr><tr><td>256</td><td>8</td><td>8</td><td>9</td><td>755</td><td>0</td><td>85.57</td></tr><tr><td colspan="7">←Weight decay adjustments</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-1</td><td>95.88</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-2</td><td>96.03</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-3</td><td>95.76</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-4</td><td>95.63</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-5</td><td>95.88</td></tr><tr><td colspan="7">↓ Kernel size adjustments when p = 2</td></tr><tr><td>256</td><td>8</td><td>2</td><td>3</td><td>561</td><td>0</td><td>94.08</td></tr><tr><td>256</td><td>8</td><td>2</td><td>5</td><td>594</td><td>0</td><td>95.21</td></tr><tr><td>256</td><td>8</td><td>2</td><td>7</td><td>643</td><td>0</td><td>95.35</td></tr><tr><td>256</td><td>8</td><td>2</td><td>9</td><td>709</td><td>0</td><td>95.00</td></tr><tr><td>256</td><td>8</td><td>2</td><td>11</td><td>791</td><td>0</td><td>95.14</td></tr><tr><td colspan="7">↓ Adding weight decay to the above</td></tr><tr><td>256</td><td>8</td><td>2</td><td>3</td><td>561</td><td>1×10-2</td><td>94.69</td></tr><tr><td>256</td><td>8</td><td>2</td><td>5</td><td>594</td><td>1×10-2</td><td>95.26</td></tr><tr><td>256</td><td>8</td><td>2</td><td>7</td><td>643</td><td>1×10-2</td><td>95.25</td></tr><tr><td>256</td><td>8</td><td>2</td><td>9</td><td>709</td><td>1×10-2</td><td>95.06</td></tr><tr><td>256</td><td>8</td><td>2</td><td>11</td><td>791</td><td>1×10-2</td><td>95.17</td></tr></table>
|
| 251 |
+
|
| 252 |
+
# D Weight Visualizations
|
| 253 |
+
|
| 254 |
+

|
| 255 |
+
Figure 5: Patch embedding weights for a ConvMixer-1024/20 with patch size 14 (see Table 2).
|
| 256 |
+
|
| 257 |
+

|
| 258 |
+
Figure 6: Patch embedding weights for a ConvMixer-768/32 with patch size 7 (see Table 2).
|
| 259 |
+
|
| 260 |
+

|
| 261 |
+
Figure 7: Random subsets of 64 depthwise convolutional kernels from progressively deeper layers of ConvMixer-1536/20 (Table 1).
|
| 262 |
+
|
| 263 |
+
In Figure 5 and 6, we visualize the (complete) weights of the patch embedding layers of a ConvMixer-1536/20 with $p = 1 4$ and a ConvMixer-768/32 with $p = 7$ , respectively. Much like Sandler et al. (2019), the layer consists of Gabor-like filters as well as “colorful globs” or rough edge detectors. The filters seem to be more structured than those learned by MLP-Mixer (Tolstikhin et al., 2021); also unlike MLP-Mixer, the weights look much the same going from $p = 1 4$ to $p = 7$ : the latter simply looks like a downsampled version of the former. It is unclear, then, why we see such a drop in accuracy for larger patches. However, some of the filters essentially look like noise, maybe suggesting a need for more regularization or longer training, or even more data. Ultimately, we cannot read too much into the learned representations here.
|
| 264 |
+
|
| 265 |
+
In Figure 7, we plot the hidden convolutional kernels for successive layers of a ConvMixer. Initially, the kernels seem to be relatively small, but make use of their allowed full size in later layers; there is a clear hierarchy of features as one would expect from a standard convolutional architecture. Interestingly, Touvron et al. (2021a) saw a similar effect for ResMLP, where earlier layers look like small-kernel convolution, while later layers were more diffuse, despite these layers being representated by an unconstrained matrix multiplication rather than convolution.
|
| 266 |
+
|
| 267 |
+
# E Implementation
|
| 268 |
+
|
| 269 |
+
def ConvMixer(h,d,k,p,n):
|
| 270 |
+
S,C,A=Sequential,Conv2d,lambda $\mathbf { x } : \mathbf { S } \left( \mathbf { x } \right.$ ,GELU(),BatchNorm2d(h))
|
| 271 |
+
R=type('',(S,),{'forward':lambda s,x:s[0] $( \mathbf { x } ) + \mathbf { x } \mathbf \}$ )
|
| 272 |
+
return S(A(C(3,h,p,p)), $^ *$ [S(R(A(C(h,h,k,groups $\mathbf { \tau } = \mathbf { h }$ ,padding=k//2))),A(C(h,h,1))) for i in range(d)], AdaptiveAvgPool2d(1),Flatten(),Linear ${ ( \ln , \ n ) }$ ) Figure 8: An implementation of our model in less than 280 characters, in case you happen to know of any means of disseminating information that could benefit from such a length.
|
| 273 |
+
All you need to do to run this is from torch.nn import \*.
|
| 274 |
+
|
| 275 |
+
We present an even more terse implementation of ConvMixer in Figure 8, which to the best of our knowledge is the first model that achieves the elusive dual goals of $8 2 \% +$ ImageNet top-1 accuracy while also fitting into a tweet.
|
md/test/rlloVZoKrX/rlloVZoKrX.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/test/rzQGHXNReU/rzQGHXNReU.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RAFT: Adapting Language Model to Domain Specific RAG
|
| 2 |
+
|
| 3 |
+
Tianjun Zhang \*
|
| 4 |
+
Department of Computer Science
|
| 5 |
+
UC Berkeley
|
| 6 |
+
Berkeley, CA 94720, USA
|
| 7 |
+
{tianjunz}@berkeley.edu
|
| 8 |
+
Shishir G. Patil, Naman Jain, Sheng Shen
|
| 9 |
+
Department of Computer Science
|
| 10 |
+
UC Berkeley
|
| 11 |
+
Berkeley, CA 94720, USA
|
| 12 |
+
{shishirpatil,naman_jain,sheng.s}@berkeley.edu
|
| 13 |
+
Matei Zaharia, Ion Stoica, Joseph E. Gonzalez
|
| 14 |
+
Department of Computer Science
|
| 15 |
+
UC Berkeley
|
| 16 |
+
Berkeley, CA 94720, USA
|
| 17 |
+
{matei,istoica,jegonzal}@berkeley.edu
|
| 18 |
+
|
| 19 |
+
# Abstract
|
| 20 |
+
|
| 21 |
+
Pretraining Large Language Models (LLMs) on large corpora of textual data is now a standard paradigm. When using these LLMs for many downstream applications, it is common to additionally incorporate new information into the pretrained model either through RAG-based-prompting, or finetuning. However, the best methodology to incorporate information remains an open question. In this paper, we present Retrieval Augmented Fine Tuning (RAFT), a training recipe which improves the model’s ability to answer questions in "open-book" in-domain settings. In training RAFT, given a question, and a set of retrieved documents, we train the model to ignore those documents that don’t help in answering the question, which we call, distractor documents. RAFT accomplishes this by citing verbatim the right sequence from the relevant document to help answer the question. This coupled with RAFT’s chain-of-thought-style response helps improve the model’s ability to reason. In domain specific RAG, RAFT consistently improves the model’s performance across PubMed, HotpotQA, and Gorilla datasets, presenting a post-training recipe to improve pre-trained LLMs to in-domain RAG.
|
| 22 |
+
|
| 23 |
+
# 1 Introduction
|
| 24 |
+
|
| 25 |
+
Trained on vast quantities of public data, Large Language Models LLMs have achieved significant advances in a wide range of general knowledge reasoning tasks Brown et al. (2020); Wei et al. (2022). However, increasingly LLMs are being employed in specialized domains to support tasks ranging from code completion for specific software frameworks to question answering on specific document collections (e.g., legal or medical documents). In these settings, general knowledge reasoning is less critical and instead the primary goal is to maximize accuracy based on a given set of documents. Indeed, adapting LLMs to the specialized domains (e.g., recent news, enterprise private documents, or program resources constructed after the training cutoff) is essential to many emerging applications (Vu et al., 2023; Lazaridou et al., 2022) and is the focus of this work.
|
| 26 |
+
|
| 27 |
+
This paper studies the following question – How do we adapt pre-trained LLMs for Retrieval Augmented Generation (RAG) in specialized domains?
|
| 28 |
+
|
| 29 |
+
When it comes to adapting LLMs to specialized domains, we consider the following two candidates: in-context learning through Retrieval-Augmented Generation (RAG) and supervised fine-tuning. RAG based methods allow the LLM to reference the documents when answering questions. However, RAG based in-context learning methods fail to leverage the learning opportunity afforded by the fixed domain setting and early access to the test documents. Alternatively, supervised fine-tuning offers the opportunity to learn more general patterns in the documents and better align to end tasks and user preferences Zhou et al. (2023). However, existing fine-tuning based approaches either fail to leverage the documents at test time (don’t incorporate RAG) or fail to account for the imperfections in retrieval process during training.
|
| 30 |
+
|
| 31 |
+

|
| 32 |
+
Figure 1: How best to prepare for an Exam?(a) Fine-tuning based approaches implement "studying" by either directly "memorizing" the input documents or answering practice QA without referencing the documents. (b) Alternatively, in-context retrieval methods fail to leverage the learning opportunity afforded by the fixed domain and are equivalent to taking an open-book exam without studying. In contrast, our approach (c) RAFT leverages fine-tuning with question-answer pairs while referencing the documents in a simulated imperfect retrieval setting — thereby effectively preparing for the open-book exam setting.
|
| 33 |
+
|
| 34 |
+
We can draw an analogy to an open-book exam. Existing in-context retrieval methods are equivalent to taking an open-book exam without studying. Alternatively, existing finetuning based approaches implement “studying" by either directly “memorizing" Xiong et al. (2023) the input documents or answering practice questions Wang et al. (2022) without referencing the documents. While these approaches leverage in-domain learning they fail to prepare for the open-book nature of the test setting.
|
| 35 |
+
|
| 36 |
+
In this paper, we study how to combine instruction fine-tuning (IFT) with retrieval augmented generation (RAG). We propose a novel adaptation strategy – Retrieval-Augmented Fine Tuning (RAFT). RAFT specifically addresses the challenge of fine-tuning LLMs to both incorporate domain knowledge while also improving in-domain RAG performance. RAFT aims to not only enable models to learn domain-specific knowledge through fine-tuning, but also to ensure robustness against distracting retrieved information. This is achieved by training the models to understand the dynamics between the question (prompt), the domain-specific documents retrieved, and the right answer. Going back to our analogy to the open book exam, our approach is analogous to studying for an open-book exam by recognizing relevant, and irrelevant retrieved documents.
|
| 37 |
+
|
| 38 |
+
In RAFT, we train the model to answer the question (Q) from Document(s) $( \mathrm { D ^ { * } } )$ to generate answer $( \mathrm { A } ^ { * } )$ , where $\mathsf { A } ^ { * }$ includes chain-of-thought reasoning Wei et al. (2022); Anthropic (2023), and in the presence of distractor documents $( D _ { k } )$ . We explain the methodology in Section 3 and analyze the sensitivity to the number of distractor documents $( k )$ at train- and test- time in Section 5. RAFT consistently outperforms Supervised-finetuning both withand without- RAG across PubMed Dernoncourt & Lee (2017), HotPot QA Yang et al. (2018), and HuggingFace Hub, Torch Hub, and Tensorflow Hub Gorilla datasets Patil et al. (2023), presenting a novel, yet simple technique to improve pre-trained LLMs for in-domain RAG. Our code is available at https://github.com/ShishirPatil/gorilla.
|
| 39 |
+
|
| 40 |
+
# 2 LLMs for Open-Book Exam
|
| 41 |
+
|
| 42 |
+
To understand our goal better, we expand on our analogy between training an LLM with the real-world setting of prepararing for an exam.
|
| 43 |
+
|
| 44 |
+
Closed-Book Exam A closed book exam often refers to the scenario where the LLMs do not have access to any additional documents or references to answer the questions during the exam. For LLMs, this is equivalent to the scenario, for example, in which the LLM is used as a chatbot. In this scenario the LLM draws from the knowledge baked in during pre-training and supervised-finetuning to respond to the users’ prompt.
|
| 45 |
+
|
| 46 |
+

|
| 47 |
+
Figure 2: Overview of our RAFT method. The top-left figure depicts our approach of adapting LLMs to reading solution from a set of positive and distractor documents in contrast to standard RAG setup where models are trained based on the retriever outputs, which is a mixture of both memorization and reading. At test time, all methods follow the standard RAG setting, provided with a top-k retrieved documents in the context.
|
| 48 |
+
|
| 49 |
+
Open Book Exam In contrast, we liken the open-book exam setting to the scenario in which the LLM can refer to external sources of information (e.g., a website or a book chapter). In such scenarios, typically, the LLM is paired with retriever which retrieves $^ { \prime } \mathbf { k } ^ { \prime }$ documents (or specific segments of the document) which are appended to the users’ prompt. It is only through these documents retrieved that the LLM gains access to “domain-specific information”. As a result, we argue that the LLM’s performance in these settings, where it is trained as a general-purpose LLM is largely dependent on the quality of the retriever and how accurately the retriever can identify the most relevant piece of information.
|
| 50 |
+
|
| 51 |
+
Domain-Specific Open-Book Exam In this paper, we focus on the narrower but increasingly popular domain than the general open book exam, which we call the domain-specific open-book exam. Here, we know apriori the domain in which the LLM will be tested. The LLM can respond to the users’ prompt using use any and all information from this specific domain, which it has been fine-tuned on. Examples of domain specific examples include enterprise documents, code repositories belonging to an organization, etc. In all these scenarios, the LLM will be used to respond to the questions, whose answers can be found within a collection of documents. The retrieval technique itself has little to no-impact on the mechanism (though it may impact the accuracy). This paper studies the domain-specific open-book setting and how to adapt a pretrained LLM to this specific domain, including how to make it more robust to a varying number of retrieved documents and distractors.
|
| 52 |
+
|
| 53 |
+
# 3 RAFT
|
| 54 |
+
|
| 55 |
+
In this section, we present RAFT, a novel way of training LLMs for domain-specific openbook exams. We first introduce the classical technique of supervised fine-tuning, followed with the key takeaways from our experiments. Then, we introduce RAFT , a modified version of general instruction tuning. Lastly, we provide an overview of the experiments to expect in the later sections.
|
| 56 |
+
|
| 57 |
+
# Supervised Finetuning
|
| 58 |
+
|
| 59 |
+
Consider the supervised fine-tuning (SFT) setting for a Question-Answer dataset. The formulation consists of the Dataset $( \bar { D } )$ from which a set of Question (Q) and corresponding answer $( A )$ pairs are derived or already available. In the classical SFT setting, the model is trained to improve it’s ability to answer the questions based on it’s knowledge - obtained either during pre-training, or during the SFT training phase. The model so trained can also
|
| 60 |
+
|
| 61 |
+
Figure 3: RAFT prompt to help LLM evaluate its own generated reasoning and answers, contrasting them with the correct reasoning and answers. The LLM is prompted to identify errors in its reasoning and extract key insights for improvement. This figure specifically represents the ‘GenerateExplanation‘ step in the RAFT algorithm (Section 3).
|
| 62 |
+
|
| 63 |
+
be used at test-time with Retrieval Augmented Generation (RAG) setting, where additional documents can be introduced in the prompt to help the model answer the question. This can be represented as follows:
|
| 64 |
+
|
| 65 |
+
{Train: $\mathbf Q \to \mathbf A _ { \mathrm { j } } ^ { \prime }$ , {0-shot Inference: $\mathbf Q \to \mathbf A \}$ , {RAG Inference: $\mathbf { Q } + \mathbf { D } \mathbf { A } \}$
|
| 66 |
+
|
| 67 |
+
RAFT: Retrieval Augmented Fine-Tuning (RAFT), presents a novel recipe to prepare finetuning data to tailor the models for domain-specific open-book setting, equivalent to indomain RAG In RAFT, we prepare the training data such that each data point contains a question $( Q )$ , a set of documents $( D _ { k } )$ , and a corresponding Chain-of-though style answer $( \hat { \boldsymbol { A } } ^ { * } )$ generated from one of the document $( D ^ { * } )$ . We differentiate between two types of documents: ‘golden’ documents $( D * )$ i.e. the documents from which the answer to the question can be deduced, and ‘distractor’ documents $( D _ { i } )$ that do not contain answerrelevant information. As an implementation detail, the ‘golden’ document doesn’t need to be a single document, but can be more than one document, as is the case in HotpotQA Yang et al. (2018). Then, for $P$ fraction of the questions $( q _ { i } )$ in the dataset, we retain the golden document $( d _ { i } ^ { * } )$ along with distractor documents $( d _ { k - 1 } )$ . For $( 1 - P )$ fraction of the questions $( q _ { i } )$ in the dataset, we include no golden document and only include distractor documents $( d _ { k } )$ . We then fine-tune the language model using standard supervised training (SFT) technique, training it to generate answers from the provided documents and question. Fig. 2 illustrates the high-level design principal for RAFT .
|
| 68 |
+
|
| 69 |
+
We demonstrate that our RAG approach trains the model to perform better RAG on the set of documents it is trained on i.e., in-domain. By removing the golden documents in some instances, we are compelling the model to memorize answers instead of deriving them from the context. The training data for RAFT is as follows, and an example training data can be seen in Fig. 3:
|
| 70 |
+
|
| 71 |
+
$\mathbf { P } \%$ of data: $\mathbf { Q } + \mathbf { D } ^ { * } + \mathbf { D } _ { 1 } + \mathbf { D } _ { 2 } + \ldots + \mathbf { D } _ { k } \mathbf { A } *$ $( 1 - \mathbf { P } ) \%$ of data: $\mathbf { Q } + \mathbf { D } _ { 1 } + \mathbf { D } _ { 2 } + \ldots + \mathbf { D } _ { k } \mathbf { A } *$
|
| 72 |
+
|
| 73 |
+
Subsequently, for the test scenario, the model is provided with the Q and top-k documents retrieved by the RAG pipeline. Note that RAFT is independent of the retriever used.
|
| 74 |
+
|
| 75 |
+
A key factor in enhancing training quality is the generation of a reasoning process, such as Chain-of-Thought, to explain the provided answers. RAFT approach is similar: we demonstrate that creating a full reasoning chain and in-addition, clearly citing sources enhances the model’s accuracy in answering questions. In Fig. 3, we illustrate this setup. Generating the training data in this fashion, involves presenting the model with a question, context, and verified answers, and then requesting it to form a reasoning chain that appropriately references the original context.
|
| 76 |
+
|
| 77 |
+
For all the datasets in our experiments, we generate the answers using the technique described above. Note that the Gorilla APIBench dataset, already includes reasoning in the answers. We provide an example of the generation step in Fig. 3, the detailed reasoning answer includes a citation from the original context inside ##begin_quote## and ##end_quote## as well as the detailed explanation on how to reach the conclusion based on the citations. We demonstrate that adding detailed reasoning paragraphs can help boost the model’s performance in our experiment section.
|
| 78 |
+
|
| 79 |
+
Table 1: RAFT improves RAG performance for all specialized domains: Across PubMed, HotPot, HuggingFace, Torch Hub, and Tensorflow Hub, we see that Domain-specific Finetuning improves significantly of the performance of the base model, RAFT consistently outperforms the existing domain-specific finetuning method with or without RAG. This suggests the need to train the model with context. We compare our model with LLaMA finetuning receipes, and provide GPT-3.5 for reference.
|
| 80 |
+
|
| 81 |
+
<table><tr><td></td><td>PubMed</td><td>HotPot</td><td>HuggingFace</td><td>Torch Hub</td><td>TensorFlow</td></tr><tr><td>GPT-3.5 + RAG</td><td>71.60</td><td>41.5</td><td>29.08</td><td>60.21</td><td>65.59</td></tr><tr><td>LLaMA2-7B</td><td>56.5</td><td>0.54</td><td>0.22</td><td>0</td><td>0</td></tr><tr><td>LLaMA2-7B + RAG</td><td>58.8</td><td>0.03</td><td>26.43</td><td>08.60</td><td>43.06</td></tr><tr><td>DSF</td><td>59.7</td><td>6.38</td><td>61.06</td><td>84.94</td><td>86.56</td></tr><tr><td>DSF + RAG</td><td>71.6</td><td>4.41</td><td>42.59</td><td>82.80</td><td>60.29</td></tr><tr><td>RAFT (LLaMA2-7B)</td><td>73.30</td><td>35.28</td><td>74.00</td><td>84.95</td><td>86.86</td></tr></table>
|
| 82 |
+
|
| 83 |
+
# 4 Evaluation
|
| 84 |
+
|
| 85 |
+
We design our experiments to study how well RAFT performs compared to various baselines. We find that the RAFT-7B model (a finetuned version of LlaMA-2) is better at reading and extracting information from in-domain documents, than domain-specific finetuned model, and general-purpose model with RAG. As an ablation, we also demonstrate how important it is for the model to learn with Chain-of-Thought responses. In this section, we will first introduce all the datasets we used in the experiments, then all the baseline model/fine-tuning techniques that we benchmark against.
|
| 86 |
+
|
| 87 |
+
Datasets In our experiments, we use the following datasets to evaluate our model and all baselines. We selected these datasets to represent both popular and diverse domains including Wikipedia, Coding/API documents, and question-answering on medical documents. Natural Questions (NQ) Kwiatkowski et al. (2019), Trivia QA Joshi et al. (2017) and HotpotQA Yang et al. (2018) are the open-domain question-answers based on Wikipedia, mainly focused on common knowledge (e.g., movies, sports, etc). HuggingFace, Torch Hub, and TensorFlow Hub are from the APIBench Patil et al. (2023) proposed in the Gorilla paper. These benchmarks measure how to generate the correct, functional, and executable API calls based on the documentation. PubMed QA Jin et al. (2019) is a question-answering dataset tailored only for biomedical-research question-answering. It mainly focuses on answering medical and biology questions based on a given set of documents. We would like to highlight that $( \mathrm { N Q } ,$ Trivia $\{ \hat { \mathrm { Q A } } ,$ and HotpotQA) are relatively general domain whereas the latter two domains are on domain-specific documents.
|
| 88 |
+
|
| 89 |
+
Baselines We consider the following baselines for our experiments:
|
| 90 |
+
|
| 91 |
+
• LlaMA2-7B-chat model with 0-shot prompting: this is the commonly used instruction-finetuned model for QA tasks, where we provide clearly written instructions, but no reference documentation.
|
| 92 |
+
• LlaMA2-7B-chat model with RAG (Llama2 $^ +$ RAG): similar to the previous setting, except here we include reference documents. This is a popular technique when dealing with domain-specific QA tasks. Domain-Specific Finetuning with 0-shot prompting (DSF): Standard supervisedfinetuning, without documents in context. We find that its mostly useful to align the answering style of the model as well as get familiar with the domain context.
|
| 93 |
+
Domain-Specific Finetuning with RAG $( \mathrm { D S F } + \mathrm { R A G } )$ ): Equip a domain-specific finetuned-model with external knowledge using RAG. So, for the “knowledge” the model does not know, it can still refer to the context.
|
| 94 |
+
|
| 95 |
+
Table 2: Ablation on Chain-of-Thought: The numbers of RAFT and RAFT without CoT. Results on various datasets show that adding CoT can significantly improve the performance of the finetuned model. With a gains of $9 . 6 6 \%$ and $1 \bar { 4 } . 9 3 \%$ in the Hotpot QA and HuggingFace datasets respectively.
|
| 96 |
+
|
| 97 |
+
<table><tr><td></td><td>PubMed</td><td>HotpotQA</td><td>HuggingFace</td><td>Torch Hub</td><td>TensorFlow</td></tr><tr><td>RAFT w.0 CoT</td><td>68.30</td><td>25.62</td><td>59.07</td><td>86.56</td><td>83.21</td></tr><tr><td>RAFT</td><td>73.30</td><td>35.28</td><td>74.00</td><td>84.95</td><td>86.86</td></tr></table>
|
| 98 |
+
|
| 99 |
+
# 4.1 Results
|
| 100 |
+
|
| 101 |
+
Using the above datasets and baselines, we evaluate our model RAFT and demonstrate the effectiveness of RAFT in Tab. 1. We see that RAFT consistently and significantly outperforms the baselines. Compared with the base Llama-2 instruction-tuned model, RAFT with RAG does much better in terms of extracting information as well as being robust towards distractors. The gain can be as big as $3 5 . 2 5 \%$ on Hotpot QA and $7 6 . 3 5 \%$ on Torch Hub evaluation. Compared with DSF on the specific dataset, our model does better at relying on the provided context to solve the problem. RAFT does much better on the tasks like Hotpot and HuggingFace datasets $( 3 0 . { \bar { 8 } } 7 \%$ on Hotpot and $3 1 . 4 1 \%$ on HuggingFace). Note that for PubMed QA, since it is a binary yes/no question, we don’t observe significant gains when we compare our model with $\mathrm { D } \mathbf { \dot { S } } \mathbf { \dot { F } } + \mathbf { R } \mathbf { A } \mathbf { G }$ . Even compared with a much larger and better model GPT-3.5, RAFT demonstrates significant advantages.
|
| 102 |
+
|
| 103 |
+
Overall, the LLaMA-7B model, both with and without the RAG, performs poorly due to its answering style not aligning with the ground truth. By applying domain-specific tuning, we significantly enhance its performance. This process enables the model to learn and adopt the appropriate style of answering. However, introducing RAG to a domain-specifically fine-tuned (DSF) model doesn’t invariably lead to better outcomes. This might indicate that the model lacks training in context processing and extracting useful information from it. By incorporating our method, RAFT , we train the model not only to match its answering style with that required but also to improve its document processing capabilities. Consequently, our approach outperforms all others.
|
| 104 |
+
|
| 105 |
+
# 4.2 Effect of CoT
|
| 106 |
+
|
| 107 |
+
We also conduct an analysis to evaluate the effectiveness of the Chain-of-Thought approach in enhancing the model’s performance. As indicated in Table 2, simply providing the answer to a question may not always be adequate. This approach can lead to a rapid decrease in loss, resulting in the model beginning to overfit. Incorporating a reasoning chain that not only guides the model to the answer but also enriches the model’s understanding can improve the overall accuracy and prevent overfitting to concise answers. In our experiments, integrating the Chain-of-Thought significantly enhances training robustness. We employ GPT-4-1106 to generate our Chain-of-Thought prompts and include an example of the prompt we used in Figure 3.
|
| 108 |
+
|
| 109 |
+
# 4.3 Qualitative Analysis
|
| 110 |
+
|
| 111 |
+
To illustrate the potential advantages of RAFT over the domain-specifically fine-tuned (DSF) approach, we present a comparative example in Figure 4. This example qualitatively demonstrates a scenario where the DSF model becomes confused by a question asking for the identity of a screenwriter. Instead of providing the correct name, it mistakenly cites one of the films written by the screenwriter. In contrast, the RAFT model accurately answers the question. This discrepancy suggests that training a model solely with question-answer pairs may impair its ability to derive relevant context from provided documents. The comparison underscores the importance of incorporating both standard instructional tuning and context comprehension into the training dataset to preserve and enhance the model’s ability to process text effectively.
|
| 112 |
+
|
| 113 |
+
# HotPot QA
|
| 114 |
+
|
| 115 |
+
Question: What screenwriter with credits for “Evolution”[0/1879]e a film starring Nicolas Cage and Téa Leoni?
|
| 116 |
+
Documents: . . . David Weissman is a screenwriter and director. His film credits include “The Family Man” (2000), “Evolution” (2001), and “When in Rome” (2010). The Family Man is a 2000 American romantic comedy-drama film directed by Brett Ratner, written by David Diamond and David Weissman, and starring Nicolas Cage and Téa Leoni.
|
| 117 |
+
|
| 118 |
+

|
| 119 |
+
Figure 4: Comparison of RAFT and DSF: On the HotPot QA dataset, we can see that DSF model extracts the wrong information from the context when the question is asking who is the screen writer and it answers a film name. RAFT manages to get the accurate results .
|
| 120 |
+
|
| 121 |
+
4.4 Should we train the LLM always with the golden context for RAG?
|
| 122 |
+
|
| 123 |
+
In our exploration of whether large language models (LLMs) should always be trained with the golden context for Retrieval-Augmented Generation (RAG), we address a key question: what proportion $( \mathrm { p \% ) }$ of the training data should include golden documents? Intuitively, one might assume that for effective training in reading and extracting information from context (e.g., RAG tasks), the golden document should always be included during training $\mathrm { ( P = 1 0 0 \% }$ ). However, our findings challenge this assumption: incorporating a portion of the training data without the golden document in the context $\mathrm { ( P = 8 0 \% }$ ) appears to enhance the model’s performance on RAG tasks.
|
| 124 |
+
|
| 125 |
+
Figure 5 presents our investigation into the hyperparameter $\mathrm { P \% }$ , which represents the percentage of training instances that should include golden documents. We find that the optimal proportion varies across datasets, with $\mathrm { P \% }$ ranging from $4 0 \%$ , $6 0 \% ,$ and $1 0 0 \%$ . This indicates that training your LLM without the correct corresponding context at times can be beneficial for the downstream task of answering questions related to the documents. In our training setup, we include four distractor documents alongside the golden document, and at test time, we maintain this format by providing the golden document with four distractors. Our findings suggest that, for domain-specific RAG tasks, including a certain percentage of training data without the golden documents in the context proves to be advantageous.
|
| 126 |
+
|
| 127 |
+
# 5 RAFT Generalizes to Top-K RAG
|
| 128 |
+
|
| 129 |
+
We now study another important problem: How does the number of distractor documents in RAFT affect the model’s performance when augmented with top-k RAG results during evaluation? Previous research has highlighted the vulnerability of LLMs to irrelevant text (see studies (Shi et al., 2023a; Weston & Sukhbaatar, 2023; Liu et al., 2023)). This issue is particularly critical for LLMs $^ +$ RAG since top-k RAG is frequently employed at test time to ensure high recall. Such a scenario necessitates the model to have the ability to discern and disregard irrelevant content, focusing solely on pertinent information.
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
Figure 5: How many golden documents to involve? We study the hyperparameter $\mathrm { P \% }$ where it indicates how much portion of training data is with golden document. Results on NQ, TQA and HotpotQA suggest that mixing some amount of data that the golden document is not put in the context is helpful for in-domain RAG.
|
| 133 |
+
|
| 134 |
+
# 5.1 Making Model Robust to top-K RAG
|
| 135 |
+
|
| 136 |
+
To tackle the challenge of enhancing large language models’ (LLMs) ability to sift through irrelevant text within the retrieval pipeline, our analysis revealed that training solely with golden (highly relevant) documents can inadvertently diminish the model’s ability to discern and disregard irrelevant information. To address this, our algorithm, RAFT , adopts a strategy that integrates golden documents with a mix of irrelevant ones. This methodology prompts us to investigate the ideal fraction of distractor (irrelevant) documents to incorporate throughout the training process and to assess how well this training approach adapts to different volumes of documents encountered by the Retrieval-Augmented Generation (RAG) during the test phase. Our aim is to refine the balance between relevant and irrelevant information to strenghten the model’s efficiency in identifying and utilizing pertinent content. Notice that Sec 4.4 looked what what $\mathrm { P \% }$ of training data should include distractors, while in this section, we study test-time scenarios.
|
| 137 |
+
|
| 138 |
+
Training with Distractor Documents To enhance the robustness of LLMs against irrelevant text in retrieved documents, we adopted a finetuning approach that incorporates both golden (highly relevant) documents and distractor (irrelevant) documents. The model was trained with varying numbers of distractor documents, but consistently evaluated using the top-3 documents obtained from the retriever - not to be confused with $p$ . Our findings, detailed in Fig. 6, reveal that finetuning with only the golden document frequently results in inferior performance compared to configurations that include a greater number of distractor documents. As we can see in the figure, the better performance for Natural Questions is training with $D ^ { * } + 3 D$ and it is $D ^ { * } + 1 D$ documents with Hotpot QA. This insight has been particularly beneficial for our algorithm, RAFT . In our experiments, we consistently employ a training setup consisting of one golden document alongside four distractor documents.
|
| 139 |
+
|
| 140 |
+
Generalization to a variable number of test-time documents. We extended our research to examine the impact of different quantities of test-time documents on the model’s performance. Specifically, our experiments focused on assessing how models, trained with varying numbers of distractor documents, respond to changes in the number of documents presented at test time. The results, illustrated in Fig. 6, confirm that the inclusion of distractor documents during training indeed makes the model more resilient to fluctuations in the number of documents encountered during testing. This ability to maintain consistent performance despite variations in test-time document numbers further validates the robustness of our approach, RAFT . This finding underscores the importance of a well-calibrated training environment to prepare the model for a range of scenarios it may encounter in real-world.
|
| 141 |
+
|
| 142 |
+
# 6 Related Works
|
| 143 |
+
|
| 144 |
+
Retrieval-Augmented Language Models Retrieval-Augmented Language Models (RALMs) enhance LLMs by integrating a retrieval module that sources relevant information from external knowledge bases, significantly improving performance across various NLP tasks, including language modeling (Guu et al., 2020; Borgeaud et al., 2022; Khandelwal et al.,
|
| 145 |
+
|
| 146 |
+

|
| 147 |
+
Figure 6: Test-Time Documents Varying: To analyze how robust RAFT is to varying number of test-time documents, we study three domains – NQ, Trivia QA and HotPot QA. In ${ \mathrm { N Q } } ,$ we find that training with 4 documents leads to optimal performance, and this changes to 3 and 2 for for Trivia QA and HotPot QA respectively. However, we see that training with only golden documents leads to poor performance.
|
| 148 |
+
|
| 149 |
+
2019; Shi et al., 2023d; Lin et al., 2023b; Shi et al., 2023c; Asai et al., 2023; Xu et al., 2023; Wang et al., 2023) and open-domain question answering (Izacard et al., 2023; Lewis et al., 2020). For instance, Atlas (Izacard et al., 2023) fine-tunes T5 models with the retriever, treating documents as latent variables, while RETRO (Borgeaud et al., 2022) modifies the decoder-only architecture to include retrieved texts and conducts pre-training from scratch. kNN-LM (Khandelwal et al., 2019) interpolates between the LM’s next token distribution and distributions computed from retrieved tokens at inference. (Shi et al., 2023d; Ram et al., 2023) assume black-box access to an LLM, combining it with either off-the-shelf or fine-tuned retriever.
|
| 150 |
+
|
| 151 |
+
Memorization A key question around large neural language models is whether they truly “understand” text (Feldman, 2020; Power et al., 2022) or simply rely on surface pattern memorization (Carlini et al., 2019; Tänzer et al., 2022). (Feldman, 2020; Carlini et al., 2019; 2022) develop methodologies to quantify the extent of memorization in neural models. (Brown et al., 2020; Power et al., 2022; Liu et al., 2022) further explored how memorization impacts the models’ generalization capabilities. (Carlini et al., 2021; Shi et al., 2023b) demonstrated the ability of language models to memorize and regurgitate training data, raising significant privacy concerns (Kandpal et al., 2022; Pan et al., 2020).
|
| 152 |
+
|
| 153 |
+
Finetuning for RAG More recently, several papers have been exploring the idea of finetuning a pretrained LLM to be better at RAG tasks (Lin et al., 2023a; Wang et al., 2023; Xu et al., 2023; Liu et al., 2024). These works focus on constructing a combination of finetuning dataset for RAG and train a model to perform well on these tasks. In particular, in their settings, at test time, the domain or documents can be different than the training time; whereas our paper studies a slightly opposite scenario where we only care about testing the LLM on the same set of documents.
|
| 154 |
+
|
| 155 |
+
# 7 Conclusion
|
| 156 |
+
|
| 157 |
+
RAFT is a training strategy designed to enhance the model’s performance in answering questions within a specific domain, in "open-book" settings. We highlight several crucial design decisions, such as training the model alongside distractor documents, organizing the dataset so a portion lacks golden documents in their context, and formulating answers in a chain-of-thought manner with direct quotations from the relevant text. Our evaluations on PubMed, HotpotQA, and Gorilla API Bench underline RAFT’s significant potential.
|
| 158 |
+
|
| 159 |
+
# References
|
| 160 |
+
|
| 161 |
+
Anthropic. Prompt engineering for claude’s long context window. 2023.
|
| 162 |
+
|
| 163 |
+
Asai, A., Wu, Z., Wang, Y., Sil, A., and Hajishirzi, H. Self-rag: Learning to retrieve, generate, and critique through self-reflection. arXiv preprint arXiv:2310.11511, 2023.
|
| 164 |
+
|
| 165 |
+
Borgeaud, S., Mensch, A., Hoffmann, J., Cai, T., Rutherford, E., Millican, K., Van Den Driessche, G. B., Lespiau, J.-B., Damoc, B., Clark, A., et al. Improving language models by retrieving from trillions of tokens. In International conference on machine learning, pp. 2206–2240. PMLR, 2022.
|
| 166 |
+
Brown, T., Mann, B., Ryder, N., Subbiah, M., Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
|
| 167 |
+
Carlini, N., Liu, C., Erlingsson, Ú., Kos, J., and Song, D. The secret sharer: Evaluating and testing unintended memorization in neural networks. In 28th USENIX Security Symposium (USENIX Security 19), pp. 267–284, 2019.
|
| 168 |
+
Carlini, N., Tramer, F., Wallace, E., Jagielski, M., Herbert-Voss, A., Lee, K., Roberts, A., Brown, T., Song, D., Erlingsson, U., et al. Extracting training data from large language models. In 30th USENIX Security Symposium (USENIX Security 21), pp. 2633–2650, 2021.
|
| 169 |
+
Carlini, N., Ippolito, D., Jagielski, M., Lee, K., Tramer, F., and Zhang, C. Quantifying memorization across neural language models. In The Eleventh International Conference on Learning Representations, 2022.
|
| 170 |
+
Dernoncourt, F. and Lee, J. Y. Pubmed 200k rct: a dataset for sequential sentence classification in medical abstracts. arXiv preprint arXiv:1710.06071, 2017.
|
| 171 |
+
Feldman, V. Does learning require memorization? a short tale about a long tail. In Proceedings of the 52nd Annual ACM SIGACT Symposium on Theory of Computing, pp. 954–959, 2020.
|
| 172 |
+
Guu, K., Lee, K., Tung, Z., Pasupat, P., and Chang, M. Retrieval augmented language model pre-training. In International conference on machine learning, pp. 3929–3938. PMLR, 2020.
|
| 173 |
+
Izacard, G., Lewis, P., Lomeli, M., Hosseini, L., Petroni, F., Schick, T., Dwivedi-Yu, J., Joulin, A., Riedel, S., and Grave, E. Atlas: Few-shot learning with retrieval augmented language models. Journal of Machine Learning Research, 24(251):1–43, 2023. URL http: //jmlr.org/papers/v24/23-0037.html.
|
| 174 |
+
Jin, Q., Dhingra, B., Liu, Z., Cohen, W. W., and Lu, X. Pubmedqa: A dataset for biomedical research question answering. arXiv preprint arXiv:1909.06146, 2019.
|
| 175 |
+
Joshi, M., Choi, E., Weld, D. S., and Zettlemoyer, L. Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension. arXiv preprint arXiv:1705.03551, 2017.
|
| 176 |
+
Kandpal, N., Wallace, E., and Raffel, C. Deduplicating training data mitigates privacy risks in language models. In International Conference on Machine Learning, pp. 10697–10707. PMLR, 2022.
|
| 177 |
+
Khandelwal, U., Levy, O., Jurafsky, D., Zettlemoyer, L., and Lewis, M. Generalization through memorization: Nearest neighbor language models. arXiv preprint arXiv:1911.00172, 2019.
|
| 178 |
+
Kwiatkowski, T., Palomaki, J., Redfield, O., Collins, M., Parikh, A., Alberti, C., Epstein, D., Polosukhin, I., Devlin, J., Lee, K., et al. Natural questions: a benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:453–466, 2019.
|
| 179 |
+
Lazaridou, A., Gribovskaya, E., Stokowiec, W., and Grigorev, N. Internet-augmented language models through few-shot prompting for open-domain question answering. arXiv preprint arXiv:2203.05115, 2022.
|
| 180 |
+
Lewis, P., Perez, E., Piktus, A., Petroni, F., Karpukhin, V., Goyal, N., Küttler, H., Lewis, M., Yih, W.-t., Rocktäschel, T., et al. Retrieval-augmented generation for knowledge-intensive nlp tasks. Advances in Neural Information Processing Systems, 33:9459–9474, 2020.
|
| 181 |
+
Lin, X. V., Chen, X., Chen, M., Shi, W., Lomeli, M., James, R., Rodriguez, P., Kahn, J., Szilvasy, G., Lewis, M., et al. Ra-dit: Retrieval-augmented dual instruction tuning. arXiv preprint arXiv:2310.01352, 2023a.
|
| 182 |
+
Lin, X. V., Chen, X., Chen, M., Shi, W., Lomeli, M., James, R., Rodriguez, P., Kahn, J., Szilvasy, G., Lewis, M., et al. Ra-dit: Retrieval-augmented dual instruction tuning. arXiv preprint arXiv:2310.01352, 2023b.
|
| 183 |
+
Liu, N. F., Lin, K., Hewitt, J., Paranjape, A., Bevilacqua, M., Petroni, F., and Liang, P. Lost in the middle: How language models use long contexts. arXiv preprint arXiv:2307.03172, 2023.
|
| 184 |
+
Liu, Z., Kitouni, O., Nolte, N. S., Michaud, E., Tegmark, M., and Williams, M. Towards understanding grokking: An effective theory of representation learning. Advances in Neural Information Processing Systems, 35:34651–34663, 2022.
|
| 185 |
+
Liu, Z., Ping, W., Roy, R., Xu, P., Shoeybi, M., and Catanzaro, B. Chatqa: Building gpt-4 level conversational qa models. arXiv preprint arXiv:2401.10225, 2024.
|
| 186 |
+
Pan, X., Zhang, M., Ji, S., and Yang, M. Privacy risks of general-purpose language models. In 2020 IEEE Symposium on Security and Privacy (SP), pp. 1314–1331. IEEE, 2020.
|
| 187 |
+
Patil, S. G., Zhang, T., Wang, X., and Gonzalez, J. E. Gorilla: Large language model connected with massive apis. arXiv preprint arXiv:2305.15334, 2023.
|
| 188 |
+
Power, A., Burda, Y., Edwards, H., Babuschkin, I., and Misra, V. Grokking: Generalization beyond overfitting on small algorithmic datasets. arXiv preprint arXiv:2201.02177, 2022.
|
| 189 |
+
Ram, O., Levine, Y., Dalmedigos, I., Muhlgay, D., Shashua, A., Leyton-Brown, K., and Shoham, Y. In-context retrieval-augmented language models. arXiv preprint arXiv:2302.00083, 2023.
|
| 190 |
+
Shi, F., Chen, X., Misra, K., Scales, N., Dohan, D., Chi, E. H., Schärli, N., and Zhou, D. Large language models can be easily distracted by irrelevant context. In International Conference on Machine Learning, pp. 31210–31227. PMLR, 2023a.
|
| 191 |
+
Shi, W., Ajith, A., Xia, M., Huang, Y., Liu, D., Blevins, T., Chen, D., and Zettlemoyer, L. Detecting pretraining data from large language models. arXiv preprint arXiv:2310.16789, 2023b.
|
| 192 |
+
Shi, W., Min, S., Lomeli, M., Zhou, C., Li, M., Lin, V., Smith, N. A., Zettlemoyer, L., Yih, S., and Lewis, M. In-context pretraining: Language modeling beyond document boundaries. arXiv preprint arXiv:2310.10638, 2023c.
|
| 193 |
+
Shi, W., Min, S., Yasunaga, M., Seo, M., James, R., Lewis, M., Zettlemoyer, L., and Yih, W.-t. Replug: Retrieval-augmented black-box language models. arXiv preprint arXiv:2301.12652, 2023d.
|
| 194 |
+
Tänzer, M., Ruder, S., and Rei, M. Memorisation versus generalisation in pre-trained language models. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 7564–7578, 2022.
|
| 195 |
+
Vu, T., Iyyer, M., Wang, X., Constant, N., Wei, J., Wei, J., Tar, C., Sung, Y.-H., Zhou, D., Le, Q., et al. Freshllms: Refreshing large language models with search engine augmentation. arXiv preprint arXiv:2310.03214, 2023.
|
| 196 |
+
Wang, B., Ping, W., McAfee, L., Xu, P., Li, B., Shoeybi, M., and Catanzaro, B. Instructretro: Instruction tuning post retrieval-augmented pretraining. arXiv preprint arXiv:2310.07713, 2023.
|
| 197 |
+
Wang, Y., Kordi, Y., Mishra, S., Liu, A., Smith, N. A., Khashabi, D., and Hajishirzi, H. Self-instruct: Aligning language models with self-generated instructions. arXiv preprint arXiv:2212.10560, 2022.
|
| 198 |
+
Wei, J., Wang, X., Schuurmans, D., Bosma, M., Xia, F., Chi, E., Le, Q. V., Zhou, D., et al. Chain-of-thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35:24824–24837, 2022.
|
| 199 |
+
Weston, J. and Sukhbaatar, S. System 2 attention (is something you might need too). arXiv preprint arXiv:2311.11829, 2023.
|
| 200 |
+
Xiong, W., Liu, J., Molybog, I., Zhang, H., Bhargava, P., Hou, R., Martin, L., Rungta, R., Sankararaman, K. A., Oguz, B., et al. Effective long-context scaling of foundation models. arXiv preprint arXiv:2309.16039, 2023.
|
| 201 |
+
Xu, P., Ping, W., Wu, X., McAfee, L., Zhu, C., Liu, Z., Subramanian, S., Bakhturina, E., Shoeybi, M., and Catanzaro, B. Retrieval meets long context large language models. arXiv preprint arXiv:2310.03025, 2023.
|
| 202 |
+
Yang, Z., Qi, P., Zhang, S., Bengio, Y., Cohen, W. W., Salakhutdinov, R., and Manning, C. D. Hotpotqa: A dataset for diverse, explainable multi-hop question answering. arXiv preprint arXiv:1809.09600, 2018.
|
| 203 |
+
Zhou, C., Liu, P., Xu, P., Iyer, S., Sun, J., Mao, Y., Ma, X., Efrat, A., Yu, P., Yu, L., et al. Lima: Less is more for alignment. arXiv preprint arXiv:2305.11206, 2023.
|
md/test/y01KGvd9Bw/y01KGvd9Bw.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/test/y0GJXRungR/y0GJXRungR.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|