ZHANGYUXUAN-zR commited on
Commit
706a3b5
·
verified ·
1 Parent(s): bae09fb

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. parse/test/0jHkUDyEO9/0jHkUDyEO9.md +282 -0
  2. parse/test/0jHkUDyEO9/0jHkUDyEO9_content_list.json +581 -0
  3. parse/test/0jHkUDyEO9/0jHkUDyEO9_middle.json +0 -0
  4. parse/test/0jHkUDyEO9/0jHkUDyEO9_model.json +0 -0
  5. parse/test/CD9Snc73AW/CD9Snc73AW.md +0 -0
  6. parse/test/CD9Snc73AW/CD9Snc73AW_content_list.json +0 -0
  7. parse/test/CD9Snc73AW/CD9Snc73AW_middle.json +0 -0
  8. parse/test/CD9Snc73AW/CD9Snc73AW_model.json +0 -0
  9. parse/test/DzxaRFVsgC/DzxaRFVsgC.md +435 -0
  10. parse/test/DzxaRFVsgC/DzxaRFVsgC_content_list.json +792 -0
  11. parse/test/DzxaRFVsgC/DzxaRFVsgC_middle.json +0 -0
  12. parse/test/DzxaRFVsgC/DzxaRFVsgC_model.json +0 -0
  13. parse/test/IkmD3fKBPQ/IkmD3fKBPQ.md +294 -0
  14. parse/test/IkmD3fKBPQ/IkmD3fKBPQ_content_list.json +725 -0
  15. parse/test/IkmD3fKBPQ/IkmD3fKBPQ_middle.json +0 -0
  16. parse/test/IkmD3fKBPQ/IkmD3fKBPQ_model.json +0 -0
  17. parse/test/Rc7dAwVL3v/Rc7dAwVL3v.md +507 -0
  18. parse/test/Rc7dAwVL3v/Rc7dAwVL3v_content_list.json +0 -0
  19. parse/test/Rc7dAwVL3v/Rc7dAwVL3v_middle.json +0 -0
  20. parse/test/Rc7dAwVL3v/Rc7dAwVL3v_model.json +0 -0
  21. parse/test/SXMTK2eltf/SXMTK2eltf.md +212 -0
  22. parse/test/SXMTK2eltf/SXMTK2eltf_content_list.json +472 -0
  23. parse/test/SXMTK2eltf/SXMTK2eltf_middle.json +0 -0
  24. parse/test/SXMTK2eltf/SXMTK2eltf_model.json +0 -0
  25. parse/test/TOE6N8dp4w/TOE6N8dp4w.md +0 -0
  26. parse/test/TOE6N8dp4w/TOE6N8dp4w_content_list.json +0 -0
  27. parse/test/TOE6N8dp4w/TOE6N8dp4w_middle.json +0 -0
  28. parse/test/TOE6N8dp4w/TOE6N8dp4w_model.json +0 -0
  29. parse/test/TyFrPOKYXw/TyFrPOKYXw.md +0 -0
  30. parse/test/TyFrPOKYXw/TyFrPOKYXw_content_list.json +0 -0
  31. parse/test/TyFrPOKYXw/TyFrPOKYXw_middle.json +0 -0
  32. parse/test/TyFrPOKYXw/TyFrPOKYXw_model.json +0 -0
  33. parse/test/c8McWs4Av0/c8McWs4Av0.md +803 -0
  34. parse/test/c8McWs4Av0/c8McWs4Av0_content_list.json +0 -0
  35. parse/test/c8McWs4Av0/c8McWs4Av0_middle.json +0 -0
  36. parse/test/c8McWs4Av0/c8McWs4Av0_model.json +0 -0
  37. parse/test/ehfRiF0R3a/ehfRiF0R3a.md +0 -0
  38. parse/test/ehfRiF0R3a/ehfRiF0R3a_content_list.json +0 -0
  39. parse/test/ehfRiF0R3a/ehfRiF0R3a_middle.json +0 -0
  40. parse/test/ehfRiF0R3a/ehfRiF0R3a_model.json +0 -0
  41. parse/test/hUgBU9wgSf/hUgBU9wgSf_model.json +0 -0
  42. parse/test/kLZsLlIpDU/kLZsLlIpDU.md +0 -0
  43. parse/test/kLZsLlIpDU/kLZsLlIpDU_content_list.json +513 -0
  44. parse/test/kLZsLlIpDU/kLZsLlIpDU_middle.json +0 -0
  45. parse/test/kLZsLlIpDU/kLZsLlIpDU_model.json +0 -0
  46. parse/test/mw1PWNSWZP/mw1PWNSWZP.md +328 -0
  47. parse/test/v8L0pN6EOi/v8L0pN6EOi.md +381 -0
  48. parse/test/v8L0pN6EOi/v8L0pN6EOi_content_list.json +950 -0
  49. parse/test/v8L0pN6EOi/v8L0pN6EOi_middle.json +0 -0
  50. parse/test/v8L0pN6EOi/v8L0pN6EOi_model.json +0 -0
parse/test/0jHkUDyEO9/0jHkUDyEO9.md ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MAGIC123: ONE IMAGE TO HIGH-QUALITY 3D OBJECT GENERATION USING BOTH 2D AND 3D DIFFUSION PRIORS
2
+
3
+ Guocheng $\mathbf { Q i a n ^ { 1 , 2 } }$ , Jinjie $\mathbf { M a i } ^ { 1 }$ , Abdullah Hamdi3, Jian $\mathbf { R e n } ^ { 2 }$ , Aliaksandr Siarohin2, Bing $\mathbf { L i } ^ { 1 }$ , Hsin-Ying Lee2, Ivan Skorokhodov1, Peter Wonka1, Sergey Tulyakov2, Bernard Ghanem1 1King Abdullah University of Science and Technology (KAUST), 2Snap Inc.
4
+ 3Visual Geometry Group, University of Oxford
5
+ {guocheng.qian, bernard.ghanem}@kaust.edu.sa
6
+
7
+ ![](images/dfdb822ca86bc62980aa330e9a53edb141e0778e2c8a3a98bbb1fe0fd425664d.jpg)
8
+ Figure 1: Magic123 can reconstruct high-fidelity 3D content with detailed geometry and high-resolution renderings $( 1 0 2 4 \times 1 0 2 4 )$ from a single image in the wild. Visit https:// guochengqian.github.io/project/magic123/ for immersive visualizations and code.
9
+
10
+ # ABSTRACT
11
+
12
+ We present “Magic1 $2 3 ^ { \mathfrak { r } }$ , a two-stage coarse-to-fine approach for high-quality, textured 3D mesh generation from a single image in the wild using both 2D and 3D priors. In the first stage, we optimize a neural radiance field to produce a coarse geometry. In the second stage, we adopt a memory-efficient differentiable mesh representation to yield a high-resolution mesh with a visually appealing texture. In both stages, the 3D content is learned through reference-view supervision and novel-view guidance by a joint 2D and 3D diffusion prior. We introduce a trade-off parameter between the 2D and 3D priors to control the details and 3D consistencies of the generation. Magic123 demonstrates a significant improvement over previous image-to-3D techniques, as validated through extensive experiments on diverse synthetic and real-world images.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ 3D reconstruction from a single image (image-to-3D) is challenging because it is an undetermined problem. A typical image-to-3D system optimizes a 3D representation such as neural radiance field (NeRF) (Mildenhall et al., 2020), where the reference view and random novel views are differentially rendered during training. While the reference view can be optimized to match the input, there is no available supervision for the novel views. Due to this ill-posed nature, the primary focus of image-to-3D is how to leverage priors to guide the novel view reconstruction.
17
+
18
+ ![](images/03745631d3af01b6a2776c9a1706a1812a7e3ff20cb4f3df7e86151c83d3f956.jpg)
19
+ Figure 2: The effects of the joint 2D and 3D priors. We compare image-to-3D in three cases: a teddy bear (common object), two stacked donuts (less common object), and a dragon statue (uncommon object). Magic123 with a sole 3D prior (on the left) yields consistent yet potentially simplified 3D with reduced shape and texture details due to its low generalizability. Magic123 with a sole 2D prior (on the right) shows a strong generalizability in producing content with high details while potentially lacking 3D consistency. Magic123 proposes to use a joint 2D and 3D prior that consistently offers identity-preserving 3D with fine-grained geometry and visually appealing texture.
20
+
21
+ Current mainstream image-to-3D systems such as NeuralLift (Xu et al., 2023) and RealFusion (Melas-Kyriazi et al., 2023) employ 2D priors, e.g. text-to-image diffusion models (Rombach et al., 2022; Saharia et al., 2022), for 3D reconstruction. The novel views are guided by the 2D priors using text prompts associated with the input image by captioning (Li et al., 2022; 2023) or textual inversion (Gal et al., 2023). Without any 3D data, 2D prior-based solutions can distill 2D knowledge for 3D generation in a zero-shot fashion through score distillation sampling (SDS) (Poole et al., 2022). Thanks to the billion-scale training dataset (Schuhmann et al., 2021), 2D priors have been showing strong generalizability in 3D generation (Poole et al., 2022; Lin et al., 2023): successfully yielding detailed 3D content respecting various prompts. However, methods relying on 2D priors alone inevitably compromise on 3D consistency due to their restricted 3D knowledge. This leads to low-fidelity 3D generation, such as yielding multiple faces (Janus problems), mismatched sizes, and inconsistent texture. Fig.2 (right column) shows failure cases of using only 2D priors: the multiple faces of the teddy bear (top row) and the two donuts merged into one at the back (middle row).
22
+
23
+ Another approach to image-to-3D is to employ 3D-aware priors1. Earlier attempts at 3D reconstruction leveraged geometric priors like topology constraints (Wang et al., 2018) and coarse 3D shapes (Michel et al., 2022) to assist in 3D generation. However, these manually crafted 3D priors fall short of generating high-quality 3D content for various prompts. Recently, approaches like 3Dim (Watson et al., 2023) and Zero-1-to-3 (Liu et al., 2023) trained/finetuned view-dependent diffusion models and utilized them as 3D priors for image-to-3D generation. Since trained in 3D data, these 3D priors are more effective in generating content with high 3D consistency. Unfortunately, (1) the scale of 3D datasets is small: the largest public dataset Objaverse-XL (Deitke et al., 2023a) only contains around 10M instances; (2) 3D datasets contain mostly limited-quality instances with simple shapes. Consequently, 3D priors are limited in generalizability and tend to generate simple geometry and texture. As illustrated in Fig.2, while a 3D prior-based solution effectively processes common objects (for instance, the teddy bear example in the top row), it struggles with less common ones, yielding oversimplified, sometimes even flat 3D geometry (e.g., dragon statue at bottom left).
24
+
25
+ In this paper, rather than solely relying on a 2D or a 3D prior, we advocate for the simultaneous use of both priors to guide novel views. By modulating the simple yet effective tradeoff parameter between the 2D and 3D priors, we can manage a balance between generalizability and 3D consistency in the generated 3D content. In many cases where both 2D prior and 3D prior fail due to low 3D consistency and low generalizability, the proposed joint 2D and 3D prior propose can produce 3D content with high fidelity. Refer to Fig.2 for comparisons. Contributions of this work is summarized as follows:
26
+
27
+ • We introduce Magic123, a novel coarse-to-fine pipeline for image-to-3D generation that uses a joint 2D and 3D prior to guide the novel views. • Using the exact same set of parameters for all examples without any additional reconfiguration, Magic123 achieves state-of-the-art image-to-3D results in both real-world and synthetic scenarios.
28
+
29
+ # 2 RELATED WORK
30
+
31
+ Multi-view 3D reconstruction. The development of Neural Radiance Fields (NeRF) (Mildenhall et al., 2020; Lombardi et al., 2019) has prompted a shift towards reconstructing 3D as volume radiance (Tagliasacchi & Mildenhall, 2022), enabling the synthesis of photo-realistic novel views (Barron et al., 2022). NeRF requires as many as 100 images to reconstruct a scene. Subsequent works have explored the optimization of NeRF in few-shot (e.g. (Jain et al., 2021; Kim et al., 2022; Du et al., 2023)) and one-shot (e.g. (Yu et al., 2021; Chan et al., 2022)) settings. However, these methods fail to generate $3 6 0 ^ { \circ }$ 3D content due to the lack of strong priors for the missing novel-view information.
32
+
33
+ In-domain single-view 3D reconstruction. 3D reconstruction from a single view requires strong priors on the object geometry. Direct supervision in the form of 3D shape priors is a robust way to impose such constraints for a particular domain, like human heads (Blanz & Vetter, 2003; Booth et al., 2016), hands (Pavlakos et al., 2019) or full bodies (Loper et al., 2015; Martinez et al., 2017). Such supervision requires expensive 3D annotations and manual 3D prior creation. Thus several works explore unsupervised learning of 3D geometry from object-centric datasets (e.g. (Kanazawa et al., 2018; Duggal & Pathak, 2022; Kemelmacher-Shlizerman, 2013; Siarohin et al., 2023)). These methods are typically structured as auto-encoders (Wu et al., 2020; Kar et al., 2015; Cheng et al., 2023) or generators (Cai et al., 2022; Sun et al., 2022) with explicit 3D decomposition under the hood. Due to the lack of large-scale 3D data, in-domain 3D reconstruction is limited to simple shapes (e.g. chairs and cars) and cannot generalize to more complex or uncommon objects (e.g. dragons and statues).
34
+
35
+ Zero-shot single-view 3D reconstruction. Foundational multi-modal networks (Radford et al., 2021; Rombach et al., 2022) have enabled various zero-shot 3D synthesis tasks. Earlier works employed CLIP (Radford et al., 2021) guidance for 3D generation (Jain et al., 2022; Hong et al., 2022; Mohammad Khalid et al., 2022; Xu et al., 2022) and manipulation (Michel et al., 2022; Patashnik et al., 2021) from text prompts. Modern zero-shot text-to-image generators (Ramesh et al., 2021; Rombach et al., 2022; Saharia et al., 2022; Zhang et al., 2023) improve these results by providing stronger synthesis priors (Poole et al., 2022; Wang et al., 2023a; Metzer et al., 2022; Mikaeili et al., 2023). DreamFusion (Poole et al., 2022) is a seminal work that proposed to distill an off-the-shelf diffusion model into a NeRF for a given text query. It sparked numerous follow-up approaches to improve the quality (Lin et al., 2023; Chen et al., 2023b; Wang et al., 2023b; Chen et al., 2023a). image-to-3D reconstruction (Melas-Kyriazi et al., 2023; Tang et al., 2023b; Höllein et al., 2023; Richardson et al., 2023). Inspired by the success of text-to-3D, 2D diffusion priors were also applied to image-to-3D with additional reference view reconstruction loss (Melas-Kyriazi et al., 2023; Xu et al., 2023; Seo et al., 2023; Lin et al., 2023; Raj et al., 2023). Recently, (Watson et al., 2023; Liu et al., 2023) trained pose-dependent diffusion models that are 3D-aware and used them to improve the 3D consistency. However, they suffered from low generalizability and tended to generate oversimplified geometry due to the limited quality and the small scale of 3D datasets. Our work instead explores a joint 2D and 3D prior to balance the generalizability and 3D consistency.
36
+
37
+ # 3 METHODOLOGY
38
+
39
+ We propose Magic123, a coarse-to-fine pipeline for high-quality 3D object generation from a single reference image. Magic123 is supervised by the reference view reconstruction and guided by a joint 2D and 3D prior, as shown in Fig. 3.
40
+
41
+ ![](images/c6848b863b3cc7e95b4e0a16d9e9aa62a3c5e2fb934f4d7e6ed42f78993204d0.jpg)
42
+ Figure 3: Magic123 pipeline. Magic123 is a two-stage coarse-to-fine framework for high-quality 3D generation from a single reference image. Magic123 is supervised by the reference image reconstruction and guided by a joint 2D and 3D diffusion prior. At the coarse stage, we optimize an Instant-NGP NeRF for a coarse geometry. At the fine stage, we initialize a DMTet differentiable mesh from the NeRF output and optimize it with high-resolution rendering $( 1 0 2 4 \times 1 0 2 4 )$ ). Textural inversion is used in both stages to generate object-preserving geometry and view-consistent textures.
43
+
44
+ # 3.1 MAGIC123 PIPELINE
45
+
46
+ Image preprocessing. Magic123 is aimed at object-level image-to-3D generation. We leverage an off-the-shelf segmentation model, Dense Prediction Transformer (Ranftl et al., 2021), to segment the object. We denote the extracted binary segmentation mask M. To prevent flat geometry, we further extract the depth map by a pretrained depth estimator (Ranftl et al., 2020). The foreground image is used as the input, while the mask and the depth map are used in the optimization as regularization priors.
47
+
48
+ Coarse-to-fine pipeline. Inspired by the text-to-3D work Magic3D (Lin et al., 2023), Magic123 adopts a coarse-to-fine pipeline for image-to-3D optimization. The coarse stage of Magic123 is targeted at learning underlying geometry that respects the reference image. Due to its strong ability to handle complex topological changes in a smooth and continuous fashion, we adopt Instant-NGP (Müller et al., 2022). It only offers low-resolution renderings $( 1 2 8 \times 1 2 8 )$ during training because of memory-expensive volumetric rendering and possibly yields 3D shapes with noise due to its tendency to create high-frequency artifacts. Therefore, we introduce the fine stage that uses DMTet (Shen et al., 2021) to refine the coarse 3D model by the NeRF and to produce a high-resolution and disentangled geometry and texture. We use $1 0 2 4 \times 1 0 2 4$ rendering resolution in the fine stage, which is found to have a similar memory consumption to the coarse stage. To reconstruct 3D faithfully from a single image, we optimize the pipeline through (i) novel view guidance; (ii) reference view reconstruction supervision; (iii) two standard regularizations: depth regularization and normal smoothness.
49
+
50
+ Novel view guidance $\mathcal { L } _ { g }$ is necessary to dream up the missing information. As a significant difference from previous works, we do not rely solely on a 2D prior or a 3D prior, but we leverage a joint 2D and 3D prior to optimize the novel views. See $\ S 3 . 2$ for details.
51
+
52
+ Reference view reconstruction loss $\mathcal { L } _ { r e c }$ is to ensure the reference image ${ \bf \cal I } ^ { r }$ can be reconstructed from the reference viewpoint $( \mathbf { v } ^ { r } )$ . Mean squared error is adopted on both $\mathbf { I } ^ { r }$ and its mask as follows:
53
+
54
+ $$
55
+ \mathcal { L } _ { r e c } = \lambda _ { r g b } \| { \bf M } \odot ( { \bf I ^ { \prime } } - G _ { \theta } ( { \bf v ^ { r } } ) ) \| _ { 2 } ^ { 2 } + \lambda _ { m a s k } \| { \bf M } - M ( G _ { \theta } ( { \bf v ^ { r } } ) ) ) \| _ { 2 } ^ { 2 } ,
56
+ $$
57
+
58
+ where $\theta$ are the NeRF parameters to be optimized, $\odot$ is the Hadamard product, $G _ { \theta } ( \mathbf { v } ^ { r } )$ is a NeRF rendered RGB image from the reference viewpoint, $M ( )$ is the foreground mask acquired by integrating the volume density along the ray of each pixel. Since the foreground object is extracted as input, we do not model any background and simply use pure white for the background rendering for all experiments. $\lambda _ { r g b }$ and $\lambda _ { m a s k }$ are the weights for the foreground RGB and the mask, respectively.
59
+
60
+ Depth regularization $\mathcal { L } _ { d }$ is a standard tool to avoid overly-flat or caved-in 3D content ( $\mathrm { X u }$ et al., 2023; Tang et al., 2023b). We would like the depth $d$ from the reference viewpoint to be similar to the depth $d ^ { r }$ estimated by a pretrained depth estimator (Ranftl et al., 2020). Due to the mismatched values of $d$ and $d ^ { r }$ , we regularize them linearly through normalized negative Pearson correlation:
61
+
62
+ ![](images/b2123d9b7154bd268baaf8727adc41422fc5701079f1136205b3df7d2a5a851b.jpg)
63
+ Figure 4: 2D v.s. 3D Diffusion priors. Magic123 uses Stable Diffusion (Rombach et al., 2022) as the 2D prior and viewpoint-conditioned diffusion model Zero-1-to-3 (Liu et al., 2023) as the 3D prior.
64
+
65
+ $$
66
+ \mathcal { L } _ { d } = \frac { 1 } { 2 } \left[ 1 - \frac { \mathrm { c o v } ( \mathbf { M } \odot d ^ { r } , \mathbf { M } \odot d ) } { \sigma ( \mathbf { M } \odot d ^ { r } ) \sigma ( \mathbf { M } \odot d ) } \right] ,
67
+ $$
68
+
69
+ where $\operatorname { c o v } ( \cdot )$ denotes covariance and $\sigma ( \cdot )$ measures standard deviation.
70
+
71
+ Normal smoothness ${ \mathcal { L } } _ { n }$ is a common idea to reduce high-frequency artifacts. Finite differences of depth are used to estimate the normal map. Gaussian smoothness with a $9 \times 9$ kernel is applied:
72
+
73
+ $$
74
+ \mathcal { L } _ { n } = \| { \mathbf { n } - \tau } ( { g } ( { \mathbf { n } } ) ) \| ,
75
+ $$
76
+
77
+ where $\tau ( \cdot )$ denotes the stopgradient operation and $g ( \cdot )$ is a Gaussian blur.
78
+
79
+ Overall, both the coarse and fine stages are optimized by a combination of losses:
80
+
81
+ $$
82
+ \begin{array} { r } { \mathcal { L } _ { c } = \mathcal { L } _ { g } + \mathcal { L } _ { r e c } + \lambda _ { d } \mathcal { L } _ { d } + \lambda _ { n } \mathcal { L } _ { n } , } \end{array}
83
+ $$
84
+
85
+ We note here that we empirically find the depth and normal regularization only have marginal affects to the final performance. We keep here as a standard practice.
86
+
87
+ # 3.2 NOVEL VIEW GUIDANCE: A JOINT 2D AND 3D PRIOR
88
+
89
+ 2D priors. Using a single reference image is insufficient to optimize 3D. DreamFusion (Poole et al., 2022) proposes to use a 2D text-to-image diffusion model as the prior to guide the novel views via the proposed score distillation sampling (SDS) loss. SDS encodes the rendered view as latent, adds noise to it, and guesses the clean novel view conditioned on the input text prompt. Roughly speaking, SDS translates the rendered view into an image that respects both the content from the rendered view and the text. The SDS loss is illustrated in the upper part of Fig. 4 and is formulated as:
90
+
91
+ $$
92
+ \nabla \mathcal { L } _ { 2 D } \triangleq \mathbb { E } _ { t , \epsilon } \left[ w ( t ) ( \epsilon _ { \phi } ( \mathbf { z } _ { t } ; \mathbf { e } , t ) - \epsilon ) \frac { \partial \mathbf { z } } { \partial \mathbf { I } } \frac { \partial \mathbf { I } } { \partial \theta } \right] ,
93
+ $$
94
+
95
+ where I is a rendered view, and $\mathbf { z } _ { t }$ is the noisy latent by adding a random Gaussian noise of a time step $t$ to the latent of $\mathbf { I } . \epsilon , \epsilon _ { \phi } , \phi , \theta$ are the added noise, predicted noise, parameters of the diffusion prior, and the parameters of the 3D model. $\theta$ can be MLPs of NeRF for the coarse stage, or SDF, triangular deformations, and color field for the fine stage. DreamFusion points out that the Jacobian term of the image encoder $\textstyle { \frac { \partial \mathbf { z } } { \partial \mathbf { I } } }$ in Eq. equation 5 can be further eliminated, making the SDS loss much more efficient in terms of both speed and memory.
96
+
97
+ Textural inversion. Note the prompt $\mathbf { e }$ we use for each reference image is not a pure text chosen from tedious prompt engineering. Using pure text for image-to-3D generation sometimes results in inconsistent texture due to the limited expressiveness of the human language. For example, using “A high-resolution DSLR image of a colorful teapot” will generate different colors that do not respect the reference image. We thus follow RealFusion (Melas-Kyriazi et al., 2023) to leverage the same textual inversion (Gal et al., 2023) technique to acquire a special token $< e >$ to represent the object in the reference image. We use the same prompt for all examples: “A high-resolution DSLR image of $< e > "$ . We find that Stable Diffusion can generate an object with a more similar texture and style to the reference image with the textural inversion technique compared to the results without it.
98
+
99
+ 3D prior. Using only the 2D prior is not sufficient to capture consistent 3D geometry due to its lack of 3D knowledge. Zero-1-to-3 (Liu et al., 2023) thus proposes a 3D(-aware) prior solution.
100
+
101
+ Zero-1-to-3 finetunes Stable Diffusion into a view-dependent version on Objaverse (Deitke et al., 2023b). Zero-1-to-3 takes a reference image and a viewpoint as input and can generate a novel view from the given viewpoint. Zero-1-to-3 thereby can be used as a strong 3D prior for 3D reconstruction. The usage of Zero-1-to-3 in an image-to-3D generation pipeline using SDS is formulated as:
102
+
103
+ $$
104
+ \nabla \mathcal { L } _ { 3 D } \triangleq \mathbb { E } _ { t , \epsilon } \left[ w ( t ) ( \epsilon _ { \phi } ( \mathbf { z } _ { t } ; \mathbf { I } ^ { r } , t , R , T ) - \epsilon ) \frac { \partial \mathbf { I } } { \partial \theta } \right] ,
105
+ $$
106
+
107
+ where $R , T$ are the camera poses passed to Zero-1-to-3. The difference between using the 3D prior and the 2D prior is illustrated in Fig. 4, where we show that the 2D prior uses text embedding as a condition while the 3D prior uses the reference view $\mathbf { I } ^ { r }$ with the novel view camera poses as conditions. The 3D prior utilizes camera poses to encourage 3D consistency and enable the usage of more 3D information compared to the 2D prior counterpart.
108
+
109
+ A joint 2D and 3D prior. We find that the 2D and 3D priors are complementary to each other. The 2D prior favors high imagination thanks to its strong generalizability stemming from the large-scale training dataset of diffusion models, but might lead to inconsistent geometry due to the lack of 3D knowledge. On the other hand, the 3D prior tends to generate consistent geometry but with simple shapes and less generalizability due to the small scale and the simple geometry of the 3D dataset. In the case of uncommon objects, the 3D prior might result in over-simplified geometry and texture. Instead of relying solely on a 2D or a 3D prior, we propose to use a joint 2D and 3D prior:
110
+
111
+ $$
112
+ \begin{array} { r } { \nabla \mathcal { L } _ { g } \triangleq \mathbb { E } _ { t _ { 1 } , t _ { 2 } , \epsilon _ { 1 } , \epsilon _ { 2 } } \left[ w ( t ) \left[ \lambda _ { 2 D } ( \epsilon _ { \phi _ { 2 D } } ( \mathbf { z } _ { t _ { 1 } } ; \mathbf { e } , t _ { 1 } ) - \epsilon _ { 1 } ) + \lambda _ { 3 D } ( \epsilon _ { \phi _ { 3 D } } ( \mathbf { z } _ { t _ { 2 } } ; \mathbf { r } , t _ { 2 } , R , T ) - \epsilon _ { 2 } ) \right] \frac { \partial \mathbf { I } } { \partial \theta } \right] } \end{array}
113
+ $$
114
+
115
+ where $\lambda _ { 2 D }$ and $\lambda _ { 3 D }$ determine the strength of 2D and 3D prior, respectively. Increasing $\lambda _ { 2 D }$ leads to better generalizability, higher imagination, and more details, but less 3D consistencies. Increasing $\lambda _ { 3 D }$ results in more 3D consistencies, but worse generalizability and fewer details. However, tuning two parameters at the same time is not user-friendly. Interestingly, through both qualitative and quantitative experiments, we find that Zero-1-to-3, the 3D prior we use, is much more tolerant to $\lambda _ { 3 D }$ than Stable Diffusion to $\lambda _ { 2 D }$ (see $\ S \subset . 1$ for details). When only the 3D prior is used, i.e. $\lambda _ { 2 D } = 0$ , Zero-1-to-3 generates consistent results for $\lambda _ { 3 D }$ ranging from 10 to 60. On the contrary, Stable Diffusion is rather sensitive to $\lambda _ { 2 D }$ . When setting $\lambda _ { 3 D }$ to 0 and using the 2D prior only, the generated geometry varies a lot when $\lambda _ { 2 D }$ is changed from 1 to 2. This observation leads us to fix $\lambda _ { 3 D } = 4 0$ and to rely on tuning the $\lambda _ { 2 D }$ to trade off the generalizability and 3D consistencies. We set $\lambda _ { 2 D } = 1 . 0$ for all experiments, but this value can be tuned according to the user’s preference. More details and discussions on the choice of 2D and 3D priors weights are available in Sec.4.3.
116
+
117
+ # 4 EXPERIMENTS
118
+
119
+ # 4.1 SETUPS
120
+
121
+ NeRF4. We use a NeRF4 dataset that we collect from 4 scenes, chair, drums, ficus, and microphonefrom the synthetic NeRF dataset (Mildenhall et al., 2020). These four scenes cover complex objects (drums and ficus), a hard case (the back view of the chair), and a simple case (the microphone).
122
+
123
+ RealFusion15. We further use the 15 natural images released by RealFusion (Melas-Kyriazi et al., 2023) that consists of both synthetic and real images in a broad range for evalution.
124
+
125
+ Optimization details. We use exactly the same set of hyperparameters for all experiments and do not perform any per-object hyperparameter optimization. Most training details and camera settings are set to the same as RealFusion (Melas-Kyriazi et al., 2023). See $\ S \mathrm { A }$ and $\ S _ { \mathrm { B } }$ for details, respectively.
126
+
127
+ Evaluation metrics. Note that accurately evaluating 3D generation remains an open problem in the field. In this work, we eschew the use of a singular 3D ground truth due to the inherent ambiguity in deriving 3D structures from a single image. Instead, we adhere to the metrics employed in the most prior studies (Xu et al., 2023; Melas-Kyriazi et al., 2023), namely PSNR, LPIPS (Zhang et al., 2018), and CLIP-similarity (Radford et al., 2021). PSNR and LPIPS are gauged in the reference view to measure reconstruction quality and perceptual similarity. CLIP-similarity calculates an average CLIP distance between the 100 rendered image and the reference image to measure 3D consistency through appearance similarity across novel views and the reference view.
128
+
129
+ ![](images/5a895a0a91f17d9bef2d50c1763c1c955b620b93c35f1e105eec62b9b3029749.jpg)
130
+ Figure 5: Qualitative comparisons on image-to-3D generation. We compare Magic123 to recent methods (Point-E (Nichol et al., 2022), ShapeE (Jun & Nichol, 2023), 3DFuse (Seo et al., 2023), RealFusion (Melas-Kyriazi et al., 2023), and Zero-1-to-3 (Liu et al., 2023)) for generating 3D objects from a single unposed image (the leftmost column). We show results on the RealFusion15 dataset at the top, while the NeRF4 dataset comparisons are shown at the bottom.
131
+
132
+ # 4.2 RESULTS
133
+
134
+ Quantitative and qualitative comparisons. We compare Magic123 against the state-of-the-art PointE (Nichol et al., 2022), Shap-E (Jun & Nichol, 2023), 3DFuse (Seo et al., 2023), NeuralLift (Xu et al., 2023), RealFusion (Melas-Kyriazi et al., 2023) and Zero-1-to-3 (Liu et al., 2023) in both NeRF4 and RealFusion15 datasets. For Zero-1-to-3, we adopt the implementation from (Tang, 2022), which yields better performance than the original implementation. For other works, we use their officially released code. All baselines and Magic123 are run with their default settings. As shown in Table 1, Magic123 achieves Top-1 performance across all the metrics in both datasets when compared to previous approaches. It is worth noting that the PSNR and LPIPS results demonstrate significant improvements over the baselines, highlighting the exceptional reconstruction performance of Magic123. The improvement of CLIP-Similarity reflects the great 3D coherence regards to the reference view. Qualitative comparisons are available in Fig. 5. Magic123 achieves the best results in terms of both geometry and texture. Note how Magic123 greatly outperforms the 3D-based zero-1-to3 (Liu et al., 2023) especially in complex objects like the dragon statue and the colorful teapot in the first two rows, while at the same time greatly outperforming 2D-based RealFusion (Melas-Kyriazi et al., 2023) in all examples. This performance demonstrates the superiority of Magic123 over the state-of-the-art and its ability to generate high-quality 3D content.
135
+
136
+ Table 1: Magic123 results. We show quantitative results in terms of CLIP-Similarity↑ / PSNR↑ / LPIPS↓. The results are shown on the NeRF4 and Realfusion15 datasets, while bold reflects the best.
137
+
138
+ <table><tr><td>Dataset</td><td>Metrics\Methods</td><td>Point-E</td><td>Shap-E</td><td>3DFuse</td><td>NeuralLift</td><td>RealFusion</td><td>Zero-1-to-3</td><td>Magic123 (Ours)</td></tr><tr><td rowspan="4">NeRF4</td><td>CLIP-Similarity↑</td><td>0.48</td><td>0.60</td><td>0.60</td><td>0.52</td><td>0.38</td><td>0.62</td><td>0.80</td></tr><tr><td>PSNR↑</td><td>0.70</td><td>0.99</td><td>11.64</td><td>12.55</td><td>15.37</td><td>23.96</td><td>24.62</td></tr><tr><td>LPIPS↓</td><td>0.80</td><td>0.76</td><td>0.29</td><td>0.40</td><td>0.20</td><td>0.05</td><td>0.03</td></tr><tr><td>CLIP-Similarity↑</td><td>0.53</td><td>0.59</td><td>0.67</td><td>0.65</td><td>0.67</td><td>0.75</td><td>0.82</td></tr><tr><td rowspan="3">RealFusion15</td><td>PSNR↑</td><td>0.98</td><td>1.23</td><td>10.32</td><td>11.08</td><td>18.87</td><td>19.49</td><td>19.50</td></tr><tr><td>LPIPS↓</td><td>0.78</td><td>0.74</td><td>0.38</td><td>0.39</td><td>0.14</td><td>0.11</td><td>0.10</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
139
+
140
+ # 4.3 ABLATION AND ANALYSIS
141
+
142
+ Magic123 introduces a coarse-to-fine pipeline for single image reconstruction and a joint 2D and 3D prior for novel view guidance. We provide analysis and ablation studies to show their effectiveness.
143
+
144
+ The effect of the coarse-to-fine pipeline is shown in Fig. 6. A consistent improvement in quantitative performance is observed throughout different setups when the fine stage is used. The use of a textured mesh DMTet representation enables higher quality 3D content that fits the objective and produces more compelling and higher resolution 3D visuals. Qualitative ablation for the coarse-to-fine pipeline is available in $\ S { \bf C } . 2$ .
145
+
146
+ Combining both 2D and 3D priors and the trade-off factor $\lambda _ { 2 D }$ . Fig. 6 demonstrates the effectiveness of the joint 2D and 3D prior quantitatively. In Fig. 7, we further ablate the joint prior qualitatively and analyze the effectiveness of the trade-off hyperparameter $\lambda _ { 2 D }$ in Eqn 7. We start from $\lambda _ { 2 D } { = } 0$ to use only the 3D prior and gradually increase $\lambda _ { 2 D }$ to $0 . 1 , 0 . 5 , 1 . 0 , 2 , 5$ , and finally to use only the 2D prior with $\lambda _ { 2 D } { = } 1$ and $\lambda _ { 3 D } { = } 0$ (we also denote this case as $\lambda _ { 2 D } { = } { \infty }$ for coherence). The key observations include: (1) Relying on a sole 3D prior results in consistent geometry (e.g. teddy bear) but falters in generating complex and uncommon objects, often rendering oversimplified geometry with minimal details (e.g. dragon statue); (2) Relying on a sole 2D prior significantly improves performance in conjuring complex scenes like the dragon statue but simultaneously triggers 3D inconsistencies such as the Janus problem in the bear; (3) As $\lambda _ { 2 D }$ escalates, the imaginative prowess of Magic123 is enhanced and more details become evident, but there is a tendency to compromise 3D consistency. We assign $\lambda _ { 2 D } { = } 1$ as the default value for all examples. $\lambda _ { 2 D }$ could also be fine-tuned for even better results on certain inputs.
147
+
148
+ ![](images/87b5297e2a9c76d6fc9be5d60453c451318ee03484a412be723775336127774f.jpg)
149
+ Figure 6: Ablation study (quantitative). We quantitatively compare using the coarse and fine stages in Magic123. In both setups, we ablate utilizing only 2D prior $( \lambda _ { 2 D } = 1 , \lambda _ { 3 D } = 0 )$ ), utilizing only 3D prior $( \lambda _ { 2 D } = 0 , \lambda _ { 3 D } = 4 0 )$ ), and utilizing a joint 2D and 3D prior $( \lambda _ { 2 D } = 1 , \lambda _ { 3 D } = 4 0 )$ ).
150
+
151
+ ![](images/0e20956e1d0e24fde0a5fcf2c50b3100bcbef22f43b5ed49edbbb3e7edfdd5ae.jpg)
152
+ Figure 7: Setting $\lambda _ { 2 D }$ . We study the effects of $\lambda _ { 2 D }$ on Magic123. Increasing $\lambda _ { 2 D }$ leads to a 3D geometry with higher imagination and more details but less 3D consistencies and vice versa. $\lambda _ { 2 D } { = } 1$ provides a good balance and thus is used as default throughout all experiments.
153
+
154
+ # 5 CONCLUSION AND DISCUSSION
155
+
156
+ This work presents Magic123, a coarse-to-fine solution for generating high-quality, textured 3D meshes from a single image. By leveraging a joint 2D and 3D prior, Magic123 achieves a performance that is not reachable in a sole 2D or 3D prior-based solution and sets the new state of the art in image-to-3D generation. A trade-off parameter between the 2D and 3D priors allows for control over the generalizability and the 3D consistency. Magic123 outperforms previous techniques in terms of both realism and level of detail, as demonstrated through extensive experiments on real-world images and synthetic benchmarks. Our findings contribute to narrowing the gap between human abilities in 3D reasoning and those of machines, and pave the way for future advancements in single-image 3D reconstruction. The availability of our code, models, and generated 3D assets will further facilitate research and applications in this field.
157
+
158
+ Limitation. One limitation is that Magic123 might suffer from inconsistent texture and inaccurate geometry due to incomplete information from a single image. Specially, a clear inconsitency appers in the boundary mostly because of blended foreground and background along the boundary segmentation errors. A texture consistency loss might be helpful. Similar to previous work, Magic123 also tends to generate over-saturated textures due to the usage of the SDS loss. The over-saturation issue becomes more severe for the second stage because of the higher resolution. See examples in Fig. 5 for these failure cases: the incomplete foot of the bear, the inconsistent texture between the front (pink color) and back views (less pink) of the donuts, the round shape of the drums, and the oversaturated color of the hoarse and the chair. Similar to other per-prompt optimization methods, Magic123 also takes around 1 hour to get a 3D model and with limited diversity. This time can be reduced through (1) replacing to Gaussian Splatting in stage 1 as shown in (Tang et al., 2023a), and (2) sampling from a small range of time steps in stage 2, following the suggestions of ICLR reviewers. The diversity issue might be possible to alleviate through VDS (Wang et al., 2023b) or training with prior guidance plus diverse 3D data.
159
+
160
+ Acknowledgement. The authors would like to thank Xiaoyu Xiang for the insightful discussion and Dai-Jie Wu for sharing Point-E and Shap-E results. This work was supported by the KAUST Office of Sponsored Research through the Visual Computing Center funding, as well as, the SDAIA-KAUST Center of Excellence in Data Science and Artificial Intelligence (SDAIA-KAUST AI). Part of the support is also coming from KAUST Ibn Rushd Postdoc Fellowship program.
161
+
162
+ REFERENCES
163
+ Jonathan T Barron, Ben Mildenhall, Matthew Tancik, Peter Hedman, Ricardo Martin-Brualla, and Pratul P Srinivasan. Mip-nerf: A multiscale representation for anti-aliasing neural radiance fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5855–5864, 2021.
164
+ Jonathan T Barron, Ben Mildenhall, Dor Verbin, Pratul P Srinivasan, and Peter Hedman. Mip-nerf 360: Unbounded anti-aliased neural radiance fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5470–5479, 2022.
165
+ Volker Blanz and Thomas Vetter. Face recognition based on fitting a 3d morphable model. IEEE transactions on pattern analysis and machine intelligence (T-PAMI), 25(9):1063–1074, 2003.
166
+ James Booth, Anastasios Roussos, Stefanos Zafeiriou, Allan Ponniah, and David Dunaway. A 3d morphable model learnt from 10,000 faces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5543–5552, 2016.
167
+ Shengqu Cai, Anton Obukhov, Dengxin Dai, and Luc Van Gool. Pix2nerf: Unsupervised conditional p-gan for single image to neural radiance fields translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3981–3990, June 2022.
168
+ 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 Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 16123–16133, 2022.
169
+ Dave Zhenyu Chen, Yawar Siddiqui, Hsin-Ying Lee, Sergey Tulyakov, and Matthias Nießner. Text2tex: Text-driven texture synthesis via diffusion models. arXiv preprint arXiv:2303.11396, 2023a.
170
+ Rui Chen, Yongwei Chen, Ningxin Jiao, and Kui Jia. Fantasia3d: Disentangling geometry and appearance for high-quality text-to-3d content creation. arXiv preprint arXiv:2303.13873, 2023b.
171
+ Yen-Chi Cheng, Hsin-Ying Lee, Sergey Tulyakov, Alexander G Schwing, and Liang-Yan Gui. Sdfusion: Multimodal 3d shape completion, reconstruction, and generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
172
+ Matt Deitke, Ruoshi Liu, Matthew Wallingford, Huong Ngo, Oscar Michel, Aditya Kusupati, Alan Fan, Christian Laforte, Vikram Voleti, Samir Yitzhak Gadre, Eli VanderBilt, Aniruddha Kembhavi, Carl Vondrick, Georgia Gkioxari, Kiana Ehsani, Ludwig Schmidt, and Ali Farhadi. Objaverse-xl: A universe of $1 0 \mathrm { m } + 3 \mathrm { d }$ objects. arXiv preprint arXiv:2307.05663, 2023a.
173
+ 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 Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 13142–13153, 2023b.
174
+ Yilun Du, Cameron Smith, Ayush Tewari, and Vincent Sitzmann. Learning to render novel views from wide-baseline stereo pairs. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
175
+ Shivam Duggal and Deepak Pathak. Topologically-aware deformation fields for single-view 3d reconstruction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1536–1546, 2022.
176
+ 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. In International Conference on Learning Representations (ICLR), 2023.
177
+ Lukas Höllein, Ang Cao, Andrew Owens, Justin Johnson, and Matthias Nießner. Text2room: Extracting textured 3d meshes from 2d text-to-image models. arXiv preprint arXiv:2303.11989, 2023.
178
+
179
+ Fangzhou Hong, Mingyuan Zhang, Liang Pan, Zhongang Cai, Lei Yang, and Ziwei Liu. Avatarclip: Zero-shot text-driven generation and animation of 3d avatars. arXiv preprint arXiv:2205.08535, 2022.
180
+
181
+ Ajay Jain, Matthew Tancik, and Pieter Abbeel. Putting nerf on a diet: Semantically consistent few-shot view synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5885–5894, 2021.
182
+ Ajay Jain, Ben Mildenhall, Jonathan T Barron, Pieter Abbeel, and Ben Poole. Zero-shot text-guided object generation with dream fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 867–876, 2022.
183
+ Heewoo Jun and Alex Nichol. Shap-e: Generating conditional 3d implicit functions. arXiv preprint arXiv:2305.02463, 2023.
184
+ Angjoo Kanazawa, Shubham Tulsiani, Alexei A Efros, and Jitendra Malik. Learning categoryspecific mesh reconstruction from image collections. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 371–386, 2018.
185
+ Abhishek Kar, Shubham Tulsiani, Joao Carreira, and Jitendra Malik. Category-specific object reconstruction from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1966–1974, 2015.
186
+ Ira Kemelmacher-Shlizerman. Internet based morphable model. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3256–3263, 2013.
187
+ Mijeong Kim, Seonguk Seo, and Bohyung Han. Infonerf: Ray entropy minimization for few-shot neural volume rendering. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 12912–12921, 2022.
188
+ Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pretraining for unified vision-language understanding and generation. In International Conference on Machine Learning, pp. 12888–12900. PMLR, 2022.
189
+ Junnan Li, Dongxu Li, Silvio Savarese, and Steven C. H. Hoi. BLIP-2: bootstrapping language-image pre-training with frozen image encoders and large language models. In ICML, volume 202 of Proceedings of Machine Learning Research, pp. 19730–19742. PMLR, 2023.
190
+ 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 Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
191
+ 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, 2023.
192
+ Stephen Lombardi, Tomas Simon, Jason Saragih, Gabriel Schwartz, Andreas Lehrmann, and Yaser Sheikh. Neural volumes: Learning dynamic renderable volumes from images. arXiv preprint arXiv:1906.07751, 2019.
193
+ Matthew Loper, Naureen Mahmood, Javier Romero, Gerard Pons-Moll, and Michael J Black. Smpl: A skinned multi-person linear model. ACM Transactions on Graphics (TOG), 34(6):1–16, 2015.
194
+ Julieta Martinez, Rayat Hossain, Javier Romero, and James J Little. A simple yet effective baseline for 3d human pose estimation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2640–2649, 2017.
195
+ Luke Melas-Kyriazi, Christian Rupprecht, Iro Laina, and Andrea Vedaldi. Realfusion: $3 6 0 \{ \backslash \mathrm { d e g } \}$ reconstruction of any object from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
196
+ Gal Metzer, Elad Richardson, Or Patashnik, Raja Giryes, and Daniel Cohen-Or. Latent-nerf for shape-guided generation of 3d shapes and textures. arXiv preprint arXiv:2211.07600, 2022.
197
+
198
+ Oscar Michel, Roi Bar-On, Richard Liu, Sagie Benaim, and Rana Hanocka. Text2mesh: Text-driven neural stylization for meshes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
199
+
200
+ Aryan Mikaeili, Or Perel, Daniel Cohen-Or, and Ali Mahdavi-Amiri. Sked: Sketch-guided text-based 3d editing. arXiv preprint arXiv:2303.10735, 2023.
201
+ 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 Proceedings of the European Conference on Computer Vision (ECCV), pp. 405–421. Springer, 2020.
202
+ Nasir Mohammad Khalid, Tianhao Xie, Eugene Belilovsky, and Tiberiu Popa. Clip-mesh: Generating textured meshes from text using pretrained image-text models. In SIGGRAPH Asia 2022 Conference Papers, pp. 1–8, 2022.
203
+ Thomas Müller, Alex Evans, Christoph Schied, and Alexander Keller. Instant neural graphics primitives with a multiresolution hash encoding. In ACM Transactions on Graphics (SIGGRAPH), 2022.
204
+ 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.
205
+ Or Patashnik, Zongze Wu, Eli Shechtman, Daniel Cohen-Or, and Dani Lischinski. Styleclip: Textdriven manipulation of stylegan imagery. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2085–2094, 2021.
206
+ Georgios Pavlakos, Vasileios Choutas, Nima Ghorbani, Timo Bolkart, Ahmed AA Osman, Dimitrios Tzionas, and Michael J Black. Expressive body capture: 3d hands, face, and body from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10975–10985, 2019.
207
+ Ben Poole, Ajay Jain, Jonathan T Barron, and Ben Mildenhall. Dreamfusion: Text-to-3d using 2d diffusion. International Conference on Learning Representations (ICLR), 2022.
208
+ 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 Proceedings of the International Conference on Machine Learning (ICML), pp. 8748–8763. PMLR, 2021.
209
+ Amit Raj, Srinivas Kaza, Ben Poole, Michael Niemeyer, Nataniel Ruiz, Ben Mildenhall, Shiran Zada, Kfir Aberman, Michael Rubinstein, Jonathan Barron, et al. Dreambooth3d: Subject-driven text-to-3d generation. arXiv preprint arXiv:2303.13508, 2023.
210
+ Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In Proceedings of the International Conference on Machine Learning (ICML), pp. 8821–8831. PMLR, 2021.
211
+ René Ranftl, Katrin Lasinger, David Hafner, Konrad Schindler, and Vladlen Koltun. Towards robust monocular depth estimation: Mixing datasets for zero-shot cross-dataset transfer. IEEE transactions on pattern analysis and machine intelligence (T-PAMI), 44(3):1623–1637, 2020.
212
+ René Ranftl, Alexey Bochkovskiy, and Vladlen Koltun. Vision transformers for dense prediction. Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 12159– 12168, 2021.
213
+ Elad Richardson, Gal Metzer, Yuval Alaluf, Raja Giryes, and Daniel Cohen-Or. Texture: Text-guided texturing of 3d shapes. arXiv preprint arXiv:2302.01721, 2023.
214
+ Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. Highresolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10684–10695, 2022.
215
+ 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 (NeurIPS), 35:36479–36494, 2022.
216
+ Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-400m: Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint arXiv:2111.02114, 2021.
217
+ Junyoung Seo, Wooseok Jang, Min-Seop Kwak, Jaehoon Ko, Hyeonsu Kim, Junho Kim, Jin-Hwa Kim, Jiyoung Lee, and Seungryong Kim. Let 2d diffusion model know 3d-consistency for robust text-to-3d generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
218
+ Tianchang Shen, Jun Gao, Kangxue Yin, Ming-Yu Liu, and Sanja Fidler. Deep marching tetrahedra: a hybrid representation for high-resolution 3d shape synthesis. In Advances in Neural Information Processing Systems (NeurIPS), volume 34, pp. 6087–6101, 2021.
219
+ Aliaksandr Siarohin, Willi Menapace, Ivan Skorokhodov, Kyle Olszewski, Hsin-Ying Lee, Jian Ren, Menglei Chai, and Sergey Tulyakov. Unsupervised volumetric animation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
220
+ Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In Proceedings of the International Conference on Machine Learning (ICML), pp. 2256–2265. PMLR, 2015.
221
+ Jingxiang Sun, Xuan Wang, Yichun Shi, Lizhen Wang, Jue Wang, and Yebin Liu. Ide-3d: Interactive disentangled editing for high-resolution 3d-aware portrait synthesis. ACM Transactions on Graphics (TOG), 41(6):1–10, 2022. doi: 10.1145/3550454.3555506.
222
+ Andrea Tagliasacchi and Ben Mildenhall. Volume rendering digest (for nerf). arXiv preprint arXiv:2209.02417, 2022.
223
+ Jiaxiang Tang. Stable-dreamfusion: Text-to-3d with stable-diffusion, 2022. https://github.com/ashawkey/stable-dreamfusion.
224
+ Jiaxiang Tang, Jiawei Ren, Hang Zhou, Ziwei Liu, and Gang Zeng. Dreamgaussian: Generative gaussian splatting for efficient 3d content creation. arXiv preprint arXiv:2309.16653, 2023a.
225
+ Junshu Tang, Tengfei Wang, Bo Zhang, Ting Zhang, Ran Yi, Lizhuang Ma, and Dong Chen. Make-it-3d: High-fidelity 3d creation from a single image with diffusion prior. arXiv preprint arXiv:2303.14184, 2023b.
226
+ Haochen Wang, Xiaodan Du, Jiahao Li, Raymond A Yeh, and Greg Shakhnarovich. Score jacobian chaining: Lifting pretrained 2d diffusion models for 3d generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023a.
227
+ Nanyang Wang, Yinda Zhang, Zhuwen Li, Yanwei Fu, Wei Liu, and Yu-Gang Jiang. Pixel2mesh: Generating 3d mesh models from single rgb images. In Proceedings of the European conference on computer vision (ECCV), pp. 52–67, 2018.
228
+ 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, 2023b.
229
+ Daniel Watson, William Chan, Ricardo Martin-Brualla, Jonathan Ho, Andrea Tagliasacchi, and Mohammad Norouzi. Novel view synthesis with diffusion models. In International Conference on Learning Representations (ICLR), 2023.
230
+ Shangzhe Wu, Christian Rupprecht, and Andrea Vedaldi. Unsupervised learning of probably symmetric deformable 3d objects from images in the wild. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
231
+ Dejia Xu, Yifan Jiang, Peihao Wang, Zhiwen Fan, Yi Wang, and Zhangyang Wang. Neurallift-360: Lifting an in-the-wild 2d photo to a 3d object with $3 6 0 \{ \backslash \mathrm { d e g } \}$ views. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
232
+ Jiale Xu, Xintao Wang, Weihao Cheng, Yan-Pei Cao, Ying Shan, Xiaohu Qie, and Shenghua Gao. Dream3d: Zero-shot text-to-3d synthesis using 3d shape prior and text-to-image diffusion models. arXiv preprint arXiv:2212.14704, 2022.
233
+ Alex Yu, Vickie Ye, Matthew Tancik, and Angjoo Kanazawa. pixelnerf: Neural radiance fields from one or few images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4578–4587, 2021.
234
+ Lvmin Zhang, Anyi Rao, and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models, 2023.
235
+ 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/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
236
+
237
+ # A IMPLEMENTATION DETAILS
238
+
239
+ We use exactly the same set of hyperparameters for all experiments and do not perform any per-object hyperparameter optimization. Both coarse and fine stages are optimized using Adam with 0.001 learning rate and no weight decay for 5, 000 iterations. $\lambda _ { r g b } , \lambda _ { m a s k }$ are set to 5, 0.5 for both stages. $\lambda _ { 2 D }$ and $\lambda _ { 3 D }$ are set to 1 and 40 for the first stage and are lowered to 0.001 and 0.01 in the second stage for refinement to alleviate oversaturated textures. We adopt the Stable Diffusion (Sohl-Dickstein et al., 2015) model of V1.5 as the 2D prior. The guidance scale of the 2D prior is set to 100 following (Poole et al., 2022). For the 3D prior, Zero-1-to-3 (Liu et al., 2023) (105, 000 iterations finetuned version) is leveraged. The guidance scale of Zero-1-to-3 is set to 5 following (Liu et al., 2023). The NeRF backbone is implemented by three layers of multi-layer perceptrons with 64 hidden dims. Regarding lighting and shading, we keep nearly the same as (Poole et al., 2022). The difference is we set the first 1, 000 iterations in the first stage to normals’ shading to focus on learning geometry as inspired by (Chen et al., 2023b). For other iterations as well as the fine stage, we use diffuse shading with a probability 0.75 and textureless shading with a probability 0.25. The rendering resolutions are set to $1 2 8 \times 1 2 8$ and $1 0 2 4 \times 1 0 2 4$ for the coarse and the fine stage, respectively. For both stages, we use depth regularization and normal smoothness regularization with $\lambda _ { d } = 0 . 0 0 1$ and $\lambda _ { n } = 0 . 5$ . Following the standard practice (Barron et al., 2021; Poole et al., 2022; Melas-Kyriazi et al., 2023), we additionally add the 0.001 entropy regularization and 0.01 orientation regularization in the NeRF stage. Our implementation is based on the Stable DreamFusion repo (Tang, 2022). The training of Magic123 takes roughly 1 hour on a 32G V100 GPU, while the coarse stage and the fine stage take 40 and 20 minutes, respectively.
240
+
241
+ # B CAMERA SETTINGS
242
+
243
+ Frontal view setting. Since the reference image is unposed, our model assumes a frontal reference view ( $9 0 ^ { \circ }$ elevation and $0 ^ { \circ }$ azimuth) for simplicity. However, in real-world applications, these angles can be adjusted according to the input, either through intuitive estimation or camera pose detection. A simple tuning of the elevation angle can improve the benchmark performance of Magic123. For instance, in the chair example shown in Fig. II, altering the elevation angle from $9 0 °$ to $6 0 ^ { \circ }$ addresses squeezed reconstruction of the chair. For research purposes, we propose to exclude this camera estimation as it does not impact the comparison between different methods and only requires engineering efforts in application.
244
+
245
+ Rendering camera setting. We set the camera parameters for the rendering as follows. The camera is placed 1.8 meters from the coordinate origin, i.e. the radial distance is 1.8. The field of view (FOV) of the camera is $4 0 ^ { \circ }$ . We highlight that the 3D reconstruction performance is not sensitive to camera parameters, as long as they are reasonable, e.g. FOV between 20 and 60, and radial distance between 1 to 4 meters. In Fig. II, we validate that using the same camera parameters as RealFusion (Melas-Kyriazi et al., 2023) that is different from ours, i.e. camera radius [1.0, 1.5] and FOV [40, 70], achieves results without obvious differences as ours.
246
+
247
+ # C MORE ANALYSIS AND ABLATION STUDIES
248
+
249
+ # C.1 ABLATION AND ANALYSIS ON THE USAGE OF 2D AND 3D PRIORS
250
+
251
+ 3D priors only. We first turn off the guidance of 2D prior by setting $\lambda _ { 2 D } = 0$ , such that we only use the 3D-aware diffusion prior Zero-1-to-3 Liu et al. (2023).
252
+
253
+ Note that Zero-1-to-3 in our paper (results in Tab. 1, Fig. 5) denotes our improved reimplemented Zeo-1-to-3 using the same training configurations as Magic123. i.e. Zero-1-to-3 in our paper refers to the first stage results of Maigc123 3D prior only (Fig. 2, 6, 7), where both of them use second stage DMTet fine-tuning for fair comparison.
254
+
255
+ Furthermore, we study the effects of $\lambda _ { 3 D }$ by performing a grid search and evaluate the image-to-3D reconstruction performance, where $\lambda _ { 3 D } = 5 , 1 0 , 2 0 , 4 0 , 6 0 , 8 0$ . Interestingly, we find that Zero-1-to3 is very robust to the change of $\lambda _ { 3 D }$ . Tab. I demonstrates that different $\lambda _ { 3 D }$ leads to a consistent quantitative result. We thus simply set $\lambda _ { 3 D } = 4 0$ throughout the experiments since it achieves a slightly better CLIP-similarity score than other values.
256
+
257
+ ![](images/1b5883af50363dac4dc385b980e46e7604f0a76acdf0ac7e6f78759e3846cf15.jpg)
258
+ Figure I: Ablation study (qualitative). We qualitatively compare the novel view renderings from the coarse and fine stages in Magic123. We ablate utilizing only 2D prior $( \lambda _ { 2 D } = 1 , \lambda _ { 3 D } = 0 )$ , only 3D prior $( \lambda _ { 2 D } = 0 , \lambda _ { 3 D } = 4 0 )$ , and a joint 2D and 3D prior $( \lambda _ { 2 D } = 1 , \lambda _ { 3 D } = 4 0 )$ ). We also ablate the effects of textual inversion at the right.
259
+
260
+ 2D priors only. We then turn off the 3D prior and study the effect of $\lambda _ { 2 D }$ . As shown in Tab. I, the image-to-3D system is sensitive to the weights of the 2D prior. With the increase of $\lambda _ { 2 D }$ , a sharp increase in CLIP similarity and a drop in PSNR are observed. This is because a larger 2D prior weight leads to more imagination, which unfortunately might result in 3D inconsistency. Due to the observation that the 3D prior is more robust than the 2D prior to the weight, we use $\lambda _ { 2 D }$ as the tradeoff parameter to control the imagination and 3D consistency.
261
+
262
+ # C.2 ABLATION ON THE COARSE-TO-FINE PIPELINE
263
+
264
+ In $\ S 4 . 3$ we ablate the effect of the coarse-to-fine pipeline quantitatively. Here we provide the visual comparisons in Fig. I. The fine stage consistently augments the sharpness of the rendering and the geometry and texture details. See the edge of the wings and claws of the dragon and the toppings of the donuts for examples.
265
+
266
+ # C.3 ABLATE THE REGULARIZATION
267
+
268
+ Magic123 is optimized additionally by depth regularization, normal smoothness regularization, entropy regularization, and orientation regularization, with weights of 0.01, 0.5, 0.001, and 0.01, respectively. In Fig. II, we show that the depth, the entropy, and the orientation regularizations have minimal impact on the image-to-3D reconstruction performance. However, we keep them in our implementation as they are common practices in the NeRF family. The normal smoothness is more important in alleviating the high-frequency noise.
269
+
270
+ # C.4 ABLATE THE TEXTUAL INVERSION
271
+
272
+ We use textual inversion in both stages for consistent geometry and texture with the input reference image. Fig. I we additionally ablate the effects of textural inversion by removing it and using pure texts in the guidance. In the two examples, we change the prompts from “A high-resolution DSLR image of $< e > "$ to “A high-resolution DSLR image of a metal dragon statue”, and “A high-resolution DSLR image of two donuts”, respectively. As observed, textual inversion has marginal effects on the image-to-3D reconstruction performance. However, it helps with keeping the consistency between the input image and the generated 3D content. Without textual inversion, the dragon with a different style of horns and golden textures appears that is not consistent with the input image. The donuts without textual inversion have distinct toppings from the input image.
273
+
274
+ ![](images/075d6b565f749be3a3950f15ab8c2226185d538833b7c54c0b3951c08b3985d2.jpg)
275
+ Figure II: Qualitative ablation study for the effects of depth regularization, normal smoothness, entropy and orientation regularization, camera parameters, and ghe front-view assumption (elevation angle). Normal smoothness reduces high-frequency noise. Other factors like depth, entropy, and orientation regularization exert minimal influence on image-to-3D reconstruction results but are maintained in Magic123, adhering to common practice. Using different camera parameters, including camera radius (1.8 meters v.s. [1.0, 1.5] in RealFusion) and field of view $4 0 ~ \nu . s .$ [40, 70] in RealFusion), have a marginal impact on performance. Magic123 opts for a simple configuration, setting the camera radius to 1.8 meters and the FOV to 40. Setting the elevation angle from $9 0 °$ to a reasonable value also improves reconstruction quality (see the chair example).
276
+
277
+ # D MORE COMPARASIONS
278
+
279
+ Here, we additionally compare Magic123 with most recent methods RealFusion (Melas-Kyriazi et al., 2023), Zero-1-to-3 (Liu et al., 2023), and Make-It-3D (Tang et al., 2023b). Magic123 outperforms all of them in terms of both 3D geometry and texture quality by a large margin.
280
+
281
+ ![](images/6cd9d371d95e9709425268b86fbd69bc0c1909b55bf5cc085e3578e9bc7e8a09.jpg)
282
+ Figure III: Qualitative comparisons. We compare Magic123 to the most recent methods RealFusion (Melas-Kyriazi et al., 2023), Zero-1-to-3 (Liu et al., 2023), and Make-It-3D (Tang et al., 2023b).
parse/test/0jHkUDyEO9/0jHkUDyEO9_content_list.json ADDED
@@ -0,0 +1,581 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "MAGIC123: ONE IMAGE TO HIGH-QUALITY 3D OBJECT GENERATION USING BOTH 2D AND 3D DIFFUSION PRIORS ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Guocheng $\\mathbf { Q i a n ^ { 1 , 2 } }$ , Jinjie $\\mathbf { M a i } ^ { 1 }$ , Abdullah Hamdi3, Jian $\\mathbf { R e n } ^ { 2 }$ , Aliaksandr Siarohin2, Bing $\\mathbf { L i } ^ { 1 }$ , Hsin-Ying Lee2, Ivan Skorokhodov1, Peter Wonka1, Sergey Tulyakov2, Bernard Ghanem1 1King Abdullah University of Science and Technology (KAUST), 2Snap Inc. \n3Visual Geometry Group, University of Oxford \n{guocheng.qian, bernard.ghanem}@kaust.edu.sa ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "image",
15
+ "img_path": "images/dfdb822ca86bc62980aa330e9a53edb141e0778e2c8a3a98bbb1fe0fd425664d.jpg",
16
+ "image_caption": [
17
+ "Figure 1: Magic123 can reconstruct high-fidelity 3D content with detailed geometry and high-resolution renderings $( 1 0 2 4 \\times 1 0 2 4 )$ from a single image in the wild. Visit https:// guochengqian.github.io/project/magic123/ for immersive visualizations and code. "
18
+ ],
19
+ "image_footnote": [],
20
+ "page_idx": 0
21
+ },
22
+ {
23
+ "type": "text",
24
+ "text": "ABSTRACT ",
25
+ "text_level": 1,
26
+ "page_idx": 0
27
+ },
28
+ {
29
+ "type": "text",
30
+ "text": "We present “Magic1 $2 3 ^ { \\mathfrak { r } }$ , a two-stage coarse-to-fine approach for high-quality, textured 3D mesh generation from a single image in the wild using both 2D and 3D priors. In the first stage, we optimize a neural radiance field to produce a coarse geometry. In the second stage, we adopt a memory-efficient differentiable mesh representation to yield a high-resolution mesh with a visually appealing texture. In both stages, the 3D content is learned through reference-view supervision and novel-view guidance by a joint 2D and 3D diffusion prior. We introduce a trade-off parameter between the 2D and 3D priors to control the details and 3D consistencies of the generation. Magic123 demonstrates a significant improvement over previous image-to-3D techniques, as validated through extensive experiments on diverse synthetic and real-world images. ",
31
+ "page_idx": 0
32
+ },
33
+ {
34
+ "type": "text",
35
+ "text": "1 INTRODUCTION ",
36
+ "text_level": 1,
37
+ "page_idx": 0
38
+ },
39
+ {
40
+ "type": "text",
41
+ "text": "3D reconstruction from a single image (image-to-3D) is challenging because it is an undetermined problem. A typical image-to-3D system optimizes a 3D representation such as neural radiance field (NeRF) (Mildenhall et al., 2020), where the reference view and random novel views are differentially rendered during training. While the reference view can be optimized to match the input, there is no available supervision for the novel views. Due to this ill-posed nature, the primary focus of image-to-3D is how to leverage priors to guide the novel view reconstruction. ",
42
+ "page_idx": 0
43
+ },
44
+ {
45
+ "type": "image",
46
+ "img_path": "images/03745631d3af01b6a2776c9a1706a1812a7e3ff20cb4f3df7e86151c83d3f956.jpg",
47
+ "image_caption": [
48
+ "Figure 2: The effects of the joint 2D and 3D priors. We compare image-to-3D in three cases: a teddy bear (common object), two stacked donuts (less common object), and a dragon statue (uncommon object). Magic123 with a sole 3D prior (on the left) yields consistent yet potentially simplified 3D with reduced shape and texture details due to its low generalizability. Magic123 with a sole 2D prior (on the right) shows a strong generalizability in producing content with high details while potentially lacking 3D consistency. Magic123 proposes to use a joint 2D and 3D prior that consistently offers identity-preserving 3D with fine-grained geometry and visually appealing texture. "
49
+ ],
50
+ "image_footnote": [],
51
+ "page_idx": 1
52
+ },
53
+ {
54
+ "type": "text",
55
+ "text": "Current mainstream image-to-3D systems such as NeuralLift (Xu et al., 2023) and RealFusion (Melas-Kyriazi et al., 2023) employ 2D priors, e.g. text-to-image diffusion models (Rombach et al., 2022; Saharia et al., 2022), for 3D reconstruction. The novel views are guided by the 2D priors using text prompts associated with the input image by captioning (Li et al., 2022; 2023) or textual inversion (Gal et al., 2023). Without any 3D data, 2D prior-based solutions can distill 2D knowledge for 3D generation in a zero-shot fashion through score distillation sampling (SDS) (Poole et al., 2022). Thanks to the billion-scale training dataset (Schuhmann et al., 2021), 2D priors have been showing strong generalizability in 3D generation (Poole et al., 2022; Lin et al., 2023): successfully yielding detailed 3D content respecting various prompts. However, methods relying on 2D priors alone inevitably compromise on 3D consistency due to their restricted 3D knowledge. This leads to low-fidelity 3D generation, such as yielding multiple faces (Janus problems), mismatched sizes, and inconsistent texture. Fig.2 (right column) shows failure cases of using only 2D priors: the multiple faces of the teddy bear (top row) and the two donuts merged into one at the back (middle row). ",
56
+ "page_idx": 1
57
+ },
58
+ {
59
+ "type": "text",
60
+ "text": "Another approach to image-to-3D is to employ 3D-aware priors1. Earlier attempts at 3D reconstruction leveraged geometric priors like topology constraints (Wang et al., 2018) and coarse 3D shapes (Michel et al., 2022) to assist in 3D generation. However, these manually crafted 3D priors fall short of generating high-quality 3D content for various prompts. Recently, approaches like 3Dim (Watson et al., 2023) and Zero-1-to-3 (Liu et al., 2023) trained/finetuned view-dependent diffusion models and utilized them as 3D priors for image-to-3D generation. Since trained in 3D data, these 3D priors are more effective in generating content with high 3D consistency. Unfortunately, (1) the scale of 3D datasets is small: the largest public dataset Objaverse-XL (Deitke et al., 2023a) only contains around 10M instances; (2) 3D datasets contain mostly limited-quality instances with simple shapes. Consequently, 3D priors are limited in generalizability and tend to generate simple geometry and texture. As illustrated in Fig.2, while a 3D prior-based solution effectively processes common objects (for instance, the teddy bear example in the top row), it struggles with less common ones, yielding oversimplified, sometimes even flat 3D geometry (e.g., dragon statue at bottom left). ",
61
+ "page_idx": 1
62
+ },
63
+ {
64
+ "type": "text",
65
+ "text": "In this paper, rather than solely relying on a 2D or a 3D prior, we advocate for the simultaneous use of both priors to guide novel views. By modulating the simple yet effective tradeoff parameter between the 2D and 3D priors, we can manage a balance between generalizability and 3D consistency in the generated 3D content. In many cases where both 2D prior and 3D prior fail due to low 3D consistency and low generalizability, the proposed joint 2D and 3D prior propose can produce 3D content with high fidelity. Refer to Fig.2 for comparisons. Contributions of this work is summarized as follows: ",
66
+ "page_idx": 2
67
+ },
68
+ {
69
+ "type": "text",
70
+ "text": "• We introduce Magic123, a novel coarse-to-fine pipeline for image-to-3D generation that uses a joint 2D and 3D prior to guide the novel views. • Using the exact same set of parameters for all examples without any additional reconfiguration, Magic123 achieves state-of-the-art image-to-3D results in both real-world and synthetic scenarios. ",
71
+ "page_idx": 2
72
+ },
73
+ {
74
+ "type": "text",
75
+ "text": "2 RELATED WORK ",
76
+ "text_level": 1,
77
+ "page_idx": 2
78
+ },
79
+ {
80
+ "type": "text",
81
+ "text": "Multi-view 3D reconstruction. The development of Neural Radiance Fields (NeRF) (Mildenhall et al., 2020; Lombardi et al., 2019) has prompted a shift towards reconstructing 3D as volume radiance (Tagliasacchi & Mildenhall, 2022), enabling the synthesis of photo-realistic novel views (Barron et al., 2022). NeRF requires as many as 100 images to reconstruct a scene. Subsequent works have explored the optimization of NeRF in few-shot (e.g. (Jain et al., 2021; Kim et al., 2022; Du et al., 2023)) and one-shot (e.g. (Yu et al., 2021; Chan et al., 2022)) settings. However, these methods fail to generate $3 6 0 ^ { \\circ }$ 3D content due to the lack of strong priors for the missing novel-view information. ",
82
+ "page_idx": 2
83
+ },
84
+ {
85
+ "type": "text",
86
+ "text": "In-domain single-view 3D reconstruction. 3D reconstruction from a single view requires strong priors on the object geometry. Direct supervision in the form of 3D shape priors is a robust way to impose such constraints for a particular domain, like human heads (Blanz & Vetter, 2003; Booth et al., 2016), hands (Pavlakos et al., 2019) or full bodies (Loper et al., 2015; Martinez et al., 2017). Such supervision requires expensive 3D annotations and manual 3D prior creation. Thus several works explore unsupervised learning of 3D geometry from object-centric datasets (e.g. (Kanazawa et al., 2018; Duggal & Pathak, 2022; Kemelmacher-Shlizerman, 2013; Siarohin et al., 2023)). These methods are typically structured as auto-encoders (Wu et al., 2020; Kar et al., 2015; Cheng et al., 2023) or generators (Cai et al., 2022; Sun et al., 2022) with explicit 3D decomposition under the hood. Due to the lack of large-scale 3D data, in-domain 3D reconstruction is limited to simple shapes (e.g. chairs and cars) and cannot generalize to more complex or uncommon objects (e.g. dragons and statues). ",
87
+ "page_idx": 2
88
+ },
89
+ {
90
+ "type": "text",
91
+ "text": "Zero-shot single-view 3D reconstruction. Foundational multi-modal networks (Radford et al., 2021; Rombach et al., 2022) have enabled various zero-shot 3D synthesis tasks. Earlier works employed CLIP (Radford et al., 2021) guidance for 3D generation (Jain et al., 2022; Hong et al., 2022; Mohammad Khalid et al., 2022; Xu et al., 2022) and manipulation (Michel et al., 2022; Patashnik et al., 2021) from text prompts. Modern zero-shot text-to-image generators (Ramesh et al., 2021; Rombach et al., 2022; Saharia et al., 2022; Zhang et al., 2023) improve these results by providing stronger synthesis priors (Poole et al., 2022; Wang et al., 2023a; Metzer et al., 2022; Mikaeili et al., 2023). DreamFusion (Poole et al., 2022) is a seminal work that proposed to distill an off-the-shelf diffusion model into a NeRF for a given text query. It sparked numerous follow-up approaches to improve the quality (Lin et al., 2023; Chen et al., 2023b; Wang et al., 2023b; Chen et al., 2023a). image-to-3D reconstruction (Melas-Kyriazi et al., 2023; Tang et al., 2023b; Höllein et al., 2023; Richardson et al., 2023). Inspired by the success of text-to-3D, 2D diffusion priors were also applied to image-to-3D with additional reference view reconstruction loss (Melas-Kyriazi et al., 2023; Xu et al., 2023; Seo et al., 2023; Lin et al., 2023; Raj et al., 2023). Recently, (Watson et al., 2023; Liu et al., 2023) trained pose-dependent diffusion models that are 3D-aware and used them to improve the 3D consistency. However, they suffered from low generalizability and tended to generate oversimplified geometry due to the limited quality and the small scale of 3D datasets. Our work instead explores a joint 2D and 3D prior to balance the generalizability and 3D consistency. ",
92
+ "page_idx": 2
93
+ },
94
+ {
95
+ "type": "text",
96
+ "text": "3 METHODOLOGY ",
97
+ "text_level": 1,
98
+ "page_idx": 2
99
+ },
100
+ {
101
+ "type": "text",
102
+ "text": "We propose Magic123, a coarse-to-fine pipeline for high-quality 3D object generation from a single reference image. Magic123 is supervised by the reference view reconstruction and guided by a joint 2D and 3D prior, as shown in Fig. 3. ",
103
+ "page_idx": 2
104
+ },
105
+ {
106
+ "type": "image",
107
+ "img_path": "images/c6848b863b3cc7e95b4e0a16d9e9aa62a3c5e2fb934f4d7e6ed42f78993204d0.jpg",
108
+ "image_caption": [
109
+ "Figure 3: Magic123 pipeline. Magic123 is a two-stage coarse-to-fine framework for high-quality 3D generation from a single reference image. Magic123 is supervised by the reference image reconstruction and guided by a joint 2D and 3D diffusion prior. At the coarse stage, we optimize an Instant-NGP NeRF for a coarse geometry. At the fine stage, we initialize a DMTet differentiable mesh from the NeRF output and optimize it with high-resolution rendering $( 1 0 2 4 \\times 1 0 2 4 )$ ). Textural inversion is used in both stages to generate object-preserving geometry and view-consistent textures. "
110
+ ],
111
+ "image_footnote": [],
112
+ "page_idx": 3
113
+ },
114
+ {
115
+ "type": "text",
116
+ "text": "3.1 MAGIC123 PIPELINE",
117
+ "text_level": 1,
118
+ "page_idx": 3
119
+ },
120
+ {
121
+ "type": "text",
122
+ "text": "Image preprocessing. Magic123 is aimed at object-level image-to-3D generation. We leverage an off-the-shelf segmentation model, Dense Prediction Transformer (Ranftl et al., 2021), to segment the object. We denote the extracted binary segmentation mask M. To prevent flat geometry, we further extract the depth map by a pretrained depth estimator (Ranftl et al., 2020). The foreground image is used as the input, while the mask and the depth map are used in the optimization as regularization priors. ",
123
+ "page_idx": 3
124
+ },
125
+ {
126
+ "type": "text",
127
+ "text": "Coarse-to-fine pipeline. Inspired by the text-to-3D work Magic3D (Lin et al., 2023), Magic123 adopts a coarse-to-fine pipeline for image-to-3D optimization. The coarse stage of Magic123 is targeted at learning underlying geometry that respects the reference image. Due to its strong ability to handle complex topological changes in a smooth and continuous fashion, we adopt Instant-NGP (Müller et al., 2022). It only offers low-resolution renderings $( 1 2 8 \\times 1 2 8 )$ during training because of memory-expensive volumetric rendering and possibly yields 3D shapes with noise due to its tendency to create high-frequency artifacts. Therefore, we introduce the fine stage that uses DMTet (Shen et al., 2021) to refine the coarse 3D model by the NeRF and to produce a high-resolution and disentangled geometry and texture. We use $1 0 2 4 \\times 1 0 2 4$ rendering resolution in the fine stage, which is found to have a similar memory consumption to the coarse stage. To reconstruct 3D faithfully from a single image, we optimize the pipeline through (i) novel view guidance; (ii) reference view reconstruction supervision; (iii) two standard regularizations: depth regularization and normal smoothness. ",
128
+ "page_idx": 3
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "Novel view guidance $\\mathcal { L } _ { g }$ is necessary to dream up the missing information. As a significant difference from previous works, we do not rely solely on a 2D prior or a 3D prior, but we leverage a joint 2D and 3D prior to optimize the novel views. See $\\ S 3 . 2$ for details. ",
133
+ "page_idx": 3
134
+ },
135
+ {
136
+ "type": "text",
137
+ "text": "Reference view reconstruction loss $\\mathcal { L } _ { r e c }$ is to ensure the reference image ${ \\bf \\cal I } ^ { r }$ can be reconstructed from the reference viewpoint $( \\mathbf { v } ^ { r } )$ . Mean squared error is adopted on both $\\mathbf { I } ^ { r }$ and its mask as follows: ",
138
+ "page_idx": 3
139
+ },
140
+ {
141
+ "type": "equation",
142
+ "img_path": "images/e11eba4a021557530d70523a61e7cdb2ebac9e2c554861b48f5521de3132c708.jpg",
143
+ "text": "$$\n\\mathcal { L } _ { r e c } = \\lambda _ { r g b } \\| { \\bf M } \\odot ( { \\bf I ^ { \\prime } } - G _ { \\theta } ( { \\bf v ^ { r } } ) ) \\| _ { 2 } ^ { 2 } + \\lambda _ { m a s k } \\| { \\bf M } - M ( G _ { \\theta } ( { \\bf v ^ { r } } ) ) ) \\| _ { 2 } ^ { 2 } ,\n$$",
144
+ "text_format": "latex",
145
+ "page_idx": 3
146
+ },
147
+ {
148
+ "type": "text",
149
+ "text": "where $\\theta$ are the NeRF parameters to be optimized, $\\odot$ is the Hadamard product, $G _ { \\theta } ( \\mathbf { v } ^ { r } )$ is a NeRF rendered RGB image from the reference viewpoint, $M ( )$ is the foreground mask acquired by integrating the volume density along the ray of each pixel. Since the foreground object is extracted as input, we do not model any background and simply use pure white for the background rendering for all experiments. $\\lambda _ { r g b }$ and $\\lambda _ { m a s k }$ are the weights for the foreground RGB and the mask, respectively. ",
150
+ "page_idx": 3
151
+ },
152
+ {
153
+ "type": "text",
154
+ "text": "Depth regularization $\\mathcal { L } _ { d }$ is a standard tool to avoid overly-flat or caved-in 3D content ( $\\mathrm { X u }$ et al., 2023; Tang et al., 2023b). We would like the depth $d$ from the reference viewpoint to be similar to the depth $d ^ { r }$ estimated by a pretrained depth estimator (Ranftl et al., 2020). Due to the mismatched values of $d$ and $d ^ { r }$ , we regularize them linearly through normalized negative Pearson correlation: ",
155
+ "page_idx": 3
156
+ },
157
+ {
158
+ "type": "image",
159
+ "img_path": "images/b2123d9b7154bd268baaf8727adc41422fc5701079f1136205b3df7d2a5a851b.jpg",
160
+ "image_caption": [
161
+ "Figure 4: 2D v.s. 3D Diffusion priors. Magic123 uses Stable Diffusion (Rombach et al., 2022) as the 2D prior and viewpoint-conditioned diffusion model Zero-1-to-3 (Liu et al., 2023) as the 3D prior. "
162
+ ],
163
+ "image_footnote": [],
164
+ "page_idx": 4
165
+ },
166
+ {
167
+ "type": "text",
168
+ "text": "",
169
+ "page_idx": 4
170
+ },
171
+ {
172
+ "type": "equation",
173
+ "img_path": "images/28b5bbbee3b1ac594b05853e25a4efb527e8777189ac9d6015f2b2ad26972320.jpg",
174
+ "text": "$$\n\\mathcal { L } _ { d } = \\frac { 1 } { 2 } \\left[ 1 - \\frac { \\mathrm { c o v } ( \\mathbf { M } \\odot d ^ { r } , \\mathbf { M } \\odot d ) } { \\sigma ( \\mathbf { M } \\odot d ^ { r } ) \\sigma ( \\mathbf { M } \\odot d ) } \\right] ,\n$$",
175
+ "text_format": "latex",
176
+ "page_idx": 4
177
+ },
178
+ {
179
+ "type": "text",
180
+ "text": "where $\\operatorname { c o v } ( \\cdot )$ denotes covariance and $\\sigma ( \\cdot )$ measures standard deviation. ",
181
+ "page_idx": 4
182
+ },
183
+ {
184
+ "type": "text",
185
+ "text": "Normal smoothness ${ \\mathcal { L } } _ { n }$ is a common idea to reduce high-frequency artifacts. Finite differences of depth are used to estimate the normal map. Gaussian smoothness with a $9 \\times 9$ kernel is applied: ",
186
+ "page_idx": 4
187
+ },
188
+ {
189
+ "type": "equation",
190
+ "img_path": "images/01bf3b725414aad6171b14b479933396a02ee3725b1ea68e0203a27f63bea74c.jpg",
191
+ "text": "$$\n\\mathcal { L } _ { n } = \\| { \\mathbf { n } - \\tau } ( { g } ( { \\mathbf { n } } ) ) \\| ,\n$$",
192
+ "text_format": "latex",
193
+ "page_idx": 4
194
+ },
195
+ {
196
+ "type": "text",
197
+ "text": "where $\\tau ( \\cdot )$ denotes the stopgradient operation and $g ( \\cdot )$ is a Gaussian blur. ",
198
+ "page_idx": 4
199
+ },
200
+ {
201
+ "type": "text",
202
+ "text": "Overall, both the coarse and fine stages are optimized by a combination of losses: ",
203
+ "page_idx": 4
204
+ },
205
+ {
206
+ "type": "equation",
207
+ "img_path": "images/52e224450e4d62ae4010f9090c77a71bbab0df7d9c5b4db6df16054dd2fbc2ca.jpg",
208
+ "text": "$$\n\\begin{array} { r } { \\mathcal { L } _ { c } = \\mathcal { L } _ { g } + \\mathcal { L } _ { r e c } + \\lambda _ { d } \\mathcal { L } _ { d } + \\lambda _ { n } \\mathcal { L } _ { n } , } \\end{array}\n$$",
209
+ "text_format": "latex",
210
+ "page_idx": 4
211
+ },
212
+ {
213
+ "type": "text",
214
+ "text": "We note here that we empirically find the depth and normal regularization only have marginal affects to the final performance. We keep here as a standard practice. ",
215
+ "page_idx": 4
216
+ },
217
+ {
218
+ "type": "text",
219
+ "text": "3.2 NOVEL VIEW GUIDANCE: A JOINT 2D AND 3D PRIOR ",
220
+ "text_level": 1,
221
+ "page_idx": 4
222
+ },
223
+ {
224
+ "type": "text",
225
+ "text": "2D priors. Using a single reference image is insufficient to optimize 3D. DreamFusion (Poole et al., 2022) proposes to use a 2D text-to-image diffusion model as the prior to guide the novel views via the proposed score distillation sampling (SDS) loss. SDS encodes the rendered view as latent, adds noise to it, and guesses the clean novel view conditioned on the input text prompt. Roughly speaking, SDS translates the rendered view into an image that respects both the content from the rendered view and the text. The SDS loss is illustrated in the upper part of Fig. 4 and is formulated as: ",
226
+ "page_idx": 4
227
+ },
228
+ {
229
+ "type": "equation",
230
+ "img_path": "images/ffbe37d68ec59c3662cf2212bcdbef4dc5ea74c39ddc8b4b65af61de792d26fe.jpg",
231
+ "text": "$$\n\\nabla \\mathcal { L } _ { 2 D } \\triangleq \\mathbb { E } _ { t , \\epsilon } \\left[ w ( t ) ( \\epsilon _ { \\phi } ( \\mathbf { z } _ { t } ; \\mathbf { e } , t ) - \\epsilon ) \\frac { \\partial \\mathbf { z } } { \\partial \\mathbf { I } } \\frac { \\partial \\mathbf { I } } { \\partial \\theta } \\right] ,\n$$",
232
+ "text_format": "latex",
233
+ "page_idx": 4
234
+ },
235
+ {
236
+ "type": "text",
237
+ "text": "where I is a rendered view, and $\\mathbf { z } _ { t }$ is the noisy latent by adding a random Gaussian noise of a time step $t$ to the latent of $\\mathbf { I } . \\epsilon , \\epsilon _ { \\phi } , \\phi , \\theta$ are the added noise, predicted noise, parameters of the diffusion prior, and the parameters of the 3D model. $\\theta$ can be MLPs of NeRF for the coarse stage, or SDF, triangular deformations, and color field for the fine stage. DreamFusion points out that the Jacobian term of the image encoder $\\textstyle { \\frac { \\partial \\mathbf { z } } { \\partial \\mathbf { I } } }$ in Eq. equation 5 can be further eliminated, making the SDS loss much more efficient in terms of both speed and memory. ",
238
+ "page_idx": 4
239
+ },
240
+ {
241
+ "type": "text",
242
+ "text": "Textural inversion. Note the prompt $\\mathbf { e }$ we use for each reference image is not a pure text chosen from tedious prompt engineering. Using pure text for image-to-3D generation sometimes results in inconsistent texture due to the limited expressiveness of the human language. For example, using “A high-resolution DSLR image of a colorful teapot” will generate different colors that do not respect the reference image. We thus follow RealFusion (Melas-Kyriazi et al., 2023) to leverage the same textual inversion (Gal et al., 2023) technique to acquire a special token $< e >$ to represent the object in the reference image. We use the same prompt for all examples: “A high-resolution DSLR image of $< e > \"$ . We find that Stable Diffusion can generate an object with a more similar texture and style to the reference image with the textural inversion technique compared to the results without it. ",
243
+ "page_idx": 4
244
+ },
245
+ {
246
+ "type": "text",
247
+ "text": "3D prior. Using only the 2D prior is not sufficient to capture consistent 3D geometry due to its lack of 3D knowledge. Zero-1-to-3 (Liu et al., 2023) thus proposes a 3D(-aware) prior solution. ",
248
+ "page_idx": 4
249
+ },
250
+ {
251
+ "type": "text",
252
+ "text": "Zero-1-to-3 finetunes Stable Diffusion into a view-dependent version on Objaverse (Deitke et al., 2023b). Zero-1-to-3 takes a reference image and a viewpoint as input and can generate a novel view from the given viewpoint. Zero-1-to-3 thereby can be used as a strong 3D prior for 3D reconstruction. The usage of Zero-1-to-3 in an image-to-3D generation pipeline using SDS is formulated as: ",
253
+ "page_idx": 5
254
+ },
255
+ {
256
+ "type": "equation",
257
+ "img_path": "images/8aaf959d4cba44f9f472260c2ede7a25347114e2829088062033b3e8b3008f1f.jpg",
258
+ "text": "$$\n\\nabla \\mathcal { L } _ { 3 D } \\triangleq \\mathbb { E } _ { t , \\epsilon } \\left[ w ( t ) ( \\epsilon _ { \\phi } ( \\mathbf { z } _ { t } ; \\mathbf { I } ^ { r } , t , R , T ) - \\epsilon ) \\frac { \\partial \\mathbf { I } } { \\partial \\theta } \\right] ,\n$$",
259
+ "text_format": "latex",
260
+ "page_idx": 5
261
+ },
262
+ {
263
+ "type": "text",
264
+ "text": "where $R , T$ are the camera poses passed to Zero-1-to-3. The difference between using the 3D prior and the 2D prior is illustrated in Fig. 4, where we show that the 2D prior uses text embedding as a condition while the 3D prior uses the reference view $\\mathbf { I } ^ { r }$ with the novel view camera poses as conditions. The 3D prior utilizes camera poses to encourage 3D consistency and enable the usage of more 3D information compared to the 2D prior counterpart. ",
265
+ "page_idx": 5
266
+ },
267
+ {
268
+ "type": "text",
269
+ "text": "A joint 2D and 3D prior. We find that the 2D and 3D priors are complementary to each other. The 2D prior favors high imagination thanks to its strong generalizability stemming from the large-scale training dataset of diffusion models, but might lead to inconsistent geometry due to the lack of 3D knowledge. On the other hand, the 3D prior tends to generate consistent geometry but with simple shapes and less generalizability due to the small scale and the simple geometry of the 3D dataset. In the case of uncommon objects, the 3D prior might result in over-simplified geometry and texture. Instead of relying solely on a 2D or a 3D prior, we propose to use a joint 2D and 3D prior: ",
270
+ "page_idx": 5
271
+ },
272
+ {
273
+ "type": "equation",
274
+ "img_path": "images/06f2c94006ca75de7826dcde32a6a9afd6fe1764c822e8b63133c0ac6dcf4ba7.jpg",
275
+ "text": "$$\n\\begin{array} { r } { \\nabla \\mathcal { L } _ { g } \\triangleq \\mathbb { E } _ { t _ { 1 } , t _ { 2 } , \\epsilon _ { 1 } , \\epsilon _ { 2 } } \\left[ w ( t ) \\left[ \\lambda _ { 2 D } ( \\epsilon _ { \\phi _ { 2 D } } ( \\mathbf { z } _ { t _ { 1 } } ; \\mathbf { e } , t _ { 1 } ) - \\epsilon _ { 1 } ) + \\lambda _ { 3 D } ( \\epsilon _ { \\phi _ { 3 D } } ( \\mathbf { z } _ { t _ { 2 } } ; \\mathbf { r } , t _ { 2 } , R , T ) - \\epsilon _ { 2 } ) \\right] \\frac { \\partial \\mathbf { I } } { \\partial \\theta } \\right] } \\end{array}\n$$",
276
+ "text_format": "latex",
277
+ "page_idx": 5
278
+ },
279
+ {
280
+ "type": "text",
281
+ "text": "where $\\lambda _ { 2 D }$ and $\\lambda _ { 3 D }$ determine the strength of 2D and 3D prior, respectively. Increasing $\\lambda _ { 2 D }$ leads to better generalizability, higher imagination, and more details, but less 3D consistencies. Increasing $\\lambda _ { 3 D }$ results in more 3D consistencies, but worse generalizability and fewer details. However, tuning two parameters at the same time is not user-friendly. Interestingly, through both qualitative and quantitative experiments, we find that Zero-1-to-3, the 3D prior we use, is much more tolerant to $\\lambda _ { 3 D }$ than Stable Diffusion to $\\lambda _ { 2 D }$ (see $\\ S \\subset . 1$ for details). When only the 3D prior is used, i.e. $\\lambda _ { 2 D } = 0$ , Zero-1-to-3 generates consistent results for $\\lambda _ { 3 D }$ ranging from 10 to 60. On the contrary, Stable Diffusion is rather sensitive to $\\lambda _ { 2 D }$ . When setting $\\lambda _ { 3 D }$ to 0 and using the 2D prior only, the generated geometry varies a lot when $\\lambda _ { 2 D }$ is changed from 1 to 2. This observation leads us to fix $\\lambda _ { 3 D } = 4 0$ and to rely on tuning the $\\lambda _ { 2 D }$ to trade off the generalizability and 3D consistencies. We set $\\lambda _ { 2 D } = 1 . 0$ for all experiments, but this value can be tuned according to the user’s preference. More details and discussions on the choice of 2D and 3D priors weights are available in Sec.4.3. ",
282
+ "page_idx": 5
283
+ },
284
+ {
285
+ "type": "text",
286
+ "text": "4 EXPERIMENTS ",
287
+ "text_level": 1,
288
+ "page_idx": 5
289
+ },
290
+ {
291
+ "type": "text",
292
+ "text": "4.1 SETUPS ",
293
+ "text_level": 1,
294
+ "page_idx": 5
295
+ },
296
+ {
297
+ "type": "text",
298
+ "text": "NeRF4. We use a NeRF4 dataset that we collect from 4 scenes, chair, drums, ficus, and microphonefrom the synthetic NeRF dataset (Mildenhall et al., 2020). These four scenes cover complex objects (drums and ficus), a hard case (the back view of the chair), and a simple case (the microphone). ",
299
+ "page_idx": 5
300
+ },
301
+ {
302
+ "type": "text",
303
+ "text": "RealFusion15. We further use the 15 natural images released by RealFusion (Melas-Kyriazi et al., 2023) that consists of both synthetic and real images in a broad range for evalution. ",
304
+ "page_idx": 5
305
+ },
306
+ {
307
+ "type": "text",
308
+ "text": "Optimization details. We use exactly the same set of hyperparameters for all experiments and do not perform any per-object hyperparameter optimization. Most training details and camera settings are set to the same as RealFusion (Melas-Kyriazi et al., 2023). See $\\ S \\mathrm { A }$ and $\\ S _ { \\mathrm { B } }$ for details, respectively. ",
309
+ "page_idx": 5
310
+ },
311
+ {
312
+ "type": "text",
313
+ "text": "Evaluation metrics. Note that accurately evaluating 3D generation remains an open problem in the field. In this work, we eschew the use of a singular 3D ground truth due to the inherent ambiguity in deriving 3D structures from a single image. Instead, we adhere to the metrics employed in the most prior studies (Xu et al., 2023; Melas-Kyriazi et al., 2023), namely PSNR, LPIPS (Zhang et al., 2018), and CLIP-similarity (Radford et al., 2021). PSNR and LPIPS are gauged in the reference view to measure reconstruction quality and perceptual similarity. CLIP-similarity calculates an average CLIP distance between the 100 rendered image and the reference image to measure 3D consistency through appearance similarity across novel views and the reference view. ",
314
+ "page_idx": 5
315
+ },
316
+ {
317
+ "type": "image",
318
+ "img_path": "images/5a895a0a91f17d9bef2d50c1763c1c955b620b93c35f1e105eec62b9b3029749.jpg",
319
+ "image_caption": [
320
+ "Figure 5: Qualitative comparisons on image-to-3D generation. We compare Magic123 to recent methods (Point-E (Nichol et al., 2022), ShapeE (Jun & Nichol, 2023), 3DFuse (Seo et al., 2023), RealFusion (Melas-Kyriazi et al., 2023), and Zero-1-to-3 (Liu et al., 2023)) for generating 3D objects from a single unposed image (the leftmost column). We show results on the RealFusion15 dataset at the top, while the NeRF4 dataset comparisons are shown at the bottom. "
321
+ ],
322
+ "image_footnote": [],
323
+ "page_idx": 6
324
+ },
325
+ {
326
+ "type": "text",
327
+ "text": "4.2 RESULTS ",
328
+ "text_level": 1,
329
+ "page_idx": 6
330
+ },
331
+ {
332
+ "type": "text",
333
+ "text": "Quantitative and qualitative comparisons. We compare Magic123 against the state-of-the-art PointE (Nichol et al., 2022), Shap-E (Jun & Nichol, 2023), 3DFuse (Seo et al., 2023), NeuralLift (Xu et al., 2023), RealFusion (Melas-Kyriazi et al., 2023) and Zero-1-to-3 (Liu et al., 2023) in both NeRF4 and RealFusion15 datasets. For Zero-1-to-3, we adopt the implementation from (Tang, 2022), which yields better performance than the original implementation. For other works, we use their officially released code. All baselines and Magic123 are run with their default settings. As shown in Table 1, Magic123 achieves Top-1 performance across all the metrics in both datasets when compared to previous approaches. It is worth noting that the PSNR and LPIPS results demonstrate significant improvements over the baselines, highlighting the exceptional reconstruction performance of Magic123. The improvement of CLIP-Similarity reflects the great 3D coherence regards to the reference view. Qualitative comparisons are available in Fig. 5. Magic123 achieves the best results in terms of both geometry and texture. Note how Magic123 greatly outperforms the 3D-based zero-1-to3 (Liu et al., 2023) especially in complex objects like the dragon statue and the colorful teapot in the first two rows, while at the same time greatly outperforming 2D-based RealFusion (Melas-Kyriazi et al., 2023) in all examples. This performance demonstrates the superiority of Magic123 over the state-of-the-art and its ability to generate high-quality 3D content. ",
334
+ "page_idx": 6
335
+ },
336
+ {
337
+ "type": "table",
338
+ "img_path": "images/36af73b46220d91e777400d8a9bb18f3eb7afe65a0d0a6383a9d9527f22eac9e.jpg",
339
+ "table_caption": [
340
+ "Table 1: Magic123 results. We show quantitative results in terms of CLIP-Similarity↑ / PSNR↑ / LPIPS↓. The results are shown on the NeRF4 and Realfusion15 datasets, while bold reflects the best. "
341
+ ],
342
+ "table_footnote": [],
343
+ "table_body": "<table><tr><td>Dataset</td><td>Metrics\\Methods</td><td>Point-E</td><td>Shap-E</td><td>3DFuse</td><td>NeuralLift</td><td>RealFusion</td><td>Zero-1-to-3</td><td>Magic123 (Ours)</td></tr><tr><td rowspan=\"4\">NeRF4</td><td>CLIP-Similarity↑</td><td>0.48</td><td>0.60</td><td>0.60</td><td>0.52</td><td>0.38</td><td>0.62</td><td>0.80</td></tr><tr><td>PSNR↑</td><td>0.70</td><td>0.99</td><td>11.64</td><td>12.55</td><td>15.37</td><td>23.96</td><td>24.62</td></tr><tr><td>LPIPS↓</td><td>0.80</td><td>0.76</td><td>0.29</td><td>0.40</td><td>0.20</td><td>0.05</td><td>0.03</td></tr><tr><td>CLIP-Similarity↑</td><td>0.53</td><td>0.59</td><td>0.67</td><td>0.65</td><td>0.67</td><td>0.75</td><td>0.82</td></tr><tr><td rowspan=\"3\">RealFusion15</td><td>PSNR↑</td><td>0.98</td><td>1.23</td><td>10.32</td><td>11.08</td><td>18.87</td><td>19.49</td><td>19.50</td></tr><tr><td>LPIPS↓</td><td>0.78</td><td>0.74</td><td>0.38</td><td>0.39</td><td>0.14</td><td>0.11</td><td>0.10</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>",
344
+ "page_idx": 7
345
+ },
346
+ {
347
+ "type": "text",
348
+ "text": "",
349
+ "page_idx": 7
350
+ },
351
+ {
352
+ "type": "text",
353
+ "text": "4.3 ABLATION AND ANALYSIS ",
354
+ "text_level": 1,
355
+ "page_idx": 7
356
+ },
357
+ {
358
+ "type": "text",
359
+ "text": "Magic123 introduces a coarse-to-fine pipeline for single image reconstruction and a joint 2D and 3D prior for novel view guidance. We provide analysis and ablation studies to show their effectiveness. ",
360
+ "page_idx": 7
361
+ },
362
+ {
363
+ "type": "text",
364
+ "text": "The effect of the coarse-to-fine pipeline is shown in Fig. 6. A consistent improvement in quantitative performance is observed throughout different setups when the fine stage is used. The use of a textured mesh DMTet representation enables higher quality 3D content that fits the objective and produces more compelling and higher resolution 3D visuals. Qualitative ablation for the coarse-to-fine pipeline is available in $\\ S { \\bf C } . 2$ . ",
365
+ "page_idx": 7
366
+ },
367
+ {
368
+ "type": "text",
369
+ "text": "Combining both 2D and 3D priors and the trade-off factor $\\lambda _ { 2 D }$ . Fig. 6 demonstrates the effectiveness of the joint 2D and 3D prior quantitatively. In Fig. 7, we further ablate the joint prior qualitatively and analyze the effectiveness of the trade-off hyperparameter $\\lambda _ { 2 D }$ in Eqn 7. We start from $\\lambda _ { 2 D } { = } 0$ to use only the 3D prior and gradually increase $\\lambda _ { 2 D }$ to $0 . 1 , 0 . 5 , 1 . 0 , 2 , 5$ , and finally to use only the 2D prior with $\\lambda _ { 2 D } { = } 1$ and $\\lambda _ { 3 D } { = } 0$ (we also denote this case as $\\lambda _ { 2 D } { = } { \\infty }$ for coherence). The key observations include: (1) Relying on a sole 3D prior results in consistent geometry (e.g. teddy bear) but falters in generating complex and uncommon objects, often rendering oversimplified geometry with minimal details (e.g. dragon statue); (2) Relying on a sole 2D prior significantly improves performance in conjuring complex scenes like the dragon statue but simultaneously triggers 3D inconsistencies such as the Janus problem in the bear; (3) As $\\lambda _ { 2 D }$ escalates, the imaginative prowess of Magic123 is enhanced and more details become evident, but there is a tendency to compromise 3D consistency. We assign $\\lambda _ { 2 D } { = } 1$ as the default value for all examples. $\\lambda _ { 2 D }$ could also be fine-tuned for even better results on certain inputs. ",
370
+ "page_idx": 7
371
+ },
372
+ {
373
+ "type": "image",
374
+ "img_path": "images/87b5297e2a9c76d6fc9be5d60453c451318ee03484a412be723775336127774f.jpg",
375
+ "image_caption": [
376
+ "Figure 6: Ablation study (quantitative). We quantitatively compare using the coarse and fine stages in Magic123. In both setups, we ablate utilizing only 2D prior $( \\lambda _ { 2 D } = 1 , \\lambda _ { 3 D } = 0 )$ ), utilizing only 3D prior $( \\lambda _ { 2 D } = 0 , \\lambda _ { 3 D } = 4 0 )$ ), and utilizing a joint 2D and 3D prior $( \\lambda _ { 2 D } = 1 , \\lambda _ { 3 D } = 4 0 )$ ). "
377
+ ],
378
+ "image_footnote": [],
379
+ "page_idx": 7
380
+ },
381
+ {
382
+ "type": "image",
383
+ "img_path": "images/0e20956e1d0e24fde0a5fcf2c50b3100bcbef22f43b5ed49edbbb3e7edfdd5ae.jpg",
384
+ "image_caption": [
385
+ "Figure 7: Setting $\\lambda _ { 2 D }$ . We study the effects of $\\lambda _ { 2 D }$ on Magic123. Increasing $\\lambda _ { 2 D }$ leads to a 3D geometry with higher imagination and more details but less 3D consistencies and vice versa. $\\lambda _ { 2 D } { = } 1$ provides a good balance and thus is used as default throughout all experiments. "
386
+ ],
387
+ "image_footnote": [],
388
+ "page_idx": 8
389
+ },
390
+ {
391
+ "type": "text",
392
+ "text": "",
393
+ "page_idx": 8
394
+ },
395
+ {
396
+ "type": "text",
397
+ "text": "5 CONCLUSION AND DISCUSSION ",
398
+ "text_level": 1,
399
+ "page_idx": 8
400
+ },
401
+ {
402
+ "type": "text",
403
+ "text": "This work presents Magic123, a coarse-to-fine solution for generating high-quality, textured 3D meshes from a single image. By leveraging a joint 2D and 3D prior, Magic123 achieves a performance that is not reachable in a sole 2D or 3D prior-based solution and sets the new state of the art in image-to-3D generation. A trade-off parameter between the 2D and 3D priors allows for control over the generalizability and the 3D consistency. Magic123 outperforms previous techniques in terms of both realism and level of detail, as demonstrated through extensive experiments on real-world images and synthetic benchmarks. Our findings contribute to narrowing the gap between human abilities in 3D reasoning and those of machines, and pave the way for future advancements in single-image 3D reconstruction. The availability of our code, models, and generated 3D assets will further facilitate research and applications in this field. ",
404
+ "page_idx": 8
405
+ },
406
+ {
407
+ "type": "text",
408
+ "text": "Limitation. One limitation is that Magic123 might suffer from inconsistent texture and inaccurate geometry due to incomplete information from a single image. Specially, a clear inconsitency appers in the boundary mostly because of blended foreground and background along the boundary segmentation errors. A texture consistency loss might be helpful. Similar to previous work, Magic123 also tends to generate over-saturated textures due to the usage of the SDS loss. The over-saturation issue becomes more severe for the second stage because of the higher resolution. See examples in Fig. 5 for these failure cases: the incomplete foot of the bear, the inconsistent texture between the front (pink color) and back views (less pink) of the donuts, the round shape of the drums, and the oversaturated color of the hoarse and the chair. Similar to other per-prompt optimization methods, Magic123 also takes around 1 hour to get a 3D model and with limited diversity. This time can be reduced through (1) replacing to Gaussian Splatting in stage 1 as shown in (Tang et al., 2023a), and (2) sampling from a small range of time steps in stage 2, following the suggestions of ICLR reviewers. The diversity issue might be possible to alleviate through VDS (Wang et al., 2023b) or training with prior guidance plus diverse 3D data. ",
409
+ "page_idx": 8
410
+ },
411
+ {
412
+ "type": "text",
413
+ "text": "Acknowledgement. The authors would like to thank Xiaoyu Xiang for the insightful discussion and Dai-Jie Wu for sharing Point-E and Shap-E results. This work was supported by the KAUST Office of Sponsored Research through the Visual Computing Center funding, as well as, the SDAIA-KAUST Center of Excellence in Data Science and Artificial Intelligence (SDAIA-KAUST AI). Part of the support is also coming from KAUST Ibn Rushd Postdoc Fellowship program. ",
414
+ "page_idx": 8
415
+ },
416
+ {
417
+ "type": "text",
418
+ "text": "REFERENCES \nJonathan T Barron, Ben Mildenhall, Matthew Tancik, Peter Hedman, Ricardo Martin-Brualla, and Pratul P Srinivasan. Mip-nerf: A multiscale representation for anti-aliasing neural radiance fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5855–5864, 2021. \nJonathan T Barron, Ben Mildenhall, Dor Verbin, Pratul P Srinivasan, and Peter Hedman. Mip-nerf 360: Unbounded anti-aliased neural radiance fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5470–5479, 2022. \nVolker Blanz and Thomas Vetter. Face recognition based on fitting a 3d morphable model. IEEE transactions on pattern analysis and machine intelligence (T-PAMI), 25(9):1063–1074, 2003. \nJames Booth, Anastasios Roussos, Stefanos Zafeiriou, Allan Ponniah, and David Dunaway. A 3d morphable model learnt from 10,000 faces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5543–5552, 2016. \nShengqu Cai, Anton Obukhov, Dengxin Dai, and Luc Van Gool. Pix2nerf: Unsupervised conditional p-gan for single image to neural radiance fields translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3981–3990, June 2022. \nEric 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 Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 16123–16133, 2022. \nDave Zhenyu Chen, Yawar Siddiqui, Hsin-Ying Lee, Sergey Tulyakov, and Matthias Nießner. Text2tex: Text-driven texture synthesis via diffusion models. arXiv preprint arXiv:2303.11396, 2023a. \nRui Chen, Yongwei Chen, Ningxin Jiao, and Kui Jia. Fantasia3d: Disentangling geometry and appearance for high-quality text-to-3d content creation. arXiv preprint arXiv:2303.13873, 2023b. \nYen-Chi Cheng, Hsin-Ying Lee, Sergey Tulyakov, Alexander G Schwing, and Liang-Yan Gui. Sdfusion: Multimodal 3d shape completion, reconstruction, and generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. \nMatt Deitke, Ruoshi Liu, Matthew Wallingford, Huong Ngo, Oscar Michel, Aditya Kusupati, Alan Fan, Christian Laforte, Vikram Voleti, Samir Yitzhak Gadre, Eli VanderBilt, Aniruddha Kembhavi, Carl Vondrick, Georgia Gkioxari, Kiana Ehsani, Ludwig Schmidt, and Ali Farhadi. Objaverse-xl: A universe of $1 0 \\mathrm { m } + 3 \\mathrm { d }$ objects. arXiv preprint arXiv:2307.05663, 2023a. \nMatt 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 Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 13142–13153, 2023b. \nYilun Du, Cameron Smith, Ayush Tewari, and Vincent Sitzmann. Learning to render novel views from wide-baseline stereo pairs. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. \nShivam Duggal and Deepak Pathak. Topologically-aware deformation fields for single-view 3d reconstruction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1536–1546, 2022. \nRinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H. Bermano, Gal Chechik, and Daniel Cohen-Or. An image is worth one word: Personalizing text-to-image generation using textual inversion. In International Conference on Learning Representations (ICLR), 2023. \nLukas Höllein, Ang Cao, Andrew Owens, Justin Johnson, and Matthias Nießner. Text2room: Extracting textured 3d meshes from 2d text-to-image models. arXiv preprint arXiv:2303.11989, 2023. ",
419
+ "page_idx": 9
420
+ },
421
+ {
422
+ "type": "text",
423
+ "text": "Fangzhou Hong, Mingyuan Zhang, Liang Pan, Zhongang Cai, Lei Yang, and Ziwei Liu. Avatarclip: Zero-shot text-driven generation and animation of 3d avatars. arXiv preprint arXiv:2205.08535, 2022. ",
424
+ "page_idx": 10
425
+ },
426
+ {
427
+ "type": "text",
428
+ "text": "Ajay Jain, Matthew Tancik, and Pieter Abbeel. Putting nerf on a diet: Semantically consistent few-shot view synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5885–5894, 2021. \nAjay Jain, Ben Mildenhall, Jonathan T Barron, Pieter Abbeel, and Ben Poole. Zero-shot text-guided object generation with dream fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 867–876, 2022. \nHeewoo Jun and Alex Nichol. Shap-e: Generating conditional 3d implicit functions. arXiv preprint arXiv:2305.02463, 2023. \nAngjoo Kanazawa, Shubham Tulsiani, Alexei A Efros, and Jitendra Malik. Learning categoryspecific mesh reconstruction from image collections. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 371–386, 2018. \nAbhishek Kar, Shubham Tulsiani, Joao Carreira, and Jitendra Malik. Category-specific object reconstruction from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1966–1974, 2015. \nIra Kemelmacher-Shlizerman. Internet based morphable model. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3256–3263, 2013. \nMijeong Kim, Seonguk Seo, and Bohyung Han. Infonerf: Ray entropy minimization for few-shot neural volume rendering. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 12912–12921, 2022. \nJunnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pretraining for unified vision-language understanding and generation. In International Conference on Machine Learning, pp. 12888–12900. PMLR, 2022. \nJunnan Li, Dongxu Li, Silvio Savarese, and Steven C. H. Hoi. BLIP-2: bootstrapping language-image pre-training with frozen image encoders and large language models. In ICML, volume 202 of Proceedings of Machine Learning Research, pp. 19730–19742. PMLR, 2023. \nChen-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 Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. \nRuoshi 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, 2023. \nStephen Lombardi, Tomas Simon, Jason Saragih, Gabriel Schwartz, Andreas Lehrmann, and Yaser Sheikh. Neural volumes: Learning dynamic renderable volumes from images. arXiv preprint arXiv:1906.07751, 2019. \nMatthew Loper, Naureen Mahmood, Javier Romero, Gerard Pons-Moll, and Michael J Black. Smpl: A skinned multi-person linear model. ACM Transactions on Graphics (TOG), 34(6):1–16, 2015. \nJulieta Martinez, Rayat Hossain, Javier Romero, and James J Little. A simple yet effective baseline for 3d human pose estimation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2640–2649, 2017. \nLuke Melas-Kyriazi, Christian Rupprecht, Iro Laina, and Andrea Vedaldi. Realfusion: $3 6 0 \\{ \\backslash \\mathrm { d e g } \\}$ reconstruction of any object from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. \nGal Metzer, Elad Richardson, Or Patashnik, Raja Giryes, and Daniel Cohen-Or. Latent-nerf for shape-guided generation of 3d shapes and textures. arXiv preprint arXiv:2211.07600, 2022. ",
429
+ "page_idx": 10
430
+ },
431
+ {
432
+ "type": "text",
433
+ "text": "Oscar Michel, Roi Bar-On, Richard Liu, Sagie Benaim, and Rana Hanocka. Text2mesh: Text-driven neural stylization for meshes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022. ",
434
+ "page_idx": 11
435
+ },
436
+ {
437
+ "type": "text",
438
+ "text": "Aryan Mikaeili, Or Perel, Daniel Cohen-Or, and Ali Mahdavi-Amiri. Sked: Sketch-guided text-based 3d editing. arXiv preprint arXiv:2303.10735, 2023. \nBen 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 Proceedings of the European Conference on Computer Vision (ECCV), pp. 405–421. Springer, 2020. \nNasir Mohammad Khalid, Tianhao Xie, Eugene Belilovsky, and Tiberiu Popa. Clip-mesh: Generating textured meshes from text using pretrained image-text models. In SIGGRAPH Asia 2022 Conference Papers, pp. 1–8, 2022. \nThomas Müller, Alex Evans, Christoph Schied, and Alexander Keller. Instant neural graphics primitives with a multiresolution hash encoding. In ACM Transactions on Graphics (SIGGRAPH), 2022. \nAlex 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. \nOr Patashnik, Zongze Wu, Eli Shechtman, Daniel Cohen-Or, and Dani Lischinski. Styleclip: Textdriven manipulation of stylegan imagery. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2085–2094, 2021. \nGeorgios Pavlakos, Vasileios Choutas, Nima Ghorbani, Timo Bolkart, Ahmed AA Osman, Dimitrios Tzionas, and Michael J Black. Expressive body capture: 3d hands, face, and body from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10975–10985, 2019. \nBen Poole, Ajay Jain, Jonathan T Barron, and Ben Mildenhall. Dreamfusion: Text-to-3d using 2d diffusion. International Conference on Learning Representations (ICLR), 2022. \nAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In Proceedings of the International Conference on Machine Learning (ICML), pp. 8748–8763. PMLR, 2021. \nAmit Raj, Srinivas Kaza, Ben Poole, Michael Niemeyer, Nataniel Ruiz, Ben Mildenhall, Shiran Zada, Kfir Aberman, Michael Rubinstein, Jonathan Barron, et al. Dreambooth3d: Subject-driven text-to-3d generation. arXiv preprint arXiv:2303.13508, 2023. \nAditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In Proceedings of the International Conference on Machine Learning (ICML), pp. 8821–8831. PMLR, 2021. \nRené Ranftl, Katrin Lasinger, David Hafner, Konrad Schindler, and Vladlen Koltun. Towards robust monocular depth estimation: Mixing datasets for zero-shot cross-dataset transfer. IEEE transactions on pattern analysis and machine intelligence (T-PAMI), 44(3):1623–1637, 2020. \nRené Ranftl, Alexey Bochkovskiy, and Vladlen Koltun. Vision transformers for dense prediction. Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 12159– 12168, 2021. \nElad Richardson, Gal Metzer, Yuval Alaluf, Raja Giryes, and Daniel Cohen-Or. Texture: Text-guided texturing of 3d shapes. arXiv preprint arXiv:2302.01721, 2023. \nRobin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. Highresolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10684–10695, 2022. \nChitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. Advances in Neural Information Processing Systems (NeurIPS), 35:36479–36494, 2022. \nChristoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-400m: Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint arXiv:2111.02114, 2021. \nJunyoung Seo, Wooseok Jang, Min-Seop Kwak, Jaehoon Ko, Hyeonsu Kim, Junho Kim, Jin-Hwa Kim, Jiyoung Lee, and Seungryong Kim. Let 2d diffusion model know 3d-consistency for robust text-to-3d generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. \nTianchang Shen, Jun Gao, Kangxue Yin, Ming-Yu Liu, and Sanja Fidler. Deep marching tetrahedra: a hybrid representation for high-resolution 3d shape synthesis. In Advances in Neural Information Processing Systems (NeurIPS), volume 34, pp. 6087–6101, 2021. \nAliaksandr Siarohin, Willi Menapace, Ivan Skorokhodov, Kyle Olszewski, Hsin-Ying Lee, Jian Ren, Menglei Chai, and Sergey Tulyakov. Unsupervised volumetric animation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. \nJascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In Proceedings of the International Conference on Machine Learning (ICML), pp. 2256–2265. PMLR, 2015. \nJingxiang Sun, Xuan Wang, Yichun Shi, Lizhen Wang, Jue Wang, and Yebin Liu. Ide-3d: Interactive disentangled editing for high-resolution 3d-aware portrait synthesis. ACM Transactions on Graphics (TOG), 41(6):1–10, 2022. doi: 10.1145/3550454.3555506. \nAndrea Tagliasacchi and Ben Mildenhall. Volume rendering digest (for nerf). arXiv preprint arXiv:2209.02417, 2022. \nJiaxiang Tang. Stable-dreamfusion: Text-to-3d with stable-diffusion, 2022. https://github.com/ashawkey/stable-dreamfusion. \nJiaxiang Tang, Jiawei Ren, Hang Zhou, Ziwei Liu, and Gang Zeng. Dreamgaussian: Generative gaussian splatting for efficient 3d content creation. arXiv preprint arXiv:2309.16653, 2023a. \nJunshu Tang, Tengfei Wang, Bo Zhang, Ting Zhang, Ran Yi, Lizhuang Ma, and Dong Chen. Make-it-3d: High-fidelity 3d creation from a single image with diffusion prior. arXiv preprint arXiv:2303.14184, 2023b. \nHaochen Wang, Xiaodan Du, Jiahao Li, Raymond A Yeh, and Greg Shakhnarovich. Score jacobian chaining: Lifting pretrained 2d diffusion models for 3d generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023a. \nNanyang Wang, Yinda Zhang, Zhuwen Li, Yanwei Fu, Wei Liu, and Yu-Gang Jiang. Pixel2mesh: Generating 3d mesh models from single rgb images. In Proceedings of the European conference on computer vision (ECCV), pp. 52–67, 2018. \nZhengyi 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, 2023b. \nDaniel Watson, William Chan, Ricardo Martin-Brualla, Jonathan Ho, Andrea Tagliasacchi, and Mohammad Norouzi. Novel view synthesis with diffusion models. In International Conference on Learning Representations (ICLR), 2023. \nShangzhe Wu, Christian Rupprecht, and Andrea Vedaldi. Unsupervised learning of probably symmetric deformable 3d objects from images in the wild. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020. \nDejia Xu, Yifan Jiang, Peihao Wang, Zhiwen Fan, Yi Wang, and Zhangyang Wang. Neurallift-360: Lifting an in-the-wild 2d photo to a 3d object with $3 6 0 \\{ \\backslash \\mathrm { d e g } \\}$ views. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. \nJiale Xu, Xintao Wang, Weihao Cheng, Yan-Pei Cao, Ying Shan, Xiaohu Qie, and Shenghua Gao. Dream3d: Zero-shot text-to-3d synthesis using 3d shape prior and text-to-image diffusion models. arXiv preprint arXiv:2212.14704, 2022. \nAlex Yu, Vickie Ye, Matthew Tancik, and Angjoo Kanazawa. pixelnerf: Neural radiance fields from one or few images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4578–4587, 2021. \nLvmin Zhang, Anyi Rao, and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models, 2023. \nRichard 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/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2018. ",
439
+ "page_idx": 11
440
+ },
441
+ {
442
+ "type": "text",
443
+ "text": "",
444
+ "page_idx": 12
445
+ },
446
+ {
447
+ "type": "text",
448
+ "text": "",
449
+ "page_idx": 13
450
+ },
451
+ {
452
+ "type": "text",
453
+ "text": "A IMPLEMENTATION DETAILS ",
454
+ "text_level": 1,
455
+ "page_idx": 14
456
+ },
457
+ {
458
+ "type": "text",
459
+ "text": "We use exactly the same set of hyperparameters for all experiments and do not perform any per-object hyperparameter optimization. Both coarse and fine stages are optimized using Adam with 0.001 learning rate and no weight decay for 5, 000 iterations. $\\lambda _ { r g b } , \\lambda _ { m a s k }$ are set to 5, 0.5 for both stages. $\\lambda _ { 2 D }$ and $\\lambda _ { 3 D }$ are set to 1 and 40 for the first stage and are lowered to 0.001 and 0.01 in the second stage for refinement to alleviate oversaturated textures. We adopt the Stable Diffusion (Sohl-Dickstein et al., 2015) model of V1.5 as the 2D prior. The guidance scale of the 2D prior is set to 100 following (Poole et al., 2022). For the 3D prior, Zero-1-to-3 (Liu et al., 2023) (105, 000 iterations finetuned version) is leveraged. The guidance scale of Zero-1-to-3 is set to 5 following (Liu et al., 2023). The NeRF backbone is implemented by three layers of multi-layer perceptrons with 64 hidden dims. Regarding lighting and shading, we keep nearly the same as (Poole et al., 2022). The difference is we set the first 1, 000 iterations in the first stage to normals’ shading to focus on learning geometry as inspired by (Chen et al., 2023b). For other iterations as well as the fine stage, we use diffuse shading with a probability 0.75 and textureless shading with a probability 0.25. The rendering resolutions are set to $1 2 8 \\times 1 2 8$ and $1 0 2 4 \\times 1 0 2 4$ for the coarse and the fine stage, respectively. For both stages, we use depth regularization and normal smoothness regularization with $\\lambda _ { d } = 0 . 0 0 1$ and $\\lambda _ { n } = 0 . 5$ . Following the standard practice (Barron et al., 2021; Poole et al., 2022; Melas-Kyriazi et al., 2023), we additionally add the 0.001 entropy regularization and 0.01 orientation regularization in the NeRF stage. Our implementation is based on the Stable DreamFusion repo (Tang, 2022). The training of Magic123 takes roughly 1 hour on a 32G V100 GPU, while the coarse stage and the fine stage take 40 and 20 minutes, respectively. ",
460
+ "page_idx": 14
461
+ },
462
+ {
463
+ "type": "text",
464
+ "text": "B CAMERA SETTINGS ",
465
+ "text_level": 1,
466
+ "page_idx": 14
467
+ },
468
+ {
469
+ "type": "text",
470
+ "text": "Frontal view setting. Since the reference image is unposed, our model assumes a frontal reference view ( $9 0 ^ { \\circ }$ elevation and $0 ^ { \\circ }$ azimuth) for simplicity. However, in real-world applications, these angles can be adjusted according to the input, either through intuitive estimation or camera pose detection. A simple tuning of the elevation angle can improve the benchmark performance of Magic123. For instance, in the chair example shown in Fig. II, altering the elevation angle from $9 0 °$ to $6 0 ^ { \\circ }$ addresses squeezed reconstruction of the chair. For research purposes, we propose to exclude this camera estimation as it does not impact the comparison between different methods and only requires engineering efforts in application. ",
471
+ "page_idx": 14
472
+ },
473
+ {
474
+ "type": "text",
475
+ "text": "Rendering camera setting. We set the camera parameters for the rendering as follows. The camera is placed 1.8 meters from the coordinate origin, i.e. the radial distance is 1.8. The field of view (FOV) of the camera is $4 0 ^ { \\circ }$ . We highlight that the 3D reconstruction performance is not sensitive to camera parameters, as long as they are reasonable, e.g. FOV between 20 and 60, and radial distance between 1 to 4 meters. In Fig. II, we validate that using the same camera parameters as RealFusion (Melas-Kyriazi et al., 2023) that is different from ours, i.e. camera radius [1.0, 1.5] and FOV [40, 70], achieves results without obvious differences as ours. ",
476
+ "page_idx": 14
477
+ },
478
+ {
479
+ "type": "text",
480
+ "text": "C MORE ANALYSIS AND ABLATION STUDIES ",
481
+ "text_level": 1,
482
+ "page_idx": 14
483
+ },
484
+ {
485
+ "type": "text",
486
+ "text": "C.1 ABLATION AND ANALYSIS ON THE USAGE OF 2D AND 3D PRIORS ",
487
+ "text_level": 1,
488
+ "page_idx": 14
489
+ },
490
+ {
491
+ "type": "text",
492
+ "text": "3D priors only. We first turn off the guidance of 2D prior by setting $\\lambda _ { 2 D } = 0$ , such that we only use the 3D-aware diffusion prior Zero-1-to-3 Liu et al. (2023). ",
493
+ "page_idx": 14
494
+ },
495
+ {
496
+ "type": "text",
497
+ "text": "Note that Zero-1-to-3 in our paper (results in Tab. 1, Fig. 5) denotes our improved reimplemented Zeo-1-to-3 using the same training configurations as Magic123. i.e. Zero-1-to-3 in our paper refers to the first stage results of Maigc123 3D prior only (Fig. 2, 6, 7), where both of them use second stage DMTet fine-tuning for fair comparison. ",
498
+ "page_idx": 14
499
+ },
500
+ {
501
+ "type": "text",
502
+ "text": "Furthermore, we study the effects of $\\lambda _ { 3 D }$ by performing a grid search and evaluate the image-to-3D reconstruction performance, where $\\lambda _ { 3 D } = 5 , 1 0 , 2 0 , 4 0 , 6 0 , 8 0$ . Interestingly, we find that Zero-1-to3 is very robust to the change of $\\lambda _ { 3 D }$ . Tab. I demonstrates that different $\\lambda _ { 3 D }$ leads to a consistent quantitative result. We thus simply set $\\lambda _ { 3 D } = 4 0$ throughout the experiments since it achieves a slightly better CLIP-similarity score than other values. ",
503
+ "page_idx": 14
504
+ },
505
+ {
506
+ "type": "image",
507
+ "img_path": "images/1b5883af50363dac4dc385b980e46e7604f0a76acdf0ac7e6f78759e3846cf15.jpg",
508
+ "image_caption": [
509
+ "Figure I: Ablation study (qualitative). We qualitatively compare the novel view renderings from the coarse and fine stages in Magic123. We ablate utilizing only 2D prior $( \\lambda _ { 2 D } = 1 , \\lambda _ { 3 D } = 0 )$ , only 3D prior $( \\lambda _ { 2 D } = 0 , \\lambda _ { 3 D } = 4 0 )$ , and a joint 2D and 3D prior $( \\lambda _ { 2 D } = 1 , \\lambda _ { 3 D } = 4 0 )$ ). We also ablate the effects of textual inversion at the right. "
510
+ ],
511
+ "image_footnote": [],
512
+ "page_idx": 15
513
+ },
514
+ {
515
+ "type": "text",
516
+ "text": "2D priors only. We then turn off the 3D prior and study the effect of $\\lambda _ { 2 D }$ . As shown in Tab. I, the image-to-3D system is sensitive to the weights of the 2D prior. With the increase of $\\lambda _ { 2 D }$ , a sharp increase in CLIP similarity and a drop in PSNR are observed. This is because a larger 2D prior weight leads to more imagination, which unfortunately might result in 3D inconsistency. Due to the observation that the 3D prior is more robust than the 2D prior to the weight, we use $\\lambda _ { 2 D }$ as the tradeoff parameter to control the imagination and 3D consistency. ",
517
+ "page_idx": 15
518
+ },
519
+ {
520
+ "type": "text",
521
+ "text": "C.2 ABLATION ON THE COARSE-TO-FINE PIPELINE ",
522
+ "text_level": 1,
523
+ "page_idx": 15
524
+ },
525
+ {
526
+ "type": "text",
527
+ "text": "In $\\ S 4 . 3$ we ablate the effect of the coarse-to-fine pipeline quantitatively. Here we provide the visual comparisons in Fig. I. The fine stage consistently augments the sharpness of the rendering and the geometry and texture details. See the edge of the wings and claws of the dragon and the toppings of the donuts for examples. ",
528
+ "page_idx": 15
529
+ },
530
+ {
531
+ "type": "text",
532
+ "text": "C.3 ABLATE THE REGULARIZATION ",
533
+ "text_level": 1,
534
+ "page_idx": 15
535
+ },
536
+ {
537
+ "type": "text",
538
+ "text": "Magic123 is optimized additionally by depth regularization, normal smoothness regularization, entropy regularization, and orientation regularization, with weights of 0.01, 0.5, 0.001, and 0.01, respectively. In Fig. II, we show that the depth, the entropy, and the orientation regularizations have minimal impact on the image-to-3D reconstruction performance. However, we keep them in our implementation as they are common practices in the NeRF family. The normal smoothness is more important in alleviating the high-frequency noise. ",
539
+ "page_idx": 15
540
+ },
541
+ {
542
+ "type": "text",
543
+ "text": "C.4 ABLATE THE TEXTUAL INVERSION ",
544
+ "text_level": 1,
545
+ "page_idx": 15
546
+ },
547
+ {
548
+ "type": "text",
549
+ "text": "We use textual inversion in both stages for consistent geometry and texture with the input reference image. Fig. I we additionally ablate the effects of textural inversion by removing it and using pure texts in the guidance. In the two examples, we change the prompts from “A high-resolution DSLR image of $< e > \"$ to “A high-resolution DSLR image of a metal dragon statue”, and “A high-resolution DSLR image of two donuts”, respectively. As observed, textual inversion has marginal effects on the image-to-3D reconstruction performance. However, it helps with keeping the consistency between the input image and the generated 3D content. Without textual inversion, the dragon with a different style of horns and golden textures appears that is not consistent with the input image. The donuts without textual inversion have distinct toppings from the input image. ",
550
+ "page_idx": 15
551
+ },
552
+ {
553
+ "type": "image",
554
+ "img_path": "images/075d6b565f749be3a3950f15ab8c2226185d538833b7c54c0b3951c08b3985d2.jpg",
555
+ "image_caption": [
556
+ "Figure II: Qualitative ablation study for the effects of depth regularization, normal smoothness, entropy and orientation regularization, camera parameters, and ghe front-view assumption (elevation angle). Normal smoothness reduces high-frequency noise. Other factors like depth, entropy, and orientation regularization exert minimal influence on image-to-3D reconstruction results but are maintained in Magic123, adhering to common practice. Using different camera parameters, including camera radius (1.8 meters v.s. [1.0, 1.5] in RealFusion) and field of view $4 0 ~ \\nu . s .$ [40, 70] in RealFusion), have a marginal impact on performance. Magic123 opts for a simple configuration, setting the camera radius to 1.8 meters and the FOV to 40. Setting the elevation angle from $9 0 °$ to a reasonable value also improves reconstruction quality (see the chair example). "
557
+ ],
558
+ "image_footnote": [],
559
+ "page_idx": 16
560
+ },
561
+ {
562
+ "type": "text",
563
+ "text": "D MORE COMPARASIONS ",
564
+ "text_level": 1,
565
+ "page_idx": 16
566
+ },
567
+ {
568
+ "type": "text",
569
+ "text": "Here, we additionally compare Magic123 with most recent methods RealFusion (Melas-Kyriazi et al., 2023), Zero-1-to-3 (Liu et al., 2023), and Make-It-3D (Tang et al., 2023b). Magic123 outperforms all of them in terms of both 3D geometry and texture quality by a large margin. ",
570
+ "page_idx": 16
571
+ },
572
+ {
573
+ "type": "image",
574
+ "img_path": "images/6cd9d371d95e9709425268b86fbd69bc0c1909b55bf5cc085e3578e9bc7e8a09.jpg",
575
+ "image_caption": [
576
+ "Figure III: Qualitative comparisons. We compare Magic123 to the most recent methods RealFusion (Melas-Kyriazi et al., 2023), Zero-1-to-3 (Liu et al., 2023), and Make-It-3D (Tang et al., 2023b). "
577
+ ],
578
+ "image_footnote": [],
579
+ "page_idx": 17
580
+ }
581
+ ]
parse/test/0jHkUDyEO9/0jHkUDyEO9_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/0jHkUDyEO9/0jHkUDyEO9_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/CD9Snc73AW/CD9Snc73AW.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/CD9Snc73AW/CD9Snc73AW_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/CD9Snc73AW/CD9Snc73AW_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/CD9Snc73AW/CD9Snc73AW_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/DzxaRFVsgC/DzxaRFVsgC.md ADDED
@@ -0,0 +1,435 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GPT4ROI: INSTRUCTION TUNING LARGE LANGUAGE MODEL ON REGION-OF-INTEREST
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Visual instruction tuning large language model (LLM) on image-text pairs has achieved general-purpose vision-language abilities. However, the lack of regiontext pairs limits their advancements to fine-grained multimodal understanding. In this paper, we propose spatial instruction tuning, which introduces the reference to the region-of-interest (RoI) in the instruction. Before sending to LLM, the reference is replaced by RoI features and interleaved with language embeddings as a sequence. Our model GPT4RoI, trained on 7 region-text pair datasets, brings an unprecedented interactive and conversational experience compared to previous image-level models. (1) Interaction beyond language: Users can interact with our model by both language and drawing bounding boxes to flexibly adjust the referring granularity. (2) Versatile multimodal abilities: A variety of attribute information within each RoI can be mined by GPT4RoI, e.g., color, shape, material, action, etc. Furthermore, it can reason about multiple RoIs based on common sense. On the Visual Commonsense Reasoning (VCR) dataset, GPT4RoI achieves a remarkable accuracy of $8 1 . 6 \%$ , surpassing all existing models by a significant margin (the second place is $7 5 . 6 \%$ ) and almost reaching human-level performance of $8 5 . 0 \%$ . The code, dataset, and demo can be found at https://github. com/Anonymous-Researcher1/GPT4RoI.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ ![](images/f77a61c0afea6a1c8aa1aa5bfbef4526c4e81f18d426138b214c66f0dbff3aba.jpg)
12
+ Figure 1: Comparison of visual instruction tuning on image-text pairs and spatial instruction tuning on region-text pairs. The bounding box and text description of each object are provided in region-text datasets. During training, the bounding box is from annotations, and in inference, it can be provided by user or any off-the-shelf object detector
13
+
14
+ Recent advancements of large language models (LLM) have shown incredible performance in solving natural language processing tasks in a human-like conversational manner, for example, commercial products (OpenAI, 2022; Anthropic, 2023; Google, 2023; OpenAI, 2023) and community opensource projects (Touvron et al., 2023a;b; Taori et al., 2023; Chiang et al., 2023; Du et al., 2022; Sun & Xipeng, 2022). Their unprecedented capabilities present a promising path toward general-purpose artificial intelligence models. Witnessing the power of LLM, the field of multimodal models (Yang et al., 2023c; Huang et al., 2023; Girdhar et al., 2023; Driess et al., 2023) is developing a new technology direction to leverage LLM as the universal interface to build general-purpose models, where the feature space of a specific task is tuned to be aligned with the feature space of pre-trained language models.
15
+
16
+ Table 1: Comparisons of vision-language models. Our GPT4RoI is an end-to-end model that supports region-level understanding and multi-round conversation.
17
+
18
+ <table><tr><td>Model</td><td></td><td> Image Region Multi-Region</td><td></td><td>Muilirgund En-o-End</td><td></td></tr><tr><td>Visual ChatGPT (Wu et al., 2023)</td><td>√</td><td></td><td>xxxx//xxx</td><td></td><td></td></tr><tr><td>MiniGPT-4 (Zhu et al., 2023)</td><td>√</td><td></td><td></td><td></td><td></td></tr><tr><td>LLaVA (Liu et al., 2023a)</td><td></td><td>xxx~</td><td></td><td></td><td></td></tr><tr><td>InstructBLIP (Dai et al., 2023)</td><td></td><td></td><td></td><td></td><td>ννν</td></tr><tr><td>MM-REACT (Yang et al., 2023c)</td><td></td><td>xν</td><td></td><td></td><td></td></tr><tr><td>InternGPT (Liu et al., 2023d)</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>VisionLLM (Wang et al., 2023b)</td><td></td><td>?</td><td></td><td></td><td></td></tr><tr><td>CaptionAnything (Wang et al., 2023a)</td><td></td><td>X</td><td></td><td>X</td><td></td></tr><tr><td>DetGPT (Pi et al., 2023)</td><td></td><td></td><td></td><td></td><td>xx/xx</td></tr><tr><td>GPT4RoI</td><td>√</td><td></td><td>√</td><td></td><td>√</td></tr></table>
19
+
20
+ As one of the representative tasks, vision-and-language models align the vision encoder feature to LLM by instruction tuning on image-text pairs, such as MiniGPT-4 (Zhu et al., 2023), LLaVA (Liu et al., 2023a), InstructBLIP (Dai et al., 2023), etc. Although these works achieve amazing multimodal abilities, their alignments are only on image-text pairs (Chen et al., 2015; Sharma et al., 2018; Changpinyo et al., 2021; Ordonez et al., 2011; Schuhmann et al., 2021), the lack of region-level alignment limits their advancements to more fine-grained understanding tasks such as region caption (Krishna et al., 2017) and reasoning (Zellers et al., 2019a). To enable region-level understanding in vision-language models, some works attempt to leverage external vision models, for example, MMREACT (Yang et al., 2023c), InternGPT (Liu et al., 2023d) and DetGPT (Pi et al., 2023), as shown in Table 1. However, their non-end-to-end architecture is a sub-optimal choice for general-purpose multi-modal models.
21
+
22
+ Considering the limitations of previous works, our objective is to construct an end-to-end visionlanguage model that supports fine-grained understanding on region-of-interest. Since there is no operation that can refer to specific regions in current image-level vision-language models (Zhu et al., 2023; Liu et al., 2023a; Zhang et al., 2023c; Dai et al., 2023), our key design is to incorporate references to bounding boxes into language instructions, thereby upgrading them to the format of spatial instructions. For example, as shown in Figure 1, when the question is “what is <region1 $>$ doing?”, where the <region $^ { \prime } >$ refers to a specific region-of-interest, the model will substitute the embedding of <region1 $^ { \prime } >$ with the region feature extracted by the corresponding bounding box. The region feature extractor can be flexibly implemented by RoIAlign (He et al., 2017) or Deformable attention (Zhu et al., 2020).
23
+
24
+ To establish fine-grained alignment between vision and language, we involve region-text datasets in our training, where the bounding box and the text description of each region are provided. The datasets are consolidated from publicly available ones including COCO object detection (Lin et al., 2014), RefCOCO (Yu et al., 2016), RefCOCO $^ +$ (Yu et al., 2016), RefCOCOg (Mao et al., 2016), Flickr30K entities (Plummer et al., 2015), Visual Genome(VG) (Krishna et al., 2017) and Visual Commonsense Reasoning(VCR) (Zellers et al., 2019a). These datasets are transformed into spatial instruction tuning format. Moreover, we incorporate the LLaVA150K dataset (Liu et al., 2023a) into our training process by utilizing an off-the-shelf detector to generate bounding boxes. This enhances our model’s ability to engage in multi-round conversations and generate more human-like responses.
25
+
26
+ The collected datasets are categorized into two types based on the complexity of the text. First, the plain-text data contains object category and simple attribute information. It is used for pre-training the region feature extractor without impacting the LLM. Second, the complex-text data often contains complex concepts or requires common sense reasoning. We conduct end-to-end fine-tuning of the region feature extractor and LLM for these data.
27
+
28
+ Benefiting from spatial instruction tuning, our model brings a new interactive experience, where the user can express the question to the model with language and the reference to the region-of-interest. This leads to new capacities beyond image-level understanding, such as region caption and complex region reasoning. As a generalist, our model GPT4RoI also shows its strong region understanding ability on three popular benchmarks, including the region caption task on Visual Genome (Krishna et al., 2017), the region reasoning task on Visual-7W (Zhu et al., 2016) and Visual Commonsense Reasoning (Zellers et al., 2019a) (VCR). Especially noteworthy is the performance on the most challenging VCR dataset, where GPT4RoI achieves an impressive accuracy of $8 1 . 6 \%$ , 6 points ahead of the second-place and nearing the human-level performance benchmarked at $8 5 . 0 \%$ .
29
+
30
+ In summary, our work makes the following contributions:
31
+
32
+ • We introduce spatial instruction, combining language and the reference to region-of-interest into an interleave sequence, enabling accurate region referring and enhancing user interaction. • By spatial instruction tuning LLM with massive region-text datasets, our model can follow user instructions to solve diverse region understanding tasks, such as region caption and reasoning. • Our method, as a generalist, outperforms the previous state-of-the-art approach on a wide range of region understanding benchmarks.
33
+
34
+ # 2 RELATED WORK
35
+
36
+ # 2.1 LARGE LANGUAGE MODEL
37
+
38
+ The field of natural language processing (NLP) has achieved significant development by the highcapability large language model (LLM). The potential of LLM is first demonstrated by pioneering works such as BERT (Devlin et al., 2018) and GPT (Radford et al., 2018). Then scaling up progress is started and leads to a series of excellent works, for example, T5 (Raffel et al., 2020), GPT-3 (Brown et al., 2020), Flan-T5 (Chung et al., 2022), PaLM (Chowdhery et al., 2022), etc. With the growth of training data and model parameters, this scaling up progress brings to a phenomenal product, ChatGPT (OpenAI, 2022). By generative pre-trained LLM and instruction tuning (Ouyang et al., 2022) on human feedback, ChatGPT shows unprecedented performance on conversations with humans, reasoning and planning tasks (Mu et al., 2023; Yang et al., 2023a; Bubeck et al., 2023), etc.
39
+
40
+ # 2.2 LARGE VISION-LANGUAGE MODEL
41
+
42
+ To utilize high-performance LLM to build up vision-language models, LLM as task coordinator is proposed. Given the user instruction, LLM parses the instruction and calls various external vision models. Some representative works are Visual ChatGPT (Wu et al., 2023), ViperGPT (Surís et al., 2023), MM-REACT (Yang et al., 2023c), InternGPT (Liu et al., 2023d), VideoChat (Li et al., 2023b), etc. Although these models largely expand the scope of multimodal models, they depend on external vision models and these non-end-to-end architectures are not the optimal choice for multi-modal models. To obtain end-to-end vision-language models, instruction tuning LLM on image-text pairs is proposed to align visual features with LLM and accomplish multimodal tasks in a unified way, for example, Flamingo (Alayrac et al., 2022), MiniGPT-4 (Zhu et al., 2023), LLaVA (Liu et al., 2023a), LLaMa-Adapter (Zhang et al., 2023c), InstructBLIP (Dai et al., 2023), MM-GPT (Gong et al., 2023), VPGTrans (Zhang et al., 2023a), etc. These models achieve amazing image-level multimodal abilities, while several benchmarks such as LVLM-eHub (Xu et al., 2023) and MMBench (Liu et al., 2023c) find that these models still have performance bottlenecks when need to be under specific region reference. Our GPT4RoI follows the research line of visual instruction tuning and moves forward region-level multimodal understanding tasks such as region caption (Krishna et al., 2017) and reasoning (Zellers et al., 2019a).
43
+
44
+ # 2.3 REGION-LEVEL IMAGE UNDERSTANDING
45
+
46
+ For region-level understanding, it is a common practice in computer vision to identify potential regions of interest first and then do the understanding. Object detection (Ren et al., 2015; Carion et al., 2020; Zhu et al., 2020; Zang et al., 2023) tackles the search for potential regions, which are generally accompanied by a simple classification task to understand the region’s content. To expand the object categories, (Kamath et al., 2021; Liu et al., 2023b; Zhou et al., 2022; $\mathrm { L i ^ { * } }$ et al., 2022) learn from natural language and achieve amazing open-vocabulary object recognition performance. Region captioning (Johnson et al., 2015; Yang et al., 2017; Wu et al., 2022) provides more descriptive language descriptions in a generative way. Scene graph generation (Li et al., 2017; Tang et al., 2018; Yang et al., 2022) analyzes the relationships between regions by the graph. The VCR (Zellers et al., 2019b) dataset presents many region-level reasoning cases and (Yu et al., 2021; Su et al., 2019; Li et al., 2019b; Yao et al., 2022) exhibit decent performance by correctly selecting the answers in the multiple-choice format. However, a general-purpose region understanding model has yet to emerge. In this paper, by harnessing the powerful large language model (Touvron et al., 2023a; Chiang et al., 2023), GPT4RoI uses a generative approach to handle all these tasks. Users can complete various region-level understanding tasks by freely asking questions.
47
+
48
+ # 2.4 USING TEXTUAL COORDINATES AS THE GROUNDING TOKEN.
49
+
50
+ We compare the design philosophy with methods using textual coordinates as the grounding token and provide a brief overview of concurrent works, all of which can be found in the appendix.
51
+
52
+ # 3 METHOD: GPT4ROI
53
+
54
+ ![](images/08cae54434d512a57d1aa6610e590cf70b4e320666ddbb257ba560330b3ddacf.jpg)
55
+ Figure 2: GPT4RoI is an end-to-end vision-language model for processing spatial instructions that contain references to the region-of-interest, such as <region $\{ i \} >$ . During tokenization and conversion to embeddings, the embedding of ${ < r e g i o n \mathord { \left/ { \vphantom { < r e g i o n \left/ { i } \right.} \kern - delimiterspace } \right.} \kern - delimiterspace } >$ in the instruction is replaced with the RoIAlign results from multi-level image features. Subsequently, such an interleaved region feature and language embedding sequence can be sent to a large language model (LLM) for further processing. We also utilize the entire image feature to capture global information and omit it in the figure for brevity. A more detailed framework figure can be found in Figure 5 in the Appendix.
56
+
57
+ The overall framework of GPT4RoI consists of a vision encoder, a projector for image-level features, a region feature extractor, and a large language model (LLM). Compared to previous works (Zhu et al., 2023; Liu et al., 2023a), GPT4RoI stands out for its ability to convert instructions that include spatial positions into an interleaved sequence of region features and text embeddings, as shown in Figure 2.
58
+
59
+ # 3.1 MODEL ARCHITECTURE
60
+
61
+ We adopt the ViT-L/14 architecture from CLIP (Radford et al., 2021) as the vision encoder. Following (Liu et al., 2023a), we use the feature map of the penultimate transformer layer as the representation of the entire image, and then map the image feature embedding to the language space using a single linear layer as projector. Finally, we employ the Vicuna (Zheng et al., 2023), an instruction-tuned LLaMA (Touvron et al., 2023a), to perform further processing.
62
+
63
+ We utilize widely adopted modules in the field of object detection to construct our RoI feature extractor. To ensure a robust feature representation for regions of varying scales, we construct a multi-level image feature pyramid (Lin et al., 2017) by selecting four layers from the CLIP vision encoder and fusing them with five lightweight scale shuffle modules (Zhang et al., 2023d). These layers are located at the second-to-last, fifth-to-last, eighth-to-last, and eleventh-to-last positions, respectively. Additionally, we incorporate feature coordinates (Liu et al., 2018a; Wang et al., 2020) for each level to address the problem of translation invariance in CNNs. This helps make the model sensitive to absolute position information, such as the description “girl on left” in Figure 3. Finally, we use RoIAlign to extract region-level features with an output size of $1 4 \times 1 4$ (He et al., 2017), which ensures that sufficient detailed information is preserved. Moreover, all four level features are involved in the RoIAlign operation and fused into a single embedding as the representation of the region of interest (RoI) (Liu et al., 2018b).
64
+
65
+ # 3.2 TOKENIZATION AND EMBEDDING
66
+
67
+ To enable users to refer to regions of interest in text inputs, we define a special token <region $\{ i \} >$ , which acts as the placeholder that will be replaced by the corresponding region feature after tokenization and embedding. One example is depicted in Figure 2. When a user presents a spatial instruction, “What was $< r e g i o n 1 >$ doing before $< r e g i o n 3 >$ touched him?”, the embedding of <region $\beth$ and $< \mathtt { r e g i o n 3 } >$ are replaced by their corresponding region features. However, this replacement discards the references to different regions. To allows LLM to maintain the original references (region1, region3) in the response sequence, the instruction is modified to “What was region1 $< r e g i o n 1 >$ doing before region3 $< r e g i o n 3 >$ touched him?”. Then, LLM can generate a reply like “The person in region1 was eating breakfast before the person in region3 touched them.”
68
+
69
+ Regardless of the user instruction, we incorporate a prefix prompt, “The <image> provides an overview of the picture.” The $< i m a g e >$ is a special token that acts as a placeholder, the embedding of which would be replaced by image features of the vision encoder. These features enable LLM to receive comprehensive image information and obtain a holistic understanding of the visual context.
70
+
71
+ # 3.3 SPATIAL INSTRUCTION TUNING
72
+
73
+ Our model is trained using a next-token prediction loss (Liu et al., 2023a; Zhu et al., 2023), where the model predicts the next token in a given input text sequence. The training details are in Section A.2 in the Appendix.
74
+
75
+ We transform annotations into instruction tuning format by creating a question that refers to the mentioned region for each region-text annotation. We partition the available region-text data into two groups, employing each in two distinct training stages. In the first stage, we attempt to align region features with word embeddings in language models using simple region-text pairs that contain color, position, or category information. The second stage is designed to handle more complex concepts, such as actions, relationships, and common sense reasoning. Furthermore, we provide diverse instructions for these datasets to simulate chat-like input in this stage.
76
+
77
+ Stage 1: Pre-training In this stage, we first load the weights of LLaVA (Liu et al., 2023a) after its initial stage of training, which includes a pre-trained vision encoder, a projector for image-level features, and an LLM. We only keep the region feature extractor trainable and aim to align region features with language embedding by collecting short text and bounding box pairs. These pairs are from both normal detection datasets and referring expression detection datasets, which have short expressions. The objective is to enable the model to recognize categories and simple attributes of the region in an image, which are typically represented by a short text annotation (usually within 5 words). Specifically, we utilize COCO (Lin et al., 2014), RefCOCO (Yu et al., 2016), and RefCOCO $^ +$ (Yu et al., 2016) datasets in this stage.
78
+
79
+ As shown in Table 2, for COCO detection data, we first explain the task in the prompt and then convert the annotations to a single-word region caption task. For RefCOCO and $\operatorname { R e f C O C O + }$ , we also give task definitions first and train the model to generate descriptions containing basic attributes of the region. Only the description of the region (in red color) will be used to calculate the loss.
80
+
81
+ After this training stage, GPT4RoI can recognize categories, simple attributes, and positions of regions in images, as shown in Figure 3.
82
+
83
+ Stage 2: End-to-end fine-tuning In this stage, we only keep the vision encoder weights fixed and train the region feature extractor, image feature projector, and LLM weights. Our main focus is to enhance GPT4RoI’s ability to accurately follow user instructions and tackle complex single/multiple region understanding tasks. We tailor specific instructions for different tasks. For single region caption, we construct from Visual Genome (VG) region caption part (Krishna et al., 2017) and RefCOCOg (Mao et al., 2016). For multiple region caption, Flicker30k (Plummer et al., 2015) is converted to a multiple region caption task where the caption should include all visual elements emphasized by bounding boxes. To simulate user instruction, we create 20 questions for each caption task as shown in Table 8 and Table 9. For the region reasoning task, we modify Visual Commonsense Reasoning (VCR) (Zellers et al., 2019a) to meet the input format requirements and make it more similar to human input. The details of this process can be found in Section A.3.
84
+
85
+ ![](images/48980511c87b214b243a25a0d246ef8afbf08e2ecb0566c6af9c1bc74bc27cfb.jpg)
86
+ Table 2: The instruction template for Stage 1 training data: For both tasks, we begin by providing a description of the task definition and the expected answer. Then, we concatenate all region-text pairs into a sequence. For detection data, the format is <region $\{ i \} >$ category_name. For referring expression comprehension, the format is <region $\{ i \} >$ description of region. Only the responses highlighted in red are used to calculate the loss.
87
+
88
+ ![](images/ed48e38bf28f371b4bf1f290578d8f4a820b246af38555b8798a21f5464dc486.jpg)
89
+ Figure 3: After Stage 1 training, GPT4RoI is capable of identifying the category of the region (elephant), simple attributes such as color (purple), and the position of the region (left).
90
+
91
+ To improve the capability of GPT4RoI for multi-round conversation and generate more human-like responses, we also involve the LLaVA150k (Liu et al., 2023a) visual instruction dataset in this stage. We employ an off-the-shelf LVIS detector (Fang et al., 2023) to extract up to 100 detection boxes per image. These boxes are then concatenated with the user instructions in the format “<region $\{ i \} >$ may feature a class_name”. LLaVA150k significantly improves the capability of GPT4RoI for multi-round conversation .
92
+
93
+ After completing this training stage, GPT4RoI is capable of performing complex region understanding tasks based on user instructions, including region caption and reasoning, as demonstrated in Section 4.
94
+
95
+ # 4 DEMOSTRATIONS
96
+
97
+ In this section, we compare the differences between the visual instruction tuning model LLaVA (Liu et al., 2023a) and our spatial instruction tuning model GPT4RoI. We demonstrate our new interactive approach and highlight its advanced capabilities in understanding multimodality.
98
+
99
+ ![](images/f61e901b88dc84ae13ce172864e82cd3c032d3584696d2be94e390962abae6a0.jpg)
100
+ Table 3: Instruction template for Stage 2 training data: During training, we randomly select one question for both single and multiple region caption tasks. For reasoning tasks, we modify the original questions to include a reference for each region so that GPT4RoI can mention them in its response. Only the response in red color and stop string ### will be used to calculate the loss.
101
+
102
+ ![](images/03ca81ec9badbcd7dc0cb7181242288b2e7296bc8af19f492c0fb1e16bf6e980.jpg)
103
+ Figure 4: GPT4RoI and LLaVA dialogue performance showcase. Figures A and C demonstrate the dialogue scenarios of LLaVA when referring to a single instance and multiple instances solely using natural language in the conversation. On the other hand, Figures B and D showcase how GPT4RoI utilizes bounding boxes as references to address the same scenarios.
104
+
105
+ As shown in Figure 4.A, when we try to make LLaVA focus on the center region of the image, it only sees the boy holding an umbrella and a bag, but it misses the book. As a result, LLaVA gives a wrong answer to the question “What is the boy doing” (Figure 4.A. $\textcircled{1}$ ), and this leads to an incorrect conclusion that “the boy’s behavior is not dangerous” (Figure 4.A. $\textcircled{2}$ ).
106
+
107
+ In comparison, as shown in Figure 4.B, our approach GPT4RoI efficiently recognizes visual details using the given bounding box. This allows it to accurately identify the action of “reading a magazine.” Furthermore, GPT4RoI demonstrates its reasoning abilities by correctly inferring that the “boy’s behavior is dangerous”, and giving a reasonable reason that “the boy is reading a book while crossing the street”.
108
+
109
+ When there are multiple instances in the image (as depicted in Figure 4.C), we attempt to refer to the corresponding instances as “the right” and “the middle”. However, LLaVA provides incorrect information by stating that the right man is “looking at the women” (as shown in Figure $4 . C . ( \textcircled { 3 } )$ . Even more concerning, LLaVA overlooks the actual women in the middle and mistakenly associates the women on the left as the reference, resulting in completely inaccurate information (as shown in Figure $4 . C . { \textcircled {4 } }$ & $\textcircled{5}$ ).
110
+
111
+ In comparison, as shown in Figure 4.D, GPT4RoI is able to understand the user’s requirements, such as identifying the person to call when ordering food, and accurately recognize that the person in region1 fulfills this criterion. Additionally, it correctly recognizes that the person in region3 is “looking at the menu”. Importantly, GPT4RoI can also infer relationships between the provided regions based on visual observations. For example, it deduces that the likely relationship between region2 and region3 is that of a “couple”, providing a reasonable explanation that they “are smiling and enjoying each other’s company”.
112
+
113
+ # 5 QUANTITATIVE RESULTS
114
+
115
+ To quantitatively evaluate GPT4RoI, we have chosen three representative benchmarks to assess the region understanding capabilities. These benchmarks include the region caption task on Visual Genome (Krishna et al., 2017), the region reasoning task on Visual-7W (Zhu et al., 2016), and Visual Commonsense Reasoning (Zellers et al., 2019a) (VCR). In order to minimize the impact of specific dataset label styles and make evaluation metrics easier to calculate, we fine-tuned GPT4RoI on each benchmark using different task prompts. More details can be found in Section A.2 in the Appendix.
116
+
117
+ # 5.1 REGION CAPTION
118
+
119
+ We report the scores of BLEU, METEOR, ROUGE, and CIDEr for both GPT4RoI-7B and GPT4RoI13B on the validation set of Visual Genome (Krishna et al., 2017). The grounding box in the annotation is combined with the task prompt in Appendix Table 7 to get the response.
120
+
121
+ <table><tr><td>Model</td><td>BLEU@4</td><td>METEOR</td><td>ROUGE</td><td>CIDEr</td></tr><tr><td>GRiT (Wu et al., 2022)</td><td></td><td>17.1</td><td>1</td><td>142.0</td></tr><tr><td>GPT4RoI-7B</td><td>11.5</td><td>17.4</td><td>35.0</td><td>145.2</td></tr><tr><td>GPT4RoI-13B</td><td>11.7</td><td>17.6</td><td>35.2</td><td>146.8</td></tr></table>
122
+
123
+ Table 4: Compariation of region caption ability on the validation dataset on Visual Genome. All methods employ ground truth bounding boxes and GPT4RoI can outperform previous state-of-the-art specialist GRiT.
124
+
125
+ The generalist approach GPT4RoI outperforms the previous state-of-the-art specialist model GRiT (Wu et al., 2022) by a significant margin, without any additional techniques or tricks. Additionally, we observe that the performance of GPT4RoI-7B and GPT4RoI-13B is comparable, suggesting that the bottleneck in performance lies in the design of the visual module and the availability of region-text pair data. These areas can be explored further in future work.
126
+
127
+ # 5.2 VISUAL-7W
128
+
129
+ Visual-7W (Zhu et al., 2016) is a PointQA dataset that contains a which box setting. Here, the model is required to choose the appropriate box among four options, based on a given description. For example, a question might ask, “Which is the black machine under the sign?”. This type of question not only tests the model’s object recognition but also its ability to determine the relationship between objects.
130
+
131
+ To prevent information leakage, we remove overlapping images with the test set from Visual Genome (Krishna et al., 2017). The results clearly demonstrate that the 13B model outperforms the 7B model by a significant margin. This finding suggests that the reasoning ability heavily relies on the Large Language Model (LLM).
132
+
133
+ Table 5: Accuracy on Visual-7W test dataset.
134
+
135
+ <table><tr><td>Model</td><td>LSTM-Att (Zhu et al., 2016)</td><td>CMNs (Hu et al., 2016)</td><td>12in1 (Lu et al., 2020)</td><td>GPT4RoI-7B</td><td>GPT4RoI-13B</td></tr><tr><td>Acc(%)</td><td>56.10</td><td>72.53</td><td>83.35</td><td>81.83</td><td>84.82</td></tr></table>
136
+
137
+ # 5.3 VISUAL COMMONSENSE REASONING
138
+
139
+ Visual Commonsense Reasoning (VCR) offers a highly demanding scenario that necessitates advanced reasoning abilities, heavily relying on common sense. Given the question(Q), the model’s task is not only to select the correct answer(A) but also to select a rationale(R) that explains why the chosen answer is true. We give a more detailed explanation of each metric in our appendix
140
+
141
+ Table 6: Accuracy scores on VCR. GPT4RoI achieves state-of-the-art accuracy among all methods.
142
+
143
+ <table><tr><td rowspan="2">Model</td><td rowspan="2">Open Source</td><td rowspan="2">Parameters</td><td colspan="3">Val Acc.(%)</td><td colspan="3">Test Acc.(%)</td></tr><tr><td>Q→A</td><td>QA→R</td><td>Q→AR</td><td>Q→A</td><td>QA→R</td><td>Q→AR</td></tr><tr><td>ViLBERT (Lu et al., 2019)</td><td></td><td>221M</td><td>72.4</td><td>74.5</td><td>54.0</td><td>73.3</td><td>74.6</td><td>54.8</td></tr><tr><td>Unicoder-VL (Li et al.,2019a)</td><td></td><td></td><td>72.6</td><td>74.5</td><td>54.5</td><td>73.4</td><td>74.4</td><td>54.9</td></tr><tr><td>VLBERT-L (Su et al.,2019)</td><td>YYYYYYYY</td><td>383M</td><td>75.5</td><td>77.9</td><td>58.9</td><td>75.8</td><td>78.4</td><td>59.7</td></tr><tr><td>UNITER-L(Chen et al.,2020)</td><td></td><td>303M</td><td>=</td><td></td><td></td><td>77.3</td><td>80.8</td><td>62.8</td></tr><tr><td>ERNIE-ViL-L (Yu et al., 2021)</td><td></td><td></td><td>78.52</td><td>83.37</td><td>65.81</td><td>79.2</td><td>83.5</td><td>66.3</td></tr><tr><td>MERLOT (Zellers et al., 2021)</td><td></td><td>223M</td><td>=</td><td>=</td><td>=</td><td>80.6</td><td>80.4</td><td>65.1</td></tr><tr><td>VILLA-L (Gan et al.,2020)</td><td></td><td></td><td>78.45</td><td>82.57</td><td>65.18</td><td>78.9</td><td>82.8</td><td>65.7</td></tr><tr><td>RESERVE-L (Zellers et al., 2022)</td><td>YY</td><td>644M</td><td>-</td><td>-</td><td>=</td><td>84.0</td><td>84.9</td><td>72.0</td></tr><tr><td>VQA-GNN-L (Wang et al., 2022)</td><td></td><td>1B+</td><td>-</td><td>-</td><td></td><td>85.2</td><td>86.6</td><td>74.0</td></tr><tr><td>GPT4RoI-7B</td><td>Y</td><td>7B+</td><td>87.4</td><td>89.6</td><td>78.6</td><td>-</td><td>-</td><td>-</td></tr><tr><td>VLUA+@ Kuaishou</td><td>N</td><td></td><td>/</td><td>-</td><td></td><td>84.8</td><td>87.0</td><td>74.0</td></tr><tr><td>KS-MGSR @KDDI Research and SNAP</td><td>N</td><td></td><td></td><td>=</td><td>=</td><td>85.3</td><td>86.9</td><td>74.3</td></tr><tr><td>SP-VCR @Shopee</td><td>N</td><td></td><td></td><td></td><td></td><td>83.6</td><td>88.6</td><td>74.4</td></tr><tr><td>HunYuan-VCR@Tencent</td><td>N</td><td></td><td></td><td></td><td></td><td>85.8</td><td>88.0</td><td>75.6</td></tr><tr><td>Human Performance (Zellers et al., 2019a)</td><td>-</td><td></td><td></td><td>=</td><td></td><td>91.0</td><td>93.0</td><td>85.0</td></tr><tr><td>GPT4RoI-13B</td><td>Y</td><td>13B+</td><td></td><td>=</td><td></td><td>89.4</td><td>91.0</td><td>81.6</td></tr></table>
144
+
145
+ GPT4RoI shows significant improvements over the previous methods across all $Q A$ , $Q A R$ , and $Q A R$ tasks. Notably, in the crucial $Q A R$ task, GPT4RoI-13B achieves a performance of 81.6 accuracy, surpassing preceding methods by over 6 points, even outperforming confidential company-level results, which may take advantage of private data. Our totally open-source pipeline can make GPT4RoI a solid baseline. More importantly, this performance is almost reaching human-level performance of 85.0 accuracy, which shows that the multimodal ability of GPT4RoI is promising to be further developed to human intelligence. Furthermore, comparing GPT4RoI to previous methods, particularly observing the size of the language model used, also demonstrates the significant benefits of the Large Language Model (LLM) for visual reasoning tasks.
146
+
147
+ # 6 CONCLUSIONS
148
+
149
+ In this paper, we present GPT4RoI, an end-to-end vision-language model that can execute user instructions to achieve region-level image understanding. Our approach employs spatial instruction tuning for the large language model (LLM), where we convert the reference to bounding boxes from user instructions into region features. These region features, along with language embeddings, are combined to create an input sequence for the large language model. By utilizing existing open-source region-text pair datasets, we show that GPT4RoI enhances user interaction by accurately referring to regions and achieves impressive performance in region-level image understanding tasks.
150
+
151
+ # REFERENCES
152
+
153
+ Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katherine Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. Advances in Neural Information Processing Systems, 35:23716– 23736, 2022. 3
154
+
155
+ Anonymous. Ins-detCLIP: Aligning detection model to follow human-language instruction. In Submitted to The Twelfth International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id ${ \bf \Phi } = { \bf \Phi }$ M0MF4t3hE9. under review. 18
156
+ Anthropic. Claude. https://www.anthropic.com/index/introducing-claude, 2023. 1
157
+ 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. 3
158
+ Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023. 3
159
+ Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision, pp. 213–229. Springer, 2020. 3
160
+ 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 Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3558–3568, 2021. 2
161
+ Chi Chen, Ruoyu Qin, Fuwen Luo, Xiaoyue Mi, Peng Li, Maosong Sun, and Yang Liu. Positionenhanced visual instruction tuning for multimodal large language models. arXiv preprint arXiv:2308.13437, 2023a. 18
162
+ Keqin Chen, Zhao Zhang, Weili Zeng, Richong Zhang, Feng Zhu, and Rui Zhao. Shikra: Unleashing multimodal llm’s referential dialogue magic. arXiv preprint arXiv:2306.15195, 2023b. 18
163
+ 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. 18
164
+ Ting Chen, Saurabh Saxena, Lala Li, Tsung-Yi Lin, David J Fleet, and Geoffrey E Hinton. A unified sequence interface for vision tasks. Advances in Neural Information Processing Systems, 35: 31333–31346, 2022. 18
165
+ Xinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015. 2
166
+ Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. Uniter: Universal image-text representation learning, 2020. 9
167
+ 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/. 1, 4
168
+ 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. 3
169
+ Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi
170
+
171
+ Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language models. arXiv preprint arXiv:2210.11416, 2022. 3
172
+
173
+ Wenliang Dai, Junnan Li, Dongxu Li, Anthony Meng Huat Tiong, Junqi Zhao, Weisheng Wang, Boyang Li, Pascale Fung, and Steven Hoi. Instructblip: Towards general-purpose vision-language models with instruction tuning, 2023. 2, 3
174
+ 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. 3
175
+ Danny Driess, Fei Xia, Mehdi SM Sajjadi, Corey Lynch, Aakanksha Chowdhery, Brian Ichter, Ayzaan Wahid, Jonathan Tompson, Quan Vuong, Tianhe Yu, et al. Palm-e: An embodied multimodal language model. arXiv preprint arXiv:2303.03378, 2023. 1
176
+ Zhengxiao Du, Yujie Qian, Xiao Liu, Ming Ding, Jiezhong Qiu, Zhilin Yang, and Jie Tang. Glm: General language model pretraining with autoregressive blank infilling. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 320–335, 2022. 1
177
+ Yuxin Fang, Quan Sun, Xinggang Wang, Tiejun Huang, Xinlong Wang, and Yue Cao. Eva-02: A visual representation for neon genesis. arXiv preprint arXiv:2303.11331, 2023. 6
178
+ Zhe Gan, Yen-Chun Chen, Linjie Li, Chen Zhu, Yu Cheng, and Jingjing Liu. Large-scale adversarial training for vision-and-language representation learning, 2020. 9
179
+ Rohit Girdhar, Alaaeldin El-Nouby, Zhuang Liu, Mannat Singh, Kalyan Vasudev Alwala, Armand Joulin, and Ishan Misra. Imagebind: One embedding space to bind them all. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15180–15190, 2023. 1
180
+ Tao Gong, Chengqi Lyu, Shilong Zhang, Yudong Wang, Miao Zheng, Qian Zhao, Kuikun Liu, Wenwei Zhang, Ping Luo, and Kai Chen. Multimodal-gpt: A vision and language model for dialogue with humans, 2023. 3
181
+ Google. Bard. https://bard.google.com/, 2023. 1
182
+ Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In Proceedings of the IEEE international conference on computer vision, pp. 2961–2969, 2017. 2, 5
183
+ Ronghang Hu, Marcus Rohrbach, Jacob Andreas, Trevor Darrell, and Kate Saenko. Modeling relationships in referential expressions with compositional modular networks, 2016. 9
184
+ 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, 2023. 1
185
+ Justin Johnson, Andrej Karpathy, and Li Fei-Fei. Densecap: Fully convolutional localization networks for dense captioning, 2015. 4
186
+ Aishwarya Kamath, Mannat Singh, Yann LeCun, Gabriel Synnaeve, Ishan Misra, and Nicolas Carion. Mdetr – modulated detection for end-to-end multi-modal understanding, 2021. 4
187
+ Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, et al. Visual genome: Connecting language and vision using crowdsourced dense image annotations. International journal of computer vision, 123:32–73, 2017. 2, 3, 6, 8, 9, 16
188
+ Feng Li, Hao Zhang, Huaizhe Xu, Shilong Liu, Lei Zhang, Lionel M Ni, and Heung-Yeung Shum. Mask dino: Towards a unified transformer-based framework for object detection and segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3041–3050, 2023a. 18
189
+ Gen Li, Nan Duan, Yuejian Fang, Ming Gong, Daxin Jiang, and Ming Zhou. Unicoder-vl: A universal encoder for vision and language by cross-modal pre-training, 2019a. 9
190
+ KunChang Li, Yinan He, Yi Wang, Yizhuo Li, Wenhai Wang, Ping Luo, Yali Wang, Limin Wang, and Yu Qiao. Videochat: Chat-centric video understanding. arXiv preprint arXiv:2305.06355, 2023b. 3
191
+ Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. Visualbert: A simple and performant baseline for vision and language, 2019b. 4
192
+ Liunian Harold $\mathrm { L i ^ { * } }$ , Pengchuan Zhang\*, Haotian Zhang\*, Jianwei Yang, Chunyuan Li, Yiwu Zhong, Lijuan Wang, Lu Yuan, Lei Zhang, Jenq-Neng Hwang, Kai-Wei Chang, and Jianfeng Gao. Grounded language-image pre-training. In CVPR, 2022. 4
193
+ Yikang Li, Wanli Ouyang, Bolei Zhou, Kun Wang, and Xiaogang Wang. Scene graph generation from objects, phrases and region captions, 2017. 4
194
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In Computer Vision– ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V 13, pp. 740–755. Springer, 2014. 2, 5
195
+ Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2117–2125, 2017. 4
196
+ Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. arXiv preprint arXiv:2304.08485, 2023a. 2, 3, 4, 5, 6
197
+ Rosanne Liu, Joel Lehman, Piero Molino, Felipe Petroski Such, Eric Frank, Alex Sergeev, and Jason Yosinski. An intriguing failing of convolutional neural networks and the coordconv solution, 2018a. 5
198
+ Shilong Liu, Zhaoyang Zeng, Tianhe Ren, Feng Li, Hao Zhang, Jie Yang, Chunyuan Li, Jianwei Yang, Hang Su, Jun Zhu, and Lei Zhang. Grounding dino: Marrying dino with grounded pre-training for open-set object detection, 2023b. 4
199
+ Shu Liu, Lu Qi, Haifang Qin, Jianping Shi, and Jiaya Jia. Path aggregation network for instance segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8759–8768, 2018b. 5
200
+ Yuan Liu, Haodong Duan, Yuanhan Zhang, Bo Li, Songyang Zhang, Wangbo Zhao, Yike Yuan, Jiaqi Wang, Conghui He, Ziwei Liu, et al. Mmbench: Is your multi-modal model an all-around player? arXiv preprint arXiv:2307.06281, 2023c. 3
201
+ 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, 2023d. 2, 3
202
+ Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks, 2019. 9
203
+ Jiasen Lu, Vedanuj Goswami, Marcus Rohrbach, Devi Parikh, and Stefan Lee. 12-in-1: Multi-task vision and language representation learning, 2020. 9
204
+ Junhua Mao, Jonathan Huang, Alexander Toshev, Oana Camburu, Alan L Yuille, and Kevin Murphy. Generation and comprehension of unambiguous object descriptions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 11–20, 2016. 2, 6
205
+ Yao Mu, Qinglong Zhang, Mengkang Hu, Wenhai Wang, Mingyu Ding, Jun Jin, Bin Wang, Jifeng Dai, Yu Qiao, and Ping Luo. Embodiedgpt: Vision-language pre-training via embodied chain of thought. arXiv preprint arXiv:2305.15021, 2023. 3
206
+ OpenAI. Chatgpt. https://openai.com/blog/chatgpt, 2022. 1, 3
207
+ OpenAI. Gpt-4 technical report, 2023. 1
208
+
209
+ Vicente Ordonez, Girish Kulkarni, and Tamara Berg. Im2text: Describing images using 1 million captioned photographs. Advances in neural information processing systems, 24, 2011. 2
210
+
211
+ 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. 3
212
+ Renjie Pi, Jiahui Gao, Shizhe Diao, Rui Pan, Hanze Dong, Jipeng Zhang, Lewei Yao, Jianhua Han, Hang Xu, and Lingpeng Kong Tong Zhang. Detgpt: Detect what you need via reasoning. arXiv
213
+ preprint arXiv:2305.14167, 2023. 2
214
+ Bryan A Plummer, Liwei Wang, Chris M Cervantes, Juan C Caicedo, Julia Hockenmaier, and Svetlana Lazebnik. Flickr30k entities: Collecting region-to-phrase correspondences for richer image-to-sentence models. In Proceedings of the IEEE international conference on computer vision, pp. 2641–2649, 2015. 2, 6
215
+ Alec Radford, Karthik Narasimhan, Tim Salimans, Ilya Sutskever, et al. Improving language understanding by generative pre-training. OpenAI, 2018. 3
216
+ 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. 4
217
+ 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. 3
218
+ Hanoona Rasheed, Muhammad Maaz, Sahal Shaji, Abdelrahman Shaker, Salman Khan, Hisham Cholakkal, Rao M Anwer, Erix Xing, Ming-Hsuan Yang, and Fahad S Khan. Glamm: Pixel grounding large multimodal model. arXiv preprint arXiv:2311.03356, 2023. 18
219
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. Advances in neural information processing systems, 28: 91–99, 2015. 3, 18
220
+ Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-400m: Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint arXiv:2111.02114, 2021. 2
221
+ Shuai Shao, Zeming Li, Tianyuan Zhang, Chao Peng, Gang Yu, Xiangyu Zhang, Jing Li, and Jian Sun. Objects365: A large-scale, high-quality dataset for object detection. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 8429–8438, 2019. doi: 10.1109/ICCV. 2019.00852. 18
222
+ Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th
223
+ Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2556–2565, 2018. 2
224
+ Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. Vl-bert: Pre-training of generic visual-linguistic representations. arXiv preprint arXiv:1908.08530, 2019. 4, 9
225
+ Tianxiang Sun and Qiu Xipeng. Moss. https://github.com/OpenLMLab/MOSS, 2022. 1
226
+ Dídac Surís, Sachit Menon, and Carl Vondrick. Vipergpt: Visual inference via python execution for
227
+ reasoning. arXiv preprint arXiv:2303.08128, 2023. 3
228
+ Kaihua Tang, Hanwang Zhang, Baoyuan Wu, Wenhan Luo, and Wei Liu. Learning to compose dynamic tree structures for visual contexts, 2018. 4
229
+ 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.
230
+
231
+ https://github.com/tatsu-lab/stanford_alpaca, 2023. 1
232
+
233
+ Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023a. 1, 4
234
+ 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. 1
235
+ Teng Wang, Jinrui Zhang, Junjie Fei, Yixiao Ge, Hao Zheng, Yunlong Tang, Zhe Li, Mingqi Gao, Shanshan Zhao, Ying Shan, et al. Caption anything: Interactive image description with diverse multimodal controls. arXiv preprint arXiv:2305.02677, 2023a. 2
236
+ 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, 2023b. 2
237
+ Xinlong Wang, Tao Kong, Chunhua Shen, Yuning Jiang, and Lei Li. Solo: Segmenting objects by locations. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XVIII 16, pp. 649–665. Springer, 2020. 5
238
+ Yanan Wang, Michihiro Yasunaga, Hongyu Ren, Shinya Wada, and Jure Leskovec. Vqa-gnn: Reasoning with multimodal semantic graph for visual question answering, 2022. 9
239
+ Chenfei Wu, Shengming Yin, Weizhen Qi, Xiaodong Wang, Zecheng Tang, and Nan Duan. Visual chatgpt: Talking, drawing and editing with visual foundation models. arXiv preprint arXiv:2303.04671, 2023. 2, 3
240
+ Jialian Wu, Jianfeng Wang, Zhengyuan Yang, Zhe Gan, Zicheng Liu, Junsong Yuan, and Lijuan Wang. Grit: A generative region-to-text transformer for object understanding, 2022. 4, 8
241
+ Peng Xu, Wenqi Shao, Kaipeng Zhang, Peng Gao, Shuo Liu, Meng Lei, Fanqing Meng, Siyuan Huang, Yu Qiao, and Ping Luo. Lvlm-ehub: A comprehensive evaluation benchmark for large vision-language models, 2023. 3
242
+ Jiange Yang, Wenhui Tan, Chuhao Jin, Bei Liu, Jianlong Fu, Ruihua Song, and Limin Wang. Pave the way to grasp anything: Transferring foundation models for universal pick-place robots. arXiv preprint arXiv:2306.05716, 2023a. 3
243
+ Jingkang Yang, Yi Zhe Ang, Zujin Guo, Kaiyang Zhou, Wayne Zhang, and Ziwei Liu. Panoptic scene graph generation, 2022. 4
244
+ Linjie Yang, Kevin Tang, Jianchao Yang, and Li-Jia Li. Dense captioning with joint inference and visual context. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Jul 2017. 4
245
+ Zhengyuan Yang, Linjie Li, Kevin Lin, Jianfeng Wang, Chung-Ching Lin, Zicheng Liu, and Lijuan Wang. The dawn of lmms: Preliminary explorations with gpt-4v (ision). arXiv preprint arXiv:2309.17421, 9, 2023b. 18
246
+ Zhengyuan Yang, Linjie Li, Jianfeng Wang, Kevin Lin, Ehsan Azarnasab, Faisal Ahmed, Zicheng Liu, Ce Liu, Michael Zeng, and Lijuan Wang. Mm-react: Prompting chatgpt for multimodal reasoning and action. arXiv preprint arXiv:2303.11381, 2023c. 1, 2, 3
247
+ Yuan Yao, Qianyu Chen, Ao Zhang, Wei Ji, Zhiyuan Liu, Tat-Seng Chua, and Maosong Sun. Pevl: Position-enhanced pre-training and prompt tuning for vision-language models. arXiv preprint arXiv:2205.11169, 2022. 4
248
+ Haoxuan You, Haotian Zhang, Zhe Gan, Xianzhi Du, Bowen Zhang, Zirui Wang, Liangliang Cao, Shih-Fu Chang, and Yinfei Yang. Ferret: Refer and ground anything anywhere at any granularity. arXiv preprint arXiv:2310.07704, 2023. 18
249
+ Fei Yu, Jiji Tang, Weichong Yin, Yu Sun, Hao Tian, Hua Wu, and Haifeng Wang. Ernie-vil: Knowledge enhanced vision-language representations through scene graph, 2021. 4, 9
250
+ Licheng Yu, Patrick Poirson, Shan Yang, Alexander C Berg, and Tamara L Berg. Modeling context in referring expressions. In Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part II 14, pp. 69–85. Springer, 2016. 2, 5
251
+ Yuhang Zang, Wei Li, Jun Han, Kaiyang Zhou, and Chen Change Loy. Contextual object detection with multimodal large language models, 2023. 3
252
+ Rowan Zellers, Yonatan Bisk, Ali Farhadi, and Yejin Choi. From recognition to cognition: Visual commonsense reasoning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 6720–6731, 2019a. 2, 3, 6, 8, 9, 16
253
+ Rowan Zellers, Yonatan Bisk, Ali Farhadi, and Yejin Choi. From recognition to cognition: Visual commonsense reasoning. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019b. 4, 17
254
+ Rowan Zellers, Ximing Lu, Jack Hessel, Youngjae Yu, Jae Sung Park, Jize Cao, Ali Farhadi, and Yejin Choi. Merlot: Multimodal neural script knowledge models. In Advances in Neural Information Processing Systems 34, 2021. 9
255
+ Rowan Zellers, Jiasen Lu, Ximing Lu, Youngjae Yu, Yanpeng Zhao, Mohammadreza Salehi, Aditya Kusupati, Jack Hessel, Ali Farhadi, and Yejin Choi. Merlot reserve: Multimodal neural script knowledge through vision and language and sound. In CVPR, 2022. 9
256
+ Ao Zhang, Hao Fei, Yuan Yao, Wei Ji, Li Li, Zhiyuan Liu, and Tat-Seng Chua. Transfer visual prompt generator across llms. arXiv preprint arXiv:2305.01278, 2023a. 3
257
+ Ao Zhang, Liming Zhao, Chen-Wei Xie, Yun Zheng, Wei Ji, and Tat-Seng Chua. Next-chat: An lmm for chat, detection and segmentation. arXiv preprint arXiv:2311.04498, 2023b. 18
258
+ Hao Zhang, Feng Li, Shilong Liu, Lei Zhang, Hang Su, Jun Zhu, Lionel M Ni, and Heung-Yeung Shum. Dino: Detr with improved denoising anchor boxes for end-to-end object detection. arXiv preprint arXiv:2203.03605, 2022. 18
259
+ Renrui Zhang, Jiaming Han, Aojun Zhou, Xiangfei Hu, Shilin Yan, Pan Lu, Hongsheng Li, Peng Gao, and Yu Qiao. Llama-adapter: Efficient fine-tuning of language models with zero-init attention. arXiv preprint arXiv:2303.16199, 2023c. 2, 3
260
+ Shilong Zhang, Xinjiang Wang, Jiaqi Wang, Jiangmiao Pang, Chengqi Lyu, Wenwei Zhang, Ping Luo, and Kai Chen. Dense distinct query for end-to-end object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 7329–7338, June 2023d. 5, 18
261
+ Liang Zhao, En Yu, Zheng Ge, Jinrong Yang, Haoran Wei, Hongyu Zhou, Jianjian Sun, Yuang Peng, Runpei Dong, Chunrui Han, et al. Chatspot: Bootstrapping multimodal llms via precise referring instruction tuning. arXiv preprint arXiv:2307.09474, 2023. 18
262
+ Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric. P Xing, Hao Zhang, Joseph E. Gonzalez, and Ion Stoica. Judging llm-as-a-judge with mt-bench and chatbot arena, 2023. 4
263
+ Xingyi Zhou, Rohit Girdhar, Armand Joulin, Philipp Krähenbühl, and Ishan Misra. Detecting twenty-thousand classes using image-level supervision. In ECCV, 2022. 4
264
+ 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, 2023. 2, 3, 4, 5
265
+ Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv preprint arXiv:2010.04159, 2020. 2, 3
266
+ Yuke Zhu, Oliver Groth, Michael Bernstein, and Li Fei-Fei. Visual7w: Grounded question answering in images, 2016. 3, 8, 9, 16
267
+
268
+ # A APPENDIX
269
+
270
+ In this appendix, we provide a detailed method architecture figure. We then discuss training-related details, including hyperparameters and instruction templates used in each stage and task. Specifically, we give an introduction for VCR dataset and describe how we utilize the VCR dataset. We also compare the design philosophy with methods using textual coordinates in LLM and provide a brief overview of concurrent works . Finally, we analyze some error cases and propose potential improvements for future exploration.
271
+
272
+ # A.1 DETAILED ARCHITECTURE
273
+
274
+ ![](images/35283ad6118f8c8045a4fb554b64b918f110aa25302dc03727db63e65f836e2f.jpg)
275
+ Figure 5: A more detailed framework of GPT4RoI.
276
+
277
+ Here is a more detailed framework of our approach, GPT4RoI.
278
+
279
+ 1. We preprocess the input text by adding prefixes to retain both image information and pure text references for each region.
280
+ 2. Next, we tokenize and embed the text. The image feature and region features will replace the placeholders <image> and ${ < r e g i o n \mathord { \left/ { \vphantom { < r e g i o n \left/ { i } \right.} \kern - delimiterspace } \right.} \kern - delimiterspace } >$ respectively.
281
+ 3. The resulting interleaved sequence of region $\&$ image features and language embeddings is then fed into a large language model (LLM) for further processing.
282
+
283
+ # A.2 TRAINING DETAILS
284
+
285
+ Dialogue model The dialogue model in the demo is trained on 8 GPUs, each with 80G of memory. During the first training stage, a learning rate of 2e-5 is used with a cosine learning schedule. The batch size is 16 for 2 epochs, with a warm-up iteration set to 3000 and a warm-up ratio of 0.003. The weight decay for all modules was set to 0. During the second training stage, the learning rate is reduced to 2e-5 and the model is trained for 1 epoch. To enable end-to-end fine-tuning of the model, which includes a 7B Vicuna, Fully Sharded Data Parallel (FSDP) is enabled in PyTorch to save memory.
286
+
287
+ Downstream tasks We finetune on three datasets with different learning schedules and task prompts (as shown in Table 7). For the region caption task on Visual Genome (Krishna et al., 2017), we perform fine-tuning for 4 epochs with a learning rate of 2e-5. As for Visual-7W (Zhu et al., 2016), we observe that it requires a smaller learning rate of 1e-6 to stabilize the training, which is also trained in 2 epochs. On the Visual Commonsense Reasoning (Zellers et al., 2019a), we fine-tune the model for 1 epoch using a learning rate of 2e-5.
288
+
289
+ Instruction of three downstream tasks. The instructions for three downstream tasks are provided in Table 7.
290
+
291
+ # Region Caption Task on Visual Genome
292
+
293
+ ### Question: Can you give a description of the region mentioned by <region> ### Answer: A man wearing a light blue t-shirt and jeans with his arms extended
294
+
295
+ # Region Reasoning Task on Visual-7W
296
+
297
+ ### Question: <region1>,<region2>,<region3>,<region4> refers to specific areas within the photo along with their respective identifiers. I need you to answer the question. Questions are multiplechoice; you only need to pick the correct answer from the given options (A), (B), (C), or (D). Which is the black machine under the sign?
298
+
299
+ ### Answer: (A)
300
+
301
+ # Region Reasoning Task on VCR
302
+
303
+ $\mathbf Q \to \mathbf A$
304
+
305
+ ### Question: <region1>,<region2>,<region3>... refers to specific areas within the photo along with their respective identifiers. I need you to answer the question. Questions are multiple-choice; you only need to pick the correct answer from the given options (A), (B), (C), or (D).
306
+
307
+ How is 1 feeling ? (A),1 is feeling amused . (B),1 is upset and disgusted . (C),1 is feeling very scared . (D),1 is feeling uncomfortable with 3
308
+
309
+ ### Answer: (C)
310
+
311
+ $\mathbf { Q A } \to \mathbf { R }$
312
+
313
+ ### Question: <region1>,<region2>,<region $3 > .$ ... refers to specific areas within the photo along with their respective identifiers. I give you a question and its answer, I need you to provide a rationale explaining why the answer is right. Both questions are multiple-choice; you only need to pick the correct answer from the given options (A), (B), (C), or (D).
314
+
315
+ "How is 1 feeling ?" The answer is "1 is feeling very scared." What’s the rationale for this decision? (A),1’s face has wide eyes and an open mouth .
316
+ (B),When people have their mouth back like that and their eyebrows lowered they are usually disgusted by what they see .
317
+ (C),3,2,1 are seated at a dining table where food would be served to them . people unaccustomed to odd or foreign dishes may make disgusted looks at the thought of eating it .
318
+ (D),1’s expression is twisted in disgust .
319
+
320
+ ### Answer: (A)
321
+
322
+ Table 7: Task prompt of three downstream tasks.
323
+
324
+ Instruction of Single-Region Caption The instructions for single-region caption are provided in Table 8. We randomly select one as the question in training.
325
+
326
+ Instruction of Multi-Region Caption The instructions for multi-region caption are provided in Table 9. We randomly select one as the question in training.
327
+
328
+ # A.3 VCR
329
+
330
+ Introduction to the VCR Dataset The Visual Commonsense Reasoning(VCR) dataset (Zellers et al., 2019b), comprises 290,000 multiple-choice questions obtained from 110,000 movie scenes. Each image in the dataset is annotated with a question that requires common-sense reasoning, along with its corresponding answer and the explanation for the answer. VCR is a particularly challenging dataset for comprehension and reasoning. It has gained attention from several wellknown organizations, who have submitted their solutions on the leaderboard. The dataset’s distinctive challenge is that a model not only needs to answer complex visual questions but also provide a rationale for why its answer is correct. The VCR task consists of two sub-tasks: Question Answering $\mathrm { ( Q \to A ) }$ ) and Answer Justification (QA R). In the Q→A setup, a model is given a question and must select the correct answer from four choices. In the QA- ${ \mathrm { . > R } }$ setup, a model is provided with a question and the correct answer, and it needs to justify the answer by selecting the most appropriate rationale from four choices. The performance of models is evaluated using the $\mathrm { Q } \to \mathrm { A R }$ metric, where accuracy is measured as the percentage of correctly answered questions along with the correct rationale.
331
+
332
+ Preprocess of VCR To construct a sequence of questions, we convert the explanation to a follow-up question and format them into a two-round conversation. Table 10 shows an example of the follow-up question that asks for the reasoning behind the answer.
333
+
334
+ The VCR dataset is valued for its diverse question-answer pairs that require referencing from prior question-answers to perform reasoning. Therefore, it’s crucial to assign a reference to each region in the dataset. We accomplish this by starting each conversation with a reference to all regions, e.g., There are <region1 $>$ , <region $2 >$ ... in the image. This approach explicitly references every region, avoiding confusion in future analyses. Additionally, we substitute the corresponding <region $\mathbf { \Phi } _ { i } \mathbf { \Phi } _ { > }$ in the answer with category_name at region{i} to ensure a plain text output sequence.
335
+
336
+ # A.4 TEXTUAL COORDINATES AS THE GROUNDING TOKEN
337
+
338
+ The key distinction lies in whether to incorporate the detection function into the LLM. For the method that uses textual coordinates as the grounding token, they have to solve the following challenge:
339
+
340
+ Aligning a large number of position tokens with their corresponding positions in the image by training on a large set of datasets. But this is actually a simple rule that can be naturally implemented with the operation in detection architectures.
341
+
342
+ Modeling geometric properties can be challenging. For example, if the ground truth box is $< x _ { 1 } =$ $0 , y _ { 1 } = 0 , x _ { 2 } = 5 , y _ { 2 } = 5 >$ , a predicted box of $< x _ { 1 } = 1 , y _ { 1 } = 1 , x _ { 2 } = 4 , y _ { 2 } = 4 >$ would be considered a better result than $< x _ { 1 } = 1 , y _ { 1 } = 1 , x _ { 2 } = 8 , y _ { 2 } = 8 >$ . because it has a higher overlap with the ground truth. However, incorporating this geometric property into the next token prediction task using cross-entropy loss can be challenging. On the other hand, utilizing traditional loss functions such as L1 or IoU loss can naturally handle this geometric constraint.
343
+
344
+ Dense to Sparse (Ren et al., 2015; Zhang et al., 2023d) is a crucial design for detection performance, but embedding such an idea into the sequential form of LLM is challenging. We provide two pieces of evidence to support our argument
345
+
346
+ 1. The performance of pix2seq (Chen et al., 2021; 2022), which utilizes object365 (Shao et al., 2019) pretrain, falls significantly behind the corresponding specialist (Zhang et al., 2022; Li et al., 2023a).
347
+
348
+ 2. Even with scaled-up data and parameters, GPT4V still faces challenges in object counting (Yang et al., 2023b). However, this is a trivial task for detection methods.
349
+
350
+ Another approach is to use an external detector to find the potential region of interest, whereas LLM only focuses on analyzing the corresponding region of interest. This is the motivation of GPT4RoI. It requires much less data and allows for quick adaptation to specific domain problems with the corresponding detector. However, the drawback is that the framework may appear less elegant and it assumes input contains all regions of interest that need to be analyzed.
351
+
352
+ Both approaches have their advantages and disadvantages, and academic research in both directions is thriving (including concurrent works or follow-ups on GPT4RoI). For the first approach, relevant references include (Zhao et al., 2023; Chen et al., 2023b), while for the second approach, there are (Anonymous, 2023; Chen et al., 2023a) besides GPT4RoI. Additionally, there has been research that explores a fusion of the two approaches, as shown in references (You et al., 2023; Rasheed et al., 2023; Zhang et al., 2023b).
353
+
354
+ # A.5 FAILURE CASE ANALYSIS
355
+
356
+ Due to limited data and instructions, GPT4RoI may fail in several landmark scenarios. We have conducted a thorough analysis and look forward to improving these limitations in future versions.
357
+
358
+ Instruction obfuscation As shown in Figure 6.(a), our multiple-region reasoning capability mainly relies on VCR, where we often use sentences that declare <region1>, <region2>, etc. at the beginning of the question. However, when users adopt the less common sentence structure to refer to regions, it can often be confused with region captions that have the highest proportion in the dataset. As shown in Figure 6.(b), because our data and instructions are mainly generated by rules, our training data does not include content with the "respectively" instruction in multi-region scenarios. This can be resolved by adding specific instructions. In future versions, we aim to develop more diverse instructions, while ensuring data balance.
359
+
360
+ ![](images/ff55085a383fc6469d04648ee0a104d17f0ab23d946cdd55761d4575deb7a803.jpg)
361
+ Figure 6: GPT4RoI on instruction obfuscation.
362
+
363
+ Misidentification of fine-grained information within in region Although GPT4RoI has improved the fine-grained perception ability of images compared to image-level vision language models, the limited amount of region-level data results in insufficient fine-grained alignment within regions. For example, in Figure 7.(a), the model incorrectly identifies the color of the helmet, and in Figure 7.(b), it misidentifies the object in the girl’s hand. Both cases generate the corresponding answers based on the most prominent feature within the region. Using semi-supervised methods to create more region-level data may address this issue.
364
+
365
+ ![](images/6ccdd527eb77de0ac10c4eff4b052ab22d4e6eead056d6dc315410645227a7b2.jpg)
366
+ Figure 7: GPT4RoI on Misidentification of fine-grained information.
367
+
368
+ # A.6 DISCUSSION
369
+
370
+ In our exploration, we find GPT4RoI produces failure cases as shown in Section. A.5. To further improve the performance, we identify the following potential directions:
371
+
372
+ • Model architecture. We find that $2 2 4 \times 2 2 4$ input image resolution struggles with understanding smaller regions. However, if we switch to a larger resolution, we must consider the potential burden on inference speed from global attention ViT architecture, while the more efficient CNN architecture or sliding window attention has no available pre-trained large-scale vision encoder like CLIP ViT-H/14. • More region-text pair data. The amount of available region-text pairs is notably smaller than that of image-text pairs, which makes it challenging to sufficiently align region-level features with language models. To tackle this issue, we may try to generate region-level pseudo labels by leveraging off-the-shelf detectors to generate bounding boxes for image-text data.
373
+
374
+ • Region-level instructions. Although we have generated instructions for each task from existing open-source datasets, users in practical applications may ask various questions about an arbitrary number of regions, and the existing data may not contain satisfactory answers. To tackle this issue, we suggest generating a new batch of spatial instructions through manual labeling or by leveraging ChatGPT or GPT4.
375
+ • Interaction mode. Currently, GPT4RoI only supports natural language and bounding box interaction. Incorporating more open-ended interaction modes such as point, scribble, or image-based search could further improve the user interaction experience. 1. Can you provide me with a detailed description of the region in the picture marked by <region1>? 2. I’m curious about the region represented by <region1 $>$ in the picture. Could you describe it in detail?
376
+ 3. What can you tell me about the region indicated by <region1 $>$ in the image?
377
+ 4. I’d like to know more about the area in the photo labeled <region1>. Can you give me a detailed description?
378
+ 5. Could you describe the region shown as <region1 $>$ in the picture in great detail?
379
+ 6. What details can you give me about the region outlined by <region $1 >$ in the photo?
380
+ 7. Please provide me with a comprehensive description of the region marked with <region1 $>$ in the image.
381
+ 8. Can you give me a detailed account of the region labeled as <region1 $>$ in the picture?
382
+ 9. I’m interested in learning more about the region represented by <region1 $>$ in the photo. Can you describe it in detail?
383
+ 10. What is the region outlined by <region1 $>$ in the picture like? Could you give me a detailed description, please?
384
+ 11. Can you provide me with a detailed description of the region in the picture marked by <region1>, please?
385
+ 12. I’m curious about the region represented by <region1> in the picture. Could you describe it in detail, please?
386
+ 13. What can you tell me about the region indicated by <region1> in the image, exactly?
387
+ 14. I’d like to know more about the area in the photo labeled <region1>, please. Can you give me a detailed description?
388
+ 15. Could you describe the region shown as <region1 $>$ in the picture in great detail, please? 16. What details can you give me about the region outlined by <region $^ { 1 > }$ in the photo, please? 17. Please provide me with a comprehensive description of the region marked with <region1 $>$ in the image, please.
389
+ 18. Can you give me a detailed account of the region labeled as <region1 $>$ in the picture, please? 19. I’m interested in learning more about the region represented by <region1 $>$ in the photo. Can you describe it in detail, please?
390
+ 20. What is the region outlined by <region1 $>$ in the picture like, please? Could you give me a detailed description? 1. Could you please give me a detailed description of these areas [<region1>, <region2>, ...]? 2. Can you provide a thorough description of the regions [<region1>, <region2>, ...] in this image? 3. Please describe in detail the contents of the boxed areas [<region1>, <region2>, ...].
391
+ 4. Could you give a comprehensive explanation of what can be found within [<region1>, <region2>, ...] in the picture?
392
+ 5. Could you give me an elaborate explanation of the [<region1>, <region2>, ...] regions in this picture?
393
+ 6. Can you provide a comprehensive description of the areas identified by [<region1>, <region2>, ...] in this photo?
394
+ 7. Help me understand the specific locations labeled [<region1>, <region2>, ...] in this picture in detail, please.
395
+ 8. What is the detailed information about the areas marked by [<region1>, <region2>, ...] in this image?
396
+ 9. Could you provide me with a detailed analysis of the regions designated [<region1>, <region2>, ...] in this photo?
397
+ 10. What are the specific features of the areas marked [<region1>, <region2>, ...] in this picture that you can describe in detail?
398
+ 11. Could you elaborate on the regions identified by [<region1>, <region2>, ...] in this image? 12. What can you tell me about the areas labeled [<region1>, <region2>, ...] in this picture? 13. Can you provide a thorough analysis of the specific locations designated [<region1>, <region2>, ...] in this photo?
399
+ 14. I am interested in learning more about the regions marked [<region1>, <region2>, ...] in this image. Can you provide me with more information?
400
+ 15. Could you please provide a detailed description of the areas identified by [<region1>, <region2>, ...] in this photo?
401
+ 16. What is the significance of the regions labeled [<region1>, <region2>, ...] in this picture? 17. I would like to know more about the specific locations designated [<region1>, <region2>, ...] in this image. Can you provide me with more information?
402
+ 18. Can you provide a detailed breakdown of the regions marked [<region1>, <region2>, ...] in this photo?
403
+ 19. What specific features can you tell me about the areas identified by [<region1>, <region2>, ...] in this picture?
404
+ 20. Could you please provide a comprehensive explanation of the locations labeled [<region1>, <region2>, ...] in this image?
405
+
406
+ 1. Why?
407
+ 2. What’s the rationale for your decision
408
+ 3. What led you to that conclusion?
409
+ 4. What’s the reasoning behind your opinion?
410
+ 5. Can you explain the basis for your thinking?
411
+ 6. What factors influenced your perspective?
412
+ 7. How did you arrive at that perspective?
413
+ 8. What evidence supports your viewpoint?
414
+ 9. What’s the logic behind your argument?
415
+ 10. Can you provide some context for your opinion?
416
+ 11. What’s the basis for your assertion?
417
+ 12. What experiences have shaped your perspective?
418
+ 13. What assumptions underlie your reasoning?
419
+ 14. What’s the foundation of your assertion?
420
+ 15. What’s the source of your reasoning?
421
+ 16. What’s the motivation behind your decision?
422
+ 17. What’s the impetus for your belief?
423
+ 18. What’s the driving force behind your conclusion?
424
+ 19. What’s your reasoning?
425
+ 20. What makes you say that?
426
+ 21. What’s the story behind that?
427
+ 22. What’s your thought process?
428
+ 23. What’s the deal with that?
429
+ 24. What’s the logic behind it?
430
+ 25. What’s the real deal here?
431
+ 26. What’s the reason behind it?
432
+ 27. What’s the rationale for your opinion?
433
+ 28. What’s the background to that?
434
+ 29. What’s the evidence that supports your view?
435
+ 30. What’s the explanation for that?
parse/test/DzxaRFVsgC/DzxaRFVsgC_content_list.json ADDED
@@ -0,0 +1,792 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "GPT4ROI: INSTRUCTION TUNING LARGE LANGUAGE MODEL ON REGION-OF-INTEREST ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Anonymous authors Paper under double-blind review ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "ABSTRACT ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "Visual instruction tuning large language model (LLM) on image-text pairs has achieved general-purpose vision-language abilities. However, the lack of regiontext pairs limits their advancements to fine-grained multimodal understanding. In this paper, we propose spatial instruction tuning, which introduces the reference to the region-of-interest (RoI) in the instruction. Before sending to LLM, the reference is replaced by RoI features and interleaved with language embeddings as a sequence. Our model GPT4RoI, trained on 7 region-text pair datasets, brings an unprecedented interactive and conversational experience compared to previous image-level models. (1) Interaction beyond language: Users can interact with our model by both language and drawing bounding boxes to flexibly adjust the referring granularity. (2) Versatile multimodal abilities: A variety of attribute information within each RoI can be mined by GPT4RoI, e.g., color, shape, material, action, etc. Furthermore, it can reason about multiple RoIs based on common sense. On the Visual Commonsense Reasoning (VCR) dataset, GPT4RoI achieves a remarkable accuracy of $8 1 . 6 \\%$ , surpassing all existing models by a significant margin (the second place is $7 5 . 6 \\%$ ) and almost reaching human-level performance of $8 5 . 0 \\%$ . The code, dataset, and demo can be found at https://github. com/Anonymous-Researcher1/GPT4RoI. ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "1 INTRODUCTION ",
27
+ "text_level": 1,
28
+ "page_idx": 0
29
+ },
30
+ {
31
+ "type": "image",
32
+ "img_path": "images/f77a61c0afea6a1c8aa1aa5bfbef4526c4e81f18d426138b214c66f0dbff3aba.jpg",
33
+ "image_caption": [
34
+ "Figure 1: Comparison of visual instruction tuning on image-text pairs and spatial instruction tuning on region-text pairs. The bounding box and text description of each object are provided in region-text datasets. During training, the bounding box is from annotations, and in inference, it can be provided by user or any off-the-shelf object detector "
35
+ ],
36
+ "image_footnote": [],
37
+ "page_idx": 0
38
+ },
39
+ {
40
+ "type": "text",
41
+ "text": "Recent advancements of large language models (LLM) have shown incredible performance in solving natural language processing tasks in a human-like conversational manner, for example, commercial products (OpenAI, 2022; Anthropic, 2023; Google, 2023; OpenAI, 2023) and community opensource projects (Touvron et al., 2023a;b; Taori et al., 2023; Chiang et al., 2023; Du et al., 2022; Sun & Xipeng, 2022). Their unprecedented capabilities present a promising path toward general-purpose artificial intelligence models. Witnessing the power of LLM, the field of multimodal models (Yang et al., 2023c; Huang et al., 2023; Girdhar et al., 2023; Driess et al., 2023) is developing a new technology direction to leverage LLM as the universal interface to build general-purpose models, where the feature space of a specific task is tuned to be aligned with the feature space of pre-trained language models. ",
42
+ "page_idx": 0
43
+ },
44
+ {
45
+ "type": "table",
46
+ "img_path": "images/44ef733bd73ca50b1f259eabd0faf9d75b2e4343b98d34d2d1909530aa9672d0.jpg",
47
+ "table_caption": [
48
+ "Table 1: Comparisons of vision-language models. Our GPT4RoI is an end-to-end model that supports region-level understanding and multi-round conversation. "
49
+ ],
50
+ "table_footnote": [],
51
+ "table_body": "<table><tr><td>Model</td><td></td><td> Image Region Multi-Region</td><td></td><td>Muilirgund En-o-End</td><td></td></tr><tr><td>Visual ChatGPT (Wu et al., 2023)</td><td>√</td><td></td><td>xxxx//xxx</td><td></td><td></td></tr><tr><td>MiniGPT-4 (Zhu et al., 2023)</td><td>√</td><td></td><td></td><td></td><td></td></tr><tr><td>LLaVA (Liu et al., 2023a)</td><td></td><td>xxx~</td><td></td><td></td><td></td></tr><tr><td>InstructBLIP (Dai et al., 2023)</td><td></td><td></td><td></td><td></td><td>ννν</td></tr><tr><td>MM-REACT (Yang et al., 2023c)</td><td></td><td>xν</td><td></td><td></td><td></td></tr><tr><td>InternGPT (Liu et al., 2023d)</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>VisionLLM (Wang et al., 2023b)</td><td></td><td>?</td><td></td><td></td><td></td></tr><tr><td>CaptionAnything (Wang et al., 2023a)</td><td></td><td>X</td><td></td><td>X</td><td></td></tr><tr><td>DetGPT (Pi et al., 2023)</td><td></td><td></td><td></td><td></td><td>xx/xx</td></tr><tr><td>GPT4RoI</td><td>√</td><td></td><td>√</td><td></td><td>√</td></tr></table>",
52
+ "page_idx": 1
53
+ },
54
+ {
55
+ "type": "text",
56
+ "text": "",
57
+ "page_idx": 1
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "As one of the representative tasks, vision-and-language models align the vision encoder feature to LLM by instruction tuning on image-text pairs, such as MiniGPT-4 (Zhu et al., 2023), LLaVA (Liu et al., 2023a), InstructBLIP (Dai et al., 2023), etc. Although these works achieve amazing multimodal abilities, their alignments are only on image-text pairs (Chen et al., 2015; Sharma et al., 2018; Changpinyo et al., 2021; Ordonez et al., 2011; Schuhmann et al., 2021), the lack of region-level alignment limits their advancements to more fine-grained understanding tasks such as region caption (Krishna et al., 2017) and reasoning (Zellers et al., 2019a). To enable region-level understanding in vision-language models, some works attempt to leverage external vision models, for example, MMREACT (Yang et al., 2023c), InternGPT (Liu et al., 2023d) and DetGPT (Pi et al., 2023), as shown in Table 1. However, their non-end-to-end architecture is a sub-optimal choice for general-purpose multi-modal models. ",
62
+ "page_idx": 1
63
+ },
64
+ {
65
+ "type": "text",
66
+ "text": "Considering the limitations of previous works, our objective is to construct an end-to-end visionlanguage model that supports fine-grained understanding on region-of-interest. Since there is no operation that can refer to specific regions in current image-level vision-language models (Zhu et al., 2023; Liu et al., 2023a; Zhang et al., 2023c; Dai et al., 2023), our key design is to incorporate references to bounding boxes into language instructions, thereby upgrading them to the format of spatial instructions. For example, as shown in Figure 1, when the question is “what is <region1 $>$ doing?”, where the <region $^ { \\prime } >$ refers to a specific region-of-interest, the model will substitute the embedding of <region1 $^ { \\prime } >$ with the region feature extracted by the corresponding bounding box. The region feature extractor can be flexibly implemented by RoIAlign (He et al., 2017) or Deformable attention (Zhu et al., 2020). ",
67
+ "page_idx": 1
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "To establish fine-grained alignment between vision and language, we involve region-text datasets in our training, where the bounding box and the text description of each region are provided. The datasets are consolidated from publicly available ones including COCO object detection (Lin et al., 2014), RefCOCO (Yu et al., 2016), RefCOCO $^ +$ (Yu et al., 2016), RefCOCOg (Mao et al., 2016), Flickr30K entities (Plummer et al., 2015), Visual Genome(VG) (Krishna et al., 2017) and Visual Commonsense Reasoning(VCR) (Zellers et al., 2019a). These datasets are transformed into spatial instruction tuning format. Moreover, we incorporate the LLaVA150K dataset (Liu et al., 2023a) into our training process by utilizing an off-the-shelf detector to generate bounding boxes. This enhances our model’s ability to engage in multi-round conversations and generate more human-like responses. ",
72
+ "page_idx": 1
73
+ },
74
+ {
75
+ "type": "text",
76
+ "text": "The collected datasets are categorized into two types based on the complexity of the text. First, the plain-text data contains object category and simple attribute information. It is used for pre-training the region feature extractor without impacting the LLM. Second, the complex-text data often contains complex concepts or requires common sense reasoning. We conduct end-to-end fine-tuning of the region feature extractor and LLM for these data. ",
77
+ "page_idx": 1
78
+ },
79
+ {
80
+ "type": "text",
81
+ "text": "Benefiting from spatial instruction tuning, our model brings a new interactive experience, where the user can express the question to the model with language and the reference to the region-of-interest. This leads to new capacities beyond image-level understanding, such as region caption and complex region reasoning. As a generalist, our model GPT4RoI also shows its strong region understanding ability on three popular benchmarks, including the region caption task on Visual Genome (Krishna et al., 2017), the region reasoning task on Visual-7W (Zhu et al., 2016) and Visual Commonsense Reasoning (Zellers et al., 2019a) (VCR). Especially noteworthy is the performance on the most challenging VCR dataset, where GPT4RoI achieves an impressive accuracy of $8 1 . 6 \\%$ , 6 points ahead of the second-place and nearing the human-level performance benchmarked at $8 5 . 0 \\%$ . ",
82
+ "page_idx": 2
83
+ },
84
+ {
85
+ "type": "text",
86
+ "text": "In summary, our work makes the following contributions: ",
87
+ "page_idx": 2
88
+ },
89
+ {
90
+ "type": "text",
91
+ "text": "• We introduce spatial instruction, combining language and the reference to region-of-interest into an interleave sequence, enabling accurate region referring and enhancing user interaction. • By spatial instruction tuning LLM with massive region-text datasets, our model can follow user instructions to solve diverse region understanding tasks, such as region caption and reasoning. • Our method, as a generalist, outperforms the previous state-of-the-art approach on a wide range of region understanding benchmarks. ",
92
+ "page_idx": 2
93
+ },
94
+ {
95
+ "type": "text",
96
+ "text": "2 RELATED WORK ",
97
+ "text_level": 1,
98
+ "page_idx": 2
99
+ },
100
+ {
101
+ "type": "text",
102
+ "text": "2.1 LARGE LANGUAGE MODEL ",
103
+ "text_level": 1,
104
+ "page_idx": 2
105
+ },
106
+ {
107
+ "type": "text",
108
+ "text": "The field of natural language processing (NLP) has achieved significant development by the highcapability large language model (LLM). The potential of LLM is first demonstrated by pioneering works such as BERT (Devlin et al., 2018) and GPT (Radford et al., 2018). Then scaling up progress is started and leads to a series of excellent works, for example, T5 (Raffel et al., 2020), GPT-3 (Brown et al., 2020), Flan-T5 (Chung et al., 2022), PaLM (Chowdhery et al., 2022), etc. With the growth of training data and model parameters, this scaling up progress brings to a phenomenal product, ChatGPT (OpenAI, 2022). By generative pre-trained LLM and instruction tuning (Ouyang et al., 2022) on human feedback, ChatGPT shows unprecedented performance on conversations with humans, reasoning and planning tasks (Mu et al., 2023; Yang et al., 2023a; Bubeck et al., 2023), etc. ",
109
+ "page_idx": 2
110
+ },
111
+ {
112
+ "type": "text",
113
+ "text": "2.2 LARGE VISION-LANGUAGE MODEL ",
114
+ "text_level": 1,
115
+ "page_idx": 2
116
+ },
117
+ {
118
+ "type": "text",
119
+ "text": "To utilize high-performance LLM to build up vision-language models, LLM as task coordinator is proposed. Given the user instruction, LLM parses the instruction and calls various external vision models. Some representative works are Visual ChatGPT (Wu et al., 2023), ViperGPT (Surís et al., 2023), MM-REACT (Yang et al., 2023c), InternGPT (Liu et al., 2023d), VideoChat (Li et al., 2023b), etc. Although these models largely expand the scope of multimodal models, they depend on external vision models and these non-end-to-end architectures are not the optimal choice for multi-modal models. To obtain end-to-end vision-language models, instruction tuning LLM on image-text pairs is proposed to align visual features with LLM and accomplish multimodal tasks in a unified way, for example, Flamingo (Alayrac et al., 2022), MiniGPT-4 (Zhu et al., 2023), LLaVA (Liu et al., 2023a), LLaMa-Adapter (Zhang et al., 2023c), InstructBLIP (Dai et al., 2023), MM-GPT (Gong et al., 2023), VPGTrans (Zhang et al., 2023a), etc. These models achieve amazing image-level multimodal abilities, while several benchmarks such as LVLM-eHub (Xu et al., 2023) and MMBench (Liu et al., 2023c) find that these models still have performance bottlenecks when need to be under specific region reference. Our GPT4RoI follows the research line of visual instruction tuning and moves forward region-level multimodal understanding tasks such as region caption (Krishna et al., 2017) and reasoning (Zellers et al., 2019a). ",
120
+ "page_idx": 2
121
+ },
122
+ {
123
+ "type": "text",
124
+ "text": "2.3 REGION-LEVEL IMAGE UNDERSTANDING ",
125
+ "text_level": 1,
126
+ "page_idx": 2
127
+ },
128
+ {
129
+ "type": "text",
130
+ "text": "For region-level understanding, it is a common practice in computer vision to identify potential regions of interest first and then do the understanding. Object detection (Ren et al., 2015; Carion et al., 2020; Zhu et al., 2020; Zang et al., 2023) tackles the search for potential regions, which are generally accompanied by a simple classification task to understand the region’s content. To expand the object categories, (Kamath et al., 2021; Liu et al., 2023b; Zhou et al., 2022; $\\mathrm { L i ^ { * } }$ et al., 2022) learn from natural language and achieve amazing open-vocabulary object recognition performance. Region captioning (Johnson et al., 2015; Yang et al., 2017; Wu et al., 2022) provides more descriptive language descriptions in a generative way. Scene graph generation (Li et al., 2017; Tang et al., 2018; Yang et al., 2022) analyzes the relationships between regions by the graph. The VCR (Zellers et al., 2019b) dataset presents many region-level reasoning cases and (Yu et al., 2021; Su et al., 2019; Li et al., 2019b; Yao et al., 2022) exhibit decent performance by correctly selecting the answers in the multiple-choice format. However, a general-purpose region understanding model has yet to emerge. In this paper, by harnessing the powerful large language model (Touvron et al., 2023a; Chiang et al., 2023), GPT4RoI uses a generative approach to handle all these tasks. Users can complete various region-level understanding tasks by freely asking questions. ",
131
+ "page_idx": 2
132
+ },
133
+ {
134
+ "type": "text",
135
+ "text": "",
136
+ "page_idx": 3
137
+ },
138
+ {
139
+ "type": "text",
140
+ "text": "2.4 USING TEXTUAL COORDINATES AS THE GROUNDING TOKEN.",
141
+ "text_level": 1,
142
+ "page_idx": 3
143
+ },
144
+ {
145
+ "type": "text",
146
+ "text": "We compare the design philosophy with methods using textual coordinates as the grounding token and provide a brief overview of concurrent works, all of which can be found in the appendix. ",
147
+ "page_idx": 3
148
+ },
149
+ {
150
+ "type": "text",
151
+ "text": "3 METHOD: GPT4ROI ",
152
+ "text_level": 1,
153
+ "page_idx": 3
154
+ },
155
+ {
156
+ "type": "image",
157
+ "img_path": "images/08cae54434d512a57d1aa6610e590cf70b4e320666ddbb257ba560330b3ddacf.jpg",
158
+ "image_caption": [
159
+ "Figure 2: GPT4RoI is an end-to-end vision-language model for processing spatial instructions that contain references to the region-of-interest, such as <region $\\{ i \\} >$ . During tokenization and conversion to embeddings, the embedding of ${ < r e g i o n \\mathord { \\left/ { \\vphantom { < r e g i o n \\left/ { i } \\right.} \\kern - delimiterspace } \\right.} \\kern - delimiterspace } >$ in the instruction is replaced with the RoIAlign results from multi-level image features. Subsequently, such an interleaved region feature and language embedding sequence can be sent to a large language model (LLM) for further processing. We also utilize the entire image feature to capture global information and omit it in the figure for brevity. A more detailed framework figure can be found in Figure 5 in the Appendix. "
160
+ ],
161
+ "image_footnote": [],
162
+ "page_idx": 3
163
+ },
164
+ {
165
+ "type": "text",
166
+ "text": "The overall framework of GPT4RoI consists of a vision encoder, a projector for image-level features, a region feature extractor, and a large language model (LLM). Compared to previous works (Zhu et al., 2023; Liu et al., 2023a), GPT4RoI stands out for its ability to convert instructions that include spatial positions into an interleaved sequence of region features and text embeddings, as shown in Figure 2. ",
167
+ "page_idx": 3
168
+ },
169
+ {
170
+ "type": "text",
171
+ "text": "3.1 MODEL ARCHITECTURE ",
172
+ "text_level": 1,
173
+ "page_idx": 3
174
+ },
175
+ {
176
+ "type": "text",
177
+ "text": "We adopt the ViT-L/14 architecture from CLIP (Radford et al., 2021) as the vision encoder. Following (Liu et al., 2023a), we use the feature map of the penultimate transformer layer as the representation of the entire image, and then map the image feature embedding to the language space using a single linear layer as projector. Finally, we employ the Vicuna (Zheng et al., 2023), an instruction-tuned LLaMA (Touvron et al., 2023a), to perform further processing. ",
178
+ "page_idx": 3
179
+ },
180
+ {
181
+ "type": "text",
182
+ "text": "We utilize widely adopted modules in the field of object detection to construct our RoI feature extractor. To ensure a robust feature representation for regions of varying scales, we construct a multi-level image feature pyramid (Lin et al., 2017) by selecting four layers from the CLIP vision encoder and fusing them with five lightweight scale shuffle modules (Zhang et al., 2023d). These layers are located at the second-to-last, fifth-to-last, eighth-to-last, and eleventh-to-last positions, respectively. Additionally, we incorporate feature coordinates (Liu et al., 2018a; Wang et al., 2020) for each level to address the problem of translation invariance in CNNs. This helps make the model sensitive to absolute position information, such as the description “girl on left” in Figure 3. Finally, we use RoIAlign to extract region-level features with an output size of $1 4 \\times 1 4$ (He et al., 2017), which ensures that sufficient detailed information is preserved. Moreover, all four level features are involved in the RoIAlign operation and fused into a single embedding as the representation of the region of interest (RoI) (Liu et al., 2018b). ",
183
+ "page_idx": 3
184
+ },
185
+ {
186
+ "type": "text",
187
+ "text": "",
188
+ "page_idx": 4
189
+ },
190
+ {
191
+ "type": "text",
192
+ "text": "3.2 TOKENIZATION AND EMBEDDING ",
193
+ "text_level": 1,
194
+ "page_idx": 4
195
+ },
196
+ {
197
+ "type": "text",
198
+ "text": "To enable users to refer to regions of interest in text inputs, we define a special token <region $\\{ i \\} >$ , which acts as the placeholder that will be replaced by the corresponding region feature after tokenization and embedding. One example is depicted in Figure 2. When a user presents a spatial instruction, “What was $< r e g i o n 1 >$ doing before $< r e g i o n 3 >$ touched him?”, the embedding of <region $\\beth$ and $< \\mathtt { r e g i o n 3 } >$ are replaced by their corresponding region features. However, this replacement discards the references to different regions. To allows LLM to maintain the original references (region1, region3) in the response sequence, the instruction is modified to “What was region1 $< r e g i o n 1 >$ doing before region3 $< r e g i o n 3 >$ touched him?”. Then, LLM can generate a reply like “The person in region1 was eating breakfast before the person in region3 touched them.” ",
199
+ "page_idx": 4
200
+ },
201
+ {
202
+ "type": "text",
203
+ "text": "Regardless of the user instruction, we incorporate a prefix prompt, “The <image> provides an overview of the picture.” The $< i m a g e >$ is a special token that acts as a placeholder, the embedding of which would be replaced by image features of the vision encoder. These features enable LLM to receive comprehensive image information and obtain a holistic understanding of the visual context. ",
204
+ "page_idx": 4
205
+ },
206
+ {
207
+ "type": "text",
208
+ "text": "3.3 SPATIAL INSTRUCTION TUNING ",
209
+ "text_level": 1,
210
+ "page_idx": 4
211
+ },
212
+ {
213
+ "type": "text",
214
+ "text": "Our model is trained using a next-token prediction loss (Liu et al., 2023a; Zhu et al., 2023), where the model predicts the next token in a given input text sequence. The training details are in Section A.2 in the Appendix. ",
215
+ "page_idx": 4
216
+ },
217
+ {
218
+ "type": "text",
219
+ "text": "We transform annotations into instruction tuning format by creating a question that refers to the mentioned region for each region-text annotation. We partition the available region-text data into two groups, employing each in two distinct training stages. In the first stage, we attempt to align region features with word embeddings in language models using simple region-text pairs that contain color, position, or category information. The second stage is designed to handle more complex concepts, such as actions, relationships, and common sense reasoning. Furthermore, we provide diverse instructions for these datasets to simulate chat-like input in this stage. ",
220
+ "page_idx": 4
221
+ },
222
+ {
223
+ "type": "text",
224
+ "text": "Stage 1: Pre-training In this stage, we first load the weights of LLaVA (Liu et al., 2023a) after its initial stage of training, which includes a pre-trained vision encoder, a projector for image-level features, and an LLM. We only keep the region feature extractor trainable and aim to align region features with language embedding by collecting short text and bounding box pairs. These pairs are from both normal detection datasets and referring expression detection datasets, which have short expressions. The objective is to enable the model to recognize categories and simple attributes of the region in an image, which are typically represented by a short text annotation (usually within 5 words). Specifically, we utilize COCO (Lin et al., 2014), RefCOCO (Yu et al., 2016), and RefCOCO $^ +$ (Yu et al., 2016) datasets in this stage. ",
225
+ "page_idx": 4
226
+ },
227
+ {
228
+ "type": "text",
229
+ "text": "As shown in Table 2, for COCO detection data, we first explain the task in the prompt and then convert the annotations to a single-word region caption task. For RefCOCO and $\\operatorname { R e f C O C O + }$ , we also give task definitions first and train the model to generate descriptions containing basic attributes of the region. Only the description of the region (in red color) will be used to calculate the loss. ",
230
+ "page_idx": 4
231
+ },
232
+ {
233
+ "type": "text",
234
+ "text": "After this training stage, GPT4RoI can recognize categories, simple attributes, and positions of regions in images, as shown in Figure 3. ",
235
+ "page_idx": 4
236
+ },
237
+ {
238
+ "type": "text",
239
+ "text": "Stage 2: End-to-end fine-tuning In this stage, we only keep the vision encoder weights fixed and train the region feature extractor, image feature projector, and LLM weights. Our main focus is to enhance GPT4RoI’s ability to accurately follow user instructions and tackle complex single/multiple region understanding tasks. We tailor specific instructions for different tasks. For single region caption, we construct from Visual Genome (VG) region caption part (Krishna et al., 2017) and RefCOCOg (Mao et al., 2016). For multiple region caption, Flicker30k (Plummer et al., 2015) is converted to a multiple region caption task where the caption should include all visual elements emphasized by bounding boxes. To simulate user instruction, we create 20 questions for each caption task as shown in Table 8 and Table 9. For the region reasoning task, we modify Visual Commonsense Reasoning (VCR) (Zellers et al., 2019a) to meet the input format requirements and make it more similar to human input. The details of this process can be found in Section A.3. ",
240
+ "page_idx": 4
241
+ },
242
+ {
243
+ "type": "image",
244
+ "img_path": "images/48980511c87b214b243a25a0d246ef8afbf08e2ecb0566c6af9c1bc74bc27cfb.jpg",
245
+ "image_caption": [
246
+ "Table 2: The instruction template for Stage 1 training data: For both tasks, we begin by providing a description of the task definition and the expected answer. Then, we concatenate all region-text pairs into a sequence. For detection data, the format is <region $\\{ i \\} >$ category_name. For referring expression comprehension, the format is <region $\\{ i \\} >$ description of region. Only the responses highlighted in red are used to calculate the loss. "
247
+ ],
248
+ "image_footnote": [],
249
+ "page_idx": 5
250
+ },
251
+ {
252
+ "type": "image",
253
+ "img_path": "images/ed48e38bf28f371b4bf1f290578d8f4a820b246af38555b8798a21f5464dc486.jpg",
254
+ "image_caption": [
255
+ "Figure 3: After Stage 1 training, GPT4RoI is capable of identifying the category of the region (elephant), simple attributes such as color (purple), and the position of the region (left). "
256
+ ],
257
+ "image_footnote": [],
258
+ "page_idx": 5
259
+ },
260
+ {
261
+ "type": "text",
262
+ "text": "",
263
+ "page_idx": 5
264
+ },
265
+ {
266
+ "type": "text",
267
+ "text": "To improve the capability of GPT4RoI for multi-round conversation and generate more human-like responses, we also involve the LLaVA150k (Liu et al., 2023a) visual instruction dataset in this stage. We employ an off-the-shelf LVIS detector (Fang et al., 2023) to extract up to 100 detection boxes per image. These boxes are then concatenated with the user instructions in the format “<region $\\{ i \\} >$ may feature a class_name”. LLaVA150k significantly improves the capability of GPT4RoI for multi-round conversation . ",
268
+ "page_idx": 5
269
+ },
270
+ {
271
+ "type": "text",
272
+ "text": "After completing this training stage, GPT4RoI is capable of performing complex region understanding tasks based on user instructions, including region caption and reasoning, as demonstrated in Section 4. ",
273
+ "page_idx": 5
274
+ },
275
+ {
276
+ "type": "text",
277
+ "text": "4 DEMOSTRATIONS ",
278
+ "text_level": 1,
279
+ "page_idx": 5
280
+ },
281
+ {
282
+ "type": "text",
283
+ "text": "In this section, we compare the differences between the visual instruction tuning model LLaVA (Liu et al., 2023a) and our spatial instruction tuning model GPT4RoI. We demonstrate our new interactive approach and highlight its advanced capabilities in understanding multimodality. ",
284
+ "page_idx": 5
285
+ },
286
+ {
287
+ "type": "image",
288
+ "img_path": "images/f61e901b88dc84ae13ce172864e82cd3c032d3584696d2be94e390962abae6a0.jpg",
289
+ "image_caption": [
290
+ "Table 3: Instruction template for Stage 2 training data: During training, we randomly select one question for both single and multiple region caption tasks. For reasoning tasks, we modify the original questions to include a reference for each region so that GPT4RoI can mention them in its response. Only the response in red color and stop string ### will be used to calculate the loss. "
291
+ ],
292
+ "image_footnote": [],
293
+ "page_idx": 6
294
+ },
295
+ {
296
+ "type": "image",
297
+ "img_path": "images/03ca81ec9badbcd7dc0cb7181242288b2e7296bc8af19f492c0fb1e16bf6e980.jpg",
298
+ "image_caption": [
299
+ "Figure 4: GPT4RoI and LLaVA dialogue performance showcase. Figures A and C demonstrate the dialogue scenarios of LLaVA when referring to a single instance and multiple instances solely using natural language in the conversation. On the other hand, Figures B and D showcase how GPT4RoI utilizes bounding boxes as references to address the same scenarios. "
300
+ ],
301
+ "image_footnote": [],
302
+ "page_idx": 6
303
+ },
304
+ {
305
+ "type": "text",
306
+ "text": "As shown in Figure 4.A, when we try to make LLaVA focus on the center region of the image, it only sees the boy holding an umbrella and a bag, but it misses the book. As a result, LLaVA gives a wrong answer to the question “What is the boy doing” (Figure 4.A. $\\textcircled{1}$ ), and this leads to an incorrect conclusion that “the boy’s behavior is not dangerous” (Figure 4.A. $\\textcircled{2}$ ). ",
307
+ "page_idx": 6
308
+ },
309
+ {
310
+ "type": "text",
311
+ "text": "",
312
+ "page_idx": 7
313
+ },
314
+ {
315
+ "type": "text",
316
+ "text": "In comparison, as shown in Figure 4.B, our approach GPT4RoI efficiently recognizes visual details using the given bounding box. This allows it to accurately identify the action of “reading a magazine.” Furthermore, GPT4RoI demonstrates its reasoning abilities by correctly inferring that the “boy’s behavior is dangerous”, and giving a reasonable reason that “the boy is reading a book while crossing the street”. ",
317
+ "page_idx": 7
318
+ },
319
+ {
320
+ "type": "text",
321
+ "text": "When there are multiple instances in the image (as depicted in Figure 4.C), we attempt to refer to the corresponding instances as “the right” and “the middle”. However, LLaVA provides incorrect information by stating that the right man is “looking at the women” (as shown in Figure $4 . C . ( \\textcircled { 3 } )$ . Even more concerning, LLaVA overlooks the actual women in the middle and mistakenly associates the women on the left as the reference, resulting in completely inaccurate information (as shown in Figure $4 . C . { \\textcircled {4 } }$ & $\\textcircled{5}$ ). ",
322
+ "page_idx": 7
323
+ },
324
+ {
325
+ "type": "text",
326
+ "text": "In comparison, as shown in Figure 4.D, GPT4RoI is able to understand the user’s requirements, such as identifying the person to call when ordering food, and accurately recognize that the person in region1 fulfills this criterion. Additionally, it correctly recognizes that the person in region3 is “looking at the menu”. Importantly, GPT4RoI can also infer relationships between the provided regions based on visual observations. For example, it deduces that the likely relationship between region2 and region3 is that of a “couple”, providing a reasonable explanation that they “are smiling and enjoying each other’s company”. ",
327
+ "page_idx": 7
328
+ },
329
+ {
330
+ "type": "text",
331
+ "text": "5 QUANTITATIVE RESULTS ",
332
+ "text_level": 1,
333
+ "page_idx": 7
334
+ },
335
+ {
336
+ "type": "text",
337
+ "text": "To quantitatively evaluate GPT4RoI, we have chosen three representative benchmarks to assess the region understanding capabilities. These benchmarks include the region caption task on Visual Genome (Krishna et al., 2017), the region reasoning task on Visual-7W (Zhu et al., 2016), and Visual Commonsense Reasoning (Zellers et al., 2019a) (VCR). In order to minimize the impact of specific dataset label styles and make evaluation metrics easier to calculate, we fine-tuned GPT4RoI on each benchmark using different task prompts. More details can be found in Section A.2 in the Appendix. ",
338
+ "page_idx": 7
339
+ },
340
+ {
341
+ "type": "text",
342
+ "text": "5.1 REGION CAPTION ",
343
+ "text_level": 1,
344
+ "page_idx": 7
345
+ },
346
+ {
347
+ "type": "table",
348
+ "img_path": "images/b46c09772a86df058fbbeafb3da54ad80a6de815ed02d3f0b0ba68acaa8c897c.jpg",
349
+ "table_caption": [
350
+ "We report the scores of BLEU, METEOR, ROUGE, and CIDEr for both GPT4RoI-7B and GPT4RoI13B on the validation set of Visual Genome (Krishna et al., 2017). The grounding box in the annotation is combined with the task prompt in Appendix Table 7 to get the response. "
351
+ ],
352
+ "table_footnote": [],
353
+ "table_body": "<table><tr><td>Model</td><td>BLEU@4</td><td>METEOR</td><td>ROUGE</td><td>CIDEr</td></tr><tr><td>GRiT (Wu et al., 2022)</td><td></td><td>17.1</td><td>1</td><td>142.0</td></tr><tr><td>GPT4RoI-7B</td><td>11.5</td><td>17.4</td><td>35.0</td><td>145.2</td></tr><tr><td>GPT4RoI-13B</td><td>11.7</td><td>17.6</td><td>35.2</td><td>146.8</td></tr></table>",
354
+ "page_idx": 7
355
+ },
356
+ {
357
+ "type": "text",
358
+ "text": "Table 4: Compariation of region caption ability on the validation dataset on Visual Genome. All methods employ ground truth bounding boxes and GPT4RoI can outperform previous state-of-the-art specialist GRiT. ",
359
+ "page_idx": 7
360
+ },
361
+ {
362
+ "type": "text",
363
+ "text": "The generalist approach GPT4RoI outperforms the previous state-of-the-art specialist model GRiT (Wu et al., 2022) by a significant margin, without any additional techniques or tricks. Additionally, we observe that the performance of GPT4RoI-7B and GPT4RoI-13B is comparable, suggesting that the bottleneck in performance lies in the design of the visual module and the availability of region-text pair data. These areas can be explored further in future work. ",
364
+ "page_idx": 7
365
+ },
366
+ {
367
+ "type": "text",
368
+ "text": "5.2 VISUAL-7W ",
369
+ "text_level": 1,
370
+ "page_idx": 7
371
+ },
372
+ {
373
+ "type": "text",
374
+ "text": "Visual-7W (Zhu et al., 2016) is a PointQA dataset that contains a which box setting. Here, the model is required to choose the appropriate box among four options, based on a given description. For example, a question might ask, “Which is the black machine under the sign?”. This type of question not only tests the model’s object recognition but also its ability to determine the relationship between objects. ",
375
+ "page_idx": 7
376
+ },
377
+ {
378
+ "type": "text",
379
+ "text": "",
380
+ "page_idx": 8
381
+ },
382
+ {
383
+ "type": "text",
384
+ "text": "To prevent information leakage, we remove overlapping images with the test set from Visual Genome (Krishna et al., 2017). The results clearly demonstrate that the 13B model outperforms the 7B model by a significant margin. This finding suggests that the reasoning ability heavily relies on the Large Language Model (LLM). ",
385
+ "page_idx": 8
386
+ },
387
+ {
388
+ "type": "table",
389
+ "img_path": "images/a696471da44b3273c81efecf1bd29ee751bca68d6496a363e5126178cab8a547.jpg",
390
+ "table_caption": [
391
+ "Table 5: Accuracy on Visual-7W test dataset. "
392
+ ],
393
+ "table_footnote": [],
394
+ "table_body": "<table><tr><td>Model</td><td>LSTM-Att (Zhu et al., 2016)</td><td>CMNs (Hu et al., 2016)</td><td>12in1 (Lu et al., 2020)</td><td>GPT4RoI-7B</td><td>GPT4RoI-13B</td></tr><tr><td>Acc(%)</td><td>56.10</td><td>72.53</td><td>83.35</td><td>81.83</td><td>84.82</td></tr></table>",
395
+ "page_idx": 8
396
+ },
397
+ {
398
+ "type": "text",
399
+ "text": "5.3 VISUAL COMMONSENSE REASONING ",
400
+ "text_level": 1,
401
+ "page_idx": 8
402
+ },
403
+ {
404
+ "type": "text",
405
+ "text": "Visual Commonsense Reasoning (VCR) offers a highly demanding scenario that necessitates advanced reasoning abilities, heavily relying on common sense. Given the question(Q), the model’s task is not only to select the correct answer(A) but also to select a rationale(R) that explains why the chosen answer is true. We give a more detailed explanation of each metric in our appendix ",
406
+ "page_idx": 8
407
+ },
408
+ {
409
+ "type": "table",
410
+ "img_path": "images/dc42fd26efe07f58b489fc88d13c2ab884baeead11e11a431e8c6d0dd61034e4.jpg",
411
+ "table_caption": [
412
+ "Table 6: Accuracy scores on VCR. GPT4RoI achieves state-of-the-art accuracy among all methods. "
413
+ ],
414
+ "table_footnote": [],
415
+ "table_body": "<table><tr><td rowspan=\"2\">Model</td><td rowspan=\"2\">Open Source</td><td rowspan=\"2\">Parameters</td><td colspan=\"3\">Val Acc.(%)</td><td colspan=\"3\">Test Acc.(%)</td></tr><tr><td>Q→A</td><td>QA→R</td><td>Q→AR</td><td>Q→A</td><td>QA→R</td><td>Q→AR</td></tr><tr><td>ViLBERT (Lu et al., 2019)</td><td></td><td>221M</td><td>72.4</td><td>74.5</td><td>54.0</td><td>73.3</td><td>74.6</td><td>54.8</td></tr><tr><td>Unicoder-VL (Li et al.,2019a)</td><td></td><td></td><td>72.6</td><td>74.5</td><td>54.5</td><td>73.4</td><td>74.4</td><td>54.9</td></tr><tr><td>VLBERT-L (Su et al.,2019)</td><td>YYYYYYYY</td><td>383M</td><td>75.5</td><td>77.9</td><td>58.9</td><td>75.8</td><td>78.4</td><td>59.7</td></tr><tr><td>UNITER-L(Chen et al.,2020)</td><td></td><td>303M</td><td>=</td><td></td><td></td><td>77.3</td><td>80.8</td><td>62.8</td></tr><tr><td>ERNIE-ViL-L (Yu et al., 2021)</td><td></td><td></td><td>78.52</td><td>83.37</td><td>65.81</td><td>79.2</td><td>83.5</td><td>66.3</td></tr><tr><td>MERLOT (Zellers et al., 2021)</td><td></td><td>223M</td><td>=</td><td>=</td><td>=</td><td>80.6</td><td>80.4</td><td>65.1</td></tr><tr><td>VILLA-L (Gan et al.,2020)</td><td></td><td></td><td>78.45</td><td>82.57</td><td>65.18</td><td>78.9</td><td>82.8</td><td>65.7</td></tr><tr><td>RESERVE-L (Zellers et al., 2022)</td><td>YY</td><td>644M</td><td>-</td><td>-</td><td>=</td><td>84.0</td><td>84.9</td><td>72.0</td></tr><tr><td>VQA-GNN-L (Wang et al., 2022)</td><td></td><td>1B+</td><td>-</td><td>-</td><td></td><td>85.2</td><td>86.6</td><td>74.0</td></tr><tr><td>GPT4RoI-7B</td><td>Y</td><td>7B+</td><td>87.4</td><td>89.6</td><td>78.6</td><td>-</td><td>-</td><td>-</td></tr><tr><td>VLUA+@ Kuaishou</td><td>N</td><td></td><td>/</td><td>-</td><td></td><td>84.8</td><td>87.0</td><td>74.0</td></tr><tr><td>KS-MGSR @KDDI Research and SNAP</td><td>N</td><td></td><td></td><td>=</td><td>=</td><td>85.3</td><td>86.9</td><td>74.3</td></tr><tr><td>SP-VCR @Shopee</td><td>N</td><td></td><td></td><td></td><td></td><td>83.6</td><td>88.6</td><td>74.4</td></tr><tr><td>HunYuan-VCR@Tencent</td><td>N</td><td></td><td></td><td></td><td></td><td>85.8</td><td>88.0</td><td>75.6</td></tr><tr><td>Human Performance (Zellers et al., 2019a)</td><td>-</td><td></td><td></td><td>=</td><td></td><td>91.0</td><td>93.0</td><td>85.0</td></tr><tr><td>GPT4RoI-13B</td><td>Y</td><td>13B+</td><td></td><td>=</td><td></td><td>89.4</td><td>91.0</td><td>81.6</td></tr></table>",
416
+ "page_idx": 8
417
+ },
418
+ {
419
+ "type": "text",
420
+ "text": "GPT4RoI shows significant improvements over the previous methods across all $Q A$ , $Q A R$ , and $Q A R$ tasks. Notably, in the crucial $Q A R$ task, GPT4RoI-13B achieves a performance of 81.6 accuracy, surpassing preceding methods by over 6 points, even outperforming confidential company-level results, which may take advantage of private data. Our totally open-source pipeline can make GPT4RoI a solid baseline. More importantly, this performance is almost reaching human-level performance of 85.0 accuracy, which shows that the multimodal ability of GPT4RoI is promising to be further developed to human intelligence. Furthermore, comparing GPT4RoI to previous methods, particularly observing the size of the language model used, also demonstrates the significant benefits of the Large Language Model (LLM) for visual reasoning tasks. ",
421
+ "page_idx": 8
422
+ },
423
+ {
424
+ "type": "text",
425
+ "text": "6 CONCLUSIONS ",
426
+ "text_level": 1,
427
+ "page_idx": 8
428
+ },
429
+ {
430
+ "type": "text",
431
+ "text": "In this paper, we present GPT4RoI, an end-to-end vision-language model that can execute user instructions to achieve region-level image understanding. Our approach employs spatial instruction tuning for the large language model (LLM), where we convert the reference to bounding boxes from user instructions into region features. These region features, along with language embeddings, are combined to create an input sequence for the large language model. By utilizing existing open-source region-text pair datasets, we show that GPT4RoI enhances user interaction by accurately referring to regions and achieves impressive performance in region-level image understanding tasks. ",
432
+ "page_idx": 8
433
+ },
434
+ {
435
+ "type": "text",
436
+ "text": "REFERENCES ",
437
+ "text_level": 1,
438
+ "page_idx": 9
439
+ },
440
+ {
441
+ "type": "text",
442
+ "text": "Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katherine Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. Advances in Neural Information Processing Systems, 35:23716– 23736, 2022. 3 ",
443
+ "page_idx": 9
444
+ },
445
+ {
446
+ "type": "text",
447
+ "text": "Anonymous. Ins-detCLIP: Aligning detection model to follow human-language instruction. In Submitted to The Twelfth International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id ${ \\bf \\Phi } = { \\bf \\Phi }$ M0MF4t3hE9. under review. 18 \nAnthropic. Claude. https://www.anthropic.com/index/introducing-claude, 2023. 1 \nTom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. 3 \nSébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023. 3 \nNicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision, pp. 213–229. Springer, 2020. 3 \nSoravit 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 Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3558–3568, 2021. 2 \nChi Chen, Ruoyu Qin, Fuwen Luo, Xiaoyue Mi, Peng Li, Maosong Sun, and Yang Liu. Positionenhanced visual instruction tuning for multimodal large language models. arXiv preprint arXiv:2308.13437, 2023a. 18 \nKeqin Chen, Zhao Zhang, Weili Zeng, Richong Zhang, Feng Zhu, and Rui Zhao. Shikra: Unleashing multimodal llm’s referential dialogue magic. arXiv preprint arXiv:2306.15195, 2023b. 18 \nTing 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. 18 \nTing Chen, Saurabh Saxena, Lala Li, Tsung-Yi Lin, David J Fleet, and Geoffrey E Hinton. A unified sequence interface for vision tasks. Advances in Neural Information Processing Systems, 35: 31333–31346, 2022. 18 \nXinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015. 2 \nYen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. Uniter: Universal image-text representation learning, 2020. 9 \nWei-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/. 1, 4 \nAakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022. 3 \nHyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi ",
448
+ "page_idx": 9
449
+ },
450
+ {
451
+ "type": "text",
452
+ "text": "Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language models. arXiv preprint arXiv:2210.11416, 2022. 3 ",
453
+ "page_idx": 9
454
+ },
455
+ {
456
+ "type": "text",
457
+ "text": "Wenliang Dai, Junnan Li, Dongxu Li, Anthony Meng Huat Tiong, Junqi Zhao, Weisheng Wang, Boyang Li, Pascale Fung, and Steven Hoi. Instructblip: Towards general-purpose vision-language models with instruction tuning, 2023. 2, 3 \nJacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. 3 \nDanny Driess, Fei Xia, Mehdi SM Sajjadi, Corey Lynch, Aakanksha Chowdhery, Brian Ichter, Ayzaan Wahid, Jonathan Tompson, Quan Vuong, Tianhe Yu, et al. Palm-e: An embodied multimodal language model. arXiv preprint arXiv:2303.03378, 2023. 1 \nZhengxiao Du, Yujie Qian, Xiao Liu, Ming Ding, Jiezhong Qiu, Zhilin Yang, and Jie Tang. Glm: General language model pretraining with autoregressive blank infilling. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 320–335, 2022. 1 \nYuxin Fang, Quan Sun, Xinggang Wang, Tiejun Huang, Xinlong Wang, and Yue Cao. Eva-02: A visual representation for neon genesis. arXiv preprint arXiv:2303.11331, 2023. 6 \nZhe Gan, Yen-Chun Chen, Linjie Li, Chen Zhu, Yu Cheng, and Jingjing Liu. Large-scale adversarial training for vision-and-language representation learning, 2020. 9 \nRohit Girdhar, Alaaeldin El-Nouby, Zhuang Liu, Mannat Singh, Kalyan Vasudev Alwala, Armand Joulin, and Ishan Misra. Imagebind: One embedding space to bind them all. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15180–15190, 2023. 1 \nTao Gong, Chengqi Lyu, Shilong Zhang, Yudong Wang, Miao Zheng, Qian Zhao, Kuikun Liu, Wenwei Zhang, Ping Luo, and Kai Chen. Multimodal-gpt: A vision and language model for dialogue with humans, 2023. 3 \nGoogle. Bard. https://bard.google.com/, 2023. 1 \nKaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In Proceedings of the IEEE international conference on computer vision, pp. 2961–2969, 2017. 2, 5 \nRonghang Hu, Marcus Rohrbach, Jacob Andreas, Trevor Darrell, and Kate Saenko. Modeling relationships in referential expressions with compositional modular networks, 2016. 9 \nShaohan 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, 2023. 1 \nJustin Johnson, Andrej Karpathy, and Li Fei-Fei. Densecap: Fully convolutional localization networks for dense captioning, 2015. 4 \nAishwarya Kamath, Mannat Singh, Yann LeCun, Gabriel Synnaeve, Ishan Misra, and Nicolas Carion. Mdetr – modulated detection for end-to-end multi-modal understanding, 2021. 4 \nRanjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, et al. Visual genome: Connecting language and vision using crowdsourced dense image annotations. International journal of computer vision, 123:32–73, 2017. 2, 3, 6, 8, 9, 16 \nFeng Li, Hao Zhang, Huaizhe Xu, Shilong Liu, Lei Zhang, Lionel M Ni, and Heung-Yeung Shum. Mask dino: Towards a unified transformer-based framework for object detection and segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3041–3050, 2023a. 18 \nGen Li, Nan Duan, Yuejian Fang, Ming Gong, Daxin Jiang, and Ming Zhou. Unicoder-vl: A universal encoder for vision and language by cross-modal pre-training, 2019a. 9 \nKunChang 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, 2023b. 3 \nLiunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. Visualbert: A simple and performant baseline for vision and language, 2019b. 4 \nLiunian Harold $\\mathrm { L i ^ { * } }$ , Pengchuan Zhang\\*, Haotian Zhang\\*, Jianwei Yang, Chunyuan Li, Yiwu Zhong, Lijuan Wang, Lu Yuan, Lei Zhang, Jenq-Neng Hwang, Kai-Wei Chang, and Jianfeng Gao. Grounded language-image pre-training. In CVPR, 2022. 4 \nYikang Li, Wanli Ouyang, Bolei Zhou, Kun Wang, and Xiaogang Wang. Scene graph generation from objects, phrases and region captions, 2017. 4 \nTsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In Computer Vision– ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V 13, pp. 740–755. Springer, 2014. 2, 5 \nTsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2117–2125, 2017. 4 \nHaotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. arXiv preprint arXiv:2304.08485, 2023a. 2, 3, 4, 5, 6 \nRosanne Liu, Joel Lehman, Piero Molino, Felipe Petroski Such, Eric Frank, Alex Sergeev, and Jason Yosinski. An intriguing failing of convolutional neural networks and the coordconv solution, 2018a. 5 \nShilong Liu, Zhaoyang Zeng, Tianhe Ren, Feng Li, Hao Zhang, Jie Yang, Chunyuan Li, Jianwei Yang, Hang Su, Jun Zhu, and Lei Zhang. Grounding dino: Marrying dino with grounded pre-training for open-set object detection, 2023b. 4 \nShu Liu, Lu Qi, Haifang Qin, Jianping Shi, and Jiaya Jia. Path aggregation network for instance segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8759–8768, 2018b. 5 \nYuan Liu, Haodong Duan, Yuanhan Zhang, Bo Li, Songyang Zhang, Wangbo Zhao, Yike Yuan, Jiaqi Wang, Conghui He, Ziwei Liu, et al. Mmbench: Is your multi-modal model an all-around player? arXiv preprint arXiv:2307.06281, 2023c. 3 \nZhaoyang 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, 2023d. 2, 3 \nJiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks, 2019. 9 \nJiasen Lu, Vedanuj Goswami, Marcus Rohrbach, Devi Parikh, and Stefan Lee. 12-in-1: Multi-task vision and language representation learning, 2020. 9 \nJunhua Mao, Jonathan Huang, Alexander Toshev, Oana Camburu, Alan L Yuille, and Kevin Murphy. Generation and comprehension of unambiguous object descriptions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 11–20, 2016. 2, 6 \nYao Mu, Qinglong Zhang, Mengkang Hu, Wenhai Wang, Mingyu Ding, Jun Jin, Bin Wang, Jifeng Dai, Yu Qiao, and Ping Luo. Embodiedgpt: Vision-language pre-training via embodied chain of thought. arXiv preprint arXiv:2305.15021, 2023. 3 \nOpenAI. Chatgpt. https://openai.com/blog/chatgpt, 2022. 1, 3 \nOpenAI. Gpt-4 technical report, 2023. 1 ",
458
+ "page_idx": 10
459
+ },
460
+ {
461
+ "type": "text",
462
+ "text": "",
463
+ "page_idx": 11
464
+ },
465
+ {
466
+ "type": "text",
467
+ "text": "Vicente Ordonez, Girish Kulkarni, and Tamara Berg. Im2text: Describing images using 1 million captioned photographs. Advances in neural information processing systems, 24, 2011. 2 ",
468
+ "page_idx": 11
469
+ },
470
+ {
471
+ "type": "text",
472
+ "text": "Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35: 27730–27744, 2022. 3 \nRenjie Pi, Jiahui Gao, Shizhe Diao, Rui Pan, Hanze Dong, Jipeng Zhang, Lewei Yao, Jianhua Han, Hang Xu, and Lingpeng Kong Tong Zhang. Detgpt: Detect what you need via reasoning. arXiv \npreprint arXiv:2305.14167, 2023. 2 \nBryan A Plummer, Liwei Wang, Chris M Cervantes, Juan C Caicedo, Julia Hockenmaier, and Svetlana Lazebnik. Flickr30k entities: Collecting region-to-phrase correspondences for richer image-to-sentence models. In Proceedings of the IEEE international conference on computer vision, pp. 2641–2649, 2015. 2, 6 \nAlec Radford, Karthik Narasimhan, Tim Salimans, Ilya Sutskever, et al. Improving language understanding by generative pre-training. OpenAI, 2018. 3 \nAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pp. 8748–8763. PMLR, 2021. 4 \nColin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. The Journal of Machine Learning Research, 21(1):5485–5551, 2020. 3 \nHanoona Rasheed, Muhammad Maaz, Sahal Shaji, Abdelrahman Shaker, Salman Khan, Hisham Cholakkal, Rao M Anwer, Erix Xing, Ming-Hsuan Yang, and Fahad S Khan. Glamm: Pixel grounding large multimodal model. arXiv preprint arXiv:2311.03356, 2023. 18 \nShaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. Advances in neural information processing systems, 28: 91–99, 2015. 3, 18 \nChristoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-400m: Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint arXiv:2111.02114, 2021. 2 \nShuai Shao, Zeming Li, Tianyuan Zhang, Chao Peng, Gang Yu, Xiangyu Zhang, Jing Li, and Jian Sun. Objects365: A large-scale, high-quality dataset for object detection. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 8429–8438, 2019. doi: 10.1109/ICCV. 2019.00852. 18 \nPiyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th \nAnnual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2556–2565, 2018. 2 \nWeijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. Vl-bert: Pre-training of generic visual-linguistic representations. arXiv preprint arXiv:1908.08530, 2019. 4, 9 \nTianxiang Sun and Qiu Xipeng. Moss. https://github.com/OpenLMLab/MOSS, 2022. 1 \nDídac Surís, Sachit Menon, and Carl Vondrick. Vipergpt: Visual inference via python execution for \nreasoning. arXiv preprint arXiv:2303.08128, 2023. 3 \nKaihua Tang, Hanwang Zhang, Baoyuan Wu, Wenhan Luo, and Wei Liu. Learning to compose dynamic tree structures for visual contexts, 2018. 4 \nRohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. ",
473
+ "page_idx": 12
474
+ },
475
+ {
476
+ "type": "text",
477
+ "text": "https://github.com/tatsu-lab/stanford_alpaca, 2023. 1 ",
478
+ "page_idx": 12
479
+ },
480
+ {
481
+ "type": "text",
482
+ "text": "Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023a. 1, 4 \nHugo 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. 1 \nTeng Wang, Jinrui Zhang, Junjie Fei, Yixiao Ge, Hao Zheng, Yunlong Tang, Zhe Li, Mingqi Gao, Shanshan Zhao, Ying Shan, et al. Caption anything: Interactive image description with diverse multimodal controls. arXiv preprint arXiv:2305.02677, 2023a. 2 \nWenhai 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, 2023b. 2 \nXinlong Wang, Tao Kong, Chunhua Shen, Yuning Jiang, and Lei Li. Solo: Segmenting objects by locations. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XVIII 16, pp. 649–665. Springer, 2020. 5 \nYanan Wang, Michihiro Yasunaga, Hongyu Ren, Shinya Wada, and Jure Leskovec. Vqa-gnn: Reasoning with multimodal semantic graph for visual question answering, 2022. 9 \nChenfei Wu, Shengming Yin, Weizhen Qi, Xiaodong Wang, Zecheng Tang, and Nan Duan. Visual chatgpt: Talking, drawing and editing with visual foundation models. arXiv preprint arXiv:2303.04671, 2023. 2, 3 \nJialian Wu, Jianfeng Wang, Zhengyuan Yang, Zhe Gan, Zicheng Liu, Junsong Yuan, and Lijuan Wang. Grit: A generative region-to-text transformer for object understanding, 2022. 4, 8 \nPeng Xu, Wenqi Shao, Kaipeng Zhang, Peng Gao, Shuo Liu, Meng Lei, Fanqing Meng, Siyuan Huang, Yu Qiao, and Ping Luo. Lvlm-ehub: A comprehensive evaluation benchmark for large vision-language models, 2023. 3 \nJiange Yang, Wenhui Tan, Chuhao Jin, Bei Liu, Jianlong Fu, Ruihua Song, and Limin Wang. Pave the way to grasp anything: Transferring foundation models for universal pick-place robots. arXiv preprint arXiv:2306.05716, 2023a. 3 \nJingkang Yang, Yi Zhe Ang, Zujin Guo, Kaiyang Zhou, Wayne Zhang, and Ziwei Liu. Panoptic scene graph generation, 2022. 4 \nLinjie Yang, Kevin Tang, Jianchao Yang, and Li-Jia Li. Dense captioning with joint inference and visual context. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Jul 2017. 4 \nZhengyuan Yang, Linjie Li, Kevin Lin, Jianfeng Wang, Chung-Ching Lin, Zicheng Liu, and Lijuan Wang. The dawn of lmms: Preliminary explorations with gpt-4v (ision). arXiv preprint arXiv:2309.17421, 9, 2023b. 18 \nZhengyuan Yang, Linjie Li, Jianfeng Wang, Kevin Lin, Ehsan Azarnasab, Faisal Ahmed, Zicheng Liu, Ce Liu, Michael Zeng, and Lijuan Wang. Mm-react: Prompting chatgpt for multimodal reasoning and action. arXiv preprint arXiv:2303.11381, 2023c. 1, 2, 3 \nYuan Yao, Qianyu Chen, Ao Zhang, Wei Ji, Zhiyuan Liu, Tat-Seng Chua, and Maosong Sun. Pevl: Position-enhanced pre-training and prompt tuning for vision-language models. arXiv preprint arXiv:2205.11169, 2022. 4 \nHaoxuan You, Haotian Zhang, Zhe Gan, Xianzhi Du, Bowen Zhang, Zirui Wang, Liangliang Cao, Shih-Fu Chang, and Yinfei Yang. Ferret: Refer and ground anything anywhere at any granularity. arXiv preprint arXiv:2310.07704, 2023. 18 \nFei Yu, Jiji Tang, Weichong Yin, Yu Sun, Hao Tian, Hua Wu, and Haifeng Wang. Ernie-vil: Knowledge enhanced vision-language representations through scene graph, 2021. 4, 9 \nLicheng Yu, Patrick Poirson, Shan Yang, Alexander C Berg, and Tamara L Berg. Modeling context in referring expressions. In Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part II 14, pp. 69–85. Springer, 2016. 2, 5 \nYuhang Zang, Wei Li, Jun Han, Kaiyang Zhou, and Chen Change Loy. Contextual object detection with multimodal large language models, 2023. 3 \nRowan Zellers, Yonatan Bisk, Ali Farhadi, and Yejin Choi. From recognition to cognition: Visual commonsense reasoning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 6720–6731, 2019a. 2, 3, 6, 8, 9, 16 \nRowan Zellers, Yonatan Bisk, Ali Farhadi, and Yejin Choi. From recognition to cognition: Visual commonsense reasoning. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019b. 4, 17 \nRowan Zellers, Ximing Lu, Jack Hessel, Youngjae Yu, Jae Sung Park, Jize Cao, Ali Farhadi, and Yejin Choi. Merlot: Multimodal neural script knowledge models. In Advances in Neural Information Processing Systems 34, 2021. 9 \nRowan Zellers, Jiasen Lu, Ximing Lu, Youngjae Yu, Yanpeng Zhao, Mohammadreza Salehi, Aditya Kusupati, Jack Hessel, Ali Farhadi, and Yejin Choi. Merlot reserve: Multimodal neural script knowledge through vision and language and sound. In CVPR, 2022. 9 \nAo Zhang, Hao Fei, Yuan Yao, Wei Ji, Li Li, Zhiyuan Liu, and Tat-Seng Chua. Transfer visual prompt generator across llms. arXiv preprint arXiv:2305.01278, 2023a. 3 \nAo Zhang, Liming Zhao, Chen-Wei Xie, Yun Zheng, Wei Ji, and Tat-Seng Chua. Next-chat: An lmm for chat, detection and segmentation. arXiv preprint arXiv:2311.04498, 2023b. 18 \nHao Zhang, Feng Li, Shilong Liu, Lei Zhang, Hang Su, Jun Zhu, Lionel M Ni, and Heung-Yeung Shum. Dino: Detr with improved denoising anchor boxes for end-to-end object detection. arXiv preprint arXiv:2203.03605, 2022. 18 \nRenrui Zhang, Jiaming Han, Aojun Zhou, Xiangfei Hu, Shilin Yan, Pan Lu, Hongsheng Li, Peng Gao, and Yu Qiao. Llama-adapter: Efficient fine-tuning of language models with zero-init attention. arXiv preprint arXiv:2303.16199, 2023c. 2, 3 \nShilong Zhang, Xinjiang Wang, Jiaqi Wang, Jiangmiao Pang, Chengqi Lyu, Wenwei Zhang, Ping Luo, and Kai Chen. Dense distinct query for end-to-end object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 7329–7338, June 2023d. 5, 18 \nLiang Zhao, En Yu, Zheng Ge, Jinrong Yang, Haoran Wei, Hongyu Zhou, Jianjian Sun, Yuang Peng, Runpei Dong, Chunrui Han, et al. Chatspot: Bootstrapping multimodal llms via precise referring instruction tuning. arXiv preprint arXiv:2307.09474, 2023. 18 \nLianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric. P Xing, Hao Zhang, Joseph E. Gonzalez, and Ion Stoica. Judging llm-as-a-judge with mt-bench and chatbot arena, 2023. 4 \nXingyi Zhou, Rohit Girdhar, Armand Joulin, Philipp Krähenbühl, and Ishan Misra. Detecting twenty-thousand classes using image-level supervision. In ECCV, 2022. 4 \nDeyao 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, 2023. 2, 3, 4, 5 \nXizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv preprint arXiv:2010.04159, 2020. 2, 3 \nYuke Zhu, Oliver Groth, Michael Bernstein, and Li Fei-Fei. Visual7w: Grounded question answering in images, 2016. 3, 8, 9, 16 ",
483
+ "page_idx": 13
484
+ },
485
+ {
486
+ "type": "text",
487
+ "text": "",
488
+ "page_idx": 14
489
+ },
490
+ {
491
+ "type": "text",
492
+ "text": "A APPENDIX ",
493
+ "text_level": 1,
494
+ "page_idx": 15
495
+ },
496
+ {
497
+ "type": "text",
498
+ "text": "In this appendix, we provide a detailed method architecture figure. We then discuss training-related details, including hyperparameters and instruction templates used in each stage and task. Specifically, we give an introduction for VCR dataset and describe how we utilize the VCR dataset. We also compare the design philosophy with methods using textual coordinates in LLM and provide a brief overview of concurrent works . Finally, we analyze some error cases and propose potential improvements for future exploration. ",
499
+ "page_idx": 15
500
+ },
501
+ {
502
+ "type": "text",
503
+ "text": "A.1 DETAILED ARCHITECTURE ",
504
+ "text_level": 1,
505
+ "page_idx": 15
506
+ },
507
+ {
508
+ "type": "image",
509
+ "img_path": "images/35283ad6118f8c8045a4fb554b64b918f110aa25302dc03727db63e65f836e2f.jpg",
510
+ "image_caption": [
511
+ "Figure 5: A more detailed framework of GPT4RoI. "
512
+ ],
513
+ "image_footnote": [],
514
+ "page_idx": 15
515
+ },
516
+ {
517
+ "type": "text",
518
+ "text": "Here is a more detailed framework of our approach, GPT4RoI. ",
519
+ "page_idx": 15
520
+ },
521
+ {
522
+ "type": "text",
523
+ "text": "1. We preprocess the input text by adding prefixes to retain both image information and pure text references for each region. \n2. Next, we tokenize and embed the text. The image feature and region features will replace the placeholders <image> and ${ < r e g i o n \\mathord { \\left/ { \\vphantom { < r e g i o n \\left/ { i } \\right.} \\kern - delimiterspace } \\right.} \\kern - delimiterspace } >$ respectively. \n3. The resulting interleaved sequence of region $\\&$ image features and language embeddings is then fed into a large language model (LLM) for further processing. ",
524
+ "page_idx": 15
525
+ },
526
+ {
527
+ "type": "text",
528
+ "text": "A.2 TRAINING DETAILS ",
529
+ "text_level": 1,
530
+ "page_idx": 15
531
+ },
532
+ {
533
+ "type": "text",
534
+ "text": "Dialogue model The dialogue model in the demo is trained on 8 GPUs, each with 80G of memory. During the first training stage, a learning rate of 2e-5 is used with a cosine learning schedule. The batch size is 16 for 2 epochs, with a warm-up iteration set to 3000 and a warm-up ratio of 0.003. The weight decay for all modules was set to 0. During the second training stage, the learning rate is reduced to 2e-5 and the model is trained for 1 epoch. To enable end-to-end fine-tuning of the model, which includes a 7B Vicuna, Fully Sharded Data Parallel (FSDP) is enabled in PyTorch to save memory. ",
535
+ "page_idx": 15
536
+ },
537
+ {
538
+ "type": "text",
539
+ "text": "Downstream tasks We finetune on three datasets with different learning schedules and task prompts (as shown in Table 7). For the region caption task on Visual Genome (Krishna et al., 2017), we perform fine-tuning for 4 epochs with a learning rate of 2e-5. As for Visual-7W (Zhu et al., 2016), we observe that it requires a smaller learning rate of 1e-6 to stabilize the training, which is also trained in 2 epochs. On the Visual Commonsense Reasoning (Zellers et al., 2019a), we fine-tune the model for 1 epoch using a learning rate of 2e-5. ",
540
+ "page_idx": 15
541
+ },
542
+ {
543
+ "type": "text",
544
+ "text": "Instruction of three downstream tasks. The instructions for three downstream tasks are provided in Table 7. ",
545
+ "page_idx": 15
546
+ },
547
+ {
548
+ "type": "text",
549
+ "text": "Region Caption Task on Visual Genome ",
550
+ "text_level": 1,
551
+ "page_idx": 16
552
+ },
553
+ {
554
+ "type": "text",
555
+ "text": "### Question: Can you give a description of the region mentioned by <region> ### Answer: A man wearing a light blue t-shirt and jeans with his arms extended ",
556
+ "page_idx": 16
557
+ },
558
+ {
559
+ "type": "text",
560
+ "text": "Region Reasoning Task on Visual-7W ",
561
+ "text_level": 1,
562
+ "page_idx": 16
563
+ },
564
+ {
565
+ "type": "text",
566
+ "text": "### Question: <region1>,<region2>,<region3>,<region4> refers to specific areas within the photo along with their respective identifiers. I need you to answer the question. Questions are multiplechoice; you only need to pick the correct answer from the given options (A), (B), (C), or (D). Which is the black machine under the sign? ",
567
+ "page_idx": 16
568
+ },
569
+ {
570
+ "type": "text",
571
+ "text": "### Answer: (A) ",
572
+ "page_idx": 16
573
+ },
574
+ {
575
+ "type": "text",
576
+ "text": "Region Reasoning Task on VCR ",
577
+ "text_level": 1,
578
+ "page_idx": 16
579
+ },
580
+ {
581
+ "type": "text",
582
+ "text": "$\\mathbf Q \\to \\mathbf A$ ",
583
+ "page_idx": 16
584
+ },
585
+ {
586
+ "type": "text",
587
+ "text": "### Question: <region1>,<region2>,<region3>... refers to specific areas within the photo along with their respective identifiers. I need you to answer the question. Questions are multiple-choice; you only need to pick the correct answer from the given options (A), (B), (C), or (D). ",
588
+ "page_idx": 16
589
+ },
590
+ {
591
+ "type": "text",
592
+ "text": "How is 1 feeling ? (A),1 is feeling amused . (B),1 is upset and disgusted . (C),1 is feeling very scared . (D),1 is feeling uncomfortable with 3 ",
593
+ "page_idx": 16
594
+ },
595
+ {
596
+ "type": "text",
597
+ "text": "### Answer: (C) ",
598
+ "page_idx": 16
599
+ },
600
+ {
601
+ "type": "text",
602
+ "text": "$\\mathbf { Q A } \\to \\mathbf { R }$ ",
603
+ "page_idx": 16
604
+ },
605
+ {
606
+ "type": "text",
607
+ "text": "### Question: <region1>,<region2>,<region $3 > .$ ... refers to specific areas within the photo along with their respective identifiers. I give you a question and its answer, I need you to provide a rationale explaining why the answer is right. Both questions are multiple-choice; you only need to pick the correct answer from the given options (A), (B), (C), or (D). ",
608
+ "page_idx": 16
609
+ },
610
+ {
611
+ "type": "text",
612
+ "text": "\"How is 1 feeling ?\" The answer is \"1 is feeling very scared.\" What’s the rationale for this decision? (A),1’s face has wide eyes and an open mouth . \n(B),When people have their mouth back like that and their eyebrows lowered they are usually disgusted by what they see . \n(C),3,2,1 are seated at a dining table where food would be served to them . people unaccustomed to odd or foreign dishes may make disgusted looks at the thought of eating it . \n(D),1’s expression is twisted in disgust . ",
613
+ "page_idx": 16
614
+ },
615
+ {
616
+ "type": "text",
617
+ "text": "### Answer: (A) ",
618
+ "page_idx": 16
619
+ },
620
+ {
621
+ "type": "text",
622
+ "text": "Table 7: Task prompt of three downstream tasks. ",
623
+ "page_idx": 16
624
+ },
625
+ {
626
+ "type": "text",
627
+ "text": "Instruction of Single-Region Caption The instructions for single-region caption are provided in Table 8. We randomly select one as the question in training. ",
628
+ "page_idx": 16
629
+ },
630
+ {
631
+ "type": "text",
632
+ "text": "Instruction of Multi-Region Caption The instructions for multi-region caption are provided in Table 9. We randomly select one as the question in training. ",
633
+ "page_idx": 16
634
+ },
635
+ {
636
+ "type": "text",
637
+ "text": "A.3 VCR ",
638
+ "text_level": 1,
639
+ "page_idx": 16
640
+ },
641
+ {
642
+ "type": "text",
643
+ "text": "Introduction to the VCR Dataset The Visual Commonsense Reasoning(VCR) dataset (Zellers et al., 2019b), comprises 290,000 multiple-choice questions obtained from 110,000 movie scenes. Each image in the dataset is annotated with a question that requires common-sense reasoning, along with its corresponding answer and the explanation for the answer. VCR is a particularly challenging dataset for comprehension and reasoning. It has gained attention from several wellknown organizations, who have submitted their solutions on the leaderboard. The dataset’s distinctive challenge is that a model not only needs to answer complex visual questions but also provide a rationale for why its answer is correct. The VCR task consists of two sub-tasks: Question Answering $\\mathrm { ( Q \\to A ) }$ ) and Answer Justification (QA R). In the Q→A setup, a model is given a question and must select the correct answer from four choices. In the QA- ${ \\mathrm { . > R } }$ setup, a model is provided with a question and the correct answer, and it needs to justify the answer by selecting the most appropriate rationale from four choices. The performance of models is evaluated using the $\\mathrm { Q } \\to \\mathrm { A R }$ metric, where accuracy is measured as the percentage of correctly answered questions along with the correct rationale. ",
644
+ "page_idx": 16
645
+ },
646
+ {
647
+ "type": "text",
648
+ "text": "",
649
+ "page_idx": 17
650
+ },
651
+ {
652
+ "type": "text",
653
+ "text": "Preprocess of VCR To construct a sequence of questions, we convert the explanation to a follow-up question and format them into a two-round conversation. Table 10 shows an example of the follow-up question that asks for the reasoning behind the answer. ",
654
+ "page_idx": 17
655
+ },
656
+ {
657
+ "type": "text",
658
+ "text": "The VCR dataset is valued for its diverse question-answer pairs that require referencing from prior question-answers to perform reasoning. Therefore, it’s crucial to assign a reference to each region in the dataset. We accomplish this by starting each conversation with a reference to all regions, e.g., There are <region1 $>$ , <region $2 >$ ... in the image. This approach explicitly references every region, avoiding confusion in future analyses. Additionally, we substitute the corresponding <region $\\mathbf { \\Phi } _ { i } \\mathbf { \\Phi } _ { > }$ in the answer with category_name at region{i} to ensure a plain text output sequence. ",
659
+ "page_idx": 17
660
+ },
661
+ {
662
+ "type": "text",
663
+ "text": "A.4 TEXTUAL COORDINATES AS THE GROUNDING TOKEN",
664
+ "text_level": 1,
665
+ "page_idx": 17
666
+ },
667
+ {
668
+ "type": "text",
669
+ "text": "The key distinction lies in whether to incorporate the detection function into the LLM. For the method that uses textual coordinates as the grounding token, they have to solve the following challenge: ",
670
+ "page_idx": 17
671
+ },
672
+ {
673
+ "type": "text",
674
+ "text": "Aligning a large number of position tokens with their corresponding positions in the image by training on a large set of datasets. But this is actually a simple rule that can be naturally implemented with the operation in detection architectures. ",
675
+ "page_idx": 17
676
+ },
677
+ {
678
+ "type": "text",
679
+ "text": "Modeling geometric properties can be challenging. For example, if the ground truth box is $< x _ { 1 } =$ $0 , y _ { 1 } = 0 , x _ { 2 } = 5 , y _ { 2 } = 5 >$ , a predicted box of $< x _ { 1 } = 1 , y _ { 1 } = 1 , x _ { 2 } = 4 , y _ { 2 } = 4 >$ would be considered a better result than $< x _ { 1 } = 1 , y _ { 1 } = 1 , x _ { 2 } = 8 , y _ { 2 } = 8 >$ . because it has a higher overlap with the ground truth. However, incorporating this geometric property into the next token prediction task using cross-entropy loss can be challenging. On the other hand, utilizing traditional loss functions such as L1 or IoU loss can naturally handle this geometric constraint. ",
680
+ "page_idx": 17
681
+ },
682
+ {
683
+ "type": "text",
684
+ "text": "Dense to Sparse (Ren et al., 2015; Zhang et al., 2023d) is a crucial design for detection performance, but embedding such an idea into the sequential form of LLM is challenging. We provide two pieces of evidence to support our argument ",
685
+ "page_idx": 17
686
+ },
687
+ {
688
+ "type": "text",
689
+ "text": "1. The performance of pix2seq (Chen et al., 2021; 2022), which utilizes object365 (Shao et al., 2019) pretrain, falls significantly behind the corresponding specialist (Zhang et al., 2022; Li et al., 2023a). ",
690
+ "page_idx": 17
691
+ },
692
+ {
693
+ "type": "text",
694
+ "text": "2. Even with scaled-up data and parameters, GPT4V still faces challenges in object counting (Yang et al., 2023b). However, this is a trivial task for detection methods. ",
695
+ "page_idx": 17
696
+ },
697
+ {
698
+ "type": "text",
699
+ "text": "Another approach is to use an external detector to find the potential region of interest, whereas LLM only focuses on analyzing the corresponding region of interest. This is the motivation of GPT4RoI. It requires much less data and allows for quick adaptation to specific domain problems with the corresponding detector. However, the drawback is that the framework may appear less elegant and it assumes input contains all regions of interest that need to be analyzed. ",
700
+ "page_idx": 17
701
+ },
702
+ {
703
+ "type": "text",
704
+ "text": "Both approaches have their advantages and disadvantages, and academic research in both directions is thriving (including concurrent works or follow-ups on GPT4RoI). For the first approach, relevant references include (Zhao et al., 2023; Chen et al., 2023b), while for the second approach, there are (Anonymous, 2023; Chen et al., 2023a) besides GPT4RoI. Additionally, there has been research that explores a fusion of the two approaches, as shown in references (You et al., 2023; Rasheed et al., 2023; Zhang et al., 2023b). ",
705
+ "page_idx": 17
706
+ },
707
+ {
708
+ "type": "text",
709
+ "text": "A.5 FAILURE CASE ANALYSIS ",
710
+ "text_level": 1,
711
+ "page_idx": 17
712
+ },
713
+ {
714
+ "type": "text",
715
+ "text": "Due to limited data and instructions, GPT4RoI may fail in several landmark scenarios. We have conducted a thorough analysis and look forward to improving these limitations in future versions. ",
716
+ "page_idx": 17
717
+ },
718
+ {
719
+ "type": "text",
720
+ "text": "Instruction obfuscation As shown in Figure 6.(a), our multiple-region reasoning capability mainly relies on VCR, where we often use sentences that declare <region1>, <region2>, etc. at the beginning of the question. However, when users adopt the less common sentence structure to refer to regions, it can often be confused with region captions that have the highest proportion in the dataset. As shown in Figure 6.(b), because our data and instructions are mainly generated by rules, our training data does not include content with the \"respectively\" instruction in multi-region scenarios. This can be resolved by adding specific instructions. In future versions, we aim to develop more diverse instructions, while ensuring data balance. ",
721
+ "page_idx": 17
722
+ },
723
+ {
724
+ "type": "text",
725
+ "text": "",
726
+ "page_idx": 18
727
+ },
728
+ {
729
+ "type": "image",
730
+ "img_path": "images/ff55085a383fc6469d04648ee0a104d17f0ab23d946cdd55761d4575deb7a803.jpg",
731
+ "image_caption": [
732
+ "Figure 6: GPT4RoI on instruction obfuscation. "
733
+ ],
734
+ "image_footnote": [],
735
+ "page_idx": 18
736
+ },
737
+ {
738
+ "type": "text",
739
+ "text": "Misidentification of fine-grained information within in region Although GPT4RoI has improved the fine-grained perception ability of images compared to image-level vision language models, the limited amount of region-level data results in insufficient fine-grained alignment within regions. For example, in Figure 7.(a), the model incorrectly identifies the color of the helmet, and in Figure 7.(b), it misidentifies the object in the girl’s hand. Both cases generate the corresponding answers based on the most prominent feature within the region. Using semi-supervised methods to create more region-level data may address this issue. ",
740
+ "page_idx": 18
741
+ },
742
+ {
743
+ "type": "image",
744
+ "img_path": "images/6ccdd527eb77de0ac10c4eff4b052ab22d4e6eead056d6dc315410645227a7b2.jpg",
745
+ "image_caption": [
746
+ "Figure 7: GPT4RoI on Misidentification of fine-grained information. "
747
+ ],
748
+ "image_footnote": [],
749
+ "page_idx": 18
750
+ },
751
+ {
752
+ "type": "text",
753
+ "text": "A.6 DISCUSSION ",
754
+ "text_level": 1,
755
+ "page_idx": 18
756
+ },
757
+ {
758
+ "type": "text",
759
+ "text": "In our exploration, we find GPT4RoI produces failure cases as shown in Section. A.5. To further improve the performance, we identify the following potential directions: ",
760
+ "page_idx": 18
761
+ },
762
+ {
763
+ "type": "text",
764
+ "text": "• Model architecture. We find that $2 2 4 \\times 2 2 4$ input image resolution struggles with understanding smaller regions. However, if we switch to a larger resolution, we must consider the potential burden on inference speed from global attention ViT architecture, while the more efficient CNN architecture or sliding window attention has no available pre-trained large-scale vision encoder like CLIP ViT-H/14. • More region-text pair data. The amount of available region-text pairs is notably smaller than that of image-text pairs, which makes it challenging to sufficiently align region-level features with language models. To tackle this issue, we may try to generate region-level pseudo labels by leveraging off-the-shelf detectors to generate bounding boxes for image-text data. ",
765
+ "page_idx": 18
766
+ },
767
+ {
768
+ "type": "text",
769
+ "text": "",
770
+ "page_idx": 19
771
+ },
772
+ {
773
+ "type": "text",
774
+ "text": "• Region-level instructions. Although we have generated instructions for each task from existing open-source datasets, users in practical applications may ask various questions about an arbitrary number of regions, and the existing data may not contain satisfactory answers. To tackle this issue, we suggest generating a new batch of spatial instructions through manual labeling or by leveraging ChatGPT or GPT4. \n• Interaction mode. Currently, GPT4RoI only supports natural language and bounding box interaction. Incorporating more open-ended interaction modes such as point, scribble, or image-based search could further improve the user interaction experience. 1. Can you provide me with a detailed description of the region in the picture marked by <region1>? 2. I’m curious about the region represented by <region1 $>$ in the picture. Could you describe it in detail? \n3. What can you tell me about the region indicated by <region1 $>$ in the image? \n4. I’d like to know more about the area in the photo labeled <region1>. Can you give me a detailed description? \n5. Could you describe the region shown as <region1 $>$ in the picture in great detail? \n6. What details can you give me about the region outlined by <region $1 >$ in the photo? \n7. Please provide me with a comprehensive description of the region marked with <region1 $>$ in the image. \n8. Can you give me a detailed account of the region labeled as <region1 $>$ in the picture? \n9. I’m interested in learning more about the region represented by <region1 $>$ in the photo. Can you describe it in detail? \n10. What is the region outlined by <region1 $>$ in the picture like? Could you give me a detailed description, please? \n11. Can you provide me with a detailed description of the region in the picture marked by <region1>, please? \n12. I’m curious about the region represented by <region1> in the picture. Could you describe it in detail, please? \n13. What can you tell me about the region indicated by <region1> in the image, exactly? \n14. I’d like to know more about the area in the photo labeled <region1>, please. Can you give me a detailed description? \n15. Could you describe the region shown as <region1 $>$ in the picture in great detail, please? 16. What details can you give me about the region outlined by <region $^ { 1 > }$ in the photo, please? 17. Please provide me with a comprehensive description of the region marked with <region1 $>$ in the image, please. \n18. Can you give me a detailed account of the region labeled as <region1 $>$ in the picture, please? 19. I’m interested in learning more about the region represented by <region1 $>$ in the photo. Can you describe it in detail, please? \n20. What is the region outlined by <region1 $>$ in the picture like, please? Could you give me a detailed description? 1. Could you please give me a detailed description of these areas [<region1>, <region2>, ...]? 2. Can you provide a thorough description of the regions [<region1>, <region2>, ...] in this image? 3. Please describe in detail the contents of the boxed areas [<region1>, <region2>, ...]. \n4. Could you give a comprehensive explanation of what can be found within [<region1>, <region2>, ...] in the picture? \n5. Could you give me an elaborate explanation of the [<region1>, <region2>, ...] regions in this picture? \n6. Can you provide a comprehensive description of the areas identified by [<region1>, <region2>, ...] in this photo? \n7. Help me understand the specific locations labeled [<region1>, <region2>, ...] in this picture in detail, please. \n8. What is the detailed information about the areas marked by [<region1>, <region2>, ...] in this image? \n9. Could you provide me with a detailed analysis of the regions designated [<region1>, <region2>, ...] in this photo? \n10. What are the specific features of the areas marked [<region1>, <region2>, ...] in this picture that you can describe in detail? \n11. Could you elaborate on the regions identified by [<region1>, <region2>, ...] in this image? 12. What can you tell me about the areas labeled [<region1>, <region2>, ...] in this picture? 13. Can you provide a thorough analysis of the specific locations designated [<region1>, <region2>, ...] in this photo? \n14. I am interested in learning more about the regions marked [<region1>, <region2>, ...] in this image. Can you provide me with more information? \n15. Could you please provide a detailed description of the areas identified by [<region1>, <region2>, ...] in this photo? \n16. What is the significance of the regions labeled [<region1>, <region2>, ...] in this picture? 17. I would like to know more about the specific locations designated [<region1>, <region2>, ...] in this image. Can you provide me with more information? \n18. Can you provide a detailed breakdown of the regions marked [<region1>, <region2>, ...] in this photo? \n19. What specific features can you tell me about the areas identified by [<region1>, <region2>, ...] in this picture? \n20. Could you please provide a comprehensive explanation of the locations labeled [<region1>, <region2>, ...] in this image? ",
775
+ "page_idx": 19
776
+ },
777
+ {
778
+ "type": "text",
779
+ "text": "",
780
+ "page_idx": 19
781
+ },
782
+ {
783
+ "type": "text",
784
+ "text": "",
785
+ "page_idx": 20
786
+ },
787
+ {
788
+ "type": "text",
789
+ "text": "1. Why? \n2. What’s the rationale for your decision \n3. What led you to that conclusion? \n4. What’s the reasoning behind your opinion? \n5. Can you explain the basis for your thinking? \n6. What factors influenced your perspective? \n7. How did you arrive at that perspective? \n8. What evidence supports your viewpoint? \n9. What’s the logic behind your argument? \n10. Can you provide some context for your opinion? \n11. What’s the basis for your assertion? \n12. What experiences have shaped your perspective? \n13. What assumptions underlie your reasoning? \n14. What’s the foundation of your assertion? \n15. What’s the source of your reasoning? \n16. What’s the motivation behind your decision? \n17. What’s the impetus for your belief? \n18. What’s the driving force behind your conclusion? \n19. What’s your reasoning? \n20. What makes you say that? \n21. What’s the story behind that? \n22. What’s your thought process? \n23. What’s the deal with that? \n24. What’s the logic behind it? \n25. What’s the real deal here? \n26. What’s the reason behind it? \n27. What’s the rationale for your opinion? \n28. What’s the background to that? \n29. What’s the evidence that supports your view? \n30. What’s the explanation for that? ",
790
+ "page_idx": 21
791
+ }
792
+ ]
parse/test/DzxaRFVsgC/DzxaRFVsgC_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/DzxaRFVsgC/DzxaRFVsgC_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/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&#x27;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&#x27;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
+ ![](images/c5c12c0d44232b86e7795a98ac53dd891999fd328c5d4c819ddb1c51e93c51a8.jpg)
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
+ ![](images/5665471ea03603afcf4df3961baea804a379b3f59b7fd8030d905f60c3aa63ec.jpg)
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.
parse/test/IkmD3fKBPQ/IkmD3fKBPQ_content_list.json ADDED
@@ -0,0 +1,725 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "LARGE LANGUAGE MODELS CANNOT SELF-CORRECT REASONING YET ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Jie Huang1,2∗ Xinyun Chen1∗ Swaroop Mishra1 Huaixiu Steven Zheng1 Adams Wei $\\mathbf { Y u } ^ { 1 }$ Xinying Song1 Denny Zhou1 ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "1Google DeepMind 2University of Illinois at Urbana-Champaign jeffhj@illinois.edu, {xinyunchen, dennyzhou}@google.com ",
16
+ "page_idx": 0
17
+ },
18
+ {
19
+ "type": "text",
20
+ "text": "ABSTRACT ",
21
+ "text_level": 1,
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "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. ",
27
+ "page_idx": 0
28
+ },
29
+ {
30
+ "type": "text",
31
+ "text": "1 INTRODUCTION ",
32
+ "text_level": 1,
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "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). ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "text",
42
+ "text": "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). ",
43
+ "page_idx": 0
44
+ },
45
+ {
46
+ "type": "text",
47
+ "text": "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. ",
48
+ "page_idx": 0
49
+ },
50
+ {
51
+ "type": "text",
52
+ "text": "",
53
+ "page_idx": 1
54
+ },
55
+ {
56
+ "type": "text",
57
+ "text": "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. ",
58
+ "page_idx": 1
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "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. ",
63
+ "page_idx": 1
64
+ },
65
+ {
66
+ "type": "text",
67
+ "text": "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. ",
68
+ "page_idx": 1
69
+ },
70
+ {
71
+ "type": "text",
72
+ "text": "2 BACKGROUND AND RELATED WORK ",
73
+ "text_level": 1,
74
+ "page_idx": 1
75
+ },
76
+ {
77
+ "type": "text",
78
+ "text": "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. ",
79
+ "page_idx": 1
80
+ },
81
+ {
82
+ "type": "text",
83
+ "text": "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). ",
84
+ "page_idx": 1
85
+ },
86
+ {
87
+ "type": "text",
88
+ "text": "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. ",
89
+ "page_idx": 1
90
+ },
91
+ {
92
+ "type": "text",
93
+ "text": "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. ",
94
+ "page_idx": 1
95
+ },
96
+ {
97
+ "type": "table",
98
+ "img_path": "images/14c11e2978ffdc05f0f9cfa995724721a563876085fde7719f1602fadba07cb0.jpg",
99
+ "table_caption": [
100
+ "Table 1: Summary of issues in previous LLM self-correction evaluation. "
101
+ ],
102
+ "table_footnote": [],
103
+ "table_body": "<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>",
104
+ "page_idx": 2
105
+ },
106
+ {
107
+ "type": "text",
108
+ "text": "3 LLMS CANNOT SELF-CORRECT REASONING INTRINSICALLY ",
109
+ "text_level": 1,
110
+ "page_idx": 2
111
+ },
112
+ {
113
+ "type": "text",
114
+ "text": "In this section, we evaluate existing self-correction methods and compare their performance with and without oracle labels regarding the answer correctness. ",
115
+ "page_idx": 2
116
+ },
117
+ {
118
+ "type": "text",
119
+ "text": "3.1 EXPERIMENTAL SETUP ",
120
+ "text_level": 1,
121
+ "page_idx": 2
122
+ },
123
+ {
124
+ "type": "text",
125
+ "text": "Benchmarks. We use datasets where existing self-correction methods with oracle labels have demonstrated significant performance improvement, including ",
126
+ "page_idx": 2
127
+ },
128
+ {
129
+ "type": "text",
130
+ "text": "• 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. ",
131
+ "page_idx": 2
132
+ },
133
+ {
134
+ "type": "text",
135
+ "text": "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. ",
136
+ "page_idx": 2
137
+ },
138
+ {
139
+ "type": "text",
140
+ "text": "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. ",
141
+ "page_idx": 2
142
+ },
143
+ {
144
+ "type": "text",
145
+ "text": "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. ",
146
+ "page_idx": 2
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "3.2 RESULTS ",
151
+ "text_level": 1,
152
+ "page_idx": 2
153
+ },
154
+ {
155
+ "type": "text",
156
+ "text": "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). ",
157
+ "page_idx": 2
158
+ },
159
+ {
160
+ "type": "table",
161
+ "img_path": "images/cc8233944c2816018905b05bfde4121a0f282113c7b8c2096cde2b46fa67271e.jpg",
162
+ "table_caption": [
163
+ "Table 2: Results of GPT-3.5 and GPT-4 on reasoning benchmarks with oracle labels. "
164
+ ],
165
+ "table_footnote": [],
166
+ "table_body": "<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>",
167
+ "page_idx": 3
168
+ },
169
+ {
170
+ "type": "table",
171
+ "img_path": "images/5e76d1cdabb89b8bd4ceccea072ac64971c08bdb35d01db0e80a694defed3785.jpg",
172
+ "table_caption": [
173
+ "Table 3: Results of GPT-3.5 and GPT-4 on reasoning benchmarks with intrinsic self-correction. "
174
+ ],
175
+ "table_footnote": [],
176
+ "table_body": "<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>",
177
+ "page_idx": 3
178
+ },
179
+ {
180
+ "type": "text",
181
+ "text": "",
182
+ "page_idx": 3
183
+ },
184
+ {
185
+ "type": "text",
186
+ "text": "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. ",
187
+ "page_idx": 3
188
+ },
189
+ {
190
+ "type": "text",
191
+ "text": "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. ",
192
+ "page_idx": 3
193
+ },
194
+ {
195
+ "type": "text",
196
+ "text": "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. ",
197
+ "page_idx": 3
198
+ },
199
+ {
200
+ "type": "text",
201
+ "text": "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. ",
202
+ "page_idx": 3
203
+ },
204
+ {
205
+ "type": "text",
206
+ "text": "3.3 WHY DOES THE PERFORMANCE NOT INCREASE, BUT INSTEAD DECREASE? ",
207
+ "text_level": 1,
208
+ "page_idx": 3
209
+ },
210
+ {
211
+ "type": "text",
212
+ "text": "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 ",
213
+ "page_idx": 3
214
+ },
215
+ {
216
+ "type": "table",
217
+ "img_path": "images/eea145f59821c3623642685378b6d212207c28d0989962c678bbe7e7e3fc335b.jpg",
218
+ "table_caption": [
219
+ "Table 4: Results of GPT-4-Turbo and Llama-2 with intrinsic self-correction. "
220
+ ],
221
+ "table_footnote": [],
222
+ "table_body": "<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>",
223
+ "page_idx": 4
224
+ },
225
+ {
226
+ "type": "table",
227
+ "img_path": "images/51059bfd518db327d45a3b134278d7ea2132f0c74da2e8f3cf2fd3519399844b.jpg",
228
+ "table_caption": [
229
+ "Table 5: Results of GPT-4-Turbo with different feedback prompts. "
230
+ ],
231
+ "table_footnote": [],
232
+ "table_body": "<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&#x27;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>",
233
+ "page_idx": 4
234
+ },
235
+ {
236
+ "type": "table",
237
+ "img_path": "images/a89a331f3f5aaf006c592a9ce1a773f3b4eb4bd9448f364dacc3ff81506c1aab.jpg",
238
+ "table_caption": [
239
+ "Table 6: Results of Llama-2 with different feedback prompts. "
240
+ ],
241
+ "table_footnote": [],
242
+ "table_body": "<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&#x27;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>",
243
+ "page_idx": 4
244
+ },
245
+ {
246
+ "type": "text",
247
+ "text": "",
248
+ "page_idx": 4
249
+ },
250
+ {
251
+ "type": "image",
252
+ "img_path": "images/c5c12c0d44232b86e7795a98ac53dd891999fd328c5d4c819ddb1c51e93c51a8.jpg",
253
+ "image_caption": [
254
+ "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. "
255
+ ],
256
+ "image_footnote": [],
257
+ "page_idx": 5
258
+ },
259
+ {
260
+ "type": "image",
261
+ "img_path": "images/5665471ea03603afcf4df3961baea804a379b3f59b7fd8030d905f60c3aa63ec.jpg",
262
+ "image_caption": [
263
+ "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. "
264
+ ],
265
+ "image_footnote": [],
266
+ "page_idx": 5
267
+ },
268
+ {
269
+ "type": "text",
270
+ "text": "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. ",
271
+ "page_idx": 5
272
+ },
273
+ {
274
+ "type": "text",
275
+ "text": "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. ",
276
+ "page_idx": 5
277
+ },
278
+ {
279
+ "type": "table",
280
+ "img_path": "images/b2a1e7452f23f89f86946a8052d7297a64a0d3067f29c157efd90870991fca35.jpg",
281
+ "table_caption": [
282
+ "Table 7: Results of multi-agent debate and self-consistency. "
283
+ ],
284
+ "table_footnote": [],
285
+ "table_body": "<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>",
286
+ "page_idx": 6
287
+ },
288
+ {
289
+ "type": "table",
290
+ "img_path": "images/b6ccebb2b31ea4953f028d768d112c864f0fbef52f1c9170ca70a4ec3277ebb4.jpg",
291
+ "table_caption": [
292
+ "Table 8: Results of Constrained Generation. "
293
+ ],
294
+ "table_footnote": [
295
+ "\\* Prompts and results from Madaan et al. (2023). "
296
+ ],
297
+ "table_body": "<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>",
298
+ "page_idx": 6
299
+ },
300
+ {
301
+ "type": "text",
302
+ "text": "4 MULTI-AGENT DEBATE DOES NOT OUTPERFORM SELF-CONSISTENCY ",
303
+ "text_level": 1,
304
+ "page_idx": 6
305
+ },
306
+ {
307
+ "type": "text",
308
+ "text": "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. ",
309
+ "page_idx": 6
310
+ },
311
+ {
312
+ "type": "text",
313
+ "text": "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. ",
314
+ "page_idx": 6
315
+ },
316
+ {
317
+ "type": "text",
318
+ "text": "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. ",
319
+ "page_idx": 6
320
+ },
321
+ {
322
+ "type": "text",
323
+ "text": "5 PROMPT DESIGN ISSUES IN SELF-CORRECTION EVALUATION ",
324
+ "text_level": 1,
325
+ "page_idx": 6
326
+ },
327
+ {
328
+ "type": "text",
329
+ "text": "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. ",
330
+ "page_idx": 6
331
+ },
332
+ {
333
+ "type": "text",
334
+ "text": "",
335
+ "page_idx": 7
336
+ },
337
+ {
338
+ "type": "text",
339
+ "text": "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. ",
340
+ "page_idx": 7
341
+ },
342
+ {
343
+ "type": "text",
344
+ "text": "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. ",
345
+ "page_idx": 7
346
+ },
347
+ {
348
+ "type": "text",
349
+ "text": "6 CONCLUSION AND DISCUSSION ",
350
+ "text_level": 1,
351
+ "page_idx": 7
352
+ },
353
+ {
354
+ "type": "text",
355
+ "text": "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. ",
356
+ "page_idx": 7
357
+ },
358
+ {
359
+ "type": "text",
360
+ "text": "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. ",
361
+ "page_idx": 7
362
+ },
363
+ {
364
+ "type": "text",
365
+ "text": "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. ",
366
+ "page_idx": 7
367
+ },
368
+ {
369
+ "type": "text",
370
+ "text": "",
371
+ "page_idx": 8
372
+ },
373
+ {
374
+ "type": "text",
375
+ "text": "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. ",
376
+ "page_idx": 8
377
+ },
378
+ {
379
+ "type": "text",
380
+ "text": "7 LIMITATIONS AND BROADER IMPACT ",
381
+ "text_level": 1,
382
+ "page_idx": 8
383
+ },
384
+ {
385
+ "type": "text",
386
+ "text": "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. ",
387
+ "page_idx": 8
388
+ },
389
+ {
390
+ "type": "text",
391
+ "text": "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. ",
392
+ "page_idx": 8
393
+ },
394
+ {
395
+ "type": "text",
396
+ "text": "REPRODUCIBILITY STATEMENT ",
397
+ "text_level": 1,
398
+ "page_idx": 8
399
+ },
400
+ {
401
+ "type": "text",
402
+ "text": "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. ",
403
+ "page_idx": 8
404
+ },
405
+ {
406
+ "type": "text",
407
+ "text": "ACKNOWLEDGEMENT ",
408
+ "text_level": 1,
409
+ "page_idx": 8
410
+ },
411
+ {
412
+ "type": "text",
413
+ "text": "We would like to thank Chen Liang, William Cohen, Uri Alon, and other colleagues at Google DeepMind for valuable discussion and feedback. ",
414
+ "page_idx": 8
415
+ },
416
+ {
417
+ "type": "text",
418
+ "text": "REFERENCES ",
419
+ "text_level": 1,
420
+ "page_idx": 8
421
+ },
422
+ {
423
+ "type": "text",
424
+ "text": "Hussam Alkaissi and Samy I McFarlane. Artificial hallucinations in chatgpt: implications in scientific writing. Cureus, 15(2), 2023. ",
425
+ "page_idx": 8
426
+ },
427
+ {
428
+ "type": "text",
429
+ "text": "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. ",
430
+ "page_idx": 8
431
+ },
432
+ {
433
+ "type": "text",
434
+ "text": "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. ",
435
+ "page_idx": 9
436
+ },
437
+ {
438
+ "type": "text",
439
+ "text": "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. ",
440
+ "page_idx": 9
441
+ },
442
+ {
443
+ "type": "text",
444
+ "text": "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. ",
445
+ "page_idx": 9
446
+ },
447
+ {
448
+ "type": "text",
449
+ "text": "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. ",
450
+ "page_idx": 9
451
+ },
452
+ {
453
+ "type": "text",
454
+ "text": "Xinyun Chen, Maxwell Lin, Nathanael Scharli, and Denny Zhou. Teaching large language models ¨ to self-debug. arXiv preprint arXiv:2304.05128, 2023b. ",
455
+ "page_idx": 9
456
+ },
457
+ {
458
+ "type": "text",
459
+ "text": "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. ",
460
+ "page_idx": 9
461
+ },
462
+ {
463
+ "type": "text",
464
+ "text": "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. ",
465
+ "page_idx": 9
466
+ },
467
+ {
468
+ "type": "text",
469
+ "text": "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. ",
470
+ "page_idx": 9
471
+ },
472
+ {
473
+ "type": "text",
474
+ "text": "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. ",
475
+ "page_idx": 9
476
+ },
477
+ {
478
+ "type": "text",
479
+ "text": "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. ",
480
+ "page_idx": 9
481
+ },
482
+ {
483
+ "type": "text",
484
+ "text": "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. ",
485
+ "page_idx": 9
486
+ },
487
+ {
488
+ "type": "text",
489
+ "text": "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. ",
490
+ "page_idx": 9
491
+ },
492
+ {
493
+ "type": "text",
494
+ "text": "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. ",
495
+ "page_idx": 10
496
+ },
497
+ {
498
+ "type": "text",
499
+ "text": "Geunwoo Kim, Pierre Baldi, and Stephen McAleer. Language models can solve computer tasks. Advances in Neural Information Processing Systems, 2023. \nTakeshi 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. \nHaoran 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. \nTian 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. \nHunter 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. \nAman 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. \nTheo 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. \nOpenAI. Gpt-4 technical report, 2023. \nLiangming 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. \nDebjit 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. \nHanyin 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. \nFreda 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. \nNoah 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. \nAlon 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. \nHugo 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. \nBoshi 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. \nTianlu 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. \nXuezhi 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. \nAlexander Wei, Nika Haghtalab, and Jacob Steinhardt. Jailbroken: How does llm safety training fail? arXiv preprint arXiv:2307.02483, 2023. \nJason 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. \nSean 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. \nZhilin 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. \nShen Zheng, Jie Huang, and Kevin Chen-Chuan Chang. Why does chatgpt fall short in providing truthful answers? ArXiv preprint, abs/2304.10513, 2023. \nAojun 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. \nDenny 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. \nAndy Zou, Zifan Wang, J Zico Kolter, and Matt Fredrikson. Universal and transferable adversarial ",
500
+ "page_idx": 10
501
+ },
502
+ {
503
+ "type": "text",
504
+ "text": "",
505
+ "page_idx": 11
506
+ },
507
+ {
508
+ "type": "text",
509
+ "text": "attacks on aligned language models. arXiv preprint arXiv:2307.15043, 2023. ",
510
+ "page_idx": 11
511
+ },
512
+ {
513
+ "type": "text",
514
+ "text": "A PROMPTS AND EXAMPLE OUTPUTS ",
515
+ "text_level": 1,
516
+ "page_idx": 12
517
+ },
518
+ {
519
+ "type": "text",
520
+ "text": "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. ",
521
+ "page_idx": 12
522
+ },
523
+ {
524
+ "type": "text",
525
+ "text": "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) ",
526
+ "page_idx": 12
527
+ },
528
+ {
529
+ "type": "text",
530
+ "text": "Review your previous answer and find problems with your answer. ",
531
+ "text_level": 1,
532
+ "page_idx": 12
533
+ },
534
+ {
535
+ "type": "text",
536
+ "text": "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$ . ",
537
+ "page_idx": 12
538
+ },
539
+ {
540
+ "type": "text",
541
+ "text": "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}. ",
542
+ "text_level": 1,
543
+ "page_idx": 12
544
+ },
545
+ {
546
+ "type": "text",
547
+ "text": "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) ",
548
+ "page_idx": 12
549
+ },
550
+ {
551
+ "type": "text",
552
+ "text": "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. ",
553
+ "page_idx": 13
554
+ },
555
+ {
556
+ "type": "text",
557
+ "text": "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) ",
558
+ "page_idx": 13
559
+ },
560
+ {
561
+ "type": "text",
562
+ "text": "Review your previous answer and find problems with your answer. ",
563
+ "text_level": 1,
564
+ "page_idx": 13
565
+ },
566
+ {
567
+ "type": "text",
568
+ "text": "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. ",
569
+ "page_idx": 13
570
+ },
571
+ {
572
+ "type": "text",
573
+ "text": "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}. ",
574
+ "text_level": 1,
575
+ "page_idx": 13
576
+ },
577
+ {
578
+ "type": "text",
579
+ "text": "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) ",
580
+ "page_idx": 13
581
+ },
582
+ {
583
+ "type": "text",
584
+ "text": "Figure 4: Example on GSM8K where self-correction changes a correct answer to an incorrect one. ",
585
+ "page_idx": 13
586
+ },
587
+ {
588
+ "type": "text",
589
+ "text": "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. ",
590
+ "page_idx": 14
591
+ },
592
+ {
593
+ "type": "text",
594
+ "text": "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) ",
595
+ "page_idx": 14
596
+ },
597
+ {
598
+ "type": "text",
599
+ "text": "Review your previous answer and find problems with your answer. ",
600
+ "text_level": 1,
601
+ "page_idx": 14
602
+ },
603
+ {
604
+ "type": "text",
605
+ "text": "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. ",
606
+ "page_idx": 14
607
+ },
608
+ {
609
+ "type": "text",
610
+ "text": "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}. ",
611
+ "page_idx": 14
612
+ },
613
+ {
614
+ "type": "text",
615
+ "text": "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) ",
616
+ "page_idx": 14
617
+ },
618
+ {
619
+ "type": "text",
620
+ "text": "Q: A fencing thrust with a sharp sword towards a person would result in what? \nAnswer Choices: (A) injury (B) small cuts (C) fever (D) competition (E) puncture wound. \nExplain 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. ",
621
+ "page_idx": 15
622
+ },
623
+ {
624
+ "type": "text",
625
+ "text": "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) ",
626
+ "page_idx": 15
627
+ },
628
+ {
629
+ "type": "text",
630
+ "text": "Review your previous answer and find problems with your answer. ",
631
+ "text_level": 1,
632
+ "page_idx": 15
633
+ },
634
+ {
635
+ "type": "text",
636
+ "text": "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. ",
637
+ "page_idx": 15
638
+ },
639
+ {
640
+ "type": "text",
641
+ "text": "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). ",
642
+ "page_idx": 15
643
+ },
644
+ {
645
+ "type": "text",
646
+ "text": "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) ",
647
+ "page_idx": 15
648
+ },
649
+ {
650
+ "type": "text",
651
+ "text": "Figure 6: Example on CommonSenseQA where self-correction changes a correct answer to an incorrect one. ",
652
+ "page_idx": 15
653
+ },
654
+ {
655
+ "type": "text",
656
+ "text": "Concepts: ['footage', 'motion', 'ruin', 'tilt', 'window'] ",
657
+ "page_idx": 16
658
+ },
659
+ {
660
+ "type": "text",
661
+ "text": "Sentence: time lapse footage with tilt up motion of the sun streaking through window of ruin ",
662
+ "page_idx": 16
663
+ },
664
+ {
665
+ "type": "text",
666
+ "text": "### ",
667
+ "page_idx": 16
668
+ },
669
+ {
670
+ "type": "text",
671
+ "text": "Concepts: ['cause', 'hate', 'hut', 'local', 'love'] ",
672
+ "page_idx": 16
673
+ },
674
+ {
675
+ "type": "text",
676
+ "text": "Sentence: new beach huts on the island have caused some controversy some locals love them others hate them ",
677
+ "page_idx": 16
678
+ },
679
+ {
680
+ "type": "text",
681
+ "text": "[8 more in-context examples] ",
682
+ "page_idx": 16
683
+ },
684
+ {
685
+ "type": "text",
686
+ "text": "### ",
687
+ "page_idx": 16
688
+ },
689
+ {
690
+ "type": "text",
691
+ "text": "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'] ",
692
+ "page_idx": 16
693
+ },
694
+ {
695
+ "type": "text",
696
+ "text": "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. ",
697
+ "page_idx": 16
698
+ },
699
+ {
700
+ "type": "text",
701
+ "text": "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). ",
702
+ "page_idx": 16
703
+ },
704
+ {
705
+ "type": "text",
706
+ "text": "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'] ",
707
+ "page_idx": 16
708
+ },
709
+ {
710
+ "type": "text",
711
+ "text": "Write a reasonable paragraph that includes \\*ALL\\* of the above concepts. ",
712
+ "text_level": 1,
713
+ "page_idx": 16
714
+ },
715
+ {
716
+ "type": "text",
717
+ "text": "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. ",
718
+ "page_idx": 16
719
+ },
720
+ {
721
+ "type": "text",
722
+ "text": "Figure 8: Example output for Constrained Generation using a prompt casually written by the authors. ",
723
+ "page_idx": 16
724
+ }
725
+ ]
parse/test/IkmD3fKBPQ/IkmD3fKBPQ_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/IkmD3fKBPQ/IkmD3fKBPQ_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/Rc7dAwVL3v/Rc7dAwVL3v.md ADDED
@@ -0,0 +1,507 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NaturalSpeech 2: LATENT DIFFUSION MODELS ARE NATURAL AND ZERO-SHOT SPEECH AND SINGING SYNTHESIZERS
2
+
3
+ Kai Shen∗, Zeqian Ju∗, Xu Tan∗, Yanqing Liu, Yichong Leng, Lei He
4
+ Tao Qin, Sheng Zhao, Jiang Bian
5
+ Zhejiang University
6
+ Microsoft Research Asia & Microsoft Azure Speech
7
+ University of Science and Technology of China
8
+
9
+ # ABSTRACT
10
+
11
+ Scaling text-to-speech (TTS) to large-scale, multi-speaker, and in-the-wild datasets is important to capture the diversity in human speech such as speaker identities, prosodies, and styles (e.g., singing). Current large TTS systems usually quantize speech into discrete tokens and use language models to generate these tokens one by one, which suffer from unstable prosody, word skipping/repeating issue, and poor voice quality. In this paper, we develop NaturalSpeech 2, a TTS system that leverages a neural audio codec with residual vector quantizers to get the quantized latent vectors and uses a diffusion model to generate these latent vectors conditioned on text input. To enhance the zero-shot capability that is important to achieve diverse speech synthesis, we design a speech prompting mechanism to facilitate in-context learning in the diffusion model and the duration/pitch predictor. We scale NaturalSpeech 2 to large-scale datasets with 44K hours of speech and singing data and evaluate its voice quality on unseen speakers. NaturalSpeech 2 outperforms previous TTS systems by a large margin in terms of prosody/timbre similarity, robustness, and voice quality in a zero-shot setting, and performs novel zero-shot singing synthesis with only a speech prompt. Audio samples are available at https://speechresearch.github.io/naturalspeech2.
12
+
13
+ ![](images/4fcde57c811c3553377a4710136bb4171a3574814b9a1168bd7efe3f5b620a5a.jpg)
14
+ Figure 1: The overview of NaturalSpeech 2, with an audio codec encoder/decoder and a latent diffusion model conditioned on a prior (a phoneme encoder and a duration/pitch predictor). The details of in-context learning in the duration/pitch predictor and diffusion model are shown in Figure 2.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Human speech is full of diversity, with different speaker identities (e.g., gender, accent, timbre), prosodies, styles (e.g., speaking, singing), etc. Text-to-speech (TTS) (Taylor, 2009; Tan et al., 2021) aims to synthesize natural and human-like speech with both good quality and diversity. With the development of neural networks and deep learning, TTS systems (Wang et al., 2017; Shen et al., 2018; Li et al., 2019; Ren et al., 2019; 2021a; Liu et al., 2021; 2022b; Kim et al., 2021; Tan et al., 2022) have achieved good voice quality in terms of intelligibility and naturalness, and some systems (e.g., NaturalSpeech (Tan et al., 2022; Jia et al., 2021)) even achieves human-level voice quality on single-speaker recording-studio benchmarking datasets (e.g., LJSpeech (Ito, 2017)). Given the great achievements in speech intelligibility and naturalness made by the whole TTS community, now we enter a new era of TTS where speech diversity becomes more and more important in order to synthesize natural and human-like speech.
19
+
20
+ Previous speaker-limited recording-studio datasets are not enough to capture the diverse speaker identities, prosodies, and styles in human speech due to limited data diversity. Instead, we can train TTS models on a large-scale corpus to learn these diversities, and as a by-product, these trained models can generalize to the unlimited unseen scenarios with few-shot or zero-shot technologies. Current large-scale TTS systems (Wang et al., 2023; Kharitonov et al., 2023; Xue et al., 2023) usually quantize the speech waveform into discrete tokens and model these tokens with autoregressive language models. This pipeline suffers from several limitations: 1) The speech (discrete token) sequence is usually very long (a 10s speech usually has thousands of discrete tokens) and the autoregressive models suffer from error propagation and thus unstable speech outputs. 2) There is a dilemma between the codec and language model: on the one hand, the codec with token quantization (VQ-VAE (van den Oord et al., 2017; Razavi et al., 2019) or VQ-GAN (Esser et al., 2021)) usually has a low bitrate token sequence, which, although eases the language model generation, incurs information loss on the high-frequency fine-grained acoustic details; on the other hand, some improving methods (Zeghidour et al., 2021; Défossez et al., 2022) use multiple residual discrete tokens to represent a speech frame, which increases the length of the token sequence multiple times if flattened and incurs difficulty in language modeling.
21
+
22
+ In this paper, we propose NaturalSpeech 2, a TTS system with latent diffusion models to achieve expressive prosody, good robustness, and most importantly strong zero-shot ability for speech synthesis. As shown in Figure 1, we first train a neural audio codec that converts a speech waveform into a sequence of latent vectors with a codec encoder, and reconstructs the speech waveform from these latent vectors with a codec decoder. After training the audio codec, we use the codec encoder to extract the latent vectors from the speech in the training set and use them as the target of the latent diffusion model, which is conditioned on prior vectors obtained from a phoneme encoder, a duration predictor, and a pitch predictor. During inference, we first generate the latent vectors from the text/phoneme sequence using the latent diffusion model and then generate the speech waveform from these latent vectors using the codec decoder.
23
+
24
+ Table 1: The comparison between NaturalSpeech 2 and previous large-scale TTS systems (Wang et al., 2023; Kharitonov et al., 2023; Xue et al., 2023).
25
+
26
+ <table><tr><td>Methods</td><td>Previous Large-Scale Systems</td><td>NaturalSpeech 2</td></tr><tr><td>Representations</td><td>Discrete Tokens</td><td>Continuous Vectors</td></tr><tr><td>Generative Models</td><td>Autoregressive Models</td><td>Non-Autoregressvie/Diffusion</td></tr><tr><td>In-Context Learning</td><td>Both Text and Speech are Needed</td><td>Only Speech is Needed</td></tr><tr><td>Stability/Robustness?</td><td></td><td>√</td></tr><tr><td>One Acoustic Model?</td><td>×</td><td>√</td></tr><tr><td>Beyond TTS (e.g., Singing)?</td><td>×</td><td>&lt;</td></tr></table>
27
+
28
+ We elaborate on some design choices in NaturalSpeech 2 (shown in Table 1) as follows.
29
+
30
+ • Continuous vectors instead of discrete tokens. To ensure the speech reconstruction quality of the neural codec, previous works usually quantize speech with multiple residual quantizers. As a result, the obtained discrete token sequence is very long (e.g., if using 8 residual quantizers for each speech frame, the resulting flattened token sequence will be 8 times longer), and puts much pressure on the acoustic model (autoregressive language model). Therefore, we use continuous vectors instead of discrete tokens, which can reduce the sequence length and increase the amount of information for fine-grained speech reconstruction (see Section 3.1).
31
+
32
+ • Diffusion models instead of autoregressive models. We leverage diffusion models to learn the complex distributions of continuous vectors in a non-autoregressive manner and avoid error propagation in autoregressive models (see Section 3.2). • Speech prompting for in-context learning. To encourage the model to follow the speech prompt characteristics and enhance the zero-shot capability, we design speech prompting mechanisms to facilitate in-context learning in the diffusion model and pitch/duration predictors (see Section 3.3).
33
+
34
+ Benefiting from these designs, NaturalSpeech 2 is more stable and robust than previous autoregressive models, and only needs one acoustic model (the diffusion model) instead of two-stage token prediction as in (Borsos et al., 2022; Wang et al., 2023), and can extend the styles beyond TTS (e.g., singing voice) due to the duration/pitch prediction and non-autoregressive generation.
35
+
36
+ We scale NaturalSpeech 2 to 400M model parameters and 44K hours of speech data, and generate speech with diverse speaker identities, prosody, and styles (e.g., singing) in zero-shot scenarios (given only a few seconds of speech prompt). Experiment results show that NaturalSpeech 2 can generate natural speech in zero-shot scenarios and outperform the previous strong TTS systems. Specifically, 1) it achieves more similar prosody with both the speech prompt and ground-truth speech; 2) it achieves comparable or better naturalness (in terms of CMOS) than the ground-truth speech on LibriSpeech and VCTK test sets; 3) it can generate singing voices in a novel timbre either with a short singing prompt, or interestingly with only a speech prompt, which unlocks the truly zero-shot singing synthesis (without a singing prompt). Audio samples can be found in https://speechresearch.github.io/naturalspeech2.
37
+
38
+ # 2 BACKGROUND
39
+
40
+ We present the background of NaturalSpeech 2, encompassing the pursuit of high-quality, natural voice in text-to-speech synthesis, neural audio codec models, and generative audio synthesis models.
41
+
42
+ TTS for Natural Voice. Text-to-speech systems (Tan et al., 2021; Wang et al., 2017; Li et al., 2019; Ren et al., 2019; Liu et al., 2021; 2022b;a; Jiang et al., 2021; Ye et al., 2023; Kim et al., 2021; Tan et al., 2022) aim to generate natural voice with both high quality and diversity. Since TTS systems have achieved good voice quality, recent works attempt to scale the TTS systems to large-scale, multi-speaker, and in-the-wild datasets to pursue diversity (Betker, 2023; Borsos et al., 2023; Zhang et al., 2023). Some works (Jiang et al., 2023b; Le et al., 2023; Li et al., 2023) propose to generate mel-spectrogram by flow-matching (Lipman et al., 2022) or GAN-based (Goodfellow et al., 2014) generation models in a NAR framework. Since the mel-spectrogram is pre-designed and intuitively less conducive to learning for neural networks, we leverage learnable latent by neural codec as the training objective. In parallel, some works (Borsos et al., 2022; Wang et al., 2023; Kharitonov et al., 2023; Xue et al., 2023; Huang et al., 2023) usually leverage a neural codec to convert speech waveform into discrete token sequence and an autoregressive language model to generate discrete tokens from text, which suffers from a dilemma that:1) Quantizing each frame into one token with vector-quantizer (VQ) (van den Oord et al., 2017; Razavi et al., 2019; Esser et al., 2021) simplifies token generation but compromises waveform quality due to high compression. 2) Quantifying each frame into multiple tokens with residual vector-quantizer (RVQ) (Zeghidour et al., 2021; Défossez et al., 2022) ensures high-fidelity waveform reconstruction but hinders autoregressive model generation due to longer token sequences, causing errors and robustness challenges. Thus, previous works, such as AudioLM (Borsos et al., 2022), leverage three-stage language models to first predict semantic tokens autoregressively, followed by generating coarse-grained tokens per frame and ultimately producing remaining fine-grained tokens. VALL-E tackles this problem using an AR model for the first codec layer tokens and an NAR model for the remaining layer tokens. These methods are complicated and incur cascaded errors. To avoid the above dilemma, we leverage a neural codec with continuous vectors and a latent diffusion model with non-autoregressive generation.
43
+
44
+ Neural Audio Codec. Neural audio codec (Oord et al., 2016; Valin & Skoglund, 2019; Zeghidour et al., 2021; Défossez et al., 2022) refers to a kind of neural network model that converts audio waveform into compact representations with a codec encoder and reconstructs audio waveform from these representations with a codec decoder. SoundStream (Zeghidour et al., 2021) and Encodec (Défossez et al., 2022) leverage vector-quantized variational auto-encoders (VQ-VAE) with multiple residual vector-quantizers to compress speech into multiple tokens, and have been used as the intermediate representations for speech/audio generation (Borsos et al., 2022; Kreuk et al., 2022; Wang et al., 2023; Kharitonov et al., 2023; Xue et al., 2023). Residual vector quantizers provide good reconstruction quality and low bitrate but may not be ideal for speech/audio generation due to their long discrete token sequences ( $R$ times longer if $R$ residual quantizers are used), which makes prediction tasks more challenging and may lead to errors such as word skipping, repetition, or speech collapse. In this paper, we design a neural audio codec that converts waveforms into continuous vectors, retaining fine-grained details for accurate waveform reconstruction without increasing sequence length.
45
+
46
+ Generative Models for Speech Synthesis. Neural TTS systems aim to synthesize high-quality voice. Generative models such as language models (Li et al., 2019; Shen et al., 2018; Wu et al., 2023), VAE (Ren et al., 2021b; Lee et al., 2022), Normalization flow (Kim et al., 2021; Miao et al., 2020; Kim et al., 2020), GAN (Kim et al., 2021; Jiang et al., 2023a), diffusion model (Kong et al., 2021; Jeong et al., 2021; Chen et al., 2021a; Popov et al., 2021; Chen et al., 2021b), self-supervised learning methods (Siuzdak et al., 2022; Du et al., 2022) and speech representation learning methods Hsu et al. (2021); Schneider et al. (2019) achieve great success. Among these, autoregressive language models and diffusion models are the two most prominent methods. Although both models are based on iterative computation (following the left-to-right process or the denoising process), autoregressive models are more sensitive to sequence length and error propagation, which cause unstable prosody and robustness issues (e.g., word skipping, repeating, and collapse). Considering text-to-speech has a strict monotonic alignment and strong source-target dependency, we leverage diffusion models enhanced with duration prediction and length expansion, which are free from robust issues.
47
+
48
+ # 3 NATURALSPEECH 2
49
+
50
+ In this section, we introduce NaturalSpeech 2, a TTS system for natural and zero-shot voice synthesis with high fidelity/expressiveness/robustness on diverse scenarios (various speaker identities, prosodies, and styles). As shown in Figure 1, NaturalSpeech 2 consists of a neural audio codec and a diffusion model with a prior model (a phoneme encoder and a duration/pitch predictor). Since speech waveform is complex and high-dimensional, following the paradigm of regeneration learning (Tan et al., 2023), we utilize post-quantized latent vectors $z$ to represent waveform $x$ . Next, we employ a prior model to encode text input $y$ into a prior $c$ , and a diffusion model to predict the latent vectors $z$ conditioned on prior $c$ . Finally, latent vectors $z$ are input into the audio codec decoder to reconstruct the waveform $x$ We introduce the detailed designs of neural audio codec in Section 3.1 and the latent diffusion model in Section 3.2, as well as the speech prompting mechanism for in-context learning in Section 3.3.
51
+
52
+ # 3.1 NEURAL AUDIO CODEC WITH CONTINUOUS VECTORS
53
+
54
+ We use a neural audio codec to convert speech waveform into continuous vectors instead of discrete tokens, as analyzed in Section 2. Audio codec with continuous vectors enjoys several benefits: 1) Continuous vectors have a lower compression rate and higher bitrate than discrete tokens1, which can ensure high-quality audio reconstruction. 2) Each audio frame only has one vector instead of multiple tokens as in discrete quantization, which will not increase the length of the hidden sequence.
55
+
56
+ We employ the SoundStream(Zeghidour et al., 2021) architecture as our neural audio codec, which comprises an audio encoder, a residual vector-quantizer (RVQ), and an audio decoder. The residual vector-quantizer cascades $R$ layers of vector-quantizer (VQ) and transforms the output of the audio encoder into quantized latent vectors, which serve as the training target of the diffusion model. More details about codec are provided in Appendix A.
57
+
58
+ Actually, to obtain continuous vectors, we do not need vector quantizers, but just an autoencoder or variational autoencoder. However, for regularization and efficiency purposes, we use residual vector quantizers with a very large number of quantizers and codebook tokens to approximate the continuous vectors. This provides two benefits: 1) Reduced dataset storage by storing codebook embeddings and quantized token IDs instead of high-dimensional continuous vectors, and 2) the regularization loss on discrete classification based on quantized token IDs (see $\mathcal { L } _ { \mathrm { c e - r v q } }$ in Section 3.2).
59
+
60
+ We leverage a prior model, comprising a phoneme encoder, a duration predictor, and a pitch predictor, to process the text input and provide a more informative hidden vector $c$ . Subsequently, the diffusion model predicts the quantized latent vector $z$ conditioned on hidden vector $c$ .
61
+
62
+ Diffusion Formulation. We formulate the diffusion (forward) process and denoising (reverse) process (Liptser & Shiriiaev, 1977; Sohl-Dickstein et al., 2015; Ho et al., 2020) as a stochastic differential equation (SDE) (Song & Ermon, 2019; 2020; Song et al., 2020), respectively. The forward SDE transforms the latent vectors $z _ { 0 }$ obtained by the neural codec (i.e., $z$ ) into Gaussian noises (Popov et al., 2021):
63
+
64
+ $$
65
+ \mathrm { d } z _ { t } = - \frac { 1 } { 2 } \beta _ { t } z _ { t } \mathrm { d } t + \sqrt { \beta _ { t } } \mathrm { d } w _ { t } , \quad t \in [ 0 , 1 ] ,
66
+ $$
67
+
68
+ where $w _ { t }$ is the standard Brownian motion, $t \in [ 0 , 1 ]$ , and $\beta _ { t }$ is a non-negative noise schedule function. Then the solution is given by:
69
+
70
+ $$
71
+ z _ { t } = e ^ { - \frac { 1 } { 2 } \int _ { 0 } ^ { t } \beta _ { s } d s } z _ { 0 } + \int _ { 0 } ^ { t } \sqrt { \beta _ { s } } e ^ { - \frac { 1 } { 2 } \int _ { 0 } ^ { t } \beta _ { u } d u } \mathrm { d } w _ { s } .
72
+ $$
73
+
74
+ By properties of Ito’s integral, the conditional distribution of $z _ { t }$ given $z _ { \mathrm { 0 } }$ is Gaussian: $p ( z _ { t } | z _ { 0 } ) \sim$ $\mathcal { N } ( \rho ( z _ { 0 } , t ) , \Sigma _ { t } )$ , where $\rho ( z _ { 0 } , t ) = e ^ { - \frac { 1 } { 2 } \int _ { 0 } ^ { t } \beta _ { s } d s } z _ { 0 }$ and $\Sigma _ { t } = I - e ^ { - \int _ { 0 } ^ { t } \beta _ { s } d s }$ .
75
+
76
+ The reverse SDE transforms the Gaussian noise back to data $z _ { 0 }$ with the following process:
77
+
78
+ $$
79
+ \mathrm { d } z _ { t } = - ( \frac { 1 } { 2 } z _ { t } + \nabla \log p _ { t } ( z _ { t } ) ) \beta _ { t } \mathrm { d } t + \sqrt { \beta _ { t } } \mathrm { d } \tilde { w } _ { t } , \quad t \in [ 0 , 1 ] ,
80
+ $$
81
+
82
+ where $\tilde { w }$ is the reverse-time Brownian motion. Moreover, we can consider an ordinary differential equation (ODE) (Song et al., 2020) in the reverse process:
83
+
84
+ $$
85
+ \mathrm { d } z _ { t } = - \frac { 1 } { 2 } ( z _ { t } + \nabla \log p _ { t } ( z _ { t } ) ) \beta _ { t } \mathrm { d } t , \quad t \in [ 0 , 1 ] .
86
+ $$
87
+
88
+ We can train a neural network $s _ { \theta }$ to estimate the score $\nabla \log p _ { t } ( z _ { t } )$ (the gradient of the log-density of noisy data), and then we can sample data $z _ { 0 }$ by starting from Gaussian noise $z _ { 1 } \sim \mathcal { N } ( 0 , 1 )$ and numerically solving the SDE in Equation 3 or ODE in Equation 4. In our formulation, the neural network $s _ { \theta } ( z _ { t } , t , c )$ is based on WaveNet (Oord et al., 2016), which takes the current noisy vector $z _ { t }$ , the time step $t$ , and the condition information $c$ as input, and predicts the data $\hat { z } _ { 0 }$ instead of the score, which we found results in better speech quality. Thus, $\hat { z } _ { 0 } = s _ { \theta } ( z _ { t } , t , c )$ . The loss function to train the diffusion model is as follows.
89
+
90
+ $$
91
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { d i f f } } = \mathbb { E } _ { z _ { 0 } , t } [ | | \hat { z } _ { 0 } - z _ { 0 } | | _ { 2 } ^ { 2 } + | | \Sigma _ { t } ^ { - 1 } ( \rho ( \hat { z } _ { 0 } , t ) - z _ { t } ) - \nabla \log p _ { t } ( z _ { t } ) | | _ { 2 } ^ { 2 } + \lambda _ { c e - r v q } \mathcal { L } _ { \mathrm { c e - r v q } } ] , } \end{array}
92
+ $$
93
+
94
+ where the first term is the data loss, the second term is the score loss, and the predicted score is calculated by $\Sigma _ { t } ^ { - 1 } ( \rho ( \hat { z } _ { 0 } , t ) - z _ { t } )$ , which is also used for reverse sampling based on Equation 3 or 4 in inference. The third term $\mathcal { L } _ { \mathrm { c e - r v q } }$ is a novel cross-entropy (CE) loss based on residual vector$\hat { z } _ { 0 } - \sum _ { i = 1 } ^ { j - 1 } e _ { i }$ Q). Spe, where $e _ { i }$ fically, for each residual quantizer is the ground-truth quantized emb $j \in [ 1 , R ]$ , wthe $i$ first get the residual vector-th residual quantizer. Then we calculate the L2 distance between the residual vector with each codebook embedding in quantizer $j$ and get a probability distribution with a softmax function, and then calculate the cross-entropy loss between the ID of the ground-truth quantized embedding $e _ { j }$ and this probability distribution. $\mathcal { L } _ { \mathrm { c e - r v q } }$ is the mean of the cross-entropy loss in all $R$ residual quantizers, and $\lambda _ { \mathrm { c e - r v q } }$ is set to 0.1. Please refer to Appendix C.3 for more details of $\mathcal { L } _ { \mathrm { c e - r v q } }$ .
95
+
96
+ Prior Model: Phoneme Encoder and Duration/Pitch Predictor. The phoneme encoder consists of 6 Transformer blocks (Vaswani et al., 2017; Ren et al., 2019), where the standard feed-forward network is modified as a convolutional network to capture the local dependency in phoneme sequence. The duration and pitch predictors utilize a similar model structure, consisting of several convolutional blocks. The ground-truth duration and pitch information is used as the learning target to train the duration and pitch predictors, with an L1 duration loss ${ \mathcal { L } } _ { \mathrm { d u r } }$ and pitch loss $\mathcal { L } _ { \mathrm { p i t c h } }$ . During training, the ground-truth duration is used to expand the hidden sequence from the phoneme encoder to obtain the frame-level hidden sequence, and then the ground-truth pitch information is added to the framelevel hidden sequence to get the final condition information $c$ . During inference, the corresponding predicted duration and pitch are used.
97
+
98
+ The total loss function for the diffusion model is as follows:
99
+
100
+ $$
101
+ \mathcal { L } = \mathcal { L } _ { \mathrm { d i f f } } + \mathcal { L } _ { \mathrm { d u r } } + \mathcal { L } _ { \mathrm { p i t c h } } .
102
+ $$
103
+
104
+ ![](images/215a04be17795880d7e01d63075d7a0c1e14fedcea9f685bf205031b3a7f7f99.jpg)
105
+ Figure 2: The speech prompting mechanism in the duration/pitch predictor and the diffusion model for in-context learning. During training, we use a random segment $z ^ { u : v }$ of the target speech $z$ as the speech prompt $z ^ { p }$ and use the diffusion model to only predict $z ^ { \backslash u : v }$ . During inference, we use a reference speech of a specific speaker as the speech prompt $z ^ { p }$ . Note that the prompt is the speech latent obtained by the codec encoder instead of the speech waveform.
106
+
107
+ # 3.3 SPEECH PROMPTING FOR IN-CONTEXT LEARNING
108
+
109
+ To facilitate in-context learning for better zero-shot generation, we design a speech prompting mechanism to encourage the duration/pitch predictor and the diffusion model to follow the diverse information (e.g., speaker identities) in the speech prompt. For a speech latent sequence $z$ , we randomly cut off a segment $z ^ { u : v }$ with frame index from $u$ to $v$ as the speech prompt, and concatenate the remaining speech segments $z ^ { 1 : u }$ and $z ^ { v : n }$ to form a new sequence $z ^ { \backslash u : v }$ as the learning target of the diffusion model. As shown in Figure 2, we use a Transformer-based prompt encoder to process the speech prompt $z ^ { u : v }$ ( $z ^ { p }$ in the figure) to get a hidden sequence. To leverage this hidden sequence as the prompt, we have two different strategies for the duration/pitch predictor and the diffusion model: 1) For the duration and pitch predictors, we insert a Q-K-V attention layer in the convolution layer, where the query is the hidden sequence of the convolution layer, and the key and value is the hidden sequence from the prompt encoder. 2) For the diffusion model, instead of directly attending to the hidden sequence from the prompt encoder that exposes too many details to the diffusion model and may harm the generation, we design two attention blocks: in the first attention block, we use $m$ randomly initialized embeddings as the query sequence to attend to the prompt hidden sequence, and get a hidden sequence with a length of $m$ as the attention results (Wang et al., 2016; 2018; Yin et al., 2022); in the second attention block, we leverage the hidden sequence in the WaveNet layer as the query and the $m$ -length attention results as the key and value. We use the attention results of the second attention block as the conditional information of a FiLM layer (Perez et al., 2018) to perform affine transform on the hidden sequence of the WaveNet in the diffusion model. Please refer to Appendix B for the details of WaveNet architecture used in the diffusion model.
110
+
111
+ # 4 EXPERIMENTS AND RESULTS
112
+
113
+ # 4.1 EXPERIMENTAL SETTINGS
114
+
115
+ In this section, we introduce experimental settings to train and evaluate NaturalSpeech 2, including the dataset, baselines, and evaluation metrics. Please refer to Appendix C for the model configuration and training and inference details.
116
+
117
+ Datasets: To train the neural audio codec and the diffusion model, we use the English subset of Multilingual LibriSpeech (MLS) (Pratap et al., 2020), comprising 44K hours of transcribed audiobook data. It contains 2742 male and 2748 female distinct speakers. We evaluate using two benchmark datasets: 1) LibriSpeech test-clean (Panayotov et al., 2015), with 40 distinct speakers and 5.4 hours of annotated speech; 2) VCTK dataset (Veaux et al., 2016), with 108 distinct speakers. We sample
118
+
119
+ 15 and 5 utterances per speaker for LibriSpeech and VCTK, resulting in 600 and 540 evaluation utterances, respectively. For synthesis, a different same-speaker utterance is cropped into a $\sigma$ -second audio segment as a prompt. All speakers in two datasets are unseen during training. Singing datasets follow a similar process, detailed in Section 4.4. See Appendix E for data processing details.
120
+
121
+ Model Comparison: We compare NaturalSpeech 2 with baselines including: 1) YourTTS (Casanova et al., 2022b). 2) FastSpeech 2 (Ren et al., 2021a). We adapt it by adding cross-attention on speech prompts for zero-shot synthesis. Furthermore, we also change the prediction target from the melspectrogram to the latent representation. 3) VALL-E (Wang et al., 2023). 4) FoundationTTS (Xue et al., 2023). 5) Voicebox (Le et al., 2023). 6) MegaTTS (Jiang et al., 2023b). For YourTTS, we use the official code and pre-trained checkpoint2. For FastSpeech 2, VALL-E, and FoundationTTS, we implement them according to the papers. We scale them to 400M parameters and use the same dataset for fair comparison. In addition, for Voicebox, VALL-E, and MegaTTS, since there are no official implementations, we download the audio samples from their demo page and compare them with NaturalSpeech 2 individually. Please refer to Appendix D for more details.
122
+
123
+ Evaluation Metrics: We use both objective and subjective metrics to evaluate the zero-shot synthesis ability of NaturalSpeech 2 and compare it with baselines. Please refer to Appendix F for a more detailed metric description.
124
+
125
+ Objective Metrics: 1) Prosody Similarity with Prompt. Following the practice (Zaïdi et al., 2021), we compare the difference in mean, standard deviation, skewness, and kurtosis of the duration/pitch to assess prosody similarity between synthesized and prompt speech. 2) Word Error Rate. We employ an ASR model to transcribe the generated speech and calculate the word error rate (WER).
126
+
127
+ Subjective Metrics: 1) Intelligibility Score. To test the robustness, following the practice in (Ren et al., 2019), we use the 50 particularly difficult sentences (see Appendix G.2) and conduct an intelligibility test. 2) CMOS and SMOS. We evaluate naturalness using comparative mean option score (CMOS), and speaker similarity using similarity mean option score (SMOS).
128
+
129
+ # 4.2 EXPERIMENTAL RESULTS ON NATURAL AND ZERO-SHOT SYNTHESIS
130
+
131
+ In this section, we conduct experiments comparing the NaturalSpeech 2 with the baselines in terms of: 1) Generation Quality, by evaluating the naturalness of the synthesized audio; 2) Generation Similarity, by evaluating how well the TTS system follows prompts; 3) Robustness, by calculating the WER and an additional intelligibility test. 4) Generation Latency, by evaluating the trade-off between the inference efficiency and generation quality.
132
+
133
+ Generation Quality. We conduct CMOS test to evaluate the generation quality (i.e., naturalness). We randomly select 20 utterances from the LibriSpeech and VCTK tests and crop the prompt speech to 3s. To ensure high-quality generation, we use a speech scoring model (Chen et al., 2022) to filter the multiple samples generated by the diffusion model with different starting Gaussian noises $z _ { 1 }$ Table 2 shows a comparison of NaturalSpeech 2 against baselines and the ground truth. We have several observations: 1) NaturalSpeech 2 is comparable to the ground-truth recording in LibriSpeech $( + 0 . 0 4 $ is regarded as on par) and achieves much better quality on VCTK datasets $( - 0 . 2 1$ is a large gap), which demonstrates the naturalness of the speech generated by NaturalSpeech 2 is high enough. 2) NaturalSpeech 2 outperforms all the baselines by a large margin in both datasets. Specifically, for VALL-E, NaturalSpeech 2 shows 0.29 and 0.31 CMOS gain in LibriSpeech and VCTK, respectively. It demonstrates that the speech generated by NaturalSpeech 2 is much more natural and of higher quality. 3) Using the cases from demo pages, we find NaturalSpeech 2 surpasses the state-of-the-art large-scale TTS systems, which shows the superiority of NaturalSpeech 2.
134
+
135
+ Generation Similarity. We use two metrics to evaluate the speech similarity: 1) prosody similarity between the synthesized and prompt speech. 2) SMOS test. To evaluate the prosody similarity, we randomly sample one sentence for each speaker for both LibriSpeech test-clean and VCTK dataset to form the test sets. Specifically, to synthesize each sample, we randomly and independently sample the prompt speech with $\sigma = 3$ seconds. Note that YourTTS has seen 97 speakers in VCTK in training, but we still compare NaturalSpeech 2 with YourTTS on all the speakers in VCTK (i.e., the 97 speakers are seen to YourTTS but unseen to NaturalSpeech 2).
136
+
137
+ Table 2: The CMOS, SMOS and WER results on LibriSpeech and VCTK with $9 5 \%$ confidence intervals. ⋆ means the results from official demo page. “-" denotes the results are not available. Note that the comparison with demo cases involves pairwise comparisons between NaturalSpeech 2 and baselines across various test cases, rendering the baseline scores in this comparison non-pairwise.
138
+
139
+ <table><tr><td>Dataset</td><td colspan="3">LibriSpeech</td><td colspan="3">VCTK</td></tr><tr><td>Setting</td><td>CMOS↑</td><td>SMOS↑</td><td>WER↓</td><td>CMOS↑</td><td>SMOS↑</td><td>WER↓</td></tr><tr><td>Ground Truth</td><td>+0.04</td><td>4.27±0.10</td><td>1.94</td><td>-0.21</td><td>4.05±0.11</td><td>9.49</td></tr><tr><td>YourTTS (Casanova et al.,2022b)</td><td>-0.65</td><td>3.31±0.09</td><td>7.10</td><td>-0.58</td><td>3.39±0.08</td><td>14.80</td></tr><tr><td>FastSpeech 2 (Ren et al.,2021a)</td><td>-0.53</td><td>3.45±0.08</td><td>2.10</td><td>-0.64</td><td>3.22±0.10</td><td>8.26</td></tr><tr><td>FoundationTTS (Xue et al., 2023)</td><td>-0.32</td><td>3.81±0.12</td><td>4.63</td><td>-0.39</td><td>3.42±0.13</td><td>12.55</td></tr><tr><td>VALL-E (Wang et al., 2023)</td><td>-0.29</td><td>3.92±0.11</td><td>5.72</td><td>-0.31</td><td>3.50±0.10</td><td>14.68</td></tr><tr><td>NaturalSpeech 2</td><td>0.00</td><td>4.06±0.11</td><td>2.01</td><td>0.00</td><td>3.62±0.11</td><td>6.72</td></tr><tr><td>Comparison with demo cases</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>VALL-E (Wang et al., 2023)*</td><td>-0.27</td><td>3.98±0.12</td><td></td><td>-0.34</td><td>3.59±0.13</td><td></td></tr><tr><td>NaturalSpeech 2</td><td>0.00</td><td>4.11±0.11</td><td></td><td>0.00</td><td>3.71±0.12</td><td></td></tr><tr><td>MegaTTS (Jiang et al., 2023b)*</td><td>-0.20</td><td>3.96±0.09</td><td>=</td><td>-0.28</td><td>3.63±0.08</td><td></td></tr><tr><td>NaturalSpeech 2</td><td>0.00</td><td>4.10±0.11</td><td>=</td><td>0.00</td><td>3.74±0.10</td><td>=</td></tr><tr><td>Voicebox (Le et al., 2023)*</td><td>-0.11</td><td>3.75±0.11</td><td></td><td></td><td></td><td></td></tr><tr><td>NaturalSpeech 2</td><td>0.00</td><td>3.86±0.11</td><td>=</td><td></td><td></td><td></td></tr></table>
140
+
141
+ Table 3: The prosody similarity between synthesized and prompt speech in terms of the difference in mean (Mean), standard deviation (Std), skewness (Skew), and kurtosis (Kurt) of pitch and duration.
142
+
143
+ <table><tr><td rowspan="2">LibriSpeech</td><td colspan="4">Pitch</td><td colspan="4">Duration</td></tr><tr><td>Mean↓</td><td>Std</td><td>Skew↓</td><td>Kurt↓</td><td>Mean↓</td><td>Std↓</td><td>Skew↓</td><td>Kurt↓</td></tr><tr><td>YourTTS</td><td>10.52</td><td>7.62</td><td>0.59</td><td>1.18</td><td>0.84</td><td>0.66</td><td>0.75</td><td>3.70</td></tr><tr><td>FastSpeech 2</td><td>14.61</td><td>9.31</td><td>1.83</td><td>3.15</td><td>0.67</td><td>0.71</td><td>0.77</td><td>3.60</td></tr><tr><td>FoundationTTS</td><td>10.34</td><td>7.04</td><td>0.62</td><td>1.51</td><td>0.67</td><td>0.72</td><td>0.70</td><td>3.38</td></tr><tr><td>VALL-E</td><td>10.23</td><td>6.19</td><td>0.54</td><td>1.09</td><td>0.62</td><td>0.67</td><td>0.64</td><td>3.22</td></tr><tr><td>NaturalSpeech 2</td><td>10.11</td><td>6.18</td><td>0.50</td><td>1.01</td><td>0.65</td><td>0.70</td><td>0.60</td><td>2.99</td></tr></table>
144
+
145
+ We apply the alignment tool to obtain phoneme-level duration and pitch and calculate the prosody similarity metrics between the synthesized speech and the prompt speech as described in Section 4.1. We report the results on LibriSpeech in Table 3 and on VCTK in Appendix H.1. We have the following observations: 1) NaturalSpeech 2 consistently outperforms all the baselines in both LibriSpeech and VCTK on most metrics, which demonstrates that our proposed NaturalSpeech 2 can mimic the prosody of prompt speech much better. 2) Although YourTTS has seen 97 from 108 speakers in VCTK dataset, our model can still outperform it by a large margin. Furthermore, we also compare prosody similarity between synthesized and ground-truth speech in Appendix H.2.
146
+
147
+ We further evaluate speaker similarity using SMOS test. We randomly select 10 utterances from LibriSpeech and VCTK datasets respectively, following the setting in the CMOS test. The prompt speech length is set to 3s. The results are shown in Table 2. We find that NaturalSpeech 2 outperforms all the baselines in two datasets. Specifically, NaturalSpeech 2 outperforms the state-of-the-art method VALL-E by 0.14 and 0.12 SMOS scores for LibriSpeech and VCTK, respectively. It demonstrates that NaturalSpeech 2 is significantly better in speaker similarity.
148
+
149
+ Robustness. We use the full test set of LibriSpeech and VCTK as described in Section 4.1 to synthesize the speech and compute the word error rate (WER) between the transcribed text and ground-truth text. To synthesize each sample, we use a 3-second prompt by randomly cropping the whole prompt speech. The results are shown in Table 2. We observe that: 1) NaturalSpeech 2 significantly outperforms all the baselines in LibriSpeech and VCTK, indicating better synthesis of high-quality and robust speech. 2) Our synthesized speech is comparable to the ground-truth speech in LibriSpeech and surpasses that in VCTK. The higher WER results in VCTK may stem from a noisy environment and the lack of ASR model fine-tuning in that dataset.
150
+
151
+ In addition, we conduct an intelligibility test on 50 particularly hard sentences from FastSpeech (Ren et al., 2019) to evaluate speech robustness. NaturalSpeech 2 demonstrates robustness in these cases without any intelligibility issues. Please refer to Appendix G.1 for the detailed results.
152
+
153
+ Generation Latency. We conduct a comparison of both the latency and generation quality with varying diffusion step $( \{ 2 0 , 5 0 , 1 0 0 , 1 5 0 \} )$ . The comparison also incorporates a NAR baseline (FastSpeech 2) and an AR model (VALL-E). As detailed in Table 12 in Appendix K, the diffusion step of 150 strikes a balance between quality (with a 0.53 CMOS gain over FastSpeech2 and a 0.29 CMOS gain over VALL-E) and latency (12.35 times faster than VALL-E). 2) As the diffusion step decreases, the inference speed increases while there is no noticeable degradation in performance. Please refer to Appendix K for more details.
154
+
155
+ # 4.3 ABLATION STUDY
156
+
157
+ In this section, we perform ablation experiments. 1) To study the effect of the speech prompt, we remove the Q-K-V attention layers in the diffusion (abbr. w/o. diff prompt), and the duration and pitch predictors (abbr. w/o. dur/pitch prompt), respectively. 2) To study the effect of the cross-entropy (CE) loss $\mathcal { L } _ { \mathrm { c e - r v q } }$ based on RVQ, we disable the CE loss by setting $\lambda _ { c e - r v q }$ to 0 (abbr. w/o. CE loss). 3) To study the effectiveness of two Q-K-V attention in speech prompting for diffusion in Section 3.3, we remove the first attention that adopts $m$ randomly initialized query sequence to attend to the prompt hidden and directly use one Q-K-V attention to attend to the prompt hidden (abbr. w/o. query attn). We report CMOS and WER results in Table 4. More detailed results are in Appendix J.
158
+
159
+ We have the following observations: 1) When we disable speech prompt in diffusion, the model can not converge, which highlights its importance for high-quality TTS synthesis. 2) Disabling speech prompt in duration/pitch predictor significantly degrades audio quality (i.e., 0.45 CMOS degradation). In practice, we find that without speech prompt, it can pronounce the words correctly but with poor prosody, which causes CMOS degradation. 3) Disabling CE loss worsens both CMOS and WER performance. It shows that regularization is important for high-quality synthesis and robustness. 4) Disabling the query attention also degrades both CMOS and WER performance. In practice, we find that applying crossattention to prompt hidden will leak details and thus mislead generation.
160
+
161
+ Table 4: The ablation study of NaturalSpeech 2, measured by CMOS and WER. “-" denotes the model can not converge.
162
+
163
+ <table><tr><td></td><td>CMOS</td><td>WER</td></tr><tr><td>NaturalSpeech 2</td><td>0.00</td><td>2.01</td></tr><tr><td>w/o. diff prompt</td><td></td><td></td></tr><tr><td> w/o. dur/pitch prompt</td><td>-0.45</td><td>2.23</td></tr><tr><td>w/o. CE loss</td><td>-0.25</td><td>3.03</td></tr><tr><td> w/o. query attn</td><td>-0.13</td><td>2.65</td></tr></table>
164
+
165
+ # 4.4 ZERO-SHOT SINGING SYNTHESIS
166
+
167
+ In this section, we explore NaturalSpeech 2 to synthesize singing voice in a zero-shot setting, either given a singing prompt or only a speech prompt. We use speech and singing data together to train NaturalSpeech 2 with a $5 e - 5$ learning rate. In inference, we set the diffusion steps to 1000 for better performance. To synthesize a singing voice, we use the ground-truth pitch and duration, and use various singing prompts to generate singing voices with different singer timbres. Interestingly, we find that NaturalSpeech 2 can generate a novel singing voice using speech as the prompt. See the demo page3 for zero-shot singing synthesis with either singing or speech as the prompt. Please refer to Appendix E for more details. Furthermore, we extend NaturalSpeech 2 to support more tasks such as voice conversion and speech enhancement. Please refer to Appendix L for more details.
168
+
169
+ # 5 CONCLUSION
170
+
171
+ In this paper, we develop NaturalSpeech 2, a TTS system that leverages a neural audio codec with continuous latent vectors and a latent diffusion model with non-autoregressive generation to enable natural and zero-shot text-to-speech synthesis. To facilitate in-context learning for zero-shot synthesis, we design a speech prompting mechanism in the duration/pitch predictor and the diffusion model. By scaling NaturalSpeech 2 to 400M model parameters, 44K hours of speech, and 5K speakers, it can synthesize speech with high expressiveness, robustness and strong zero-shot ability, outperforming previous TTS systems. For future work, we will explore efficient strategies such as (Song et al., 2023) to speed up, and explore large-scale speaking and singing voice training to enable more powerful mixed speaking/singing capability. We include our limitation in Appendix M.
172
+
173
+ Broader Impacts: Since NaturalSpeech 2 could synthesize speech that maintains speaker identity, it may carry potential risks in misuse of the model, such as spoofing voice identification or impersonating a specific speaker. We conduct experiments under the assumption that the user agrees to be the target speaker in speech synthesis. If the model generalizes to unseen speakers in the real world, it should include a protocol to ensure that the speaker approves the use of their voice and a synthesized speech detection model.
174
+
175
+ REFERENCES
176
+ James Betker. Better speech synthesis through scaling. arXiv preprint arXiv:2305.07243, 2023.
177
+ Zalán Borsos, Raphaël Marinier, Damien Vincent, Eugene Kharitonov, Olivier Pietquin, Matt Sharifi, Olivier Teboul, David Grangier, Marco Tagliasacchi, and Neil Zeghidour. Audiolm: a language modeling approach to audio generation. arXiv preprint arXiv:2209.03143, 2022.
178
+ Zalán Borsos, Matt Sharifi, Damien Vincent, Eugene Kharitonov, Neil Zeghidour, and Marco Tagliasacchi. Soundstorm: Efficient parallel audio generation. arXiv preprint arXiv:2305.09636, 2023.
179
+ Edresson Casanova, Arnaldo Candido Junior, Christopher Shulby, Frederico Santos de Oliveira, João Paulo Teixeira, Moacir Antonelli Ponti, and Sandra Aluísio. Tts-portuguese corpus: a corpus for speech synthesis in brazilian portuguese. Language Resources and Evaluation, 56(3): 1043–1055, 2022a.
180
+ Edresson Casanova, Julian Weber, Christopher D Shulby, Arnaldo Candido Junior, Eren Gölge, and Moacir A Ponti. Yourtts: Towards zero-shot multi-speaker tts and zero-shot voice conversion for everyone. In International Conference on Machine Learning, pp. 2709–2720. PMLR, 2022b.
181
+ Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, and William Chan. WaveGrad: Estimating gradients for waveform generation. In ICLR, 2021a.
182
+ Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, Najim Dehak, and William Chan. WaveGrad 2: Iterative refinement for text-to-speech synthesis. arXiv preprint arXiv:2106.09660, 2021b.
183
+ Sanyuan Chen, Chengyi Wang, Zhengyang Chen, Yu Wu, Shujie Liu, Zhuo Chen, Jinyu Li, Naoyuki Kanda, Takuya Yoshioka, Xiong Xiao, et al. Wavlm: Large-scale self-supervised pre-training for full stack speech processing. IEEE Journal of Selected Topics in Signal Processing, 16(6): 1505–1518, 2022.
184
+ Alexandre Défossez. Hybrid spectrogram and waveform source separation. arXiv preprint arXiv:2111.03600, 2021.
185
+ Alexandre Défossez, Jade Copet, Gabriel Synnaeve, and Yossi Adi. High fidelity neural audio compression. arXiv preprint arXiv:2210.13438, 2022.
186
+ Chenpeng Du, Yiwei Guo, Xie Chen, and Kai Yu. VQTTS: High-fidelity text-to-speech synthesis with self-supervised VQ acoustic feature. arXiv preprint arXiv:2204.00768, 2022.
187
+ Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 12873–12883, 2021.
188
+ Ian J Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aäron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, 2014.
189
+ Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. arXiv preprint arXiv:2006.11239, 2020.
190
+ Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan Salakhutdinov, and Abdelrahman Mohamed. Hubert: Self-supervised speech representation learning by masked prediction of hidden units. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 29:3451–3460, 2021.
191
+
192
+ Rongjie Huang, Chunlei Zhang, Yongqi Wang, Dongchao Yang, Luping Liu, Zhenhui Ye, Ziyue Jiang, Chao Weng, Zhou Zhao, and Dong Yu. Make-a-voice: Unified voice synthesis with discrete representation. arXiv preprint arXiv:2305.19269, 2023.
193
+
194
+ Keith Ito. The LJ speech dataset. https://keithito.com/LJ-Speech-Dataset/, 2017.
195
+ Myeonghun Jeong, Hyeongju Kim, Sung Jun Cheon, Byoung Jin Choi, and Nam Soo Kim. Diff-TTS: A denoising diffusion model for text-to-speech. arXiv preprint arXiv:2104.01409, 2021.
196
+ Ye Jia, Heiga Zen, Jonathan Shen, Yu Zhang, and Yonghui Wu. PnG BERT: Augmented BERT on phonemes and graphemes for neural TTS. arXiv preprint arXiv:2103.15060, 2021.
197
+ Ziyue Jiang, Yi Ren, Ming Lei, and Zhou Zhao. Fedspeech: Federated text-to-speech with continual learning. arXiv preprint arXiv:2110.07216, 2021.
198
+ Ziyue Jiang, Jinglin Liu, Yi Ren, Jinzheng He, Zhenhui Ye, Shengpeng Ji, Qian Yang, Chen Zhang, Pengfei Wei, Chunfeng Wang, et al. Boosting prompting mechanisms for zero-shot speech synthesis. In The Twelfth International Conference on Learning Representations, 2023a.
199
+ Ziyue Jiang, Yi Ren, Zhenhui Ye, Jinglin Liu, Chen Zhang, Qian Yang, Shengpeng Ji, Rongjie Huang, Chunfeng Wang, Xiang Yin, et al. Mega-tts: Zero-shot text-to-speech at scale with intrinsic inductive bias. arXiv preprint arXiv:2306.03509, 2023b.
200
+ Jacob Kahn, Morgane Riviere, Weiyi Zheng, Evgeny Kharitonov, Qiantong Xu, Pierre-Emmanuel Mazaré, Julien Karadayi, Vitaliy Liptchinsky, Ronan Collobert, Christian Fuegen, et al. Libri-light: A benchmark for asr with limited or no supervision. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 7669–7673. IEEE, 2020.
201
+ Eugene Kharitonov, Damien Vincent, Zalán Borsos, Raphaël Marinier, Sertan Girgin, Olivier Pietquin, Matt Sharifi, Marco Tagliasacchi, and Neil Zeghidour. Speak, read and prompt: High-fidelity text-to-speech with minimal supervision. arXiv preprint arXiv:2302.03540, 2023.
202
+ Jaehyeon Kim, Sungwon Kim, Jungil Kong, and Sungroh Yoon. Glow-TTS: A generative flow for text-to-speech via monotonic alignment search. Advances in Neural Information Processing Systems, 33, 2020.
203
+ Jaehyeon Kim, Jungil Kong, and Juhee Son. Conditional variational autoencoder with adversarial learning for end-to-end text-to-speech. arXiv preprint arXiv:2106.06103, 2021.
204
+ Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. DiffWave: A versatile diffusion model for audio synthesis. In ICLR, 2021.
205
+ Felix Kreuk, Gabriel Synnaeve, Adam Polyak, Uriel Singer, Alexandre Défossez, Jade Copet, Devi Parikh, Yaniv Taigman, and Yossi Adi. Audiogen: Textually guided audio generation. arXiv preprint arXiv:2209.15352, 2022.
206
+ Matthew Le, Apoorv Vyas, Bowen Shi, Brian Karrer, Leda Sari, Rashel Moritz, Mary Williamson, Vimal Manohar, Yossi Adi, Jay Mahadeokar, et al. Voicebox: Text-guided multilingual universal speech generation at scale. arXiv preprint arXiv:2306.15687, 2023.
207
+ Yoonhyung Lee, Joongbo Shin, and Kyomin Jung. Bidirectional variational inference for nonautoregressive text-to-speech. In International conference on learning representations, 2022.
208
+ Naihan Li, Shujie Liu, Yanqing Liu, Sheng Zhao, and Ming Liu. Neural speech synthesis with Transformer network. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 6706–6713, 2019.
209
+ Yinghao Aaron Li, Cong Han, Vinay S Raghavan, Gavin Mischler, and Nima Mesgarani. Styletts 2: Towards human-level text-to-speech through style diffusion and adversarial training with large speech language models. arXiv preprint arXiv:2306.07691, 2023.
210
+ Yaron Lipman, Ricky TQ Chen, Heli Ben-Hamu, Maximilian Nickel, and Matt Le. Flow matching for generative modeling. arXiv preprint arXiv:2210.02747, 2022.
211
+ Robert Shevilevich Liptser and Albert Nikolaevich Shiriiaev. Statistics of random processes: General theory, volume 394. Springer, 1977.
212
+ Jinglin Liu, Chengxi Li, Yi Ren, Feiyang Chen, and Zhou Zhao. DiffSinger: Singing voice synthesis via shallow diffusion mechanism. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pp. 11020–11028, 2022a.
213
+ Yanqing Liu, Zhihang Xu, Gang Wang, Kuan Chen, Bohan Li, Xu Tan, Jinzhu Li, Lei He, and Sheng Zhao. DelightfulTTS: The Microsoft speech synthesis system for Blizzard challenge 2021. arXiv preprint arXiv:2110.12612, 2021.
214
+ Yanqing Liu, Ruiqing Xue, Lei He, Xu Tan, and Sheng Zhao. DelightfulTTS 2: End-to-end speech synthesis with adversarial vector-quantized auto-encoders. arXiv preprint arXiv:2207.04646, 2022b.
215
+ Chenfeng Miao, Shuang Liang, Minchuan Chen, Jun Ma, Shaojun Wang, and Jing Xiao. Flow-TTS: A non-autoregressive network for text to speech based on flow. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 7209–7213. IEEE, 2020.
216
+ Aäron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. WaveNet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016.
217
+ Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. LibriSpeech: an ASR corpus based on public domain audio books. In 2015 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5206–5210. IEEE, 2015.
218
+ Ethan Perez, Florian Strub, Harm De Vries, Vincent Dumoulin, and Aaron Courville. Film: Visual reasoning with a general conditioning layer. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
219
+ Vadim Popov, Ivan Vovk, Vladimir Gogoryan, Tasnima Sadekova, and Mikhail Kudinov. Grad-TTS: A diffusion probabilistic model for text-to-speech. arXiv preprint arXiv:2105.06337, 2021.
220
+ Vineel Pratap, Qiantong Xu, Anuroop Sriram, Gabriel Synnaeve, and Ronan Collobert. MLS: A large-scale multilingual dataset for speech research. Proc. Interspeech 2020, pp. 2757–2761, 2020.
221
+ Konpat Preechakul, Nattanat Chatthee, Suttisak Wizadwongsa, and Supasorn Suwajanakorn. Diffusion autoencoders: Toward a meaningful and decodable representation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10619–10629, 2022.
222
+ Ali Razavi, Aaron van den Oord, and Oriol Vinyals. Generating diverse high-fidelity images with VQ-VAE-2. In Advances in neural information processing systems, pp. 14866–14876, 2019.
223
+ Yi Ren, Yangjun Ruan, Xu Tan, Tao Qin, Sheng Zhao, Zhou Zhao, and Tie-Yan Liu. FastSpeech: Fast, robust and controllable text to speech. In NeurIPS, 2019.
224
+ Yi Ren, Chenxu Hu, Xu Tan, Tao Qin, Sheng Zhao, Zhou Zhao, and Tie-Yan Liu. FastSpeech 2: Fast and high-quality end-to-end text to speech. In International Conference on Learning Representations, 2021a. URL https://openreview.net/forum?id=piLPYqxtWuA.
225
+ Yi Ren, Jinglin Liu, and Zhou Zhao. Portaspeech: Portable and high-quality generative text-to-speech. Advances in Neural Information Processing Systems, 34:13963–13974, 2021b.
226
+ Steffen Schneider, Alexei Baevski, Ronan Collobert, and Michael Auli. wav2vec: Unsupervised pre-training for speech recognition. Proc. Interspeech 2019, pp. 3465–3469, 2019.
227
+ Jonathan Shen, Ruoming Pang, Ron J Weiss, Mike Schuster, Navdeep Jaitly, Zongheng Yang, Zhifeng Chen, Yu Zhang, Yuxuan Wang, RJ Skerry-Ryan, et al. Natural TTS synthesis by conditioning WaveNet on mel spectrogram predictions. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4779–4783. IEEE, 2018.
228
+
229
+ Hubert Siuzdak, Piotr Dura, Pol van Rijn, and Nori Jacoby. Wavthruvec: Latent speech representation as intermediate features for neural speech synthesis. arXiv preprint arXiv:2203.16930, 2022.
230
+
231
+ 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.
232
+ Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in Neural Information Processing Systems, 32, 2019.
233
+ Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. Advances in neural information processing systems, 33:12438–12448, 2020.
234
+ Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2020.
235
+ Yang Song, Prafulla Dhariwal, Mark Chen, and Ilya Sutskever. Consistency models. arXiv preprint arXiv:2303.01469, 2023.
236
+ Hao Sun, Xu Tan, Jun-Wei Gan, Hongzhi Liu, Sheng Zhao, Tao Qin, and Tie-Yan Liu. Token-level ensemble distillation for grapheme-to-phoneme conversion. In INTERSPEECH, 2019.
237
+ Xu Tan, Tao Qin, Frank Soong, and Tie-Yan Liu. A survey on neural speech synthesis. arXiv preprint arXiv:2106.15561, 2021.
238
+ Xu Tan, Jiawei Chen, Haohe Liu, Jian Cong, Chen Zhang, Yanqing Liu, Xi Wang, Yichong Leng, Yuanhao Yi, Lei He, et al. NaturalSpeech: End-to-end text to speech synthesis with human-level quality. arXiv preprint arXiv:2205.04421, 2022.
239
+ Xu Tan, Tao Qin, Jiang Bian, Tie-Yan Liu, and Yoshua Bengio. Regeneration learning: A learning paradigm for data generation. arXiv preprint arXiv:2301.08846, 2023.
240
+ Paul Taylor. Text-to-speech synthesis. Cambridge university press, 2009.
241
+ Jean-Marc Valin and Jan Skoglund. LPCNet: Improving neural speech synthesis through linear prediction. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5891–5895. IEEE, 2019.
242
+ Aaron van den Oord, Oriol Vinyals, and Koray Kavukcuoglu. Neural discrete representation learning. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pp. 6309–6318, 2017.
243
+ 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.
244
+ Christophe Veaux, Junichi Yamagishi, Kirsten MacDonald, et al. Superseded-CSTK VCTK corpus: English multi-speaker corpus for CSTK voice cloning toolkit. 2016.
245
+ Chengyi Wang, Sanyuan Chen, Yu Wu, Ziqiang Zhang, Long Zhou, Shujie Liu, Zhuo Chen, Yanqing Liu, Huaming Wang, Jinyu Li, et al. Neural codec language models are zero-shot text to speech synthesizers. arXiv preprint arXiv:2301.02111, 2023.
246
+ Yequan Wang, Minlie Huang, Xiaoyan Zhu, and Li Zhao. Attention-based lstm for aspect-level sentiment classification. In Proceedings of the 2016 conference on empirical methods in natural language processing, pp. 606–615, 2016.
247
+ Yuxuan Wang, RJ Skerry-Ryan, Daisy Stanton, Yonghui Wu, Ron J Weiss, Navdeep Jaitly, Zongheng Yang, Ying Xiao, Zhifeng Chen, Samy Bengio, et al. Tacotron: Towards end-to-end speech synthesis. Proc. Interspeech 2017, pp. 4006–4010, 2017.
248
+ Yuxuan Wang, Daisy Stanton, Yu Zhang, RJ Skerry-Ryan, Eric Battenberg, Joel Shor, Ying Xiao, Ye Jia, Fei Ren, and Rif A Saurous. Style tokens: Unsupervised style modeling, control and transfer in end-to-end speech synthesis. In International Conference on Machine Learning, pp. 5180–5189. PMLR, 2018.
249
+ Yiquan Wu, Siying Zhou, Yifei Liu, Weiming Lu, Xiaozhong Liu, Yating Zhang, Changlong Sun, Fei Wu, and Kun Kuang. Precedent-enhanced legal judgment prediction with llm and domain-model collaboration. arXiv preprint arXiv:2310.09241, 2023.
250
+ Ruiqing Xue, Yanqing Liu, Lei He, Xu Tan, Linquan Liu, Edward Lin, and Sheng Zhao. Foundationtts: Text-to-speech for asr customization with generative language model. arXiv preprint arXiv:2303.02939, 2023.
251
+ Zhenhui Ye, Rongjie Huang, Yi Ren, Ziyue Jiang, Jinglin Liu, Jinzheng He, Xiang Yin, and Zhou Zhao. Clapspeech: Learning prosody from text context with contrastive language-audio pretraining. arXiv preprint arXiv:2305.10763, 2023.
252
+ Dacheng Yin, Chuanxin Tang, Yanqing Liu, Xiaoqiang Wang, Zhiyuan Zhao, Yucheng Zhao, Zhiwei Xiong, Sheng Zhao, and Chong Luo. Retrievertts: Modeling decomposed factors for text-based speech insertion. arXiv preprint arXiv:2206.13865, 2022.
253
+ Julian Zaïdi, Hugo Seut’e, Benjamin van Niekerk, and Marc-André Carbonneau. Daft-exprt: Crossspeaker prosody transfer on any text for expressive speech synthesis. In Interspeech, 2021. URL https://api.semanticscholar.org/CorpusID:247997035.
254
+ Neil Zeghidour, Alejandro Luebs, Ahmed Omran, Jan Skoglund, and Marco Tagliasacchi. SoundStream: An end-to-end neural audio codec. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 2021.
255
+ Heiga Zen, Viet Dang, Rob Clark, Yu Zhang, Ron J Weiss, Ye Jia, Zhifeng Chen, and Yonghui Wu. LibriTTS: A corpus derived from librispeech for text-to-speech. Proc. Interspeech 2019, pp. 1526–1530, 2019.
256
+ Ziqiang Zhang, Long Zhou, Chengyi Wang, Sanyuan Chen, Yu Wu, Shujie Liu, Zhuo Chen, Yanqing Liu, Huaming Wang, Jinyu Li, et al. Speak foreign languages with your own voice: Cross-lingual neural codec language modeling. arXiv preprint arXiv:2303.03926, 2023.
257
+
258
+ # A NEURAL AUDIO CODEC
259
+
260
+ As shown in Figure 3, our neural audio codec consists of an audio encoder, a residual vector-quantizer (RVQ), and an audio decoder: 1) The audio encoder consists of several convolutional blocks with a total downsampling rate of 200 for 16KHz audio, i.e., each frame corresponds to a $1 2 . 5 \mathrm { m s }$ speech segment. 2) The residual vector-quantizer converts the output of the audio encoder into multiple residual vectors following (Zeghidour et al., 2021). The sum of these residual vectors is taken as the quantized vectors, which are used as the training target of the diffusion model. 3) The audio decoder mirrors the structure of the audio encoder, which generates the audio waveform from the quantized vectors. The working flow of the neural audio codec is as follows.
261
+
262
+ $$
263
+ \mathrm { R e s i d u a l ~ V e c t o r ~ Q u a n t i z e r : ~ } \{ e _ { j } ^ { i } \} _ { j = 1 } ^ { R } = f _ { \mathrm { r v q } } ( h ^ { i } ) , z ^ { i } = \sum _ { j = 1 } ^ { R } e _ { j } ^ { i } , z = \{ z ^ { i } \} _ { i = 1 } ^ { n } ,
264
+ $$
265
+
266
+ where $f _ { \mathrm { e n c } }$ , $f _ { \mathrm { r v q } }$ , and $f _ { \mathrm { d e c } }$ denote the audio encoder, residual vector quantizer, and audio decoder. $x$ is the speech waveform, $h$ is the hidden sequence obtained by the audio encoder with a frame length of $n$ , and $z$ is the quantized vector sequence with the same length as $h , i$ is the index of the speech frame, $j$ is the index of the residual quantizer and $R$ is the total number of residual quantizers, and $e _ { j } ^ { i }$ is the embedding vector of the codebook ID obtained by the $j$ -th residual quantizer on the $i$ -th hidden frame (i.e., $h ^ { i }$ ). The training of the neural codec follows the loss function in (Zeghidour et al., 2021).
267
+
268
+ ![](images/1697a5f7ca97da36ebc1b967296799aed352c3f82cb425f726f076336f5ef5ee.jpg)
269
+ Figure 3: The neural audio codec consists of an encoder, a residual vector-quantizer (RVQ), and a decoder. The encoder extracts the frame-level speech representations from the audio waveform, the RVQ leverages multiple codebooks to quantize the frame-level representations, and the decoder takes the quantized vectors as input and reconstructs the audio waveform. The quantized vectors also serve as the training target of the latent diffusion model.
270
+
271
+ # B THE DETAILS OF WAVENET ARCHITECTURE IN THE DIFFUSION MODEL
272
+
273
+ As shown in Figure 4, the WaveNet consists of 40 blocks. Each block consists of 1) a dilated CNN with kernel size 3 and dilation 2, 2) a Q-K-V attention, and 3) a FiLM layer. In detail, we use Q-K-V attention to attend to the key/value obtained from the first Q-K-V attention module (from the speech prompt encoder) as shown in Figure 2. Then, we use the attention results to generate the scale and bias terms, which are used as the conditional information of the FiLM layer. Finally, we average the skip output results of each layer and calculate the final WaveNet output.
274
+
275
+ # C THE IMPLEMENTATION DETAILS
276
+
277
+ # C.1 MODEL CONFIGURATION DETAILS
278
+
279
+ The phoneme encoder is a 6-layer Transformer (Vaswani et al., 2017) with 8 attention heads, 512 embedding dimensions, 2048 1D convolution filter size, 9 convolution 1D kernel size, and 0.1 dropout rate. The pitch and duration predictor share the same architecture of 30-layer 1D convolution with
280
+
281
+ ![](images/93f1d2483c81be6dc9ef8b80bc7ddfe3260a598cb902cff649728d84386898ad.jpg)
282
+ Figure 4: Overview of the WaveNet architecture in the diffusion model.
283
+
284
+ ReLU activation and layer normalization, $1 0 \mathrm { Q } { \cdot } \mathrm { K } { \cdot } \mathrm { V }$ attention layers for in-context learning, which have 512 hidden dimensions and 8 attention heads and are placed every $3 ~ 1 \mathrm { D }$ convolution layers. We set the dropout to 0.5 in both duration and pitch predictors. The ground-truth pitch is quantized in the log scale and converted into pitch embedding, which is added to the expanded hidden sequence. The pitch is standardized for the learning target. For the speech prompt encoder, we use a 6-layer Transformer with 512 hidden size, which has the same architecture as the phoneme encoder. As for the $m$ query tokens in the first Q-K-V attention in the prompting mechanism in the diffusion model (as shown in Figure 2), we set the token number $m$ to 32 and the hidden dimension to 512.
285
+
286
+ The diffusion model contains 40 WaveNet layers (Oord et al., 2016), which consist of 1D dilated convolution layers with 3 kernel size, 1024 filter size, and 2 dilation size. Specifically, we use a FiLM layer (Perez et al., 2018) at every 3 WaveNet layers to fuse the condition information processed by the second Q-K-V attention in the prompting mechanism in the diffusion model. The hidden size in WaveNet is 512, and the dropout rate is 0.2.
287
+
288
+ We show the more detailed configuration in Table 5.
289
+
290
+ # C.2 MODEL TRAINING AND INFERENCE
291
+
292
+ We first train the audio codec using 8 NVIDIA TESLA V100 16GB GPUs with a batch size of 200 audios per GPU for 440K steps. We follow the implementation and experimental setting of SoundStream (Zeghidour et al., 2021) and adopt Adam optimizer with $2 e - 4$ learning rate. Then we use the trained codec to extract the quantized latent vectors for each audio to train the diffusion model in NaturalSpeech 2.
293
+
294
+ The diffusion model in NaturalSpeech 2 is trained using 16 NVIDIA TESLA V100 32GB GPUs with a batch size of 6K frames of latent vectors per GPU for 300K steps. We optimize the models with the AdamW optimizer with $5 e - 4$ learning rate, 32K warmup steps following the inverse square root learning schedule. We use a linear noise schedule function, i.e., $\beta _ { t } = \beta _ { 0 } + ( \beta _ { 1 } - \beta _ { 0 } ) * t$ , where $\beta _ { 0 } = 0 . 0 5$ and $\beta _ { 1 } = 2 0$ .
295
+
296
+ Table 5: The detailed model configurations of NaturalSpeech 2.
297
+
298
+ <table><tr><td>Module</td><td>Configuration</td><td>Value</td><td>#Parameters</td></tr><tr><td rowspan="5">Audio Codec</td><td>Number of Residual VQ Blocks Codebook size</td><td>16 1024</td><td rowspan="5">27M</td></tr><tr><td></td><td>256</td></tr><tr><td>Codebook Dimension</td><td></td></tr><tr><td>Hop Size</td><td>200</td></tr><tr><td>Similarity Metric</td><td>L2</td></tr><tr><td rowspan="5">Phoneme Encoder</td><td>Transformer Layer</td><td>6</td><td rowspan="5">72M</td></tr><tr><td>Attention Heads</td><td>8</td></tr><tr><td>Convideniter Size</td><td>2518</td></tr><tr><td></td><td></td></tr><tr><td>Conv1D Kernel Size</td><td>9</td></tr><tr><td rowspan="6"></td><td>Dropout</td><td>0.2</td><td rowspan="6">34M</td></tr><tr><td>Conv1D Layers</td><td>30</td></tr><tr><td>Conv1D Kernel Size</td><td>3 10</td></tr><tr><td>Attention Layers Attention Heads</td><td>8</td></tr><tr><td>Hidden Size</td><td>512</td></tr><tr><td>Dropout</td><td>0.5</td></tr><tr><td rowspan="5">Pitch Predictor</td><td>Conv1D Layers</td><td>30</td><td rowspan="5">50M</td></tr><tr><td>Conv1D Kernel Size</td><td>5</td></tr><tr><td> Attention Layers</td><td></td></tr><tr><td></td><td>18</td></tr><tr><td>Hidden Size</td><td>512</td></tr><tr><td rowspan="6"></td><td>Dropout</td><td>0.5</td><td rowspan="6">69M</td></tr><tr><td>Transformer Layer</td><td>6</td></tr><tr><td>Attention Heads</td><td>8</td></tr><tr><td>Hidden Size</td><td>512</td></tr><tr><td>Conv1D Filter Size</td><td>2048</td></tr><tr><td>Conv1D Kernel Size Dropout</td><td>9 0.2</td></tr><tr><td rowspan="6">Diffusion Model</td><td>WaveNet Layer</td><td>40</td><td rowspan="6">183M</td></tr><tr><td>Attention Layers</td><td>13</td></tr><tr><td>Attention Heads</td><td>8</td></tr><tr><td>Hidden Size</td><td>512</td></tr><tr><td>Query Tokens</td><td>32</td></tr><tr><td>Query Token Dimension Dropout</td><td>512</td></tr><tr><td colspan="2"></td><td>0.2</td><td>435M</td></tr><tr><td colspan="2">Total</td><td></td><td></td></tr></table>
299
+
300
+ During inference, for the diffusion model, we find it beneficial to use a temperature $\tau$ and sample the terminal condition $z _ { 1 }$ from $\mathcal { N } ( 0 , \tau ^ { - 1 } I )$ (Popov et al., 2021). We set $\tau$ to $1 . 2 ^ { 2 }$ . To balance the generation quality and latency, we adopt the Euler ODE solver and set the diffusion steps to 150. We quantize the predicted latent vectors and feed them into the audio decoder of the codec to obtain the waveform.
301
+
302
+ # C.3 THE DETAILS OF $\mathcal { L } _ { \mathrm { c e - } }$ rvq
303
+
304
+ For each residual quantizer $j \in [ 1 , R ]$ , we first get the residual vector:
305
+
306
+ $$
307
+ z _ { j } = z _ { 0 } - \sum _ { m = 1 } ^ { j - 1 } \hat { e } ^ { m } ,
308
+ $$
309
+
310
+ where $\hat { e } ^ { m }$ is the ground-truth quantized embedding in the $m$ -th residual quantizer. Then we calculate the L2 distance between the residual vector with each codebook embedding in quantizer $j$ and get a probability distribution as follows:
311
+
312
+ $$
313
+ l _ { i } = | | z _ { j } - e _ { i } ^ { j } | | _ { 2 } , s _ { i } = \frac { e ^ { - l _ { i } } } { \sum _ { k = 1 } ^ { N _ { j } } e ^ { - l _ { k } } } ,
314
+ $$
315
+
316
+ where $N _ { j }$ is the code number of residual quantizer $j$ , and $s _ { i }$ is the probability of code $i$ in codebook $j$ . Finally, we can calculate the cross-entropy loss of residual quantizer $j$ given the ground-truth code index which is denoted as $L _ { c e , j }$ . The final CE-RVQ loss is shown as follows:
317
+
318
+ $$
319
+ L _ { c e - r v q } = \sum _ { j = 1 } ^ { R } L _ { c e , j }
320
+ $$
321
+
322
+ # D THE DETAILS OF BASELINE METHODS
323
+
324
+ We compare NaturalSpeech 2 with the following baselines:
325
+
326
+ • YourTTS (Casanova et al., 2022b). A powerful zero-shot TTS baseline. We use the official code and pre-trained checkpoint4, which is trained on VCTK Veaux et al. (2016), LibriTTS Zen et al. (2019) and TTS-Portuguese Casanova et al. (2022a).
327
+ • FastSpeech 2 (Ren et al., 2021a), which is a classic high-quality TTS system. We adapt it by adding cross-attention on speech prompts for zero-shot synthesis. Furthermore, we also change the prediction target from the mel-spectrogram to the latent representation.
328
+ • FoundationTTS (Xue et al., 2023), which is another strong baseline with a neural audio codec for discrete speech token extraction and waveform reconstruction and a LLM for discrete token generation from linguistic (phoneme) tokens. To extend it to the zero-shot TTS scenario, we use an additional Transformer to encode the prompt speech features and temporally average the output to obtain a one-dimensional speaker embedding. We scale it to 400M parameters and train it on the same MLS dataset for comparison.
329
+ • VALL-E (Wang et al., 2023), which is a strong large-scale zero-shot TTS system. It uses the audio codec to discretize speech waveforms into tokens and language models to generate them. In our experiment, we implement it with reference to a third-party implementation5. Specifically, we use the same neural codec, dataset as used in NaturalSpeech 2 and scale it to 400 parameters for fair comparison.
330
+ • Voicebox (Le et al., 2023), which is a large-scale zero-shot TTS baseline. It uses a flowmatching (Lipman et al., 2022) model to infill speech mel-spectrogram.
331
+ • MegaTTS (Jiang et al., 2023b), which is a GAN-based large-scale zero-shot TTS system. They decompose the mel-spectrogram into different speech attributes such as timbre, and prosody, and model them according to their intrinsic properties.
332
+
333
+ Since the VALL-E, Voicebox, and MegaTTS are not open source, we download the samples from their demo pages and compare them with NaturalSpeech 2 individually. For VALL-E, we collect 8 samples in LibriSpeech and 8 samples in VCTK6. For Voicebox, we collect 8 samples in LibriSpeech7. For MegaTTS, we collect 4 samples in LibriSpeech and 4 samples in VCTK8.
334
+
335
+ # E THE DETAILS OF DATASET
336
+
337
+ Speech Preprocessing: The speech data is resampled to $1 6 \mathrm { K H z }$ . The input text sequence is first converted into a phoneme sequence using grapheme-to-phoneme conversion (Sun et al., 2019) and then aligned with speech using our internal alignment tool to obtain the phoneme-level duration. The frame-level pitch sequence is extracted from the speech using PyWorld9.
338
+
339
+ Singing Preprocessing: We collect approximately 30 hours of songs in waveform format and their corresponding lyrics from the Web, with each songs containing singing, accompaniment, backing vocals, et al. To remove them, we employ a demucs (Défossez, 2021) model for music source separation. We apply the same duration and pitch extraction method as we apply for speech data. During the training process, we mix the singing and speech data samples. Our experimental results indicate that training the model with a mix of large-scale speech data proves to be more advantageous for enhancing its performance, as opposed to fine-tuning it on a small-scale, singing-only dataset.
340
+
341
+ # F EVALUATION METRICS
342
+
343
+ We use both objective and subjective metrics to evaluate the zero-shot synthesis ability of NaturalSpeech 2 and compare it with baselines.
344
+
345
+ Objective Metrics We evaluate the TTS systems with the following objective metrics:
346
+
347
+ • Prosody Similarity with Prompt. Following the practice (Zaïdi et al., 2021), we evaluate the prosody similarity (in terms of pitch and duration) between the generated speech and the prompt speech, which measures how well the TTS model follows the prosody in speech prompt in zero-shot synthesis. We calculate the prosody similarity with the following steps: 1) we extract phonemelevel duration and pitch from the prompt and the synthesized speech; 2) we calculate the mean, standard deviation, skewness, and kurtosis (Ren et al., 2021a) of the pitch and duration in each speech sequence; 3) we calculate the difference of the mean, standard deviation, skewness, and kurtosis between each paired prompt and synthesized speech and average the differences among the whole test set.
348
+ • Prosody Similarity with Ground Truth. We evaluate the prosody similarity (in terms of pitch and duration) between the generated speech and the ground-truth speech, which measures how well the TTS model matches the prosody in the ground truth. Since there is correspondence between two speech sequences, we calculate the Pearson correlation and RMSE of the pitch/duration between the generated and ground-truth speech, and average them on the whole test set.
349
+ • Word Error Rate. We employ an ASR model to transcribe the generated speech and calculate the word error rate (WER). The ASR model is a CTC-based HuBERT (Hsu et al., 2021) pre-trained on Librilight (Kahn et al., 2020) and fine-tuned on the 960 hours training set of LibriSpeech. We use the official code and checkpoint10.
350
+
351
+ Subjective Metrics We conduct human evaluation and use the intelligibility score and mean opinion score as the subjective metrics:
352
+
353
+ • Intelligibility Score. Neural TTS models often suffer from the robustness issues such as word skipping, repeating, and collapse issues, especially for autoregressive models. To demonstrate the robustness of NaturalSpeech 2, following the practice in (Ren et al., 2019), we use the 50 particularly hard sentences (see Appendix G.2) and conduct an intelligibility test. We measure the number of repeating words, skipping words, and error sentences as the intelligibility score. • CMOS and SMOS. Since synthesizing natural voices is one of the main goals of NaturalSpeech 2, we measure naturalness using comparative mean option score (CMOS) with 12 native speakers as the judges. We also use the similarity mean option score (SMOS) between the synthesized and prompt speech to measure the speaker similarity, with 6 native speakers as the judges. We calculate the CMOS and SMOS by a third-party commercial evaluation platform.
354
+
355
+ # G INTELLIGIBILTY TEST
356
+
357
+ Table 6: The robustness of NaturalSpeech 2 and other autoregressive/non-autoregressive models on 50 particularly hard sentences. We conduct an intelligibility test on these sentences and measure the number of word repeating, word skipping, and error sentences. Each kind of word error is counted at once per sentence.
358
+
359
+ <table><tr><td>AR/NAR</td><td>Model</td><td>Repeats</td><td>Skips</td><td>Error Sentences</td><td>Error Rate</td></tr><tr><td rowspan="4">AR</td><td>Tacotron (Wang et al., 2017)</td><td>4</td><td>11</td><td>12</td><td>24%</td></tr><tr><td></td><td>78</td><td>15</td><td></td><td></td></tr><tr><td>TaLL-r(erTs(Li.,tal.,2019)</td><td></td><td></td><td></td><td>34%</td></tr><tr><td>FoundationTTS (Xue et al.,2023)</td><td>2</td><td>16</td><td>16</td><td>32%</td></tr><tr><td rowspan="2">NAR</td><td>FastSpeech (Ren et al., 2019)</td><td>0</td><td>0</td><td>0</td><td>0%</td></tr><tr><td>NaturalSpeech (Tan et al., 2022)</td><td>0</td><td>0</td><td>0</td><td>0%</td></tr><tr><td>NAR</td><td>NaturalSpeech 2</td><td>0</td><td>0</td><td>0</td><td>0%</td></tr></table>
360
+
361
+ # G.1 INTELLIGIBILTY TEST/ROBUSTNESS TEST
362
+
363
+ Autoregressive TTS models often suffer from alignment mismatch between phoneme and speech, resulting in severe word repeating and skipping. To further evaluate the robustness of the diffusionbased TTS model, we adopt the 50 particularly hard sentences in FastSpeech (Ren et al., 2019) to evaluate the robustness of the TTS systems. We can find that the non-autoregressive models such as FastSpeech (Ren et al., 2019), NaturalSpeech (Tan et al., 2022), and also NaturalSpeech 2 are robust for the 50 hard cases, without any intelligibility issues. As a comparison, the autoregressive models such as Tacotron (Wang et al., 2017), Transformer TTS (Li et al., 2019), FoundationTTS (Xue et al., 2023), and VALL-E (Wang et al., 2023) will have a high error rate on these hard sentences. The comparison results are provided in Table 6.
364
+
365
+ # G.2 THE 50 PARTICULARLY HARD SENTENCES
366
+
367
+ The 50 particularly hard sentences used in Section G.1 are listed below:
368
+
369
+ 01. a
370
+ 02. b
371
+ 03. c
372
+ 04. H
373
+ 05. I
374
+ 06. J
375
+ 07. K
376
+ 08. L
377
+ 09. 22222222 hello 22222222
378
+ 10. S D S D Pass zero - zero Fail - zero to zero - zero - zero Cancelled - fifty nine to three - two - sixty four Total - fifty nine to three - two -
379
+ 11. S D S D Pass - zero - zero - zero - zero Fail - zero - zero - zero - zero Cancelled - four hundred and sixteen - seventy six -
380
+ 12. zero - one - one - two Cancelled - zero - zero - zero - zero Total - two hundred and eighty six - nineteen - seven -
381
+ 13. forty one to five three hundred and eleven Fail - one - one to zero two Cancelled - zero - zero to zero zero Total -
382
+ 14. zero zero one , MS03 - zero twenty five , MS03 - zero thirty two , MS03 - zero thirty nine ,
383
+ 15. 1b204928 zero zero zero zero zero zero zero zero zero zero zero zero zero zero one seven ole32
384
+ 16. zero zero zero zero zero zero zero zero two seven nine eight F three forty zero zero zero zero zero six four two eight zero one eight
385
+ 17. c five eight zero three three nine a zero bf eight FALSE zero zero zero bba3add2 - c229 - 4cdb -
386
+ 18. Calendaring agent failed with error code 0x80070005 while saving appointment .
387
+ 19. Exit process - break ld - Load module - output ud - Unload module - ignore ser - System error - ignore ibp - Initial breakpoint -
388
+ 20. Common DB connectors include the DB - nine , DB - fifteen , DB - nineteen , DB - twenty five , DB - thirty seven , and DB - fifty connectors .
389
+ 21. To deliver interfaces that are significantly better suited to create and process RFC eight twenty one , RFC eight twenty two , RFC nine seventy seven , and MIME content .
390
+ 22. int1 , int2 , int3 , int4 , int5 , int6 , int7 , int8 , int9 ,
391
+ 23. seven _ ctl00 ctl04 ctl01 ctl00 ctl00
392
+ 24. Http0XX , Http1XX , Http2XX , Http3XX ,
393
+ 25. config file must contain A , B , C , D , E , F , and G .
394
+ 26. mondo - debug mondo - ship motif - debug motif - ship sts - debug sts - ship Comparing local files to checkpoint files ...
395
+ 27. Rusbvts . dll Dsaccessbvts . dll Exchmembvt . dll Draino . dll Im trying to deploy a new topology , and I keep getting this error .
396
+ 28. You can call me directly at four two five seven zero three seven three four four or my cell four two five four four four seven four seven four or send me a meeting request with all the appropriate information .
397
+ 29. Failed zero point zero zero percent $<$ one zero zero one zero zero zero zero Internal . Exchange . ContentFilter . BVT ContentFilter . BVT_log . xml Error ! Filename not specified .
398
+ 30. C colon backslash o one two f c p a r t y backslash d e v one two backslash oasys backslash legacy backslash web backslash HELP
399
+ 31. src backslash mapi backslash t n e f d e c dot c dot o l d backslash backslash m o z a r t f one backslash e x five
400
+ 32. copy backslash backslash j o h n f a n four backslash scratch backslash M i c r o s o f t dot S h a r e P o i n t dot
401
+ 33. Take a look at h t t p colon slash slash w w w dot granite dot a b dot c a slash access slash email dot
402
+ 34. backslash bin backslash premium backslash forms backslash r e g i o n a l o p t i o n s dot a s p x dot c s Raj , DJ ,
403
+ 35. Anuraag backslash backslash r a d u r five backslash d e b u g dot one eight zero nine underscore P R two h dot s t s contains
404
+ 36. p l a t f o r m right bracket backslash left bracket f l a v o r right bracket backslash s e t u p dot e x e
405
+ 37. backslash x eight six backslash Ship backslash zero backslash A d d r e s s B o o k dot C o n t a c t s A d d r e s
406
+ 38. Mine is here backslash backslash g a b e h a l l hyphen m o t h r a backslash S v r underscore O f f i c e s v r
407
+ 39. h t t p colon slash slash teams slash sites slash T A G slash default dot aspx As always , any feedback , comments ,
408
+ 40. two thousand and five h t t p colon slash slash news dot com dot com slash i slash n e slash f d slash two zero zero three slash f d
409
+ 41. backslash i n t e r n a l dot e x c h a n g e dot m a n a g e m e n t dot s y s t e m m a n a g e
410
+ 42. I think Rich’s post highlights that we could have been more strategic about how the sum total of XBOX three hundred and sixtys were distributed .
411
+ 43. 64X64 , 8K , one hundred and eighty four ASSEMBLY , DIGITAL VIDEO DISK DRIVE , INTERNAL , 8X ,
412
+ 44. So we are back to Extended MAPI and $\mathrm { C } { + + }$ because . Extended MAPI does not have a dual interface VB or VB .Net can read .
413
+ 45. Thanks , Borge Trongmo Hi gurus , Could you help us E2K ASP guys with the following issue ?
414
+
415
+ Table 7: The prosody similarity between synthesized and prompt speech in terms of the difference in mean (Mean), standard deviation (Std), skewness (Skew), and kurtosis (Kurt) of pitch and duration on VCTK.
416
+
417
+ <table><tr><td rowspan="2">VCTK</td><td colspan="4">Pitch</td><td colspan="4">Duration</td></tr><tr><td>Mean↓</td><td>Std</td><td>Skew↓</td><td>Kurt↓</td><td>Mean↓</td><td>Std</td><td>Skew↓</td><td>Kurt</td></tr><tr><td>YourTTS</td><td>13.67</td><td>6.63</td><td>0.72</td><td>1.54</td><td>0.72</td><td>0.85</td><td>0.84</td><td>3.31</td></tr><tr><td>FastSpeech 2</td><td>18.17</td><td>9.87</td><td>2.04</td><td>3.67</td><td>0.81</td><td>0.79</td><td>0.86</td><td>3.12</td></tr><tr><td>FoundationTTS</td><td>13.41</td><td>6.59</td><td>0.76</td><td>1.68</td><td>0.80</td><td>0.82</td><td>0.80</td><td>3.38</td></tr><tr><td>VALL-E</td><td>13.33</td><td>6.44</td><td>0.73</td><td>1.36</td><td>0.74</td><td>0.79</td><td>0.82</td><td>2.91</td></tr><tr><td>NaturalSpeech 2</td><td>13.29</td><td>6.41</td><td>0.68</td><td>1.27</td><td>0.79</td><td>0.76</td><td>0.76</td><td>2.65</td></tr></table>
418
+
419
+ 46. Thanks J RGR Are you using the LDDM driver for this system or the in the build XDDM driver ?
420
+
421
+ 47. Btw , you might remember me from our discussion about OWA automation and OWA readiness day a year ago .
422
+
423
+ 48. empidtool . exe creates HKEY_CURRENT_USER Software Microsoft Office Common QMPersNum in the registry , queries AD , and the populate the registry with MS employment ID if available else an error code is logged .
424
+
425
+ 49. Thursday, via a joint press release and Microsoft AI Blog, we will announce Microsoft’s continued partnership with Shell leveraging cloud, AI, and collaboration technology to drive industry innovation and transformation.
426
+
427
+ 50. Actress Fan Bingbing attends the screening of ’Ash Is Purest White (Jiang Hu Er Nv)’ during the 71st annual Cannes Film Festival
428
+
429
+ # H PROSODY SIMILARITY RESULTS
430
+
431
+ H.1 PROSODY SIMILARITY WITH PROMPT SPEECH ON VCTK
432
+
433
+ In this section, we report the prosody similarity evaluation results on VCTK in Table 7.
434
+
435
+ # H.2 PROSODY SIMILARITY WITH GROUND TRUTH
436
+
437
+ To further investigate the quality of prosody, we follow the generation quality evaluation of prosody similarity between synthesized and prompt speech in Section 4.2 and compare the generated speech with the ground-truth speech. We use Pearson correlation and RMSE to measure the prosody matching between generated and ground-truth speech. The results are shown in Table 8. We observe that NaturalSpeech 2 outperforms all baselines by a large margin, which shows that our NaturalSpeech 2 is much better in prosody similarity.
438
+
439
+ # I EXPERIMENTS ON PROMPT LENGTH
440
+
441
+ Since the prompt length is an important hyper-parameter for zero-shot TTS, we would like to investigate the effect of the prompt length. We follow the setting of prosody similarity between synthesized and prompt speech in Section 4.2. Specifically, we vary the prompt length by $\sigma =$ $\{ 3 , 5 , 1 0 \}$ seconds and report the prosody similarity metrics of NaturalSpeech 2. The results are shown in Table 9. We observe that when the prompt is longer, the similarity between the generated speech and the prompt is higher for NaturalSpeech 2. It shows that the longer prompt reveals more details of the prosody, which help the TTS model to generate more similar speech.
442
+
443
+ # J ABLATION STUDY
444
+
445
+ In this section, we present the detailed ablation results by evaluating the prosody similarity between synthesized audio generated by the ablation model and the prompt speech, which are conducted in Section 4.3. The results are shown in Table 10.
446
+
447
+ Table 8: The prosody similarity between the synthesized and ground-truth speech in terms of the correlation and RMSE on pitch and duration.
448
+
449
+ <table><tr><td rowspan="2">LibriSpeech</td><td colspan="2">Pitch</td><td colspan="2">Duration</td></tr><tr><td>Correlation ↑</td><td>RMSE↓</td><td>Correlation ↑</td><td>RMSE↓</td></tr><tr><td>YourTTS</td><td>0.77</td><td>51.78</td><td>0.52</td><td>3.24</td></tr><tr><td>FastSpeech 2</td><td>0.64</td><td>60.39</td><td>0.63</td><td>2.92</td></tr><tr><td>FoundationTTS</td><td>0.73</td><td>52.18</td><td>0.61</td><td>3.16</td></tr><tr><td>VALL-E</td><td>0.73</td><td>50.80</td><td>0.62</td><td>2.88</td></tr><tr><td>NaturalSpeech 2</td><td>0.81</td><td>47.72</td><td>0.65</td><td>2.72</td></tr><tr><td rowspan="2">VCTK</td><td>Pitch</td><td></td><td>Duration</td><td></td></tr><tr><td>Correlation ↑</td><td>RMSE↓</td><td>Correlation ↑</td><td>RMSE↓</td></tr><tr><td>YourTTS</td><td>0.82</td><td>42.63</td><td>0.55</td><td>2.55</td></tr><tr><td>FastSpeech 2</td><td>0.77</td><td>47.40</td><td>0.60</td><td>2.63</td></tr><tr><td>FoundationTTS</td><td>0.81</td><td>46.00</td><td>0.53</td><td>2.64</td></tr><tr><td>VALL-E</td><td>0.83</td><td>43.27</td><td>0.61</td><td>2.52</td></tr><tr><td>NaturalSpeech 2</td><td>0.87</td><td>39.83</td><td>0.64</td><td>2.50</td></tr></table>
450
+
451
+ Table 9: The NaturalSpeech 2 prosody similarity between the synthesized and prompt speech with different lengths in terms of the difference in the mean (Mean), standard deviation (Std), skewness (Skew), and kurtosis (Kurt) of pitch and duration.
452
+
453
+ <table><tr><td rowspan="2">LibriSpeech</td><td colspan="4">Pitch</td><td colspan="4">Duration</td></tr><tr><td>Mean↓</td><td>Std↓</td><td>Skew↓</td><td>Kurt</td><td>Mean↓</td><td>Std</td><td>Skew↓</td><td>Kurt</td></tr><tr><td>3s</td><td>10.11</td><td>6.18</td><td>0.50</td><td>1.01</td><td>0.65</td><td>0.70</td><td>0.60</td><td>2.99</td></tr><tr><td>5s</td><td>6.96</td><td>4.29</td><td>0.42</td><td>0.77</td><td>0.69</td><td>0.60</td><td>0.53</td><td>2.52</td></tr><tr><td>10s</td><td>6.90</td><td>4.03</td><td>0.48</td><td>1.36</td><td>0.62</td><td>0.45</td><td>0.56</td><td>2.48</td></tr><tr><td rowspan="2">VCTK</td><td colspan="5">Pitch</td><td colspan="3">Duration</td></tr><tr><td>Mean↓</td><td>Std↓</td><td>Skew↓</td><td>Kurt</td><td>Mean↓</td><td>Std</td><td>Skew↓</td><td>Kurt↓</td></tr><tr><td>3s</td><td>13.29</td><td>6.41</td><td>0.68</td><td>1.27</td><td>0.79</td><td>0.76</td><td>0.76</td><td>2.65</td></tr><tr><td>5s</td><td>14.46</td><td>5.47</td><td>0.63</td><td>1.23</td><td>0.62</td><td>0.67</td><td>0.74</td><td>3.40</td></tr><tr><td>10s</td><td>10.28</td><td>4.31</td><td>0.41</td><td>0.87</td><td>0.71</td><td>0.62</td><td>0.76</td><td>3.48</td></tr></table>
454
+
455
+ Furthermore, we also compare the prosody similarity between audio generated by the ablation model and the ground-truth speech in Table 11. Similar to the results of comparing the audio generated by the ablation model and prompt speech, we also have the following observations. 1) The speech prompt is most important to the generation quality. 2) The cross-entropy and the query attention strategy are also helpful in high-quality speech synthesis.
456
+
457
+ # K LATENCY STUDY OF NATURALSPEECH 2
458
+
459
+ In this section, we report the inference latency of NaturalSpeech 2. We vary the diffusion step in $\{ 2 0 , 5 0 , 1 0 0 , 1 5 0 \}$ , and report both the latency (RTF) and generation quality (CMOS). We also compare NaturalSpeech 2 with a NAR baseline (FastSpeech 2) and an AR model (VALL-E). The latency tests are conducted on a server with E5-2690 Intel Xeon CPU, 512GB memory, and one NVIDIA V100 GPU. The results are shown in Table 12.
460
+
461
+ From the results, we have several observations. 1) When the diffusion step is 150 (used in our paper), NaturalSpeech 2 is 33.3 times slower than the NAR model FastSpeech 2, but achieves 0.53 CMOS gain. Still, it is 12.35 times faster than VALL-E. 2) NaturalSpeech 2 has 0.08 CMOS drop and
462
+
463
+ Table 10: The ablation study of NaturalSpeech 2. The prosody similarity between the synthesized and prompt speech in terms of the difference in the mean (Mean), standard variation (Std), skewness (Skew), and kurtosis (Kurt) of pitch and duration. “-" denotes the model can not converge.
464
+
465
+ <table><tr><td rowspan="2"></td><td colspan="4">Pitch</td><td colspan="4">Duration</td></tr><tr><td>Mean↓</td><td>Std</td><td>Skew↓</td><td>Kurt↓</td><td>Mean↓</td><td>Std</td><td>Skew↓</td><td>Kurt</td></tr><tr><td>NaturalSpeech 2</td><td>10.11</td><td>6.18</td><td>0.50</td><td>1.01</td><td>0.65</td><td>0.70</td><td>0.60</td><td>2.99</td></tr><tr><td> w/o. diff prompt</td><td>-</td><td>1</td><td></td><td>-</td><td></td><td>1</td><td></td><td></td></tr><tr><td>w/o. dur/pitch prompt</td><td>21.69</td><td>19.38</td><td>0.63</td><td>1.29</td><td>0.77</td><td>0.72</td><td>0.70</td><td>3.70</td></tr><tr><td>w/o. CE loss</td><td>10.69</td><td>6.24</td><td>0.55</td><td>1.06</td><td>0.71</td><td>0.72</td><td>0.74</td><td>3.85</td></tr><tr><td> w/o. query attn</td><td>10.78</td><td>6.29</td><td>0.62</td><td>1.37</td><td>0.67</td><td>0.71</td><td>0.69</td><td>3.59</td></tr></table>
466
+
467
+ Table 11: The ablation study of NaturalSpeech 2. The prosody similarity between the synthesized and ground-truth speech in terms of the correlation and RMSE on pitch and duration. “-" denotes that the model can not converge.
468
+
469
+ <table><tr><td rowspan="2"></td><td colspan="2">Pitch</td><td colspan="2">Duration</td></tr><tr><td>Correlation ↑</td><td>RMSE↓</td><td>Correlation ↑</td><td>RMSE↓</td></tr><tr><td> NaturalSpeech 2</td><td>0.81</td><td>47.72</td><td>0.65</td><td>2.72</td></tr><tr><td> w/o. diff prompt</td><td></td><td></td><td>1</td><td></td></tr><tr><td> w/o. dur/pitch prompt</td><td>0.80</td><td>55.00</td><td>0.59</td><td>2.76</td></tr><tr><td>w/o. CE loss</td><td>0.79</td><td>50.69</td><td>0.63</td><td>2.73</td></tr><tr><td>w/o. query attn</td><td>0.79</td><td>50.65</td><td>0.63</td><td>2.73</td></tr></table>
470
+
471
+ 2.95 times speedup (compared with 150 steps) when the diffusion step is 50. The CMOS drops 0.21 while it can achieve 7.31 times speedup (compared with 150 steps) when the diffusion step is 20. Furthermore, since NaturalSpeech 2 is parallel to many diffusion speedup works such as the consistency model Song et al. (2023), we will explore speeding up the diffusion model while retaining the generation quality in the future.
472
+
473
+ # L VOICE CONVERSION AND SPEECH ENHANCEMENT
474
+
475
+ # L.1 VOICE CONVERSION
476
+
477
+ Besides zero-shot text-to-speech and singing synthesis, NaturalSpeech 2 also supports zero-shot voice conversion, which aims to convert the source audio $z _ { s o u r c e }$ into the target audio $z _ { t a r g e t }$ using the voice of the prompt audio $z _ { p r o m p t }$ . Technically, we first convert the source audio $z _ { s o u r c e }$ into an informative Gaussian noise $z _ { 1 }$ using a source-aware diffusion process and generate the target audio $z _ { t a r g e t }$ using a target-aware denoising process, shown as follows.
478
+
479
+ Source-Aware Diffusion Process In voice conversion, it is helpful to provide some necessary information from source audio for target audio in order to ease the generation process. Thus, instead of directly diffusing the source audio with some Gaussian noise, we diffuse the source audio into a starting point that still maintains some information in the source audio. Specifically, inspired by the stochastic encoding process in Diffusion Autoencoder (Preechakul et al., 2022), we obtain the starting point $z _ { 1 }$ from $z _ { s o u r c e }$ as follows:
480
+
481
+ $$
482
+ z _ { 1 } = z _ { 0 } + \int _ { 0 } ^ { 1 } - \frac { 1 } { 2 } ( z _ { t } + \Sigma _ { t } ^ { - 1 } ( \rho ( \hat { s } _ { \theta } ( z _ { t } , t , c ) , t ) - z _ { t } ) ) \beta _ { t } \mathrm { d } t ,
483
+ $$
484
+
485
+ where $\Sigma _ { t } ^ { - 1 } ( \rho ( \hat { s } _ { \theta } ( z _ { t } , t , c ) , t ) - z _ { t } )$ is the predicted score at $t$ . We can think of this process as the reverse of ODE (Equation 4) in the denoising process.
486
+
487
+ Table 12: The latency study of NaturalSpeech 2. We report the RTF and CMOS results for different diffusion steps.
488
+
489
+ <table><tr><td>Model</td><td>Diffusion Step</td><td>RTF</td><td>CMOS</td></tr><tr><td>NaturalSpeech 2</td><td>150</td><td>0.366</td><td>0.00</td></tr><tr><td>NaturalSpeech 2</td><td>100</td><td>0.244</td><td>-0.02</td></tr><tr><td>NaturalSpeech 2</td><td>50</td><td>0.124</td><td>-0.08</td></tr><tr><td>NaturalSpeech 2</td><td>20</td><td>0.050</td><td>-0.21</td></tr><tr><td>FastSpeech 2</td><td>1</td><td>0.011</td><td>-0.53</td></tr><tr><td>VALL-E</td><td>1</td><td>4.52</td><td>-0.29</td></tr></table>
490
+
491
+ Target-Aware Denoising Process Different from the TTS which starts from the random Gaussian noise, the denoising process of voice conversion starts from the $z _ { 1 }$ obtained from the source-aware diffusion process. We run the standard denoising process as in the TTS setting to obtain the final target audio $z _ { t a r g e t }$ , conditioned on $c$ and the prompt audio $z _ { p r o m p t }$ , where $c$ is obtained from the phoneme and the duration sequence of the source audio and the predicted pitch sequence.
492
+
493
+ # L.2 SPEECH ENHANCEMENT
494
+
495
+ NaturalSpeech 2 can be extended to speech enhancement, which is similar to the extension of voice conversion. In this setting, we assume that we have the source audio $z _ { s o u r c e } ^ { \prime }$ which contains background noise ( $z ^ { \prime }$ denotes the audio with background noise), the prompt with background noise $z _ { p r o m p t } ^ { \prime }$ for the source-aware diffusion process, and the prompt without background noise zprompt for target-aware denoising process. Note that $z _ { s o u r c e } ^ { \prime }$ and $z _ { p r o m p t } ^ { \prime }$ have the same background noise.
496
+
497
+ To remove the background noise, firstly, we apply the source-aware diffusion process by $z _ { s o u r c e } ^ { \prime }$ and $z _ { p r o m p t } ^ { \prime }$ and obtain there. Secondly, $z _ { 1 }$ as in Equation 11. The source audio’s duration and pitch are utilizedrun the target-aware denoising process to obtain the clean audio by thisand $z _ { 1 }$ the clean prompt $z _ { p r o m p t }$ . Specifically, we use the phoneme sequence, duration sequence, and pitch sequence of the source audio in this procedure.
498
+
499
+ # M LIMITATION AND FUTURE WORKS
500
+
501
+ Despite NaturalSpeech 2 has made great progress, it still suffers from the following issues.
502
+
503
+ Data coverage. Although the 44K speech data from MLS dataset is large compared to previous works, they can not cover everyone’s voice. In audiobooks, most speakers will read the books clearly and fluently, while in real world people will speak causally, thus leading to degradation when generalizing to real-world scenarios. In the future, we will scale NaturalSpeech 2 to more generalized and larger-scale benchmarks to enhance the zero-shot generation ability.
504
+
505
+ Inference efficiency. Although NaturalSpeech 2 is a non-autoregressive generation model, it still needs multiple iterations during inference. In the future, we will explore efficient strategies such as consistency models to speed up the diffusion model.
506
+
507
+ Singing voice quality. Although NaturalSpeech 2 can synthesize singing voices in a zero-shot manner, the quality is not as good as the TTS synthesis’s quality. We think we are limited in two aspects: 1) the scale of singing data and 2) the quality of singing data. For data scale, we only collect 30 hours, which is small compared with the speech data scale. For data quality, it is difficult to obtain clean human voices from commercial songs, which are a combination of vocals, backing vocals, accompaniment, and other background noises. In the future, we will first explore more efficient methods to collect more singing data and obtain higher-quality singing voices to enhance the singing voice quality.
parse/test/Rc7dAwVL3v/Rc7dAwVL3v_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/Rc7dAwVL3v/Rc7dAwVL3v_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/Rc7dAwVL3v/Rc7dAwVL3v_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/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
+ ![](images/a0f45b109aebac593fd1627509cf1ac1b71dc70720e738fdb5b6f0c3a698202f.jpg)
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
+ ![](images/405bcc0966d6d3a8753a62a63e0dbde7cf2f55a989ee267806b347708541cef3.jpg)
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
+ ![](images/b0c50b023e8b22ac17d1a006a2f8d9c2aa6953560d6b3c4d8055c7d13c36b400.jpg)
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
+ ![](images/ab634a7be7b787863d8b237646ecc933fd7f95ec21eef8b8bef04437d21e2516.jpg)
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.
parse/test/SXMTK2eltf/SXMTK2eltf_content_list.json ADDED
@@ -0,0 +1,472 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "GPT-DRIVER: LEARNING TO DRIVE WITH GPT ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Anonymous authors Paper under double-blind review ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "ABSTRACT ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "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. ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "1 INTRODUCTION ",
27
+ "text_level": 1,
28
+ "page_idx": 0
29
+ },
30
+ {
31
+ "type": "text",
32
+ "text": "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. ",
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "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. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "text",
42
+ "text": "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. ",
43
+ "page_idx": 0
44
+ },
45
+ {
46
+ "type": "text",
47
+ "text": "",
48
+ "page_idx": 1
49
+ },
50
+ {
51
+ "type": "text",
52
+ "text": "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. ",
53
+ "page_idx": 1
54
+ },
55
+ {
56
+ "type": "text",
57
+ "text": "We summarize our contributions as follows: ",
58
+ "page_idx": 1
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "· 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. ",
63
+ "page_idx": 1
64
+ },
65
+ {
66
+ "type": "text",
67
+ "text": "· 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. ",
68
+ "page_idx": 1
69
+ },
70
+ {
71
+ "type": "text",
72
+ "text": "· 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. ",
73
+ "page_idx": 1
74
+ },
75
+ {
76
+ "type": "text",
77
+ "text": "2 RELATED WORKS ",
78
+ "text_level": 1,
79
+ "page_idx": 1
80
+ },
81
+ {
82
+ "type": "text",
83
+ "text": "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. ",
84
+ "page_idx": 1
85
+ },
86
+ {
87
+ "type": "text",
88
+ "text": "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. ",
89
+ "page_idx": 1
90
+ },
91
+ {
92
+ "type": "image",
93
+ "img_path": "images/a0f45b109aebac593fd1627509cf1ac1b71dc70720e738fdb5b6f0c3a698202f.jpg",
94
+ "image_caption": [
95
+ "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. "
96
+ ],
97
+ "image_footnote": [],
98
+ "page_idx": 2
99
+ },
100
+ {
101
+ "type": "text",
102
+ "text": "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. ",
103
+ "page_idx": 2
104
+ },
105
+ {
106
+ "type": "text",
107
+ "text": "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. ",
108
+ "page_idx": 2
109
+ },
110
+ {
111
+ "type": "text",
112
+ "text": "3 GPT-DRIVER ",
113
+ "text_level": 1,
114
+ "page_idx": 2
115
+ },
116
+ {
117
+ "type": "text",
118
+ "text": "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). ",
119
+ "page_idx": 2
120
+ },
121
+ {
122
+ "type": "text",
123
+ "text": "3.1 PROBLEM DEFINITION ",
124
+ "text_level": 1,
125
+ "page_idx": 3
126
+ },
127
+ {
128
+ "type": "text",
129
+ "text": "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: ",
130
+ "page_idx": 3
131
+ },
132
+ {
133
+ "type": "equation",
134
+ "img_path": "images/f6d8bfebffd34f7377ae3b0993e417ed7ae9d82d600dd1ef197b982975825d07.jpg",
135
+ "text": "$$\n{ \\mathcal { T } } = F ( { \\mathcal { O } } , S ) .\n$$",
136
+ "text_format": "latex",
137
+ "page_idx": 3
138
+ },
139
+ {
140
+ "type": "text",
141
+ "text": "A planned trajectory $\\tau$ can be represented as a set of waypoints of $t$ timesteps: $\\mathcal { T } \\in R ^ { t \\times 2 }$ : ",
142
+ "page_idx": 3
143
+ },
144
+ {
145
+ "type": "equation",
146
+ "img_path": "images/0b8f5a8f258350f9edfe72808a47cd67f732966193fa0cb457c8429c6908bce8.jpg",
147
+ "text": "$$\n\\mathcal { T } = \\{ ( x _ { 1 } , y _ { 1 } ) , \\cdot \\cdot \\cdot , ( x _ { t } , y _ { t } ) \\} ,\n$$",
148
+ "text_format": "latex",
149
+ "page_idx": 3
150
+ },
151
+ {
152
+ "type": "text",
153
+ "text": "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. ",
154
+ "page_idx": 3
155
+ },
156
+ {
157
+ "type": "text",
158
+ "text": "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: ",
159
+ "page_idx": 3
160
+ },
161
+ {
162
+ "type": "equation",
163
+ "img_path": "images/0708d849c6abaf1346b2d06dd8f044049bcaaa8d54ace8cf1acee4c50ad4d675.jpg",
164
+ "text": "$$\n\\mathcal { L } _ { r e g } = \\sum _ { i = 1 } ^ { T } ( | x _ { i } - \\hat { x } _ { i } | + | y _ { i } - \\hat { y } _ { i } | ) ,\n$$",
165
+ "text_format": "latex",
166
+ "page_idx": 3
167
+ },
168
+ {
169
+ "type": "text",
170
+ "text": "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. ",
171
+ "page_idx": 3
172
+ },
173
+ {
174
+ "type": "text",
175
+ "text": "3.2 MOTION PLANNING AS LANGUAGE MODELING ",
176
+ "text_level": 1,
177
+ "page_idx": 3
178
+ },
179
+ {
180
+ "type": "text",
181
+ "text": "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: ",
182
+ "page_idx": 3
183
+ },
184
+ {
185
+ "type": "equation",
186
+ "img_path": "images/709a6e890e8029342c710bd358210a4f351e05202290f00eb9671268c28b4db9.jpg",
187
+ "text": "$$\n{ \\mathcal { T } } = K ( \\{ ( x _ { 1 } , y _ { 1 } ) , \\cdots , ( x _ { t } , y _ { t } ) \\} ) = \\{ w _ { 1 } , \\cdots , w _ { n } \\} ,\n$$",
188
+ "text_format": "latex",
189
+ "page_idx": 3
190
+ },
191
+ {
192
+ "type": "text",
193
+ "text": "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: ",
194
+ "page_idx": 3
195
+ },
196
+ {
197
+ "type": "equation",
198
+ "img_path": "images/d89e2c26bcf8a37cf26814cff7784fbbaf157c810feca5fc63e1d4b0970b9722.jpg",
199
+ "text": "$$\n\\mathcal { L } _ { L M } = - \\sum _ { i = 1 } ^ { N } \\log P ( \\hat { w } _ { i } | w _ { 1 } , \\cdot \\cdot \\cdot , w _ { i - 1 } ) ,\n$$",
200
+ "text_format": "latex",
201
+ "page_idx": 3
202
+ },
203
+ {
204
+ "type": "text",
205
+ "text": "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. ",
206
+ "page_idx": 3
207
+ },
208
+ {
209
+ "type": "text",
210
+ "text": "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. ",
211
+ "page_idx": 3
212
+ },
213
+ {
214
+ "type": "image",
215
+ "img_path": "images/405bcc0966d6d3a8753a62a63e0dbde7cf2f55a989ee267806b347708541cef3.jpg",
216
+ "image_caption": [
217
+ "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. "
218
+ ],
219
+ "image_footnote": [],
220
+ "page_idx": 4
221
+ },
222
+ {
223
+ "type": "text",
224
+ "text": "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. ",
225
+ "page_idx": 4
226
+ },
227
+ {
228
+ "type": "text",
229
+ "text": "3.3 PROMPTING-REASONING-FINETUNING ",
230
+ "text_level": 1,
231
+ "page_idx": 4
232
+ },
233
+ {
234
+ "type": "text",
235
+ "text": "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 ",
236
+ "page_idx": 4
237
+ },
238
+ {
239
+ "type": "image",
240
+ "img_path": "images/b0c50b023e8b22ac17d1a006a2f8d9c2aa6953560d6b3c4d8055c7d13c36b400.jpg",
241
+ "image_caption": [
242
+ "Figure 3: An example of the expected outputs of the LLM. The chain-of-thought reasoning and the planned trajectory are highlighted in red. "
243
+ ],
244
+ "image_footnote": [],
245
+ "page_idx": 5
246
+ },
247
+ {
248
+ "type": "equation",
249
+ "img_path": "images/c034175870d4e22e14406803d9387ede89fac4c1c3ba114a07a748e9536fad2c.jpg",
250
+ "text": "$$\n\\{ \\mathcal { T } , \\mathcal { R } \\} = F _ { G P T } ( K ( \\mathcal { O } , \\mathcal { S } ) ) ,\n$$",
251
+ "text_format": "latex",
252
+ "page_idx": 5
253
+ },
254
+ {
255
+ "type": "text",
256
+ "text": "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. ",
257
+ "page_idx": 5
258
+ },
259
+ {
260
+ "type": "text",
261
+ "text": "In subsequent sections, we delve into details of the prompting, reasoning, and fine-tuning process. ",
262
+ "page_idx": 5
263
+ },
264
+ {
265
+ "type": "text",
266
+ "text": "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. ",
267
+ "page_idx": 5
268
+ },
269
+ {
270
+ "type": "text",
271
+ "text": "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. ",
272
+ "page_idx": 5
273
+ },
274
+ {
275
+ "type": "text",
276
+ "text": "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. ",
277
+ "page_idx": 5
278
+ },
279
+ {
280
+ "type": "text",
281
+ "text": "",
282
+ "page_idx": 6
283
+ },
284
+ {
285
+ "type": "text",
286
+ "text": "4 EXPERIMENTS ",
287
+ "text_level": 1,
288
+ "page_idx": 6
289
+ },
290
+ {
291
+ "type": "text",
292
+ "text": "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. ",
293
+ "page_idx": 6
294
+ },
295
+ {
296
+ "type": "text",
297
+ "text": "4.1 EXPERIMENTAL SETUP ",
298
+ "text_level": 1,
299
+ "page_idx": 6
300
+ },
301
+ {
302
+ "type": "text",
303
+ "text": "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. ",
304
+ "page_idx": 6
305
+ },
306
+ {
307
+ "type": "text",
308
+ "text": "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. ",
309
+ "page_idx": 6
310
+ },
311
+ {
312
+ "type": "text",
313
+ "text": "4.2 COMPARISON AGAINST THE STATE-OF-THE-ART METHODS ",
314
+ "text_level": 1,
315
+ "page_idx": 6
316
+ },
317
+ {
318
+ "type": "text",
319
+ "text": "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. ",
320
+ "page_idx": 6
321
+ },
322
+ {
323
+ "type": "text",
324
+ "text": "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. ",
325
+ "page_idx": 6
326
+ },
327
+ {
328
+ "type": "text",
329
+ "text": "4.3 FEW-SHOT MOTION PLANNING ",
330
+ "text_level": 1,
331
+ "page_idx": 6
332
+ },
333
+ {
334
+ "type": "text",
335
+ "text": "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. ",
336
+ "page_idx": 6
337
+ },
338
+ {
339
+ "type": "table",
340
+ "img_path": "images/95d16dcb43bd3ccbbf07be2786f755852a5a4ff8c0502ab7ed6f65138201528b.jpg",
341
+ "table_caption": [
342
+ "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. "
343
+ ],
344
+ "table_footnote": [],
345
+ "table_body": "<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>",
346
+ "page_idx": 7
347
+ },
348
+ {
349
+ "type": "table",
350
+ "img_path": "images/d4cba5a978dc59ee9d4424e498e8b5dbff2275a62d4485b229e77734eb501cbb.jpg",
351
+ "table_caption": [
352
+ "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. "
353
+ ],
354
+ "table_footnote": [],
355
+ "table_body": "<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>",
356
+ "page_idx": 7
357
+ },
358
+ {
359
+ "type": "text",
360
+ "text": "",
361
+ "page_idx": 7
362
+ },
363
+ {
364
+ "type": "text",
365
+ "text": "4.4 INTERPRETABILITY ",
366
+ "text_level": 1,
367
+ "page_idx": 7
368
+ },
369
+ {
370
+ "type": "text",
371
+ "text": "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. ",
372
+ "page_idx": 7
373
+ },
374
+ {
375
+ "type": "text",
376
+ "text": "4.5 FINE-TUNING VS. IN-CONTEXT LEARNING ",
377
+ "text_level": 1,
378
+ "page_idx": 7
379
+ },
380
+ {
381
+ "type": "text",
382
+ "text": "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. ",
383
+ "page_idx": 7
384
+ },
385
+ {
386
+ "type": "image",
387
+ "img_path": "images/ab634a7be7b787863d8b237646ecc933fd7f95ec21eef8b8bef04437d21e2516.jpg",
388
+ "image_caption": [
389
+ "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. "
390
+ ],
391
+ "image_footnote": [],
392
+ "page_idx": 8
393
+ },
394
+ {
395
+ "type": "table",
396
+ "img_path": "images/a14454463da64cdeed2a684d307c5074c22de70f863a9565616fbbfc11295b09.jpg",
397
+ "table_caption": [
398
+ "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. "
399
+ ],
400
+ "table_footnote": [],
401
+ "table_body": "<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>",
402
+ "page_idx": 8
403
+ },
404
+ {
405
+ "type": "text",
406
+ "text": "",
407
+ "page_idx": 8
408
+ },
409
+ {
410
+ "type": "text",
411
+ "text": "4.6 LIMITATIONS ",
412
+ "text_level": 1,
413
+ "page_idx": 9
414
+ },
415
+ {
416
+ "type": "text",
417
+ "text": "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. ",
418
+ "page_idx": 9
419
+ },
420
+ {
421
+ "type": "text",
422
+ "text": "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. ",
423
+ "page_idx": 9
424
+ },
425
+ {
426
+ "type": "text",
427
+ "text": "5 CONCLUSION ",
428
+ "text_level": 1,
429
+ "page_idx": 9
430
+ },
431
+ {
432
+ "type": "text",
433
+ "text": "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. ",
434
+ "page_idx": 9
435
+ },
436
+ {
437
+ "type": "text",
438
+ "text": "REFERENCES ",
439
+ "text_level": 1,
440
+ "page_idx": 10
441
+ },
442
+ {
443
+ "type": "text",
444
+ "text": "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. ",
445
+ "page_idx": 10
446
+ },
447
+ {
448
+ "type": "text",
449
+ "text": "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. \nMariusz 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. \nAnthony 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. \nTom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. \nHolger 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. \nSergio 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. \nChenyi 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. \nTing 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. \nFelipe 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. \nFelipe 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. \nDaniel Dauner, Marcel Hallgarten, Andreas Geiger, and Kashyap Chitta. Parting with misconceptions about learning-based vehicle motion planning. arXiv preprint arXiv:2306.07962, 2023. \nHaoyang 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. \nDaocheng 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. \nPeiyun 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. \nShengchao 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. ",
450
+ "page_idx": 10
451
+ },
452
+ {
453
+ "type": "text",
454
+ "text": "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. ",
455
+ "page_idx": 11
456
+ },
457
+ {
458
+ "type": "text",
459
+ "text": "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. \nBo 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. \nTarasha 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. \nJohn 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. \nBai 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. \nAlexander 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. \nOpenAI. Gpt-4 technical report. 2023. \nLong 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. \nNicholas 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. \nAbbas 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. \nAxel Sauer, Nikolay Savinov, and Andreas Geiger. Conditional affordance learning for driving in urban environments. In Conference on Robot Learning, pp. 237–252. PMLR, 2018. \nPatrick 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. \nChan 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. \nSebastian 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. \nHugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee´ Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and \\` ",
460
+ "page_idx": 11
461
+ },
462
+ {
463
+ "type": "text",
464
+ "text": "efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023a. ",
465
+ "page_idx": 11
466
+ },
467
+ {
468
+ "type": "text",
469
+ "text": "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. \nMartin Treiber, Ansgar Hennecke, and Dirk Helbing. Congested traffic states in empirical observations and microscopic simulations. Physical review E, 62(2):1805, 2000. \nChris 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. \nWenhai 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. \nJason 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. \nYujing 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. \nShunyu 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. \nWenyuan 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. ",
470
+ "page_idx": 12
471
+ }
472
+ ]
parse/test/SXMTK2eltf/SXMTK2eltf_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/SXMTK2eltf/SXMTK2eltf_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/TOE6N8dp4w/TOE6N8dp4w.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/TOE6N8dp4w/TOE6N8dp4w_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/TOE6N8dp4w/TOE6N8dp4w_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/TOE6N8dp4w/TOE6N8dp4w_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/TyFrPOKYXw/TyFrPOKYXw.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/TyFrPOKYXw/TyFrPOKYXw_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/TyFrPOKYXw/TyFrPOKYXw_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/TyFrPOKYXw/TyFrPOKYXw_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/c8McWs4Av0/c8McWs4Av0.md ADDED
@@ -0,0 +1,803 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOLVING CHALLENGING MATH WORD PROBLEMS USING GPT-4 CODE INTERPRETER WITH CODEBASED SELF-VERIFICATION
2
+
3
+ Aojun Zhou1∗ Ke Wang1∗ Zimu Lu1∗ Weikang Shi1∗ Sichun Luo3∗ Zipeng Qin1 Shaoqing Lu 4 Anya Jia 5 Linqi Song3 Mingjie Zhan1†‡ Hongsheng Li1,2‡
4
+
5
+ 1MMLab, The Chinese University of Hong Kong 2Shanghai Artificial Intelligence Laboratory 3City University of Hong Kong 4CSUST 5Tufts University {aojunzhou, zmjdll}@gmail.com hsli@ee.cuhk.edu.hk
6
+
7
+ # ABSTRACT
8
+
9
+ Recent progress in large language models (LLMs) like GPT-4 and PaLM-2 has brought significant advancements in solving math problems. In particular, OpenAI’s latest version of GPT-4, known as GPT-4 Code Interpreter, shows remarkable performance on challenging math datasets. In this paper, we explore the effect of code on enhancing LLMs’ reasoning capability by introducing different constraints on the Code Usage Frequency of GPT-4 Code Interpreter. We found that its success can be primarily attributed to its powerful skills in generating and executing code, evaluating the execution result, and rectifying its solution when receiving unreasonable outputs. Based on this, we propose a novel prompting method, explicit code-based self-verification (CSV). This method employs a zero-shot prompt on the GPT-4 Code Interpreter to encourage it to use code to self-verify its answers. In instances where the verification state is "False", the model will automatically amend its solution. Furthermore, we recognize that the states of the verification result indicate the confidence of a solution, which can improve the effectiveness of majority voting. With GPT-4 Code Interpreter and CSV, we achieve an impressive zero-shot accuracy of various mathematical problem-solving benchmarks.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Large language models (LLMs) (Brown et al., 2020; OpenAI, 2023; Anil et al., 2023) have shown impressive success in various tasks. However, they still fall short in mathematical reasoning, often producing nonsensical or inaccurate content and struggling with complex calculations. Previous works to tackle these challenges include the Chain-of-Thought (CoT) (Wei et al., 2022) framework, which enhances LLMs’ logical reasoning abilities by generating intermediate reasoning steps. Additionally, PAL (Gao et al., 2023) uses the Python interpreter to improve computational accuracy.
14
+
15
+ Recently, OpenAI has unveiled an improved version of GPT-4, namely the GPT-4 Code Interpreter1 or GPT4-Code, which is good at providing natural language reasoning, alongside step-by-step Python code. Notably, it can generate and execute code incrementally, and subsequently present the execution results back to the LLM. This mechanism has shown promising results in solving mathematical problems. Our initial experiments show that GPT4-Code achieved an impressive zero-shot accuracy of $6 9 . 6 9 \%$ on the challenging MATH dataset (Hendrycks et al., 2021), marking a significant improvement of $2 7 . 5 \%$ over GPT-4’s performance $( 4 2 . 2 \% )$ .
16
+
17
+ While GPT4-Code has demonstrated proficiency in solving math problems, there has been a notable absence of systematic analysis focusing on understanding and further enhancing its mathematical problem-solving abilities. A critical distinction between GPT4-Code and its predecessor, GPT4, lies in GPT4-Code’s ability to automatically generate and execute code. Therefore, this paper presents pilot experiments investigating GPT4-Code’s code generation and execution mechanism using specific code-constrained prompts. The analysis reveals that GPT4-Code’s strong performance is not solely due to its code generation and execution abilities but also its capacity to adjust its problem-solving strategies based on feedback from code execution—a process we term selfdebugging (akin to (Chen et al., 2023b)), examples illustrated in Appendix E. Due to this clever mechanism, there is an increased frequency of code usage. Hence, we introduce Code Usage Frequency to differentiate these unique prompting strategies to quantitatively analyze the impact of code-constrained prompts on GPT4-Code for mathematical problem-solving. The step-by-step code generation and self-debugging mechanisms highlight the critical role of code in mathematical problem-solving. Nevertheless, the self-debugging mechanism only verifies the correctness of code while lacking the verification of the reasoning steps and the final answer, which has been demonstrated to be of vital importance to solve math problems of LLMs (Cobbe et al., 2021; Lightman et al., 2023).
18
+
19
+ We therefore ask the question: can we fully exploit the code generation and self-debugging mechanisms in GPT4-code, so that it can automatically verify and correct its solutions, without extra assistance from other models or users?
20
+
21
+ To answer this question, we propose a simple yet effective prompting technique termed the explicit code-based self-verification (CSV), which guides GPT4-Code to generate additional code that verifies the answer and adjusts the reasoning steps if there’s a flaw in reasoning. Unlike previous methods that rely on external language models for verification (Lightman et al., 2023; Cobbe et al., 2021), our approach leverages GPT4-Code’s inherent strengths. This approach offers two key benefits: (1) When the verification indicates an answer is False, GPT4-Code can rectify its prior solution and provide an improved alternative. (2) Solutions verified as True tend to be more reliable, akin to human problem-solving. However, even if a solution is self-verified as False, we do not directly abandon it. Instead, we propose a weighted majority voting strategy that incorporates the code-based solution verification results, as opposed to relying exclusively on the frequency of answers. We assign different weights to the solutions according to their verification states, reflecting the solutions’ varying levels of reliability. In alignment with the Code Usage Frequency analysis from our pilot experiments, our explicit code-based self-verification prompt boosts GPT4-Code’s accuracy in mathematical problem-solving with increased code usage.
22
+
23
+ Empirical study demonstrates the effectiveness of our proposed pipeline on the MATH, GSM8K, and MMLU-Math datasets using GPT4-Code. Our method achieves an impressive accuracy of $8 4 . 3 \%$ on the MATH dataset, greatly outperforming the base GPT4-Code and previous SOTA methods.
24
+
25
+ This paper’s main contributions can be summarized in three key aspects:
26
+
27
+ • This study provides the first systematic analysis of code generation, execution, and selfdebugging’s role in mathematical problem-solving. Our findings reveal that GPT4-Code’s impressive mathematical problem-solving proficiency is primarily attributed to its step-bystep code generation and dynamic solution refinement based on code execution outcomes.
28
+ • We introduce the innovative explicit code-based self-verification (CSV) prompt, which leverages GPT4-Code’s advanced code generation mechanism. This prompt guides the model to verify the answer and then reevaluate its solution with code. CSV not only extends the verification to the logic behind problem-solving but also improves the efficacy of the majority voting method by integrating the verification states.
29
+ We have demonstrated the superior performance of GPT4-Code and the proposed CSV pipeline through extensive quantitative experiments on a variety of challenging mathematical reasoning datasets.
30
+
31
+ # 2 RELATED WORK
32
+
33
+ Chain-of-Thought Reasoning. The Chain-of-Thought (CoT) prompting approach proposed by (Wei et al., 2022) shows the multi-step reasoning capabilities of LLMs. (Kojima et al., 2022) implements Zero-shot-CoT, which can serve as a strong zero-shot baseline. Further research extends the reasoning capabilities of CoT by applying majority voting (Wang et al., 2023), choosing complex few-shot examples and outputting results (Fu et al., 2022), breaking down the problem (Zhou et al., 2023), or even using Tree-of-Thoughts (Yao et al., 2023). Similar to Zero-shot-CoT, our method applies "step by step"-like prompts to regularize GPT4-Code’s use of code. Additionally, We enhance majority voting by leveraging the results of CSV as voting weights.
34
+
35
+ # Question
36
+
37
+ # Model output
38
+
39
+ Q: The greatest common divisor of positive integers $m$ and $n$ is 6. The least common multiple of $m$ and $n$ is 126. What is the least possible value of $m + n ?$ A: 60
40
+
41
+ # BasePrompt: The problem: {Q},
42
+
43
+ One important property relating GCD and LCM is that
44
+
45
+ $$
46
+ \operatorname { G C D } ( m , n ) \times \operatorname { L C M } ( m , n ) = m \times n
47
+ $$
48
+
49
+ # (a) Model output
50
+
51
+ # Prompt 1: You are not allowed to use any code. The problem: {Q}.
52
+
53
+ For any two positive integers $_ m$ and $_ n$ , the product of their GCD and LCM is equal to the product of the two numbers.
54
+
55
+ $$
56
+ \begin{array} { c } { { G C D ( m , n ) \cdot L C M ( m , n ) } } \\ { { = m \cdot n } } \end{array}
57
+ $$
58
+
59
+ # (b) Model output
60
+
61
+ $$
62
+ 6 \times 1 2 6 = m \times n
63
+ $$
64
+
65
+ Let’s compute the right hand side of the equation first.
66
+
67
+ Prompt 2: You can use code only 1 time. The problem: {Q}
68
+ For any two positive integers $_ m$ and $_ n$ , their gcd and lcm satisfy:
69
+
70
+ $$
71
+ m \cdot n = \operatorname* { g c d } ( m , n ) \cdot \operatorname { l c m } ( m , n )
72
+ $$
73
+
74
+ $$
75
+ m \cdot n = 6 \cdot 1 2 6
76
+ $$
77
+
78
+ In this problem, we’re given that $\operatorname* { g c d } ( m , n ) = 6$ and $\operatorname { l c m } ( { \tilde { m _ { } } } , n ) = 1 2 6 \cdot$
79
+
80
+ $$
81
+ \scriptstyle \left( { \begin{array} { l } { \scriptstyle \operatorname { g c d , l c m } = 6 , 1 2 6 ; \ x \operatorname { g c d } ^ { * } \operatorname { l c m } } \\ { \gg 7 5 6 } \end{array} } \right)
82
+ $$
83
+
84
+ In this problem, we can get
85
+
86
+ The product of $_ m$ and $_ n$ is 756. Since the GCD of $_ m$ and $_ n$ is $^ 6$ , both $_ m$ and $_ n$ must be multiples of 6. So we need to find all the factors of 756 that are multiples of 6.
87
+
88
+ We use the fact that $_ m$ and $_ n$ are integers to generate possible pairs $( m , n )$ . After we have the pairs $\bar { ( } m , n )$ , we can find the pair that minimizes $m + n$ [(i, m_times_n // i) for i in range(6 int(m\*n\*\*0.5) + 1, 6) if m\*n % i == 0] »> [(6, 126), (12, 63), (18, 42)]
89
+
90
+ import sympy as sp
91
+ gcd,l $c \mathrm { m } = 6 { , } 1 2 6$ ; product $=$ gcd \* lcm
92
+ pairs $=$ [(d, product // d) for d in sp.div(product) if
93
+ d $< =$ product // d]
94
+ min_pair = min(pairs, key=sum)
95
+ min_pair, sum(min_pair)
96
+ »> ((27, 28), 55)
97
+
98
+ The pairs of factors of 756 that are multiples of 6 are: 1. (6, 126) 2. (12, 63) 3. (18, 42) We want to find the pair with the least sum.
99
+
100
+ sums = [(pair, sum(pair)) for pair in factor_pairs] min(sums, key=lambda x: x[1]) »> ((18, 42), 60)
101
+
102
+ The pair $( m , n )$ that min $m + n$ is (27, 28), and the minimum possible value of $m + n$ is $[ 5 5 ] . x$
103
+
104
+ The pair with the smallest sum is (18, 42), and the sum is 60.So, the least possible value is 60
105
+
106
+ Figure 1: Example from the 277th number theory problem in the MATH dataset: (a) Prompt 1 generates text-only reasoning steps. (b) Prompt 2 generates intermediate text reasoning steps and post-hoc code, akin to PAL (Gao et al., 2023). (c) Base prompt without code usage constrain. Details of the three prompts are presented in Sec. 3.1. (For more examples, see Tab. 10 and Tab. 11 in Appendix H.)
107
+
108
+ Solving Math Problems with Code. Large language models have been found to be less accurate in performing arithmetic calculations (Cobbe et al., 2021; Lewkowycz et al., 2022; Gao et al., 2023; Lu et al., 2022). Consequently, previous works have attempted to solve math problems with the assistance of code. The GSM8K dataset (Cobbe et al., 2021) uses calculation annotations to extract all arithmetic calculations solved by an external calculator: the Python eval function. ProgramAided Language model (PAL) (Gao et al., 2023) and Program of Thoughts (PoT) (Chen et al., 2022) obtain the answer by generating and executing Python code. Although they can improve computational accuracy, many generated codes get wrong answers due to the lack of verification. Our approach not only utilizes the ability of GPT4-Code to generate codes and refine codes that fail to run, but also uses CSV to enhance the accuracy of the answers.
109
+
110
+ Self-Verification. Previous studies train an additional verifier to verify the correctness of final answers (Cobbe et al., 2021) or intermediate steps (Lightman et al., 2023; Li et al., 2023). (Weng et al., 2023) showed the self-verification abilities of LLMs by generating and ranking multiple answers. Furthermore, Self-refine proposed by (Madaan et al., 2023) iteratively refines its output through self-generated feedback. Self-debug (Chen et al., 2023b) prompts the LLM to debug its own prediction for code generation. Unlike these methods that require LLMs to give verification feedback in natural language, our method applies generated codes to verify the answers and votes on different answers based on the verification results, thus improving the accuracy of the verification.
111
+
112
+ # 3 METHOD
113
+
114
+ We first conduct a pilot experiment with GPT4-Code on the challenging MATH dataset (Hendrycks et al., 2021). Remarkably, it achieves an accuracy of $6 9 . 6 9 \%$ , significantly surpassing the previous state-of-the-art performance of $5 3 . 9 \%$ (Zheng et al., 2023). Encouraged by the compelling performance of GPT4-Code, we strive to systematically explore and analyze its underlying code mechanisms. In Sec. 3.1, we illustrate, via our code-constrained prompts design, that GPT4-Code’s robust performance in solving math problems derives not only from its ability to generate accurate step-by-step code, but also from its self-debugging mechanism. In Sec. 3.2, we aim to leverage GPT4-Code’s self-debugging strengths to further improve its mathematical problem-solving ability.
115
+
116
+ ![](images/d59340fc7210d6794ab442335b467312042c3b2e550775c5305bc03d0d50788f.jpg)
117
+ Figure 2: Performance on MATH dataset of different levels by applying different prompts to adjust the frequency of code usage. (a) Comparison of overall accuracy between the four prompts. (b) Code Usage Frequency is in proportion to accuracy in all five levels, and this phenomenon is especially apparent when the problems are relatively complicated (i.e., with higher levels). The red points denoting Prompt 1 show that the model still occasionally uses code, especially when the problem is very difficult. However, even then, the Code Usage Frequency is negligible.
118
+
119
+ # 3.1 PILOT EXPERIMENTS ON ANALYZING CODE USAGE OF GPT4-CODE
120
+
121
+ To explore the impact of code on GPT4-Code’s mathematical skills, we adopt a straightforward approach by constraining GPT4-Code’s uasge of code through thoughtfully constructed prompts. Specifically, we introduce two code-constrained prompts and a base prompt for comparison:
122
+
123
+ • Prompt 1. No code usage is allowed: With this prompt, GPT4-Code is prohibited from using code. This prompts GPT4-Code to rely solely on Natural Language $\mathbf { \left( N L \right) }$ reasoning chain, resembling solutions in the CoT framework (Wei et al., 2022). The resulting sequence of reasoning steps is depicted as $\mathbf { C } _ { \mathbf { N L } }$ , with an example given in Fig. 1 (a). • Prompt 2. Code can be used only once: In this prompt setting, GPT4-Code is permitted to employ code within a single code block to generate the solution, mirroring the PAL approach introduced by (Gao et al., 2023). We denote this sequence as $\mathbf { C _ { S L } }$ , representing a series of Symbolic Language (SL), such as Python. An example is shown in Fig. 1 (b). • Base Prompt. GPT4-Code is prompted to tackle the problem without any restrictions on code usage. This prompt leads to GPT4-Code’s usual performance, which can be denoted as $\bar { \mathbf { C } } = ( ( \mathbf { c 1 } _ { \mathrm { { N L } } } , \mathbf { c 1 } _ { \mathrm { { s L } } } ^ { - } )$ , $( \mathbf { c 2 _ { N L } } , \mathbf { c 2 _ { S L } } ) , \dots )$ , representing a list of reasoning steps, each consisted of both natural language and code, with an example shown in Fig. 1 (c).
124
+
125
+ Apart from the specific example in Fig. 1, we introduce Code Usage Frequency to record the number of code executions for different prompts. The results of the experiments using these prompts are shown in Fig. 2 (b). This figure illustrates a positive correlation between the better performance of GPT4-Code and the higher Code Usage Frequency. More specifically,
126
+
127
+ Prompt 1 v.s. Prompt 2. Prompt 1 results in almost negligible code usage, while Prompt 2 results in approximately 1 time’s code usage. Prompt 2 yields an accuracy gain of 6.78 percent over Prompt 1. This suggests that the Python code chains $\mathbf { C _ { S L } }$ can improve computational capability more than the natural language chains $\mathbf { C _ { N L } }$ . This observation is consistent with the findings in previous Pythonbased prompting methods (Gao et al., 2023; Chen et al., 2022). However, employing code only once comes with an inherent drawback – the model lacks the ability to self-debug when the code output triggers an error or produces an implausible outcome.
128
+
129
+ Prompt 2 v.s. Base Prompt. The Base Prompt consistently produces solutions that entail multiple instances of code usage, resulting in a large Code Usage Frequency. Additionally, the Base Prompt’s accuracy of $6 9 . 6 9 \%$ represents a $2 . 1 1 \%$ improvement over Prompt 2’s $6 7 . 5 8 \%$ . These improvements in Code Usage Frequency and accuracy might be attributable to two unique advantages: (1) Generating code in brief and frequent segments, divided among natural language reasoning steps, tends to result in higher accuracy. (2) The model possesses the capability to evaluate the results of code execution and make corrections to solution steps if the outcomes contain bugs or are deemed illogical, as illustrated in Tab. 8 and Tab. 9 (Appendix E).
130
+
131
+ ![](images/1583b1b5570746a9faa8c2a3c37491ef12832410dc5aeb8f04f1140421d525ef.jpg)
132
+ Figure 3: Question from the 712th intermediate algebra problem in the MATH dataset. (a) Without selfverification, the model generates a wrong answer. (b) With self-verification, the model corrects the error and generates the correct answer. The CSV prompt: Solve the problem using code interpreter step by step, even in every sub-step. And following your answer, please verify it using code interpreter by yourself.
133
+
134
+ From these observations, it is plausible to enhance and build upon the favorable attributes of GPT4- Code to further improve its precision in tackling math problems.
135
+
136
+ # 3.2 EXPLICIT CODE-BASED SELF-VERIFICATION PROMPTING
137
+
138
+ Inspired by the observations on Code Usage Frequency analysis, we seek to harness the capabilities of GPT4-Code. These capabilities include the model’s aptitude for generating accurate code, evaluating the outcomes of code execution, and automatically adjusting reasoning steps of solutions when needed. Our objective is to utilize these strengths to augment solution verification.
139
+
140
+ To achieve this objective, we propose the technique termed as explicit code-based self-verification (CSV). This method prompts GPT4-Code to explicitly validate its answer through code generation. By implementing this prompt, we introduce an extra verification stage to the solution $\mathbf { C }$ , referred to as $\breve { \mathbf { V } }$ . The verification result $\mathbf { V }$ can be classified as True, False, or Uncertain. An Uncertain classification indicates that GPT4-Code encountered difficulties in identifying an effective method for answer verification, thereby abstaining from delivering a definitive verification result. Leveraging GPT4-Code’s inherent autonomous capabilities, we can formulate the proposed prompting as:
141
+
142
+ $$
143
+ \mathbf { C } \mathbf { V } = { \{ \begin{array} { l l } { { \mathrm { T r u e } } } & { { \mathrm { f n a l ~ a n s w e r } } } \\ { { \mathrm { F a l s e } } } & { \mathbf { C } _ { \mathrm { n e w } } \mathbf { V } \cdots { \mathrm { T r u e } } { \mathrm { f n a l ~ a n s w e r } } } \\ { { \mathrm { U n c e r t a i n } } } & { { \mathrm { f n a l ~ a n s w e r } } } \end{array} }
144
+ $$
145
+
146
+ An example is presented in Fig. 3 (b). Incorporated with CSV, the model becomes capable of using code to verify answers, then reviewing and adjusting how it arrived at the solution if the verification result is False, aiming at obtaining the correct answer. The different types of verification code can be seen in Tab.16, Tab.17, Tab.18, and Tab.19 (Appendix J). Upon refining and correcting the initial solution, we anticipate a notable increase in accuracy. It is worth noting that both the verification and rectification stages are code-based. This inevitably results in increased Code Usage Frequency, akin to the aforementioned analysis, which will be further demonstrated in subsequent experiments.
147
+
148
+ We perform experiments with CSV, and these results can be found in Fig. 2. The experiment here is conducted with GPT4-Code on MATH (Hendrycks et al., 2021). In Fig. 2 (b), the accuracy achieved with our proposed CSV prompt consistently surpasses that of the Base Prompt across all designated difficulty levels2. Meanwhile, the Code Usage Frequency receives a clear increase.
149
+
150
+ ![](images/7245d53526c394bd4be769660a930839aa8595ba0e24e059f32624ae076e515c.jpg)
151
+ Figure 4: (a) Illustration of the Naive majority voting (Wang et al., 2023) and our Verification-guided weighted majority voting. (b) The full pipeline of the proposed Verification-guided Weighted Majority Voting (VWvoting) framework. We detect the self-verification state of each solution and classify them into three states: True, Uncertain, and False. According to the state of the verification, we assign each solution a different weight and use the classified result to vote the score of each possible answer. (For more examples, see Tab. 12 and Tab. 13 in Appendix G.)
152
+
153
+ Before the advent of GPT4-Code, prior frameworks (Lightman et al., 2023; Cobbe et al., 2021) relied on an external Large Language Model (LLM) and well-constructed few-shot prompts for natural language verification. In contrast, GPT4-Code’s robust capabilities enable our approach to depend solely on a straightforward prompt, thereby operating in a zero-shot manner. This enables GPT4-Code to autonomously verify and independently rectify its solutions using the advanced code execution mechanism, thereby eliminating the need for customized few-shot examples.
154
+
155
+ Given that CSV can effectively verify problem-solving answers, we can naturally integrate the verification states into majority voting, akin to the methodology embraced in self-consistency CoT (Wang et al., 2023). Answers deemed True through verification are generally more trustworthy, reflecting the problem-solving approach seen in human cognition (Newell & Simon, 1972; Wang & Chiew, 2010). This improved reliability can be leveraged in the widely-used majority voting process. To exploit this insight, we introduce verification-guided weighted majority voting, which assigns different weights to the states of the verification process.
156
+
157
+ In practice, it sometimes occurs that once an answer is confirmed as False, no additional verification is conducted, yielding a False verification state. We allocate corresponding weights these states of True, Uncertain, False: $w _ { \mathbf { T } } , w _ { \mathbf { U } }$ , and $w _ { \mathbf { F } }$ , respectively.
158
+
159
+ Similar to the Self-consistency with CoT (CoT-SC) (Wang et al., 2023) in Fig. 4 (a)(ii), our framework can sample $k$ paths. For simplicity, we extract pairs of final answers and their corresponding verification results from $k$ solutions, represented as $( v ^ { i } , a ^ { i } ) , i = 1 , 2 , . . . , k$ , where $v ^ { i }$ and $a ^ { i }$ denote the $i$ -th final answer and final verification result, respectively.
160
+
161
+ So the voting score for each candidate answer $a$ can be expressed as:
162
+
163
+ $$
164
+ \operatorname { S c o r e } ( a ) = \sum _ { \{ v ^ { i } \} } w _ { v } ( \# \{ i \mid a ^ { i } = a { \mathrm { ~ a n d ~ } } v ^ { i } = v \} ) , \quad v \in \{ \mathrm { T r u e } , \mathrm { U n c e r t a i n } , \mathrm { F a l s e } \} ,
165
+ $$
166
+
167
+ Table 1: Accuracy $( \% )$ on MATH dataset. VW-voting is an abbreviation for Verification-guided Weighted Majority Voting. Voting is an abbreviation for Naive Majority Voting. (Overall: The results across various MATH subtopics)
168
+
169
+ <table><tr><td></td><td>Code-based Verification</td><td>Intermediate Algebra</td><td>Precalculus 1</td><td>Geometry 1</td><td>Number Theory</td><td>Counting&amp; Probability</td><td>PreAlgebra 1</td><td>Algebra 1</td><td>Overall MATH</td></tr><tr><td>GPT-4 (OpenAI,2023)</td><td>X</td><td>-</td><td>-</td><td>-</td><td></td><td></td><td></td><td>-</td><td>42.20</td></tr><tr><td>GPT-3.5(CoT) (Zheng et al.,2023)</td><td></td><td>14.6</td><td>16.8</td><td>22.3</td><td>33.4</td><td>29.7</td><td>53.8</td><td>49.1</td><td>34.12</td></tr><tr><td>GPT-4(Complex CoT) (Fuet al.,2022)</td><td>xx</td><td>23.4</td><td>26.7</td><td>36.5</td><td>49.6</td><td>53.1</td><td>71.6</td><td>70.8</td><td>50.36</td></tr><tr><td>GPT-4(PHP) (Zheng et al.,2023)</td><td></td><td>26.3</td><td>29.8</td><td>41.9</td><td>55.7</td><td>56.3</td><td>73.8</td><td>74.3</td><td>53.90</td></tr><tr><td>GPT4-Code (baseline)</td><td>X</td><td>50.1</td><td>51.5</td><td>53.4</td><td>77.2</td><td>70.6</td><td>86.3</td><td>83.6</td><td>69.69</td></tr><tr><td>GPT4-Code + CSV</td><td>√</td><td>56.6</td><td>53.9</td><td>54.0</td><td>85.6</td><td>77.3</td><td>86.5</td><td>86.9</td><td>73.54</td></tr><tr><td>Improvement</td><td></td><td>+6.5</td><td>+2.4</td><td>+0.6</td><td>+8.4</td><td>+6.7</td><td>+0.2</td><td>+3.3</td><td>+3.85</td></tr><tr><td>GPT4-Code+ Voting (k=16,baseline)</td><td>×</td><td>63.3</td><td>64.1</td><td>61.7</td><td>89.1</td><td>84.6</td><td>90.8</td><td>92.9</td><td>79.88</td></tr><tr><td>GPT4-Code + CSV + Voting (k=16)</td><td>√</td><td>72.7</td><td>66.5</td><td>64.5</td><td>93.1</td><td>88.8</td><td>91.2</td><td>95.3</td><td>83.54</td></tr><tr><td>Improvement</td><td></td><td>+9.4</td><td>+2.4</td><td>+2.8</td><td>+4.0</td><td>+4.2</td><td>+0.4</td><td>+2.4</td><td>+3.66</td></tr><tr><td>GPT4-Code + CSV + VW-Voting (k=16)</td><td>√</td><td>74.4</td><td>67.8</td><td>64.9</td><td>94.1</td><td>89.0</td><td>91.6</td><td>95.6</td><td>84.32</td></tr><tr><td>Improvement</td><td></td><td>+11.1</td><td>+3.7</td><td>+3.2</td><td>+5.0</td><td>+4.4</td><td>+0.8</td><td>+2.7</td><td>+4.44</td></tr></table>
170
+
171
+ Here, $a$ represents a candidate answer, $v$ denotes the state of verification, and $w _ { v }$ is an element from the set $\{ \tilde { w _ { \mathbf { T } } } , w _ { \mathbf { U } } , w _ { \mathbf { F } } \}$ . Each $w _ { v }$ signifies the degree of confidence associated with its corresponding verification state. Finally, we select the answer with the highest score from all candidate answers.
172
+
173
+ It should be noted that when $w _ { v } \ = \ 1$ for all $w _ { v } \in \{ w _ { \mathbf { T } } , w _ { \mathbf { U } } , w _ { \mathbf { F } } \}$ , Eq. 1 becomes equivalent to the naive majority voting employed in Self-Consistency with CoT (CoT-SC) (Wang et al., 2023). Typically, we set $w _ { \mathbf { T } } > w _ { \mathbf { U } } > w _ { \mathbf { F } }$ , which means that an answer verified true has greater confidence than the one with an uncertain state of verification, while an answer verified false has the lowest degree of confidence. An example of the calculation process within verification-guided weighted majority voting is illustrated in Fig. 4.
174
+
175
+ # 4 EXPERIMENTS
176
+
177
+ Datasets and Baseline. We evaluate GPT4-Code using CSV on three datasets: MATH (Hendrycks et al., 2021), GSM8K (Cobbe et al., 2021), and MMLU-Math (Hendrycks et al., 2020). We primarily compare our code-based self-verification (CSV) approach to standard zero-shot prompting using GPT4-Code to validate the effectiveness of the self-verification ability. To more comprehensively evaluate the zero-shot capabilities of both GPT4-Code and GPT4-Code with CSV in mathematical reasoning tasks, we also compare our method with the state-of-the-art few-shot in-context-learning method using GPT-4 from PHP (Zheng et al., 2023) and Model selection (Zhao et al., 2023).
178
+
179
+ Prompt. The proposed prompt is presented in the caption of Fig. 3.
180
+
181
+ # 4.1 PERFORMANCE ON MATH
182
+
183
+ The MATH dataset (Hendrycks et al., 2021) is recognized as the most challenging math word problem dataset, as also highlighted by Chen et al. (Chen et al., 2023a). Most of our experiments and the corresponding analyses are performed on the MATH benchmark. Tab. 1 compares the performance of the GPT4-Code against other models. GPT4-Code reaches $6 9 . 6 9 \%$ on MATH (Hendrycks et al., 2020), largely surpassing the previous state of the art result $( 5 3 . 9 0 \% )$ , which shows that GPT4-Code exhibits strong abilities in solving math problems and is used as our baseline. On top of GPT4-Code, our method further improves its accuracy, raising the result to $7 3 . 5 4 \%$ after adding explicit code-based self-verification. GPT4-Code with naive majority voting reaches an accuracy of $\bar { 7 } 9 . 8 8 \%$ , which we set as the baseline for methods that used voting. When using code-based self-verification with majority voting, the accuracy is $8 3 . 3 4 \%$ , while adding both explicit code-based self-verification and verification-guided weighted majority voting reaches an accuracy of $8 4 . 3 2 \%$ . Note that this astonishingly high result is based on the strong abilities of the base model GPT4-Code, and our method amplifies its good qualities of GPT4-Code, with the ability to verify solutions.
184
+
185
+ Note that although adding CSV can improve the performance of every individual subject, the extent of improvement varies, from $8 . 4 \%$ to only $0 . 2 \%$ . In particular, the Geometry problem only has an increased accuracy of $0 . 6 \%$ , even though the original accuracy is only $5 3 . 4 \%$ , which is low among the subjects. This discrepancy may be attributed to the fact that solving geometry problems often requires multi-modality (Chen et al., 2023a), a concept beyond the scope of this paper.
186
+
187
+ Table 2: Performance on GSM8K dataset.
188
+
189
+ <table><tr><td>Method</td><td>Sampled paths</td><td>Accuracy(%)</td></tr><tr><td>GPT-3.5 (5-shot) (OpenAI,2023)</td><td>1</td><td>57.1</td></tr><tr><td>GPT-4 (5-shot CoT) (OpenAI,2023)</td><td></td><td>92.0</td></tr><tr><td>GPT-4 (PHP) (Zheng et al.,2023)</td><td>40</td><td>96.5</td></tr><tr><td>GPT-4 (Model selection) (Zhao et al.,2023)</td><td>15</td><td>96.8</td></tr><tr><td>GPT4-Code</td><td>1</td><td>92.9</td></tr><tr><td>GPT4-Code + Voting</td><td>5</td><td>94.9</td></tr><tr><td>GPT4-Code +CSV</td><td>一</td><td>94.5</td></tr><tr><td>GPT4-Code +CSV +VW-Voting</td><td>5</td><td>97.0</td></tr></table>
190
+
191
+ Table 3: Performances on MMLU-Math dataset.
192
+
193
+ <table><tr><td>Method</td><td>Sampled paths</td><td>Accuracy(%)</td><td>Few-shot</td></tr><tr><td>Goper (Rae et al., 2021)</td><td></td><td>30.6</td><td>5-shot</td></tr><tr><td>Chinchilla (Hoffmann et al.,2022)</td><td></td><td>35.7</td><td>5-shot</td></tr><tr><td>Llama-2(7oB) (Touvron et al.,2023)</td><td></td><td>47.1</td><td>5-shot</td></tr><tr><td>Galactica (Taylor et al., 2022)</td><td></td><td>41.3</td><td>zero-shot</td></tr><tr><td>GPT4-Code</td><td></td><td>87.5</td><td>zero-shot</td></tr><tr><td>GPT4-Code+ Voting</td><td>5</td><td>92.1</td><td>zero-shot</td></tr><tr><td></td><td></td><td></td><td>zero-shot</td></tr><tr><td>GPT4-Code + CSV + vW-Voting</td><td>-5</td><td>995</td><td></td></tr></table>
194
+
195
+ ![](images/bf79e4daff663d4e03e079672c1a5e64ddcb8285b5ba05d84d3b9be4e9fe87b0.jpg)
196
+ Figure 5: The four points on each curve correspond to results using Prompt 1, Prompt 2, Base Prompt and Proposed Prompt, respectively. (a) The accuracy of different levels at various code usage frequencies. (b) The accuracy of different subjects at various code usage frequencies.
197
+
198
+ # 4.2 PERFORMANCE ON GSM8K AND MMLU-MATH
199
+
200
+ In addition to the challenging MATH dataset, we have also performed our method on other reasoning datasets such as GSM8K (Cobbe et al., 2021), MMLU-Math (Hendrycks et al., 2020). The corresponding results can be viewed in Tab. 2 and Tab. 3. When integrated on top of GPT-4-code, our method outperforms other methods, achieving state-of-the-art results across all datasets. Other subjects in MMLU benchmarks are provided in Appendix D. A comparative analysis of our results with those of previous state-of-the-art techniques and open-source models are also provided.
201
+
202
+ Tab. 2 illustrates that verification-guided majority voting is an effective framework to reduce the number of sampled paths, compared to GPT-4 with model selection (Zhao et al., 2023) and PHP (Zheng et al., 2023). Tab. 3 presents a comparison of our model’s performance with existing models (Hoffmann et al., 2022; Taylor et al., 2022; Touvron et al., 2023) on the MMLU-Math dataset. The open-source models remain significantly outpaced by their closed-source counterparts.
203
+
204
+ # 4.3 CODE USAGE FREQUENCY OF PROPOSED PROMPTS
205
+
206
+ Analogous to the approach taken in Sec. 3.1, we gather data to elucidate the correlation between accuracy and Code Usage Frequency across various dimensions - prompts (proposed CSV prompt and prompts used in pilot experiments), subjects, and difficulty levels. As shown in Fig. 5, the model’s behavior is in line with our expectations when adding the code-based verification prompts. Each line in Fig. 5 has an obvious trend of going upwards, suggesting a possible positive correlation between Code Usage Frequency and accuracy. The performance gain when using more code is more obvious in the higher difficulty levels, while in lower levels, the performance gain is not very prominent, as shown in Fig. 5 (a). The Code Usage Frequency increases with the increase of difficulty levels. This shows that the harder math problems require more frequent code usage, which implies that invoking code multiple times might be an important reason why GPT4-Code have such an advantage in solving difficult math problems. There is a similar trend in Fig. 5 (b).
207
+
208
+ # 4.4 ABLATION STUDY AND DISCUSSION
209
+
210
+ Comparisons between Natural Language and Code-based Self-Verification. To underscore the significance of code in the self-verification stage, we employed a distinct natural language selfverification, where GPT4-Code is directed to verify the solution through natural language instead of relying on code-based verification, as presented in Tab. 4. The accuracy achieved with this method was slightly lower than that of the Base Prompt. Moreover, we observed a decline in accuracy for four of the seven subtopics, indicating that relying solely on natural language self-verification, which appears to have a negative impact on the accuracy, is less reliable than using code-based self-verification. Examples of natural language self-verification can be seen in Tab. 14 and Tab. 15 (Appendix F). In contrast, code-based verification enhances accuracy across all seven subtopics when compared to the Base Prompt.
211
+
212
+ Table 4: Comparison Self-verification with/without explicit code-based prompt (Overall:The results across various MATH subtopics (Hendrycks et al., 2021))
213
+
214
+ <table><tr><td rowspan="5">GPT4-Code Interpreter</td><td>Verification Method</td><td>Intermediate Algebra</td><td>Precalculus 1</td><td>Geometry 1</td><td>Number Theory</td><td>Counting&amp; Probability</td><td>PreAlgebra 1</td><td>Algebra 1</td><td>Overall 1</td></tr><tr><td>Without Verification</td><td>50.1</td><td>51.5</td><td>53.4</td><td>77.2</td><td>70.6</td><td>86.3</td><td>83.6</td><td>69.69</td></tr><tr><td>Natural Language</td><td>52.6</td><td>487</td><td></td><td></td><td>75</td><td>83.2</td><td></td><td></td></tr><tr><td rowspan="2">Code-based</td><td></td><td></td><td>50.8</td><td>7997</td><td></td><td></td><td>826</td><td>69.29</td></tr><tr><td>56.6 +6.5</td><td>53.9 +2.4</td><td>54.0 +0.6</td><td>85.6 +8.4</td><td>77.3 +6.7</td><td>86.5 +0.2</td><td>86.9 +3.3</td><td>73.54 +3.85</td></tr></table>
215
+
216
+ ![](images/52c0e13e2a66dbb2f8c49f15d48b104345a3c5cf784b5e39cb5419a020ca25a0.jpg)
217
+ Figure 6: (a). The average precision, recall, and accuracy of five sampled paths on the MATH dataset. (b). The Acc on MATH in response to the number of sampled reasoning paths when the weight is set to different values.
218
+
219
+ Analysis of Verification-guided Weighted Majority Voting. We initially compiled the confusion matrix (TP/TN/FP/FN), capturing solutions with self-verification that matches the True and False states mentioned in Eq. 1 from five distinct sampled paths. The details are presented in Appendix A. From this data, we computed Precision, Recall, and Accuracy (Solutions in the True state are seen as positive). The results are presented in Fig. 6 (a). We note that Precision exceeds Accuracy by $2 2 . { \bar { 3 } } 4 \%$ (increasing from $7 3 . { \bar { 5 } } 4 \%$ to $9 5 . 8 8 \%$ ), whereas Recall surpasses Accuracy by $5 . 5 7 \%$ (rising from $7 3 . 5 4 \%$ to $7 9 . 1 1 \%$ ). In particular, the average Precision registered at $9 5 . 8 8 \%$ . This implies that the Accuracy has the potential to become much higher if more solutions reach the verified True state before giving the final answer.
220
+
221
+ Hyper-parameters ablation in Verification-guided Weighted Majority Voting. We also performed ablation studies on the hyper-parameter $w _ { v } \in \{ w _ { \mathbf { T } } , w _ { \mathbf { U } } , w _ { \mathbf { F } } \}$ in Eq. 1. As shown in Fig 6 (b). When the hyper-parameter setting satisfied $w _ { \mathbf { T } } > w _ { \mathbf { U } } \ge w _ { \mathbf { F } }$ , the performance of the verificationguided weighted majority voting consistently surpassed that of the naive majority voting methods across all sampled paths. In contrast, when we set the hyper-parameter $( w _ { \mathbf { T } } = 0 . 5 , w _ { \mathbf { U } } = 0 . 5 , w _ { \mathbf { F } } =$ 1), the performance under this configuration was worse than the naive majority voting. Therefore, our proposed method, verification-guided weighted majority voting, is easy to tune and robust.
222
+
223
+ # 5 CONCLUSION
224
+
225
+ In this paper, we begin with pilot experiments on GPT4-Code to explore how its use of code impacts its performance in mathematical reasoning. By analyzing Code Usage Frequency and accuracy, we determine that GPT4-Code’s skill in solving math problems can be largely attributed to its ability to generate and execute code, as well as its effectiveness in adjusting and rectifying solutions when confronted with implausible execution outputs. Expanding on this understanding, we introduce the ideas of explicit code-based self-verification and verification-guided weighted majority voting, with the goal of enhancing GPT4-Code’s mathematical capabilities. We hope this work could shed light on math problem-solving in open-source LLMs, especially when advanced code usage is involved.
226
+
227
+ # 6 ACKNOWLEDGMENTS
228
+
229
+ This project is funded in part by National Key R&D Program of China Project 2022ZD0161100, and in part by General Research Fund of Hong Kong RGC Project 14204021.
230
+
231
+ REFERENCES
232
+ 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.
233
+ 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.
234
+ Wenhu Chen, Xueguang Ma, Xinyi Wang, and William W. Cohen. Program of thoughts prompting: Disentangling computation from reasoning for numerical reasoning tasks, 2022.
235
+ Wenhu Chen, Ming Yin, Max Ku, Pan Lu, Yixin Wan, Xueguang Ma, Jianyu Xu, Xinyi Wang, and Tony Xia. Theoremqa: A theorem-driven question answering dataset, 2023a.
236
+ Xinyun Chen, Maxwell Lin, Nathanael Schärli, and Denny Zhou. Teaching large language models to self-debug, 2023b.
237
+ Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
238
+ Yao Fu, Hao Peng, Ashish Sabharwal, Peter Clark, and Tushar Khot. Complexity-based prompting for multi-step reasoning. arXiv preprint arXiv:2210.00720, 2022.
239
+ Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models. In International Conference on Machine Learning, pp. 10764–10799. PMLR, 2023.
240
+ Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Xiaodong Song, and Jacob Steinhardt. Measuring massive multitask language understanding. ArXiv, abs/2009.03300, 2020. URL https://api.semanticscholar.org/CorpusID: 221516475.
241
+ Dan Hendrycks, Collin Burns, Saurav Kadavath, Akul Arora, Steven Basart, Eric Tang, Dawn Song, and Jacob Steinhardt. Measuring mathematical problem solving with the math dataset. arXiv preprint arXiv:2103.03874, 2021.
242
+ 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.
243
+ Takeshi Kojima, Shixiang (Shane) Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. In Advances in Neural Information Processing Systems, volume 35, pp. 22199–22213, 2022.
244
+ Aitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, et al. Solving quantitative reasoning problems with language models. Advances in Neural Information Processing Systems, 35:3843–3857, 2022.
245
+ Yifei Li, Zeqi Lin, Shizhuo Zhang, Qiang Fu, Bei Chen, Jian-Guang Lou, and Weizhu Chen. Making language models better reasoners with step-aware verifier. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 5315– 5333, 2023.
246
+ 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.
247
+
248
+ Pan Lu, Liang Qiu, Kai-Wei Chang, Ying Nian Wu, Song-Chun Zhu, Tanmay Rajpurohit, Peter Clark, and Ashwin Kalyan. Dynamic prompt learning via policy gradient for semi-structured mathematical reasoning. arXiv preprint arXiv:2209.14610, 2022.
249
+
250
+ Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, et al. Self-refine: Iterative refinement with self-feedback. arXiv preprint arXiv:2303.17651, 2023.
251
+
252
+ A. Newell and H.A. Simon. Human Problem Solving. ACS symposium series. Prentice-Hall, 1972. ISBN 9780134454030. URL https://books.google.com.hk/books?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ h03uAAAAMAAJ.
253
+ OpenAI. Gpt-4 technical report. ArXiv, abs/2303.08774, 2023.
254
+ Jack W. Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, Eliza Rutherford, Tom Hennigan, Jacob Menick, Albin Cassirer, Richard Powell, George van den Driessche, Lisa Anne Hendricks, Maribeth Rauh, Po-Sen Huang, Amelia Glaese, Johannes Welbl, Sumanth Dathathri, Saffron Huang, Jonathan Uesato, John F. J. Mellor, Irina Higgins, Antonia Creswell, Nathan McAleese, Amy Wu, Erich Elsen, Siddhant M. Jayakumar, Elena Buchatskaya, David Budden, Esme Sutherland, Karen Simonyan, Michela Paganini, L. Sifre, Lena Martens, Xiang Lorraine Li, Adhiguna Kuncoro, Aida Nematzadeh, Elena Gribovskaya, Domenic Donato, Angeliki Lazaridou, Arthur Mensch, Jean-Baptiste Lespiau, Maria Tsimpoukelli, N. K. Grigorev, Doug Fritz, Thibault Sottiaux, Mantas Pajarskas, Tobias Pohlen, Zhitao Gong, Daniel Toyama, Cyprien de Masson d’Autume, Yujia Li, Tayfun Terzi, Vladimir Mikulik, Igor Babuschkin, Aidan Clark, Diego de Las Casas, Aurelia Guy, Chris Jones, James Bradbury, Matthew G. Johnson, Blake A. Hechtman, Laura Weidinger, Iason Gabriel, William S. Isaac, Edward Lockhart, Simon Osindero, Laura Rimell, Chris Dyer, Oriol Vinyals, Kareem W. Ayoub, Jeff Stanway, L. L. Bennett, Demis Hassabis, Koray Kavukcuoglu, and Geoffrey Irving. Scaling language models: Methods, analysis & insights from training gopher. ArXiv, abs/2112.11446, 2021. URL https://api.semanticscholar.org/CorpusID:245353475.
255
+ Ross Taylor, Marcin Kardas, Guillem Cucurull, Thomas Scialom, Anthony Hartshorn, Elvis Saravia, Andrew Poulton, Viktor Kerkez, and Robert Stojnic. Galactica: A large language model for science. arXiv preprint arXiv:2211.09085, 2022.
256
+ 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.
257
+ 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, 2023. URL https://openreview.net/forum?id $_ { \cdot } =$ 1PL1NIMMrw.
258
+ Yingxu Wang and Vincent Chiew. On the cognitive process of human problem solving. Cognitive Systems Research, 11(1):81–92, 2010. ISSN 1389-0417.
259
+ Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, brian ichter, Fei Xia, Ed H. Chi, Quoc V Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022. URL https://openreview. net/forum?id ${ . } = { }$ _VjQlMeSB_J.
260
+ Yixuan Weng, Minjun Zhu, Fei Xia, Bin Li, Shizhu He, Kang Liu, and Jun Zhao. Large language models are better reasoners with self-verification, 2023.
261
+ Shunyu Yao, Dian Yu, Jeffrey Zhao, Izhak Shafran, Thomas L. Griffiths, Yuan Cao, and Karthik Narasimhan. Tree of Thoughts: Deliberate problem solving with large language models, 2023.
262
+ Xu Zhao, Yuxi Xie, Kenji Kawaguchi, Junxian He, and Qizhe Xie. Automatic model selection with large language models for reasoning. arXiv preprint arXiv:2305.14333, 2023.
263
+ Chuanyang Zheng, Zhengying Liu, Enze Xie, Zhenguo Li, and Yu Li. Progressive-hint prompting
264
+
265
+ improves reasoning in large language models. arXiv preprint arXiv:2304.09797, 2023.
266
+
267
+ Denny Zhou, Nathanael Schärli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuurmans, Claire Cui, Olivier Bousquet, Quoc Le, and Ed Chi. Least-to-most prompting enables complex reasoning in large language models, 2023.
268
+
269
+ # APPENDIX
270
+
271
+ # A EXPLANATION OF CONFUSION MATRIX
272
+
273
+ A confusion matrix is a specific table layout that allows visualization of the performance of an algorithm. It’s particularly useful for classification problems, and we utilize it to analyze the performance of our verification process.
274
+
275
+ The matrix itself is a two-dimensional grid, $2 \mathbf { x } 2$ , for the binary classification of verification results. Each row of the matrix represents the instances in a predicted class, which is determined by the verification results given by the language model, while each column represents the instances in an actual class, which is determined by the actual correctness of the answer given by the model. Tab. 5 shows how the matrix looks for our verification process:
276
+
277
+ Table 5: Confusion Matrix of Verification
278
+
279
+ <table><tr><td></td><td> Answer CorrectAnswer Wrong</td><td></td></tr><tr><td>Verification True</td><td>TP</td><td>FP</td></tr><tr><td>Verification False</td><td>FN</td><td>TN</td></tr></table>
280
+
281
+ Here’s what the four terms mean:
282
+
283
+ • True Positive (TP): The cases in which the model’s verification result is ‘True’, and the answer is actually correct.
284
+ • True Negative (TN): The cases in which the model’s verification result is ‘False’, and the answer is actually wrong.
285
+ • False Positive (FP): The cases in which the model’s verification result is ‘True’, but the answer is actually wrong.
286
+ • False Negative (FN): The cases in which the model’s verification result is ‘False’, but the answer is actually correct.
287
+
288
+ This matrix is very helpful for measuring more than just straightforward accuracy, based on which Precision and Recall are two important metrics. They are defined in Eq. 2 and their meanings are as follows:
289
+
290
+ • Precision is the fraction of relevant instances among the retrieved instances. It is a measure of the accuracy of the classifier when it predicts the positive class. • Recall is the fraction of the total amount of relevant instances that were actually retrieved. It is a measure of the ability of a classifier to find all the positive instances.
291
+
292
+ $$
293
+ { \mathrm { P r e c i s i o n } } = { \frac { \mathrm { T P } } { \mathrm { T P } + { \mathrm { F P } } } } , { \mathrm { R e c a l l } } = { \frac { \mathrm { T P } } { \mathrm { T P } + { \mathrm { F N } } } }
294
+ $$
295
+
296
+ In other words, precision answers the question "What proportion of verified TRUE answers was actually correct?" while recall answers "What proportion of actual correct answers was verified TRUE?" Given its meaning, verification-guided voting is bound to be effective when the precision of verification is high.
297
+
298
+ # B PYTHON PACKAGE USAGE ANALYSIS
299
+
300
+ Tab. 6 outlines the usage of various Python packages in our experiments. Among them, we found that the sympy package is utilized most frequently, highlighting its central role in the computational tasks performed.
301
+
302
+ Table 6: Python package usage frequency on MATH dataset.
303
+
304
+ <table><tr><td></td><td>All</td><td>Correct</td><td>Correct per code</td><td>Wrong</td><td>Wrong per code</td><td>c/w per code</td></tr><tr><td> sympy</td><td>0.4168</td><td>0.3907</td><td>0.3323</td><td>0.4724</td><td>0.3194</td><td>104%</td></tr><tr><td>math</td><td>0.1590</td><td>0.1638</td><td>0.1393</td><td>0.1493</td><td>0.1009</td><td>138%</td></tr><tr><td>numpy</td><td>0.0284</td><td>0.0241</td><td>0.0205</td><td>0.0383</td><td>0.0259</td><td>79%</td></tr><tr><td>fractions</td><td>0.0094</td><td>0.0110</td><td>0.0094</td><td>0.0058</td><td>0.004</td><td>238%</td></tr><tr><td>itertools</td><td>0.0034</td><td>0.0029</td><td>0.0025</td><td>0.0045</td><td>0.0031</td><td>80%</td></tr><tr><td>cmath</td><td>0.0034</td><td>0.0026</td><td>0.0022</td><td>0.0052</td><td>0.0035</td><td>63%</td></tr><tr><td>scipy</td><td>0.0016</td><td>0.0009</td><td>0.0007</td><td>0.0032</td><td>0.0022</td><td>34%</td></tr><tr><td>matplotlib</td><td>0.0010</td><td>0.0003</td><td>0.0003</td><td>0.0026</td><td>0.0018</td><td>14%</td></tr><tr><td>functools</td><td>0.0004</td><td>0.0003</td><td>0.0003</td><td>0.0007</td><td>0.0004</td><td>57%</td></tr><tr><td>collections</td><td>0.0004</td><td>0.0006</td><td>0.0005</td><td>0.0000</td><td>0.0000</td><td>NaN</td></tr><tr><td>statistics</td><td>0.0002</td><td>0.0003</td><td>0.0003</td><td>0.0000</td><td>0.0000</td><td>NaN</td></tr></table>
305
+
306
+ Table 7: Performance of CSV on GSM8K and MATH based on CodeLlama-7B and CodeLlama-34B.
307
+
308
+ <table><tr><td></td><td>一 GSM8K Accuracy (%) | MATH Accuracy (%)</td><td></td></tr><tr><td>CodeLlama-7B</td><td>一 17.44 一</td><td>6.56</td></tr><tr><td>CodeLlama-7B + CSV</td><td>一 20.85 一</td><td>10.18</td></tr><tr><td>CodeLlama-34B</td><td>一 28.96 一</td><td>9.12</td></tr><tr><td>CodeLlama-34B + CSV|</td><td>37.60 一</td><td>13.36</td></tr></table>
309
+
310
+ # C CSV ON OPEN SOURCE MODELS
311
+
312
+ We have tested our method on CodeLlama-7B and CodeLlama-34B by applying the same prompting method of CSV to these weaker models in a zero-shot manner. The results are shown in Tab. 7. As can be seen, there is a noticeable improvement on the accuracy of both GSM8K and MATH, though the accuracy is much lower compared to GPT4-Code.
313
+
314
+ # D DETAILED EXPERIMENT RESULT ON MMLU DATASET
315
+
316
+ Fig. 7 illustrates that GPT4-Code performs relatively poorly in certain domains, such as engineering and the humanities, with a particularly marked deficiency in virology, where it achieves a score of less than $60 \%$ . These observations delineate specific areas that call for further investigation and refinement, thus outlining the direction for future improvements in the model.
317
+
318
+ ![](images/98cf0d380048620e21ff79f3c9540a9c48b9e91150466c1a4a1f0ea46a8ec5e1.jpg)
319
+ Figure 7: GPT4-Code performance on MMLU dataset on: (a) subsubcategory, (b) category, (c) subcategory
320
+
321
+ ![](images/ef454712c1143ae37531125929b67288208b1c23afb03552ab92bba456d9e722.jpg)
322
+ Figure 8: Performance of GPT4-Code with CSV prompt on MMLU dataset on: (a) subsubcategory, (b) category, (c) subcategory
323
+
324
+ # E EXAMPLES OF SELF-DEBUGGING MECHANISM IN GPT4-CODE
325
+
326
+ <table><tr><td>Math Problem: 0.54 as a fraction in lowest terms.</td></tr><tr><td>Sure, we can solve this problem by setting up an equation, solving it, and simplifying the fraction.</td></tr><tr><td>Let&#x27;s call 0.54 as x. The decimal 0.54 means that the digits &quot;54&quot; repeat indefinitely. So, we can multiply x by 100 (since &quot;54&quot; is a two-digit number) to get another equation.</td></tr><tr><td>This gives us 100x = 54.54.</td></tr><tr><td>By subtracting the original equation from this new one, we eliminate the repeating decimal: 100x- x= 54.54-0.54. Let&#x27;s perform these steps in the next Python cell.</td></tr></table>
327
+
328
+ # define the symbol $\mathrm { ~ x ~ } =$ symbols $( \mathbf { \partial } ^ { \prime } \mathbf { x } ^ { \prime } \mathbf { \partial } )$ )
329
+
330
+ # Apologies for the mistake. We can’t directly subtract two equations in Python. Instead, we should subtract the right-hand sides and left-hand sides of the equations separately to get a new equation. Let’s correct that.
331
+
332
+ # subtract the right hand sides and left hand sides of the equations separately
333
+ rhs $=$ simplify(eq2.rhs - eq1.rhs)
334
+ lhs $=$ simplify(eq2.lhs - eq1.lhs) RESULT
335
+ $\mathbf { E q } ( 9 9 ^ { * } \mathbf { x } , 5 4 . \mathbf { 0 } )$
336
+ After subtraction, we get the equation $9 9 x = 5 4$ . Next, we can solve for $x$ to express $0 . { \overline { { 5 4 } } }$ as a fraction.
337
+
338
+ # solve for x solution $=$ solve(new_eq, x)
339
+
340
+ solution[0]
341
+
342
+ RESULT
343
+ 0.545454545454545
344
+ The solution for $x$ is approximately 0.545454545454545, but we need to express it as a fraction. Let’s convert this decimal into a fraction.
345
+
346
+ # convert the decimal solution to a fraction fraction $=$ nsimplify(solution[0])
347
+
348
+ fraction
349
+
350
+ RESULT
351
+ 6/11
352
+ The decimal 0.54 can be expressed as the fraction $\frac { 6 } { 1 1 }$ .
353
+
354
+ <table><tr><td>Math Problem: A bus comes by Jerry&#x27;s bus stop every 20 minutes starting at exactly 5:13 a.m. If Jerry shows up at exactly 8:35 a.m.,how many minutes will he have to wait for the next bus?</td></tr><tr><td>Step 1: Calculate the total minutes from 5:13 a.m. to 8:35 a.m. Total minutes from 5:13 a.m. to 8:35 a.m. is 180 + 22 minutes. Step 2: Calculate how many buses have come by during this time. Step 3: Calculate the time when the last bus before 8:35 a.m. came by. - The time when the last bus came by is 5 : 13a.m. + 20 × [n」minutes.</td></tr></table>
355
+
356
+ # Step 1: Calculate the total minutes from 5:13 a.m. to 8:35 a.m. total_minutes $= \ 1 8 0 \ + \ 2 2$
357
+
358
+ # RESULT
359
+
360
+ #
361
+
362
+ It seems that there’s a mistake in the calculations. The waiting time cannot be negative. This error might have occurred in Step 3, where I calculated the time of the last bus in minutes past midnight, but then in Step 4, I subtracted this from the total time from $5 { : } 1 3 \ \mathrm { a . m }$ . to $8 { : } 3 5 \ \mathrm { a . \dot { m } }$ . I should correct Step 4 to calculate the time until the next bus, which is either 0 if a bus has just arrived at $8 { : } 3 5 \ \mathrm { a . m }$ ., or 20 minutes minus the time since the last bus if a bus arrived before 8:35 a.m.
363
+
364
+ Let’s correct this.
365
+
366
+ # Corrected Step 4: Calculate the time until the next bus time_since_last_bus $=$ total_minutes - last_bus_time
367
+
368
+ # RESULT
369
+
370
+ #
371
+
372
+ There still seems to be a mistake in the calculations. The waiting time calculated is significantly more than 20 minutes, which is not possible given that the bus comes every 20 minutes. Looking back at the calculations, it seems that the error is in Step 3 when calculating the time the last bus came. The last bus time should be calculated from $5 { : } 1 3 \ \mathrm { a . m . }$ ., not from midnight. Let’s correct this.
373
+
374
+ # Corrected Step 3: Calculate the time when the last bus before 8:35 a.m. came by. last_bus_time_corrected $= 5 \star 6 0 + 1 3 +$ num_buses $\star \_ 0$
375
+
376
+ # RESULT
377
+
378
+ #
379
+
380
+ It seems there is still an error. Let’s try a different approach.
381
+
382
+ 1. Calculate the total minutes that have passed since the first bus at $5 { : } 1 3 \ \mathrm { a . m }$ . until $8 { : } 3 5 \ \mathrm { a . m }$ . 2. Since the buses come every 20 minutes, calculate how many complete cycles of 20 minutes have passed in the calculated total minutes. 3. The time Jerry will have to wait is the remainder of the total minutes divided by 20 (which is the time since the last bus) subtracted from 20 (which is the bus cycle). This approach should give us the correct waiting time. Let’s calculate it.
383
+
384
+ # Calculate total minutes from 5:13 a.m. to 8:35 a.m. total_minutes $= 3 \star 6 0 + 2 2$ # 3 hours and 22 minutes
385
+
386
+ # RESULT
387
+
388
+ 18 So, Jerry will have to wait for 18 minutes for the next bus.
389
+
390
+ # Answer: 18
391
+
392
+ # F EXAMPLES OF NATURAL LANGUAGE VERIFICATION
393
+
394
+ # code 0
395
+
396
+ # code 1
397
+
398
+ # code more
399
+
400
+ The given fraction is
401
+
402
+ $$
403
+ \frac { 4 3 2 1 } { 5 ^ { 7 } \cdot 2 ^ { 8 } }
404
+ $$
405
+
406
+ To simplify this fraction, we can notice that $5 ^ { 7 } \ \cdot \ 2 ^ { 8 } = 1 0 ^ { 7 }$ , which would mean the fraction is equivalent to 4321 × 10−7, i.e., the number 4321 with the decimal point moved 7 places to the left. This would result in the number 0.0004321.
407
+
408
+ To get the sum of the digits in the terminating decimal representation of this number, we just need to add up the digits in 4321, since the zeros do not contribute to the sum.
409
+
410
+ So, the sum is $4 + 3 + 2 + 1 = 1 0$ Therefore, the answer is 10
411
+
412
+ $\#$ Convert to string and replace the decimal point
413
+ str_value $=$ str(value).replace(’. , ’’)
414
+
415
+ # Answer:
416
+
417
+ The denominator can be rewritten as $1 0 ^ { m i n ( 7 , 8 ) } \quad \times$ $5 ^ { m a x ( 0 , 7 - 8 ) } \quad \times \quad 2 ^ { m a x ( 0 , 8 - 7 ) }$ , where $m i n ( a , b )$ is the minimum of $a$ and $b$ , and $m a x ( a , b )$ is the maximum of $a$ and $^ { b }$ . Now let’s calculate the value of $m i n ( 7 , 8 )$ , $m a x ( 0 , 7 - 8 )$ , and $m a x ( 0 , 8 - 7 )$ .
418
+
419
+ # RESULT:
420
+
421
+ Now, let’s simplify the fraction $\frac { 4 3 2 1 } { 1 0 ^ { 7 } \times 5 ^ { 0 } \times 2 ^ { 1 } }$ .
422
+
423
+ $\#$ define the numerator and denominator
424
+ numerator $= \ 4 3 2 1$
425
+ denominator $= 1 0 \star \star 7 \star 5 \star \star 0 \star 2 \star \star 1$
426
+
427
+ # RESULT: 0.00021605
428
+
429
+ We exclude the zeros before the first non-zero digit and the decimal point as they do not contribute to the sum.
430
+
431
+ Thus, the sum of the digits is the sum of 2, 1, 6, 0, and 5. Let’s calculate it.
432
+
433
+ digits $=$ [2, 1, 6, 0, 5] # calculate the sum of the digits sum_of_digits $=$ sum(digits)
434
+
435
+ # RESULT:
436
+
437
+ So, the final answer is: 14
438
+
439
+ # Answer: 14
440
+
441
+ Math Problem: Solve for $x : 3 ^ { 2 x } + 1 9 = 1 0 ^ { x } .$
442
+
443
+ # code 0
444
+
445
+ # code more
446
+
447
+ This is a difficult equation to solve and there’s no simple analytical solution using elementary functions. In real world scenarios, such equations are typically solved numerically. For example, using a graphing calculator, a computer, or a mathematical software. However, if you want an approximation of the solution, it is advisable to use numerical methods such as the bisection method, Newton’s method, or others. If you would like me to provide an algorithm to find the solution numerically, let me know.
448
+
449
+ The equation you’re asking to solve, $\bar { 3 } ^ { 2 x } + 1 9 = 1 0 ^ { x }$ , cannot be solved algebraically due to the nature of the functions and operations involved. Therefore, we’ll need to use numerical methods such as Newton’s method or Bisection method for root finding.
450
+
451
+ from scipy.optimize import fsolve
452
+ import numpy as np
453
+ # Defining the function
454
+ def func(x): return $3 \star \star ( 2 \star \mathbf { x } ) + 1 9 - 1 0 \star \star \mathbf { x }$
455
+ # Initial guess for x, it can be anything, 1.0 is chosen arbitrarily here
456
+ $\times 0 = 1 . 0$
457
+ $\#$ Using fsolve to find the root
458
+ root $=$ fsolve(func, $\mathtt { x 0 }$ )
459
+ x = root[0]
460
+ x
461
+
462
+ # RESULT 1.001831315399663
463
+
464
+ Answer:
465
+ Rewrite the equation as:
466
+ $3 ^ { 2 x } - 1 0 + 1 \bar { 9 } = 0$
467
+ Let’s denote $\begin{array} { r l r l } { { 3 } ^ { x } } & { { } = { } } & { a } \end{array}$ , and $1 0 ^ { x } = b$
468
+ so $a ^ { 2 } - b + 1 9 = 0$
469
+ now we have two equations:
470
+ 1. $a = 3 ^ { x }$
471
+ 2. $b = 1 0 ^ { x }$ Let’s solve this with Python.
472
+ # Define the system of equations
473
+ def equations(vars): x, a, b = vars $\mathtt { e q 1 } \ = \ \mathtt { a } \ - \ 3 \star \star \mathbf { x }$ $\mathtt { e q 2 } \ = \ \mathtt { b } \ - \ \mathtt { 1 0 \star \star x }$ $\mathtt { e q 3 } ~ = ~ \mathtt { a } \star \star 2 ~ - ~ \mathtt { b } ~ + ~ 1 \subseteq$ return [eq1, eq2, eq3]
474
+
475
+ # RESULT:
476
+
477
+ $$
478
+ \bar { 3 } ^ { 2 . 0 } + 1 9 = 1 0 ^ { 0 }
479
+ $$
480
+
481
+ Let’s try a different initial guess for the solution to see if that helps.
482
+
483
+ $\#$ Adjust initial guess for x, a, b
484
+ $\mathrm { ~ \bf ~ x 0 ~ } = \mathrm { ~ \bf ~ [ ~ } 1$ , 3, 10]
485
+
486
+ $\#$ Solve system of equations solution $=$ root(equations, x0)
487
+
488
+ # RESULT: 2.0000000000004463
489
+
490
+ We know that $3 ^ { 2 \cdot 2 } = 3 ^ { 4 } = 8 1$ and $1 0 ^ { 2 } ~ = ~ 1 0 0$ . The left-hand side becomes 100 and the righthand side is also 100. Thus, the original equation holds true for $x = 2$ .
491
+
492
+ # Answer: 2
493
+
494
+ # G EXAMPLES OF DIFFERENT VERIFICATION RESULTS
495
+
496
+ # True
497
+
498
+ # False
499
+
500
+ The angle $A B C$ is the angle between the vectors $\vec { B A }$ and $B \bar { C }$ . We can find these vectors as follows:
501
+
502
+ $$
503
+ \vec { B A } = \vec { A } - \vec { B } = ( - 2 , - 7 , 1 )
504
+ $$
505
+
506
+ $$
507
+ \vec { B C } = \vec { C } - \vec { B } = ( - 5 , 5 , - 2 )
508
+ $$
509
+
510
+ The angle $\theta$ between two vectors $\vec { u }$ and $\vec { v }$ can be found using the formula
511
+
512
+ $$
513
+ \cos ( \theta ) = { \frac { { \vec { u } } \cdot { \vec { v } } } { | | { \vec { u } } | | | | | { \vec { v } } | | } }
514
+ $$
515
+
516
+ Let’s calculate these values.
517
+
518
+ import numpy as np
519
+
520
+ # Define vectors vec_BA $=$ np.array([1, -11, 2]) - np.array([3, -4, 1])
521
+
522
+ # RESULT:
523
+
524
+ # 120.00000000000001
525
+
526
+ Let’s now verify this answer.
527
+
528
+ $$
529
+ \vec { u } \cdot \vec { v } = | | \vec { u } | | \cdot | | \vec { v } | | \cdot \cos ( \theta )
530
+ $$
531
+
532
+ Substituting our values into this formula, we should get the same dot product (-27) that we calculated earlier. Let’s check this.
533
+
534
+ # Compute the dot product using the formula
535
+ dot_product_verification $=$ magnitude_BA $^ { \star }$ magnitude_BC \* np.cos(theta $\star \mathrm { \ n p . p i } \mathrm { \Delta } /$ 180)
536
+
537
+ # RESULT: -27
538
+
539
+ #
540
+
541
+ which matches the dot product we calculated earlier. Therefore, the computed angle of $1 2 0 ^ { \circ }$ is correct.
542
+
543
+ Answer: 120◦
544
+
545
+ the cosine of the angle $\theta$ between them is given by
546
+
547
+ $$
548
+ \cos \theta = { \frac { \mathbf { u } \cdot \mathbf { v } } { \left| \left| \mathbf { u } \right| \right| \left| \left| \mathbf { v } \right| \right| } }
549
+ $$
550
+
551
+ Table 12: An example in which True succeeds while Uncertain and False fails.
552
+
553
+ <table><tr><td>Math Problem: Let A = (1,-11,2), B = (3,-4,1), and C = (-2,1,-1). Compute ∠ABC, in degrees.</td></tr></table>
554
+
555
+ In the given problem, we want to find the angle between vectors $\xrightarrow [ A B ] { }$ and $\overrightarrow { B C }$ , where
556
+
557
+ $$
558
+ \overrightarrow { A B } = { \bf B } - { \bf A } = ( 2 , 7 , - 1 )
559
+ $$
560
+
561
+ $$
562
+ \overrightarrow { B C } = \mathbf { C } - \mathbf { B } = ( - 5 , 5 , - 2 )
563
+ $$
564
+
565
+ Now, we’ll calculate the angle using the formula for $\cos \theta$ .
566
+
567
+ from numpy import array, dot from numpy.linalg import norm import math
568
+
569
+ # Defining the vectors $\begin{array} { r l } { \mathbb { A } } & { { } = } \end{array}$ array([1, -11, 2])
570
+
571
+ # RESULT:
572
+
573
+ #
574
+
575
+ The angle $\angle A B C$ is $6 0 ^ { \circ }$
576
+
577
+ The vector $\xrightarrow [ A B ] { }$ is given by $B \mathrm { ~ - ~ } A$ , and the vector $\overrightarrow { B C }$ is given by $C - B$ .
578
+
579
+ The cosine of the angle between two vectors $\mathbf { u }$ and $\mathbf { v }$ is given by
580
+
581
+ $$
582
+ \cos ( \theta ) = { \frac { \mathbf { u } \cdot \mathbf { v } } { \| \mathbf { u } \| \| \mathbf { v } \| } }
583
+ $$
584
+
585
+ # Let’s calculate.
586
+
587
+ import numpy as np
588
+
589
+ # define the points A = np.array([1, -11, 2])
590
+
591
+ # RESULT: 60.00000000000001
592
+
593
+ The angle $A B C$ is approximately $6 0 . 0 ^ { \circ }$ . Let’s verify this. We can solve for $\cos ( \dot { C } )$ :
594
+
595
+ $$
596
+ \cos ( C ) = { \frac { a ^ { 2 } + b ^ { 2 } - c ^ { 2 } } { 2 a b } }
597
+ $$
598
+
599
+ # calculate the magnitudes of AC magnitude_AC $=$ np.linalg.norm(AC)
600
+
601
+ # RESULT:
602
+
603
+ I apologize for the confusion; there seems to have been a mistake in the verification.
604
+
605
+ The discrepancy arises due to the directionality of the vectors.
606
+
607
+ # True
608
+
609
+ # False
610
+
611
+ The least common multiple (LCM) of two numbers $a$ and $^ { b }$ is given by the formula:
612
+
613
+ $$
614
+ \operatorname { L C M } ( a , b ) = { \frac { | a \times b | } { \operatorname { G C D } ( a , b ) } }
615
+ $$
616
+
617
+ Hence, the equation can be rewritten as:
618
+
619
+ First, let’s find the prime factorization of 7000.
620
+
621
+ In this problem, we are given that $l c m ( r , 7 0 0 ) = 7 0 0 0$ . Let’s first find the prime factors of 700 and 7000.
622
+
623
+ $$
624
+ \frac { r \times 7 0 0 } { \mathrm { G C D } ( r , 7 0 0 ) } = 7 0 0 0
625
+ $$
626
+
627
+ import sympy
628
+
629
+ $\#$ Find the prime factorization of 700 and 7000
630
+ factors_ $. 7 0 0 ~ =$ sympy.factorint (700)
631
+
632
+ We also know that $r$ must be a divisor of 7000. So, we’ll find all the divisors of 7000.
633
+
634
+ # Find all divisors of 7000
635
+ divisors_7000 $=$ sympy.divisors (7000)
636
+ # Filter out the divisors
637
+ r_values_corrected $\begin{array} { r l r } { \mathbf { \Phi } } & { { } = } & { [ \mathbf { \Phi } \mathbf { r } } \end{array}$ for r in divisors_7000 $\mathrm { ~ i ~ f ~ } \mathrm { ~ r ~ } = = \mathrm { ~ 7 0 0 0 ~ }$ \* sympy.gcd(r, 700) // 700]
638
+
639
+ # RESULT:
640
+
641
+ # (7000, 1000)
642
+
643
+ Let’s verify our solution by checking whether the LCM of each possible $r$ and 700 is indeed 7000.
644
+
645
+ # Verify the solution
646
+ lcm_values_corrected $=$ [sympy.lcm (r, 700) for r in r_values_corrected]
647
+
648
+ # RESULT:
649
+
650
+ # (True, True)
651
+
652
+ Upon verification, we find that the least common multiple (LCM) of each possible value of $r$ and 700 is indeed 7000. Hence, the sum of all positive integers $r$ that satisfy $\mathrm { l c } \hat { \mathrm { m } } [ r , 7 0 0 ] = \mathsf { ^ { - } 7 0 0 0 }$ is $1 0 0 0 + 7 0 0 0 = 8 0 0 0$ . The answer is 8000.
653
+
654
+ import sympy
655
+ # Get the prime factorization of 7000
656
+ prime_factors $=$ sympy.factorint (7000)
657
+ # Generate all factors of 7000
658
+ factors = set()
659
+ for factor_2_count in range( prime_factors[2] $+ ~ \perp )$ ): for factor_5_count in range( prime_factors[5] $\textsuperscript { + } ~ \textsuperscript { 1 1 }$ ):
660
+
661
+ # RESULT:
662
+
663
+ # (2: 3, 5: 3, 7: 1, [3500, 700, 7000, 1400], 12600)
664
+
665
+ The prime factorization of 7000 is $2 ^ { 3 } { \cdot } 5 ^ { 3 } \cdot 7 ^ { 1 }$ . The factors of 7000 that are multiples of 700 are: 3500, 700, 7000, and 1400. So, the sum of all positive integers $r$ that satisfy $\mathrm { l c } \hat { \mathrm { m } } ( r , 7 0 0 ) = 7 0 0 0$ is $3 5 0 0 + 7 0 0 + 7 0 0 0 + 1 4 0 0 =$ 12600. So the final answer is 12600.
666
+
667
+ # RESULT:
668
+
669
+ (2: 2, 5: 2, 7: 1, 2: 3, 5: 3, 7: 1) Since the LCM of r and 700 is 7000, r must contain all the prime factors of 7000 that are not already in 700.
670
+
671
+ # Generate all combinations
672
+ combinations = list(product(\*[[1, i] for i in extra_factors ]))
673
+
674
+ # RESULT:
675
+
676
+ # ([1, 5, 2, 10], 18)
677
+
678
+ The possible values of r are 1, 2, 5, and 10.
679
+ To verify our answer, we can check that the least common multiple of r and 700 is indeed 7000.
680
+ # Remove 1 from the possible values of r
681
+ possible_r_values.remove(1)
682
+ .. ...
683
+
684
+ # RESULT:
685
+
686
+ # False
687
+
688
+ It seems that there’s a mistake. Not all the calculated values of r satisfy the given condition. Let’s correct the calculation.
689
+
690
+ $\#$ All the values of $\mathbb { r }$ should have the factors of 700 r_values $=$ [700]
691
+
692
+ RESULT: ([700, 1400, 3500, 7000], 18720) Therefore, answer is 18720.
693
+
694
+ # Answer: 8000
695
+
696
+ # H FAILURE EXAMPLES OF NATURAL LANGUAGE VERIFICATION
697
+
698
+ $\bf M a t h P r o b l e m \colon L e t a _ { n } = 4 n ^ { 3 } + 6 n ^ { 2 } + 4 n + 1 . \mathrm { F i n d } a _ { 8 } + a _ { 9 } + a _ { 1 0 } + \cdot \cdot \cdot + a _ { 2 3 } .$
699
+
700
+ The sequence $a _ { n } = 4 n ^ { 3 } + 6 n ^ { 2 } + 4 n + 1$ is a cubic sequence. To find the sum $a _ { 8 } + a _ { 9 } + a _ { 1 0 } +$ $\cdots + a _ { 2 3 }$ , we can use the property of cubic sequences which states that the sum of consecutive terms in a cubic sequence forms a quartic sequence. Given that the sum of the first $n$ terms ...... Let’s calculate this.
701
+
702
+ # Define the function for the sum of the first n terms
703
+ def S(n): return $n \star \star 4 + 2 \star \square \star \star 3 + 2 \star \square \star \star 2 + \square$
704
+ # Calculate the sum of terms from a_8 to a_23
705
+ sum_8_to_23 = S(23) - S(7)
706
+ sum_8_to_23
707
+
708
+ # RESULT 302064
709
+
710
+ The sum of the terms from $a _ { 8 }$ to $a _ { 2 3 }$ is
711
+
712
+ Now, let’s verify this result. The sum of the terms from $a _ { 8 }$ to $a _ { 2 3 }$ is equivalent to the sum of the terms $a _ { n }$ from $n = 8$ to $n = 2 3$ . This is equal to
713
+
714
+ $$
715
+ 4 \cdot 8 ^ { 3 } + 6 \cdot 8 ^ { 2 } + 4 \cdot 8 + 1 + 4 \cdot 9 ^ { 3 } + 6 \cdot 9 ^ { 2 } + 4 \cdot 9 + 1 + \ldots + 4 \cdot 2 3 ^ { 3 } + 6 \cdot 2 3 ^ { 2 } + 4 \cdot 2 3 + 1
716
+ $$
717
+
718
+ We can’t calculate this manually without a calculator or any programming language. However, we can still verify the result by checking the properties of the sequence and the sum formula. Given the sequence $a _ { n } = 4 n ^ { 3 } \dot { + } 6 n ^ { 2 } + 4 \bar { n } + 1$ , the sum of the first $n$ terms is a quartic sequence, which is given by $S _ { n } = n ^ { 4 } + 2 n ^ { 3 } + 2 n ^ { 2 } + n$ . This is derived correctly from the sequence by term-by-term integration. The sum of terms from $a _ { 8 }$ to $a _ { 2 3 }$ is found by subtracting the sum of the first 7 terms from the sum of the first 23 terms, which is $S _ { 2 3 } - \bar { S _ { 7 } }$ . This is also a correct approach. Therefore, without actually calculating the sum, we can say that the method used to find the sum and the sum formula are correct. Based on these observations, the calculated result is likely to be correct as well. So, the verification result is:
719
+
720
+ Math Problem: Compute P∞k=1 k+2k!+(k+1)!+(k+2)! .
721
+
722
+ The sum
723
+
724
+ $$
725
+ \sum _ { k = 1 } ^ { \infty } { \frac { k + 2 } { k ! + ( k + 1 ) ! + ( k + 2 ) ! } }
726
+ $$
727
+
728
+ can be rearranged to recognize a pattern ......
729
+
730
+ $$
731
+ \boxed { e - 1 }
732
+ $$
733
+
734
+ where $e$ is the base of the natural logarithm.Now let’s verify the result. Recall that the series
735
+
736
+ $$
737
+ \sum _ { k = 1 } ^ { \infty } { \frac { 1 } { ( k - 1 ) ! } }
738
+ $$
739
+
740
+ is a shifted version of the series
741
+
742
+ $$
743
+ \sum _ { k = 0 } ^ { \infty } { \frac { 1 } { k ! } }
744
+ $$
745
+
746
+ which is known to converge to $e$ , the base of the natural logarithm. The original series is missing the 0! term, which is equal to 1, so we subtract 1 from $e$ to get the sum of the original series. Therefore, based on the properties of the series and the value of $e$ , it seems reasonable to conclude that the solution is $e - 1$ . Therefore, the verification result is:
747
+
748
+ Answer: e - 1 ✗
749
+
750
+ # I DISTRIBUTION OF THE CONSISTENCY BETWEEN REASONING PROCESS AND VERIFICATION PROCESS
751
+
752
+ To further analyze the consistency between the verification process, NL reasoning process, and output correctness, we have collected examples of four kinds from MATH shown in Fig. 9. The reasoning process is correct if the answer before the verification is correct. The verification process is correct if the verification process itself is correct. The four kinds of examples are explained below:
753
+
754
+ • Reasoning: Correct, Verification: Correct. When both the reasoning and verification processes are correct, the verification successfully validates the solution, ensuring consistency with the answer and the natural language (NL) reasoning process. • Reasoning: Correct, Verification: Wrong. If the reasoning is correct but the verification is erroneous, the verification fails to recognize the correct solution. • Reasoning: Wrong, Verification: Correct. If the reasoning is incorrect but the verification is accurate, the verification process amends the erroneous reasoning, leading to a correct answer. • Reasoning: Wrong, Verification: Wrong. If both the reasoning and verification processes are incorrect, the verification is unable to rectify the flawed solution.
755
+
756
+ Fig. 9 demonstrates that in most of the samples, reasoning process and verification process are consistent with each other.
757
+
758
+ ![](images/a75fa3b9081e7f45a8c889698ee3b8257321a7053d878a7a719800e72243f7ca.jpg)
759
+ Figure 9: The distribution of the consistency between reasoning process and verification process on 100 randomly sampled math word problems from MATH.
760
+
761
+ # J ANALYSIS OF DIFFERENT TYPES OF VERIFICATION CODE
762
+
763
+ To further analyze what types of verification code are generated, we randomly sampled 50 problems from MATH as well as their solutions generated with CSV. We counted 4 types of verification code: Substitution, Alternative Method, Double Checking, and Approximation. Their distribution is show in Fig. 10.
764
+
765
+ • Substitution: The model substitutes the answer back to the question to check if it fits all the conditions. By inspecting the solutions we randomly sampled from the results, we found that this is the most common type of verification.
766
+ • Alternative Method: The model uses a different method to solve the problem and check if it reaches the same final answer.
767
+
768
+ • Double Checking: The model double-checks each part of the solution to see if they are correct. • Approximation: The model computes an approximation of the answer. This method is often used when there is infinity involved in the problems. The model uses a large number to approximate the infinity to check if the result is close to the answer.
769
+
770
+ Examples of the types above are shown in Tab. 16, Tab. 17, Tab. 18, Tab. 19.
771
+
772
+ ![](images/fb2c0211f74747b4662e3fa1431c322c834163c0c810d2a33f2aa9ab788a94f8.jpg)
773
+ Figure 10: The distribution of verification types generated by GPT4-Code on 50 randomly sampled math word problems from MATH.
774
+
775
+ Math Problem: Suppose that the minimum value of $f ( x ) = \cos 2 x - 2 a ( 1 + \cos x )$ is $- \frac { 1 } { 2 }$ . Find $a$ .
776
+
777
+ Next, we will verify this solution by substituting $a ~ = ~ - 0 . 2 5$ into the function $f ( x )$ , and checking whether the minimum value of $f ( x )$ is indeed $- \frac 1 2$ . We will evaluate $f ( x )$ over the interval $[ 0 , 2 \pi ]$ because the function is periodic with period $2 \pi$ .
778
+
779
+ ![](images/f7e66450f9e447ee3a90be0b30c310b995226facb04c1b9d29bbb9ff0b7416d6.jpg)
780
+
781
+ Now, let’s verify this result by actually computing the expression term by term. We’ll create a list of numbers from 100 down to 1, then add the even-indexed numbers and subtract the odd-indexed numbers.
782
+
783
+ ![](images/7a62b361c603daf1435c667eed9c7714aa0129a9b19aa3027f1b6b432aa3458c.jpg)
784
+
785
+ Table 17: An example of verification code that used alternative methods. The model uses a different method to solve the problem and check if it reaches the same final answer.
786
+
787
+ Math Problem: What is the greatest prime factor of the sum of the arithmetic sequence $1 + 2 + 3 + \cdot \cdot + 8 0 ?$
788
+
789
+ Now, let’s verify the solution. First, we will generate the sequence from 1 to 80, sum it up, and confirm that it is equal to 3240. Then, we will calculate the product of the prime factors and confirm that it is also equal to 3240. Finally, we will check that the maximum prime factor is indeed 5.
790
+
791
+ # create a list of numbers from 100 down to 1 # Generate the sequence from 1 to 80 sequence $=$ list(range(1, $\mathtt { n } + \mathtt { 1 } )$ )
792
+
793
+ Table 18: An example of verification code that used double checking. The model double checks each part of the solution to see if they are correct.
794
+
795
+ Now, let’s verify the solution. We can do this by calculating the sum of the first few terms of the series and see if it is close to our solution. Note that the series is infinite, so we can’t compute the exact value in this way, but we can check if it seems to be converging towards our solution. Let’s calculate the sum of the first 10,000 terms.
796
+
797
+ # calculate the sum of the first 10000 terms
798
+ sum_of_terms = 0
799
+ for n in range(1, 10001): sum_of_terms $+ =$ math.atan(math.sqrt(n)) - math.atan(math.sqrt(n+1))
800
+
801
+ sum_of_terms
802
+
803
+ Table 19: An example of verification code that used approximation. The model use a large number to approximate the infinity to check if the result is close to the answer.
parse/test/c8McWs4Av0/c8McWs4Av0_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/c8McWs4Av0/c8McWs4Av0_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/c8McWs4Av0/c8McWs4Av0_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/ehfRiF0R3a/ehfRiF0R3a.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/ehfRiF0R3a/ehfRiF0R3a_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/ehfRiF0R3a/ehfRiF0R3a_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/ehfRiF0R3a/ehfRiF0R3a_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/hUgBU9wgSf/hUgBU9wgSf_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/kLZsLlIpDU/kLZsLlIpDU.md ADDED
Binary file (60.4 kB). View file
 
parse/test/kLZsLlIpDU/kLZsLlIpDU_content_list.json ADDED
@@ -0,0 +1,513 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Escaping the Big Data Paradigm with Compact Transformers ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Anonymous authors Paper under double-blind review ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "Abstract ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "With the rise of Transformers as the standard for language processing, and their advancements in computer vision, there has been a corresponding growth in parameter size and amounts of training data. Many have come to believe that because of this, transformers are not suitable for small sets of data. This trend leads to concerns such as: limited availability of data in certain scientific domains and the exclusion of those with limited resource from research in the field. In this paper, we aim to present an approach for small-scale learning by introducing Compact Transformers. We show for the first time that with the right size, convolutional tokenization, transformers can avoid overfitting and outperform state-of-theart CNNs on small datasets. Our models are flexible in terms of model size, and can have as little as 0.28M parameters while achieving competitive results. Our best model can reach 98% accuracy when training from scratch on CIFAR-10 with only 3.7M parameters, which is a significant improvement in data-e\u0000ciency over previous Transformer based models being over 10x smaller than other transformers and is 15% the size of ResNet50 while achieving similar performance. CCT also outperforms many modern CNN based approaches, and even some recent NAS-based approaches. Additionally, we obtain a new SOTA result on Flowers-102 with $9 9 . 7 6 \\%$ top-1 accuracy, and improve upon the existing baseline on ImageNet (82.71% accuracy with 29% as many parameters as ViT), as well as NLP tasks. Our simple and compact design for transformers makes them more feasible to study for those with limited computing resources and/or dealing with small datasets, while extending existing research e\u0000orts in data e\u0000cient transformers. ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "1 Introduction ",
27
+ "text_level": 1,
28
+ "page_idx": 0
29
+ },
30
+ {
31
+ "type": "text",
32
+ "text": "Convolutional neural networks (CNNs) LeCun et al. (1989) have been the standard for computer vision, since the success of AlexNet $\\boxed { \\mathrm { K r i z h e v s k y ~ e t ~ a l . } } \\left( \\boxed { 2 0 1 2 } \\right)$ . Krizhevsky et al. showed that convolutions are adept at vision based problems due to their invariance to spatial translations as well as having low relational inductive bias. He et al. He et al. (2016a) extended this work by introducing residual connections, allowing for significantly deeper models to perform e\u0000ciently. Convolutions leverage three important concepts that lead to their e\u0000ciency: sparse interaction, weight sharing, and equivariant representations Goodfellow et al. $\\textcircled { | 2 0 1 6 | }$ . Translational equivariance and invariance are properties of the convolutions and pooling layers, respectively Goodfellow et al. $\\textcircled { 2 0 1 6 }$ ; Schmidhuber (2015). They allow CNNs to leverage natural image statistics and subsequently allow models to have higher sampling e\u0000ciency Ruderman & Bialek (1994;?). ",
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "On the other end of the spectrum, Transformers have become increasingly popular and a major focus of modern machine learning research. Since the advent of Attention is All You Need Vaswani et al. (2017), the research community saw a spike in transformer-based and attention-based research. While this work originated in natural language processing, these models have been applied to other fields, such as computer vision. Vision Transformer (ViT $) [ \\mathrm { D o s o v i t s k i y ~ e t ~ a l . } ] ( [ \\mathrm { 2 0 2 0 } ] )$ was the first major demonstration of a pure transformer backbone being applied to computer vision tasks. ViT highlights not only the power of such models, but also that large-scale training can trump inductive biases. The authors argued that “Transformers lack some of the inductive biases inherent to CNNs, such as translation equivariance and locality, and therefore do not generalize well when trained on insu\u0000cient amounts of data.” Over the past few years, an explosion in model sizes and datasets has also become noticeable which has led to a “data hungry” paradigm, making training transformers from scratch seem intractable for many types of pressing problems, where there are typically several orders of magnitude less data. It also limits major contributions in the research to those with vast computational resources. As a result, CNNs are still the go-to models for smaller datasets because they are more e\u0000cient, both computationally and in terms of memory, when compared to transformers. Additionally, local inductive bias shows to be more important in smaller images. They require less time and data to train while also requiring a lower number of parameters to accurately fit data. However, they do not enjoy the long range interdependence that attention mechanisms in transformers provide. Reducing machine learning’s dependence on large sums of data is important, as many domains, such as science and medicine, would hardly have datasets the size of ImageNet $| \\mathrm { D e n g ~ e t ~ a l . } ( \\mathrm { \\mathbb { 2 0 0 9 } } )$ This is because events are far more rare and it would be more di\u0000cult to properly assign labels, let alone create a set of data which has low bias and is appropriate for conventional neural networks. In medical research, for instance, it may be di\u0000cult to compile positive samples of images for a rare disease without other correlating factors, such as medical equipment being attached to patients who are actively being treated. Additionally, for a su\u0000ciently rare disease there may only be a few thousand images for positive samples, which is typically not enough to train a network with good statistical prediction unless it can su\u0000ciently be pre-trained on data with similar attributes. This inability to handle smaller datasets has impacted the scientific community where they are much more limited in the models and tools that they are able to explore. Frequently, problems in scientific domains have little in common with domains of pre-trained models and when domains are su\u0000ciently distinct pre-training can have little to no e\u0000ect on the performance within a new domain Zhuang et al. $\\textcircled { 2 0 2 0 }$ . In addition, it has been shown that strong performance on ImageNet does not necessarily result in equally strong performance in other domains, such as medicine $\\boxed { \\mathrm { K e ~ e t ~ a l . } } \\left( \\boxed { 2 0 2 1 } \\right)$ . Furthermore, the requisite of large data results in a requisite of large computational resources and this prevents many researchers from being able to provide insight. This not only limits the ability to apply models in di\u0000erent domains, but also limits reproducibility. Verification of state of the art machine learning algorithms should not be limited to those with large infrastructures and computational resources. The above concerns motivated our e\u0000orts to build more e\u0000cient models that can be e\u0000ective in less data intensive domains and allow for training on datasets that are orders of magnitude smaller than those conventionally seen in computer vision and natural language processing (NLP) problems. Both Transformers and CNNs have highly desirable qualities for statistical inference and prediction, but each comes with their own costs. In this work, we try to bridge the gap between these two architectures and develop an architecture that can both attend to important features within images, while also being spatially invariant, where we have sparse interactions and weight sharing. This allows for a Transformer based model to be trained from scratch on small datasets like CIFAR-10 and CIFAR-100, providing competitive results with fewer parameters and low computational requirements. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "image",
42
+ "img_path": "images/cc46a1b5d1f9ac26622c14eae5e08d08313c75514b325b54aabfcc72850ed6b0.jpg",
43
+ "image_caption": [
44
+ "Figure 1: Overview of CVT (right), the basic compact transformer, and CCT (left), the convolutional variant of our compact transformer. CCT can be quickly trained from scratch on small datasets, while achieving high accuracy (in under 30 minutes one can get 90% on an NVIDIA 2080Ti GPU or 80% on an AMD 5900X CPU on CIFAR-10). "
45
+ ],
46
+ "image_footnote": [],
47
+ "page_idx": 1
48
+ },
49
+ {
50
+ "type": "text",
51
+ "text": "",
52
+ "page_idx": 1
53
+ },
54
+ {
55
+ "type": "text",
56
+ "text": "",
57
+ "page_idx": 2
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "In this paper we introduce ViT-Lite, a smaller and more compact version of ViT, which can obtain over $9 0 \\%$ accuracy on CIFAR-10. We expand on ViT-Lite by introducing a sequence pooling and forming the Compact Vision Transformer (CVT). We further iterate by adding convolutional blocks to the tokenization step and thus creating the Compact Convolutional Transformer (CCT). Both of these simple additions add to significant increases in performance, leading to a top-1%accuracy of 98% on CIFAR-10. This makes our work the only transformer based model in the top 25 best performing models on CIFAR-10, without pre-training, and significantly smaller than the vast majority. Our model also outperforms most comparable CNN-based models within this domain, with the exception of certain Neural Architectural Search techniques Cai et al. $\\textcircled { | 2 0 1 8 | }$ . Additionally, we show that our model can be lightweight, only needing 0.28 million parameters and still reach close to $9 0 \\%$ top- $1 \\%$ accuracy on CIFAR-10. On ImageNet, CCT achieves $8 0 . 6 7 \\%$ accuracy while still maintaining a small number of parameters and reduced computation. CCT outperforms ViT, while containing less than a third of the number of parameters with about a third of the computational complexity (MACs). Additionally, CCT outperform similarly sized and more recent models, such as DeiT Huang et al. $\\left( \\left| 2 0 2 0 \\right| \\right)$ This demonstrates the scalability of our model while maintaining compactness and computational e\u0000ciency. The main contributions of this paper are: ",
62
+ "page_idx": 2
63
+ },
64
+ {
65
+ "type": "text",
66
+ "text": "• Extending transformer-based research to small data regimes, by introducing ViT-Lite, which can be trained from scratch and achieve high accuracy on datasets such as CIFAR-10. \n• Introducing Compact Vision Transformer (CVT) with a new sequence pooling strategy, which pools over output tokens and improves performance. \n• Introducing Compact Convolutional Transformer (CCT) to increase performance and provide flexibility for input image sizes while also demonstrating that these variants do not depend as much on Positional Embedding compared to the rest. ",
67
+ "page_idx": 2
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "In addition, we demonstrate that our CCT model is fast, obtaining 90% accuracy on CIFAR-10 using a single NVIDIA 2080Ti GPU and 80% when trained on a CPU (AMD 5900X), both in under 30 minutes. Additionally, since our model has a relatively small number of parameters, it can be trained on the majority of GPUs, even if researchers do not have access to top of the line hardware. Through these e\u0000orts, we aim to help enable and extend research around Transformers to cases with limited data and/or researchers with limited resources. ",
72
+ "page_idx": 2
73
+ },
74
+ {
75
+ "type": "text",
76
+ "text": "2 Related Works ",
77
+ "text_level": 1,
78
+ "page_idx": 2
79
+ },
80
+ {
81
+ "type": "text",
82
+ "text": "In NLP research, attention mechanisms Graves et al. (2014); Bahdanau et al. (2016); Luong et al. (2015) gained popularity for their ability to weigh di\u0000erent features within sequential data. Transformers Vaswani $\\boxed { \\mathrm { e t ~ a l . } } \\left( \\boxed { 2 0 1 7 } \\right)$ were introduced as a fully attention-based model, primarily for machine translation and NLP in general. Following this, attention-based models, specifically transformers have been applied to a wide variety of tasks beyond machine translation Devlin et al. (2019); Liu et al. (2019); Yang et al. (2019), including: visual question answering Lu et al. (2019); Su et al. (2019), action recognition Bertasius et al. (2021); Girdhar et al. (2019), and the like. Many researchers also leveraged a combination of attention and convolutions in neural networks for visual tasks Wang et al. (2017); Hu et al. (2018); Bello et al. (2019); Zhang et al. $\\textcircled { 2 0 1 9 }$ . Ramachandran et al. Ramachandran et al. (2019) introduced one of the first vision models that rely primarily on attention. Dosovitskiy et al. Dosovitskiy et al. (2020) introduced the first stand-alone transformer based model for image classification (ViT). In the following subsections, we briefly revisit ViT and several other related works. ",
83
+ "page_idx": 2
84
+ },
85
+ {
86
+ "type": "text",
87
+ "text": "2.1 Vision Transformer ",
88
+ "text_level": 1,
89
+ "page_idx": 2
90
+ },
91
+ {
92
+ "type": "text",
93
+ "text": "Dosovitskiy et al. Dosovitskiy et al. (2020) introduced ViT primarily to show that reliance on CNNs or their structure is unnecessary, as prior to it, most attention-based models for vision were used either with convolutions Wang et al. (2017); Bello et al. (2019) Zhang et al. (2019); Carion et al. (2020), or kept some of their properties Ramachandran et al. (2019). The motivation, beyond self-attention’s many desirable properties for a network, specifically its ability to make long range connections, was scalability. It was shown that ViT can successfully keep scaling, while CNNs start saturating in performance as the number of training samples grew. Through this, they concluded that large-scale training triumphs over the advantage of inductive bias that CNNs have, allowing their model to be competitive with CNN based architectures given su\u0000ciently large amount of training data. ViT is composed of several parts: Image Tokenization, Positional Embedding, Classification Token, the Transformer Encoder, and a Classification Head. These subjects are discussed in more detail below. ",
94
+ "page_idx": 2
95
+ },
96
+ {
97
+ "type": "text",
98
+ "text": "",
99
+ "page_idx": 3
100
+ },
101
+ {
102
+ "type": "text",
103
+ "text": "Image Tokenization: A standard transformer takes as input a sequence of vectors, called tokens. For traditional NLP based transformers, word ordering provides a natural order to sequence the data, but this is not so obvious for images. To tokenize an image, ViT subdivides an image into non-overlapping square patches in raster-scan order. The sequence of patches, $\\mathbf { x _ { p } } \\in \\mathbb { R } ^ { H \\times ( P ^ { 2 } C ) }$ with patch size $P$ , are flattened into 1D vectors and transformed into latent vectors of dimension $d$ . This is equivalent to a convolutional layer with $d$ filters, and $P \\times P$ kernel size and stride. This simple patching and embedding method has a few limitations, in particular: loss of information along the boundary regions. ",
104
+ "page_idx": 3
105
+ },
106
+ {
107
+ "type": "text",
108
+ "text": "Positional Embedding: Positional embedding adds spatial information into the sequence. Since the model does not actually know anything about the spatial relationship between tokens, adding extra information to reflect that can be useful. Typically, this is either a learned embedding or tokens are given weights from two sine waves with high frequencies, which is su\u0000cient for the model to learn that there exists a positional relationship between these tokens. ",
109
+ "page_idx": 3
110
+ },
111
+ {
112
+ "type": "text",
113
+ "text": "Transformer Encoder: A transformer encoder consists of a series of stacked encoding layers. Each encoder layer is comprised of two sub-layers: Multi-Headed Self-Attention (MHSA) and a Multi-Layer Perceptron (MLP) head. Each sub-layer is preceded by a layer normalization (LN), and followed by a residual connection to the next sub-layer. ",
114
+ "page_idx": 3
115
+ },
116
+ {
117
+ "type": "text",
118
+ "text": "Classification: Vision transformers typically add an extra learnable [class] token to the sequence of the embedded patches, representing the class parameter of an entire image and its state after transformer encoder can be used for classification. [class] token contains latent information, and through self-attention accumulates more information about the sequence, which is later used for classification. ViT Dosovitskiy et al. (2020) also explored averaging output tokens instead, but found no significant di\u0000erence in performance. ",
119
+ "page_idx": 3
120
+ },
121
+ {
122
+ "type": "text",
123
+ "text": "2.2 Data-E\u0000cient Transformers ",
124
+ "text_level": 1,
125
+ "page_idx": 3
126
+ },
127
+ {
128
+ "type": "text",
129
+ "text": "In an e\u0000ort to reduce dependence on data, Touvron et al. $\\boxed { \\mathrm { T o u v r o n ~ e t ~ a l . } \\mathrm { ( } \\mathbb { 2 0 2 0 } \\mathrm { ) } }$ proposed Data-E\u0000cient Image Transformers (DeiT). Using more advanced training techniques, and a novel knowledge transfer method, DeiT improves the classification performance of ViT on ImageNet-1k without large-scale pre-training on datasets such as JFT-300M Sun et al. $\\textcircled { 2 0 1 7 }$ or ImageNet-21k Deng et al. (2009). By relying only on more augmentations $\\mathrm { { C u b u k \\ e t \\ a l . } \\ ( \\mathbb { 2 0 2 0 } ) }$ and training techniques Zhang et al. (2017) Yun et al. (2019), it is shown that much smaller ViT variants that were unexplored by Dosovitskiy et al. can outperform the larger ones on ImageNet-1k without pre-training. Furthermore, DeiT variants were pushed even further through their novel knowledge transfer technique, specifically when using a convolutional model as the teacher. This work pushes forward accessibility of transformers in medium-sized datasets, and we aim to follow by extending the study to even smaller sets of data and smaller models. However, we base our work on the notion that if a small dataset happens to be su\u0000ciently novel, pre-trained models will not help train on that domain and the model will not be appropriate for that dataset. While knowledge transfer is a strong technique, it requires a pre-trained model for any given dataset, adding to training time and complexity, with an additional forward pass, and as pointed out by Touvron et al. is usually only significant when there’s a convolutional teacher available to transfer the inductive biases. As a result, it can be argued that if a network utilized just the bare minimum of convolutions, while keeping the pure transformer structure, it may need to rely less on large-scale training and transfer of inductive biases through knowledge transfer. ",
130
+ "page_idx": 3
131
+ },
132
+ {
133
+ "type": "text",
134
+ "text": "Yuan et al. Yuan et al. (2021b) proposed Tokens-to-token ViT (T2T-ViT), which adopts a window- and attention-based tokenization strategy. Their tokenizer extracts patches of the input feature map, simila to a convolution, applies three sets of kernel weights, and produces three sets of feature maps, which are fed to self-attention as query and key-value pairs. This process is equivalent to convolutions producing the QKV projections in a self-attention module. Finally, this strategy is repeated twice, followed by a final patching and embedding. The entire process replaces patch and embedding in ViT. This strategy, along with their small-strided patch extraction, allows their network to model local structures, including along the boundaries between patches. This attention-based patch interaction leads to finer-grained tokens which allow T2T-ViT to outperform previous Transformer-based models on ImageNet. T2T-ViT di\u0000ers from our work, in that it focuses on medium-sized datasets like ImageNet, which are not only far too large for many research problems in science and medicine but also resource demanding. T2T tokenizer also has more parameters and complexity compared to a convolutional one. ",
135
+ "page_idx": 3
136
+ },
137
+ {
138
+ "type": "image",
139
+ "img_path": "images/76d7365b0a24d8f4d43ce3e9277bb4982c77433709893bd27287c9ff2501917f.jpg",
140
+ "image_caption": [
141
+ "Figure 2: Comparing ViT (top) to CVT (middle) and CCT (bottom). CVT can be thought of as an ablated version of CCT, only utilizing sequence pooling and not a convolutional tokenizer. "
142
+ ],
143
+ "image_footnote": [],
144
+ "page_idx": 4
145
+ },
146
+ {
147
+ "type": "text",
148
+ "text": "",
149
+ "page_idx": 4
150
+ },
151
+ {
152
+ "type": "text",
153
+ "text": "2.3 Hierarchical and Convolution-inspired Transformers ",
154
+ "text_level": 1,
155
+ "page_idx": 4
156
+ },
157
+ {
158
+ "type": "text",
159
+ "text": "Hierarchical Vision Transformers, such as Swin Transformer Liu et al. (2021), PiT Heo et al. (2021), PVT Wang et al. (2021), stack multiple transformer encoders with downsampling modules in between, aimed at producing multi-scale feature maps which can be fed to many existing downstream frameworks. These works restrict self attention to linear variants in order to maintain a reasonable memory footprint and complexity, and have at times exceeded existing CNNs in downstream tasks such as object detection and image segmentation. ",
160
+ "page_idx": 4
161
+ },
162
+ {
163
+ "type": "text",
164
+ "text": "Many works motivated by Vision Transformers and their performance at scale propose hybrid models made of both attention and convolutions. $\\mathrm { C o n V i T \\ [ d ^ { \\prime } A s c o l i e t a l . ] ( \\ [ 2 0 2 1 ] ) }$ introduces a gated positional self-attention (GPSA) that allows for a “soft” convolutional inductive bias within their model. GPSA allows their network to have more flexibility with respect to positional information. Since GPSA is able to be initialized as a convolutional layer, this allows their network to sometimes have the properties of convolutions or alternatively having the properties of attention. Its gating parameter can be adjusted by the network, allowing it to become more expressive and adapt to the needs of the dataset. Convolution-enhanced image Transformers (Ceit) $\\mathrm { { \\underline { { Y u a n \\ e t \\ a l . } } } \\ ( \\mathrm { { \\underline { { 2 0 2 1 a } } } ) } }$ utilize convolutions throughout their model. They propose a convolution-based ",
165
+ "page_idx": 4
166
+ },
167
+ {
168
+ "type": "text",
169
+ "text": "Image-to-Token module for tokenization. They also re-design the encoder with layers of multi-headed selfattention and their novel Locally Enhanced Feedforward Layer, which processes the spatial information form the extracted token. This allows creates a network that is competitive with other works such as DeiT Touvron $\\mathrm { \\overline { { e t \\ a l . } } ( \\overline { { 2 0 2 0 } } ) }$ on ImageNet. Convolutional vision Transformer $\\mathrm { ( C v T ) [ W u \\ e t \\ a l . ] ( \\mathbb { 2 0 2 1 } ) }$ introduces convolutional transformer encoder layers, which use convolutions instead of linear projections for the QKV in self-attention. They also introduce convolutions into their tokenization step, and report competitive results compared to other vision transformers on ImageNet-1k. All of these works report results when trained from scratch on ImageNet (or larger datasets). ",
170
+ "page_idx": 5
171
+ },
172
+ {
173
+ "type": "text",
174
+ "text": "2.4 Comparison ",
175
+ "text_level": 1,
176
+ "page_idx": 5
177
+ },
178
+ {
179
+ "type": "text",
180
+ "text": "Our work di\u0000ers from the aforementioned in several ways, in that it focuses on answering the following question: Can vision transformers be trained from scratch on small datasets? Focusing on a small datasets, we seek to create a model that can be trained, from scratch, on datasets that are orders of magnitude smaller than ImageNet. Having a model that is compact, small in size, and e\u0000cient allows greater accessibility, as training on ImageNet is still a di\u0000cult and data intensive task for many researchers. Thus our focus is on an accessible model, with few parameters, that can quickly and e\u0000ciently be trained on smaller platforms while still maintaining SOTA results. ",
181
+ "page_idx": 5
182
+ },
183
+ {
184
+ "type": "text",
185
+ "text": "3 Method ",
186
+ "text_level": 1,
187
+ "page_idx": 5
188
+ },
189
+ {
190
+ "type": "text",
191
+ "text": "In order to provide empirical evidence that vision transformers are trainable from scratch when dealing with small sets of data, we propose three di\u0000erent models: ViT-Lite, Compact Vision Transformers (CVT), and Compact Convolutional Transformers (CCT). ViT-Lite is nearly identical to the original ViT in terms of architecture, but with a more suitable size and patch size for small-scale learning. CVT builds on this by using our Sequence Pooling method (SeqPool), that pools the entire sequence of tokens produced by the transformer encoder. SeqPool replaces the conventional [class] token. CCT builds on CVT and utilizes a convolutional tokenizer, generating richer tokens and preserving local information. The convolutional tokenizer is better at encoding relationships between patches compared to the original ViT Dosovitskiy et al. $\\textcircled { 2 0 2 0 }$ . A detailed modular-level comparison of these models can be viewed in Fig. 2. The components of our compact transformers are further discussed in the following subsections: Transformer-based Backbone, Small and Compact Models, SeqPool, and Convolutional Tokenizer. ",
192
+ "page_idx": 5
193
+ },
194
+ {
195
+ "type": "text",
196
+ "text": "3.1 Transformer-based Backbone ",
197
+ "text_level": 1,
198
+ "page_idx": 5
199
+ },
200
+ {
201
+ "type": "text",
202
+ "text": "In terms of model design, we follow the original Vision Transformer Dosovitskiy et al. (2020), and original Transformer $\\boxed { \\mathrm { V a s w a n i ~ e t ~ a l . } } ( \\boxed { 2 0 1 7 } )$ . As mentioned, the encoder consists of transformer blocks, each including an MHSA layer and an MLP block. The encoder also applies Layer Normalization, $G E L U$ activation, and dropout. Positional embeddings can be learnable or sinusoidal, both of which are e\u0000ective. ",
203
+ "page_idx": 5
204
+ },
205
+ {
206
+ "type": "text",
207
+ "text": "3.2 Small and Compact Models ",
208
+ "text_level": 1,
209
+ "page_idx": 5
210
+ },
211
+ {
212
+ "type": "text",
213
+ "text": "We propose smaller and more compact vision transformers. The smallest ViT variant, ViT-Base, includes a 12 layer transformer encoder with 12 attention heads, 64 dimensions per head, and 2048-dimensional hidden layers in the MLP blocks. This, along with the classifier and 16x16 patch and embedder results in over 85M parameters. We propose variants with as few as 2 layers, 2 heads, and 128-dimensional hidden layers. We summarized the details of the variants we propose, the smallest of which can have as little as 0.22M parameters, while the largest (for small-scale learning) only have 3.8M parameters in the appendix. We also adjust the tokenizer (patch size) according to the dataset we’re training on, based on its image resolution. These variants, which are mostly similar in architecture to ViT, but di\u0000erent in size, are referred to as ViT-Lite. In our notation, we use the number of layers to specify size, as well as tokenization details: for instance, ViT-Lite-12 /16 has $1 \\mathcal { Z }$ transformer encoder layers, and a 16◊16 patch size. ",
214
+ "page_idx": 5
215
+ },
216
+ {
217
+ "type": "text",
218
+ "text": "3.3 SeqPool ",
219
+ "text_level": 1,
220
+ "page_idx": 6
221
+ },
222
+ {
223
+ "type": "text",
224
+ "text": "In order to map the sequential outputs to a singular class index, ViT Dosovitskiy et al. $\\textcircled { 2 0 2 0 }$ and most other common transformer-based classifiers follow BERT $\\boxed { \\mathrm { D e v l i n ~ e t ~ a l . } } \\textcircled { \\mathrm { 2 0 1 9 } }$ , in forwarding a learnable class or query token through the network and later feeding it to the classifier. Other common practices include global average pooling (averaging over tokens), which have been shown to be preferable in some scenarios. We introduce SeqPool, an attention-based method which pools over the output sequence of tokens. Our motivation is that the output sequence contains relevant information across di\u0000erent parts of the input image, therefore preserving this information can improve performance, and at no additional parameters compared to the learnable token. Additionally, this change slightly decreases computation, due one less token being forwarded. This operation consists of mapping the output sequence using the transformation $T : \\mathbb { R } ^ { b \\times n \\times d } \\mapsto \\mathbb { R } ^ { b \\times d }$ . Given: ",
225
+ "page_idx": 6
226
+ },
227
+ {
228
+ "type": "equation",
229
+ "img_path": "images/320c986f295584638d81620a058c52deaf369ee7e6eff631a0f5598a7c596981.jpg",
230
+ "text": "$$\n\\mathbf { x } _ { L } = \\mathbf { f } ( \\mathbf { x } _ { 0 } ) \\in \\mathbb { R } ^ { b \\times n \\times d }\n$$",
231
+ "text_format": "latex",
232
+ "page_idx": 6
233
+ },
234
+ {
235
+ "type": "text",
236
+ "text": "where $\\mathbf { x } _ { L }$ is the output of an $L$ layer transformer encoder $f$ , $b$ is batch size, $n$ is sequence length, and $d$ is the total embedding dimension. $\\mathbf { x } _ { L }$ is fed to a linear layer $\\mathbf { g } ( \\mathbf { x } _ { L } ) \\in \\mathbb { R } ^ { d \\times 1 }$ , and softmax activation is applied to the output: ",
237
+ "page_idx": 6
238
+ },
239
+ {
240
+ "type": "equation",
241
+ "img_path": "images/55ac32a79dd6ffed9845aebc7c98965e569e443e6b4a336760f483dbd7463272.jpg",
242
+ "text": "$$\n\\mathbf { x } _ { L } ^ { \\prime } = \\mathrm { s o f t m a x } \\left( \\mathrm { g } ( \\mathbf { x } _ { L } ) ^ { T } \\right) \\in \\mathbb { R } ^ { b \\times 1 \\times n }\n$$",
243
+ "text_format": "latex",
244
+ "page_idx": 6
245
+ },
246
+ {
247
+ "type": "text",
248
+ "text": "This generates an importance weighting for each input token, which is applied as follows: ",
249
+ "page_idx": 6
250
+ },
251
+ {
252
+ "type": "equation",
253
+ "img_path": "images/0eb0f8f8175c7128dcccb5ccdc6db245e3acb6fc05a576154d1741d73e3e4a96.jpg",
254
+ "text": "$$\n\\mathbf { z } = \\mathbf { x } _ { L } ^ { \\prime } \\mathbf { x } _ { L } = \\operatorname { s o f t m a x } \\left( \\operatorname { g } ( \\mathbf { x } _ { L } ) ^ { T } \\right) \\times \\mathbf { x } _ { L } \\in \\mathbb { R } ^ { b \\times 1 \\times d }\n$$",
255
+ "text_format": "latex",
256
+ "page_idx": 6
257
+ },
258
+ {
259
+ "type": "text",
260
+ "text": "By flattening, the output $z \\in \\mathbb { R } ^ { b \\times d }$ is produced. This output can then be sent through a classifier. SeqPool allows our network to weigh the sequential embeddings of the latent space produced by the transformer encoder and correlate data across the input data. This can be thought of this as attending to the sequential data, where we are assigning importance weights across the sequence of data, only after they have been processed by the encoder. We tested several variations of this pooling method, including learnable and static methods, and found that the learnable pooling performs the best. Static methods, such as global average pooling have already been explored by ViT as well, as pointed out in Related Works. We believe that the learnable weighting is more e\u0000cient because each embedded patch does not contain the same amount of entropy. This allows the model to apply weights to tokens with respect to the relevance of their information. Additionally, sequence pooling allows our model to better utilize information across spatially sparse data. We will further study the e\u0000ects of this pooling in the ablation study. By replacing the conventional class token in ViT-Lite with SeqPool, Compact Vision Transformer is created. We use the same notations for this model: for instance, CVT-7 /4 has 7 transformer encoder layers, and a 4 $\\times 4$ patch size. ",
261
+ "page_idx": 6
262
+ },
263
+ {
264
+ "type": "text",
265
+ "text": "3.4 Convolutional Tokenizer ",
266
+ "text_level": 1,
267
+ "page_idx": 6
268
+ },
269
+ {
270
+ "type": "text",
271
+ "text": "In order to introduce an inductive bias into the model, we replace patch and embedding in ViT-Lite and CVT, with a simple convolutional block. This block follows conventional design, which consists of a single convolution, $R e L U$ activation, and a max pool. Given an image or feature map $\\mathbf { x } \\in \\mathbb { R } ^ { H \\times W \\times C }$ : ",
272
+ "page_idx": 6
273
+ },
274
+ {
275
+ "type": "equation",
276
+ "img_path": "images/b6ece748cf75ca01f9517c0d58bec67c6e0e803f5b1d808e7aa44e3f776904df.jpg",
277
+ "text": "$$\n\\mathbf { x } _ { 0 } = \\mathrm { M a x P o o l } ( \\mathrm { R e L U } ( \\mathrm { C o n v 2 d } ( \\mathbf { x } ) ) )\n$$",
278
+ "text_format": "latex",
279
+ "page_idx": 6
280
+ },
281
+ {
282
+ "type": "text",
283
+ "text": "where the Conv2d operation has $d$ filters, same number as the embedding dimension of the transformer backbone. Additionally, the convolution and max pool operations can be overlapping, which could increase performance by injecting inductive biases. This allows our model to maintain locally spatial information. Additionally, by using this convolutional block, the models enjoy an added flexibility over models like ViT, by no longer being tied to the input resolution strictly divisible by the pre-set patch size. We seek to use convolutions to embed the image into a latent representation, because we believe that it will be more e\u0000cient and produce richer tokens for the transformer. These blocks can be adjusted in terms of downsampling ratio (kernel size, stride and padding), and are repeatable for even further downsampling. Since self-attention has a quadratic time and space complexity with respect to the number of tokens, and number of tokens is equal to the resolution of the input feature map, more downsampling results in fewer tokens which noticeably decreases computation (at the expense of performance). We found that on top of the added performance gains, this choice in tokenization also gives more flexibility toward removing the positional embedding in the model, as it manages to maintain a very good performance. This is further discussed in Appendix. This convolutional tokenizer, along with SeqPool and the transformer encoder create Compact Convolutional Transformers. We use a similar notation for CCT variants, with the exception of also denoting the number of convolutional layers: for instance, CCT-7 /3x2 has 7 transformer encoder layers, and a 2-layer convolutional tokenizer with $\\mathbf { 3 \\times 3 }$ kernel size. ",
284
+ "page_idx": 6
285
+ },
286
+ {
287
+ "type": "text",
288
+ "text": "",
289
+ "page_idx": 7
290
+ },
291
+ {
292
+ "type": "text",
293
+ "text": "4 Experiments ",
294
+ "text_level": 1,
295
+ "page_idx": 7
296
+ },
297
+ {
298
+ "type": "table",
299
+ "img_path": "images/063b105bf3bb73fe821a5f404035ae4ee6f5965741f688e7c1024a6efc42acf7.jpg",
300
+ "table_caption": [
301
+ "Table 1: Top-1 validation accuracy comparisons. $\\star$ variants were trained longer (see Table IV ) "
302
+ ],
303
+ "table_footnote": [],
304
+ "table_body": "<table><tr><td>Model</td><td>C-10</td><td>C-100</td><td>Fashion</td><td>MNIST</td><td># Params</td><td>MACs</td></tr><tr><td colspan=\"7\">Convolutional Networks (Designed for ImageNet)</td></tr><tr><td>ResNet18</td><td>90.27%</td><td>66.46%</td><td>94.78%</td><td>99.80%</td><td>11.18 M</td><td>0.04G</td></tr><tr><td>ResNet34</td><td>90.51%</td><td>66.84%</td><td>94.78%</td><td>99.77%</td><td>21.29 M</td><td>0.08 G</td></tr><tr><td>MobileNetV2/0.5</td><td>84.78%</td><td>56.32%</td><td>93.93%</td><td>99.70%</td><td>0.70M</td><td>&lt;0.01 G</td></tr><tr><td>MobileNetV2/2.0</td><td>91.02%</td><td>67.44%</td><td>95.26%</td><td>99.75%</td><td>8.72 M</td><td>0.02 G</td></tr><tr><td colspan=\"7\">Convolutional Networks (Designed for CIFAR)</td></tr><tr><td>ResNet56He et al. (2016a)</td><td>94.63%</td><td>74.81%</td><td>95.25%</td><td>99.27%</td><td>0.85M</td><td>0.13 G</td></tr><tr><td>ResNet110He et al. (2016a)</td><td>95.08%</td><td>76.63%</td><td>95.32%</td><td>99.28%</td><td>1.73M</td><td>0.26 G</td></tr><tr><td>ResNet1k-v2He et alJ](2016b)</td><td>95.38%</td><td>1</td><td>1</td><td>1</td><td>10.33 M</td><td>1.55 G</td></tr><tr><td>Proxyless-GCai et al.](2018)</td><td>97.92%</td><td>1</td><td>1</td><td>1</td><td>5.7M</td><td>1</td></tr><tr><td colspan=\"7\">Vision Transformers</td></tr><tr><td>ViT-12/16</td><td>83.04%</td><td>57.97%</td><td>93.61%</td><td>99.63%</td><td>85.63M</td><td>0.43G</td></tr><tr><td>ViT-Lite-7/16</td><td>78.45%</td><td>52.87%</td><td>93.24%</td><td>99.68%</td><td>3.89 M</td><td>0.02 G</td></tr><tr><td>ViT-Lite-7/8</td><td>89.10%</td><td>67.27%</td><td>94.49%</td><td>99.69%</td><td>3.74 M</td><td>0.06 G</td></tr><tr><td>ViT-Lite-7/4</td><td>93.57%</td><td>73.94%</td><td>95.16%</td><td>99.77%</td><td>3.72 M</td><td>0.26 G</td></tr><tr><td colspan=\"7\">Compact Vision Transformers</td></tr><tr><td>CVT-7/8</td><td>89.79%</td><td>70.11%</td><td>94.50%</td><td>99.70%</td><td>3.74M</td><td>0.06 G</td></tr><tr><td>CVT-7/4</td><td>94.01%</td><td>76.49%</td><td>95.32%</td><td>99.76%</td><td>3.72 M</td><td>0.25 G</td></tr><tr><td colspan=\"7\">Compact Convolutional Transformers</td></tr><tr><td>CCT-2/3×2</td><td>89.75%</td><td>66.93%</td><td>94.08%</td><td>99.70%</td><td>0.28M</td><td>0.04 G</td></tr><tr><td>CCT-7/3×2</td><td>95.04%</td><td>77.72%</td><td>95.16%</td><td>99.76%</td><td>3.85M</td><td>0.29 G</td></tr><tr><td>CCT-7/3×1</td><td>96.53%</td><td>80.92%</td><td>95.56%</td><td>99.82%</td><td>3.76M</td><td>1.19 G</td></tr><tr><td>CCT-7/3×1*</td><td>98.00%</td><td>82.72%</td><td>1</td><td>1</td><td>3.76M</td><td>1.19 G</td></tr></table>",
305
+ "page_idx": 7
306
+ },
307
+ {
308
+ "type": "text",
309
+ "text": "4.1 Datasets ",
310
+ "text_level": 1,
311
+ "page_idx": 7
312
+ },
313
+ {
314
+ "type": "text",
315
+ "text": "We conducted image classification experiments using our method on the following datasets: CIFAR-10, CIFAR-100 (MIT License) $\\left[ \\mathrm { K r i z h e v s k y ~ e t ~ a l . } \\right] ( \\mathrm { 2 0 0 9 } )$ , MNIST, Fashion-MNIST, Oxford Flowers-102 Nilsback & Zisserman $\\textcircled { 2 0 0 8 } \\textcircled { 1 }$ and ImageNet-1k Deng et al. (2009) The first four datasets not only have a small number of training samples, but they are also small in resolution. Additionally, MNIST and Fashion-MNIST only contain a single channel, greatly reducing the information density. Flowers-102 has a relatively small number of samples, while having relatively higher resolution images and 102 classes. We divided these ",
316
+ "page_idx": 7
317
+ },
318
+ {
319
+ "type": "image",
320
+ "img_path": "images/90ab8b553d3df3c7bb8977efe39a218fa98294c4b5ddd1d2b2aba516fe1c3a0e.jpg",
321
+ "image_caption": [
322
+ "Figure 3: CIFAR-10 accuracy vs model size (sizes $< 1 2 \\mathrm { M }$ ). CCT $\\star$ was trained longer. "
323
+ ],
324
+ "image_footnote": [],
325
+ "page_idx": 8
326
+ },
327
+ {
328
+ "type": "text",
329
+ "text": "Table 2: ImageNet Top-1 validation accuracy comparison (no extra data or pretraining). $\\frac { \\ d n } { \\ d m }$ denotes distillation. ResNet50 (2021) is reported from Wightman et al. (2021) which has the same training recipe as ours datasets into three categories: small-scale small resolution datasets (CIFAR-10/100, MNIST, and FashionMNIST), small-scale larger resolution (Flowers-102), and medium-scale (ImageNet-1k) datasets. We also include a study on NLP classification, presented in the appendix. ",
330
+ "page_idx": 8
331
+ },
332
+ {
333
+ "type": "table",
334
+ "img_path": "images/62e8cf89af7a3fb1b45209807fd3d0b6be063a510f9e83ecc6c06cde6c7d63a2.jpg",
335
+ "table_caption": [],
336
+ "table_footnote": [],
337
+ "table_body": "<table><tr><td>Model</td><td></td><td></td><td>|Top-1|# Params MACs|Training Epochs</td></tr><tr><td>ResNet50</td><td>77.15%</td><td>25.55M 4.15 G</td><td>120</td></tr><tr><td>ResNet50 (2021)79.80%</td><td></td><td>25.55M 4.15 G</td><td>300</td></tr><tr><td>ViT-S</td><td>79.85%</td><td>22.05 M 4.61 G</td><td>300</td></tr><tr><td>CCT-14/7×2</td><td>80.67%</td><td>22.36M 5.53 G</td><td>300</td></tr><tr><td>DeiT-s m</td><td>81.16%</td><td>22.44M 4.63 G</td><td>300</td></tr><tr><td>CCT-14/7×2 m</td><td>81.34%</td><td>22.36M 5.53 G</td><td>300</td></tr></table>",
338
+ "page_idx": 8
339
+ },
340
+ {
341
+ "type": "text",
342
+ "text": "",
343
+ "page_idx": 8
344
+ },
345
+ {
346
+ "type": "text",
347
+ "text": "4.2 Performance Comparison ",
348
+ "text_level": 1,
349
+ "page_idx": 8
350
+ },
351
+ {
352
+ "type": "text",
353
+ "text": "We used the timm package $\\boxed { \\mathrm { W i g h t m a n } } \\textcircled { \\cdot } \\boxed { 2 0 1 9 }$ to train the models except for cited works which are reported directly. For all CNN experiments, we conducted a hyperparameter sweep for every di\u0000erent method and report the best results we were able to achieve. For Transformer-based models, we only tuned learning rate schedules and set augmentations and other hyperparameters to default values from timm. We will release checkpoints corresponding to the reported numbers, and our hyperparameters in the form of YAML files, along with our code. ",
354
+ "page_idx": 8
355
+ },
356
+ {
357
+ "type": "text",
358
+ "text": "Small-scale small resolution training: Unless stated otherwise, all tests were run for 200 epochs (10- epoch warmup) with a batch size of 128 and a learning rate of $4 e \\mathrm { ~ - ~ } 5$ . We follow DeiT Touvron et al. $\\sqsubset$ in adopting the cosine LR scheduler Loshchilov & Hutter (2017), stochastic depth of rate 0.1, label smoothing with a probability of 0.1, and AutoAugment Cubuk et al. (2019) (MIT License), all of which are available in the timm package. In order to demonstrate that vision transformers can be as e\u0000ective as convolutional neural networks, even in settings with small sets of data, we compare our compact transformers to ResNets He et al. (2016a), which are still very useful CNNs for small to medium amounts of data, as well as to MobileNetV2 Sandler et al. $\\textcircled { 2 0 1 8 } )$ , which are very compact and small-sized CNNs. We also compare with results from He et al. (2016b) where He et al. designed very deep (up to 1001 layers) CNNs specifically for CIFAR. The results are presented in Tab. $^ { 1 , }$ all of which are of models trained from scratch. We highlight the top performers. CCT-7/3x2 achieves on par results with the CNN models, while having significantly fewer parameters in some cases. We also compare our method to the original ViT Dosovitskiy et al. (2020) in order to express the e\u0000ectiveness of smaller sized backbones, convolutional layers, as well our pooling technique. As these datasets were not trained from scratch in the original paper, we attempted to train the smallest variant: ViT-B/16 (ViT-12/16). We trained our best performing model, CCT-7/3x1, for longer than the 300 epochs to see how far it can go. Surprisingly, this model can get as high as 98% accuracy on CIFAR-10, and 82.87% accuracy on CIFAR-100 when trained for 5000 epochs, which is still fewer iterations an ImageNet pre-training would have. We present results from training on CIFAR-10/100 for 300, 1500 and 5000 epochs in Tab. $\\mathrm { I V } .$ We observed that sinusoidal positional embedding had a small but noticeable edge over learnable when training longer. This represents the only transformer based model in the top 25 results on PapersWithCode for CIFAR-10 where models have no extra data or pre-training2. In addition to this, it is also one of the smallest models, being 15% the size of ResNet50 while maintaining similar performance. ",
359
+ "page_idx": 8
360
+ },
361
+ {
362
+ "type": "table",
363
+ "img_path": "images/a196b39183198277d69fdcc134407593f7636ce7f9c2765c4f10dbca26db83d5.jpg",
364
+ "table_caption": [
365
+ "Table 3: Flowers-102 Top-1 validation accuracy comparison. CCT outperforms other competitive models, having significantly fewer parameters and GMACs. This demonstrates the compactness on small datasets even with large images "
366
+ ],
367
+ "table_footnote": [],
368
+ "table_body": "<table><tr><td>Model</td><td>|Resolution Pretraining|Top-1</td><td></td><td></td><td>#Params</td><td>MACs</td></tr><tr><td>CCT-14/7×2|</td><td>224</td><td></td><td>97.19%</td><td>22.17 M</td><td>18.63 G</td></tr><tr><td>DeiT-B</td><td>384</td><td>ImageNet-1k| 98.80%</td><td></td><td>86.25M</td><td>55.68 G</td></tr><tr><td>ViT-L/16</td><td>384</td><td>JFT-300M</td><td>99.74%</td><td>304.71M</td><td>191.30 G</td></tr><tr><td>ViT-H/14</td><td>384</td><td>JFT-300M</td><td>99.68%</td><td>661.00M</td><td>504.00 G</td></tr><tr><td>CCT-14/7×2</td><td>384</td><td>ImageNet-1k 99.76%</td><td></td><td>22.17M</td><td>18.63 G</td></tr></table>",
369
+ "page_idx": 9
370
+ },
371
+ {
372
+ "type": "text",
373
+ "text": "",
374
+ "page_idx": 9
375
+ },
376
+ {
377
+ "type": "text",
378
+ "text": "Medium-scale training: ImageNet training results are presented in Tab. $\\bigstar$ and compared to ResNet50 He $\\boxed { \\mathrm { e t ~ a l . } } \\textcircled { 1 2 0 1 6 a }$ , ViT, and DeiT. We report ResNet50 from the original paper He et al. (2016a), as well as from Wightman et al. Wightman et al. (2021) which uses a similar training schedule to ours, and is therefore a fairer comparison. We also report a smaller ViT variant as proposed by Touvron et al. $\\mathtt { \\small { [ T o u v r o n e t a l . ] } ( \\mathbb { Z } 0 2 0 ) }$ . We also report CCT’s performance with knowledge distillation, in order to compare it to DeiT Touvron et al. $\\textcircled { 2 0 2 0 }$ . Similar to DeiT, we trained our CCT-14/7x2 with a convolutional teacher and hard distillation loss. We used a RegNetY-16GF Radosavovic et al. (2020) (84M parameters), the same model DeiT selected as the teacher. It is noticeable that distillation does not have as significant of an e\u0000ect on CCT it does on DeiT. This can be attributed to the already existing inductive biases from the convolutional tokenizer. DeiT authors argued that a convolutional teacher would be able to transfer inductive biases to the student model. ",
379
+ "page_idx": 9
380
+ },
381
+ {
382
+ "type": "text",
383
+ "text": "Small-scale higher-resolution training: We also present our results on Flowers-102, in which we successfully reach reasonable performance without any pre-training, and with the same model size as our ImageNet model. We also claim state of the art with $\\mathbf { 9 9 . 7 6 \\% }$ top-accuracy with ImageNet pretraining, which exceeds even far larger models pre-trained on JFT-300M. In addition to this we note that our model is at least a quarter the size of the next best model and almost $3 0 \\times$ smaller than ViT-H/14. CCT is also $3 - 2 7 \\times$ more computationally e\u0000cient. ",
384
+ "page_idx": 9
385
+ },
386
+ {
387
+ "type": "text",
388
+ "text": "4.3 Ablation Study ",
389
+ "text_level": 1,
390
+ "page_idx": 9
391
+ },
392
+ {
393
+ "type": "text",
394
+ "text": "We present our ablation on model architecture in Tab. 4. We provide a full list of ablated terms showing which factors give the largest boost in performances. “Model” column refers to variant (see Tab. $\\bigstar$ for details), “Conv” specifies the number of convolutional blocks (if an), and “Conv Size” specifies the kernel size. “Aug” denotes the use of AutoAugment Cubuk et al. (2019). “Tuning” specifies a minor change in dropout, attention dropout, and/or stochastic depth (see Tab. 5). The first row in Tab. 4 is essentially ViT. The next three rows are modified variants of ViT, which are not proposed in the original paper. These variants are more compact and use smaller patch sizes. It should be noted that the numbers reported in this table are best out of 4. ",
395
+ "page_idx": 9
396
+ },
397
+ {
398
+ "type": "text",
399
+ "text": "",
400
+ "page_idx": 10
401
+ },
402
+ {
403
+ "type": "table",
404
+ "img_path": "images/5f16b666effaec272672a1388d99f8c9030362afc5af43d625591ea50ea5f10f.jpg",
405
+ "table_caption": [
406
+ "Table 4: CIFAR Top-1 validation accuracy when transforming ViT into CCT step by step "
407
+ ],
408
+ "table_footnote": [],
409
+ "table_body": "<table><tr><td>Model</td><td>CLS</td><td>#Conv</td><td>Conv Size</td><td>Aug</td><td>Tuning</td><td>C-10</td><td>C-100</td><td>#Params</td><td>MACs</td></tr><tr><td>ViT-12/16</td><td>CT</td><td>×</td><td>×</td><td>×</td><td>×</td><td>69.82%</td><td>40.57%</td><td>85.63M</td><td>0.43 G</td></tr><tr><td>ViT-12/16</td><td>CT</td><td>×</td><td>×</td><td>√</td><td>√</td><td>80.72%</td><td>56.73%</td><td>85.63 M</td><td>0.43 G</td></tr><tr><td>CVT-12/16</td><td>SP</td><td>X</td><td>X</td><td>√</td><td>√</td><td>80.84%</td><td>58.05%</td><td>85.63 M</td><td>0.34 G</td></tr><tr><td>ViT-12/8</td><td>CT</td><td>X</td><td>×</td><td></td><td></td><td>90.24%</td><td>69.81%</td><td>85.20 M</td><td>1.45 G</td></tr><tr><td>ViT-12/4</td><td>CT</td><td>×</td><td></td><td></td><td></td><td>94.07%</td><td>76.08%</td><td>85.12 M</td><td>5.61 G</td></tr><tr><td>CCT-12/7×1</td><td>SP</td><td>1</td><td>7×7</td><td></td><td>√</td><td>93.72%</td><td>76.21%</td><td>85.20 M</td><td>5.55G</td></tr><tr><td>CCT-12/3×2</td><td>SP</td><td>2</td><td>3×3</td><td></td><td>√</td><td>94.50%</td><td>77.05%</td><td>85.53 M</td><td>5.63 G</td></tr><tr><td>ViT-Lite-7/16</td><td>CT</td><td>X</td><td>×</td><td>X</td><td>X</td><td>71.78%</td><td>41.59%</td><td>3.89 M</td><td>0.02 G</td></tr><tr><td>ViT-Lite-7/8</td><td>CT</td><td>X</td><td>×</td><td>X</td><td>×</td><td>83.38%</td><td>55.69%</td><td>3.74 M</td><td>0.06G</td></tr><tr><td>ViT-Lite-7/4</td><td>CT</td><td>X</td><td>X</td><td>X</td><td>X</td><td>83.59%</td><td>58.43%</td><td>3.72 M</td><td>0.26 G</td></tr><tr><td>CVT-7/16</td><td>SP</td><td>X</td><td>×</td><td>X</td><td>X</td><td>72.26%</td><td>42.37%</td><td>3.89 M</td><td>0.02 G</td></tr><tr><td>CVT-7/8</td><td>SP</td><td>×</td><td>×</td><td>X</td><td>×</td><td>84.24%</td><td>55.49%</td><td>3.74 M</td><td>0.06 G</td></tr><tr><td>CVT-7/8</td><td>SP</td><td>×</td><td>×</td><td>√</td><td>X</td><td>87.15%</td><td>63.14%</td><td>3.74 M</td><td>0.06 G</td></tr><tr><td>CVT-7/4</td><td>SP</td><td>X</td><td>×</td><td>X</td><td>×</td><td>88.06%</td><td>62.06%</td><td>3.72 M</td><td>0.25 G</td></tr><tr><td>CVT-7/4</td><td>SP</td><td>×</td><td>×</td><td>√</td><td>×</td><td>91.72%</td><td>69.59%</td><td>3.72 M</td><td>0.25 G</td></tr><tr><td>CVT-7/4</td><td>SP</td><td>×</td><td>×</td><td>√</td><td>√</td><td>92.43%</td><td>73.01%</td><td>3.72 M</td><td>0.25 G</td></tr><tr><td>CVT-7/2</td><td>SP</td><td>X</td><td>×</td><td>×</td><td>X</td><td>84.80%</td><td>57.98%</td><td>3.76 M</td><td>1.18 G</td></tr><tr><td>CCT-7/7×1</td><td>SP</td><td>1</td><td>7×7</td><td>X</td><td></td><td>87.81%</td><td>62.83%</td><td>3.74 M</td><td>0.26 G</td></tr><tr><td>CCT-7/7×1</td><td>SP</td><td>1</td><td>7×7</td><td>√</td><td>×</td><td>91.85%</td><td>69.43%</td><td>3.74 M</td><td>0.26 G</td></tr><tr><td>CCT-7/7×1</td><td>CT</td><td>1</td><td>7×7</td><td>√</td><td>√</td><td>91.67%</td><td>72.07%</td><td>3.74 M</td><td>0.26 G</td></tr><tr><td>CCT-7/7×1</td><td>SP</td><td>1</td><td>7×7</td><td>~</td><td>√</td><td>92.29%</td><td>72.46%</td><td>3.74 M</td><td>0.26 G</td></tr><tr><td>CCT-7/3×2</td><td>CT</td><td>2</td><td>3×3</td><td>√</td><td>√</td><td>93.36%</td><td>74.77%</td><td>3.85 M</td><td>0.29 G</td></tr><tr><td>CCT-7/3×2</td><td>SP</td><td>2</td><td>3×3</td><td>√</td><td></td><td>93.65%</td><td>74.77%</td><td>3.85 M</td><td>0.29 G</td></tr><tr><td>CCT-7/3x1</td><td>SP</td><td>1</td><td>3×3</td><td>√</td><td>√</td><td>94.47%</td><td>75.59%</td><td>3.76M</td><td>1.19 G</td></tr></table>",
410
+ "page_idx": 10
411
+ },
412
+ {
413
+ "type": "table",
414
+ "img_path": "images/4aca651aa882353ef8d9587d8f9ea8d83d89ec285e1827683076a09ea830101d.jpg",
415
+ "table_caption": [
416
+ "Table 5: Di\u0000erence between tuned and not tuned runs in Table 4. "
417
+ ],
418
+ "table_footnote": [],
419
+ "table_body": "<table><tr><td>Hyper Param</td><td>|Not Tuned</td><td>Tuned</td></tr><tr><td>MLP Dropout</td><td>0.1</td><td>0</td></tr><tr><td>MSA Dropout</td><td>0</td><td>0.1</td></tr><tr><td>Stochastic Depth</td><td>0</td><td>0.1</td></tr></table>",
420
+ "page_idx": 10
421
+ },
422
+ {
423
+ "type": "text",
424
+ "text": "4.4 Performance vs Dataset Size ",
425
+ "text_level": 1,
426
+ "page_idx": 10
427
+ },
428
+ {
429
+ "type": "text",
430
+ "text": "In this experiment, we evaluated model performance on smaller subsets of CIFAR-10 to determine the relationship between performance and the number of samples within a dataset. Samples were removed uniformly from each class in CIFAR-10. For this experiment, we compared ViT-Lite and CCT. In Fig. 4, we see the comparison of each model’s accuracy vs the number of samples per class. We show how each model performs when given only 500, 1000, 2000, 3000, 4000, or 5000 (original) samples per class, meaning the total training set ranges from one tenth the size to full. It can be observed that CCT is more robust since it is able to obtain higher accuracy with a lower number of samples per class, especially in the low sample regime. ",
431
+ "page_idx": 10
432
+ },
433
+ {
434
+ "type": "text",
435
+ "text": "",
436
+ "page_idx": 11
437
+ },
438
+ {
439
+ "type": "text",
440
+ "text": "4.5 Performance vs Dimensionality ",
441
+ "text_level": 1,
442
+ "page_idx": 11
443
+ },
444
+ {
445
+ "type": "text",
446
+ "text": "In order to determine whether transformers are dependant on high dimensional data, as opposed to the number of samples, we experimented with downsampled and upsampled versions of CIFAR-10. In Fig. 5, we present the image dimensionality vs the performance of CCT vsViT-Lite. Both models were trained with images of sizes ranging from 16 $\\cdot$ 16 to 64 $\\cdot$ 64. It can be observed that CCT performs better on all image sizes, with a widening di\u0000erence as the number of pixels increases. From this, it can be inferred that CCT is able to better utilize the information density of an image, while ViT does not see continued performance increases after the standard 32x32 size. ",
447
+ "page_idx": 11
448
+ },
449
+ {
450
+ "type": "image",
451
+ "img_path": "images/067fc2e53751f1e34cf3ce34b731c3ef28c4566593cb9e97282cdfeac9c5ef1e.jpg",
452
+ "image_caption": [
453
+ "Figure 4: Reduced # samples / class (CIFAR-10) "
454
+ ],
455
+ "image_footnote": [],
456
+ "page_idx": 11
457
+ },
458
+ {
459
+ "type": "image",
460
+ "img_path": "images/c4b22000ca2fabd83dedf1a86ee065a99c8deaeb847b26938915e62073ca2842.jpg",
461
+ "image_caption": [
462
+ "Figure 5: Image Size vs Accuracy (CIFAR-10) "
463
+ ],
464
+ "image_footnote": [],
465
+ "page_idx": 11
466
+ },
467
+ {
468
+ "type": "text",
469
+ "text": "5 Conclusion ",
470
+ "text_level": 1,
471
+ "page_idx": 11
472
+ },
473
+ {
474
+ "type": "text",
475
+ "text": "Transformers have commonly been perceived to be only applicable to larger-scale or medium-scale training. While their scalability is undeniable, we have shown within this paper that with proper configuration, a transformer can be successfully used in small data regimes as well, and outperform convolutional models of equivalent, and even larger, sizes. Our method is simple, flexible in size, and the smallest of our variants can be easily loaded on even a minimal GPU, or even a CPU. While part of research has been focused on large-scale models and datasets, we focus on smaller scales in which there is still much research to be done in data e\u0000ciency. We show that CCT can outperform other transformer based models on small datasets while also having a significant reduction in computational costs and memory constraints. This work demonstrates that transformers do not require vast computational resources and can allow for their applications in even the most modest of settings. This type of research is important to many scientific domains where data is far more limited that the conventional machine learning datasets which are used in general research. Continuing research in this direction will help open research up to more people and domains, extending machine learning research. ",
476
+ "page_idx": 11
477
+ },
478
+ {
479
+ "type": "text",
480
+ "text": "References \nSören Auer, Christian Bizer, Georgi Kobilarov, Jens Lehmann, Richard Cyganiak, and Zachary Ives. Dbpedia: A nucleus for a web of open data. In The semantic web, pp. 722–735. Springer, 2007. \nDzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate, 2016. \nIrwan 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. \nGedas Bertasius, Heng Wang, and Lorenzo Torresani. Is space-time attention all you need for video understanding? arXiv preprint arXiv:2102.05095, 2021. \nHan Cai, Ligeng Zhu, and Song Han. Proxylessnas: Direct neural architecture search on target task and hardware. In International Conference on Learning Representations, 2018. \nNicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision, pp. 213–229. Springer, 2020. \nEkin D Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V Le. Autoaugment: Learning augmentation strategies from data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 113–123, 2019. \nEkin 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. \nSté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. \nJia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. IEEE, 2009. \nJacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. 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. 4171–4186, 2019. \nAlexey 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. \nRohit Girdhar, Joao Carreira, Carl Doersch, and Andrew Zisserman. Video action transformer network. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 244–253, 2019. \nIan Goodfellow, Yoshua Bengio, Aaron Courville, and Yoshua Bengio. Deep learning. MIT press Cambridge, 2016. \nAlex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines, 2014. \nKaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016a. \nKaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European conference on computer vision, pp. 630–645. Springer, 2016b. ",
481
+ "page_idx": 12
482
+ },
483
+ {
484
+ "type": "text",
485
+ "text": "",
486
+ "page_idx": 12
487
+ },
488
+ {
489
+ "type": "text",
490
+ "text": "Byeongho Heo, Sangdoo Yun, Dongyoon Han, Sanghyuk Chun, Junsuk Choe, and Seong Joon Oh. Rethinking spatial dimensions of vision transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, 2021. ",
491
+ "page_idx": 13
492
+ },
493
+ {
494
+ "type": "text",
495
+ "text": "Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7132–7141, 2018. \nXiao Shi Huang, Felipe Perez, Jimmy Ba, and Maksims Volkovs. Improving transformer optimization through better initialization. In International Conference on Machine Learning, pp. 4475–4483. PMLR, 2020. \nAlexander Ke, William Ellsworth, Oishi Banerjee, Andrew Y. Ng, and Pranav Rajpurkar. Chextransfer: performance and parameter e\u0000ciency of imagenet models for chest x-ray interpretation. Proceedings of the Conference on Health, Inference, and Learning, April 2021. doi: 10.1145/3450439.3451867. URL http://dx.doi.org/10.1145/3450439.3451867. \nAlex Krizhevsky, Geo\u0000rey Hinton, et al. Learning multiple layers of features from tiny images, 2009. \nAlex Krizhevsky, Ilya Sutskever, and Geo\u0000rey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25:1097–1105, 2012. \nYann LeCun, Bernhard Boser, John S Denker, Donnie Henderson, Richard E Howard, Wayne Hubbard, and Lawrence D Jackel. Backpropagation applied to handwritten zip code recognition. Neural computation, 1 (4):541–551, 1989. \nXin Li and Dan Roth. Learning question classifiers. In COLING 2002: The 19th International Conference on Computational Linguistics, 2002. URL https://www.aclweb.org/anthology/C02-1150. \nYinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019. \nZe Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF International Conference on Computer Vision, 2021. \nIlya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. ICLR, 2017. \nJiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. arXiv preprint arXiv:1908.02265, 2019. \nMinh-Thang Luong, Hieu Pham, and Christopher D. Manning. E\u0000ective approaches to attention-based neural machine translation, 2015. \nAndrew Maas, Raymond E Daly, Peter T Pham, Dan Huang, Andrew Y Ng, and Christopher Potts. Learning word vectors for sentiment analysis. In Proceedings of the 49th annual meeting of the association for computational linguistics: Human language technologies, pp. 142–150, 2011. \nMaria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In 2008 Sixth Indian Conference on Computer Vision, Graphics & Image Processing, pp. 722–729. IEEE, 2008. \nJe\u0000rey Pennington, Richard Socher, and Christopher D. Manning. Glove: Global vectors for word representation. In Empirical Methods in Natural Language Processing (EMNLP), pp. 1532–1543, 2014. URL http://www.aclweb.org/anthology/D14-1162. \nIlija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, and Piotr Dollár. Designing network design spaces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10428–10436, 2020. ",
496
+ "page_idx": 13
497
+ },
498
+ {
499
+ "type": "text",
500
+ "text": "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. ",
501
+ "page_idx": 14
502
+ },
503
+ {
504
+ "type": "text",
505
+ "text": "Daniel L Ruderman and William Bialek. Statistics of natural images: Scaling in the woods. Physical review letters, 73(6):814, 1994. \nMark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4510–4520, 2018. \nJürgen Schmidhuber. Deep learning in neural networks: An overview. Neural networks, 61:85–117, 2015. \nRichard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Y Ng, and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pp. 1631–1642, 2013. \nWeijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. Vl-bert: Pre-training of generic visual-linguistic representations. arXiv preprint arXiv:1908.08530, 2019. \nChen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable e\u0000ectiveness of data in deep learning era. In Proceedings of the IEEE international conference on computer vision, pp. 843–852, 2017. \nHugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-e\u0000cient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020. \nAshish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, £ukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in Neural Information Processing Systems, 30: 5998–6008, 2017. \nFei Wang, Mengqing Jiang, Chen Qian, Shuo Yang, Cheng Li, Honggang Zhang, Xiaogang Wang, and Xiaoou Tang. Residual attention network for image classification. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3156–3164, 2017. \nWenhai 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. In Proceedings of the IEEE/CVF International Conference on Computer Vision, 2021. \nRoss Wightman. Pytorch image models. https://github.com/rwightman/pytorch-image-models, 2019. \nRoss Wightman, Hugo Touvron, and Hervé Jégou. Resnet strikes back: An improved training procedure in timm. arXiv preprint arXiv:2110.00476, 2021. \nHaiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, and Lei Zhang. Cvt: Introducing convolutions to vision transformers. arXiv preprint arXiv:2103.15808, 2021. \nZhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. arXiv preprint arXiv:1906.08237, 2019. \nKun Yuan, Shaopeng Guo, Ziwei Liu, Aojun Zhou, Fengwei Yu, and Wei Wu. Incorporating convolution designs into visual transformers. arXiv preprint arXiv:2103.11816, 2021a. \nLi Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, 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. \nSangdoo 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. \nHan Zhang, Ian Goodfellow, Dimitris Metaxas, and Augustus Odena. Self-attention generative adversarial networks. In International conference on machine learning, pp. 7354–7363. PMLR, 2019. \nHongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017. \nXiang Zhang, Junbo Zhao, and Yann LeCun. Character-level convolutional networks for text classification. arXiv preprint arXiv:1509.01626, 2015. \nZhun 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. \nFuzhen Zhuang, Zhiyuan Qi, Keyu Duan, Dongbo Xi, Yongchun Zhu, Hengshu Zhu, Hui Xiong, and Qing He. A comprehensive survey on transfer learning. Proceedings of the IEEE, 109(1):43–76, 2020. ",
506
+ "page_idx": 14
507
+ },
508
+ {
509
+ "type": "text",
510
+ "text": "",
511
+ "page_idx": 15
512
+ }
513
+ ]
parse/test/kLZsLlIpDU/kLZsLlIpDU_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/kLZsLlIpDU/kLZsLlIpDU_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/mw1PWNSWZP/mw1PWNSWZP.md ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OCTOPACK: INSTRUCTION TUNING CODE LARGELANGUAGE MODELS
2
+
3
+ Niklas Muennighoff Qian Liu Armel Zebaze Qinkai Zheng Binyuan Hui Terry Yue Zhuo Swayam Singh Xiangru Tang Leandro von Werra Shayne Longpre
4
+
5
+ n.muennighoff@gmail.com
6
+
7
+ # ABSTRACT
8
+
9
+ Finetuning large language models (LLMs) on instructions leads to vast performance improvements on natural language tasks. We apply instruction tuning using code, leveraging the natural structure of Git commits, which pair code changes with human instructions. We compile COMMITPACK: 4 terabytes of Git commits across 350 programming languages. We benchmark COMMITPACK against other natural and synthetic code instructions (xP3x, Self-Instruct, OASST) on the 16B parameter StarCoder model, and achieve state-of-the-art performance among models not trained on OpenAI outputs, on the HumanEval Python benchmark $4 6 . 2 \%$ pass $@ 1$ ). We further introduce HUMANEVALPACK, expanding the HumanEval benchmark to a total of 3 coding tasks (Code Repair, Code Explanation, Code Synthesis) across 6 languages (Python, JavaScript, Java, Go, $\mathrm { C } { + + }$ , Rust). Our models, OCTOCODER and OCTOGEEX, achieve the best performance across HUMANEVALPACK among all permissive models, demonstrating COMMITPACK’s benefits in generalizing to a wider set of languages and natural coding tasks. Code, models and data are freely available at https://github.com/bigcode-project/octopack.
10
+
11
+ # 1) CommitPack
12
+
13
+ ![](images/d6e2f0317fe1f5c5a898b6e2f7ba52759e4e57d2cd393f17abef1d6f00a3dce4.jpg)
14
+ Figure 1: OCTOPACK Overview. 1) Sample from our 4TB dataset, COMMITPACK. 2) Performance of OCTOCODER, OCTOGEEX and other code models including non-permissive ones (WizardCoder, GPT-4) on HUMANEVALPACK spanning 3 coding tasks and 6 programming languages.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Finetuning large language models (LLMs) on a variety of language tasks explained via instructions (instruction tuning) has been shown to improve model usability and general performance (Wei et al., 2022; Sanh et al., 2022; Min et al., 2022; Ouyang et al., 2022). The instruction tuning paradigm has also proven successful for models trained on visual (Liu et al., 2023a; Li et al., 2023a), audio (Zhang et al., 2023b) and multilingual (Muennighoff et al., 2022b; Wang et al., 2022b) data.
19
+
20
+ In this work, we instruction tune LLMs on the coding modality. While Code LLMs can already be indirectly instructed to generate desired code using code comments, this procedure is brittle and does not work when the desired output is natural language, such as explaining code. Explicit instructing tuning of Code LLMs may improve their steerability and enable their application to more tasks. Concurrently to our work, three instruction tuned Code LLMs have been proposed: PanGu-Coder2 (Shen et al., 2023), WizardCoder (Luo et al., 2023) and InstructCodeT $^ { \circ + }$ (Wang et al., 2023c). These models rely on more capable and closed models from the OpenAI $\mathrm { \bf A P I ^ { 1 } }$ to create their instruction training data. This approach is problematic as (1) closed-source APIs keep changing and have unpredictable availability (Pozzobon et al., 2023; Chen et al., 2023a), (2) it relies on the assumption that a more capable model exists (3) it can reinforce model hallucination (Gudibande et al., 2023) and (4), depending on legal interpretation, OpenAI’s terms of use2 forbid such models: “...You may not...use output from the Services to develop models that compete with OpenAI...”. Thus, we consider models trained on OpenAI outputs not usable for commercial purposes in practice and classify them as non-permissive in this work.
21
+
22
+ We focus on more permissively licensed data and avoid using a closed-source model to generate synthetic data. We benchmark four popular sources of code instruction data: (1) xP3x (Muennighoff et al., 2022b), which contains data from common code benchmarks, (2) Self-Instruct (Wang et al., 2023a) data we create using a permissive Code LLM, (3) OASST (Köpf et al., 2023), which contains mostly natural language data and few code examples and (4) COMMITPACK, our new 4TB dataset of Git commits. Instruction tuning’s primary purpose is to expand models’ generalization abilities to a wide variety of tasks and settings. Thus, we extend the code synthesis benchmark, HumanEval (Chen et al., 2021; Zheng et al., 2023), to create HUMANEVALPACK: A code benchmark covering code synthesis, code repair, and code explanation across six programming languages.
23
+
24
+ Instruction tuning StarCoder (Li et al., 2023b) on a filtered variant of COMMITPACK and OASST leads to our best model, OCTOCODER, which surpasses all other openly licensed models (Figure 1), but falls short of the much larger GPT-4 (OpenAI, 2023). GPT-4 is close to maximum performance on the code synthesis variant, notably with a pass $@ 1$ score of $8 6 . 6 \%$ on Python HumanEval. However, it performs significantly worse on the code fixing and explanation variants of HUMANEVALPACK, which we introduce. This suggests that the original HumanEval benchmark may soon cease to be useful due to models reaching close to the maximum performance. Our more challenging evaluation variants provide room for future LLMs to improve on the performance of the current state-of-the-art.
25
+
26
+ In summary, we contribute:
27
+
28
+ • COMMITPACK and COMMITPACKFT: 4TB of permissively licensed code commits across 350 programming languages for pretraining and a filtered 2GB variant containing highquality code instructions used for finetuning
29
+ • HUMANEVALPACK: A benchmark for Code LLM generalization, spanning three scenarios (Code Repair, Code Explanation, Code Synthesis) and 6 programming languages (Python, JavaScript, Java, Go, $\mathrm { C } { + } { + }$ , Rust)
30
+ • OCTOCODER and OCTOGEEX: The best permissive Code LLMs
31
+
32
+ # 2 COMMITPACK: CODE INSTRUCTION DATA
33
+
34
+ Prior work has shown that models can generalize to languages included in pretraining, but absent during instruction tuning (Muennighoff et al., 2022b). However, they also show that including such languages during instruction tuning boosts their performance further. We hypothesize that code data exhibits the same behavior. To improve performance on code-related tasks, we thus construct a code instruction dataset leveraging the natural structure of Git commits.
35
+
36
+ ![](images/f8a8e303f102a5f63ef80413dd5919ebd952287ec3d6ab6d2436276e818cedc6.jpg)
37
+ Figure 2: Overview of COMMITPACK and COMMITPACKFT. Top: Language distribution of the full commit data (COMMITPACK) and the variant filtered for high-quality instructions (COMMITPACKFT). See Appendix C for the full distribution. Bottom: Task distribution of commits on the Python subset of COMMITPACKFT (59K samples) according to GPT-4.
38
+
39
+ Table 1: Statistics of code instruction data we consider. We display the number of programming languages, total samples, and fraction of samples that contain code for permissive instruction datasets. For finetuning on these datasets, we use small subsets with around 5,000 samples each.
40
+
41
+ <table><tr><td></td><td colspan="3">Base dataset</td><td colspan="3">Subset</td></tr><tr><td>Dataset (↓)</td><td>Lang.</td><td>Samples</td><td>Code fraction</td><td>Lang.</td><td>Samples</td><td>Code fraction</td></tr><tr><td>xP3x</td><td>8</td><td>532,107,156</td><td>0.67%</td><td>8</td><td>5,000</td><td>100%</td></tr><tr><td>StarCoder Self-Instruct</td><td>12</td><td>5,003</td><td>100%</td><td>12</td><td>5,003</td><td>100%</td></tr><tr><td>OASST</td><td>49</td><td>161,443</td><td>0.9%</td><td>28</td><td>8,587</td><td>2.5%</td></tr><tr><td>COMMITPACKFT</td><td>277</td><td>742,273</td><td>100%</td><td>6</td><td>5,000</td><td>100%</td></tr></table>
42
+
43
+ COMMITPACK To create the dataset, we use commit metadata from the GitHub action dump on Google BigQuery.3 We apply quality filters, filter for commercially friendly licenses, and discard commits that affect more than a single file to ensure commit messages are very specific and to avoid additional complexity from dealing with multiple files. We use the filtered metadata to scrape the affected code files prior to and after the commit from GitHub. This leads to almost 4 terabytes of data covering 350 programming languages (COMMITPACK). As instruction tuning does not require so much data (Zhou et al., 2023a; Touvron et al., 2023), we apply several strict filters to reduce the dataset to 2 gigabytes and 277 languages (COMMITPACKFT). These include filtering for samples where the commit message has specific words in uppercase imperative form at the start (e.g. "Verify ..."), consists of multiple words, and does not contain external references. All filters are detailed in Appendix D. Figure 2 depicts the distribution of both datasets and the tasks contained in COMMITPACKFT. For instruction tuning our models, we select 5,000 random samples from COMMITPACKFT across the 6 programming languages that we evaluate on. In Appendix G, we also experiment with pretraining on the entirety of COMMITPACK.
44
+
45
+ Alternatives We consider three additional datasets for instruction tuning presented in Table 1. xP3x: xP3x is a large-scale collection of multilingual instruction data with around 532 million samples (Muennighoff et al., 2022b). We focus only on the code subset of xP3x, excluding NeuralCodeSearch (Li et al., 2019) which is not licensed permissively, and select 5,000 samples.
46
+
47
+ Self-Instruct: Using the Self-Instruct method (Wang et al., 2022a) and the StarCoder model (Li et al., 2023b), we create 5,003 synthetic instructions and corresponding answers.
48
+
49
+ OASST: OASST is a diverse dataset of multi-turn chat dialogues (Köpf et al., 2023). Only a few of the dialogues contain code. We reuse a filtered variant from prior work (Dettmers et al., 2023) and additionally filter out moralizing assistant answers (Appendix D) leading to 8,587 samples.
50
+
51
+ # 3 HUMANEVALPACK: EVALUATING INSTRUCTION TUNED CODE MODELS
52
+
53
+ ![](images/6d4237dbeea9dce08c47c00b28420e174e150d6eae786187a47d3411b344f93b.jpg)
54
+ Figure 3: HUMANEVALPACK overview. The first HumanEval problem is depicted across the three scenarios for Python. The bug for HUMANEVALFIX consists of a missing "abs" statement.
55
+
56
+ When instruction tuning LLMs using natural language (NL) data, the input is an NL instruction with optional NL context and the target output is the NL answer to the task (Wei et al., 2022). When instruction tuning with code (C) data, code may either appear only in the input alongside the NL instruction $\mathrm { N L + C \mathrm { \to N L } }$ , e.g. code explanation), only in the output $\mathrm { N L } { } \mathrm { C }$ , e.g. code synthesis), or in both input and output $( { \mathrm { N L } } { + } { \mathrm { C } } { } { \mathrm { C } } ,$ , e.g. code modifications like bug fixing). While prior benchmarks commonly only cover variants of code synthesis, users may want to use models in all three scenarios. Thus, we expand the code synthesis benchmark HumanEval (Chen et al., 2021; Zheng et al., 2023) to cover all three input-output combinations for six languages (Figure 3).
57
+
58
+ HUMANEVALFIX $( \mathbf { N L + C } { \boldsymbol { } } \mathbf { C } )$ Given an incorrect code function with a subtle bug and accompanying unit tests, the model is tasked to fix the function. We manually add a bug to each of the 164 HumanEval solutions across all 6 languages (984 total bugs). For a given sample, the bugs are as similar as possible across the 6 languages enabling meaningful comparison of scores across languages. Bugs are written such that the code still runs but produces an incorrect result leading to at least one unit test failing. Bug statistics and examples are in Appendix L. We also evaluate an easier variant of this task where instead of unit tests, models are provided with the correct function docstring as the source of truth to fix bugs, see Appendix K.
59
+
60
+ HUMANEVALEXPLAIN $( \mathbf { N L + C } { } \mathbf { N L }$ ) Given a correct code function, the model is tasked to generate an explanation of the code. Subsequently, the same model is tasked to regenerate the code given only its own explanation. The second step allows us to score this task via code execution and measure pass $@ k$ (Chen et al., 2021) instead of evaluating the explanation itself using heuristic-based metrics like BLEU (Papineni et al., 2002) or ROUGE (Lin, 2004) which have major limitations (Reiter, 2018; Schluter, 2017; Eghbali & Pradel, 2022; Zhou et al., 2023b). To prevent models from copying the solution into the description, we remove any solution overlap of at least 20 characters from the description. We further enforce a character length limit on the model-generated explanation equivalent to the length of the docstring describing the function. This limit is specified in the prompt for the model. Note that the function docstring itself is never provided to the model for this task.
61
+
62
+ HUMANEVALSYNTHESIZE $( \mathbf { N L } { } \mathbf { C } )$ ) Given a natural language docstring or comment describing the desired code, the model is tasked to synthesize the correct code. This task corresponds to the original HumanEval benchmark (Chen et al., 2021). For instruction tuned models, we add an explicit instruction to the input explaining what the model should do. For models that have only gone through language model pretraining, we follow Chen et al. (2021) and provide the model with the function header and docstring to evaluate its completion of the function.
63
+
64
+ For all tasks we execute the code generations to compute performance using the pass $@ k$ metric (Chen et al., 2021): a problem is considered solved if any of $k$ code generations passes every test case. We focus on the simplest version of pass $@ k$ , which is pass $@ 1$ : the likelihood that the model solves a problem in a single attempt. Like Chen et al. (2021), we use a sampling temperature of 0.2 and $t o p _ { p } = 0 . 9 5$ to estimate pass $@ 1$ . We generate $n = 2 0$ samples, which is enough to get reliable pass $@ 1$ estimates (Li et al., 2023b). For GPT-4, we generate $n = 1$ samples. Using $n = 1$ instead of $n = 2 0$ for GPT-4 only changed scores from $7 5 . 0 \%$ to $7 5 . 2 \%$ pass $@ 1$ on HUMANEVALSYNTHESIZE Python while providing 20x cost savings.
65
+
66
+ Python HumanEval is the most widely used code benchmark and many training datasets have already been decontaminated for it (Kocetkov et al., 2022). By manually extending HumanEval, we ensure existing decontamination remains valid to enable fair evaluation. However, this may not hold for all models (e.g. GPT-4), thus results should be interpreted carefully.
67
+
68
+ # 4 OCTOCODER: BEST COMMERCIALLY LICENSED CODE LLM
69
+
70
+ # 4.1 ABLATING INSTRUCTION DATA CHOICES
71
+
72
+ We instruction tune the pretrained StarCoder model (Li et al., 2023b) on different combinations of our instruction datasets (§2). We evaluate all models on the Python subset of HUMANEVALPACK as depicted in Figure 4. Similar to prior work (Taori et al., 2023), we format all instructions into a consistent schema to distinguish question and answer (see Figure 18).
73
+
74
+ COMMITPACKFT enables CodeLLMs to fix bugs COMMITPACKFT is critical for the performance boost on code repair (HUMANEVALFIX), where instruction tuning on only OASST or other variants results in a significantly lower score. This is likely due to COMMITPACKFT including around $20 \%$ of bug fixes among other code-related tasks (Figure 2).
75
+
76
+ Importance of samples with natural language targets The pretrained StarCoder model, as well as the Self-Instruct variant, perform poorly on code explanation (HUMANEVALEXPLAIN). This is because both models are only conditioned to write code instead of natural language. We find that to perform well at explaining code, it is necessary to include samples with natural language as the target output during instruction tuning. Only relying on data with code as the target, such as the Self-Instruct data, will lead to models always outputting code even if the question requires a natural language output. Thus, we mix all other ablations with OASST, which contains many natural language targets. While the $\bf { \Phi } _ { X } \bf { P } 3 \bf { x }$ subset also contains samples with natural language output, many of its target outputs are short, which leads to models with a bias for short answers. This is impractical for the explanation task leading to the comparatively low score of mixing xP3x with OASST.
77
+
78
+ ![](images/26e4eb35762381651ff22b6fd3132055d1c85e3d9a50f03e670d8a3b73231f0d.jpg)
79
+ Figure 4: Comparing permissively licensed instruction datasets by instruction tuning StarCoder. Models are evaluated on the Python subset of HUMANEVALPACK.
80
+
81
+ COMMITPACKFT $^ +$ OASST yields best performance All instruction datasets provide similar boosts for code synthesis (HUMANEVALSYNTHESIZE), which has been the focus of all prior work on code instruction models (Wang et al., 2023c; Luo et al., 2023; Muennighoff et al., 2022b). We achieve the best average score by instruction tuning on COMMITPACKFT mixed with our filtered OASST data yielding an absolute $23 \%$ improvement over StarCoder. Thus, we select COMMITPACKFT $^ +$ OASST for our final model dubbed OCTOCODER. Using the same data, we also instruction tune the 6 billion parameter CodeGeeX2 (Zheng et al., 2023) to create OCTOGEEX. Training hyperparameters for both models are in Appendix P.
82
+
83
+ # 4.2 COMPARING WITH OTHER MODELS
84
+
85
+ We benchmark OCTOCODER and OCTOGEEX with state-of-the-art Code LLMs on HUMANEVALPACK in Table 2. For all models, we use the prompt put forward by the model creators if applicable or else a simple intuitive prompt, see Appendix Q.
86
+
87
+ OCTOCODER performs best among permissive models OCTOCODER has the highest average score across all three evaluation scenarios among all permissive models. With just 6 billion parameters, OCTOGEEX is the smallest model benchmarked, but still outperforms all prior permissive Code LLMs. GPT-4 (OpenAI, 2023) performs best among all models benchmarked with a significant margin. However, GPT-4 is closed-source and likely much larger than all other models evaluated.
88
+
89
+ Instruction tuning generalizes to unseen programming languages Trained primarily on natural language, not code, BLOOMZ (Muennighoff et al., 2022b) performs worse than other models despite having 176 billion parameters. Go and Rust are not contained in BLOOMZ’s instruction data, yet it performs much better than the random baseline of 0.0 for these two languages across most tasks. This confirms our hypothesis that models are capable of generalizing instructions to programming languages only seen at pretraining, similar to crosslingual generalization for natural languages (Muennighoff et al., 2022b). To improve programming language generalization further, we tune OCTOCODER and OCTOGEEX on many languages from COMMITPACKFT, and this generalization improvement is reflected in the performance on HUMANEVALPACK’s new languages.
90
+
91
+ Pretraining weight correlates with programming language performance after instruction tuning Prior work has shown that the performance on natural languages after instruction tuning is correlated with the weight of these languages during pretraining (Muennighoff et al., 2022b). The more weight during pretraining, the better the performance after instruction tuning. We find the same to be the case for programming languages. Python, Java, and JavaScript collectively make up around $30 \%$ of the pretraining data of StarCoder (Li et al., 2023b). After instruction tuning StarCoder to produce OCTOCODER, we see the best performance among these three languages, especially for HUMANEVALSYNTHESIZE. OCTOCODER performs weakest on Rust, which is the lowest resource language of StarCoder among the languages we benchmark ( $1 . 2 \%$ of pretraining data).
92
+
93
+ <table><tr><td>Model (↓)</td><td>Python</td><td> JavaScript</td><td>Java</td><td>Go</td><td>C++</td><td></td><td>Rust|Avg.</td></tr><tr><td colspan="8">HUMANEVALFIX</td></tr><tr><td colspan="8">Non-permissive models</td></tr><tr><td rowspan="4">InstructCodeT5+t WizardCodert GPT-4</td><td>2.7</td><td></td><td></td><td></td><td></td><td>0.5</td><td>1.8</td></tr><tr><td>31.8</td><td>1.2 29.5</td><td>4.3 30.7</td><td>2.1 30.4</td><td>0.2 18.7</td><td>13.0</td><td>25.7</td></tr><tr><td>47.0</td><td>48.2</td><td>50.0</td><td>50.6</td><td>47.6</td><td>43.3</td><td>47.8</td></tr><tr><td colspan="7">Permissive models</td></tr><tr><td colspan="8"></td></tr><tr><td>BLOOMZ</td><td>16.6</td><td>15.5</td><td>15.2</td><td>16.4</td><td>6.7</td><td>5.7</td><td>12.5</td></tr><tr><td>StarChat-β</td><td>18.1</td><td>18.1</td><td>24.1</td><td>18.1</td><td>8.2</td><td>3.6</td><td>11.2</td></tr><tr><td>CodeGeeX2*</td><td>15.9</td><td>14.7</td><td>18.0</td><td>13.6</td><td>4.3</td><td>6.1</td><td>12.1</td></tr><tr><td>StarCoder</td><td>8.7</td><td>15.7</td><td>13.3</td><td>20.1</td><td>15.6</td><td>6.7</td><td>13.4</td></tr><tr><td>OCTOGEEX*</td><td>28.1</td><td>27.7</td><td>30.4</td><td>27.6</td><td>22.9</td><td>9.6</td><td>24.4</td></tr><tr><td>OCTOCODER</td><td>30.4</td><td>28.4</td><td>30.6</td><td>30.2</td><td>26.1</td><td>16.5</td><td>27.0</td></tr></table>
94
+
95
+ HUMANEVALEXPLAIN
96
+
97
+ <table><tr><td colspan="8">Non-permissive models</td></tr><tr><td rowspan="2">InstructCodeT5+† WizardCodert GPT-4</td><td>20.8</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.1</td><td>0.0</td><td>3.5</td></tr><tr><td>32.5 64.6</td><td>33.0 57.3</td><td>27.4 51.2</td><td>26.7 58.5</td><td>28.2 38.4</td><td>16.9 42.7</td><td>27.5 52.1</td></tr><tr><td colspan="8"></td></tr><tr><td colspan="8">Permissive models</td></tr><tr><td>BLOOMZ</td><td>14.7</td><td>8.8</td><td>12.1</td><td>8.5</td><td>0.6</td><td>0.0</td><td>7.5</td></tr><tr><td>StarChat-β</td><td>25.4</td><td>21.5</td><td>24.5</td><td>18.4</td><td>17.6</td><td>13.2</td><td>20.1</td></tr><tr><td>CodeGeeX2*</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td></tr><tr><td>StarCoder</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td></tr><tr><td>OCTOGEEX*</td><td>30.4</td><td>24.0</td><td>24.7</td><td>21.7</td><td>21.0</td><td>15.9</td><td>22.9</td></tr><tr><td>OCTOCODER</td><td>35.1</td><td>24.5</td><td>27.3</td><td>21.1</td><td>24.1</td><td>14.8</td><td>24.5</td></tr></table>
98
+
99
+ HUMANEVALSYNTHESIZE
100
+ Table 2: Zero-shot pass $@ 1$ $( \% )$ performance across HUMANEVALPACK. InstructCodeT $^ { 5 + }$ , WizardCoder, StarChat- $\boldsymbol { \cdot } \beta$ , StarCoder and OCTOCODER have 16B parameters. CodeGeeX2 and OCTOGEEX have 6B parameters. BLOOMZ has 176B parameters. In this work, we call models "permissive" if weights are freely accessible and usable for commercial purposes. ⇤: Commercial license available after submitting a form. $\dagger$ : Trained on data that may not be used “to develop models that compete with OpenAI” thus we classify them as non-permissive in this work (see $\ S 1$ ).
101
+
102
+ <table><tr><td colspan="8">Non-permissive models</td></tr><tr><td rowspan="2">InstructCodeT5+† WizardCodert GPT-4</td><td>37.0</td><td>18.9</td><td>17.4</td><td>9.5</td><td>19.8</td><td>0.3</td><td>17.1</td></tr><tr><td>57.3 86.6</td><td>49.5 82.9</td><td>36.1 81.7</td><td>36.4 72.6</td><td>40.9 78.7</td><td>20.2 67.1</td><td>40.1 78.3</td></tr><tr><td colspan="8">Permissive models</td></tr><tr><td colspan="8"></td></tr><tr><td>BLOOMZ StarChat-β</td><td>15.6 33.5</td><td>14.8 31.4</td><td>18.4 26.7</td><td>8.4 25.5</td><td>6.5 26.6</td><td>5.5 14.0</td><td>11.5 26.3</td></tr><tr><td>CodeGeeX2*</td><td>35.9</td><td>32.2</td><td>30.8</td><td>22.5</td><td>29.3</td><td>18.1</td><td>28.1</td></tr><tr><td>StarCoder</td><td>33.6</td><td>30.8</td><td>30.2</td><td>17.6</td><td>31.6</td><td>21.8</td><td>27.6</td></tr><tr><td>OCTOGEEX*</td><td>44.7</td><td>33.8</td><td>36.9</td><td>21.9</td><td>32.3</td><td>15.7</td><td>30.9</td></tr><tr><td>OCTOCODER</td><td>46.2</td><td>39.2</td><td>38.2</td><td>30.4</td><td>35.6</td><td>23.4</td><td>35.5</td></tr></table>
103
+
104
+ Models struggle with small targeted changes HUMANEVALFIX is the most challenging task for most models. They commonly regenerate the buggy function without making any change (e.g. WizardCoder in Figure 34) or they introduce new bugs (e.g. GPT-4 in Figure 33). We analyze model performance by bug type in Appendix M and find bugs that require removing excess code are the most challenging. OCTOCODER performs comparatively well across all languages. Instruction tuning on COMMITPACKFT has likely taught OCTOCODER to make small, targeted changes to fix bugs.
105
+
106
+ Models struggle switching between code and text Some models fail at HUMANEVALEXPLAIN, as they do not generate natural language explanations. We manually inspect explanations for the first ten samples of the Python split and disqualify a model if none of them are explanations. This is the case for StarCoder and CodeGeeX2, which generate code instead of natural language explanations. BLOOMZ and InstructCode $^ { \mathrm { 7 5 + } }$ also occasionally generate code. Other models exclusively generate natural language explanations, not containing any code for inspected samples.
107
+
108
+ Models struggle adhering to a specified output length HUMANEVALEXPLAIN instructs models to fit their explanation within a given character limit (§3). Current models appear to have no understanding of how many characters they are generating. They commonly write very short and thus underspecified explanations (e.g. BLOOMZ in Figure 35) or excessively long explanations that end up being cut off (e.g. StarChat- $\beta$ in Figure 38). Future work could investigate how to enable models to be aware of their generated output length to improve HUMANEVALEXPLAIN performance.
109
+
110
+ HumanEval code synthesis is close to saturation Pure code synthesis on HUMANEVALSYNTHESIZE is the easiest task for all models. With a pass rate of $8 6 . 6 \%$ for a single solution, GPT-4 is close to fully saturating the Python subset. GPT-4 was originally found to score $67 \%$ on Python HumanEval (OpenAI, 2023) and $81 \%$ in later work (Bubeck et al., 2023). Our score for GPT-4 is significantly higher, possibly due to improvements made to the API by OpenAI, contamination of HumanEval in GPT-4 training, or slightly different prompting and evaluation. An example of our prompt is depicted in Figure 3 (right). We perform very careful evaluation to ensure every generation is correctly processed. We reproduce the HumanEval score of WizardCoder (Luo et al., 2023; $\mathrm { X u }$ et al., 2023a) and find it to also perform well across other languages. For BLOOMZ and InstructCodeT $^ { 5 + }$ our evaluation leads to a higher Python score than they reported, likely because of our more careful processing of generations. OCTOCODER has the highest performance for every language among permissively licensed models. With a pass $@ 1$ of $4 6 . 2 \%$ on the original Python split, OCTOCODER improves by a relative $38 \%$ over its base model, StarCoder.
111
+
112
+ # 5 RELATED WORK
113
+
114
+ # 5.1 CODE MODELS
115
+
116
+ There has been extensive work on code models tailored to a specific coding task, such as code summarization (Iyer et al., 2016; Ahmad et al., 2020; Zhang et al., 2022a; Shi et al., 2022) or code editing (Drain et al., 2021; Zhang et al., 2022c; He et al., 2022; Zhang et al., 2022b; Wei et al., 2023; Prenner & Robbes, 2023; Fakhoury et al., 2023; Skreta et al., 2023) (also see work on edit models more generally (Reid & Neubig, 2022; Schick et al., 2022; Dwivedi-Yu et al., 2022; Raheja et al., 2023)). These works use task-specific heuristics that limit the applicability of their methods to other tasks. In contrast, we aim to build models applicable to all kinds of tasks related to code and beyond.
117
+
118
+ Through large-scale pretraining more generally applicable code models have been developed (Nijkamp et al., 2022; 2023; Xu et al., 2022a; Christopoulou et al., 2022; Gunasekar et al., 2023; Li et al., 2023b; Bui et al., 2023; Scao et al., 2022a;b). However, these models only continue code making them hard to use for tasks such as explaining code with natural language (HUMANEVALEXPLAIN). Teaching them to follow human instructions is critical to make them applicable to diverse tasks.
119
+
120
+ # 5.2 INSTRUCTION MODELS
121
+
122
+ Training models to follow instructions has led to new capabilities in text (Ouyang et al., 2022; Wang et al., 2022b; Chung et al., 2022) and visual modalities (Xu et al., 2023b; OpenAI, 2023). Prior work has shown its benefits for traditional language tasks (Wei et al., 2022; Longpre et al., 2023a; Iyer et al., 2022), multilingual tasks (Muennighoff et al., 2022b; 2024; Yong et al., 2022; Üstün et al., 2024), and dialog (Köpf et al., 2023; Bai et al., 2022; Ganguli et al., 2022). For coding applications, PanGu-Coder2 (Shen et al., 2023), WizardCoder (Luo et al., 2023) and InstructCode $\mathrm { T } 5 +$ (Wang et al., 2023c) are recent models trained with coding instructions. However, they all use the CodeAlpaca dataset (Chaudhary, 2023), which is synthetically generated from OpenAI models. Using data from powerful closed-source models provides a strong advantage, but limits the model use and has other limitations highlighted in $\ S 1$ . CoEditor (Wei et al., 2023) proposes an “auto-editing” task, trained on 1650 python commit history repositories. Our work expands this to more general coding tasks via instructions, more languages, and orders of magnitude more commit data.
123
+
124
+ # 5.3 CODE BENCHMARKS
125
+
126
+ Many code synthesis benchmarks have been proposed (Wang et al., 2022d;c; Yu et al., 2023; Lai et al., 2023; Du et al., 2023). HumanEval (Chen et al., 2021; Liu et al., 2023b) has emerged as the standard for this task. Prior work has extended HumanEval to new programming languages via automatic translation mechanisms (Athiwaratkun et al., 2022; Cassano et al., 2023; Orlanski et al., 2023). These approaches are error-prone and only translate tests, not the actual solutions, which are needed for tasks like code explanation. Thus, we rely only on humans to create all parts of HUMANEVALPACK including test cases, correct solutions, buggy solutions, and other metadata across 6 languages.
127
+
128
+ Code repair is commonly evaluated on Quixbugs (Lin et al., 2017; Prenner & Robbes, 2021; Ye et al., 2021; Xia & Zhang, 2023; Jiang et al., 2023; Sobania et al., 2023) or Python bugs (He et al., 2022; Bradley et al., 2023). The latter does not support code execution, which limits its utility. While Quixbugs supports execution with unit tests, it only contains 40 samples in Python and Java. Further, the problems in Quixbugs are generic functions, such as bucket sort. This makes them easy to solve and hard to decontaminate training data for. Our benchmark, HUMANEVALFIX, contains 164 buggy functions for six languages with solutions and unit tests. Further, our coding problems, derived from HumanEval, are very specific, such as keeping track of a bank account balance (see Figure 14).
129
+
130
+ Prior work on evaluating code explanations (Lu et al., 2021; Cui et al., 2022) has relied on metrics such as METEOR (Banerjee & Lavie, 2005) or BLEU (Papineni et al., 2002). By chaining code explanation with code synthesis, we can evaluate this task using the execution-based pass $@ k$ metric overcoming the major limitations of BLEU and other heuristics-based metrics (Reiter, 2018).
131
+
132
+ Large-scale benchmarking has proven useful in many areas of natural language processing (Wang et al., 2019; Kiela et al., 2021; Srivastava et al., 2022; Muennighoff et al., 2022a). By producing 18 scores (6 languages across 3 tasks) for 9 models, we take a step towards large-scale benchmarking of code models. However, we lack many models capable of generating code (Black et al., 2021; Fried et al., 2022; Black et al., 2022; Wang & Komatsuzaki, 2021; Biderman et al., 2023b). Future work may consider more models or extending HUMANEVALPACK to new languages or tasks, such as code efficiency (Madaan et al., 2023a; Yetistiren et al., 2022) or code classification (Khan et al., 2023).
133
+
134
+ # 6 CONCLUSION
135
+
136
+ This work studies training and evaluation of Code LLMs that follow instructions. We introduce COMMITPACK, a 4TB dataset of Git commits covering 350 programming languages. We filter this large-scale dataset to create COMMITPACKFT, 2GB of high-quality code with commit messages that assimilate instructions. To enable a comprehensive evaluation of instruction code models, we construct HUMANEVALPACK, a human-written benchmark covering 3 different tasks for 6 programming languages. We ablate several instruction datasets and find that COMMITPACKFT combined with natural language data leads to the best performance. While our models, OCTOCODER and OCTOGEEX, are the best permissively licensed Code LLMs available, they are outperformed by closed-source models such as GPT-4. In addition to improving the instruction tuning paradigm, future work should consider training more capable base models.
137
+
138
+ # ACKNOWLEDGEMENTS
139
+
140
+ We thank Hugging Face for providing compute instances. We are extremely grateful to Rodrigo Garcia for the Rust translations, Dimitry Ageev and Calum Bird for help with GPT-4 evaluation, Loubna Ben Allal for help on evaluation, Arjun Guha for insightful discussions on chaining evaluation tasks to avoid evaluating with BLEU, Lewis Tunstall for help on the OASST data, Victor Sanh and Nadav Timor for discussions, Jiaxi Yang for logo editing and domain classification prompting design, Ghosal et al. (2023); Zeng et al. (2023) for design inspiration, Harm de Vries for feedback and all members of BigCode for general support. Finally, we thank every programmer who takes the time to write informative commit messages.
141
+
142
+ # REFERENCES
143
+
144
+ Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, and Kai-Wei Chang. A transformer-based approach for source code summarization. arXiv preprint arXiv:2005.00653, 2020.
145
+ Loubna Ben Allal, Raymond Li, Denis Kocetkov, Chenghao Mou, Christopher Akiki, Carlos Munoz Ferrandis, Niklas Muennighoff, Mayank Mishra, Alex Gu, Manan Dey, et al. Santacoder: don’t reach for the stars! arXiv preprint arXiv:2301.03988, 2023.
146
+ Ben Athiwaratkun, Sanjay Krishna Gouda, Zijian Wang, Xiaopeng Li, Yuchen Tian, Ming Tan, Wasi Uddin Ahmad, Shiqi Wang, Qing Sun, Mingyue Shang, et al. Multi-lingual evaluation of code generation models. arXiv preprint arXiv:2210.14868, 2022.
147
+ Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, et al. Program synthesis with large language models. arXiv preprint arXiv:2108.07732, 2021.
148
+ Hannah McLean Babe, Sydney Nguyen, Yangtian Zi, Arjun Guha, Molly Q Feldman, and Carolyn Jane Anderson. Studenteval: A benchmark of student-written prompts for large language models of code. arXiv preprint arXiv:2306.04556, 2023.
149
+ Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, et al. Training a helpful and harmless assistant with reinforcement learning from human feedback. arXiv preprint arXiv:2204.05862, 2022. URL https://arxiv.org/abs/2204.05862.
150
+ 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.
151
+ Antonio Valerio Miceli Barone and Rico Sennrich. A parallel corpus of python functions and documentation strings for automated code documentation and code generation. arXiv preprint arXiv:1707.02275, 2017.
152
+ Mohammad Bavarian, Heewoo Jun, Nikolas A. Tezak, John Schulman, Christine McLeavey, Jerry Tworek, and Mark Chen. Efficient training of language models to fill in the middle. arXiv preprint arXiv:2207.14255, 2022.
153
+ Loubna Ben Allal, Niklas Muennighoff, Logesh Kumar Umapathi, Ben Lipkin, and Leandro von Werra. A framework for the evaluation of code generation models. https://github.com/b igcode-project/bigcode-evaluation-harness, 2022.
154
+ Stella Biderman, USVSN Sai Prashanth, Lintang Sutawika, Hailey Schoelkopf, Quentin Anthony, Shivanshu Purohit, and Edward Raf. Emergent and predictable memorization in large language models. arXiv preprint arXiv:2304.11158, 2023a.
155
+ Stella Biderman, Hailey Schoelkopf, Quentin Gregory Anthony, Herbie Bradley, Kyle O’Brien, Eric Hallahan, Mohammad Aflah Khan, Shivanshu Purohit, USVSN Sai Prashanth, Edward Raff, et al. Pythia: A suite for analyzing large language models across training and scaling. In International Conference on Machine Learning, pp. 2397–2430. PMLR, 2023b.
156
+
157
+ Sid Black, Leo Gao, Phil Wang, Connor Leahy, and Stella Biderman. Gpt-neo: Large scale autoregressive language modeling with mesh-tensorflow. If you use this software, please cite it using these metadata, 58, 2021.
158
+
159
+ Sid Black, Stella Biderman, Eric Hallahan, Quentin Anthony, Leo Gao, Laurence Golding, Horace He, Connor Leahy, Kyle McDonell, Jason Phang, et al. Gpt-neox-20b: An open-source autoregressive language model. arXiv preprint arXiv:2204.06745, 2022.
160
+ Herbie Bradley, Honglu Fan, Harry Saini, Reshinth Adithyan, Shivanshu Purohit, and Joel Lehman. Diff models - a new way to edit code. CarperAI Blog, Jan 2023. URL https://carper.ai/ diff-model/.
161
+ 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. Conference on Neural Information Processing Systems (NeurIPS), 2020. URL https://papers.nips.cc/paper/2020/hash/1457c0d6bfcb4967418bfb8ac 142f64a-Abstract.html.
162
+ Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023.
163
+ Nghi DQ Bui, Hung Le, Yue Wang, Junnan Li, Akhilesh Deepak Gotmare, and Steven CH Hoi. Codetf: One-stop transformer library for state-of-the-art code llm. arXiv preprint arXiv:2306.00029, 2023.
164
+ Federico Cassano, John Gouwar, Daniel Nguyen, Sydney Nguyen, Luna Phipps-Costin, Donald Pinckney, Ming-Ho Yee, Yangtian Zi, Carolyn Jane Anderson, Molly Q Feldman, et al. Multipl-e: a scalable and polyglot approach to benchmarking neural code generation. IEEE Transactions on Software Engineering, 2023.
165
+ Sahil Chaudhary. Code alpaca: An instruction-following llama model for code generation. https: //github.com/sahil280114/codealpaca, 2023.
166
+ Bei Chen, Fengji Zhang, Anh Nguyen, Daoguang Zan, Zeqi Lin, Jian-Guang Lou, and Weizhu Chen. Codet: Code generation with generated tests. arXiv preprint arXiv:2207.10397, 2022.
167
+ Lingjiao Chen, Matei Zaharia, and James Zou. How is chatgpt’s behavior changing over time?, 2023a.
168
+ Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.
169
+ Shouyuan Chen, Sherman Wong, Liangjian Chen, and Yuandong Tian. Extending context window of large language models via positional interpolation. arXiv preprint arXiv:2306.15595, 2023b.
170
+ Xinyun Chen, Maxwell Lin, Nathanael Schärli, and Denny Zhou. Teaching large language models to self-debug. arXiv preprint arXiv:2304.05128, 2023c.
171
+ 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.
172
+ Fenia Christopoulou, Gerasimos Lampouras, Milan Gritta, Guchun Zhang, Yinpeng Guo, Zhongqi Li, Qi Zhang, Meng Xiao, Bo Shen, Lin Li, et al. Pangu-coder: Program synthesis with function-level language modeling. arXiv preprint arXiv:2207.11280, 2022.
173
+ 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. URL https://arxiv.org/abs/2210.11416.
174
+ Haotian Cui, Chenglong Wang, Junjie Huang, Jeevana Priya Inala, Todd Mytkowicz, Bo Wang, Jianfeng Gao, and Nan Duan. Codeexp: Explanatory code document generation. arXiv preprint arXiv:2211.15395, 2022.
175
+
176
+ Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. arXiv preprint arXiv:1901.02860, 2019.
177
+
178
+ Tri Dao, Dan Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. Flashattention: Fast and memoryefficient exact attention with io-awareness. Advances in Neural Information Processing Systems, 35:16344–16359, 2022.
179
+ Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. Qlora: Efficient finetuning of quantized llms. arXiv preprint arXiv:2305.14314, 2023.
180
+ Kaustubh D Dhole, Varun Gangal, Sebastian Gehrmann, Aadesh Gupta, Zhenhao Li, Saad Mahamood, Abinaya Mahendiran, Simon Mille, Ashish Srivastava, Samson Tan, et al. Nl-augmenter: A framework for task-sensitive natural language augmentation. arXiv preprint arXiv:2112.02721, 2021.
181
+ Yangruibo Ding, Zijian Wang, Wasi Uddin Ahmad, Murali Krishna Ramanathan, Ramesh Nallapati, Parminder Bhatia, Dan Roth, and Bing Xiang. Cocomic: Code completion by jointly modeling in-file and cross-file context. arXiv preprint arXiv:2212.10007, 2022.
182
+ Yihong Dong, Xue Jiang, Zhi Jin, and Ge Li. Self-collaboration code generation via chatgpt. arXiv preprint arXiv:2304.07590, 2023.
183
+ Dawn Drain, Colin B Clement, Guillermo Serrato, and Neel Sundaresan. Deepdebug: Fixing python bugs using stack traces, backtranslation, and code skeletons. arXiv preprint arXiv:2105.09352, 2021.
184
+ Xueying Du, Mingwei Liu, Kaixin Wang, Hanlin Wang, Junwei Liu, Yixuan Chen, Jiayi Feng, Chaofeng Sha, Xin Peng, and Yiling Lou. Classeval: A manually-crafted benchmark for evaluating llms on class-level code generation. arXiv preprint arXiv:2308.01861, 2023.
185
+ Jane Dwivedi-Yu, Timo Schick, Zhengbao Jiang, Maria Lomeli, Patrick Lewis, Gautier Izacard, Edouard Grave, Sebastian Riedel, and Fabio Petroni. Editeval: An instruction-based benchmark for text improvements. arXiv preprint arXiv:2209.13331, 2022.
186
+ Aryaz Eghbali and Michael Pradel. Crystalbleu: precisely and efficiently measuring the similarity of code. In Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering, pp. 1–12, 2022.
187
+ Kawin Ethayarajh, Winnie Xu, Niklas Muennighoff, Dan Jurafsky, and Douwe Kiela. Kto: Model alignment as prospect theoretic optimization, 2024.
188
+ Sarah Fakhoury, Saikat Chakraborty, Madan Musuvathi, and Shuvendu K Lahiri. Towards generating functionally correct code edits from natural language issue descriptions. arXiv preprint arXiv:2304.03816, 2023.
189
+ Daniel Fried, Armen Aghajanyan, Jessy Lin, Sida Wang, Eric Wallace, Freda Shi, Ruiqi Zhong, Wen-tau Yih, Luke Zettlemoyer, and Mike Lewis. Incoder: A generative model for code infilling and synthesis. arXiv preprint arXiv:2204.05999, 2022.
190
+ Jinlan Fu, See-Kiong Ng, Zhengbao Jiang, and Pengfei Liu. Gptscore: Evaluate as you desire. arXiv preprint arXiv:2302.04166, 2023.
191
+ Deep Ganguli, Liane Lovitt, Jackson Kernion, Amanda Askell, Yuntao Bai, Saurav Kadavath, Ben Mann, Ethan Perez, Nicholas Schiefer, Kamal Ndousse, et al. Red teaming language models to reduce harms: Methods, scaling behaviors, and lessons learned. arXiv preprint arXiv:2209.07858, 2022.
192
+ Leo Gao, Jonathan Tow, Stella Biderman, Sid Black, Anthony DiPofi, Charles Foster, Laurence Golding, Jeffrey Hsu, Kyle McDonell, Niklas Muennighoff, Jason Phang, Laria Reynolds, Eric Tang, Anish Thite, Ben Wang, Kevin Wang, and Andy Zou. A framework for few-shot language model evaluation, 2021. URL https://doi.org/10.5281/zenodo.5371628.
193
+
194
+ Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models. In International Conference on Machine Learning, pp. 10764–10799. PMLR, 2023.
195
+
196
+ Deepanway Ghosal, Yew Ken Chia, Navonil Majumder, and Soujanya Poria. Flacuna: Unleashing the problem solving power of vicuna using flan fine-tuning. arXiv preprint arXiv:2307.02053, 2023.
197
+ 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.
198
+ Dirk Groeneveld, Iz Beltagy, Pete Walsh, Akshita Bhagia, Rodney Kinney, Oyvind Tafjord, A. Jha, Hamish Ivison, Ian Magnusson, Yizhong Wang, Shane Arora, David Atkinson, Russell Authur, Khyathi Raghavi Chandu, Arman Cohan, Jennifer Dumas, Yanai Elazar, Yuling Gu, Jack Hessel, Tushar Khot, William Merrill, Jacob Daniel Morrison, Niklas Muennighoff, Aakanksha Naik, Crystal Nam, Matthew E. Peters, Valentina Pyatkin, Abhilasha Ravichander, Dustin Schwenk, Saurabh Shah, Will Smith, Emma Strubell, Nishant Subramani, Mitchell Wortsman, Pradeep Dasigi, Nathan Lambert, Kyle Richardson, Luke Zettlemoyer, Jesse Dodge, Kyle Lo, Luca Soldaini, Noah A. Smith, and Hanna Hajishirzi. Olmo: Accelerating the science of language models. 2024. URL https://api.semanticscholar.org/CorpusID:267365485.
199
+ Arnav Gudibande, Eric Wallace, Charlie Snell, Xinyang Geng, Hao Liu, Pieter Abbeel, Sergey Levine, and Dawn Song. The false promise of imitating proprietary llms. arXiv preprint arXiv:2305.15717, 2023.
200
+ Suriya Gunasekar, Yi Zhang, Jyoti Aneja, Caio César Teodoro Mendes, Allie Del Giorno, Sivakanth Gopi, Mojan Javaheripi, Piero Kauffmann, Gustavo de Rosa, Olli Saarikivi, et al. Textbooks are all you need. arXiv preprint arXiv:2306.11644, 2023.
201
+ Jingxuan He, Luca Beurer-Kellner, and Martin Vechev. On distribution shift in learning-based bug detectors. In International Conference on Machine Learning, pp. 8559–8580. PMLR, 2022.
202
+ Vincent J Hellendoorn, Charles Sutton, Rishabh Singh, Petros Maniatis, and David Bieber. Global relational models of source code. In International conference on learning representations, 2019.
203
+ Dan Hendrycks, Steven Basart, Saurav Kadavath, Mantas Mazeika, Akul Arora, Ethan Guo, Collin Burns, Samir Puranik, Horace He, Dawn Song, et al. Measuring coding challenge competence with apps. arXiv preprint arXiv:2105.09938, 2021.
204
+ 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.
205
+ Yi Hu, Haotong Yang, Zhouchen Lin, and Muhan Zhang. Code prompting: a neural symbolic method for complex reasoning in large language models. arXiv preprint arXiv:2305.18507, 2023.
206
+ Srinivasan Iyer, Ioannis Konstas, Alvin Cheung, and Luke Zettlemoyer. Summarizing source code using a neural attention model. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2073–2083, 2016.
207
+ Srinivasan Iyer, Xi Victoria Lin, Ramakanth Pasunuru, Todor Mihaylov, Daniel Simig, Ping Yu, Kurt Shuster, Tianlu Wang, Qing Liu, Punit Singh Koura, Xian Li, Brian O’Horo, Gabriel Pereyra, Jeff Wang, Christopher Dewan, Asli Celikyilmaz, Luke Zettlemoyer, and Ves Stoyanov. Opt-iml: Scaling language model instruction meta learning through the lens of generalization. arXiv preprint arXiv:2212.12017, 2022. URL https://arxiv.org/abs/2212.12017.
208
+ Mingi Jeon, Seung-Yeop Baik, Joonghyuk Hahn, Yo-Sub Han, and Sang-Ki Ko. Deep Learning-based Code Complexity Prediction. openreview, 2022.
209
+
210
+ Nan Jiang, Kevin Liu, Thibaud Lutellier, and Lin Tan. Impact of code language models on automated program repair. arXiv preprint arXiv:2302.05020, 2023.
211
+
212
+ Tae-Hwan Jung. Commitbert: Commit message generation using pre-trained programming language model. arXiv preprint arXiv:2105.14242, 2021.
213
+
214
+ Mohammad Abdullah Matin Khan, M Saiful Bari, Xuan Long Do, Weishi Wang, Md Rizwan Parvez, and Shafiq Joty. xcodeeval: A large scale multilingual multitask benchmark for code understanding, generation, translation and retrieval. arXiv preprint arXiv:2303.03004, 2023.
215
+ Douwe Kiela, Hamed Firooz, Aravind Mohan, Vedanuj Goswami, Amanpreet Singh, Casey A Fitzpatrick, Peter Bull, Greg Lipstein, Tony Nelli, Ron Zhu, et al. The hateful memes challenge: Competition report. In NeurIPS 2020 Competition and Demonstration Track, pp. 344–360. PMLR, 2021.
216
+ Denis Kocetkov, Raymond Li, Loubna Ben Allal, Jia Li, Chenghao Mou, Carlos Muñoz Ferrandis, Yacine Jernite, Margaret Mitchell, Sean Hughes, Thomas Wolf, et al. The stack: 3 tb of permissively licensed source code. arXiv preprint arXiv:2211.15533, 2022.
217
+ Andreas Köpf, Yannic Kilcher, Dimitri von Rütte, Sotiris Anagnostidis, Zhi-Rui Tam, Keith Stevens, Abdullah Barhoum, Nguyen Minh Duc, Oliver Stanley, Richárd Nagyfi, et al. Openassistant conversations–democratizing large language model alignment. arXiv preprint arXiv:2304.07327, 2023.
218
+ Yuhang Lai, Chengxi Li, Yiming Wang, Tianyi Zhang, Ruiqi Zhong, Luke Zettlemoyer, Wen-tau Yih, Daniel Fried, Sida Wang, and Tao Yu. Ds-1000: A natural and reliable benchmark for data science code generation. In International Conference on Machine Learning, pp. 18319–18345. PMLR, 2023.
219
+ Hugo Laurençon, Lucile Saulnier, Thomas Wang, Christopher Akiki, Albert Villanova del Moral, Teven Le Scao, Leandro Von Werra, Chenghao Mou, Eduardo González Ponferrada, Huu Nguyen, et al. The bigscience roots corpus: A 1.6 tb composite multilingual dataset. Advances in Neural Information Processing Systems, 35:31809–31826, 2022.
220
+ Joel Lehman, Jonathan Gordon, Shawn Jain, Kamal Ndousse, Cathy Yeh, and Kenneth O Stanley. Evolution through large models. arXiv preprint arXiv:2206.08896, 2022.
221
+ Bo Li, Yuanhan Zhang, Liangyu Chen, Jinghao Wang, Jingkang Yang, and Ziwei Liu. Otter: A multi-modal model with in-context instruction tuning. arXiv preprint arXiv:2305.03726, 2023a.
222
+ Hongyu Li, Seohyun Kim, and Satish Chandra. Neural code search evaluation dataset. arXiv preprint arXiv:1908.09804, 2019.
223
+ Raymond Li, Loubna Ben Allal, Yangtian Zi, Niklas Muennighoff, Denis Kocetkov, Chenghao Mou, Marc Marone, Christopher Akiki, Jia Li, Jenny Chim, et al. Starcoder: may the source be with you! arXiv preprint arXiv:2305.06161, 2023b.
224
+ Xueyang Li, Shangqing Liu, Ruitao Feng, Guozhu Meng, Xiaofei Xie, Kai Chen, and Yang Liu. Transrepair: Context-aware program repair for compilation errors. In Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering, pp. 1–13, 2022a.
225
+ Yujia Li, David Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, Rémi Leblond, Tom Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, et al. Competition-level code generation with alphacode. Science, 378(6624):1092–1097, 2022b.
226
+ Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. In Text summarization branches out, pp. 74–81, 2004.
227
+ Derrick Lin, James Koppel, Angela Chen, and Armando Solar-Lezama. Quixbugs: A multi-lingual program repair benchmark set based on the quixey challenge. In Proceedings Companion of the 2017 ACM SIGPLAN international conference on systems, programming, languages, and applications: software for humanity, pp. 55–56, 2017.
228
+ Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. arXiv preprint arXiv:2304.08485, 2023a.
229
+ Jiawei Liu, Chunqiu Steven Xia, Yuyao Wang, and Lingming Zhang. Is your code generated by chatgpt really correct? rigorous evaluation of large language models for code generation. arXiv preprint arXiv:2305.01210, 2023b.
230
+ 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, 2023c.
231
+ Tianyang Liu, Canwen Xu, and Julian McAuley. Repobench: Benchmarking repository-level code auto-completion systems. arXiv preprint arXiv:2306.03091, 2023d.
232
+ 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, 2023e.
233
+ Shayne Longpre, Le Hou, Tu Vu, Albert Webson, Hyung Won Chung, Yi Tay, Denny Zhou, Quoc V Le, Barret Zoph, Jason Wei, et al. The flan collection: Designing data and methods for effective instruction tuning. arXiv preprint arXiv:2301.13688, 2023a.
234
+ Shayne Longpre, Gregory Yauney, Emily Reif, Katherine Lee, Adam Roberts, Barret Zoph, Denny Zhou, Jason Wei, Kevin Robinson, David Mimno, et al. A pretrainer’s guide to training data: Measuring the effects of data age, domain coverage, quality, & toxicity. arXiv preprint arXiv:2305.13169, 2023b.
235
+ Shuai Lu, Daya Guo, Shuo Ren, Junjie Huang, Alexey Svyatkovskiy, Ambrosio Blanco, Colin Clement, Dawn Drain, Daxin Jiang, Duyu Tang, et al. Codexglue: A machine learning benchmark dataset for code understanding and generation. arXiv preprint arXiv:2102.04664, 2021.
236
+ Ziyang Luo, Can Xu, Pu Zhao, Qingfeng Sun, Xiubo Geng, Wenxiang Hu, Chongyang Tao, Jing Ma, Qingwei Lin, and Daxin Jiang. Wizardcoder: Empowering code large language models with evol-instruct. arXiv preprint arXiv:2306.08568, 2023.
237
+ Aman Madaan, Alexander Shypula, Uri Alon, Milad Hashemi, Parthasarathy Ranganathan, Yiming Yang, Graham Neubig, and Amir Yazdanbakhsh. Learning performance-improving code edits. arXiv preprint arXiv:2302.07867, 2023a.
238
+ Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, et al. Self-refine: Iterative refinement with self-feedback. arXiv preprint arXiv:2303.17651, 2023b.
239
+ Sewon Min, Mike Lewis, Luke Zettlemoyer, and Hannaneh Hajishirzi. MetaICL: Learning to learn in context. Annual Conference of the North American Chapter of the Association for Computational Linguistics (NAACL), 2022. URL https://arxiv.org/abs/2110.15943.
240
+ Martin Monperrus, Matias Martinez, He Ye, Fernanda Madeiral, Thomas Durieux, and Zhongxing Yu. Megadiff: A dataset of 600k java source code changes categorized by diff size. arXiv preprint arXiv:2108.04631, 2021.
241
+ Niklas Muennighoff. Sgpt: Gpt sentence embeddings for semantic search. arXiv preprint arXiv:2202.08904, 2022.
242
+ Niklas Muennighoff, Nouamane Tazi, Loïc Magne, and Nils Reimers. Mteb: Massive text embedding benchmark. arXiv preprint arXiv:2210.07316, 2022a. doi: 10.48550/ARXIV.2210.07316. URL https://arxiv.org/abs/2210.07316.
243
+ Niklas Muennighoff, Thomas Wang, Lintang Sutawika, Adam Roberts, Stella Biderman, Teven Le Scao, M Saiful Bari, Sheng Shen, Zheng-Xin Yong, Hailey Schoelkopf, et al. Crosslingual generalization through multitask finetuning. arXiv preprint arXiv:2211.01786, 2022b.
244
+ Niklas Muennighoff, Alexander M Rush, Boaz Barak, Teven Le Scao, Aleksandra Piktus, Nouamane Tazi, Sampo Pyysalo, Thomas Wolf, and Colin Raffel. Scaling data-constrained language models. arXiv preprint arXiv:2305.16264, 2023.
245
+ Niklas Muennighoff, Hongjin Su, Liang Wang, Nan Yang, Furu Wei, Tao Yu, Amanpreet Singh, and Douwe Kiela. Generative representational instruction tuning, 2024.
246
+
247
+ Ansong Ni, Srini Iyer, Dragomir Radev, Veselin Stoyanov, Wen-tau Yih, Sida Wang, and Xi Victoria Lin. Lever: Learning to verify language-to-code generation with execution. In International Conference on Machine Learning, pp. 26106–26128. PMLR, 2023.
248
+
249
+ Erik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu, Huan Wang, Yingbo Zhou, Silvio Savarese, and Caiming Xiong. Codegen: An open large language model for code with multi-turn program synthesis. arXiv preprint arXiv:2203.13474, 2022.
250
+
251
+ Erik Nijkamp, Hiroaki Hayashi, Caiming Xiong, Silvio Savarese, and Yingbo Zhou. Codegen2: Lessons for training llms on programming and natural languages. arXiv preprint arXiv:2305.02309, 2023.
252
+
253
+ Maxwell Nye, Anders Johan Andreassen, Guy Gur-Ari, Henryk Michalewski, Jacob Austin, David Bieber, David Dohan, Aitor Lewkowycz, Maarten Bosma, David Luan, et al. Show your work: Scratchpads for intermediate computation with language models. arXiv preprint arXiv:2112.00114, 2021. URL https://openreview.net/forum?id ${ . } = { }$ iedYJm92o0a.
254
+ OpenAI. Gpt-4 technical report, 2023.
255
+ Gabriel Orlanski, Kefan Xiao, Xavier Garcia, Jeffrey Hui, Joshua Howland, Jonathan Malmaud, Jacob Austin, Rishah Singh, and Michele Catasta. Measuring the impact of programming language distribution. arXiv preprint arXiv:2302.01973, 2023.
256
+ Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. In Conference on Neural Information Processing Systems (NeurIPS), 2022. URL https://arxiv.org/abs/2203.02155.
257
+ 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.
258
+ Bo Peng, Eric Alcaide, Quentin Anthony, Alon Albalak, Samuel Arcadinho, Huanqi Cao, Xin Cheng, Michael Chung, Matteo Grella, Kranthi Kiran GV, et al. Rwkv: Reinventing rnns for the transformer era. arXiv preprint arXiv:2305.13048, 2023.
259
+ Ethan Perez, Douwe Kiela, and Kyunghyun Cho. True few-shot learning with language models. Advances in Neural Information Processing Systems, 34:11054–11070, 2021.
260
+ Luiza Amador Pozzobon, Beyza Ermis, Patrick Lewis, and Sara Hooker. On the challenges of using black-box apis for toxicity evaluation in research. In ICLR 2023 Workshop on Trustworthy and Reliable Large-Scale Machine Learning Models, 2023.
261
+ Julian Aron Prenner and Romain Robbes. Automatic program repair with openai’s codex: Evaluating quixbugs. arXiv preprint arXiv:2111.03922, 2021.
262
+ Julian Aron Prenner and Romain Robbes. Runbugrun–an executable dataset for automated program repair. arXiv preprint arXiv:2304.01102, 2023.
263
+ Ofir Press, Noah A Smith, and Mike Lewis. Train short, test long: Attention with linear biases enables input length extrapolation. arXiv preprint arXiv:2108.12409, 2021.
264
+ Rafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D Manning, Stefano Ermon, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model. Advances in Neural Information Processing Systems, 36, 2024.
265
+ Vipul Raheja, Dhruv Kumar, Ryan Koo, and Dongyeop Kang. Coedit: Text editing by task-specific instruction tuning. arXiv preprint arXiv:2305.09857, 2023.
266
+ Machel Reid and Graham Neubig. Learning to model editing processes. arXiv preprint arXiv:2205.12374, 2022.
267
+ Ehud Reiter. A structured review of the validity of bleu. Computational Linguistics, 44(3):393–401, 2018.
268
+ Victor Sanh, Albert Webson, Colin Raffel, Stephen Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, et al. Multitask prompted training enables zero-shot task generalization. International Conference on Learning Representations (ICLR), 2022. URL https://openreview.net/forum?id $=$ 9Vrb9D0WI4.
269
+ Teven Le Scao, Angela Fan, Christopher Akiki, Ellie Pavlick, Suzana Ilic, Daniel Hesslow, Roman ´ Castagné, Alexandra Sasha Luccioni, François Yvon, Matthias Gallé, et al. Bloom: A 176bparameter open-access multilingual language model. arXiv preprint arXiv:2211.05100, 2022a.
270
+ Teven Le Scao, Thomas Wang, Daniel Hesslow, Lucile Saulnier, Stas Bekman, M Saiful Bari, Stella Bideman, Hady Elsahar, Niklas Muennighoff, Jason Phang, et al. What language model to train if you have one million gpu hours? arXiv preprint arXiv:2210.15424, 2022b.
271
+ Timo Schick, Jane Dwivedi-Yu, Zhengbao Jiang, Fabio Petroni, Patrick Lewis, Gautier Izacard, Qingfei You, Christoforos Nalmpantis, Edouard Grave, and Sebastian Riedel. Peer: A collaborative language model. arXiv preprint arXiv:2208.11663, 2022.
272
+ Natalie Schluter. The limits of automatic summarisation according to rouge. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics, pp. 41–45. Association for Computational Linguistics, 2017.
273
+ Noam M. Shazeer. Fast transformer decoding: One write-head is all you need. arXiv preprint arXiv:1911.02150, 2019.
274
+ Bo Shen, Jiaxin Zhang, Taihong Chen, Daoguang Zan, Bing Geng, An Fu, Muhan Zeng, Ailun Yu, Jichuan Ji, Jingyang Zhao, Yuenan Guo, and Qianxiang Wang. Pangu-coder2: Boosting large language models for code with ranking feedback, 2023.
275
+ Ensheng Shi, Yanlin Wang, Lun Du, Junjie Chen, Shi Han, Hongyu Zhang, Dongmei Zhang, and Hongbin Sun. On the evaluation of neural code summarization. In Proceedings of the 44th International Conference on Software Engineering, pp. 1597–1608, 2022.
276
+ Disha Shrivastava, Denis Kocetkov, Harm de Vries, Dzmitry Bahdanau, and Torsten Scholak. Repofusion: Training code models to understand your repository. arXiv preprint arXiv:2306.10998, 2023a.
277
+ Disha Shrivastava, Hugo Larochelle, and Daniel Tarlow. Repository-level prompt generation for large language models of code. In International Conference on Machine Learning, pp. 31693–31715. PMLR, 2023b.
278
+ Shivalika Singh, Freddie Vargus, Daniel Dsouza, Börje F Karlsson, Abinaya Mahendiran, Wei-Yin Ko, Herumb Shandilya, Jay Patel, Deividas Mataciunas, Laura OMahony, et al. Aya dataset: An open-access collection for multilingual instruction tuning. arXiv preprint arXiv:2402.06619, 2024.
279
+ Marta Skreta, Naruki Yoshikawa, Sebastian Arellano-Rubach, Zhi Ji, Lasse Bjørn Kristensen, Kourosh Darvish, Alán Aspuru-Guzik, Florian Shkurti, and Animesh Garg. Errors are useful prompts: Instruction guided task programming with verifier-assisted iterative prompting. arXiv preprint arXiv:2303.14100, 2023.
280
+ Dominik Sobania, Martin Briesch, Carol Hanna, and Justyna Petke. An analysis of the automatic bug fixing performance of chatgpt. arXiv preprint arXiv:2301.08653, 2023.
281
+ Luca Soldaini, Rodney Kinney, Akshita Bhagia, Dustin Schwenk, David Atkinson, Russell Authur, Ben Bogin, Khyathi Raghavi Chandu, Jennifer Dumas, Yanai Elazar, Valentin Hofmann, A. Jha, Sachin Kumar, Li Lucy, Xinxi Lyu, Nathan Lambert, Ian Magnusson, Jacob Daniel Morrison, Niklas Muennighoff, Aakanksha Naik, Crystal Nam, Matthew E. Peters, Abhilasha Ravichander, Kyle Richardson, Zejiang Shen, Emma Strubell, Nishant Subramani, Oyvind Tafjord, Pete Walsh, Luke Zettlemoyer, Noah A. Smith, Hanna Hajishirzi, Iz Beltagy, Dirk Groeneveld, Jesse Dodge, and Kyle Lo. Dolma: an open corpus of three trillion tokens for language model pretraining research. 2024. URL https://api.semanticscholar.org/CorpusID:267364861.
282
+
283
+ Aarohi Srivastava, Abhinav Rastogi, Abhishek Rao, Abu Awal Md Shoeb, Abubakar Abid, Adam Fisch, Adam R Brown, Adam Santoro, Aditya Gupta, Adrià Garriga-Alonso, et al. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models, 2022. URL https://arxiv.org/abs/2206.04615.
284
+
285
+ Simeng Sun, Kalpesh Krishna, Andrew Mattarella-Micke, and Mohit Iyyer. Do long-range language models actually use long-range context? ArXiv, abs/2109.09115, 2021. URL https://api. semanticscholar.org/CorpusID:237572264.
286
+ 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.
287
+ Ross Taylor, Marcin Kardas, Guillem Cucurull, Thomas Scialom, Anthony Hartshorn, Elvis Saravia, Andrew Poulton, Viktor Kerkez, and Robert Stojnic. Galactica: A large language model for science. arXiv preprint arXiv:2211.09085, 2022.
288
+ 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.
289
+ Lewis Tunstall, Nathan Lambert, Nazneen Rajani, Edward Beeching, Teven Le Scao, Leandro von Werra, Sheon Han, Philipp Schmid, and Alexander Rush. Creating a coding assistant with starcoder. Hugging Face Blog, 2023. https://huggingface.co/blog/starchat.
290
+ Ahmet Üstün, Viraat Aryabumi, Zheng-Xin Yong, Wei-Yin Ko, Daniel D’souza, Gbemileke Onilude, Neel Bhandari, Shivalika Singh, Hui-Lee Ooi, Amr Kayid, et al. Aya model: An instruction finetuned open-access multilingual language model. arXiv preprint arXiv:2402.07827, 2024.
291
+ Alex Wang, Yada Pruksachatkun, Nikita Nangia, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. SuperGLUE: A stickier benchmark for general-purpose language understanding systems. Conference on Neural Information Processing Systems (NeurIPS), 2019. URL https://arxiv.org/abs/1905.00537.
292
+ Ben Wang and Aran Komatsuzaki. Gpt-j-6b: A 6 billion parameter autoregressive language model, 2021.
293
+ 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 International Conference on Learning Representations (ICLR), 2023a. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ 1PL1NIMMrw.
294
+ Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language model with self generated instructions. arXiv preprint arXiv:2212.10560, 2022a.
295
+ Yizhong Wang, Swaroop Mishra, Pegah Alipoormolabashi, Yeganeh Kordi, Amirreza Mirzaei, Anjana Arunkumar, Arjun Ashok, Arut Selvan Dhanasekaran, Atharva Naik, David Stap, et al. Super-naturalinstructions: Generalization via declarative instructions on $1 6 0 0 +$ nlp tasks. arXiv preprint arXiv:2204.07705, 2022b.
296
+ Yizhong Wang, Hamish Ivison, Pradeep Dasigi, Jack Hessel, Tushar Khot, Khyathi Raghavi Chandu, David Wadden, Kelsey MacMillan, Noah A Smith, Iz Beltagy, et al. How far can camels go? exploring the state of instruction tuning on open resources. arXiv preprint arXiv:2306.04751, 2023b.
297
+ Yue Wang, Hung Le, Akhilesh Deepak Gotmare, Nghi DQ Bui, Junnan Li, and Steven CH Hoi. Codet5 $^ +$ : Open code large language models for code understanding and generation. arXiv preprint arXiv:2305.07922, 2023c.
298
+ Zhiruo Wang, Grace Cuenca, Shuyan Zhou, Frank F Xu, and Graham Neubig. Mconala: a benchmark for code generation from multiple natural languages. arXiv preprint arXiv:2203.08388, 2022c.
299
+ Zhiruo Wang, Shuyan Zhou, Daniel Fried, and Graham Neubig. Execution-based evaluation for open-domain code generation. arXiv preprint arXiv:2212.10481, 2022d.
300
+ 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. International Conference on Learning Representations (ICLR), 2022. URL https://openreview.net/f orum?id ${ . } = { }$ gEZrGCozdqR.
301
+ Jiayi Wei, Greg Durrett, and Isil Dillig. Coeditor: Leveraging contextual changes for multi-round code auto-editing. arXiv preprint arXiv:2305.18584, 2023.
302
+ Minghao Wu and Alham Fikri Aji. Style over substance: Evaluation biases for large language models. arXiv preprint arXiv:2307.03025, 2023.
303
+ Chunqiu Steven Xia and Lingming Zhang. Conversational automated program repair. arXiv preprint arXiv:2301.13246, 2023.
304
+ Mengzhou Xia, Mikel Artetxe, Chunting Zhou, Xi Victoria Lin, Ramakanth Pasunuru, Danqi Chen, Luke Zettlemoyer, and Ves Stoyanov. Training trajectories of language models across scales. arXiv preprint arXiv:2212.09803, 2022.
305
+ Can Xu, Qingfeng Sun, Kai Zheng, Xiubo Geng, Pu Zhao, Jiazhan Feng, Chongyang Tao, and Daxin Jiang. Wizardlm: Empowering large language models to follow complex instructions. arXiv preprint arXiv:2304.12244, 2023a.
306
+ Frank F Xu, Uri Alon, Graham Neubig, and Vincent Josua Hellendoorn. A systematic evaluation of large language models of code. In Proceedings of the 6th ACM SIGPLAN International Symposium on Machine Programming, pp. 1–10, 2022a.
307
+ Shengbin Xu, Yuan Yao, Feng Xu, Tianxiao Gu, and Hanghang Tong. Combining code context and fine-grained code difference for commit message generation. In Proceedings of the 13th Asia-Pacific Symposium on Internetware, pp. 242–251, 2022b.
308
+ Zhiyang Xu, Ying Shen, and Lifu Huang. Multiinstruct: Improving multi-modal zero-shot learning via instruction tuning, 2023b.
309
+ Michihiro Yasunaga and Percy Liang. Break-it-fix-it: Unsupervised learning for program repair. In International Conference on Machine Learning, pp. 11941–11952. PMLR, 2021.
310
+ He Ye, Matias Martinez, Thomas Durieux, and Martin Monperrus. A comprehensive study of automatic program repair on the quixbugs benchmark. Journal of Systems and Software, 171: 110825, 2021.
311
+ Burak Yetistiren, Isik Ozsoy, and Eray Tuzun. Assessing the quality of github copilot’s code generation. In Proceedings of the 18th International Conference on Predictive Models and Data Analytics in Software Engineering, pp. 62–71, 2022.
312
+ Pengcheng Yin, Bowen Deng, Edgar Chen, Bogdan Vasilescu, and Graham Neubig. Learning to mine aligned code and natural language pairs from stack overflow. In International Conference on Mining Software Repositories, MSR, pp. 476–486. ACM, 2018. doi: https://doi.org/10.1145/3196 398.3196408.
313
+ Zheng-Xin Yong, Hailey Schoelkopf, Niklas Muennighoff, Alham Fikri Aji, David Ifeoluwa Adelani, Khalid Almubarak, M Saiful Bari, Lintang Sutawika, Jungo Kasai, Ahmed Baruwa, et al. Bloom+ 1: Adding language support to bloom for zero-shot prompting. arXiv preprint arXiv:2212.09535, 2022.
314
+ Hao Yu, Bo Shen, Dezhi Ran, Jiaxin Zhang, Qi Zhang, Yuchi Ma, Guangtai Liang, Ying Li, Tao Xie, and Qianxiang Wang. Codereval: A benchmark of pragmatic code generation with generative pre-trained models. arXiv preprint arXiv:2302.00288, 2023.
315
+ Yan Zeng, Hanbo Zhang, Jiani Zheng, Jiangnan Xia, Guoqiang Wei, Yang Wei, Yuchen Zhang, and Tao Kong. What matters in training a gpt4-style language model with multimodal inputs? arXiv preprint arXiv:2307.02469, 2023.
316
+ Chunyan Zhang, Junchao Wang, Qinglei Zhou, Ting Xu, Ke Tang, Hairen Gui, and Fudong Liu. A survey of automatic source code summarization. Symmetry, 14(3):471, 2022a.
317
+ Fengji Zhang, Bei Chen, Yue Zhang, Jin Liu, Daoguang Zan, Yi Mao, Jian-Guang Lou, and Weizhu Chen. Repocoder: Repository-level code completion through iterative retrieval and generation. arXiv preprint arXiv:2303.12570, 2023a.
318
+ Hang Zhang, Xin Li, and Lidong Bing. Video-llama: An instruction-tuned audio-visual language model for video understanding. arXiv preprint arXiv:2306.02858, 2023b.
319
+ Jialu Zhang, José Cambronero, Sumit Gulwani, Vu Le, Ruzica Piskac, Gustavo Soares, and Gust Verbruggen. Repairing bugs in python assignments using large language models. arXiv preprint arXiv:2209.14876, 2022b.
320
+ Jiyang Zhang, Sheena Panthaplackel, Pengyu Nie, Junyi Jessy Li, and Milos Gligoric. Coditt5: Pretraining for source code and natural language editing. In 37th IEEE/ACM International Conference on Automated Software Engineering, pp. 1–12, 2022c.
321
+ Tianyi Zhang, Tao Yu, Tatsunori Hashimoto, Mike Lewis, Wen-tau Yih, Daniel Fried, and Sida Wang. Coder reviewer reranking for code generation. In International Conference on Machine Learning, pp. 41832–41846. PMLR, 2023c.
322
+ Qinkai Zheng, Xiao Xia, Xu Zou, Yuxiao Dong, Shan Wang, Yufei Xue, Zihan Wang, Lei Shen, Andi Wang, Yang Li, et al. Codegeex: A pre-trained model for code generation with multilingual evaluations on humaneval-x. arXiv preprint arXiv:2303.17568, 2023.
323
+ Chunting Zhou, Pengfei Liu, Puxin Xu, Srini Iyer, Jiao Sun, Yuning Mao, Xuezhe Ma, Avia Efrat, Ping Yu, Lili Yu, et al. Lima: Less is more for alignment. arXiv preprint arXiv:2305.11206, 2023a.
324
+ Shuyan Zhou, Uri Alon, Sumit Agarwal, and Graham Neubig. Codebertscore: Evaluating code generation with pretrained models of code. arXiv preprint arXiv:2302.05527, 2023b.
325
+ Yongchao Zhou, Andrei Ioan Muresanu, Ziwen Han, Keiran Paster, Silviu Pitis, Harris Chan, and Jimmy Ba. Large language models are human-level prompt engineers. arXiv preprint arXiv:2211.01910, 2022.
326
+ Ming Zhu, Aneesh Jain, Karthik Suresh, Roshan Ravindran, Sindhu Tipirneni, and Chandan K Reddy. Xlcost: A benchmark dataset for cross-lingual code intelligence. arXiv preprint arXiv:2206.08474, 2022.
327
+ Terry Yue Zhuo. Large language models are state-of-the-art evaluators of code generation. arXiv preprint arXiv:2304.14317, 2023.
328
+ Terry Yue Zhuo, Armel Zebaze, Nitchakarn Suppattarachai, Leandro von Werra, Harm de Vries, Qian Liu, and Niklas Muennighoff. Astraios: Parameter-efficient instruction tuning code large language models. arXiv preprint arXiv:2401.00788, 2024.
parse/test/v8L0pN6EOi/v8L0pN6EOi.md ADDED
@@ -0,0 +1,381 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LET’S VERIFY STEP BY STEP
2
+
3
+ Hunter Lightman∗, Vineet Kosaraju∗, Yura Burda∗, Harri Edwards, Bowen Baker,
4
+ Teddy Lee, Jan Leike, John Schulman, Ilya Sutskever & Karl Cobbe∗
5
+ OpenAI
6
+ San Francisco, CA, USA
7
+ karl@openai.com
8
+
9
+ # ABSTRACT
10
+
11
+ In recent years, large language models have greatly improved in their ability to perform complex multi-step reasoning. However, even state-of-the-art models still regularly produce logical mistakes. To train more reliable models, we can turn either to outcome supervision, which provides feedback for a final result, or process supervision, which provides feedback for each intermediate reasoning step. Given the importance of training reliable models, and given the high cost of human feedback, it is important to carefully compare the both methods. Recent work has already begun this comparison, but many questions still remain. We conduct our own investigation, finding that process supervision significantly outperforms outcome supervision for training models to solve problems from the challenging MATH dataset. Our process-supervised model solves $78 \%$ of problems from a representative subset of the MATH test set. Additionally, we show that active learning significantly improves the efficacy of process supervision. To support related research, we also release PRM800K, the complete dataset of 800,000 step-level human feedback labels used to train our best reward model.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Large language models are capable of solving tasks that require complex multi-step reasoning by generating solutions in a step-by-step chain-of-thought format (Nye et al., 2021; Wei et al., 2022; Kojima et al., 2022). However, even state-of-the-art models are prone to producing falsehoods — they exhibit a tendency to invent facts in moments of uncertainty (Bubeck et al., 2023). These hallucinations (Maynez et al., 2020) are particularly problematic in domains that require multi-step reasoning, since a single logical error is enough to derail a much larger solution. Detecting and mitigating hallucinations is essential to improve reasoning capabilities.
16
+
17
+ One effective method involves training reward models to discriminate between desirable and undesirable outputs. The reward model can then be used in a reinforcement learning pipeline (Ziegler et al., 2019; Stiennon et al., 2020; Nakano et al., 2021; Ouyang et al., 2022) or to perform search via rejection sampling (Nichols et al., 2020; Shen et al., 2021; Cobbe et al., 2021). While these techniques are useful, the resulting system is only as reliable as the reward model itself. It is therefore important that we study how to most effectively train reliable reward models.
18
+
19
+ In closely related work, Uesato et al. (2022) describe two distinct methods for training reward models: outcome supervision and process supervision. Outcome-supervised reward models (ORMs) are trained using only the final result of the model’s chain-of-thought, while process-supervised reward models (PRMs) receive feedback for each step in the chain-of-thought. There are compelling reasons to favor process supervision. It provides more precise feedback, since it specifies the exact location of any errors that occur. It also has several advantages relevant to AI alignment: it is easier for humans to interpret, and it more directly rewards models for following a human-endorsed chain-of-thought. Within the domain of logical reasoning, models trained with outcome supervision regularly use incorrect reasoning to reach the correct final answer (Zelikman et al., 2022; Creswell et al., 2022). Process supervision has been shown to mitigate this misaligned behavior (Uesato et al., 2022).
20
+
21
+ Despite these advantages, Uesato et al. (2022) found that outcome supervision and process supervision led to similar final performance in the domain of grade school math. We conduct our own detailed comparison of outcome and process supervision, with three main differences: we use a more capable base model, we use significantly more human feedback, and we train and test on the more challenging MATH dataset (Hendrycks et al., 2021).
22
+
23
+ Our main contributions are as follows:
24
+
25
+ 1. We show that process supervision can train much more reliable reward models than outcome supervision. We use our state-of-the-art PRM to solve $7 8 . 2 \%$ of problems from a representative subset of the MATH test set.
26
+ 2. We show that a large reward model can reliably approximate human supervision for smaller reward models, and that it can be used to efficiently conduct large-scale data collection ablations.
27
+ 3. We show that active learning leads to a $2 . 6 \times$ improvement in the data efficiency of process supervision.
28
+ 4. We release our full process supervision dataset, PRM800K, to promote related research.
29
+
30
+ # 2 METHODS
31
+
32
+ We perform a comparison of outcome and process supervision, following a similar methodology to Uesato et al. (2022). Outcome supervision can be provided without humans, since all problems in the MATH dataset have automatically checkable answers. In contrast, there is no simple way to automate process supervision. We therefore rely on human data-labelers to provide process supervision, specifically by labelling the correctness of each step in model-generated solutions.
33
+
34
+ We conduct experiments in two separate regimes: large-scale and small-scale. Each has its own advantages, and they offer complimentary perspectives. At large-scale, we finetune all models from GPT-4 (OpenAI, 2023). We focus on advancing the state-of-the-art by training the most reliable ORM and PRM possible. Unfortunately the training sets for these reward models are not directly comparable, for reasons we will discuss in Section 3. These models are therefore not ideal for making an apples-to-apples comparison of outcome and process supervision. To address this flaw, we also train models at small-scale, where we can conduct a more direct comparison. In order to remove our dependence on costly human feedback, we use a large-scale model to supervise small-scale model training. This setup enables us to conduct several important ablations that would otherwise be infeasible.
35
+
36
+ # 2.1 SCOPE
37
+
38
+ At each model scale, we use a single fixed model to generate all solutions. We call this model the generator. We do not attempt to improve the generator with reinforcement learning (RL). When we discuss outcome and process supervision, we are specifically referring to the supervision given to the reward model. We do not discuss any supervision the generator would receive from the reward model if trained with RL. Although finetuning the generator with RL is a natural next step, it is intentionally not the focus of this work.
39
+
40
+ We instead focus exclusively on how to train the most reliable reward model possible. We evaluate a reward model by its ability to perform best-of-N search over uniformly sampled solutions from the generator. For each test problem we select the solution ranked highest by the reward model, automatically grade it based on its final answer, and report the fraction that are correct. A reward model that is more reliable will select the correct solution more often.
41
+
42
+ # 2.2 BASE MODELS
43
+
44
+ All large-scale models are finetuned from the base GPT-4 model (OpenAI, 2023). This model has been pretrained solely to predict the next token; it has not been pretrained with any Reinforcement Learning from Human Feedback (RLHF) (Christiano et al., 2017). The small-scale base models are similar in design to GPT-4, but they were pretrained with roughly 200 times less compute. As an additional pretraining step, we finetune all models on a dataset of roughly 1.5B math-relevant tokens, which we call MathMix. Similar to Lewkowycz et al. (2022), we find that this improves the model’s mathematical reasoning capabilities. Details on how this dataset was constructed can be found in Appendix A.
45
+
46
+ ![](images/c1d0f12e03190fac361b1683bd42e8929b71239320fcf3a8033799f6f2ad7ca6.jpg)
47
+ Figure 1: A screenshot of the interface used to collect feedback for each step in a solution.
48
+
49
+ # 2.3 GENERATOR
50
+
51
+ To make parsing individual steps easier, we train the generator to produce solutions in a newline delimited step-by-step format. Specifically, we few-shot generate solutions to MATH training problems, filter to those that reach the correct final answer, and finetune the base model on this dataset for a single epoch. This step is not intended to teach the generator new skills; it is intended only to teach the generator to produce solutions in the desired format.
52
+
53
+ # 2.4 DATA COLLECTION
54
+
55
+ To collect process supervision data, we present human data-labelers with step-by-step solutions to MATH problems sampled by the large-scale generator. Their task is to assign each step in the solution a label of positive, negative, or neutral, as shown in Figure 1. A positive label indicates that the step is correct and reasonable. A negative label indicates that the step is either incorrect or unreasonable. A neutral label indicates ambiguity. In practice, a step may be labelled neutral if it is subtly misleading, or if it is a poor suggestion that is technically still valid. We permit neutral labels since this allows us to defer the decision about how to handle ambiguity: at test time, we can treat neutral labels as either positive or negative. A more detailed description of the labelling instructions is provided in Appendix D.
56
+
57
+ We label solutions exclusively from the large-scale generator in order to maximize the value of our limited human-data resource. We refer to the entire dataset of step-level labels collected as PRM800K. The PRM800K training set contains 800K step-level labels across 75K solutions to 12K problems. To minimize overfitting, we include data from 4.5K MATH test problems in the PRM800K training set, and we therefore evaluate our models only on the remaining 500 MATH test problems. More details about this test set can be found in Appendix C.
58
+
59
+ During data collection, we must decide which solutions to surface to data-labelers. The most straightforward strategy is to uniformly surface solutions produced by the generator. However, if we surface solutions that make obvious errors, the human feedback we get is less valuable. We would prefer to surface solutions that are more likely to fool our best reward model. To that end, we attempt to strategically select which solutions to show data-labelers. Specifically, we choose to surface convincing wrong-answer solutions. We use the term convincing to refer to solutions that are rated highly by our current best PRM, and we use wrong-answer to refer to solutions that reach an incorrect final answer. We use this slightly verbose phrasing to emphasize the fact that correctness is determined solely by checking the final answer, a process which occasionally leads to misgraded solutions. We expect to gain more information from labeling convincing wrong-answer solutions, since we know the PRM is mistaken about at least one step in each such solution.
60
+
61
+ ![](images/ffc22ae160a648b156742bec8deed0a7d49290e049bf1729e7c134fcdaf3d50b.jpg)
62
+ Figure 2: Two solutions to the same problem, graded by the PRM. The solution on the left is correct while the solution on the right is incorrect. A green background indicates a high PRM score, and a red background indicates a low score. The PRM correctly identifies the mistake in the incorrect solution.
63
+
64
+ In addition to using this selection strategy, we also iteratively re-train our PRM using the latest data at several points in the data collection process. At each iteration, we generate N solutions per problem and surface only the top K most convincing wrong-answer solutions to data-labelers. We experiment with either applying this top-K filtering at a problem level (K solutions per problem) or globally across the dataset (K solutions in total, unequally distributed among problems). Since the data collection process is expensive, it was not feasible to conduct at-scale ablations of these decisions. However, we perform several surrogate ablations in Section 4, using our largest PRM as a labelling oracle for a smaller PRM. More details about data collection can be found in Appendix B.
65
+
66
+ # 2.5 OUTCOME-SUPERVISED REWARD MODELS (ORMS)
67
+
68
+ We train ORMs following a similar methodology to Cobbe et al. (2021). We uniformly sample a fixed number of solutions per problem from the generator, and we train the ORM to predict whether each solution is correct or incorrect. In practice, we usually determine correctness by automatically checking the final answer, but in principle these labels could be provided by humans. At test time, we use the ORM’s prediction at the final token as the overall score for the solution. We note the automatic grading used to determine ORM targets is not perfectly reliable: false positives solutions that reach the correct answer with incorrect reasoning will be misgraded. We discuss additional ORM training details in Appendix E.
69
+
70
+ # 2.6 PROCESS-SUPERVISED REWARD MODELS (PRMS)
71
+
72
+ We train PRMs to predict the correctness of each step after the last token in each step. This prediction takes the form of a single token, and we maximize the log-likelihood of these target tokens during training. The PRM can therefore be trained in a standard language model pipeline without any special accommodations. To determine the step-level predictions at test time, it suffices to perform a single PRM forward pass over the whole solution. We visualize large-scale PRM scores for two different solutions in Figure 2. To compare multiple solutions, it is necessary to compute a single score for each solution. This is an important but straightforward detail: we define the PRM score for a solution to be the probability that every step is correct under the PRM. We implement this as the product of the correctness probabilities for each step. We describe other possible scoring strategies and additional PRM training details in Appendix F.
73
+
74
+ ![](images/398f5a02dd00061aad73e4de4fa19d24d32181d5e28eb16c797a16c66222f22d.jpg)
75
+ Figure 3: A comparison of outcome-supervised and process-supervised reward models, evaluated by their ability to search over many test solutions. Majority voting is shown as a strong baseline. For $N \leq 1 0 0 0$ , we visualize the variance across many subsamples of the 1860 solutions we generated in total per problem.
76
+
77
+ When we provide process supervision, we deliberately choose to supervise only up to the first incorrect step. This makes the comparison between outcome and process supervision more straightforward. For correct solutions, both methods provide the same information, namely that every step is correct. For incorrect solutions, both methods reveal the existence of at least one mistake, and process supervision additionally reveals the precise location of that mistake. If we were to provide additional process supervision beyond the first mistake, then process supervision would have an even greater information advantage. This decision also keeps the labelling cost similar for humans: without relying on an easy-to-check final answer, determining the correctness of a solution is equivalent to identifying its first mistake. While most MATH problems do have easy-to-check final answers, we expect this to not remain true in more complex domains.
78
+
79
+ # 3 LARGE-SCALE SUPERVISION
80
+
81
+ We train the large-scale PRM using the step-level labels in PRM800K. To ensure the large-scale ORM baseline is as strong as possible, we train on 100 uniform samples per problem from the generator. This means the ORM training set has no overlap with PRM800K, and it is an order of magnitude larger. Although these two training sets are not directly comparable, each represents our best attempt to advance the state-of-the-art with each form of supervision. We note that training the ORM solely on PRM800K solutions would be problematic, since our active learning strategy has heavily biased the dataset towards wrong-answer solutions. We did explore training the ORM on a superset of PRM800K solutions, by mixing in uniformly sampled solutions, but we found that this did not improve ORM performance.
82
+
83
+ Figure 3 shows how the best-of-N performance of each reward model varies as a function of N. Since majority voting is known to be a strong baseline (Wang et al., 2022; Lewkowycz et al., 2022), we also include this method as a point of comparison. While the ORM performs slightly better than the majority voting baseline, the PRM strongly outperforms both. Not only does the PRM reach higher performance for all values of N, but the performance gap widens as $_ \mathrm { N }$ increases. This indicates that the PRM is more effective than both the ORM and majority voting at searching over a large number of model-generated solutions. We experimented with using RM-weighted voting (Li et al., 2022; Uesato et al., 2022) to combine the benefits of the PRM and majority voting, but this did not noticeably improve performance. We use a specific subset of the MATH test set for evaluation,
84
+
85
+ (a) Four series of reward models trained using different data collection strategies, compared across training sets of varying sizes.
86
+
87
+ ![](images/edb438b96f27cee4f7ef693c85efeb4c0a306f6511f0f1f06e41416d703a4825.jpg)
88
+ (b) Three reward models trained on 200 samples/problem using different forms of supervision, compared across many test-time compute budgets.
89
+
90
+ ![](images/6dd60f6e10154fb701edb07b45f03fbe4c44c49cc9b9be4a11687d6b16d3bde6.jpg)
91
+
92
+ Figure 4: A comparison of different forms of outcome and process supervision. Mean and standard deviation is shown across three seeds.
93
+
94
+ which we describe in Appendix C. We further break down these results by problem difficulty in Appendix G.
95
+
96
+ # 4 SMALL-SCALE SYNTHETIC SUPERVISION
97
+
98
+ We find that the PRM outperforms the ORM at large-scale, but this result alone paints an incomplete picture. To better compare outcome and process supervision, there are two confounding factors that must be isolated. First, the training sets for the ORM and the PRM are not directly comparable: the PRM training set was constructed using active learning, is biased towards answer-incorrect solutions, and is an order of magnitude smaller. Second, the final-answer grading will provide positive labels to spurious solutions that reach the correct final answer despite incorrect reasoning. This could damage ORM performance, an effect we may or may not want to attribute to outcome supervision more generally.
99
+
100
+ Due to the high cost of collecting human feedback, we cannot easily ablate these factors using human labelers. We instead perform the relevant ablations by using the large-scale PRM to supervise smaller models. This setup enables us to simulate a large amount of data collection at a modest cost. For the remainder of this section, we refer to the large-scale PRM from Section 3 as $\mathrm { P R M _ { l a r g e } }$ .
101
+
102
+ # 4.1 PROCESS VS OUTCOME SUPERVISION
103
+
104
+ We now conduct a direct comparison of outcome and process supervision. We first sample between 1 and 200 solutions per problem from a small-scale generator. For each dataset, we provide three forms of supervision: process supervision from $\mathrm { P R M _ { l a r g e } }$ , outcome supervision from $\mathrm { P R M _ { l a r g e } }$ , and outcome supervision from final-answer checking. The choice of supervision is the only difference between these three series of reward models, which are otherwise trained on identical datasets. See Appendix H for more details about how $\mathrm { P R M _ { l a r g e } }$ is used for outcome and process supervision.
105
+
106
+ In Figure 4a, we evaluate each reward model by its best-of-500 selection. We see that process supervision significantly outperforms both forms of outcome supervision at all data collection scales. In Figure 4b, we evaluate the best reward model from each series by its best-of-N performance across different values of N. We see that using $\mathrm { P R M _ { l a r g e } }$ for outcome supervision is noticeably more effective than final-answer checking. This can be explained by the fact that $\mathrm { P R M _ { l a r g e } }$ provides better supervision for solutions that reach the correct final answer using incorrect reasoning.
107
+
108
+ It is not clear whether supervision by $\mathrm { P R M _ { l a r g e } }$ or by final-answer checking represents the more appropriate outcome supervision baseline. While final-answer supervision is more explicitly outcome based, its main weakness — the existence of false positives — is arguably over-emphasized in the
109
+
110
+ Table 1: We measure out-of-distribution generalization using recent STEM tests. We evaluate the outcome-supervised RM, the process-supervised RM, and majority voting using 100 test samples per problem.
111
+
112
+ <table><tr><td></td><td>ORM</td><td>PRM</td><td>Majority Vote</td><td>#Problems</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>AP Calculus</td><td>68.9%</td><td>86.7%</td><td>80.0%</td><td>45</td></tr><tr><td>AP Chemistry</td><td>68.9%</td><td>80.0%</td><td>71.7%</td><td>60</td></tr><tr><td>AP Physics</td><td>77.8%</td><td>86.7%</td><td>82.2%</td><td>45</td></tr><tr><td>AMC10/12</td><td>49.1%</td><td>53.2%</td><td>32.8%</td><td>84</td></tr><tr><td>Aggregate</td><td>63.8%</td><td>72.9%</td><td>61.3%</td><td>234</td></tr></table>
113
+
114
+ MATH dataset. Outcome supervision by $\mathrm { P R M _ { l a r g e } }$ better represents outcome supervision in domains that are less susceptible to false positives. We consider outcome supervision by $\mathrm { P R M _ { l a r g e } }$ to be the more relevant baseline, but we encourage the reader to draw their own conclusions.
115
+
116
+ # 4.2 ACTIVE LEARNING
117
+
118
+ Finally, we investigate the impact of active learning. We train a small-scale reward model, $\mathrm { P R M } _ { \mathrm { s e l e c t o r } }$ , on a single sample from each problem, and we use this model to score 1000 samples per problem. To train each of our larger reward models, we select $N$ samples per problem such that $8 0 \%$ are the most convincing (according to $\mathrm { P R M } _ { \mathrm { s e l e c t o r } } )$ ) wrong-answer samples, and $2 0 \%$ are the most convincing samples that remain (right- or wrong-answer). We score the selected samples with $\mathrm { P R M _ { l a r g e } }$ and train on those scores. This process ensures that all samples are relatively convincing under $\mathrm { \bar { P R M } } _ { \mathrm { s e l e c t o r } }$ , that a large fraction are known to contain at least one mistake, and that our overall dataset is not too heavily biased toward wrong-answer solutions. Performance of this data labelling scheme is shown in Figure 4a. By comparing the slopes of the line of best fit with and without active learning, we estimate that this form of active learning is approximately $2 . 6 \mathbf { x }$ more data efficient than uniform data labelling. We note that the model trained on the largest active learning dataset (200 samples per problem) appears to slightly underperform the expected trend line. Our best explanation for this observation is that 200 samples represents a significant fraction of the overall selection pool (1000 samples) and that this relative lack of diversity limits the possible upside from active learning.
119
+
120
+ We also performed a preliminary investigation into the impact of iteratively retraining $\mathrm { P R M } _ { \mathrm { s e l e c t o r } }$ throughout data collection. Between iterations, we re-trained $\mathrm { P R M } _ { \mathrm { s e l e c t o r } }$ using all currently labeled data. Unfortunately, we observed instability in this process which we were unable to diagnose. The resulting reward models performed no better than the models described above. We expect some form of iterative retraining to be beneficial in active learning, but we currently have no concrete evidence to support this claim. We consider this a compelling direction for future research.
121
+
122
+ # 5 OOD GENERALIZATION
123
+
124
+ To get some measure of out-of-distribution generalization, we evaluate our large-scale ORM and PRM on a held-out set of 224 STEM questions, pulled from the most recent AP Physics, AP Calculus, AP Chemistry, AMC10, and AMC12 exams. Since these tests were released after the pre-training dataset was compiled, we can have high confidence that the model has not seen these problems. We report the best-of-100 performance of the ORM, PRM and majority voting in Table 1. We observe results similar to those in Section 3: the PRM outperforms both the ORM and majority voting. This shows us that the PRM can tolerate a modest amount of distribution shift and that its strong performance holds up on fresh test questions.
125
+
126
+ # 6 DISCUSSION
127
+
128
+ # 6.1 CREDIT ASSIGNMENT
129
+
130
+ One clear advantage of process supervision is that it provides more precise feedback than outcome supervision. A reward model trained with outcome supervision faces a difficult credit-assignment task — to generalize well, it must determine where an incorrect solution went wrong. This is particularly difficult for hard problems: most model-generated solutions contain an error somewhere, so the marginal value of a negative label from outcome supervision is low. In contrast, process supervision provides a richer signal: it specifies both how many of the first steps were in fact correct, as well as the precise location of the incorrect step. Process supervision makes credit assignment easier, and we believe that this explains its strong performance.
131
+
132
+ # 6.2 ALIGNMENT IMPACT
133
+
134
+ Process supervision has several advantages over outcome supervision related to AI alignment. Process supervision is more likely to produce interpretable reasoning, since it encourages models to follow a process endorsed by humans. Process supervision is also inherently safer: it directly rewards an aligned chain-of-thought rather than relying on outcomes as a proxy for aligned behavior (Stuhlmuller & Byun, 2022). In contrast, outcome supervision is harder to scrutinize, and the prefer-¨ ences conveyed are less precise. In the worst case, the use of outcomes as an imperfect proxy could lead to models that become misaligned after learning to exploit the reward signal (Uesato et al., 2022; Cotra, 2022; Everitt et al., 2017).
135
+
136
+ In some cases, safer methods for AI systems can lead to reduced performance (Ouyang et al., 2022; Askell et al., 2021), a cost which is known as an alignment tax. In general, any alignment tax may hinder the adoption of alignment methods, due to pressure to deploy the most capable model. Our results show that process supervision in fact incurs a negative alignment tax. This could lead to increased adoption of process supervision, which we believe would have positive alignment sideeffects. It is unknown how broadly these results will generalize beyond the domain of math, and we consider it important for future work to explore the impact of process supervision in other domains.
137
+
138
+ # 6.3 TEST SET CONTAMINATION
139
+
140
+ The test set of the MATH dataset contains problems that are discussed in several online venues, and it is likely that some of these problems appear in the pretraining dataset for our models. We attempted to remove all MATH problems from our MathMix dataset using string-matching heuristics, but since humans can post hard-to-detect rephrasings of a problem online, it is difficult to make any strong guarantees about the overlap between MathMix and the MATH dataset.
141
+
142
+ In our experience inspecting model-generated solutions, we saw no clear signs of our models memorizing MATH problems. However, it is impossible to rule out subtle forms of memorization that would slip past manual inspection, and it is still possible that some degree of contamination has slightly inflated our performance on the MATH test set. Even in that case, we would expect any contamination to manifest similarly across all methods, and that the relative comparisons made throughout this work would remain mostly unaffected.
143
+
144
+ We also note that the PRM regularly surfaces correct solutions to MATH problems that have a low single-digit percentage solve-rate under the generator, some examples of which can be seen in Appendix I. The generator’s low solve-rate is an additional indication that it has not encountered such problems via test set contamination. Our generalization results from Section 5 further strengthen our claim that test set contamination has not significantly impacted this work, since we observe qualitatively similar results on problems that are guaranteed to be uncontaminated.
145
+
146
+ # 7 RELATED WORK
147
+
148
+ # 7.1 OUTCOME VS PROCESS SUPERVISION
149
+
150
+ In work closely related to our own, Uesato et al. (2022) compare the impact of outcome and process supervision in the domain of grade school math. They found that both methods led to similar finalanswer error rates, and that process supervision achieved those results with less data. While our core methodology is very similar, there are three main details that differ. First, we use a more capable model to collect PRM800K dataset and to perform our large-scale experiments. However, our small-scale results in Section 4 suggest that large-scale models are not necessary to observe benefits from process supervision. Second, we evaluate on the MATH dataset, which is significantly more challenging than GSM8K. Third, we collect a much larger quantity of process supervision data.
151
+
152
+ On the surface, the results from Uesato et al. (2022) may seem to conflict with our claim that process supervision leads to better performance. However, we believe the apparent conflict can be explained by the difference in the scale of the supervision. The data scaling trend in Figure 4a suggests that a small amount of process supervision and a large amount of outcome supervision do in fact lead to similar performance, consistent with the results from Uesato et al. (2022). The trend also shows that process supervision beats outcome supervision when scaled up, even when judged based solely on outcomes. This is consistent with our results in Section 3. We believe these results make a strong case for using process supervision.
153
+
154
+ # 7.2 SYNTHETIC SUPERVISION
155
+
156
+ Similar to our work in Section 4, Gao et al. (2022) use a large reward model to supervise the training of smaller models. They study the over-optimization that occurs during RLHF, with experiments that require large quantities of human preference data. To work around this challenge, they use a gold-standard reward model to replace human feedback. Our use of a large-scale reward model to supervise smaller reward models shares similarities with their approach.
157
+
158
+ # 7.3 NATURAL LANGUAGE REASONING
159
+
160
+ Several recent studies that have examined the reasoning ability of large language models are implicitly relevant to our work. Lewkowycz et al. (2022) showed that finetuning models on a large corpus of technical content led to significantly improved performance on MATH. Wang et al. (2022) showed that self-consistency leads to remarkably strong performance on many reasoning benchmarks, notably without requiring any additional finetuning. Wei et al. (2022) and Nye et al. (2021) demonstrate the importance of explicitly performing intermediate reasoning steps via a chain of thought or a scratchpad in order to solve tasks that require multi-step reasoning. Kojima et al. (2022) show that models are able to perform this behavior zero-shot, conditioned only on a simple prompt.
161
+
162
+ # 8 CONCLUSION
163
+
164
+ We have shown that process supervision can be used to train much more reliable reward models than outcome supervision in the domain of mathematical reasoning. We have also shown that active learning can be used to lower the cost of human data collection by surfacing only the most valuable model completions for human feedback. We release PRM800K, the full dataset of human feedback used to train our state-of-the-art reward model, with the hope that removing this significant barrier to entry will catalyze related research on the alignment of large language models. We believe that process supervision is currently under-explored, and we are excited for future work to more deeply investigate the extent to which these methods generalize.
165
+
166
+ # ACKNOWLEDGMENTS
167
+
168
+ We thank Joshua Achiam, Mark Chen, Jonathan Gordon, Dan Hendrycks, Lukasz Kaiser, Oleg Murk, Ben Sokolowsky, Francis Song, and Jonathan Uesato for valuable feedback and thoughtful discussions; Giambattista Parascandolo and Daniel Selsam for their contributions to the MathMix dataset; Jonathan Ward for contributing to the data collection interface; Wojciech Zaremba for encouraging us to scale up data collection; Peter Hoeschele and Aris Kostantinidis for supporting our data collection; the research acceleration and supercomputing teams at OpenAI for providing infrastructure support; and the team at Scale and the many data-labelers who created PRM800K.
169
+
170
+ # REPRODUCIBILITY STATEMENT
171
+
172
+ To assist reproducibility and further research we are releasing all of the labels that we gathered over the course of this project. Appendix B contains information about the dataset, what data was used for training, and a link to the repository containing the raw labels. Appendix C explains our evaluation methods. Finally, Appendix E and Appendix F explain how we trained our ORMs and PRMs.
173
+
174
+ # REFERENCES
175
+
176
+ Amanda Askell, Yuntao Bai, Anna Chen, Dawn Drain, Deep Ganguli, Tom Henighan, Andy Jones, Nicholas Joseph, Ben Mann, Nova DasSarma, et al. A general language assistant as a laboratory for alignment. arXiv preprint arXiv:2112.00861, 2021.
177
+
178
+ Sebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Ka- ´ mar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023.
179
+ 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.
180
+ 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.
181
+ Ajeya Cotra. Without specific countermeasures, the easiest path to transformative AI likely leads to AI takeover. https://www.alignmentforum.org/posts/pRkFkzwKZ2zfa3R6H/ without-specific-countermeasures-the-easiest-path-to, 2022.
182
+ Antonia Creswell, Murray Shanahan, and Irina Higgins. Selection-inference: Exploiting large language models for interpretable logical reasoning. arXiv preprint arXiv:2205.09712, 2022.
183
+ Tom Everitt, Victoria Krakovna, Laurent Orseau, Marcus Hutter, and Shane Legg. Reinforcement learning with a corrupted reward channel. arXiv preprint arXiv:1705.08417, 2017.
184
+ Leo Gao, John Schulman, and Jacob Hilton. Scaling laws for reward model overoptimization. arXiv preprint arXiv:2210.10760, 2022.
185
+ Dan Hendrycks, Collin Burns, Saurav Kadavath, Akul Arora, Steven Basart, Eric Tang, Dawn Song, and Jacob Steinhardt. Measuring mathematical problem solving with the math dataset. arXiv preprint arXiv:2103.03874, 2021.
186
+ 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.
187
+ Aitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, et al. Solving quantitative reasoning problems with language models. arXiv preprint arXiv:2206.14858, 2022.
188
+ Yifei Li, Zeqi Lin, Shizhuo Zhang, Qiang Fu, Bei Chen, Jian-Guang Lou, and Weizhu Chen. On the advance of making language models better reasoners. arXiv preprint arXiv:2206.02336, 2022.
189
+ Joshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. On faithfulness and factuality in abstractive summarization. arXiv preprint arXiv:2005.00661, 2020.
190
+ Reiichiro Nakano, Jacob Hilton, Suchir Balaji, Jeff Wu, Long Ouyang, Christina Kim, Christopher Hesse, Shantanu Jain, Vineet Kosaraju, William Saunders, et al. Webgpt: Browser-assisted question-answering with human feedback. arXiv preprint arXiv:2112.09332, 2021.
191
+ Eric Nichols, Leo Gao, and Randy Gomez. Collaborative storytelling with large-scale neural language models. In Proceedings of the 13th ACM SIGGRAPH Conference on Motion, Interaction and Games, pp. 1–10, 2020.
192
+ Maxwell Nye, Anders Johan Andreassen, Guy Gur-Ari, Henryk Michalewski, Jacob Austin, David Bieber, David Dohan, Aitor Lewkowycz, Maarten Bosma, David Luan, et al. Show your work: Scratchpads for intermediate computation with language models. arXiv preprint arXiv:2112.00114, 2021.
193
+ OpenAI. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023.
194
+ Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. arXiv preprint arXiv:2203.02155, 2022.
195
+ Jianhao Shen, Yichun Yin, Lin Li, Lifeng Shang, Xin Jiang, Ming Zhang, and Qun Liu. Generate & rank: A multi-task framework for math word problems. arXiv preprint arXiv:2109.03034, 2021.
196
+ Nisan Stiennon, Long Ouyang, Jeffrey Wu, Daniel Ziegler, Ryan Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul F Christiano. Learning to summarize with human feedback. Advances in Neural Information Processing Systems, 33:3008–3021, 2020.
197
+ Andreas Stuhlmuller and Jungwon Byun. Supervise process, not outcomes. ¨ https://ought. org/updates/2022-04-06-process, 2022.
198
+ Jonathan Uesato, Nate Kushman, Ramana Kumar, Francis Song, Noah Siegel, Lisa Wang, Antonia Creswell, Geoffrey Irving, and Irina Higgins. Solving math word problems with process-and outcome-based feedback. arXiv preprint arXiv:2211.14275, 2022.
199
+ Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022.
200
+ Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. arXiv preprint arXiv:2201.11903, 2022.
201
+ Eric Zelikman, Yuhuai Wu, Jesse Mu, and Noah Goodman. Star: Bootstrapping reasoning with reasoning. Advances in Neural Information Processing Systems, 35:15476–15488, 2022.
202
+ Daniel M Ziegler, Nisan Stiennon, Jeffrey Wu, Tom B Brown, Alec Radford, Dario Amodei, Paul Christiano, and Geoffrey Irving. Fine-tuning language models from human preferences. arXiv
203
+
204
+ preprint arXiv:1909.08593, 2019.
205
+
206
+ # A MATHMIX
207
+
208
+ Similar to Lewkowycz et al. (2022) we construct a large-scale dataset of high-quality math-relevant tokens for use in a lightweight pretraining stage, before finetuning on comparably smaller datasets like MATH and PRM800K. This dataset, which we call MathMix, has two main differences compared to the one used to train Minerva. First, it is smaller and more aggressively filtered to highquality math problem-solving content, and second, it does not explicitly mix in general language data.
209
+
210
+ Minerva was trained on 38.5B tokens of arXiv documents and webscrape pages with LaTeX content, while MathMix consists of a smaller set of 1.5B tokens containing individual math problems and their solutions, free-form text discussing math problems and concepts, and synthetic data (Table 2). While Minerva was pretrained on a dataset with $5 \%$ general natural language data, we chose not to mix in any natural language data explicitly, primarily because MathMix already contains plenty of natural language data.
211
+
212
+ Table 2: MathMix dataset components.
213
+
214
+ <table><tr><td>Data type</td><td>Token count </td><td>Present in pretraining?</td></tr><tr><td>Math problems and solutions</td><td>~275M</td><td>No</td></tr><tr><td>Free-form math discussion text (1)</td><td>~430M</td><td>No</td></tr><tr><td>Free-form math discussion text (2)</td><td>~ 450M</td><td>Yes</td></tr><tr><td>Synthetic data (1)</td><td>~30M</td><td>No</td></tr><tr><td>Synthetic data (2)</td><td>~100M</td><td>Yes</td></tr><tr><td>Critiques grading data</td><td>~ 500M</td><td>No</td></tr><tr><td></td><td></td><td></td></tr></table>
215
+
216
+ Note that when training smaller models, as in Section 4, we use a slightly smaller variant of MathMix that excludes the critiques data and only consists of 1B tokens. For our large models experiments, we train on MathMix for roughly 3B tokens (2 epochs). For our small models experiments, we train for 6 epochs (roughly 6.6B tokens).
217
+
218
+ We apply a set of decontamination checks on MathMix against the test split of the MATH dataset, including stripping out LaTeX and searching for matching n-grams, but we can make no strong guarantees on the efficacy of this decontamination. As discussed in Section 6.3, we would not expect the relative comparisons made throughout this work to be significantly impacted by test set contamination.
219
+
220
+ # B PRM800K
221
+
222
+ We collected 1,085,590 step-level labels over 101,599 solution samples. We present the whole unfiltered dataset as PRM800K. During training we discard labels used for quality control, as well as any step-level labels for which the labeler was unable to complete the task. The filtered dataset contains about 800,000 step-level labels over 75,000 solutions. The full PRM800K dataset is available at https://github.com/openai/prm800k.
223
+
224
+ The data collection was split into two separate phases. In phase 1, we collected labels for multiple alternative completions at each step of a solution. This seeded our dataset but was cumbersome— for many steps the alternatives were repetitive, and we found labelers spent a lot of time supervising long uninteresting solutions. As a result, the step-level labels we collected in this phase are more repetitive than those collected later. In total, phase 1 represents about $5 \%$ of PRM800K, or about 40,000 step-level labels.
225
+
226
+ The majority of our labels were collected as part of phase 2, during which we scaled up and streamlined the data collection process. Phase 2 data collection is split into 10 generations. For each generation, we sample $N$ solutions per problem from the generator. We rank these solutions with our current best PRM and surface the highest scoring wrong-answer solutions to our labelers. We retrain this PRM between each generation using all the latest data. This active learning strategy changes the balance of our data considerably. Though we sometimes surfaced correct solutions (either by manually injecting correct solutions or because of errors in our automatic grading), the vast majority of the labels we collected in this phase are for incorrect solutions. Table 3 breaks down the balance of correct/incorrect steps and solutions between the different phases of data collection. Though we mostly collected labels on incorrect solutions, we still collected many labels for correct individual steps. In fact, our small-scale ablations in Section 4.2 suggest that this active learning strategy, which favors labelling high-scoring wrong-answer solutions, improves performance despite the resulting imbalance in the dataset.
227
+
228
+ Table 3: Distribution of positive/negative steps/solutions.
229
+
230
+ <table><tr><td></td><td>phase 1</td><td>phase 2</td><td>combined</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>% end in correct solution</td><td>85.1</td><td>13.2</td><td>14.2</td></tr><tr><td>% correct steps</td><td>58.6</td><td>74.1</td><td>73.1</td></tr></table>
231
+
232
+ Some of our phase 2 questions are intended for quality control. For a quality control question, researchers mark which steps are reasonable to label as incorrect. Then we assess that labelers are able to consistently mark those steps as incorrect. Prior to starting on phase 2, we required all labelers to label 30 quality control questions. This served as a screening test, and we only admitted labelers that agreed with our gold labels at least $7 5 \%$ of the time.
233
+
234
+ We then designated 10-20 problems per generation as additional quality control questions, and we randomly served them to labelers as they worked through the task. We used the results of this continuous quality control to remove labelers whose quality slipped too far, as well as to prepare educational material on common mistakes in order to improve labeler alignment with our instructions.
235
+
236
+ # C EVALUATION
237
+
238
+ As we scaled up the project, we began having to collect labels on multiple solutions for the same training problem. In order to avoid the risk of over-fitting on the 7,500 MATH training problems, we expanded the training set to include 4,500 MATH test split problems. We therefore evaluate our models only on the remaining 500 held-out problems. We selected these 500 test problems uniformly at random. In Figure 5, we show that the distribution of difficulty levels and subjects in this subset is representative of the MATH test set as a whole. The specific test set we used can be found at https://github.com/openai $/ \mathrm { p r m } 8 0 0 \mathrm { k }$ . We leave it for future work to explore how many distinct training problems are actually necessary, and how quickly our methods overfit to the training set.
239
+
240
+ ![](images/68b0f55ecfe175af16990e7d464701ba8ed6b1bea6e450500df406bfc0f706d0.jpg)
241
+ Figure 5: Two histograms comparing the distribution of problem difficulty levels and subjects in both the original MATH test set and in our 500 problem test subset.
242
+
243
+ # D LABELLING INSTRUCTIONS
244
+
245
+ Labelers were tasked to look at steps in a solution and label each one as positive, negative, or neutral. A step is considered neutral if it is appropriate in context, reasonable, correct, and contains only computations that can be verified easily. A step is positive if it is neutral and also progresses towards the solution. All other steps are considered negative. Labelers were not given reference solutions, but they were given the ground truth final answers. We chose not to provide reference solutions to avoid biasing them towards one particular path to the solution. We chose to provide ground truth final answers since this information can sometimes help labelers resolve their own misunderstandings.
246
+
247
+ In phase 1, labelers were permitted to enter their own steps in the case that all candidate steps were negative. Then the solution would progress from a randomly selected positive step (or neutral if their were no positive ones). This often resulted in trajectories that got stuck in endless sequences of neutral steps that said reasonable things but made frustratingly slow progress towards a solution or negative steps that needed constant human supervision. In phase 2, we pre-generate whole solutions and end the task as soon as the first negative step is encountered. The full instructions given to labelers can be found at https://github.com/openai/prm800k/tree/main/prm800k/instructions.
248
+
249
+ # E ORM TRAINING DETAILS
250
+
251
+ We train outcome-supervised reward models in the same manner as token-level verifiers from Cobbe et al. (2021), with a few subtle differences to hyperparameters. In particular, we only train for a single epoch on each dataset of model samples and reward model labels, without dropout, and without jointly learning a language modeling objective. We find that performance is not sensitive to most other hyperparameters, within a reasonable range.
252
+
253
+ To collect model samples, we simply sample uniformly from the generator at a temperature of 1.0 without applying any rebalancing of positives or negatives. At training time, the reward model makes predictions for every token in the context. The target for each token in a solution is the same, based on whether the solution is labelled correct or incorrect. At test time, we simply use the score of the final token in the completion as the overall score of the solution. We note that this setup is identical to the way token-level verifiers were trained in Cobbe et al. (2021).
254
+
255
+ # F PRM DETAILS
256
+
257
+ # F.1 TRAINING
258
+
259
+ We train our PRMs by fine-tuning the MathMix model to predict the probability of positive, negative, and neutral labels given a solution prefix ending in one of our labeled steps. We sweep over hyperparameters using a dataset containing the first $\sim 1 0 \%$ of PRM800K. Fine-tuning an LLM from its ordinary language modeling task to a classification task like this is a large distribution shift, and we found low learning rates were important to stable PRM training.
260
+
261
+ All of our PRMs are trained for 2 epochs. On smaller datasets (such as in phase 1 and the first few generations of phase 2) this improves the final performance over training for just 1 epoch. Additional epochs, up to some point, don’t noticeably help or hurt performance. On larger datasets, the benefits of 2 epoch training diminishes, but we continue doing it for consistency.
262
+
263
+ # F.2 SCORING
264
+
265
+ There are multiple ways of using the PRM to score solutions. In general, we produce a single solution-level score by performing a reduction over step-level scores, where the step-level score is the probability that the step’s label is positive. This involves two specific implementation decisions. First, when determining a step-level score, we either consider a neutral label to be positive or negative. Second, when determining a solution-level score, we either use the minimum or the product over step-level scores as a reduction.
266
+
267
+ We show results from all four scoring strategies in Table 4. The best performing strategy is to take the product of step-level scores and to consider the neutrals as positives, but the difference in performance between all strategies is minor. Throughout the rest of this work, we consider neutral steps to be positive, and we define the solution score to be the product of step-level scores. Using the product instead of the minimum as the reduction does create a slight bias against solutions with a larger number of steps.
268
+
269
+ Table 4: Best-of-1860 test performance using the PRM with four different scoring strategies.
270
+
271
+ <table><tr><td></td><td>product</td><td>minimum</td></tr><tr><td></td><td></td><td></td></tr><tr><td>neutral = positive</td><td>78.2%</td><td>77.6%</td></tr><tr><td>neutral = negative</td><td>77.4%</td><td>77.8%</td></tr></table>
272
+
273
+ # G DIFFICULTY BREAKDOWN
274
+
275
+ We show performance of our ORM and PRM on each quintile of the MATH dataset. We determine quintiles based on the pass rate under the generator. It is interesting to note that the performance gap is not only apparent on high difficulty problems: it is in fact apparent across all difficulties. For the lowest difficulty problems, we see that it is possible to find adversarial examples that fool the ORM, since the ORM’s performance slightly decreases as the number of samples increases. In contrast, the PRM remains highly robust over this same set of samples.
276
+
277
+ We also see that increasing the number of samples has the largest positive effect on the highest difficulty problems. This is to be expected, since a large number of generator samples may be required to find a true and convincing solution to a hard problem.
278
+
279
+ ![](images/8450f287250109be7557d8552dd0b83880b5823695213a5396ab6cd42bdb000c.jpg)
280
+ Figure 6: A breakdown of ORM vs PRM performance by problem difficulty.
281
+
282
+ # H SYNTHETIC SUPERVISION DETAILS
283
+
284
+ We can use $\mathrm { P R M _ { l a r g e } }$ to provide either outcome or process supervision for smaller models. We determine the labels for individual steps based on the step-level probabilities outputted by $\mathrm { P R M _ { l a r g e } }$ . To do this, we set an arbitrary threshold: any step that $\mathrm { P R M _ { l a r g e } }$ assigns a negative label with greater than $20 \%$ probability is considered incorrect. We choose this threshold based on the observation that $\mathrm { P R M _ { l a r g e } }$ is slightly miscalibrated in the direction of favoring positive labels.
285
+
286
+ To provide process supervision for a solution, we directly return the step-level labels (positive or negative) provided by $\mathrm { P R M _ { l a r g e } }$ , up until the first step that is marked as negative. This mimics our true human data collection process. To provide outcome supervision, we mark the solution as correct if and only if $\mathrm { P R M _ { l a r g e } }$ considers every step to be correct (using the same thresholding logic).
287
+
288
+ # I PRM VISUALIZATIONS
289
+
290
+ All examples shown come from the large-scale generator (GPT-4). We note the pass-rate under the generator to give some sense of the difficulty of these problems.
291
+
292
+ # I.1 TRUE POSITIVES
293
+
294
+ These cherry-picked examples show the best-of-1860 solution from the generator as ranked by the large-scale PRM.
295
+
296
+ Problem 1. Generator pass-rate: $0 . 1 \%$ . This challenging trigonometry problem requires applying several identities in a not-at-all obvious succession. Most solution attempts fail, because it is hard to choose which identities are actually helpful. Though successful solutions to this problem are rare, the reward model correctly recognizes when a valid chain-of-thought has been found.
297
+
298
+ ![](images/b49cd8102ecf354e8a234cd1f0e421d1a1b1f65c4fac690d3ced5941e37c4bee.jpg)
299
+
300
+ Problem 2. Generator pass-rate: $5 . 8 \%$ . In step 7 and 8, the generator starts performing guessand-check. This is a common place the model might hallucinate, by claiming a particular guess is successful when it isn’t. In this case, the reward model verifies each step and determines that the chain-of-thought is correct.
301
+
302
+ ![](images/03cac43323bcf76ab5d39d35080de64d0a273b4fa8989a088be9850931b25fb0.jpg)
303
+
304
+ Problem 3. Generator pass-rate: $1 . 7 \%$ . The generator successfully applies several trigonometric identities to simplify the expression.
305
+
306
+ ![](images/3f4d188bcad1dfbcc6023a240ee47f7a7ea7839dbfd1015cc0d43918d114c635.jpg)
307
+
308
+ Problem 4. Generator pass-rate: $4 . 5 \%$ . Here, the generator successfully performs a complex series of polynomial factorizations. The use of the Sophie-Germain identity in step 5 is an important step that could be considered insightful.
309
+
310
+ ![](images/66772c6cbe7783cf2e3c5ed3f309ab922ac1bf5b53f936b1897bfa344df11ac4.jpg)
311
+
312
+ # I.2 TRUE NEGATIVES
313
+
314
+ Problem 5. Generator pass-rate: $4 . 5 \%$ . The generator attempts to use the difference of squares formula in step 12 on an expression that isn’t in fact a difference of squares. The reward model catches this mistake.
315
+
316
+ ![](images/19bf328a892b84877038770ef6c02f287e7e3bc480688cd02a3f84e54856d842.jpg)
317
+
318
+ Problem 6. Generator pass-rate: $9 3 . 5 \%$ . In step 7, the generator makes an incorrect attempt to simplify an expression. The reward model catches this mistake.
319
+
320
+ ![](images/4c82528b60c8f2e29416c1872622b73f35787f67944dab503130eb6938a9556d.jpg)
321
+
322
+ Problem 7. Generator pass-rate: $4 8 . 0 \%$ . In step 11, the generator makes a simple calculation error.
323
+ The reward model catches this mistake.
324
+
325
+ ![](images/7bf6ac2652580521f781b34ce2c1d15e82f9f29dd3aacb776e875f9aa58738c5.jpg)
326
+
327
+ Answer:36
328
+
329
+ Problem 8. Generator pass-rate: $5 . 8 \%$ . The justification in step 8 is strange, but the reward model lets it slide. In step 9, though, the model incorrectly factors the expression. The reward model catches this mistake.
330
+
331
+ <table><tr><td>Find the unique odd integer t such thatO&lt;t&lt;23 and t+2 is the inverse of t modulo 23 I need to find an odd integer t between O and 23 such that t +2 is the inverse of t modulo 23.</td></tr><tr><td>That means that t and t +2 multiply to give 1 modulo 23.</td></tr><tr><td></td></tr><tr><td>I can write this as t(t +2)=1 (mod 23).</td></tr><tr><td>I can try to guess and check values of t until I find one that works, but that might take a long time.</td></tr><tr><td>I can also try to use some properties of modular arithmetic to simplify the equation.</td></tr><tr><td>For example, I can subtract 23 from t + 2 and still get the same remainder modulo 23.</td></tr><tr><td>So I can write t(t +2)=t(t-21) (mod 23).</td></tr><tr><td>This looks simpler, because now I have a diference of two multiples of t.</td></tr><tr><td>I can factor out t and get t(t -21) = t(1 - 21) (mod 23).</td></tr><tr><td>Now I can divide both sides by t, as long as t is not a multiple of 23.</td></tr><tr><td>This gives me t - 21 = 1- 21 (mod 23).</td></tr><tr><td>I can simplify this further by adding 21 to both sides.</td></tr><tr><td>This gives me t = 1 (mod 23).</td></tr><tr><td>Thismeans that t has the same remainder as1 when divided by 23.</td></tr><tr><td>The smallest positive value of t that satisfies this is t = 1.</td></tr><tr><td>This is also an odd integer, so it meets the criteria of the problem.</td></tr><tr><td>I can check that t = 1 works by plugging it into the original equation. I get 1(1 +2) = 1 (mod 23), which is true.</td></tr><tr><td> Therefore, the unique odd integer t that satisfies the given conditions is t = 1.</td></tr><tr><td>Answer:1</td></tr></table>
332
+
333
+ # I.3 FALSE POSITIVES
334
+
335
+ Problem 9. Generator pass-rate: $1 8 . 5 \%$ . The generator makes a subtle counting error in step 9. On the surface, it appears reasonable to claim that there are 5 ways to exchange the same colored ball since there are 5 colors. However, this undercounts by a factor of 2, since Bob has 2 choices for which ball to return to Alice. The reward model is fooled by this mistake.
336
+
337
+ Bob and Alice each have a bag that contains one ball of each of the colors,blue,green,orange,red,and violet.Alice randomly selects one ballfrom her bag and puts it into Bob's bag.Bob then randomly selects one ballfrom his bag and puts it into Alice's bag.What is the probability that after this process the contents of the two bags are the same?
338
+
339
+ <table><tr><td>Tofindtheprobabilityofanevent,Ineedtodividethenumberoffavorableoutcomesbythenumberofposibleoutcomes.</td></tr><tr><td>In this case, the event is that the contents of the two bags are the same after the process.</td></tr><tr><td>SoI need tocount how many ways this can happen,and how many ways the process can happen in total.</td></tr><tr><td>I will start with the total number of ways the process can happen.</td></tr><tr><td>Alice can choose any of the five balls in her bag,and Bob can choose any of the six balls in his bag.</td></tr><tr><td>So the total number of ways the process can happen is 5 times 6, which is 30.</td></tr><tr><td>Now I will count how many ways the contents of the two bags can be the same after the process.</td></tr><tr><td>This means that Alice and Bob must have exchanged the same color of ball.</td></tr><tr><td>Thereare five colors,so there are five ways they canexchange the same color of ball.ERROR</td></tr><tr><td>Therefore, the number of favorable outcomes is 5.</td></tr><tr><td>So the probability of the event is 5 divided by 30, which simplifies to 1/6.</td></tr><tr><td>Answer:1/6</td></tr></table>
340
+
341
+ Problem 10. Generator pass-rate: $1 7 . 6 \%$ . In step 13, the generator attempts to simplify the equation by combining like terms. It correctly moves and combines the linear terms to the left-hand side, but then mistakenly leaves the right-hand side untouched. The reward model is fooled by this mistake.
342
+
343
+ ![](images/5f500c74d6366d54983800783dd72e5b0e313cb5347506d269e5789680e03082.jpg)
344
+
345
+ Problem 11. Generator pass-rate: $1 3 . 4 \%$ . The generator attempts to perform long division, but in step 16, it forgets to include the leading zeros in the repeating part of the decimal. The reward model is fooled by this mistake.
346
+
347
+ ![](images/ae8878faf5c5e525ab95a1a80388750b168e5b17bab5c1c2cb50ef5356602edc.jpg)
348
+
349
+ Problem 12. Generator pass-rate: $9 . 1 \%$ . In step 4, the generator falsely claims that the sequence repeats itself every 12 terms, when it’s in fact every 10 terms. This sort of counting mistake occasionally fools the reward model.
350
+
351
+ Given that
352
+
353
+ Ω1=211,
354
+ m2=375,
355
+ $x _ { 3 } = 4 2 0 ,$
356
+ 𝑥4=523,and
357
+ $x _ { n } = x _ { n - 1 } - x _ { n - 2 } + x _ { n - 3 } - x _ { n - 4 }$ when $n \geq 5$
358
+
359
+ find thevalueof $x _ { 5 3 1 } + x _ { 7 5 3 } + x _ { 9 7 5 }$
360
+
361
+ his isaproblem involvingarecursive sequence,whereeachtermdependsontheprevious four terms.
362
+
363
+ One way toapproach this problemis tolook fora pattern oraformula that can helpus findany term of the sequence without havingtocompute all theprevious terms.
364
+
365
+ Todo that,let's write down the first few terms of the sequence and see if we notice anything:
366
+
367
+ $$
368
+ \begin{array} { r l } & { x _ { 1 } = 2 1 1 , } \\ & { x _ { 2 } = 3 7 5 , } \\ & { x _ { 3 } = 4 2 0 , } \\ & { x _ { 4 } = 5 2 3 , } \\ & { x _ { 5 } = 5 4 3 , } \\ & { x _ { 6 } = x _ { 5 } - x _ { 4 } + x _ { 2 } - x _ { 1 } = 5 2 3 - 4 2 0 + 3 7 5 - 2 1 1 = 2 6 7 , } \\ & { x _ { 5 } = x _ { 6 } - x _ { 4 } + x _ { 3 } - x _ { 2 } = 2 6 7 - 5 2 3 + 4 2 0 - 3 7 5 = - 2 1 1 , } \\ & { x _ { 7 } = x _ { 6 } - x _ { 5 } + x _ { 4 } - x _ { 3 } = - 2 1 1 - 2 6 7 + 5 2 3 - 4 2 0 - - 3 7 5 , } \\ & { x _ { 8 } = x _ { 7 } - x _ { 6 } + x _ { 5 } - x _ { 4 } - 3 7 5 - ( - 2 1 1 ) + 2 6 7 - 5 2 3 = - 4 2 0 , } \\ & { x _ { 9 } = x _ { 8 } - x _ { 7 } + x _ { 8 } - x _ { 8 } = - 4 2 0 - ( - 3 7 5 ) + ( - 2 1 1 ) - 2 6 7 - 5 2 3 , } \\ & { x _ { 9 } = x _ { 9 } - x _ { 8 } + x _ { 7 } - x _ { 6 } - 3 5 - ( - 4 2 0 ) + ( - 3 7 5 ) - ( - 2 1 1 ) - - 2 6 7 , } \\ & { x _ { 1 1 } = x _ { 1 0 } - x _ { 9 } + x _ { 8 } - x _ { 7 } = - 2 6 7 - ( - 5 2 3 ) + ( - 4 2 0 ) - ( - 3 7 5 ) - 2 1 1 , } \\ & { x _ { 1 2 } = x _ { 1 1 } - x _ { 1 0 } + x _ { 9 } - x _ { 8 } = 2 1 1 - ( - 2 8 7 ) + ( - 5 2 3 ) - ( - 4 2 0 ) - 3 7 5 , } \\ & { x _ { 1 3 } = x _ { 1 2 } - x _ { 1 } + x _ { 1 0 } - x _ { 3 } = 3 7 5 - 2 1 1 + ( - 2 8 7 ) - ( - 4 2 0 ) - 3 7 5 + 2 0 , } \\ & { x _ { 1 4 } = x _ { 1 2 } - x _ { 1 } + x _ { 1 0 } - x _ { 2 0 } - 2 1 1 + ( - 2 8 7 ) - ( - 5 2 3 ) + 2 0 , } \\ & x _ { 2 4 } = x _ { 1 1 } - x _ { 1 } \end{array}
369
+ $$
370
+
371
+ We can see that the sequence repeats itself every 12 terms, starting from x1. ERROR
372
+
373
+ This means that wecanfindanytermofthesequencebyfinding itsremainder whendividedby12,andthenlooking up the corresponding term in the first cycle.
374
+ For example, to find ε531, we can divide 531 by 12 and get a quotient of 44 and a remainder of 3.
375
+ This means that x531 is the same as x3, which is 420.
376
+ Similarly, we can find x753 and xg75 by dividing them by 12 and looking up their remainders.
377
+ We get that x753 has a remainder of 9, so it is the same as xg,which is-523.
378
+ And 𝑥975 has a remainder of 3, so it is the same as x3, which is 420.
379
+ Therefore, the value of x531 + x753 + x975 is 420 +(-523) + 420 = 317.
380
+
381
+ Answer:317
parse/test/v8L0pN6EOi/v8L0pN6EOi_content_list.json ADDED
@@ -0,0 +1,950 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "LET’S VERIFY STEP BY STEP ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Hunter Lightman∗, Vineet Kosaraju∗, Yura Burda∗, Harri Edwards, Bowen Baker, \nTeddy Lee, Jan Leike, John Schulman, Ilya Sutskever & Karl Cobbe∗ \nOpenAI \nSan Francisco, CA, USA \nkarl@openai.com ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "ABSTRACT ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "In recent years, large language models have greatly improved in their ability to perform complex multi-step reasoning. However, even state-of-the-art models still regularly produce logical mistakes. To train more reliable models, we can turn either to outcome supervision, which provides feedback for a final result, or process supervision, which provides feedback for each intermediate reasoning step. Given the importance of training reliable models, and given the high cost of human feedback, it is important to carefully compare the both methods. Recent work has already begun this comparison, but many questions still remain. We conduct our own investigation, finding that process supervision significantly outperforms outcome supervision for training models to solve problems from the challenging MATH dataset. Our process-supervised model solves $78 \\%$ of problems from a representative subset of the MATH test set. Additionally, we show that active learning significantly improves the efficacy of process supervision. To support related research, we also release PRM800K, the complete dataset of 800,000 step-level human feedback labels used to train our best reward model. ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "1 INTRODUCTION ",
27
+ "text_level": 1,
28
+ "page_idx": 0
29
+ },
30
+ {
31
+ "type": "text",
32
+ "text": "Large language models are capable of solving tasks that require complex multi-step reasoning by generating solutions in a step-by-step chain-of-thought format (Nye et al., 2021; Wei et al., 2022; Kojima et al., 2022). However, even state-of-the-art models are prone to producing falsehoods — they exhibit a tendency to invent facts in moments of uncertainty (Bubeck et al., 2023). These hallucinations (Maynez et al., 2020) are particularly problematic in domains that require multi-step reasoning, since a single logical error is enough to derail a much larger solution. Detecting and mitigating hallucinations is essential to improve reasoning capabilities. ",
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "One effective method involves training reward models to discriminate between desirable and undesirable outputs. The reward model can then be used in a reinforcement learning pipeline (Ziegler et al., 2019; Stiennon et al., 2020; Nakano et al., 2021; Ouyang et al., 2022) or to perform search via rejection sampling (Nichols et al., 2020; Shen et al., 2021; Cobbe et al., 2021). While these techniques are useful, the resulting system is only as reliable as the reward model itself. It is therefore important that we study how to most effectively train reliable reward models. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "text",
42
+ "text": "In closely related work, Uesato et al. (2022) describe two distinct methods for training reward models: outcome supervision and process supervision. Outcome-supervised reward models (ORMs) are trained using only the final result of the model’s chain-of-thought, while process-supervised reward models (PRMs) receive feedback for each step in the chain-of-thought. There are compelling reasons to favor process supervision. It provides more precise feedback, since it specifies the exact location of any errors that occur. It also has several advantages relevant to AI alignment: it is easier for humans to interpret, and it more directly rewards models for following a human-endorsed chain-of-thought. Within the domain of logical reasoning, models trained with outcome supervision regularly use incorrect reasoning to reach the correct final answer (Zelikman et al., 2022; Creswell et al., 2022). Process supervision has been shown to mitigate this misaligned behavior (Uesato et al., 2022). ",
43
+ "page_idx": 0
44
+ },
45
+ {
46
+ "type": "text",
47
+ "text": "Despite these advantages, Uesato et al. (2022) found that outcome supervision and process supervision led to similar final performance in the domain of grade school math. We conduct our own detailed comparison of outcome and process supervision, with three main differences: we use a more capable base model, we use significantly more human feedback, and we train and test on the more challenging MATH dataset (Hendrycks et al., 2021). ",
48
+ "page_idx": 1
49
+ },
50
+ {
51
+ "type": "text",
52
+ "text": "Our main contributions are as follows: ",
53
+ "page_idx": 1
54
+ },
55
+ {
56
+ "type": "text",
57
+ "text": "1. We show that process supervision can train much more reliable reward models than outcome supervision. We use our state-of-the-art PRM to solve $7 8 . 2 \\%$ of problems from a representative subset of the MATH test set. \n2. We show that a large reward model can reliably approximate human supervision for smaller reward models, and that it can be used to efficiently conduct large-scale data collection ablations. \n3. We show that active learning leads to a $2 . 6 \\times$ improvement in the data efficiency of process supervision. \n4. We release our full process supervision dataset, PRM800K, to promote related research. ",
58
+ "page_idx": 1
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "2 METHODS ",
63
+ "text_level": 1,
64
+ "page_idx": 1
65
+ },
66
+ {
67
+ "type": "text",
68
+ "text": "We perform a comparison of outcome and process supervision, following a similar methodology to Uesato et al. (2022). Outcome supervision can be provided without humans, since all problems in the MATH dataset have automatically checkable answers. In contrast, there is no simple way to automate process supervision. We therefore rely on human data-labelers to provide process supervision, specifically by labelling the correctness of each step in model-generated solutions. ",
69
+ "page_idx": 1
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "We conduct experiments in two separate regimes: large-scale and small-scale. Each has its own advantages, and they offer complimentary perspectives. At large-scale, we finetune all models from GPT-4 (OpenAI, 2023). We focus on advancing the state-of-the-art by training the most reliable ORM and PRM possible. Unfortunately the training sets for these reward models are not directly comparable, for reasons we will discuss in Section 3. These models are therefore not ideal for making an apples-to-apples comparison of outcome and process supervision. To address this flaw, we also train models at small-scale, where we can conduct a more direct comparison. In order to remove our dependence on costly human feedback, we use a large-scale model to supervise small-scale model training. This setup enables us to conduct several important ablations that would otherwise be infeasible. ",
74
+ "page_idx": 1
75
+ },
76
+ {
77
+ "type": "text",
78
+ "text": "2.1 SCOPE ",
79
+ "text_level": 1,
80
+ "page_idx": 1
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "At each model scale, we use a single fixed model to generate all solutions. We call this model the generator. We do not attempt to improve the generator with reinforcement learning (RL). When we discuss outcome and process supervision, we are specifically referring to the supervision given to the reward model. We do not discuss any supervision the generator would receive from the reward model if trained with RL. Although finetuning the generator with RL is a natural next step, it is intentionally not the focus of this work. ",
85
+ "page_idx": 1
86
+ },
87
+ {
88
+ "type": "text",
89
+ "text": "We instead focus exclusively on how to train the most reliable reward model possible. We evaluate a reward model by its ability to perform best-of-N search over uniformly sampled solutions from the generator. For each test problem we select the solution ranked highest by the reward model, automatically grade it based on its final answer, and report the fraction that are correct. A reward model that is more reliable will select the correct solution more often. ",
90
+ "page_idx": 1
91
+ },
92
+ {
93
+ "type": "text",
94
+ "text": "2.2 BASE MODELS ",
95
+ "text_level": 1,
96
+ "page_idx": 1
97
+ },
98
+ {
99
+ "type": "text",
100
+ "text": "All large-scale models are finetuned from the base GPT-4 model (OpenAI, 2023). This model has been pretrained solely to predict the next token; it has not been pretrained with any Reinforcement Learning from Human Feedback (RLHF) (Christiano et al., 2017). The small-scale base models are similar in design to GPT-4, but they were pretrained with roughly 200 times less compute. As an additional pretraining step, we finetune all models on a dataset of roughly 1.5B math-relevant tokens, which we call MathMix. Similar to Lewkowycz et al. (2022), we find that this improves the model’s mathematical reasoning capabilities. Details on how this dataset was constructed can be found in Appendix A. ",
101
+ "page_idx": 1
102
+ },
103
+ {
104
+ "type": "image",
105
+ "img_path": "images/c1d0f12e03190fac361b1683bd42e8929b71239320fcf3a8033799f6f2ad7ca6.jpg",
106
+ "image_caption": [
107
+ "Figure 1: A screenshot of the interface used to collect feedback for each step in a solution. "
108
+ ],
109
+ "image_footnote": [],
110
+ "page_idx": 2
111
+ },
112
+ {
113
+ "type": "text",
114
+ "text": "",
115
+ "page_idx": 2
116
+ },
117
+ {
118
+ "type": "text",
119
+ "text": "2.3 GENERATOR ",
120
+ "text_level": 1,
121
+ "page_idx": 2
122
+ },
123
+ {
124
+ "type": "text",
125
+ "text": "To make parsing individual steps easier, we train the generator to produce solutions in a newline delimited step-by-step format. Specifically, we few-shot generate solutions to MATH training problems, filter to those that reach the correct final answer, and finetune the base model on this dataset for a single epoch. This step is not intended to teach the generator new skills; it is intended only to teach the generator to produce solutions in the desired format. ",
126
+ "page_idx": 2
127
+ },
128
+ {
129
+ "type": "text",
130
+ "text": "2.4 DATA COLLECTION ",
131
+ "text_level": 1,
132
+ "page_idx": 2
133
+ },
134
+ {
135
+ "type": "text",
136
+ "text": "To collect process supervision data, we present human data-labelers with step-by-step solutions to MATH problems sampled by the large-scale generator. Their task is to assign each step in the solution a label of positive, negative, or neutral, as shown in Figure 1. A positive label indicates that the step is correct and reasonable. A negative label indicates that the step is either incorrect or unreasonable. A neutral label indicates ambiguity. In practice, a step may be labelled neutral if it is subtly misleading, or if it is a poor suggestion that is technically still valid. We permit neutral labels since this allows us to defer the decision about how to handle ambiguity: at test time, we can treat neutral labels as either positive or negative. A more detailed description of the labelling instructions is provided in Appendix D. ",
137
+ "page_idx": 2
138
+ },
139
+ {
140
+ "type": "text",
141
+ "text": "We label solutions exclusively from the large-scale generator in order to maximize the value of our limited human-data resource. We refer to the entire dataset of step-level labels collected as PRM800K. The PRM800K training set contains 800K step-level labels across 75K solutions to 12K problems. To minimize overfitting, we include data from 4.5K MATH test problems in the PRM800K training set, and we therefore evaluate our models only on the remaining 500 MATH test problems. More details about this test set can be found in Appendix C. ",
142
+ "page_idx": 2
143
+ },
144
+ {
145
+ "type": "text",
146
+ "text": "During data collection, we must decide which solutions to surface to data-labelers. The most straightforward strategy is to uniformly surface solutions produced by the generator. However, if we surface solutions that make obvious errors, the human feedback we get is less valuable. We would prefer to surface solutions that are more likely to fool our best reward model. To that end, we attempt to strategically select which solutions to show data-labelers. Specifically, we choose to surface convincing wrong-answer solutions. We use the term convincing to refer to solutions that are rated highly by our current best PRM, and we use wrong-answer to refer to solutions that reach an incorrect final answer. We use this slightly verbose phrasing to emphasize the fact that correctness is determined solely by checking the final answer, a process which occasionally leads to misgraded solutions. We expect to gain more information from labeling convincing wrong-answer solutions, since we know the PRM is mistaken about at least one step in each such solution. ",
147
+ "page_idx": 2
148
+ },
149
+ {
150
+ "type": "image",
151
+ "img_path": "images/ffc22ae160a648b156742bec8deed0a7d49290e049bf1729e7c134fcdaf3d50b.jpg",
152
+ "image_caption": [
153
+ "Figure 2: Two solutions to the same problem, graded by the PRM. The solution on the left is correct while the solution on the right is incorrect. A green background indicates a high PRM score, and a red background indicates a low score. The PRM correctly identifies the mistake in the incorrect solution. "
154
+ ],
155
+ "image_footnote": [],
156
+ "page_idx": 3
157
+ },
158
+ {
159
+ "type": "text",
160
+ "text": "In addition to using this selection strategy, we also iteratively re-train our PRM using the latest data at several points in the data collection process. At each iteration, we generate N solutions per problem and surface only the top K most convincing wrong-answer solutions to data-labelers. We experiment with either applying this top-K filtering at a problem level (K solutions per problem) or globally across the dataset (K solutions in total, unequally distributed among problems). Since the data collection process is expensive, it was not feasible to conduct at-scale ablations of these decisions. However, we perform several surrogate ablations in Section 4, using our largest PRM as a labelling oracle for a smaller PRM. More details about data collection can be found in Appendix B. ",
161
+ "page_idx": 3
162
+ },
163
+ {
164
+ "type": "text",
165
+ "text": "2.5 OUTCOME-SUPERVISED REWARD MODELS (ORMS)",
166
+ "text_level": 1,
167
+ "page_idx": 3
168
+ },
169
+ {
170
+ "type": "text",
171
+ "text": "We train ORMs following a similar methodology to Cobbe et al. (2021). We uniformly sample a fixed number of solutions per problem from the generator, and we train the ORM to predict whether each solution is correct or incorrect. In practice, we usually determine correctness by automatically checking the final answer, but in principle these labels could be provided by humans. At test time, we use the ORM’s prediction at the final token as the overall score for the solution. We note the automatic grading used to determine ORM targets is not perfectly reliable: false positives solutions that reach the correct answer with incorrect reasoning will be misgraded. We discuss additional ORM training details in Appendix E. ",
172
+ "page_idx": 3
173
+ },
174
+ {
175
+ "type": "text",
176
+ "text": "2.6 PROCESS-SUPERVISED REWARD MODELS (PRMS) ",
177
+ "text_level": 1,
178
+ "page_idx": 3
179
+ },
180
+ {
181
+ "type": "text",
182
+ "text": "We train PRMs to predict the correctness of each step after the last token in each step. This prediction takes the form of a single token, and we maximize the log-likelihood of these target tokens during training. The PRM can therefore be trained in a standard language model pipeline without any special accommodations. To determine the step-level predictions at test time, it suffices to perform a single PRM forward pass over the whole solution. We visualize large-scale PRM scores for two different solutions in Figure 2. To compare multiple solutions, it is necessary to compute a single score for each solution. This is an important but straightforward detail: we define the PRM score for a solution to be the probability that every step is correct under the PRM. We implement this as the product of the correctness probabilities for each step. We describe other possible scoring strategies and additional PRM training details in Appendix F. ",
183
+ "page_idx": 3
184
+ },
185
+ {
186
+ "type": "image",
187
+ "img_path": "images/398f5a02dd00061aad73e4de4fa19d24d32181d5e28eb16c797a16c66222f22d.jpg",
188
+ "image_caption": [
189
+ "Figure 3: A comparison of outcome-supervised and process-supervised reward models, evaluated by their ability to search over many test solutions. Majority voting is shown as a strong baseline. For $N \\leq 1 0 0 0$ , we visualize the variance across many subsamples of the 1860 solutions we generated in total per problem. "
190
+ ],
191
+ "image_footnote": [],
192
+ "page_idx": 4
193
+ },
194
+ {
195
+ "type": "text",
196
+ "text": "When we provide process supervision, we deliberately choose to supervise only up to the first incorrect step. This makes the comparison between outcome and process supervision more straightforward. For correct solutions, both methods provide the same information, namely that every step is correct. For incorrect solutions, both methods reveal the existence of at least one mistake, and process supervision additionally reveals the precise location of that mistake. If we were to provide additional process supervision beyond the first mistake, then process supervision would have an even greater information advantage. This decision also keeps the labelling cost similar for humans: without relying on an easy-to-check final answer, determining the correctness of a solution is equivalent to identifying its first mistake. While most MATH problems do have easy-to-check final answers, we expect this to not remain true in more complex domains. ",
197
+ "page_idx": 4
198
+ },
199
+ {
200
+ "type": "text",
201
+ "text": "3 LARGE-SCALE SUPERVISION ",
202
+ "text_level": 1,
203
+ "page_idx": 4
204
+ },
205
+ {
206
+ "type": "text",
207
+ "text": "We train the large-scale PRM using the step-level labels in PRM800K. To ensure the large-scale ORM baseline is as strong as possible, we train on 100 uniform samples per problem from the generator. This means the ORM training set has no overlap with PRM800K, and it is an order of magnitude larger. Although these two training sets are not directly comparable, each represents our best attempt to advance the state-of-the-art with each form of supervision. We note that training the ORM solely on PRM800K solutions would be problematic, since our active learning strategy has heavily biased the dataset towards wrong-answer solutions. We did explore training the ORM on a superset of PRM800K solutions, by mixing in uniformly sampled solutions, but we found that this did not improve ORM performance. ",
208
+ "page_idx": 4
209
+ },
210
+ {
211
+ "type": "text",
212
+ "text": "Figure 3 shows how the best-of-N performance of each reward model varies as a function of N. Since majority voting is known to be a strong baseline (Wang et al., 2022; Lewkowycz et al., 2022), we also include this method as a point of comparison. While the ORM performs slightly better than the majority voting baseline, the PRM strongly outperforms both. Not only does the PRM reach higher performance for all values of N, but the performance gap widens as $_ \\mathrm { N }$ increases. This indicates that the PRM is more effective than both the ORM and majority voting at searching over a large number of model-generated solutions. We experimented with using RM-weighted voting (Li et al., 2022; Uesato et al., 2022) to combine the benefits of the PRM and majority voting, but this did not noticeably improve performance. We use a specific subset of the MATH test set for evaluation, ",
213
+ "page_idx": 4
214
+ },
215
+ {
216
+ "type": "text",
217
+ "text": "(a) Four series of reward models trained using different data collection strategies, compared across training sets of varying sizes. ",
218
+ "page_idx": 5
219
+ },
220
+ {
221
+ "type": "image",
222
+ "img_path": "images/edb438b96f27cee4f7ef693c85efeb4c0a306f6511f0f1f06e41416d703a4825.jpg",
223
+ "image_caption": [
224
+ "(b) Three reward models trained on 200 samples/problem using different forms of supervision, compared across many test-time compute budgets. "
225
+ ],
226
+ "image_footnote": [],
227
+ "page_idx": 5
228
+ },
229
+ {
230
+ "type": "image",
231
+ "img_path": "images/6dd60f6e10154fb701edb07b45f03fbe4c44c49cc9b9be4a11687d6b16d3bde6.jpg",
232
+ "image_caption": [],
233
+ "image_footnote": [],
234
+ "page_idx": 5
235
+ },
236
+ {
237
+ "type": "text",
238
+ "text": "Figure 4: A comparison of different forms of outcome and process supervision. Mean and standard deviation is shown across three seeds. ",
239
+ "page_idx": 5
240
+ },
241
+ {
242
+ "type": "text",
243
+ "text": "which we describe in Appendix C. We further break down these results by problem difficulty in Appendix G. ",
244
+ "page_idx": 5
245
+ },
246
+ {
247
+ "type": "text",
248
+ "text": "4 SMALL-SCALE SYNTHETIC SUPERVISION ",
249
+ "text_level": 1,
250
+ "page_idx": 5
251
+ },
252
+ {
253
+ "type": "text",
254
+ "text": "We find that the PRM outperforms the ORM at large-scale, but this result alone paints an incomplete picture. To better compare outcome and process supervision, there are two confounding factors that must be isolated. First, the training sets for the ORM and the PRM are not directly comparable: the PRM training set was constructed using active learning, is biased towards answer-incorrect solutions, and is an order of magnitude smaller. Second, the final-answer grading will provide positive labels to spurious solutions that reach the correct final answer despite incorrect reasoning. This could damage ORM performance, an effect we may or may not want to attribute to outcome supervision more generally. ",
255
+ "page_idx": 5
256
+ },
257
+ {
258
+ "type": "text",
259
+ "text": "Due to the high cost of collecting human feedback, we cannot easily ablate these factors using human labelers. We instead perform the relevant ablations by using the large-scale PRM to supervise smaller models. This setup enables us to simulate a large amount of data collection at a modest cost. For the remainder of this section, we refer to the large-scale PRM from Section 3 as $\\mathrm { P R M _ { l a r g e } }$ . ",
260
+ "page_idx": 5
261
+ },
262
+ {
263
+ "type": "text",
264
+ "text": "4.1 PROCESS VS OUTCOME SUPERVISION",
265
+ "text_level": 1,
266
+ "page_idx": 5
267
+ },
268
+ {
269
+ "type": "text",
270
+ "text": "We now conduct a direct comparison of outcome and process supervision. We first sample between 1 and 200 solutions per problem from a small-scale generator. For each dataset, we provide three forms of supervision: process supervision from $\\mathrm { P R M _ { l a r g e } }$ , outcome supervision from $\\mathrm { P R M _ { l a r g e } }$ , and outcome supervision from final-answer checking. The choice of supervision is the only difference between these three series of reward models, which are otherwise trained on identical datasets. See Appendix H for more details about how $\\mathrm { P R M _ { l a r g e } }$ is used for outcome and process supervision. ",
271
+ "page_idx": 5
272
+ },
273
+ {
274
+ "type": "text",
275
+ "text": "In Figure 4a, we evaluate each reward model by its best-of-500 selection. We see that process supervision significantly outperforms both forms of outcome supervision at all data collection scales. In Figure 4b, we evaluate the best reward model from each series by its best-of-N performance across different values of N. We see that using $\\mathrm { P R M _ { l a r g e } }$ for outcome supervision is noticeably more effective than final-answer checking. This can be explained by the fact that $\\mathrm { P R M _ { l a r g e } }$ provides better supervision for solutions that reach the correct final answer using incorrect reasoning. ",
276
+ "page_idx": 5
277
+ },
278
+ {
279
+ "type": "text",
280
+ "text": "It is not clear whether supervision by $\\mathrm { P R M _ { l a r g e } }$ or by final-answer checking represents the more appropriate outcome supervision baseline. While final-answer supervision is more explicitly outcome based, its main weakness — the existence of false positives — is arguably over-emphasized in the ",
281
+ "page_idx": 5
282
+ },
283
+ {
284
+ "type": "table",
285
+ "img_path": "images/64d4b2f3243cd6b999f0aa2b7a5a46b3c5f9307d73b100fd22a8b6e3061eccd8.jpg",
286
+ "table_caption": [
287
+ "Table 1: We measure out-of-distribution generalization using recent STEM tests. We evaluate the outcome-supervised RM, the process-supervised RM, and majority voting using 100 test samples per problem. "
288
+ ],
289
+ "table_footnote": [],
290
+ "table_body": "<table><tr><td></td><td>ORM</td><td>PRM</td><td>Majority Vote</td><td>#Problems</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>AP Calculus</td><td>68.9%</td><td>86.7%</td><td>80.0%</td><td>45</td></tr><tr><td>AP Chemistry</td><td>68.9%</td><td>80.0%</td><td>71.7%</td><td>60</td></tr><tr><td>AP Physics</td><td>77.8%</td><td>86.7%</td><td>82.2%</td><td>45</td></tr><tr><td>AMC10/12</td><td>49.1%</td><td>53.2%</td><td>32.8%</td><td>84</td></tr><tr><td>Aggregate</td><td>63.8%</td><td>72.9%</td><td>61.3%</td><td>234</td></tr></table>",
291
+ "page_idx": 6
292
+ },
293
+ {
294
+ "type": "text",
295
+ "text": "MATH dataset. Outcome supervision by $\\mathrm { P R M _ { l a r g e } }$ better represents outcome supervision in domains that are less susceptible to false positives. We consider outcome supervision by $\\mathrm { P R M _ { l a r g e } }$ to be the more relevant baseline, but we encourage the reader to draw their own conclusions. ",
296
+ "page_idx": 6
297
+ },
298
+ {
299
+ "type": "text",
300
+ "text": "4.2 ACTIVE LEARNING ",
301
+ "text_level": 1,
302
+ "page_idx": 6
303
+ },
304
+ {
305
+ "type": "text",
306
+ "text": "Finally, we investigate the impact of active learning. We train a small-scale reward model, $\\mathrm { P R M } _ { \\mathrm { s e l e c t o r } }$ , on a single sample from each problem, and we use this model to score 1000 samples per problem. To train each of our larger reward models, we select $N$ samples per problem such that $8 0 \\%$ are the most convincing (according to $\\mathrm { P R M } _ { \\mathrm { s e l e c t o r } } )$ ) wrong-answer samples, and $2 0 \\%$ are the most convincing samples that remain (right- or wrong-answer). We score the selected samples with $\\mathrm { P R M _ { l a r g e } }$ and train on those scores. This process ensures that all samples are relatively convincing under $\\mathrm { \\bar { P R M } } _ { \\mathrm { s e l e c t o r } }$ , that a large fraction are known to contain at least one mistake, and that our overall dataset is not too heavily biased toward wrong-answer solutions. Performance of this data labelling scheme is shown in Figure 4a. By comparing the slopes of the line of best fit with and without active learning, we estimate that this form of active learning is approximately $2 . 6 \\mathbf { x }$ more data efficient than uniform data labelling. We note that the model trained on the largest active learning dataset (200 samples per problem) appears to slightly underperform the expected trend line. Our best explanation for this observation is that 200 samples represents a significant fraction of the overall selection pool (1000 samples) and that this relative lack of diversity limits the possible upside from active learning. ",
307
+ "page_idx": 6
308
+ },
309
+ {
310
+ "type": "text",
311
+ "text": "We also performed a preliminary investigation into the impact of iteratively retraining $\\mathrm { P R M } _ { \\mathrm { s e l e c t o r } }$ throughout data collection. Between iterations, we re-trained $\\mathrm { P R M } _ { \\mathrm { s e l e c t o r } }$ using all currently labeled data. Unfortunately, we observed instability in this process which we were unable to diagnose. The resulting reward models performed no better than the models described above. We expect some form of iterative retraining to be beneficial in active learning, but we currently have no concrete evidence to support this claim. We consider this a compelling direction for future research. ",
312
+ "page_idx": 6
313
+ },
314
+ {
315
+ "type": "text",
316
+ "text": "5 OOD GENERALIZATION ",
317
+ "text_level": 1,
318
+ "page_idx": 6
319
+ },
320
+ {
321
+ "type": "text",
322
+ "text": "To get some measure of out-of-distribution generalization, we evaluate our large-scale ORM and PRM on a held-out set of 224 STEM questions, pulled from the most recent AP Physics, AP Calculus, AP Chemistry, AMC10, and AMC12 exams. Since these tests were released after the pre-training dataset was compiled, we can have high confidence that the model has not seen these problems. We report the best-of-100 performance of the ORM, PRM and majority voting in Table 1. We observe results similar to those in Section 3: the PRM outperforms both the ORM and majority voting. This shows us that the PRM can tolerate a modest amount of distribution shift and that its strong performance holds up on fresh test questions. ",
323
+ "page_idx": 6
324
+ },
325
+ {
326
+ "type": "text",
327
+ "text": "6 DISCUSSION ",
328
+ "text_level": 1,
329
+ "page_idx": 6
330
+ },
331
+ {
332
+ "type": "text",
333
+ "text": "6.1 CREDIT ASSIGNMENT ",
334
+ "text_level": 1,
335
+ "page_idx": 6
336
+ },
337
+ {
338
+ "type": "text",
339
+ "text": "One clear advantage of process supervision is that it provides more precise feedback than outcome supervision. A reward model trained with outcome supervision faces a difficult credit-assignment task — to generalize well, it must determine where an incorrect solution went wrong. This is particularly difficult for hard problems: most model-generated solutions contain an error somewhere, so the marginal value of a negative label from outcome supervision is low. In contrast, process supervision provides a richer signal: it specifies both how many of the first steps were in fact correct, as well as the precise location of the incorrect step. Process supervision makes credit assignment easier, and we believe that this explains its strong performance. ",
340
+ "page_idx": 6
341
+ },
342
+ {
343
+ "type": "text",
344
+ "text": "",
345
+ "page_idx": 7
346
+ },
347
+ {
348
+ "type": "text",
349
+ "text": "6.2 ALIGNMENT IMPACT ",
350
+ "text_level": 1,
351
+ "page_idx": 7
352
+ },
353
+ {
354
+ "type": "text",
355
+ "text": "Process supervision has several advantages over outcome supervision related to AI alignment. Process supervision is more likely to produce interpretable reasoning, since it encourages models to follow a process endorsed by humans. Process supervision is also inherently safer: it directly rewards an aligned chain-of-thought rather than relying on outcomes as a proxy for aligned behavior (Stuhlmuller & Byun, 2022). In contrast, outcome supervision is harder to scrutinize, and the prefer-¨ ences conveyed are less precise. In the worst case, the use of outcomes as an imperfect proxy could lead to models that become misaligned after learning to exploit the reward signal (Uesato et al., 2022; Cotra, 2022; Everitt et al., 2017). ",
356
+ "page_idx": 7
357
+ },
358
+ {
359
+ "type": "text",
360
+ "text": "In some cases, safer methods for AI systems can lead to reduced performance (Ouyang et al., 2022; Askell et al., 2021), a cost which is known as an alignment tax. In general, any alignment tax may hinder the adoption of alignment methods, due to pressure to deploy the most capable model. Our results show that process supervision in fact incurs a negative alignment tax. This could lead to increased adoption of process supervision, which we believe would have positive alignment sideeffects. It is unknown how broadly these results will generalize beyond the domain of math, and we consider it important for future work to explore the impact of process supervision in other domains. ",
361
+ "page_idx": 7
362
+ },
363
+ {
364
+ "type": "text",
365
+ "text": "6.3 TEST SET CONTAMINATION ",
366
+ "text_level": 1,
367
+ "page_idx": 7
368
+ },
369
+ {
370
+ "type": "text",
371
+ "text": "The test set of the MATH dataset contains problems that are discussed in several online venues, and it is likely that some of these problems appear in the pretraining dataset for our models. We attempted to remove all MATH problems from our MathMix dataset using string-matching heuristics, but since humans can post hard-to-detect rephrasings of a problem online, it is difficult to make any strong guarantees about the overlap between MathMix and the MATH dataset. ",
372
+ "page_idx": 7
373
+ },
374
+ {
375
+ "type": "text",
376
+ "text": "In our experience inspecting model-generated solutions, we saw no clear signs of our models memorizing MATH problems. However, it is impossible to rule out subtle forms of memorization that would slip past manual inspection, and it is still possible that some degree of contamination has slightly inflated our performance on the MATH test set. Even in that case, we would expect any contamination to manifest similarly across all methods, and that the relative comparisons made throughout this work would remain mostly unaffected. ",
377
+ "page_idx": 7
378
+ },
379
+ {
380
+ "type": "text",
381
+ "text": "We also note that the PRM regularly surfaces correct solutions to MATH problems that have a low single-digit percentage solve-rate under the generator, some examples of which can be seen in Appendix I. The generator’s low solve-rate is an additional indication that it has not encountered such problems via test set contamination. Our generalization results from Section 5 further strengthen our claim that test set contamination has not significantly impacted this work, since we observe qualitatively similar results on problems that are guaranteed to be uncontaminated. ",
382
+ "page_idx": 7
383
+ },
384
+ {
385
+ "type": "text",
386
+ "text": "7 RELATED WORK ",
387
+ "text_level": 1,
388
+ "page_idx": 7
389
+ },
390
+ {
391
+ "type": "text",
392
+ "text": "7.1 OUTCOME VS PROCESS SUPERVISION",
393
+ "text_level": 1,
394
+ "page_idx": 7
395
+ },
396
+ {
397
+ "type": "text",
398
+ "text": "In work closely related to our own, Uesato et al. (2022) compare the impact of outcome and process supervision in the domain of grade school math. They found that both methods led to similar finalanswer error rates, and that process supervision achieved those results with less data. While our core methodology is very similar, there are three main details that differ. First, we use a more capable model to collect PRM800K dataset and to perform our large-scale experiments. However, our small-scale results in Section 4 suggest that large-scale models are not necessary to observe benefits from process supervision. Second, we evaluate on the MATH dataset, which is significantly more challenging than GSM8K. Third, we collect a much larger quantity of process supervision data. ",
399
+ "page_idx": 7
400
+ },
401
+ {
402
+ "type": "text",
403
+ "text": "",
404
+ "page_idx": 8
405
+ },
406
+ {
407
+ "type": "text",
408
+ "text": "On the surface, the results from Uesato et al. (2022) may seem to conflict with our claim that process supervision leads to better performance. However, we believe the apparent conflict can be explained by the difference in the scale of the supervision. The data scaling trend in Figure 4a suggests that a small amount of process supervision and a large amount of outcome supervision do in fact lead to similar performance, consistent with the results from Uesato et al. (2022). The trend also shows that process supervision beats outcome supervision when scaled up, even when judged based solely on outcomes. This is consistent with our results in Section 3. We believe these results make a strong case for using process supervision. ",
409
+ "page_idx": 8
410
+ },
411
+ {
412
+ "type": "text",
413
+ "text": "7.2 SYNTHETIC SUPERVISION ",
414
+ "text_level": 1,
415
+ "page_idx": 8
416
+ },
417
+ {
418
+ "type": "text",
419
+ "text": "Similar to our work in Section 4, Gao et al. (2022) use a large reward model to supervise the training of smaller models. They study the over-optimization that occurs during RLHF, with experiments that require large quantities of human preference data. To work around this challenge, they use a gold-standard reward model to replace human feedback. Our use of a large-scale reward model to supervise smaller reward models shares similarities with their approach. ",
420
+ "page_idx": 8
421
+ },
422
+ {
423
+ "type": "text",
424
+ "text": "7.3 NATURAL LANGUAGE REASONING ",
425
+ "text_level": 1,
426
+ "page_idx": 8
427
+ },
428
+ {
429
+ "type": "text",
430
+ "text": "Several recent studies that have examined the reasoning ability of large language models are implicitly relevant to our work. Lewkowycz et al. (2022) showed that finetuning models on a large corpus of technical content led to significantly improved performance on MATH. Wang et al. (2022) showed that self-consistency leads to remarkably strong performance on many reasoning benchmarks, notably without requiring any additional finetuning. Wei et al. (2022) and Nye et al. (2021) demonstrate the importance of explicitly performing intermediate reasoning steps via a chain of thought or a scratchpad in order to solve tasks that require multi-step reasoning. Kojima et al. (2022) show that models are able to perform this behavior zero-shot, conditioned only on a simple prompt. ",
431
+ "page_idx": 8
432
+ },
433
+ {
434
+ "type": "text",
435
+ "text": "8 CONCLUSION ",
436
+ "text_level": 1,
437
+ "page_idx": 8
438
+ },
439
+ {
440
+ "type": "text",
441
+ "text": "We have shown that process supervision can be used to train much more reliable reward models than outcome supervision in the domain of mathematical reasoning. We have also shown that active learning can be used to lower the cost of human data collection by surfacing only the most valuable model completions for human feedback. We release PRM800K, the full dataset of human feedback used to train our state-of-the-art reward model, with the hope that removing this significant barrier to entry will catalyze related research on the alignment of large language models. We believe that process supervision is currently under-explored, and we are excited for future work to more deeply investigate the extent to which these methods generalize. ",
442
+ "page_idx": 8
443
+ },
444
+ {
445
+ "type": "text",
446
+ "text": "ACKNOWLEDGMENTS ",
447
+ "text_level": 1,
448
+ "page_idx": 8
449
+ },
450
+ {
451
+ "type": "text",
452
+ "text": "We thank Joshua Achiam, Mark Chen, Jonathan Gordon, Dan Hendrycks, Lukasz Kaiser, Oleg Murk, Ben Sokolowsky, Francis Song, and Jonathan Uesato for valuable feedback and thoughtful discussions; Giambattista Parascandolo and Daniel Selsam for their contributions to the MathMix dataset; Jonathan Ward for contributing to the data collection interface; Wojciech Zaremba for encouraging us to scale up data collection; Peter Hoeschele and Aris Kostantinidis for supporting our data collection; the research acceleration and supercomputing teams at OpenAI for providing infrastructure support; and the team at Scale and the many data-labelers who created PRM800K. ",
453
+ "page_idx": 8
454
+ },
455
+ {
456
+ "type": "text",
457
+ "text": "REPRODUCIBILITY STATEMENT ",
458
+ "text_level": 1,
459
+ "page_idx": 8
460
+ },
461
+ {
462
+ "type": "text",
463
+ "text": "To assist reproducibility and further research we are releasing all of the labels that we gathered over the course of this project. Appendix B contains information about the dataset, what data was used for training, and a link to the repository containing the raw labels. Appendix C explains our evaluation methods. Finally, Appendix E and Appendix F explain how we trained our ORMs and PRMs. ",
464
+ "page_idx": 8
465
+ },
466
+ {
467
+ "type": "text",
468
+ "text": "REFERENCES ",
469
+ "text_level": 1,
470
+ "page_idx": 9
471
+ },
472
+ {
473
+ "type": "text",
474
+ "text": "Amanda Askell, Yuntao Bai, Anna Chen, Dawn Drain, Deep Ganguli, Tom Henighan, Andy Jones, Nicholas Joseph, Ben Mann, Nova DasSarma, et al. A general language assistant as a laboratory for alignment. arXiv preprint arXiv:2112.00861, 2021. ",
475
+ "page_idx": 9
476
+ },
477
+ {
478
+ "type": "text",
479
+ "text": "Sebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Ka- ´ mar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023. \nPaul 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. \nKarl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. \nAjeya Cotra. Without specific countermeasures, the easiest path to transformative AI likely leads to AI takeover. https://www.alignmentforum.org/posts/pRkFkzwKZ2zfa3R6H/ without-specific-countermeasures-the-easiest-path-to, 2022. \nAntonia Creswell, Murray Shanahan, and Irina Higgins. Selection-inference: Exploiting large language models for interpretable logical reasoning. arXiv preprint arXiv:2205.09712, 2022. \nTom Everitt, Victoria Krakovna, Laurent Orseau, Marcus Hutter, and Shane Legg. Reinforcement learning with a corrupted reward channel. arXiv preprint arXiv:1705.08417, 2017. \nLeo Gao, John Schulman, and Jacob Hilton. Scaling laws for reward model overoptimization. arXiv preprint arXiv:2210.10760, 2022. \nDan Hendrycks, Collin Burns, Saurav Kadavath, Akul Arora, Steven Basart, Eric Tang, Dawn Song, and Jacob Steinhardt. Measuring mathematical problem solving with the math dataset. arXiv preprint arXiv:2103.03874, 2021. \nTakeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. arXiv preprint arXiv:2205.11916, 2022. \nAitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, et al. Solving quantitative reasoning problems with language models. arXiv preprint arXiv:2206.14858, 2022. \nYifei Li, Zeqi Lin, Shizhuo Zhang, Qiang Fu, Bei Chen, Jian-Guang Lou, and Weizhu Chen. On the advance of making language models better reasoners. arXiv preprint arXiv:2206.02336, 2022. \nJoshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. On faithfulness and factuality in abstractive summarization. arXiv preprint arXiv:2005.00661, 2020. \nReiichiro Nakano, Jacob Hilton, Suchir Balaji, Jeff Wu, Long Ouyang, Christina Kim, Christopher Hesse, Shantanu Jain, Vineet Kosaraju, William Saunders, et al. Webgpt: Browser-assisted question-answering with human feedback. arXiv preprint arXiv:2112.09332, 2021. \nEric Nichols, Leo Gao, and Randy Gomez. Collaborative storytelling with large-scale neural language models. In Proceedings of the 13th ACM SIGGRAPH Conference on Motion, Interaction and Games, pp. 1–10, 2020. \nMaxwell Nye, Anders Johan Andreassen, Guy Gur-Ari, Henryk Michalewski, Jacob Austin, David Bieber, David Dohan, Aitor Lewkowycz, Maarten Bosma, David Luan, et al. Show your work: Scratchpads for intermediate computation with language models. arXiv preprint arXiv:2112.00114, 2021. \nOpenAI. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023. \nLong Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. arXiv preprint arXiv:2203.02155, 2022. \nJianhao Shen, Yichun Yin, Lin Li, Lifeng Shang, Xin Jiang, Ming Zhang, and Qun Liu. Generate & rank: A multi-task framework for math word problems. arXiv preprint arXiv:2109.03034, 2021. \nNisan Stiennon, Long Ouyang, Jeffrey Wu, Daniel Ziegler, Ryan Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul F Christiano. Learning to summarize with human feedback. Advances in Neural Information Processing Systems, 33:3008–3021, 2020. \nAndreas Stuhlmuller and Jungwon Byun. Supervise process, not outcomes. ¨ https://ought. org/updates/2022-04-06-process, 2022. \nJonathan Uesato, Nate Kushman, Ramana Kumar, Francis Song, Noah Siegel, Lisa Wang, Antonia Creswell, Geoffrey Irving, and Irina Higgins. Solving math word problems with process-and outcome-based feedback. arXiv preprint arXiv:2211.14275, 2022. \nXuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022. \nJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. arXiv preprint arXiv:2201.11903, 2022. \nEric Zelikman, Yuhuai Wu, Jesse Mu, and Noah Goodman. Star: Bootstrapping reasoning with reasoning. Advances in Neural Information Processing Systems, 35:15476–15488, 2022. \nDaniel M Ziegler, Nisan Stiennon, Jeffrey Wu, Tom B Brown, Alec Radford, Dario Amodei, Paul Christiano, and Geoffrey Irving. Fine-tuning language models from human preferences. arXiv ",
480
+ "page_idx": 9
481
+ },
482
+ {
483
+ "type": "text",
484
+ "text": "",
485
+ "page_idx": 10
486
+ },
487
+ {
488
+ "type": "text",
489
+ "text": "preprint arXiv:1909.08593, 2019. ",
490
+ "page_idx": 10
491
+ },
492
+ {
493
+ "type": "text",
494
+ "text": "A MATHMIX ",
495
+ "text_level": 1,
496
+ "page_idx": 11
497
+ },
498
+ {
499
+ "type": "text",
500
+ "text": "Similar to Lewkowycz et al. (2022) we construct a large-scale dataset of high-quality math-relevant tokens for use in a lightweight pretraining stage, before finetuning on comparably smaller datasets like MATH and PRM800K. This dataset, which we call MathMix, has two main differences compared to the one used to train Minerva. First, it is smaller and more aggressively filtered to highquality math problem-solving content, and second, it does not explicitly mix in general language data. ",
501
+ "page_idx": 11
502
+ },
503
+ {
504
+ "type": "text",
505
+ "text": "Minerva was trained on 38.5B tokens of arXiv documents and webscrape pages with LaTeX content, while MathMix consists of a smaller set of 1.5B tokens containing individual math problems and their solutions, free-form text discussing math problems and concepts, and synthetic data (Table 2). While Minerva was pretrained on a dataset with $5 \\%$ general natural language data, we chose not to mix in any natural language data explicitly, primarily because MathMix already contains plenty of natural language data. ",
506
+ "page_idx": 11
507
+ },
508
+ {
509
+ "type": "table",
510
+ "img_path": "images/b9e68050630c140fba83beb46263fd99659cee23a4f05d3703a78ee9a88630c9.jpg",
511
+ "table_caption": [
512
+ "Table 2: MathMix dataset components. "
513
+ ],
514
+ "table_footnote": [],
515
+ "table_body": "<table><tr><td>Data type</td><td>Token count </td><td>Present in pretraining?</td></tr><tr><td>Math problems and solutions</td><td>~275M</td><td>No</td></tr><tr><td>Free-form math discussion text (1)</td><td>~430M</td><td>No</td></tr><tr><td>Free-form math discussion text (2)</td><td>~ 450M</td><td>Yes</td></tr><tr><td>Synthetic data (1)</td><td>~30M</td><td>No</td></tr><tr><td>Synthetic data (2)</td><td>~100M</td><td>Yes</td></tr><tr><td>Critiques grading data</td><td>~ 500M</td><td>No</td></tr><tr><td></td><td></td><td></td></tr></table>",
516
+ "page_idx": 11
517
+ },
518
+ {
519
+ "type": "text",
520
+ "text": "Note that when training smaller models, as in Section 4, we use a slightly smaller variant of MathMix that excludes the critiques data and only consists of 1B tokens. For our large models experiments, we train on MathMix for roughly 3B tokens (2 epochs). For our small models experiments, we train for 6 epochs (roughly 6.6B tokens). ",
521
+ "page_idx": 11
522
+ },
523
+ {
524
+ "type": "text",
525
+ "text": "We apply a set of decontamination checks on MathMix against the test split of the MATH dataset, including stripping out LaTeX and searching for matching n-grams, but we can make no strong guarantees on the efficacy of this decontamination. As discussed in Section 6.3, we would not expect the relative comparisons made throughout this work to be significantly impacted by test set contamination. ",
526
+ "page_idx": 11
527
+ },
528
+ {
529
+ "type": "text",
530
+ "text": "B PRM800K ",
531
+ "text_level": 1,
532
+ "page_idx": 12
533
+ },
534
+ {
535
+ "type": "text",
536
+ "text": "We collected 1,085,590 step-level labels over 101,599 solution samples. We present the whole unfiltered dataset as PRM800K. During training we discard labels used for quality control, as well as any step-level labels for which the labeler was unable to complete the task. The filtered dataset contains about 800,000 step-level labels over 75,000 solutions. The full PRM800K dataset is available at https://github.com/openai/prm800k. ",
537
+ "page_idx": 12
538
+ },
539
+ {
540
+ "type": "text",
541
+ "text": "The data collection was split into two separate phases. In phase 1, we collected labels for multiple alternative completions at each step of a solution. This seeded our dataset but was cumbersome— for many steps the alternatives were repetitive, and we found labelers spent a lot of time supervising long uninteresting solutions. As a result, the step-level labels we collected in this phase are more repetitive than those collected later. In total, phase 1 represents about $5 \\%$ of PRM800K, or about 40,000 step-level labels. ",
542
+ "page_idx": 12
543
+ },
544
+ {
545
+ "type": "text",
546
+ "text": "The majority of our labels were collected as part of phase 2, during which we scaled up and streamlined the data collection process. Phase 2 data collection is split into 10 generations. For each generation, we sample $N$ solutions per problem from the generator. We rank these solutions with our current best PRM and surface the highest scoring wrong-answer solutions to our labelers. We retrain this PRM between each generation using all the latest data. This active learning strategy changes the balance of our data considerably. Though we sometimes surfaced correct solutions (either by manually injecting correct solutions or because of errors in our automatic grading), the vast majority of the labels we collected in this phase are for incorrect solutions. Table 3 breaks down the balance of correct/incorrect steps and solutions between the different phases of data collection. Though we mostly collected labels on incorrect solutions, we still collected many labels for correct individual steps. In fact, our small-scale ablations in Section 4.2 suggest that this active learning strategy, which favors labelling high-scoring wrong-answer solutions, improves performance despite the resulting imbalance in the dataset. ",
547
+ "page_idx": 12
548
+ },
549
+ {
550
+ "type": "table",
551
+ "img_path": "images/1d6a002d5231df6c1c982d4cc1f897335c182551d542fa70c090579f647d669c.jpg",
552
+ "table_caption": [
553
+ "Table 3: Distribution of positive/negative steps/solutions. "
554
+ ],
555
+ "table_footnote": [],
556
+ "table_body": "<table><tr><td></td><td>phase 1</td><td>phase 2</td><td>combined</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>% end in correct solution</td><td>85.1</td><td>13.2</td><td>14.2</td></tr><tr><td>% correct steps</td><td>58.6</td><td>74.1</td><td>73.1</td></tr></table>",
557
+ "page_idx": 12
558
+ },
559
+ {
560
+ "type": "text",
561
+ "text": "Some of our phase 2 questions are intended for quality control. For a quality control question, researchers mark which steps are reasonable to label as incorrect. Then we assess that labelers are able to consistently mark those steps as incorrect. Prior to starting on phase 2, we required all labelers to label 30 quality control questions. This served as a screening test, and we only admitted labelers that agreed with our gold labels at least $7 5 \\%$ of the time. ",
562
+ "page_idx": 12
563
+ },
564
+ {
565
+ "type": "text",
566
+ "text": "We then designated 10-20 problems per generation as additional quality control questions, and we randomly served them to labelers as they worked through the task. We used the results of this continuous quality control to remove labelers whose quality slipped too far, as well as to prepare educational material on common mistakes in order to improve labeler alignment with our instructions. ",
567
+ "page_idx": 12
568
+ },
569
+ {
570
+ "type": "text",
571
+ "text": "C EVALUATION ",
572
+ "text_level": 1,
573
+ "page_idx": 12
574
+ },
575
+ {
576
+ "type": "text",
577
+ "text": "As we scaled up the project, we began having to collect labels on multiple solutions for the same training problem. In order to avoid the risk of over-fitting on the 7,500 MATH training problems, we expanded the training set to include 4,500 MATH test split problems. We therefore evaluate our models only on the remaining 500 held-out problems. We selected these 500 test problems uniformly at random. In Figure 5, we show that the distribution of difficulty levels and subjects in this subset is representative of the MATH test set as a whole. The specific test set we used can be found at https://github.com/openai $/ \\mathrm { p r m } 8 0 0 \\mathrm { k }$ . We leave it for future work to explore how many distinct training problems are actually necessary, and how quickly our methods overfit to the training set. ",
578
+ "page_idx": 12
579
+ },
580
+ {
581
+ "type": "image",
582
+ "img_path": "images/68b0f55ecfe175af16990e7d464701ba8ed6b1bea6e450500df406bfc0f706d0.jpg",
583
+ "image_caption": [
584
+ "Figure 5: Two histograms comparing the distribution of problem difficulty levels and subjects in both the original MATH test set and in our 500 problem test subset. "
585
+ ],
586
+ "image_footnote": [],
587
+ "page_idx": 13
588
+ },
589
+ {
590
+ "type": "text",
591
+ "text": "D LABELLING INSTRUCTIONS ",
592
+ "text_level": 1,
593
+ "page_idx": 13
594
+ },
595
+ {
596
+ "type": "text",
597
+ "text": "Labelers were tasked to look at steps in a solution and label each one as positive, negative, or neutral. A step is considered neutral if it is appropriate in context, reasonable, correct, and contains only computations that can be verified easily. A step is positive if it is neutral and also progresses towards the solution. All other steps are considered negative. Labelers were not given reference solutions, but they were given the ground truth final answers. We chose not to provide reference solutions to avoid biasing them towards one particular path to the solution. We chose to provide ground truth final answers since this information can sometimes help labelers resolve their own misunderstandings. ",
598
+ "page_idx": 13
599
+ },
600
+ {
601
+ "type": "text",
602
+ "text": "In phase 1, labelers were permitted to enter their own steps in the case that all candidate steps were negative. Then the solution would progress from a randomly selected positive step (or neutral if their were no positive ones). This often resulted in trajectories that got stuck in endless sequences of neutral steps that said reasonable things but made frustratingly slow progress towards a solution or negative steps that needed constant human supervision. In phase 2, we pre-generate whole solutions and end the task as soon as the first negative step is encountered. The full instructions given to labelers can be found at https://github.com/openai/prm800k/tree/main/prm800k/instructions. ",
603
+ "page_idx": 13
604
+ },
605
+ {
606
+ "type": "text",
607
+ "text": "E ORM TRAINING DETAILS ",
608
+ "text_level": 1,
609
+ "page_idx": 13
610
+ },
611
+ {
612
+ "type": "text",
613
+ "text": "We train outcome-supervised reward models in the same manner as token-level verifiers from Cobbe et al. (2021), with a few subtle differences to hyperparameters. In particular, we only train for a single epoch on each dataset of model samples and reward model labels, without dropout, and without jointly learning a language modeling objective. We find that performance is not sensitive to most other hyperparameters, within a reasonable range. ",
614
+ "page_idx": 13
615
+ },
616
+ {
617
+ "type": "text",
618
+ "text": "To collect model samples, we simply sample uniformly from the generator at a temperature of 1.0 without applying any rebalancing of positives or negatives. At training time, the reward model makes predictions for every token in the context. The target for each token in a solution is the same, based on whether the solution is labelled correct or incorrect. At test time, we simply use the score of the final token in the completion as the overall score of the solution. We note that this setup is identical to the way token-level verifiers were trained in Cobbe et al. (2021). ",
619
+ "page_idx": 13
620
+ },
621
+ {
622
+ "type": "text",
623
+ "text": "F PRM DETAILS ",
624
+ "text_level": 1,
625
+ "page_idx": 14
626
+ },
627
+ {
628
+ "type": "text",
629
+ "text": "F.1 TRAINING ",
630
+ "text_level": 1,
631
+ "page_idx": 14
632
+ },
633
+ {
634
+ "type": "text",
635
+ "text": "We train our PRMs by fine-tuning the MathMix model to predict the probability of positive, negative, and neutral labels given a solution prefix ending in one of our labeled steps. We sweep over hyperparameters using a dataset containing the first $\\sim 1 0 \\%$ of PRM800K. Fine-tuning an LLM from its ordinary language modeling task to a classification task like this is a large distribution shift, and we found low learning rates were important to stable PRM training. ",
636
+ "page_idx": 14
637
+ },
638
+ {
639
+ "type": "text",
640
+ "text": "All of our PRMs are trained for 2 epochs. On smaller datasets (such as in phase 1 and the first few generations of phase 2) this improves the final performance over training for just 1 epoch. Additional epochs, up to some point, don’t noticeably help or hurt performance. On larger datasets, the benefits of 2 epoch training diminishes, but we continue doing it for consistency. ",
641
+ "page_idx": 14
642
+ },
643
+ {
644
+ "type": "text",
645
+ "text": "F.2 SCORING ",
646
+ "text_level": 1,
647
+ "page_idx": 14
648
+ },
649
+ {
650
+ "type": "text",
651
+ "text": "There are multiple ways of using the PRM to score solutions. In general, we produce a single solution-level score by performing a reduction over step-level scores, where the step-level score is the probability that the step’s label is positive. This involves two specific implementation decisions. First, when determining a step-level score, we either consider a neutral label to be positive or negative. Second, when determining a solution-level score, we either use the minimum or the product over step-level scores as a reduction. ",
652
+ "page_idx": 14
653
+ },
654
+ {
655
+ "type": "text",
656
+ "text": "We show results from all four scoring strategies in Table 4. The best performing strategy is to take the product of step-level scores and to consider the neutrals as positives, but the difference in performance between all strategies is minor. Throughout the rest of this work, we consider neutral steps to be positive, and we define the solution score to be the product of step-level scores. Using the product instead of the minimum as the reduction does create a slight bias against solutions with a larger number of steps. ",
657
+ "page_idx": 14
658
+ },
659
+ {
660
+ "type": "table",
661
+ "img_path": "images/9893e47554728f19580b0a102050610a842551c0677f876e47907d50cf87e702.jpg",
662
+ "table_caption": [
663
+ "Table 4: Best-of-1860 test performance using the PRM with four different scoring strategies. "
664
+ ],
665
+ "table_footnote": [],
666
+ "table_body": "<table><tr><td></td><td>product</td><td>minimum</td></tr><tr><td></td><td></td><td></td></tr><tr><td>neutral = positive</td><td>78.2%</td><td>77.6%</td></tr><tr><td>neutral = negative</td><td>77.4%</td><td>77.8%</td></tr></table>",
667
+ "page_idx": 14
668
+ },
669
+ {
670
+ "type": "text",
671
+ "text": "G DIFFICULTY BREAKDOWN ",
672
+ "text_level": 1,
673
+ "page_idx": 15
674
+ },
675
+ {
676
+ "type": "text",
677
+ "text": "We show performance of our ORM and PRM on each quintile of the MATH dataset. We determine quintiles based on the pass rate under the generator. It is interesting to note that the performance gap is not only apparent on high difficulty problems: it is in fact apparent across all difficulties. For the lowest difficulty problems, we see that it is possible to find adversarial examples that fool the ORM, since the ORM’s performance slightly decreases as the number of samples increases. In contrast, the PRM remains highly robust over this same set of samples. ",
678
+ "page_idx": 15
679
+ },
680
+ {
681
+ "type": "text",
682
+ "text": "We also see that increasing the number of samples has the largest positive effect on the highest difficulty problems. This is to be expected, since a large number of generator samples may be required to find a true and convincing solution to a hard problem. ",
683
+ "page_idx": 15
684
+ },
685
+ {
686
+ "type": "image",
687
+ "img_path": "images/8450f287250109be7557d8552dd0b83880b5823695213a5396ab6cd42bdb000c.jpg",
688
+ "image_caption": [
689
+ "Figure 6: A breakdown of ORM vs PRM performance by problem difficulty. "
690
+ ],
691
+ "image_footnote": [],
692
+ "page_idx": 15
693
+ },
694
+ {
695
+ "type": "text",
696
+ "text": "H SYNTHETIC SUPERVISION DETAILS ",
697
+ "text_level": 1,
698
+ "page_idx": 16
699
+ },
700
+ {
701
+ "type": "text",
702
+ "text": "We can use $\\mathrm { P R M _ { l a r g e } }$ to provide either outcome or process supervision for smaller models. We determine the labels for individual steps based on the step-level probabilities outputted by $\\mathrm { P R M _ { l a r g e } }$ . To do this, we set an arbitrary threshold: any step that $\\mathrm { P R M _ { l a r g e } }$ assigns a negative label with greater than $20 \\%$ probability is considered incorrect. We choose this threshold based on the observation that $\\mathrm { P R M _ { l a r g e } }$ is slightly miscalibrated in the direction of favoring positive labels. ",
703
+ "page_idx": 16
704
+ },
705
+ {
706
+ "type": "text",
707
+ "text": "To provide process supervision for a solution, we directly return the step-level labels (positive or negative) provided by $\\mathrm { P R M _ { l a r g e } }$ , up until the first step that is marked as negative. This mimics our true human data collection process. To provide outcome supervision, we mark the solution as correct if and only if $\\mathrm { P R M _ { l a r g e } }$ considers every step to be correct (using the same thresholding logic). ",
708
+ "page_idx": 16
709
+ },
710
+ {
711
+ "type": "text",
712
+ "text": "I PRM VISUALIZATIONS ",
713
+ "text_level": 1,
714
+ "page_idx": 17
715
+ },
716
+ {
717
+ "type": "text",
718
+ "text": "All examples shown come from the large-scale generator (GPT-4). We note the pass-rate under the generator to give some sense of the difficulty of these problems. ",
719
+ "page_idx": 17
720
+ },
721
+ {
722
+ "type": "text",
723
+ "text": "I.1 TRUE POSITIVES ",
724
+ "text_level": 1,
725
+ "page_idx": 17
726
+ },
727
+ {
728
+ "type": "text",
729
+ "text": "These cherry-picked examples show the best-of-1860 solution from the generator as ranked by the large-scale PRM. ",
730
+ "page_idx": 17
731
+ },
732
+ {
733
+ "type": "text",
734
+ "text": "Problem 1. Generator pass-rate: $0 . 1 \\%$ . This challenging trigonometry problem requires applying several identities in a not-at-all obvious succession. Most solution attempts fail, because it is hard to choose which identities are actually helpful. Though successful solutions to this problem are rare, the reward model correctly recognizes when a valid chain-of-thought has been found. ",
735
+ "page_idx": 17
736
+ },
737
+ {
738
+ "type": "image",
739
+ "img_path": "images/b49cd8102ecf354e8a234cd1f0e421d1a1b1f65c4fac690d3ced5941e37c4bee.jpg",
740
+ "image_caption": [],
741
+ "image_footnote": [],
742
+ "page_idx": 17
743
+ },
744
+ {
745
+ "type": "text",
746
+ "text": "Problem 2. Generator pass-rate: $5 . 8 \\%$ . In step 7 and 8, the generator starts performing guessand-check. This is a common place the model might hallucinate, by claiming a particular guess is successful when it isn’t. In this case, the reward model verifies each step and determines that the chain-of-thought is correct. ",
747
+ "page_idx": 18
748
+ },
749
+ {
750
+ "type": "image",
751
+ "img_path": "images/03cac43323bcf76ab5d39d35080de64d0a273b4fa8989a088be9850931b25fb0.jpg",
752
+ "image_caption": [],
753
+ "image_footnote": [],
754
+ "page_idx": 18
755
+ },
756
+ {
757
+ "type": "text",
758
+ "text": "Problem 3. Generator pass-rate: $1 . 7 \\%$ . The generator successfully applies several trigonometric identities to simplify the expression. ",
759
+ "page_idx": 18
760
+ },
761
+ {
762
+ "type": "image",
763
+ "img_path": "images/3f4d188bcad1dfbcc6023a240ee47f7a7ea7839dbfd1015cc0d43918d114c635.jpg",
764
+ "image_caption": [],
765
+ "image_footnote": [],
766
+ "page_idx": 18
767
+ },
768
+ {
769
+ "type": "text",
770
+ "text": "Problem 4. Generator pass-rate: $4 . 5 \\%$ . Here, the generator successfully performs a complex series of polynomial factorizations. The use of the Sophie-Germain identity in step 5 is an important step that could be considered insightful. ",
771
+ "page_idx": 19
772
+ },
773
+ {
774
+ "type": "image",
775
+ "img_path": "images/66772c6cbe7783cf2e3c5ed3f309ab922ac1bf5b53f936b1897bfa344df11ac4.jpg",
776
+ "image_caption": [],
777
+ "image_footnote": [],
778
+ "page_idx": 19
779
+ },
780
+ {
781
+ "type": "text",
782
+ "text": "I.2 TRUE NEGATIVES ",
783
+ "text_level": 1,
784
+ "page_idx": 19
785
+ },
786
+ {
787
+ "type": "text",
788
+ "text": "Problem 5. Generator pass-rate: $4 . 5 \\%$ . The generator attempts to use the difference of squares formula in step 12 on an expression that isn’t in fact a difference of squares. The reward model catches this mistake. ",
789
+ "page_idx": 19
790
+ },
791
+ {
792
+ "type": "image",
793
+ "img_path": "images/19bf328a892b84877038770ef6c02f287e7e3bc480688cd02a3f84e54856d842.jpg",
794
+ "image_caption": [],
795
+ "image_footnote": [],
796
+ "page_idx": 19
797
+ },
798
+ {
799
+ "type": "text",
800
+ "text": "Problem 6. Generator pass-rate: $9 3 . 5 \\%$ . In step 7, the generator makes an incorrect attempt to simplify an expression. The reward model catches this mistake. ",
801
+ "page_idx": 20
802
+ },
803
+ {
804
+ "type": "image",
805
+ "img_path": "images/4c82528b60c8f2e29416c1872622b73f35787f67944dab503130eb6938a9556d.jpg",
806
+ "image_caption": [],
807
+ "image_footnote": [],
808
+ "page_idx": 20
809
+ },
810
+ {
811
+ "type": "text",
812
+ "text": "Problem 7. Generator pass-rate: $4 8 . 0 \\%$ . In step 11, the generator makes a simple calculation error. \nThe reward model catches this mistake. ",
813
+ "page_idx": 20
814
+ },
815
+ {
816
+ "type": "image",
817
+ "img_path": "images/7bf6ac2652580521f781b34ce2c1d15e82f9f29dd3aacb776e875f9aa58738c5.jpg",
818
+ "image_caption": [],
819
+ "image_footnote": [],
820
+ "page_idx": 20
821
+ },
822
+ {
823
+ "type": "text",
824
+ "text": "Answer:36 ",
825
+ "page_idx": 20
826
+ },
827
+ {
828
+ "type": "text",
829
+ "text": "Problem 8. Generator pass-rate: $5 . 8 \\%$ . The justification in step 8 is strange, but the reward model lets it slide. In step 9, though, the model incorrectly factors the expression. The reward model catches this mistake. ",
830
+ "page_idx": 21
831
+ },
832
+ {
833
+ "type": "text",
834
+ "text": "",
835
+ "page_idx": 21
836
+ },
837
+ {
838
+ "type": "table",
839
+ "img_path": "images/264d41451deeea7bb5c8a3941e65157160481ce5ecdf508551fc4848aa921684.jpg",
840
+ "table_caption": [],
841
+ "table_footnote": [],
842
+ "table_body": "<table><tr><td>Find the unique odd integer t such thatO&lt;t&lt;23 and t+2 is the inverse of t modulo 23 I need to find an odd integer t between O and 23 such that t +2 is the inverse of t modulo 23.</td></tr><tr><td>That means that t and t +2 multiply to give 1 modulo 23.</td></tr><tr><td></td></tr><tr><td>I can write this as t(t +2)=1 (mod 23).</td></tr><tr><td>I can try to guess and check values of t until I find one that works, but that might take a long time.</td></tr><tr><td>I can also try to use some properties of modular arithmetic to simplify the equation.</td></tr><tr><td>For example, I can subtract 23 from t + 2 and still get the same remainder modulo 23.</td></tr><tr><td>So I can write t(t +2)=t(t-21) (mod 23).</td></tr><tr><td>This looks simpler, because now I have a diference of two multiples of t.</td></tr><tr><td>I can factor out t and get t(t -21) = t(1 - 21) (mod 23).</td></tr><tr><td>Now I can divide both sides by t, as long as t is not a multiple of 23.</td></tr><tr><td>This gives me t - 21 = 1- 21 (mod 23).</td></tr><tr><td>I can simplify this further by adding 21 to both sides.</td></tr><tr><td>This gives me t = 1 (mod 23).</td></tr><tr><td>Thismeans that t has the same remainder as1 when divided by 23.</td></tr><tr><td>The smallest positive value of t that satisfies this is t = 1.</td></tr><tr><td>This is also an odd integer, so it meets the criteria of the problem.</td></tr><tr><td>I can check that t = 1 works by plugging it into the original equation. I get 1(1 +2) = 1 (mod 23), which is true.</td></tr><tr><td> Therefore, the unique odd integer t that satisfies the given conditions is t = 1.</td></tr><tr><td>Answer:1</td></tr></table>",
843
+ "page_idx": 21
844
+ },
845
+ {
846
+ "type": "text",
847
+ "text": "I.3 FALSE POSITIVES ",
848
+ "text_level": 1,
849
+ "page_idx": 21
850
+ },
851
+ {
852
+ "type": "text",
853
+ "text": "Problem 9. Generator pass-rate: $1 8 . 5 \\%$ . The generator makes a subtle counting error in step 9. On the surface, it appears reasonable to claim that there are 5 ways to exchange the same colored ball since there are 5 colors. However, this undercounts by a factor of 2, since Bob has 2 choices for which ball to return to Alice. The reward model is fooled by this mistake. ",
854
+ "page_idx": 21
855
+ },
856
+ {
857
+ "type": "text",
858
+ "text": "Bob and Alice each have a bag that contains one ball of each of the colors,blue,green,orange,red,and violet.Alice randomly selects one ballfrom her bag and puts it into Bob's bag.Bob then randomly selects one ballfrom his bag and puts it into Alice's bag.What is the probability that after this process the contents of the two bags are the same? ",
859
+ "page_idx": 21
860
+ },
861
+ {
862
+ "type": "table",
863
+ "img_path": "images/2749ad0627fee85a7e1239c1814e865600f5db20642b04852ff1b1c913e87caa.jpg",
864
+ "table_caption": [],
865
+ "table_footnote": [],
866
+ "table_body": "<table><tr><td>Tofindtheprobabilityofanevent,Ineedtodividethenumberoffavorableoutcomesbythenumberofposibleoutcomes.</td></tr><tr><td>In this case, the event is that the contents of the two bags are the same after the process.</td></tr><tr><td>SoI need tocount how many ways this can happen,and how many ways the process can happen in total.</td></tr><tr><td>I will start with the total number of ways the process can happen.</td></tr><tr><td>Alice can choose any of the five balls in her bag,and Bob can choose any of the six balls in his bag.</td></tr><tr><td>So the total number of ways the process can happen is 5 times 6, which is 30.</td></tr><tr><td>Now I will count how many ways the contents of the two bags can be the same after the process.</td></tr><tr><td>This means that Alice and Bob must have exchanged the same color of ball.</td></tr><tr><td>Thereare five colors,so there are five ways they canexchange the same color of ball.ERROR</td></tr><tr><td>Therefore, the number of favorable outcomes is 5.</td></tr><tr><td>So the probability of the event is 5 divided by 30, which simplifies to 1/6.</td></tr><tr><td>Answer:1/6</td></tr></table>",
867
+ "page_idx": 21
868
+ },
869
+ {
870
+ "type": "text",
871
+ "text": "Problem 10. Generator pass-rate: $1 7 . 6 \\%$ . In step 13, the generator attempts to simplify the equation by combining like terms. It correctly moves and combines the linear terms to the left-hand side, but then mistakenly leaves the right-hand side untouched. The reward model is fooled by this mistake. ",
872
+ "page_idx": 22
873
+ },
874
+ {
875
+ "type": "image",
876
+ "img_path": "images/5f500c74d6366d54983800783dd72e5b0e313cb5347506d269e5789680e03082.jpg",
877
+ "image_caption": [],
878
+ "image_footnote": [],
879
+ "page_idx": 22
880
+ },
881
+ {
882
+ "type": "text",
883
+ "text": "Problem 11. Generator pass-rate: $1 3 . 4 \\%$ . The generator attempts to perform long division, but in step 16, it forgets to include the leading zeros in the repeating part of the decimal. The reward model is fooled by this mistake. ",
884
+ "page_idx": 22
885
+ },
886
+ {
887
+ "type": "image",
888
+ "img_path": "images/ae8878faf5c5e525ab95a1a80388750b168e5b17bab5c1c2cb50ef5356602edc.jpg",
889
+ "image_caption": [],
890
+ "image_footnote": [],
891
+ "page_idx": 22
892
+ },
893
+ {
894
+ "type": "text",
895
+ "text": "Problem 12. Generator pass-rate: $9 . 1 \\%$ . In step 4, the generator falsely claims that the sequence repeats itself every 12 terms, when it’s in fact every 10 terms. This sort of counting mistake occasionally fools the reward model. ",
896
+ "page_idx": 23
897
+ },
898
+ {
899
+ "type": "text",
900
+ "text": "Given that ",
901
+ "page_idx": 23
902
+ },
903
+ {
904
+ "type": "text",
905
+ "text": "Ω1=211, \nm2=375, \n$x _ { 3 } = 4 2 0 ,$ \n𝑥4=523,and \n$x _ { n } = x _ { n - 1 } - x _ { n - 2 } + x _ { n - 3 } - x _ { n - 4 }$ when $n \\geq 5$ ",
906
+ "page_idx": 23
907
+ },
908
+ {
909
+ "type": "text",
910
+ "text": "find thevalueof $x _ { 5 3 1 } + x _ { 7 5 3 } + x _ { 9 7 5 }$ ",
911
+ "page_idx": 23
912
+ },
913
+ {
914
+ "type": "text",
915
+ "text": "his isaproblem involvingarecursive sequence,whereeachtermdependsontheprevious four terms. ",
916
+ "page_idx": 23
917
+ },
918
+ {
919
+ "type": "text",
920
+ "text": "One way toapproach this problemis tolook fora pattern oraformula that can helpus findany term of the sequence without havingtocompute all theprevious terms. ",
921
+ "page_idx": 23
922
+ },
923
+ {
924
+ "type": "text",
925
+ "text": "Todo that,let's write down the first few terms of the sequence and see if we notice anything: ",
926
+ "page_idx": 23
927
+ },
928
+ {
929
+ "type": "equation",
930
+ "img_path": "images/447edf643ff420e3c2ebe172bdacf8517009716aa054fe7470cdee64ea0da3da.jpg",
931
+ "text": "$$\n\\begin{array} { r l } & { x _ { 1 } = 2 1 1 , } \\\\ & { x _ { 2 } = 3 7 5 , } \\\\ & { x _ { 3 } = 4 2 0 , } \\\\ & { x _ { 4 } = 5 2 3 , } \\\\ & { x _ { 5 } = 5 4 3 , } \\\\ & { x _ { 6 } = x _ { 5 } - x _ { 4 } + x _ { 2 } - x _ { 1 } = 5 2 3 - 4 2 0 + 3 7 5 - 2 1 1 = 2 6 7 , } \\\\ & { x _ { 5 } = x _ { 6 } - x _ { 4 } + x _ { 3 } - x _ { 2 } = 2 6 7 - 5 2 3 + 4 2 0 - 3 7 5 = - 2 1 1 , } \\\\ & { x _ { 7 } = x _ { 6 } - x _ { 5 } + x _ { 4 } - x _ { 3 } = - 2 1 1 - 2 6 7 + 5 2 3 - 4 2 0 - - 3 7 5 , } \\\\ & { x _ { 8 } = x _ { 7 } - x _ { 6 } + x _ { 5 } - x _ { 4 } - 3 7 5 - ( - 2 1 1 ) + 2 6 7 - 5 2 3 = - 4 2 0 , } \\\\ & { x _ { 9 } = x _ { 8 } - x _ { 7 } + x _ { 8 } - x _ { 8 } = - 4 2 0 - ( - 3 7 5 ) + ( - 2 1 1 ) - 2 6 7 - 5 2 3 , } \\\\ & { x _ { 9 } = x _ { 9 } - x _ { 8 } + x _ { 7 } - x _ { 6 } - 3 5 - ( - 4 2 0 ) + ( - 3 7 5 ) - ( - 2 1 1 ) - - 2 6 7 , } \\\\ & { x _ { 1 1 } = x _ { 1 0 } - x _ { 9 } + x _ { 8 } - x _ { 7 } = - 2 6 7 - ( - 5 2 3 ) + ( - 4 2 0 ) - ( - 3 7 5 ) - 2 1 1 , } \\\\ & { x _ { 1 2 } = x _ { 1 1 } - x _ { 1 0 } + x _ { 9 } - x _ { 8 } = 2 1 1 - ( - 2 8 7 ) + ( - 5 2 3 ) - ( - 4 2 0 ) - 3 7 5 , } \\\\ & { x _ { 1 3 } = x _ { 1 2 } - x _ { 1 } + x _ { 1 0 } - x _ { 3 } = 3 7 5 - 2 1 1 + ( - 2 8 7 ) - ( - 4 2 0 ) - 3 7 5 + 2 0 , } \\\\ & { x _ { 1 4 } = x _ { 1 2 } - x _ { 1 } + x _ { 1 0 } - x _ { 2 0 } - 2 1 1 + ( - 2 8 7 ) - ( - 5 2 3 ) + 2 0 , } \\\\ & x _ { 2 4 } = x _ { 1 1 } - x _ { 1 } \\end{array}\n$$",
932
+ "text_format": "latex",
933
+ "page_idx": 23
934
+ },
935
+ {
936
+ "type": "text",
937
+ "text": "We can see that the sequence repeats itself every 12 terms, starting from x1. ERROR ",
938
+ "page_idx": 23
939
+ },
940
+ {
941
+ "type": "text",
942
+ "text": "This means that wecanfindanytermofthesequencebyfinding itsremainder whendividedby12,andthenlooking up the corresponding term in the first cycle. \nFor example, to find ε531, we can divide 531 by 12 and get a quotient of 44 and a remainder of 3. \nThis means that x531 is the same as x3, which is 420. \nSimilarly, we can find x753 and xg75 by dividing them by 12 and looking up their remainders. \nWe get that x753 has a remainder of 9, so it is the same as xg,which is-523. \nAnd 𝑥975 has a remainder of 3, so it is the same as x3, which is 420. \nTherefore, the value of x531 + x753 + x975 is 420 +(-523) + 420 = 317. ",
943
+ "page_idx": 23
944
+ },
945
+ {
946
+ "type": "text",
947
+ "text": "Answer:317 ",
948
+ "page_idx": 23
949
+ }
950
+ ]
parse/test/v8L0pN6EOi/v8L0pN6EOi_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/v8L0pN6EOi/v8L0pN6EOi_model.json ADDED
The diff for this file is too large to render. See raw diff