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

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. md/train/B1lnzn0ctQ/B1lnzn0ctQ.md +0 -0
  2. md/train/Bw7VC-DJUM/Bw7VC-DJUM.md +343 -0
  3. md/train/XQQA6-So14/XQQA6-So14.md +530 -0
  4. md/train/qmI0P1ZExUl/qmI0P1ZExUl.md +321 -0
  5. md/train/rkEfPeZRb/rkEfPeZRb.md +233 -0
  6. md/train/ry2YOrcge/ry2YOrcge.md +270 -0
  7. md/train/vrhNQ7aYSdr/vrhNQ7aYSdr.md +274 -0
  8. parse/test/4WnqRR915j/4WnqRR915j.md +539 -0
  9. parse/test/4WnqRR915j/4WnqRR915j_content_list.json +0 -0
  10. parse/test/4WnqRR915j/4WnqRR915j_middle.json +0 -0
  11. parse/test/4WnqRR915j/4WnqRR915j_model.json +0 -0
  12. parse/test/8dkp41et6U/8dkp41et6U.md +378 -0
  13. parse/test/8dkp41et6U/8dkp41et6U_content_list.json +0 -0
  14. parse/test/8dkp41et6U/8dkp41et6U_middle.json +0 -0
  15. parse/test/8dkp41et6U/8dkp41et6U_model.json +0 -0
  16. parse/test/AqN23oqraW/AqN23oqraW.md +0 -0
  17. parse/test/AqN23oqraW/AqN23oqraW_content_list.json +0 -0
  18. parse/test/AqN23oqraW/AqN23oqraW_middle.json +0 -0
  19. parse/test/AqN23oqraW/AqN23oqraW_model.json +0 -0
  20. parse/test/FAO4VS9QRV/FAO4VS9QRV.md +352 -0
  21. parse/test/FAO4VS9QRV/FAO4VS9QRV_content_list.json +811 -0
  22. parse/test/FAO4VS9QRV/FAO4VS9QRV_middle.json +0 -0
  23. parse/test/FAO4VS9QRV/FAO4VS9QRV_model.json +0 -0
  24. parse/test/QAwaaLJNCk/QAwaaLJNCk.md +0 -0
  25. parse/test/QAwaaLJNCk/QAwaaLJNCk_content_list.json +0 -0
  26. parse/test/QAwaaLJNCk/QAwaaLJNCk_middle.json +0 -0
  27. parse/test/QAwaaLJNCk/QAwaaLJNCk_model.json +0 -0
  28. parse/test/VP20ZB6DHL/VP20ZB6DHL.md +352 -0
  29. parse/test/VP20ZB6DHL/VP20ZB6DHL_content_list.json +819 -0
  30. parse/test/VP20ZB6DHL/VP20ZB6DHL_middle.json +0 -0
  31. parse/test/VP20ZB6DHL/VP20ZB6DHL_model.json +0 -0
  32. parse/test/WPZ2yPag4K/WPZ2yPag4K.md +241 -0
  33. parse/test/WPZ2yPag4K/WPZ2yPag4K_content_list.json +598 -0
  34. parse/test/WPZ2yPag4K/WPZ2yPag4K_middle.json +0 -0
  35. parse/test/WPZ2yPag4K/WPZ2yPag4K_model.json +0 -0
  36. parse/test/aKkAwZB6JV/aKkAwZB6JV.md +279 -0
  37. parse/test/aKkAwZB6JV/aKkAwZB6JV_content_list.json +733 -0
  38. parse/test/aKkAwZB6JV/aKkAwZB6JV_middle.json +0 -0
  39. parse/test/aKkAwZB6JV/aKkAwZB6JV_model.json +0 -0
  40. parse/test/b4tMhpN0JC/b4tMhpN0JC.md +340 -0
  41. parse/test/b4tMhpN0JC/b4tMhpN0JC_content_list.json +604 -0
  42. parse/test/b4tMhpN0JC/b4tMhpN0JC_middle.json +0 -0
  43. parse/test/b4tMhpN0JC/b4tMhpN0JC_model.json +0 -0
  44. parse/test/hUgBU9wgSf/hUgBU9wgSf.md +628 -0
  45. parse/test/hUgBU9wgSf/hUgBU9wgSf_content_list.json +0 -0
  46. parse/test/hUgBU9wgSf/hUgBU9wgSf_middle.json +0 -0
  47. parse/test/ttMwEuEPeB/ttMwEuEPeB.md +440 -0
  48. parse/test/ttMwEuEPeB/ttMwEuEPeB_content_list.json +975 -0
  49. parse/test/ttMwEuEPeB/ttMwEuEPeB_middle.json +0 -0
  50. parse/test/ttMwEuEPeB/ttMwEuEPeB_model.json +0 -0
md/train/B1lnzn0ctQ/B1lnzn0ctQ.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/Bw7VC-DJUM/Bw7VC-DJUM.md ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING SPATIOTEMPORAL FEATURES VIA VIDEO AND TEXT PAIR DISCRIMINATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Current video representations heavily rely on learning from manually annotated video datasets which are time-consuming and expensive to acquire. We observe videos are naturally accompanied by abundant text information such as YouTube titles and Instagram captions. In this paper, we leverage this visual-textual connection to learn spatiotemporal features in an efficient weakly-supervised manner. We present a general cross-modal pair discrimination (CPD) framework to capture this correlation between a video and its associated text. We train our CPD models on both standard video dataset (Kinetics-210k) and uncurated web video dataset (Instagram-300k) to demonstrate its effectiveness. Without further fine-tuning, the learnt models obtain competitive results for action classification on Kinetics under the linear classification protocol. Moreover, our visual model provides an effective initialization to fine-tune on downstream tasks, which yields a remarkable performance gain for action recognition on UCF101 and HMDB51, compared with the existing state-of-the-art self-supervised training methods. In addition, our CPD demonstrates that pre-training a relatively small dataset is able to yield a comparable performance to those methods of using order magnitude more data, which is meaningful and practicable for the scenarios with limited computational facilities.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep learning has made a remarkable progress for visual recognition in both image and video domain (Krizhevsky et al., 2012; He et al., 2016; Carreira & Zisserman, 2017; Feichtenhofer et al., 2018) by training powerful neural networks on large-scale manually annotated datasets (e.g., ImageNet (Deng et al., 2009) and Kinetics (Kay et al., 2017)). More importantly, it is well-established that this supervised pre-training on large-scale datasets would benefit the downstream tasks (e.g., object detection (Ren et al., 2015), pose estimation (He et al., 2017), and temporal action detection (Zhao et al., 2017)), in particular when the target datasets are relatively small. Yet, annotating a large-scale dataset for training such deep neural networks is costly and time-consuming, and even more challenging for video due to its various temporal structure and complex semantics. As a result, the existing video datasets size is still smaller than ImageNet in terms of training samples and classes. On the other hand, videos typically contain richer structure with abundant side information such as motion (Diba et al., 2019; $\mathrm { N g }$ et al., 2018), audio (Arandjelovic & Zisserman, 2017; Korbar et al., 2018), and text (Miech et al., 2019; Sun et al., 2019b). So these expected these associated modalities are expected to provide useful cues to learn video representations in a more efficient way.
12
+
13
+ Language or text is probably the most natural and easy way to describe the semantic information of a video, and the associated textual information could be easily acquired when collecting video dataset (Rohrbach et al., 2017; Miech et al., 2019) from Internet or Movie. We argue that this correlation between a clip and its associated text could serve as an alternative supervision to learn video representation from scratch. This is different from some recent works (Sun et al., 2019b; Miech et al., 2019), in which these abundant textual information has been used to learn a high-level visual-text embedding applied to text-to-video retrieval or video captioning. Intuitively, it is more challenging to learn a general visual representation solely from text information without any human annotation, for reasons such as large numbers of noise in text, lacking careful initialization, and being hard to design an effective objective.
14
+
15
+ In this paper, we aim to learn effective video representation from noisy and diverse textual information, which could serves as the basis for a variety of downstream tasks. Basically, we learn a mapping of text and video into a shared embedding space and leverage their correlation as supervision signal. The technical difficulty is how to design an effective objective function, that is capable of modeling this complex visual-textual correlation and as well easily optimized by training from scratch on noisy datasets. Inspired by unsupervised feature learning in images (Wu et al., 2018; Tian et al., 2019), we present a cross-modal pair discrimination (CPD) framework, which tries to recognize each video and text pair into a class via a non-parametric classifier. To solve the computational issues imposed by the huge numbers of pair classes, we adapt noise-contrastive estimation technique (Gutmann & Hyvarinen, 2010) to approximate the original loss function. ¨
16
+
17
+ Specifically, we learn the CPD framework from web videos with the associated title or caption that could be directly crawled from web platforms such as YouTube (Kay et al., 2017) and Instagram (Duan et al., 2020). We utilize the off-the-shelf language models such as BERT (Devlin et al., 2019) or Word2vec (Mikolov et al., 2013) and devise a curriculum learning strategy to progressively train the video models. We first test the generalization ability of learned video representation by CPD on the Kinetics dataset (Kay et al., 2017) by using shallow classifiers such k-NN and linear classifier. It shows that our learned spatiotemporal features obtain promising results which are comparable to some supervised learning methods on the Kinetics dataset (Kay et al., 2017). Then, we investigate the generalization power of learned spatiotemporal features of CPD by fine-tuning on the Kinetics (Kay et al., 2017), UCF101 (Soomro et al., 2012) and HMDB51 (Kuehne et al., 2011) datasets, demonstrating that our method obtain superior performance to previous state-of-the-art self-supervised methods and comparable performance to the very recent methods of using orders of magnitude more videos (70M-100M vs. 0.3M).
18
+
19
+ # 2 RELATED WORK
20
+
21
+ Self/Weakly Supervised Representation Learning. Self supervised representation was popular in both image and video domains by designing various proxy tasks. In image domain, for instance, these tasks could be predicting the image context (Doersch et al., 2015), counting the objects (Noroozi et al., 2017), converting gray images to color one (Zhang et al., 2016), keeping global and local consistency (Hjelm et al., 2019). In video domain, typical examples include frame prediction (Diba et al., 2019; Vondrick et al., 2016), optical flow estimation $\mathrm { N g }$ et al., 2018; Zhou et al., 2017; Jayaraman & Grauman, 2017), instance tracking (Wang & Gupta, 2015; Wang et al., 2019b), temporal order or structure prediction (Misra et al., 2016; Fernando et al., 2017; Wei et al., 2018; Xu et al., 2019a). These learnt representations may capture some aspects of low-level image or video structures, but are generally outperformed by those using cross modal information.
22
+
23
+ Several cross-modal self-supervised tasks was proposed to enhance single-modality representation power and typical example is audio-visual representation learning (Aytar et al., 2016; Arandjelovic & Zisserman, 2017; Korbar et al., 2018). Meanwhile, some weakly-supervised methods were developed by utilizing web supervision obtained in an automatic way, such as query ID (Chen & Gupta, 2015; Ghadiyaram et al., 2019), and hashtag (Mahajan et al., 2018). Concurrent work (Miech et al., 2020) tried to learn video representations by using narration as supervision with instructional videos (e.g., HowTo100M (Miech et al., 2019)). However, they are limited by the video type. Our CPD is applicable to more general video type and we experiment with a much smaller dataset (0.3M vs. 100M) of both PGC and UGC videos, but achieves a similar performance on UCF101 and HMDB51. Concurrent work (Stroud et al., 2020) proposed a similar framework but required more training videos (0.3M vs. 70M) and richer textual information to obtain similar performance to ours.
24
+
25
+ Motion, Audio, and Text. Multi-modal information in videos provides natural cues for learning deep models. Motion or temporal information has been studied as to design proxy tasks to assist cross-modal learning, such as optical flow or tracking (Ng et al., 2018; Wang & Gupta, 2015), frame prediction (Diba et al., 2019; Vondrick et al., 2016), or high-level temporal structure (Wei et al., 2018; Xu et al., 2019a; Fernando et al., 2017). As most video contain synchronized audio and visual signals, audio information has served another common modality to supervised visual learning (Aytar et al., 2016; Arandjelovic & Zisserman, 2017; Korbar et al., 2018). However, both motion and audio information seem to be low-level signals and may lack high-level semantic for cross-modal learning.
26
+
27
+ Speech or text has been widely studied as another cross-modal setting in video learning (Sun et al., 2019b; Miech et al., 2019; Dong et al., 2019; Miech et al., 2018; Pan et al., 2016; Plummer et al., 2017). These works mainly aimed to learn a joint video-text embedding where visual and textual cues are adjacent if they are semantically. However, these works focused on learn high-level visualtextual embedding by using the off-the-shelf models as feature extractors. Instead, our proposed CPD framework addresses a different issue of video representation learning from scratch.
28
+
29
+ ![](images/8a67af6f74daf14c18ca4442d46bf1823105ebabb57dde5b598d121cf0b3a1cf.jpg)
30
+ Figure 1: The pipeline of our cross-modal pair discrimination (CPD) framework. First, the visual and text are fed into modality-specific networks for feature extraction. Then, the visual and textual features are mapped into a common 256-dimensional space. The cross-modal framework is learned via video and text pair discrimination, which tries to make corresponding pairs closer than other inconsistent pairs using a softmax criteria. The learnt spatiotemporal features could be deployed directly or fine-tuned for downstream tasks.
31
+
32
+ # 3 CROSS-MODAL PAIR DISCRIMINATION
33
+
34
+ In this section we provide an detailed description on our proposed cross-modal pair discrimination (CPD) for weakly supervised spatiotemporal feature learning. First, we present the whole framework and analyze its important properties. Then, we describe the training strategy of CPD framework. Finally, we introduce text and video feature extraction networks.
35
+
36
+ # 3.1 FRAMEWORK AND ANALYSIS
37
+
38
+ Our goal is to propose a weakly supervised representation learning method by exploiting the correlation between each video clip and its associated text information, which could be easily obtained from a variety of sources such as YouTube titles, Instagram captions and automatic speech recognition (ASR). It is generally assumed that these text information contains semantic information, but also might be noisy and irrelevant. Therefore, from technical perspective, we need to design an effective objective function and training strategy to capture this semantic correlation and as well also suppress the effect of noisy and irrelevant information. To this end, we devise a video-text pair discrimination objective and a curriculum learning strategy as follows.
39
+
40
+ More formally, as shown in Figure 1, we aim to learn a modality-specific embedding function $\mathcal { F } _ { v }$ and $\mathcal { F } _ { t }$ for the visual and textual information from a set of $N$ video clips and their associated textual information $\{ ( v _ { i } , t _ { i } ) _ { i = 1 } \} ^ { N }$ . Let $\mathbf { f } _ { i } ^ { v }$ and $\mathbf { f } _ { i } ^ { t }$ denote $\mathcal { F } _ { v } ( v _ { i } )$ and $\mathcal { F } _ { t } ( t _ { i } )$ , respectively. These embedding functions would map these two modality into a common space (i.e., $f _ { i } ^ { v } \in \mathbb { R } ^ { d }$ and $f _ { i } ^ { v } \in \mathbb { R } ^ { d } .$ ), and related visual and text information should be close to each other. The embedding functions could be implemented by neural networks which will be clarified in next section. We first focus on how to devise objective function to optimize these embedding functions. Inspired by the work of unsupervised learning in images (Wu et al., 2018), we design a cross-modal pair discrimination objective to learn these two embedding functions.
41
+
42
+ Self-instance discrimination. In the original instance-level discrimination framework ( $\mathrm { W u }$ et al., 2018), each image is treated as a distinct class and it would learn a classifier to categorize each image into its own class. This framework could be naturally extended into the setting of video and text pair by directly using feature concatenation, and we call this extension as self-instance discrimination. Formally, this video-text level instance discrimination objective could be implemented with the following softmax criterion:
43
+
44
+ $$
45
+ p ( i | ( v , t ) ) = \frac { \exp ( \mathbf { w } _ { i } ^ { v T } \mathbf { f } ^ { v } + \mathbf { w } _ { i } ^ { t T } \mathbf { f } ^ { t } ) } { \sum _ { j = 1 } ^ { N } \exp ( \mathbf { w } _ { j } ^ { v T } \mathbf { f } ^ { v } + \mathbf { w } _ { j } ^ { t T } \mathbf { f } ^ { t } ) } ,
46
+ $$
47
+
48
+ where the $i ^ { t h }$ video-text pair define a class $i$ , $( \mathbf { w } _ { i } ^ { v } , \mathbf { w } _ { i } ^ { t } )$ is a weight for class $i$ , and the class number is equal to training sample number $N$ . This class weight represent a class prototype for each video-text instance and is probably not easy to optimize as we only have a single sample for each class. Thus, the above parametric classifier could be refined with the following non-parametric variant:
49
+
50
+ $$
51
+ p ( i | ( v , t ) ) = \frac { \exp ( \mathbf { f } _ { i } ^ { v T } \mathbf { f } ^ { v } / \tau + \mathbf { f } _ { i } ^ { t T } \mathbf { f } ^ { t } / \tau ) } { \sum _ { j = 1 } ^ { N } \exp ( \mathbf { f } _ { j } ^ { v T } \mathbf { f } ^ { v } / \tau + \mathbf { f } _ { j } ^ { t T } \mathbf { f } ^ { t } / \tau ) } ,
52
+ $$
53
+
54
+ where $\tau$ is a temperature parameter to control the class concentration level and our training objective is to optimize the likelihood $\begin{array} { r } { \prod _ { i = 1 } ^ { N } p ( i | ( v _ { i } , t _ { i } ) ) } \end{array}$ . This straight forward extension shares the advantage of instance-level discrimination by directly modeling in the joint video-text space. Yet, in fact, the semantic information of text modality is higher than video pixels and we aims at learning video features with the supervision of textual information. To meet this requirement, we propose a refined objective function from the perspective of conditional distribution.
55
+
56
+ Cross-pair discrimination. According to the above analysis, we design the objective function by considering conditional distribution $p ( i _ { t } | v )$ and $p ( i _ { v } | t )$ rather than implicitly modeling distribution $p ( v , t )$ . Specifically, we design the following conditional distribution:
57
+
58
+ $$
59
+ p ( i _ { t } | v ) = \frac { \exp ( \mathbf { f } _ { i } ^ { t T } \mathbf { f } ^ { v } / \tau ) } { \sum _ { j = 1 } ^ { N } \exp ( \mathbf { f } _ { j } ^ { t T } \mathbf { f } ^ { v } / \tau ) } ,
60
+ $$
61
+
62
+ where $i ^ { t h }$ text define a text class $i _ { t }$ , and both $\mathbf { f } ^ { t }$ and $\mathbf { f } ^ { v }$ with unit-norm constraint. The conditional distribution $p ( i _ { v } | t )$ could be defined at the same way. We call this framework as cross-pair discrimination, and during training phase, the objective is to maximize the likelihood $\begin{array} { r } { \prod _ { i = 1 } ^ { N } p ( i _ { t } | v _ { i } ) \prod _ { i = 1 } ^ { N } p ( i _ { v } | t _ { i } ) } \end{array}$ . The key difference between Equation (2) and (3) is that we propose to use cross-correlation term $\mathbf { f } ^ { t T } \mathbf { f } ^ { v }$ to replace the self-correlation term $( \mathbf { f } ^ { v T } \mathbf { f } ^ { v } + \mathbf { f } ^ { t T } \mathbf { f } ^ { t } )$ . This cross correlation is more effective to capture the mutual information between visual and textual information, and thereby better at guiding the spatiotemporal feature learning from video with text information as supervision.
63
+
64
+ Ranking loss. There is some common ranking loss for cross-modal matching. To well study the effectiveness of proposed cross-modal pair discrimination objective, we also compare with a baseline of ranking loss, which is defined as follows:
65
+
66
+ $$
67
+ \mathcal { L } ( v _ { i } , t _ { i } ) = \frac { 1 } { n - 1 } \sum _ { j \neq i } \operatorname* { m a x } ( 0 , \delta + \mathcal { S } ( \mathbf { f } _ { j } ^ { t } , \mathbf { f } _ { i } ^ { v } ) - \mathcal { S } ( \mathbf { f } _ { i } ^ { t } , \mathbf { f } _ { i } ^ { v } ) ) ,
68
+ $$
69
+
70
+ where each video $v _ { i }$ has a associated text $t _ { i }$ and unrelated text $t _ { j }$ from current batch. ${ \cal { S } } ( \mathbf { f } _ { j } ^ { t } , \mathbf { f } _ { i } ^ { v } )$ is the cosine similarity, $n$ is the batch size and $\delta$ is a margin. We apply Equation (4) in both ways of video with its associated text and text with its video. In experiment, we empirically compare this ranking loss with our designed cross-pair discrimination objective.
71
+
72
+ # 3.2 TRAINING CPD
73
+
74
+ The training of CPD framework needs to address two technical issues: (1) large number of video-text pair classes; (2) optimization difficulty on noisy video-text datasets by training from scratch.
75
+
76
+ Noise-contrastive estimation. In training stage, we adopt noise-contrastive estimation technique (Gutmann & Hyvarinen, 2010) to approximate Equation (3) to solve the computational issues ¨ by the huge numbers of pairs. The basic idea is to transform the multi-class classification problem in Equation (3) into a set of binary classification problem. In the binary classification task, the task is to distinguish between data sample and noise sample. The approximate training objective is to minimize the following loss function:
77
+
78
+ $$
79
+ \mathcal { L } = - \mathbb { E } _ { P ( v ) } \left\{ \mathbb { E } _ { P _ { d } ( i _ { t } | v ) } [ \log h ( i _ { t } , v ) ] + m \mathbb { E } _ { P _ { n } ( i _ { t } ^ { \prime } | v ) } [ \log \left( 1 - h ( i _ { t } ^ { \prime } , v ) \right) ] \right\} ,
80
+ $$
81
+
82
+ where $\begin{array} { r } { h ( i _ { t } , v ) = \frac { p ( i _ { t } | v ) } { p ( i _ { t } | v ) + m p _ { n } ( i _ { t } | v ) } } \end{array}$ , $P _ { d } ( i _ { t } | v )$ is the actual data distribution and $P _ { n } ( i _ { t } ^ { \prime } | v )$ is the uniform distribution for noise, and $m$ denotes the noise frequency. To compute $p ( i _ { t } | v )$ efficiently and avoid large memory consumption, following $\mathbf { W } \mathbf { u }$ et al., 2018), we maintain a memory bank to store the visual and textual features for each training pair. The memory bank is updated dynamically during the training procedure.
83
+
84
+ Curriculum learning. To handle the optimization difficulty of directly training from scratch on noisy video-text dataset, we present a curriculum training strategy by resorting to the existing unsupervised pre-trained language models. To relieve the training difficulty, our curriculum learning strategy divides the training procedure into two stages. In the first stage, we fix the pre-trained language model and only update the parameters of visual model and embedding function. The motivation is that the language model is pre-trained well using corpus much larger than ours and the video model is totally trained from scratch. If we train both models simultaneously in the beginning, the random noise produced by video model will destroy the parameters of language model. In the second stage, after the good initialization of video model, we start to jointly train the visual-textual model with a smaller learning rate.
85
+
86
+ # 3.3 ARCHITECTURE DESIGN
87
+
88
+ Video architecture. For video representation, we use the 3D CNNs to extract spatiotemporal features from a video clip. Specifically, we randomly sample 8 frames from each video clip and sampling stride is 4. Following the implementation of slow stream in the recent SlowFast (Feichtenhofer et al., 2018), all filters from $c o n v _ { 1 }$ to $r e s _ { 3 }$ degenerate temporal convolutions into 2D convolution kernels and it only reserves 3D convolution kernels in $r e s _ { 4 }$ and $r e s _ { 5 }$ without temporal downsampling. We try two kinds of network architectures: (1) 3D ResNet34 trained on $1 1 2 \times 1 1 2 \times 8$ volumes and (2) 3D ResNet50 trained on $2 2 4 \times 2 2 4 \times 8$ volumes. The first tiny network is efficient for ablation study and then we transfer its optimal setting to the larger backbone and frame resolution. We also add a mapping layer to transform the visual features into 256-dimensional embedding space $\mathbf { f } ^ { v }$ and this 256-d vector is $\ell _ { 2 }$ -normalized.
89
+
90
+ Text architecture. Our textual stream subnetwork is based on the off-the-shelf language models. We choose Word2vec (Mikolov et al., 2013) and DistilBERT (Devlin et al., 2019; Sanh et al., 2019) as our textual encoders. Word2vec is an unsupervised word encoder, pre-trained by reconstructing the surrounding words of the continue sentences. We average word vectors which are 300 dimensional as textual encoder. BERT (Devlin et al., 2019) encodes long sentences by predicting the missing words given their bidirectional context, and DistilBERT achieves comparable performance with a faster and lighter model via knowledge distillation (Hinton et al., 2015). We average word embeddings of title generated by DistilBERT and obtain 768 dimensional text feature. Finally, two fully connected layers with ReLU and Batch Normalization (Ioffe & Szegedy, 2015) are added to our textual encoder to obtain textual feature $\mathbf { f } ^ { t }$ in the common embedding space, which is also $\ell _ { 2 }$ -normalized.
91
+
92
+ # 4 EXPERIMENTS
93
+
94
+ In this section, we present the experimental results of our proposed CPD framework. First, we describe the training and evaluation datasets with implementation details. Then, we conduct ablation study on our proposed CPD framework. Finally, we verify the effectiveness of CPD from two aspects: weakly-supervised representation learning and representation transfer.
95
+
96
+ # 4.1 DATASETS
97
+
98
+ In our experiment, we pre-train our CPD framework on two video-text datasets: Kinetics-210k (Kay et al., 2017) and Instagram-300k (Duan et al., 2020). Then, we fine-tune the video model on three human action datasets: Kinetics400 (Kay et al., 2017), UCF101 (Soomro et al., 2012) and HMDB51 (Kuehne et al., 2011).
99
+
100
+ Kinetics-210k. Following the recent self-supervised methods (Wang et al., $2 0 1 9 \mathrm { a }$ ; Korbar et al., 2018; Han et al., 2019), we utilize Kinetics (Kay et al., 2017) dataset for weakly-supervised pretraining of CPD. It is often called Kinetics400 since it has 400 action classes, but we count training video number as we do not use any class information for weakly-supervised representation learning. Due to invalid urls and data cleaning, the collected dataset contains around 210k video-text pairs, and thus we call this dataset as Kinetics-210k. To construct video-text pairs, we equip each clip with the video title directly crawled from YouTube, termed as Kinetics-title. As the original title may be very noisy, we pre-process the text information in two ways. First, we delete special symbols and characters such as non-English words and emoji, termed as Kinetics-title-clean. Second, we use StanfordNLP (Qi et al., 2018) to obtain the dependency tree of sentences in titles and only reserve verbs and nouns, named Kinetics-title-tree.
101
+
102
+ Instagram-300k. To avoid data bias in Kinetics caused by human annotation (i.e., trimmed videos with an action), we further verify the effectiveness our CPD model on an uncurated web video dataset (Duan et al., 2020). This new dataset is constructed from Instagram by searching action label of Kinetics-400 but without any manual filtering. Due to limited computation resource and also for fair comparison with pretraining on Kinetics-210k, we randomly sample 300k from the original web video dataset, termed as Instagram-300k.
103
+
104
+ An important difference is that the these videos are with User Generated Content (UGC) and accompanied by captions uploaded by users. Therefore, its video content distribution is much different with those in Profession Generated Content (PGC) in UCF101 and HMDB51, and the text noise is also much higher. So, it is more challenging to train a pre-trained CPD model on Instagram-300k.
105
+
106
+ UCF101 and HMDB51. We evaluate the generalization of our pre-trained models by fine-tuning on two small human action datasets: UCF101 (Soomro et al., 2012) and HMDB51 (Kuehne et al., 2011), which contain $1 3 \mathrm { k }$ videos of 101 classes and 7k video of 51 classes respectively. We report ablation study on the first split and report average performance over three splits for fair comparison.
107
+
108
+ # 4.2 IMPLEMENTATION DETAILS
109
+
110
+ Weakly supervised learning of CPD. We train our CPD model on video-text datasets and use video-text retrieval on 1k unseen video-text pairs as validation set duration training. Specifically, 8 frames are sampled from each video clip and the sampling stride is 4. We use SGD to optimize our objective and the training parameters include a momentum of 0.9 and 1e-4 for weight decay. We set temperature parameter $\tau = 0 . 0 7$ and noise frequency $m$ to 4096. In the beginning, we fix the pre-trained language model and the learning rate is set as 0.2. When the retrieval performance on validation set saturates (170 epochs for 3D ResNet34 and 110 epochs for 3D ResNet50), we start to update the language model with learning rate of 3e-5 and decrease the rest learning rate to 0.02. The maximize training number is 250 epochs. For input size of $1 1 2 \times 1 1 2 \times 8$ , the mini-batch size is 64 clips per GPUs and 16 clips per GPUs for input size of $2 2 4 \times 2 2 4 \times 8$ . We use 8 GPUs for training.
111
+
112
+ Evaluation on representation learning. We first verify our CPD learned representation by employing a shallow classifier on frozen features. Specifically, we utilize $\mathbf { k }$ -Nearest Neighbor (kNN) and linear classifier based on extracted features for classification. For video feature extraction, we sample 10 clips from each video and each clip contains 8 frames with 4 sampling stride. The 256- dimensional embedding feature and the output of global average pooling are extracted as features. The extracted features over 10 clips in a video are averaged as a video-level representation. We choose cosine distance as distance metric in kNN and set $k = 2 5$ . As for linear classifier, a fully connected layer after Batch Normalization is added with cross-entropy loss. We adopt Adam with learning rate of 1e-3 and reduce by a factor of 10 every 10 epochs, stopping at 30 epochs.
113
+
114
+ Evaluation on representation transfer. A main goal of representation learning is to transfer them to downstream tasks. We fine-tune the learned spatiotemporal representation on the UCF101, HMDB51 and a small fraction of Kinetics400. During fine-tuning, 16 frames with stride 4 are sampled as input. We simply replace the embedding layer of video model with a new fully-connected layer and multi-way softmax for action recognition. The classifier is trained using the SGD optimizer with an initial learning rate 1e-2 and weight decay 5e-4. Learning rate is decreased twice by a factor of 10 when the validation loss saturates. During testing, for each video, we uniformly sample 10 clips and each clip contains 3 crops, following the common practice (Feichtenhofer et al., 2018).
115
+
116
+ # 4.3 ABLATION STUDY
117
+
118
+ In this study, we pre-train our CPD models on Kinetics-210k dataset and choose the task of representation transfer by fine tuning on UCF101 split 1 for evaluation.
119
+
120
+ <table><tr><td>Trainingstrategy</td><td>Accuracy(%)</td></tr><tr><td>Random init.</td><td>50.0</td></tr><tr><td>Direct fine-tuning</td><td>81.3</td></tr><tr><td>Curr. learning1</td><td>82.2</td></tr><tr><td>Curr.learning2</td><td>84.2</td></tr></table>
121
+
122
+ (b) Study on training strategies.
123
+
124
+ <table><tr><td>Textual encoder</td><td>Data</td><td>Accuracy(%)</td></tr><tr><td>Random Init.</td><td>-</td><td>50.0</td></tr><tr><td>Word2vec</td><td>Tree</td><td>83.1</td></tr><tr><td>DistilBERT</td><td>Tree</td><td>82.1</td></tr><tr><td>Word2vec</td><td>Clean</td><td>82.5</td></tr><tr><td>DistilBERT</td><td>Clean</td><td>84.2</td></tr></table>
125
+
126
+ (c) Study on textual encoders.
127
+
128
+ Table 1: Ablation study on UCF101 by fine tuning a pre-trained CPD model from Kinetics-210k.
129
+
130
+ <table><tr><td>Objective function</td><td>Accuracy(%)</td></tr><tr><td>Random init.</td><td>50.0</td></tr><tr><td>Ranking loss</td><td>79.9</td></tr><tr><td>Self-instance Dis.</td><td>51.1</td></tr><tr><td>Cross-pair Dis.</td><td>82.2</td></tr></table>
131
+
132
+ (a) Study on loss functions.
133
+
134
+ Table 2: Evaluation on weakly-supervised representation learning without fine-tuning. Top-1 classification accuracy is reported on Kinetics-400 validation set.
135
+
136
+ <table><tr><td>Backbone</td><td>Pre-trained Sup.</td><td>Layer (Dim)</td><td>KNN</td><td>LC</td></tr><tr><td>3D-ConvNet (Kay et al.,2017)</td><td>Kinetics-400Label</td><td>-</td><td>-</td><td>56.1</td></tr><tr><td>3D ResNet34 (Hara et al., 2018) 3D ResNet50 (ours)</td><td>Kinetics-400 Label Kinetics-400 Label</td><td>-</td><td>-</td><td>60.1 73.2</td></tr><tr><td>ResNet50</td><td>ImageNet Label</td><td>-</td><td>- 42.8</td><td>56.1</td></tr><tr><td>3DResNet34</td><td></td><td>res5 (2048)</td><td></td><td></td></tr><tr><td></td><td>Instagram-300k Caption</td><td>emb (256)</td><td>34.5</td><td>37.3</td></tr><tr><td>3D ResNet34</td><td>Instagram-300k Caption</td><td>res5 (512)</td><td>36.1</td><td>44.6</td></tr><tr><td>3D ResNet50</td><td>Instagram-300k Caption</td><td>emb (256)</td><td>51.1</td><td>51.7</td></tr><tr><td>3DResNet50</td><td>Instagram-300k Caption</td><td>res5 (2048)</td><td>51.1</td><td>55.4</td></tr><tr><td>3DResNet34</td><td>Kinetics-210k Title</td><td>emb (256)</td><td>49.9</td><td>50.8</td></tr><tr><td>3D ResNet34</td><td>Kinetics-210k Title</td><td>res5 (512)</td><td>50.1</td><td>53.3</td></tr><tr><td>3DResNet50</td><td>Kinetics-210k Title</td><td>emb (256)</td><td>58.0</td><td>59.6</td></tr><tr><td>3DResNet50</td><td>Kinetics-210k Title</td><td>res5 (2048)</td><td>58.2</td><td>63.8</td></tr></table>
137
+
138
+ Objective function. We compare three objective functions for cross-modal pair discrimination described in Section 3.1. We pre-train models by utilizing DistilBERT as textual encoder without finetuning and the experimental results are reported in Table 1a. Self-instance discrimination almost has no contribution to learn effective representation as there is no cross-modal correlation modeling. Cross-pair discrimination gives a better performance than ranking loss as cross-pair discrimination can construct negative video-text pairs from entire dataset while ranking loss is only optimized by negative pairs from current batch. More theoretical analysis can be found in Section. A.1 of the Appendix.
139
+
140
+ Curriculum learning. We design different training strategies from noisy video-text datasets. The first strategy is to fine-tune the pre-trained textual encoder directly at the beginning. Then we compare with stage I and stage II of curriculum learning proposed in Section 3.2. All these strategies are pre-trained on Kinetics-title-clean. The numerical results are summarized in Table 1b. Fixing the pre-trained language model gives better performance than direct fine-tuning at the beginning $( + 0 . 9 \% )$ . We ascribe this to the fact that the random noise produced by video model destroy the well pre-trained textual encoder at the beginning. Also, fine-tuning the language model after the video model is well initialized further boost the accuracy by $2 . 0 \%$ .
141
+
142
+ Different textual information. In this experiment, we choose video-text pairs from Kinetics-titletree, Kinetics-title-clean datasets and utilize Word2vec and DistilBERT as a textual extractor. The experimental results are reported in Table 1c. For textual encoder, abundant and video-specific text information benefits to train our CPD model with stronger language model such as DistilBERT according to the performance difference between Kinetics-title-tree and Kinetics-title-clean $( 8 2 . 1 \%$ vs. $8 4 . 2 \%$ ). As for shallow textual encoder (e.g., Word2vec), simple text information from Kineticstitle-tree dataset gives better performance than abundant text information $( 8 3 . 1 \%$ vs. $8 2 . 5 \%$ ). From above observation, it can be concluded that Word2vec is more good at concise and accurate text while DistilBERT can handle more complex and noisy sentences which is close to realistic setting. Also, it is affordable to utilize strong language models due to our curriculum learning strategy and lightweight DistilBERT model.
143
+
144
+ # 4.4 EVALUATION ON REPRESENTATION LEARNING
145
+
146
+ To evaluate our learned representation, we report the classification performance on validation set of Kinetics via training shallow classifiers on frozen features as shown in Table 4.3. We perform kNN classifiers and linear classifiers (LC) on the embedding features or visual features from global average pooling after res5. In this shallow learning setting, we also compare with ImageNet pretraining representation (ResNet50) by using the same classifier. First, the representation learnt from
147
+
148
+ Table 3: Evaluation on representation transfer by fine-tuning. We compare our CPD model with other methods trained on different type of supervision.
149
+
150
+ <table><tr><td>Method</td><td>Supervision</td><td>Backbone</td><td>Pre-trained Dataset</td><td>UCF101</td><td>HMDB51</td></tr><tr><td>RandomInit. (Hara etal.,2018)</td><td></td><td>3DResNet18</td><td></td><td>42.4</td><td>17.1</td></tr><tr><td>Kinetics Pre-trained (Hara etal., 2018)</td><td>Action label</td><td>3DResNet50</td><td>Kinetics</td><td>89.3</td><td>61.0</td></tr><tr><td>Supervised SOTA (Xie et al.,2018)</td><td>Action label</td><td>S3D</td><td>Kinetics</td><td>96.8</td><td>75.9</td></tr><tr><td>Shuffle&amp; Learn (Misra et al.,2016)</td><td>Order verification</td><td>CaffeNet</td><td>UCF101/HMDB51</td><td>50.2</td><td>18.1</td></tr><tr><td>OPN (Lee et al., 2017)</td><td>Sequence order</td><td>VGGNet</td><td>UCF101/HMDB51</td><td>59.8</td><td>23.8</td></tr><tr><td>CMC (Tian et al., 2019)</td><td>Optical flow</td><td>CaffeNet</td><td>UCF101</td><td>55.3</td><td>-</td></tr><tr><td>O3N (Fernando et al.,2017)</td><td>Odd-one-out</td><td>AlexNet</td><td>UCF101</td><td>60.3</td><td>32.5</td></tr><tr><td>MASN (Wang et al.,2019a)</td><td>Motion</td><td>C3D</td><td>Kinetics-400</td><td>61.2</td><td>33.4</td></tr><tr><td>COP (Xu et al.,2019b)</td><td>Clip order</td><td>3D ResNet10</td><td>UCF101</td><td>64.9</td><td>29.5</td></tr><tr><td>DPC (Han et al.,2019)</td><td>Prediction</td><td>3DResNet34</td><td>Kinetics-400</td><td>75.7</td><td>35.7</td></tr><tr><td>CBT(Sun et al.,2019a)</td><td>Audio(Text)/Context</td><td>S3D</td><td>Kinetics-600</td><td>79.5</td><td>44.6</td></tr><tr><td>AVTS (Korbar et al.,2018)</td><td>Audio</td><td>I3D</td><td>Kinetics-600</td><td>83.7</td><td>53.0</td></tr><tr><td>AVTS (Korbar et al., 2018)</td><td>Audio</td><td>MC3</td><td>Audioset-1.8M</td><td>89.0</td><td>61.6</td></tr><tr><td>XDC (Alwassel et al.,2019)</td><td>Audio</td><td>R(2+1)D</td><td>Kinetics-400</td><td>84.2</td><td>47.1</td></tr><tr><td>XDC (Alwassel et al.,2019)</td><td>Audio</td><td>R(2+1)D</td><td>IG-65M</td><td>91.5</td><td>63.1</td></tr><tr><td>MIL-NCE (Miech et al., 2020)</td><td>Audio(Text)</td><td>S3D</td><td>HT-100M</td><td>91.3</td><td>61.0</td></tr><tr><td>TWS (Stroud et al.,2020)</td><td>Text (Title,Des,Tag etc.)</td><td>S3D-G</td><td>WVT-70M</td><td>90.3</td><td>65.3</td></tr><tr><td>CPD (Ours)</td><td>Caption</td><td>3DResNet50</td><td>Instagram300k</td><td>89.9</td><td>63.8</td></tr><tr><td>CPD (Ours)</td><td>Title</td><td>3DResNet50</td><td>Kinetics210k</td><td>90.5</td><td>63.6</td></tr></table>
151
+
152
+ Kinetics-210k generally outperforms that of Instagram- $3 0 0 \mathrm { k }$ . The reason could be ascribed to the video distribution gap between UGC (Instagram) and PGC (Youtube), and also much noisier textual information in Instagram-300k. Second, we compare with ImageNet pretrained features, and our CPD representation is better under the same backbone. Finally, we compare with some end-toend trained representations with action labels, and there is still a performance gap between our representation and supervised end-to-end representation (e.g. $6 3 . 8 \%$ vs. $7 3 . 2 \%$ ).
153
+
154
+ # 4.5 EVALUATION ON REPRESENTATION TRANSFER
155
+
156
+ Transferring learned representation to downstream tasks is a main goal of representation learning. We transfer them to action recognition task on small datasets, namely UCF101 and HMDB51. We compare our CPD model pre-trained on Instagram-300k and Kinetics-210k with a randomly initialized network, self-supervised methods solely based on visual information, including Shuffle & Learn (Misra et al., 2016), CMC (Tian et al., 2019), MASN (Wang et al., 2019a), COP (Xu et al., 2019b), DPC (Han et al., 2019) and so on, and representation learning methods based on multimodal information (e.g., audio, text), including CBT (Sun et al., 2019a), AVTS (Korbar et al., 2018), XDC (Alwassel et al., 2019), MIL-NCE (Stroud et al., 2020), and TWS (Stroud et al., 2020).
157
+
158
+ As shown in Table 3, our CPD models generally outperform those self-supervised learning approaches of only using visual information $( \geq 1 0 \%$ on UCF101 and $\geq 2 0 \%$ on HMDB51), which indicates that cross-modal information is useful cue for visual representation learning. Meanwhile, our CPD representations obtain comparable performance to the concurrent works (i.e., MIL-NCE and TWS) of using text as weak supervision. However, our CPD uses a much smaller pre-training dataset of around 0.3M videos, while the other methods uses 70M-100M videos. Training a CPD model on a such large-scale dataset is almost impossible for a university lab with limited computational facilities. Our work demonstrates that pre-training a relatively small video-text dataset is also possible to match the SOTA performance, and this is quite meaningful and practicable for university lab. Finally, we notice that the gap of CPD models learned from Instagram- ${ 3 0 0 } \mathrm { k }$ and Kinetics- ${ \it 2 0 0 k }$ is very small, indicating that our CPD model can effectively handle high noise in text.
159
+
160
+ # 5 CONCLUSION
161
+
162
+ In this paper, we have presented a general cross-modal pair discrimination (CPD) framework to capture the correlation between a video clip and its associated text from real word and adopt noisecontrastive estimation to approximate the objective. Without fine-tuning, the learned models obtain competitive results for action classification on Kinetics dataset with a shallow classifier. Also, our visual models provide an effective initialization to fine-tune on the datasets of downstream task, and matches the state-of-the-art performance with a much smaller pre-training dataset.
163
+
164
+ # REFERENCES
165
+
166
+ Humam Alwassel, Dhruv Mahajan, Lorenzo Torresani, Bernard Ghanem, and Du Tran. Selfsupervised learning by cross-modal audio-video clustering. CoRR, abs/1911.12667, 2019. URL http://arxiv.org/abs/1911.12667.
167
+
168
+ Relja Arandjelovic and Andrew Zisserman. Look, listen and learn. In IEEE International Conference on Computer Vision, ICCV 2017, Venice, Italy, October 22-29, 2017, pp. 609–617, 2017.
169
+
170
+ Yusuf Aytar, Carl Vondrick, and Antonio Torralba. Soundnet: Learning sound representations from unlabeled video. In Advances in Neural Information Processing Systems 29: Annual Conference on Neural Information Processing Systems 2016, December 5-10, 2016, Barcelona, Spain, pp. 892–900, 2016.
171
+
172
+ Joao Carreira and Andrew Zisserman. Quo vadis, action recognition? A new model and the kinetics ˜ dataset. In 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017, pp. 4724–4733, 2017.
173
+
174
+ Xinlei Chen and Abhinav Gupta. Webly supervised learning of convolutional networks. In 2015 IEEE International Conference on Computer Vision, ICCV 2015, Santiago, Chile, December 7- 13, 2015, pp. 1431–1439, 2015.
175
+
176
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Fei-Fei Li. Imagenet: A large-scale hierarchical image database. In 2009 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR 2009), 20-25 June 2009, Miami, Florida, USA, pp. 248–255, 2009.
177
+
178
+ Jacob 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, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pp. 4171–4186, 2019.
179
+
180
+ Ali Diba, Vivek Sharma, Luc Van Gool, and Rainer Stiefelhagen. Dynamonet: Dynamic action and motion network. CoRR, abs/1904.11407, 2019.
181
+
182
+ Carl Doersch, Abhinav Gupta, and Alexei A. Efros. Unsupervised visual representation learning by context prediction. In 2015 IEEE International Conference on Computer Vision, ICCV 2015, Santiago, Chile, December 7-13, 2015, pp. 1422–1430, 2015.
183
+
184
+ Jianfeng Dong, Xirong Li, Chaoxi Xu, Shouling Ji, Yuan He, Gang Yang, and Xun Wang. Dual encoding for zero-example video retrieval. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16-20, 2019, pp. 9346–9355, 2019.
185
+
186
+ Haodong Duan, Yue Zhao, Yuanjun Xiong, Wentao Liu, and Dahua Lin. Omni-sourced weblysupervised learning for video recognition. CoRR, abs/2003.13042, 2020.
187
+
188
+ Christoph Feichtenhofer, Haoqi Fan, Jitendra Malik, and Kaiming He. Slowfast networks for video recognition. CoRR, abs/1812.03982, 2018.
189
+
190
+ Basura Fernando, Hakan Bilen, Efstratios Gavves, and Stephen Gould. Self-supervised video representation learning with odd-one-out networks. In 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017, pp. 5729–5738, 2017.
191
+
192
+ Deepti Ghadiyaram, Du Tran, and Dhruv Mahajan. Large-scale weakly-supervised pre-training for video action recognition. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16-20, 2019, pp. 12046–12055, 2019.
193
+
194
+ Michael Gutmann and Aapo Hyvarinen. Noise-contrastive estimation: A new estimation principle ¨ for unnormalized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, AISTATS 2010, Chia Laguna Resort, Sardinia, Italy, May 13-15, 2010, pp. 297–304, 2010.
195
+
196
+ Tengda Han, Weidi Xie, and Andrew Zisserman. Video representation learning by dense predictive coding. CoRR, abs/1909.04656, 2019.
197
+
198
+ Kensho Hara, Hirokatsu Kataoka, and Yutaka Satoh. Can spatiotemporal 3d cnns retrace the history of 2d cnns and imagenet? In 2018 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, Salt Lake City, UT, USA, June 18-22, 2018, pp. 6546–6555, 2018.
199
+
200
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, pp. 770–778, 2016.
201
+
202
+ Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross B. Girshick. Mask R-CNN. In ´ IEEE International Conference on Computer Vision, ICCV 2017, Venice, Italy, October 22-29, 2017, pp. 2980–2988, 2017.
203
+
204
+ Geoffrey E. Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. CoRR, abs/1503.02531, 2015.
205
+
206
+ R. Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Philip Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019, 2019.
207
+
208
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Proceedings of the 32nd International Conference on Machine Learning, ICML 2015, Lille, France, 6-11 July 2015, pp. 448–456, 2015.
209
+
210
+ Dinesh Jayaraman and Kristen Grauman. Learning image representations tied to egomotion from unlabeled video. International Journal of Computer Vision, 125(1-3):136–161, 2017.
211
+
212
+ Will Kay, Joao Carreira, Karen Simonyan, Brian Zhang, Chloe Hillier, Sudheendra Vijaya- ˜ narasimhan, Fabio Viola, Tim Green, Trevor Back, Paul Natsev, Mustafa Suleyman, and Andrew Zisserman. The kinetics human action video dataset. CoRR, abs/1705.06950, 2017.
213
+
214
+ Bruno Korbar, Du Tran, and Lorenzo Torresani. Cooperative learning of audio and video models from self-supervised synchronization. In Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, 3-8 December 2018, Montreal, Canada. ´ , pp. 7774–7785, 2018.
215
+
216
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems 25: 26th Annual Conference on Neural Information Processing Systems 2012. Proceedings of a meeting held December 3-6, 2012, Lake Tahoe, Nevada, United States., pp. 1106–1114, 2012.
217
+
218
+ Hildegard Kuehne, Hueihan Jhuang, Est´ıbaliz Garrote, Tomaso A. Poggio, and Thomas Serre. HMDB: A large video database for human motion recognition. In IEEE International Conference on Computer Vision, ICCV 2011, Barcelona, Spain, November 6-13, 2011, pp. 2556–2563, 2011.
219
+
220
+ Hsin-Ying Lee, Jia-Bin Huang, Maneesh Singh, and Ming-Hsuan Yang. Unsupervised representation learning by sorting sequences. In IEEE International Conference on Computer Vision, ICCV 2017, Venice, Italy, October 22-29, 2017, pp. 667–676, 2017.
221
+
222
+ Dhruv Mahajan, Ross B. Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens van der Maaten. Exploring the limits of weakly supervised pretraining. In Computer Vision - ECCV 2018 - 15th European Conference, Munich, Germany, September 8-14, 2018, Proceedings, Part II, pp. 185–201, 2018.
223
+
224
+ Pascal Mettes and Cees G. M. Snoek. Spatial-aware object embeddings for zero-shot localization and classification of actions. In The IEEE International Conference on Computer Vision (ICCV), Oct 2017.
225
+
226
+ Antoine Miech, Ivan Laptev, and Josef Sivic. Learning a text-video embedding from incomplete and heterogeneous data. CoRR, abs/1804.02516, 2018.
227
+
228
+ Antoine Miech, Dimitri Zhukov, Jean-Baptiste Alayrac, Makarand Tapaswi, Ivan Laptev, and Josef Sivic. Howto100m: Learning a text-video embedding by watching hundred million narrated video clips. CoRR, abs/1906.03327, 2019.
229
+
230
+ Antoine Miech, Jean-Baptiste Alayrac, Lucas Smaira, Ivan Laptev, Josef Sivic, and Andrew Zisserman. End-to-end learning of visual representations from uncurated instructional videos. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, Seattle, WA, USA, June 13-19, 2020, pp. 9876–9886, 2020.
231
+
232
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. In Yoshua Bengio and Yann LeCun (eds.), 1st International Conference on Learning Representations, ICLR 2013, Scottsdale, Arizona, USA, May 2-4, 2013, Workshop Track Proceedings, 2013.
233
+
234
+ Ishan Misra, C. Lawrence Zitnick, and Martial Hebert. Shuffle and learn: Unsupervised learning using temporal order verification. In Computer Vision - ECCV 2016 - 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part I, pp. 527–544, 2016.
235
+
236
+ Joe Yue-Hei Ng, Jonghyun Choi, Jan Neumann, and Larry S. Davis. Actionflownet: Learning motion representation for action recognition. In 2018 IEEE Winter Conference on Applications of Computer Vision, WACV 2018, Lake Tahoe, NV, USA, March 12-15, 2018, pp. 1616–1624, 2018.
237
+
238
+ Mehdi Noroozi, Hamed Pirsiavash, and Paolo Favaro. Representation learning by learning to count. In IEEE International Conference on Computer Vision, ICCV 2017, Venice, Italy, October 22-29, 2017, pp. 5899–5907, 2017.
239
+
240
+ Yingwei Pan, Tao Mei, Ting Yao, Houqiang Li, and Yong Rui. Jointly modeling embedding and translation to bridge video and language. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, pp. 4594–4602, 2016.
241
+
242
+ Bryan A. Plummer, Matthew Brown, and Svetlana Lazebnik. Enhancing video summarization via vision-language embedding. In 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017, pp. 1052–1060, 2017.
243
+
244
+ Peng Qi, Timothy Dozat, Yuhao Zhang, and Christopher D. Manning. Universal dependency parsing from scratch. In Proceedings of the CoNLL 2018 Shared Task: Multilingual Parsing from Raw Text to Universal Dependencies, pp. 160–170, Brussels, Belgium, October 2018. Association for Computational Linguistics.
245
+
246
+ Shaoqing Ren, Kaiming He, Ross B. Girshick, and Jian Sun. Faster R-CNN: towards real-time object detection with region proposal networks. In Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pp. 91–99, 2015.
247
+
248
+ Anna Rohrbach, Atousa Torabi, Marcus Rohrbach, Niket Tandon, Christopher Joseph Pal, Hugo Larochelle, Aaron C. Courville, and Bernt Schiele. Movie description. International Journal of Computer Vision, 123(1):94–120, 2017.
249
+
250
+ Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. Distilbert, a distilled version of BERT: smaller, faster, cheaper and lighter. CoRR, abs/1910.01108, 2019.
251
+
252
+ Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah. UCF101: A dataset of 101 human actions classes from videos in the wild. CoRR, abs/1212.0402, 2012.
253
+
254
+ Jonathan C. Stroud, David A. Ross, Chen Sun, Jia Deng, Rahul Sukthankar, and Cordelia Schmid. Learning video representations from textual web supervision. CoRR, abs/2007.14937, 2020. URL https://arxiv.org/abs/2007.14937.
255
+
256
+ Chen Sun, Fabien Baradel, Kevin Murphy, and Cordelia Schmid. Contrastive bidirectional transformer for temporal representation learning. CoRR, abs/1906.05743, 2019a.
257
+
258
+ Chen Sun, Austin Myers, Carl Vondrick, Kevin Murphy, and Cordelia Schmid. Videobert: A joint model for video and language representation learning. CoRR, abs/1904.01766, 2019b.
259
+
260
+ Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. CoRR, abs/1906.05849, 2019.
261
+
262
+ Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Anticipating visual representations from unlabeled video. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, pp. 98–106, 2016.
263
+
264
+ Jiangliu Wang, Jianbo Jiao, Linchao Bao, Shengfeng He, Yunhui Liu, and Wei Liu. Self-supervised spatio-temporal representation learning for videos by predicting motion and appearance statistics. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019a.
265
+
266
+ Xiaolong Wang and Abhinav Gupta. Unsupervised learning of visual representations using videos. In 2015 IEEE International Conference on Computer Vision, ICCV 2015, Santiago, Chile, December 7-13, 2015, pp. 2794–2802, 2015.
267
+
268
+ Xiaolong Wang, Allan Jabri, and Alexei A. Efros. Learning correspondence from the cycleconsistency of time. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16-20, 2019, pp. 2566–2576, 2019b.
269
+
270
+ Donglai Wei, Joseph J. Lim, Andrew Zisserman, and William T. Freeman. Learning and using the arrow of time. In 2018 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, Salt Lake City, UT, USA, June 18-22, 2018, pp. 8052–8060, 2018.
271
+
272
+ Zhirong Wu, Yuanjun Xiong, Stella X. Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In 2018 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, Salt Lake City, UT, USA, June 18-22, 2018, pp. 3733–3742, 2018.
273
+
274
+ Saining Xie, Chen Sun, Jonathan Huang, Zhuowen Tu, and Kevin Murphy. Rethinking spatiotemporal feature learning: Speed-accuracy trade-offs in video classification. In ECCV, pp. 318–335, 2018.
275
+
276
+ Dejing Xu, Jun Xiao, Zhou Zhao, Jian Shao, Di Xie, and Yueting Zhuang. Self-supervised spatiotemporal learning via video clip order prediction. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16-20, 2019, pp. 10334–10343, 2019a.
277
+
278
+ Dejing Xu, Jun Xiao, Zhou Zhao, Jian Shao, Di Xie, and Yueting Zhuang. Self-supervised spatiotemporal learning via video clip order prediction. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019b.
279
+
280
+ Richard Zhang, Phillip Isola, and Alexei A. Efros. Colorful image colorization. In Computer Vision - ECCV 2016 - 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part III, pp. 649–666, 2016.
281
+
282
+ Yue Zhao, Yuanjun Xiong, Limin Wang, Zhirong Wu, Xiaoou Tang, and Dahua Lin. Temporal action detection with structured segment networks. In IEEE International Conference on Computer Vision, ICCV 2017, Venice, Italy, October 22-29, 2017, pp. 2933–2942, 2017.
283
+
284
+ Tinghui Zhou, Matthew Brown, Noah Snavely, and David G. Lowe. Unsupervised learning of depth and ego-motion from video. In 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017, pp. 6612–6619, 2017.
285
+
286
+ # A TRAINING DETAILS OF CPD
287
+
288
+ we adopt noise-contrastive estimation technique (NCE) to approximate objective function in Equation (5) in our main paper. The purpose of NCE is to transform the multi-class classification problem into a set of binary classification problems by comparing data distribution against noise distribution. So $p _ { n }$ is noise distribution and we formalize it as a uniform distribution: $\begin{array} { r } { { p } _ { n } = \frac { 1 } { N } } \end{array}$ , where $N$ is the number of video-text pairs. $h ( i _ { t } , v )$ is the posterior probability of feature from the data distribution which means video and text are matched. $m$ is the number of negative pairs and we set it as 4096. For each video feature $\mathbf { f } ^ { v }$ , we take its related text feature $\mathbf { f } _ { i } ^ { t }$ and sample 4096 unrelated text features $\mathbf { f } _ { j } ^ { t }$ which are all from memory bank. The FPS of training videos are 30. The code of CPD will be released.
289
+
290
+ # A.1 ANALYSIS ON DIFFERENT LOSS FUNCTIONS
291
+
292
+ More insight about why our loss is better than ranking loss could be found from gradient backpropagation. Let $\mathbf { f } ^ { t + }$ and $\mathbf { f } ^ { t - }$ represent the associated and unrelated text feature. For ranking loss, the negative gradient w.r.t $\mathbf { f } ^ { v }$ is $\bar { \mathbf { f } ^ { t + } } - \mathbf { f } ^ { t - }$ if $\mathcal { L } > 0$ else 0. For CPD loss, it is $[ 1 - h ( i _ { t } ^ { + } , v ) ] / \bar { \bf \Delta } \bar { \bf f } ^ { t + } -$ $\sum h ( i _ { t } ^ { - } , v ) / \tau \mathbf { f } ^ { t - }$ . We observe our loss assign different weights to different examples based on their posterior probability $h$ , which helps learn from hard examples while the ranking loss treats them equally.
293
+
294
+ # B REPRESENTATION TRANSFER ON KINETICS
295
+
296
+ <table><tr><td rowspan="2">Method</td><td colspan="3">The Amount ofLabeled Data</td></tr><tr><td>1%</td><td>10%</td><td>20%</td></tr><tr><td>Fromscratch</td><td>0.3</td><td>10.7</td><td>33.3</td></tr><tr><td>ImageNet Inflation</td><td>12.8</td><td>36.8</td><td>45.7</td></tr><tr><td>Ours (Instagram-300k)</td><td>18.7</td><td>41.3</td><td>47.4</td></tr><tr><td>Ours (Kinetics-210k)</td><td>25.9</td><td>43.1</td><td>47.8</td></tr></table>
297
+
298
+ Table 4: Results of classification with small amount of labeled data on Kinetics-400 validation set (showing top-1 accuracy). We utilize 3D ResNet34 as backbone and pre-train it on Kinetics-210k and Instagram-210k.
299
+
300
+ Our weakly-supervised pre-trained representation can be an efficient initialization when training the model with only a small amount of labeled data. We randomly choose a small fraction of Kinetics400 training set as labeled data and fine-tune the pre-trained model on it. We report the performance of top-1 accuracy which is trained on labeled subset of $1 \%$ , $10 \%$ and $20 \%$ of the entire dataset in Table 4. We compare our method with training from scratch and ImageNet inflated model as baselines. Our method significantly surpasses the baselines on all present proportion of labeled subset especially when the amount of labeled data is extremely small. When only $1 \%$ of data is labeled, training from scratch can not learn anything yet our model achieves $1 8 . 7 \%$ and $2 5 . 9 \%$ top-1 accuracy. Both our CPD pre-trained models on Instagram and Kinetics outperform the ImageNet pre-trained models.
301
+
302
+ # C EVALUATION ON ZERO-SHOT CLASSIFICATION
303
+
304
+ We evaluate our visual-textual embedding of CPD model with zero-shot classification on UCF101 and Kinetics-400 without any fine-tuning in Table 5. We transform class labels and video clips into the same embedding space and recognize the video clip to its closest class with cosine distance. We compare our method with Mettes et al. (Mettes & Snoek, 2017) which realizes zero-shot localization and classification of human action in video via spatial-aware object embeddings on UCF101. Following (Mettes & Snoek, 2017), we select different classes for 10 times and average their accuracies for testing except the class number is 101. We outperform for every number of testing classes. For Kinetics-400, we achieve top-1 accuracy of $4 3 . 7 \%$ without fine-tuning and training label. In addition, top-1 accuracy of 20 random classes reaches to $7 4 . 4 \%$ , which shows the strong capability of our visual-textual embedding.
305
+
306
+ Table 5: Top-1 accuracy of zero-shot classification on UCF-101 and Kinetics-400. We outperform other methods without any extra labeled data and training procedure after pre-training on Kinetics210k.
307
+
308
+ <table><tr><td rowspan="2">Methods</td><td colspan="4">UCF-101</td><td colspan="4">Kinetics-400</td></tr><tr><td>Train</td><td>Test</td><td>Split</td><td>Acc.</td><td>Train</td><td>Test</td><td>Split</td><td>Acc.</td></tr><tr><td>Mettes (Mettes&amp; Snoek,2017)</td><td>1</td><td>101</td><td>3</td><td>32.8</td><td>-</td><td>-</td><td>1</td><td>1</td></tr><tr><td>Ours(3D ResNet34)</td><td>=</td><td>101</td><td>3</td><td>40.6</td><td>=</td><td>400</td><td>1</td><td>38.2</td></tr><tr><td>Ours(3D ResNet50)</td><td>-</td><td>101</td><td>3</td><td>39.9</td><td>-</td><td>400</td><td>1</td><td>43.7</td></tr><tr><td>Mettes(Mettes&amp; Snoek,2017)</td><td>-</td><td>50</td><td>10</td><td>40.4</td><td>-</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Ours(3D ResNet34)</td><td></td><td>50</td><td>10</td><td>47.2</td><td>=</td><td>100</td><td>10</td><td>55.3</td></tr><tr><td>Ours(3D ResNet50)</td><td></td><td>50</td><td>10</td><td>44.8</td><td>=</td><td>100</td><td>10</td><td>57.4</td></tr><tr><td>Mettes (Mettes&amp; Snoek,2017)</td><td></td><td>20</td><td>10</td><td>51.2</td><td>1</td><td>-</td><td>-</td><td>=</td></tr><tr><td>Ours(3D ResNet34)</td><td></td><td>20</td><td>10</td><td>54.4</td><td>=</td><td>20</td><td>10</td><td>73.1</td></tr><tr><td>Ours(3D ResNet50)</td><td></td><td>20</td><td>10</td><td>58.1</td><td>=</td><td>20</td><td>10</td><td>74.4</td></tr></table>
309
+
310
+ # D ANALYZE TEXT INFORMATION
311
+
312
+ # D.1 ANALYSIS ON KINETICS TITLE
313
+
314
+ Table 6: Analyze text information of Kinetics-210k datasets. At Least One: The proportion of text information that contains at least one word in action classes of Kinetics-400. All: The proportion of text information that contains the entire action class. $R e l$ : The proportion of word in text information that is relevant to action classes.
315
+
316
+ <table><tr><td>Datasets</td><td>At Least One(%)</td><td>A11(%)</td><td>Rel(%)</td></tr><tr><td>Kinetics-title-tree</td><td>90.5</td><td>44.3</td><td>46.3</td></tr><tr><td>Kinetics-title-clean</td><td>91.6</td><td>38.4</td><td>26.0</td></tr></table>
317
+
318
+ We provide an analysis of text information we used and the result in Table 6. First, there exists a large overlap between action class and text information (more than $90 \%$ for at least one word and more than $38 \%$ for complete action class). However, the titles also contain many other words and noisier information than action classes. Only $26 \%$ of words in Kinetics-title-clean are relevant to action classes.
319
+
320
+ ![](images/ad7bcc7280b2e78acea6087fc4a4e1cc11c2bec2263d73b9806c870843806321.jpg)
321
+ Figure 2: List of top 10 and bottom 10 kinetics classes sorted by the frequency of at least one word in label occurring in according title of Kinetics-title-clean dataset. Zoom in for more details. We also report the per-class accuracy of top 10 and bottom 10 classes sorted by word overlapping in Figure 2 and see that this accuracy is not positively correlated with word overlapping percentage. Finally, we provide some examples of videos and their titles from Kinetics-210k in Figure 3.
322
+
323
+ # D.2 VISUALIZATION OF INSTAGRAM CAPTION
324
+
325
+ Since videos from Instagram-300k are not annotated or filtered by human, both of their visual and textual information are very noisy. Figure 4 demonstrates some examples of videos and their associated captions. Figure 4a presents an example of high-quality video and relative accurate caption that both are about folding napkin. Many captions describe some useful information but also contain noisy text that is not related to video content (e.g., summerdays and gettingtattooed in Figure 4b and very long sentences in Figure 4d). In addition, there are some correct but not totally accurate descriptions. Figure 4c shows that the action in video is shot putting rather than spinning (appears in associated caption). Figure 4f illustrates that a person is climbing but its caption is mainly about high jumpping. Figure 4e shows that video content can also be noisy due to low video quality and shot transformation.
326
+
327
+ ![](images/18a06d7e24dcf2ca11f47c9494c912565a377463e4f0eff00aa54fe17b8bc0da.jpg)
328
+ Figure 3: Examples of video and title pairs from Kinetics-210k.
329
+
330
+ Bird of Paradise Napkin Fold #napkinfolding #napkinart #napkin #yellow #napkinfold #birdofparadise #kidscrafts #diy #video #tutorial #decoration #tablesetting
331
+
332
+ ![](images/2bc24d3718235e6d923f7c302986676576fe887ce7fc1a26163532e11a745b6f.jpg)
333
+ Figure 4: Examples of videos and their associated captions from Instagram-300k.
334
+
335
+ #roadtrip from #britishcolumbia to #alberta. drivingallnight #mountains #trees #summer #summerdays #summerlovin #highway #music #playlist #carpoolkaraoke #notreallyasinger #butitry #gettingtattooed #buyingatruck #duoting
336
+
337
+ Day 1 of learning to spin $\circledast$ . A work in progress but having fun with it!
338
+
339
+ Good morning beautiful people of #god #grateful for another day he has given me #prayingfor #guidance and #protection in #Jesusname I #pray #amen Early #dinnersettings today #potroastbeef #bakechicken #vegetables WHAT #RICEANDPEAS WOULD YOU EAT WITH THIS? #pyjamachef #foodbloger #pyjamachef #healthyeating #alltypeoffood #lovecooking
340
+
341
+ My pets are unruly... Who wants them...??? #computerwork #selfishpets
342
+
343
+ High Jump Challenge Very funny $\textcircled { \dag }$ ?? #boulder #highjump #fitness #climbing #ninjawarrior #ninjawarriorswitzerland #challenge #funny
md/train/XQQA6-So14/XQQA6-So14.md ADDED
@@ -0,0 +1,530 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NEURAL SPATIO-TEMPORAL POINT PROCESSES
2
+
3
+ Ricky T. Q. Chen∗ University of Toronto; Vector Institute rtqichen@cs.toronto.edu
4
+
5
+ Brandon Amos, Maximilian Nickel
6
+ Facebook AI Research
7
+ {bda,maxn}@fb.com
8
+
9
+ # ABSTRACT
10
+
11
+ We propose a new class of parameterizations for spatio-temporal point processes which leverage Neural ODEs as a computational method and enable flexible, highfidelity models of discrete events that are localized in continuous time and space. Central to our approach is a combination of continuous-time neural networks with two novel neural architectures, i.e., Jump and Attentive Continuous-time Normalizing Flows. This approach allows us to learn complex distributions for both the spatial and temporal domain and to condition non-trivially on the observed event history. We validate our models on data sets from a wide variety of contexts such as seismology, epidemiology, urban mobility, and neuroscience.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Modeling discrete events that are localized in continuous time and space is an important task in many scientific fields and applications. Spatio-temporal point processes (STPPs) are a versatile and principled framework for modeling such event data and have, consequently, found many applications in a diverse range of fields. This includes, for instance, modeling earthquakes and aftershocks (Ogata, 1988; 1998), the occurrence and propagation of wildfires (Hering et al., 2009), epidemics and infectious diseases (Meyer et al., 2012; Schoenberg et al., 2019), urban mobility (Du et al., 2016), the spread of invasive species (Balderama et al., 2012), and brain activity (Tagliazucchi et al., 2012).
16
+
17
+ It is of great interest in all of these areas to learn high-fidelity models which can jointly capture spatial and temporal dependencies and their propagation effects. However, existing parameterizations of STPPs are strongly restricted in this regard due to computational considerations: In its general form, STPPs require solving multivariate integrals for computing likelihood values and thus have primarily been studied within the context of different approximations and model restrictions. This includes, for instance, restricting the model class to parameterizations with known closed-form solutions (e.g., exponential Hawkes processes (Ozaki, 1979)), to restrict dependencies between the spatial and temporal domain (e.g., independent and unpredictable marks (Daley & Vere-Jones, 2003)), or to discretize continuous time and space (Ogata, 1998). These restrictions and approximations—which can lead to mis-specified models and loss of information—motivated the development of neural temporal point processes such as Neural Hawkes Processes (Mei & Eisner, 2017) and Neural Jump SDEs (Jia & Benson, 2019). While these methods are more flexible, they can still require approximations such as Monte-Carlo sampling of the likelihood (Mei & Eisner, 2017; Nickel & Le, 2020) and, most importantly, only model restricted spatial distributions (Jia & Benson, 2019).
18
+
19
+ ![](images/fa57820cf1c346f628551e171ee58cac549d8c865680579795012e82f52dbaf4.jpg)
20
+ Figure 1: Color is used to denote $p ( x | t )$ , which can be evaluated for Neural STPPs. After observing an event in one mode, the model is instantaneously updated as it strongly expects an event in the next mode. After a period of no observations, the model smoothly reverts back to the marginal distribution.
21
+
22
+ To overcome these issues, we propose a new class of parameterizations for spatio-temporal point processes which leverage Neural ODEs as a computational method and allows us to define flexible, high-fidelity models for spatio-temporal event data. We build upon ideas of Neural Jump SDEs (Jia & Benson, 2019) and Continuous-time Normalizing Flows (CNFs; Chen et al. 2018; Grathwohl et al. 2019; Mathieu & Nickel 2020) to learn parametric models of spatial (or mark1) distributions that are defined continuously in time. Normalizing flows are known to be flexible universal density estimators (e.g. Huang et al. 2018; 2020; Teshima et al. 2020; Kong & Chaudhuri 2020) while retaining computational tractability. As such, our approach allows the computation of exact likelihood values even for highly complex spatio-temporal distributions, and our models create smoothly changing spatial distributions that naturally benefits spatio-temporal modeling. Central to our approach, are two novel neural architectures based on CNFs—using either discontinuous jumps in distribution or self-attention—to condition spatial distributions on the event history. To the best of our knowledge, this is the first method that combines the flexibility of neural TPPs with the ability to learn high-fidelity models of continuous marks that can have complex dependencies on the event history. In addition to our modeling contributions, we also construct five new pre-processed data sets for benchmarking spatio-temporal event models.
23
+
24
+ # 2 BACKGROUND
25
+
26
+ In the following, we give a brief overview of two core frameworks which our method builds upon, i.e., spatio-temporal point processes and continuous-time normalizing flows.
27
+
28
+ Event Modeling with Point Processes Spatio-temporal point processes are concerned with modeling sequences of random events in continuous space and time (Moller & Waagepetersen, 2003; Baddeley et al., 2007). Let $\mathcal { H } = \{ ( t _ { i } , \pmb { x } _ { i } ) \} _ { i = 1 } ^ { n }$ denote the sequence of event times $t _ { i } \in \mathbb { R }$ and their associated locations $\pmb { x } _ { i } \in \mathbb { R } ^ { d }$ , the number of events $n$ being also random. Additionally, let $\mathcal { H } _ { t } = \{ ( t _ { i } , \pmb { x } _ { i } ) ~ | ~ t _ { i } < t , t _ { i } \in \mathcal { H } \}$ denote the history of events predating time $t$ . A spatio-temporal point process is then fully characterized by its conditional intensity function
29
+
30
+ $$
31
+ \lambda ( t , \pmb { x } \mid \mathcal { H } _ { t } ) \triangleq \operatorname* { l i m } _ { \Delta t \downarrow 0 , \Delta \pmb { x } \downarrow 0 } \frac { \mathbb { P } \left( t _ { i } \in [ t , t + \Delta t ] , \pmb { x } _ { i } \in B ( \pmb { x } , \Delta \pmb { x } ) \mid \mathcal { H } _ { t } \right) } { | B ( \pmb { x } , \Delta \pmb { x } ) | \Delta t } .
32
+ $$
33
+
34
+ where $B ( { \pmb x } , \Delta { \pmb x } )$ denotes a ball centered at $\pmb { x } \in \mathbb { R } ^ { d }$ and with radius $\Delta \mathbfit { x }$ . The only condition is that $\lambda ( t , \pmb { x } \mid \mathcal { H } _ { t } ) \geq 0$ and need not be normalized. Given $i - 1$ previous events, the conditional intensity function describes therefore the instantaneous probability of the $i$ -th event occurring at $t$ and location $_ { \textbf { \em x } }$ . In the following, we will use the common star superscript shorthand $\lambda ^ { * } ( t , \pmb { x } ) = \lambda ( t , \pmb { x } \mid \mathcal { H } _ { t } )$ to denote conditional dependence on the history. The joint log-likelihood of observing $\mathcal { H }$ within a time interval of $[ 0 , T ]$ is then given by (Daley $\&$ Vere-Jones, 2003, Proposition 7.3.III)
35
+
36
+ $$
37
+ \log p \left( \mathcal { H } \right) = \sum _ { i = 1 } ^ { n } \log \lambda ^ { * } ( t _ { i } , \pmb { x } _ { i } ) - \int _ { 0 } ^ { T } \int _ { \mathbb { R } ^ { d } } \lambda ^ { * } ( \tau , \pmb { x } ) d \pmb { x } d \tau .
38
+ $$
39
+
40
+ Training general STPPs with maximum likelihood is difficult as eq. (2) requires solving a multivariate integral. This need to compute integrals has driven research to focus around the use of kernel density estimators (KDE) with exponential kernels that have known anti-derivatives (Reinhart et al., 2018).
41
+
42
+ Continuous-time Normalizing Flows Normalizing flows (Dinh et al., 2014; 2016; Rezende & Mohamed, 2015) is a class of density models that describe flexible distributions by parameterizing an invertible transformation from a simpler base distribution, which enables exact computation of the probability of the transformed distribution, without any unknown normalization constants.
43
+
44
+ Given a random variable $\scriptstyle { \pmb x } _ { 0 }$ with known distribution $p ( \pmb { x } _ { 0 } )$ and an invertible transformation $F ( x )$ , the transformed variable $F ( \pmb { x } _ { 0 } )$ is a random variable with a probability distribution function that satisfies
45
+
46
+ $$
47
+ \log p ( F ( { \pmb x } _ { 0 } ) ) = \log p ( { \pmb x } _ { 0 } ) - \log \left| \operatorname* { d e t } \frac { \partial F } { \partial { \pmb x } } ( { \pmb x } _ { 0 } ) \right| .
48
+ $$
49
+
50
+ There have been many advances in parameterizing $F$ with flexible neural networks that also allow for cheap evaluations of eq. (3). We focus our attention on Continuous-time Normalizing Flows (CNFs), which parameterizes this transformation with a Neural ODE (Chen et al., 2018). CNFs define an infinite set of distributions on the real line that vary smoothly across time, and will be our core component for modeling events in the spatial domain.
51
+
52
+ Let $p ( \pmb { x } _ { 0 } )$ be the base distribution2. We then parameterize an instantaneous change in the form of an ordinary differential equation (ODE), $\begin{array} { r } { \frac { d { \pmb x } _ { t } } { d t } = f ( t , { \pmb x } _ { t } ) } \end{array}$ , where the subscript denotes dependence on $t$ . This function can be parameterized using any Lipschitz-continuous neural network. Conditioned on a sample $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ from the base distribution, let $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ be the solution of the initial value problem 3 at time $t$ , i.e. it is from a trajectory that passes through $\scriptstyle { \pmb x } _ { 0 }$ at time 0 and satisfies the ODE $d { \pmb x } _ { t } / d t = f$ . We can express the value of the solution at time $t$ as
53
+
54
+ $$
55
+ { \pmb x } _ { t } = { \pmb x } _ { 0 } + \int _ { 0 } ^ { t } f ( t , { \pmb x } _ { \tau } ) d \tau .
56
+ $$
57
+
58
+ The distribution of $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ then also continuously changes in $t$ through the following equation,
59
+
60
+ $$
61
+ \log p ( { \pmb x } _ { t } | t ) = \log p ( { \pmb x } _ { 0 } ) - \int _ { 0 } ^ { t } \mathrm { t r } \left( \frac { \partial f } { \partial x } ( \tau , { \pmb x } _ { \tau } ) \right) ~ d \tau .
62
+ $$
63
+
64
+ In practice, eq. (4) and eq. (5) are solved together from 0 to $t$ , as eq. (5) alone is not an ordinary differential equation but the combination of $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ and $\log p ( { \pmb x } _ { t } )$ is. The trace of the Jacobian $\frac { \partial f } { \partial \boldsymbol { x } } ( \tau , \pmb { x } _ { \tau } )$ can be estimated using a Monte Carlo estimate of the identity (Skilling, 1989; Hutchinson, 1990), $\mathrm { t r } ( A ) = \mathbb { E } _ { v \sim \mathcal { N } ( 0 , 1 ) } [ v ^ { \top } A v ]$ . This estimator relies only on a vector-Jacobian product, which can be efficiently computed in modern automatic differentiation and deep learning frameworks. This has been used (Grathwohl et al., 2019) to scale CNFs to higher dimensions using a Monte Carlo estimate of the log likelihood objective,
65
+
66
+ $$
67
+ \log p ( { \pmb x } _ { t } | t ) = \log p ( { \pmb x } _ { 0 } ) - \mathbb { E } _ { \pmb { v } \sim \mathcal { N } ( 0 , 1 ) } \left[ \int _ { 0 } ^ { t } v ^ { \top } \frac { \partial f } { \partial x } ( \tau , { \pmb x } _ { \tau } ) v \ d \tau \right] ,
68
+ $$
69
+
70
+ which, even if only one sample of $v$ is used, is still amenable to training with stochastic gradient descent. Gradients with respect to any parameters in $f$ can be computed with constant memory by solving an adjoint ODE in reverse-time as described in Chen et al. (2018).
71
+
72
+ # 3 NEURAL SPATIO-TEMPORAL POINT PROCESSES
73
+
74
+ We are interested in modeling high-fidelity distributions in continuous time and space that can be updated based on new event information. For this purpose, we use the Neural ODE framework to parameterize a STPP by combining ideas from Neural Jump SDEs and Continuous Normalizing Flows to create highly flexible models that still allow exact likelihood computation.
75
+
76
+ We first (re-)introduce necessary notation. Let $\mathcal { H } = \{ ( t _ { i } , \pmb { x } _ { t _ { i } } ^ { ( i ) } ) \}$ denote a sequence of event times $t _ { i } \in [ 0 , T ]$ and locations $\pmb { x } _ { t _ { i } } ^ { ( i ) } \in \mathbb { R } ^ { d }$ i. The superscript indicates an association with the $i$ -th event, and the use of subscripting with $t _ { i }$ will be useful later in the continuous-time modeling framework. Following Daley & Vere-Jones (2003), we decompose the conditional intensity function as
77
+
78
+ $$
79
+ \lambda ^ { * } ( t , { \pmb x } ) = \lambda ^ { * } ( t ) p ^ { * } ( { \pmb x } \mid t )
80
+ $$
81
+
82
+ where $\lambda ^ { * } ( t )$ is the ground intensity of the temporal process and where $\boldsymbol { p } ^ { * } ( \boldsymbol { x } \mid t )$ is the conditional density of a mark $_ { \textbf { \em x } }$ at $t$ given $\mathcal { H } _ { t }$ . The star superscript is used as again shorthand to denote dependence on the history. Since $\textstyle \int _ { \mathbb { R } ^ { d } } p ^ { * } ( { \pmb { x } } \mid t ) = 1$ , eq. (7) allows us now to simplify the log-likelihood function of the joint process from eq. (2), such that
83
+
84
+ $$
85
+ \log p ( \mathcal { H } ) = \underbrace { \sum _ { i = 1 } ^ { n } \log \lambda ^ { * } ( t _ { i } ) - \int _ { 0 } ^ { T } \lambda ^ { * } ( \tau ) ~ d \tau } _ { \mathrm { t e m p o r a l ~ l o g - l i k e l i h o o d } } + \underbrace { \sum _ { i = 1 } ^ { n } \log p ^ { * } ( \pmb { x } _ { t _ { i } } ^ { ( i ) } | t _ { i } ) } _ { \mathrm { s p a t i a l ~ l o g - l i k e l i h o o d } }
86
+ $$
87
+
88
+ Furthermore, based on eq. (7), we can derive separate models for the ground intensity and conditional mark density which will be jointly conditioned on a continuous-time hidden state with jumps. In the following, we will first describe how we construct a latent dynamics model, which we use to compute the ground intensity $\lambda ^ { * } ( t )$ . We will then propose three novel CNF-based approaches for modeling the conditional mark density $p ^ { * } ( { \pmb x } | t )$ . We will first describe an unconditional model, which is already a strong baseline when spatial event distributions only follow temporal patterns and there is little to no correlation between the spatial observations. We then devise two new methods of conditioning on the event history $\mathcal { H }$ : one explicitly modeling instantaneous changes in distribution, and another that uses an attention mechanism which is more amenable to parallelism.
89
+
90
+ Latent Dynamics and Ground Intensity For the temporal variables $\{ t _ { i } \}$ , parameterize the intensity function using hidden state dynamics with jumps, similar to the work of Jia & Benson (2019). Specifically, we evolve a continuous-time hidden state $^ { h }$ and set
91
+
92
+ $$
93
+ \lambda ^ { * } ( t ) = g _ { \lambda } ( h _ { t } ) \qquad \mathrm { ( G r o u n d i n t e n s i t y ) }
94
+ $$
95
+
96
+ where $g _ { \lambda }$ is a neural network with a softplus nonlinearity applied to the output, to ensure the intensity is positive. We then capture conditional dependencies through the use of a continuously changing state $\boldsymbol { h } _ { t }$ with instantaneous updates when conditioned on an event.
97
+
98
+ The architecture is analogous to a recurrent neural network with a continuous-time hidden state (Mei & Eisner, 2017; Che et al., 2018; Rubanova et al., 2019) modeled by a Neural ODE. This provides us with a vector representation $\boldsymbol { h } _ { t }$ at every time value $t$ that acts as both a summary of the history of events and as a predictor of future behavior. Instantaneous updates to $\boldsymbol { h } _ { t }$ allow to incorporate abrupt changes to the hidden state that are triggered by observed events. This mechanism is important for modeling point processes and allows past events to influence future dynamics in a discontinuous way (e.g., modeling immediate shocks to a system).
99
+
100
+ We use $f _ { h }$ to model the continuous change in the form of an ODE and $g _ { h }$ to model instantaneous changes based on an observed event.
101
+
102
+ $$
103
+ { \begin{array} { r l r l } & { h _ { t _ { 0 } } = h _ { 0 } } & & { ( { \mathrm { A n ~ i n i t i a l ~ h i d d e n ~ s t a t e } } ) } \\ & { { \frac { d h _ { t } } { d t } } = f _ { h } ( t , h _ { t } ) } & & { { \mathrm { b e t w e e n ~ e v e n t ~ t i m e s } } } & & { ( { \mathrm { C o n t i n u o u s ~ e v o l u t i o n } } ) } \\ & { \operatorname* { l i m } _ { \varepsilon \to 0 } h _ { t _ { i } + \varepsilon } = g _ { h } \left( t _ { i } , h _ { t _ { i } } , x _ { t _ { i } } ^ { ( i ) } \right) } & & { { \mathrm { a t ~ e v e n t ~ t i m e s ~ } } t _ { i } } & & { ( { \mathrm { I n s t a n t a n e o u s ~ u p d a t e s } } ) } \end{array} }
104
+ $$
105
+
106
+ The use of $\varepsilon$ is to portray that $h _ { t }$ is a cagl \` ad\` function, i.e. left-continuous with right limits, with a discontinuous jump modeled by $g _ { h }$ .
107
+
108
+ The parameterization of continuous-time hidden states in the form of eqs. (10) to (12) has been used for time series modeling (Rubanova et al., 2019; De Brouwer et al., 2019) as well as TPPs (Jia & Benson, 2019). We parameterize $f _ { h }$ as a standard multi-layer fully connected neural network, and use the GRU update (Cho et al., 2014) to parameterize $g _ { h }$ , as was done in Rubanova et al. (2019).
109
+
110
+ Time-varying CNF The first model we consider is a straightforward application of the CNF to time-variable observations. Assuming that the spatial distribution is independent of prior events,
111
+
112
+ $$
113
+ \log p ^ { * } ( \pmb { x } _ { t _ { i } } ^ { ( i ) } | t _ { i } ) = \log p ( \pmb { x } _ { t _ { i } } ^ { ( i ) } | t _ { i } ) = \log p ( \pmb { x } _ { 0 } ^ { ( i ) } ) - \int _ { 0 } ^ { t _ { i } } \mathrm { t r } \left( \frac { \partial f } { \partial x } ( \tau , \pmb { x } _ { \tau } ^ { ( i ) } ) \right) d \tau
114
+ $$
115
+
116
+ where $\pmb { x } _ { \tau } ^ { ( i ) }$ ) is the solution of the ODE f with initial value x(i)t , the observed event location, at $\tau = t _ { i }$ the observed event time. The spatial distribution of an event modeled by a Time-varying CNF changes with respect to the time it occurs. Some spatio-temporal data sets exhibit mostly temporal patterns and little to no dependence on previous events in the spatial domain, which would make a time-varying CNF a good fit. Nevertheless, this model lacks the ability to capture spatial propagation effects, as it does not condition on previous event observations.
117
+
118
+ A major benefit of this model is the ability to evaluate the joint log-likelihood fully in parallel across events, since there are no dependencies between events. Most modern ODE solvers that we are aware of only allow a scalar terminal time. Thus, to solve all $n$ integrals in eq. (13) with a single call to an ODE solver, we can simply reparameterize all integrals with a consistent dummy variable and track the terminal time in the state (see Appendix $\mathrm { F }$ for detailed explanation). Intuitively, the idea is that we can reparameterize ODEs that are on $t \in [ 0 , t _ { i } ]$ into an ODE on $s \in [ 0 , 1 ]$ using the change of variables $\bar { s } = t / { { t } _ { i } }$ (or $t = s t _ { i }$ ) and scaling the output of $f$ by $t _ { i }$ . The joint ODE is then
119
+
120
+ $$
121
+ \frac { d } { d s } \underbrace { \left[ \begin{array} { c } { x _ { s } ^ { ( 1 ) } } \\ { \vdots } \\ { x _ { s } ^ { ( n ) } } \end{array} \right] } _ { A _ { s } } = \underbrace { \left[ t _ { 1 } f ( s t _ { 1 } , x _ { s } ^ { ( 1 ) } ) \right] } _ { f ( s t _ { n } , z _ { s } ) } \quad \mathrm { ~ w h i c h ~ g i v e s ~ } \quad \underbrace { \left[ \begin{array} { c } { x _ { 0 } ^ { ( 1 ) } } \\ { \vdots } \\ { x _ { 0 } ^ { ( n ) } } \end{array} \right] } _ { A _ { 0 } } + \int _ { 0 } ^ { 1 } f ( s , A _ { s } ) d s = \underbrace { \left[ \begin{array} { c } { x _ { t _ { 1 } } ^ { ( 1 ) } } \\ { \vdots } \\ { x _ { t _ { n } } ^ { ( n ) } } \end{array} \right] } _ { A _ { 1 } } .
122
+ $$
123
+
124
+ Thus the full trajectories between 0 to $t _ { i }$ for all events can be computed in parallel using this augmented ODE by simply integrating once from $s = 0$ to $s = 1$ .
125
+
126
+ $\mathbf { J u m p C N F }$ For the second model, we condition the dynamics defining the continuous normalizing flow on the hidden state $^ { h }$ , allowing the normalizing flow to update its distribution based on changes in $\mathcal { H }$ . For this purpose, we define continuous-time spatial distributions by making again use of two components: (i) a continuous-time normalizing flow that evolves the distribution continuously, and (ii) a standard (discrete-time) flow model that changes the distribution instantaneously after conditioning on new events. As normalizing flows parameterize distributions through transformations of the samples, these continuous- and discrete-time transformations are composable in a straightforward manner and are end-to-end differentiable.
127
+
128
+ The generative process of a single event in a Jump CNF is given by:
129
+
130
+ $$
131
+ \begin{array} { r l r l } { x _ { 0 } \sim p ( x _ { 0 } ) } & { } & & { \mathrm { ( A n i n i t i a l ~ d i s t r i b u t i o n ) } } \\ { \displaystyle \frac { d x _ { t } } { d t } = f _ { x } ( t , x _ { t } , h _ { t } ) } & { \mathrm { ~ b e t w e e n ~ e v e n t ~ t i m e s ~ } } & & { \mathrm { ( C o n t i n u o u s ~ e v o l u t i o n ) } } \\ { \displaystyle \operatorname* { l i m } _ { \varepsilon 0 } x _ { t _ { i } + \varepsilon } = g _ { x } ( t _ { i } , x _ { t _ { i } } , h _ { t _ { i } } ) } & { \quad \mathrm { a t ~ e v e n t ~ t i m e s ~ } t _ { i } } & & { \mathrm { ( I n s t a n t a n e o u s ~ u p d a t e s ) } } \end{array}
132
+ $$
133
+
134
+ The initial distribution can be parameterized by a normalizing flow. In practice, we set a base distribution at a negative time value and model $p ( \pmb { x } _ { 0 } )$ using the same CNF parameterized by $f _ { x }$ . The instantaneous updates (or jumps) describe conditional updates in distribution after each new event has been observed. This conditioning on $h _ { t _ { i } }$ is required for the continuous and instantaneous updates to depend on the history of observations. Otherwise, a Jump CNF would only be able to model the marginal distribution and behave similarly to a time-varying CNF. We solve for $h _ { t }$ alongside $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ .
135
+
136
+ The final probability of an event $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ at some $t > t _ { n }$ after observing $n$ events is given by the sum of changes according to the continuous- and discrete-time normalizing flows.
137
+
138
+ $$
139
+ \begin{array} { r l } & { \log p ^ { * } ( { \boldsymbol x } _ { t } | t ) = \log p ( { \boldsymbol x } _ { 0 } ) } \\ & { \quad \quad + \underbrace { \displaystyle \sum _ { t _ { i } \in \mathcal { H } _ { t } } \left( - \int _ { t _ { i - 1 } } ^ { t _ { i } } { \mathrm { t r } \left( \frac { \partial f ( \tau , { \boldsymbol x } _ { \tau } , h _ { \tau } ) } { \partial { \boldsymbol x } } \right) d \tau } - \log \left| \operatorname* { d e t } \frac { \partial g _ { { \boldsymbol x } } ( t _ { i } , { \boldsymbol x } _ { t _ { i } } , h _ { t _ { i } } ) } { \partial { \boldsymbol x } } \right| \right) } _ { \mathrm { C h a p e ~ i n g ~ u p ~ t o ~ l a s t ~ v e n t } } } \\ & { \quad \quad + \underbrace { \displaystyle \int _ { t _ { n } } ^ { t } - { \mathrm { t r } \left( \frac { \partial f ( \tau , { \boldsymbol x } _ { \tau } , h _ { \tau } ) } { \partial { \boldsymbol x } } \right) d \tau } } _ { \mathrm { C h a p e ~ i n g e n ~ l a s t ~ v e n t ~ t o ~ } } } \end{array}
140
+ $$
141
+
142
+ As the instantaneous updates must be applied sequentially in a Jump CNF, we can only compute the integrals in eq. (18) one at a time. As such, the number of initial value problems scales linearly with the number of events in the history because the ODE solver must be restarted between each instantaneous update to account for the discontinuous change to state. This incurs a substantial cost when the number of events is large.
143
+
144
+ Attentive CNF To design a spatial model with conditional dependencies that alleviates the computational issues of Jump CNFs and can be computed in parallel, we make use of efficient attention mechanisms based on the Transformer architecture (Vaswani et al., 2017). Denoting only the spatial variables for simplicity, each conditional distribution $\log p ( \pmb { x } _ { t _ { i } } \ | \ \mathcal { H } _ { t _ { i } } )$ can be modeled by a CNF that depends on the sample path of prior events. Specifically, we take the dummy-variable reparameterization of eq. (14) and modify it so that the $i$ -th event depends on all previous events using a Transformer architecture for $f$ ,
145
+
146
+ ![](images/63a02fc2549e8b7f69997b935dc6ed8a77774c252453939a052db56ee3e48cab.jpg)
147
+ Figure 2: Visualization of the sampling paths of Neural STPP models for a 1-D spatio-temporal data set where $\{ t _ { i } \} _ { i = 1 } ^ { 4 }$ are event times. The Jump CNF uses instantaneous jumps to update its distribution based on newly observed events while the Attentive CNF depends continuously on the sampling paths of prior events. We additionally visualize a second sequence for the Attentive CNF where the random base samples $\{ x _ { 0 } ^ { ( i ) } \} _ { i = 2 } ^ { 4 }$ are the same as in sequence 1. Even so, the sampling paths are different because the first event is different, effectively leading to different conditional spatial distributions. See Figure 9 for visualizations of the learned density.
148
+
149
+ $$
150
+ \frac { d } { d s } \left[ \begin{array} { c } { x _ { s } ^ { ( 1 ) } } \\ { x _ { s } ^ { ( 2 ) } } \\ { \vdots } \\ { x _ { s } ^ { ( n ) } } \end{array} \right] = \left[ \begin{array} { c } { t _ { 1 } f \left( s t _ { 1 } , \{ x _ { s } ^ { ( i ) } \} _ { i = 1 } ^ { 1 } , \{ h _ { t _ { i } } \} _ { i = 1 } ^ { 1 } \right) } \\ { t _ { 2 } f \left( s t _ { 2 } , \{ x _ { s } ^ { ( i ) } \} _ { i = 1 } ^ { 2 } , \{ h _ { t _ { i } } \} _ { i = 1 } ^ { 2 } \right) } \\ { \vdots } \\ { t _ { n } f \left( s t _ { n } , \{ x _ { s } ^ { ( i ) } \} _ { i = 1 } ^ { n } , \{ h _ { t _ { i } } \} _ { i = 1 } ^ { n } \right) } \end{array} \right] : = f _ { \mathrm { A t t } } \mathrm { n } .
151
+ $$
152
+
153
+ With this formulation, the trajectory of $\pmb { x } _ { \tau } ^ { ( i ) }$ depends continuously on the trajectory of $\pmb { x } _ { \tau } ^ { ( j ) }$ for all $j < i$ and the hidden states $^ { h }$ prior to the $i$ -th event. Similar to eq. (14), an Attention CNF can now solve for the trajectories of all events in parallel while simultaneously depending non-trivially on $\mathcal { H }$ .
154
+
155
+ To parameterize $f _ { \mathrm { A t t } \mathrm { n } }$ , we use an embedding layer followed by two multihead attention (MHA) blocks and an output layer to map back into the input space. We use the Lipschitz-continuous multihead attention from Kim et al. (2020) as they recently showed that the dot product multihead attention (Vaswani et al., 2017) is not Lipschitz-continuous and thus may be ill-suited for parameterizing ODEs.
156
+
157
+ Low-variance Log-likelihood Estimation The variance of the Hutchinson stochastic trace estimator in eq. (6) grows with the squared Frobenius norm of the Jacobian, $\sum _ { i j } \left[ \partial f / \partial x \right] _ { i j } ^ { 2 }$ (Hutchinson, 1990). For attentive CNFs, we can remove some of the non-diagonal elements of the Jacobian and achieve a lower variance estimator. The attention mechanism creates a blocktriangular Jacobian, where each block corresponds to one event, but the elements outside of the blockdiagonal are solely due to the multihead attention. By detaching the gradient connections between different events in the MHA blocks, we can create a surrogate
158
+
159
+ ![](images/f5dbfbc0e7accab2cb0542d09d2deb53f0e2cb9c2f4fa3bd16b33ead1f927e20.jpg)
160
+ Figure 3: Lower variance estimates of the loglikelihood allows training better Attentive CNFs.
161
+
162
+ Jacobian matrix that do not contain cross-event partial derivatives. This effectively allows us to apply Hutchinson’s estimator on a matrix that has the same diagonal elements as the Jacobian $\partial f / \partial x$ —and thus has the same expected value—but has zeros outside of the block-diagonal, leading to a lower variance trace estimator. The procedure consists of selectively removing partial derivatives and is straightforward but notationally cumbersome; the interested reader can find the details in Appendix E.
163
+
164
+ This is similar in spirit to Chen & Duvenaud (2019) but instead of constructing a neural network that specifically allows cheap removal of partial derivatives, we make use of the fact that multihead attention already allows cheap removal of (cross-event) partial derivatives.
165
+
166
+ An ablation experiment is shown in Figure 3 for training on the PINWHEEL data set, where the lower variance estimates (and gradients) ultimate led to faster convergence and better converged models.
167
+
168
+ # 4 RELATED WORK
169
+
170
+ Neural Temporal Point Processes Modeling real-world data using restricted models such as Exponential Hawkes Processes (Ozaki, 1979) may lead to poor results due to model mis-specification. While this has led to many works on improving the Hawkes process (e.g. Linderman & Adams 2014; Li & Zha 2014; Zhao et al. 2015; Farajtabar et al. 2017; Li & Ke 2020; Nickel & Le 2020), recent works have begun to explore neural network parameterizations of TPPs. A common approach is to use recurrent neural networks to accumulate the event history in a latent state from which the intensity value can then be derived. Models of this form include, for instance, Recurrent Marked Temporal Point Processes (RMTPPs; Du et al. 2016) and Neural Hawkes Processes (NHPs; Mei & Eisner 2017). In contrast to our approach, these methods can not compute the exact likelihood of the model and have to resort to Monte-Carlo sampling for its approximation. However, this approach is especially problematic for commonly occurring clustered and bursty event sequences as it either requires a very high sampling rate or ignores important temporal dependencies (Nickel & Le, 2020). To overcome this issue, Jia & Benson (2019) proposed Neural Jump SDEs which extend the Neural ODE framework and allow to compute the exact likelihood for neural TPPs, up to numerical errors. This method is closely related to our approach and we build on its ideas to compute the ground intensity of the STPP. However, current Neural Jump SDEs —as well as NHPs and RMTPPs—are not well-suited for modeling complex continuous mark distributions as they are restricted to methods such as Gaussian mixture models in the spatial domain. Finally, Shchur et al. (2019) and Mehrasa et al. (2019) considered combining TPPs with flexible likelihood-based models, however for different purposes as in our case, i.e., for intensity-free learning of only temporal point processes.
171
+
172
+ Continuous Normalizing Flows The ability to describe an infinite number of distributions with a Continuous Normalizing Flow has been used by a few recent works. Some works in computer graphics have used the interpolation effect of CNFs to model transformations of point clouds (Yang et al., 2019; Rempe et al., 2020; Li et al., 2020). CNFs have also been used in sequential latent variable models (Deng et al., 2020; Rempe et al., 2020). However, such works do not align the “time” axis of the CNF with the temporal axis of observations, and do not train on observations at more than one value of “time” in the CNF. In contrast, we align the time axis of the CNF with the time of the observations, directly using its ability to model distributions on a real-valued axis. A closely related application of CNFs to spatio-temporal data was done by Tong et al. (2020), who modeled the distribution of cells in a developing human embryo system at five fixed time values. In contrast to this, we extend to applications where observations are made at arbitrary time values, jointly modeling space and time within the spatio-temporal point process framework. Furthermore, Mathieu & Nickel (2020); Lou et al. (2020) recently proposed extensions of CNFs to Riemannian manifolds. For our proposed approach, this is especially interesting in the context of earth and climate science, as it allows us to model STPPs on the sphere simply by replacing the CNF with its Riemannian equivalent.
173
+
174
+ # 5 EXPERIMENTS
175
+
176
+ Data Sets Many collected data can be represented within the framework of spatio-temporal events. We pre-process data from open sources and make them suitable for spatio-temporal event modeling. Each sequence in these data sets can contain up to thousands of variables, all the while having a large variance in sequence lengths. Varying across a wide range of domains, the data sets we consider are: earthquakes, pandemic spread, consumer demand for a bike sharing app, and high-amplitude brain signals from fMRI scans. We briefly describe these data sets here; further details, pre-processing steps, and data set diagnostics can be found in Appendix C. Code for preprocessing and training are open sourced at https://github.com/facebookresearch/neural_stpp.
177
+
178
+ PINWHEEL This is a synthetic data set with multimodal and non-Gaussian spatial distributions designed to test the ability to capture drastic changes due to event history (see fig. 5). The data set consists of 10 clusters which form a pinwheel structure. Events are sampled from a multivariate Hawkes process such that events from one cluster will increase the probability of observing events in the next cluster in a clock-wise rotation. Number of events per sequences ranges between 4 to 108.
179
+
180
+ EARTHQUAKES For modeling earthquakes and aftershocks, we gathered location and time of all earthquakes in Japan from 1990 to 2020 with magnitude of at least 2.5 from the U.S. Geological Survey (2020). Number of events per sequences ranges between 18 to 543.
181
+
182
+ ![](images/64968869c1f670bd0d6d1f78cc771ab88dd0fa3dbd68dc7e1efb980f726fcdbe.jpg)
183
+ Figure 5: Evolution of spatial densities on PINWHEEL data. top: Attentive CNF. bottom: Jump CNF. (a) Before observing any events at $\scriptstyle t = 0$ , the distribution is even across all clusters. (b-f) Each event increases the probability of observing a future event from the subsequent cluster in clock-wise ordering. (g-h) After a period of no new events, the distribution smoothly returns back to the initial distribution (a).
184
+
185
+ ![](images/c2f9aeea16989017a062ac3824365a59e03ce754df2dafff536fa59e95729512.jpg)
186
+ Figure 7: Snapshots of conditional spatial distributions modeled by the Jump CNF (top) and a conditional kernel density estimator (KDE; bottom). (a) Distribution before any events at $\scriptstyle t = 0$ . (b-d) The Jump CNF’s distributions concentrate around tectonic plate boundaries where earthquakes and aftershocks gather, whereas the KDE must use a large variance in order to capture propagation of aftershocks in multiple directions.
187
+
188
+ COVID-19 CASES We use data released publicly by The New York Times (2020) on daily COVID-19 cases in New Jersey state. The data is aggregated at the county level, which we dequantize uniformly across the county. Number of events per sequences ranges between 3 to 323.
189
+
190
+ BOLD5000 This consists of fMRI scans as participants are given visual stimuli (Chang et al., 2019). We convert brain responses into spatio-temporal events following the z-score thresholding approach in Tagliazucchi et al. (2012; 2016). Number of events per sequences ranges between 6 to 1741.
191
+
192
+ In addition to these datasets, we also report in Appendix A results for CITIBIKE, a data set consisting of rental events from a bike sharing service in New York City.
193
+
194
+ Baselines To evaluate the capability of our proposed models, we compare against commonly-used baselines and state-of-the-art models. In some settings, ground intensity and conditional mark density are independent of each other and we can freely combine different baselines for the temporal and spatial domains. As temporal baselines, we use a homogeneous Poisson process, a self-correction process, a Hawkes process, and the Neural Hawkes Process, which were trained using their officially released code. As spatial baselines, we use a conditional kernel density estimator (KDE) with learned parameters, where $p ( { \pmb x } | t )$ is essentially modeled as a history-dependent Gaussian mixture model (see Appendix B), as well as the Time-varying CNF. In addition, we also compare to our implementation of Neural Jump SDEs (Jia & Benson, 2019) where the spatial distribution is a Gaussian mixture model. We use the same architecture as our GRU-based continuous-time hidden states for fair comparison, as we found the simpler parameterization in Jia & Benson (2019) to be numerically unstable for large number of events. Range of hyperparameter values are outlined in Appendix D.
195
+
196
+ <table><tr><td></td><td colspan="2">Pinwheel</td><td colspan="2">Earthquakes JP</td><td colspan="2">COVID-19 NJ</td><td colspan="2">BOLD5000</td></tr><tr><td>Model</td><td>Temporal</td><td>Spatial</td><td>Temporal</td><td>Spatial</td><td>Temporal</td><td>Spatial</td><td>Temporal</td><td>Spatial</td></tr><tr><td>Poisson Process</td><td>-0.784±0.001</td><td>1</td><td>-0.111±0.001</td><td>1</td><td>0.878±0.016</td><td>1</td><td>0.862±0.018</td><td>1</td></tr><tr><td>Self-correcting Process</td><td>-2.117±0.222</td><td></td><td>-7.051±0.780</td><td></td><td>-10.053±1.150</td><td></td><td>-6.470±0.827</td><td></td></tr><tr><td>Hawkes Process</td><td>-0.276±0.033</td><td></td><td>0.114±0.005</td><td></td><td>2.092±0.023</td><td></td><td>2.860±0.050</td><td></td></tr><tr><td>Neural Hawkes Process</td><td>-0.023±0.001</td><td></td><td>0.198±0.001</td><td></td><td>2.229±0.013</td><td></td><td>3.080±0.019</td><td></td></tr><tr><td>Conditional KDE</td><td></td><td>-2.958±0.000</td><td></td><td>-2.259±0.001</td><td></td><td>-2.583±0.000</td><td></td><td>-3.467±0.000</td></tr><tr><td>Time-varying CNF</td><td></td><td>-2.185±0.003</td><td></td><td>-1.459±0.016</td><td></td><td>-2.002±0.002</td><td>1</td><td>-1.846±0.019</td></tr><tr><td>Neural Jump SDE (GRU)</td><td>-0.006±0.042</td><td>-2.077±0.026</td><td>0.186±0.005 -1.652±0.012</td><td></td><td>2.251±0.004 -2.214±0.005</td><td></td><td>5.675±0.003</td><td>0.743±0.089</td></tr><tr><td>Jump CNF</td><td>0.027±0.002</td><td>-1.562±0.015</td><td>0.166±0.001</td><td>-1.007±0.050</td><td>2.242±0.002 -1.904±0.004</td><td></td><td>5.536±0.016</td><td>1.246±0.185</td></tr><tr><td>Attentive CNF</td><td>0.034±0.001 -1.572±0.002</td><td></td><td>0.204±0.001</td><td>-1.237±0.075</td><td>2.258±0.002 -1.864±0.001</td><td></td><td>5.842±0.005</td><td>1.252±0.026</td></tr></table>
197
+
198
+ Table 1: Log-likelihood per event on held-out test data (higher is better). Standard devs. estimated over 3 runs.
199
+
200
+ Results & Analyses The results of our evaluation are shown in table 1. We highlight all results where the intervals containing one standard deviation away from the mean overlap.
201
+
202
+ Across all data sets, the Time-varying CNF outperforms the conditional KDE baseline despite not being conditional on history. This suggests that the overall spatial distribution is rather complex. We also see from Figure 7 that Gaussian clusters tend to compensate for far-reaching events by learning a larger band-width whereas a flexible CNF can easily model multi-modal event propagation.
203
+
204
+ The Jump and Attentive CNF models achieve better log-likelihoods than the Time-varying CNF, suggesting prediction in these data sets benefit from modeling dependence on event history.
205
+
206
+ For COVID-19, the self-exciting Hawkes process is a strong baseline which aligns with similar results for other infectious diseases (Park et al., 2019), but Neural STPPs can achieve substantially better spatial likelihoods. Overall, NHP is competitive with the Neural Jump SDE; however, it tends to fall short of the Attentive CNF which jointly models spatial and temporal variables.
207
+
208
+ In a closer comparison to the temporal likelihood of Neural Jump SDEs (Jia & Benson, 2019), we find that overly-restricted spatial models can negatively affect the temporal model since both domains are tightly coupled. Since our realization of Neural Jump SDEs and our STPPs use the same underlying architecture to model the temporal domain, the temporal likelihood values are often close. However, there is still a statistically significant difference between our Neural STPP models and Neural Jump SDEs even for the temporal log-likelihood on all data sets.
209
+
210
+ Finally, we note that the results of the Jump and Attentive CNFs are typically close. The attentive model generally achieves better temporal log-likelihoods while maintaining competitive spatial log-likelihoods. This difference is likely due to the Attentive CNF’s ability to attend to all previous events, while the Jump CNF has to compress all history information inside the hidden state at the time of event. The Attentive CNF also enjoys substantially faster computations (see Appendix A).
211
+
212
+ # 6 CONCLUSION
213
+
214
+ To learn high-fidelity models of stochastic events occurring in continuous space and time, we have proposed a new class of parameterizations for spatio-temporal point processes. Our approach combines ideas of Neural Jump SDEs with Continuous Normalizing Flows and allows to retain the flexibility of neural temporal point processes while enabling highly expressive models of continuous marks. We leverage Neural ODEs as a computational method that allows computing, up to negligible numerical error, the likelihood of the joint model, and we show that our approach achieves state-ofthe-art performance on spatio-temporal datasets collected from a wide range of domains.
215
+
216
+ A promising area for future work are applications of our method in earth and climate science which often are concerned with modeling highly complex spatio-temporal data. In this context, the use of Riemannian CNFs (Mathieu & Nickel, 2020; Lou et al., 2020; Falorsi & Forre´, 2020) is especially interesting as it allows us to model Neural STPPs on manifolds (e.g. the earth’s surface) by simply replacing the CNF in our models with a Riemannian counterpart.
217
+
218
+ # ACKNOWLEDGMENTS
219
+
220
+ We acknowledge the Python community (Van Rossum & Drake Jr, 1995; Oliphant, 2007) for developing the core set of tools that enabled this work, including PyTorch (Paszke et al., 2019), torchdiffeq (Chen, 2018), fairseq (Ott et al., 2019), Jupyter (Kluyver et al., 2016), Matplotlib (Hunter, 2007), seaborn (Waskom et al., 2018), Cython (Behnel et al., 2011), numpy (Oliphant, 2006; Van Der Walt et al., 2011), pandas (McKinney, 2012), and SciPy (Jones et al., 2014).
221
+
222
+ # REFERENCES
223
+
224
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
225
+
226
+ Adrian Baddeley, Imre Bar´ any, and Rolf Schneider. Spatial point processes and their applications. ´ Stochastic Geometry: Lectures Given at the CIME Summer School Held in Martina Franca, Italy, September 13–18, 2004, pp. 1–75, 2007.
227
+
228
+ Earvin Balderama, Frederic Paik Schoenberg, Erin Murray, and Philip W Rundel. Application of branching models in the study of invasive species. Journal of the American Statistical Association, 107(498):467–476, 2012.
229
+
230
+ Stefan Behnel, Robert Bradshaw, Craig Citro, Lisandro Dalcin, Dag Sverre Seljebotn, and Kurt Smith. Cython: The best of both worlds. Computing in Science & Engineering, 13(2):31–39, 2011.
231
+
232
+ Nadine Chang, John A Pyles, Austin Marcus, Abhinav Gupta, Michael J Tarr, and Elissa M Aminoff. BOLD5000, a public fMRI dataset while viewing 5000 visual images. Scientific data, 6(1):1–18, 2019.
233
+
234
+ Zhengping Che, Sanjay Purushotham, Kyunghyun Cho, David Sontag, and Yan Liu. Recurrent neural networks for multivariate time series with missing values. Scientific reports, 8(1):1–12, 2018.
235
+
236
+ Ricky T. Q. Chen. torchdiffeq, 2018. URL https://github.com/rtqichen/ torchdiffeq.
237
+
238
+ Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt, and David K. Duvenaud. Neural ordinary differential equations. In Advances in neural information processing systems, pp. 6571–6583, 2018.
239
+
240
+ Ricky TQ Chen and David K Duvenaud. Neural networks with cheap differential operators. In Advances in Neural Information Processing Systems, pp. 9961–9971, 2019.
241
+
242
+ Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger ¨ Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014.
243
+
244
+ Daryl J Daley and David Vere-Jones. An introduction to the theory of point processes, volume 1: Elementary theory and methods. Verlag New York Berlin Heidelberg: Springer, 2003.
245
+
246
+ Edward De Brouwer, Jaak Simm, Adam Arany, and Yves Moreau. GRU-ODE-Bayes: Continuous modeling of sporadically-observed time series. In Advances in Neural Information Processing Systems, pp. 7379–7390, 2019.
247
+
248
+ Ruizhi Deng, Bo Chang, Marcus A Brubaker, Greg Mori, and Andreas Lehrmann. Modeling continuous stochastic processes with dynamic normalizing flows. arXiv preprint arXiv:2002.10516, 2020.
249
+
250
+ Laurent Dinh, David Krueger, and Yoshua Bengio. Nice: Non-linear independent components estimation. arXiv preprint arXiv:1410.8516, 2014.
251
+
252
+ Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real nvp. 2016.
253
+
254
+ Nan Du, Hanjun Dai, Rakshit Trivedi, Utkarsh Upadhyay, Manuel Gomez-Rodriguez, and Le Song. Recurrent marked temporal point processes: Embedding event history to vector. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1555–1564, 2016.
255
+
256
+ Luca Falorsi and Patrick Forre. Neural ordinary differential equations on manifolds. ´ arXiv preprint arXiv:2006.06663, 2020.
257
+
258
+ Mehrdad Farajtabar, Jiachen Yang, Xiaojing Ye, Huan Xu, Rakshit Trivedi, Elias Khalil, Shuang Li, Le Song, and Hongyuan Zha. Fake news mitigation via point process based intervention. arXiv preprint arXiv:1703.07823, 2017.
259
+
260
+ Chris Finlay, Jorn-Henrik Jacobsen, Levon Nurbekyan, and Adam M Oberman. How to train your ¨ neural ode. arXiv preprint arXiv:2002.02798, 2020.
261
+
262
+ Will Grathwohl, Ricky T. Q. Chen, Jesse Bettencourt, and David Duvenaud. Scalable reversible generative models with free-form continuous dynamics. In International Conference on Learning Representations, 2019.
263
+
264
+ Amanda S Hering, Cynthia L Bell, and Marc G Genton. Modeling spatio-temporal wildfire ignition point patterns. Environmental and Ecological Statistics, 16(2):225–250, 2009.
265
+
266
+ Chin-Wei Huang, David Krueger, Alexandre Lacoste, and Aaron Courville. Neural autoregressive flows. In International Conference on Machine Learning, pp. 2078–2087, 2018.
267
+
268
+ Chin-Wei Huang, Laurent Dinh, and Aaron Courville. Solving ode with universal flows: Approximation theory for flow-based models. In ICLR 2020 Workshop on Integration of Deep Neural Models and Differential Equations, 2020.
269
+
270
+ John D Hunter. Matplotlib: A 2d graphics environment. Computing in science & engineering, 9(3): 90, 2007.
271
+
272
+ Michael F Hutchinson. A stochastic estimator of the trace of the influence matrix for Laplacian smoothing splines. Communications in Statistics-Simulation and Computation, 19(2):433–450, 1990.
273
+
274
+ Junteng Jia and Austin R Benson. Neural jump stochastic differential equations. In Advances in Neural Information Processing Systems, pp. 9847–9858, 2019.
275
+
276
+ Eric Jones, Travis Oliphant, and Pearu Peterson. {SciPy}: Open source scientific tools for $\{ { \mathrm { P y t h o n } } \}$ 2014.
277
+
278
+ Hyunjik Kim, George Papamakarios, and Andriy Mnih. The Lipschitz constant of self-attention. arXiv preprint arXiv:2006.04710, 2020.
279
+
280
+ Durk P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. In Advances in neural information processing systems, pp. 10215–10224, 2018.
281
+
282
+ Thomas Kluyver, Benjamin Ragan-Kelley, Fernando Perez, Brian E Granger, Matthias Bussonnier, ´ Jonathan Frederic, Kyle Kelley, Jessica B Hamrick, Jason Grout, Sylvain Corlay, et al. Jupyter notebooks-a publishing format for reproducible computational workflows. In ELPUB, pp. 87–90, 2016.
283
+
284
+ Zhifeng Kong and Kamalika Chaudhuri. The expressive power of a class of normalizing flow models. arXiv preprint arXiv:2006.00392, 2020.
285
+
286
+ Liangda Li and Hongyuan Zha. Learning parametric models for social infectivity in multi-dimensional hawkes processes. In Proceedings of the Twenty-Eighth AAAI Conference on Artificial Intelligence, pp. 101–107, 2014.
287
+
288
+ Tianbo Li and Yiping Ke. Tweedie-hawkes processes: Interpreting the phenomena of outbreaks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 4699–4706, 2020.
289
+
290
+ Yang Li, Haidong Yi, Christopher M Bender, Siyuan Shan, and Junier B Oliva. Exchangeable neural ode for set modeling. arXiv preprint arXiv:2008.02676, 2020.
291
+
292
+ Scott Linderman and Ryan Adams. Discovering latent network structure in point process data. In International Conference on Machine Learning, pp. 1413–1421, 2014.
293
+
294
+ Aaron Lou, Derek Lim, Isay Katsman, Leo Huang, Qingxuan Jiang, Ser-Nam Lim, and Christopher De Sa. Neural manifold ordinary differential equations. arXiv preprint arXiv:2006.10254, 2020.
295
+
296
+ Emile Mathieu and Maximilian Nickel. Riemannian continuous normalizing flows. arXiv preprint arXiv:2006.10605, 2020.
297
+
298
+ Wes McKinney. Python for data analysis: Data wrangling with Pandas, NumPy, and IPython. ” O’Reilly Media, Inc.”, 2012.
299
+
300
+ Nazanin Mehrasa, Ruizhi Deng, Mohamed Osama Ahmed, Bo Chang, Jiawei He, Thibaut Durand, Marcus Brubaker, and Greg Mori. Point process flows. arXiv preprint arXiv:1910.08281, 2019.
301
+
302
+ Hongyuan Mei and Jason Eisner. The Neural Hawkes Process: A neurally self-modulating multivariate point process. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, 4-9 December 2017, Long Beach, CA, USA, pp. 6754–6764, 2017.
303
+
304
+ Sebastian Meyer, Johannes Elias, and Michael Hohle. A space–time conditional intensity model for ¨ invasive meningococcal disease occurrence. Biometrics, 68(2):607–616, 2012.
305
+
306
+ Jesper Moller and Rasmus Plenge Waagepetersen. Statistical inference and simulation for spatial point processes. CRC Press, 2003.
307
+
308
+ Maximilian Nickel and Matthew Le. Learning multivariate hawkes processes at scale. arXiv preprint arXiv:2002.12501, 2020.
309
+
310
+ Yosihiko Ogata. Statistical models for earthquake occurrences and residual analysis for point processes. Journal of the American Statistical association, 83(401):9–27, 1988.
311
+
312
+ Yosihiko Ogata. Space-time point-process models for earthquake occurrences. Annals of the Institute of Statistical Mathematics, 50(2):379–402, 1998.
313
+
314
+ Travis E Oliphant. A guide to NumPy, volume 1. Trelgol Publishing USA, 2006.
315
+
316
+ Travis E Oliphant. Python for scientific computing. Computing in Science & Engineering, 9(3): 10–20, 2007.
317
+
318
+ Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. fairseq: A fast, extensible toolkit for sequence modeling. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations), pp. 48–53, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-4009. URL https://www.aclweb.org/anthology/ N19-4009.
319
+
320
+ T. Ozaki. Maximum likelihood estimation of Hawkes’ self-exciting point processes. Annals of the Institute of Statistical Mathematics, 31(1):145–155, Dec 1979. ISSN 1572-9052. doi: 10.1007/ bf02480272.
321
+
322
+ Junhyung Park, Adam W Chaffee, Ryan J Harrigan, and Frederic Paik Schoenberg. A non-parametric Hawkes model of the spread of ebola in west africa. 2019.
323
+
324
+ Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. In Advances in neural information processing systems, pp. 8026–8037, 2019.
325
+
326
+ Prajit Ramachandran, Barret Zoph, and Quoc V Le. Searching for activation functions. arXiv preprint arXiv:1710.05941, 2017.
327
+
328
+ Alex Reinhart et al. A review of self-exciting spatio-temporal point processes and their applications. Statistical Science, 33(3):299–318, 2018.
329
+
330
+ Davis Rempe, Tolga Birdal, Yongheng Zhao, Zan Gojcic, Srinath Sridhar, and Leonidas J Guibas. CaSPR: Learning canonical spatiotemporal point cloud representations. arXiv preprint arXiv:2008.02792, 2020.
331
+ Danilo Rezende and Shakir Mohamed. Variational inference with normalizing flows. In International Conference on Machine Learning, pp. 1530–1538, 2015.
332
+ Yulia Rubanova, Ricky T. Q. Chen, and David Duvenaud. Latent ODEs for irregularly-sampled time series. arXiv preprint arXiv:1907.03907, 2019.
333
+ Frederic Paik Schoenberg, Marc Hoffmann, and Ryan J Harrigan. A recursive point process model for infectious diseases. Annals of the Institute of Statistical Mathematics, 71(5):1271–1287, 2019.
334
+ Oleksandr Shchur, Marin Bilos, and Stephan G ˇ unnemann. Intensity-free learning of temporal point ¨ processes. arXiv preprint arXiv:1909.12127, 2019.
335
+ John Skilling. The eigenvalues of mega-dimensional matrices. In Maximum Entropy and Bayesian Methods, pp. 455–466. Springer, 1989.
336
+ Enzo Tagliazucchi, Pablo Balenzuela, Daniel Fraiman, and Dante R Chialvo. Criticality in large-scale brain fMRI dynamics unveiled by a novel point process analysis. Frontiers in physiology, 3:15, 2012.
337
+ Enzo Tagliazucchi, Michael Siniatchkin, Helmut Laufs, and Dante R Chialvo. The voxel-wise functional connectome can be efficiently derived from co-activations in a sparse spatio-temporal point-process. Frontiers in neuroscience, 10:381, 2016.
338
+ Takeshi Teshima, Isao Ishikawa, Koichi Tojo, Kenta Oono, Masahiro Ikeda, and Masashi Sugiyama. Coupling-based invertible neural networks are universal diffeomorphism approximators. arXiv preprint arXiv:2006.11469, 2020.
339
+ The New York Times. Coronavirus (Covid-19) Data in the United States, 2020. URL https: //github.com/nytimes/covid-19-data.
340
+ Alexander Tong, Jessie Huang, Guy Wolf, David van Dijk, and Smita Krishnaswamy. TrajectoryNet: A dynamic optimal transport network for modeling cellular dynamics. arXiv preprint arXiv:2002.04461, 2020.
341
+ U.S. Geological Survey. Earthquake Catalogue (accessed August 21, 2020), 2020. URL https: //earthquake.usgs.gov/earthquakes/search/.
342
+ Stefan Van Der Walt, S Chris Colbert, and Gael Varoquaux. The numpy array: a structure for efficient numerical computation. Computing in Science & Engineering, 13(2):22, 2011.
343
+ Guido Van Rossum and Fred L Drake Jr. Python reference manual. Centrum voor Wiskunde en Informatica Amsterdam, 1995.
344
+ 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.
345
+ Michael Waskom, Olga Botvinnik, Drew O’Kane, Paul Hobson, Joel Ostblom, Saulius Lukauskas, David C Gemperline, Tom Augspurger, Yaroslav Halchenko, John B. Cole, Jordi Warmenhoven, Julian de Ruiter, Cameron Pye, Stephan Hoyer, Jake Vanderplas, Santi Villalba, Gero Kunter, Eric Quintero, Pete Bachant, Marcel Martin, Kyle Meyer, Alistair Miles, Yoav Ram, Thomas Brunner, Tal Yarkoni, Mike Lee Williams, Constantine Evans, Clark Fitzgerald, Brian, and Adel Qalieh. mwaskom/seaborn: v0.9.0 (july 2018), July 2018. URL https://doi.org/10. 5281/zenodo.1313201.
346
+ Guandao Yang, Xun Huang, Zekun Hao, Ming-Yu Liu, Serge Belongie, and Bharath Hariharan. PointFlow: 3d point cloud generation with continuous normalizing flows. In Proceedings of the IEEE International Conference on Computer Vision, pp. 4541–4550, 2019.
347
+ Qingyuan Zhao, Murat A Erdogdu, Hera Y He, Anand Rajaraman, and Jure Leskovec. Seismic: A self-exciting point process model for predicting tweet popularity. In Proceedings of the 21th ACM SIGKDD international conference on knowledge discovery and data mining, pp. 1513–1522, 2015.
348
+
349
+ # A ADDITIONAL RESULTS AND FIGURES
350
+
351
+ <table><tr><td></td><td colspan="2">Citibike NY</td></tr><tr><td>Model</td><td>Temporal</td><td>Spatial</td></tr><tr><td>Poisson Process</td><td>0.609±0.012</td><td></td></tr><tr><td>Self-correcting Process</td><td>-5.649±1.433</td><td></td></tr><tr><td>Hawkes Process</td><td>1.062±0.000</td><td></td></tr><tr><td>Neural Hawkes Process 1.030±0.015</td><td></td><td></td></tr><tr><td>Conditional KDE</td><td></td><td>-2.856±0.000</td></tr><tr><td>Time-varying CNF</td><td></td><td>-2.132±0.012</td></tr><tr><td>Neural Jump SDE</td><td>1.092±0.002</td><td>-2.731±0.001</td></tr><tr><td>Jump CNF</td><td>1.105±0.002</td><td>-2.155±0.015</td></tr><tr><td>Attentive CNF</td><td>1.112±0.002</td><td>-2.095±0.006</td></tr></table>
352
+
353
+ ![](images/3b3f8ed141ab2f08bd1ebcfa696bac421996048d70ab7a1c592ac5145da7e4d0.jpg)
354
+ Figure 8: Runtime comparison of Jump and Attentive CNF.
355
+ Table 2: Log-likelihood values on held-out test data for an urban mobility data set.
356
+
357
+ ![](images/39a14c8009ca62fbe1c850ddd66d48d4ee3b174b7ebe6492ce5e6ec129b8812d.jpg)
358
+ Figure 9: Both the Jump CNF and Attentive CNF are capable of modeling different the spatial distributions based on event history, so the appearance of a new event effectively shifts the distribution instantaneously. Shown on a synthetic 1-D data set similar to PINWHEEL, except we use a mixture of three Gaussians. Each event increases the likelihood of events for the cluster to the right.
359
+
360
+ ![](images/b85d5ea6427ba727b8c5be454da079d0dca9eaaee7f8cdf688b11c3f384509fc.jpg)
361
+ Figure 10: Learned attention weights for random event sequences.
362
+
363
+ # B BASELINE
364
+
365
+ Our self-excitation baseline uses a Hawkes process to model the temporal variable, then uses a Gaussian mixture model to describe the spatial distribution conditioned on history of events. This corresponds to the following likelihood decomposition
366
+
367
+ $$
368
+ \log p ( t _ { 1 } , \dots , t _ { n } , x _ { 1 } , \dots , x _ { n } ) = \sum _ { i = 1 } ^ { n } \log p ( x _ { i } | t _ { i } , t _ { 1 } , \dots , t _ { i - 1 } , x _ { 1 } , \dots , x _ { i - 1 } ) + \sum _ { i = 1 } ^ { n } \log p ( t _ { i } | t _ { 1 } , \dots , t _ { i - 1 } )
369
+ $$
370
+
371
+ Note that $t _ { i }$ does not depend on the spatial variables associated with previous events. This dependence structure allows the usage of simple temporal point processes to model $t _ { i }$ , e.g. a Hawkes process, since temporal variables do not depend on the spatial information. The spatial distribution conditions all past events as well as the current time of occurance.
372
+
373
+ Our baseline model assumes a simple Gaussian conditional model, that new events are likely to appear near previous events.
374
+
375
+ $$
376
+ \log p ( x _ { i } | t _ { i } , t _ { 1 } , \dots , t _ { i - 1 } , x _ { 1 } , \dots , x _ { i - 1 } ) = \sum _ { j = 1 } ^ { i - 1 } \alpha _ { j } \mathcal { N } ( x _ { j } | \sigma ^ { 2 } ) , \quad \alpha _ { j } = \frac { \exp \{ ( t _ { j } - t _ { i } ) / \tau \} } { \sum _ { j ^ { \prime } = 1 } ^ { i - 1 } \exp \{ ( t _ { j ^ { \prime } } - t _ { i } ) / \tau \} }
377
+ $$
378
+
379
+ This parameteric model has two learnable parameters: $\sigma ^ { 2 }$ and $\tau$ , which control the rate of decay in the spatial and temporal domains, respectively.
380
+
381
+ However, this Gaussian spatial model assumes events are propagated in all directions equally and can only model local self-excitation behavior. These assumptions are often used for simplifications but are generally incorrect for many spatio-temporal data. To name a few, earthquakes occur more frequently along boundaries of tectonic plates, epidemics propagate along traffic routes, taxi demands saturate locally and change as customers move around.
382
+
383
+ # C PRE-PROCESSING STEPS FOR EACH DATA SET
384
+
385
+ PINWHEEL We sample from a multivariate Hawkes process with 10 dimensions. We turn this into continuous spatial variables by assigning each dimension to a cluster from a “pinwheel” distribution, and sample from the corresponding cluster for each event. Number of events per sequences ranges between 4 to 108.
386
+
387
+ EARTHQUAKES For modeling earthquakes and aftershocks, we gathered location and time of all earthquakes in Japan from 1990 to 2020 with magnitude of at least 2.5 from the U.S. Geological Survey (2020). Starting from January 01, 1990, we created sequences with a gap of 7 days. Each sequence was of length 30 days. We ensured there was no contamination between train/val/test sets by removing intermediate sequences. We removed earthquakes from 2010 November to 2011 December, as these sequences were too long and only served as outliers in the data. This resulted in 950 training sequences, 50 validation sequences, and 50 test sequences. Number of events per sequence ranges between 18 to 543.
388
+
389
+ COVID-19 CASES We use data released publicly by The New York Times (2020) on daily COVID-19 cases in the New Jersey state, from March to July of 2020. The data is aggregated at the county level, which we dequantize uniformly across the county. We also dequantize the temporal axis by assigning new cases uniformly within the day. Starting at March 15, and every 3 days, we took a 7 day length sequence. For each sequence, we sampled each event with a probability of 0.01. This was done 50 times per sequence. We ensured there was no contamination between train/val/test sets by removing intermediate sequences. This resulted in 1450 training sequences, 100 validation sequences, and 100 test sequences. Number of events per sequence ranges between 3 to 323.
390
+
391
+ CITIBIKE Citibike is a bike sharing service in New York City. We treat the start of each trip as an event, and use the data from April to August of 2019. We split into sequences of length 1 day starting at $5 { : } 0 0 { \mathrm { a m } }$ of each day. For each sequence, we subsampled with a probability of 0.005 per event, 20 times. This resulted in 2440 training sequences, 300 validation sequences, and 320 test sequences. Number of events per sequence ranges between 9 to 231.
392
+
393
+ ![](images/749703a2fc1655f14b5816bcd8926bc3db67af8d8051f198cc235bae973ff268.jpg)
394
+ Figure 11: Histograms of the number of events per sequence in each processed data set.
395
+
396
+ BOLD5000 This consists of fMRI scans of four participants as they are given visual stimuli (Chang et al., 2019). We use the sessions of a single patient and for each run, we split into 3 sequences, treated individually. We converted brain responses into spatio-temporal events following the $\mathbf { Z }$ -score thresholding approach in Tagliazucchi et al. 2016, Equation (2). We used a threshold of $\gamma = 6 . 0$ . We split the data into 1050 training sequences, 150 val sequences, 220 test sequences. Number of events per sequence ranges between 6 to 1741.
397
+
398
+ Each data set contains sequences with highly variable number of events, with varying degrees of dependence between events, making them difficult to model with traditional point process models. We plot histograms showing the number of events per sequence in Figure 11.
399
+
400
+ # D HYPERPARAMETERS CHOSEN AND TESTED
401
+
402
+ For the time-varying, jump, and attentive CNF models, we parameterized the CNF drift as a multilayer perceptron (MLP) with dimensions $[ d - 6 4 - 6 4 - 6 4 - d ]$ , where $d$ is the number of spatial variables. We swept over activation functions between using softplus or a time-dependent Swish (Ramachandran et al., 2017).
403
+
404
+ $$
405
+ \mathrm { T i m e D e p e n d e n t S w i s h } ( t , z ) = h \sigma ( \beta ( t ) \odot z )
406
+ $$
407
+
408
+ where $\sigma$ is the logistic sigmoid function, $\odot$ is the Hadamard (element-wise) product, and $\beta : \mathbb { R } \mathbb { R } _ { d _ { z } }$ is a MLP with widths $[ \bar { 1 } - 6 4 - d _ { z } ]$ where $d _ { z }$ is the dimension of $z$ , using the softplus activation function. We ultimately decided on using the time-dependent Swish for all experiments.
409
+
410
+ We swept over the MLP for defining $f _ { h }$ for the continuous-time hidden state in eq. (11) using hidden widths of $[ 8 - 2 0 ]$ , $[ 3 2 - 3 2 ]$ , $[ 6 4 - 6 4 ]$ , $\left[ 3 2 - 3 2 - 3 2 \right]$ , and $[ 6 4 - 6 4 - 6 4 ]$ . The majority of models used $3 2 - 3 2$ as it provided enough flexibility while remaining easy to solve. We used the softplus activation function. We tried MLP for parameterizing the instantaneous change in eq. (12); however, it was too unstable for long sequences. We therefore switched to the GRU parameterization, which takes an input (new event), the hidden state at the time of event, and outputs a new hidden state.
411
+
412
+ We regularized the $L _ { 2 }$ norm of the hidden state drift with a strength of 1e-4, chosen from $\{ 0$ , 1e-4, 1e-3, 1e- $\langle 2 \}$ . We optionally used optimal transport-inspired regularization from Finlay et al. (2020), which adds a Frobenius norm regularization to the gradient of the drift in addition to the $L _ { 2 }$ norm regularization, to the CNF models with a strength of $\{ 0 \}$ , 1e-4, 1e-3, 1e- $\cdot 2 \}$ . The Time-varying and Attentive CNF models did not require regularization and were mostly kept at 0, but the Jump CNF models benefited from some amount of regularization to avoid numerical instability.
413
+
414
+ To model a non-trivial spatial distribution for the entire data interval, we shift the data interval to start at $t = 2$ for all CNF models. Thus the interval used for parameterizing the CNF is $[ 2 , T + 2 ]$ . Generally, the “time” variable is a dummy one; we can place the base distribution at any time, and we can choose any interval on the real line to be the data interval; this does not limit the model in any way.
415
+
416
+ For the Jump CNF, we used a composition of 4 radial flows (Rezende & Mohamed, 2015) to parameterize the instantaneous updates in eq. (17). All parameters of the radial flows were parameterized to be the output of a MLP that takes as input the hidden state at the time of the event (before the hidden state is updated based on the current event). The radial flows were initialized in such a way that the log determinant is near zero.
417
+
418
+ For the Attentive CNF, the drift function consists of
419
+
420
+ Time-dependent $\mathrm { M L P } ( d - 6 4 - 6 4 ) 2 \times ]$ MultiheadAttention Time-dependent MLP(64 − 64 − d)
421
+
422
+ where the Time-dependent MLPs make use of the TimeDependentSwish. As was done in Vaswani et al. (2017), the multihead attention is used within a residual branch, except we swapped LayerNorm (Ba et al., 2016) with ActNorm (Kingma & Dhariwal, 2018) as LayerNorm has an unbounded Lipschitz and can be ill-suited for use in ODEs. We tested both standard multihead attention (Vaswani et al., 2017) and the Lipschitz multihead attention (Kim et al., 2020). The Lipschitz multihead attention typically produced similar validation NLL as the standard multihead attention but were more stable on multiple occassions. We therefore kept the Lipschitz multihead attention for all experiments. We additionally, use an auxiliary (non-attentive, simply with the two multihead attention layers removed) CNF to map from 0 (i.e. the time of base distribution) to the beginning of the data interval.
423
+
424
+ We initialized all Neural ODEs (for the hidden state and CNFs) with zero drift by initializing the weights and biases of the final layer to zero.
425
+
426
+ The log-likelihood values reported are after the spatial variables have been standardized using the empirical mean and standard deviation from the training set.
427
+
428
+ We train and test on log-likelihood (in nats) per event, which normalizes eq. (8) of each sequence by the number of events.
429
+
430
+ All integrals were solved using Chen (2018) to within a relative and absolute tolerance of 1E-4 or 1E-6, chosen based on preliminary testing for convergence and stability.
431
+
432
+ Our implementation of the Neural Jump SDE shares the same continuous-time hidden state parameterization but uses a mixture of Gaussians as the spatial model. We used 5 mixtures, and a MLP that maps from the hidden state to the parameters of this mixture of Gaussians (the means, log standard deviations, and mixture coefficients).
433
+
434
+ # E REMOVING CROSS-EVENT PARTIAL DERIVATIVES
435
+
436
+ This results in a lower-variance gradient estimator for training, and allows parallel computation of conditional log probabilities at test time.
437
+
438
+ We first summarily describe the attention mechanism. For an input $\boldsymbol { X } \in \mathbb { R } ^ { n \times d }$ representing the f $n$ variabled values $\{ x _ { s } ^ { ( 0 ) } , \ldots , x _ { s } ^ { ( n ) } \}$ . . . , x(n)s } at some valudependent on f , $s$ , this attention mechanism creates logitsch that the output is $P \in \mathbb { R } ^ { n \times n }$ $V \in R ^ { n \times d }$ $X$
439
+
440
+ $$
441
+ O = \underbrace { \operatorname { s o f t m a x } ( P ) } _ { : = S } V .
442
+ $$
443
+
444
+ where the softmax is taken over each row of $P$ . The output is then added to $X$ as a residual connection. The multihead attention computes $P$ in a way such that $P _ { i j }$ depends on $X _ { i }$ and $X _ { j }$ , and $V _ { i }$ depends on $X _ { i }$ . This is true for both the vanilla MHA (Vaswani et al., 2017) and the L2 MHA (Kim et al., 2020). For our use case, $P _ { i j }$ is set to −inf for $j > i$ as we don’t want to attend to future events.
445
+
446
+ We retain only the block-diagonal gradients where each block contains variables corresponding to one event. This is equivalent to removing all the cross-event dependencies.
447
+
448
+ $$
449
+ { \frac { \partial { \cal O } _ { i } } { \partial X _ { i } } } = S _ { : , i } { \frac { \partial V _ { i } } { \partial X _ { i } } } + V ^ { \mathsf { T } } { \frac { \partial S } { \partial P _ { i } } } { \frac { \partial P _ { i } } { \partial X _ { i } } } + V ^ { \mathsf { T } } { \frac { \partial S } { \partial P _ { : , i } } } { \frac { \partial P _ { : , i } } { \partial X _ { i } } }
450
+ $$
451
+
452
+ # F PARALLEL SOLVING OF MULTIPLE ODES WITH VARYING INTERVALS
453
+
454
+ Our numerical ODE solvers integrate a single ODE system $\begin{array} { r } { \frac { d x } { d t } = f ( t , x ) } \end{array}$ , where $x \in \mathbb { R } ^ { d }$ and $f : \mathbb { R } ^ { 1 + d } \mathbb { R } ^ { d }$ , on a single fixed interval $[ t _ { s t a r t } , t _ { e n d } ]$ . We can express the inputs and outputs of an ODE solver with
455
+
456
+ $$
457
+ \odot \mathtt { D E S o l v e } ( x _ { 0 } , f , t _ { s t a r t } , t _ { e n d } ) \triangleq x _ { 0 } + \int _ { t _ { s t a r t } } ^ { t _ { e n d } } f ( t , x ( t ) ) d t = x ( t _ { e n d } ) .
458
+ $$
459
+
460
+ where $x _ { 0 }$ is a vector containing the initial state at the initial time $t _ { 0 }$ .
461
+
462
+ Multiple ODEs Now suppose we have a set of that we would like to solve. If all systems had the $M$ systems (i.e. e initial time $\begin{array} { r } { { \frac { d x _ { m } } { d t } } = f _ { m } } \end{array}$ for outp $m = 1 , \ldots , M )$ $t _ { s t a r t }$ and $t _ { e n d }$ , we can readily create a joint system
463
+
464
+ $$
465
+ \boldsymbol { x } _ { j o i n t } = \left[ \begin{array} { c } { x _ { 1 } } \\ { \vdots } \\ { x _ { M } } \end{array} \right] \qquad \mathrm { t h a t ~ f o l l o w s } \quad \frac { d x _ { j o i n t } } { d t } = \left[ \begin{array} { c } { f _ { 1 } ( t , x _ { 1 } ) } \\ { \vdots } \\ { f _ { M } ( t , x _ { M } ) } \end{array} \right]
466
+ $$
467
+
468
+ Solving this joint system can be done in parallel with a single call to ODESolve:
469
+
470
+ $$
471
+ x _ { j o i n t } ( t _ { 1 } ) = \mathsf { O D E S o l v e } ( x _ { 0 j o i n t } , f _ { j o i n t } , t _ { 0 } , t _ { 1 } )
472
+ $$
473
+
474
+ which computes $x _ { m } ( t _ { 1 } )$ for all $m = 1 , \ldots , M$ . This is the standard method used for solving a batch of Neural ODEs.
475
+
476
+ Adding dependencies is straightforward Note that extending this further, the ODE systems do not need to be independent. They can depend on other variables at the same concurrent time value because the joint system is still an ordinary differential equation. For instance, we can have
477
+
478
+ $$
479
+ \frac { d x _ { m } } { d t } = f _ { m } ( t , x _ { 1 } , \ldots , x _ { m } )
480
+ $$
481
+
482
+ where $f _ { m } : \mathbb { R } ^ { 1 + M d } \mathbb { R } ^ { d }$ . Each system is now a partial differential equation, but the joint system $x _ { j o i n t }$ is still an ODE and can be solved with one call to ODESolve.
483
+
484
+ Varied time intervals Now suppose each system has a different time interval that we want to solve. Different initial times and different end times. Let’s denote the start and end time for the $m$ -th system as t start and $t _ { e n d } ^ { ( m ) }$ respectively. We can construct a dummy variable that always integrates from 0 to 1, and perform a change of variables (reparameterization) to transform every system to use this dummy variable.
485
+
486
+ As a concrete example of this reparameterzation procedure, consider just one system $x ( t )$ with drift function $f ( t , x )$ that we want to integrate from $t _ { s t a r t }$ to $t _ { e n d }$ with the initial value $x _ { 0 }$ . We can transform $x ( t )$ using the relation $\begin{array} { r } { s = \frac { t - \overline { { t } } _ { s t a r t } } { t _ { e n d } - t _ { s t a r t } } } \end{array}$ , or equivalently
487
+
488
+ $$
489
+ t = s ( t _ { e n d } - t _ { s t a r t } ) + t _ { s t a r t } ,
490
+ $$
491
+
492
+ into a solution $\tilde { { \boldsymbol { x } } } ( s )$ on the unit interval $[ 0 , 1 ]$ such that
493
+
494
+ $$
495
+ \tilde { x } ( s ) = x ( s ( t _ { e n d } - t _ { s t a r t } ) + t _ { s t a r t } )
496
+ $$
497
+
498
+ The drift function for $\tilde { x }$ then follows as
499
+
500
+ $$
501
+ \begin{array} { l } { \displaystyle \tilde { f } ( s , \tilde { x } ( s ) ) \triangleq \frac { d \tilde { x } ( s ) } { d s } = \frac { d x ( t ) } { d t } \bigg \rvert _ { t = s ( t _ { e n d } - t _ { s t a r t } ) + t _ { s t a r t } } \frac { d t } { d s } } \\ { \displaystyle = f ( t , x ( t ) ) \bigg \rvert _ { t = s ( t _ { e n d } - t _ { s t a r t } ) + t _ { s t a r t } } ( t _ { e n d } - t _ { s t a r t } ) } \\ { \displaystyle = f \big ( s ( t _ { e n d } - t _ { s t a r t } ) + t _ { s t a r t } , \tilde { x } ( s ) \big ) \big ( t _ { e n d } - t _ { s t a r t } \big ) } \end{array}
502
+ $$
503
+
504
+ Now since $\tilde { x } ( 0 ) = x ( t _ { s t a r t } )$ and $\tilde { x } ( 1 ) = x ( t _ { e n d } )$ , the following are equivalent
505
+
506
+ $$
507
+ \boldsymbol { x } ( t _ { e n d } ) = \boldsymbol { \mathrm { O D E S O 1 v e } } ( x _ { 0 } , \tilde { f } , 0 , 1 ) = \boldsymbol { \mathrm { O D E S O 1 v e } } ( x _ { 0 } , f , t _ { s t a r t } , t _ { e n d } )
508
+ $$
509
+
510
+ Putting it all together Let $\widetilde { x } _ { m } ( s )$ be the reparameterized solution for $x _ { m } ( t )$ such that
511
+
512
+ $$
513
+ \tilde { x } _ { m } ( s ) = x _ { m } \left( s \left( t _ { e n d } ^ { ( m ) } - t _ { s t a r t } ^ { ( m ) } \right) + t _ { s t a r t } \right)
514
+ $$
515
+
516
+ We can then solve for all $M$ systems, with different varying time intervals, using
517
+
518
+ $$
519
+ \tilde { x } _ { j o i n t } = \left[ \begin{array} { l } { \tilde { x } _ { 1 } } \\ { \vdots } \\ { \tilde { x } _ { M } } \end{array} \right] \qquad \quad \mathrm { t h a t ~ f o l l o w s } \quad \frac { d \tilde { x } _ { j o i n t } } { d s } = \left[ \begin{array} { l } { \tilde { f } _ { 1 } ( s , \tilde { x } _ { 1 } ) } \\ { \vdots } \\ { \tilde { f } _ { M } ( s , \tilde { x } _ { M } ) } \end{array} \right] .
520
+ $$
521
+
522
+ Solving this system to $s = 1$ yields $\tilde { x } _ { m } ( 1 ) = x _ { m } ( t _ { e n d } ^ { ( m ) } )$
523
+
524
+ Assuming $t _ { s t a r t } ^ { ( m ) } = 0$ for all $m = 1 , \ldots , M$ in order to reduce notational complexity, we can write this joint system in terms of the original systems as
525
+
526
+ $$
527
+ \frac { d \tilde { x } _ { j o i n t } } { d s } = \left[ \begin{array} { c } { f _ { 1 } \left( s t _ { e n d } ^ { ( 1 ) } , \tilde { x } ( s ) \right) \ t _ { e n d } } \\ { \vdots } \\ { f _ { 1 } \left( s t _ { e n d } ^ { ( 1 ) } , \tilde { x } ( s ) \right) \ t _ { e n d } } \end{array} \right] .
528
+ $$
529
+
530
+ This is the joint system written in equation 14. The joint system in equation 19 adds dependence between the $M$ systems but can still be solved with a single ODESolve.
md/train/qmI0P1ZExUl/qmI0P1ZExUl.md ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ENCODING IN STYLE: A STYLEGAN ENCODER FOR IMAGE-TO-IMAGE TRANSLATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We present a generic image-to-image translation framework, Pixel2Style2Pixel $( p S p )$ . Our pSp framework is based on a novel encoder network that directly generates a series of style vectors which are fed into a pretrained StyleGAN generator, forming the extended $\mathcal { W } +$ latent space. We first show that our encoder can directly embed real images into $\mathcal { W } +$ , with no additional optimization. We further introduce a dedicated identity loss which is shown to achieve improved performance in the reconstruction of an input image. We demonstrate pSp to be a simple architecture that, by leveraging a well-trained, fixed generator network, can be easily applied on a wide-range of image-to-image translation tasks. Solving these tasks through the style representation results in a global approach that does not rely on a local pixel-to-pixel correspondence and further supports multi-modal synthesis via the resampling of styles. Notably, we demonstrate that pSp can be trained to align a face image to a frontal pose with no labeled data and generate multi-modal results for ambiguous tasks such as conditional face generation from sketches and segmentation maps.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In recent years, Generative Adversarial Networks (GANs) have significantly advanced image synthesis, particularly on face images. State-of-the-art image generation methods have achieved high visual quality and fidelity, and can now generate images with phenomenal realism. Most notably, StyleGAN (Karras et al., 2019; 2020) proposes a novel style-based generator architecture and attains state-of-the-art visual quality on high-resolution images. Moreover, it has been demonstrated that it has a disentangled latent space, $\mathcal { W }$ (Yang et al., 2019; Collins et al., 2020; Shen et al., 2020), which may offer control and editing capabilities.
12
+
13
+ Recently, numerous methods have shown competence in controlling StyleGAN’s latent space and performing meaningful manipulations in $\mathcal { W }$ (Jahanian et al., 2019; Shen et al., 2020; Tewari et al., 2020; Hark ¨ onen et al., 2020). To perform such edits on real images, one needs to invert the image ¨ into StyleGAN’s latent space, i.e., retrieve the latent code that reconstructs the image. However, it has been shown that inverting a real image into a 512-dimensional vector $\mathbf { w } \in \mathcal { W }$ does not lead to an accurate reconstruction. Motivated by this, it has become common practice (Abdal et al., 2019; 2020; Baylies, 2019; Zhu et al., 2020a; Adbal et al., 2020) to encode real images into an extended latent space, $\mathcal { W } +$ , defined by the concatenation of 18 different 512-dimensional w vectors, one for each input layer of StyleGAN. Nevertheless, many methods resort to using per-image optimization over $\mathcal { W } +$ , requiring several minutes for a single image. To accelerate this optimization process, some methods (Baylies, 2019; Zhu et al., 2020a) have trained an encoder to infer an approximate vector in $\mathcal { W } +$ which serves as a good initial point from which additional optimization is required. However, a fast, direct, and accurate learned inversion of real images into $\mathcal { W } +$ remains a challenge.
14
+
15
+ In this paper, we focus on the broader task of latent space embedding, which aims to retrieve the latent vector that generates a desired, not necessarily known, image. We do so by introducing a novel encoder architecture tasked with encoding an arbitrary image directly into $\mathcal { W } +$ . The encoder is based on a Feature Pyramid Network (Lin et al., 2017), where style feature vectors are extracted from different pyramid scales and inserted directly into a fixed, pretrained StyleGAN generator in correspondence to their spatial scales. Our encoder into $\mathcal { W } +$ , together with the StyleGAN decoder, form a generic encoder-decoder network that benefits many image-to-image translation tasks. Focusing on face images, we first demonstrate our method’s ability to successfully reconstruct a given image while preserving identity and other attributes. We then present numerous image-to-image translation applications. In a sense, our method performs Pixel2Style2Pixel translation, as every image is first encoded into style vectors and then into an image, and is therefore dubbed $p S p$ .
16
+
17
+ While many previous approaches to solving image-to-image translations tasks involve dedicated architectures specific for solving a single problem, we follow the spirit of pix2pix (Isola et al., 2017) and define a generic framework able to solve a wide range of tasks, all using the same architecture. Besides the simplification of the training process, as no adversary discriminator needs to be trained, using a pretrained StyleGAN generator offers several intriguing advantages over previous works. Many image-to-image architectures explicitly feed the generator with residual feature maps from the encoder (Isola et al., 2017; Wang et al., 2018), creating a strong locality bias (Richardson & Weiss, 2020). In contrast, our generator is governed only by the styles with no direct spatial input. The advantage of such a global approach is most evident in the task of Face Frontalization, where our encoder can be trained to align a given face image to a frontal pose with no labeled data. Another notable advantage of the intermediate style representation is the inherent support for multi-modal synthesis for ambiguous tasks such as face generation from sketches, segmentation maps, or lowresolution images. In such tasks, the generated styles can be resampled to create variations of the output image with no change to the architecture or training process.
18
+
19
+ The main contributions of this paper are: (i) a novel StyleGAN encoder able to directly encode real face images into the $\mathcal { W } +$ target latent domain; and (ii) a generic end-to-end framework for solving image-to-image translation tasks.
20
+
21
+ # 2 RELATED WORK
22
+
23
+ Latent Space Embedding With the rapid evolution of GANs, many works have tried to understand and control their latent space. A specific task that has received substantial attention is $G A N$ Inversion — where the latent vector from which a pretrained GAN most accurately reconstructs a given, known image, is sought. Motivated by its state-of-the-art image quality and latent space semantic richness, many recent works have used StyleGAN (Karras et al., 2019; 2020) for this task. Generally, inversion methods either directly optimize the latent vector to minimize the error for the given image (Lipton & Tripathi, 2017; Creswell & Bharath, 2018; Abdal et al., 2019; 2020), train an encoder to map the given image to the latent space (Perarnau et al., 2016; Creswell & Bharath, 2018; Pidhorskyi et al., 2020; Guan et al., 2020; Nitzan et al., 2020), or use a hybrid approach combining both (Baylies, 2019; Zhu et al., 2020a). Typically, methods performing optimization are superior in reconstruction quality to a learned encoder mapping, but require a substantially longer time. Unlike the above methods, our encoder can accurately and efficiently embed a given face image into the extended latent space $\mathcal { W } +$ of a fixed, pretrained StyleGAN generator, with no further optimization.
24
+
25
+ Image-to-Image Image-to-Image translation techniques aim at learning a conditional image generation function that maps an input image of a source domain to a corresponding image of a target domain. Isola et al. (2017) first introduced the use of conditional GANs to solve various imageto-image translation tasks. Since then, their work has been extended for many scenarios: highresolution synthesis (Wang et al., 2018), unsupervised learning (Liu et al., 2017; Zhu et al., 2017a; Katzir et al., 2019; Lira et al., 2020), multi-modal image synthesis (Zhu et al., 2017b; Huang et al., 2018; Choi et al., 2020), and conditional image synthesis (Park et al., 2019; Li et al., 2019; Liu et al., 2019b; Zhu et al., 2020b; Chen et al., 2020). The aforementioned works have constructed dedicated architectures, which require training the generator network.
26
+
27
+ Latent-Space Manipulation Recently, numerous papers have presented diverse methods to learn semantic edits of the latent code. A popular approach is finding linear directions that correspond to changes in a given binary labeled attribute, such as young $ \mathrm { o l d }$ , or no-smile smile (Shen et al., 2020; Goetschalckx et al., 2019; Denton et al., 2019; Adbal et al., 2020). Tewari et al. (2020) utilize a pretrained 3DMM to learn semantic face edits in the latent space. Jahanian et al. (2019) find latent space paths that correspond to a specific transformation, such as zoom or rotation, in a selfsupervised manner. Hark ¨ onen et al. (2020) find useful paths in an unsupervised manner by using the ¨ principal component axes (PCA) of an intermediate activation space. Finally, Collins et al. (2020) perform local semantic editing by manipulating corresponding components of the latent code.
28
+
29
+ ![](images/aaa87c70d8d04df81fa258ed78659642cc51ccb7d39c7c3bd9e96fd5502d0ea6.jpg)
30
+ Figure 1: Our pSp architecture. Feature maps are first extracted using a standard feature pyramid over a ResNet backbone. For each of the 18 target styles, a small mapping network is trained to extract the learned styles from the corresponding feature map, where styles (0-2) are generated from the small feature map, (3-6) from the medium feature map, and (7-18) from the largest feature map. The mapping network, map2style, is a small fully convolutional network, which gradually reduces spatial size using a set of 2-strided convolutions followed by LeakyReLU activations. Each generated 512 vector, is fed into StyleGAN, starting from its matching affine transformation, $A$ .
31
+
32
+ # 3 THE PSP FRAMEWORK
33
+
34
+ Our pSp framework builds upon the representative power of a pretrained StyleGAN generator and the $\mathcal { W } +$ latent space. To utilize this representation one needs a strong encoder that is able to match each input image to an accurate encoding in the latent domain. A simple technique to embed into this domain is directly encoding a given input image into $\mathcal { W } +$ using a single 512-dimensional vector obtained from the last layer of the encoder network, thereby learning all 18 style vectors together. However, such an architecture presents a strong bottleneck making it difficult to fully represent the finer details of the original image and therefore limiting the reconstruction quality.
35
+
36
+ In StyleGAN, the authors have shown that the different style inputs correspond to different levels of detail, which are roughly divided into three groups — coarse, medium, and fine. Following this observation, in pSp we extend an encoder backbone with a feature pyramid (Lin et al., 2017), generating three levels of feature maps from which styles are extracted using a simple intermediate network — map2style — shown in Figure 1. The styles, aligned with the hierarchical representation, are then fed into the generator in correspondence to their scale to generate the output image, thus completing the translation from input pixels to output pixels, through the intermediate style representation. Therefore, our architecture, pSp, is an end-to-end image-to-image translation framework. The complete architecture is illustrated in Figure 1.
37
+
38
+ As in StyleGAN, we further define $\overline { { \mathbf { W } } }$ to be the average style vector of the pretrained generator. Given an input image, $\mathbf { X }$ , the output of our model is then defined as $p S p ( \mathbf { x } ) : = \mathbf { \bar { \boldsymbol { G } } } ( E ( \mathbf { \boldsymbol { x } } ) + \mathbf { \bar { \boldsymbol { w } } } )$ where $E ( \cdot )$ and $G ( \cdot )$ denote the encoder and StyleGAN generator, respectively. In this formulation, our encoder aims to learn the latent code with respect to the average style vector. We find that this results in better initialization.
39
+
40
+ # 3.1 LOSS FUNCTIONS
41
+
42
+ While the style-based translation is the core part of our framework, the choice of losses is also crucial. Our encoder is trained using a weighted combination of several objectives. First, we utilize the pixel-wise $\mathcal { L } _ { 2 }$ loss,
43
+
44
+ $$
45
+ \mathcal { L } _ { 2 } \left( \mathbf { x } \right) = | | \mathbf { x } - p S p ( \mathbf { x } ) | | _ { 2 } .
46
+ $$
47
+
48
+ In addition, to learn perceptual similarities, we utilize the LPIPS (Zhang et al., 2018) loss, which has been shown to better preserve image quality (Guan et al., 2020) compared to the more standard perceptual loss (Johnson et al., 2016):
49
+
50
+ $$
51
+ \mathcal { L } _ { \mathrm { L P I P S } } \left( \mathbf { x } \right) = | | F ( \mathbf { x } ) - F ( p S p ( \mathbf { x } ) ) | | _ { 2 } ,
52
+ $$
53
+
54
+ where $F ( \cdot )$ denotes the perceptual feature extractor.
55
+
56
+ To encourage the encoder to output latent style vectors closer to the average latent vector, we additionally define the following regularization loss:
57
+
58
+ $$
59
+ \mathcal { L } _ { \mathrm { r e g } } \left( \mathbf { x } \right) = | | E ( \mathbf { x } ) - \overline { { \mathbf { w } } } | | _ { 2 } .
60
+ $$
61
+
62
+ Similar to the truncation trick introduced in StyleGAN, we find that adding this regularization in the training of our encoder improves image quality without harming the fidelity of our outputs, especially in some of the more ambiguous tasks explored below.
63
+
64
+ The Identity Loss One of the main challenges of face generation tasks is the ability to preserve identity between the input and output images. Since identity preservation is a crucial part of face reconstruction tasks, it is important to integrate this objective into the overall loss function. Therefore, we incorporate a dedicated recognition loss measuring the cosine similarity between the output image and its source,
65
+
66
+ $$
67
+ \mathcal { L } _ { \mathrm { I D } } \left( \mathbf { x } \right) = 1 - \left. R ( \mathbf { x } ) , R ( p S p ( \mathbf { x } ) ) \right. ,
68
+ $$
69
+
70
+ where $R$ is a pretrained ArcFace (Deng et al., 2019) network for face recognition. The input, $\mathbf { X }$ , and output, $p S p ( \mathbf { x } )$ , are cropped around the face and resized to $1 1 2 \times 1 1 2$ before being fed into $R$ .
71
+
72
+ In summary, the total loss function is defined as
73
+
74
+ $$
75
+ \begin{array} { r } { \mathcal { L } ( \mathbf { x } ) = \lambda _ { 1 } \mathcal { L } _ { 2 } ( \mathbf { x } ) + \lambda _ { 2 } \mathcal { L } _ { \mathrm { L P I P S } } ( \mathbf { x } ) + \lambda _ { 3 } \mathcal { L } _ { \mathrm { I D } } ( \mathbf { x } ) + \lambda _ { 4 } \mathcal { L } _ { \mathrm { r e g } } ( \mathbf { x } ) , } \end{array}
76
+ $$
77
+
78
+ where $\lambda _ { 1 } , \lambda _ { 2 } , \lambda _ { 3 } , \lambda _ { 4 }$ are constants defining the loss weights. Constants and other implementation details can be found in Appendix A.1.
79
+
80
+ # 3.2 THE BENEFITS OF THE STYLEGAN DOMAIN
81
+
82
+ The translation between images through the style domain differentiates pSp from many standard image-to-image translation frameworks, as it makes our model operate globally instead of locally, without requiring pixel-to-pixel correspondence. This is a desired property as it has been shown that the locality bias limits current methods when handling non-local transformations (Richardson & Weiss, 2020). Moreover, previous works (Karras et al., 2019; Collins et al., 2020) have demonstrated that the disentanglement of semantic objects learned by StyleGAN is due to its layer-wise representation. This ability to independently manipulate semantic attributes leads to another desired property: the support for multi-modal synthesis. As some translation tasks are ambiguous, where a single input image may correspond to several outputs, it is desirable to be able to sample these possible outputs. While this requires specialized changes in standard image-to-image architectures (Zhu et al., 2017b; Huang et al., 2018), our framework inherently supports this by simply sampling style vectors. In practice, this is done by randomly sampling a vector $\mathbf { w } \in \mathbb { R } ^ { 5 1 2 }$ and generating a corresponding latent code in $\mathcal { W } +$ by replicating w. Style mixing is then performed by replacing select layers of the computed latent with those of the randomly generated latent, possibly with an $\alpha$ parameter for blending between the two styles. This is illustrated in Figure 7a in Appendix A. There, layers 1-7 are selected from the input latent while layers 8-18 are taken from the sampled vector allowing one to obtain outputs with similar coarse and medium features, but varying fine features.
83
+
84
+ # 4 APPLICATIONS AND EXPERIMENTS
85
+
86
+ To explore the effectiveness of our approach we evaluate our pSp framework on numerous imageto-image translation tasks.
87
+
88
+ # 4.1 STYLEGAN INVERSION
89
+
90
+ We start by evaluating the usage of the pSp framework for StyleGAN Inversion, that is, finding the latent code of real images in the latent domain. We compare our method to the ALAE encoder (Pidhorskyi et al., 2020) and to the encoder from IDInvert (In-Domain Invert) (Zhu et al., 2020a). The ALAE method proposes a StyleGAN-based autoencoder, where the encoder is trained alongside the generator to generate latent codes. In IDInvert, real images are embedded into the latent domain of a pretrained StyleGAN by first encoding the image into $\mathcal { W } +$ and then directly optimizing over the generated image to tune the latent. For a fair comparison with our method, we compare with IDInvert where no further optimization is performed after computing the encoding of a given image.
91
+
92
+ ![](images/bb69cc85325bb39515b25424afb41cb5f70bd3c6eb6a0999b0c6640a439ba37d.jpg)
93
+ Figure 2: Results of pSp for StyleGAN inversion compared to other approaches on CelebA-HQ.
94
+
95
+ ![](images/fd8e8a9c98b438418175d16bb3f7e30702a7cca4f16c79e2de2b313cc8b5bd50.jpg)
96
+ Figure 3: (a) Ablation of the pSp encoder over CelebA-HQ. (b) The importance of the identity loss.
97
+
98
+ Results Figure 2 shows a qualitative comparison between the methods. One can see that the ALAE method, operating in the $\mathcal { W }$ domain, cannot accurately reconstruct the input images. While IDInvert (Zhu et al., 2020a) better preserves the image attributes, it still fails to accurately preserve identity and the finer details of the input image. In contrast, our method is able to preserve identity while also reconstructing fine details such as lighting, hairstyle, and glasses.
99
+
100
+ Next, we conduct an ablation study to analyze the effectiveness of the pSp architecture. We compare our architecture to two simpler variations. First, we define an encoder generating a 512-dimensional style vector in the $\mathcal { W }$ latent domain, extracted from the last layer of the encoder network. We then expand this and define an encoder with an additional layer to transform the 512-dimensional feature vector to a full $1 8 \times 5 1 2 ~ { \textmu } { \bmod { } }$ vector. Figure 3a shows that while this simple extension into $\mathcal { W } +$ significantly improves the results, it still cannot preserve the finer details generated by our architecture. In Figure 3b we show the importance of the identity loss in the reconstruction task.
101
+
102
+ Finally, Table 4a presents a quantitative evaluation measuring the different encoders examined above. Our pSp model is able to better preserve the original images in terms of both perceptual similarity and identity. To make sure the similarity score is independent of our loss function, we utilize the Curricularface (Huang et al., 2020) method for evaluation.
103
+
104
+ Figure 4: (a) Quantitative results for image reconstruction on CelebA-HQ. (b) Results for Face Frontalization on the FEI Face Database split by rotation angle of the face in the input image.
105
+
106
+ <table><tr><td>Method</td><td colspan="4">↑ Similarity↓LPIPS↓MSERuntime</td></tr><tr><td>ALAE IDInvert</td><td>0.06 0.18</td><td>0.32 0.22</td><td>0.15 0.06</td><td>0.207 0.032</td></tr><tr><td>W Encoder Naive W+</td><td>0.35</td><td>0.23 0.19</td><td>0.06 0.04</td><td>0.064 0.064</td></tr><tr><td></td><td>0.49 0.56</td><td>0.17</td><td>0.03</td><td>0.105</td></tr><tr><td>pSp</td><td></td><td></td><td></td><td></td></tr><tr><td colspan="5">(a)</td></tr></table>
107
+
108
+ <table><tr><td>Method 90°</td><td>个 Similarity ↓Runtime 70° 50° 30°</td></tr><tr><td>R&amp;R 0.34 0.56 0.66</td><td>0.7 1.5</td></tr><tr><td>pSp 0.32 0.52 0.60</td><td>0.63 0.1</td></tr><tr><td>(b)</td><td></td></tr></table>
109
+
110
+ ![](images/6cb149008410b1e68a49694b950d34ccbea9c3396117e7f7edb3172de4e05421.jpg)
111
+ Figure 5: Comparison of face frontalization methods.
112
+
113
+ # 4.2 FACE FRONTALIZATION
114
+
115
+ Face frontalization is a challenging task for image-to-image translation frameworks due to the required non-local transformations and the lack of paired training data. RotateAndRender (R&R) (Zhou et al., 2020) overcome this challenge by incorporating a geometric 3D alignment process before the translation process. Alternatively, we show that our style-based translation mechanism is able overcome these challenges, even when trained with no labeled data.
116
+
117
+ Methodology and details For this task, training is the same as the encoder formulation with two important changes. First, we randomly flip the target image, thus creating inconsistencies in terms of pose compared to the input image. This guides the model towards generating a frontalized face, as the true target pose is unknown. While this may seem minor, without this augmentation the model would simply learn to encode the input image, matching its pose as well as identity. Next, in frontalization, as we are less interested in the background region compared to the face region and its identity, we also change the weights of the loss objective. In particular, we decrease the weights of the LPIPS and $L _ { 2 }$ loss functions, and give more weight to the losses computed on the inner part of the face, focusing the model on the inner region while reducing the importance of background preservation. As shown below, these changes to the training objective are enough for the model to generate realistic frontal faces, while also preserving identity.
118
+
119
+ Results Results are illustrated in Figure 5. When trained with the same data, pix2pixHD is unable to converge to satisfying results as it is much more dependent on the correspondence between the input and output pairs. Conversely, our method is able to handle the task successfully, generating realistic frontal faces, which are comparable to the more involved RotateAndRender approach. This shows the benefit of using a pretrained StyleGAN for image translation, as it allows us to achieve visually-pleasing results even with weak supervision. Table 4b provides a quantitative evaluation on the FEI Faces Database (Thomaz & Giraldi, 2010). While R&R outperforms pSp, our simple approach provides an elegant alternative, without requiring specialized alignment steps.
120
+
121
+ ![](images/2fae6c2fd49241b71e411ab8fe52917c7054060d2baca609e732f5db62918b51.jpg)
122
+ Figure 6: (a) Comparison of sketches presented in DeepFaceDrawing. (b) Comparisons to other label-to-image methods on CelebAMask-HQ. (c) Multi-modal outputs using pSp with style-mixing. (d) Human evaluation results on CelebA-HQ for Conditional Image Synthesis tasks. Each cell denotes the percentage of users who favored pSp over the listed method.
123
+
124
+ # 4.3 CONDITIONAL IMAGE SYNTHESIS
125
+
126
+ Conditional image synthesis aims at generating photo-realistic images conditioned on certain input types. In this section, our pSp architecture is tested on two conditional image generation tasks: generating high-quality face images from sketches and semantic label maps. We demonstrate that, with only minimal changes, our encoder successfully utilizes the expressiveness of StyleGAN to generate high-quality and diverse outputs. Additionally, an ideal mapping framework should be able to generate multiple diverse outputs for a given input. To achieve this, we utilize the multi-modal synthesis approach described in Section 3.2.
127
+
128
+ Methodology and details The training of the two conditional generation tasks is identical to that of the encoder for StyleGAN inversion except for the omission of the identity loss and the addition of the regularization loss. To generate multiple images at inference time, we perform style-mixing, taking layers $( 1 - 7 )$ from the latent code of the input image and layers $( 8 - 1 8 )$ from a randomly drawn w vector.
129
+
130
+ # 4.3.1 FACE FROM SKETCH
131
+
132
+ Common approaches for sketch-to-image synthesis incorporate hard constraints that require pixelwise correspondence between the input sketch and generated image, making them ill-suited when given incomplete sketches. DeepFaceDrawing (Chen et al., 2020) address this using a set of dedicated mapping networks. We show that pSp provides a simple alternative to past approaches.
133
+
134
+ Dataset Construction As there are currently no publicly available datasets representative of handdrawn face sketches, we elect to construct our own dataset, which we describe in Appendix A.2.
135
+
136
+ Results Figure 6a compares the results of our method to those of pix2pixHD and DeepFaceDrawing. As no code release is available for DeepFaceDrawing, we compare directly with sketches and results published in their paper. Due to the hard constraints of pix2pixHD, they are unable to handle the abstract sketches and obtain poor visual results. While DeepFaceDrawing obtain more visually pleasing results compared to pix2pixHD, they are still limited in their diversity. Conversely, although our model is trained on a different dataset, we are still able to generalize well to their sketches. Notably, we observe our ability to obtain more diverse outputs that better retain finer details (e.g. facial hair). Another limitation of DeepFaceDrawing is its focus on frontal images. We therefore illustrate our model’s ability to generate high-fidelity outputs from non-frontal sketches in Figure 13. As we are unable to directly evaluate DeepFaceDrawing on our constructed dataset, we compare our results only to those of pix2pixHD, trained and evaluated with the same data.
137
+
138
+ # 4.3.2 FACE FROM SEGMENTATION MAP
139
+
140
+ Here, we evaluate using pSp for synthesizing face images from segmentation maps. In addition to pix2pixHD, we compare our approach to two additional state-of-the-art label-to-image methods: SPADE (Park et al., 2019), and CC FPSE (Liu et al., 2019b), both of which are based on pix2pixHD.
141
+
142
+ Results In Figure 6b we provide a visual comparison of the competing approaches on the CelebAMask-HQ dataset containing 19 semantic categories. As the competing methods are based on pix2pixHD, the results of all three are visually similar. Conversely, our approach is able to generate high-quality outputs across a wide range of inputs of various poses and expressions. Additionally, using our multi-modal technique, pSp can easily generate various possible outputs with the same pose and attributes but varying fine styles for a single input semantic map or sketch image. We provide examples in Figure 6c with additional examples in Appendix C.
143
+
144
+ # 4.3.3 HUMAN PERCEPTUAL STUDY
145
+
146
+ We additionally perform a human evaluation to compare the visual quality of each method presented above. Here, each worker is given two images synthesized by different methods on the same input and is given an unlimited time to select which output looks more realistic. Each of our three workers reviews approximately 2, 800 pairs for each task, resulting in over 8, 400 human judgements for each method. Table 6d shows that pSp significantly outperforms the other respective methods in both synthesis tasks.
147
+
148
+ # 5 DISCUSSION AND CONCLUSIONS
149
+
150
+ Although our suggested framework for image-to-image translation achieves compelling results in various applications, it has some inherent assumptions that should be considered. First, the highquality images that are generated by utilizing the pretrained StyleGAN come with a cost — the method is limited to images that can be generated by StyleGAN. Thus, generating faces which are not close to frontal, or have certain expressions may be challenging if such examples were not available when training the StyleGAN model. Also, the global approach of $\mathsf { p } \mathsf { S p }$ , although advantageous for many tasks, does introduce a challenge in preserving finer details of the input image, such as earrings or background details. This is especially significant in tasks such as inpainting or superresolution where standard image-to-image architectures can simply propagate local information. Figure 7b in Appendix A presents some examples of such reconstruction failures.
151
+
152
+ In this work, we proposed a novel encoder architecture that can be used to directly map a face image into the $\mathcal { W } +$ latent space with no optimization required. The encoder architecture, motivated by StyleGAN, consists of a hierarchy of three levels that correspond to the coarse, medium, and fine groupings of the 18 style vectors defining the input in the $\mathcal { W } +$ latent space. Styles are then extracted from the encoder in a hierarchical fashion and fed into the corresponding inputs of a fixed StyleGAN generator. Notably, our network is trained with an ID similarity loss, which encourages better preservation of identity compared to previous direct approaches. Combining our encoder with a StyleGAN decoder, we present a general framework for solving various image-to-image translation tasks. In contrast to previous methods, which tackle such tasks using a local ”pixel-topixel” approach, our framework takes a global approach, which we show can be used to solve a wide variety of image-to-image translation problems.
153
+
154
+ # REFERENCES
155
+
156
+ Rameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan: How to embed images into the stylegan latent space? In Proceedings of the IEEE international conference on computer vision, pp. 4432–4441, 2019.
157
+
158
+ Rameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan $^ { + + }$ : How to edit the embedded images? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8296–8305, 2020.
159
+
160
+ Rameen Adbal, Pie Zhu, Niloy J. Mitra, and Peter Wonka. Styleflow: Attribute-conditioned exploration of stylegan-generated images using conditional continuous normalizing flows. arXiv preprint arXiv:, 2020.
161
+
162
+ Baylies. stylegan-encoder. https://github.com/pbaylies/stylegan-encoder, 2019. Accessed: April 2020.
163
+
164
+ Shu-Yu Chen, Wanchao Su, Lin Gao, Shihong Xia, and Hongbo Fu. DeepFaceDrawing: Deep generation of face images from sketches. ACM Transactions on Graphics (Proceedings of ACM SIGGRAPH 2020), 39(4):72:1–72:16, 2020.
165
+
166
+ Yunjey Choi, Youngjung Uh, Jaejun Yoo, and Jung-Woo Ha. Stargan v2: Diverse image synthesis for multiple domains. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8188–8197, 2020.
167
+
168
+ Edo Collins, Raja Bala, Bob Price, and Sabine Susstrunk. Editing in style: Uncovering the local semantics of gans. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5771–5780, 2020.
169
+
170
+ Antonia Creswell and Anil Anthony Bharath. Inverting the generator of a generative adversarial network. IEEE transactions on neural networks and learning systems, 30(7):1967–1974, 2018.
171
+
172
+ Jiankang Deng, Jia Guo, Niannan Xue, and Stefanos Zafeiriou. Arcface: Additive angular margin loss for deep face recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4690–4699, 2019.
173
+
174
+ Emily Denton, Ben Hutchinson, Margaret Mitchell, and Timnit Gebru. Detecting bias with generative counterfactual face attribute augmentation. arXiv preprint arXiv:1906.06439, 2019.
175
+
176
+ Lore Goetschalckx, Alex Andonian, Aude Oliva, and Phillip Isola. Ganalyze: Toward visual definitions of cognitive image properties, 2019.
177
+
178
+ Shanyan Guan, Ying Tai, Bingbing Ni, Feida Zhu, Feiyue Huang, and Xiaokang Yang. Collaborative learning for faster stylegan embedding. arXiv preprint arXiv:2007.01758, 2020.
179
+
180
+ Erik Hark ¨ onen, Aaron Hertzmann, Jaakko Lehtinen, and Sylvain Paris. Ganspace: Discovering ¨ interpretable gan controls. arXiv preprint arXiv:2004.02546, 2020.
181
+
182
+ Xun Huang, Ming-Yu Liu, Serge Belongie, and Jan Kautz. Multimodal unsupervised image-toimage translation. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 172–189, 2018.
183
+
184
+ Yuge Huang, Yuhan Wang, Ying Tai, Xiaoming Liu, Pengcheng Shen, Shaoxin Li, Jilin Li, and Feiyue Huang. Curricularface: adaptive curriculum learning loss for deep face recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5901–5910, 2020.
185
+
186
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1125–1134, 2017.
187
+
188
+ Ali Jahanian, Lucy Chai, and Phillip Isola. On the ”steerability” of generative adversarial networks. arXiv preprint arXiv:1907.07171, 2019.
189
+
190
+ Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. In European conference on computer vision, pp. 694–711. Springer, 2016.
191
+
192
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id ${ . } = { }$ Hk99zCeAb.
193
+
194
+ Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4401–4410, 2019.
195
+
196
+ Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of stylegan. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8110–8119, 2020.
197
+
198
+ Oren Katzir, Dani Lischinski, and Daniel Cohen-Or. Cross-domain cascaded deep feature translation. arXiv, pp. arXiv–1906, 2019.
199
+
200
+ Vuong Le, Jonathan Brandt, Zhe Lin, Lubomir Bourdev, and Thomas S. Huang. Interactive facial feature localization. In Andrew Fitzgibbon, Svetlana Lazebnik, Pietro Perona, Yoichi Sato, and Cordelia Schmid (eds.), Computer Vision – ECCV 2012, pp. 679–692, Berlin, Heidelberg, 2012. Springer Berlin Heidelberg. ISBN 978-3-642-33712-3.
201
+
202
+ Yuhang Li, Xuejin Chen, Feng Wu, and Zheng-Jun Zha. Linestofacephoto: Face photo generation from lines with conditional self-attention generative adversarial networks. In Proceedings of the 27th ACM International Conference on Multimedia, pp. 2323–2331, 2019.
203
+
204
+ Tsung-Yi Lin, Piotr Dollar, 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.
205
+
206
+ Zachary C Lipton and Subarna Tripathi. Precise recovery of latent vectors from generative adversarial networks. arXiv preprint arXiv:1702.04782, 2017.
207
+
208
+ Wallace Lira, Johannes Merz, Daniel Ritchie, Daniel Cohen-Or, and Hao Zhang. Ganhopper: Multihop gan for unsupervised image-to-image translation. arXiv preprint arXiv:2002.10102, 2020.
209
+
210
+ Liyuan Liu, Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Jiawei Han. On the variance of the adaptive learning rate and beyond. arXiv preprint arXiv:1908.03265, 2019a.
211
+
212
+ Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. In Advances in neural information processing systems, pp. 700–708, 2017.
213
+
214
+ Xihui Liu, Guojun Yin, Jing Shao, Xiaogang Wang, et al. Learning to predict layout-to-image conditional convolutions for semantic image synthesis. In Advances in Neural Information Processing Systems, pp. 570–580, 2019b.
215
+
216
+ Sachit Menon, Alexandru Damian, Shijia Hu, Nikhil Ravi, and Cynthia Rudin. Pulse: Selfsupervised photo upsampling via latent space exploration of generative models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
217
+
218
+ Yotam Nitzan, Amit Bermano, Yangyan Li, and Daniel Cohen-Or. Disentangling in latent space by harnessing a pretrained generator. arXiv preprint arXiv:2005.07728, 2020.
219
+
220
+ Taesung Park, Ming-Yu Liu, Ting-Chun Wang, and Jun-Yan Zhu. Semantic image synthesis with spatially-adaptive normalization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2337–2346, 2019.
221
+
222
+ Guim Perarnau, Joost Van De Weijer, Bogdan Raducanu, and Jose M Alvarez. Invertible conditional ´ gans for image editing. arXiv preprint arXiv:1611.06355, 2016.
223
+
224
+ Stanislav Pidhorskyi, Donald A Adjeroh, and Gianfranco Doretto. Adversarial latent autoencoders. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 14104–14113, 2020.
225
+
226
+ Eitan Richardson and Yair Weiss. The surprising effectiveness of linear unsupervised image-toimage translation. ArXiv, abs/2007.12568, 2020.
227
+
228
+ Yujun Shen, Jinjin Gu, Xiaoou Tang, and Bolei Zhou. Interpreting the latent space of gans for semantic face editing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9243–9252, 2020.
229
+
230
+ Edgar Simo-Serra, Satoshi Iizuka, Kazuma Sasaki, and Hiroshi Ishikawa. Learning to simplify: fully convolutional networks for rough sketch cleanup. ACM Transactions on Graphics, 35:1–11, 07 2016. doi: 10.1145/2897824.2925972.
231
+
232
+ Ayush Tewari, Mohamed Elgharib, Gaurav Bharaj, Florian Bernard, Hans-Peter Seidel, Patrick Perez, Michael Zollh ´ ofer, and Christian Theobalt. Stylerig: Rigging stylegan for 3d control over ¨ portrait images. arXiv preprint arXiv:2004.00121, 2020.
233
+
234
+ Carlos Eduardo Thomaz and Gilson Antonio Giraldi. A new ranking method for principal components analysis and its application to face image analysis. Image and Vision Computing, 28(6):902 – 913, 2010. ISSN 0262-8856. doi: https://doi.org/10.1016/j.imavis.2009.11.005. URL http: //www.sciencedirect.com/science/article/pii/S0262885609002613.
235
+
236
+ Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Highresolution image synthesis and semantic manipulation with conditional gans. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8798–8807, 2018.
237
+
238
+ Ceyuan Yang, Yujun Shen, and Bolei Zhou. Semantic hierarchy emerges in deep generative representations for scene synthesis, 2019.
239
+
240
+ Michael Zhang, James Lucas, Jimmy Ba, and Geoffrey E Hinton. Lookahead optimizer: k steps forward, 1 step back. In Advances in Neural Information Processing Systems, pp. 9597–9608, 2019.
241
+
242
+ Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 586–595, 2018.
243
+
244
+ Hang Zhou, Jihao Liu, Ziwei Liu, Yu Liu, and Xiaogang Wang. Rotate-and-render: Unsupervised photorealistic face rotation from single-view images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5911–5920, 2020.
245
+
246
+ Jiapeng Zhu, Yujun Shen, Deli Zhao, and Bolei Zhou. In-domain gan inversion for real image editing. arXiv preprint arXiv:2004.00049, 2020a.
247
+
248
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE international conference on computer vision, pp. 2223–2232, 2017a.
249
+
250
+ Jun-Yan Zhu, Richard Zhang, Deepak Pathak, Trevor Darrell, Alexei A Efros, Oliver Wang, and Eli Shechtman. Toward multimodal image-to-image translation. In Advances in neural information processing systems, pp. 465–476, 2017b.
251
+
252
+ Peihao Zhu, Rameen Abdal, Yipeng Qin, and Peter Wonka. Sean: Image synthesis with semantic region-adaptive normalization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5104–5113, 2020b.
253
+
254
+ ![](images/6c4cc31dab2277525f919812eaa15843177fde4d034b0ab73aa011ebcda5b8b3.jpg)
255
+ Figure 7: (a) To generate multiple outputs for a single input image, style-mixing is performed over pSp. (b) Challenging cases for StyleGAN Inversion.
256
+
257
+ A ADDITIONAL DETAILS
258
+
259
+ # A.1 IMPLEMENTATION DETAILS
260
+
261
+ Training Details For our backbone network we use the ResNet-IR architecture from (Deng et al., 2019) pretrained on face recognition, which accelerated convergence. We use a fixed StyleGAN2 generator trained on the FFHQ (Karras et al., 2019) dataset. That is, only the pSp encoder network is trained on the given image-to-image translation task. For all applications, the input image resolution is $2 5 6 \times 2 5 6$ , where the generated $1 0 2 4 \times 1 0 2 4$ output is resized before being fed into the loss functions. For training, we use the Ranger optimizer, a combination of Rectified Adam (Liu et al., 2019a) with the Lookahead technique (Zhang et al., 2019), with a constant learning rate of 0.001. Only horizontal flips are used as augmentations during training. All experiments are performed using a single NVIDIA Tesla P40 GPU.
262
+
263
+ For the StyleGAN inversion task, the $\lambda$ values are set as $\lambda _ { 1 } = 1$ , $\lambda _ { 2 } = 0 . 8$ , $\lambda _ { 3 } = 0 . 1$ . For face frontalization, we increase the weight of the identity loss, setting $\lambda _ { 3 } = 1$ , and decrease the LPIPS and $L _ { 2 }$ loss functions, setting $\lambda _ { 1 } = 0 . 0 1$ , $\lambda _ { 2 } = 0 . 8$ over the inner part of the face and $\lambda _ { 1 } = 0 . 0 0 1$ , $\lambda _ { 2 } = 0 . 0 8$ elsewhere. Additionally, the constants used in the conditional image synthesis tasks are identical to those used in the inversion task except for the omission of the identity loss (i.e. we set $\lambda _ { 3 } = 0$ ). Finally, $\lambda _ { 4 }$ is set to 0.005 in all applications except for the StyleGAN inversion task, which does not utilize the regularization loss.
264
+
265
+ # A.2 DATASETS
266
+
267
+ We conduct our experiments on the CelebA-HQ dataset (Karras et al., 2018), which contains 30,000 high quality images. We use a standard train-test split of the dataset, resulting in approximately 24,000 training images. The FFHQ dataset from (Karras et al., 2019), which contains 70,000 face images, is used for the StyleGAN inversion and face frontalization tasks.
268
+
269
+ For the generation of face images from sketches, we construct a dataset representative of handdrawn sketches using the CelebA-HQ dataset (Karras et al., 2018). Given an input image, we first apply a “pencil sketch” filter which retains most facial details of the original image while removing the remaining noise. We then apply the sketch-simplification method by Simo-Serra et al. (2016), resulting in images resembling hand-drawn sketches.
270
+
271
+ # B ADDITIONAL APPLICATIONS
272
+
273
+ # B.1 SUPER RESOLUTION
274
+
275
+ Here we show that our framework can be used to construct high-resolution (HR) facial images from corresponding low-resolution (LR) input images. PULSE (Menon et al., 2020) approaches this task in an unsupervised manner by traversing the HR image manifold in search of an image that downsamples to the input LR image. In this work we focus on applying pSp in a supervised manner as obtaining paired data is immediate. We show that our method achieves comparable results to PULSE and other previous works.
276
+
277
+ Methodology and details We train our model in a supervised fashion, where for each input we perform random bi-cubic down-sampling of $\times 1$ (i.e. no down-sampling), $\times 2 , \times 4 , \times 8$ , $\times 1 6$ , $\times 3 2$ and set the original, full resolution image as the target.
278
+
279
+ Results Figure 9 demonstrates the visual quality of the resulting images from our method along with those of the previous approaches. Although PULSE is able to achieve very high-quality results due to their usage of StyleGAN to generate images, they are unable to accurately retain identity even when performing down-sampling of $\times 8$ to a resolution of $3 2 \times 3 2$ . By learning a pixel-wise correspondence between the LR and HR images, pix2pixHD is able to obtain satisfying results even when down-sampled to a resolution of $1 6 \times 1 6$ (i.e. $\times 1 6$ down-sampling). However, visually, their results appear less photo-realistic. Contrary to these previous works, we are able to obtain highquality results even when down-sampling to resolutions of $1 6 \times 1 6$ and $8 \times 8$ . Finally, we generate multiple outputs for a given LR image using our multi-modal technique by perform style-mixing on layers (4-7) with an $\alpha$ value of 0.5 with a randomly sampled w vector, which alters medium-level styles that mainly control facial features. Figure 10 illustrates the results.
280
+
281
+ # B.2 EVEN MORE APPLICATIONS
282
+
283
+ To better show the flexibility of our pSp framework, We present three additional applications, which are summarized in Figure 8.
284
+
285
+ Local Editing Our framework allows for a simple approach to local image editing where altering specific attributes of an input sketch (e.g. eyes, smile) or segmentation map (e.g. hair) results in local edits of the generated images.
286
+
287
+ Face Interpolation Given two real images one can obtain their respective latent codes $w _ { 1 } , w _ { 2 } \in$ $\mathcal { W } +$ by feeding the images through our encoder. We can then naturally interpolate between the two images by computing their intermediate latent code $w ^ { \prime } = \lambda w _ { 1 } + ( 1 \bar { - \lambda } ) \bar { w } _ { 2 }$ for $0 \leq \lambda \leq 1$ and generate the corresponding image using the new code $w ^ { \prime }$ .
288
+
289
+ Inpainting Finally, we show the ability of our framework to reconstruct missing parts of an image using a simple, symmetric triangular mask. Our approach is able to accurately reconstruct the occluded areas while preserving the identity with respect to the original image.
290
+
291
+ ![](images/86f5a49cffbd32d7a6733400d7854ef3fa70e9da809eb23cd98d657af77aae3e.jpg)
292
+ Figure 8: Additional applications for the pSp framework.
293
+
294
+ ![](images/306f3b0994bcc83d2eb8bcc0bfefa18fb443c65fcaf1adadee5c332ec672f0c4.jpg)
295
+ Figure 9: Comparison of super-resolution approaches with (a) $\times 8$ down-sampling, (b) $\times 1 6$ downsampling, and (c) $\times 3 2$ down-sampling.
296
+
297
+ ![](images/cc851dc564bcf59d7ad3cc72569ed9fb3ead6857cedb2026f61dfd6d209bbd20.jpg)
298
+ Figure 10: Multi-modal synthesis for super-resolution using pSp with style-mixing.
299
+
300
+ # C ADDITIONAL RESULTS
301
+
302
+ ![](images/0b25c29782244b03b64745b80191702264eb58f7874ed7bb4b9668287da6e962.jpg)
303
+ Figure 11: Additional StyleGAN inversion results using pSp on the CelebA-HQ (Karras et al., 2018) test set.
304
+
305
+ ![](images/0bc1a6317ea8cc91663d5ac69208bcc68da61cbde0a677bb5ea6a84e8a4b80f5.jpg)
306
+ Figure 12: Additional face frontalization results using pSp on the CelebA-HQ (Karras et al., 2018) test set.
307
+
308
+ ![](images/d2f8dd3a4bf409c2f63b861f3263b95631a3910158bfd6c3ff50947224bac76f.jpg)
309
+ Figure 13: Even for challenging, non-frontal face sketches, pSp is able to obtain high-quality, diverse outputs.
310
+
311
+ ![](images/e0db11481e9689ab3efaf35c551a8e00ff24be6e85b5d47c8c790141a433397a.jpg)
312
+ Figure 14: Additional results using pSp for the generation of face images from sketches constructed from the CelebA-HQ (Karras et al., 2018) test dataset.
313
+
314
+ ![](images/285edcda767a71026820f65323a255deec2bce6771dc0a1f83b629dcf5a456c8.jpg)
315
+ Figure 15: Additional results on the Helen Faces (Le et al., 2012) dataset using our proposed labelto-image method.
316
+
317
+ ![](images/a9f3f2b94b8e1934a25bd2d1d39736774770d5133ef0ff5c9e79e28416c3dbed.jpg)
318
+ Figure 16: Additional results on the CelebAMask-HQ (Karras et al., 2018) test set using our proposed label-to-image method.
319
+
320
+ ![](images/fe2db569bda27147de22c163e828d57efa05c8729d3e9bc45cda5f45a1c704d7.jpg)
321
+ Figure 17: Conditional image synthesis results from sketches and segmentation maps displaying the multi-modal property of our approach.
md/train/rkEfPeZRb/rkEfPeZRb.md ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VARIANCE-BASED GRADIENT COMPRESSION FOR EF-FICIENT DISTRIBUTED DEEP LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Due to the substantial computational cost, training state-of-the-art deep neural networks for large-scale datasets often requires distributed training using multiple computation workers. However, by nature, workers need to frequently communicate gradients, causing severe bottlenecks, especially on lower bandwidth connections. A few methods have been proposed to compress gradient for efficient communication, but they either suffer a low compression ratio or significantly harm the resulting model accuracy, particularly when applied to convolutional neural networks. To address these issues, we propose a method to reduce the communication overhead of distributed deep learning. Our key observation is that gradient updates can be delayed until an unambiguous (high amplitude, low variance) gradient has been calculated. We also present an efficient algorithm to compute the variance and prove that it can be obtained with negligible additional cost. We experimentally show that our method can achieve very high compression ratio while maintaining the result model accuracy. We also analyze the efficiency using computation and communication cost models and provide the evidence that this method enables distributed deep learning for many scenarios with commodity environments.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep neural networks are attracting attention because of their outstanding prediction power in many application fields such as image recognition, natural language processing, and speech recognition. In addition, software frameworks are publicly available, making it easier to apply deep learning. However, their crucial drawback is the substantial computational cost on training. For example, it takes over a week to train ResNet-50 on the ImageNet dataset if using a single GPU. Such long training time limits the number of trials possible when creating models.
12
+
13
+ Therefore, we must conduct distributed training using multiple computation workers (e.g., multiple GPUs in different nodes). However, by nature, workers need to frequently communicate gradients, which yields a severe bottleneck for scalability, especially when using lower bandwidth connections. For example, when using 1000BASE-T Ethernet, communication takes at least ten times longer than forward and backward computation for ResNet-50, making multiple nodes impractical. High performance interconnections such as InfiniBand and Omni-Path are an order of magnitude more expensive than commodity interconnections, which limits research and development of deep learning using large-scale datasets to a small number of researchers.
14
+
15
+ Although several methods have been proposed to compress gradient for efficient communication, they either suffer a low compression ratio or significantly harm the resulting model accuracy, particularly when applied to convolutional neural networks. There are mainly two lines of research: quantization and sparsification. Quantization-based methods include 1-bit SGD (Seide et al., 2014) and TernGrad (Wen et al., 2017). Though they achieve small loss of accuracy by using at least one bit for each parameter, the compression ratio is limited. Sparsification-based methods include Strom (2015) and QSGD (Alistarh et al., 2017). While they can achieve high compression ratio, as we will see in our experiments, they harm the resulting model accuracy or suffer a low compression ratio, particularly when applied to convolutional neural networks.
16
+
17
+ To address these issues, we propose a new gradient compression algorithm to reduce the communication overhead of distributed deep learning. The proposed method belongs to the sparsification approaches. Our key observation is that the variance of the gradient for each parameter point over iterations is a useful signal for compression. As almost all previous approaches of both sparsification and quantization only look at the magnitude of gradient, we believe that we are opening a new door for this field. In addition, we also show that our method can be combined with previous compression methods to further boost performance. We also present an efficient algorithm to compute the variance and prove that it can be obtained with negligible additional cost.
18
+
19
+ We experimentally demonstrate that our method can achieve a high compression ratio while maintaining result model accuracy. We also analyze the efficiency using computation and communication cost models and provide evidence that our method enables distributed deep learning for many scenarios with commodity environments.
20
+
21
+ Organization. The remainder of this paper is organized as follows: Section 2 provides the definitions and notations used in this paper. Section 3 reviews related work in this field. Section 4 presents the proposed method. Section 5 analyzes performance. Section 6 shows our experimental results, and we conclude in Section 7.
22
+
23
+ # 2 PRELIMINARIES
24
+
25
+ In this section, we describe an overview of distributed deep learning and parameter updates with compressed gradients.
26
+
27
+ # 2.1 CHALLENGES IN DATA PARALLEL STOCHASTIC GRADIENT DESCENT
28
+
29
+ In data parallel distributed Stochastic Gradient Descent (SGD), all workers have identical copies of the same model and calculate gradients using different subsets of training data. Gradients are shared across all workers, and each worker updates its local model using the shared gradients.
30
+
31
+ There are two well-known approaches to communication of gradients: synchronous and asynchronous. Even though our method can be applied to both of them, we focus on the synchronous approach in this paper. Each worker computes gradients and shares them with other workers using a synchronized group communication routine in every single training iteration, typically using a communication routine known as allreduce.
32
+
33
+ The challenge is that the communication is possibly a severe bottleneck in a training process. Gradients typically consist of tens of millions of floating point values so the total size of exchanged data can be large. For example, the model size of ResNet-50 (He et al. (2016)) is over $1 1 0 \mathrm { M B }$ , and the size of gradients becomes large accordingly. Thus, the communication time has a significant effect on the total training time in environments equipped with a commodity interconnect hardware, such as 1Gb Ethernet. Also, in the synchronous approach, workers have to wait for completion of communication and their computing resources including GPUs are idle, which is a significant performance loss.
34
+
35
+ # 2.2 PROBLEM FORMULATION
36
+
37
+ In basic procedures of SGD, model parameters are updated as
38
+
39
+ $$
40
+ \boldsymbol x _ { t + 1 } = \boldsymbol x _ { t } - \gamma \nabla f _ { t } ( \boldsymbol x _ { t } ) ,
41
+ $$
42
+
43
+ where $x _ { t }$ and $\nabla f _ { t } ( x _ { t } )$ are model parameters and calculated gradients in time step $t$ , respectively. $f _ { t }$
44
+ is a loss function and it differs between samples used in a mini-batch. $\gamma$ is a step size.
45
+
46
+ To reduce an amount of data to be exchanged over a network, either quantization or sparsification or both are used as explained in Sec. 3.
47
+
48
+ # 3 RELATED WORK
49
+
50
+ There are two main approaches to gradient compression: quantization-based approaches and sparsification-based approaches. Quantization-based approaches reduce communication cost by expressing each gradient with fewer bits. If a baseline uses 32-bit floating points in communication, then it can reduce the amount of communication by up to 32 times. Seide et al. (2014) showed that neural networks can be trained using only one sign bit per parameter. There are two key techniques in their algorithm. First, they use different threshold to encode and decode gradient elements for each column of weight matrix. Second, quantization errors are added to the gradients calculated in the next step. Its effectiveness has been experimentally verified through speech models. Wen et al. (2017) proposed TernGrad to encode gradients with 2 bits per parameter. The algorithm is characterized by its theoretically-guaranteed convergence and reported that it can successfully train GoogLeNet (Szegedy et al., 2015) on ImageNet with an average loss of accuracy of less than $2 \%$ .
51
+
52
+ As a second approach, sparsification-based approaches reduce communication cost by sending only a small fraction of gradients. Even though they require sending not only the values of gradients but also parameters’ indexes, their strong sparsification reduces transmission requirements significantly. Strom (2015) proposed sending only gradients whose absolute values are greater than a user-defined threshold. The algorithm sends only sign bits and encoded indexes of parameters. Gradients are decoded up to the threshold and quantization errors are added to the gradients calculated in the next step as 1-bit stochastic gradients. Its effectiveness has also been experimentally verified on speech applications. Dryden et al. (2016) extended Strom’s method. They proposed to use an adaptive threshold instead of using a user-defined threshold. They also introduced repeated sparsification of gradients in order to combine the algorithm with an efficient communication algorithm. Alistarh et al. (2017) proposed QSGD. QSGD stochastically rounds gradients to linearly quantized values, which are calculated in the algorithm. Their work enjoys strong theoretical properties in convex optimizations. Furthermore, they can control the trade-off between accuracy and compression. On the other hand, Strom’s method does not work with small or large thresholds.
53
+
54
+ # 4 PROPOSED METHODS
55
+
56
+ In this section, we describe the proposed method. An efficient implementation and combination with other compression methods are also explained.
57
+
58
+ Our work belongs to the sparsification-based approaches. In this section, we explicitly denote a gradient vector $( \nabla \bar { f } ( x ) )$ and a gradient element $( \nabla _ { i } f ( x ) )$ for clarity. Previous works in this direction have focused on gradient elements with small magnitudes, and they rounded them to zero to sparsify. Our work diverges at this point. We propose using approximated variances of gradient elements instead of magnitudes. Our method do not transmit ambiguous elements until additional data reduce their ambiguity and significantly reduces communication while maintaining accuracy. This method enables shifting the balance between accuracy and compression, as necessary. Furthermore, we can combine our work with sparsity-promoting quantization like QSGD and Strom’s method. We show the way of combination with the Strom’s method later.
59
+
60
+ # 4.1 KEY CONCEPTS
61
+
62
+ The key idea of our method is delaying sending ambiguously estimated gradient elements. We consider a gradient element to be ambiguous when its amplitude is small compared to its variance over the data points. We extend the standard updating method to the following:
63
+
64
+ $$
65
+ x _ { t + 1 } - \gamma r _ { t + 1 } = x _ { t } - \gamma ( \nabla f _ { t } ( x _ { t } ) + r _ { t } ) .
66
+ $$
67
+
68
+ This extension follows Seide et al. (2014) and Strom (2015).
69
+
70
+ In previous works, the approximation errors are accumulated in $r _ { t }$ and used in future updates. In each step, parameters are updated only with approximated gradient elements represented by less number of bits. In our work, we interpret $r _ { t }$ as a delayed update, not approximation errors.
71
+
72
+ We send the gradient element corresponding to the $i$ -th parameter only when it satisfies the following criterion,
73
+
74
+ $$
75
+ \frac { \alpha ^ { \prime } } { | B | } V _ { B } [ \nabla _ { i } f _ { z } ( x ) ] < ( \nabla _ { i } f _ { B } ( x ) ) ^ { 2 } ,
76
+ $$
77
+
78
+ where $| B |$ is a size of the mini-batch and $\alpha ^ { \prime }$ is a hyper parameter representing required estimation accuracy. $z$ is a each sample and $B$ is a mini-batch, respectively and $f _ { z }$ and $f _ { B }$ are corresponding loss functions. $V _ { B } [ \nabla _ { i } f _ { z } ( x ) ]$ is the sample variance of the gradient element corresponding to the $i$ -th parameter over a mini-batch $B$ .
79
+
80
+ If we do not send some gradient elements, we add them to the next batch and recalculate (1) with increased batch size. For example, if we postpone sending a gradient element nine times consecutively, the criterion (1) is calculated as if ten times larger batch than usual mini-batch in the next step. Note that even though the criterion (1) is calculated as if we used a larger batch, what is used for an update is not the mean of the mini-batches across steps but the sum of them.
81
+
82
+ Following lemma supports our formulation.
83
+
84
+ Lemma 4.1. (De et al., 2017) A sufficient condition that a vector $- g$ is a descent direction is
85
+
86
+ $$
87
+ \begin{array} { r } { \| g - \nabla f ( x ) \| _ { 2 } ^ { 2 } < \| g \| _ { 2 } ^ { 2 } . } \end{array}
88
+ $$
89
+
90
+ We are interested in the case of $g = \nabla f _ { B } ( x )$ , the gradient vector of the loss function over $B$ . By the weak law of large numbers, when $| B | > 1$ , the left hand side of Eq. 2 with $g = \nabla f _ { B } ( x )$ can be estimated as follows:
91
+
92
+ $$
93
+ E [ \| \nabla f _ { B } ( x ) - \nabla f ( x ) \| _ { 2 } ^ { 2 } ] \sim \frac { 1 } { | B | } V _ { B } [ \nabla f _ { z } ( x ) ] .
94
+ $$
95
+
96
+ Thus our formulation with $\alpha ^ { \prime } \geq 1$ corresponds to an elementwise estimation of the sufficient condition (2) that a gradient vector decreases the loss function. Gradient elements become more likely to be sent as sample size increases. However, if once gradient elements are estimated with too high variances, it takes too long for the elements to be sent. Thus, we decay variance at every step. Details are described in subsection 4.4. In the combination with optimization methods like Momentum SGD, gradient elements not sent are assumed to be equal to zero.
97
+
98
+ # 4.2 QUANTIZATION AND PARAMETER ENCODING
99
+
100
+ To allow for comparison with other compression methods, we propose a basic quantization process. In this section, we refer to a gradient as an accumulated gradient. After deciding which gradient elements to send, each worker sends pairs of a value of a gradient element and its parameter index as Strom (2015) and Alistarh et al. (2017). We quantize each element to 4-bit so that we can represent each pair in 32-bit as per Strom (2015). The 4-bit consists of one sign bit and three exponent bits.
101
+
102
+ Our quantization except for the sign bit is as follows. For a weight matrix $W _ { k }$ (or a weight tensor in CNN), there is a group of gradient elements corresponding to the matrix. Let $M _ { k }$ be the maximum absolute value in the group. First, for each element $g _ { i }$ in the $k$ -th group, if $| g _ { i } |$ is larger than $2 ^ { \lfloor \log _ { 2 } M _ { k } \rfloor }$ truncate it to $2 ^ { \lfloor \log _ { 2 } { M _ { k } } \rfloor }$ , otherwise, round to the closer value of $2 ^ { \lfloor \log _ { 2 } \left. \dot { g } _ { i } \right. \rfloor }$ or $2 ^ { \lceil \bar { \log } _ { 2 } \lvert g _ { i } \rvert \rceil }$ . Let $g _ { i } ^ { \prime }$ be the preprocessed gradient element. Next, calculate a integer $d _ { i } : = \lfloor \log _ { 2 } M _ { k } \rfloor - \log _ { 2 } g _ { i } ^ { \prime }$ . If $d \sb i > 7$ then we do not send the value, otherwise, encode the integer from 0 to 7 using 3 bits. $\lfloor \log _ { 2 } M _ { k } \rfloor$ is also sent for every weight matrix. An efficient implementation is presented in subsection 4.4. We do not adopt stochastic rounding like Alistarh et al. (2017) nor accumulate rounding error $g _ { i } - g _ { i } ^ { \prime }$ for the next batch because this simple rounding does not harm accuracy empirically. Appendix B has a running example of this quantization.
103
+
104
+ Because the variance-based sparsification method described in subsection 4.1 is orthogonal to the quantization shown above, we can reduce communication cost further using sparsity promoting quantization methods such as QSGD instead. However, we used the quantization to show that enough level of sparsity is gained solely by our variance-based sparsification because the quantization rounds only a small fraction of gradient elements to zero. We show how to combine our method with a method in Strom (2015) later in this paper because the way of the combination is less obvious. We use a naive encoding for parameter indexes because the rest 28-bits are enough. We can further reduce the number of bits by compressing parameter indexes (Strom, 2015; Alistarh et al., 2017).
105
+
106
+ # 4.3 COMMUNICATION BETWEEN WORKERS
107
+
108
+ In distributed deep learning, the most important operation is to take the global mean of the gradient elements calculated in each worker. The operation is referred to as “allreduce.” It consists of three steps: (1) collects all local arrays in each worker, (2) reduce them using a given arithmetic operator, which is summation in this case, and (3) broadcast the result back to all workers so that all workers obtain the identical copies of the array.
109
+
110
+ Conventional data parallel deep learning applications can enjoy the benefit of highly optimized allreduce implementations thanks to the fact that only the sum of the values has to be kept during the communication. However, after applying the proposed method to the local gradient elements, they are converted to a sparse data structure so the allreduce operation can no longer apply.
111
+
112
+ Dryden et al. (2016) and Aji & Heafield (2017) proposed sparsifying gradient elements multiple times to utilize a kind of allreduce for sparsification-based compressions. However, the accuracy is possibly degraded when the elements are highly compressed through repetitive compressions. Instead, we adopt allgatherv for communication, where each worker just sends the calculated elements to other workers. We avoid to encode and decode elements multiple times by allgatherv. In allgatherv communication cost hardly increase from a kind of allreduce because index overlap, which is needed for summation, rarely occur if the compression ratio is sufficiently higher than the number of workers. Thanks to the high compression ratio possible with this algorithm and its combination with other compression methods, even large numbers of workers can be supported. Some optimization methods, such as ADAM (Ba & Kingma, 2015), require parameter updates and postprocessing. They are calculated locally after the communication.
113
+
114
+ # 4.4 EFFICIENT IMPLEMENTATION
115
+
116
+ We first describe the efficient computation of the criterion (1) and second how to quantize gradient elements without additional floating points operations. We can efficiently compare squared mean and variance in the criterion (1) by just comparing squared mean of gradient elements and sum of squared gradient elements. That is,
117
+
118
+ $$
119
+ \left( \sum _ { z \in B } \frac { 1 } { | B | } \nabla _ { i } f _ { z } ( x ) \right) ^ { 2 } > \alpha \sum _ { z \in B } \left( \frac { 1 } { | B | } \nabla _ { i } f _ { z } ( x ) \right) ^ { 2 }
120
+ $$
121
+
122
+ achieves our goal. Thus, we have to maintain only the sum of gradient elements and sum of squared gradient elements. Details are described in Appendix A. Decay of variance, described in subsection 4.1, is accomplished by multiplying hyperparameter $\zeta ( < 1 )$ to the sum of squared gradient elements at every step. Alpha in Eq. 3 controls how much unambiguity the algorithm require. The algorithm compress more aggressively with larger alpha. A range from one to two is good for alpha from its derivation. Fig. 1 shows the final algorithm.
123
+
124
+ The quantization of parameters described in subsection 4.2 can also be efficiently implemented with the standard binary floating point representation using only binary operations and integer arithmetic as follows. We can calculate $2 ^ { \lfloor \log _ { 2 } x \rfloor }$ by truncating the mantissa. We can also round values by adding one to the most significant bit of mantissa as if $x$ is an unsigned integer and then masking mantissa to 0.
125
+
126
+ # 4.5 HYBRID ALGORITHM
127
+
128
+ We describe the way to combine our method with Strom’s method. It becomes problematic how to modify variance when only parts of gradient elements are exchanged. We solve the issue simply by modifying $a ^ { 2 }$ to $( a - b ) ^ { 2 }$ . Let S be the value sent in a step (i.e. threshold, -threshold or 0). We correct squared gradient elements $\textstyle \sum ( \nabla _ { i } f ) ^ { 2 }$ to $\sum ( \nabla _ { i } f ) ^ { 2 } - 2 \bar { S } \sum ( \nabla _ { i } f ) + S ^ { 2 }$ . Fig. 2 shows the algorithm. We show the effictiveness of this combined algorithm by experiments in Sec. 6. Combinations with other works like QSGD and TernGrad are rather straightforward and we do not explore further in this paper.
129
+
130
+ # 5 PERFORMANCE ANALYSIS
131
+
132
+ Because common deep learning libraries do not currently support access to gradients of each sample, it is difficult to contrast practical performance of an efficient implementation in the commonly used software environment. In light of this, we estimate speedup of each iteration by gradient compression with a performance model of communication and computation. The total speed up of the whole training process is just the summation of each iteration because we adopt a synchronized approach.
133
+
134
+ Figure 1: Basic algorithm of our variancebased compression. $\zeta$ and $\alpha$ are hyperparameters. Recommended value for $\zeta$ is 0.999. $\alpha$ controls compression and accuracy. $\nabla _ { i } f _ { z }$ denotes a gradient element of parameter $i$ for each sample $z$ in mini-batch. CalcGrad() is backward and forward computaion. Encode() includes quantization and encoding of indexes. CommunicateAndUpdate() requires sharing gradient elements and decode, then update parameters.
135
+
136
+ <table><tr><td>Algorithm1:Basic</td></tr><tr><td>hyperparam:B = batch size, S,α</td></tr><tr><td>foreach parameters:</td></tr><tr><td>ri=0;</td></tr><tr><td>Ui = 0;</td></tr><tr><td>while not converged:</td></tr><tr><td>CalcGrad(;</td></tr><tr><td>foreach parameters: Vif; ri+=∑</td></tr><tr><td>Df)²; B</td></tr><tr><td>Ui+=∑( B</td></tr><tr><td>if r² &gt;αui:</td></tr><tr><td>Encode(ri);</td></tr><tr><td>ri=0;</td></tr><tr><td>Ui=0;</td></tr><tr><td>else:</td></tr><tr><td>Ui *=;</td></tr><tr><td>CommunicateAndUpdate();</td></tr></table>
137
+
138
+ Figure 2: Hybrid algorithm of our variancebased compression and Strom’s method. $\tau$ is a user-defined threshold required in Strom’s method. Other parameters and notations are the same with Fig. 1.
139
+
140
+ <table><tr><td>Algorithm 2: Hybrid</td><td colspan="2"></td></tr><tr><td>hyperparam:B = batch size, S,α,T</td><td rowspan="3">if |ri| &gt;T and r² &gt; αvi: Encode(Sign(ri)); ri -= Sign(ri) T; max(Ui - 2|rilT + T²,0);</td></tr><tr><td>foreach parameters:</td></tr><tr><td>ri=0; Ui=0;</td></tr></table>
141
+
142
+ In the communication part, the pairs of the quantized values and the parameter indexes in each node are broadcast to all nodes. The $i$ -th node’s input data size $n _ { i } ( i = 1 , . . . , p )$ may be different among nodes, where $p$ denotes the number of nodes. An MPI function called allgatherv realizes such an operation. Because recent successful image recognition neural network models like VGG (Simonyan & Zisserman, 2015) or ResNet (He et al., 2016) have a large number of parameters, the latency term in communication cost can be ignored even if we achieve very high compression ratio such as $c > 1 , 0 0 0$ . In such cases, a type of collective communication algorithms called the ring algorithm is efficient (Thakur et al., 2005). Its bandwidth term is relatively small even though its latency term is proportional to $p$ . Although the naive ring allgatherv algorithm costs unacceptable $O ( \operatorname* { m a x } _ { i } n _ { i } \cdot p )$ time, Traff et al. ¨ (2008) proposed a method to mitigate it by dividing large input data, which is called pipelined ring algorithm. For example, an allgatherv implementation in MVAPICH adopts a pipelined ring algorithm for large input data.
143
+
144
+ The calculation of variance of gradients dominates in the additional cost for the computation part of the proposed method. The leading term of the number of multiply-add operations in it is $2 N | B |$ , where $N$ and $| B |$ are the number of parameters and the local batch size, respectively. Other terms such as determination of sent indexes and application of decay are at most $\bar { O } ( N )$ . Therefore hereafter we ignore the additional cost for the computation part and concentrate to the communication part.
145
+
146
+ We discuss the relationship between the compression ratio and the speedup of the communication part. As stated above, we ignore the latency term. The baseline is ring allreduce for uncompressed gradients. Its elapsed time is $T _ { r } = 2 ( p - \mathrm { i } ) N s \beta / p$ , where $s$ and $\beta$ are the bit size of each parameter and the transfer time per bit, respectively. On the other hand, elapsed time of pipelined ring allgatherv is $T _ { v } = \sum [ ( { n } _ { i } / m ) - 1 ) \bar { m \beta } ]$ , where $m$ is the block size of pipelining. Defining $c$ as the averaged compression ratio including change of the number of bits per parameter, $T _ { v }$ is evaluated as $\begin{array} { r } { T _ { v } \leq ( \sum n _ { i } + ( p - 1 ) m ) \beta = ( N s p / c + ( p - 1 ) m ) \beta . } \end{array}$ . If we set $m$ small enough, relative speedup is $T _ { r } / \overline { { T _ { v } } } \geq 2 ( p - 1 ) c / p ^ { 2 }$ . Therefore we expect linear speedup in $c > p / 2$ range.
147
+
148
+ # 6 EXPERIMENTS
149
+
150
+ In this section, we experimentally evaluate the proposed method. Specifically, we demonstrate that our method can significantly reduce the communication cost while maintaining test accuracy. We also show that it can reduce communication cost further when combined with other sparsification methods, and even improves test accuracy in some settings.
151
+
152
+ We used CIFAR-10 (Krizhevsky, 2009) and ImageNet (Russakovsky et al., 2015), the two most popular benchmark datasets of image classification. We fixed the hyperparameter $\zeta$ in Fig. 1 and Fig. 2 to 0.999 in all experiments. We evaluated gradient compression algorithms from the following two viewpoints: accuracy and compression ratio. The accuracy is defined as the test accuracy at the last epoch, and the compression ratio is defined as the number of the total parameters of networks divided by the average number of parameters sent. We do not consider the size of other non-essential information required for the communication, because they are negligible. In addition, we can ignore the number of bits to express each gradient because we assume that both a gradient and a parameter index are enclosed in a 32 bit word as Strom (2015) in all algorithms. Please note that, as all methods use allgatherv for communication, communication cost increases in proportion to the number of workers. Thus, high compression ratio is required to achieve sufficient speed up when using tens or hundreds of workers. We have visualization of results in Appendix C.
153
+
154
+ # 6.1 CIFAR-10
155
+
156
+ For experiments on CIFAR-10, we used a convolutional neural network similar to VGG (Simonyan & Zisserman, 2015). The details of the network architecture are described in Appendix D. We trained the network for 300 epochs with weight decay of 0.0005. A total number of workers was 8 and batch size was 64 for each worker. We applied no data augmentation to training images and center-cropped both training and test images into 32x32. We used two different optimization methods: Adam (Ba & Kingma, 2015) and momentum SGD (Sutskever et al., 2013). For Adam, we used Adam’s default parameter described in Ba & Kingma (2015). For momentum SGD, we set the initial learning rate to $0 . 0 5 \times 8$ and halved it at every 25 epochs. We used two’s complement in implementation of QSGD and ”bit” represents the number of bits used to represent each element of gradients. ”d” represents a bucket size. For each configuration, we report the median of the accuracy from five independent runs. Compression ratios are calculated based on the execution that achieved the reported accuracy.
157
+
158
+ Table 1 summarizes the results. Our method successfully trained the network with slight accuracy gain for the Adam setting and 2 to $3 \%$ of accuracy degradation for the Momentum SGD setting. Compression ratios were also sufficiently high, and our method reduced communication cost beyond quantization-based approaches described in section 3. The hybrid algorithm’s compression ratio is several orders higher than existing compression methods with a low reduction in accuracy. This indicates the algorithm can make computation with a large number of nodes feasible on commodity level infrastructure that would have previously required high-end interconnections. Even though QSGD achieved higher accuracy than our method, its compression power is limited and our algorithm can reduce communication cost more aggressively. On the other hand, Strom’s method caused significant accuracy degradation. Counter-intuitively, the hybrid algorithm improved its accuracy, in addition to the further reduction of communication.
159
+
160
+ Our hypothesis for this phenomena is as follows. In Strom’s algorithm, when a large positive gradient appears, it has no choice but send positive values for consequent steps even if calculated gradients in following mini-batches have negative values. On the other hand, in the hybrid algorithm, if following gradients have a different sign with a residual, the residual is not likely to be sent. We assume that this effect helped the training procedure and led to better accuracy. We also would like to mention the difficulty of hyperparameter tuning in Strom’s method. As Table 1 shows, using lower threshold does not necessarily always lead to higher accuracy. This is because the hyperparameter controls both its sparsification and quantization. Thus, users do not know whether to use a larger or smaller value as a threshold to maintain accuracy. We note that we observed unstable behaviors with other thresholds around 0.01. On the other hand, our algorithm are free from such problem. Moreover, when we know good threshold for Strom’s algorithm, we can just combine it with ours to get further compression.
161
+
162
+ Table 1: Training of a VGG-like network on CIFAR-10. $\tau$ denotes the threshold in Strom’s method. $\alpha$ is the hyperparameter of our method described in the criterion (3). The number of bits of QSGD refers the number of bits to express gradients except for the sign bits. For each configuration, the median of the accuracy from five independent runs is reported. The compression column lists the compression ratio defined at the beginning of Sec. 6.
163
+
164
+ <table><tr><td colspan="3">Adam</td><td colspan="2">Momentum SGD</td></tr><tr><td>Method</td><td>Accuracy</td><td>Compression</td><td>Accuracy</td><td>Compression</td></tr><tr><td>no compression</td><td>88.1</td><td>1</td><td>91.7</td><td>1</td></tr><tr><td>Strom, T = 0.001</td><td>62.8</td><td>88.5</td><td>84.8</td><td>6.5</td></tr><tr><td>Strom, T = :0.01</td><td>85.0</td><td>230.1</td><td>10.6</td><td>990.7</td></tr><tr><td>Strom, T = 0.1</td><td>88.0</td><td>6,942.8</td><td>71.6</td><td>8,485.0</td></tr><tr><td>our method,α = 1</td><td>88.9</td><td>120.7</td><td>90.3</td><td>52.4</td></tr><tr><td>our method,α = 1.5</td><td>88.9</td><td>453.3</td><td>89.6</td><td>169.2</td></tr><tr><td>our method,α = 2.0</td><td>88.9</td><td>913.4</td><td>88.4</td><td>383.6</td></tr><tr><td>hybrid, τ = 0.01,α = 2.0</td><td>85.0</td><td>1,942.2</td><td>87.6</td><td>983.9</td></tr><tr><td>hybrid, τ = 0.1,α = 2.0</td><td>88.2</td><td>12,822.4</td><td>87.1</td><td>12,396.8</td></tr><tr><td>QSGD (2bit, d = 128)</td><td>88.8</td><td>12.3</td><td>90.8</td><td>6.6</td></tr><tr><td>QSGD (3bit, d = 512)</td><td>87.4</td><td>14.4</td><td>91.4</td><td>7.0</td></tr><tr><td>QSGD (4bit, d = 512)</td><td>88.2</td><td>11.0</td><td>91.7</td><td>4.0</td></tr></table>
165
+
166
+ Table 2: Training ResNet50 on ImageNet. $\tau$ denotes a threshold in Strom’s method. $\alpha$ is the hyperparameter of our method described in the criterion (3). Accuracy is the test accuracy at the last epoch. Compression refers compression ratio defined in the beginning of Sec. 6.
167
+
168
+ <table><tr><td colspan="3">Adam</td><td colspan="2">Momentum SGD</td></tr><tr><td>Method</td><td>Accuracy</td><td>Compression</td><td> Accuracy</td><td>Compression</td></tr><tr><td>no compression</td><td>56.2</td><td>1</td><td>76.0</td><td>1</td></tr><tr><td>Strom, T = 0.001</td><td>28.6</td><td>38.6</td><td>75.2</td><td>2.1</td></tr><tr><td>Strom, T = 0.01</td><td>50.0</td><td>156.2</td><td>75.5</td><td>35.2</td></tr><tr><td>Strom, T = 0.1</td><td>48.1</td><td>6,969.0</td><td>75.5</td><td>2.002.2</td></tr><tr><td>our method,α = 1</td><td>55.3</td><td>1,542.8</td><td>74.7</td><td>103.8</td></tr><tr><td>our method, α = 1.5</td><td>57.4</td><td>2,953.1</td><td>75.5</td><td>400.7</td></tr><tr><td>our method,α = 2.0</td><td>57.8</td><td>5,173.8</td><td>75.1</td><td>990.7</td></tr><tr><td>hybrid, τ = 0.01,α = 2.0</td><td>52.2</td><td>2,374.2</td><td>75.0</td><td>470.9</td></tr><tr><td>hybrid, T = 0.1,α = 2.0</td><td>43.1</td><td>28,954.2</td><td>75.1</td><td>4,345.0</td></tr></table>
169
+
170
+ # 6.2 IMAGENET
171
+
172
+ As larger scale experiments, we trained ResNet-50 (He et al., 2016) on ImageNet. We followed training procedure of Goyal et al. (2017) including optimizer, hyperparameters and data augmentation. We also evaluated algorithms with replacing MomentumSGD and its learning rate scheduling to Adam with its default hyperparameter. We used batch size 32 for each worker and used 16 workers.
173
+
174
+ Table 2 summarizes the results. In this example as well as the previous CIFAR10 example, Variancebased Gradient Compression shows a significantly high compression ratio, with comparable accuracy. While in this case, Strom’s method’s accuracy was comparable with no compression, given the significant accuracy degradation with Strom’s method on CIFAR10, it appears Variance-based Gradient Compression provides a more robust solution. Note that the training configuration with MomentumSGD is highly optimized to training without any compression. For reference, the original paper of ResNet-50 reports its accuracy as $7 5 . 3 \%$ (He et al., 2016). Wen et al. (2017) reports that it caused up to $2 \%$ accuracy degradation in training with GoogLeNet (Szegedy et al., 2015) on ImageNet and our method causes no more degradation compared to quantization-based approaches.
175
+
176
+ # 7 CONCLUSION
177
+
178
+ We proposed a novel method for gradient compression. Our method can reduce communication cost significantly with no or only slight accuracy degradation. Contributions of our work can be summarized in the following three points. First, we proposed a novel measurement of ambiguity (high variance, low amplitude) to determine when a gradient update is required. Second, we showed the application of this measurement as a threshold for updates significantly reduces update requirements, while providing comparable accuracy. Third, we demonstrated this method can be combined with other efficient gradient compression approaches to further reduce communication cost.
179
+
180
+ # REFERENCES
181
+
182
+ A. F. Aji and K. Heafield. Sparse communication for distributed gradient descent. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 440–445, 2017.
183
+ D. Alistarh, D. Grubic, J. Li, R. Tomioka, and M. Vojnovic. Communication-efficient stochastic gradient descent, with applications to neural networks. In Advances in Neural Information Processing Systems 31 (NIPS), 2017. to appear.
184
+ J. Ba and D. Kingma. Adam: A method for stochastic optimization. In 3rd International Conference on Learning Representations (ICLR), 2015.
185
+ S. De, A. Yadav, D. Jacobs, and T. Goldstein. Automated inference with adaptive batches. In Proceedings of the 20th International Conference on Artificial Intelligence and Statistics (AISTATS), pp. 1504–1513, 2017.
186
+ N. Dryden, S. A. Jacobs, T. Moon, and B. Van Essen. Communication quantization for data-parallel training of deep neural networks. In Proceedings of the Workshop on Machine Learning in High Performance Computing Environments (MLHPC ’16), pp. 1–8, 2016.
187
+ P. Goyal, P. Dollar, R. B. Girshick, P. Noordhuis, L. Wesolowski, A. Kyrola, A. Tulloch, Y. Jia, and ´ K. He. Accurate, large minibatch SGD: training imagenet in 1 hour. arXiv:1706.02677, 2017.
188
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, 2016.
189
+ A. Krizhevsky. Learning multiple layers of features from tiny images. 2009.
190
+ O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, A. C. Berg, and L. Fei-Fei. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
191
+ F. Seide, H. Fu, J. Droppo, G. Li, and D. Yu. 1-bit stochastic gradient descent and application to data-parallel distributed training of speech DNNs. In INTERSPEECH, pp. 1058–1062, 2014.
192
+ K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In 3rd International Conference on Learning Representations (ICLR), 2015.
193
+ N. Strom. Scalable distributed DNN training using commodity GPU cloud computing. In INTERSPEECH, pp. 1488–1492, 2015.
194
+ I. Sutskever, J. Martens, G. Dahl, and G. Hinton. On the importance of initialization and momentum in deep learning. In Proceedings of the 30th International Conference on International Conference on Machine Learning (ICML), pp. 1139–1147, 2013.
195
+ C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1–9, 2015.
196
+ R. Thakur, R. Rabenseifner, and W. Gropp. Optimization of collective communication operations in MPICH. The International Journal of High Performance Computing Applications, 19(1):49–66, 2005.
197
+ S. Tokui, K. Oono, S. Hido, and J. Clayton. Chainer: a next-generation open source framework for deep learning. In Proceedings of Workshop on Machine Learning Systems (LearningSys) in The Twenty-ninth Annual Conference on Neural Information Processing Systems (NIPS), 2015.
198
+ J. L. Traff, A. Ripke, C. Siebert, P. Balaji, R. Thakur, and W. Gropp. A simple, pipelined algorithm ¨ for large, irregular all-gather problems. In Recent Advances in Parallel Virtual Machine and Message Passing Interface: 15th European PVM/MPI Users’ Group Meeting, pp. 84–93, 2008.
199
+ W. Wen, C. Xu, F. Yan, C. Wu, Y. Wang, Y. Chen, and H. Li. TernGrad: Ternary gradients to reduce communication in distributed deep learning. In Advances in Neural Information Processing Systems 31 (NIPS), 2017. to appear.
200
+
201
+ # A A SIMPLIFIED VIEW OF THE VARIANCE-BASED CRITERION
202
+
203
+ We derive that the criterion (3) corresponds to the criterion (1).
204
+
205
+ $$
206
+ \begin{array} { r l } & { \quad ( \underset { s \in \boldsymbol { \kappa } _ { 1 } } { \sum } \frac { 1 } { B } \big | \nabla \gamma _ { s } f _ { s } ( z ) \big | ) ^ { \frac { 1 } { \gamma } } > \alpha \sum _ { \kappa \in \boldsymbol { \kappa } } ( \frac { 1 } { | B | } \nabla \gamma _ { s } f _ { s } ( z ) ) ^ { \theta ^ { \prime } } } \\ { \Leftrightarrow } & { \frac { | B | - \alpha } { | B | } ( \underset { s \in \boldsymbol { \kappa } _ { 1 } } { \sum } \frac { 1 } { B } \nabla \gamma _ { s } f _ { s } ( z ) ) ^ { 2 } > \alpha \frac { 1 } { | B | } ( \frac { 1 } { | B | } \underset { s \in \boldsymbol { \kappa } } { \sum } ( \nabla _ { s } f _ { s } ( z ) ) - \underset { s \neq n } { \sum } ( \frac { 1 } { | B | } \nabla _ { s } f _ { s } ( z ) ) ^ { 2 } ) } \\ { \Leftrightarrow } & { \frac { | B | - \alpha } { | B | } ( \underset { s \in \boldsymbol { \kappa } _ { 1 } } { \sum } | \nabla \gamma _ { s } f _ { s } ( z ) | ) ^ { 2 } > \alpha _ { | B | } \underset { s \in \boldsymbol { \kappa } } { \sum } | \nabla \gamma _ { s } f _ { s } ( z ) - \frac { 1 } { | B | } \sum _ { s \in \boldsymbol { \kappa } } ( \nabla \gamma _ { s } f _ { s } ( z ) ) ^ { 2 } | } \\ { \Leftrightarrow } & { \frac { | B | - \alpha } { | B | } ( \underset { s \in \boldsymbol { \kappa } _ { 1 } } { \sum } \frac { 1 } { B } \nabla \gamma _ { s } f _ { s } ( z ) ) ^ { 2 } > \alpha \frac { | B | - \frac { 1 } { | B | } } { | B | ^ { 2 } \cdot | B | } \sum _ { s = \boldsymbol { \kappa } } ( \nabla \gamma _ { s } f _ { s } ( z ) - \frac { 1 } { | B | } \sum _ { s = \boldsymbol { \kappa } } \gamma _ { s } ( z ) ) ^ { 2 } } \\ { \Leftrightarrow } & \frac { | B | - \alpha } { | B | } ( \underset { s \in \boldsymbol { \kappa } _ { 1 } } { \sum } \frac { 1 } { B } \gamma _ { s } f _ s \end{array}
207
+ $$
208
+
209
+ $V _ { B } [ \nabla _ { i } f _ { z } ( x ) ] / | B |$ is an estimated variance of the means of gradients in mini-batches with size $| B |$ . For $\alpha = 1$ , the above criterion reduces to
210
+
211
+ $$
212
+ \nabla f _ { B } ( x ) ^ { 2 } > \frac { 1 } { | B | } V _ { B } [ \nabla f _ { z } ( x ) ] ,
213
+ $$
214
+
215
+ which is an estimated version of the sufficient condition (2). The term $( | B | - 1 ) / ( | B | - \alpha )$ is approximately 1 in most settings.
216
+
217
+ # B RUNNING EXAMPLE OF QUANTIZATION
218
+
219
+ Let $( 0 . 0 4 , 0 . 3 1 , - 6 . 2 5 , 2 2 . 2 5 , - 3 5 . 7 5 )$ be a part of gradient elements corresponding to a matrix. Sign bits are separately processed and we consider their absolute values here: $( 0 . 0 4 , 0 . 3 1 , 6 . 2 5 , 2 2 . 2 5 , 3 5 . 7 5 )$ . Now, $M _ { k }$ is the max of the elements: 35.75. $2 ^ { \lfloor \log _ { 2 } M _ { k } \rfloor }$ is 32. After rounding, $g _ { i ^ { \prime } }$ of each element become $0 . 0 3 1 2 5 , 0 . 2 5 , 8 , 1 6 , 3 2$ and $d _ { i }$ for each element become $1 0 , 7 , 2 , 1 , 0$ . Note that higher $d _ { i }$ corresponds to smaller $g _ { i } ^ { \prime }$ . We can use only 3 bits and thus we cannot represent 10 and it will not be sent, which means it will not be sent. Finally, we send them with $\lfloor \log _ { 2 } M _ { k } \rfloor$ , sign bits and index: $\left\{ \left\lfloor \log _ { 2 } M _ { k } \right\rfloor : 5 \right.$ , ( $( + 7$ , index : 1), (−2, index $: 2$ ), ( $+ 1$ , index : 2), $( - 0 , \mathrm { i n d e x : 3 } ) ) \}$ .
220
+
221
+ # C VISUAL REPRESENTATION OF EXPERIMENTAL RESULTS
222
+
223
+ ![](images/c3cf6aed99673b376af707069222d09b139ce69201cd66b018754064d305fff5.jpg)
224
+ Figure 3 are scatter plots of Table 1 and 2. The upper right corner is desirable. The figures suggests superiority of our variance-based compression and hybrid algorithm.
225
+ Figure 3: Scatter plots of relation between accuracy and compression ratio. The four plots correspond to the configurations on datasets and optimization methods as follows: (a) CIFAR-10 and Adam, (b) CIFAR-10 and MomentumSGD, (c) ImageNet and Adam, (d) ImageNet and MomentumSGD. No compression denotes the case where we do not use any compression methods. Variance is a method described in Sec. 4.1 and 4.2. Hybrid is a combination of variance based compression and Strom’s algorithm. Some outliers are not plotted. Upper right of these figures is desirable for all compression algorithms.
226
+
227
+ # D ARCHITECTURE OF VGG-LIKE NETWORK USED ON CIFAR-10
228
+
229
+ Table 3 shows the network architecture used for experiments on CIFAR-10. All convolutional layers are followed by batch normalization and ReLU activation. The code is available in examples of Chainer (Tokui et al., 2015) on GitHub.
230
+
231
+ Table 3: The network architecture for the CIFAR-10 classification task
232
+
233
+ <table><tr><td>input (3x32x32)</td></tr><tr><td>conv3-64 dropout(0.3) conv3-64</td></tr><tr><td>maxpool</td></tr><tr><td>conv3-128 dropout(0.4) conv3-128</td></tr><tr><td>maxpool</td></tr><tr><td>conv3-256 dropout(0.4) conv3-256 dropout(0.4)</td></tr><tr><td>conv3-256 maxpool</td></tr><tr><td>conv3-512 dropout(0.4) conv3-512 dropout(0.4)</td></tr><tr><td>conv3-512 maxpool</td></tr><tr><td>conv3-512 dropout(0.4) conv3-512 dropout(0.4)</td></tr><tr><td>conv3-512 maxpool</td></tr><tr><td>dropout(0.5) fully connected 512 bn relu</td></tr><tr><td>dropout(0.5) fully connected 10</td></tr><tr><td>softmax</td></tr></table>
md/train/ry2YOrcge/ry2YOrcge.md ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING A NATURAL LANGUAGE INTERFACE WITH NEURAL PROGRAMMER
2
+
3
+ Arvind Neelakantan∗ University of Massachusetts Amherst arvind@cs.umass.edu
4
+
5
+ Quoc V. Le Google Brain qvl@google.com
6
+
7
+ Mart´ın Abadi
8
+ Google Brain
9
+ abadi@google.com
10
+
11
+ # Andrew McCallum∗
12
+
13
+ University of Massachusetts Amherst mccallum@cs.umass.edu
14
+
15
+ Dario Amodei∗
16
+ OpenAI
17
+ damodei@openai.com
18
+
19
+ # ABSTRACT
20
+
21
+ Learning a natural language interface for database tables is a challenging task that involves deep language understanding and multi-step reasoning. The task is often approached by mapping natural language queries to logical forms or programs that provide the desired response when executed on the database. To our knowledge, this paper presents the first weakly supervised, end-to-end neural network model to induce such programs on a real-world dataset. We enhance the objective function of Neural Programmer, a neural network with built-in discrete operations, and apply it on WikiTableQuestions, a natural language question-answering dataset. The model is trained end-to-end with weak supervision of question-answer pairs, and does not require domain-specific grammars, rules, or annotations that are key elements in previous approaches to program induction. The main experimental result in this paper is that a single Neural Programmer model achieves $3 4 . 2 \%$ accuracy using only 10,000 examples with weak supervision. An ensemble of 15 models, with a trivial combination technique, achieves $3 7 . 7 \%$ accuracy, which is competitive to the current state-of-the-art accuracy of $3 7 . 1 \%$ obtained by a traditional natural language semantic parser.
22
+
23
+ # 1 BACKGROUND AND INTRODUCTION
24
+
25
+ Databases are a pervasive way to store and access knowledge. However, it is not straightforward for users to interact with databases since it often requires programming skills and knowledge about database schemas. Overcoming this difficulty by allowing users to communicate with databases via natural language is an active research area. The common approach to this task is by semantic parsing, which is the process of mapping natural language to symbolic representations of meaning. In this context, semantic parsing yields logical forms or programs that provide the desired response when executed on the databases (Zelle & Mooney, 1996). Semantic parsing is a challenging problem that involves deep language understanding and reasoning with discrete operations such as counting and row selection (Liang, 2016).
26
+
27
+ The first learning methods for semantic parsing require expensive annotation of question-program pairs (Zelle & Mooney, 1996; Zettlemoyer & Collins, 2005). This annotation process is no longer necessary in the current state-of-the-art semantic parsers that are trained using only question-answer pairs (Liang et al., 2011; Kwiatkowski et al., 2013; Krishnamurthy & Kollar, 2013; Pasupat & Liang, 2015). However, the performance of these methods still heavily depends on domain-specific grammar or pruning strategies to ease program search. For example, in a recent work on building semantic parsers for various domains, the authors hand-engineer a separate grammar for each domain (Wang et al., 2015).
28
+
29
+ Recently, many neural network models have been developed for program induction (Andreas et al., 2016; Jia & Liang, 2016; Reed & Freitas, 2016; Zaremba et al., 2016; Yin et al., 2015), despite the notorious difficulty of handling discrete operations in neural networks (Joulin & Mikolov, 2015; Kaiser & Sutskever, 2016). Most of these approaches rely on complete programs as supervision (Jia & Liang, 2016; Reed & Freitas, 2016) while others (Zaremba et al., 2016; Yin et al., 2015) have been tried only on synthetic tasks. The work that is most similar to ours is that of Andreas et al. (2016) on the dynamic neural module network. However, in their method, the neural network is employed only to search over a small set of candidate layouts provided by the syntactic parse of the question, and is trained using the REINFORCE algorithm (Williams, 1992). Hence, their method cannot recover from parser errors, and it is not trivial to adapt the parser to the task at hand. Additionally, all their modules or operations are parametrized by a neural network, so it is difficult to apply their method on tasks that require discrete arithmetic operations. Finally, their experiments concern a simpler dataset that requires fewer operations, and therefore a smaller search space, than WikiTableQuestions which we consider in our work. We discuss other related work in Section 4.
30
+
31
+ ![](images/c3fbf422d12a94e9e469c4d9edd7cabf43b9708d865779a1944e2cfd424cee5d.jpg)
32
+ Figure 1: Neural Programmer is a neural network augmented with a set of discrete operations. The model runs for a fixed number of time steps, selecting an operation and a column from the table at every time step. The induced program transfers information across timesteps using the row selector variable while the output of the model is stored in the scalar answer and lookup answer variables.
33
+
34
+ Neural Programmer (Neelakantan et al., 2016) is a neural network augmented with a set of discrete operations. It produces both a program, made up of those operations, and the result of running the program against a given table. The operations make use of three variables: row selector, scalar answer, and lookup answer, which are updated at every timestep. lookup answer and scalar answer store answers while row selector is used to propagate information across time steps. As input, a model receives a question along with a table (Figure 1). The model runs for a fixed number of time steps, selecting an operation and a column from the table as the argument to the operation at each time step. During training, soft selection (Bahdanau et al., 2014) is performed so that the model can be trained end-to-end using backpropagation. This approach allows Neural Programmer to explore the search space with better sample complexity than hard selection with the REINFORCE algorithm (Williams, 1992) would provide. All the parameters of the model are learned from a weak supervision signal that consists of only the final answer; the underlying program, which consists of a sequence of operations and of selected columns, is latent.
35
+
36
+ In this work, we develop an approach to semantic parsing based on Neural Programmer. We show how to learn a natural language interface for answering questions using database tables, thus integrating differentiable operations that are typical of neural networks with the declarative knowledge contained in the tables and with discrete operations on tables and entries. For this purpose, we make several improvements and adjustments to Neural Programmer, in particular adapting its objective function to make it more broadly applicable.
37
+
38
+ In earlier work, Neural Programmer is applied only on a synthetic dataset. In that dataset, when the expected answer is an entry in the given table, its position is explicitly marked in the table. However, real-world datasets certainly do not include those markers, and lead to many ambiguities (e.g., (Pasupat & Liang, 2015)). In particular, when the answer is a number that occurs literally in the table, it is not known, a priori, whether the answer should be generated by an operation or selected from the table. Similarly, when the answer is a natural language phrase that occurs in multiple positions in the table, it is not known which entry (or entries) in the table is actually responsible for the answer. We extend Neural Programmer to handle the weaker supervision signal by backpropagating through decisions that concern how the answer is generated when there is an ambiguity.
39
+
40
+ Our main experimental results concern WikiTableQuestions (Pasupat & Liang, 2015), a real-world question-answering dataset on database tables, with only 10,000 examples for weak supervision. This dataset is particularly challenging because of its small size and the lack of strong supervision, and also because the tables provided at test time are never seen during training, so learning requires adaptation at test time to unseen column names. A state-of-the-art, traditional semantic parser that relies on pruning strategies to ease program search achieves $3 7 . 1 \%$ accuracy. Standard neural network models like sequence-to-sequence and pointer networks do not appear to be promising for this dataset, as confirmed in our experiments below, which yield single-digit accuracies. In comparison, a single Neural Programmer model using minimal text pre-processing, and trained end-to-end, achieves $3 4 . 2 \%$ accuracy. This surprising result is enabled primarily by the sample efficiency of Neural Programmer, by the enhanced objective function, and by reducing overfitting via strong regularization with dropout (Srivastava et al., 2014; Iyyer et al., 2015; Gal & Ghahramani, 2016) and weight decay. An ensemble of 15 models, even with a trivial combination technique, achieves $3 7 . 7 \%$ accuracy.
41
+
42
+ # 2 NEURAL PROGRAMMER
43
+
44
+ In this section we describe in greater detail the Neural Programmer model and the modifications we made to the model. Neural Programmer is a neural network augmented with a set of discrete operations. The model consists of four modules:
45
+
46
+ • Question RNN that processes the question and converts the tokens to a distributed representation. We use an LSTM network (Hochreiter & Schmidhuber, 1997) as the question RNN.
47
+ • A list of discrete operations such as counting and entry selection that are manually defined. Each operation is parameterized by a real-valued vector that is learned during training.
48
+ • A selector module that induces two probability distributions at every time step, one over the set of operations and another over the set of columns. The input to the selector is obtained by concatenating the last hidden state of the question RNN, the hidden state of the history RNN from the current timestep, and the attention vector obtained by performing soft attention (Bahdanau et al., 2014) on the question using the history vector. Following Neelakantan et al. (2016), we employ hard selection at test time. History RNN modeled by a simple RNN (Werbos, 1990) with tanh activations which remembers the previous operations and columns selected by the model. The input to the history RNN at each timestep is the result of concatenating the weighted representations of operations and columns with their corresponding probability distributions produced by the selector at the previous timestep.
49
+
50
+ A more detailed description of the basic model can be found in Neelakantan et al. (2016). The model runs for fixed total of $T$ timesteps. The parameters of the operations, selector module, question and history RNNs are all learned with backpropagation using a weak supervision signal that consists of the final answer. Below, we discuss several modifications to the model to make it more broadly applicable, and easier to train.
51
+
52
+ # 2.1 OPERATIONS
53
+
54
+ We use 15 operations in the model that were chosen to closely match the set of operations used in the baseline model (Pasupat & Liang, 2015). All the operations except select and most frequent entry operate only on the set of selected rows which is given by the row selector variable. Before the first timestep, all the rows in the table are set to be selected. The built-in operations are:
55
+
56
+ • count returns the number of selected rows in row selector.
57
+ • select and most frequent entry are operations which are computed only once for every question and output a boolean tensor with size same as the size of the input table. An entry in the output of the select operation is set to 1 if the entry matches some phrase in the question. The matched phrases in the question are anonymized to prevent overfitting. Similarly, for most frequent entry, it is set to 1 if the entry is the most frequently occurring one in its column.
58
+ • argmax, argmin, greater than, less than, greater than or equal to, less than or equal to are all operations that output a tensor with size same as the size of the input table.
59
+ • first, last, previous and next modify the row selector.
60
+ • print operation assigns row selector on the selected column of lookup answer.
61
+ • reset resets row selector to its initial value. This operation also serves as no-op when the model needs to induce programs whose complexity is less than $T$ .
62
+
63
+ All the operations are defined to work with soft selection so that the model can be trained with backpropagation. The operations along with their definitions are discussed in the Appendix.
64
+
65
+ # 2.2 OUTPUT AND ROW SELECTOR
66
+
67
+ Neural programmer makes use of three variables: row selector, scalar answer and lookup answer which are updated at every timestep. The variable lookup answer stores answers that are selected from the table while scalar answer stores numeric answers that are not provided in the table.1 The induced program transfers information across timesteps using the row selector variable which contains rows that are selected by the model.
68
+
69
+ Given an input table $\Pi$ , containing $M$ rows and $C$ columns ( $M$ and $C$ can vary across examples), the output variables at timestep $t$ are given by:
70
+
71
+ sc $\begin{array} { r l } & { \times a l a r \ a n s w e r _ { t } = \alpha _ { t } ^ { o p } ( c o u n t ) o u t p u t _ { t } ( c o u n t ) , } \\ & { o k u p \ a n s w e r _ { t } [ i ] [ j ] = \alpha _ { t } ^ { c o l } ( j ) \alpha _ { t } ^ { o p } ( p r i n t ) r o w \ s e l e c t _ { t - t } [ i ] , \forall ( i , j ) i = 1 , 2 , . . . , M , j = 1 , 2 , . . . , C } \end{array}$ lo where $\alpha _ { t } ^ { o p } ( o p )$ and $\alpha _ { t } ^ { c o l } ( j )$ are the probabilities assigned by the selector to operation $o p$ and column $j$ at timestep $t$ respectively and $o u t p u t _ { t } ( c o u n t )$ is the output of the count operation at timestep $t$ . The row selector variable at timestep $t$ is obtained by taking the weighted average of the outputs of the remaining operations and is discussed in the Appendix. lookup answerT $[ i ] [ j ]$ is the probability that the element $( i , j )$ in the input table is in the final answer predicted by the model.
72
+
73
+ # 2.3 TRAINING OBJECTIVE
74
+
75
+ We modify the training objective of Neural Programmer to handle the supervision signal available in real-world settings. In previous work, the position of the answers are explicitly marked in the table when the answer is an entry from the table. However, as discussed in Section 1, in real-world datasets (e.g., (Pasupat & Liang, 2015)) the answer is simply written down introducing two kinds of ambiguities. First, when the answer is a number and if the number is in the table, it is not known whether the loss should be computed using the scalar answer variable or the lookup answer variable. Second, when the answer is a natural language phrase and if the phrase occurs in multiple positions in the table, we again do not know which entry (or entries) in the table is actually responsible for generating the answer. We extend Neural Programmer to handle this weaker supervision signal during training by computing the loss only on the prediction that is closest to the desired response.
76
+
77
+ For scalar answers we compute the square loss:
78
+
79
+ $$
80
+ L _ { s c a l a r } ( s c a l a r ~ a n s w e r _ { T } , y ) = \frac { 1 } { 2 } ( s c a l a r ~ a n s w e r _ { T } - y ) ^ { 2 }
81
+ $$
82
+
83
+ where $y$ is the ground truth answer. We divide $L _ { s c a l a r }$ by the number of rows in the input table and do not backpropagate on examples for which the loss is greater than a threshold since it leads to instabilities in training.
84
+
85
+ When the answer is a list of items $y \ = \ ( a _ { 1 } , a _ { 2 } , . . . , a _ { N } )$ , for each element in the list $( a _ { i } , i { \ = }$ $1 , 2 , \ldots , N )$ we compute all the entries in the table that match that element, given by $S _ { i } ~ =$ $\{ ( r , c ) , \forall ( r , c ) \Pi [ r ] [ { \bar { c } } ] = a _ { i } \}$ . We tackle the ambiguity introduced when an answer item occurs at multiple entries in the table by computing the loss only on the entry which is assigned the highest probability by the model. We construct $g \in \{ 0 , 1 \} ^ { M \times C }$ , where $g [ i , j ]$ indicates whether the element $( i , j )$ in the input table is part of the output. We compute log-loss for each entry and the final loss is given by:
86
+
87
+ $$
88
+ \begin{array} { l } { { \displaystyle { \cal L } _ { l o o k u p } ( l o o k u p ~ a n s w e r _ { T } , y ) = \sum _ { i = 1 } ^ { N } m i n _ { ( r , c ) \in S _ { i } } ( - \log ( l o o k u p ~ a n s w e r _ { T } [ r , c ] ) ) } \ ~ } \\ { { \displaystyle ~ - \ \frac { 1 } { M C } \sum _ { i = 1 } ^ { M } \sum _ { j = 1 } ^ { C } [ g [ i , j ] ~ = = \ 0 ] \log ( 1 - l o o k u p ~ a n s w e r _ { T } [ i , j ] ) } } \end{array}
89
+ $$
90
+
91
+ where $[ c o n d ]$ is 1 when cond is True, and 0 otherwise.
92
+
93
+ We deal with the ambiguity that occurs when the ground truth is a number and if the number also occurs in the table, by computing the final loss as the soft minimum of $L _ { s c a l a r }$ and $L _ { l o o k u p }$ . Otherwise, the loss for an example is $L _ { s c a l a r }$ when the ground truth is a number and $L _ { l o o k u p }$ when the ground truth matches some entries in the table. The two loss functions $L _ { s c a l a r }$ and $L _ { l o o k u p }$ are in different scales, so we multiply $L _ { l o o k u p }$ by a constant factor which we set to 50.0 after a small exploration in our experiments.
94
+
95
+ Since we employ hard selection at test time, only one among scalar answer and lookup answer is modified at the last timestep. We use the variable that is set at the last timestep as the final output of the model.
96
+
97
+ # 3 EXPERIMENTS
98
+
99
+ We apply Neural Programmer on the WikiTableQuestions dataset (Pasupat & Liang, 2015) and compare it to different non-neural baselines including a natural language semantic parser developed by Pasupat & Liang (2015). Further, we also report results from training the sequence-tosequence model (Sutskever et al., 2014) and a modified version of the pointer networks (Vinyals et al., 2015). Our model is implemented in TensorFlow (Abadi et al., 2016) and the model takes approximately a day to train on a single Tesla K80 GPU. We use double-precision format to store the model parameters since the gradients become undefined values in single-precision format. Our code is available at https://github.com/tensorflow/models/tree/master/neural_ programmer.
100
+
101
+ # 3.1 DATA
102
+
103
+ We use the train, development, and test split given by Pasupat & Liang (2015). The dataset contains 11321, 2831, and 4344 examples for training, development, and testing respectively. We use their tokenization, number and date pre-processing. There are examples with answers that are neither number answers nor phrases selected from the table. We ignore these questions during training but the model is penalized during evaluation following Pasupat & Liang (2015). The tables provided in the test set are unseen at training, hence requiring the model to adapt to unseen column names at test time. We train only on examples for which the provided table has less than 100 rows since we run out of GPU memory otherwise, but consider all examples at test time.
104
+
105
+ Table 1: Performance of Neural Programmer compared to baselines from (Pasupat & Liang, 2015). The performance of an ensemble of 15 models is competitive to the current state-of-the-art natural language semantic parser.
106
+
107
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Dev Accuracy</td><td rowspan=1 colspan=1>Test Accuracy</td></tr><tr><td rowspan=1 colspan=3>Baselines from Pasupat &amp; Liang (2015)</td></tr><tr><td rowspan=1 colspan=1>InformationRetrieval System</td><td rowspan=1 colspan=1>13.4</td><td rowspan=1 colspan=1>12.7</td></tr><tr><td rowspan=1 colspan=1>Simple Semantic Parser</td><td rowspan=1 colspan=1>23.6</td><td rowspan=1 colspan=1>24.3</td></tr><tr><td rowspan=1 colspan=1>Semantic Parser</td><td rowspan=1 colspan=1>37.0</td><td rowspan=1 colspan=1>37.1</td></tr><tr><td rowspan=1 colspan=3>Neural Programmer</td></tr><tr><td rowspan=1 colspan=1>Neural Programmer</td><td rowspan=1 colspan=1>34.1</td><td rowspan=1 colspan=1>34.2</td></tr><tr><td rowspan=1 colspan=1>Ensemble of 15 Neural Programmer models</td><td rowspan=1 colspan=1>37.5</td><td rowspan=1 colspan=1>37.7</td></tr><tr><td rowspan=1 colspan=1>Oracle Score with 15 Neural Programmer models</td><td rowspan=1 colspan=1>50.5</td><td rowspan=1 colspan=1>1</td></tr></table>
108
+
109
+ # 3.2 TRAINING DETAILS
110
+
111
+ We use $T = 4$ timesteps in our experiments. Words and operations are represented as 256 dimensional vectors, and the hidden vectors of the question and the history RNN are also 256 dimensional. The parameters are initialized uniformly randomly within the range [-0.1, 0.1]. We train the model using the Adam optimizer (Kingma & Ba, 2014) with mini-batches of size 20. The $\epsilon$ hyperparameter in Adam is set to 1e-6 while others are set to the default values. Since the training set is small compared to other datasets in which neural network models are usually applied, we rely on strong regularization:
112
+
113
+ • We clip the gradients to norm 1 and employ early-stopping.
114
+ • The occurrences of words that appear less than 10 times in the training set are replaced by a single unknown word token.
115
+ • We add a weight decay penalty with strength 0.0001.
116
+ • We use dropout with a keep probability of 0.8 on input and output vectors of the RNN, and selector, operation and column name representations (Srivastava et al., 2014). We use dropout with keep probability of 0.9 on the recurrent connections of the question RNN and history RNN using the technique from Gal & Ghahramani (2016). We use word-dropout (Iyyer et al., 2015) with keep probability of 0.9. Here, words in the question are randomly replaced with the unknown word token while training.
117
+
118
+ We tune the dropout rates, regularization strength, and the $\epsilon$ hyperparameter using grid search on the development data, we fix the other hyperparameters after a small exploration during initial experiments.
119
+
120
+ # 3.3 RESULTS
121
+
122
+ Table 1 shows the performance of our model in comparison to baselines from Pasupat & Liang (2015). The best result from Neural Programmer is achieved by an ensemble of 15 models. The only difference among these models is that the parameters of each model is initialized with a different random seed. We combine the models by averaging the predicted softmax distributions of the models at every timestep. While it is generally believed that neural network models require a large number of training examples compared to simpler linear models to get good performance, our model
123
+
124
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Dev Accuracy</td></tr><tr><td rowspan=1 colspan=1>NeuralProgrammer</td><td rowspan=1 colspan=1>34.1</td></tr><tr><td rowspan=1 colspan=1>NeuralProgrammer-anonymization</td><td rowspan=1 colspan=1>33.7</td></tr><tr><td rowspan=1 colspan=1>Neural Programmer - match feature</td><td rowspan=1 colspan=1>31.1</td></tr><tr><td rowspan=1 colspan=1>Neural Programmer - {dropout,weight decay}</td><td rowspan=1 colspan=1>30.3</td></tr></table>
125
+
126
+ Table 2: Model ablation studies. We find that dropout and weight decay, along with the boolean feature indicating a matched table entry for column selection, have a significant effect on the performance of the model.
127
+
128
+ achieves competitive performance on this small dataset containing only 10,000 examples with weak supervision.
129
+
130
+ We did not get better results either by using pre-trained word vectors (Mikolov et al., 2013) or by pre-training the question RNN with a language modeling objective (Dai & Le, 2015). A possible explanation is that the word vectors obtained from unsupervised learning may not be suitable to the task under consideration. For example, the learned representations of words like maximum and minimum from unsupervised learning are usually close to each other but for our task it is counterproductive. We consider replacing soft selection with hard selection and training the model with the REINFORCE algorithm (Williams, 1992). The model fails to learn in this experiment, probably because the model has to search over millions of symbolic programs for every input question making it highly unlikely to find a program that gives a reward. Hence, the parameters of the model are not updated frequently enough.
131
+
132
+ # 3.3.1 NEURAL NETWORK BASELINES
133
+
134
+ To understand the difficulty of the task for neural network models, we experiment with two neural network baselines: the sequence-to-sequence model (Sutskever et al., 2014) and a modified version of the pointer networks (Vinyals et al., 2015). The input to the sequence-to-sequence model is a concatenation of the table and the question, and the decoder produces the output one token at a time. We consider only examples whose input length is less than 400 to make the running time reasonable. The resulting dataset has 8, 857 and 1, 623 training and development examples respectively. The accuracy of the best model on this development set after hyperparameter tuning is only $8 . 9 \%$ . Next, we experiment with pointer networks to select entries in the table as the final answer. We modify pointer networks to have two-attention heads: one to select the column and the other to select entries within a column. Additionally, the model performs multiple pondering steps on the table before returning the final answer. We train this model only on lookup questions, since the model does not have a decoder to generate answers. We consider only examples whose tables have less than 100 rows resulting in training and development set consisting of 7, 534 and 1, 829 examples respectively. The accuracy of the best model on this development set after hyperparameter tuning is only $4 . 0 \dot { \% }$ . These results confirm our intuition that discrete operations are hard to learn for neural networks particularly with small datasets in real-world settings.
135
+
136
+ # 3.4 ANALYSIS
137
+
138
+ # 3.4.1 MODEL ABLATION
139
+
140
+ Table 2 shows the impact of different model design choices on the final performance. While anonymizing phrases in the question that match some table entry seems to have a small positive effect, regularization has a much larger effect on the performance. Column selection is performed in Neelakantan et al. (2016) using only the name of a column; however, this selection procedure is insufficient in real-world settings. For example the column selected in question 3 in Table 3 does not have a corresponding phrase in the question. Hence, to select a column we additionally use a boolean feature that indicates whether an entry in that column matches some phrase in the question. Table 2 shows that the addition of this boolean feature has a significant effect on performance.
141
+
142
+ <table><tr><td rowspan=1 colspan=1>ID</td><td rowspan=1 colspan=1>Question</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Step 1</td><td rowspan=1 colspan=1>Step 2</td><td rowspan=1 colspan=1>Step 3</td><td rowspan=1 colspan=1>Step 4</td></tr><tr><td rowspan=2 colspan=1>1</td><td rowspan=2 colspan=1>what is the total number ofteams?</td><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>count</td></tr><tr><td rowspan=1 colspan=1>Column</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=2 colspan=1>2</td><td rowspan=2 colspan=1>how many games had morethan 1,5oO in attendance?</td><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>&gt;=</td><td rowspan=1 colspan=1>count</td></tr><tr><td rowspan=1 colspan=1>Column</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>=</td><td rowspan=1 colspan=1>attendance</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>3</td><td rowspan=2 colspan=1>what is the total numberof runner-ups listed on thechart?</td><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>=</td><td rowspan=1 colspan=1>select</td><td rowspan=1 colspan=1>count</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Column</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>outcome</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=2 colspan=1>4</td><td rowspan=2 colspan=1>which year held the mostcompetitions?</td><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>mfe</td><td rowspan=1 colspan=1>print</td></tr><tr><td rowspan=1 colspan=1>Column</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>year</td><td rowspan=1 colspan=1>year</td></tr><tr><td rowspan=2 colspan=1>5</td><td rowspan=2 colspan=1>what opponent is listed laston the table?</td><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>last</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>last</td><td rowspan=1 colspan=1>print</td></tr><tr><td rowspan=1 colspan=1>Column</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>opponent</td></tr><tr><td rowspan=2 colspan=1>6</td><td rowspan=2 colspan=1>which section is longest??</td><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>argmax</td><td rowspan=1 colspan=1>print</td></tr><tr><td rowspan=1 colspan=1>Column</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>kilometers</td><td rowspan=1 colspan=1>name</td></tr><tr><td rowspan=2 colspan=1>7</td><td rowspan=2 colspan=1>which engine(s) has the leastamount of power?</td><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>argmin</td><td rowspan=1 colspan=1>print</td></tr><tr><td rowspan=1 colspan=1>Column</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>power</td><td rowspan=1 colspan=1>engine</td></tr><tr><td rowspan=2 colspan=1>8</td><td rowspan=2 colspan=1>whatwas claudia roll&#x27;stime?</td><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>select</td><td rowspan=1 colspan=1>print</td></tr><tr><td rowspan=1 colspan=1>Column</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>swimmer</td><td rowspan=1 colspan=1>time</td></tr><tr><td rowspan=2 colspan=1>9</td><td rowspan=2 colspan=1>who had more silver medals,cuba or brazil?</td><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>argmax</td><td rowspan=1 colspan=1>select</td><td rowspan=1 colspan=1>argmax</td><td rowspan=1 colspan=1>print</td></tr><tr><td rowspan=1 colspan=1>Column</td><td rowspan=1 colspan=1>nation</td><td rowspan=1 colspan=1>nation</td><td rowspan=1 colspan=1>silver</td><td rowspan=1 colspan=1>nation</td></tr><tr><td rowspan=2 colspan=1>10</td><td rowspan=2 colspan=1>who was the next appointeddirector after lee p. brown?</td><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>select</td><td rowspan=1 colspan=1>next</td><td rowspan=1 colspan=1>last</td><td rowspan=1 colspan=1>print</td></tr><tr><td rowspan=1 colspan=1>Column</td><td rowspan=1 colspan=1>name</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>name</td></tr><tr><td rowspan=2 colspan=1>11</td><td rowspan=2 colspan=1>what team is listed previousto belgium?</td><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>select</td><td rowspan=1 colspan=1>previous</td><td rowspan=1 colspan=1>first</td><td rowspan=1 colspan=1>print</td></tr><tr><td rowspan=1 colspan=1>Column</td><td rowspan=1 colspan=1>team</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>team</td></tr></table>
143
+
144
+ Table 3: A few examples of programs induced by Neural Programmer that generate the correct answer in the development set. mfe is abbreviation for the operation most frequent entry. The model runs for 4 timesteps selecting an operation and a column at every step. The model employs hard selection during evaluation. The column name is displayed in the table only when the operation picked at that step takes in a column as input while the operation is displayed only when it is other than the reset operation. Programs that choose count as the final operation produce a number as the final answer while programs that select print as the final operation produce entries selected from the table as the final answer.
145
+
146
+ <table><tr><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>Program in Table 3Amount (%)</td><td rowspan=1 colspan=1>Amount (%)</td></tr><tr><td rowspan=1 colspan=3>Scalar Answer</td></tr><tr><td rowspan=1 colspan=1>Only Count</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>6.5</td></tr><tr><td rowspan=1 colspan=1>Comparison+ Count</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2.1</td></tr><tr><td rowspan=1 colspan=1>Select + Count</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>22.1</td></tr><tr><td rowspan=1 colspan=1>Scalar Answer</td><td rowspan=1 colspan=1>1,2,3</td><td rowspan=1 colspan=1>30.7</td></tr><tr><td rowspan=1 colspan=3>Lookup Answer</td></tr><tr><td rowspan=1 colspan=1>Most Frequent Entry + Print</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>1.7</td></tr><tr><td rowspan=1 colspan=1>First/Last+Print</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>9.5</td></tr><tr><td rowspan=1 colspan=1>Superlative+Print</td><td rowspan=1 colspan=1>6.7</td><td rowspan=1 colspan=1>13.5</td></tr><tr><td rowspan=1 colspan=1>Select+Print</td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>17.5</td></tr><tr><td rowspan=1 colspan=1>Select + {first, last, previous, next, superlative} + Print</td><td rowspan=1 colspan=1>9-11</td><td rowspan=1 colspan=1>27.1</td></tr><tr><td rowspan=1 colspan=1>Lookup Answer</td><td rowspan=1 colspan=1>4-11</td><td rowspan=1 colspan=1>69.3</td></tr></table>
147
+
148
+ Table 4: Statistics of the different sequence of operations among the examples answered correctly by the model in the development set. For each sequence of operations in the table, we also point to corresponding example programs in Table 3. Superlative operations include argmax and argmin, while comparison operations include greater than, less than, greater than or equal to and less than or equal to. The model induces a program that results in a scalar answer $3 0 . 7 \%$ of the time while the induced program is a table lookup for the remaining questions. print and select are the two most common operations used $6 9 . 3 \%$ and $6 6 . 7 \%$ of the time respectively.
149
+
150
+ # 3.4.2 INDUCED PROGRAMS
151
+
152
+ Table 3 shows few examples of programs induced by Neural Programmer that yield the correct answer in the development set. The programs given in Table 3 show a few characteristics of the learned model. First, our analysis indicates that the model can adapt to unseen column names at test time. For example in Question 3, the word outcome occurs only 8 times in the training set and is replaced with the unknown word token. Second, the model does not always induce the most efficient (with respect to number of operations other than the reset operation that are picked) program to solve a task. The last 3 questions in the table can be solved using simpler programs. Finally, the model does not always induce the correct program to get the ground truth answer. For example, the last 2 programs will not result in the correct response for all input database tables. The programs would produce the correct response only when the select operation matches one entry in the table.
153
+
154
+ # 3.4.3 CONTRIBUTION OF DIFFERENT OPERATIONS
155
+
156
+ Table 4 shows the contribution of the different operations. The model induces a program that results in a scalar answer $3 0 . 7 \%$ of the time while the induced program is a table lookup for the remaining questions. The two most commonly used operations by the model are print and select.
157
+
158
+ # 3.4.4 ERROR ANALYSIS
159
+
160
+ To conclude this section, we suggest ideas to potentially improve the performance of the model. First, the oracle performance with 15 Neural Programmer models is $5 0 . 5 \%$ on the development set while averaging achieves only $3 7 . 5 \%$ implying that there is still room for improvement. Next, the accuracy of a single model on the training set is $5 3 \%$ which is about $20 \%$ higher than the accuracy in both the development set and the test set. This difference in performance indicates that the model suffers from significant overfitting even after employing strong regularization. It also suggests that the performance of the model could be greatly improved by obtaining more training data. Nevertheless, there are limits to the performance improvements we may reasonably expect: in particular, as shown in previous work (Pasupat & Liang, 2015), $21 \%$ of questions on a random set of 200 examples in the considered dataset are not answerable because of various issues such as annotation errors and tables requiring advanced normalization.
161
+
162
+ # 4 OTHER RELATED WORK
163
+
164
+ While we discuss in detail various semantic parsing and neural program induction techniques in Section 1, here we briefly describe other relevant work. Recently, Kocisky et al. (2016) develop a semi-supervised semantic parsing method that uses question-program pairs as supervision. Concurrently to our work, Liang et al. (2016) propose neural symbolic machine, a model very similar to Neural Programmer but trained using the REINFORCE algorithm (Williams, 1992). They use only 2 discrete operations and run for a total of 3 timesteps, hence inducing programs that are much simpler than ours. Neural networks have also been applied on question-answering datasets that do not require much arithmetic reasoning (Bordes et al., 2014; Iyyer et al., 2014; Sukhbaatar et al., 2015; Peng et al., 2015; Hermann et al., 2015; Kumar et al., 2016). Wang & Jiang (2016) use a neural network model to get state-of-the-art results on a reading comprehension task (Rajpurkar et al., 2016).
165
+
166
+ # 5 CONCLUSION
167
+
168
+ In this paper, we enhance Neural Programmer to work with weaker supervision signals to make it more broadly applicable. Soft selection during training enables the model to actively explore the space of programs by backpropagation with superior sample complexity. In our experiments, we show that the model achieves performance comparable to a state-of-the-art traditional semantic parser even though the training set contains only 10,000 examples. To our knowledge, this is the first instance of a weakly supervised, end-to-end neural network model that induces programs on a real-world dataset.
169
+
170
+ Acknowledgements We are grateful to Panupong Pasupat for answering numerous questions about the dataset, and providing pre-processed version of the dataset and the output of the semantic parser. We thank David Belanger, Samy Bengio, Greg Corrado, Andrew Dai, Jeff Dean, Nando de Freitas, Shixiang Gu, Navdeep Jaitly, Rafal Jozefowicz, Ashish Vaswani, Luke Vilnis, Yuan Yu and Barret Zoph for their suggestions and the Google Brain team for the support. Arvind Neelakantan is supported by a Google PhD fellowship in machine learning.
171
+
172
+ # REFERENCES
173
+
174
+ Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Gregory S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian J. Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz ´ Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Gor- ´ don Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul A. Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda B. Viegas, Oriol Vinyals, ´ Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. Tensorflow: Large-scale machine learning on heterogeneous distributed systems. ArXiv, 2016.
175
+
176
+ Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Learning to compose neural networks for question answering. NAACL, 2016.
177
+
178
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. ICLR, 2014.
179
+
180
+ Antoine Bordes, Sumit Chopra, and Jason Weston. Question answering with subgraph embeddings. EMNLP, 2014.
181
+
182
+ Andrew M Dai and Quoc V Le. Semi-supervised sequence learning. NIPS, 2015.
183
+
184
+ Yarin Gal and Zoubin Ghahramani. A theoretically grounded application of dropout in recurrent neural networks. NIPS, 2016.
185
+
186
+ Karl Moritz Hermann, Tomas Kocisk ´ y, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa ´ Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. NIPS, 2015.
187
+
188
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Computation, 1997.
189
+
190
+ Mohit Iyyer, Jordan L. Boyd-Graber, Leonardo Max Batista Claudino, Richard Socher, and Hal Daume III. A neural network for factoid question answering over paragraphs. ´ EMNLP, 2014.
191
+
192
+ Mohit Iyyer, Varun Manjunatha, Jordan Boyd-Graber, and Hal Daume III. Deep unordered compo- ´ sition rivals syntactic methods for text classification. ACL, 2015.
193
+
194
+ Robin Jia and Percy Liang. Data recombination for neural semantic parsing. ACL, 2016.
195
+
196
+ Armand Joulin and Tomas Mikolov. Inferring algorithmic patterns with stack-augmented recurrent nets. NIPS, 2015.
197
+
198
+ Lukasz Kaiser and Ilya Sutskever. Neural gpus learn algorithms. ICLR, 2016.
199
+
200
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. ICLR, 2014.
201
+
202
+ Tomas Kocisky, Gabor Melis, Edward Grefenstette, Chris Dyer, Wang Ling, Phil Blunsom, and Karl Moritz Hermann. Semantic parsing with semi-supervised sequential autoencoders. ArXiv, 2016.
203
+
204
+ Jayant Krishnamurthy and Thomas Kollar. Jointly learning to parse and perceive: Connecting natural language to the physical world. TACL, 2013.
205
+
206
+ Ankit Kumar, Ozan Irsoy, Jonathan Su, James Bradbury, Robert English, Brian Pierce, Peter Ondruska, Ishaan Gulrajani, and Richard Socher. Ask me anything: Dynamic memory networks for natural language processing. ICML, 2016.
207
+
208
+ Tom Kwiatkowski, Eunsol Choi, Yoav Artzi, and Luke Zettlemoyer. Scaling semantic parsers with on-the-fly ontology matching. EMNLP, 2013.
209
+
210
+ Chen Liang, Jonathan Berant, Quoc Le, Kenneth Forbus, and Ni Lao. Neural symbolic machines: Learning semantic parsers on freebase with weak supervision. NAMPI Workshop, NIPS, 2016.
211
+
212
+ Percy Liang. Learning executable semantic parsers for natural language understanding. ACM, 2016.
213
+
214
+ Percy Liang, Michael I. Jordan, and Dan Klein. Learning dependency-based compositional semantics. ACL, 2011.
215
+
216
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. ArXiv, 2013.
217
+
218
+ Arvind Neelakantan, Quoc V. Le, and Ilya Sutskever. Neural programmer: Neural programmer: Inducing latent programs with gradient descent. ICLR, 2016.
219
+
220
+ Panupong Pasupat and Percy Liang. Compositional semantic parsing on semi-structured tables. ACL, 2015.
221
+
222
+ Baolin Peng, Zhengdong Lu, Hang Li, and Kam-Fai Wong. Towards neural network-based reasoning. ArXiv, 2015.
223
+
224
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: 100, $0 0 0 +$ questions for machine comprehension of text. ArXiv, 2016.
225
+
226
+ Scott Reed and Nando De Freitas. Neural programmer-interpreters. ICLR, 2016.
227
+
228
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. JMLR, 2014.
229
+
230
+ Sainbayar Sukhbaatar, Arthur Szlam, Jason Weston, and Rob Fergus. End-to-end memory networks. NIPS, 2015.
231
+
232
+ Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. NIPS, 2014.
233
+
234
+ Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. NIPS, 2015.
235
+
236
+ Shuohang Wang and Jing Jiang. Machine comprehension using match-lstm and answer pointer. ArXiv, 2016.
237
+
238
+ Yushi Wang, Jonathan Berant, and Percy Liang. Building a semantic parser overnight. ACL, 2015.
239
+
240
+ P. Werbos. Backpropagation through time: what does it do and how to do it. Proceedings of IEEE, 1990.
241
+
242
+ Ronald Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning, 1992.
243
+
244
+ Pengcheng Yin, Zhengdong Lu, Hang Li, and Ben Kao. Neural enquirer: Learning to query tables with natural language. ArXiv, 2015.
245
+
246
+ Wojciech Zaremba, Tomas Mikolov, Armand Joulin, and Rob Fergus. Learning simple algorithms from examples. ICML, 2016.
247
+
248
+ John M. Zelle and Raymond J. Mooney. Learning to parse database queries using inductive logic programming. AAAI/IAAI, 1996.
249
+
250
+ Luke S. Zettlemoyer and Michael Collins. Learning to map sentences to logical form: Structured classification with probabilistic categorial grammars. UAI, 2005.
251
+
252
+ <table><tr><td rowspan=1 colspan=1>Type</td><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=3>Definition</td></tr><tr><td rowspan=1 colspan=1>Aggregate</td><td rowspan=1 colspan=1>count</td><td rowspan=1 colspan=3>Mcountt =∑ row_selectt-1[i]i=1</td></tr><tr><td rowspan=2 colspan=1>Superlative</td><td rowspan=1 colspan=1>argmax</td><td rowspan=1 colspan=3>maxt[i][j]=max(O.0,row_selectt-1[i]-C([[[i][]]&lt;I[k][j]] × row_selectt-1[k])),i=1,...,M,j=1,...,C</td></tr><tr><td rowspan=1 colspan=1>argmin</td><td rowspan=1 colspan=3>mint[i][j]=max(O.0,row_selectt-1[i]-M([[i][j] &gt; I[k][j]] × row_select-1[k])),i=1,...,M,j =1,...,C</td></tr><tr><td rowspan=4 colspan=1>Comparison</td><td rowspan=1 colspan=1>&gt;</td><td rowspan=1 colspan=1>gi][i]=II</td><td rowspan=1 colspan=1>illi</td><td rowspan=1 colspan=1>g[i][j]= I[i][] &gt; pivotg,V(i,j),i= 1,...,M,j = 1,...,C</td></tr><tr><td rowspan=1 colspan=1>&lt;</td><td rowspan=1 colspan=1>[i][=II</td><td rowspan=1 colspan=1>i]i</td><td rowspan=1 colspan=1>li][j]=I[i][]&lt; pivot,V(i,j),i =1,...,M,j=1,...,C</td></tr><tr><td rowspan=1 colspan=1>M</td><td rowspan=1 colspan=1>geii=II</td><td rowspan=1 colspan=1>il</td><td rowspan=1 colspan=1>geli]l]= I[𝑖]j]≥ pivotge,∀(i,j),i = 1,...,M,j = 1,...,C</td></tr><tr><td rowspan=1 colspan=1>≤</td><td rowspan=1 colspan=2>leij=Iij</td><td rowspan=1 colspan=1>le[i][j]=II[i][j]≤ pivote,V(i,j),i=1,...,M,j=1,...,C</td></tr><tr><td rowspan=6 colspan=1>Table Ops</td><td rowspan=1 colspan=1>select</td><td rowspan=1 colspan=3>s[i][j]= 1.O if II[i]lj] appears in question else 0.0,∀(i,j),i=1,...,M,j =1,...,C</td></tr><tr><td rowspan=1 colspan=1>mfe</td><td rowspan=1 colspan=3>mfe[i][j]=1.O if I[i]lj] is the most common entry in column j else 0.0,∀(i,j),i =1,...,M,j=1,.,C</td></tr><tr><td rowspan=1 colspan=1>first</td><td rowspan=1 colspan=3>i=1,...,M</td></tr><tr><td rowspan=1 colspan=1>last</td><td rowspan=1 colspan=3>i=1,...,M</td></tr><tr><td rowspan=1 colspan=1>previous</td><td rowspan=1 colspan=3>Pt[]= row_selectt-1[i+ 1],i=1,...,M-1;pt[M]=0</td></tr><tr><td rowspan=1 colspan=1>next</td><td rowspan=1 colspan=3>nt[i]=row_selectt-1[i-1],i=2,...,M;nt[1]=0</td></tr><tr><td rowspan=1 colspan=1>Print</td><td rowspan=1 colspan=1>print</td><td rowspan=1 colspan=3>lookup answert[il[i]= row_selectt-1[i],∀(i,j)i=1,...,M,j =1,...,C</td></tr><tr><td rowspan=1 colspan=1>Reset</td><td rowspan=1 colspan=1>reset</td><td rowspan=1 colspan=3>rt[]=1,Vi =1,2,...,M</td></tr></table>
253
+
254
+ Table 5: List of all operations provided to the model along with their definitions. mfe is abbreviation for the operation most frequent entry. [cond] is 1 when cond is True, and 0 otherwise. Comparison, select, reset and mfe operations are independent of the timestep while all the other operations are computed at every time step. Superlative operations and most frequent entry are computed within a column. The operations calculate the expected output with the respect to the membership probabilities given by the row selector so that they can work with probabilistic selection.
255
+
256
+ # APPENDIX
257
+
258
+ # OPERATIONS
259
+
260
+ Table 5 shows the list of operations built into the model along with their definitions.
261
+
262
+ ROW SELECTOR
263
+
264
+ As discussed in Section 2.3, the output variables scalar answer and lookup answer are calculated using the output of the count operations and print operation respectively. The row selector is computed using the output of the remaining operations and is given by,
265
+
266
+ $$
267
+ \begin{array} { l } { { r o w ~ s e l e c t o r } [ \hat { l } ] = \displaystyle \sum _ { j = 1 } ^ { C } \{ \alpha _ { t } ^ { c o l } ( j ) \alpha _ { t } ^ { o p } ( > ) g [ \hat { l } ] [ j ] + \alpha _ { t } ^ { c o l } ( j ) \alpha _ { t } ^ { o p } ( < ) l [ \hat { l } ] [ j ] } \\ { ~ + ~ \alpha _ { t } ^ { c o l } ( j ) \alpha _ { t } ^ { o p } ( \ge ) g [ \hat { l } ] [ j ] + \alpha _ { t } ^ { c o l } ( j ) \alpha _ { t } ^ { o p } ( \le ) l [ \hat { l } ] [ j ] , } \\ { { ~ + ~ \alpha _ { t } ^ { c o l } ( j ) \alpha _ { t } ^ { o p } ( a r g m a x ) m a x [ \hat { l } ] j ] + \alpha _ { t } ^ { c o l } ( j ) \alpha _ { t } ^ { o p } ( a r g m i n _ { t } ) m i n [ \hat { l } ] [ j ] , } } \\ { { ~ + ~ \alpha _ { t } ^ { c o l } ( j ) \alpha _ { t } ^ { o p } ( s e l e c t ) s [ i ] [ j ] + \alpha _ { t } ^ { c o l } ( j ) \alpha _ { t } ^ { o p } ( m f e ) m f e [ \hat { l } ] [ j ] ] } } \\ { { ~ + ~ \alpha _ { t } ^ { c o l } ( j ) \alpha _ { t } ^ { o p } ( s e l e c t ) s [ i ] [ j ] + \alpha _ { t } ^ { c o l } ( j ) \alpha _ { t } ^ { o p } ( m f e ) m f e [ \hat { l } ] [ j ] ] } } \\ { { ~ + ~ \alpha _ { t } ^ { o p } ( p r e v i o u s ) p _ { t } [ \hat { l } ] + \alpha _ { t } ^ { o p } ( m e x t ) n _ { t } [ \hat { l } ] + \alpha _ { t } ^ { o p } ( r e s e t ) r _ { t } [ \hat { l } ] } } \\ { { ~ + ~ \alpha _ { t } ^ { e o p } ( f i r s t ) f [ \hat { l } ] + \alpha _ { t } ^ { o p } ( l a s t ) l a _ { t } [ \hat { l } ] } } \\ { { ~ \forall i , i = 1 , 2 , . . . , ~ M } } \end{array}
268
+ $$
269
+
270
+ where $\alpha _ { t } ^ { o p } ( o p )$ and $\alpha _ { t } ^ { c o l } ( j )$ are the probabilities assigned by the selector to operation $o p$ and column $j$ at timestep $t$ respectively.
md/train/vrhNQ7aYSdr/vrhNQ7aYSdr.md ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SubTab: Subsetting Features of Tabular Data for Self-Supervised Representation Learning
2
+
3
+ Talip Uçar, Ehsan Hajiramezanali, Lindsay Edwards
4
+
5
+ Respiratory and Immunology, R&D, AstraZeneca {talip.ucar, ehsan.hajiramezanali, lindsay.edwards}@astrazeneca.com
6
+
7
+ # Abstract
8
+
9
+ Self-supervised learning has been shown to be very effective in learning useful representations, and yet much of the success is achieved in data types such as images, audio, and text. The success is mainly enabled by taking advantage of spatial, temporal, or semantic structure in the data through augmentation. However, such structure may not exist in tabular datasets commonly used in fields such as healthcare, making it difficult to design an effective augmentation method, and hindering a similar progress in tabular data setting. In this paper, we introduce a new framework, Subsetting features of Tabular data (SubTab), that turns the task of learning from tabular data into a multi-view representation learning problem by dividing the input features to multiple subsets. We argue that reconstructing the data from the subset of its features rather than its corrupted version in an autoencoder setting can better capture its underlying latent representation. In this framework, the joint representation can be expressed as the aggregate of latent variables of the subsets at test time, which we refer to as collaborative inference. Our experiments show that the SubTab achieves the state of the art (SOTA) performance of $9 8 . 3 1 \%$ on MNIST in tabular setting, on par with CNN-based SOTA models, and surpasses existing baselines on three other real-world datasets by a significant margin.
10
+
11
+ # 1 Introduction
12
+
13
+ In recent years, the self-supervised learning has successfully been used to learn meaningful representations of the data in natural language processing [34, 41, 11, 28, 10, 21, 9]. A similar success has been achieved in image and audio domains [7, 15, 37, 5, 17, 13, 8]. This progress is mainly enabled by taking advantage of spatial, semantic, or temporal structure in the data through data augmentation [7] , pretext task generation [11] and using inductive biases through architectural choices (e.g. CNN for images). However, these methods can be less effective in the lack of such structures and biases in the tabular data commonly used in many fields such as healthcare, advertisement, finance, and law. And some augmentation methods such as cropping, rotation, color transformation etc. are domain specific, and not suitable for tabular setting. The difficulty in designing similarly effective methods tailored for tabular data is one of the reasons why self-supervised learning is under-studied in this domain $\lVert \overline { { 4 6 } } \rVert$ .
14
+
15
+ The most common approach in tabular data is to corrupt data through adding noise $\boxed { 4 3 }$ . An autoencoder maps corrupted examples of data to a latent space, from which it maps back to uncorrupted data. Through this process, it learns a representation robust to the noise in the input. This approach may not be as effective since it treats all features equally as if features are equally informative. However, perturbing uninformative features may not result in the intended goal of the corruption. A recent work takes advantage of self-supervised learning in tabular data setting by introducing a pretext task [46], in which a de-noising autoencoder with a classifier attached to representation layer is trained on corrupted data. The classifier’s task is to predict the location of corrupted features. However, this framework still relies on noisy data in the input. Additionally, training a classifier on an imbalanced binary mask for a high-dimensional data may not be ideal to learn meaningful representations.
16
+
17
+ ![](images/627972ccde368e4abb61346ab5503e52534cfdcce989262378148d136190a787.jpg)
18
+ Figure 1: SubTab framework: i) Dividing the features into subsets (similar to feature bagging, or cropping images), ii) Reconstruction of either subsets of features $( \tilde { x } _ { 1 } , \tilde { x } _ { 2 } , \tilde { x } _ { 3 } )$ , or complete feature space $( \breve { \tilde { X } } _ { 1 } , \tilde { X } _ { 2 } , \tilde { X } _ { 3 } )$ , which are used to compute reconstruction loss. iii) Generating projections used to compute contrastive and distance loss. $E \equiv E n c o d e r .$ $D \equiv D e c o d e r$ , $G \equiv P r$ ojection.
19
+
20
+ In this work, we turn the problem of learning representation from a single-view of the data into the one learnt from its multiple views by dividing the features into subsets, akin to cropping in image domain or feature bagging in ensemble learning, to generate different views of the data. Each subset can be considered a different view. We show that reconstructing data from the subset of its features forces the encoder to learn better representation than the ones learned through the existing methods such as adding noise. We train our model in a self-supervised setting and evaluate it on downstream tasks such as classification, and clustering. We use five different datasets; MNIST in tabular format, the cancer genome atlas (TCGA) [42], human gut metagen-omic samples of obesity cohorts (Obesity) [36, 26], UCI adult income (Income) [24], and UCI BlogFeedback (Blog) [4].
21
+
22
+ SubTab can: i) construct a better representation by using the aggregate of the representation of the subsets, a process that we refer as collaborative inference ii) discover the regions of informative features by measuring predictive power of each subset, which is useful especially in high-dimensional data iii) do training and inference in the presence of missing features by ignoring corresponding subsets and iv) use smaller models by reducing input dimension, making it less prone to overfitting.
23
+
24
+ # 2 Method
25
+
26
+ The augmentation methods such as adding noise, rotation, cropping etc. are commonly used in image domain. Among them, the cropping is shown to be the most effective technique $\textcircled { 7 }$ . Inspired from this insight, we propose subsetting features of tabular data.
27
+
28
+ Figure 1 presents SubTab framework, in which we have an encoder (E), a decoder (D), and an optional projection (G). For the purpose of this paper, we will refer $^ { h }$ as latent, or representation, $_ { z }$ as projection, $\tilde { \pmb x }$ , and $\tilde { X }$ as the reconstruction of subset, and whole data respectively. Small letters are associated with subsets while capital latters are associated the whole set of features. Moreover, throughout this work, when we say that a representation is "good", we refer to its performance in a classification task using a linear model.
29
+
30
+ In SubTab framework, we divide tabular data to multiple subsets. Neighbouring subsets can have overlapping regions, defined as a percentage of a dimension of the subset. Each of the subsets is fed to the same encoder (i.e. parameter sharing) to get their corresponding latent representation. A shared decoder is used to reconstruct either the subset fed to the encoder, or full tabular data (i.e. reconstructing all features from the subset of features). We chose the latter in our experiments since it is more effective in learning good representations. We should also note that, in the latter case, the autoencoder cannot learn the identity, eliminating the constraint on the dimension of the bottleneck (i.e. representation). We compute one reconstruction loss term per subset.
31
+
32
+ ![](images/07c289a2119a323df61b9f955041fe75764f373e6d0ba73815abb1733a070355.jpg)
33
+ Figure 2: a) Push-Pull forces applied by each loss. PS / NS $:$ Positive/Negative sample; CL/RL/DL: Contrastive, Reconstruction, Distance losses b) Column or feature selection strategies for adding noise to each subset. Top: Selecting a block of neighbouring columns; Middle: Selecting columns randomly; Bottom: Selecting random features per row c) Latent variables from each subset is aggregated at test time. The mean (default), sum, max, or min aggregation can be used.
34
+
35
+ Moreover, we can optionally add contrastive loss to our objective by using all combination of pairs of projections from all subsets. For example, given three subsets as in Figure 1, there are three combinations of two: $\textstyle { { \binom { n } { k } } = { \binom { 3 } { 2 } } = { \frac { 3 ! } { 2 ! ( 1 ) ! } } = \dot { 3 } }$ . For four subsets, it would be 6 pairs of combination, and so on. We can add one more loss term, referred as distance loss, to reduce the distance between the pairs of projections of the subsets by using a loss function such as mean squared error (MSE). All three loss terms apply a pulling force on positive samples while contrastive loss also applies a push force between positive and negative samples as shown in Figure 2a.
36
+
37
+ Once the dataset is divided into subsets in data preparation step, a process that is similar to feature bagging in ensemble learning, their location is fixed. Thus, we don’t change the relative order of features in a subset during training since standard neural network architectures are not permutation invariant. This is to ensure that same features are fed to the same input units of neural network. However, our method can be extended to permutation invariant setting as a next step.
38
+
39
+ # 2.1 Strategies for adding noise
40
+
41
+ Our framework is complementary to other augmentation techniques used in tabular data setting. Thus, we experimented with adding noise to randomly selected entries in each subset by using three types of noise: i) adding Gaussian noise, ${ \mathcal { N } } ( 0 , \sigma ^ { 2 } )$ , ii) overwriting the value of a selected entry with another value randomly sampled from the same column, referred as swap-noise, iii) zeroing-out randomly selected entries, referred as zero-out noise.
42
+
43
+ Moreover, we use three different strategies when selecting the features to add noise to, as shown in Figure 2b: i) a random block of neighboring columns (NC), ii) random columns (RC) iii) random features per each sample (RF). To add noise, we create a binomial mask, $_ { \mathbf { \nabla } } \mathbf { m }$ , and a noise matrix, $\epsilon$ with same shape as the subset, in which the entries of the mask is assigned to 1 with probability $p$ and to 0 otherwise. The corrupted version, $\scriptstyle { \mathbf { \mathcal { x } } } _ { 1 c }$ , of subset $\mathbf { \mathbf { { x } _ { 1 } } }$ is generated as following:
44
+
45
+ $$
46
+ x _ { 1 c } = ( 1 - m ) \odot x _ { 1 } + m \odot \epsilon
47
+ $$
48
+
49
+ # 2.2 Training
50
+
51
+ Our objective function is:
52
+
53
+ $$
54
+ \mathcal { L } _ { t } = \mathcal { L } _ { r } + \mathcal { L } _ { c } + \mathcal { L } _ { d } ,
55
+ $$
56
+
57
+ where $\mathcal { L } _ { t } , \mathcal { L } _ { r }$ , $\mathcal { L } _ { c }$ and $\mathcal { L } _ { d }$ are total, reconstruction, contrastive, and distance losses, respectively.
58
+
59
+ i) Reconstruction loss: Given a subset, denoted by $\scriptstyle { \mathbf { 2 } } \mathbf { 4 }$ , we can reconstruct either the same subset, $\tilde { \mathbfit { x } } _ { k }$ or the entire feature space $\tilde { X } _ { k }$ . Then, we can compute the reconstruction loss for $k ^ { t h }$ subset by
60
+
61
+ computing mean squared error using either $( x _ { k } , \tilde { x } _ { k } )$ , or $( X , \tilde { X } _ { k } )$ pair as shown in Figure 1. We chose the latter since it was more effective. Overall reconstruction loss:
62
+
63
+ $$
64
+ \mathcal { L } _ { r } = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } s _ { k } , \mathrm { w h e r e } s _ { k } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \left( X ^ { ( i ) } - \tilde { X } _ { k } ^ { ( i ) } \right) ^ { 2 }
65
+ $$
66
+
67
+ where $K$ is the total number of subsets, $N$ is the size of the batch, $s _ { k }$ is the reconstruction loss for $k ^ { t h }$ subset, and $\mathcal { L } _ { r }$ is the average of reconstruction loss over all subsets.
68
+
69
+ ii) Contrastive loss: If the dataset is rich in the number of classes such that chances of sampling negative samples are high, we can use a projection network (G) to get projections, $z ^ { \prime } s$ , of representations, $\bar { \boldsymbol { h } } ^ { \prime } \boldsymbol { s }$ . Samples at the same rows of two subsets, ${ z } _ { 1 }$ and ${ z _ { 2 } }$ , can be considered as positive pairs while remaining rows in the subsets can be considered as negative to those samples.This allows us to compute the contrastive loss for each pair of projections using a loss function such as the normalized temperature-scaled cross entropy loss (NT-Xent) $\lVert \rVert$ . For three subsets, $\{ x _ { 1 } , x _ { 2 } , x _ { 3 } \}$ , we can compute such a loss for every pair $\{ z _ { a } , z _ { b } \}$ of total three pairs from the set $\bar { S } = \{ \{ z _ { 1 } , z _ { 2 } \} , \{ z _ { 1 } , z _ { 3 } \} , \{ z _ { 2 } , z _ { 3 } \} \}$ . Overall contrastive loss is:
70
+
71
+ $$
72
+ \mathcal { L } _ { c } = \frac { 1 } { J } \sum _ { \{ z _ { a } , z _ { b } \} \in S } p ( z _ { a } , z _ { b } ) , \mathrm { ~ w h e r e ~ } p ( z _ { a } , z _ { b } ) = \frac { 1 } { 2 N } \sum _ { i = 1 } ^ { N } \Big [ l ( z _ { a } ( ^ { i } ) , z _ { b } ( ^ { i } ) ) + l ( z _ { b } ( ^ { i } ) , z _ { a } ( ^ { i } ) ) \Big ]
73
+ $$
74
+
75
+ $$
76
+ l ( z _ { \mathbf { a } } ^ { ( i ) } , z _ { b } ^ { ( i ) } ) = - \log \frac { \exp ( s i m ( z _ { \mathbf { a } } ^ { ( i ) } , z _ { b } ^ { ( i ) } ) / \tau ) } { \sum _ { k = 1 } ^ { N } \mathbb { 1 } _ { k \neq i } \exp ( s i m ( z _ { \mathbf { a } } ^ { ( i ) } , z _ { b } ^ { ( k ) } ) / \tau ) }
77
+ $$
78
+
79
+ where $J$ is the total number of pairs in set $S$ , $p ( z _ { a } , z _ { b } )$ is total contrastive loss for a pair of projection $\{ z _ { a } , z _ { b } \}$ , $l \big ( z _ { a } ^ { \mathrm { ~ } } ^ { ( i ) } , z _ { b } ^ { \mathrm { ~ } ( i ) } \big )$ is the loss function for a corresponding positive pairs of examples $( z _ { a } { ^ { ( i ) } } , z _ { b } { ^ { ( i ) } } )$ in subsets $\{ z _ { a } , z _ { b } \}$ , and $\mathcal { L } _ { c }$ is the average of contrastive loss over all pairs.
80
+
81
+ iii) Distance loss: We can also add mean-squared error (MSE) loss for pairs of projections of subsets since the corresponding samples in subsets should be close to each other. Hence, we can compute an overall MSE loss as:
82
+
83
+ $$
84
+ { \mathcal { L } } _ { d } = { \frac { 1 } { J } } \sum _ { \{ z _ { a } , z _ { b } \} \in S } p ( z _ { a } , z _ { b } ) , { \mathrm { ~ w h e r e ~ } } p ( z _ { a } , z _ { b } ) = { \frac { 1 } { N } } \sum _ { i = 1 } ^ { N } \left( z _ { a } ^ { ( i ) } - z _ { b } ^ { ( i ) } \right) ^ { 2 }
85
+ $$
86
+
87
+ The pseudocode of algorithm can be found in Algorithm $\bigstar$ in the Appendix. We should note that both $\mathcal { L } _ { c }$ and $\mathcal { L } _ { d }$ in equation $^ { ( 2 ) }$ are optional, and we used them only in some experiments.
88
+
89
+ # 2.3 Test time
90
+
91
+ At test time, we feed the subsets of test set to the encoder, and get the aggregate of the representations of all available subsets as shown in Figure $2 \mathrm { c } .$ Please note that we can use mean, sum, min, max, or any other aggregation method to get joint representation, which is analogous to pooling in Computer Vision, or the aggregation of neighbouring nodes in graph convolutional networks $\pmb { \widetilde { \left. 2 3 \right. } }$ . We used mean aggregation in all our experiments, but did compare different aggregation methods in Appendix F.4. Our experiments show that we can use the representations of only one, or few subsets and still achieve a good performance at test time. For example, we could use only $h _ { 1 }$ , or aggregate of $\boldsymbol { h } _ { 1 }$ and $h _ { 2 }$ rather than aggregating over all subsets $( h _ { 1 } , h _ { 2 } , h _ { 3 } )$ in Figure $\boxed { 2 \mathrm { c } }$ This allows the model to infer from the data even in the presence of missing features, in which case we can ignore the subset with missing features. We can also design an aggregation function that computes weighted mean of the representations of subsets since some subsets might be more informative than others:
92
+
93
+ $$
94
+ h = \frac { 1 } { Z } \sum _ { k = 1 } ^ { K } \eta _ { k } * h _ { k } , \mathrm { a n d } Z = \sum _ { k = 1 } ^ { K } \eta _ { k } ,
95
+ $$
96
+
97
+ where $K$ is number of subsets, and $\eta _ { k }$ is the weight for $k _ { t h }$ subset. $\eta$ can be a learnable parameter in semi-supervised, or supervised setting by using an attention mechanism. We can also use 1D convolution in equation $\textcircled { 7 }$ by treating representations of subsets as separate channels during training. We left these ideas as future work and used the mean aggregation (i.e. $\eta _ { k } = 1 \mathrm { ~ }$ ) throughout our experiments, unless explicitly stated. A comparison of different aggregation methods can be found in Table $\underline { { \sqrt { \bf A } ^ { 3 } } } \mathrm { | i n }$ the Appendix.
98
+
99
+ # 3 Experiments
100
+
101
+ We conducted various experiments on diverse set of tabular datasets including MNIST $\pm \pm$ in tabular format, the cancer genome atlas (TCGA) $\pmb { \| 4 2 } \pmb { \| }$ , human gut metagen-omic samples of obesity cohorts (Obesity) [36, 26], UCI adult income (Income) $\pm \overbrace { | 2 4 | }$ , and UCI BlogFeedback (Blog) [4] to demonstrate the effectiveness of the SubTab framework. We compare our method to autoencoder baseline with and without dropout, other self-supervised methods such as VIME-self $\boxed { \boxed { 4 6 } }$ , Denoising Autoencoder (DAE) $\boxed { \boxplus 3 }$ , and Context Encoder (CAE) $\textcircled { 1 3 9 } \textcircled { 1 }$ as well as fully-supervised models such as logistic regression, random forest, and XGBoost $\textcircled { 6 }$ . For each dataset, once we decided on a particular autoencoder architecture, we used it for all models compared (i.e. VIME-self, DAE, CAE, and our model). We tried both ReLU and leakyReLU as activation functions for all, and both performed equally well. The code for SubTab is provided1. The summary of model architectures and hyperparameters are in Table $\boxed { \mathbf { A } 1 }$ in the Appendix. We should note that we ran more experiments using; i) Synthetic datasets and ii) OpenML-CC18 datasets $\lVert \rVert$ in Appendix G and H respectively.
102
+
103
+ # 3.1 Data
104
+
105
+ MNIST: We flattened $2 8 \mathbf { x } 2 8$ images, and scaled them by dividing all with 255 as it is done in [46]. We split training set into training and validation sets $( 9 0 - 1 0 \%$ split) when searching for hyper-parameters, and then used all of training set to train the final model. The test set is used only for final evaluation.
106
+
107
+ The Cancer Genome Atlas (TCGA): TCGA is a public cancer genomics dataset characterized over 20,000 primary cancer and matched normal samples that holds information over 38 cohorts. The task is to classify the cancer cohorts from the reverse phase protein array (RPPA) dataset. It includes 6671 samples with 122 features, which we divided to $8 0 { - } 1 0 { - } 1 0 \%$ train-validation-test sets. Once hyper-parameters is found, we trained the models on combined training and validation set.
108
+
109
+ Obesity: The dataset consists of publicly available human gut metagen-omic samples of obesity cohorts $\textcircled { 1 3 6 }$ . It is derived from whole-genome shotgun metagenomic studies. The dataset consists of 164 obese patients and 89 non-obese controls and has 425 features $\pmb { \left. 2 6 \right. }$ . We scaled the dataset by using min-max scaling. Since it is a small dataset, we evaluated the model by using 10 randomly drawn training-test $( 9 0 - 1 0 \% )$ splits, for each of which we used 10-fold cross-validation.
110
+
111
+ UCI Adult Income: It is a well-known public dataset extracted from the 1994 Census database $\pm$ It includes the details such as education level and demographics to predict whether the income of a person exceeds $\$ 508$ /yr. The data consists of six continuous and eight categorical features. After one-hot encoding of categorical features, there are total of 101 features. The pre-processing steps can be found in Section B.1 of Appendix.
112
+
113
+ UCI BlogFeedback: The data originates from blog posts, and is originally used for regression task of predicting the number of comments in the upcoming 24 hours. Similar to Yoon et al. $\check { \left| 4 6 \right| }$ , we turned it into a binary classification task of predicting whether there is a comment for a post or not.There are 280 integer and real valued features, and separate training and test datasets are provided. Further information can be found in Section B.2 of Appendix.
114
+
115
+ # 3.2 Evaluation
116
+
117
+ For self-supervised models, once the models are trained, we evaluate them by training a logistic regression model on the latent representations of training set, and testing it on the latent representation of the test set. For SubTab, the joint latent representation is obtained by using the mean aggregation of embeddings of the subsets for both training and test sets. We use the performance on a classification task as a measure of quality of the representation as it is usually done in the self-supervised learning. MNIST has 10, TCGA has 38, and the rest (i.e. Obesity, Income, and Blog) has 2 classes each.
118
+
119
+ # 3.3 Results
120
+
121
+ MNIST: We used a simple three-layer encoder architecture with dimensions of [512, 256, 128], referred as the base model, in which the last layer is a linear layer. During training of the base model, we used both reconstruction and contrastive losses. Additionally, we trained our model under three conditions: i) without any noise in the input data, ii) with noise in the input data and iii) same as (ii), but we also added distance loss computed for pairs of projections $\{ z _ { i } , z _ { j } , \ldots \}$ .
122
+
123
+ ![](images/f22844ca8a29df355d839bd394288cedfe8ccc7994506998c0476fd0d48d621c.jpg)
124
+ Figure 3: a) Test accuracy on MNIST dataset over different number of subsets and varying levels of overlaps. b-c) t-SNE plots for training (b) and test (c) sets of MNIST for the case of using 4 subsets with $7 5 \%$ overlap between neighboring subsets.
125
+
126
+ ![](images/916e7798e05f50a945f8f30f63ca1aaa7a644ab72658c1a8f73ebc551c186b1d.jpg)
127
+ Figure 4: a) After training the base model (latent dimension ${ \boldsymbol { \mathbf { \rho } } } = 1 2 8$ ) on four subsets with $7 5 \%$ overlap, we test its performance using different number of subsets. The performance improves as we start increasing number of subsets involved in prediction. b) Comparing our model to CNN-based SOTA models trained on $2 8 \mathbf { x } 2 8$ MNIST in image format (please see Section 3.4 for details).
128
+
129
+ For SubTab, we trained our base model multiple times without noise at the input. For each training, we used different number of subsets with different levels of overlap between neighbouring subsets (Figure $\textcircled { 3 } \textcircled { \mu }$ . For small number of subsets (e.g. 2 or 3), the performance monotonically decreases when we increase the overlap between subsets. But, for higher number of subsets, the performance generally improves as we increase the number of shared features between the neighbouring subsets. In general, our results show that $K = 4$ with $7 5 \%$ overlap, and $K = 7$ with $50 \%$ overlap perform the best in MNIST dataset, where $K$ refers to the number of subsets. Figure $^ 3$ also shows t-SNE plots of training and test sets for $\mathrm { K } = 4$ with $7 5 \%$ overlap, which proves the high quality of clustering, while Table $\perp$ summarizes the classification accuracy of all models on the test set. Our base model without noise outperforms autoencoder baselines and other self-supervised models with the same architecture. We experimented with three noise types for all self-supervised models, and observed that adding swap-noise at the input pushes the performance higher. For SubTab, adding distance loss and increasing the dimensions of the last layer from 128 to 512 help improve the performance even further. Moreover, we conducted three additional experiments (details in Section $\dot { \mathbf { C } } . 3$ of Appendix):
130
+
131
+ In the first experiment, for the optimum case of $K = 4$ with $7 5 \%$ overlap, we trained and tested accuracy of a linear model by using the joint representations obtained from the varying number of subsets. Starting with a single subset of the data, we plot the training and test accuracy of the model (Figure $^ { 4 \mathrm { { a } } ) }$ . The linear model is able to achieve $8 7 . 5 \%$ test accuracy using the representation of a single subset. As we start adding latent representations of remaining subsets, both the training and test accuracy keep increasing, eventually achieving top accuracy when all subsets are used. The evolution of clusters corresponding to Figure $\textcircled { 4 } \textcircled { \scriptsize { \tt d } }$ can be seen in Figure $\mathbf { A } 7$ in Appendix. This experiment indicates that we can achieve a good performance using only small subset of features when we don’t have access to data on other features.
132
+
133
+ ![](images/3dc8d84d69b06eb39db88cb75022b9f6e386e5ec4ce588e49abc154b0e5ebca6.jpg)
134
+ Figure 5: a) The test accuracy using the mean aggregation of the latent representations of subsets, starting with the first subset, and keep adding new subsets sequentially. b) The test accuracy of individual subsets. c) Comparing the test accuracy by aggregating the representations of different set of subsets at test time for two versions of the model; untrained and the one trained on all subsets.
135
+
136
+ In the second experiment, we evaluated SubTab under the condition of missing features during training (Figure $5 \mathrm { a } )$ . To do so, we first sliced the unshuffled features of MNIST to seven subsets with no overlap (the case corresponding to the legend "7" at zero overlap in Figure $3 \mathrm { a } )$ . Each subset corresponds to four rows in a $2 8 \mathbf { x } 2 8$ image, starting from top four rows (subset 1) to the bottom ones (subset 7). Then, we trained the base model on five different sets of subsets; $\{ 4 \} , \{ 4 , 5 \} , \{ 3 , 4 , 5 \} , \{ 2 , 3 , 4 , 5 , 6 \}$ , and $\{ 1 , 2 , 3 , 4 , 5 , 6 , 7 \}$ , resulting in five different trained SubTab models. Please note that we selected the sets such that we expand out from the most informative middle regions of the image (i.e. subset 4) to the least informative top and bottom areas.
137
+
138
+ In order to compare the performance of five models, we followed the following steps for each trained model: 1) We first obtained the embeddings of all seven subsets for both training and test sets; 2) We then trained and evaluated a logistic regression model by using the joint embedding of each of the following seven sets: $\{ 1 \} , \{ 1 , \bar { 2 } \} , \{ 1 , \bar { 2 , } 3 \} , . . . , \{ 1 , 2 , 3 , 4 , 5 , 6 , \bar { 7 } \}$ i.e. starting from the first subset, we kept adding new subsets sequentially to increase the information content in the sets. For example, for the set $\{ 1 , 2 , 3 \}$ , we first trained a logistic regression model by using joint embedding of subset 1, 2 and 3 from training set, and evaluated it by using the joint embedding of same subsets from test set. The joint embedding of a set is obtained by using mean aggregation of embeddings of subsets in the set. In addition to five models, we initialized a sixth SubTab model, but kept it untrained and followed the same procedure described before to use it as a baseline. The results are shown in Figure 5a.
139
+
140
+ In this experiment, we observe that even when the model is trained on a single subset (subset 4, or the blue line in Figure $\textcircled { 5 } \textcircled { \scriptsize { \mathtt { h } } }$ , aggregating the representations of all seven subsets including the subsets not used in training does improve the results. This is because the encoder is able to map samples of different classes to different points in latent space even if it is not trained on them. Since we use the mean aggregation over different views (i.e. subsets) of the same class, we can still make each class in the data distinguishable from the rest in the latent space. We also note that when the model is trained on more and more subsets, its performance keeps improving. As a baseline, we also conducted the same test using untrained model (red line in the plot), and observed similar behaviour in which the test accuracy generally improves as we use more subsets when constructing the joint latent representation. Moreover, we measured the test accuracy of individual subsets to see how informative each subset is (Figure $\textcircled { 5 } \textcircled { > }$ . The result is as expected since we kept the features unshuffled in this experiment, and know that the subsets corresponding to the mid-region of the images (i.e. subsets 3, 4, and 5) should be more informative than the ones corresponding to the top and bottom regions (i.e. subsets 1, and 7). We repeated the same experiment using 28 subsets to get a higher resolution and added the result in Figure A8 in Appendix. From this experiment; i) we see that joint representation improves as we include more subsets (i.e. sub-views) at training and/or test time, ii) we can identify the informative subsets of features using SubTab framework.
141
+
142
+ In the third experiment, we evaluated SubTab on handling missing features at test time. Specifically, we used the model trained on all subsets, and compared it to the untrained model (i.e. our baseline). For each model, we obtained the joint embedding for training set by using mean aggregation over embeddings of all seven subsets, and then trained a linear model. The test accuracy of the linear model is measured by using; i) only subset 4, ii) aggregate of the most informative subsets {3,4,5}, iii) aggregate of {2,3,4,5,6} excluding the least informative subsets, and iv) all seven subsets of the test set (Figure 5c).
143
+
144
+ Table 1: Accuracy scores for all models for various datasets. The abbreviations in the table; NC: Neighbour columns used, RF: Random features used, G: Gaussian noise used, S: Swap noise used.
145
+
146
+ <table><tr><td>Type</td><td>Models</td><td>MNIST</td><td>Income</td><td>Blog</td><td>Obesity</td><td>TCGA</td></tr><tr><td rowspan="3">Supervised baseline</td><td>Logistic Regression</td><td>92.60±0.03</td><td>84.68±0.05</td><td>84.15±0.12</td><td>62.35±4.02</td><td>36.98± 1.25</td></tr><tr><td>Random Forest</td><td>96.96±0.06</td><td>84.62±0.07</td><td>83.61±0.15</td><td>67.45±2.23</td><td>61.62± 1.02</td></tr><tr><td>XGBoost</td><td>98.02±0.086</td><td>86.11±0.20</td><td>84.29±0.23</td><td>64.05±4.52</td><td>72.61±1.31</td></tr><tr><td rowspan="2">Autoencoder baseline</td><td>AE</td><td>92.77±0.32</td><td>84.67±0.07</td><td>84.06±0.24</td><td>61.96±3.28</td><td>55.16±0.75</td></tr><tr><td>AE w/Dropout (p=0.2)</td><td>94.31±0.28</td><td>85.00±0.10</td><td>84.18±0.20</td><td>62.74±4.38</td><td>56.87±2.26</td></tr><tr><td rowspan="9">Self- supervised</td><td>DAE (RF)</td><td>96.30±0.14 (S)</td><td>84.37±0.36 (G)</td><td>84.12±0.29 (G)</td><td>56.43±5.79 (G)</td><td>54.31±1.39 (G)</td></tr><tr><td>CAE (NC)</td><td>96.39±0.20 (S)</td><td>84.24±0.18 (G)</td><td>84.3±0.31 (G)</td><td>62.26±5.01 (G)</td><td>54.20±1.17(G)</td></tr><tr><td>VIME-self</td><td>95.23±0.17 (S)</td><td>84.43±0.08 (G)</td><td>84.11±0.27(G)</td><td>66.45±4.54(G)</td><td>55.11±1.37 (G)</td></tr><tr><td>SubTabwith:</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Base model (No noise)</td><td>97.26±0.2</td><td>85.31±0.08</td><td>84.29±0.26</td><td>68.01±3.07</td><td>57.02±1.50</td></tr><tr><td>+Noise</td><td>97.47±0.18 (S)</td><td>85.34±0.07 (G)</td><td>84.47±0.15 (G)</td><td>71.13±4.08 (G)</td><td>58.25±1.36 (G)</td></tr><tr><td>+Distance loss</td><td>97.52±0.14 (S)</td><td>85.35±0.06(G)</td><td>84.64±0.19 (G)</td><td>69.25±4.19 (G)</td><td>58.15±1.56 (G)</td></tr><tr><td>+LatentDim=512</td><td>97.86±0.07 (S)</td><td>=</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>=</td><td></td></tr></table>
147
+
148
+ The results indicate that SubTab can accommodate missing features at test time, and can still perform well. This might also indicate that working with subsets can give us a way to deal with uncertainty better when there are missing features at test time. As the model collects more information in the form of more features, its prediction improves (see Figure $\textcircled { 5 } \mathrm { { c } }$ ). We can also train the model when there are missing subsets during training, and it still performs well (e.g. see legend "4", corresponding to the model trained only on subset 4, in Figure $: 5 \mathrm { a } \big )$ . Our experiments simulate a practical scenario. For example, in healthcare, we might not have access to some features in one hospital while we might have them in another. So, our method would be beneficial in this type of cases.
149
+
150
+ Overall, we can make the following observations from our experiments: i) the less informative subsets can add value to the overall representation, or at least does not harm the performance (see the aggregate over {3,4,5} versus "All" in Figure $\textcircled { 5 } \mathrm { { c } }$ , ii) untrained model can be used to analyze which subsets can be potentially more informative, iii) once a model is trained on a subset, the performance of the individual subset does not change whether it is trained together with other subsets or not (for example, compare the performance of subset 3, 4, and 5 across all models in Figure $^ { 5 | { \scriptsize 5 } ) } _ { \cdot }$ , iv) general idea behind our framework works even for untrained model, and v) we may not need to impute data in our framework since we can simply ignore them as missing subsets, which is good since imputation generally distorts data, and the results.
151
+
152
+ TCGA: We used an encoder architecture with three layers [1024, 784, 784], where the third layer is linear. For VIME-self, DAE, CAE, and our model, we experimented with three noise types (Gaussian, swap, and zero-out noise) at the different $\%$ levels of masking ratio $p$ . We observed that $p = [ 0 . 1 5 , 0 . 3 ]$ range worked well for all models. For Gaussian noise, we used a distribution with zero mean, and different levels of standard deviation $( \sigma )$ . Among all three noise types, Gaussian noise with $\sigma = 0 . 1$ worked the best for all models. Please note that VIME-self uses swap-noise in its original implementation, but swap-noise does not work well on this dataset. For SubTab, similar to MNIST, we used four subsets with $7 5 \%$ overlap. SubTab performs better than other self-supervised models with a significant margin and almost doubles the performance of logistic regression model trained on raw data as shown in Table 1.
153
+
154
+ Obesity: We used a two-layer encoder with [1024, 1024] dimensions. Second layer is a linear layer. Gaussian noise $\mathcal { N } ( 0 , 0 . 3 )$ and masking ratio $p = 0 . 2$ works well across all models. Six subsets $K = 6$ ) with $0 \%$ overlap performed the best for the SubTab. We note that this dataset has 164 obese patients out of 253 total patients. So, the baseline accuracy is $1 6 4 / 2 5 3 = 6 4 . 8 2 \%$ . Based on this fact, we can say that all models, except ours, did not perform well on this dataset. Our model with added Gaussian noise results in accuracy of $7 1 . 1 3 \pm 4 . 0 8 \%$ , which is well above all models, including supervised ones. It means that our model was able to learn useful representation from the data. We should also note that the performance of our model is much better than what Oh and Zhang $\pmb { \mathbb { B } } 6 \mathbb { I }$ reported $( 6 6 \pm 3 . 2 \% )$ even though they trained a DAE on the same data, and reported their results using a random forest, a non-linear model, on the learned representations rather than a linear model.
155
+
156
+ UCI Adult Income & BlogFeedback: For these two datasets, we used the same architecture as in Obesity. For Income dataset, the best performance is obtained using 5 subsets with $25 \%$ overlap whereas we used 7 subsets with $7 5 \%$ overlap for Blog dataset. For the base model, we only used reconstruction loss. Adding Gaussian noise to the input and distance loss to the objective improves the performance for both datasets. SubTab outperforms other self-supervised models in both datasets.
157
+
158
+ The choice of hyper-parameters and other details for all experiments can be found in Table A1 in Section C.1 of Appendix.
159
+
160
+ # 3.4 Ablation study
161
+
162
+ We conducted a comprehensive ablation study using MNIST. Table 2 summarizes our experiments. The first thing to note is that the performance of the our base model is already good with only reconstruction loss. Hence, we can argue that the reconstruction of original feature space from a subset of features is a very effective way of learning representation. By adding noise to the input data, we can improve the performance. In the case of MNIST, swap-noise is very effective. Also, by adding additional losses such as contrastive, and distance losses as well as increasing the dimension of representation layer from 128 to 512, we can further improve the results. Moreover, we shuffled the features of MNIST to make sure that we don’t have any gains from unintentional spatial
163
+
164
+ Table 2: Ablation study using MNIST with 4 subsets with $7 5 \%$ overlap. Abbreviations are; RL: Reconstruction Loss, CL: Contrastive Loss, DL: Distance Loss, SF: Shuffled Features, LD: Latent Dim, Agg: Aggregating embeddings.
165
+
166
+ <table><tr><td rowspan=1 colspan=1>RL</td><td rowspan=1 colspan=1>CL</td><td rowspan=1 colspan=1>Noise</td><td rowspan=1 colspan=1>DL</td><td rowspan=1 colspan=1>SF</td><td rowspan=1 colspan=1>LD</td><td rowspan=1 colspan=1>Agg</td><td rowspan=1 colspan=1>Test Accuracy</td></tr><tr><td rowspan=2 colspan=1>+1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>97.13</td></tr><tr><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>97.11</td></tr><tr><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>97.26</td></tr><tr><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>Zero-out</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>=</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>+</td><td rowspan=3 colspan=1>97.2597.2597.47</td></tr><tr><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>Gaussian</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>+</td></tr><tr><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>Swap</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>=</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>+</td></tr><tr><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>Swap</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>97.52</td></tr><tr><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>Swap</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>97.2</td></tr><tr><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>Swap</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>=</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>1</td><td rowspan=2 colspan=1>95.9297.86</td></tr><tr><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>Swap</td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>+</td></tr></table>
167
+
168
+ correlations between neighboring features. We kept all parameters and random seeds same for the comparison. As shown in the table, our model’s performance does not change much. We also tried concatenating latent variables of subsets rather than aggregating them when testing the performance. Comparing last two rows in the table, the aggregation is shown to work much better. Please note that we compared different aggregation functions in Appendix $\underline { { \overline { { \operatorname { F . 4 } } } } }$ showing that mean aggregation worked the best.
169
+
170
+ Finally, we compared the performance of SubTab on shallow and deep architecture choices. We trained and tested very shallow architectures for SubTab (referred as shallow SubTab), and compared them to relatively deeper SubTab models used in Table $^ 1$ (referred as deep SubTab). We used one-layer encoder and decoder with 784 dimension each for MNIST while using 1024 dimension for other datasets. Shallow SubTab is trained and evaluated under the same conditions as the deeper ones. As shown in Table $\textcircled { 3 }$ shallow SubTab significantly improves results in MNIST and TCGA, placing our model performance on par with CNN-based SOTA models $\pm 0 1 \big [ 1 9 \big ] \big [ 2 5 \big ] \big [ 2 2 \big ] \big [ 3 2 \big ]$ as shown in Figure 4b. Obesity is the only dataset which exploits the deeper architecture.
171
+
172
+ # 4 Related works
173
+
174
+ We refer the reader to the introduction section that lists some of the recent noticeable works in self-supervised learning. Since our work focuses on tabular data, we will review some of the recent work done in tabular data in self-supervised framework. The most recent work is mostly based on solving a pretext task. For example, Yoon et al. $\textcircled { 1 4 6 } |$ uses a de-noising autoencoder with a classifier attached to its representation layer. A random binary mask is generated to mask and overwrite a portion of entries in the tabular data, and the corrupted data is given as input to the encoder. The classifier is used to predict the mask while decoder is used to re-construct the uncorrupted original input similar to de-noising autoencoder $\boxed { 4 3 }$ . Although the proposed method is shown to work well in the experiments, there are couple drawbacks to this approach. Firstly, this approach might not work well in very high-dimensional, small and noisy data sets since the model might easily become over-parameterized and be prone to overfitting to the data. Secondly, training a classifier in this setting can be challenging since it needs to predict very high dimensional, sparse, and imbalanced binary mask, similar to the problems observed when training a model on imbalanced, binary dataset. In a similar way, TabNet [1] and TaBERT [45] also tries to recover original data from corrupted one.
175
+
176
+ Table 3: Comparing shallow and deep SubTab architectures.
177
+
178
+ <table><tr><td>Model</td><td>MNIST</td><td>Income</td><td>Blog</td><td>Obesity</td><td>TCGA</td></tr><tr><td>Deep SubTab</td><td>97.86±0.07</td><td>85.35±0.06</td><td>84.64±0.19</td><td>71.13±4.08</td><td>58.25± 1.36</td></tr><tr><td>Shallow SubTab</td><td>98.31±0.06</td><td>85.34±0.03</td><td>84.64±0.09</td><td>66.88±5.35</td><td>61.41±1.11</td></tr></table>
179
+
180
+ # 5 Conclusion
181
+
182
+ In this work, we show that a simple MLP-based autoencoder trained on MNIST in tabular format can perform on par with the CNN-based SOTA models trained on MNIST images in unsupervised/selfsupervised framework. SubTab achieves SOTA in MNIST dataset in tabular setting. We also tested our approach on other commonly used tabular datasets, and proved its benefits. In SubTab, the main performance gain comes from two parts of the model: i) reconstruction of all features from the subset of features, and ii) learning the joint representation by aggregating the embeddings of the subsets.
183
+
184
+ Using subsets of features may obviate the need for data imputation during training, and allows inference using subsets of features at test time. It might open the door to distributed training of high-dimensional data since the models can be trained on different subsets of features at the same time. We can also potentially take advantage of different datasets with common features by assigning those features to same subsets (i.e. transfer learning). We should note that the subsets shared the same autoencoder in our experiments although we could use separate autoencoders for different subsets if some of the features are drastically different than the rest.
185
+
186
+ SubTab is computationally scalable when we use only reconstruction loss during training. However, using contrastive, and/or distance losses requires the combinations of projections, which makes the computational complexity quadratic during training and limits the number of subsets we can use to divide the data. In this case, computational complexity is still linear at test time since we need to compute only the aggregate of the representations of the subsets. Also, when we divide the features into subsets, we keep the location of features in each subset same throughout training and test time since neural networks are not permutation invariant. As a possible solution, we can extend our work to permutation invariant architectures by treating collection of features as a set. We also showed that SubTab framework can be used to discover most informative subsets of features with limited resolution. A hierarchical version of SubTab might be used for identifying individual important features, but we leave it as a future work.
187
+
188
+ Finally, although the primary focus of this work is tabular data setting, SubTab can be extended to other domains such as images, audio, text and so on. We leave the extensions and applications of SubTab as a future work.
189
+
190
+ # 6 Broader Impact
191
+
192
+ Tabular data is a commonly used format in healthcare, finance, law and many other fields. Despite its broad usage, the most of the research in deep learning, especially with regards to unsupervised representation learning, has been on other data types such as images, text and audio. Our paper tries to close this gap by introducing a new framework to learn good representations from tabular data in unsupervised/self-supervised setting. The progress in this line of research will open doors to widespread applications of tabular data in other areas such as transfer learning, distributed learning, and multi-view learning, in which we can combine knowledge such as demographics and genomics from tabular data with those in images, text and audio. However, we should be aware of the shortcomings of such data integration in terms of biases and privacy issues that it might introduce.
193
+
194
+ # 7 Acknowledgements
195
+
196
+ We thank the anonymous reviewers for their helpful and constructive feedback on the paper. We would also like to thank the entire Respiratory and Immunology AI team and are grateful for general support from other organizations within AstraZeneca.
197
+
198
+ # References
199
+
200
+ [1] Sercan O Arik and Tomas Pfister. Tabnet: Attentive interpretable tabular learning. arXiv preprint arXiv:1908.07442, 2019.
201
+
202
+ [2] Bernd Bischl, Giuseppe Casalicchio, Matthias Feurer, Frank Hutter, Michel Lang, Rafael G Mantovani, Jan N van Rijn, and Joaquin Vanschoren. Openml benchmarking suites. arXiv preprint arXiv:1708.03731, 2017.
203
+
204
+ [3] James P Bridge, Sean B Holden, and Lawrence C Paulson. Machine learning for first-order theorem proving. Journal of automated reasoning, 53(2):141–172, 2014.
205
+
206
+ [4] Krisztian Buza. Feedback prediction for blogs. In Data analysis, machine learning and knowledge discovery, pages 145–152. Springer, 2014.
207
+
208
+ [5] Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. arXiv preprint arXiv:2006.09882, 2020.
209
+
210
+ [6] Tianqi Chen and Carlos Guestrin. XGBoost: A scalable tree boosting system. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’16, pages 785–794, New York, NY, USA, 2016. ACM. ISBN 978-1-4503-4232-2. doi: 10.1145/2939672.2939785. URL http://doi.acm.org/10.1145/2939672.2939785.
211
+
212
+ [7] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pages 1597–1607. PMLR, 2020.
213
+
214
+ [8] Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020.
215
+
216
+ [9] Ronan Collobert and Jason Weston. A unified architecture for natural language processing: Deep neural networks with multitask learning. In Proceedings of the 25th international conference on Machine learning, pages 160–167, 2008.
217
+
218
+ [10] Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettlemoyer, and Veselin Stoyanov. Unsupervised cross-lingual representation learning at scale. arXiv preprint arXiv:1911.02116, 2019.
219
+
220
+ [11] 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.
221
+
222
+ [12] Dheeru Dua and Casey Graff. UCI machine learning repository, 2017. URL http://archive. ics.uci.edu/ml.
223
+
224
+ [13] William Falcon and Kyunghyun Cho. A framework for contrastive self-supervised learning and designing a new approach. arXiv preprint arXiv:2009.00104, 2020.
225
+
226
+ [14] Ananda L Freire, Guilherme A Barreto, Marcus Veloso, and Antonio T Varela. Short-term memory mechanisms in neural network learning of robot navigation tasks: A case study. In 2009 6th Latin American Robotics Symposium (LARS 2009), pages 1–6. IEEE, 2009.
227
+
228
+ [15] Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020.
229
+
230
+ [16] Michael Harries and New South Wales. Splice-2 comparative evaluation: Electricity pricing. 1999.
231
+
232
+ [17] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9729–9738, 2020.
233
+
234
+ [18] Irwin Hersey. Textures: A photographic album for artists and designers by phil brodatz. Leonardo, 1(1):91–92, 1968.
235
+ [19] Weihua Hu, Takeru Miyato, Seiya Tokui, Eiichi Matsumoto, and Masashi Sugiyama. Learning discrete representations via information maximizing self-augmented training. In International Conference on Machine Learning, pages 1558–1567. PMLR, 2017.
236
+ [20] Xu Ji, João F Henriques, and Andrea Vedaldi. Invariant information clustering for unsupervised image classification and segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9865–9874, 2019.
237
+ [21] Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. Bag of tricks for efficient text classification. arXiv preprint arXiv:1607.01759, 2016.
238
+ [22] Lyes Khacef, Laurent Rodriguez, and Benoit Miramond. Improving self-organizing maps with unsupervised feature extraction. In International Conference on Neural Information Processing, pages 474–486. Springer, 2020.
239
+ [23] Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
240
+ [24] Ron Kohavi. Scaling up the accuracy of naive-bayes classifiers: A decision-tree hybrid. In Kdd, volume 96, pages 202–207, 1996.
241
+ [25] Adam R Kosiorek, Sara Sabour, Yee Whye Teh, and Geoffrey E Hinton. Stacked capsule autoencoders. arXiv preprint arXiv:1906.06818, 2019.
242
+ [26] Emmanuelle Le Chatelier, Trine Nielsen, Junjie Qin, Edi Prifti, Falk Hildebrand, Gwen Falony, Mathieu Almeida, Manimozhiyan Arumugam, Jean-Michel Batto, Sean Kennedy, et al. Richness of human gut microbiome correlates with metabolic markers. Nature, 500(7464):541–546, 2013.
243
+ [27] Yann LeCun. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/, 1998.
244
+ [28] Yinhan 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.
245
+ [29] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
246
+ [30] DD Lucas, R Klein, J Tannahill, D Ivanova, S Brandon, D Domyancic, and Y Zhang. Failure analysis of parameter-induced simulation crashes in climate models. Geoscientific Model Development, 6(4):1157–1171, 2013.
247
+ [31] Renata CB Madeo, Clodoaldo AM Lima, and Sarajane M Peres. Gesture unit segmentation using support vector machines: segmenting gestures from rest positions. In Proceedings of the 28th Annual ACM Symposium on Applied Computing, pages 46–52, 2013.
248
+ [32] Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, Ian Goodfellow, and Brendan Frey. Adversarial autoencoders. arXiv preprint arXiv:1511.05644, 2015.
249
+ [33] C Merz and PM Murphy. Pima indians diabetes dataset. UCI Repository, 1996.
250
+ [34] Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013.
251
+ [35] Michiel O Noordewier, Geoffrey G Towell, and Jude W Shavlik. Training knowledge-based neural networks to recognize genes in dna sequences. In Advances in neural information processing systems, pages 530–536, 1991.
252
+ [36] Min Oh and Liqing Zhang. Deepmicro: deep representation learning for disease prediction based on microbiome data. Scientific reports, 10(1):1–9, 2020.
253
+
254
+ [37] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
255
+
256
+ [38] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, highperformance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché- Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems 32, pages 8024–8035. Curran Associates, Inc., 2019. URL http://papers.neurips.cc/paper/ 9015-pytorch-an-imperative-style-high-performance-deep-learning-library pdf.
257
+
258
+ [39] Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A Efros. Context encoders: Feature learning by inpainting. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2536–2544, 2016.
259
+
260
+ [40] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.
261
+
262
+ [41] Jeffrey Pennington, Richard Socher, and Christopher D Manning. Glove: Global vectors for word representation. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pages 1532–1543, 2014.
263
+
264
+ [42] Katarzyna Tomczak, Patrycja Czerwinska, and Maciej Wiznerowicz. The cancer genome atlas ´ (tcga): an immeasurable source of knowledge. Contemporary oncology, 19(1A):A68, 2015.
265
+
266
+ [43] Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Manzagol. Extracting and composing robust features with denoising autoencoders. In Proceedings of the 25th international conference on Machine learning, pages 1096–1103, 2008.
267
+
268
+ [44] I-Cheng Yeh, King-Jang Yang, and Tao-Ming Ting. Knowledge discovery on rfm model using bernoulli sequence. Expert Systems with Applications, 36(3):5866–5871, 2009.
269
+
270
+ [45] Pengcheng Yin, Graham Neubig, Wen-tau Yih, and Sebastian Riedel. Tabert: Pretraining for joint understanding of textual and tabular data. arXiv preprint arXiv:2005.08314, 2020.
271
+
272
+ [46] Jinsung Yoon, Yao Zhang, James Jordon, and Mihaela van der Schaar. Vime: Extending the success of self-and semi-supervised learning to tabular domain. Advances in Neural Information Processing Systems, 33, 2020.
273
+
274
+ [47] Kun Zhang and Wei Fan. Forecasting skewed biased stochastic ozone days: analyses, solutions and beyond. Knowledge and Information Systems, 14(3):299–326, 2008.
parse/test/4WnqRR915j/4WnqRR915j.md ADDED
@@ -0,0 +1,539 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LLEMMA: AN OPEN LANGUAGE MODEL FOR MATHEMATICS
2
+
3
+ Zhangir Azerbayev 1,2 Hailey Schoelkopf 2 Keiran Paster 3,4 Marco Dos Santos 5 Stephen McAleer 6 Albert Q. Jiang 5 Jia Deng 1 Stella Biderman 2 Sean Welleck 6,7
4
+
5
+ 1 Princeton University 2 EleutherAI 3 University of Toronto 4 Vector Institute 5 University of Cambridge 6 Carnegie Mellon University 7 University of Washington
6
+
7
+ # ABSTRACT
8
+
9
+ We present LLEMMA, a large language model for mathematics. We continue pretraining Code Llama on Proof-Pile-2, a mixture of scientific papers, web data containing mathematics, and mathematical code, yielding LLEMMA. On the MATH benchmark LLEMMA outperforms all known open base models, as well as the unreleased Minerva model suite on an equi-parameter basis. Moreover, LLEMMA is capable of tool use and formal theorem proving without any further finetuning. We openly release all artifacts, including 7 billion and 34 billion parameter models, the Proof-Pile-2, and code to replicate our experiments.1
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Language models trained on diverse mixtures of text display remarkably general language understanding and generation capabilities (Brown et al., 2020; Chowdhery et al., 2022), serving as base models that are adapted to a wide range of applications (Raffel et al., 2023). Applications such as open-ended dialogue (Thoppilan et al., 2022; Touvron et al., 2023) or instruction following (Ouyang et al., 2022; Wei et al., 2022) require balanced performance across the entire distribution of natural text, thus favoring generalist models. However, if we seek to maximize performance within one domain, such as medicine (Singhal et al., 2022; 2023), finance (Wu et al., 2023), or science (Taylor et al., 2022), a domain-specific language model may offer superior capabilities for a given computational cost, or lower computational cost for a given level of capability.
14
+
15
+ In this work, we train a domain-specific language model for mathematics. We have several motivations for doing so. First, solving mathematical problems requires pattern matching against a large body of specialized prior knowledge, thus serving as an ideal setting for domain adaptation. Second, mathematical reasoning is in itself a central AI task, its study dating back to at least Gelernter (1959) and Wang (1960) and continuing to today (Lu et al., 2023). Third, language models capable of strong mathematical reasoning are upstream of a number of research topics, such as reward modeling (Uesato et al., 2022; Lightman et al., 2023), reinforcement learning for reasoning (Polu et al., 2022; Lample et al., 2022), and algorithmic reasoning (Zhou et al., 2022; Zhang et al., 2023).
16
+
17
+ ![](images/cc14070e1920927e6211548e087a927e5f22fb188042a5ae3269e5745a8480e1.jpg)
18
+ Figure 1: Continued pretraining on ProofPile-2 yields LLEMMA, a base model with improved mathematical capabilities.
19
+
20
+ Although domain-specific models for mathematics have been trained in the past, they have either been closed access (Lewkowycz et al., 2022), limiting their ability to become a platform for further research, or have lagged far behind the closed access state-of-the-art (Azerbayev et al., 2023).
21
+
22
+ We present a recipe for adapting a language model to mathematics through continued pretraining (Lewkowycz et al., 2022; Rozière et al., 2023) on Proof-Pile-2, a diverse mixture of math-related text and code. Applying the recipe to Code Llama (Rozière et al., 2023) yields LLEMMA: 7 billion and 34 billion parameter base language models with substantially improved mathematical capabilities.
23
+
24
+ Specifically, our contributions are as follows:
25
+
26
+ 1. We train and release the LLEMMA models: 7B and 34B parameter language models specialized for mathematics. The LLEMMA models are a new state-of-the-art for publicly released base models on MATH (Lewkowycz et al., 2022).
27
+ 2. We release the AlgebraicStack, a dataset of 11B tokens of code specifically related to mathematics.
28
+ 3. We demonstrate that LLEMMA is capable of using computational tools to solve mathematical problems, namely, the Python interpreter and formal theorem provers.
29
+ 4. Unlike prior mathematics language models such as Minerva (Lewkowycz et al., 2022), the LLEMMA models are open access and we open source our training data and code. This allows LLEMMA to serve as a platform for future research in mathematical reasoning.
30
+
31
+ Our work builds on findings in Minerva (Lewkowycz et al., 2022), but differs in several ways: (1) LLEMMA’s training and evaluation covers a wider range of data and tasks, notably code data (e.g., the AlgebraicStack), tool use, and formal mathematics; (2) our work only depends on publicly accessible tools and data; (3) we provide new analyses related to the continued training data mixture, memorization, and additional supervised finetuning; (4) we make all artifacts publicly available.
32
+
33
+ # 2 APPROACH
34
+
35
+ ![](images/9d4faf187e4b0a447cb7b68eeec5f2c6f85a37a1a2648548cbf83f1be5a52cf6.jpg)
36
+
37
+ LLEMMA models are 7 billion and 34 billion parameter language models specialized for mathematics. Our approach is to continue pretraining Code Llama (Rozière et al., 2023) on the Proof-Pile-2.
38
+ Figure 2: Comparison of LLEMMA and Minerva training
39
+
40
+ <table><tr><td>Dataset</td><td>Tokens Open</td><td></td></tr><tr><td>Minerva Dataset</td><td>38.5B</td><td>X</td></tr><tr><td>Proof-Pile-2 (ours)</td><td>55B</td><td>√</td></tr><tr><td>Code (AlgebraicStack)</td><td>11B</td><td>√</td></tr><tr><td>OpenWebMath (Paster et al.,2023))</td><td>15B</td><td></td></tr><tr><td>ArXiv (Computer, 2023))</td><td>29B</td><td></td></tr></table>
41
+
42
+ # 2.1 DATA: Proof-Pile-2
43
+
44
+ We form the Proof-Pile-2, a 55B-token mixture of scientific papers, web data containing mathematics, and mathematical code. With the exception of the Lean proofsteps subset (see Appendix B), the Proof-Pile-2 has a knowledge cutoff of April 2023.
45
+
46
+ Code. Computational tools such as numerical simulations, computer algebra systems, and formal theorem provers are of ever increasing importance to mathematicians (Avigad, 2018). Motivated by this fact, we create AlgebraicStack, an 11B-token dataset of source code from 17 languages, spanning numerical, symbolic, and formal math. The dataset consists of filtered code from the Stack (Kocetkov et al., 2022), public GitHub repositories, and formal proofstep data. Table 9 shows the number of tokens by language in AlgebraicStack. See Appendix B.1 for further details on AlgebraicStack.
47
+
48
+ Web data. We use OpenWebMath (Paster et al., 2023), a 15B-token dataset of high-quality web pages filtered for mathematical content. OpenWebMath filters CommonCrawl web pages based on math-related keywords and a classifier-based math score, preserves mathematical formatting (e.g., LATEX, AsciiMath), and includes additional quality filters (e.g., perplexity, domain, length) and near-deduplication. Refer to Paster et al. (2023) for a full description of OpenWebMath.
49
+
50
+ Scientific papers. We use the ArXiv subset of RedPajama (Computer, 2023), an open-access reproduction of the LLaMA training dataset. The ArXiv subset contains 29B tokens.
51
+
52
+ General natural language and code data. Following Lewkowycz et al. (2022), our training mixture consists of a small amount of general domain data, which functions as a form of regularization. Since the pretraining dataset for LLaMA 2 is undisclosed, we use the Pile (Gao et al., 2020; Biderman et al., 2022) as a surrogate training dataset. We set $9 5 \%$ of our training mixture to be the Proof-Pile-2, $2 \%$ to be from the Pile (with ArXiv removed, as it is separately in Proof-Pile-2), and $3 \%$ to be the GitHub subset of RedPajama (Computer, 2023).
53
+
54
+ Further information on dataset composition and a datasheet are in Appendix B and Appendix E, respectively. We publicly release Proof-Pile-2 at hf.co/datasets/EleutherAI/proof-pile-2.
55
+
56
+ # 2.2 MODEL AND TRAINING
57
+
58
+ Each model is initialized from Code Llama (Rozière et al., 2023). Code Llama models are decoderonly transformer language models initialized from Llama 2 (Touvron et al., 2023) and further trained on 500B tokens of code. We continue training the Code Llama models on Proof-Pile-2 using a standard autoregressive language modeling objective. We train the 7B model for 200B tokens, and the 34B model for 50B tokens.
59
+
60
+ We train all models in bfloat16 mixed precision using the GPT-NeoX library (Andonian et al., 2023) across 256 A100 40GB GPUs. We use Tensor Parallelism (Shoeybi et al., 2019) with a world size of 2 for LLEMMA-7B , and a world size of 8 for LLEMMA-34B, alongside ZeRO Stage 1 sharded optimizer states (Rajbhandari et al., 2020) across Data Parallel (Goyal et al., 2017) replicas. We use Flash Attention 2 (Dao, 2023) to improve throughput and further reduce memory requirements.
61
+
62
+ LLEMMA 7B is trained for 42, 000 steps with a global batch size of 4 million tokens and a 4096 token context length. This corresponds to roughly 23, 000 A100-hours. The learning rate is warmed up to $1 \cdot 1 0 ^ { - 4 }$ over 500 steps, then set to cosine decay to $1 / 3 0 0 \mathrm { { t h } }$ of the maximum learning rate over 48, 000 steps. The reason for the discrepancy between the number of training steps and the scheduler length is that we planned to train for 48, 000 steps, but encountered NaN losses after step 42, 000, likely caused by unstable optimization or hardware failures (Elsen et al., 2023).
63
+
64
+ LLEMMA 34B is trained for 12, 000 steps with a global batch size of 4 million tokens and a 4096 context length. This corresponds to roughly 47, 000 A100-hours. The learning rate is warmed up to $5 \cdot 1 0 ^ { - 5 }$ over 500 steps, then decayed to 1/30th the peak learning rate.
65
+
66
+ Before training LLEMMA 7B, we contract the RoPE (Su et al., 2022) base period of the Code Llama 7B initialization from $\theta = 1 , 0 0 0 , 0 0 0$ to $\theta = 1 0 , 0 0 0$ . This is so that the long context finetuning procedure described in Peng et al. (2023)and Rozière et al. (2023) can be repeated on the trained LLEMMA 7B (we leave actually doing so to future work). Due to compute constraints, we were unable to verify that training LLEMMA 34B with a contracted RoPE base period did not come with a performance penalty, therefore for that model we preserved $\theta = 1 , 0 0 0 , 0 0 0$ .
67
+
68
+ # 3 EVALUATION
69
+
70
+ Our goal is to evaluate LLEMMA as a base model for mathematical text. To this end, we compare LLEMMA models using few-shot evaluation (Brown et al., 2020), and primarily focus on state-of-theart models that have not been finetuned on supervised examples for the task. First, we evaluate the model’s ability to solve mathematics problems using chain of thought reasoning (Wei et al., 2023) and majority voting (Wang et al., 2023). Our evaluations include MATH (Hendrycks et al., 2021b) and GSM8k (Cobbe et al., 2021), the de-facto standard benchmarks for evaluating quantitative reasoning in language models (Lewkowycz et al., 2022). Second, we explore few-shot tool use and formal theorem proving. Third, we study the effects of memorization and the data mixture. Appendix G contains a preliminary study of supervised finetuning with LLEMMA.
71
+
72
+ These tasks involve generating self-contained text solutions to problems expressed in $\mathrm { I A T _ { E } X }$ or natural language, without using external tools (Lewkowycz et al., 2022). We use the following evaluation:
73
+
74
+ • MATH (Hendrycks et al., 2021b), a dataset with $1 2 . 5 \mathrm { k }$ problems (5k evaluation) from high-school math competitions. Given a problem statement, the model generates a LATEXsolution and an answer that must match a reference answer. We follow a similar task implementation to Lewkowycz et al. (2022), using their four-example prompt and evaluating answers for exact string match or SymPy equivalence.
75
+ • GSM8k (Cobbe et al., 2021), a dataset of middle-school level math word problems. We use the 8-shot prompt from Wei et al. (2023), as Lewkowycz et al. (2022) do not specify their evaluation prompt or number of few-shot examples.
76
+ • OCWCourses (Lewkowycz et al., 2022), a collection of undergraduate-level STEM problems harvested from MIT’s OpenCourseWare. We use the four-example prompt provided by (Lewkowycz et al., 2022).
77
+ • MMLU-STEM (Hendrycks et al., 2021a), a subset of 18 out of 57 subjects in the MMLU benchmark. We follow Lewkowycz et al. (2022) and use their provided four-example chain-ofthought prompt.
78
+ • SAT, we create a dataset consisting of the 32 math questions that do not contain figures from the May 2023 College Board SAT examination, which is after our model’s knowledge cutoff.
79
+
80
+ # Input:
81
+
82
+ LLEMMA 34B solution: We have
83
+
84
+ $$
85
+ \begin{array} { r l } { \displaystyle \sum _ { k = 2 } ^ { \infty } f ( k ) = \sum _ { k = 2 } ^ { \infty } \frac { 2 0 0 8 } { j \pi ^ { 2 } } \frac { 1 } { j ^ { k } } = \sum _ { j = 2 } ^ { 2 0 0 8 } \sum _ { k = 2 } ^ { \infty } \frac { 1 } { j ^ { k } } = \sum _ { j = 2 } ^ { 2 0 0 8 } \frac { 1 } { j ^ { 2 } } \sum _ { k = 0 } ^ { \infty } \frac { 1 } { j ^ { 3 } } = \sum _ { j = 2 } ^ { 2 0 0 8 } \frac { 1 } { j ^ { 2 } } \frac { 1 } { 1 - \frac { 1 } { j } } } & { } \\ { = \displaystyle \sum _ { j = 2 } ^ { 2 0 0 8 } \frac { 1 } { j ( j - 1 ) } = \sum _ { j = 2 } ^ { 2 0 0 8 } \left( \frac { 1 } { j - 1 } - \frac { 1 } { j } \right) } & { } \\ { = \left( \frac { 1 } { 1 } - \frac { 1 } { 2 } \right) + \left( \frac { 1 } { 2 } - \frac { 1 } { 3 } \right) + \cdots + \left( \frac { 1 } { 2 0 0 7 } - \frac { 1 } { 2 0 0 8 } \right) } & { } \\ { = 1 - \frac { 1 } { 2 0 0 8 } } & { } \\ { = \left[ \frac { 2 0 0 7 } { 2 0 0 8 } \right] } & { } \end{array}
86
+ $$
87
+
88
+ Final Answer: The final answer is $\frac { 2 0 0 7 } { 2 0 0 8 }$ .
89
+
90
+ Figure 3: Example of a LLEMMA 34B solution to a MATH (Hendrycks et al., 2021a) problem. This problem is tagged with difficulty level 5, the highest in MATH. The model was conditioned on the 4-shot prompt described in subsection 3.1, and the solution was produced by greedy decoding. The model had to apply two nontrivial steps to solve this problem: (1) noticing that swapping the order of summation simplifies the problem, and (2) noticing that the resulting sum telescopes.
91
+
92
+ We compare with Minerva (Lewkowycz et al., 2022), which continued pretraining the PaLM language model on a dataset of technical content; Code Llama, the initialization of LLEMMA’s continued pretraining; and Llama 2, the initialization of Code Llama’s continued pretraining on code. For open access models, we report scores computed using our evaluation suite, which is implemented as a fork of the Language Model Evaluation Harness (Gao et al., 2021). For Minerva models, we report benchmark scores from Lewkowycz et al. (2022).
93
+
94
+ Results. LLEMMA’s continued pretraining on Proof-Pile-2 improves few-shot performance on the five mathematical benchmarks. LLEMMA 34B improves over Code Llama by 20 percentage points on GSM8k and 13 points on MATH, and LLEMMA 7B outperforms the proprietary Minerva model. Our approach also outperforms all open-weight language models at the time of writing. We conclude that continued pretraining on Proof-Pile-2 is effective for improving a pretrained model’s ability to perform mathematical problem solving.
95
+
96
+ LLEMMA is pretrained on a diverse distribution of mathematics-related data, and is not tuned for a particular task. Therefore, we expect that LLEMMA can adapt to many other tasks via task-specific finetuning and few-shot prompting.
97
+
98
+ Table 1: Results on our five chain-of-thought reasoning tasks with samples generated via greedy decoding. Minerva results are quoted from Lewkowycz et al. (2022). Note that CodeLlama 7B performs worse than random guessing $( 2 5 \% )$ on MMLU and SAT, largely due to failing to conclude its chain of thought with a valid answer.
99
+
100
+ <table><tr><td></td><td></td><td>GSM8k</td><td>OCW</td><td>MMLU-STEM</td><td>SAT</td><td>MATH</td></tr><tr><td>Llama 2</td><td>7B</td><td>11.8%</td><td>3.7%</td><td>29.9%</td><td>25.0%</td><td>3.2%</td></tr><tr><td>Code Llama</td><td>7B</td><td>10.5%</td><td>4.4%</td><td>25.1%</td><td>9.4%</td><td>4.5%</td></tr><tr><td>Minerva</td><td>8B</td><td>16.2%</td><td>7.7%</td><td>35.6%</td><td></td><td>14.1%</td></tr><tr><td>LLEMMA</td><td>7B</td><td>36.4%</td><td>7.7%</td><td>37.7%</td><td>53.1%</td><td>18.0%</td></tr><tr><td>Code Llama</td><td>34B</td><td>29.6%</td><td>7.0%</td><td>40.5%</td><td>40.6%</td><td>12.2%</td></tr><tr><td>LLEMMA</td><td>34B</td><td> 51.5%</td><td>11.8%</td><td>49.0%</td><td>71.9%</td><td>25.0%</td></tr><tr><td>Minerva</td><td>62B</td><td>52.4%</td><td>12.0%</td><td>53.9%</td><td></td><td>27.6%</td></tr><tr><td>Minerva</td><td>540B</td><td>58.8%</td><td>17.6%</td><td>63.9%</td><td>1</td><td>33.6%</td></tr></table>
101
+
102
+ Table 2: Majority voting results for LLEMMA and Minerva. Minerva results are quoted from Lewkowycz et al. (2022). Voting is done with $k = 2 5 6$ for MATH, $k = 1 0 0$ for GSM8k and OCW, and $k = 1 6$ for MMLU-STEM and SAT. We sample with temperature $T = 0 . 6$ for $k = 2 5 6$ and $k = 1 0 0$ and $T = 0 . 3$ for $k = 1 6$ , and use nucleus sampling with $p = 0 . 9 5$ (Holtzman et al., 2020). Due to compute constraints, we do not calculate majority voting scores for Llama 2 and Code Llama.
103
+
104
+ <table><tr><td></td><td></td><td>GSM8k maj@k</td><td>OCW maj@k</td><td>MMLU-STEM maj@k</td><td>SAT maj@k</td><td>MATH maj@k</td></tr><tr><td>Minerva</td><td>8B</td><td>28.4%</td><td>12.5%</td><td>43.4%</td><td></td><td>25.4%</td></tr><tr><td>LLEMMA</td><td>7B</td><td> 54.0%</td><td>14.3%</td><td>49.9%</td><td>78.1%</td><td>33.5%</td></tr><tr><td>LLEMMA</td><td>34B</td><td>69.3%</td><td>18.4%</td><td>59.7%</td><td>81.3%</td><td>43.1%</td></tr><tr><td>Minerva</td><td>62B</td><td>68.5%</td><td>23.5%</td><td>63.5%</td><td></td><td>43.4%</td></tr><tr><td>Minerva</td><td>540B</td><td>78.5%</td><td>30.8%</td><td>75.0%</td><td></td><td>50.3%</td></tr></table>
105
+
106
+ # 3.2 MATHEMATICAL PROBLEM SOLVING WITH TOOL USE
107
+
108
+ These tasks involve solving problems with access to computational tools. We evaluate the following:
109
+
110
+ • MATH+Python, the model is prompted to alternately describe a solution step in natural language, then execute that step with code. The final answer is a program that executes to a numeric type or a SymPy object. Our few-shot prompt includes examples that use built-in numeric operations, the math module, and SymPy.
111
+ GSM8k $+$ Python, solving a GSM8k word problem by writing a Python program that executes to an integer answer. We use the prompt from Gao et al. (2023).
112
+
113
+ Results. As seen in Table 3, LLEMMA improves over Code Llama on both tasks. Its performance on MATH and GSM8k with tools is also higher than its performance on these datasets without tools.
114
+
115
+ Table 3: Mathematical problem solving with tool use.
116
+
117
+ <table><tr><td></td><td></td><td>GSM8k+Python pass@1</td><td>MATH+Python pass@1</td></tr><tr><td>Code Llama</td><td>7B</td><td>27.1%</td><td>17.2%</td></tr><tr><td>LLEMMA</td><td>7B</td><td>40.1%</td><td>21.5%</td></tr><tr><td>Code Llama</td><td>34B</td><td>52.7%</td><td>23.5%</td></tr><tr><td>LLEMMA</td><td>34B</td><td>62.6%</td><td>27.1%</td></tr></table>
118
+
119
+ # 3.3 FORMAL MATHEMATICS
120
+
121
+ Interactive proof assistants such as Lean (de Moura et al., 2015), Isabelle (Wenzel et al., 2008), and Coq (Paulin-Mohring, 1989a;b) express mathematics in programming languages that allow for verification. These languages are data scarce compared to mainstream languages, especially in the context of pretraining. For instance, the Stack dataset used to pretrain language models in the BigCode project (Allal et al., 2023) has over 700 gigabytes of Python, compared to 322 megabytes of Lean. Proof assistants also require models to leverage information that is not present in raw source code, such as goal states that contain information about each step of a proof.
122
+
123
+ ![](images/1e7f74c33b1bf8ace4487dca4649bb9b746a05efc6db6b52ec99b741de0911c9.jpg)
124
+ Figure 4: Example formal proofs from LLEMMA-7b. Left: The model is given a problem, informal proof, and formal statement, following Jiang et al. (2023). It generates a formal proof (starting with proof -) containing Isabelle code and calls to automation (shown as ${ < A T P > }$ ). Right: The model is given a proof state, visualized as a grey comment, and generates the subsequent step (e.g. rw [..).
125
+
126
+ Proof-Pile-2’s AlgebraicStack contains over 1.5 billion tokens of formal mathematics data, including proof states extracted from Lean and Isabelle formalizations. While a full investigation of formal math is outside the scope of this paper, we evaluate LLEMMA few-shot on two tasks:
127
+
128
+ • Informal-to-formal proving (Jiang et al., 2023), the task of generating a formal proof, given a formal statement, an informal LATEX statement, and an informal LATEX proof. The formal proof is checked by the proof assistant. We use the Isabelle proof assistant and evaluate on miniF2F (Zheng et al., 2021), a benchmark consisting of problem statements from Olympiads and undergraduate coursework. For the prompt, we use 11 (formal statement, informal statement, informal proof, formal proof) examples from Jiang et al. (2023), selecting 7 examples for number theory problems, and 6 examples for all others. We generate a single proof with greedy decoding.
129
+
130
+ • Formal-to-formal proving (e.g., Polu & Sutskever (2020)), the task of proving a formal statement by generating a sequence of proof steps (tactics). At each step, the input is a state $x _ { t }$ given by the proof assistant, and the language model’s task is to generate a proof step $y _ { t }$ (a sequence of code). The proof step is checked by the proof assistant, yielding a new state $x _ { t + 1 }$ or an error message. The process continues, stopping if a proof is completed or a timeout is reached. We prompt the model using three $( x _ { t } , y _ { t } )$ examples. We evaluate on miniF2F (Zheng et al., 2021) using the Lean 4 proof assistant, and use a standard best first search. See Appendix D for more details.
131
+
132
+ Results. As seen in Table 4, LLEMMA’s continued pretraining on Proof-Pile-2 improved few-shot performance on the two formal theorem proving tasks.
133
+
134
+ <table><tr><td>Method</td><td colspan="2">Informal-to-formal miniF2F-valid miniF2F-test</td></tr><tr><td>Sledgehammer</td><td>14.72%</td><td>20.49%</td></tr><tr><td>Code Llama 7b</td><td>16.31%</td><td>17.62%</td></tr><tr><td>Code Llama 34b</td><td>18.45%</td><td>18.03%</td></tr><tr><td>LLEMMA-7b</td><td>20.60%</td><td>22.13%</td></tr><tr><td>LLEMMA-34b</td><td>21.03%</td><td>21.31%</td></tr></table>
135
+
136
+ <table><tr><td>Method</td><td colspan="2">Formal-to-formal Search miniF2F-test</td></tr><tr><td>ReProver (fine-tuned)</td><td>1×64</td><td>26.50%</td></tr><tr><td>Code Llama 7b</td><td>1×32</td><td>20.49%</td></tr><tr><td>Code Llama 34b</td><td>1×32</td><td>22.13%</td></tr><tr><td>COPRA (GPT-4)</td><td></td><td>23.36%</td></tr><tr><td>LLEMMA-7b</td><td>1×32</td><td>26.23%</td></tr><tr><td>LLEMMA-34b</td><td>1×32</td><td>25.82%</td></tr></table>
137
+
138
+ Table 4: Formal theorem proving tasks. Left: Informal-to-formal proving in Isabelle, showing the percentage of proven theorems with greedy decoding. Right: Formal-to-formal proving in Lean, showing the percentage of proven theorems with the given number of attempts $\times$ generations-periteration of best first search, and a 10-minute timeout. Sledgehammer (Paulson & Nipkow, 2023) is built-in Isabelle automation. ReProver (Yang et al., 2023) is a supervised and retrieval-augmented model. COPRA (Thakur et al., 2023) is a retrieval-augmented GPT-4 based method. † COPRA does not use best first search, but instead samples from GPT-4 (OpenAI, 2023) a maximum of 60 times.
139
+
140
+ On informal-to-formal proving, LLEMMA-7b closes $2 2 . 1 \%$ of the theorems, improving upon its Code Llama initialization and the Sledgehammer prover. The theorems that LLEMMA proves are often complementary to those proved with Sledgehammer: taking the union of Sledgehammer and LLEMMA proofs results in 26 new validation proofs (an 11 percentage-point increase), and 17 new test proofs (a 7 point increase); see Appendix Table 11. Prior to our work, the only demonstration of few-shot proof autoformalization used the proprietary Codex model (Jiang et al., 2023).
141
+
142
+ On Lean 4 formal-to-formal proving, LLEMMA-7b improves upon its Code Llama initialization, and performs similar to ReProver (Yang et al., 2023), a retrieval-augmented language model finetuned for tactic prediction. LLEMMA adapts to the task using a 3 example prompt, which to our knowledge is the first demonstration of few-shot tactic prediction for theorem proving by an open model.
143
+
144
+ # 3.4 IMPACT OF DATA MIXTURE
145
+
146
+ When training a language model, it is common to upsample high-quality subsets of the training data according to mixture weights (Brown et al., 2020; Gao et al., 2020; Xie et al., 2023). We select mixture weights by doing short training runs on several hand-picked mixture weights, then choosing the one which minimizes perplexity on a set of high-quality held-out text (we use the MATH training set). Table 5 shows the MATH training set perplexity of models trained using different mixtures of arXiv to web to code. Based on these results, we trained LLEMMA with a ratio of $2 : 4 : 1$ . Note that our methodology uses the MATH training set to determine a training hyperparameter, though we expect that the effect is similar to that of related high-quality texts.
147
+
148
+ Table 5: MATH training set perplexity of Code Llama 7B models trained using different data mixtures for a reduced number of steps. Each mixture is represented by its arXiv:Web:Code ratio.
149
+
150
+ <table><tr><td>Mixture</td><td colspan="8">MATH training set perplexity</td></tr><tr><td></td><td>Overall</td><td>Prealgebra</td><td>Algebra</td><td>Numbrer</td><td>Countity</td><td>Geometry</td><td>Interedeate</td><td>Precalculus</td></tr><tr><td>2:4:1</td><td>1.478</td><td>1.495</td><td>1.515</td><td>1.552</td><td>1.475</td><td>1.519</td><td>1.439</td><td>1.331</td></tr><tr><td>2:4:2</td><td>1.482</td><td>1.500</td><td>1.519</td><td>1.556</td><td>1.477</td><td>1.524</td><td>1.443</td><td>1.334</td></tr><tr><td>4:2:1</td><td>1.487</td><td>1.505</td><td>1.524</td><td>1.561</td><td>1.481</td><td>1.534</td><td>1.447</td><td>1.338</td></tr><tr><td>4:2:2</td><td>1.489</td><td>1.508</td><td>1.527</td><td>1.562</td><td>1.483</td><td>1.538</td><td>1.447</td><td>1.339</td></tr><tr><td>4:4:1</td><td>1.487</td><td>1.506</td><td>1.525</td><td>1.561</td><td>1.482</td><td>1.529</td><td>1.446</td><td>1.335</td></tr><tr><td>4:4:2</td><td>1.485</td><td>1.503</td><td>1.523</td><td>1.559</td><td>1.480</td><td>1.529</td><td>1.444</td><td>1.334</td></tr></table>
151
+
152
+ # 3.5 DATASET OVERLAP AND MEMORIZATION
153
+
154
+ Do test problems or solutions appear in the corpus? We check whether any 30-gram in a test sequence (either an input problem or an output solution) occurs in any OpenWebMath or AlgebraicStack document. If so, we say that a hit occurred between the sequence and the document. Table 6 shows hits between sequences from MATH and documents from Proof-Pile-2. Using our methodology, around $7 \%$ of MATH test problem statements and $0 . 6 \%$ of MATH test solutions have hits. Note that our methodology gives a lower bound on the number of semantically equivalent sequences (e.g., it does not account for alternative phrasing).
155
+
156
+ We manually inspected 100 uniformly sampled hits between a test problem statement and an OpenWebMath document. 41 of the cases had no solution, which included websites with a list of problems, discussions, or hints. 49 had an alternative solution to the MATH ground-truth solution, but with the same answer. These include solutions that solve the problem differently than the ground-truth, solutions with missing details, and discussions that include the answer. 9 cases had a missing or incorrect answer, and 1 had the same solution as in the ground-truth. In summary, we find that solutions can appear in a corpus derived from web documents, particularly alternative solutions to those in the evaluation set. We repeated our analysis with 20-gram hits and our findings were similar, though with false positives; see Appendix Figure 6 for examples.
157
+
158
+ Table 6: Left: 30-gram hits between MATH test problems or solutions and Proof-Pile-2 documents. Example and Docs are the numbers of unique test examples and Proof-Pile-2 documents with a hit. Right: manual inspection of 100 hits between a problem statement and a Proof-Pile-2 document.
159
+
160
+ <table><tr><td>Proof-Pile-2</td><td>Test</td><td colspan="2"></td><td colspan="2">Example Docs Examputi Docs</td><td colspan="2">Same solution</td></tr><tr><td>OpenWebMath</td><td>MATH</td><td>348</td><td>717</td><td>34</td><td>46</td><td>Different solution, same answer</td><td>49</td></tr><tr><td>AlgebraicStack MATH</td><td></td><td>3</td><td>3</td><td>1</td><td>1</td><td>Different solution, different ans wer</td><td>9</td></tr><tr><td>OpenWebMath</td><td>GSM8k</td><td>2</td><td>3</td><td>0</td><td>0</td><td>No solution</td><td>41</td></tr><tr><td>AlgebraicStack GSM8k</td><td></td><td>0</td><td>0</td><td>0</td><td>0</td><td>Different problem</td><td>0</td></tr></table>
161
+
162
+ # How do problems in the corpus impact performance?
163
+
164
+ Next, we evaluate LLEMMA-34b on the test examples with a 30-gram hit, and the test examples without a 30- gram hit. Table 7 shows the accuracy partitioned by MATH difficulty level. The model’s accuracy remains low on difficult problems (e.g., $6 . 0 8 \%$ on Level 5 problems with a hit, versus $6 . 3 9 \%$ on problems without a hit), and we observe no clear relationship between 30-gram hits and accuracy across difficulty levels. We conclude that a nontrivial match between a test example and a training document did not imply that the model generated a memorized correct answer. We repeated the analysis with 20-grams and with the 7b model, and our findings were analogous. Figure 7 shows an example.
165
+
166
+ <table><tr><td>MATH Level</td><td>Hit Accuracy</td><td>Nonhit Accuracy</td><td>#Hits</td></tr><tr><td>Level 1</td><td>72.73</td><td>61.50</td><td>11</td></tr><tr><td>Level 2</td><td>35.71</td><td>40.18</td><td>28</td></tr><tr><td>Level 3</td><td>30.36</td><td>26.88</td><td>56</td></tr><tr><td>Level 4</td><td>14.89</td><td>16.61</td><td>94</td></tr><tr><td>Level 5</td><td>6.08</td><td>6.39</td><td>181</td></tr></table>
167
+
168
+ Table 7: LLEMMA-34b’s accuracy on hits (a 30-gram overlap between a problem or solution and a training sequence) and nonhits by MATH difficulty level.
169
+
170
+ Finally, we check 30-gram hits between LLEMMA’s MATH generations and OpenWebMath. There were 13 hits, which occurred when the model generated a common sequence of numbers (e.g., a list of Fibonacci numbers), plus one instance of factoring a polynomial. Appendix Figure 6 shows an example. We find all of these observations worthy of further study. Using LLEMMA and Proof-Pile-2 to better understand data, memorization, and performance is an interesting future direction. We include the code for our analysis in the LLEMMA repository.
171
+
172
+ # 4 RELATED WORK
173
+
174
+ Large-scale language modeling. Recent progress in large language models involves two connected threads: the increasing scale of models and data (Hoffmann et al., 2022; Kaplan et al., 2020; Chowdhery et al., 2022), and a progression toward more generalist models (Radford et al., 2019; Brown et al., 2020) which are capable of solving diverse problems and adapting quickly to novel tasks. A third thread relates to enabling open access to language models with these capabilities (Black et al., 2022; Biderman et al., 2023; Touvron et al., 2023; Rozière et al., 2023). Our work provides a recipe for specializing these language models to the domain of mathematics, providing a platform for further research and applications.
175
+
176
+ Domain adaptation. Language model applications typically require a general-domain pretraining step, followed by a shorter fine-tuning step. The finetuning step is often aimed at imbuing instructionfollowing ability (Sanh et al., 2022; Wei et al., 2022) or aligning a model’s outputs with human preferences (Ziegler et al., 2019; Ouyang et al., 2022; Bai et al., 2022). Other work explores adapting pretrained models to novel domains by continued training (Rozière et al., 2023; Beltagy et al., 2019), parameter-efficient finetuning methods (Yong et al., 2023), retrieval augmentation (Min et al., 2023; Asai et al., 2023), and other techniques. We provide an adaptation recipe involving continued training and targeted data collection.
177
+
178
+ Language models for mathematics. Applying large language models to problems in mathematics is an active subfield of machine learning, including benchmarking mathematical knowledge and reasoning at varying levels (Hendrycks et al., 2021b; Zheng et al., 2021; Welleck et al., 2022; Azerbayev et al., 2023). Although achieving strong mathematical reasoning is an important target, it is difficult to assess the correctness of models’ answers and processes, especially as models become more capable (Bowman et al., 2022; Uesato et al., 2022; Lightman et al., 2023; Cobbe et al., 2021).
179
+
180
+ A number of recent works focus on supervised finetuning on task-relevant (input, output) pairs (e.g.,Yu et al. (2023); Yue et al. (2023)). Doing so boosts performance on some common mathematical language modeling benchmarks, but trains the model for these specific tasks. In contrast, Lewkowycz et al. (2022) and our work seek to train a base language model as a platform for further development.
181
+
182
+ Language models for formal mathematics. An ongoing line of work explores integrating language models with interactive proof assistants in the context of mathematics. This includes synthesizing proofs via tactic prediction (Polu & Sutskever, 2020; Han et al., 2022; Lample et al., 2022; Jiang et al., 2022), autoformalization (Wu et al., 2022; Jiang et al., 2023), and integrated tools (Welleck & Saha, 2023). Due to high computational costs of search, language models applied to this domain have traditionally been small, but recent work has demonstrated promise in the use of larger models (First et al., 2023; Jiang et al., 2023). Our work provides a demonstration of few-shot proof autoformalization and tactic prediction, a large collection of formal mathematics data, along with an open access model for further exploring these directions.
183
+
184
+ # 5 CONCLUSION
185
+
186
+ We introduce LLEMMA and Proof-Pile-2, a novel base model and corpus for language modeling of mathematics. Our models, dataset, and code are openly available. We have shown that LLEMMA achieves state-of-the-art results for open-weights models on mathematical problem solving benchmarks, shown capabilities of using external tools via Python code, and demonstrated few-shot tactic prediction for theorem proving. We hope that LLEMMA and Proof-Pile-2 will be a useful base for future work on understanding language model generalization and dataset composition, investigating the limits of domain-specific language models, using language models as tools for mathematicians, and improving the mathematical capabilities of language models.
187
+
188
+ # ACKNOWLEDGEMENTS
189
+
190
+ We would like to thank Dragomir Radev, Arman Cohan, Jesse Michael Han, and the Deepmind Blueshift team for valuable guidance. We thank Jonah Philion for the model name. We thank Aviya Skowron for advising us on ethical considerations in the development and release of our models. We thank Jonathan Laurent and Leo Du for contributions to our open-source code.
191
+
192
+ We would also like to thank several parties for donating computing resources for this project: Stability AI (training the LLEMMA models), CoreWeave (evaluations and finetuning), the Province of Ontario and companies sponsoring the Vector Institute for Artificial Intelligence (www.vectorinstitute.ai/partners), and Brigham Young University (finetuning). KP is supported by an NSERC PGS-D award.
193
+
194
+ # REFERENCES
195
+
196
+ Loubna Ben Allal, Raymond Li, Denis Kocetkov, Chenghao Mou, Christopher Akiki, Carlos Munoz Ferrandis, Niklas Muennighoff, Mayank Mishra, Alex Gu, Manan Dey, Logesh Kumar Umapathi, Carolyn Jane Anderson, Yangtian Zi, Joel Lamy Poirier, Hailey Schoelkopf, Sergey Troshin, Dmitry Abulkhanov, Manuel Romero, Michael Lappert, Francesco De Toni, Bernardo García del Río, Qian Liu, Shamik Bose, Urvashi Bhattacharyya, Terry Yue Zhuo, Ian Yu, Paulo Villegas, Marco Zocca, Sourab Mangrulkar, David Lansky, Huu Nguyen, Danish Contractor, Luis Villa, Jia Li, Dzmitry Bahdanau, Yacine Jernite, Sean Hughes, Daniel Fried, Arjun Guha, Harm de Vries, and Leandro von Werra. Santacoder: don’t reach for the stars! In Deep Learning for Code (DL4C) Workshop, 2023.
197
+ Alex Andonian, Quentin Anthony, Stella Biderman, Sid Black, Preetham Gali, Leo Gao, Eric Hallahan, Josh Levy-Kramer, Connor Leahy, Lucas Nestler, Kip Parker, Michael Pieler, Jason Phang, Shivanshu Purohit, Hailey Schoelkopf, Dashiell Stander, Tri Songz, Curt Tigges, Benjamin Thérien, Phil Wang, and Samuel Weinbach. GPT-NeoX: Large scale autoregressive language modeling in PyTorch. GitHub Repo, 9 2023. URL https://www.github.com/eleutherai/ gpt-neox.
198
+ Akari Asai, Sewon Min, Zexuan Zhong, and Danqi Chen. Retrieval-based language models and applications. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 6: Tutorial Abstracts), pp. 41–46, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-tutorials.6. URL https: //aclanthology.org/2023.acl-tutorials.6.
199
+ Jeremy Avigad. The mechanization of mathematics. Notices of the AMS, 65(6):681–90, 2018.
200
+ Zhangir Azerbayev, Bartosz Piotrowski, Hailey Schoelkopf, Edward W. Ayers, Dragomir R. Radev, and Jeremy Avigad. Proofnet: Autoformalizing and formally proving undergraduate-level mathematics. ArXiv, abs/2302.12433, 2023.
201
+ Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, Nicholas Joseph, Saurav Kadavath, Jackson Kernion, Tom Conerly, Sheer El-Showk, Nelson Elhage, Zac Hatfield-Dodds, Danny Hernandez, Tristan Hume, Scott Johnston, Shauna Kravec, Liane Lovitt, Neel Nanda, Catherine Olsson, Dario Amodei, Tom Brown, Jack Clark, Sam McCandlish, Chris Olah, Ben Mann, and Jared Kaplan. Training a helpful and harmless assistant with reinforcement learning from human feedback. arXiv preprint arXiv:2204.05862, 2022.
202
+ Iz Beltagy, Kyle Lo, and Arman Cohan. SciBERT: A pretrained language model for scientific text. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 3615–3620, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1371. URL https://aclanthology.org/D19-1371.
203
+ 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, 2023.
204
+
205
+ Stella Rose Biderman, Kieran Bicheno, and Leo Gao. Datasheet for the pile. ArXiv, abs/2201.07311, 2022.
206
+
207
+ Sidney 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. In Proceedings of BigScience Episode# 5–Workshop on Challenges & Perspectives in Creating Large Language Models, pp. 95–136, 2022.
208
+ Samuel R. Bowman, Jeeyoon Hyun, Ethan Perez, Edwin Chen, Craig Pettit, Scott Heiner, Kamile˙ Lukošiut¯ e, Amanda Askell, Andy Jones, Anna Chen, Anna Goldie, Azalia Mirhoseini, Cameron ˙ McKinnon, Christopher Olah, Daniela Amodei, Dario Amodei, Dawn Drain, Dustin Li, Eli TranJohnson, Jackson Kernion, Jamie Kerr, Jared Mueller, Jeffrey Ladish, Joshua Landau, Kamal Ndousse, Liane Lovitt, Nelson Elhage, Nicholas Schiefer, Nicholas Joseph, Noemí Mercado, Nova DasSarma, Robin Larson, Sam McCandlish, Sandipan Kundu, Scott Johnston, Shauna Kravec, Sheer El Showk, Stanislav Fort, Timothy Telleen-Lawton, Tom Brown, Tom Henighan, Tristan Hume, Yuntao Bai, Zac Hatfield-Dodds, Ben Mann, and Jared Kaplan. Measuring progress on scalable oversight for large language models. arXiv preprint arXiv:2211.03540, 2022.
209
+ Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, T. J. Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeff Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. ArXiv, abs/2005.14165, 2020.
210
+ 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.
211
+ 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.
212
+ Katherine M. Collins, Albert Q. Jiang, Simon Frieder, Lionel Wong, Miri Zilka, Umang Bhatt, Thomas Lukasiewicz, Yuhuai Wu, Joshua B. Tenenbaum, William Hart, Timothy Gowers, Wenda Li, Adrian Weller, and Mateja Jamnik. Evaluating language models for mathematics through interactions. arXiv preprint arXiv:2306.01694, 2023.
213
+ Together Computer. Redpajama: An open source recipe to reproduce llama training dataset, April 2023. URL https://github.com/togethercomputer/RedPajama-Data.
214
+ Tri Dao. Flashattention-2: Faster attention with better parallelism and work partitioning. arXiv preprint arXiv:2307.08691, 2023.
215
+ Leonardo de Moura, Soonho Kong, Jeremy Avigad, Floris Van Doorn, and Jakob von Raumer. The lean theorem prover (system description). In Automated Deduction-CADE-25: 25th International Conference on Automated Deduction, Berlin, Germany, August 1-7, 2015, Proceedings 25, pp. 378–388. Springer, 2015.
216
+ Erich Elsen, Curtis Hawthorne, and Arushi Somani. The adventure of the errant hardware, 2023. URL https://www.adept.ai/blog/sherlock-sdc.
217
+ Emily First, Markus N. Rabe, Talia Ringer, and Yuriy Brun. Baldur: Whole-proof generation and repair with large language models. arXiv preprint arXiv:2303.04910, 2023.
218
+ Leo Gao, Stella Rose Biderman, Sid Black, Laurence Golding, Travis Hoppe, Charles Foster, Jason Phang, Horace He, Anish Thite, Noa Nabeshima, Shawn Presser, and Connor Leahy. The pile: An $8 0 0 \mathrm { g b }$ dataset of diverse text for language modeling. ArXiv, abs/2101.00027, 2020.
219
+ Leo Gao, Jonathan Tow, Baber Abbasi, Stella Biderman, Sid Black, Anthony DiPofi, Charles Foster, Laurence Golding, Jeffrey Hsu, Alain Le Noac’h, Haonan Li, Kyle McDonell, Niklas Muennighoff, Jason Ociepa, Chris Phang, Laria Reynolds, Hailey Schoelkopf, Aviya Skowron, Lintang Sutawika, Eric Tang, Anish Thite, Ben Wang, Kevin Wang, and Andy Zou. A framework for few-shot language model evaluation, September 2021. URL https://doi.org/10.5281/zenodo. 5371628.
220
+ Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models. arXiv preprint arXiv:2211.10435, 2022.
221
+ Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models. arXiv preprint arXiv:2211.10435, 2023.
222
+ Timnit Gebru, Jamie Morgenstern, Briana Vecchione, Jennifer Wortman Vaughan, Hanna Wallach, Hal Daumé III au2, and Kate Crawford. Datasheets for datasets, 2021.
223
+ Herbert L. Gelernter. Realization of a geometry theorem proving machine. In IFIP Congress, 1959. URL https://api.semanticscholar.org/CorpusID:18484295.
224
+ Priya Goyal, Piotr Dollár, Ross B. Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch SGD: training imagenet in 1 hour. CoRR, abs/1706.02677, 2017. URL http://arxiv.org/abs/1706.02677.
225
+ Jesse Michael Han, Jason Rute, Yuhuai Wu, Edward Ayers, and Stanislas Polu. Proof artifact cotraining for theorem proving with language models. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rpxJc9j04U.
226
+ Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. arXiv preprint arXiv:2009.03300, 2021a.
227
+ 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. NeurIPS, 2021b.
228
+ Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, Tom Hennigan, Eric Noland, Katie Millican, George van den Driessche, Bogdan Damoc, Aurelia Guy, Simon Osindero, Karen Simonyan, Erich Elsen, Jack W. Rae, Oriol Vinyals, and L. Sifre. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556, 2022.
229
+ Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration, 2020.
230
+ Albert Q. Jiang, Wenda Li, Jesse Michael Han, and Yuhuai Wu. Lisa: Language models of isabelle proofs. 6th Conference on Artificial Intelligence and Theorem Proving, 2021.
231
+ Albert Q. Jiang, Wenda Li, Szymon Tworkowski, Konrad Czechowski, Tomasz Odrzygó´zd´z, Piotr Miłos, Yuhuai Wu, and Mateja Jamnik. Thor: Wielding hammers to integrate language models ´ and automated theorem provers. arXiv preprint arXiv:2205.10893, 2022.
232
+ Albert Qiaochu Jiang, Sean Welleck, Jin Peng Zhou, Timothee Lacroix, Jiacheng Liu, Wenda Li, Mateja Jamnik, Guillaume Lample, and Yuhuai Wu. Draft, sketch, and prove: Guiding formal theorem provers with informal proofs. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ SMa9EAovKMC.
233
+ Jared Kaplan, Sam McCandlish, T. J. Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeff Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
234
+ Denis Kocetkov, Raymond Li, Loubna Ben Allal, Jia Li, Chenghao Mou, Carlos Muñoz Ferrandis, Yacine Jernite, Margaret Mitchell, Sean Hughes, Thomas Wolf, Dzmitry Bahdanau, Leandro von Werra, and Harm de Vries. The stack: 3 tb of permissively licensed source code. Preprint, 2022.
235
+ Guillaume Lample, Marie-Anne Lachaux, Thibaut Lavril, Xavier Martinet, Amaury Hayat, Gabriel Ebner, Aurélien Rodriguez, and Timothée Lacroix. Hypertree proof search for neural theorem proving. arXiv preprint arXiv:2205.11491, 2022.
236
+ Aitor Lewkowycz, Anders Johan Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Venkatesh Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, Yuhuai Wu, Behnam Neyshabur, Guy Gur-Ari, and Vedant Misra. Solving quantitative reasoning problems with language models. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022.
237
+ 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.
238
+ Pan Lu, Liang Qiu, Wenhao Yu, Sean Welleck, and Kai-Wei Chang. A survey of deep learning for mathematical reasoning. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 14605–14631, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.817. URL https://aclanthology.org/2023.acl-long.817.
239
+ Haipeng Luo, Qingfeng Sun, Can Xu, Pu Zhao, Jianguang Lou, Chongyang Tao, Xiubo Geng, Qingwei Lin, Shifeng Chen, and Dongmei Zhang. Wizardmath: Empowering mathematical reasoning for large language models via reinforced evol-instruct. arXiv preprint arXiv:2308.09583, 2023.
240
+ The mathlib Community. The lean mathematical library. In Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2020, pp. 367–381, New York, NY, USA, 2020. Association for Computing Machinery. ISBN 9781450370974. doi: 10.1145/ 3372885.3373824. URL https://doi.org/10.1145/3372885.3373824.
241
+ Sewon Min, Suchin Gururangan, Eric Wallace, Hannaneh Hajishirzi, Noah A. Smith, and Luke Zettlemoyer. Silo language models: Isolating legal risk in a nonparametric datastore, 2023.
242
+ Scott Morrison. lean-training-data. https://github.com/semorrison/ lean-training-data, 2023.
243
+ OpenAI. Gpt-4 technical report, 2023.
244
+ Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback. arXiv preprint arXiv:2203.02155, 2022.
245
+ Keiran Paster, Marco Dos Santos, Zhangir Azerbayev, and Jimmy Ba. Openwebmath: An open dataset of high-quality mathematical web text. CoRR, abs/2310.06786, 2023. doi: 10.48550/ ARXIV.2310.06786. URL https://doi.org/10.48550/arXiv.2310.06786.
246
+ Christine Paulin-Mohring. Extracting $\omega$ ’s programs from proofs in the calculus of constructions. In Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 89–104, 1989a.
247
+ Christine Paulin-Mohring. Extraction de programmes dans le Calcul des Constructions. PhD thesis, Université Paris-Diderot-Paris VII, 1989b.
248
+ Larry Paulson and Tobias Nipkow. The sledgehammer: Let automatic theorem provers write your isabelle scripts!, 2023. URL https://isabelle.in.tum.de/ website-Isabelle2009-1/sledgehammer.html.
249
+ Bowen Peng, Jeffrey Quesnelle, Honglu Fan, and Enrico Shippole. Yarn: Efficient context window extension of large language models. arXiv preprint arXiv:2309.00071, 2023.
250
+ Stanislas Polu and Ilya Sutskever. Generative language modeling for automated theorem proving. arXiv preprint arXiv:2009.03393, 2020.
251
+ Stanislas Polu, Jesse Michael Han, Kunhao Zheng, Mantas Baksys, Igor Babuschkin, and Ilya Sutskever. Formal mathematics statement curriculum learning. arXiv preprint arXiv:2202.01344, 2022.
252
+
253
+ Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI Blog, 2019.
254
+
255
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer, 2023.
256
+
257
+ Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. ZeRO: Memory optimizations toward training trillion parameter models. In Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, SC ’20. IEEE Press, 2020. ISBN 9781728199986. doi: 10.5555/3433701.3433727. URL https://dl.acm.org/doi/10. 5555/3433701.3433727.
258
+ Baptiste Rozière, Jonas Gehring, Fabian Gloeckle, Sten Sootla, Itai Gat, Xiaoqing Ellen Tan, Yossi Adi, Jingyu Liu, Tal Remez, Jérémy Rapin, Artyom Kozhevnikov, Ivan Evtimov, Joanna Bitton, Manish Bhatt, Cristian Canton Ferrer, Aaron Grattafiori, Wenhan Xiong, Alexandre Défossez, Jade Copet, Faisal Azhar, Hugo Touvron, Louis Martin, Nicolas Usunier, Thomas Scialom, and Gabriel Synnaeve. Code llama: Open foundation models for code. arXiv preprint arXiv:2308.12950, 2023.
259
+ Victor Sanh, Albert Webson, Colin Raffel, Stephen H. Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, Manan Dey, M Saiful Bari, Canwen Xu, Urmish Thakker, Shanya Sharma Sharma, Eliza Szczechla, Taewoon Kim, Gunjan Chhablani, Nihal Nayak, Debajyoti Datta, Jonathan Chang, Mike Tian-Jian Jiang, Han Wang, Matteo Manica, Sheng Shen, Zheng Xin Yong, Harshit Pandey, Rachel Bawden, Thomas Wang, Trishala Neeraj, Jos Rozen, Abheesht Sharma, Andrea Santilli, Thibault Fevry, Jason Alan Fries, Ryan Teehan, Tali Bers, Stella Biderman, Leo Gao, Thomas Wolf, and Alexander M. Rush. Multitask prompted training enables zero-shot task generalization. arXiv preprint arXiv:2110.08207, 2022.
260
+ Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, and Bryan Catanzaro. Megatron-LM: Training multi-billion parameter language models using model parallelism. Computing Research Repository, 2019. doi: 10.48550/arXiv.1909.08053. URL https://arxiv.org/abs/1909.08053v4. Version 4.
261
+ Karan Singhal, Shekoofeh Azizi, Tao Tu, S. Sara Mahdavi, Jason Wei, Hyung Won Chung, Nathan Scales, Ajay Tanwani, Heather Cole-Lewis, Stephen Pfohl, Perry Payne, Martin Seneviratne, Paul Gamble, Chris Kelly, Nathaneal Scharli, Aakanksha Chowdhery, Philip Mansfield, Blaise Aguera y Arcas, Dale Webster, Greg S. Corrado, Yossi Matias, Katherine Chou, Juraj Gottweis, Nenad Tomasev, Yun Liu, Alvin Rajkomar, Joelle Barral, Christopher Semturs, Alan Karthikesalingam, and Vivek Natarajan. Large language models encode clinical knowledge, 2022.
262
+ Karan Singhal, Tao Tu, Juraj Gottweis, Rory Sayres, Ellery Wulczyn, Le Hou, Kevin Clark, Stephen Pfohl, Heather Cole-Lewis, Darlene Neal, Mike Schaekermann, Amy Wang, Mohamed Amin, Sami Lachgar, Philip Mansfield, Sushant Prakash, Bradley Green, Ewa Dominowska, Blaise Aguera y Arcas, Nenad Tomasev, Yun Liu, Renee Wong, Christopher Semturs, S. Sara Mahdavi, Joelle Barral, Dale Webster, Greg S. Corrado, Yossi Matias, Shekoofeh Azizi, Alan Karthikesalingam, and Vivek Natarajan. Towards expert-level medical question answering with large language models, 2023.
263
+ Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864, 2022.
264
+ 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, 2022.
265
+ Amitayush Thakur, Yeming Wen, and Swarat Chaudhuri. A language-agent approach to formal theorem-proving, 2023.
266
+ Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, YaGuang Li, Hongrae Lee, Huaixiu Steven Zheng, Amin Ghafouri, Marcelo Menegali, Yanping Huang, Maxim Krikun, Dmitry Lepikhin, James Qin, Dehao Chen, Yuanzhong Xu, Zhifeng Chen, Adam Roberts, Maarten Bosma, Vincent Zhao, Yanqi Zhou, Chung-Ching Chang, Igor Krivokon, Will Rusch, Marc Pickett, Pranesh Srinivasan, Laichee Man, Kathleen Meier-Hellstern, Meredith Ringel Morris, Tulsee Doshi, Renelito Delos Santos, Toju Duke, Johnny Soraker, Ben Zevenbergen, Vinodkumar Prabhakaran, Mark Diaz, Ben Hutchinson, Kristen Olson, Alejandra Molina, Erin Hoffman-John, Josh Lee, Lora Aroyo, Ravi Rajakumar, Alena Butryna, Matthew Lamm, Viktoriya Kuzmina, Joe Fenton, Aaron Cohen, Rachel Bernstein, Ray Kurzweil, Blaise Aguera-Arcas, Claire Cui, Marian Croak, Ed Chi, and Quoc Le. Lamda: Language models for dialog applications. arXiv preprint arXiv:2201.08239, 2022.
267
+ Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023.
268
+ 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, 2022.
269
+ H. Wang. Toward mechanical mathematics. IBM Journal of Research and Development, 4(1):2–22, 1960. doi: 10.1147/rd.41.0002.
270
+ 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 $\underline { { \underline { { \mathbf { \Pi } } } } } =$ 1PL1NIMMrw.
271
+ Jason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, and Quoc V. Le. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652, 2022.
272
+ Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc Le, and Denny Zhou. Chain-of-thought prompting elicits reasoning in large language models, 2023.
273
+ Sean Welleck. Neural theorem proving tutorial. https://github.com/wellecks/ ntptutorial, 2023.
274
+ Sean Welleck and Rahul Saha. llmstep: Llm proofstep suggestions in lean. https://github. com/wellecks/llmstep, 2023.
275
+ Sean Welleck, Jiacheng Liu, Ximing Lu, Hannaneh Hajishirzi, and Yejin Choi. Naturalprover: Grounded mathematical proof generation with 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 ${ . } = { }$ rhdfTOiXBng.
276
+ Makarius Wenzel, Lawrence C Paulson, and Tobias Nipkow. The isabelle framework. In Theorem Proving in Higher Order Logics: 21st International Conference, TPHOLs 2008, Montreal, Canada, August 18-21, 2008. Proceedings 21, pp. 33–38. Springer, 2008.
277
+ Shijie Wu, Ozan Irsoy, Steven Lu, Vadim Dabravolski, Mark Dredze, Sebastian Gehrmann, Prabhanjan Kambadur, David Rosenberg, and Gideon Mann. Bloomberggpt: A large language model for finance, 2023.
278
+ Yuhuai Wu, Albert Qiaochu Jiang, Wenda Li, Markus Norman Rabe, Charles E Staats, Mateja Jamnik, and Christian Szegedy. Autoformalization with 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 $=$ IUikebJ1Bf0.
279
+ Sang Michael Xie, Hieu Pham, Xuanyi Dong, Nan Du, Hanxiao Liu, Yifeng Lu, Percy Liang, Quoc V. Le, Tengyu Ma, and Adams Wei Yu. Doremi: Optimizing data mixtures speeds up language model pretraining. arXiv preprint arXiv:2305.10429, 2023.
280
+ Kaiyu Yang, Aidan Swope, Alex Gu, Rahul Chalamala, Peiyang Song, Shixing Yu, Saad Godil, Ryan Prenger, and Anima Anandkumar. LeanDojo: Theorem proving with retrieval-augmented language models. In Neural Information Processing Systems (NeurIPS), 2023.
281
+ Zheng Xin Yong, Hailey Schoelkopf, Niklas Muennighoff, Alham Fikri Aji, David Ifeoluwa Adelani, Khalid Almubarak, M Saiful Bari, Lintang Sutawika, Jungo Kasai, Ahmed Baruwa, Genta Winata, Stella Biderman, Edward Raff, Dragomir Radev, and Vassilina Nikoulina. BLOOM $+ 1$ : Adding language support to BLOOM for zero-shot prompting. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 11682–11703, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023. acl-long.653. URL https://aclanthology.org/2023.acl-long.653.
282
+ Longhui Yu, Weisen Jiang, Han Shi, Jincheng Yu, Zhengying Liu, Yu Zhang, James T. Kwok, Zhenguo Li, Adrian Weller, and Weiyang Liu. Metamath: Bootstrap your own mathematical questions for large language models. arXiv preprint arXiv:2309.12284, 2023.
283
+ Xiang Yue, Xingwei Qu, Ge Zhang, Yao Fu, Wenhao Huang, Huan Sun, Yu Su, and Wenhu Chen. Mammoth: Building math generalist models through hybrid instruction tuning. CoRR, abs/2309.05653, 2023. doi: 10.48550/arXiv.2309.05653. URL https://doi.org/10. 48550/arXiv.2309.05653.
284
+ Shizhuo Dylan Zhang, Curt Tigges, Stella Biderman, Maxim Raginsky, and Talia Ringer. Can transformers learn to solve problems recursively?, 2023.
285
+ Kunhao Zheng, Jesse Michael Han, and Stanislas Polu. Minif2f: a cross-system benchmark for formal olympiad-level mathematics. arXiv preprint arXiv:2109.00110, 2021.
286
+ Hattie Zhou, Azade Nova, Hugo Larochelle, Aaron Courville, Behnam Neyshabur, and Hanie Sedghi. Teaching algorithmic reasoning via in-context learning, 2022.
287
+ 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 preprint arXiv:1909.08593, 2019.
288
+
289
+ # A AUTHOR CONTRIBUTIONS
290
+
291
+ Training Data. Zhangir Azerbayev, Keiran Paster, Marco Dos Santos, Sean Welleck.
292
+ Model training. Zhangir Azerbayev, Hailey Schoelkopf, Keiran Paster.
293
+ Evaluations. Zhangir Azerbayev, Hailey Schoelkopf, Keiran Paster, Marco Dos Santos, Stephen McAleer, Albert Q. Jiang, Sean Welleck.
294
+ Formal math evaluations. Sean Welleck.
295
+ Memorization analysis. Sean Welleck, Keiran Paster.
296
+ Senior Authorship and Advising. Jia Deng, Stella Biderman, Sean Welleck.
297
+
298
+ B DATA: Proof-Pile-2
299
+
300
+ <table><tr><td>Data source</td><td>Tokens</td><td>Weight</td></tr><tr><td>Proof-Pile-2</td><td>55B</td><td>1</td></tr><tr><td>Code (AlgebraicStack)</td><td>11B</td><td>1.00</td></tr><tr><td>Web (OpenWebMath)</td><td>15B</td><td>4.00</td></tr><tr><td>Papers (ArXiv)</td><td>29B</td><td>2.00</td></tr><tr><td>General code (RedPajama)</td><td>59B</td><td>0.22</td></tr><tr><td>General language (Pile)</td><td>300B</td><td>0.15</td></tr></table>
301
+
302
+ Table 8: Proof-Pile-2 data sources (top), general language and code data included during training (bottom), and the mixture weights of each component during training.
303
+
304
+ # B.1 MATHEMATICAL CODE: AlgebraicStack
305
+
306
+ AlgebraicStack contains roughly 11B tokens of code related to mathematics. We describe its sources, filtering, and content below. Table 9 shows the number of tokens per language in AlgebraicStack.
307
+
308
+ <table><tr><td>Language</td><td>AlgebraicStack tokens</td><td>Language</td><td>AlgebraicStack tokens</td></tr><tr><td>Agda</td><td>35.2 M</td><td>Julia</td><td>531.0 M</td></tr><tr><td>C</td><td>25.1 M</td><td>Jupyter</td><td>199.1 M</td></tr><tr><td>C++</td><td>954.1 M</td><td>Lean</td><td>285.6 M</td></tr><tr><td>Coq</td><td>281.9 M</td><td>Maple</td><td>2.0M</td></tr><tr><td>Fortran</td><td>724.9 M</td><td>Matlab</td><td>65.8M</td></tr><tr><td>GAP</td><td>3.6 M</td><td>Python</td><td>6,098.8 M</td></tr><tr><td>Haskell</td><td>9.1 M</td><td>R</td><td>71.3 M</td></tr><tr><td>Idris</td><td>10.9 M</td><td>Tex</td><td>567.7 M</td></tr><tr><td>Isabelle</td><td>1,089.7 M</td><td>Total</td><td>10,955.7 M</td></tr></table>
309
+
310
+ Table 9: Tokens in AlgebraicStack, computed with the Llama tokenizer.
311
+
312
+ # B.1.1 GITHUB CODE
313
+
314
+ The following programming languages were either barely present in the Stack or consisted of largely incorrect filetypes, so we downloaded data for these languages directly via the Github Python API.
315
+
316
+ • Coq : We filter for files with the .v extension, and include Coq via including files that match a heuristic filter for the keywords "Theorem", "Proof", "Qed", "Inductive", "Definition", "Fixpoint" and exclude Verilog files via the keyword blacklist "pragma", "endmodule", "posedge", "negedge", "wire". We additionally exclude files noted as automatically generated.
317
+
318
+ • Isabelle : We filter for files with the .thy extension and include files matching the keyword whitelist "theorem ", "lemma We keep only isabelle-prover/mirror-afp-devel and discard all other older copies of the Archive of Formal Proofs. We further remove theorem statements and proofs that have a theorem name in the PISA (Jiang et al., 2021) test set.
319
+ • Lean $:$ We filter for files with the .lean extension, using the keyword whitelist "theorem ", "lemma ", "example ". We remove all dependency files, and in order to avoid known benchmark contamination, we blacklist the ProofNet and MiniF2F repositories. We further remove theorems or lemmas that share a theorem name with the LeanDojo (Yang et al., 2023) val or test sets.
320
+ • MATLAB $:$ We filter for files with the .m extension, using the keyword whitelist "#import", "interface", "implementation", "property", and blacklist C files via the keywords "#include" and the regex $\Sigma ^ { \prime }$ main\(.\*{\$’
321
+
322
+ We implemented a cutoff date for our Github API downloads, and used a cutoff date of April 1, 2023.
323
+
324
+ For all languages, unless otherwise stated, we additionally filtered out files with a filesize greater than 1048575 bytes or with a numerical density (ratio of digit characters to non-digit characters) of 0.5. We additionally perform document-level exact deduplication by removing documents which contain an overlapping 2048-character chunk as another document.
325
+
326
+ # B.1.2 LEAN PROOFSTEPS
327
+
328
+ We extract a dataset of (tactic state, next tactic) pairs from Mathlib 4 (mathlib Community, 2020) using the lean-training-data (Morrison, 2023) tool. We use Mathlib 4 commit c779bd5, which was created on August 20th 2023.
329
+
330
+ # B.1.3 ISABELLE PROOFSTEPS
331
+
332
+ We construct a dataset of Isabelle proofs, building upon the PISA dataset Jiang et al. (2021). Isabelle Proofsteps comprises proofs from the Archive of Formal Proofs and Isabelle Standard Library, scraped with PISA Jiang et al. (2021). Each entry in the dataset includes the theorem statement, the proof states and the proof steps, separated by specific tags. To maintain the integrity of evaluations using the PISA test set, we decontaminate Isabelle Proofsteps by removing theorems whose names overlap with those in the PISA test set. Although this approach results in a strict filtering – removing more than 10,000 theorems although there are only 3600 in the PISA test set – we consider it acceptable in order to mitigate data contamination. After filtering, Isabelle Proofsteps contains 251,000 theorems.
333
+
334
+ # B.1.4 STACK FILTERING
335
+
336
+ We source the following programming languages from the Stack (Kocetkov et al., 2022) dataset, and describe our filtering process and quality issues we chose to mitigate beyond our default quality heuristics:
337
+
338
+ • Agda: Only standard filters applied.
339
+ • C : We include documents based on a keyword whitelist, namely: "#include <fftw.h>", "#include <fftw3.h>", "#include <rfftw.h>", "#include <gsl", "#include <cblas.h>", "#include <blas.h>", "#include <lapacke.h>", "#include <nlopt.h>", "#include <petsc.h>".
340
+ • $\mathbf { C } + +$ : We include documents based on a keyword whitelist, namely: "#include <adept_arrays.h>", "#include <adept.h>", "#include <alglib>, "#include <boost", "#include <armadillo", "#include <blitz", "#include <Eigen", "#include <deal.II", "#include <dlib", "#include <NTL", "#include <mtl".
341
+ • Fortran $:$ Only standard filters applied.
342
+ • GAP $:$ Only standard filters applied.
343
+ • Haskell : We filtered the data to only contain files with the following imports: Numeric.LinearAlgebra, Numeric.SpecFunctions, Numeric.Vector, Statistics, Data.Complex.
344
+
345
+ • Idris $:$ Only standard filters applied.
346
+
347
+ • Julia $:$ We filtered out mislabeled JSON lines files. We removed files larger than 10,000 characters long which both were not files containing tests and which had a lower numerical density than 0.5, and otherwise ignored numerical density. We additionally only accepted files within a specific keyword whitelist, to attempt to control relevance to scientific computing, namely: "LinearAlgebra", "DifferentialEquations", "Symbolics", "Distributions", "DataFrames", "DynamicalSystems", "Turing", "Gen", "JuMP", "sqrt", "abs", "zeros", "ones", "sin", "cos", "tan", "log", "exp", "integrate", "likelihood", "Matrix", $\pi$ , "pi", "rand", "grad".
348
+ • Jupyter $:$ We found that many Jupyter notebook files were large due to containing long cell outputs, such as base64 images, long tracebacks, or other extra JSON cell metadata. We use nbconvert to convert notebooks to a markdown format, removing metadata. Maple $:$ We filtered out files with a size greater than 100, 000 bytes, and found that some files were XML. We filtered all files beginning with an XML declaration.
349
+ • Python $:$ We filtered notebooks and JSON files out by excluding documents with beginning "{" characters, and included only files importing from a fixed list of libraries.
350
+ • R : We excluded all files beginning with an XML declaration. We additionally filtered out all notebooks, and filtered all files containing MacOS "Resource Fork" files.
351
+ • Tex : We used a max file size of 10,000,000 bytes. We excluded tex files found in directories named "latex/" because these were often auto-generated files, and excluded documents using gnuplot. We included only documents containing one of the keywords " \chapter{", "\chapter\*{", "\section{", "\section\*{", "\subsection{", "\subsection\*{", "\subsubsection{", "\subsubsection\*{", "\paragraph{", "\subparagraph{", and additionally only included documents identified as English by a classifier from the langid package.
352
+
353
+ For all languages we used within the Stack, unless otherwise stated, we additionally filtered out files with a filesize greater than 1048575 bytes or with a numerical density (ratio of digit characters to non-digit characters) of 0.5.
354
+
355
+ We used v1.2 of the near-deduplicated Stack as a base for processing.
356
+
357
+ # B.2 PAPERS: ARXIV
358
+
359
+ We use the entirety of ArXiv, as accessed by Computer (2023) in April 2023. For further information on preprocessing applied to ArXiv, see Computer (2023).
360
+
361
+ # B.3 WEB: OPENWEBMATH
362
+
363
+ For the web portion of our training dataset, we use OpenWebMath (Paster et al., 2023).
364
+
365
+ # C EVALUATION HARNESS
366
+
367
+ We implement a variety of math-related tasks and evaluation protocols into a public fork of the Language Model Evaluation Harness (Gao et al., 2021). The Harness provides a model-agnostic framework for standardized, reproducible evaluation of language models.
368
+
369
+ We add the following tasks for the evaluations in this paper:
370
+
371
+ • hendrycks_math_ppl: Perplexity evaluation on MATH (Hendrycks et al., 2021a) sub-tasks.
372
+ • minif2f_isabelle: Proof autoformalization in Isabelle on the miniF2F benchmark based on Jiang et al. (2023), with a Portal-to-Isabelle (Jiang et al., 2021) proof checker.
373
+ • minerva_math: The MATH benchmark with the prompt and Sympy evaluation from Minerva (Lewkowycz et al., 2022).
374
+ • minerva-hendrycksTest: MMLU-STEM tasks following Lewkowycz et al. (2022). • ocw_courses: The OCW Courses task from Lewkowycz et al. (2022).
375
+ • python_gsm8k: GSM8k with Python, based on Gao et al. (2022).
376
+ • sympy_math: MATH with Sympy evaluation.
377
+
378
+ We include a link to the implementations for these tasks, including full prompts, in our public codebase.
379
+
380
+ # D EVALUATION: EXPERIMENT DETAILS
381
+
382
+ D.1 ISABELLE INFORMAL-TO-FORMAL THEOREM PROVING
383
+
384
+ We follow Jiang et al. (2023), allowing the model to issue a call to built-in Isabelle automation in the output proof by generating sledgehammer. This calls Sledgehammer (Paulson & Nipkow, 2023) and the list of heuristics listed in Jiang et al. (2023). Following Jiang et al. (2023), as a baseline we use Sledgehammer and the heuristics executed at the beginning of the proof (referred to as Sledgehammer in the main text for brevity). We use a 30-second timeout for Sledgehammer and implement proof checking via Portal-to-Isabelle (Jiang et al., 2021). Refer to the implementation in the Evaluation Harness for further details.
385
+
386
+ # D.2 LEAN THEOREM PROVING
387
+
388
+ Theorem proving via tactic prediction involves interacting with a proof assistant after each step of a proof. Implementing these interactions within the evaluation harness is outside the scope of this work. Therefore, for the Lean theorem proving task we use a separate evaluation setup based on an open-source implementation (Welleck, 2023). We include our evaluation code in our public codebase.
389
+
390
+ Setup. We evaluate on miniF2F (Zheng et al., 2021), which consists of 488 formalized statements from math competitions and undergraduate coursework. Given a formalized statement, the task is to generate a formal proof that is checked by Lean.
391
+
392
+ We use best first search, commonly used for neural tactic prediction models (e.g., Polu & Sutskever (2020)). Best first search is parameterized by the number of attempts $( \Nu )$ , generated tactics per iteration (S), and maximum iterations (T). We define the search budget to be the maximum number of generated tactics, $N \times S \times T$ . We set our search budget to $N \ = \ 1$ , $S ~ = ~ 3 2$ , and $T ~ = ~ 1 0 0$ , less than that of the baseline model. Following Yang et al. (2023), we generate tactics with beam search and use a 10 minute timeout. We adapt the proof search implementation from Welleck (2023), which uses LeanDojo v.1.1.2 (Yang et al., 2023) for interaction. We use Lean 4 miniF2F, using https://github.com/rah4927/lean-dojo-mew commit d00c776260c77de7e70125ef0cd119de6c0ff1de. Note that the ReProver baseline from (Yang et al., 2023) reports performance with Lean 3.
393
+
394
+ Prompt. We prompt the model with three (state, tactic) examples, shown in Figure 5.
395
+
396
+ """Given the Lean 4 tactic state, suggest a next tactic.
397
+
398
+ ![](images/0c015c735b852c9c24ebc7b1e54f310306539ca9247630e4403fcc78085b8bb5.jpg)
399
+ Figure 5: Prompt for the Lean theorem proving experiments.
400
+
401
+ # E DATASHEET
402
+
403
+ We provide a datasheet for Proof-Pile-2, following the framework in Gebru et al. (2021).
404
+
405
+ <table><tr><td colspan="2">MOTIVATION</td></tr><tr><td>For what purpose was the dataset cre- ated?</td><td>Proof-Pile-2 was created for the training or finetuning of domain-specific large lan- guage models for general mathematics</td></tr><tr><td>Who created the dataset and on behalf of which entity?</td><td>tasks. The dataset was created by the authors of this paper for the purposes of this research project.</td></tr><tr><td>Who funded the creation of the dataset?</td><td>The creation of the dataset was funded by the coauthors‘ grants and employers,as fur-</td></tr><tr><td> Any other comment?</td><td>ther described in section 5.</td></tr><tr><td colspan="2">COMPOSITION</td></tr><tr><td>What do the instances that comprise the dataset represent?</td><td>Instances are text-only documents.</td></tr><tr><td> How many instances are there in total?</td><td>We detail fine-grained token counts else- where in this paper.</td></tr><tr><td>Does the dataset contain all possible in- stances or is it a sample (not necessarily random) of instances from a larger set?</td><td>Our dataset is filtered based on our assess- ments of quality for the language modeling task. More detail on methodology can be</td></tr><tr><td>What data does each instance consist of?</td><td>found in Appendix B. Each instance is a text-only document, alongside metadata about its originating</td></tr><tr><td>Is there a label or target associated with each instance?</td><td>split and filename or location. No.</td></tr><tr><td>Is any information missing from individ- ual instances?</td><td>Yes,we filter undesired noise,such as base64-encoded images, from some doc-</td></tr><tr><td>Are relationships between individual in- stances made explicit?</td><td>uments. No.</td></tr><tr><td>Are there recommended data splits?</td><td>Yes, we release a canonical train, validation, and test split of the dataset, which we follow</td></tr><tr><td>Are there any errors, sources of noise,or redundancies in the dataset?</td><td>in this work. We make our best efforts to remove errors or sources of noise,but our dataset will naturally contain documents with errors or noise,and may contain near-duplicate doc-</td></tr><tr><td>Is the dataset self-contained, or does it link to or otherwise rely on external re- sources?</td><td>uments. The dataset is self-contained, but can also be reconstructed based on external publicly available data sources and datasets follow-</td></tr><tr><td>Does the dataset contain data that might be considered confidential?</td><td>ing our instructions. All documents in Proof-Pile-2 are publicly available online.</td></tr></table>
406
+
407
+ Does the dataset contain data that, if viewed directly, might be offensive, insulting, threatening, or might otherwise
408
+
409
+ We estimate toxic content to be less prevalent in our dataset than other more general web-based datasets, due to its technical fo
410
+
411
+ <table><tr><td>cause anxiety?</td><td>cus.However, it is likely to contain such content.</td></tr><tr><td colspan="2">COLLECTION</td></tr><tr><td>How was the data associated with each instance acquired?</td><td>Data was largely sourced from existing pub- lic subsets,such as the RedPajama dataset (Computer, 2023), OpenWebMath dataset (Paster et al., 2023),and via filtering the Stack (Kocetkov et al., 2022). Some data was collected using the Github API.</td></tr><tr><td>What mechanisms or procedures were used to collect the data?</td><td> See above.</td></tr><tr><td>If the dataset is a sample from a larger set, what was the sampling strategy?</td><td>We release the entirety of the dataset fol- lowing the application of our quality filters. We randomly held out validation and test splits from the dataset.</td></tr><tr><td>Who was involved in the data collec- tion process and how were they compen- sated?</td><td>The authors of this paper participated in lo- cating,retrieving,and filtering the dataset.</td></tr><tr><td>Over what timeframe was the data col- lected?</td><td>This data was collected in 2023,with a cut- off date of April 2023 for all subsets with the exception of our Lean proofstep data.</td></tr><tr><td>Were any ethical review processes con- ducted?</td><td>Yes, the authors conducted an informal eth- ical review internally.</td></tr><tr><td colspan="2">PREPROCESSING</td></tr><tr><td>Was any preprocessing/cleaning/labeling of the data done?</td><td>Yes,the authors extensively filtered the dataset subsets in keeping with our expec- tations for high-quality language modeling data in our domain. See Appendix B for further detail on filtering steps taken.</td></tr><tr><td>Was the“raw” data saved in addition to the preprocessed/cleaned/labeled data? Is the software that was used to prepro- cess/clean/label the data available?</td><td>Raw data can be accessed via reuse of our provided codebase. Yes. We release our codebase, which can be used to reproduce our dataset and its con- struction process,at https : //github. com/EleutherAI/math-lm.</td></tr><tr><td colspan="2">USES Has the dataset been used for any tasks</td></tr><tr><td>already?</td><td>Yes, this dataset has been used to train the LLEMMA language models as a domain adaptation and continued pretraining cor- pus.</td></tr><tr><td>Is there a repository that links to any or all papers or systems that use the dataset?</td><td>No.</td></tr><tr><td>What (other) tasks could the dataset be used for?</td><td>The dataset was specifically targeted as a high quality language modeling corpus for the mathematics domain, but may be useful for general-purpose language modeling or unforeseen other downstream uses.</td></tr></table>
412
+
413
+ Table 10: Datasheet for Proof-Pile-2, following the framework introduced by Gebru et al. (2021).
414
+
415
+ <table><tr><td>Is there anything about the composition of the dataset or the way it was col- lected and preprocessed/cleaned/labeled that might impact future uses?</td><td>We filtered the dataset with the intent of creating a model useful for mathematical tasks with solely English text.</td></tr><tr><td>Are there tasks for which the dataset should not be used?</td><td>The dataset should not be used with the intent to cause harm or for models intended for the purposes of harm.</td></tr><tr><td colspan="2">DISTRIBUTION</td></tr><tr><td>Will the dataset be distributed to third parties outside of the entity on behalf of which the dataset was created?</td><td>We make the dataset publicly available for reproducibility,analysis,and other further downstream uses.</td></tr><tr><td>How will the dataset will be distributed?</td><td>We provide code to replicate the dataset, and release it via the Huggingface Hub.</td></tr><tr><td>When will the dataset be distributed?</td><td>The dataset is available immediately.</td></tr><tr><td>Will the dataset be distributed under a copyright or other intellectual prop- erty (IP) license,and/or under applicable terms of use (ToU)?</td><td>We do not relicense the dataset&#x27;s compo- nents,and do not impose our own use re- strictions.</td></tr><tr><td>Have any third parties imposed IP-based or other restrictions on the data associ- ated with the instances?</td><td>Not to our knowledge.</td></tr><tr><td>Do any export controls or other regula- tory restrictions apply to the dataset or to individual instances?</td><td>Not to our knowledge.</td></tr><tr><td>MAINTENANCE</td><td></td></tr><tr><td>Who will be supporting/hosting/main- taining the dataset?</td><td>The dataset will be hosted on the Hug- gingFace Hub and able to be recreated via code at https://github.com/ EleutherAI/math-lm. The dataset will not be updated post-release.</td></tr><tr><td>How can the owner/curator/manager of the dataset be contacted?</td><td> Via email at za2514@princeton.edu</td></tr><tr><td> Is there an erratum?</td><td>No.</td></tr><tr><td> Will the dataset be updated?</td><td>No.</td></tr><tr><td>If others want to extend/augment/build on/contribute to the dataset, is there a mechanism for them to do so?</td><td>No.</td></tr></table>
416
+
417
+ # F ADDITIONAL RESULTS
418
+
419
+ # F.1 PROOF AUTOFORMALIZATION
420
+
421
+ Table 11 shows additional results on Isabelle proof autoformalization, including the union of theorems closed by Sledgehammer and the given language model.
422
+
423
+ Table 11: Isabelle autoformalization. ∗We exclude the 11 examples used in the few-shot prompts. Pass $@ 1$ with greedy decoding.
424
+
425
+ <table><tr><td>Method</td><td>Autoformalization pass @1 miniF2F-valid*</td><td>miniF2F-test</td></tr><tr><td> Sledgehammer</td><td>14.72%</td><td>20.49%</td></tr><tr><td>Code Llama 7b</td><td>16.31%</td><td>17.62%</td></tr><tr><td>LLEMMA-7b</td><td>20.60%</td><td>22.13%</td></tr><tr><td>Code Llama 7b U Sledgehammer</td><td>20.17%</td><td>25.00%</td></tr><tr><td>LLEMMA-7b U Sledgehammer</td><td>25.97%</td><td>27.46%</td></tr></table>
426
+
427
+ # G SUPERVISED FINETUNING
428
+
429
+ A full exploration of finetuning applications for LLEMMA, such as instruction following (Ouyang et al., 2022; Wei et al., 2022), dialogue modeling (Thoppilan et al., 2022; Touvron et al., 2023; Collins et al., 2023), and reward modeling (Cobbe et al., 2021; Lightman et al., 2023) are outside the scope of this work. However, to establish that LLEMMA retains its advantage over other open models when finetuned, we conduct preliminary experiments finetuning LLEMMA-7B on MetaMathQA (Yu et al., 2023), a supervised dataset targeted at the MATH and GSM8k benchmarks. Results are shown in Table 12.
430
+
431
+ Table 12: Finetuning of various 7B base models on supervised mathematics datasets. All results with a Llama 2 initialization are copied from the literature (Luo et al., 2023; Yu et al., 2023). The LLEMMA 7B finetune is trained with identical hyperparameters to the models in Yu et al. (2023)
432
+
433
+ <table><tr><td>Initialization</td><td>Finetune Dataset</td><td>MATH</td><td>GSM8k</td></tr><tr><td>Llama 2 7B</td><td>WizardMath (Proprietary)</td><td>10.7%</td><td>54.9%</td></tr><tr><td>Llama 2 7B</td><td>MetaMathQA</td><td>19.4%</td><td>66.4%</td></tr><tr><td>LLEMMA 7B</td><td>MetaMathQA</td><td>25.2%</td><td>66.5%</td></tr><tr><td>Llama 2 70B</td><td>WizardMath (Proprietary)</td><td>22.7%</td><td>81.6%</td></tr><tr><td>Llama 2 70B</td><td>MetaMathQA</td><td>26.6%</td><td>82.3%</td></tr></table>
434
+
435
+ # H QUALITATIVE EXAMPLES
436
+
437
+ Dataset overlap. Figure 6 shows example false positives when checking $n$ -gram overlap with OpenWebMath documents for various $n$ . Figure 7 shows an example OpenWebMath document that has 30-gram overlap with a MATH problem, and LLEMMA-7b’s generated solution.
438
+
439
+ Task outputs. Figure 8 shows a generated proof in the informal2formal theorem proving task.
440
+
441
+ # OpenWebMath document
442
+
443
+ 2D affine transformations can be better represented using 2 by 2 matrices, since they are simply linear combinations of 2 variables. The advantage of this is that the matrices are associative under multiplication Also, GPUs and modern toolkits are optimised to work with this representation. As a result, a scale matrix is \begin{bmatrix} s_x & 0 \\ 0 & s_y \end{bmatrix}, and a rotation matrix is \begin{bmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{bmatrix}.
444
+
445
+ A translation matrix is simply \begin{bmatrix} 1 & \frac{t_x}{y} \\ \frac{t_y}{x} & 1 ...
446
+
447
+ # MATH problem
448
+
449
+ A rotation centered at the origin takes $\binom { 1 3 } { 0 }$ to $\left( { \begin{array} { c } { 5 } \\ { - 1 2 } \end{array} } \right) .$ Which vector does the rotation take $\binom { 0 } { 1 }$ to?
450
+
451
+ #
452
+
453
+ The rotation matrix must be of the form $\left( \sin \theta \frac { \ l - \sin \theta } { \sin \theta } \right)$ . Thus,...
454
+
455
+ # Hit
456
+
457
+ \cos \theta & -\sin \theta \\ \sin \theta & \cos
458
+
459
+ # OpenWebMath document
460
+
461
+ # Basic Probability
462
+
463
+ A number is selected at random from 1 through 100, inclusive. What is the probability that the number is a divisor of 50? Express your answer as a common fraction.
464
+
465
+ Apr 24, 2019
466
+
467
+ There are a 100 integers between 1-100, inclusive. Since 50 is \$\$2\*5^2\$\$, it has
468
+ \$\$(1+1) $( 1 + 2 ) = ( 2 )$ $( 3 ) = 6 5 5$ factors. Thus, the answer is
469
+ \$\$\frac{6} $\{ 1 0 0 \} =$ \boxed{\frac{3}{50}}.\$\$
470
+
471
+ # MATH problem
472
+
473
+ A number is selected at random from 1 through 100, inclusive. What is the probability that the number is a perfect square?
474
+
475
+ # Hit
476
+
477
+ A number is selected at random from 1 through 100, inclusive. What is the probability that the number is a
478
+
479
+ # OpenWebMath document
480
+
481
+ Fig. 2.
482
+
483
+ Use values of the most used medicinal plants in the Safi Province (Morocco).
484
+
485
+ It is also important to note that for the abovementioned medicinal plants, many other folk uses have been reported in different regions of Morocco. Furthermore, literature-based proof revealed that these species have proven a wide variety of biological and pharmacological activities (Table 4, Ref. [14, 17, 19, 20, 21, 23, 24, 26, 28, 30, 31, 34, 35, 36, 38, 39, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116]), which may confirm the different popular applications of ...
486
+
487
+ # Generated solution (LLEMMA 7b):
488
+
489
+ The first 100 positive integers are 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49, 50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78, 79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100. We can see that...
490
+
491
+ Figure 6: Data overlap: Example false positives using 10-gram match between MATH solutions and OpenWebMath documents (top), 20-gram match between MATH problems and OpenWebMath documents (middle), and 30-gram match between LLEMMA-7b’s generated solutions and OpenWebMath documents (bottom).
492
+
493
+ # OpenWebMath document
494
+
495
+ A triangle is formed with edges along the line \$y=\frac{2}{3}x+5\$, the \$x\$-axis, and the line $\$ 123,456$ . If the area of the triangle is less than $\$ 205$ , find the sum of all possible integral values of \$k\$.
496
+
497
+ Feb 28, 2018
498
+
499
+ Look at the graph, here...two triangles are possible : https://www.desmos.com/calculator/m6wnjpgldq The height of the triangles at any point will be formed by
500
+
501
+ $$
502
+ [ \begin{array} { l l l } { } & { ( 2 / 3 ) \textbf { x } + \textbf { 5 } } \end{array} ]
503
+ $$
504
+
505
+ And the bases will be $[ \mathrm { ~ \bf ~ x ~ } - \mathrm { ~ \bf ~ ( ~ - ~ } 7 . 5 ) ] = [ \mathrm { ~ \bf ~ x ~ } + 7 . 5 ]$ ${ \begin{array} { r l } & { { \mathrm { S o \ldots \ldots \ldots } } { \mathrm { ~ w e ~ { \ w a n t } ~ t o ~ { \ s o \bot } v e ~ { \ t n } { \mathrm { ~ { \Sigma } } } } } } \\ & { ( 1 / 2 ) { \mathrm { ~ { \Sigma } ~ } } [ { \mathrm { ~ { \Sigma } } } ( 2 / 3 ) { \mathrm { ~ x ~ { \Sigma } ~ } } + { \mathrm { ~ { \Sigma } ~ } } 5 { \mathrm { ~ { \Sigma } ~ } } ] { \mathrm { ~ { \Sigma } ~ } } [ { \mathrm { ~ { \bf ~ x } ~ } } + { \mathrm { ~ { \Sigma } ~ } } 7 \cdot 5 { \mathrm { ~ { \Sigma } ~ } } ] = 2 0 } \\ & { [ { \mathrm { ~ { \Sigma } ~ } } ( 2 / 3 ) { \mathrm { ~ x ~ { \Sigma } ~ } } + { \mathrm { ~ { \Sigma } ~ } } 5 { \mathrm { ~ { \Sigma } ~ } } ] [ { \mathrm { ~ { \bf ~ x } ~ } } + { \mathrm { ~ { \Sigma } ~ } } 7 \cdot 5 ] = 4 0 } \\ & { ( 2 / 3 ) { \mathrm { ~ x \Sigma \mathrm { { \Sigma } } } } 2 + { \mathrm { ~ { \Sigma } } } { \mathrm { ~ { \Sigma } } } { \mathrm { ~ { \Sigma } } } + { \mathrm { ~ { \Sigma } } } { \mathrm { ~ { \Sigma } } } { \mathrm { ~ { \Sigma } } } + { \mathrm { ~ { \Sigma } } } 3 7 \ldots = 0 } \\ & { ( 2 / 3 ) { \mathrm { ~ x \widehat { \mathrm { \Sigma } } } } 2 + { \mathrm { ~ { \Sigma } ~ } } 1 0 { \bf x } - { \mathrm { ~ { \Sigma } ~ } } 2 . 5 = 0 { \mathrm { ~ { \Sigma } ~ } } 0 } \end{array} }$
506
+
507
+ Using a little technology.....the max x value for the triangle formed above the $_ \textrm { x }$ axis will be $=$ .246
508
+
509
+ And the min x value for the triangle formed below the x axis will be = -15.246
510
+
511
+ With the given boundaries, the integer sums of all possible $_ \textrm { x }$ values of k giving triangles with an area $< ~ 2 0$ units^2 $=$
512
+
513
+ [ (-15) + (-14 ) + (-13) + ...+ ( -2) + ( - 1 ) + 0 ] = (15) (16) / 2 =
514
+ -120
515
+
516
+ Feb 28, 2018
517
+
518
+ MATH Problem: A triangle is formed with edges along the line $y = \textstyle { \frac { 2 } { 3 } } x + 5$ , the $x$ -axis, and the line $x = k$ . If the area of the triangle is less than 20, find the sum of all possible integral values of $k$ . Answer: -120
519
+
520
+ # Generated solution (LLEMMA $\mathbf { \Delta } ^ { 7 \mathbf { b } }$ ):
521
+
522
+ The triangle has vertices $( k , 0 )$ , $( 0 , 5 )$ , and $( k , \textstyle { \frac { 2 } { 3 } } k + 5 )$ . The base of the triangle has length $k$ , and the height of the triangle has length ${ \frac { 2 } { 3 } } k + 5$ . The area of the triangle is therefore
523
+
524
+ $$
525
+ A = { \frac { 1 } { 2 } } b h = { \frac { 1 } { 2 } } k ( { \frac { 2 } { 3 } } k + 5 ) = { \frac { 1 } { 3 } } k ^ { 2 } + { \frac { 5 } { 2 } } k .
526
+ $$
527
+
528
+ Since the area of the triangle is less than 20, we have
529
+
530
+ $$
531
+ \frac { 1 } { 3 } k ^ { 2 } + \frac { 5 } { 2 } k < 2 0 \Rightarrow \frac { 1 } { 6 } k ^ { 2 } + \frac { 5 } { 4 } k - 1 0 < 0 .
532
+ $$
533
+
534
+ This inequality is true if and only if with positive leading coefficient, it $\textstyle { \frac { 1 } { 6 } } k ^ { 2 } + { \frac { 5 } { 4 } } k - 1 0$ is positive. Since d only if its vertex $\textstyle { \frac { 1 } { 6 } } k ^ { 2 } + { \frac { 5 } { 4 } } k - 1 0$ is a quadratic The vertex of $\textstyle { \frac { 1 } { 6 } } k ^ { 2 } + { \frac { 5 } { 4 } } k - 1 0$ is $\bigl ( - { \frac { 1 0 } { 3 } } , - { \frac { 1 2 5 } { 1 8 } } \bigr )$ . Since $\begin{array} { l } { \displaystyle { - \frac { 1 0 } { 3 } < 0 } } \end{array}$ , we have that $\textstyle { \frac { 1 } { 6 } } k ^ { 2 } + { \frac { 5 } { 4 } } k - 1 0 > 0$ if and only if $k < - \frac { 1 0 } { 3 }$ . Therefore, the only possible integral values of $k$ are $k = 0 , 1 , 2 , 3 , 4$ . The sum of these values is $\boxed { 1 0 } .$ Final Answer: The final answer is 10.
535
+
536
+ Figure 7: Data overlap: Example OpenWebMath document that has a 30-gram overlap with the given MATH problem, and LLEMMA-7b’s generated solution.
537
+
538
+ ![](images/fa04da4d1e89f26e6ced90f8ce43ef3139709120585a0f57628e6cd1e7d38003.jpg)
539
+ Figure 8: Informal-to-formal proving. The model is given the problem, informal proof, and formal statement, following Jiang et al. (2023). It generates a formal proof (starting with proof -) containing Isabelle code, comments $( \star \ldots \star )$ ) that align the informal and formal proofs, and calls to an automated prover (shown as ${ < A T P > }$ ). The proof is from LLEMMA-7b with greedy decoding.
parse/test/4WnqRR915j/4WnqRR915j_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/4WnqRR915j/4WnqRR915j_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/4WnqRR915j/4WnqRR915j_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/8dkp41et6U/8dkp41et6U.md ADDED
@@ -0,0 +1,378 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LongLLMLingua: ACCELERATING AND ENHANCING LLMS IN LONG CONTEXT SCENARIOS VIA PROMPT COMPRESSION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ In long context scenarios, large language models (LLMs) face three main challenges: higher computational/financial cost, longer latency, and inferior performance. Some studies reveal that the performance of LLMs depends on both the density and the position of the key information (question relevant) in the input prompt. Inspired by these findings, we propose LongLLMLingua for prompt compression towards improving LLMs’ perception of the key information to simultaneously address the three challenges. We conduct evaluation on a wide range of long context scenarios including single-/multi-document QA, few-shot learning, summarization, synthetic tasks, and code completion. Experimental results show that LongLLMLingua compressed prompt can derive higher performance with much lower cost. The latency of the end-to-end system is also reduced. For example, on NaturalQuestions benchmark, LongLLMLingua gains a performance boost of up to $1 7 . 1 \%$ over the original prompt with ${ \sim } 4 \mathbf { x }$ fewer tokens as input to GPT-3.5-Turbo. It can drive cost savings of $\$ 28.5$ and $\$ 27.4$ per 1,000 samples from the LongBench and ZeroScrolls benchmark, respectively. Additionally, when compressing prompts of ${ \sim } 1 0 \mathrm { k }$ tokens at a compression rate of $2 \mathbf { X } { - } 1 0 \mathbf { X }$ , LongLLMLingua can speed up the end-to-end latency by $1 . 4 \mathrm { X } \mathrm { - } 3 . 8 \mathrm { X }$ .
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ ChatGPT and other large language models (LLMs) have revolutionized user-oriented language technologies and are serving as crucial components in more and more applications. Carefully designing prompts is necessary to achieve better performance in specific downstream tasks. The commonly used technologies such as In-Context Learning (ICL) (Dong et al., 2023), Retrieval Augment Generation (RAG) (Lewis et al., 2020), and Agent (Park et al., 2023) are driving prompts to be increasingly longer, even reaching thousands of tokens. Scenarios such as multi-document question answering, code completion, and document summarization also necessitate the processing of long contexts.
12
+
13
+ There are three main challenges when LLMs are used in long context scenarios: (1) The higher computational and financial cost required to run these models or to call APIs from companies providing LLM services. This can be a significant barrier for individuals or smaller organizations with limited resources. (2) The longer latency associated with LLMs, which can cause delays in generating responses or predictions and is particularly problematic in real-time scenarios where users expect quick and accurate responses. (3) The inferior performance caused by the extended window size of LLMs (Xiong et al., 2023), and the low density as well as the less sensitive position of the questionrelevant key information in the prompt. Figure 1a shows that LLMs’ performance in downstream tasks may decrease as the noisy information in the prompt increases (Shi et al., 2023). Moreover, the purple curve in Figure 1b indicates that LLMs’ ability to capture the relevant information depends on their positions in the prompt (Liu et al., 2023): they achieve the highest performance when relevant information occurs at the beginning or end of the input context, and significantly degrades if relevant information is located in the middle of long contexts.
14
+
15
+ Inspired by these observations, we propose LongLLMLingua to address the three challenges. Specifically, we use the advanced while efficient LLMLingua (Jiang et al., 2023a) as our backbone framework for prompt compression to address the first two challenges, i.e., reduce cost and latency. However, in the case of long contexts, the distribution of question-relevant key information in the prompt is generally sparse. Existing prompt compression methods like LLMLingua (Jiang et al., 2023a) and Selective-Context (Li, 2023) that do not consider the content of the question during compression may retain too much noisy information in the compressed results, leading to inferior performance. In this paper, LongLLMLingua is designed to enhance LLM’s perception of key information (relevant to the question) in the prompt, so that the third challenge of inferior performance in long context scenarios could be addressed. Figure 1b is an example. The underlying principle of LongLLMLingua is that small language models are inherently capable of capturing the distribution of key information relevant to a given question.
16
+
17
+ ![](images/66aebfbd651bc709db4af516e9ea49ed2c0cfe9ea12bdf6e391e8e17e5292cb5.jpg)
18
+ Figure 1: (a) LLMs’ performance in downstream tasks may decrease as the noisy information in the prompt increases. In this case, we keep $k$ most relevant documents/paragraphs based on the ground truth or LongLLMLingua $r _ { k }$ . A larger $k$ implies more noise introduced into the prompt. To improve the key information density in the prompt, we present question-aware coarse-to-fine compression. (b) LLMs’ ability to capture the relevant information depends on their positions in the prompt. To reduce information loss in the middle, we introduce a document reordering mechanism.
19
+
20
+ Our main contributions are five-fold: (1) We propose a question-aware coarse-to-fine compression method to improve the key information density in the prompt (Sec. 4.1); (2) We introduce a document reordering mechanism to reduce information loss in the middle. (Sec. 4.2); (3) We present dynamic compression ratios to bridge the coarse-grained compression and fine-grained compression for adaptive granular control (Sec. 4.3); (4) We propose a post-compression subsequence recovery strategy to improve the integrity of the key information (4.4). (5) We evaluate LongLLMLingua on three benchmarks, i.e., NaturalQuestions (Liu et al., 2023), LongBench (Bai et al., 2023), and ZeroSCROLLS (Shaham et al., 2023). Experimental results demonstrate that compared with original prompts, LongLLMLingua compressed prompts can achieve higher performance with much lower costs. The latency of the end-to-end system is also reduced.
21
+
22
+ # 2 PROBLEM FORMULATION
23
+
24
+ Following LLMLingua (Jiang et al., 2023a), we use $\mathbf { x } = ( \mathbf { x } ^ { \mathrm { { i n s } } } , \mathbf { x } _ { 1 } ^ { \mathrm { { d o c } } } , \cdot \cdot \cdot , \mathbf { x } _ { K } ^ { \mathrm { { d o c } } } , \mathbf { x } ^ { \mathrm { { q u e } } } )$ to represent a prompt, which composed of the instruction $\mathbf { x } ^ { \mathrm { i n s } }$ , $K$ documents $\mathbf { x } _ { i } ^ { \mathrm { { d o c } } }$ , and the question $\mathbf { x } ^ { \mathrm { q u e } }$ . In fact, the prompt can be modified according to specific application scenarios. For example, $\mathbf { x } ^ { \mathrm { i n s } }$ at the beginning can be removed, $\mathbf { x } ^ { \mathrm { q u e } }$ can be any requirement specified by users, and $( \mathbf { x } _ { 1 } ^ { \mathrm { d o c } } , \cdot \cdot \cdot , \mathbf { x } _ { K } ^ { \mathrm { d o c } } )$ can be any additional materials that users append to the prompt to get a better response from LLMs for $\mathbf { x } ^ { \mathrm { q u e } }$ . The objective of a prompt compression system can be formulated as:
25
+
26
+ $$
27
+ \operatorname* { m i n } _ { \widetilde { \mathbf { x } } } D \left( \mathbf { y } , \widetilde { \mathbf { y } } \right) + \lambda \| \widetilde { \mathbf { x } } \| _ { 0 } ,
28
+ $$
29
+
30
+ where $\widetilde { \mathbf { x } }$ denotes the compressed prompt and is a token-level subsequence of $\mathbf { x }$ . $\mathbf { y }$ represents the eground-truth output texts with $\mathbf { x }$ as the input and $\widetilde { \mathbf { y } }$ represent the LLM-generated results derived by $\widetilde { \mathbf { x } }$ . $D$ eis a distance measure between two distributions, such as KL divergence. We expect the edistribution of $\mathbf { y }$ and $\widetilde { \mathbf { y } }$ to be as similar as possible. $\lambda$ is a trade-off hyper-parameter regarding the ecompression ratio. In this work, we additionally incorporate an operation space of permutation over the $K$ documents $( \mathbf { x } _ { 1 } ^ { \mathrm { d o c } } , \cdot \cdot \cdot , \mathbf { x } _ { K } ^ { \mathrm { d o c } } )$ for joint optimization.
31
+
32
+ ![](images/a9fd51ee6948e7fc9201c2549863077e51526708087f9154ddefa422e1738277.jpg)
33
+ Figure 2: Framework of LongLLMLingua. Gray Italic content: As in LLMLingua.
34
+
35
+ # 3 PRELIMINARY: LLMLINGUA
36
+
37
+ LLMLingua (Jiang et al., 2023a) uses a small language model $\mathcal { M } _ { S }$ to calculate the perplexity of each token in the original prompt and then removes tokens with lower perplexities. The rationale behind this approach is that tokens with lower perplexities contribute less to the overall entropy gain of the language model, so removing them will have a relatively minor impact on the LLM’s comprehension of the context. LLMLiungua consists of three components: a budget controller, an iterative token-level prompt compression algorithm, and a distribution alignment mechanism, as shown by Italic texts in Figure 2. The budget controller allocates different compression ratios to the various components in the original prompt (i.e., instruction, demonstrations, question), and performs coarsegrained compression at the demonstration level. The intermediate results are divided into segments and the token-level compression is then performed segment by segment, with the perplexity of each token conditioned on previous compressed segments calculated by $\mathcal { M } _ { S }$ . For distribution alignment, it performs instruction tuning on $\mathcal { M } _ { S }$ with the data generated by the target LLM to narrow the gap between the distribution of LLM and that of $\mathcal { M } _ { S }$ used for prompt compression.
38
+
39
+ # 4 LONGLLMLINGUA
40
+
41
+ LongLLMLingua is developed upon the framework of LLMLingua towards prompt compression in long context scenarios. The primary challenge in long context scenarios is how to enhance LLM’s perception of key information relevant to the question in the prompt. LongLLMLingua addresses this challenge from three perspectives, and further applies a subsequence recovery strategy to improve the accuracy and reliability of the information provided to users. We elaborate on each component in this section.
42
+
43
+ # 4.1 HOW TO IMPROVE KEY INFORMATION DENSITY IN THE PROMPT?
44
+
45
+ out a metric Question-Aware Coarse-Grained Compression In coarse-grained compression, we aim to figure $r _ { k }$ to evaluate the importance of each document $\mathbf { x } _ { k } ^ { \mathrm { d o c } } = \{ x _ { k , i } ^ { \mathrm { { \bar { d o c } } } } \} _ { i = 1 } ^ { N _ { k } }$ , where $N _ { k }$ is the number of tokens in $\mathbf { x } _ { k } ^ { \mathrm { { d o c } } }$ . We only keep $\mathbf { x } _ { k } ^ { \mathrm { { d o c } } }$ with higher $r _ { k }$ as the intermediate compressed results.
46
+
47
+ LLMLingua uses document-level perplexity to represent the importance of documents: $r _ { k } = { }$ $1 / N _ { k } \textstyle \sum _ { i } ^ { \bar { N } _ { k } } p ( x _ { k , i } ^ { \mathrm { d o c } } ) \log p ( x _ { k , i } ^ { \mathrm { d o c } } ) , k \in \{ 1 , 2 , \cdots , K \}$ . Although the retained documents typically contain a lot of information, they are irrelevant to the question and instead become noise, reducing key information density in the compressed results and bringing difficulties for LLM to output correct answers. As shown in Figure 3a, the recall $@ 1 6$ of LLMLingua only reaches $50 \%$ , indicating its incompetence in retaining key information during compression.
48
+
49
+ Retrieval-based methods are also feasible here. We can use $\mathbf { x } ^ { \mathrm { q u e } }$ to retrieve the most relevant documents among $( \mathbf { x } _ { 1 } ^ { \mathrm { d o c } } , \cdot \cdot \cdot , \mathbf { x } _ { K } ^ { \mathrm { d o c } } )$ as the compressed results. However, these methods struggle to distinguish question-related fine-grained semantic information. Some documents with key information may be discarded during retrieval. As shown in Figure 3a, embedding-based methods such as Sentence BERT and OpenAI Embedding only achieve ${ \sim } 7 5 \%$ accuracy in recall $\textcircled { \alpha } 5$ , which implies that the final accuracy upper bound of LLMs with $4 \mathbf { x }$ compression is only $7 5 \%$ .
50
+
51
+ ![](images/720bed68970cc95cb97591bce0de674ae933533791f64e08c09d9c92ad9062a8.jpg)
52
+ Figure 3: (a) Comparison of recall on NaturalQuestions Multi-documemnt QA dataset. (b) Comparison between perplexities and contrastive perplexities of tokens in the prompt from Multi-documemnt QA dataset. The document with the ground truth is located on the left side of the dashed line.
53
+
54
+ One approach to improve key information density in the compressed results is to calculate documentlevel perplexity conditioned on the question $\mathbf { x } ^ { \mathrm { q u e } }$ . However, this method may not be effective because documents often contain a significant amount of irrelevant information. Even when conditioned on $\mathbf { x } ^ { \mathrm { q u e } }$ , the perplexity scores computed for entire documents may not be sufficiently distinct, rendering them an inadequate metric for document-level compression. Therefore, we propose to use the perplexity of the question $\mathbf { x } ^ { \mathrm { q u e } }$ conditioned on different contexts $\mathbf { x } _ { k } ^ { \mathrm { { d o c } } }$ to represent the association between them. We append a restrictive statement $\mathbf { x } ^ { \mathrm { r e s t r i c t { 1 } } }$ after $\mathbf { x } ^ { \mathrm { q u e } }$ to strengthen the interconnection of $\mathbf { x } ^ { \mathrm { q u e } }$ and $\mathbf { x } _ { k } ^ { \mathrm { { d o c } } }$ . It can be regarded as a regularization term that mitigates the impact of hallucinations. This can be formulated as:
55
+
56
+ $$
57
+ r _ { k } = \frac { 1 } { N _ { c } } \sum _ { i } ^ { N _ { c } } p ( x _ { i } ^ { \mathrm { q u e , r e s t i c t } } | \mathbf { x } _ { k } ^ { \mathrm { d o c } } ) \log p ( x _ { i } ^ { \mathrm { q u e , r e s t r i c t } } | \mathbf { x } _ { k } ^ { \mathrm { d o c } } ) , k \in \{ 1 , 2 , \cdots , K \} ,
58
+ $$
59
+
60
+ where $x _ { i } ^ { \mathrm { q u e , r e s t r i c t } }$ is the $i$ -th token in the concatenated sequence of $\mathbf { x } ^ { \mathrm { q u e } }$ and $\mathbf { x } ^ { \mathrm { r e s t r i c t } }$ and $N _ { c }$ in the number of tokens.
61
+
62
+ Figure 3a demonstrates that our coarse-level compression approach achieves the highest recall with different numbers of retained documents, suggesting that it preserves the most key information from the documents $( \mathbf { x } _ { 1 } ^ { \mathrm { d o c } } , \cdot \cdot \cdot , \mathbf { x } _ { K } ^ { \mathrm { d o c } } )$ in the compressed results.
63
+
64
+ Question-Aware Fine-Grained Compression In fine-grained compression, we assess the importance of each token in the instruction $\mathbf { x } ^ { \mathrm { i n s } }$ , the question $\mathbf { x } ^ { \mathrm { q u e } }$ , and $K ^ { \prime }$ documents $\{ \mathbf { x } _ { i } ^ { \mathrm { d o c } } \} _ { i = 1 } ^ { K ^ { \prime } }$ retained after coarse-grained compression. We incorporate the iterative compression mechanism following LLMLingua and directly calculate token perplexities to compress $\bar { \mathbf { x } } ^ { \mathrm { i n s } }$ and $\mathbf { x } ^ { \mathrm { q u e } }$ . In this section, we invesquestion e how to make the fine-grained token-level compression over , so that the compressed results could contain more question-r $\{ \mathbf { x } _ { k } ^ { \mathrm { d o c } } \} _ { k = 1 } ^ { K ^ { \prime } }$ aware of the information. $\mathbf { x } ^ { \mathrm { q u e } }$
65
+
66
+ A straightforward solution for the awareness of $\mathbf { x } ^ { \mathrm { q u e } }$ is to simply concatenate it at the beginning of the whole context. However, this will result in low perplexities of relevant tokens in the context following the condition, further reducing their differentiation from general tokens. In this paper, we propose contrastive perplexity, i.e., the distribution shift caused by the condition of the question, to represent the association between the token and the question. The contrastive perplexity based importance metric $s _ { i }$ for each token $x _ { i }$ in $\{ \mathbf { x } _ { k } ^ { \mathrm { d o c } } \} _ { k = 1 } ^ { K ^ { \prime } }$ can be formulated as:
67
+
68
+ $$
69
+ s _ { i } = \mathrm { p e r p l e x i t y } ( x _ { i } | \boldsymbol { x } _ { < i } ) - \mathrm { p e r p l e x i t y } ( x _ { i } | \boldsymbol { x } ^ { \mathrm { q u e } } , \boldsymbol { x } _ { < i } ) .
70
+ $$
71
+
72
+ Figure 3b illustrates the difference between perplexities and contrastive perplexities. We can see that tokens of high perplexities are widely distributed in all documents. However, tokens with high contrastive perplexities concentrate more on the left side of the dashed line, which corresponds to the document that contains the answer to the question. This suggests that the proposed contrastive perplexity can better distinguish tokens relevant to the question, thus improving the key information density in the compressed results.
73
+
74
+ # 4.2 HOW TO REDUCE INFORMATION LOSS IN THE MIDDLE?
75
+
76
+ As demonstrated in Figure 1b, LLM achieves the highest performance when relevant information occurs at the beginning and significantly degrades if relevant information is located in the middle of long contexts. After the coarse-grained compression, we have obtained a set of documents $\{ \mathbf { x } _ { k } ^ { \mathrm { d o c } } \} _ { k = 1 } ^ { K ^ { \prime } }$ with their corresponding importance scores $\{ r _ { k } \} _ { k = 1 } ^ { K ^ { \prime } }$ indicating their association with the question $\mathbf { x } ^ { \mathrm { q u e } }$ . Therefore, we reorder documents using their importance scores to better leverage LLMs’ information perception difference in positions:
77
+
78
+ $$
79
+ ( \mathbf { x } ^ { \mathrm { i n s } } , \mathbf { x } _ { 1 } ^ { \mathrm { d o c } } , \cdot \cdot \cdot , \mathbf { x } _ { K ^ { \prime } } ^ { \mathrm { d o c } } , \mathbf { x } ^ { \mathrm { q u e } } ) \xrightarrow { r _ { k } } ( \mathbf { x } ^ { \mathrm { i n s } } , \mathbf { x } _ { r 1 } ^ { \mathrm { d o c } } , \cdot \cdot \cdot , \mathbf { x } _ { r K ^ { \prime } } ^ { \mathrm { d o c } } , \mathbf { x } ^ { \mathrm { q u e } } )
80
+ $$
81
+
82
+ # 4.3 HOW TO ACHIEVE ADAPTIVE GRANULAR CONTROL DURING COMPRESSION?
83
+
84
+ In fine-grained compression, LLMLingua applies the save compression ratio over all documents obtained from coarse-grained compression. However, the key information density of different documents is different. The more relevant to the question a document is, the more budget (i.e., lower compression ratio) we should allocate to it. Therefore, we bridge coarse-grained compression to fine-grained compression and use the importance scores $\{ r _ { k } \} _ { k = 1 } ^ { \bar { K ^ { \prime } } }$ obtained from coarse-grained compression to guide the budget allocation in fine-grained compression. In this way, we can achieve adaptive granular control on the whole.
85
+
86
+ Specifically, we first determine the initial budget for the retained documents $\tau ^ { \mathrm { d o c } }$ 2 using the budget controller of LLMLingua. During fine-grained compression, we follow the iterative token-level compression algorithm in LLMLingua but dynamically assign the compression budget $\cdot$ to each document $\mathbf { x } _ { k } ^ { \mathrm { { d o c } } }$ according to the ranking index $I ( r _ { k } )$ (e.g., 0, 1) of its importance score from the coarse-grained compression. In this paper, we employ a linear scheduler for the adaptive allocation. Budget of each token $x _ { i }$ can be formulated as:
87
+
88
+ $$
89
+ \begin{array} { r l } & { \tau _ { i } = \tau _ { k } ^ { \mathrm { d o c } } , } \\ & { \tau _ { k } ^ { \mathrm { d o c } } = \operatorname* { m a x } ( \operatorname* { m i n } ( ( 1 - \frac { 2 I ( r _ { k } ) } { K ^ { \prime } } ) \delta \tau + \tau ^ { \mathrm { d o c } } , 0 ) , 1 ) , } \end{array}
90
+ $$
91
+
92
+ where $i$ and $k$ is the index of token and document, $K ^ { \prime }$ denotes the number of documents, and $\delta \tau$ is a hyper-parameter that controls the overall budget for dynamic allocation.
93
+
94
+ # 4.4 HOW TO IMPROVE THE INTEGRITY OF KEY INFORMATION?
95
+
96
+ Certain tokens of key entities may be discarded during the fine-grained token-wise compression. For example, the time entity “2009” in the original prompt might be compressed to “209” and the name entity “Wilhelm Conrad Rontgen” might be compressed to “Wilhelmgen”. This can cause problems ¨ for fact-based tasks like document QA, where language models tend to replicate information from the prompt, as shown in Figure 4.
97
+
98
+ To improve the accuracy and reliability of the information provided to users, we propose a subsequence recovery method to restore the original content from LLMs’ responses. This method relies on the subsequence relationship among tokens in the original prompt, compressed prompt, and LLMs’ response. The overall procedure includes: i) Iterate through tokens $y _ { l }$ in LLMs’ response and select the longest substring $\bar { \tilde { y } } _ { \mathrm { k e y } , l } = \{ y _ { l } , y _ { l + 1 } , . . . , y _ { r } \}$ that appears in the compressed prompt $\widetilde { \pmb x }$ . ii) Find ethe maximum common shortest subsequence $\mathbf { \bar { \mathbf { x } } } _ { i , j } ~ { = } ~ \bar { \left\{ \mathbf { \bar { \mathbf { \Phi } } } ( { \bf { x } } _ { i } , { \bf { x } } _ { i + 1 } , . . . , { \bf { x } } _ { j } \right\} }$ ein the original prompt $_ { \textbf { \em x } }$ , corresponding to the representation $\widetilde { \boldsymbol { y } } _ { \mathrm { k e y } , l }$ in the original prompt (accelerated using prefix trees or esequence automata). iii) Replace the matched tokens $\widetilde { \boldsymbol { y } } _ { \mathrm { k e y } , l }$ in LLMs’ response with the corresponding subsequence $\boldsymbol { x } _ { i , j }$ efrom the original prompt. For more details, please refer to Algorithm 1.
99
+
100
+ <table><tr><td>Document [1](Title: List of Nobel laureates in Physics)The first Nobel Prize in Physics was awarded in 1901to{Wilhelm Conrad Rontgen}{Wilhelm Con rad Ro nt gen}, of Germany,... Original Prompt</td><td>Document [1](Title: List of Nobelates in Physics) The first Nobel1 {Wilhelmgen}{Wilhelm gen}, of, who received,.. Compressed Prompt</td><td>{Wilelmgen} {Wilhelm gen} LLMs&#x27; Response</td></tr></table>
101
+
102
+ # 5 EXPERIMENTS
103
+
104
+ Here, we investigate: (1) How effective is LongLLMLingua? (2) How efficient is LongLLMLingua?
105
+
106
+ Implementation details In this paper, we use GPT-3.5-Turbo- $. 0 6 1 3 ^ { 3 }$ and LongChat-13B-16k as the target LLMs, both accessible via OpenAI4 and HuggingFace5. To ensure stable and reproducible results, we employ greedy decoding and set the temperature to 0 in all experiments. For the small language models used for compression, we apply LLaMA-2-7B-Chat6, which has been aligned by supervised fine-tuning and RLHF. We implement our approach with PyTorch 1.13.1 and HuggingFace Transformers. We set up hyperparameters following LLMLingua except for the segment size used in iterative token-level compression set to 200 here. More details are provided in Appendix C.
107
+
108
+ Dataset & evaluation metric We use NaturalQuestions for the multi-document QA task, and use LongBench and ZeroSCROLLS for general long context scenarios. We also test on multi-hop QA tasks using MuSiQue dataset (Trivedi et al., 2022), and long dependency QA tasks using LooGLE benchmark (Li et al., 2023b). Please refer to Appendix D for more details on datasets.
109
+
110
+ (i) NaturalQuestions (Liu et al., 2023): This benchmark is similar to the retrieval-augmented generation setup in commercial search and question-answering scenarios like Bing Chat. Specifically, each question has 20 related documents in the original prompt. One of them contains the correct answer and there are five different ground truth document position settings in the prompt: 1st, 5th, 10th, 15th, and 20th. Following Liu et al. (2023), we use accuracy as the evaluation metric.
111
+
112
+ (ii) LongBench (Bai et al., 2023): This benchmark consists of six task types: single-document QA, multi-document QA, summarization, few-shot learning, code completion, and synthetic tasks. We used the English portion that covers 16 datasets for evaluation. We use the metrics and scripts provided along with the benchmark for evaluation.
113
+
114
+ (iii) ZeroSCROLLS (Shaham et al., 2023): This benchmark consists of four task types: summarization, QA, sentiment classification, and reordering, covering 10 datasets. We used the validation set for evaluation. We use the provided metrics and scripts for evaluation.
115
+
116
+ Baselines We include two sets of baselines in following experiments:
117
+
118
+ (i) Retrieval-based Methods. We measure the association between the question and the documents in the prompt using five SoTA retrieval methods: BM25, Gzip (Jiang et al., 2023b), SentenceBERT (Reimers & Gurevych, 2019), OpenAI Embedding, and the important metric $r _ { k }$ used in LongLLMLingua coarse-grained compression. We discard sentences or paragraphs with low association until the compression constraint is met while keeping the original document order unchanged.
119
+
120
+ Table 1: Performance of different methods with different compression ratios on NaturalQuestions (20 documents) (Liu et al., 2023). Reorder: we reorder the documents with relevance metrics of different baselines as our document reordering strategy described in Sec. 4.2. In the case of OpenAI, it corresponds to LongContextReorder in the LangChain framework (Chase, 2022). For results reported under 1st to 20th, we do not use the reordering strategy for all methods.
121
+
122
+ <table><tr><td rowspan="2">Methods</td><td rowspan="2"></td><td colspan="5">t</td><td></td><td colspan="3"></td><td></td><td colspan="2"></td><td colspan="2"></td></tr><tr><td>1st</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="10">2x constraint</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Retrieval-based Methods</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>BM25</td><td></td><td>53.749.347.949.946.9</td><td></td><td></td><td>50.3</td><td></td><td>50.944.944.1 42.9 43.2</td><td></td><td></td><td></td><td>46.0</td><td>1,545</td><td>1.9x</td><td>2.1</td><td>1.9x</td></tr><tr><td>Gzip</td><td></td><td>64.663.8 60.5 58.3 57.3</td><td></td><td></td><td></td><td>64.4</td><td>61.9 55.752.7 50.8 50.9</td><td></td><td></td><td></td><td>59.3</td><td>1,567</td><td>1.9x</td><td>2.1</td><td>1.9x</td></tr><tr><td>SBERT</td><td></td><td>72.5 67.963.365.0 66.2</td><td></td><td></td><td></td><td>68.7</td><td>65.8 57.5 54.9 53.4 55.7</td><td></td><td></td><td></td><td>61.4</td><td>1,549</td><td>1.9x</td><td>2.2</td><td>1.9x</td></tr><tr><td>OpenAI</td><td></td><td>73.0 65.666.5 65.4 65.5</td><td></td><td></td><td></td><td>69.9</td><td>65.9 57.5 56.2 54.2 55.7</td><td></td><td></td><td></td><td>61.7</td><td>1,550</td><td>1.9x</td><td>4.9</td><td>0.8x</td></tr><tr><td>LongLLMLingua rk73.967.7 68.766.0 65.6</td><td></td><td></td><td></td><td></td><td></td><td>74.3</td><td>68.5 59.1 56.8 55.3 56.9</td><td></td><td></td><td></td><td>65.2</td><td>1,548</td><td>1.9x</td><td>2.3</td><td>1.8x</td></tr><tr><td colspan="10">Compression-based Methods</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Selective-Context</td><td></td><td>45.4 39.0 33.833.5 41.5</td><td></td><td></td><td></td><td></td><td>53.2 26.325.424.2 33.3</td><td></td><td></td><td></td><td>1</td><td></td><td>1,4782.0x</td><td>7.4</td><td>0.6x</td></tr><tr><td>LLMLingua</td><td></td><td>39.739.540.437.1 42.3</td><td></td><td></td><td>41.5</td><td></td><td>38.7 37.3 35.7 34.1 37.5</td><td></td><td></td><td></td><td>37.1</td><td>1,410</td><td>2.1x</td><td>2.8</td><td>1.5x</td></tr><tr><td> LongLLMLingua</td><td></td><td></td><td></td><td></td><td></td><td>76.2</td><td></td><td></td><td></td><td></td><td>66.1</td><td>1,429</td><td>2.1x</td><td>2.9</td><td>1.4x</td></tr><tr><td colspan="10">77.2 72.9 70.8 70.5 70.6 68.7 59.4 57.3 55.9 58.4</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="10">4x constraint</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Retrieval-based Methods BM25</td><td></td><td>40.638.6 38.2 37.4 36.6</td><td></td><td></td><td>36.3</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>2.7x</td></tr><tr><td>Gzip</td><td></td><td></td><td></td><td></td><td></td><td></td><td>39.537.5 36.8 36.4 35.5</td><td></td><td></td><td></td><td>37.7</td><td>798</td><td>3.7x</td><td>1.5</td><td>2.7x</td></tr><tr><td>SBERT</td><td></td><td>63.1 61.0 59.861.1 60.1</td><td></td><td></td><td></td><td>62.3</td><td>57.652.951.050.150.4</td><td></td><td></td><td></td><td>57.2</td><td>824</td><td>3.6x</td><td>1.5</td><td>2.5x</td></tr><tr><td>OpenAI</td><td></td><td>66.961.1 59.0 61.2 60.3</td><td></td><td></td><td></td><td>64.4 63.7</td><td>61.2 56.0 55.1 54.4 55.0</td><td>62.656.6 55.1 53.9 55.0</td><td></td><td></td><td>59.1</td><td>808</td><td>3.6x</td><td>1.6</td><td>1.0x</td></tr><tr><td></td><td></td><td>63.8 64.6 65.4 64.1 63.7</td><td></td><td></td><td></td><td>71.5</td><td>67.8 59.457.7 57.7 58.6</td><td></td><td></td><td></td><td>58.8 64.0</td><td>804 807</td><td>3.7x 3.7x</td><td>4.3 1.7</td><td>2.4x</td></tr><tr><td colspan="10">LongLLMLingua rk71.170.769.368.7 68.5</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Compression-based Methods</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Selective-Context LLMLingua</td><td>31.419.524.724.1 43.8</td><td></td><td></td><td></td><td></td><td>1 27.0</td><td>38.217.2 15.916.0 27.3 32.1 30.8 29.9 28.9 32.4</td><td></td><td></td><td></td><td>1 30.5</td><td>791 775</td><td>3.7x 3.8x</td><td>6.8 1.8</td><td>0.6x 2.2x</td></tr><tr><td> LongLLMLingua</td><td>25.527.523.526.530.0</td><td></td><td></td><td></td><td></td><td>75.5</td><td>68.7 60.5 59.3 58.3 61.3</td><td></td><td></td><td></td><td></td><td>748</td><td>3.9x</td><td>2.1</td><td>2.0x</td></tr><tr><td></td><td>75.0 71.8 71.2 71.2 74.7</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>66.7</td><td></td><td></td><td></td><td></td></tr><tr><td>Original Prompt Zero-shot</td><td>[75.7 57.3 54.1 55.4 63.1</td><td></td><td>56.1</td><td></td><td></td><td>1</td><td>68.657.4 55.352.5 55.0</td><td>35.0</td><td></td><td></td><td>-</td><td>2,946 15</td><td>1 196x |</td><td>4.1 1.1</td><td>- 3.7x</td></tr></table>
123
+
124
+ (ii) Compression-based Methods. We compare our approach with two state-of-art methods for prompt compression, i.e., Selective Context (Li, 2023) and LLMLingua (Jiang et al., 2023a). Both methods employ LLaMA-2-7B-Chat as the small language model for compression. In LLMLingua, a coarse-to-fine approach is used to handle constraints of compression ratio: the original prompt is first compressed to $k$ times the constraint at a coarse level, where $k$ is the granular control coefficient; token-level is then performed to reach the overall constraint. Our method follows the same coarse-to-fine logic to achieve the constraint.
125
+
126
+ Main results Table 1 and 2 present the performance of various methods under different compression constraints. There are multiple observations and conclusions: (1) Our LongLLMLingua achieves the best performance across different tasks and constraints of compression ratios. Compared to the original prompt, our compressed prompt can derive higher performance with much lower cost. For example, LongLLMLingua gains a performance boost of $1 7 . 1 \%$ on NaturalQuestions with the ground-truth document at the 10th position, while the number of tokens input to GPT3.5-Turbo is ${ \sim } 4 \mathbf { x }$ less. (2) Compression-based methods like Selective Context (Li, 2023) and LLMLingua (Jiang et al., 2023a) perform poorly on most tasks, especially those with abundant irrelevant information in the original prompt. This is due to their pure information entropy based compression mechanism, which includes too much noise in the compressed results and even leads to performance worse than the zero-shot setting, e.g., on NaturalQuestions. (3) Retrieval-based methods work well with low compression rates. However, their performance declines as the compression progresses, e.g., $2 x 4 x$ ; 3000 tokens $\to 2 0 0 0$ tokens. This may be caused by the decreased recall. Figure 3a is the illustration of cases on NaturalQuestions. (4) LongLLMLingua as well as our coarse-grained compression metric $r _ { k }$ only is much more robust than all other baselines under different tasks and compression constraints. With the increase of the compression rate, e.g., $2 x 4 x$ , LongLLMLingua even achieves a little performance gain. We mainly owe this to the question-aware coarse-to-fine compression, which can better figure out the key information and reach a higher key information density with a higher compression rate. (5) The proposed reordering method helps in not only our approach but also other baselines as shown in Table 1, well demonstrating its effectiveness.
127
+
128
+ Table 2: Performance of different methods under different compression ratios on LongBench (Bai et al., 2023) and ZeroSCROLLS (Shaham et al., 2023) using GPT-3.5-Turbo. Considering the dataset structure, we do not use the reordering strategy here.
129
+
130
+ <table><tr><td rowspan="2">Methods</td><td colspan="9">SinglDoc MuoSFeeesS</td><td rowspan="2"></td><td colspan="3"></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="10">3,000 tokens constraint</td><td></td><td></td><td></td><td></td></tr><tr><td>Retrieval-based Methods BM25</td><td>32.3</td><td>34.3</td><td>25.3</td><td>57.9</td><td>45.1</td><td>48.940.6</td><td>3,417</td><td>3x</td><td>7.5(2.1x)</td><td>19.8</td><td>3,379</td><td>3x</td><td>5.5(2.2x)</td></tr><tr><td>SBERT</td><td>35.3</td><td>37.4</td><td>26.7</td><td>63.4</td><td>51.0</td><td>34.541.4</td><td>3,399</td><td>3x</td><td>7.7(2.0x)</td><td>24.03,340</td><td></td><td>3x</td><td>5.9(2.1x)</td></tr><tr><td>OpenAI</td><td>34.5</td><td>38.6</td><td>26.8</td><td>63.4</td><td>49.6</td><td>37.641.7</td><td>3,421</td><td>3x</td><td>13.3(1.2x)</td><td>22.4</td><td>3.362</td><td>3x</td><td>11.7(1.0x)</td></tr><tr><td>LongLLMLingua rk</td><td>37.6</td><td>42.9</td><td>26.9</td><td>68.2</td><td>49.9</td><td>53.446.5</td><td>3,424</td><td>3x</td><td>8.2(1.9x)</td><td>29.3</td><td>3,350</td><td>3x</td><td>6.2(2.0x)</td></tr><tr><td colspan="10">Compression-basedMethods</td><td></td><td></td><td></td><td></td></tr><tr><td>Selective-Context</td><td>23.3</td><td>39.2</td><td>25.0</td><td>23.8</td><td>27.5</td><td>53.132.03,328</td><td></td><td></td><td>3x50.6(0.3x)|20.7</td><td></td><td>3,460</td><td>3x</td><td>54.2(0.2x)</td></tr><tr><td>LLMLingua</td><td>31.8</td><td>37.5</td><td>26.2</td><td>67.2</td><td>8.3</td><td></td><td>53.237.43,421</td><td>3x</td><td>9.2(1.7x)</td><td>30.7</td><td>3,366</td><td>3x</td><td>7.4(1.7x)</td></tr><tr><td> LongLLMLingua</td><td>40.7</td><td>46.2</td><td>27.2</td><td>70.6</td><td>53.0</td><td>55.2 48.8</td><td>3,283</td><td>3x</td><td>8.0(1.6x)32.83.412</td><td></td><td></td><td>3x</td><td>8.2(1.5x)</td></tr><tr><td colspan="10">2,000 tokens constraint</td><td colspan="7"></td></tr><tr><td colspan="10"></td><td colspan="7"></td></tr><tr><td>Retrieval-based Methods BM25</td><td>30.1</td><td>29.4</td><td>21.2</td><td>19.5</td><td>12.4</td><td>29.1 23.6</td><td>1,985</td><td>5x</td><td>4.6(3.4x)</td><td></td><td>20.1</td><td>1,799</td><td>5x</td><td>3.8(3.2x)</td></tr><tr><td>SBERT</td><td>33.8</td><td>35.9</td><td>25.9</td><td>23.5</td><td>18.0</td><td>17.825.8</td><td></td><td>1,947</td><td>5x</td><td>4.8(3.4x)</td><td>20.5</td><td>1,773</td><td>6x</td><td>4.1(3.0x)</td></tr><tr><td>OpenAI</td><td>34.3</td><td>36.3</td><td>24.7</td><td>32.4</td><td>26.3</td><td>24.829.8</td><td></td><td>1,991</td><td>5x</td><td>10.4(1.5x)</td><td>20.6</td><td>1,784</td><td>5x</td><td>9.9(1.2x)</td></tr><tr><td>LongLLMLingua rk</td><td>37.8</td><td>41.7</td><td>26.9</td><td>66.3</td><td>53.0</td><td>52.446.3</td><td></td><td>1,960</td><td>5x</td><td>4.7(3.3x)</td><td>24.9</td><td>1,771</td><td>6x</td><td>10.4(1.2x)</td></tr><tr><td colspan="10">Compression-based Methods</td><td colspan="7"></td></tr><tr><td>Selective-Context</td><td></td><td></td><td></td><td>15.7</td><td>8.4</td><td>49.224.8</td><td></td><td>1,925</td><td></td><td></td><td></td><td></td><td></td><td>47.5(0.3x)</td></tr><tr><td>LLMLingua</td><td>16.2 22.4</td><td>34.8 32.1</td><td>24.4 24.5</td><td>61.2</td><td>10.4</td><td>56.834.6</td><td></td><td>1,950</td><td>5x</td><td>5x47.1(0.3x)|19.4 5.9(2.6x)</td><td>27.2</td><td>1,865 1,862</td><td>5x 5x</td><td>4.8(2.5x)</td></tr><tr><td> LongLLMLingua</td><td>39.0</td><td>42.2</td><td>27.4</td><td>69.3</td><td>53.8</td><td>56.6 48.01,809</td><td></td><td></td><td>6x</td><td>6.1(2.6x)|32.5</td><td></td><td>1,753</td><td>6x</td><td>5.2(2.3x)</td></tr><tr><td>Original Prompt</td><td></td><td></td><td></td><td></td><td></td><td>54.244.0 10,295</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Zero-shot</td><td>39.7 15.6</td><td>38.7 31.3</td><td>26.5 15.6</td><td>67.0 40.7</td><td>37.8 1.6</td><td>36.223.5</td><td></td><td>214</td><td>-</td><td>15.6 48x1.6(9.8x)</td><td>132.59,788 10.8</td><td>32</td><td>-</td><td>12.2 306x 1.0(12.2x)</td></tr></table>
131
+
132
+ Ablation study To evaluate the contributions of different components in LongLLMLingua, we introduce following variants of it for ablation study. (1) Variants about Question-aware Coarsegrained Compression, include: ours w/o Questionawareness, which calculates question-text relevance $r _ { k }$ using information entropy in LLMLingua, ours w/ SBERT, which employs SBERT to compute $r _ { k }$ , ours w/ $p ( \mathbf { x } _ { k } ^ { \mathrm { d o c } } | \boldsymbol { x } _ { i } ^ { \mathrm { q u e , r e s t r i c t } } )$ |xque,restricti ), which replace p(xque,restricti |x doc with $p ( \mathbf { x } _ { k } ^ { \mathrm { d o c } } | x _ { i } ^ { \mathrm { q u e , r e s t r 1 c t } } )$ in Eq. 2, and ours w/o restrict, which only calculates the conditional probability corresponding to $x ^ { \mathrm { q u e } }$ . (2) Ours w/o Question-aware Fine-grained, which disregards Eq. (3) and only applies Iterative Token-level Prompt Compression as LLMLingua. (3) Ours w/o Dynamic Compression Ratio, where all documents share the same compression ratio in fine-grained compression.
133
+
134
+ Table 3: Ablation study on NaturalQuestions with $2 \mathbf { x }$ constraint using GPT-3.5-Turbo.
135
+
136
+ <table><tr><td>1st 5th 10th 15th 20th</td></tr><tr><td>LongLLMLingua 77.2 72.9 70.8 70.5 70.6 Question-awareCoarse-grained - w/o Question-awareness 42.1 40.3 39.7 40.1 40.3</td></tr><tr><td>- W/SBERT 73.2 68.5 65.7 66.1 66.7 - w/p(xdoq| ,que,restrict 56.0 52.6 53.4 51.6 51.1 - w/o restrict 75.172.2 70.3 70.370.2 xi</td></tr><tr><td>- w/o Question-aware Fine-grained 75.8 71.0 68.9 68.4 69.3 - w/o Dynamic Compression Ratio 74.4 70.7 68.7 67.9 68.1 - w/o Subsequence Recovery 76.7 71.7 69.4 69.3 69.7</td></tr><tr><td>- w/ Document Reordering 76.2 76.2 76.2 76.2 76.2 - w/ GPT2-small 74.6 71.7 70.169.8 68.5</td></tr></table>
137
+
138
+ (4) Ours w/o and (5) LLMLingua w/ Subsequence Recovery, which either removes or adds the postprocessing subsequence recovery strategy. (6) Ours w/ GPT2-small, which uses the GPT2-small model as the small language model.
139
+
140
+ Table 3 shows the results of the ablation study. In summary, removing any component proposed for LongLLMLingua will lead to a performance drop regardless of the position of the ground-truth answer. This well validates the necessity and effectiveness of the proposed question-aware mechanism during coarse-to-fine compression, the dynamic compression ratio, and the subsequence recovery strategy. It also shows that applying SBERT for coarse-grained compression will result in inferior performance, which implies the superiority of our question-aware importance metric in Eq. 2 over SBERT. In addition, replacing $p ( x _ { i } ^ { \mathrm { q u e , r e s t r u c t } } | \mathbf { x } _ { k } ^ { \mathrm { d o c } } )$ with $p ( \mathbf { x } _ { k } ^ { \mathrm { d o c } } | x _ { i } ^ { \mathrm { q u e , r e s t r i c t } } )$ can greatly affect performance due to the large noise in calculating $p ( \mathbf { x } _ { k } ^ { \mathrm { { d o c } } } )$ since the perplexity of document depends on many other information besides the question. Removing the restrictive statement can increase the hallucination of small language models, leading to a decrease in performance. Moreover, our subsequence recovery strategy can also bring performance gains for LLMLingua. However, without our question-aware mechanism, results from LLMLingua are still less satisfactory. For more detailed cases, please go to Appendix F.
141
+
142
+ Latency evaluation We conducte end-to-end latency testing on a V100-32G, using the prompts from Multi-document QA, LongBench, and ZeroSCROLLS in the API call, and results are shown in Table 1 and 2. The latency includes the time cost for prompt compression and the request time for LLMs, with multiple measurements taken and averaged over. Results demonstrate that LongLLMLingua does indeed speed up the overall inference under different compression ratios and scenarios. Moreover, with the compression ratio increasing, the acceleration effect becomes more pronounced up to 2.6x. However, the OpenAI embedding and Selective-Context results in longer latency time, due to repeated API calls and the sequential entropy calculation of semantic units, respectively.
143
+
144
+ # 6 RELATED WORKS
145
+
146
+ Long context for LLMs. Recent research has focused on expanding the window size of LLMs. Main approaches include: (1) Staged pre-training (Nijkamp et al., 2023) which gradually increases the context window; (2) Modifying (Press et al., 2022) or interpolating position embeddings (Chen et al., 2023; Peng et al., 2023; Han et al., 2023); (3) Using linear or sparse attention mechanisms (Ding et al., 2023; Sun et al., 2023); (4) Utilizing external memory modules for context storage (Bertsch et al., 2023; Tworkowski et al., 2023). While these methods address context window expansion, their impact on downstream task performance has yet to be discussed.
147
+
148
+ Information distribution in prompt. Recent empirical experiments have shown that LLM performance decreases with less effective information in a prompt (Bai et al., 2023; Li et al., 2023a; Shi et al., 2023). Moreover, the position of relevant information in a prompt has a significant impact on performance(Wu et al., 2022). Liu et al. (2023) suggests that LLMs have more difficulty comprehending information located in the middle of a prompt compared to those at the edges.
149
+
150
+ Retrieval methods can be categorized as dense or sparse retrieval methods. Sparse retrieval methods, like BM25, determine the relevance between queries and documents based on n-gram information. Conversely, dense retrieval methods assess the relevance between queries and documents in latent space using dense vectors, such as SentenceBERT (Reimers & Gurevych, 2019) and OpenAI Embedding. Recently, Jiang et al. (2023b)) proposed an unsupervised dense retrieval method that leverages traditional compression algorithms, such as gzip, and k-nearest neighbors.
151
+
152
+ Prompt compression methods can be grouped into three main categories: (1) Token pruning (Goyal et al., 2020; Kim & Cho, 2021; Modarressi et al., 2022) and token merging (Bolya et al., 2023), which need model fine-tuning or intermediate results during inference and have been used with BERT-scale models. (2) Soft prompt tuning methods like GIST (Mu et al., 2023), AutoCompressor (Chevalier et al., 2023), and ICAE (Ge et al., 2023), which require LLMs’ parameter fine-tuning, making them suitable for specific domains but not directly applicable to black-box LLMs. (3) Information-entropy-based approaches such as Selective Context (Li, 2023) and LLMLingua (Jiang et al., 2023a), which use a small language model to calculate the self-information or perplexity of each token in the original prompt and then remove tokens with lower perplexities.
153
+
154
+ # 7 CONCLUSION
155
+
156
+ We propose LongLLMLingua to address the three challenges, i.e., higher computational/financial cost, longer system latency, and inferior performance for LLMs in long context scenarios. We develop LongLLMLingua from the perspective of efficient prompt compression, thus reducing both computational/financial cost and the system latency. We further design four components, i.e., a question-aware coarse-to-fine compression method, a document reordering mechanism, dynamic compression ratios, and a post-compression subsequence recovery strategy to improve LLMs’ perception of the key information, with which LongLLMLingua demonstrate superior performance. Experiments on one multi-document QA benchmark and two long context benchmarks demonstrate that LongLLMLingua compressed prompt can derive higher performance than original prompts while both API costs for inference and the end-to-end system latency are largely reduced.
157
+
158
+ REFERENCES
159
+ Yushi Bai, Xin Lv, Jiajie Zhang, Hongchang Lyu, Jiankai Tang, Zhidian Huang, Zhengxiao Du, Xiao Liu, Aohan Zeng, Lei Hou, et al. Longbench: A bilingual, multitask benchmark for long context understanding. ArXiv preprint, abs/2308.14508, 2023. URL https://arxiv.org/ abs/2308.14508.
160
+ Amanda Bertsch, Uri Alon, Graham Neubig, and Matthew R. Gormley. Unlimiformer: Long-range transformers with unlimited length input. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ lJWUJWLCJo.
161
+ Daniel Bolya, Cheng-Yang Fu, Xiaoliang Dai, Peizhao Zhang, Christoph Feichtenhofer, and Judy Hoffman. Token merging: Your vit but faster. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id $=$ JroZRaRw7Eu.
162
+ Harrison Chase. LangChain, 2022. URL https://github.com/hwchase17/langchain.
163
+ Shouyuan Chen, Sherman Wong, Liangjian Chen, and Yuandong Tian. Extending context window of large language models via positional interpolation. ArXiv preprint, abs/2306.15595, 2023. URL https://arxiv.org/abs/2306.15595.
164
+ Alexis Chevalier, Alexander Wettig, Anirudh Ajith, and Danqi Chen. Adapting language models to compress contexts. ArXiv preprint, abs/2305.14788, 2023. URL https://arxiv.org/ abs/2305.14788.
165
+ Jiayu Ding, Shuming Ma, Li Dong, Xingxing Zhang, Shaohan Huang, Wenhui Wang, and Furu Wei. Longnet: Scaling transformers to 1,000,000,000 tokens. ArXiv preprint, abs/2307.02486, 2023. URL https://arxiv.org/abs/2307.02486.
166
+ Qingxiu Dong, Lei Li, Damai Dai, Ce Zheng, Zhiyong Wu, Baobao Chang, Xu Sun, Jingjing Xu, and Zhifang Sui. A survey for in-context learning. ArXiv preprint, abs/2301.00234, 2023. URL https://arxiv.org/abs/2301.00234.
167
+ Tao Ge, Jing Hu, Xun Wang, Si-Qing Chen, and Furu Wei. In-context autoencoder for context compression in a large language model. ArXiv preprint, abs/2307.06945, 2023. URL https: //arxiv.org/abs/2307.06945.
168
+ Saurabh Goyal, Anamitra Roy Choudhury, Saurabh Raje, Venkatesan T. Chakaravarthy, Yogish Sabharwal, and Ashish Verma. Power-bert: Accelerating BERT inference via progressive word-vector elimination. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pp. 3690–3699. PMLR, 2020. URL http://proceedings.mlr.press/v119/ goyal20a.html.
169
+ Chi Han, Qifan Wang, Wenhan Xiong, Yu Chen, Heng Ji, and Sinong Wang. Lm-infinite: Simple on-the-fly length generalization for large language models. ArXiv preprint, abs/2308.16137, 2023. URL https://arxiv.org/abs/2308.16137.
170
+ Gautier Izacard, Mathilde Caron, Lucas Hosseini, Sebastian Riedel, Piotr Bojanowski, Armand Joulin, and Edouard Grave. Unsupervised dense information retrieval with contrastive learning. Transactions on Machine Learning Research, 2022. ISSN 2835-8856. URL https: //openreview.net/forum?id ${ . } = { }$ jKN1pXi7b0.
171
+ Huiqiang Jiang, Qianhui Wu, Chin-Yew Lin, Yuqing Yang, and Lili Qiu. Llmlingua: Compressing prompts for accelerated inference of large language models. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics, December 2023a. URL https://arxiv.org/abs/2310.05736.
172
+ Zhiying Jiang, Matthew Yang, Mikhail Tsirlin, Raphael Tang, Yiqin Dai, and Jimmy Lin. “lowresource” text classification: A parameter-free classification method with compressors. In Findings of the Association for Computational Linguistics: ACL 2023, pp. 6810–6828, Toronto, Canada, 2023b. Association for Computational Linguistics. doi: 10.18653/v1/2023.findings-acl. 426. URL https://aclanthology.org/2023.findings-acl.426.
173
+ Gyuwan Kim and Kyunghyun Cho. Length-adaptive transformer: Train once with length drop, use anytime with search. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 6501–6511, Online, 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.508. URL https://aclanthology.org/2021. acl-long.508.
174
+ Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, Kristina Toutanova, Llion Jones, Matthew Kelcey, Ming-Wei Chang, Andrew M. Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov. Natural questions: A benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:452–466, 2019. doi: 10.1162/tacl a 00276. URL https://aclanthology.org/Q19-1026.
175
+ Patrick S. H. Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Rockt ¨ aschel, Sebastian Riedel, ¨ and Douwe Kiela. Retrieval-augmented generation for knowledge-intensive NLP tasks. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and HsuanTien Lin (eds.), Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. URL https://proceedings.neurips.cc/paper/2020/hash/ 6b493230205f780e1bc26945df7481e5-Abstract.html.
176
+ Dacheng Li, Rulin Shao, Anze Xie, Ying Sheng, Lianmin Zheng, Joseph E. Gonzalez, Ion Stoica, Xuezhe Ma, and Hao Zhang. How long can open-source llms truly promise on context length?, 2023a. URL https://lmsys.org/blog/2023-06-29-longchat.
177
+ Jiaqi Li, Mengmeng Wang, Zilong Zheng, and Muhan Zhang. Loogle: Can long-context language models understand long contexts? ArXiv preprint, abs/2311.04939, 2023b. URL https:// arxiv.org/abs/2311.04939.
178
+ Yucheng Li. Unlocking context constraints of llms: Enhancing context efficiency of llms with self-information-based content filtering. ArXiv preprint, abs/2304.12102, 2023. URL https: //arxiv.org/abs/2304.12102.
179
+ 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, abs/2307.03172, 2023. URL https://arxiv.org/abs/2307.03172.
180
+ Ali Modarressi, Hosein Mohebbi, and Mohammad Taher Pilehvar. AdapLeR: Speeding up inference by adaptive length reduction. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1–15, Dublin, Ireland, 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.1. URL https://aclanthology.org/2022.acl-long.1.
181
+ Jesse Mu, Xiang Lisa Li, and Noah Goodman. Learning to compress prompts with gist tokens. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https: //openreview.net/forum?id $=$ 2DtxPCL3T5.
182
+ Erik Nijkamp, Tian Xie, Hiroaki Hayashi, Bo Pang, Congying Xia, Chen Xing, Jesse Vig, Semih Yavuz, Philippe Laban, Ben Krause, Senthil Purushwalkam, Tong Niu, Wojciech Krysci ´ nski, ´ Lidiya Murakhovs’ka, Prafulla Kumar Choubey, Alex Fabbri, Ye Liu, Rui Meng, Lifu Tu, Meghana Bhat, Chien-Sheng Wu, Silvio Savarese, Yingbo Zhou, Shafiq Joty, and Caiming Xiong. Xgen-7b technical report. ArXiv preprint, abs/2309.03450, 2023. URL https: //arxiv.org/abs/2309.03450.
183
+ Joon Sung Park, Joseph C O’Brien, Carrie J Cai, Meredith Ringel Morris, Percy Liang, and Michael S Bernstein. Generative agents: Interactive simulacra of human behavior. ArXiv preprint, abs/2304.03442, 2023. URL https://arxiv.org/abs/2304.03442.
184
+ Bowen Peng, Jeffrey Quesnelle, Honglu Fan, and Enrico Shippole. Yarn: Efficient context window extension of large language models. ArXiv preprint, abs/2309.00071, 2023. URL https:// arxiv.org/abs/2309.00071.
185
+ Ofir Press, Noah Smith, and Mike Lewis. Train short, test long: Attention with linear biases enables input length extrapolation. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $_ { \cdot } =$ R8sQPpGCv0.
186
+ Nils Reimers and Iryna Gurevych. Sentence-BERT: Sentence embeddings using Siamese BERTnetworks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLPIJCNLP), pp. 3982–3992, Hong Kong, China, 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1410. URL https://aclanthology.org/D19-1410.
187
+ Uri Shaham, Maor Ivgi, Avia Efrat, Jonathan Berant, and Omer Levy. Zeroscrolls: A zero-shot benchmark for long text understanding. ArXiv preprint, abs/2305.14196, 2023. URL https: //arxiv.org/abs/2305.14196.
188
+ 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.
189
+ Yutao Sun, Li Dong, Shaohan Huang, Shuming Ma, Yuqing Xia, Jilong Xue, Jianyong Wang, and Furu Wei. Retentive network: A successor to transformer for large language models. ArXiv preprint, abs/2307.08621, 2023. URL https://arxiv.org/abs/2307.08621.
190
+ Harsh Trivedi, Niranjan Balasubramanian, Tushar Khot, and Ashish Sabharwal. MuSiQue: Multihop questions via single-hop question composition. Transactions of the Association for Computational Linguistics, 2022.
191
+ Szymon Tworkowski, Konrad Staniszewski, Mikołaj Pacek, Yuhuai Wu, Henryk Michalewski, and Piotr Miłos. Focused transformer: Contrastive training for context scaling. ´ ArXiv preprint, abs/2307.03170, 2023. URL https://arxiv.org/abs/2307.03170.
192
+ Zhiyong Wu, Yaoxiang Wang, Jiacheng Ye, and Lingpeng Kong. Self-adaptive in-context learning: An information compression perspective for in-context example selection and ordering. ArXiv preprint, abs/2212.10375, 2022. URL https://arxiv.org/abs/2212.10375.
193
+ Wenhan Xiong, Jingyu Liu, Igor Molybog, Hejia Zhang, Prajjwal Bhargava, Rui Hou, Louis Martin, Rashi Rungta, Karthik Abinav Sankararaman, Barlas Oguz, Madian Khabsa, Han Fang, Yashar Mehdad, Sharan Narang, Kshitiz Malik, Angela Fan, Shruti Bhosale, Sergey Edunov, Mike Lewis, Sinong Wang, and Hao Ma. Effective long-context scaling of foundation models. ArXiv preprint, abs/2309.16039, 2023. URL https://arxiv.org/abs/2309.16039.
194
+
195
+ # A TOKEN-LEVEL SUBSQUENCE RECOVERY DETAILS
196
+
197
+ Algorithm 1 Pseudo code of Token-level Subsquence Recovery.
198
+
199
+ Input: The original prompt $_ { \pmb { x } }$ ; the compressed prompt $\widetilde { \pmb x }$ ; the generation response of LLMs $\textbf { { y } }$ .
200
+ 1: Set the final response list $y _ { \mathrm { r e c } } = \phi$ , the left token index of subsquence $l$ to 0.
201
+ 2: while $l < { \bf { y } } . l e n ( )$ do
202
+ 3: if Substring $y _ { l } \in \widetilde { \pmb x }$ then
203
+ 4: eFind the longer substring $\widetilde { \pmb { y } } _ { \mathrm { k e y } , l } = \left\{ y _ { l } , y _ { l + 1 } , . . . , y _ { r } \right\} \in \widetilde { \pmb { x } }$ .
204
+ 5: eFind the maximum common shortest subsequence $\pmb { x } _ { i , j } = \{ x _ { i } , x _ { i + 1 } , . . . , x _ { j } \}$ in the original prompt
205
+ $_ { \textbf { \em x } }$ .
206
+ 6: Add the subsequence $\pmb { x } _ { i , j } = \{ x _ { i } , x _ { i + 1 } , . . . , x _ { j } \}$ to the response $\scriptstyle { \pmb { y } } _ { \mathrm { r e c } }$ .
207
+ 7: Set the left index $l$ to $r + 1$ .
208
+ 8: else
209
+ 9: Add the token $y _ { l }$ to the response $\scriptstyle { \pmb { y } } _ { \mathrm { r e c } }$ .
210
+ 10: Set the left index $l$ to $l + 1$ .
211
+ 11: end if
212
+ 12: end while
213
+ Output: The final response list $\scriptstyle { \pmb { y } } _ { \mathrm { r e c } }$ .
214
+
215
+ # B DERIVATION OF QUESTION-AWARE FINE-GRAINED COMPRESSION
216
+
217
+ Based on the definition of Eq. 3, we can derive that,
218
+
219
+ $$
220
+ \begin{array} { r l } & { s _ { i } = \mathrm { p e r p l e x i t y } ( x _ { i } | { x } _ { < i } ) - \mathrm { p e r p l e x i t y } ( x _ { i } | { x } ^ { \mathrm { q u e } } , { x } _ { < i } ) } \\ & { \quad = q ( x _ { i } ) \log p ( x _ { i } | { x } ^ { \mathrm { q u e } } , { x } _ { < i } ) - q ( x _ { i } ) \log p ( x _ { i } | { x } _ { < i } ) } \\ & { \quad = q ( x _ { i } ) \log \frac { p ( x _ { i } | { x } ^ { \mathrm { q u e } } , { x } _ { < i } ) } { p ( x _ { i } | { x } _ { < i } ) } } \end{array}
221
+ $$
222
+
223
+ In the actual calculation of perplexity, a log operation is performed to avoid overflow, and $\cdot$ represents the probability distribution of the ground-truth.
224
+
225
+ At the same time, we can derive the following expanded expression based on Bayes’ theorem.
226
+
227
+ $$
228
+ p ( x ^ { \mathfrak { q } \mathfrak { u e } } | x _ { i } , x _ { < i } ) = { \frac { p ( x _ { i } | x ^ { \mathfrak { q } \mathfrak { u e } } , x _ { < i } ) p ( x ^ { \mathfrak { q } \mathfrak { u e } } ) } { p ( x _ { i } | x _ { < i } ) } } = p ( x ^ { \mathfrak { q } \mathfrak { u e } } ) { \frac { p ( x _ { i } | x ^ { \mathfrak { q } \mathfrak { u e } } , x _ { < i } ) } { p ( x _ { i } | x _ { < i } ) } }
229
+ $$
230
+
231
+ The probability distribution $\cdot$ of the question and the ground-truth distribution $q ( x _ { i } )$ of $\cdot$ are constants, hence $s _ { i }$ can be considered as the representation of Eq. 7.
232
+
233
+ $$
234
+ s _ { i } \propto p ( x ^ { \mathrm { q u e } } | x _ { i } , x _ { < i } )
235
+ $$
236
+
237
+ So we can utilize Eq. 3 to represent the probability distribution $\_$ , which represents the condition likelihood of generating $x ^ { \mathrm { q u e } }$ given the token $\cdot$ . Therefore, we can represent the token-level sensitive distribution for the question $x ^ { \mathrm { q u e } }$ using just a single inference. For tokens that are unrelated to $x ^ { \mathrm { q u e } }$ , such as the tokens on the right side of Figure 3b, their original amount of information may be high, but the contrastive perplexity remains at a relatively low level.
238
+
239
+ # C EXPERIMENT DETAILS
240
+
241
+ # C.1 DATASET DETAILS
242
+
243
+ NaturalQuestions multi-document QA A multi-document question-answering dataset, comprising 2,655 problems, was built by Liu et al. (2023) based on the NaturalQuestions dataset (Kwiatkowski et al., 2019). This dataset provides a realistic retrieval-augmented generation setup that closely resembles commercial search and question-answering applications (e.g., Bing Chat). Each example in the dataset contains a question and $\mathbf { k }$ related documents, utilizing the Contriever retrieval system (Izacard et al., 2022), one of which includes a document with the correct answer. To perform this task, the model must access the document containing the answer within its input context and use it to answer the question. The dataset’s data is sourced from the NaturalQuestions dataset, which contains historical queries issued to the Google search engine and human-annotated answers extracted from Wikipedia. The average prompt token length in this benchmark is 2,946. For our experiments, we used the version provided by Liu et al. (2023) that includes 20 documents7. The dataset comprises five different ground truth document position settings in the prompt: 1st, 5th, 10th, 15th, and 20th.
244
+
245
+ LongBench A multi-task long context benchmark consists of 3,750 problems in English and includes six categories with a total of 16 tasks. These tasks encompass key long-text application scenarios, such as single-document QA, multi-document QA, summarization, few-shot learning, synthetic tasks, and code completion. The average prompt token length in this benchmark is 10,289. For our experiments, we used the English dataset and evaluation scripts provided by Bai et al. (2023) for this benchmark8.
246
+
247
+ ZeroSCROLLS The multi-task long context benchmark consists of 4,378 problems, including four categories with a total of 10 tasks. These tasks cover summarization, question answering, aggregated sentiment classification, and information reordering. The average prompt token length in this benchmark is 9,788. For our experiments, we used the validation set and evaluation scripts provided by Shaham et al. (2023) for this dataset9.
248
+
249
+ MuSiQue The multi-hop question-answer dataset is composed of 39,876, 4,834, and 4,918 problems in the training, validation, and testing datasets, respectively. This dataset requires the language model to conduct multiple inferences based on the content of several documents and provide corresponding answers, thereby necessitating a certain capability for global information processing. The average token length for prompts in this dataset is 2,477. For our experiments, we utilized the validation set and evaluation scripts provided by Trivedi et al. (2022) for this dataset10.
250
+
251
+ LooGLE The multi-task long context benchmark comprises 6,448 problems, divided into three categories: summarization, short dependency question answering, and long dependency question answering. The average prompt token length in this benchmark stands at 24,005. For our experiments, we focused on the long dependency question answering subset, which includes four types of tasks: information retrieval, timeline reordering, computation, and comprehension. This subset contains 1,101 problems. We utilized the evaluation scripts provided by Li et al. (2023b) for this dataset11.
252
+
253
+ # C.2 OTHER IMPLEMENTATION DETAILS
254
+
255
+ All experiments were conducted using a Tesla V100 (32GB). We use tiktoken12 and GPT-3.5-Turbo model to count all the tokens. We set the granular control coefficient $k$ to 2. We use the pre-defined compression rates $\tau _ { \mathrm { i n s } } ~ = ~ 0 . 8 5$ and $\tau _ { \mathrm { q u e } } = 0 . 9$ for instructions and questions. The segment size used in the iterative token-level compression is set to 200. The $\delta \tau$ used in dynamic compression ratio is set to 0.25. For a fair comparison, we only used reordering in the NaturalQuestions Multidocument QA and noted this in Table 1. We use “We can get the answer to this question in the given documents.” as the guideline sentence in Equation (3).
256
+
257
+ For the baselines experiment, we use the currently recommended strongest model, all-mpnetbase- $. \mathbf { V } 2 ^ { 1 3 }$ , as the dense representation model for SentenceBERT. We use the recommended “textembedding-ada-002” as the embedding model for OpenAI Embedding14. We use the GPT2-dolly15 as the small language model in w/ GPT2-small ablation experiments.
258
+
259
+ D ADDITIONAL EXPERIMENTAL RESULTS
260
+
261
+ # D.1 DOCUMENT-LEVEL AVERAGE PERPLEXITY DISTRIBUTION
262
+
263
+ ![](images/dab3f4cf12367ae85d6ab9a362599a7538a7223f46e2c6964a0de6ce601ad074.jpg)
264
+ Figure 5: The distribution of document-level average perplexity when the ground-truth document is in different positions.
265
+
266
+ Figure 5 shows the distribution of the document’s average perplexity when the ground-truth is located at different positions within the prompt. As can be observed, as the context length increases, the original perplexity curve remains relatively stable. In unrelated documents, a higher perplexity is still retained, making it easier to remove relevant tokens from the related documents in the prompt compression process, thereby damaging the corresponding semantic information. Contrarily, contrastive perplexity shows an increase in perplexity in documents related to the question. According to the theoretical derivation in Appendix B, it’s known that contrastive perplexity characterizes the conditional probability of tokens corresponding to the question. The higher the relevance, the higher the contrastive perplexity, thereby retaining key information in the prompt compression process.
267
+
268
+ # D.2 ZEROSCROLLS BREAKDOWNS
269
+
270
+ Table 4: Performance breakdown of different methods under different compression ratios on ZeroSCROLLS (Shaham et al., 2023) using GPT-3.5-Turbo.
271
+
272
+ <table><tr><td>Methods</td><td>GvRp SSFD QMsm SQAL QALT Nrtv Qspr MuSQ SpDg BkSS AVG|Tokens1/T</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="10">3,000 tokens constraint</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Retrieval-based Methods</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>BM25</td><td>9.7</td><td>3.4</td><td>11.7</td><td>14.3</td><td>57.1</td><td>5.9</td><td>25.7</td><td>11.2</td><td>29.6</td><td>29.6</td><td>19.8</td><td>3.379</td><td>3x</td></tr><tr><td>SBERT</td><td>16.5</td><td>9.8</td><td>12.3</td><td>15.2</td><td>60.0</td><td>14.623.4</td><td></td><td>12.1</td><td>39.4</td><td>36.4</td><td>24.0</td><td>3.340</td><td>3x</td></tr><tr><td>OpenAI</td><td>14.3</td><td>8.3</td><td>12.0</td><td>15.3</td><td>66.7</td><td>13.324.3</td><td></td><td>11.7</td><td>31.2</td><td>26.4</td><td>22.4</td><td>3,362</td><td>3x</td></tr><tr><td>LongLLMLingua rk</td><td>19.5</td><td>11.6</td><td>14.7</td><td>15.5</td><td>66.7</td><td>20.527.6</td><td></td><td>13.0</td><td>60.8</td><td>43.4</td><td>29.3</td><td>3,350</td><td>3x</td></tr><tr><td colspan="10">Compression-based Methods</td><td></td><td></td><td></td><td></td></tr><tr><td>Selective-Context</td><td>20.8</td><td>9.1</td><td>11.7</td><td>13.4</td><td>50.0</td><td>9.826.1</td><td></td><td>11.0</td><td>46.0</td><td>9.5</td><td>20.7</td><td>3,460</td><td>3x</td></tr><tr><td>LLMLingua</td><td>18.7</td><td>10.0</td><td>14.9</td><td>16.8</td><td>61.9</td><td>26.927.2</td><td></td><td>23.4</td><td>62.9</td><td>44.5</td><td>30.7</td><td>3.366</td><td>3x</td></tr><tr><td>LongLLMLingua </td><td>21.9</td><td>12.7</td><td>15.5</td><td>17.0</td><td>66.9</td><td>27.6 31.1</td><td></td><td>23.8</td><td>65.6</td><td>46.4</td><td>32.8</td><td>3.412</td><td>3x</td></tr><tr><td colspan="10">2,000 tokens constraint</td><td></td><td></td><td></td><td></td></tr><tr><td colspan="10">Retrieval-based Methods</td><td></td><td></td><td></td><td></td></tr><tr><td>BM25</td><td>8.8</td><td>2.5</td><td>11.1</td><td>13.5</td><td>60.0</td><td>7.0</td><td>4.9</td><td>20.3</td><td>39.9</td><td>32.9</td><td>20.1</td><td>1,799</td><td>5x</td></tr><tr><td>SBERT</td><td>10.2</td><td>7.9</td><td>13.7</td><td>13.2</td><td>60.0</td><td>8.1</td><td>10.8</td><td>1.7</td><td>37.2</td><td>42.8</td><td>20.5</td><td>1,773</td><td>6x</td></tr><tr><td>OpenAI</td><td>11.1</td><td>8.0</td><td>11.8</td><td>13.6</td><td>60.0</td><td>7.1</td><td>13.2</td><td>4.0</td><td>33.6</td><td>43.6</td><td>20.6</td><td>1,784</td><td>5x</td></tr><tr><td>LongLLMLingua rk</td><td>18.2</td><td>9.8</td><td>12.3</td><td>15.9</td><td>57.1</td><td>10.1 17.8</td><td></td><td>7.3</td><td>57.7</td><td>42.3</td><td>24.9</td><td>1,771</td><td>6x</td></tr><tr><td colspan="10">Compression-based Methods</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Selective-Context</td><td>19.0</td><td>8.4</td><td>9.7</td><td>12.4</td><td>47.0</td><td>12.5 21.6</td><td></td><td>11.5</td><td>41.2</td><td>11.0</td><td>19.4</td><td>1,865</td><td>5x</td></tr><tr><td>LLMLingua</td><td>19.4</td><td>11.9</td><td>13.1</td><td>16.0</td><td>62.1</td><td>23.724.0</td><td></td><td>22.4</td><td>33.9</td><td>44.9</td><td>27.2</td><td>1,862</td><td>5x</td></tr><tr><td>LongLLMLingua</td><td>19.9</td><td>12.3</td><td>14.7</td><td>16.5</td><td>64.9</td><td>27.4 30.6</td><td></td><td>23.5</td><td>68.3</td><td>47.1</td><td> 32.5</td><td>1,809</td><td>6x</td></tr><tr><td>Original Prompt</td><td>21.8</td><td>12.1</td><td>17.9</td><td>17.4</td><td>66.7</td><td>25.329.8</td><td></td><td>20.0</td><td>69.7</td><td>44.1</td><td>32.5</td><td>9.788</td><td>-</td></tr><tr><td>Zero-shot</td><td>9.4</td><td>3.0</td><td>8.6</td><td>11.4</td><td>42.9</td><td>10.612.4</td><td></td><td>5.5</td><td>4.2</td><td>0.0</td><td>12.8</td><td>32</td><td>306x</td></tr></table>
273
+
274
+ Table 4 presents a detailed performance breakdown on the ZeroSCROLLS benchmark. It can be observed that in the four summarization tasks - GvRp, SSFD, QMsm, SQAL, LongLLMLingua closely matches or slightly surpasses the original results under two compression constraints. Meanwhile, in the four long context QA tasks - Qsqr, Nrtv, QALT, MuSQ, there is a significant improvement. Notably, in the MuSiQue task, which is based on a question-answering dataset from books and movie scripts, there is a 2.1 point increase even under a 2,000 tokens constraint. It’s worth mentioning that MuSiQue is a multi-hop question-answering dataset that requires LLMs to utilize global information for long dependency QA. LongLLMLingua can also improve by 3.5 points under a 6x compression ratio. In the two ordering tasks, SpDg and BkSS, LongLLMLingua can better retain globally sensitive information, resulting in a 3.0 point improvement in BkSS after prompt compression.
275
+
276
+ It’s important to note that although the ZeroScrolls validation dataset is relatively small, it still demonstrates conclusions similar to previous experimental observations across various methods and tasks. Furthermore, this study conducted an in-depth analysis of the multi-hop QA task - MuSiQue, and another long context benchmark - LooGLE. The results can be found in Appendix D.3 and Appendix D.6.
277
+
278
+ # D.3 MUSIQUE
279
+
280
+ Table 5 presents the results from the MuSiQue multihop question-answer dataset. From the table, it can be observed that in the multi-hop QA task, requiring global information: 1) LongLLMLingua can reduce noise in the prompt by eliminating irrelevant information and putting more related information at the beginning or end of the prompt, thereby improving performance by 5.4 points. 2) The performance drop is more pronounced for retrievalbased methods, particularly for n-gram-based methods like BM25. Due to long dependencies, direct matching information is lost, resulting in less relevant information being recalled. 3) The performance of compression-based methods is slightly different. Selective-Context does not distinguish between different modules’ sensitivity, resulting in a loss of question and instruction-related information, thereby leading to poorer performance. However, LLMLingua can still retain relevant key information at around a $\cdot$ compression ratio. 4) The ablation experiments show that every module designed in LongLLMLingua plays a role in the multi-hop task. The removal of the question-aware coarse-grained and w/ $\cdot$ modules, which have difficulty in perceiving the importance distribution of corresponding questions, can cause a drop of up to 8 points. Removing the restrict prompt in the question-aware coarse module can also cause a 2-point drop due to the hallucination issue of small LLM. In addition, removing question-aware fine-grained, dynamic compression ratio, and document reordering can all cause a drop of 0.5-2.8 points. 5) Moreover, if the small language model in LongLLMLingua is replaced with GPT2-small, it can further improve the acceleration ratio and still achieve a result that is 2.6 points better than the original prompt.
281
+
282
+ Table 5: Performance of different methods and ablation study on MuSicQue (Trivedi et al., 2022) with 2x constraint using GPT3.5-Turbo.
283
+
284
+ <table><tr><td>Methods</td><td></td><td>F1 Tokens 1/T</td></tr><tr><td>Original Prompt</td><td>45.8 2,427</td><td></td></tr><tr><td>BM25</td><td></td><td>28.51,295 1.9x</td></tr><tr><td>SBERT</td><td></td><td>36.2 1,288 1.9x</td></tr><tr><td>LongLLMLingua rk</td><td>46.3 1,295 1.9x</td><td></td></tr><tr><td>Selective-Context LLMLingua</td><td>19.6 1,141 2.1x</td><td></td></tr><tr><td>LongLLMLingua</td><td>40.1 1,110 2.2x</td><td></td></tr><tr><td>Question-aware Coarse-grained</td><td></td><td>51.2 1,077 2.3x</td></tr><tr><td>- w/o Question-awareness</td><td></td><td>43.2 1,076 2.3x</td></tr><tr><td>- w/SBERT</td><td></td><td>47.31,070 2.3x</td></tr><tr><td>-w/ p(xe|a cxquersriet</td><td></td><td>44.0 1,066 2.3x</td></tr><tr><td>- w/o restrict</td><td></td><td>49.2 1,078 2.3x</td></tr><tr><td>- w/o Question-aware Fine-grained 48.4 1,118 2.2x - w/o Dynamic Compression Ratio 48.2 1,090 2.2x</td><td></td><td></td></tr><tr><td>- w/o Subsequence Recovery</td><td></td><td></td></tr><tr><td></td><td></td><td>50.7 1,077 2.3x</td></tr><tr><td>- w/o Document Reordering</td><td></td><td>49.2 1,077 2.3x</td></tr><tr><td>- w/ GPT2-small</td><td></td><td>48.4 1,095 2.2x</td></tr></table>
285
+
286
+ # D.4 ABLATION IN LONGBENCH
287
+
288
+ Table 6 presents the results from the ablation experiment in the LongBench long context benchmark. It can be observed that in various long context tasks: 1) Removing the question-aware coarsegrained, question-aware fine-grained, dynamic compression ratio, document reordering, and subsequence recovery proposed by LongLLMLingua all result in different degrees of performance drop. 2) Among these, question-aware coarse-grained is particularly important for document-based QA and synthetic tasks, with the maximum drop being 35.8 points; its impact on summarization and code tasks is relatively smaller. 3) The design of the conditional probability in the question-aware coarse-grained module improves the results in all tasks, including code completion, single-document question-answer, and synthetic tasks. Changing the order of conditional probabilities or removing the restrict prompt both lead to varying degrees of performance decline. 4) Removing questionaware fine-grained, dynamic compression ratio has a more significant impact on document-based QA and synthetic tasks. 5) The subsequence recovery module can enhance reference-based tasks, but its improvement on tasks like summarization, code, synthetic, etc., is relatively smaller. 6) Document reordering is effective for all types of tasks. Reordering at the document level does not affect LLMs’ understanding of context information, even for timeline-related tasks (see timeline reorder in LooGLE, Table 8). On the contrary, reordering can effectively alleviate the “lost in the middle” issue, thereby improving LLMs performance. 7) Using GPT2-small reduces the capture of effective tokens, but it can still achieve results close to or even slightly better than the original prompt.
289
+
290
+ Table 6: Ablation on LongBench (Bai et al., 2023) using GPT-3.5-Turbo.
291
+
292
+ <table><tr><td>Methods</td><td>|SingleDoc MultiDoc Summ.FewShot Synth. Code AVG Tokens1/T</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LongLLMLingua</td><td>39.0</td><td>42.2</td><td>27.4</td><td>69.3</td><td>53.8</td><td>56.6</td><td>48.0</td><td>1,809</td><td>6x</td></tr><tr><td>Question-aware Coarse-grained</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>- w/o Question-awareness</td><td>27.1</td><td>38.7</td><td>25.4</td><td>62.0</td><td>18.0</td><td>53.3</td><td>37.4</td><td>1,945</td><td>5x</td></tr><tr><td>- w/ SBERT</td><td>34.0</td><td>38.7</td><td>24.1</td><td>57.9</td><td>32.5</td><td>31.1</td><td>36.4</td><td>1790</td><td>6x</td></tr><tr><td>-w/p(xget</td><td>22.5</td><td>28.9</td><td>23.2</td><td>53.0</td><td>22.5</td><td>33.3</td><td>30.6</td><td>1,794</td><td>6x</td></tr><tr><td>- w/o restrict</td><td>37.8</td><td>39.5</td><td>26.4</td><td>64.8</td><td>52.5</td><td>55.8</td><td>46.1</td><td>1,834</td><td>6x</td></tr><tr><td>- w/o Question-aware Fine-grained</td><td>35.7</td><td>41.1</td><td>26.4</td><td>62.9</td><td>44.5</td><td>54.8</td><td>44.2</td><td>1,807</td><td>6x</td></tr><tr><td>- w/o Dynamic Compression Ratio</td><td>36.1</td><td>40.6</td><td>26.9</td><td>67.2</td><td>48.0</td><td>55.8</td><td>45.7</td><td>1,851</td><td>6x</td></tr><tr><td>- w/o Subsequence Recovery</td><td>38.6</td><td>41.8</td><td>27.3</td><td>69.0</td><td>53.8</td><td>56.6</td><td>47.8</td><td>1,809</td><td>6x</td></tr><tr><td>- w/ Document Reordering</td><td>39.9</td><td>43.2</td><td>27.4</td><td>69.8</td><td>53.0</td><td>56.7</td><td>48.3</td><td>1,822</td><td>6x</td></tr><tr><td>- w/ GPT2-small</td><td>35.9</td><td>39.4</td><td>25.0</td><td>60.6</td><td>42.0</td><td>55.4</td><td>43.0</td><td>1,892</td><td>5x</td></tr></table>
293
+
294
+ # D.5 LONGBENCH USING LONGCHAT-13B-16K
295
+
296
+ Table 7: Performance of different methods under different compression ratios on LongBench (Bai et al., 2023) using LongChat-13b. Considering the dataset structure, we do not use the reordering strategy here.
297
+
298
+ <table><tr><td>Methods</td><td>| SingleDoc MultiDoc Summ. FewShot Synth. Code AVG Tokens 1/T</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Original Prompt</td><td>27.4</td><td>30.3</td><td>20.3</td><td>49.9</td><td>12.5</td><td>42.5</td><td>30.5</td><td>10,295</td><td></td></tr><tr><td colspan="10">Retrieval-based Methods</td></tr><tr><td>BM25</td><td>2.4</td><td>2.6</td><td>16.4</td><td>8.7</td><td>0.0</td><td>44.7</td><td>12.5</td><td>1,985</td><td>5x</td></tr><tr><td>SBERT</td><td>11.6</td><td>13.7</td><td>21.1</td><td>16.2</td><td>7.5</td><td>30.0</td><td>16.7</td><td>1,947</td><td>5x</td></tr><tr><td>LongLLMLingua rk</td><td>30.3</td><td>32.4</td><td>24.5</td><td>41.0</td><td>27.5</td><td>38.1</td><td>32.3</td><td>1,960</td><td>5x</td></tr><tr><td colspan="10">Compression-based Methods</td></tr><tr><td>Selective-Context</td><td>16.1</td><td>23.5</td><td>21.8</td><td>21.4</td><td>2.5</td><td></td><td>35.920.2</td><td>1,925</td><td>5x</td></tr><tr><td>LLMLingua</td><td>20.6</td><td>22.3</td><td>22.4</td><td>35.6</td><td>0.0</td><td>35.4</td><td>22.7</td><td>1,950</td><td>5x</td></tr><tr><td>LongLLMLingua</td><td>31.1</td><td>34.1</td><td>24.5</td><td> 45.7</td><td>28.0</td><td>48.6</td><td>35.3</td><td>1,809</td><td>6x</td></tr></table>
299
+
300
+ Table 7 presents the experiment results in the LongBench long context benchmark using LongChat13b-16k. It can be seen that the compressed prompt can also achieve good results on other LLMs, such as LongChat-13b-16k. Specifically, 1) there is a maximum improvement of 15.5 points in synthetic tasks. Except for a slight drop in few-shot Learning, there is an improvement of 3-5 points in other tasks. 2) The performance trends of retrieval-based and compressed-based baselines are similar to the results in GPT-3.5-Turbo.
301
+
302
+ # D.6 LOOGLE
303
+
304
+ Table 8 presents the experiment results in the LooGLE long dependency benchmark, which features longer prompts $\cdot$ and more global dependencies. From the table, we can observe that: 1) LongLLMLingua can effectively improve the performance of long context tasks by compressing prompts, even for long dependency tasks. The results show that LongLLMLingua significantly improves performance in tasks such as retrieval, timeline reorder, and computation, with the maximum improvement reaching 15.9 points. 2) The document reorder in LongLLMLingua is effective in all types of tasks, even in tasks highly related to the timeline, it can effectively improve performance by alleviating the “lost in the middle” issue. 3) Retrieval-based methods tend to lose performance in tasks that have longer dependencies, such as computation and reasoning. 4) For compressionbased methods, due to the difficulty in perceiving question information, there tends to be a larger performance loss in retrieval tasks within long contexts.
305
+
306
+ Table 8: Performance of different methods on LooGLE (Li et al., 2023b) long dependency QA.
307
+
308
+ <table><tr><td>Methods</td><td></td><td>Retrieval Timeline Reorder Computation Reasoning AVG Tokens</td><td></td><td></td><td></td><td></td><td>1/T</td></tr><tr><td>Retrieval-based Methods</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>BM25</td><td>20.4</td><td>21.7</td><td>8.2</td><td>26.3</td><td>19.2</td><td>3,185</td><td>10x</td></tr><tr><td>SBERT</td><td>28.9</td><td>21.1</td><td>10.7</td><td>27.2</td><td>22.0</td><td>3,169</td><td>10x</td></tr><tr><td>LongLLMLingua rk</td><td>38.6</td><td>32.2</td><td>16.2</td><td>26.3</td><td>28.3</td><td>3,158</td><td>10x</td></tr><tr><td>Compression-based Methods</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Selective-Context</td><td>16.7</td><td>5.0</td><td>2.3</td><td>17.6</td><td>10.4</td><td>3,710</td><td>8x</td></tr><tr><td>LLMLingua</td><td>10.0</td><td>25.0</td><td>13.3</td><td>21.1</td><td>17.3</td><td>3,404</td><td>9x</td></tr><tr><td>LongLLMLingua</td><td>40.0</td><td> 35.0</td><td>19.7</td><td>33.6</td><td> 32.1</td><td>3,121</td><td>10x</td></tr><tr><td> LongLLMLingua w/o Reorder</td><td>39.3</td><td>33.8</td><td>18.7</td><td>31.6</td><td>30.9</td><td>3,119</td><td>10x</td></tr><tr><td>Original Prompt</td><td>24.1</td><td>20.9</td><td>13.5</td><td>32.1</td><td></td><td>22.630.546</td><td>1</td></tr><tr><td>Zero-shot</td><td>8.7</td><td>6.3</td><td>1.2</td><td>14.5</td><td>7.7</td><td>43</td><td>710x</td></tr></table>
309
+
310
+ # E ECONOMIC COST
311
+
312
+ Table 9: The inference costs(per 1,000 samples $\$ 1$ ) for various datasets using GPT-3.5-Turbo.
313
+
314
+ <table><tr><td></td><td>Multi-document QA</td><td>LongBench</td><td>ZeroScolls</td><td>MuSicQue</td><td>LooGLE</td></tr><tr><td>Original</td><td>4.6</td><td>31.5</td><td>30.6</td><td>3.8</td><td>93.6</td></tr><tr><td>Ours</td><td>1.3</td><td>3.0</td><td>3.2</td><td>1.8</td><td>5.6</td></tr></table>
315
+
316
+ Table 9 presents the estimated per 1,000 samples inference costs for various datasets, encompassing input prompts and generated output text, based on GPT-3.5-Turbo pricing16. Our approach demonstrates substantial savings in computational resources and monetary expenses, particularly in long context situations. Cost reductions of $\$ 3.3$ , $\$ 28.5$ , $\$ 27.4$ , $\$ 2.0$ , and $\cdot$ per 1,000 samples are observed for Multi-document QA, LongBench, ZeroScrolls, MuSiQue, and LooGLE, respectively.
317
+
318
+ F ABLATION ANALYSIS G CASES STUDY
319
+
320
+ ![](images/a2f149bae667366109931bf8732c2f01f2478ccf270d26fc4fa05082828d5bf4.jpg)
321
+ Figure 6: Comparing the compressed prompt and LLMs’ response before and after using Questionaware Fine-grained Compression and Subsequence Recovery ${ \mathrm { 1 / } } \tau \mathrm { = } 3 0 \mathrm { x }$ , high compression ratio setting) from NaturalQuestions Multi-document QA (Liu et al., 2023) using GPT-3.5-Turbo.
322
+
323
+ # Original Prompt:
324
+
325
+ Document [1](Title: Dancing on Ice) It was confirmed on 25 January 2018, that Dancing on Ice had been recommissioned for an eleventh series to air in 2019.
326
+
327
+ Compressed Prompt:
328
+ Write a high-quality answer for the given question using only the provided search results (some of which might be irrelevant).
329
+ 1Title: Dancing on was confirmed on 2 January 2018 that Dancing on had been recommissioned for an eleventh series air in 209 .
330
+ Document [2Title: Dan on) Dan on Ice Dancing on British presented by Phillip Schof alongside Holly Willough from 26 to 2011, and Christine Bleakley from 2012 to 204 The show consists of celebrit and professional partners figure skating in front of a panel of judges The, broadcast on ITV, started on January 2006 and ended on 9 March 2014 after showcontract not renewed by ITV On 4 September 2017, it was announced that rev series ´ would on I 7 January 201 Sch and Willby returning as a
331
+ 5(: on ( on () The third series of a from January to168TV. The from Saturdays, with Holby present Kar,y Sliner Robin Cins returned to Panel”, with Ruth H joining the panel as replacement for Natalia Bestova. The commission of the was confirmed by at the07 announcedova depart the series Robinen Bar,ater and Jasoniner announced
332
+ 7( on ( )) Dan 2 second of Dan on a from January to1207 ITV It presented Phillip Sch Holly Willough, and judged the ”I P consisting Nicky Slater, Nataliaian Karenres Jason Gardiner Karen Barber and Robin Cousins Jaynevill and Christopher Dean co and trained the contestants In this series, cele to ten in first series. The series was won former Kyran Bracken, with Mel Lambert the winner. It announced thatenresge
333
+ Document []( on Ice on 08 on TV edition started 8 TV2 The Russian version ”анду) being on channel0, and renamed in8 to ” Ice” (). Its counterpart called ”Ice Age (, ”Stars on Ice on Channel Oneak IceHviezdyˇlJ. The Turkish version” is called Dans” (”ance on
334
+ Document1 on Ice its, all,e () and Sje Chris de In series.2 edition ´
335
+ ](: on Ice world) Dan Ice is a made competition world format, and been subsequently Italy Chile where titled after series There have a, the show was broadcast on Channel 13 as a Document [17](Title: Dancing on Ice) the insight to the training of the celebrities over the last week. It was presented by television presenter Ben Shephard and former contestant and ”Loose Women” star Coleen Nolan. The show was broadcast from $8 ~ \mathrm { p m }$ to $8 . 3 0 \ \mathrm { p m }$ on Friday evenings on ITV throughout the duration of the main shows season. STV who broadcast the main show did not broadcast this on the Friday evening but after repeating the previous weeks main show on the following Saturday afternoon. Due to poor ratings, ´ ”Dancing on Ice Friday” was axed prior to the 2011 series. The show was based in the Question: when is dancing on ice on the tv
336
+ Answer:
337
+ LLMs’ Response:
338
+ 209
339
+ LLMs’ Response after Subsquence Recovery:
340
+ 2019
341
+ Ground Truth:
342
+ 2019
343
+ Compressed Prompt:
344
+ Please complete the code given below.
345
+ public class MessageArchiveManagement private static final long MILLISECONDS_IN_DAY = 24 \* 00 \*0; public static final long_CUP $=$ MCON_DAY /.../ .("",.getStart add
346
+ ifget() ${ > } 0$ Node end(" end.(" endNode.Value("", Util.getTimestamp(query.getEnd
347
+ addNode } if (.withid null && contact null && !isference Node with(" .with .Value("valuewith .( // queryMessageive(connection, nextQuery final(connectionProtocol(), query synchronized (eries) // queries.add(nextQuery } } public boolean queryInProgress( contact, OnLoaded moreMessagesLoadedListener) ized (eries) (Query query : queries) if(query.getWith().equals(contact.getUserId())) if (query.onMoreMessagesLoaded $= =$ null &&MessagesListener null) query.setOnMoreMessagesLoaded(Listener} return true;}} return false;}} private void finalizeQuery(Protocol protocol, Query query) synchronized (queries) { .remove(query); } Contact contact $=$ null; if (query.getWith() ! $=$ null) { contact $=$ protocol.getItemByUID(query.getWith()); } if (contact ! $=$ null) {
348
+ Next line of code:
349
+
350
+ contact.setLastMessageTransitted(query.getEnd());\n
351
+
352
+ # Ground Truth:
353
+
354
+ if (contact.setLastMessageTransmitted(query.getEnd()))
355
+
356
+ Zero-shot LLMs’ Response: contact.removeQuery(query);\n
357
+
358
+ Figure 8: Cases study on lcc code completion task in LongBench benchmark (Bai et al., 2023) in 2,000 constraint using GPT-3.5-Turbo.
359
+
360
+ # Compressed Prompt:
361
+
362
+ Please the of the question. questions
363
+ are sometimes your cold but the of you isnt:ason: What food hasges:: Who the first coach the Clevelandns What arch the Placede: Other: Who created Harryime What Carbean cult didvey:: did Iraqi troops::ose cover is of an of Universal Import What the of Betty theest thectic:: Wh the founder and of The National Review:: was T Tims What the historicalals following the of Agra is whiteolate: of What the the: is a of everything:ase and:ose old London come- was : “y my sweet:: The major team in is called: Group or organization of: How dorow: M of: the name to ofese ?: Animal: is gymnia: of the between k and ch: of: the lawyer for Randy C:: the Francisco What year the in whereci became What country most is g the Who the to P What are the states the the name , Elino: What manmade waterways is1.76: Other of Z:ivalent of: of What was the:: How do ants have: of: the Dow first the high sound that hear in ear every then , but then it away ,:: didist control in:: How can I ofies ’ What did theramid-ers of Egypt eat:: How does Belle her inast: M of: When reading classs does EENTY :: Expression abbre: When was Florida:: manyelies were killed the: Whative on Punchl Hill and has1 What the Filenes the cookies in Internet: What word contains: Word with a special is Larry: a person: a Frenchist: of What American wrote : “ Goodors:: Where theiestk rail stations:: many people ofosis: the worsticane Whatbean is of was Jean: What the2 What caused Harryini What buildingately enough the the1d bill: Other location: many logmic there a rule:: the the word , JJ the average hours per months byOL:: How a cop of: many are of is Ch:: is Whatation does: the the Whatte is “ a whole new: Other: the Chyl nuclear:
364
+ the first the: Invention, book and otherative What does “ Philebus-:: didoco painting: the between: is Po What. the lowest highestation 6:: How the inpy: an the “ What was General Douglasthur in was by Presidentuman: How isaster: an the forini:: was Dick:: Where can find on religion and health the and: Other Whatian the TV51 theBC show for How the is of What Englishrighted “ thee , so What song put James:ative piece
365
+ What new school in Philadelphia: Whatwestern isbed is B: is What Asian was as The Little Brown theans What of thean meeting: is: much the91 ?:: On which isbor: Who first:: the:: How you a paint: an What then-der theterset ,:ivalent What is to hold the lens the the star: Why toason
366
+ a for behavior , or that the accepted of:ivalent of Perg What religion What country you the What does V:: Where I a goodboard for:: buyies on the the the: areter cookiespped with cres: theoe thated ofasticitations , as ‘ the rules to “: the three What do for an:: CNN in:: is a:ose special bears was on17 the Who used Au an electionan: what book: is to the various ways can measure IT:chni and method is software What British minister and wereins: aic the to overcome fear What drink would the biggest:: the States do people longest:: which the the rare disease as : , andentizations , , and is of a is What Russian mastery What a perfect a: What c was Thomas in: Other: did the of What did What can feature the different:ques the-O the ons lips at What anetic did Victoria used her child: D What do: many from to of ofors , body: and is What causes get in: the G What is Other Who the1 century-stone who gained of Florence but endedake:
367
+ of c: the oldest relationship sister with The the world of a to detectchni Whaty make:: Stuart
368
+
369
+ is first: is w What a character by Rs
370
+
371
+ Question: What is a fuel cell ?
372
+ Type:
373
+ LLMs’ Response:
374
+ Definition of something
375
+ LLMs’ Response after Subsquence Recovery:
376
+ Definition of something
377
+
378
+ Ground Truth: Definition of something
parse/test/8dkp41et6U/8dkp41et6U_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/8dkp41et6U/8dkp41et6U_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/8dkp41et6U/8dkp41et6U_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/AqN23oqraW/AqN23oqraW.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/AqN23oqraW/AqN23oqraW_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/AqN23oqraW/AqN23oqraW_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/AqN23oqraW/AqN23oqraW_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/FAO4VS9QRV/FAO4VS9QRV.md ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DELTA-LORA: FINE-TUNING HIGH-RANK PARAMETERS WITH THE DELTA OF LOW-RANK MATRICES
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ In this paper, we present Delta-LoRA, which is a novel parameter-efficient approach to fine-tune large language models (LLMs). In contrast to LoRA and other low-rank adaptation methods such as AdaLoRA, Delta-LoRA not only updates the low-rank matrices $\pmb { A }$ and $\textbf { { B } }$ , but also propagate the learning to the pre-trained weights $W$ via updates utilizing the delta of the product of two low-rank matrices $( \boldsymbol { A } ^ { ( \bar { t } + 1 ) } \boldsymbol { B } ^ { ( t + 1 ) } - \boldsymbol { A } ^ { ( t ) } \boldsymbol { B } ^ { ( t ) } )$ . Such a strategy effectively addresses the limitation that the incremental update of low-rank matrices is inadequate for learning representations capable for downstream tasks. Moreover, as the update of $W$ does not need to compute the gradients of $W$ and store their momentums, Delta-LoRA shares comparable memory requirements and computational costs with LoRA. Extensive experiments show that Delta-LoRA significantly outperforms existing low-rank adaptation methods. We further support these results with comprehensive analyses that underscore the effectiveness of Delta-LoRA.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Large Language Models (LLMs) recently have attracted considerable attention due to their remarkable performance across a broad spectrum of downstream tasks. Diverging from conventional Transformers characterized by a scale of millions of parameters, modern LLMs typically scale up to billions of parameters, endowing them with notable advantages such as emergent capabilities and robust generalization as detailed in (Bubeck et al., 2023). Fine-tuning such highly capable LLMs on downstream tasks (Raffel et al., 2020; Devlin et al., 2019; Radford et al., 2019; He et al., 2021; Liu et al., 2019; Brown et al., 2020) has consequently become a mainstream paradigm to reduce the training time required for individual tasks, yet with superior performance compared with other methods (Lester et al., 2021; Li & Liang, 2021; Houlsby et al., 2019).
12
+
13
+ However, fine-tuning a LLM with all the learnable parameters (Full Fine-tuning) requires multiple GPUs with high memory demand (Dettmers et al., 2023; Hu et al., 2022), which is unattainable for many companies and research institutions. Full fine-tuning poses exceptional challenges to researchers: with massive parameter size, LLMs already demand more storage space than regular models; Further training exaggerates the GPU memory requirement because common optimizers such as AdamW (Loshchilov & Hutter, 2019) often maintain several copies of the model parameters, which is 2-3 times of memory overhead.
14
+
15
+ To this end, a series of methods have been proposed (Valipour et al., 2023; Zhang et al., 2022; Li & Liang, 2021; Liu et al., 2022a; Lv et al., 2023; Dettmers et al., 2023; Liu et al., 2022b; Zaken et al., 2021; Pfeiffer et al., 2021; Guo et al., 2021; Zhou et al., 2023; Zhang et al., 2023; Houlsby et al., 2019; Wang et al., 2022) to reduce memory overhead at the training stage. Some even accelerate the fine-tuning process with only less than $1 \%$ trainable parameters. Among these methods, LoRA (Hu et al., 2022) is the most attractive for its stable performance on broad downstream tasks (Ding et al., 2023), no observed overfitting, as well as no extra memory and computation cost at inference.
16
+
17
+ While LoRA and its successors (Zhang et al., 2022; Valipour et al., 2023) have indeed exhibited superior performance in comparison to alternative approaches within the realm of Parameter Efficient Fine-Tuning (PEFT), a substantial performance gap persists when compared to the full fine-tuning, as highlighted in most scenarios (Ding et al., 2023). This discrepancy is attributed to the inherent limitation of updating only a fraction of the model’s parameters, rendering it inadequate to fit the intricacies presented in the training data.
18
+
19
+ ![](images/1ca0c1ec6ae0bdfd3ed1798fc6e45918c8fd23932e69b68d64eae2d7c5c29b9a.jpg)
20
+ Figure 1: An overview of the proposed Delta-LoRA structure, compared to LoRA, DyLoRA and AdaLoRA. Note that DyLoRA and LoRA basically share the same architecture. W is the pre-trained weight which is frozen (signified by blue) when performing efficient-parameter fine-tuning in (a) and (b). Orange trapezoids $\pmb { A }$ , $\textbf { { B } }$ and $\pmb { \cal E }$ denote the trainable parameters. In our proposed Delta-LoRA, the light orange rectangle means that pre-trained weights can be updated via the delta. Note that our proposed Delta-LoRA removes the Dropout layer to ensure reasonable delta for pre-trained matrix.
21
+
22
+ To bridge this gap, a reasonable strategy is to introduce more parameters into the optimization process. In this paper, we introduce Delta-LoRA as shown in Fig. 1, a novel PEFT approach that simultaneously updates the pre-trained matrix and two low-rank matrices while maintaining the same memory consumption as the original LoRA. Specifically, the pre-trained matrix $W$ is updated with the delta of the product of two low-rank matrices in two consecutive iterations $\triangle A B =$ $A ^ { ( t + 1 ) } B ^ { ( t + 1 ) } - A ^ { ( t ) } \bar { B } ^ { ( t ) } )$ , while two low-rank matrices are updated by the AdamW optimizer automatically. This is based on the mathematical property that $\begin{array} { r } { \frac { \partial \mathcal { L } ^ { \star } } { \partial W } = \frac { \partial \mathcal { L } } { \partial A B } . } \end{array}$ and $\triangle A B$ is a surrogate to direct the update of $W$ (see Sec. 4 for details). Since we neither store the gradient of $W$ nor use the optimizer to update the pre-trained matrix, the proposed method thus does not yield any extra memory overhead. This strategic integration effectively mitigates the sub-optimal representation learning stemming from only updating the two low-rank matrices. Moreover, our approach aligns the update direction of the pre-trained weights with that of the incremental update matrix. Furthermore, we discard the Dropout layer in low-rank branches to obtain a more reasonable delta for $W$ , in order to ensure $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial W } . = \frac { \partial \check { \mathcal { L } } } { \partial A B } } \end{array}$ . The advantages of our proposed method are conspicuous: including the pre-trained weights in the optimization process engenders a broader integration of parameters, thereby enhancing the potential for learning intricate representations.
23
+
24
+ The main contributions of this paper can be summarized as:
25
+
26
+ • We introduce Delta-LoRA, a novel PEFT method that simultaneously updates the full weight matrix and two low-rank matrices. Delta-LoRA leverages the delta of the product of $\pmb { A }$ and $\textbf { { B } }$ to update the pre-trained weights and thus prevent storing the first and the second-order momentums in the optimizer.
27
+ • We analyze thbranch makes $\begin{array} { r } { \frac { \partial \Xi } { \partial W } \neq \frac { \partial \mathcal { L } } { \partial A B } } \end{array}$ ow of Delta-LoRA and show that the Dropout layer in the low-rank. Thus, we remove the Dropout layer in our proposed Delta-LoRA to get reasonable delta for $W$ .
28
+ • We conduct comprehensive experiments to show that Delta-LoRA has consistent gains on a broad range of NLP tasks. Additionally, we provide thorough explanations to analyze its superiority and the value contributed by each component.
29
+
30
+ # 2 PRELIMINARIES
31
+
32
+ Transformer-based Models. Transformer (Vaswani et al., 2017) adopts the self-attention mechanism instead of recurrence and convolutions, achieving new state-of-the-art in machine translation. Dosovitskiy et al. (2021) later proposed the Vision-Transformer (ViT) architecture which exhibits versatility across various computer vision tasks. Nowadays, the Transformer-based models have become the most popular choice in both NLP and Computer Vision (Li et al., 2021; Carion et al., 2020; Zheng et al., 2021). Transformer typically consists of $L$ stacked blocks, each containing a multi-head attention (MHA) module and a feed-forward network (FFN) module. For an input sequence $\ b { X } \in \mathbb { R } ^ { n \times d }$ , the MHA module yields the output $\operatorname { M H A } ( X )$ , given by:
33
+
34
+ $$
35
+ \begin{array} { r } { \mathrm { h e a d } _ { i } = \mathrm { s o f t m a x } ( \frac { X W _ { Q _ { i } } ( X W _ { K _ { i } } ) ^ { \top } } { \sqrt { d _ { k } } } ) X W _ { V _ { i } } } \\ { \mathrm { M H A } ( X ) = \mathrm { c o n c a t } ( \mathrm { h e a d } _ { 1 } , . . . , \mathrm { h e a d } _ { k } ) W _ { o } , } \end{array}
36
+ $$
37
+
38
+ where $d _ { k }$ is the scaling factor and set to $d _ { k } = d / k$ . $W _ { K _ { i } }$ $W _ { Q _ { i } }$ , $W _ { V _ { i } }$ and $W _ { o }$ are weight matrices for computation of key, query, value and the output of MHA, respectively. Besides the MHA module, the FFN is also vital in the Transformer-based model. It stacks two fully connected (FC) layers with an activation function in between. FFN is defined as:
39
+
40
+ $$
41
+ \mathrm { F F N } ( \pmb { x } ) = W _ { f _ { 2 } } \mathrm { R e L U } ( W _ { f _ { 1 } } \pmb { x } + b _ { 1 } ) + b _ { 2 } ,
42
+ $$
43
+
44
+ where $\pmb { x } \in \mathbb { R } ^ { d }$ , $W _ { f _ { 1 } }$ and $W _ { f _ { 2 } }$ are two fully connected layers in FFN, $b _ { 1 }$ and $b _ { 2 }$ are bias terms.
45
+
46
+ Low Rank Adaptation. Given a pre-trained matrix $\boldsymbol { W } \in \mathbb { R } ^ { c \times d }$ , LoRA ( $\mathrm { H u }$ et al., 2022) learns an incremental update $\triangle \mathbf { { W } }$ and decomposes $\triangle W$ into a matrix multiplication between two lowrank matrices $\pmb { A }$ and $\textbf { { B } }$ , where $\pmb { A } \in \mathbb { R } ^ { c \times r }$ and $\boldsymbol { B } \in \mathbb { R } ^ { r \times d }$ , and $\triangle W = A B$ . Here, the rank $r \ll m i n ( d , c )$ . For an input $_ { \textbf { \em x } }$ and hidden state $^ { h }$ , LoRA has the following forward process:
47
+
48
+ $$
49
+ \pmb { h } = \pmb { W } ^ { * } \pmb { x } = \pmb { W } \pmb { x } + \triangle \pmb { W } \pmb { x } = \pmb { W } \pmb { x } + \frac { \alpha } { r } \pmb { A } \pmb { B } \pmb { x }
50
+ $$
51
+
52
+ At the beginning of the training stage, $\pmb { A }$ is randomly initialized via Kaiming initialization (He et al., 2015) and $\textbf { { B } }$ is initialized to zero matrix to make sure that the incremental update $A B = \mathbf { 0 }$ at initialization. Besides, LoRA uses hyper-parameters $\alpha$ and $r$ to scale ${ \pmb A } { \pmb B } { \pmb x }$ .
53
+
54
+ # 3 RELATED WORKS
55
+
56
+ With the ever-growing parameter scale in current Transformer-based models, fine-tuning such a large language model (LLM) requires considerable number of GPUs equipped with high memory capacity. This is mainly due to the fact that common optimizers such as AdamW (Loshchilov & Hutter, 2019) requires maintaining three times of extra parameter size (gradients, first-order and second-order momentums). To bridge this gap, a series of Parameter-Efficient Fine-Tuning (PEFT) methods have been proposed (Hu et al., 2022; Liu et al., 2022b; Shin et al., 2020; Houlsby et al., 2019). The Adapter (Houlsby et al., 2019) introduces lightweight trainable parameters between pre-trained layers while keeping the pre-trained weights fixed. Prompt-Tuning (Lester et al., 2021) aims to optimize the prompt to achieve comparable performance with fine-tuning for specific task, while Prefix-Tuning optimizes for trainable prefixes and prepends these trainable parameters to each hidden state (Li & Liang, 2021). Despite the notable performance achievements, these methods inevitably introduce extra overhead at the inference stage.
57
+
58
+ Hu et al. (2022) proposed LoRA to utilize the multiplication of two low-rank matrices to model the incremental update of a full-rank matrix. LoRA merges the incremental updates to pre-trained weights after training, thereby avoiding any extra computation overhead during inference. Furthermore, it stands out as one of the most effective PEFT techniques according to Ding et al. (2023)’s evaluation. Subsequent to its inception, a series of enhanced methods building upon LoRA was proposed. Notably, G-LoRA (Chavan et al., 2023) leverages a generalized prompt module to fine-tune pre-trained weights resulting in better representations for computer vision tasks. DyLoRA (Valipour et al., 2023) aims to adjust the rank of two lightweight matrices after the training stage. Differing from the conventional approach of maintaining a static rank during training, DyLoRA introduces rank variations to its blocks. AdaLoRA (Zhang et al., 2022) emphasizes the disparate importance attributed to distinct weight parameters. This technique intelligently allocates the parameter budget across weight matrices based on their respective importance scores. Additionally, Q-LoRA (Dettmers et al., 2023) was proposed to further reduce the average memory footprint by quantizing the pre-trained model with 4-bit NormalFloat. This quantization approach not only preserves the model’s efficacy but also effectively alleviates the resource-intensive nature of LLM training and addresses a pertinent concern.
59
+
60
+ ![](images/037ce7a0f1a42468cb0674307bfde62dc2055b5d13ea1eeaf17d413680783a56.jpg)
61
+ Figure 2: The framework of our proposed Delta-LoRA. The blue arrows represent forward pass while yellow dashed arrows denote backward propagation. The black solid arrows in (b) represent the process of updating the low-rank adaptation matrices $\pmb { A }$ and $\textbf { { B } }$ with normalized gradients $\widehat { \mathbf { g } } _ { A }$ and $\widehat { \pmb { g } } _ { B }$ multiplied by the learning rate $\eta$ , as well as updating the pre-trained weights $W$ bwith the delta bmatrix $\triangle A B$ multiplied by the update ratio $\lambda$ .
62
+
63
+ # 4 METHODOLOGY
64
+
65
+ This section introduces the novel fine-tuning approach termed as Delta-LoRA. Delta-LoRA encompasses two pivotal designs as shown in Figure 1 and Figure 2: (i) It simultaneously updates the full weight matrix $( W )$ alongside the two low-rank adaptation matrices $\mathbf { \delta A }$ and $\textbf { { B } }$ ), utilizing the delta $( \hat { A ^ { ( t + 1 ) } B ^ { ( t + 1 ) } } - A ^ { ( t ) } \hat { B } ^ { ( t ) } )$ resulting from incremental updates to refine the pre-trained weights $( W )$ ; (ii) The Dropout layer as originally integrated within the conventional LoRA module, is excluded in Delta-LoRA. This omission stems from the realization that its presence violates the required assumption $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial W } = \frac { \partial \mathcal { L } } { \partial A B } } \end{array}$ .
66
+
67
+ # 4.1 UPDATE THE DELTA OF LOW-RANK MATRICES ON PRE-TRAINED WEIGHTS
68
+
69
+ For an input $_ { \textbf { \em x } }$ and its corresponding hidden state $^ { h }$ , LoRA optimizes two low-rank matrices $\pmb { A }$ and $\textbf { { B } }$ to learn an incremental update $_ { A B }$ for the pre-trained and fixed weight matrix $W$ . Different from previous methods, we argue that $W$ also needs to be updated. In this way, we can introduce more learnable parameters to the optimization process for higher learning capability. However, acquiring the normalized gradients (i.e. the gradients after normalization in optimizer) to fine-tune the weight matrix $W$ is non-trivial, since the optimizer such as AdamW must maintain at least three extra copies of the parameters (i.e. gradients as well as the first-order and the second-order moments of gradients) in GPU memory. Intriguingly, we note that the gradients of the loss $\mathcal { L }$ with respect to matrices $_ { A B }$ and $W$ are precisely identical, under the presumption that the LoRA module exclusively retains matrices $\pmb { A }$ and $\textbf { { B } }$ , while disregarding the Dropout layer. This correspondence can be formally represented as:
70
+
71
+ $$
72
+ \begin{array} { l } { g _ { W } = \displaystyle \frac { \partial \mathcal { L } } { \partial h _ { i + 1 } } \cdot \frac { \partial h _ { i + 1 } } { \partial W } ^ { \top } = \displaystyle \frac { \partial \mathcal { L } } { \partial h _ { i + 1 } } \cdot h _ { i } ^ { \top } , } \\ { g _ { A B } = \displaystyle \frac { \partial \mathcal { L } } { \partial h _ { i + 1 } } \cdot \frac { \partial h _ { i + 1 } } { \partial A B } ^ { \top } = \displaystyle \frac { \partial \mathcal { L } } { \partial h _ { i + 1 } } \cdot h _ { i } ^ { \top } , } \\ { \implies g _ { W } = g _ { A B } , } \end{array}
73
+ $$
74
+
75
+ where $h _ { i + 1 } = W h _ { i } + A B h _ { i } .$ , $\boldsymbol { h } _ { i }$ and $\boldsymbol { h } _ { i + 1 }$ are the outputs of the $i$ -th layer and the $_ { i + 1 }$ -th layer respectively. $_ { A B }$ is the matrix product of the adaptation matrices $\pmb { A }$ and $\textbf { { B } }$ , $\mathcal { L }$ is the loss function, while $g _ { W + A B } , g _ { W }$ and $\mathbf { \sigma } _ { \mathbf { \sigma } _ { g _ { A B } } }$ denote the gradients of ∂L∂(W +AB) , ∂L∂W , and ∂ $\frac { \partial \mathcal { L } } { \partial A B }$ respectively.
76
+
77
+ Equation 4 inspires us to use $\mathbf { \sigma } _ { \mathbf { \sigma } _ { g _ { A B } } }$ to assimilate $\mathbf { \Delta } _ { g _ { W } }$ when learning the parameter updates for weight matrix $W$ . Unfortunately, we are only able to obtain the gradients $\mathbf { \pmb { g } } _ { \pmb { A } }$ and $\mathbf { \nabla } _ { \mathbf { \pmb { g } } \mathbf { \it { B } } }$ rather than $\mathbf { \Delta } _ { \mathbf { \mathcal { { g } } } \mathbf { \Delta } _ { W } }$ during the back-propagation process. Furthermore, the computation of the gradients for $_ { A B }$ is as expensive as for the matrix $W$ , since both matrices share the same dimensions of $d \times k$ , consequently entailing an equivalent GPU memory overhead.
78
+
79
+ Considering a typical optimization process, the model updates its parameters by applying the gradient descent: $\boldsymbol { W } ^ { ( t + 1 ) } = \boldsymbol { W } ^ { ( t ) } - \eta \boldsymbol { g } _ { \boldsymbol { W } }$ , with the parameter update denoted as $\triangle W = - \eta g _ { W }$ , using the learning rate $\eta$ . Similarly, we regard $- \triangle A B$ as the gradients for $_ { A B }$ and utilize this matrix as a substitute for $\mathbf { \Delta } _ { g _ { W } }$ according to Equation 4. Here, we can compute $\triangle A B$ as:
80
+
81
+ $$
82
+ \triangle { \cal A } B = { \cal A } ^ { ( t + 1 ) } B ^ { ( t + 1 ) } - { \cal A } ^ { ( t ) } B ^ { ( t ) } = \eta { \cal A } ^ { ( t ) } g _ { B } + \eta g _ { A } B ^ { ( t ) } - \eta ^ { 2 } g _ { A } g _ { B } ,
83
+ $$
84
+
85
+ where $A ^ { ( t ) }$ , $B ^ { ( t ) }$ and $\mathbf { \mathbf { } } W ^ { ( t ) }$ are the weights of $A , B$ and $W$ at the $t { \cdot }$ -th step respectively, $A ^ { ( t + 1 ) } =$ $A ^ { ( t ) } - \eta g _ { A }$ , $B ^ { ( t + 1 ) } = B ^ { ( t ) } - \eta \pmb { g } _ { B }$ and $\eta$ is the learning rate. To be precise, $- \triangle A B$ does not equate directly to $\mathbf { \sigma } _ { \mathbf { \sigma } _ { g _ { A B } } }$ and $\mathbf { \Delta } _ { \mathbf { \mathcal { { g } } } \mathbf { \Delta } _ { W } }$ as elaborated in Appendix A.4.2. Nonetheless, $\triangle A B$ has the capability to symbolize the genuine directions of update for the matrix $_ { A B }$ . Based on this assumption, it is reasonable to employ $- \triangle A B$ as the gradient for directing the update of $W$ .
86
+
87
+ Therefore, during the training phase we introduce the matrix $\triangle A B$ to update the pre-trained weights $W$ in the following manner:
88
+
89
+ $$
90
+ { \bf W } ^ { ( t + 1 ) } = { \bf W } ^ { ( t ) } + \lambda \cdot \frac { \alpha } { r } \cdot \triangle A B , { \mathrm { w h e r e ~ } } \triangle A B = { \cal A } ^ { ( t + 1 ) } B ^ { ( t + 1 ) } - { \cal A } ^ { ( t ) } B ^ { ( t ) } ,
91
+ $$
92
+
93
+ where $\lambda$ represents the hyper-parameter to trade off the update ratio of $_ { A B }$ and the pre-trained weights $W$ . The parameter updates for $W$ commence after $K$ training iterations. The procedural details of the algorithm are illustrated in Algorithm 1.
94
+
95
+ Discussion. The Delta-LoRA has some important modifications compared to LoRA. Here, we discuss and compare the difference:
96
+
97
+ <table><tr><td colspan="2">LoRA</td><td colspan="2">1 Delta-LoRA 1 1</td></tr><tr><td rowspan="2">(1) A(t+1) ← ∂L(χ;W,A(t),B(t))</td><td>1 1</td><td>aL(x;W(t),A(t),B(t)) (1) A(t+1) ←</td><td rowspan="2"></td></tr><tr><td>aA(t)</td><td>aA(t)</td></tr><tr><td rowspan="3">(2) B(t+1) ← ∂C(χ:W.A(t),B(t))</td><td></td><td>1 (2) B(t+1) ← 0L(ω:W(t),A(t),B(t))</td><td>aB(t)</td></tr><tr><td>∂B(t)</td><td></td><td></td></tr><tr><td></td><td></td><td>(3)W(t+1) ← A(t+1)B(t+1) - A(t)B(t)</td></tr></table>
98
+
99
+ It is obvious that LoRA only updates $\pmb { A }$ and $\textbf { { B } }$ , and keeps $W$ frozen, while Delta-LoRA updates $\pmb { A }$ and $\textbf { { B } }$ by the optimizer and $W$ with the delta of the product of $\pmb { A }$ and $\textbf { { B } }$ .
100
+
101
+ # 4.2 THE STRUCTURE OF OUR DELTA-LORA
102
+
103
+ Both LoRA and its successor AdaLoRA put a Dropout layer before two low-rank matrices $\pmb { A }$ and $\textbf { { B } }$ . However, this arrangement results in a disparity between the gradient matrices $\mathbf { \Delta } _ { g _ { W } }$ and $\mathbf { \sigma } _ { \mathbf { \sigma } _ { g _ { A B } } }$ (or the matrix $\mathbf { \_ { \_ { \_ { \delta A E B } } } }$ in the context of AdaLoRA). The derivation of this disparity can be shown as:
104
+
105
+ $$
106
+ g _ { W } = { \frac { \partial { \mathcal { L } } } { \partial h _ { i + 1 } } } \cdot h _ { i } ^ { \top } \neq g _ { A B } = { \frac { \partial { \mathcal { L } } } { \partial h _ { i + 1 } } } \cdot \mathrm { D r o p } ( h _ { i } ) ^ { \top } ,
107
+ $$
108
+
109
+ where $\mathrm { D r o p } ( \cdot )$ denotes the Dropout layer which leads to $g _ { W } \neq g _ { A B }$ . A reasonable choice is to remove the Dropout layer in the low-rank module and activate the Dropout layer between pre-trained layers if overfitting problem occurs. This modification also brings additional benefits: (1) it can alleviate under-fitting to some extent, thereby enhancing the learned representations of the networks. The rationale behind this improvement lies in the fact that LoRA and its successors formulate low-rank updates for pre-trained weights, involving less than $1 \%$ of the complete parameters. However, relying solely on such a small fraction of parameters may not bestow an adequate representation capacity in most cases; (2) This alteration also yields memory-saving benefits. By negating the requirement to store intermediate features, the model curtails the memory consumption. Consequently, there is a reduction in activation memory employed during the back-propagation process.
110
+
111
+ # 5 EXPERIMENTS
112
+
113
+ We evaluate our proposed model fine-tuning method Delta-LoRA with RoBERTa (Liu et al., 2019), GPT-2 (Radford et al., 2019) and BART (Lewis et al., 2019) on a broad set of datasets. Specifically, we train (1) RoBERTa on GLUE benchmark which consists of 8 NLP understanding tasks; (2) GPT-2 on E2E Challenge and WebNLG Challenge 2017 following the setting of Hu et al. (2022); and (3) BART on XSum dataset by using the setting provided by Zhang et al. (2022). See Appendix A.7 for more training details on the datasets. The setups and detailed introductions of baseline methods are shown in Appendix A.1. We use PyTorch to implement our experiments and download the pre-trained weights as well as configuration files from HuggingFace Wolf et al. (2019).
114
+
115
+ Table 1: The evaluation results of our proposed Delta-LoRA and other existing methods on E2E NLG Challenge dataset. $\dagger$ indicates fine-tuning all layers except embedding layer. $^ \ddag$ indicates only fine-tuning weights for query and value. $^ \mathparagraph$ means we choose different settings with AdaLoRA: we only tune $W _ { Q }$ and $W _ { V }$ instead of all layers. The best results of Fine-Tuning methods are underlined. The best results of PEFT methods are boldfaced.
116
+
117
+ Table 2: The evaluation results of our proposed Delta-LoRA and other existing methods on WebNLG Challenge 2017 dataset. $\dagger$ indicates fine-tuning all layers except embedding layer. $\ddagger$ indicates only fine-tuning weights for query and value. $^ \mathparagraph$ means we choose different settings with AdaLoRA: we only tune $W _ { Q }$ and $W _ { V }$ instead of all layers. The best results of Fine-Tuning methods are underlined. The best results of PEFT methods are boldfaced.
118
+
119
+ <table><tr><td>Method</td><td></td><td>Trainables|Exrupdale</td><td></td><td></td><td></td><td>BLEU NIST METEOR ROUGE-L CIDEr</td><td></td></tr><tr><td>Full Fine-Tuning</td><td>354.92M</td><td></td><td>69.58</td><td>8.75</td><td>46.34</td><td>71.66</td><td>2.47</td></tr><tr><td>Fine-Tuningt</td><td>305.84M</td><td></td><td>69.37</td><td>8.76</td><td>46.05</td><td>71.97</td><td>2.44</td></tr><tr><td>Fine-Tuningt</td><td>48M</td><td>×</td><td>69.77</td><td>8.84</td><td>46.29</td><td>71.96</td><td>2.49</td></tr><tr><td>LoRA (repr.)</td><td>0.375M</td><td>X</td><td>69.60</td><td>8.78</td><td>45.61</td><td>71.12</td><td>2.45</td></tr><tr><td>LoRA</td><td>0.35M</td><td></td><td>70.4</td><td>8.85</td><td>46.8</td><td>71.8</td><td>2.53</td></tr><tr><td>DyLoRA</td><td>0.375M</td><td></td><td>67.89</td><td>8.50</td><td>44.07</td><td>70.52</td><td>2.26</td></tr><tr><td>AdaLoRA</td><td>0.375M</td><td></td><td>68.16</td><td>8.58</td><td>44.10</td><td>70.66</td><td>2.35</td></tr><tr><td>Delta-LoRA (Ours)</td><td>0.375M</td><td>√48M</td><td>70.84</td><td>8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr></table>
120
+
121
+ <table><tr><td>Method</td><td></td><td>PTrainables Exraupdatable</td><td>S BLEU↑</td><td>A</td><td>METEOR↑</td><td>S</td><td>TER</td><td>A</td></tr><tr><td>FullFine-Tuning</td><td>354.92M</td><td></td><td></td><td></td><td>61.38 45.11 54.480.44 0.38 0.410.36 0.53 0.44</td><td></td><td></td><td></td></tr><tr><td>Fine-Tuningt</td><td>305.84M</td><td>×</td><td></td><td></td><td>63.53 46.66 55.920.45 0.39 0.420.34 0.49 0.41</td><td></td><td></td><td></td></tr><tr><td>Fine-Tuningt</td><td>48M</td><td>×</td><td></td><td></td><td>64.55 48.06 57.080.46 0.39 0.430.33 0.47 0.40</td><td></td><td></td><td></td></tr><tr><td>LoRA (repr.)</td><td>0.375M</td><td>X</td><td>62.08 46.60 55.050.44 0.38 0.410.35 0.49 0.42</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LoRA</td><td>0.375M</td><td></td><td>62.1</td><td>46.7 55.3</td><td>0.440.380.41</td><td></td><td>0.330.460.39</td><td></td></tr><tr><td>DyLoRA</td><td>0.375M</td><td>×</td><td></td><td></td><td>58.39 46.02 52.77|0.42 0.37 0.40|0.38 0.49 0.43</td><td></td><td></td><td></td></tr><tr><td>AdaLoRA</td><td>0.375M</td><td>×</td><td>56.39 44.14 50.820.41 0.37 0.390.40 0.49 0.44</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Delta-LoRA (Ours)</td><td>0.375M</td><td>√48M</td><td></td><td></td><td></td><td></td><td>62.87 47.68 55.960.45 0.39 0.420.34 0.48 0.40</td><td></td></tr></table>
122
+
123
+ # 5.1 NATURAL LANGUAGE GENERATION
124
+
125
+ Models and Datasets. We use GPT2-Medium to verify the effectiveness of our Delta-LoRA on two datasets for data-to-text tasks, including the E2E NLG Challenge (Puzikov & Gurevych, 2018) and WebNLG Challenge 2017 (Gardent et al., 2017). The E2E NLG Challenge dataset comprises 42,000 samples for training, 4,600 for validation, and 4,600 for testing purposes. In contrast, the WebNLG Challenge 2017 consists of 21,855 training samples across nine categories, expanding to a total of 14 categories in the test set. For the text summarization task, we employed BART-Large (Lewis et al., 2019) to evaluate the efficacy of our method using the XSum dataset (Narayan et al., 2018). The XSum dataset is composed of 204,045 training samples, 11,332 validation samples, and 11,332 test samples. We also use LLaMA-7B(Touvron et al., 2023), a popular pre-trained large language model with 7 Billion parameters,to fine-tune on Alpaca dataset (Taori et al., 2023).
126
+
127
+ Implementation Details. In order to compare with LoRA and its successors fairly, we adopt the model setups from LoRA to implement our Delta-LoRA and three PEFT methods. We only learn the low-rank incremental update for $W _ { Q }$ and $W _ { V }$ in MHA module. For data-to-text datasets, we use the same training configurations as adopted by LoRA, including the number of training epochs, batch size and etc. We use update ratio $\lambda = 2$ and set start steps $K = 5 0 0$ for Delta-LoRA. More details about Delta-LoRA are listed in the Appendix A.7. For the text-summarization task, we use the implementation of AdaLoRA and adopt the same training configurations. We set the update ratio $\lambda = 0 . 5$ and the start steps $K = 1 0 0 0$ for Delta-LoRA.
128
+
129
+ Table 3: The evaluation results of Delta-LoRA with LLaMA-7B on the Instruction-Tuning dataset provided by Stanford Alpaca(Taori et al., 2023). We use GPT-4 to choose from a. LoRA, b. DeltaLoRA or c. Both LoRA and Delta-LoRA to decide the text from which method is better.
130
+
131
+ <table><tr><td>Both</td><td>LoRA</td><td>Delta-LoRA</td><td>Total</td></tr><tr><td>886</td><td>10</td><td>104</td><td>1,000</td></tr></table>
132
+
133
+ Experimental Results. Table 1 shows the results for E2E Challenge dataset on 5 evaluation metrics, demonstrating that our method achieves state-of-the-art performance over 3 baselines and a set of fine-tuning methods. For the BLEU and ROUGE-L metrics, our method obtains 1.24 and 1.13 performance gains compared with LoRA, with 0.13, 0.86 and 0.08 improvement on NIST, METEOR and CIDEr respectively. Table 2 demonstrates that Delta-LoRA outperforms baselines on BLEU score for WebNLG Challenge 2017 dataset, with 0.79, 1.08 and 0.91 improvement on Seen, Unseen and All test data, respectively. Additionally, for the METEOR and TER evaluation metrics, Delta-LoRA also achieves state-of-the-art performance, with 0.01 and 0.02 improvement over LoRA on all data. For the text-summarization task, the test results are shown in Table 4, which demonstrates that our method achieves state-of-the-art results across 3 parameter-efficient methods on 4 evaluation metrics. To fairly evaluate our method, we utilized LLaMA-7B and compared it with LoRA. We employed GPT-4 to generate 1,000 questions and presented these questions to the parameter-efficient fine-tuned LLaMA-7B. Subsequently, we leveraged GPT-4 to compare the texts generated by LoRA-tuned and Delta-LoRA-tuned LLMs. Additional details can be found in Appendix A.2. According to the findings in Table 3, Delta-LoRA establishes state-of-the-art performance in the evaluation of Language Models (LLMs). GPT-4 identified 104 samples generated by Delta-LoRA as superior to LoRA, while only 10 samples generated by LoRA exhibited higher quality than Delta-LoRA. This underscores Delta-LoRA’s effectiveness even when utilized within models containing billions of parameters.
134
+
135
+ Table 4: The evaluation results of our proposed Delta-LoRA and other existing methods on XSum dataset. $\dagger$ indicates fine-tuning all layers except the embedding layer. $^ \ddag$ indicates only fine-tuning weights for query and value. $\ P$ means we choose different settings with AdaLoRA: we only tune $W _ { Q }$ and $W _ { V }$ instead of all layers. The best results of Fine-Tuning methods are underlined. The best results of PEFT methods are boldfaced.
136
+
137
+ <table><tr><td>Method</td><td></td><td> PTrainablesExraUpdatable</td><td></td><td></td><td></td><td>Rouge-1 Rouge-2 Rouge-L Rouge-Sum</td></tr><tr><td>Full Fine-Tuning</td><td>387.5M</td><td></td><td>45.36</td><td>22.16</td><td>37.23</td><td>37.24</td></tr><tr><td>Fine-Tuningt</td><td>338.4M</td><td>xx</td><td>45.04</td><td>22.05</td><td>36.92</td><td>36.94</td></tr><tr><td>Fine-Tuningt</td><td>72M</td><td></td><td>44.95</td><td>21.43</td><td>36.35</td><td>36.37</td></tr><tr><td>LoRA</td><td>0.56M</td><td>X</td><td>43.27</td><td>20.13</td><td>35.12</td><td>35.12</td></tr><tr><td>DyLoRA</td><td>0.56M</td><td>×</td><td>41.84</td><td>18.76</td><td>33.56</td><td>33.57</td></tr><tr><td>AdaLoRAI</td><td>0.56M</td><td>X</td><td>42.91</td><td>19.76</td><td>34.71</td><td>34.72</td></tr><tr><td>Delta-LoRA (Ours)</td><td>0.56M</td><td>√72M</td><td>43.49</td><td>20.23</td><td>35.26</td><td>35.26</td></tr></table>
138
+
139
+ # 5.2 NATURAL LANGUAGE UNDERSTANDING
140
+
141
+ Models and Datasets. We use RoBERTa-baseLiu et al. (2019) to evaluate the performance of our proposed method, prior works and three fine-tuning methods. We choose the GLUE benchmark consisting of 8 datasets (Wang et al., 2019), including classification tasks, similarity and paraphrase tasks and natural language inference tasks.
142
+
143
+ Implementation Details. We use RoBERTa-base with 118M parameters to conduct our experiments and to compare our method with the baselines. We mostly adopt the same training configurations of
144
+
145
+ LoRA, more details can get from Appendix A.7. We set the rank to 8 and the target rank to 6 for AdaLoRA and choose the rest of hyper-parameters according to the characteristics of different tasks. For Delta-LoRA, we set the update ratio $\lambda$ to 0.5 and choose different start steps $K$ according to warmup steps used in individual tasks.
146
+
147
+ Table 5: The evaluation results of our proposed Delta-LoRA and other existing methods on GLUE benchmark. We report the overall (matched and mismatched) accuracy for MNLI, Matthew’s correlation for CoLA, Pearson correlation for STS-B, and accuracy for other tasks. $\dagger$ indicates fine-tuning all layers except the embedding layer. $\ddagger$ indicates only fine-tuning weights for query and value. $^ \mathparagraph$ means we choose different settings with AdaLoRA: we only tune $W _ { Q }$ and $W _ { V }$ instead of all layers. The best results of Fine-Tuning methods are underlined. The best results of PEFT methods are boldfaced.
148
+
149
+ <table><tr><td>Method</td><td></td><td></td><td>TraiableErUpdatablMNLISS-2 MRPC CoLA QNLIQP RTE STS-B AVG</td></tr><tr><td>Full Fine-Tuning</td><td>118.87M</td><td>X</td><td>87.51 94.26 88.23 64.57 92.73 91.96 84.11 90.56 86.74</td></tr><tr><td>Fine-Tuningt</td><td>82.05M</td><td>×</td><td>87.58 94.03 89.95 62.99 92.73 91.90 86.64 90.22 87.01</td></tr><tr><td>Fine-Tuningt</td><td>13.5M</td><td>×</td><td>87.48 95.06 89.21 61.07 92.76 91.19 84.83 89.85 86.43</td></tr><tr><td>LoRA</td><td>0.28M</td><td>X</td><td>87.40 94.61 89.95 63.17 93.02 90.67 86.64 91.54 87.12</td></tr><tr><td>DyLoRA</td><td>0.28M</td><td>X</td><td>86.33 94.26 89.46 61.12 92.22 90.17 84.47 91.06 86.14</td></tr><tr><td>AdaLoRA</td><td>0.28M</td><td>×</td><td>87.34 94.49 90.19 61.64 93.08 90.14 85.19 91.16 86.65</td></tr><tr><td>Delta-LoRA (Ours)</td><td>0.28M</td><td>√13.5M</td><td>87.50 95.06 90.19 63.82 93.09 90.87 87.00 91.57 87.38</td></tr></table>
150
+
151
+ Experimental Results. We compare our method with prior PEFT works. According to Table 5, our method outperforms existing methods on all 8 tasks in GLUE benchmark. Among these tasks, our method demonstrates significant improvement on SST-2, CoLA and RTE. This is mainly due to the fact that these datasets contain less training data, which hinders the model’s capacity to effectively acquire a robust representation when using prior fine-tuning methods. Delta-LoRA also achieves decent performance on the rest of the datasets, including MNLI, MRPC, QNLI as well STS-B, which proves that our method is stable and reliable across different settings.
152
+
153
+ # 5.3 COMPREHENSIVE UNDERSTANDING OF DELTA-LORA
154
+
155
+ Table 6: The ablation study of our proposed Delta-LoRA on E2E Challenge dataset demonstrates the importance of each component. The best results are boldfaced.
156
+
157
+ <table><tr><td>Method</td><td>Trainable Parameters</td><td>Parameters</td><td>Extra Updatable|BLEU NIST METEOR ROUGE-L CIDEr</td><td></td><td></td><td></td></tr><tr><td>LoRA (repr.)</td><td>0.375M</td><td></td><td>69.60 8.78</td><td>45.61</td><td>71.12</td><td>2.45</td></tr><tr><td>Delta-LoRA + LoRA Module</td><td>0.375M</td><td>√48M</td><td>70.29 8.88</td><td>46.38</td><td>71.88</td><td>2.51</td></tr><tr><td>Delta-LoRA</td><td>0.375M</td><td>√48M</td><td>70.84 8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr></table>
158
+
159
+ Table 7: The ablation study of our proposed Delta-LoRA to eliminate the impact of hyper-parameter $\lambda$ on E2E Challenge dataset. The best results are boldfaced.
160
+
161
+ <table><tr><td>Method</td><td>Learming</td><td>入</td><td>BLEU NIST METEOR ROUGE-L CIDEr</td><td></td><td></td><td></td></tr><tr><td>LoRA (repr.)</td><td>2e-4</td><td>-</td><td>69.60</td><td>8.78 45.61</td><td>71.12</td><td>2.45</td></tr><tr><td>LoRA (repr.)</td><td>6e-4</td><td>1</td><td>69.63</td><td>8.79 45.70</td><td>71.55</td><td>2.39</td></tr><tr><td>Delta-LoRA</td><td>2e-4</td><td>2</td><td>70.84 8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr></table>
162
+
163
+ The Extra Updatable Parameters. We introduce the concept of extra updatable parameters to point out the superiority of Delta-LoRA. For most PEFT methods, they can only adjust the low-rank adapters, such as AdapterHoulsby et al. (2019) and LoRAHu et al. (2022). Thus, they don’t have any extra parameters to update, which means their extra updatable parameters are 0. However, our Delta-LoRA can achieve the purpose of updating the W matrix without increasing the GPU memory consumption, which means its extra updatable parameters are the parameter number of $W$ .
164
+
165
+ Ablation study. To better understand the contribution of our modified LoRA module (i.e. DeltaLoRA module) and the effectiveness of our update algorithm, we conduct studies on E2E Challenge dataset with GPT2-medium. As shown in Table 6, only updating the pre-trained matrices with delta of low-rank update can indeed achieve performance improvement, while further discarding the dropout in Delta-LoRA module obtains the best performance. This observation confirms the indispensable role played by each component within our proposed methodology. We have devised an experiment to further differentiate whether the performance enhancement stems from the inherent characteristics of our method rather than solely from the substantial update magnitude. According to our algorithm, we update the parameters of both pre-trained and low-rank matrices, which can arose the doubt of whether the improvement is caused by updating larger $\triangle A B$ on the weights instead of introducing more parameters into the optimization process. To answer this question, we design an experiment with results shown in Table 7 to prove the effectiveness of our method. We scale the learning rate of LoRA from 2e-4 to 6e-4 making sure that $W + A B$ can be updated with $3 \times \triangle A B$ , which is equivalent to Delta-LoRA when $\lambda$ is set to 2. We find that even by updating with $3 \times \triangle A B$ on $_ { A B }$ , the performance is still not comparable with Delta-LoRA. This experiment further proves that introducing more parameters into the optimization process can force to learn better representation.
166
+
167
+ ![](images/9dcc54c551ff5c3ecbf10e382ac75f464784f07e54ba1c1d36ef9cdb8534030b.jpg)
168
+ Figure 3: The comparison of Fine-Tuning‡, LoRA as well as Delta-LoRA for the cosine similarity between the fine-tuned parameters and the original pre-trained parameters in each transformer block. Higher value means higher similarity.
169
+
170
+ The cosine similarity between fine-tuned and the pre-trained parameters to measure learning effects. We conduct a comparative analysis of three methods including Fine-Tuning‡, LoRA and Delta-LoRA, in order to elucidate the reasons behind Delta-LoRA’s superior performance. We use the last checkpoint trained on E2E Challenge dataset to give understanding. As depicted in Figure 3, it is evident that LoRA exhibits the highest similarity across the majority of transformer blocks. This observation suggests that LoRA primarily modifies the matrix $\pmb { W } ^ { * } = \pmb { W } + \pmb { A } \pmb { B }$ within a limited range. Nevertheless, Delta-LoRA showcases the lowest cosine similarity, underscoring that our approach induces the most significant modifications to the final matrix $W ^ { * }$ . Due to this property, our approach can effectively stimulate the model to acquire better representations, leading to state-of-the-art performance across all four PEFT methods. This observation further aligns with the evaluation results in Table 1: Delta-LoRA achieves the best performance among the three methods, whereas LoRA is slightly worse than Fine-Tuning‡.
171
+
172
+ # 6 CONCLUSION
173
+
174
+ In this paper, we have introduced Delta-LoRA, a novel method to simultaneously update the full weight matrix and two low-rank matrices. Delta-LoRA leverages the delta $( { \pmb A } ^ { ( t + 1 ) } { \pmb B } ^ { ( t + 1 ) } - { \pmb A } ^ { ( t ) } { \pmb B } ^ { ( t ) } )$ to update the pre-trained weights $( W )$ . In this way, we introduce more learnable parameters into the optimization process such that the model can learn a better representation with comparable memory cost as LoRA. Meanwhile, we identify the Dropout layer in the low-rank branch to be unnecessary according to the gradient flow. We also provide thorough analysis of our method to understand its effectiveness and robustness. Extensive experiments on a broad range of NLP tasks are conducted to empirically verify the effectiveness of our Delta-LoRA.
175
+
176
+ # REFERENCES
177
+
178
+ Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In NeurIPS, 2020.
179
+
180
+ Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, Harsha Nori, Hamid Palangi, Marco Tulio Ribeiro, and Yi Zhang. Sparks of artificial general intelligence: Early experiments with gpt-4, 2023.
181
+ Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020.
182
+ Arnav Chavan, Zhuang Liu, Deepak Gupta, Eric Xing, and Zhiqiang Shen. One-for-all: Generalized lora for parameter-efficient fine-tuning. arXiv preprint arXiv:2306.07967, 2023.
183
+ Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. Qlora: Efficient finetuning of quantized llms. arXiv preprint arXiv:2305.14314, 2023.
184
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL, 2019.
185
+ Ning Ding, Yujia Qin, Guang Yang, Fuchao Wei, Zonghan Yang, Yusheng Su, Shengding Hu, Yulin Chen, Chi-Min Chan, Weize Chen, Jing Yi, Weilin Zhao, Zhiyuan Liu, Hai-Tao Zheng, Jianfei Chen, Yang Liu, Jie Tang, Juanzi Li, and Maosong Sun. Parameter-efficient fine-tuning of large-scale pre-trained language models. Nature Machine Intelligence, 2023.
186
+ Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
187
+ Claire Gardent, Anastasia Shimorina, Shashi Narayan, and Laura Perez-Beltrachini. The WebNLG challenge: Generating text from RDF data. In Proceedings of the 10th International Conference on Natural Language Generation, 2017.
188
+ Demi Guo, Alexander M Rush, and Yoon Kim. Parameter-efficient transfer learning with diff pruning. In ACL, 2021.
189
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In ICCV, 2015.
190
+ Pengcheng He, Jianfeng Gao, and Weizhu Chen. Debertav3: Improving deberta using electra-style pre-training with gradient-disentangled embedding sharing. arXiv preprint arXiv:2111.09543, 2021.
191
+ Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin De Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for nlp. In ICML, 2019.
192
+ Edward J Hu, yelong shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. In ICLR, 2022.
193
+ Shaoyi Huang, Dongkuan Xu, Ian Yen, Yijue Wang, Sung-En Chang, Bingbing Li, Shiyang Chen, Mimi Xie, Sanguthevar Rajasekaran, Hang Liu, and Caiwen Ding. Sparse progressive distillation: Resolving overfitting under pretrain-and-finetune paradigm. In ACL, 2022.
194
+ Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. In EMNLP, 2021.
195
+ Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461, 2019.
196
+ Junnan Li, Ramprasaath Selvaraju, Akhilesh Gotmare, Shafiq Joty, Caiming Xiong, and Steven Chu Hong Hoi. Align before fuse: Vision and language representation learning with momentum distillation. 2021.
197
+ Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. In Chengqing Zong, Fei Xia, Wenjie Li, and Roberto Navigli (eds.), ACL, 2021.
198
+ Haokun Liu, Derek Tam, Mohammed Muqeeth, Jay Mohta, Tenghao Huang, Mohit Bansal, and Colin A Raffel. Few-shot parameter-efficient fine-tuning is better and cheaper than in-context learning. In NeurIPS, 2022a.
199
+ Xiao Liu, Kaixuan Ji, Yicheng Fu, Weng Tam, Zhengxiao Du, Zhilin Yang, and Jie Tang. P-tuning: Prompt tuning can be comparable to fine-tuning across scales and tasks. In ACL, 2022b.
200
+ 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, 2023.
201
+ Yinhan 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.
202
+ Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In ICLR, 2019.
203
+ Kai Lv, Yuqing Yang, Tengxiao Liu, Qinghui Gao, Qipeng Guo, and Xipeng Qiu. Full parameter fine-tuning for large language models with limited resources. 2023.
204
+ Shashi Narayan, Shay B Cohen, and Mirella Lapata. Don’t give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. arXiv preprint arXiv:1808.08745, 2018.
205
+ Jonas Pfeiffer, Aishwarya Kamath, Andreas Rücklé, Kyunghyun Cho, and Iryna Gurevych. Adapterfusion: Non-destructive task composition for transfer learning. In EACL, 2021.
206
+ Yevgeniy Puzikov and Iryna Gurevych. E2E NLG challenge: Neural models vs. templates. In Proceedings of the 11th International Conference on Natural Language Generation, 2018.
207
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
208
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J Liu, et al. Exploring the limits of transfer learning with a unified text-to-text transformer. JMLR, 21(140):1–67, 2020.
209
+ Taylor Shin, Yasaman Razeghi, Robert L Logan IV, Eric Wallace, and Sameer Singh. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. In EMNLP, 2020.
210
+ Chuanqi Tan, Fuchun Sun, Tao Kong, Wenchang Zhang, Chao Yang, and Chunfang Liu. A survey on deep transfer learning. In ICANN, 2018.
211
+ 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.
212
+ Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023.
213
+ Mojtaba Valipour, Mehdi Rezagholizadeh, Ivan Kobyzev, and Ali Ghodsi. Dylora: Parameter-efficient tuning of pre-trained models using dynamic search-free low-rank adaptation. In EACL, 2023.
214
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017.
215
+ Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In ICLR, 2019.
216
+ Yaqing Wang, Subhabrata Mukherjee, Xiaodong Liu, Jing Gao, Ahmed Hassan Awadallah, and Jianfeng Gao. Adamix: Mixture-of-adapter for parameter-efficient tuning of large language models. In EMNLP, 2022.
217
+ Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, et al. Huggingface’s transformers: State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771, 2019.
218
+ Elad Ben Zaken, Shauli Ravfogel, and Yoav Goldberg. Bitfit: Simple parameter-efficient fine-tuning for transformer-based masked language-models. arXiv preprint arXiv:2106.10199, 2021.
219
+ Longteng Zhang, Lin Zhang, Shaohuai Shi, Xiaowen Chu, and Bo Li. Lora-fa: Memory-efficient low-rank adaptation for large language models fine-tuning. arXiv preprint arXiv:2308.03303, 2023.
220
+ Qingru Zhang, Minshuo Chen, Alexander Bukharin, Pengcheng He, Yu Cheng, Weizhu Chen, and Tuo Zhao. Adaptive budget allocation for parameter-efficient fine-tuning. In ICLR, 2022.
221
+ Sixiao Zheng, Jiachen Lu, Hengshuang Zhao, Xiatian Zhu, Zekun Luo, Yabiao Wang, Yanwei Fu, Jianfeng Feng, Tao Xiang, Philip HS Torr, et al. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. In CVPR, 2021.
222
+ Han Zhou, Xingchen Wan, Ivan Vulic, and Anna Korhonen. Autopeft: Automatic configuration ´ search for parameter-efficient fine-tuning. arXiv preprint arXiv:2301.12132, 2023.
223
+
224
+ # A APPENDIX
225
+
226
+ # A.1 BASELINES
227
+
228
+ We compare our proposed method Delta-LoRA with Fine-Tuning and prior works of LoRA, AdaLoRA, and DyLoRA. For PEFT methods, we only train the incremental updates for $W _ { V }$ and $W _ { Q }$ , following the setup as used in LoRA’s paper. For Fine-Tuning methods, we use two extra training paradigms: (1) freeze the embedding and train all the other parameters as Fine-Tuning $\dagger$ ; (2) train $W _ { V }$ and $W _ { Q }$ only as Fine-Tuning‡.
229
+
230
+ Fine-Tuning. In the past few years, fine-tuning has become the mainstream paradigm for both NLP and CV tasks. However, fine-tuning full parameters is subject to potential drawbacks including overfitting and training instability (Huang et al., 2022). Therefore, freezing a subset of network layers and fine-tuning the rest has become a popular choice (Tan et al., 2018). In our experiments, we compare with full fine-tuning, fine-tuning with embedding layers frozen (Fine-tuning $\dagger .$ ) and fine-tuning query and value matrices only (Fine-tuning $\ddagger$ ).
231
+
232
+ LoRA (Hu et al., 2022) uses multiplication of two low-rank matrices to learn the incremental updates with reduced GPU memory cost. We follow their setups to reproduce experimental results for fair comparison.
233
+
234
+ DyLoRA (Valipour et al., 2023) randomly chooses a rank $r$ for LoRA modules during learning.
235
+
236
+ AdaLoRA (Zhang et al., 2022) focuses on the challenge of determining the optimal rank for incremental updates. It employs an adaptive approach to singular value pruning, tailoring the rank selection to the magnitude of each singular value. Consequently, distinct ranks are employed for different layers.
237
+
238
+ A.2 THE COMPARISON BETWEEN LORA AND DELTA-LORA WITH LLAMA-7B
239
+
240
+ # A.2.1 TRAINING AND INFERENCE ARGUMENTS USED IN OUR METHOD AND BASELINE
241
+
242
+ We choose LLaMA-7B to evaluate our method and LoRA. Here, we set the learning rate $\gamma = 1 \mathrm { e } { - } 4$ , batch size to 128, $r = 8$ , $\alpha = 1 6$ , and training epochs to 3 for both two methods. Following the LoRA’s paper, we only tune $W _ { Q }$ and $W _ { V }$ . For Delta-LoRA, we choose start steps $K = 1 0 0$ and $\lambda = 0 . 2 5$ . When inference, we set the no_repeat_ngram_size $= 1 0$ , temperature ${ } = 0$ and beam size $=$ 4 to get a certain answer.
243
+
244
+ # A.2.2 THE EVALUATION FOR OUR METHOD AND BASELINES
245
+
246
+ Current LLMs obtain the training data from the Internet, which may unintentionally cause data leakage. Therefore, using the mainstream NLP datasets to evaluate the effectiveness of Large Language Model is not reasonable and wisdom. Inspired by evaluation approach proposed by Liu et al. (2023), we decided to use GPT-4 to judge the text generated by which method is accurate. First, we ask GPT-4 to generate 1,000 different questions. Second, we use the LLaMA-7B trained by two methods to generate the texts. Finally, we ask GPT-4 to give decision to tell us which text is accurate. It can choose from three options: a. Choice 1 (LoRA generates accurate text), b. Choice 2 (Delta-LoRA generates accurate text) and c. Both Choice 1 and 2 (Both LoRA and Delta-LoRA generate accurate texts). The prompt we used for evaluation:
247
+
248
+ Help me to determine which text is accurate for the given instruction and question. The answer can be chosen from a. Choice 1 is accurate, b. Choice 2 is accurate or c. both Choice 1 and 2 are accurate. Give me a certain answer and this is a choice question. Please don’t give reasons and the answer must be shorter than 20 words.
249
+
250
+ Question: "" (Choice 1): "" (Choice 2): ""
251
+
252
+ # A.3 ALGORITHM OF DELTA-LORA
253
+
254
+ Our Delta-LoRA can be found in Algorithm 1. Compared to LoRA, we added a step to update the pre-trained $W$ without any extra GPU memory consumption.
255
+
256
+ Algorithm 1: Delta-LoRA
257
+
258
+ <table><tr><td>Input: Learning rate n; weight decay β; total training iterations T; low rank r; scale factor α; start steps K;update ratio 入. A is initialized by Kaiming Initialization, B= O and W is initialized with pre-trained weights. fort=0,..,T-1do Sample a mini-batch and compute gradients for {A,B} in each Delta-LoRA module.</td></tr><tr><td>Update the first and second moments maintained by the optimizer with the computed gradients,</td></tr><tr><td>and get the normalized gradients gA and gB . A(t+1) ← A(t)-ngA-nβA6) B(t+1)←B(t)-ngB-nβB(t)</td></tr><tr><td>ift&gt;Kdo W(t+1) ←W(t) +λ··(A(t+1)B(t+1)-A(t)B(t))</td></tr><tr><td>end if end for</td></tr><tr><td>Output: the fine-tuned parameters {W(T),A(T), B(T) }</td></tr></table>
259
+
260
+ # A.4 A FURTHER UNDERSTANDING OF DELTA-LORA
261
+
262
+ A.4.1 THE DIFFERENCES BETWEEN LORA AND DELTA-LORA
263
+
264
+ There are some fundamental differences between LoRA and Delta-LoRA.
265
+
266
+ • Given $W + A B$ , $W$ is fixed in LoRA, but $W$ will be updated in our Delta-LoRA. This is the largest difference between LoRA and Delta-LoRA. This modification can yield more training differences between LoRA and Delta-LoRA in the next few training steps.
267
+
268
+ $\cdot$ $\mathrm { R a n k } ( \Delta W _ { D e l t a - L o R A } ) = \mathrm { R a n k } ( W ^ { ( T ) } - W ^ { ( 0 ) } + A B ) > \mathrm { R a n k } ( \Delta W _ { L o R A } ) = \mathrm { R a n k } ( A B ) .$ The rank of the learned incremental weight matrix in our Delta-LoRA is larger than that in the original LoRA.
269
+
270
+ $\bullet$ The gradient flow is different between LoRA and Delta-LoRA. Suppose that we have $\pmb { W } \in \mathbb { R } ^ { m \times n }$ , $\pmb { A } \in \mathbb { R } ^ { m \times r }$ and $\boldsymbol { B } \in \mathbb { R } ^ { r \times n }$ , where $r \leq \operatorname* { m i n } ( m , n )$ . For LoRA, it keeps $W$ frozen, so that $W ^ { * } =$ $\begin{array} { r } { { \cal W } ^ { ( 0 ) } + \frac { \alpha } { r } \cdot { \cal A } ^ { ( t ) } { \cal B } ^ { ( t ) } } \end{array}$ . For Delta-LoRA, it updates all matrices, and has $\begin{array} { r } { W ^ { * } = W ^ { ( t ) } + \frac { \alpha } { r } \cdot A ^ { ( t ) } B ^ { ( t ) } } \end{array}$ .
271
+
272
+ $$
273
+ \frac \left[ \begin{array} { l l l l } { \displaystyle \frac { A ^ { h _ { i } } } { \eta } } & { \displaystyle + \frac { \eta } { \eta } } & { \displaystyle } & { \right] } \left[ \begin{array} { l l l l } { \displaystyle \frac { A ^ { h _ { i } } } { \eta } } & { \displaystyle + \frac { \eta } { \eta } } & { \displaystyle h _ { i + 1 } = h _ { i } A } & { h _ { i + 1 } \in \mathbb R ^ { h \times r } } \\ { \displaystyle \frac { A ^ { h } } { \eta } } & { \displaystyle \frac { A ^ { h } } { \eta } } & { h _ { i + 1 } } & { h _ { i + 2 } = h _ { i + 1 } B } & { h _ { i + 2 } \in \mathbb R ^ { h \times n } } \\ { \displaystyle \frac { \left[ \begin{array} { l l l l } { \displaystyle h _ { i + 3 } } & { \displaystyle - \frac { A ^ { h } } { \eta } } & { \displaystyle h _ { i + 2 } } & { \displaystyle h _ { i + 3 } = h _ { i } W } & { h _ { i + 3 } \in \mathbb R ^ { b \times n } } \\ { \displaystyle h _ { i + 4 } } & { \displaystyle } & { \displaystyle } & { } \end{array} \right] } { \le\right]ft[ \begin{array} { l } { \displaystyle h _ { i + 3 } } \\ { \displaystyle h _ { i + 4 } } \end{array} \right] } } \end{array} \end{array}
274
+ $$
275
+
276
+ Figure 4: The backward propagation of Delta-LoRA.
277
+
278
+ So, we have the following equation according to Figure 4:
279
+
280
+ $$
281
+ \begin{array} { r l } & { \frac { \partial \mathcal { L } } { \partial W ^ { ( t ) } } = ( \frac { \partial h _ { i + 3 } } { \partial W ^ { ( t ) } } ) ^ { \top } \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } = h _ { i } ^ { \top } \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } } \\ & { \frac { \partial \mathcal { L } } { \partial A ^ { ( t ) } } = ( \frac { \partial h _ { i + 1 } } { \partial A ^ { ( t ) } } ) ^ { \top } \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } \cdot \frac { \partial h _ { i + 4 } } { \partial h _ { i + 2 } } \cdot \frac { \partial h _ { i + 2 } } { \partial h _ { i + 1 } } = h _ { i } ^ { \top } \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } \frac { \partial h _ { i + 2 } } { \partial h _ { i + 1 } } = h _ { i } ^ { \top } \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } B ^ { ( t ) \top } = \frac { \partial \mathcal { L } } { \partial W ^ { ( t ) } } \cdot B ^ { ( t ) \top } } \end{array}
282
+ $$
283
+
284
+ $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial B ^ { ( t ) } } = ( \frac { \partial h _ { i + 1 } } { \partial B ^ { ( t ) } } ) ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } \cdot \frac { \partial h _ { i + 4 } } { \partial h _ { i + 2 } } = h _ { i + 2 } ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } = ( A ^ { ( t ) } ) ^ { \top } \cdot h _ { i } ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } = ( A ^ { ( t ) } ) ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial W ^ { ( t ) } } } \end{array}$ Here, we provide the back-propagation process of LoRA:
285
+
286
+ $$
287
+ \begin{array} { r l } & { \frac { \partial \mathcal { L } } { \partial A ^ { ( t + 1 ) } } = \frac { \partial \mathcal { L } } { \partial W ^ { ( t + 1 ) } } \cdot ( B ^ { ( t + 1 ) } ) ^ { \top } = \frac { \partial \mathcal { L } } { \partial ( W ^ { ( 0 ) } + ( A ^ { ( t ) } + \Delta A ^ { ( t ) } ) ( B ^ { ( t ) } + \Delta B ^ { ( t ) } ) ) } \cdot ( B ^ { ( t ) } + \Delta B ^ { ( t ) } ) ^ { \top } } \\ & { \frac { \partial \mathcal { L } } { \partial B ^ { ( t + 1 ) } } = ( A ^ { ( t + 1 ) } ) ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial W ^ { ( t + 1 ) } } = ( A ^ { ( t ) } + \Delta A ^ { ( t ) } ) ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial ( W ^ { ( 0 ) } + ( A ^ { ( t ) } + \Delta A ^ { ( t ) } ) ( B ^ { ( t ) } + \Delta B ^ { ( t ) } ) ) } } \end{array}
288
+ $$
289
+
290
+ This is the back-propagation process of Delta-LoRA:
291
+
292
+ $$
293
+ \begin{array} { r l } & { \frac { \partial \mathcal { L } } { \partial A ^ { ( t + 1 ) } } = \frac { \partial \mathcal { L } } { \partial W ^ { ( t + 1 ) } } \cdot ( B ^ { ( t + 1 ) } ) ^ { \top } = \frac { \partial \mathcal { L } } { \partial ( ( W ^ { ( t ) } + \lambda \Delta A ^ { ( t ) } B ^ { ( t ) } ) + ( A ^ { ( t ) } + \Delta A ^ { ( t ) } ) ( B ^ { ( t ) } + \Delta B ^ { ( t ) } ) } \cdot ( B ^ { ( t ) } + \Delta B ^ { ( t ) } ) ^ { \top } } \\ & { \frac { \partial \mathcal { L } } { \partial B ^ { ( t + 1 ) } } = ( A ^ { ( t + 1 ) } ) ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial W ^ { ( t + 1 ) } } = ( A ^ { ( t ) } + \Delta A ^ { ( t ) } ) ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial ( ( W ^ { ( t ) } + \lambda \Delta A ^ { ( t ) } B ^ { ( t ) } ) + ( A ^ { ( t ) } + \Delta A ^ { ( t ) } ) ( B ^ { ( t ) } + \Delta B ^ { ( t ) } ) ) } } \end{array}
294
+ $$
295
+
296
+ # A.4.2 THE EXPANSION OF $\triangle { A B }$
297
+
298
+ In the real training process, we need to consider a variety of training arguments, such as optimizer and the regularization for $\triangle A B$ . Suppose that we use the AdamW (Loshchilov & Hutter, 2019) and $L _ { 2 }$ regularization, the $\triangle A B$ can be expanded in the following equation:
299
+
300
+ $$
301
+ \begin{array} { r l } & { \triangle A B = A ^ { ( t + 1 ) } B ^ { ( t + 1 ) } - A ^ { ( t ) } B ^ { ( t ) } } \\ & { \qquad = ( A ^ { ( t ) } - \eta \hat { g } _ { A } - \eta \beta A ^ { ( t ) } ) \cdot ( B ^ { ( t ) } - \eta \hat { g } _ { B } - \eta \beta B ^ { ( t ) } ) - A ^ { ( t ) } B ^ { ( t ) } } \\ & { \qquad = A ^ { ( t ) } B ^ { ( t ) } - \eta A ^ { ( t ) } \hat { g } _ { B } - \eta \beta A ^ { ( t ) } B ^ { ( t ) } - \eta \hat { g } _ { A } B ^ { ( t ) } + \eta ^ { 2 } \hat { g } _ { A } \hat { g } _ { B } + \eta ^ { 2 } \beta \hat { g } _ { A } B ^ { ( t ) } } \\ & { \qquad - \eta \beta A ^ { ( t ) } B ^ { ( t ) } + \eta ^ { 2 } \beta A ^ { ( t ) } \hat { g } _ { B } + \eta ^ { 2 } \beta ^ { 2 } A ^ { ( t ) } B ^ { ( t ) } - A ^ { ( t ) } B ^ { ( t ) } } \\ & { \qquad = - \eta A ^ { ( t ) } \hat { g } _ { B } - \eta \beta A ^ { ( t ) } B ^ { ( t ) } - \eta \hat { g } _ { A } B ^ { ( t ) } + \eta ^ { 2 } \hat { g } _ { A } \hat { g } _ { B } + \eta ^ { 2 } \beta \hat { g } _ { A } B ^ { ( t ) } } \\ & { \qquad - \eta \beta A ^ { ( t ) } B ^ { ( t ) } + \eta ^ { 2 } \beta A ^ { ( t ) } \hat { g } _ { B } + \eta ^ { 2 } \beta ^ { 2 } A ^ { ( t ) } B ^ { ( t ) } } \\ & { \qquad \approx - \eta A ^ { ( t ) } \hat { g } _ { B } - \eta \hat { g } _ { A } B ^ { ( t ) } } \end{array}
302
+ $$
303
+
304
+ where $\eta$ is the learning rate, $\beta$ is weight decay. What’s more, for pre-trained weight $W , \triangle W =$ $\eta \widehat { g } _ { W } + \eta \beta W ^ { ( t ) }$ . As a consequence, $\triangle A B$ is not equal to $\triangle W$ in the training process.
305
+
306
+ A.5 CHANGE THE LEARNING RATE AND START STEPS TO SHOW BETTER PERFORMANCE.
307
+
308
+ We explored better hyper parameters of our Delta-LoRA by modifying the learning rate and trying more start steps and update ratio to prove the effectiveness of Delta-LoRA.
309
+
310
+ Table 8: The evaluation results of our proposed Delta-LoRA by using better hyper-parameters on GLUE benchmark.
311
+
312
+ <table><tr><td>Method</td><td>MNLI</td><td> SST-2</td><td>MRPC</td><td>CoLA</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>STS-B</td><td>AVG</td></tr><tr><td>LoRA</td><td>87.40</td><td>94.61</td><td>89.95</td><td>63.17</td><td>93.02</td><td>90.67</td><td>86.64</td><td>91.54</td><td>87.12</td></tr><tr><td>DyLoRA</td><td>86.33</td><td>94.26</td><td>89.46</td><td>61.12</td><td>92.22</td><td>90.17</td><td>84.47</td><td>91.06</td><td>86.14</td></tr><tr><td>AdaLoRA</td><td>87.34</td><td>94.49</td><td>90.19</td><td>61.64</td><td>93.08</td><td>90.14</td><td>85.19</td><td>91.16</td><td>86.65</td></tr><tr><td>Delta-LoRA</td><td>87.62±0.21</td><td>95.29±0.23 90.60±0.14</td><td></td><td></td><td>64.64±0.86 93.09±0.15 91.01±0.06 87.00±0.36 91.61±0.04 87.60</td><td></td><td></td><td></td><td></td></tr></table>
313
+
314
+ Table 9: The better training hyper-parameters that we obtained of our proposed Delta-LoRA on GLUE benchmark.
315
+
316
+ <table><tr><td>Hyper-Parameter|MNLI SST-2 MRPC CoLA QNLI QQP RTE STS-B</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Learning Raten|4e-4 5e-4 5e-4 6e-4 3e-4 6e-4 4e-4 4e-4</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Start Steps K</td><td>2000400</td><td></td><td>10</td><td>200600400200200</td><td></td><td></td><td></td><td></td></tr><tr><td>Update Ratio入</td><td>0.5</td><td>0.5</td><td>0.5</td><td>1</td><td>1</td><td>0.50.5</td><td></td><td>0.5</td></tr></table>
317
+
318
+ # A.6 THE PARAMETER SENSITIVITY STUDY
319
+
320
+ Table 10: The parameter sensitivity study of update ratio $\lambda$ for our proposed Delta-LoRA on E2E Challenge dataset. The best results are boldfaced.
321
+
322
+ <table><tr><td>入</td><td>BLEU</td><td>NIST</td><td>METEOR</td><td>ROUGE-L</td><td>CIDEr</td></tr><tr><td>0</td><td>68.94</td><td>8.73</td><td>45.27</td><td>70.81</td><td>2.41</td></tr><tr><td>1</td><td>69.77</td><td>8.81</td><td>45.99</td><td>71.58</td><td>2.46</td></tr><tr><td>2</td><td>70.84</td><td>8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr><tr><td>3</td><td>70.14</td><td>8.84</td><td>46.39</td><td>71.45</td><td>2.45</td></tr><tr><td>4</td><td>70.03</td><td>8.83</td><td>46.21</td><td>71.56</td><td>2.47</td></tr><tr><td>5</td><td>70.13</td><td>8.85</td><td>46.35</td><td>71.72</td><td>2.48</td></tr></table>
323
+
324
+ Parameter Sensitivity. Here, we explore the hyper-parameter $K$ in Algorithm 1 and $\lambda$ in Equation 6. For the hyper-parameter $K$ , we select it from 0 to 1000 with the interval of 100. From Table 11, we find that our Delta-LoRA could not bring in any improvement before $K = 4 0 0$ , and it will keep a relatively good performance when $K$ is larger than 500. What is more, we choose different numbers for $\lambda$ , ranging from 0 to 5. According to Table 10, the 5 metrics rise rapidly after $\lambda = 0$ and reach best at $\lambda = 2$ , while the performance has small drops on 5 evaluation scores if $\lambda$ is chosen from 3 to 5.
325
+
326
+ Table 11: The parameter sensitivity study of start steps $K$ for our proposed Delta-LoRA on E2E Challenge dataset. The best results are boldfaced.
327
+
328
+ <table><tr><td>K</td><td>BLEU</td><td>NIST</td><td>METEOR</td><td>ROUGE-L</td><td>CIDEr</td></tr><tr><td>0</td><td>69.10</td><td>8.75</td><td>45.54</td><td>71.31</td><td>2.41</td></tr><tr><td>100</td><td>69.97</td><td>8.84</td><td>46.07</td><td>71.40</td><td>2.46</td></tr><tr><td>200</td><td>69.72</td><td>8.83</td><td>45.82</td><td>71.41</td><td>2.43</td></tr><tr><td>300</td><td>69.73</td><td>8.86</td><td>45.98</td><td>71.09</td><td>2.46</td></tr><tr><td>400</td><td>70.18</td><td>8.89</td><td>46.30</td><td>71.66</td><td>2.49</td></tr><tr><td>500</td><td>70.84</td><td>8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr><tr><td>600</td><td>70.38</td><td>8.86</td><td>46.38</td><td>71.70</td><td>2.47</td></tr><tr><td>700</td><td>70.61</td><td>8.89</td><td>46.43</td><td>72.13</td><td>2.51</td></tr><tr><td>800</td><td>70.70</td><td>8.89</td><td>46.30</td><td>71.97</td><td>2.51</td></tr><tr><td>900</td><td>71.00</td><td>8.92</td><td>46.47</td><td>72.04</td><td>2.52</td></tr><tr><td>1000</td><td>70.87</td><td>8.89</td><td>46.31</td><td>72.06</td><td>2.50</td></tr></table>
329
+
330
+ # A.7 HYPER-PARAMETER USED IN OUR EXPERIMENTS
331
+
332
+ We report the hyper-parameter that used in our experiments. Table 12 and Table 13 show the hyperparameter that we used for the training and evaluation on E2E Challenge and WebNLG Challenge 2017 dataset. The Table 14 and Table 15 are the training and evaluation hyper parameter for XSum dataset, and the Table 16 consists of hyper-parameters for 8 datasets in GLUE benchmark.
333
+
334
+ Table 12: The training hyper-parameter used for E2E Challenge and WebNLG Challenge 2017 dataset.
335
+
336
+ <table><tr><td>Hyper-Parameter</td><td>E2E Challenge</td><td>WebNLG Challenge 2017</td></tr><tr><td>Learning Rate n</td><td>2e-4</td><td>2e-4</td></tr><tr><td>Batch Size</td><td>8</td><td>8</td></tr><tr><td>Number of Epochs</td><td>5</td><td>5</td></tr><tr><td>Weight Decay β</td><td>0.01</td><td>0.01</td></tr><tr><td>Resid_pdrop</td><td>0</td><td>0.09</td></tr><tr><td>Attn_pdrop</td><td>0</td><td>0.09</td></tr><tr><td>Embd_pdrop</td><td>0</td><td>0</td></tr><tr><td>Label Smooth</td><td>0</td><td>0</td></tr><tr><td> Start Steps K</td><td>500</td><td>500</td></tr><tr><td>Update Ratio 入</td><td>2</td><td>5</td></tr><tr><td>Rank r</td><td>4</td><td>4</td></tr><tr><td>Alpha α</td><td>32</td><td>32</td></tr><tr><td>Trainable Matrices</td><td>Wq,Wv</td><td>Wq,Wv</td></tr><tr><td>LR Scheduler</td><td>Linear</td><td>Linear</td></tr><tr><td>Warmup Steps</td><td>500</td><td>500</td></tr></table>
337
+
338
+ Table 13: The hyper-parameter for evaluation used for E2E Challenge and WebNLG Challenge 2017 dataset.
339
+
340
+ <table><tr><td>Hyper-Parameter</td><td>E2E Challenge</td><td>WebNLG Challenge 2017</td></tr><tr><td>Beam Size</td><td>10</td><td>5</td></tr><tr><td>Penalty</td><td>0.8</td><td>1.0</td></tr><tr><td>No Repeat Ngram Size</td><td>4</td><td>4</td></tr></table>
341
+
342
+ Table 14: The training hyper-parameter used for XSum dataset.
343
+
344
+ <table><tr><td>Hyper-Parameter</td><td>Xsum</td></tr><tr><td>Learning Rate n</td><td>2e-4</td></tr><tr><td>Batch Size</td><td>64</td></tr><tr><td>Number of Epochs</td><td>25</td></tr><tr><td>Weight Decay β</td><td>0</td></tr><tr><td>Activation Dropout</td><td>0</td></tr><tr><td>Dropout Classifier Dropout</td><td>0</td></tr><tr><td>Start Steps K</td><td>0</td></tr><tr><td></td><td>1000</td></tr><tr><td>Update Ratio 入</td><td>0.5</td></tr><tr><td>Rank r</td><td>4</td></tr><tr><td>Alpha α Trainable Matrices</td><td>32</td></tr><tr><td>LR Scheduler</td><td>Wq, Wv Linear</td></tr><tr><td>Warmup Steps</td><td>3000</td></tr></table>
345
+
346
+ Table 15: The hyper-parameter for evaluation used for XSum dataset.
347
+
348
+ <table><tr><td>Hyper-Parameter</td><td>Xsum</td></tr><tr><td>Beam Size</td><td>8</td></tr><tr><td>Penalty</td><td>1.0</td></tr><tr><td>No Repeat N-gram Size</td><td>4</td></tr></table>
349
+
350
+ Table 16: The training hyper-parameters of our proposed Delta-LoRA on GLUE benchmark. We adopt the most of hyper-parameters in LoRA’s paper and implement our method based on the codes given by LoRA’s repository.
351
+
352
+ <table><tr><td>Hyper-Parameter</td><td>MNLI</td><td>SST-2</td><td>MRPC</td><td>CoLA</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>STS-B</td></tr><tr><td>Learning Rate n</td><td>5e-4</td><td>5e-4</td><td>4e-4</td><td>4e-4</td><td>4e-4</td><td>4e-4</td><td>4e-4</td><td>4e-4</td></tr><tr><td>Batch Size</td><td>128</td><td>128</td><td>128</td><td>64</td><td>256</td><td>128</td><td>128</td><td>128</td></tr><tr><td>Number of Epochs</td><td>30</td><td>60</td><td>30</td><td>80</td><td>25</td><td>25</td><td>80</td><td>40</td></tr><tr><td>Weight Decay β</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>Max Sequence Length</td><td>256</td><td>256</td><td>256</td><td>256</td><td>256</td><td>256</td><td>512</td><td>256</td></tr><tr><td>Start Steps K</td><td>2000</td><td>400</td><td>10</td><td>100</td><td>800</td><td>400</td><td>200</td><td>200</td></tr><tr><td>Update Ratio 入</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td></tr><tr><td>Rank r</td><td>8</td><td>8</td><td>8</td><td>8</td><td>8</td><td>8</td><td>8</td><td>8</td></tr><tr><td>Alpha α</td><td>16</td><td>16</td><td>16</td><td>16</td><td>16</td><td>16</td><td>16</td><td>16</td></tr><tr><td>LR Scheduler</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td></tr><tr><td>Trainable Matrices</td><td>WQ,Wv WQ.Wv WQ,Wv</td><td></td><td></td><td>Wq,Wv</td><td></td><td></td><td></td><td> WQ,Wv WQ,Wv WQ,Wv WQ.Wv</td></tr><tr><td>Warmup Ratio</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td></tr><tr><td>Evaluation Metrics</td><td></td><td>Accuracy Accuracy Accuracy</td><td></td><td> Mthtion Accuracy Accuracy Accuracy</td><td></td><td></td><td></td><td>Pearson</td></tr></table>
parse/test/FAO4VS9QRV/FAO4VS9QRV_content_list.json ADDED
@@ -0,0 +1,811 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "DELTA-LORA: FINE-TUNING HIGH-RANK PARAMETERS WITH THE DELTA OF LOW-RANK MATRICES ",
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": "In this paper, we present Delta-LoRA, which is a novel parameter-efficient approach to fine-tune large language models (LLMs). In contrast to LoRA and other low-rank adaptation methods such as AdaLoRA, Delta-LoRA not only updates the low-rank matrices $\\pmb { A }$ and $\\textbf { { B } }$ , but also propagate the learning to the pre-trained weights $W$ via updates utilizing the delta of the product of two low-rank matrices $( \\boldsymbol { A } ^ { ( \\bar { t } + 1 ) } \\boldsymbol { B } ^ { ( t + 1 ) } - \\boldsymbol { A } ^ { ( t ) } \\boldsymbol { B } ^ { ( t ) } )$ . Such a strategy effectively addresses the limitation that the incremental update of low-rank matrices is inadequate for learning representations capable for downstream tasks. Moreover, as the update of $W$ does not need to compute the gradients of $W$ and store their momentums, Delta-LoRA shares comparable memory requirements and computational costs with LoRA. Extensive experiments show that Delta-LoRA significantly outperforms existing low-rank adaptation methods. We further support these results with comprehensive analyses that underscore the effectiveness of Delta-LoRA. ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "1 INTRODUCTION ",
27
+ "text_level": 1,
28
+ "page_idx": 0
29
+ },
30
+ {
31
+ "type": "text",
32
+ "text": "Large Language Models (LLMs) recently have attracted considerable attention due to their remarkable performance across a broad spectrum of downstream tasks. Diverging from conventional Transformers characterized by a scale of millions of parameters, modern LLMs typically scale up to billions of parameters, endowing them with notable advantages such as emergent capabilities and robust generalization as detailed in (Bubeck et al., 2023). Fine-tuning such highly capable LLMs on downstream tasks (Raffel et al., 2020; Devlin et al., 2019; Radford et al., 2019; He et al., 2021; Liu et al., 2019; Brown et al., 2020) has consequently become a mainstream paradigm to reduce the training time required for individual tasks, yet with superior performance compared with other methods (Lester et al., 2021; Li & Liang, 2021; Houlsby et al., 2019). ",
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "However, fine-tuning a LLM with all the learnable parameters (Full Fine-tuning) requires multiple GPUs with high memory demand (Dettmers et al., 2023; Hu et al., 2022), which is unattainable for many companies and research institutions. Full fine-tuning poses exceptional challenges to researchers: with massive parameter size, LLMs already demand more storage space than regular models; Further training exaggerates the GPU memory requirement because common optimizers such as AdamW (Loshchilov & Hutter, 2019) often maintain several copies of the model parameters, which is 2-3 times of memory overhead. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "text",
42
+ "text": "To this end, a series of methods have been proposed (Valipour et al., 2023; Zhang et al., 2022; Li & Liang, 2021; Liu et al., 2022a; Lv et al., 2023; Dettmers et al., 2023; Liu et al., 2022b; Zaken et al., 2021; Pfeiffer et al., 2021; Guo et al., 2021; Zhou et al., 2023; Zhang et al., 2023; Houlsby et al., 2019; Wang et al., 2022) to reduce memory overhead at the training stage. Some even accelerate the fine-tuning process with only less than $1 \\%$ trainable parameters. Among these methods, LoRA (Hu et al., 2022) is the most attractive for its stable performance on broad downstream tasks (Ding et al., 2023), no observed overfitting, as well as no extra memory and computation cost at inference. ",
43
+ "page_idx": 0
44
+ },
45
+ {
46
+ "type": "text",
47
+ "text": "While LoRA and its successors (Zhang et al., 2022; Valipour et al., 2023) have indeed exhibited superior performance in comparison to alternative approaches within the realm of Parameter Efficient Fine-Tuning (PEFT), a substantial performance gap persists when compared to the full fine-tuning, as highlighted in most scenarios (Ding et al., 2023). This discrepancy is attributed to the inherent limitation of updating only a fraction of the model’s parameters, rendering it inadequate to fit the intricacies presented in the training data. ",
48
+ "page_idx": 0
49
+ },
50
+ {
51
+ "type": "image",
52
+ "img_path": "images/1ca0c1ec6ae0bdfd3ed1798fc6e45918c8fd23932e69b68d64eae2d7c5c29b9a.jpg",
53
+ "image_caption": [
54
+ "Figure 1: An overview of the proposed Delta-LoRA structure, compared to LoRA, DyLoRA and AdaLoRA. Note that DyLoRA and LoRA basically share the same architecture. W is the pre-trained weight which is frozen (signified by blue) when performing efficient-parameter fine-tuning in (a) and (b). Orange trapezoids $\\pmb { A }$ , $\\textbf { { B } }$ and $\\pmb { \\cal E }$ denote the trainable parameters. In our proposed Delta-LoRA, the light orange rectangle means that pre-trained weights can be updated via the delta. Note that our proposed Delta-LoRA removes the Dropout layer to ensure reasonable delta for pre-trained matrix. "
55
+ ],
56
+ "image_footnote": [],
57
+ "page_idx": 1
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "To bridge this gap, a reasonable strategy is to introduce more parameters into the optimization process. In this paper, we introduce Delta-LoRA as shown in Fig. 1, a novel PEFT approach that simultaneously updates the pre-trained matrix and two low-rank matrices while maintaining the same memory consumption as the original LoRA. Specifically, the pre-trained matrix $W$ is updated with the delta of the product of two low-rank matrices in two consecutive iterations $\\triangle A B =$ $A ^ { ( t + 1 ) } B ^ { ( t + 1 ) } - A ^ { ( t ) } \\bar { B } ^ { ( t ) } )$ , while two low-rank matrices are updated by the AdamW optimizer automatically. This is based on the mathematical property that $\\begin{array} { r } { \\frac { \\partial \\mathcal { L } ^ { \\star } } { \\partial W } = \\frac { \\partial \\mathcal { L } } { \\partial A B } . } \\end{array}$ and $\\triangle A B$ is a surrogate to direct the update of $W$ (see Sec. 4 for details). Since we neither store the gradient of $W$ nor use the optimizer to update the pre-trained matrix, the proposed method thus does not yield any extra memory overhead. This strategic integration effectively mitigates the sub-optimal representation learning stemming from only updating the two low-rank matrices. Moreover, our approach aligns the update direction of the pre-trained weights with that of the incremental update matrix. Furthermore, we discard the Dropout layer in low-rank branches to obtain a more reasonable delta for $W$ , in order to ensure $\\begin{array} { r } { \\frac { \\partial \\mathcal { L } } { \\partial W } . = \\frac { \\partial \\check { \\mathcal { L } } } { \\partial A B } } \\end{array}$ . The advantages of our proposed method are conspicuous: including the pre-trained weights in the optimization process engenders a broader integration of parameters, thereby enhancing the potential for learning intricate representations. ",
62
+ "page_idx": 1
63
+ },
64
+ {
65
+ "type": "text",
66
+ "text": "The main contributions of this paper can be summarized as: ",
67
+ "page_idx": 1
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "• We introduce Delta-LoRA, a novel PEFT method that simultaneously updates the full weight matrix and two low-rank matrices. Delta-LoRA leverages the delta of the product of $\\pmb { A }$ and $\\textbf { { B } }$ to update the pre-trained weights and thus prevent storing the first and the second-order momentums in the optimizer. \n• We analyze thbranch makes $\\begin{array} { r } { \\frac { \\partial \\Xi } { \\partial W } \\neq \\frac { \\partial \\mathcal { L } } { \\partial A B } } \\end{array}$ ow of Delta-LoRA and show that the Dropout layer in the low-rank. Thus, we remove the Dropout layer in our proposed Delta-LoRA to get reasonable delta for $W$ . \n• We conduct comprehensive experiments to show that Delta-LoRA has consistent gains on a broad range of NLP tasks. Additionally, we provide thorough explanations to analyze its superiority and the value contributed by each component. ",
72
+ "page_idx": 1
73
+ },
74
+ {
75
+ "type": "text",
76
+ "text": "2 PRELIMINARIES ",
77
+ "text_level": 1,
78
+ "page_idx": 1
79
+ },
80
+ {
81
+ "type": "text",
82
+ "text": "Transformer-based Models. Transformer (Vaswani et al., 2017) adopts the self-attention mechanism instead of recurrence and convolutions, achieving new state-of-the-art in machine translation. Dosovitskiy et al. (2021) later proposed the Vision-Transformer (ViT) architecture which exhibits versatility across various computer vision tasks. Nowadays, the Transformer-based models have become the most popular choice in both NLP and Computer Vision (Li et al., 2021; Carion et al., 2020; Zheng et al., 2021). Transformer typically consists of $L$ stacked blocks, each containing a multi-head attention (MHA) module and a feed-forward network (FFN) module. For an input sequence $\\ b { X } \\in \\mathbb { R } ^ { n \\times d }$ , the MHA module yields the output $\\operatorname { M H A } ( X )$ , given by: ",
83
+ "page_idx": 1
84
+ },
85
+ {
86
+ "type": "text",
87
+ "text": "",
88
+ "page_idx": 2
89
+ },
90
+ {
91
+ "type": "equation",
92
+ "img_path": "images/f55f34c702fd129ebb084cd19f22d2ecdeedfb3924df3b45f0eb1962af2d34b3.jpg",
93
+ "text": "$$\n\\begin{array} { r } { \\mathrm { h e a d } _ { i } = \\mathrm { s o f t m a x } ( \\frac { X W _ { Q _ { i } } ( X W _ { K _ { i } } ) ^ { \\top } } { \\sqrt { d _ { k } } } ) X W _ { V _ { i } } } \\\\ { \\mathrm { M H A } ( X ) = \\mathrm { c o n c a t } ( \\mathrm { h e a d } _ { 1 } , . . . , \\mathrm { h e a d } _ { k } ) W _ { o } , } \\end{array}\n$$",
94
+ "text_format": "latex",
95
+ "page_idx": 2
96
+ },
97
+ {
98
+ "type": "text",
99
+ "text": "where $d _ { k }$ is the scaling factor and set to $d _ { k } = d / k$ . $W _ { K _ { i } }$ $W _ { Q _ { i } }$ , $W _ { V _ { i } }$ and $W _ { o }$ are weight matrices for computation of key, query, value and the output of MHA, respectively. Besides the MHA module, the FFN is also vital in the Transformer-based model. It stacks two fully connected (FC) layers with an activation function in between. FFN is defined as: ",
100
+ "page_idx": 2
101
+ },
102
+ {
103
+ "type": "equation",
104
+ "img_path": "images/2644eb5c23196218ed1ebc4db68a8ed8c0811f2e16062fba503f09b1f8e3c151.jpg",
105
+ "text": "$$\n\\mathrm { F F N } ( \\pmb { x } ) = W _ { f _ { 2 } } \\mathrm { R e L U } ( W _ { f _ { 1 } } \\pmb { x } + b _ { 1 } ) + b _ { 2 } ,\n$$",
106
+ "text_format": "latex",
107
+ "page_idx": 2
108
+ },
109
+ {
110
+ "type": "text",
111
+ "text": "where $\\pmb { x } \\in \\mathbb { R } ^ { d }$ , $W _ { f _ { 1 } }$ and $W _ { f _ { 2 } }$ are two fully connected layers in FFN, $b _ { 1 }$ and $b _ { 2 }$ are bias terms. ",
112
+ "page_idx": 2
113
+ },
114
+ {
115
+ "type": "text",
116
+ "text": "Low Rank Adaptation. Given a pre-trained matrix $\\boldsymbol { W } \\in \\mathbb { R } ^ { c \\times d }$ , LoRA ( $\\mathrm { H u }$ et al., 2022) learns an incremental update $\\triangle \\mathbf { { W } }$ and decomposes $\\triangle W$ into a matrix multiplication between two lowrank matrices $\\pmb { A }$ and $\\textbf { { B } }$ , where $\\pmb { A } \\in \\mathbb { R } ^ { c \\times r }$ and $\\boldsymbol { B } \\in \\mathbb { R } ^ { r \\times d }$ , and $\\triangle W = A B$ . Here, the rank $r \\ll m i n ( d , c )$ . For an input $_ { \\textbf { \\em x } }$ and hidden state $^ { h }$ , LoRA has the following forward process: ",
117
+ "page_idx": 2
118
+ },
119
+ {
120
+ "type": "equation",
121
+ "img_path": "images/70f75d17594911e264922372df18ed14984b7eb15c868ba1a1061ceb89af8a7d.jpg",
122
+ "text": "$$\n\\pmb { h } = \\pmb { W } ^ { * } \\pmb { x } = \\pmb { W } \\pmb { x } + \\triangle \\pmb { W } \\pmb { x } = \\pmb { W } \\pmb { x } + \\frac { \\alpha } { r } \\pmb { A } \\pmb { B } \\pmb { x }\n$$",
123
+ "text_format": "latex",
124
+ "page_idx": 2
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "At the beginning of the training stage, $\\pmb { A }$ is randomly initialized via Kaiming initialization (He et al., 2015) and $\\textbf { { B } }$ is initialized to zero matrix to make sure that the incremental update $A B = \\mathbf { 0 }$ at initialization. Besides, LoRA uses hyper-parameters $\\alpha$ and $r$ to scale ${ \\pmb A } { \\pmb B } { \\pmb x }$ . ",
129
+ "page_idx": 2
130
+ },
131
+ {
132
+ "type": "text",
133
+ "text": "3 RELATED WORKS ",
134
+ "text_level": 1,
135
+ "page_idx": 2
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "With the ever-growing parameter scale in current Transformer-based models, fine-tuning such a large language model (LLM) requires considerable number of GPUs equipped with high memory capacity. This is mainly due to the fact that common optimizers such as AdamW (Loshchilov & Hutter, 2019) requires maintaining three times of extra parameter size (gradients, first-order and second-order momentums). To bridge this gap, a series of Parameter-Efficient Fine-Tuning (PEFT) methods have been proposed (Hu et al., 2022; Liu et al., 2022b; Shin et al., 2020; Houlsby et al., 2019). The Adapter (Houlsby et al., 2019) introduces lightweight trainable parameters between pre-trained layers while keeping the pre-trained weights fixed. Prompt-Tuning (Lester et al., 2021) aims to optimize the prompt to achieve comparable performance with fine-tuning for specific task, while Prefix-Tuning optimizes for trainable prefixes and prepends these trainable parameters to each hidden state (Li & Liang, 2021). Despite the notable performance achievements, these methods inevitably introduce extra overhead at the inference stage. ",
140
+ "page_idx": 2
141
+ },
142
+ {
143
+ "type": "text",
144
+ "text": "Hu et al. (2022) proposed LoRA to utilize the multiplication of two low-rank matrices to model the incremental update of a full-rank matrix. LoRA merges the incremental updates to pre-trained weights after training, thereby avoiding any extra computation overhead during inference. Furthermore, it stands out as one of the most effective PEFT techniques according to Ding et al. (2023)’s evaluation. Subsequent to its inception, a series of enhanced methods building upon LoRA was proposed. Notably, G-LoRA (Chavan et al., 2023) leverages a generalized prompt module to fine-tune pre-trained weights resulting in better representations for computer vision tasks. DyLoRA (Valipour et al., 2023) aims to adjust the rank of two lightweight matrices after the training stage. Differing from the conventional approach of maintaining a static rank during training, DyLoRA introduces rank variations to its blocks. AdaLoRA (Zhang et al., 2022) emphasizes the disparate importance attributed to distinct weight parameters. This technique intelligently allocates the parameter budget across weight matrices based on their respective importance scores. Additionally, Q-LoRA (Dettmers et al., 2023) was proposed to further reduce the average memory footprint by quantizing the pre-trained model with 4-bit NormalFloat. This quantization approach not only preserves the model’s efficacy but also effectively alleviates the resource-intensive nature of LLM training and addresses a pertinent concern. ",
145
+ "page_idx": 2
146
+ },
147
+ {
148
+ "type": "image",
149
+ "img_path": "images/037ce7a0f1a42468cb0674307bfde62dc2055b5d13ea1eeaf17d413680783a56.jpg",
150
+ "image_caption": [
151
+ "Figure 2: The framework of our proposed Delta-LoRA. The blue arrows represent forward pass while yellow dashed arrows denote backward propagation. The black solid arrows in (b) represent the process of updating the low-rank adaptation matrices $\\pmb { A }$ and $\\textbf { { B } }$ with normalized gradients $\\widehat { \\mathbf { g } } _ { A }$ and $\\widehat { \\pmb { g } } _ { B }$ multiplied by the learning rate $\\eta$ , as well as updating the pre-trained weights $W$ bwith the delta bmatrix $\\triangle A B$ multiplied by the update ratio $\\lambda$ . "
152
+ ],
153
+ "image_footnote": [],
154
+ "page_idx": 3
155
+ },
156
+ {
157
+ "type": "text",
158
+ "text": "4 METHODOLOGY ",
159
+ "text_level": 1,
160
+ "page_idx": 3
161
+ },
162
+ {
163
+ "type": "text",
164
+ "text": "This section introduces the novel fine-tuning approach termed as Delta-LoRA. Delta-LoRA encompasses two pivotal designs as shown in Figure 1 and Figure 2: (i) It simultaneously updates the full weight matrix $( W )$ alongside the two low-rank adaptation matrices $\\mathbf { \\delta A }$ and $\\textbf { { B } }$ ), utilizing the delta $( \\hat { A ^ { ( t + 1 ) } B ^ { ( t + 1 ) } } - A ^ { ( t ) } \\hat { B } ^ { ( t ) } )$ resulting from incremental updates to refine the pre-trained weights $( W )$ ; (ii) The Dropout layer as originally integrated within the conventional LoRA module, is excluded in Delta-LoRA. This omission stems from the realization that its presence violates the required assumption $\\begin{array} { r } { \\frac { \\partial \\mathcal { L } } { \\partial W } = \\frac { \\partial \\mathcal { L } } { \\partial A B } } \\end{array}$ . ",
165
+ "page_idx": 3
166
+ },
167
+ {
168
+ "type": "text",
169
+ "text": "4.1 UPDATE THE DELTA OF LOW-RANK MATRICES ON PRE-TRAINED WEIGHTS",
170
+ "text_level": 1,
171
+ "page_idx": 3
172
+ },
173
+ {
174
+ "type": "text",
175
+ "text": "For an input $_ { \\textbf { \\em x } }$ and its corresponding hidden state $^ { h }$ , LoRA optimizes two low-rank matrices $\\pmb { A }$ and $\\textbf { { B } }$ to learn an incremental update $_ { A B }$ for the pre-trained and fixed weight matrix $W$ . Different from previous methods, we argue that $W$ also needs to be updated. In this way, we can introduce more learnable parameters to the optimization process for higher learning capability. However, acquiring the normalized gradients (i.e. the gradients after normalization in optimizer) to fine-tune the weight matrix $W$ is non-trivial, since the optimizer such as AdamW must maintain at least three extra copies of the parameters (i.e. gradients as well as the first-order and the second-order moments of gradients) in GPU memory. Intriguingly, we note that the gradients of the loss $\\mathcal { L }$ with respect to matrices $_ { A B }$ and $W$ are precisely identical, under the presumption that the LoRA module exclusively retains matrices $\\pmb { A }$ and $\\textbf { { B } }$ , while disregarding the Dropout layer. This correspondence can be formally represented as: ",
176
+ "page_idx": 3
177
+ },
178
+ {
179
+ "type": "equation",
180
+ "img_path": "images/95257cbf066bc719e602036a008c8a79b946d66fabd6a65178a95ca73e35ccb0.jpg",
181
+ "text": "$$\n\\begin{array} { l } { g _ { W } = \\displaystyle \\frac { \\partial \\mathcal { L } } { \\partial h _ { i + 1 } } \\cdot \\frac { \\partial h _ { i + 1 } } { \\partial W } ^ { \\top } = \\displaystyle \\frac { \\partial \\mathcal { L } } { \\partial h _ { i + 1 } } \\cdot h _ { i } ^ { \\top } , } \\\\ { g _ { A B } = \\displaystyle \\frac { \\partial \\mathcal { L } } { \\partial h _ { i + 1 } } \\cdot \\frac { \\partial h _ { i + 1 } } { \\partial A B } ^ { \\top } = \\displaystyle \\frac { \\partial \\mathcal { L } } { \\partial h _ { i + 1 } } \\cdot h _ { i } ^ { \\top } , } \\\\ { \\implies g _ { W } = g _ { A B } , } \\end{array}\n$$",
182
+ "text_format": "latex",
183
+ "page_idx": 3
184
+ },
185
+ {
186
+ "type": "text",
187
+ "text": "where $h _ { i + 1 } = W h _ { i } + A B h _ { i } .$ , $\\boldsymbol { h } _ { i }$ and $\\boldsymbol { h } _ { i + 1 }$ are the outputs of the $i$ -th layer and the $_ { i + 1 }$ -th layer respectively. $_ { A B }$ is the matrix product of the adaptation matrices $\\pmb { A }$ and $\\textbf { { B } }$ , $\\mathcal { L }$ is the loss function, while $g _ { W + A B } , g _ { W }$ and $\\mathbf { \\sigma } _ { \\mathbf { \\sigma } _ { g _ { A B } } }$ denote the gradients of ∂L∂(W +AB) , ∂L∂W , and ∂ $\\frac { \\partial \\mathcal { L } } { \\partial A B }$ respectively. ",
188
+ "page_idx": 3
189
+ },
190
+ {
191
+ "type": "text",
192
+ "text": "Equation 4 inspires us to use $\\mathbf { \\sigma } _ { \\mathbf { \\sigma } _ { g _ { A B } } }$ to assimilate $\\mathbf { \\Delta } _ { g _ { W } }$ when learning the parameter updates for weight matrix $W$ . Unfortunately, we are only able to obtain the gradients $\\mathbf { \\pmb { g } } _ { \\pmb { A } }$ and $\\mathbf { \\nabla } _ { \\mathbf { \\pmb { g } } \\mathbf { \\it { B } } }$ rather than $\\mathbf { \\Delta } _ { \\mathbf { \\mathcal { { g } } } \\mathbf { \\Delta } _ { W } }$ during the back-propagation process. Furthermore, the computation of the gradients for $_ { A B }$ is as expensive as for the matrix $W$ , since both matrices share the same dimensions of $d \\times k$ , consequently entailing an equivalent GPU memory overhead. ",
193
+ "page_idx": 3
194
+ },
195
+ {
196
+ "type": "text",
197
+ "text": "",
198
+ "page_idx": 4
199
+ },
200
+ {
201
+ "type": "text",
202
+ "text": "Considering a typical optimization process, the model updates its parameters by applying the gradient descent: $\\boldsymbol { W } ^ { ( t + 1 ) } = \\boldsymbol { W } ^ { ( t ) } - \\eta \\boldsymbol { g } _ { \\boldsymbol { W } }$ , with the parameter update denoted as $\\triangle W = - \\eta g _ { W }$ , using the learning rate $\\eta$ . Similarly, we regard $- \\triangle A B$ as the gradients for $_ { A B }$ and utilize this matrix as a substitute for $\\mathbf { \\Delta } _ { g _ { W } }$ according to Equation 4. Here, we can compute $\\triangle A B$ as: ",
203
+ "page_idx": 4
204
+ },
205
+ {
206
+ "type": "equation",
207
+ "img_path": "images/d1113a3f92d45b5c22d6b134b15c5e12b757b82b7c1ac4d8f926ac787c51bf3b.jpg",
208
+ "text": "$$\n\\triangle { \\cal A } B = { \\cal A } ^ { ( t + 1 ) } B ^ { ( t + 1 ) } - { \\cal A } ^ { ( t ) } B ^ { ( t ) } = \\eta { \\cal A } ^ { ( t ) } g _ { B } + \\eta g _ { A } B ^ { ( t ) } - \\eta ^ { 2 } g _ { A } g _ { B } ,\n$$",
209
+ "text_format": "latex",
210
+ "page_idx": 4
211
+ },
212
+ {
213
+ "type": "text",
214
+ "text": "where $A ^ { ( t ) }$ , $B ^ { ( t ) }$ and $\\mathbf { \\mathbf { } } W ^ { ( t ) }$ are the weights of $A , B$ and $W$ at the $t { \\cdot }$ -th step respectively, $A ^ { ( t + 1 ) } =$ $A ^ { ( t ) } - \\eta g _ { A }$ , $B ^ { ( t + 1 ) } = B ^ { ( t ) } - \\eta \\pmb { g } _ { B }$ and $\\eta$ is the learning rate. To be precise, $- \\triangle A B$ does not equate directly to $\\mathbf { \\sigma } _ { \\mathbf { \\sigma } _ { g _ { A B } } }$ and $\\mathbf { \\Delta } _ { \\mathbf { \\mathcal { { g } } } \\mathbf { \\Delta } _ { W } }$ as elaborated in Appendix A.4.2. Nonetheless, $\\triangle A B$ has the capability to symbolize the genuine directions of update for the matrix $_ { A B }$ . Based on this assumption, it is reasonable to employ $- \\triangle A B$ as the gradient for directing the update of $W$ . ",
215
+ "page_idx": 4
216
+ },
217
+ {
218
+ "type": "text",
219
+ "text": "Therefore, during the training phase we introduce the matrix $\\triangle A B$ to update the pre-trained weights $W$ in the following manner: ",
220
+ "page_idx": 4
221
+ },
222
+ {
223
+ "type": "equation",
224
+ "img_path": "images/9a3179d521c61ebb8ffb53739f6d4760bf3e7b00e49e537240a28bb15da1e09a.jpg",
225
+ "text": "$$\n{ \\bf W } ^ { ( t + 1 ) } = { \\bf W } ^ { ( t ) } + \\lambda \\cdot \\frac { \\alpha } { r } \\cdot \\triangle A B , { \\mathrm { w h e r e ~ } } \\triangle A B = { \\cal A } ^ { ( t + 1 ) } B ^ { ( t + 1 ) } - { \\cal A } ^ { ( t ) } B ^ { ( t ) } ,\n$$",
226
+ "text_format": "latex",
227
+ "page_idx": 4
228
+ },
229
+ {
230
+ "type": "text",
231
+ "text": "where $\\lambda$ represents the hyper-parameter to trade off the update ratio of $_ { A B }$ and the pre-trained weights $W$ . The parameter updates for $W$ commence after $K$ training iterations. The procedural details of the algorithm are illustrated in Algorithm 1. ",
232
+ "page_idx": 4
233
+ },
234
+ {
235
+ "type": "text",
236
+ "text": "Discussion. The Delta-LoRA has some important modifications compared to LoRA. Here, we discuss and compare the difference: ",
237
+ "page_idx": 4
238
+ },
239
+ {
240
+ "type": "table",
241
+ "img_path": "images/9d9e25da4fca476561e29d0e85e617c5a6c515f2b89fb10a3194629d5c010bb5.jpg",
242
+ "table_caption": [],
243
+ "table_footnote": [],
244
+ "table_body": "<table><tr><td colspan=\"2\">LoRA</td><td colspan=\"2\">1 Delta-LoRA 1 1</td></tr><tr><td rowspan=\"2\">(1) A(t+1) ← ∂L(χ;W,A(t),B(t))</td><td>1 1</td><td>aL(x;W(t),A(t),B(t)) (1) A(t+1) ←</td><td rowspan=\"2\"></td></tr><tr><td>aA(t)</td><td>aA(t)</td></tr><tr><td rowspan=\"3\">(2) B(t+1) ← ∂C(χ:W.A(t),B(t))</td><td></td><td>1 (2) B(t+1) ← 0L(ω:W(t),A(t),B(t))</td><td>aB(t)</td></tr><tr><td>∂B(t)</td><td></td><td></td></tr><tr><td></td><td></td><td>(3)W(t+1) ← A(t+1)B(t+1) - A(t)B(t)</td></tr></table>",
245
+ "page_idx": 4
246
+ },
247
+ {
248
+ "type": "text",
249
+ "text": "It is obvious that LoRA only updates $\\pmb { A }$ and $\\textbf { { B } }$ , and keeps $W$ frozen, while Delta-LoRA updates $\\pmb { A }$ and $\\textbf { { B } }$ by the optimizer and $W$ with the delta of the product of $\\pmb { A }$ and $\\textbf { { B } }$ . ",
250
+ "page_idx": 4
251
+ },
252
+ {
253
+ "type": "text",
254
+ "text": "4.2 THE STRUCTURE OF OUR DELTA-LORA ",
255
+ "text_level": 1,
256
+ "page_idx": 4
257
+ },
258
+ {
259
+ "type": "text",
260
+ "text": "Both LoRA and its successor AdaLoRA put a Dropout layer before two low-rank matrices $\\pmb { A }$ and $\\textbf { { B } }$ . However, this arrangement results in a disparity between the gradient matrices $\\mathbf { \\Delta } _ { g _ { W } }$ and $\\mathbf { \\sigma } _ { \\mathbf { \\sigma } _ { g _ { A B } } }$ (or the matrix $\\mathbf { \\_ { \\_ { \\_ { \\delta A E B } } } }$ in the context of AdaLoRA). The derivation of this disparity can be shown as: ",
261
+ "page_idx": 4
262
+ },
263
+ {
264
+ "type": "equation",
265
+ "img_path": "images/d5e04b80286b8059cbc80569079c089a6c70080998409316587498e9b8b64858.jpg",
266
+ "text": "$$\ng _ { W } = { \\frac { \\partial { \\mathcal { L } } } { \\partial h _ { i + 1 } } } \\cdot h _ { i } ^ { \\top } \\neq g _ { A B } = { \\frac { \\partial { \\mathcal { L } } } { \\partial h _ { i + 1 } } } \\cdot \\mathrm { D r o p } ( h _ { i } ) ^ { \\top } ,\n$$",
267
+ "text_format": "latex",
268
+ "page_idx": 4
269
+ },
270
+ {
271
+ "type": "text",
272
+ "text": "where $\\mathrm { D r o p } ( \\cdot )$ denotes the Dropout layer which leads to $g _ { W } \\neq g _ { A B }$ . A reasonable choice is to remove the Dropout layer in the low-rank module and activate the Dropout layer between pre-trained layers if overfitting problem occurs. This modification also brings additional benefits: (1) it can alleviate under-fitting to some extent, thereby enhancing the learned representations of the networks. The rationale behind this improvement lies in the fact that LoRA and its successors formulate low-rank updates for pre-trained weights, involving less than $1 \\%$ of the complete parameters. However, relying solely on such a small fraction of parameters may not bestow an adequate representation capacity in most cases; (2) This alteration also yields memory-saving benefits. By negating the requirement to store intermediate features, the model curtails the memory consumption. Consequently, there is a reduction in activation memory employed during the back-propagation process. ",
273
+ "page_idx": 4
274
+ },
275
+ {
276
+ "type": "text",
277
+ "text": "5 EXPERIMENTS ",
278
+ "text_level": 1,
279
+ "page_idx": 4
280
+ },
281
+ {
282
+ "type": "text",
283
+ "text": "We evaluate our proposed model fine-tuning method Delta-LoRA with RoBERTa (Liu et al., 2019), GPT-2 (Radford et al., 2019) and BART (Lewis et al., 2019) on a broad set of datasets. Specifically, we train (1) RoBERTa on GLUE benchmark which consists of 8 NLP understanding tasks; (2) GPT-2 on E2E Challenge and WebNLG Challenge 2017 following the setting of Hu et al. (2022); and (3) BART on XSum dataset by using the setting provided by Zhang et al. (2022). See Appendix A.7 for more training details on the datasets. The setups and detailed introductions of baseline methods are shown in Appendix A.1. We use PyTorch to implement our experiments and download the pre-trained weights as well as configuration files from HuggingFace Wolf et al. (2019). ",
284
+ "page_idx": 4
285
+ },
286
+ {
287
+ "type": "text",
288
+ "text": "",
289
+ "page_idx": 5
290
+ },
291
+ {
292
+ "type": "text",
293
+ "text": "Table 1: The evaluation results of our proposed Delta-LoRA and other existing methods on E2E NLG Challenge dataset. $\\dagger$ indicates fine-tuning all layers except embedding layer. $^ \\ddag$ indicates only fine-tuning weights for query and value. $^ \\mathparagraph$ means we choose different settings with AdaLoRA: we only tune $W _ { Q }$ and $W _ { V }$ instead of all layers. The best results of Fine-Tuning methods are underlined. The best results of PEFT methods are boldfaced. ",
294
+ "page_idx": 5
295
+ },
296
+ {
297
+ "type": "table",
298
+ "img_path": "images/5a4925a9663990b313825f10dd9729f95b01c4f4a88252897fdc395329f046c5.jpg",
299
+ "table_caption": [
300
+ "Table 2: The evaluation results of our proposed Delta-LoRA and other existing methods on WebNLG Challenge 2017 dataset. $\\dagger$ indicates fine-tuning all layers except embedding layer. $\\ddagger$ indicates only fine-tuning weights for query and value. $^ \\mathparagraph$ means we choose different settings with AdaLoRA: we only tune $W _ { Q }$ and $W _ { V }$ instead of all layers. The best results of Fine-Tuning methods are underlined. The best results of PEFT methods are boldfaced. "
301
+ ],
302
+ "table_footnote": [],
303
+ "table_body": "<table><tr><td>Method</td><td></td><td>Trainables|Exrupdale</td><td></td><td></td><td></td><td>BLEU NIST METEOR ROUGE-L CIDEr</td><td></td></tr><tr><td>Full Fine-Tuning</td><td>354.92M</td><td></td><td>69.58</td><td>8.75</td><td>46.34</td><td>71.66</td><td>2.47</td></tr><tr><td>Fine-Tuningt</td><td>305.84M</td><td></td><td>69.37</td><td>8.76</td><td>46.05</td><td>71.97</td><td>2.44</td></tr><tr><td>Fine-Tuningt</td><td>48M</td><td>×</td><td>69.77</td><td>8.84</td><td>46.29</td><td>71.96</td><td>2.49</td></tr><tr><td>LoRA (repr.)</td><td>0.375M</td><td>X</td><td>69.60</td><td>8.78</td><td>45.61</td><td>71.12</td><td>2.45</td></tr><tr><td>LoRA</td><td>0.35M</td><td></td><td>70.4</td><td>8.85</td><td>46.8</td><td>71.8</td><td>2.53</td></tr><tr><td>DyLoRA</td><td>0.375M</td><td></td><td>67.89</td><td>8.50</td><td>44.07</td><td>70.52</td><td>2.26</td></tr><tr><td>AdaLoRA</td><td>0.375M</td><td></td><td>68.16</td><td>8.58</td><td>44.10</td><td>70.66</td><td>2.35</td></tr><tr><td>Delta-LoRA (Ours)</td><td>0.375M</td><td>√48M</td><td>70.84</td><td>8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr></table>",
304
+ "page_idx": 5
305
+ },
306
+ {
307
+ "type": "table",
308
+ "img_path": "images/9a3abb0b5d99c654333e2c66bea506773b2613725539c0dd6ba47825643e39c7.jpg",
309
+ "table_caption": [],
310
+ "table_footnote": [],
311
+ "table_body": "<table><tr><td>Method</td><td></td><td>PTrainables Exraupdatable</td><td>S BLEU↑</td><td>A</td><td>METEOR↑</td><td>S</td><td>TER</td><td>A</td></tr><tr><td>FullFine-Tuning</td><td>354.92M</td><td></td><td></td><td></td><td>61.38 45.11 54.480.44 0.38 0.410.36 0.53 0.44</td><td></td><td></td><td></td></tr><tr><td>Fine-Tuningt</td><td>305.84M</td><td>×</td><td></td><td></td><td>63.53 46.66 55.920.45 0.39 0.420.34 0.49 0.41</td><td></td><td></td><td></td></tr><tr><td>Fine-Tuningt</td><td>48M</td><td>×</td><td></td><td></td><td>64.55 48.06 57.080.46 0.39 0.430.33 0.47 0.40</td><td></td><td></td><td></td></tr><tr><td>LoRA (repr.)</td><td>0.375M</td><td>X</td><td>62.08 46.60 55.050.44 0.38 0.410.35 0.49 0.42</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LoRA</td><td>0.375M</td><td></td><td>62.1</td><td>46.7 55.3</td><td>0.440.380.41</td><td></td><td>0.330.460.39</td><td></td></tr><tr><td>DyLoRA</td><td>0.375M</td><td>×</td><td></td><td></td><td>58.39 46.02 52.77|0.42 0.37 0.40|0.38 0.49 0.43</td><td></td><td></td><td></td></tr><tr><td>AdaLoRA</td><td>0.375M</td><td>×</td><td>56.39 44.14 50.820.41 0.37 0.390.40 0.49 0.44</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Delta-LoRA (Ours)</td><td>0.375M</td><td>√48M</td><td></td><td></td><td></td><td></td><td>62.87 47.68 55.960.45 0.39 0.420.34 0.48 0.40</td><td></td></tr></table>",
312
+ "page_idx": 5
313
+ },
314
+ {
315
+ "type": "text",
316
+ "text": "5.1 NATURAL LANGUAGE GENERATION ",
317
+ "text_level": 1,
318
+ "page_idx": 5
319
+ },
320
+ {
321
+ "type": "text",
322
+ "text": "Models and Datasets. We use GPT2-Medium to verify the effectiveness of our Delta-LoRA on two datasets for data-to-text tasks, including the E2E NLG Challenge (Puzikov & Gurevych, 2018) and WebNLG Challenge 2017 (Gardent et al., 2017). The E2E NLG Challenge dataset comprises 42,000 samples for training, 4,600 for validation, and 4,600 for testing purposes. In contrast, the WebNLG Challenge 2017 consists of 21,855 training samples across nine categories, expanding to a total of 14 categories in the test set. For the text summarization task, we employed BART-Large (Lewis et al., 2019) to evaluate the efficacy of our method using the XSum dataset (Narayan et al., 2018). The XSum dataset is composed of 204,045 training samples, 11,332 validation samples, and 11,332 test samples. We also use LLaMA-7B(Touvron et al., 2023), a popular pre-trained large language model with 7 Billion parameters,to fine-tune on Alpaca dataset (Taori et al., 2023). ",
323
+ "page_idx": 5
324
+ },
325
+ {
326
+ "type": "text",
327
+ "text": "Implementation Details. In order to compare with LoRA and its successors fairly, we adopt the model setups from LoRA to implement our Delta-LoRA and three PEFT methods. We only learn the low-rank incremental update for $W _ { Q }$ and $W _ { V }$ in MHA module. For data-to-text datasets, we use the same training configurations as adopted by LoRA, including the number of training epochs, batch size and etc. We use update ratio $\\lambda = 2$ and set start steps $K = 5 0 0$ for Delta-LoRA. More details about Delta-LoRA are listed in the Appendix A.7. For the text-summarization task, we use the implementation of AdaLoRA and adopt the same training configurations. We set the update ratio $\\lambda = 0 . 5$ and the start steps $K = 1 0 0 0$ for Delta-LoRA. ",
328
+ "page_idx": 5
329
+ },
330
+ {
331
+ "type": "table",
332
+ "img_path": "images/6d52a5ca410fa47ba56cca5b1ec9485c800c33be78d19dedd041b92d51c60422.jpg",
333
+ "table_caption": [
334
+ "Table 3: The evaluation results of Delta-LoRA with LLaMA-7B on the Instruction-Tuning dataset provided by Stanford Alpaca(Taori et al., 2023). We use GPT-4 to choose from a. LoRA, b. DeltaLoRA or c. Both LoRA and Delta-LoRA to decide the text from which method is better. "
335
+ ],
336
+ "table_footnote": [],
337
+ "table_body": "<table><tr><td>Both</td><td>LoRA</td><td>Delta-LoRA</td><td>Total</td></tr><tr><td>886</td><td>10</td><td>104</td><td>1,000</td></tr></table>",
338
+ "page_idx": 6
339
+ },
340
+ {
341
+ "type": "text",
342
+ "text": "",
343
+ "page_idx": 6
344
+ },
345
+ {
346
+ "type": "text",
347
+ "text": "Experimental Results. Table 1 shows the results for E2E Challenge dataset on 5 evaluation metrics, demonstrating that our method achieves state-of-the-art performance over 3 baselines and a set of fine-tuning methods. For the BLEU and ROUGE-L metrics, our method obtains 1.24 and 1.13 performance gains compared with LoRA, with 0.13, 0.86 and 0.08 improvement on NIST, METEOR and CIDEr respectively. Table 2 demonstrates that Delta-LoRA outperforms baselines on BLEU score for WebNLG Challenge 2017 dataset, with 0.79, 1.08 and 0.91 improvement on Seen, Unseen and All test data, respectively. Additionally, for the METEOR and TER evaluation metrics, Delta-LoRA also achieves state-of-the-art performance, with 0.01 and 0.02 improvement over LoRA on all data. For the text-summarization task, the test results are shown in Table 4, which demonstrates that our method achieves state-of-the-art results across 3 parameter-efficient methods on 4 evaluation metrics. To fairly evaluate our method, we utilized LLaMA-7B and compared it with LoRA. We employed GPT-4 to generate 1,000 questions and presented these questions to the parameter-efficient fine-tuned LLaMA-7B. Subsequently, we leveraged GPT-4 to compare the texts generated by LoRA-tuned and Delta-LoRA-tuned LLMs. Additional details can be found in Appendix A.2. According to the findings in Table 3, Delta-LoRA establishes state-of-the-art performance in the evaluation of Language Models (LLMs). GPT-4 identified 104 samples generated by Delta-LoRA as superior to LoRA, while only 10 samples generated by LoRA exhibited higher quality than Delta-LoRA. This underscores Delta-LoRA’s effectiveness even when utilized within models containing billions of parameters. ",
348
+ "page_idx": 6
349
+ },
350
+ {
351
+ "type": "table",
352
+ "img_path": "images/18c5f81ef84d14b7664d2fa8b74d5de1ae903239dbbb236abfcfdb66aeae15c1.jpg",
353
+ "table_caption": [
354
+ "Table 4: The evaluation results of our proposed Delta-LoRA and other existing methods on XSum dataset. $\\dagger$ indicates fine-tuning all layers except the embedding layer. $^ \\ddag$ indicates only fine-tuning weights for query and value. $\\ P$ means we choose different settings with AdaLoRA: we only tune $W _ { Q }$ and $W _ { V }$ instead of all layers. The best results of Fine-Tuning methods are underlined. The best results of PEFT methods are boldfaced. "
355
+ ],
356
+ "table_footnote": [],
357
+ "table_body": "<table><tr><td>Method</td><td></td><td> PTrainablesExraUpdatable</td><td></td><td></td><td></td><td>Rouge-1 Rouge-2 Rouge-L Rouge-Sum</td></tr><tr><td>Full Fine-Tuning</td><td>387.5M</td><td></td><td>45.36</td><td>22.16</td><td>37.23</td><td>37.24</td></tr><tr><td>Fine-Tuningt</td><td>338.4M</td><td>xx</td><td>45.04</td><td>22.05</td><td>36.92</td><td>36.94</td></tr><tr><td>Fine-Tuningt</td><td>72M</td><td></td><td>44.95</td><td>21.43</td><td>36.35</td><td>36.37</td></tr><tr><td>LoRA</td><td>0.56M</td><td>X</td><td>43.27</td><td>20.13</td><td>35.12</td><td>35.12</td></tr><tr><td>DyLoRA</td><td>0.56M</td><td>×</td><td>41.84</td><td>18.76</td><td>33.56</td><td>33.57</td></tr><tr><td>AdaLoRAI</td><td>0.56M</td><td>X</td><td>42.91</td><td>19.76</td><td>34.71</td><td>34.72</td></tr><tr><td>Delta-LoRA (Ours)</td><td>0.56M</td><td>√72M</td><td>43.49</td><td>20.23</td><td>35.26</td><td>35.26</td></tr></table>",
358
+ "page_idx": 6
359
+ },
360
+ {
361
+ "type": "text",
362
+ "text": "5.2 NATURAL LANGUAGE UNDERSTANDING ",
363
+ "text_level": 1,
364
+ "page_idx": 6
365
+ },
366
+ {
367
+ "type": "text",
368
+ "text": "Models and Datasets. We use RoBERTa-baseLiu et al. (2019) to evaluate the performance of our proposed method, prior works and three fine-tuning methods. We choose the GLUE benchmark consisting of 8 datasets (Wang et al., 2019), including classification tasks, similarity and paraphrase tasks and natural language inference tasks. ",
369
+ "page_idx": 6
370
+ },
371
+ {
372
+ "type": "text",
373
+ "text": "Implementation Details. We use RoBERTa-base with 118M parameters to conduct our experiments and to compare our method with the baselines. We mostly adopt the same training configurations of ",
374
+ "page_idx": 6
375
+ },
376
+ {
377
+ "type": "text",
378
+ "text": "LoRA, more details can get from Appendix A.7. We set the rank to 8 and the target rank to 6 for AdaLoRA and choose the rest of hyper-parameters according to the characteristics of different tasks. For Delta-LoRA, we set the update ratio $\\lambda$ to 0.5 and choose different start steps $K$ according to warmup steps used in individual tasks. ",
379
+ "page_idx": 7
380
+ },
381
+ {
382
+ "type": "table",
383
+ "img_path": "images/e1db5f4642bf7cab3c6eef750a7a93687dc02950f4a45707f5b0dc5672a36528.jpg",
384
+ "table_caption": [
385
+ "Table 5: The evaluation results of our proposed Delta-LoRA and other existing methods on GLUE benchmark. We report the overall (matched and mismatched) accuracy for MNLI, Matthew’s correlation for CoLA, Pearson correlation for STS-B, and accuracy for other tasks. $\\dagger$ indicates fine-tuning all layers except the embedding layer. $\\ddagger$ indicates only fine-tuning weights for query and value. $^ \\mathparagraph$ means we choose different settings with AdaLoRA: we only tune $W _ { Q }$ and $W _ { V }$ instead of all layers. The best results of Fine-Tuning methods are underlined. The best results of PEFT methods are boldfaced. "
386
+ ],
387
+ "table_footnote": [],
388
+ "table_body": "<table><tr><td>Method</td><td></td><td></td><td>TraiableErUpdatablMNLISS-2 MRPC CoLA QNLIQP RTE STS-B AVG</td></tr><tr><td>Full Fine-Tuning</td><td>118.87M</td><td>X</td><td>87.51 94.26 88.23 64.57 92.73 91.96 84.11 90.56 86.74</td></tr><tr><td>Fine-Tuningt</td><td>82.05M</td><td>×</td><td>87.58 94.03 89.95 62.99 92.73 91.90 86.64 90.22 87.01</td></tr><tr><td>Fine-Tuningt</td><td>13.5M</td><td>×</td><td>87.48 95.06 89.21 61.07 92.76 91.19 84.83 89.85 86.43</td></tr><tr><td>LoRA</td><td>0.28M</td><td>X</td><td>87.40 94.61 89.95 63.17 93.02 90.67 86.64 91.54 87.12</td></tr><tr><td>DyLoRA</td><td>0.28M</td><td>X</td><td>86.33 94.26 89.46 61.12 92.22 90.17 84.47 91.06 86.14</td></tr><tr><td>AdaLoRA</td><td>0.28M</td><td>×</td><td>87.34 94.49 90.19 61.64 93.08 90.14 85.19 91.16 86.65</td></tr><tr><td>Delta-LoRA (Ours)</td><td>0.28M</td><td>√13.5M</td><td>87.50 95.06 90.19 63.82 93.09 90.87 87.00 91.57 87.38</td></tr></table>",
389
+ "page_idx": 7
390
+ },
391
+ {
392
+ "type": "text",
393
+ "text": "Experimental Results. We compare our method with prior PEFT works. According to Table 5, our method outperforms existing methods on all 8 tasks in GLUE benchmark. Among these tasks, our method demonstrates significant improvement on SST-2, CoLA and RTE. This is mainly due to the fact that these datasets contain less training data, which hinders the model’s capacity to effectively acquire a robust representation when using prior fine-tuning methods. Delta-LoRA also achieves decent performance on the rest of the datasets, including MNLI, MRPC, QNLI as well STS-B, which proves that our method is stable and reliable across different settings. ",
394
+ "page_idx": 7
395
+ },
396
+ {
397
+ "type": "text",
398
+ "text": "5.3 COMPREHENSIVE UNDERSTANDING OF DELTA-LORA ",
399
+ "text_level": 1,
400
+ "page_idx": 7
401
+ },
402
+ {
403
+ "type": "table",
404
+ "img_path": "images/dbdff6b48a80432c9339dd679b12aaee917a7aed12615c8693d3653c6b5537bd.jpg",
405
+ "table_caption": [
406
+ "Table 6: The ablation study of our proposed Delta-LoRA on E2E Challenge dataset demonstrates the importance of each component. The best results are boldfaced. "
407
+ ],
408
+ "table_footnote": [],
409
+ "table_body": "<table><tr><td>Method</td><td>Trainable Parameters</td><td>Parameters</td><td>Extra Updatable|BLEU NIST METEOR ROUGE-L CIDEr</td><td></td><td></td><td></td></tr><tr><td>LoRA (repr.)</td><td>0.375M</td><td></td><td>69.60 8.78</td><td>45.61</td><td>71.12</td><td>2.45</td></tr><tr><td>Delta-LoRA + LoRA Module</td><td>0.375M</td><td>√48M</td><td>70.29 8.88</td><td>46.38</td><td>71.88</td><td>2.51</td></tr><tr><td>Delta-LoRA</td><td>0.375M</td><td>√48M</td><td>70.84 8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr></table>",
410
+ "page_idx": 7
411
+ },
412
+ {
413
+ "type": "table",
414
+ "img_path": "images/41725e6c83c08bec0e98a3c0063d770c4211a61adb3e6eec6a080c2f03bc3a69.jpg",
415
+ "table_caption": [
416
+ "Table 7: The ablation study of our proposed Delta-LoRA to eliminate the impact of hyper-parameter $\\lambda$ on E2E Challenge dataset. The best results are boldfaced. "
417
+ ],
418
+ "table_footnote": [],
419
+ "table_body": "<table><tr><td>Method</td><td>Learming</td><td>入</td><td>BLEU NIST METEOR ROUGE-L CIDEr</td><td></td><td></td><td></td></tr><tr><td>LoRA (repr.)</td><td>2e-4</td><td>-</td><td>69.60</td><td>8.78 45.61</td><td>71.12</td><td>2.45</td></tr><tr><td>LoRA (repr.)</td><td>6e-4</td><td>1</td><td>69.63</td><td>8.79 45.70</td><td>71.55</td><td>2.39</td></tr><tr><td>Delta-LoRA</td><td>2e-4</td><td>2</td><td>70.84 8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr></table>",
420
+ "page_idx": 7
421
+ },
422
+ {
423
+ "type": "text",
424
+ "text": "The Extra Updatable Parameters. We introduce the concept of extra updatable parameters to point out the superiority of Delta-LoRA. For most PEFT methods, they can only adjust the low-rank adapters, such as AdapterHoulsby et al. (2019) and LoRAHu et al. (2022). Thus, they don’t have any extra parameters to update, which means their extra updatable parameters are 0. However, our Delta-LoRA can achieve the purpose of updating the W matrix without increasing the GPU memory consumption, which means its extra updatable parameters are the parameter number of $W$ . ",
425
+ "page_idx": 7
426
+ },
427
+ {
428
+ "type": "text",
429
+ "text": "Ablation study. To better understand the contribution of our modified LoRA module (i.e. DeltaLoRA module) and the effectiveness of our update algorithm, we conduct studies on E2E Challenge dataset with GPT2-medium. As shown in Table 6, only updating the pre-trained matrices with delta of low-rank update can indeed achieve performance improvement, while further discarding the dropout in Delta-LoRA module obtains the best performance. This observation confirms the indispensable role played by each component within our proposed methodology. We have devised an experiment to further differentiate whether the performance enhancement stems from the inherent characteristics of our method rather than solely from the substantial update magnitude. According to our algorithm, we update the parameters of both pre-trained and low-rank matrices, which can arose the doubt of whether the improvement is caused by updating larger $\\triangle A B$ on the weights instead of introducing more parameters into the optimization process. To answer this question, we design an experiment with results shown in Table 7 to prove the effectiveness of our method. We scale the learning rate of LoRA from 2e-4 to 6e-4 making sure that $W + A B$ can be updated with $3 \\times \\triangle A B$ , which is equivalent to Delta-LoRA when $\\lambda$ is set to 2. We find that even by updating with $3 \\times \\triangle A B$ on $_ { A B }$ , the performance is still not comparable with Delta-LoRA. This experiment further proves that introducing more parameters into the optimization process can force to learn better representation. ",
430
+ "page_idx": 7
431
+ },
432
+ {
433
+ "type": "text",
434
+ "text": "",
435
+ "page_idx": 8
436
+ },
437
+ {
438
+ "type": "image",
439
+ "img_path": "images/9dcc54c551ff5c3ecbf10e382ac75f464784f07e54ba1c1d36ef9cdb8534030b.jpg",
440
+ "image_caption": [
441
+ "Figure 3: The comparison of Fine-Tuning‡, LoRA as well as Delta-LoRA for the cosine similarity between the fine-tuned parameters and the original pre-trained parameters in each transformer block. Higher value means higher similarity. "
442
+ ],
443
+ "image_footnote": [],
444
+ "page_idx": 8
445
+ },
446
+ {
447
+ "type": "text",
448
+ "text": "The cosine similarity between fine-tuned and the pre-trained parameters to measure learning effects. We conduct a comparative analysis of three methods including Fine-Tuning‡, LoRA and Delta-LoRA, in order to elucidate the reasons behind Delta-LoRA’s superior performance. We use the last checkpoint trained on E2E Challenge dataset to give understanding. As depicted in Figure 3, it is evident that LoRA exhibits the highest similarity across the majority of transformer blocks. This observation suggests that LoRA primarily modifies the matrix $\\pmb { W } ^ { * } = \\pmb { W } + \\pmb { A } \\pmb { B }$ within a limited range. Nevertheless, Delta-LoRA showcases the lowest cosine similarity, underscoring that our approach induces the most significant modifications to the final matrix $W ^ { * }$ . Due to this property, our approach can effectively stimulate the model to acquire better representations, leading to state-of-the-art performance across all four PEFT methods. This observation further aligns with the evaluation results in Table 1: Delta-LoRA achieves the best performance among the three methods, whereas LoRA is slightly worse than Fine-Tuning‡. ",
449
+ "page_idx": 8
450
+ },
451
+ {
452
+ "type": "text",
453
+ "text": "6 CONCLUSION ",
454
+ "text_level": 1,
455
+ "page_idx": 8
456
+ },
457
+ {
458
+ "type": "text",
459
+ "text": "In this paper, we have introduced Delta-LoRA, a novel method to simultaneously update the full weight matrix and two low-rank matrices. Delta-LoRA leverages the delta $( { \\pmb A } ^ { ( t + 1 ) } { \\pmb B } ^ { ( t + 1 ) } - { \\pmb A } ^ { ( t ) } { \\pmb B } ^ { ( t ) } )$ to update the pre-trained weights $( W )$ . In this way, we introduce more learnable parameters into the optimization process such that the model can learn a better representation with comparable memory cost as LoRA. Meanwhile, we identify the Dropout layer in the low-rank branch to be unnecessary according to the gradient flow. We also provide thorough analysis of our method to understand its effectiveness and robustness. Extensive experiments on a broad range of NLP tasks are conducted to empirically verify the effectiveness of our Delta-LoRA. ",
460
+ "page_idx": 8
461
+ },
462
+ {
463
+ "type": "text",
464
+ "text": "REFERENCES ",
465
+ "text_level": 1,
466
+ "page_idx": 9
467
+ },
468
+ {
469
+ "type": "text",
470
+ "text": "Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In NeurIPS, 2020. ",
471
+ "page_idx": 9
472
+ },
473
+ {
474
+ "type": "text",
475
+ "text": "Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, Harsha Nori, Hamid Palangi, Marco Tulio Ribeiro, and Yi Zhang. Sparks of artificial general intelligence: Early experiments with gpt-4, 2023. \nNicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020. \nArnav Chavan, Zhuang Liu, Deepak Gupta, Eric Xing, and Zhiqiang Shen. One-for-all: Generalized lora for parameter-efficient fine-tuning. arXiv preprint arXiv:2306.07967, 2023. \nTim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. Qlora: Efficient finetuning of quantized llms. arXiv preprint arXiv:2305.14314, 2023. \nJacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL, 2019. \nNing Ding, Yujia Qin, Guang Yang, Fuchao Wei, Zonghan Yang, Yusheng Su, Shengding Hu, Yulin Chen, Chi-Min Chan, Weize Chen, Jing Yi, Weilin Zhao, Zhiyuan Liu, Hai-Tao Zheng, Jianfei Chen, Yang Liu, Jie Tang, Juanzi Li, and Maosong Sun. Parameter-efficient fine-tuning of large-scale pre-trained language models. Nature Machine Intelligence, 2023. \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. In ICLR, 2021. \nClaire Gardent, Anastasia Shimorina, Shashi Narayan, and Laura Perez-Beltrachini. The WebNLG challenge: Generating text from RDF data. In Proceedings of the 10th International Conference on Natural Language Generation, 2017. \nDemi Guo, Alexander M Rush, and Yoon Kim. Parameter-efficient transfer learning with diff pruning. In ACL, 2021. \nKaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In ICCV, 2015. \nPengcheng He, Jianfeng Gao, and Weizhu Chen. Debertav3: Improving deberta using electra-style pre-training with gradient-disentangled embedding sharing. arXiv preprint arXiv:2111.09543, 2021. \nNeil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin De Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for nlp. In ICML, 2019. \nEdward J Hu, yelong shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. In ICLR, 2022. \nShaoyi Huang, Dongkuan Xu, Ian Yen, Yijue Wang, Sung-En Chang, Bingbing Li, Shiyang Chen, Mimi Xie, Sanguthevar Rajasekaran, Hang Liu, and Caiwen Ding. Sparse progressive distillation: Resolving overfitting under pretrain-and-finetune paradigm. In ACL, 2022. \nBrian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. In EMNLP, 2021. \nMike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461, 2019. \nJunnan Li, Ramprasaath Selvaraju, Akhilesh Gotmare, Shafiq Joty, Caiming Xiong, and Steven Chu Hong Hoi. Align before fuse: Vision and language representation learning with momentum distillation. 2021. \nXiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. In Chengqing Zong, Fei Xia, Wenjie Li, and Roberto Navigli (eds.), ACL, 2021. \nHaokun Liu, Derek Tam, Mohammed Muqeeth, Jay Mohta, Tenghao Huang, Mohit Bansal, and Colin A Raffel. Few-shot parameter-efficient fine-tuning is better and cheaper than in-context learning. In NeurIPS, 2022a. \nXiao Liu, Kaixuan Ji, Yicheng Fu, Weng Tam, Zhengxiao Du, Zhilin Yang, and Jie Tang. P-tuning: Prompt tuning can be comparable to fine-tuning across scales and tasks. In ACL, 2022b. \nYang 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, 2023. \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. \nIlya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In ICLR, 2019. \nKai Lv, Yuqing Yang, Tengxiao Liu, Qinghui Gao, Qipeng Guo, and Xipeng Qiu. Full parameter fine-tuning for large language models with limited resources. 2023. \nShashi Narayan, Shay B Cohen, and Mirella Lapata. Don’t give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. arXiv preprint arXiv:1808.08745, 2018. \nJonas Pfeiffer, Aishwarya Kamath, Andreas Rücklé, Kyunghyun Cho, and Iryna Gurevych. Adapterfusion: Non-destructive task composition for transfer learning. In EACL, 2021. \nYevgeniy Puzikov and Iryna Gurevych. E2E NLG challenge: Neural models vs. templates. In Proceedings of the 11th International Conference on Natural Language Generation, 2018. \nAlec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019. \nColin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J Liu, et al. Exploring the limits of transfer learning with a unified text-to-text transformer. JMLR, 21(140):1–67, 2020. \nTaylor Shin, Yasaman Razeghi, Robert L Logan IV, Eric Wallace, and Sameer Singh. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. In EMNLP, 2020. \nChuanqi Tan, Fuchun Sun, Tao Kong, Wenchang Zhang, Chao Yang, and Chunfang Liu. A survey on deep transfer learning. In ICANN, 2018. \nRohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. https://github.com/tatsu-lab/stanford_alpaca, 2023. \nHugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023. \nMojtaba Valipour, Mehdi Rezagholizadeh, Ivan Kobyzev, and Ali Ghodsi. Dylora: Parameter-efficient tuning of pre-trained models using dynamic search-free low-rank adaptation. In EACL, 2023. \nAshish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017. \nAlex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In ICLR, 2019. \nYaqing Wang, Subhabrata Mukherjee, Xiaodong Liu, Jing Gao, Ahmed Hassan Awadallah, and Jianfeng Gao. Adamix: Mixture-of-adapter for parameter-efficient tuning of large language models. In EMNLP, 2022. \nThomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, et al. Huggingface’s transformers: State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771, 2019. \nElad Ben Zaken, Shauli Ravfogel, and Yoav Goldberg. Bitfit: Simple parameter-efficient fine-tuning for transformer-based masked language-models. arXiv preprint arXiv:2106.10199, 2021. \nLongteng Zhang, Lin Zhang, Shaohuai Shi, Xiaowen Chu, and Bo Li. Lora-fa: Memory-efficient low-rank adaptation for large language models fine-tuning. arXiv preprint arXiv:2308.03303, 2023. \nQingru Zhang, Minshuo Chen, Alexander Bukharin, Pengcheng He, Yu Cheng, Weizhu Chen, and Tuo Zhao. Adaptive budget allocation for parameter-efficient fine-tuning. In ICLR, 2022. \nSixiao Zheng, Jiachen Lu, Hengshuang Zhao, Xiatian Zhu, Zekun Luo, Yabiao Wang, Yanwei Fu, Jianfeng Feng, Tao Xiang, Philip HS Torr, et al. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. In CVPR, 2021. \nHan Zhou, Xingchen Wan, Ivan Vulic, and Anna Korhonen. Autopeft: Automatic configuration ´ search for parameter-efficient fine-tuning. arXiv preprint arXiv:2301.12132, 2023. ",
476
+ "page_idx": 9
477
+ },
478
+ {
479
+ "type": "text",
480
+ "text": "",
481
+ "page_idx": 10
482
+ },
483
+ {
484
+ "type": "text",
485
+ "text": "",
486
+ "page_idx": 11
487
+ },
488
+ {
489
+ "type": "text",
490
+ "text": "A APPENDIX ",
491
+ "text_level": 1,
492
+ "page_idx": 12
493
+ },
494
+ {
495
+ "type": "text",
496
+ "text": "A.1 BASELINES",
497
+ "text_level": 1,
498
+ "page_idx": 12
499
+ },
500
+ {
501
+ "type": "text",
502
+ "text": "We compare our proposed method Delta-LoRA with Fine-Tuning and prior works of LoRA, AdaLoRA, and DyLoRA. For PEFT methods, we only train the incremental updates for $W _ { V }$ and $W _ { Q }$ , following the setup as used in LoRA’s paper. For Fine-Tuning methods, we use two extra training paradigms: (1) freeze the embedding and train all the other parameters as Fine-Tuning $\\dagger$ ; (2) train $W _ { V }$ and $W _ { Q }$ only as Fine-Tuning‡. ",
503
+ "page_idx": 12
504
+ },
505
+ {
506
+ "type": "text",
507
+ "text": "Fine-Tuning. In the past few years, fine-tuning has become the mainstream paradigm for both NLP and CV tasks. However, fine-tuning full parameters is subject to potential drawbacks including overfitting and training instability (Huang et al., 2022). Therefore, freezing a subset of network layers and fine-tuning the rest has become a popular choice (Tan et al., 2018). In our experiments, we compare with full fine-tuning, fine-tuning with embedding layers frozen (Fine-tuning $\\dagger .$ ) and fine-tuning query and value matrices only (Fine-tuning $\\ddagger$ ). ",
508
+ "page_idx": 12
509
+ },
510
+ {
511
+ "type": "text",
512
+ "text": "LoRA (Hu et al., 2022) uses multiplication of two low-rank matrices to learn the incremental updates with reduced GPU memory cost. We follow their setups to reproduce experimental results for fair comparison. ",
513
+ "page_idx": 12
514
+ },
515
+ {
516
+ "type": "text",
517
+ "text": "DyLoRA (Valipour et al., 2023) randomly chooses a rank $r$ for LoRA modules during learning. ",
518
+ "page_idx": 12
519
+ },
520
+ {
521
+ "type": "text",
522
+ "text": "AdaLoRA (Zhang et al., 2022) focuses on the challenge of determining the optimal rank for incremental updates. It employs an adaptive approach to singular value pruning, tailoring the rank selection to the magnitude of each singular value. Consequently, distinct ranks are employed for different layers. ",
523
+ "page_idx": 12
524
+ },
525
+ {
526
+ "type": "text",
527
+ "text": "A.2 THE COMPARISON BETWEEN LORA AND DELTA-LORA WITH LLAMA-7B ",
528
+ "page_idx": 12
529
+ },
530
+ {
531
+ "type": "text",
532
+ "text": "A.2.1 TRAINING AND INFERENCE ARGUMENTS USED IN OUR METHOD AND BASELINE ",
533
+ "text_level": 1,
534
+ "page_idx": 12
535
+ },
536
+ {
537
+ "type": "text",
538
+ "text": "We choose LLaMA-7B to evaluate our method and LoRA. Here, we set the learning rate $\\gamma = 1 \\mathrm { e } { - } 4$ , batch size to 128, $r = 8$ , $\\alpha = 1 6$ , and training epochs to 3 for both two methods. Following the LoRA’s paper, we only tune $W _ { Q }$ and $W _ { V }$ . For Delta-LoRA, we choose start steps $K = 1 0 0$ and $\\lambda = 0 . 2 5$ . When inference, we set the no_repeat_ngram_size $= 1 0$ , temperature ${ } = 0$ and beam size $=$ 4 to get a certain answer. ",
539
+ "page_idx": 12
540
+ },
541
+ {
542
+ "type": "text",
543
+ "text": "A.2.2 THE EVALUATION FOR OUR METHOD AND BASELINES ",
544
+ "text_level": 1,
545
+ "page_idx": 12
546
+ },
547
+ {
548
+ "type": "text",
549
+ "text": "Current LLMs obtain the training data from the Internet, which may unintentionally cause data leakage. Therefore, using the mainstream NLP datasets to evaluate the effectiveness of Large Language Model is not reasonable and wisdom. Inspired by evaluation approach proposed by Liu et al. (2023), we decided to use GPT-4 to judge the text generated by which method is accurate. First, we ask GPT-4 to generate 1,000 different questions. Second, we use the LLaMA-7B trained by two methods to generate the texts. Finally, we ask GPT-4 to give decision to tell us which text is accurate. It can choose from three options: a. Choice 1 (LoRA generates accurate text), b. Choice 2 (Delta-LoRA generates accurate text) and c. Both Choice 1 and 2 (Both LoRA and Delta-LoRA generate accurate texts). The prompt we used for evaluation: ",
550
+ "page_idx": 12
551
+ },
552
+ {
553
+ "type": "text",
554
+ "text": "Help me to determine which text is accurate for the given instruction and question. The answer can be chosen from a. Choice 1 is accurate, b. Choice 2 is accurate or c. both Choice 1 and 2 are accurate. Give me a certain answer and this is a choice question. Please don’t give reasons and the answer must be shorter than 20 words. ",
555
+ "page_idx": 12
556
+ },
557
+ {
558
+ "type": "text",
559
+ "text": "Question: \"\" (Choice 1): \"\" (Choice 2): \"\" ",
560
+ "page_idx": 12
561
+ },
562
+ {
563
+ "type": "text",
564
+ "text": "A.3 ALGORITHM OF DELTA-LORA ",
565
+ "text_level": 1,
566
+ "page_idx": 12
567
+ },
568
+ {
569
+ "type": "text",
570
+ "text": "Our Delta-LoRA can be found in Algorithm 1. Compared to LoRA, we added a step to update the pre-trained $W$ without any extra GPU memory consumption. ",
571
+ "page_idx": 12
572
+ },
573
+ {
574
+ "type": "table",
575
+ "img_path": "images/5262abc5271f04ac9464f3f9e2a946374e723b5fa0594edcad78709ac54a20b8.jpg",
576
+ "table_caption": [
577
+ "Algorithm 1: Delta-LoRA "
578
+ ],
579
+ "table_footnote": [],
580
+ "table_body": "<table><tr><td>Input: Learning rate n; weight decay β; total training iterations T; low rank r; scale factor α; start steps K;update ratio 入. A is initialized by Kaiming Initialization, B= O and W is initialized with pre-trained weights. fort=0,..,T-1do Sample a mini-batch and compute gradients for {A,B} in each Delta-LoRA module.</td></tr><tr><td>Update the first and second moments maintained by the optimizer with the computed gradients,</td></tr><tr><td>and get the normalized gradients gA and gB . A(t+1) ← A(t)-ngA-nβA6) B(t+1)←B(t)-ngB-nβB(t)</td></tr><tr><td>ift&gt;Kdo W(t+1) ←W(t) +λ··(A(t+1)B(t+1)-A(t)B(t))</td></tr><tr><td>end if end for</td></tr><tr><td>Output: the fine-tuned parameters {W(T),A(T), B(T) }</td></tr></table>",
581
+ "page_idx": 13
582
+ },
583
+ {
584
+ "type": "text",
585
+ "text": "A.4 A FURTHER UNDERSTANDING OF DELTA-LORA ",
586
+ "text_level": 1,
587
+ "page_idx": 13
588
+ },
589
+ {
590
+ "type": "text",
591
+ "text": "A.4.1 THE DIFFERENCES BETWEEN LORA AND DELTA-LORA ",
592
+ "page_idx": 13
593
+ },
594
+ {
595
+ "type": "text",
596
+ "text": "There are some fundamental differences between LoRA and Delta-LoRA. ",
597
+ "page_idx": 13
598
+ },
599
+ {
600
+ "type": "text",
601
+ "text": "• Given $W + A B$ , $W$ is fixed in LoRA, but $W$ will be updated in our Delta-LoRA. This is the largest difference between LoRA and Delta-LoRA. This modification can yield more training differences between LoRA and Delta-LoRA in the next few training steps. ",
602
+ "page_idx": 13
603
+ },
604
+ {
605
+ "type": "text",
606
+ "text": "$\\cdot$ $\\mathrm { R a n k } ( \\Delta W _ { D e l t a - L o R A } ) = \\mathrm { R a n k } ( W ^ { ( T ) } - W ^ { ( 0 ) } + A B ) > \\mathrm { R a n k } ( \\Delta W _ { L o R A } ) = \\mathrm { R a n k } ( A B ) .$ The rank of the learned incremental weight matrix in our Delta-LoRA is larger than that in the original LoRA. ",
607
+ "page_idx": 13
608
+ },
609
+ {
610
+ "type": "text",
611
+ "text": "$\\bullet$ The gradient flow is different between LoRA and Delta-LoRA. Suppose that we have $\\pmb { W } \\in \\mathbb { R } ^ { m \\times n }$ , $\\pmb { A } \\in \\mathbb { R } ^ { m \\times r }$ and $\\boldsymbol { B } \\in \\mathbb { R } ^ { r \\times n }$ , where $r \\leq \\operatorname* { m i n } ( m , n )$ . For LoRA, it keeps $W$ frozen, so that $W ^ { * } =$ $\\begin{array} { r } { { \\cal W } ^ { ( 0 ) } + \\frac { \\alpha } { r } \\cdot { \\cal A } ^ { ( t ) } { \\cal B } ^ { ( t ) } } \\end{array}$ . For Delta-LoRA, it updates all matrices, and has $\\begin{array} { r } { W ^ { * } = W ^ { ( t ) } + \\frac { \\alpha } { r } \\cdot A ^ { ( t ) } B ^ { ( t ) } } \\end{array}$ . ",
612
+ "page_idx": 13
613
+ },
614
+ {
615
+ "type": "equation",
616
+ "img_path": "images/40cbd1fe3a3a13fdaa9a7f4d5f3f702cd283215648cba09f5f4187967ac98a40.jpg",
617
+ "text": "$$\n\\frac \\left[ \\begin{array} { l l l l } { \\displaystyle \\frac { A ^ { h _ { i } } } { \\eta } } & { \\displaystyle + \\frac { \\eta } { \\eta } } & { \\displaystyle } & { \\right] } \\left[ \\begin{array} { l l l l } { \\displaystyle \\frac { A ^ { h _ { i } } } { \\eta } } & { \\displaystyle + \\frac { \\eta } { \\eta } } & { \\displaystyle h _ { i + 1 } = h _ { i } A } & { h _ { i + 1 } \\in \\mathbb R ^ { h \\times r } } \\\\ { \\displaystyle \\frac { A ^ { h } } { \\eta } } & { \\displaystyle \\frac { A ^ { h } } { \\eta } } & { h _ { i + 1 } } & { h _ { i + 2 } = h _ { i + 1 } B } & { h _ { i + 2 } \\in \\mathbb R ^ { h \\times n } } \\\\ { \\displaystyle \\frac { \\left[ \\begin{array} { l l l l } { \\displaystyle h _ { i + 3 } } & { \\displaystyle - \\frac { A ^ { h } } { \\eta } } & { \\displaystyle h _ { i + 2 } } & { \\displaystyle h _ { i + 3 } = h _ { i } W } & { h _ { i + 3 } \\in \\mathbb R ^ { b \\times n } } \\\\ { \\displaystyle h _ { i + 4 } } & { \\displaystyle } & { \\displaystyle } & { } \\end{array} \\right] } { \\le\\right]ft[ \\begin{array} { l } { \\displaystyle h _ { i + 3 } } \\\\ { \\displaystyle h _ { i + 4 } } \\end{array} \\right] } } \\end{array} \\end{array}\n$$",
618
+ "text_format": "latex",
619
+ "page_idx": 13
620
+ },
621
+ {
622
+ "type": "image",
623
+ "img_path": "",
624
+ "image_caption": [
625
+ "Figure 4: The backward propagation of Delta-LoRA. "
626
+ ],
627
+ "image_footnote": [],
628
+ "page_idx": 13
629
+ },
630
+ {
631
+ "type": "text",
632
+ "text": "So, we have the following equation according to Figure 4: ",
633
+ "page_idx": 13
634
+ },
635
+ {
636
+ "type": "equation",
637
+ "img_path": "images/edfdef858b105f09097f1e38f896b04e419e7b327da9c28fa3a04647394e61cb.jpg",
638
+ "text": "$$\n\\begin{array} { r l } & { \\frac { \\partial \\mathcal { L } } { \\partial W ^ { ( t ) } } = ( \\frac { \\partial h _ { i + 3 } } { \\partial W ^ { ( t ) } } ) ^ { \\top } \\frac { \\partial \\mathcal { L } } { \\partial h _ { i + 4 } } = h _ { i } ^ { \\top } \\frac { \\partial \\mathcal { L } } { \\partial h _ { i + 4 } } } \\\\ & { \\frac { \\partial \\mathcal { L } } { \\partial A ^ { ( t ) } } = ( \\frac { \\partial h _ { i + 1 } } { \\partial A ^ { ( t ) } } ) ^ { \\top } \\frac { \\partial \\mathcal { L } } { \\partial h _ { i + 4 } } \\cdot \\frac { \\partial h _ { i + 4 } } { \\partial h _ { i + 2 } } \\cdot \\frac { \\partial h _ { i + 2 } } { \\partial h _ { i + 1 } } = h _ { i } ^ { \\top } \\frac { \\partial \\mathcal { L } } { \\partial h _ { i + 4 } } \\frac { \\partial h _ { i + 2 } } { \\partial h _ { i + 1 } } = h _ { i } ^ { \\top } \\frac { \\partial \\mathcal { L } } { \\partial h _ { i + 4 } } B ^ { ( t ) \\top } = \\frac { \\partial \\mathcal { L } } { \\partial W ^ { ( t ) } } \\cdot B ^ { ( t ) \\top } } \\end{array}\n$$",
639
+ "text_format": "latex",
640
+ "page_idx": 13
641
+ },
642
+ {
643
+ "type": "text",
644
+ "text": "$\\begin{array} { r } { \\frac { \\partial \\mathcal { L } } { \\partial B ^ { ( t ) } } = ( \\frac { \\partial h _ { i + 1 } } { \\partial B ^ { ( t ) } } ) ^ { \\top } \\cdot \\frac { \\partial \\mathcal { L } } { \\partial h _ { i + 4 } } \\cdot \\frac { \\partial h _ { i + 4 } } { \\partial h _ { i + 2 } } = h _ { i + 2 } ^ { \\top } \\cdot \\frac { \\partial \\mathcal { L } } { \\partial h _ { i + 4 } } = ( A ^ { ( t ) } ) ^ { \\top } \\cdot h _ { i } ^ { \\top } \\cdot \\frac { \\partial \\mathcal { L } } { \\partial h _ { i + 4 } } = ( A ^ { ( t ) } ) ^ { \\top } \\cdot \\frac { \\partial \\mathcal { L } } { \\partial W ^ { ( t ) } } } \\end{array}$ Here, we provide the back-propagation process of LoRA: ",
645
+ "page_idx": 14
646
+ },
647
+ {
648
+ "type": "equation",
649
+ "img_path": "images/2364d19b8d1ba5aec70389e1f20e817d272eaa9ea61d444cb2d404ea8cc6b06b.jpg",
650
+ "text": "$$\n\\begin{array} { r l } & { \\frac { \\partial \\mathcal { L } } { \\partial A ^ { ( t + 1 ) } } = \\frac { \\partial \\mathcal { L } } { \\partial W ^ { ( t + 1 ) } } \\cdot ( B ^ { ( t + 1 ) } ) ^ { \\top } = \\frac { \\partial \\mathcal { L } } { \\partial ( W ^ { ( 0 ) } + ( A ^ { ( t ) } + \\Delta A ^ { ( t ) } ) ( B ^ { ( t ) } + \\Delta B ^ { ( t ) } ) ) } \\cdot ( B ^ { ( t ) } + \\Delta B ^ { ( t ) } ) ^ { \\top } } \\\\ & { \\frac { \\partial \\mathcal { L } } { \\partial B ^ { ( t + 1 ) } } = ( A ^ { ( t + 1 ) } ) ^ { \\top } \\cdot \\frac { \\partial \\mathcal { L } } { \\partial W ^ { ( t + 1 ) } } = ( A ^ { ( t ) } + \\Delta A ^ { ( t ) } ) ^ { \\top } \\cdot \\frac { \\partial \\mathcal { L } } { \\partial ( W ^ { ( 0 ) } + ( A ^ { ( t ) } + \\Delta A ^ { ( t ) } ) ( B ^ { ( t ) } + \\Delta B ^ { ( t ) } ) ) } } \\end{array}\n$$",
651
+ "text_format": "latex",
652
+ "page_idx": 14
653
+ },
654
+ {
655
+ "type": "text",
656
+ "text": "This is the back-propagation process of Delta-LoRA: ",
657
+ "page_idx": 14
658
+ },
659
+ {
660
+ "type": "equation",
661
+ "img_path": "images/3e89350f054224cd724921bb5543388056b7cfd48920d6dbb5253990dbbc928e.jpg",
662
+ "text": "$$\n\\begin{array} { r l } & { \\frac { \\partial \\mathcal { L } } { \\partial A ^ { ( t + 1 ) } } = \\frac { \\partial \\mathcal { L } } { \\partial W ^ { ( t + 1 ) } } \\cdot ( B ^ { ( t + 1 ) } ) ^ { \\top } = \\frac { \\partial \\mathcal { L } } { \\partial ( ( W ^ { ( t ) } + \\lambda \\Delta A ^ { ( t ) } B ^ { ( t ) } ) + ( A ^ { ( t ) } + \\Delta A ^ { ( t ) } ) ( B ^ { ( t ) } + \\Delta B ^ { ( t ) } ) } \\cdot ( B ^ { ( t ) } + \\Delta B ^ { ( t ) } ) ^ { \\top } } \\\\ & { \\frac { \\partial \\mathcal { L } } { \\partial B ^ { ( t + 1 ) } } = ( A ^ { ( t + 1 ) } ) ^ { \\top } \\cdot \\frac { \\partial \\mathcal { L } } { \\partial W ^ { ( t + 1 ) } } = ( A ^ { ( t ) } + \\Delta A ^ { ( t ) } ) ^ { \\top } \\cdot \\frac { \\partial \\mathcal { L } } { \\partial ( ( W ^ { ( t ) } + \\lambda \\Delta A ^ { ( t ) } B ^ { ( t ) } ) + ( A ^ { ( t ) } + \\Delta A ^ { ( t ) } ) ( B ^ { ( t ) } + \\Delta B ^ { ( t ) } ) ) } } \\end{array}\n$$",
663
+ "text_format": "latex",
664
+ "page_idx": 14
665
+ },
666
+ {
667
+ "type": "text",
668
+ "text": "A.4.2 THE EXPANSION OF $\\triangle { A B }$ ",
669
+ "text_level": 1,
670
+ "page_idx": 14
671
+ },
672
+ {
673
+ "type": "text",
674
+ "text": "In the real training process, we need to consider a variety of training arguments, such as optimizer and the regularization for $\\triangle A B$ . Suppose that we use the AdamW (Loshchilov & Hutter, 2019) and $L _ { 2 }$ regularization, the $\\triangle A B$ can be expanded in the following equation: ",
675
+ "page_idx": 14
676
+ },
677
+ {
678
+ "type": "equation",
679
+ "img_path": "images/84763fe0b18426f41e0f77128271433035c57c76a6a3e5cdbdb242e2ca6d2f51.jpg",
680
+ "text": "$$\n\\begin{array} { r l } & { \\triangle A B = A ^ { ( t + 1 ) } B ^ { ( t + 1 ) } - A ^ { ( t ) } B ^ { ( t ) } } \\\\ & { \\qquad = ( A ^ { ( t ) } - \\eta \\hat { g } _ { A } - \\eta \\beta A ^ { ( t ) } ) \\cdot ( B ^ { ( t ) } - \\eta \\hat { g } _ { B } - \\eta \\beta B ^ { ( t ) } ) - A ^ { ( t ) } B ^ { ( t ) } } \\\\ & { \\qquad = A ^ { ( t ) } B ^ { ( t ) } - \\eta A ^ { ( t ) } \\hat { g } _ { B } - \\eta \\beta A ^ { ( t ) } B ^ { ( t ) } - \\eta \\hat { g } _ { A } B ^ { ( t ) } + \\eta ^ { 2 } \\hat { g } _ { A } \\hat { g } _ { B } + \\eta ^ { 2 } \\beta \\hat { g } _ { A } B ^ { ( t ) } } \\\\ & { \\qquad - \\eta \\beta A ^ { ( t ) } B ^ { ( t ) } + \\eta ^ { 2 } \\beta A ^ { ( t ) } \\hat { g } _ { B } + \\eta ^ { 2 } \\beta ^ { 2 } A ^ { ( t ) } B ^ { ( t ) } - A ^ { ( t ) } B ^ { ( t ) } } \\\\ & { \\qquad = - \\eta A ^ { ( t ) } \\hat { g } _ { B } - \\eta \\beta A ^ { ( t ) } B ^ { ( t ) } - \\eta \\hat { g } _ { A } B ^ { ( t ) } + \\eta ^ { 2 } \\hat { g } _ { A } \\hat { g } _ { B } + \\eta ^ { 2 } \\beta \\hat { g } _ { A } B ^ { ( t ) } } \\\\ & { \\qquad - \\eta \\beta A ^ { ( t ) } B ^ { ( t ) } + \\eta ^ { 2 } \\beta A ^ { ( t ) } \\hat { g } _ { B } + \\eta ^ { 2 } \\beta ^ { 2 } A ^ { ( t ) } B ^ { ( t ) } } \\\\ & { \\qquad \\approx - \\eta A ^ { ( t ) } \\hat { g } _ { B } - \\eta \\hat { g } _ { A } B ^ { ( t ) } } \\end{array}\n$$",
681
+ "text_format": "latex",
682
+ "page_idx": 14
683
+ },
684
+ {
685
+ "type": "text",
686
+ "text": "where $\\eta$ is the learning rate, $\\beta$ is weight decay. What’s more, for pre-trained weight $W , \\triangle W =$ $\\eta \\widehat { g } _ { W } + \\eta \\beta W ^ { ( t ) }$ . As a consequence, $\\triangle A B$ is not equal to $\\triangle W$ in the training process. ",
687
+ "page_idx": 14
688
+ },
689
+ {
690
+ "type": "text",
691
+ "text": "A.5 CHANGE THE LEARNING RATE AND START STEPS TO SHOW BETTER PERFORMANCE. ",
692
+ "page_idx": 14
693
+ },
694
+ {
695
+ "type": "text",
696
+ "text": "We explored better hyper parameters of our Delta-LoRA by modifying the learning rate and trying more start steps and update ratio to prove the effectiveness of Delta-LoRA. ",
697
+ "page_idx": 14
698
+ },
699
+ {
700
+ "type": "table",
701
+ "img_path": "images/9f7e6cf447bcf509eb53e72b21d9ee4416a1ffc0fa59bb0dd7c5545e6c3f559a.jpg",
702
+ "table_caption": [
703
+ "Table 8: The evaluation results of our proposed Delta-LoRA by using better hyper-parameters on GLUE benchmark. "
704
+ ],
705
+ "table_footnote": [],
706
+ "table_body": "<table><tr><td>Method</td><td>MNLI</td><td> SST-2</td><td>MRPC</td><td>CoLA</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>STS-B</td><td>AVG</td></tr><tr><td>LoRA</td><td>87.40</td><td>94.61</td><td>89.95</td><td>63.17</td><td>93.02</td><td>90.67</td><td>86.64</td><td>91.54</td><td>87.12</td></tr><tr><td>DyLoRA</td><td>86.33</td><td>94.26</td><td>89.46</td><td>61.12</td><td>92.22</td><td>90.17</td><td>84.47</td><td>91.06</td><td>86.14</td></tr><tr><td>AdaLoRA</td><td>87.34</td><td>94.49</td><td>90.19</td><td>61.64</td><td>93.08</td><td>90.14</td><td>85.19</td><td>91.16</td><td>86.65</td></tr><tr><td>Delta-LoRA</td><td>87.62±0.21</td><td>95.29±0.23 90.60±0.14</td><td></td><td></td><td>64.64±0.86 93.09±0.15 91.01±0.06 87.00±0.36 91.61±0.04 87.60</td><td></td><td></td><td></td><td></td></tr></table>",
707
+ "page_idx": 14
708
+ },
709
+ {
710
+ "type": "table",
711
+ "img_path": "images/be9bc167a7ce7fb872dfcd51215057f1e05bb04fbab23f643f7ad85c512cea0e.jpg",
712
+ "table_caption": [
713
+ "Table 9: The better training hyper-parameters that we obtained of our proposed Delta-LoRA on GLUE benchmark. "
714
+ ],
715
+ "table_footnote": [],
716
+ "table_body": "<table><tr><td>Hyper-Parameter|MNLI SST-2 MRPC CoLA QNLI QQP RTE STS-B</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Learning Raten|4e-4 5e-4 5e-4 6e-4 3e-4 6e-4 4e-4 4e-4</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Start Steps K</td><td>2000400</td><td></td><td>10</td><td>200600400200200</td><td></td><td></td><td></td><td></td></tr><tr><td>Update Ratio入</td><td>0.5</td><td>0.5</td><td>0.5</td><td>1</td><td>1</td><td>0.50.5</td><td></td><td>0.5</td></tr></table>",
717
+ "page_idx": 14
718
+ },
719
+ {
720
+ "type": "text",
721
+ "text": "A.6 THE PARAMETER SENSITIVITY STUDY ",
722
+ "text_level": 1,
723
+ "page_idx": 15
724
+ },
725
+ {
726
+ "type": "table",
727
+ "img_path": "images/d510e93eac06d4c47b958d15e47a554885fb0542771f49fb06300c494f88a060.jpg",
728
+ "table_caption": [
729
+ "Table 10: The parameter sensitivity study of update ratio $\\lambda$ for our proposed Delta-LoRA on E2E Challenge dataset. The best results are boldfaced. "
730
+ ],
731
+ "table_footnote": [],
732
+ "table_body": "<table><tr><td>入</td><td>BLEU</td><td>NIST</td><td>METEOR</td><td>ROUGE-L</td><td>CIDEr</td></tr><tr><td>0</td><td>68.94</td><td>8.73</td><td>45.27</td><td>70.81</td><td>2.41</td></tr><tr><td>1</td><td>69.77</td><td>8.81</td><td>45.99</td><td>71.58</td><td>2.46</td></tr><tr><td>2</td><td>70.84</td><td>8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr><tr><td>3</td><td>70.14</td><td>8.84</td><td>46.39</td><td>71.45</td><td>2.45</td></tr><tr><td>4</td><td>70.03</td><td>8.83</td><td>46.21</td><td>71.56</td><td>2.47</td></tr><tr><td>5</td><td>70.13</td><td>8.85</td><td>46.35</td><td>71.72</td><td>2.48</td></tr></table>",
733
+ "page_idx": 15
734
+ },
735
+ {
736
+ "type": "text",
737
+ "text": "Parameter Sensitivity. Here, we explore the hyper-parameter $K$ in Algorithm 1 and $\\lambda$ in Equation 6. For the hyper-parameter $K$ , we select it from 0 to 1000 with the interval of 100. From Table 11, we find that our Delta-LoRA could not bring in any improvement before $K = 4 0 0$ , and it will keep a relatively good performance when $K$ is larger than 500. What is more, we choose different numbers for $\\lambda$ , ranging from 0 to 5. According to Table 10, the 5 metrics rise rapidly after $\\lambda = 0$ and reach best at $\\lambda = 2$ , while the performance has small drops on 5 evaluation scores if $\\lambda$ is chosen from 3 to 5. ",
738
+ "page_idx": 15
739
+ },
740
+ {
741
+ "type": "table",
742
+ "img_path": "images/c68055072a7b99eea319779d30509405785852a01512ac369f315dfc697e8c28.jpg",
743
+ "table_caption": [
744
+ "Table 11: The parameter sensitivity study of start steps $K$ for our proposed Delta-LoRA on E2E Challenge dataset. The best results are boldfaced. "
745
+ ],
746
+ "table_footnote": [],
747
+ "table_body": "<table><tr><td>K</td><td>BLEU</td><td>NIST</td><td>METEOR</td><td>ROUGE-L</td><td>CIDEr</td></tr><tr><td>0</td><td>69.10</td><td>8.75</td><td>45.54</td><td>71.31</td><td>2.41</td></tr><tr><td>100</td><td>69.97</td><td>8.84</td><td>46.07</td><td>71.40</td><td>2.46</td></tr><tr><td>200</td><td>69.72</td><td>8.83</td><td>45.82</td><td>71.41</td><td>2.43</td></tr><tr><td>300</td><td>69.73</td><td>8.86</td><td>45.98</td><td>71.09</td><td>2.46</td></tr><tr><td>400</td><td>70.18</td><td>8.89</td><td>46.30</td><td>71.66</td><td>2.49</td></tr><tr><td>500</td><td>70.84</td><td>8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr><tr><td>600</td><td>70.38</td><td>8.86</td><td>46.38</td><td>71.70</td><td>2.47</td></tr><tr><td>700</td><td>70.61</td><td>8.89</td><td>46.43</td><td>72.13</td><td>2.51</td></tr><tr><td>800</td><td>70.70</td><td>8.89</td><td>46.30</td><td>71.97</td><td>2.51</td></tr><tr><td>900</td><td>71.00</td><td>8.92</td><td>46.47</td><td>72.04</td><td>2.52</td></tr><tr><td>1000</td><td>70.87</td><td>8.89</td><td>46.31</td><td>72.06</td><td>2.50</td></tr></table>",
748
+ "page_idx": 15
749
+ },
750
+ {
751
+ "type": "text",
752
+ "text": "A.7 HYPER-PARAMETER USED IN OUR EXPERIMENTS ",
753
+ "text_level": 1,
754
+ "page_idx": 15
755
+ },
756
+ {
757
+ "type": "text",
758
+ "text": "We report the hyper-parameter that used in our experiments. Table 12 and Table 13 show the hyperparameter that we used for the training and evaluation on E2E Challenge and WebNLG Challenge 2017 dataset. The Table 14 and Table 15 are the training and evaluation hyper parameter for XSum dataset, and the Table 16 consists of hyper-parameters for 8 datasets in GLUE benchmark. ",
759
+ "page_idx": 15
760
+ },
761
+ {
762
+ "type": "table",
763
+ "img_path": "images/162a2f0cf25716d299d0270805fc6cfd10e9a8b6111f99c84cf0248d66b3ba46.jpg",
764
+ "table_caption": [
765
+ "Table 12: The training hyper-parameter used for E2E Challenge and WebNLG Challenge 2017 dataset. "
766
+ ],
767
+ "table_footnote": [],
768
+ "table_body": "<table><tr><td>Hyper-Parameter</td><td>E2E Challenge</td><td>WebNLG Challenge 2017</td></tr><tr><td>Learning Rate n</td><td>2e-4</td><td>2e-4</td></tr><tr><td>Batch Size</td><td>8</td><td>8</td></tr><tr><td>Number of Epochs</td><td>5</td><td>5</td></tr><tr><td>Weight Decay β</td><td>0.01</td><td>0.01</td></tr><tr><td>Resid_pdrop</td><td>0</td><td>0.09</td></tr><tr><td>Attn_pdrop</td><td>0</td><td>0.09</td></tr><tr><td>Embd_pdrop</td><td>0</td><td>0</td></tr><tr><td>Label Smooth</td><td>0</td><td>0</td></tr><tr><td> Start Steps K</td><td>500</td><td>500</td></tr><tr><td>Update Ratio 入</td><td>2</td><td>5</td></tr><tr><td>Rank r</td><td>4</td><td>4</td></tr><tr><td>Alpha α</td><td>32</td><td>32</td></tr><tr><td>Trainable Matrices</td><td>Wq,Wv</td><td>Wq,Wv</td></tr><tr><td>LR Scheduler</td><td>Linear</td><td>Linear</td></tr><tr><td>Warmup Steps</td><td>500</td><td>500</td></tr></table>",
769
+ "page_idx": 16
770
+ },
771
+ {
772
+ "type": "table",
773
+ "img_path": "images/9156124cb481f5a13eae2a0ebb71fddd843320c9ea724ce309e0bbabab36da5c.jpg",
774
+ "table_caption": [
775
+ "Table 13: The hyper-parameter for evaluation used for E2E Challenge and WebNLG Challenge 2017 dataset. "
776
+ ],
777
+ "table_footnote": [],
778
+ "table_body": "<table><tr><td>Hyper-Parameter</td><td>E2E Challenge</td><td>WebNLG Challenge 2017</td></tr><tr><td>Beam Size</td><td>10</td><td>5</td></tr><tr><td>Penalty</td><td>0.8</td><td>1.0</td></tr><tr><td>No Repeat Ngram Size</td><td>4</td><td>4</td></tr></table>",
779
+ "page_idx": 16
780
+ },
781
+ {
782
+ "type": "table",
783
+ "img_path": "images/da597f8730d96119464796a7e05ffe09dc8d5545a3946f3b9f0260e204e982bc.jpg",
784
+ "table_caption": [
785
+ "Table 14: The training hyper-parameter used for XSum dataset. "
786
+ ],
787
+ "table_footnote": [],
788
+ "table_body": "<table><tr><td>Hyper-Parameter</td><td>Xsum</td></tr><tr><td>Learning Rate n</td><td>2e-4</td></tr><tr><td>Batch Size</td><td>64</td></tr><tr><td>Number of Epochs</td><td>25</td></tr><tr><td>Weight Decay β</td><td>0</td></tr><tr><td>Activation Dropout</td><td>0</td></tr><tr><td>Dropout Classifier Dropout</td><td>0</td></tr><tr><td>Start Steps K</td><td>0</td></tr><tr><td></td><td>1000</td></tr><tr><td>Update Ratio 入</td><td>0.5</td></tr><tr><td>Rank r</td><td>4</td></tr><tr><td>Alpha α Trainable Matrices</td><td>32</td></tr><tr><td>LR Scheduler</td><td>Wq, Wv Linear</td></tr><tr><td>Warmup Steps</td><td>3000</td></tr></table>",
789
+ "page_idx": 16
790
+ },
791
+ {
792
+ "type": "table",
793
+ "img_path": "images/ea1a27b206db1a4acf10682468033577f4bd671ad95239a35794dfb8d4249ed8.jpg",
794
+ "table_caption": [
795
+ "Table 15: The hyper-parameter for evaluation used for XSum dataset. "
796
+ ],
797
+ "table_footnote": [],
798
+ "table_body": "<table><tr><td>Hyper-Parameter</td><td>Xsum</td></tr><tr><td>Beam Size</td><td>8</td></tr><tr><td>Penalty</td><td>1.0</td></tr><tr><td>No Repeat N-gram Size</td><td>4</td></tr></table>",
799
+ "page_idx": 16
800
+ },
801
+ {
802
+ "type": "table",
803
+ "img_path": "images/76f5df35a6ae5876bd32fcbbe28738001e834c3e0e3f6cf36558012b07abb44b.jpg",
804
+ "table_caption": [
805
+ "Table 16: The training hyper-parameters of our proposed Delta-LoRA on GLUE benchmark. We adopt the most of hyper-parameters in LoRA’s paper and implement our method based on the codes given by LoRA’s repository. "
806
+ ],
807
+ "table_footnote": [],
808
+ "table_body": "<table><tr><td>Hyper-Parameter</td><td>MNLI</td><td>SST-2</td><td>MRPC</td><td>CoLA</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>STS-B</td></tr><tr><td>Learning Rate n</td><td>5e-4</td><td>5e-4</td><td>4e-4</td><td>4e-4</td><td>4e-4</td><td>4e-4</td><td>4e-4</td><td>4e-4</td></tr><tr><td>Batch Size</td><td>128</td><td>128</td><td>128</td><td>64</td><td>256</td><td>128</td><td>128</td><td>128</td></tr><tr><td>Number of Epochs</td><td>30</td><td>60</td><td>30</td><td>80</td><td>25</td><td>25</td><td>80</td><td>40</td></tr><tr><td>Weight Decay β</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>Max Sequence Length</td><td>256</td><td>256</td><td>256</td><td>256</td><td>256</td><td>256</td><td>512</td><td>256</td></tr><tr><td>Start Steps K</td><td>2000</td><td>400</td><td>10</td><td>100</td><td>800</td><td>400</td><td>200</td><td>200</td></tr><tr><td>Update Ratio 入</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td></tr><tr><td>Rank r</td><td>8</td><td>8</td><td>8</td><td>8</td><td>8</td><td>8</td><td>8</td><td>8</td></tr><tr><td>Alpha α</td><td>16</td><td>16</td><td>16</td><td>16</td><td>16</td><td>16</td><td>16</td><td>16</td></tr><tr><td>LR Scheduler</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td></tr><tr><td>Trainable Matrices</td><td>WQ,Wv WQ.Wv WQ,Wv</td><td></td><td></td><td>Wq,Wv</td><td></td><td></td><td></td><td> WQ,Wv WQ,Wv WQ,Wv WQ.Wv</td></tr><tr><td>Warmup Ratio</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td></tr><tr><td>Evaluation Metrics</td><td></td><td>Accuracy Accuracy Accuracy</td><td></td><td> Mthtion Accuracy Accuracy Accuracy</td><td></td><td></td><td></td><td>Pearson</td></tr></table>",
809
+ "page_idx": 17
810
+ }
811
+ ]
parse/test/FAO4VS9QRV/FAO4VS9QRV_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/FAO4VS9QRV/FAO4VS9QRV_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/QAwaaLJNCk/QAwaaLJNCk.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/QAwaaLJNCk/QAwaaLJNCk_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/QAwaaLJNCk/QAwaaLJNCk_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/QAwaaLJNCk/QAwaaLJNCk_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/VP20ZB6DHL/VP20ZB6DHL.md ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CHAIN-OF-VERIFICATION REDUCES HALLUCINATION IN LARGE LANGUAGE MODELS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Generation of plausible yet incorrect factual information, termed hallucination, is an unsolved issue in large language models. We study the ability of language models to deliberate on the responses they give in order to correct their mistakes. We develop the Chain-of-Verification (COVE) method whereby the model first (i) drafts an initial response; then (ii) plans verification questions to fact-check its draft; (iii) answers those questions independently so the answers are not biased by other responses; and (iv) generates its final verified response. In experiments, we show COVE decreases hallucinations across a variety of tasks, from list-based questions from Wikidata, closed book MultiSpanQA and longform text generation.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Large Language Models (LLMs) are trained on huge corpora of text documents with billions of tokens of text. It has been shown that as the number of model parameters is increased, performance at tasks such as closed book QA improve in accuracy, and larger models can generate more correct factual statements (Radford et al., 2019; Petroni et al., 2019). However, even the largest models can still fail, particularly on lesser known torso and tail distribution facts (Sun et al., 2023a), i.e. those that occur relatively rarely in the training corpora. In those cases where the model is incorrect, they instead generate an alternative response which is typically plausible looking (e.g., a similar entity, but an incorrect one). These factually incorrect generations are referred to as hallucinations (Maynez et al., 2020). Further, in longform tasks consisting of generating multiple sentences or paragraphs, the hallucination problem can be exacerbated due to the issue of exposure bias (Wang & Sennrich, 2020).
12
+
13
+ The current wave of language modeling research goes beyond next word prediction, and has focused on their ability to reason. Improved performance in reasoning tasks can be gained by encouraging language models to first generate internal thoughts or reasoning chains before responding (Wei et al., 2022; Adolphs et al., 2021; Wang et al., 2022; Lanchantin et al., 2023), as well as updating their initial response through self-critique (Press et al., 2022; Madaan et al., 2023). In this work we follow this line of research to study how and when language-model-based reasoning can be used to reduce hallucinations. We develop an approach, called Chain-of-Verification (CoVe) which, given an initial draft response, first plans verification questions to check its work, and then systematically answers those questions in order to finally produce an improved revised response. We find that independent verification questions tend to provide more accurate facts than those in the original longform answer, and hence improve the correctness of the overall response. We study variations on this recipe across a range of tasks: from list-based questions, closed booked QA and longform text generation. We first propose a joint approach for generating the entire verification chain left-to-right, which improves performance and decreases hallucinations compared to the baseline language model. However, models that attend to existing hallucinations in the context from their own generations tend to repeat the hallucinations. Hence we also introduce further improvements with factored variants which separate out the verification chain steps, in terms of which context is attended to. We show how these factored variants give further performance gains across all three tasks considered.
14
+
15
+ # 2 RELATED WORK
16
+
17
+ Hallucination is a general problem in language model generations that appears across many tasks, from summarization (Maynez et al., 2020) to open-domain dialogue (Roller et al., 2020), and has not
18
+
19
+ # Query
20
+
21
+ Name some politicians who were born in NY, New York.
22
+
23
+ # 1. Baseline Response
24
+
25
+ Here are some politicians who were born in NY, New York:
26
+ 1. Hillary Clinton - former secretary of state and former Democratic presidential nominee
27
+ 2. Donald Trump - former president of the United States
28
+ 3. Michael Bloomberg - former Mayor of New York City and former Democratic presidential candidate … <list continues..>
29
+
30
+ # 2. Plan Verifications
31
+
32
+ 3. Execute Verifications
33
+
34
+ Hillary Clinton was born in Chicago, Illinois, United States on October 26, 1947.
35
+
36
+ - Where was Hillary Clinton born? - Where was Donald Trump born? - Where was Michael Bloomberg born? … <questions continue..>
37
+
38
+ Donald Trump was born on June 14, 1946, in Queens, New York City, New York, United States
39
+
40
+ Michael Bloomberg was born on February 14, 1942, in Boston, Massachusetts, United States.
41
+
42
+ # 4. Final Verified Response
43
+
44
+ Here are some politicians who were born in NY, New York:
45
+ 1. Donald Trump - former president of the United States
46
+ 2. Alexandria Ocasio-Cortez - Democratic member of the U.S. House of Representatives … <list continues..>
47
+
48
+ Figure 1: Chain-of-Verification (CoVe) method. Given a user query, a large language model generates a baseline response that may contain inaccuracies, e.g. factual hallucinations. We show a query here which failed for ChatGPT (see section 12 for more details). To improve this, CoVe first generates a plan of a set of verification questions to ask, and then executes that plan by answering them and hence checking for agreement. We find that individual verification questions are typically answered with higher accuracy than the original accuracy of the facts in the original longform generation. Finally, the revised response takes into account the verifications. The factored version of CoVe answers verification questions such that they cannot condition on the original response, avoiding repetition and improving performance.
49
+
50
+ been resolved by simply scaling up training data or model size (Zhang et al., 2023). For a survey of the hallucination issue, see Ji et al. (2023) and Ye et al. (2023). A majority of the methods for reducing hallucination can be divided into roughly three categories: training-time correction, generation-time correction and via augmentation (tool-use).
51
+
52
+ In training-time correction methods, an attempt is made to improve the raw left-to-right generations of an encoder-decoder or decoder-only language model by either training or otherwise adjusting the model weights to decrease the probability of hallucinated generations. This includes using reinforcement learning (Roit et al., 2023; Wu et al., 2023), constrastive learning (Chern et al., 2023b; Sun et al., 2023b) and other methods (Li et al., 2023; Narayan et al., 2023).
53
+
54
+ In generation-time correction, a common theme is to make reasoning decisions “on top of” the base LLM in order to make them more reliable. For example, by considering the probabilities of the generated tokens (Mielke et al., 2022; Kadavath et al., 2022). In Manakul et al. (2023) multiple samples are drawn from the model to detect hallucinations. In Varshney et al. (2023) hallucinations are identified using low confidence scores, and their correctness is checked through a validation procedure, mitigated, and then the generation is continued. An alternative to using the confidence scores is to leverage inconsistencies in the LLMs output to detect hallucination. Cohen et al. (2023) show that using inconsistencies for QA tasks can outperform using confidence scores for hallucination detection. Cohen et al. (2023) simulate an interactive multi-agent LM vs. LM debate setup to detect hallucinations for factoid QA, Agrawal et al. (2023) check for hallucinated references, while Mundler ¨ et al. (2023) extract relational triples from generations and verify them against another LLM. COVE also uses a related self-consistency approach but we show our approach can correct hallucinated facts in longform generations by generating and answering verification questions by solely using the same LLM.
55
+
56
+ A third approach is to use external tools to help mitigate hallucinations, rather than relying solely on the abilities of the language model itself. For example, retrieval-augmented generation can decrease hallucinations by using factual documents for grounding (Shuster et al., 2021; Jiang et al., 2023b; Yu et al., 2023) or chain-of-thought verification (Zhao et al., 2023). Other approaches include using tools for fact-checking (Chern et al., 2023a; Galitsky, 2023; Peng et al., 2023), or linking to external documents with attribution (Menick et al., 2022; Rashkin et al., 2023; Gao et al., 2023).
57
+
58
+ There are also a number of related works in improving reasoning for logical and mathematical tasks, even if they do not address reducing hallucination explicitly. Several approaches have been shown to improve results with extended reasoning steps by the system, such as chain-of-thought (Wei et al., 2022), deductive verification (Ling et al., 2023), and self-verification (Miao et al., 2023; Jiang et al., 2023a; Weng et al., 2022). The latter tries to predict the (masked) question given the answer for math problems, and use that as evidence that this is the correct solution.
59
+
60
+ # 3 CHAIN-OF-VERIFICATION
61
+
62
+ Our approach assumes access to a base LLM that – despite potentially being prone to hallucination – is capable of being prompted with general instructions in either a few-shot or zero-shot fashion. A key assumption of our method is that this language model, when suitably prompted, can both generate and execute a plan of how to verify itself in order to check its own work, and finally incorporate this analysis into an improved response.
63
+
64
+ Our overall process, which we call Chain-of-Verification (CoVe), thus performs four core steps:
65
+
66
+ 1. Generate Baseline Response: Given a query, generate the response using the LLM. 2. Plan Verifications: Given both query and baseline response, generate a list of verification questions that could help to self-analyze if there are any mistakes in the original response. 3. Execute Verifications: Answer each verification question in turn, and hence check the answer against the original response to check for inconsistencies or mistakes. 4. Generate Final Verified Response: Given the discovered inconsistencies (if any), generate a revised response incorporating the verification results.
67
+
68
+ Each of these steps is performed by prompting the same LLM in different ways to obtain the desired response. While steps (1), (2) and (4) all can be invoked with a single prompt, we investigate variations of step (3) including joint, 2-step and factored versions. These variants either involve a single prompt, two prompts or else independent prompts per question, where more sophisticated decomposition can yield improved results.
69
+
70
+ We describe these steps in more detail below. An overview of the approach is illustrated in Figure 1, and in the Appendix in Figure 3.
71
+
72
+ # 3.1 BASELINE RESPONSE
73
+
74
+ Given a query, we generate left-to-right as usual using the LLM, with no special tricks. While this is the first step in the CoVe pipeline, it also serves as the baseline we wish to improve in our experiments (i.e., we will directly compare this baseline response with the final verified response from our overall method).
75
+
76
+ Given such baseline generations are typically prone to hallucination, CoVe attempts to identify these hallucinations, and correct them, in the following steps.
77
+
78
+ # 3.2 PLAN VERIFICATIONS
79
+
80
+ Conditioned on the original query and the baseline response, the model is prompted to generate a series of verification questions that test the factual claims in the original baseline response. For example if part of a longform model response contains the statement “The Mexican–American War was an armed conflict between the United States and Mexico from 1846 to 1848”, then one possible verification question to check those dates could be “When did the Mexican American war start and end?”. We note that verification questions are not templated and the language model is free to phrase these in any form it wants, and they also do not have to closely match the phrasing of the original text.
81
+
82
+ In our experiments, we perform such verification planning by providing a few-shot prompt of (response, verification) demonstrations to our LLM. See section 11 for the few-shot prompts we will use in our experiments. We note it is also possible with a sufficiently performant instruction-following LLM that this could be performed zero-shot.
83
+
84
+ # 3.3 EXECUTE VERIFICATIONS
85
+
86
+ Given the planned verification questions, the next step is to answer them in order to assess if any hallucinations exist. While techniques such as retrieval-augmentation could be used in this process, such as verification via search engine, in this work we do not explore tool-use. Instead, we consider only using the LLM itself in all steps of CoVe, hence the model is used to check its own work. We investigate several variants of verification execution, called joint, 2-Step, factored and factor+revise.
87
+
88
+ Joint In the joint method, the planning and execution (steps 2 and 3) are accomplished by using a single LLM prompt, whereby the few-shot demonstrations include both verification questions and their answers immediately after the questions. In this approach separate prompts are not needed.
89
+
90
+ 2-Step A potential disadvantage of the joint method is that because the verification questions must condition on the baseline response in the LLM context, and the method is joint, the verification answers have to condition on the initial response as well. This may increase the likelihood of repetition, another known issue of modern LLMs (Holtzman et al., 2019). This means the verification questions might hallucinate similarly to the original baseline response, which defeats the purpose. We hence instead separate the planning and execution into separate steps, both with their own LLM prompt. The planning prompt conditions on the baseline response in the first step. The verification questions generated from planning are answered in the second step, where crucially the context given to the LLM prompt only contains the questions, and not the original baseline response and hence cannot repeat those answers directly.
91
+
92
+ Factored Another, more sophisticated approach, is to answer all questions independently as separate prompts. Again, crucially, those prompts do not contain the original baseline response and are hence not prone to simply copying or repeating it. The factored approach has the further advantage of removing any potential interference not only from the baseline response, but also between answer contexts, and is somewhat related to the recent (concurrent) work of Radhakrishnan et al. (2023) for subquestion answering by factored decomposition, hence we adopt their naming. It can also potentially handle more verification questions by virtue of them not all having to fit with the same single context. While this is potentially more computationally expensive, requiring the execution of many more LLM prompts, they can be run in parallel, and hence be batched. In order to do this, we first have to take the set of generated questions from subsection 3.2 and parse them into separate questions, which is a relatively easy task as the few-shot demonstrations we provide indicate they should be generated as a comma-separated list. We can then split them out into separate LLM prompts.
93
+
94
+ Factor+Revise After answering the verification questions, the overall CoVe pipeline then has to either implicitly or explicitly cross-check whether those answers indicate an inconsistency with the original responses. In the factor+revise approach, we execute this as a deliberate step via an extra LLM prompt, which may make it easier for the final system to reason about this step explicitly. Differently to answering the verification questions, the cross-checking phase needs to condition on both the baseline response and the verification question and answer. We thus execute this as separate LLM prompts, one “cross-check” prompt for each question, with again a set of few-shot demonstrations showing the desired output. For example if the original baseline response contained the phrase “It followed in the wake of the 1845 U.S. annexation of Texas. . . ” and CoVe generated a verification question When did Texas secede from Mexico? which was answered with 1836 then an inconsistency should be detected by this step.
95
+
96
+ # 3.4 FINAL VERIFIED RESPONSE
97
+
98
+ Finally, the improved response that takes verification into account is generated. This is executed by a final few-shot prompt where the context takes into account all of the previous reasoning steps, the baseline response and verification question answer pairs, so that the corrections can take place. If the Factor+Revise approach is used from subsection 3.3 then the output of the cross-check inconsistency detection is provided as well.
99
+
100
+ # 4 EXPERIMENTS
101
+
102
+ We use various experimental benchmarks to measure the efficacy of CoVe in reducing hallucination, comparing against a number of baselines.
103
+
104
+ # 4.1 TASKS
105
+
106
+ The benchmarks we use range from list-based questions where the required answer is a set of entities, to where the answer is a longform generation of multiple freeform sentences.
107
+
108
+ # 4.1.1 WIKIDATA
109
+
110
+ We start by testing CoVe on a set of automatically generated questions using the Wikidata $\mathsf { A P I } ^ { 1 }$ . We create list questions of the form: “Who are some [Profession]s who were born in [City]?”. For example, “Who are some politicians who were born in Boston?”. The answer to these questions is a set of entities, where the gold list is obtained from the Wikidata knowledge base. This results in a dataset of 56 test questions, each typically containing ${ \sim } 6 0 0$ known gold entities, but typically an LLM will produce a much shorter list. We then use the precision metric (micro-averaged) to measure performance, in addition to reporting the averaged number of positive and negative entities produced.
111
+
112
+ # 4.1.2 WIKI-CATEGORY LIST
113
+
114
+ We then proceed to a harder set-generation task. We use the QUEST (Malaviya et al., 2023) dataset that was created using Wikipedia Category lists. We convert these category names to questions by simply prepending a “Name some”. Owing to the varied questions such as Name some Mexican animated horror films or Name some Endemic orchids of Vietnam we believe this task can pose a greater challenge. We collate all examples in the dataset that do not require logical operations to create a set of 55 test questions each having 8 answers. Similar to the Wikidata task, we measure ˜ precision (micro-averaged) to measure performance, in addition to reporting the averaged number of positive and negative entities produced.
115
+
116
+ # 4.1.3 MULTISPANQA
117
+
118
+ We next test our approach on an reading comprehension benchmark, MultiSpanQA (Li et al., 2022). MultiSpanQA comprises of questions that have multiple independent answers (derived from a series of multiple discontiguous spans in the text, with questions originally from the Natural Questions dataset). We consider a closed-book setting, where we do not provide supporting documents, and hence consider a subset of questions which are factoid-based, so that our base LLM is more likely to be able to answer them. We thus use a test set of 418 questions with shorter answers per span (up to 3 tokens per item). For example, Q: Who invented the first printing press and in what year?, A: Johannes Gutenberg, 1450.
119
+
120
+ Table 1: Test Precision and average number of positive and negative (hallucination) entities for list-based questions on the Wikidata and Wiki-Category list tasks.
121
+
122
+ <table><tr><td></td><td colspan="2">Wikidata (Easier)</td><td></td><td colspan="4">Wiki-Category list (Harder)</td></tr><tr><td>LLM</td><td>Method</td><td>Prec. (↑)</td><td>Pos.</td><td>Neg.</td><td>Prec.(↑)</td><td>Pos.</td><td>Neg.</td></tr><tr><td>Llama 2 70B Chat</td><td>Zero-shot</td><td>0.12</td><td>0.55</td><td>3.93</td><td>0.05</td><td>0.35</td><td>6.85</td></tr><tr><td>Llama 2 70B Chat</td><td>CoT</td><td>0.08</td><td>0.75</td><td>8.92</td><td>0.03</td><td>0.30</td><td>11.1</td></tr><tr><td>Llama 65B</td><td>Few-shot</td><td>0.17</td><td>0.59</td><td>2.95</td><td>0.12</td><td>0.55</td><td>4.05</td></tr><tr><td>Llama 65B</td><td>CoVe (joint)</td><td>0.29</td><td>0.41</td><td>0.98</td><td>0.15</td><td>0.30</td><td>1.69</td></tr><tr><td>Llama 65B</td><td>CoVe (two-step)</td><td>0.36</td><td>0.38</td><td>0.68</td><td>0.21</td><td>0.50</td><td>0.52</td></tr><tr><td>Llama 65B</td><td>CoVe (factored)</td><td>0.32</td><td>0.38</td><td>0.79</td><td>0.22</td><td>0.52</td><td>1.52</td></tr></table>
123
+
124
+ # 4.1.4 LONGFORM GENERATION OF BIOGRAPHIES
125
+
126
+ We next validate the performance of CoVe on longform text generation. In this setting, we evaluate our method on generating biographies, adopting the benchmark proposed in by Min et al. (2023). Here the model is simply prompted to generate a biography of a selected entity using the prompt: “Tell me a bio of <entity>”. We evaluate the efficacy of our approach using the FACTSCORE metric (Min et al., 2023) developed in that work, which uses a retrieval-augmented language model to fact-check the response (Instruct-Llama, “Llama $^ +$ Retrieval $+ \mathrm { N P ^ { , } }$ ), which they showed correlates well with human judgments.
127
+
128
+ # 4.2 BASELINES
129
+
130
+ We use Llama 65B, a strong open model as our base LLM (Touvron et al., 2023a), and use greedy decoding for all models. As Llama 65B is not instruction fine-tuned, we employ few-shot examples particular to each task for measuring performance on each of our benchmarks. This serves as our main baseline which CoVe tries to improve upon. CoVe uses the same Llama 65B base, but includes, for the same few-shot examples, demonstrations of verification questions and final verified responses, following Figure 1 and section 3. Thus, we measure the ability to improve over the original baseline response for the same LLM. For CoVe, we compare different variants, particularly the joint and factored versions on all tasks.
131
+
132
+ We also compare to Llama instruction fine-tuned models, for which we use Llama 2 (Touvron et al., 2023b). We measure both zero-shot performance on the task, or zero-shot with chain-of-thought by adding “Let’s think step by step” to the zero-shot prompt. We find that the instruction fine-tuned models tend to generate extraneous content when queried. This can especially be a problem for the list-based tasks. To deal with this we add an extra line to our prompt: “List only the answers separated by a comma”. We also add another layer of post-processing to extract the answers by using an off-the-shelf NER model to further avoid this issue as this helped. However, we still expect few-shot to improve over this, especially for tasks like Multi-Span-QA where the answers are not all named entities, and the few-shot examples effectively show the domain of the task.
133
+
134
+ For the longform generation of biographies we also compare to several existing model results reported in Min et al. (2023), in particular InstructGPT (Ouyang et al., 2022), ChatGPT 2 and PerplexityAI 3.
135
+
136
+ # 4.3 RESULTS
137
+
138
+ We are interested in empirically answering the following research questions:
139
+
140
+ RQ1 Can COVE effectively reduce the rate of hallucinatory content produced by the LLM? RQ2 Can COVE be used to fix or remove incorrect generations without decreasing the amount of correct content?
141
+
142
+ Table 2: Closed book MultiSpanQA test performance, comparing CoVe with various baselines.
143
+
144
+ <table><tr><td>LLM</td><td>Method</td><td>F1(1)</td><td>Prec.</td><td>Rec.</td></tr><tr><td>Llama 2 70B Chat</td><td>Zero-shot</td><td>0.20</td><td>0.13</td><td>0.40</td></tr><tr><td>Llama 2 70B Chat</td><td>CoT</td><td>0.17</td><td>0.11</td><td>0.37</td></tr><tr><td>Llama 65B</td><td>Few-shot</td><td>0.39</td><td>0.40</td><td>0.38</td></tr><tr><td>Llama 65B</td><td>CoVe (joint)</td><td>0.46</td><td>0.50</td><td>0.42</td></tr><tr><td>Llama 65B</td><td>CoVe (factored)</td><td>0.48</td><td>0.50</td><td>0.46</td></tr></table>
145
+
146
+ Table 3: Longform generation of biographies with metrics defined from Min et al. (2023). Models marked with $^ *$ are reported from previous work. FACTSCORE automatically computed using “InstructLlama” ( Retrieve $ \mathrm { L M } + \mathrm { N P }$ ), the best open-access model.
147
+
148
+ <table><tr><td>LLM</td><td>Method</td><td>FACTSCORE. (↑)</td><td>Avg. # facts</td></tr><tr><td>InstructGPT*</td><td>Zero-shot</td><td>41.1</td><td>26.3</td></tr><tr><td>ChatGPT*</td><td>Zero-shot</td><td>58.7</td><td>34.7</td></tr><tr><td>PerplexityAI*</td><td>Retrieval-based</td><td>61.6</td><td>40.8</td></tr><tr><td>Llama 2 70B Chat</td><td>Zero-shot</td><td>41.3</td><td>64.9</td></tr><tr><td>Llama 2 70B Chat</td><td>CoT</td><td>41.1</td><td>49.0</td></tr><tr><td>Llama 65B</td><td>Few-shot</td><td>55.9</td><td>16.6</td></tr><tr><td>Llama 65B</td><td>CoVe (joint)</td><td>60.8</td><td>12.8</td></tr><tr><td>Llama 65B</td><td>CoVe (factored)</td><td>63.7</td><td>11.7</td></tr><tr><td>Llama 65B</td><td>CoVe (factor+revise)</td><td>71.4</td><td>12.3</td></tr><tr><td>GPT-3</td><td>Few-shot</td><td>45.3</td><td>15.6</td></tr><tr><td>GPT-3 + ChatGPT</td><td>ChatProtect Muindler et al. (2023)</td><td>48.5</td><td>14.6</td></tr><tr><td>GPT-3 + InstructGPT</td><td>SCG-LL Manakul et al. (2023)</td><td>60.6</td><td>6.0</td></tr><tr><td>GPT-3+DeBERTA</td><td>SCG-NLI Manakul et al. (2023)</td><td>61.7</td><td>6.3</td></tr><tr><td>GPT-3 + InstructGPT</td><td>CoVe (factor+revise)</td><td>68.6</td><td>9.0</td></tr></table>
149
+
150
+ ![](images/2a6ac1cda2f821ac1aa01184f19b3fcaf962289ecad5c965bc0573e103f15b60.jpg)
151
+ Figure 2: FACTSCORE performance distribution across head, torso and tail facts for CoVe variants and various baselines on longform generation of biographies.
152
+
153
+ Our main results across the four benchmark tasks are given in Table 1, Table 2 and Table 3, and our main findings are as follows.
154
+
155
+ CoVe improves precision on list-based answer tasks We find that CoVe provides large gains in precision on the list-based tasks, e.g. more than doubles the precision from the Llama 65B few-shot baseline for the Wikidata task (from 0.17 to 0.36). We find from the positive and negative breakdown that there is a large reduction in the number of hallucinated answers (negatives: $2 . 9 5 0 . 6 8 )$ while only a relatively small reduction in the number of non-hallucinations (positives: $0 . 5 9 0 . 3 8$ ).
156
+
157
+ CoVe improves performance on closed book QA We also find that CoVe brings improvements in general QA problems, as measured on MultiSpanQA. We observe a $23 \%$ improvement in F1 over the few-shot baseline $( 0 . 3 9 0 . 4 8 )$ ), where the improvements come from gains in both precision and recall.
158
+
159
+ CoVe improves precision on longform generation These results also extend to longform generation, where we actually see larger gains than in the QA setting. FACTSCORE increases $28 \%$ $5 5 . 9 $ 71.4) from the few-shot baseline, with again only a relatively small reduction in average number of facts provided $1 6 . 6 1 2 . 3$ ). We also show the breakdown of improvements across facts in Figure 2, where one can see CoVe improves results for both rare and more frequent facts.
160
+
161
+ Instruction-tuning and CoT do not reduce hallucinations We find that the few-shot baseline that employs a pre-trained Llama model outperforms Llama-2-Chat, an instruction tuned model, across all the tasks. The few-shot examples lead the model to give outputs in line with those expected for the task, whereas general instruction tuning produces more hallucinations or incorrect outputs. Zero-shot chain-of-thought (CoT) prompting also fails to improve the results for these tasks.
162
+
163
+ Factored and 2-step CoVe improve performance We observe a consistent performance improvement across all tasks from applying the factored CoVe approach compared to joint CoVe. For example improvement from $6 0 . 8 6 3 . 7$ in FACTSCORE in longform generation. Similarly, the 2-step approach also outperforms the joint approach, as tested on the Wikidata and Wiki-Category list tasks, with 2-step giving the best results for Wikidata, and factored the best for Wiki-Category. All these results support our hypothesis that verifying questions should not attend to the original baseline response as they may be prone to repeating it (as the joint method can do).
164
+
165
+ Further explicit reasoning helps remove hallucinations In the longform generation task we also explore more sophisticated reasoning steps in the CoVe “factor+revise” method, which explicitly cross-checks whether verification answers indicate an inconsistency. We see large gains in the FACTSCORE metric from this further explicit reasoning from 63.7 (factored) $ 7 1 . 4$ (factor+revise). This gives further indication that appropriate and explicit reasoning in LLMs can bring improvements in mitigating hallucinations.
166
+
167
+ CoVe-based Llama outperforms InstructGPT, ChatGPT and PerplexityAI On the longform generation task, our baseline few-shot Llama 65B is outperformed by the ChatGPT and PerplexityAI models in terms of the FACTSCORE metric. However, applying CoVe to Llama 65B lifts its performance above ChatGPT and InstructGPT, as well as PerplexityAI. This is particularly impressive compared to PerplexityAI considering that is a model that can support its facts with retrieval-augmentation, whereas CoVe uses only the base language model itself with improved reasoning via deliberation (verification). However, Figure 2 shows PerplexityAI still outperforms CoVe for very rare facts where retrieval is essential, but CoVe outperforms PerplexityAI for frequent facts.
168
+
169
+ CoVe outperforms existing hallucination mitigation baselines We compare CoVe to three recently released longform hallucination mitigation approaches — NLI and LLM, the two bestperforming variants of SelfCheckGPT (Manakul et al., 2023) and ChatProtect Mundler et al. (2023). ¨ Our results in Table 3 show that COVE outperforms all these baselines. More details on our implementations of the baselines can be found in section 9. For SelfCheckGPT we experiment with different thresholds (in Table 6) and choose a threshold that results in a high FACTSCORE without removing a lot of facts. We note that some models produce fewer overall facts than others, however, the FACTSCORE metric is normalized and hence comparable across models. We verified this experimentally by clipping Llama-2-70B chat’s output to present fewer facts (as it contains the largest number in its output out of all models), but this did not change its FACTSCORE substantially, e.g. clipping to 10 sentences increased its score from $4 1 . 3 4 2 . 7$ . We note the length of the generations of the few-shot-based models is essentially governed by the few-shot examples, which in turn are constrained by the context length.
170
+
171
+ Shortform verification questions are more accurately answered than longform queries In a longform response, LLMs are prone to generate a number of hallucinations. However, it can often be the case that the LLM itself would know these hallucinations are wrong if queried specifically for that individual fact, independent of the rest of the longform generation, see Figure 1, Figure 3, and section 12. This can be seen quantitatively on the Wikidata task, where only ${ \sim } 1 7 \%$ of the Llama few-shot baseline answer entities are correct in list-based questions. However, when querying each individual entity via a verification question, we find ${ \sim } 7 0 \%$ are correctly answered.
172
+
173
+ Open LLM-based verification questions outperform yes/no-based and rule-based verification questions In our method, CoVe, the verification questions generated by the LLM expect answers that are true facts. Another alternative type of verification questions would be templated verification questions, which can be generated cheaply, and binary questions. We first compare to heuristically constructed questions by replacing the LLM questions with templated yes/no questions of the form “Does $X$ answer the question” for list-based questions with elements $X$ in the answer. Results on the Wiki-Category task, given in Table 4, show a reduced precision with rule-based verification questions. We then move on to binary questions where we include the fact as part of the verification question and ask it in a yes/no answer format. We evaluate this difference in Table 4, and find that yes/no type questions perform worse for the factored version of CoVe. Some anecdotal examples are included in Appendix section 12 for ChatGPT where we find the model tends to agree with facts in a yes/no question format whether they are right or wrong. We believe this difference would be larger for longform generation where the types of required verification questions can be more diverse, and LLM-based verification becomes even more necesary.
174
+
175
+ Inference overhead Approaches that detect hallucinations via inconsistencies require repeated prompts to the LLM. COVE essentially requires 1 LLM call for generating the baseline response, 1 LLM call for each sentence to plan the verifications, 1 LLM call to verify each fact and 1 LLM call for each fact to generate the consistent response. We also note that the LLM calls for verification for each fact can be parallelized. This is comparable and in certain cases fewer LLM calls compared to other approaches for hallucination mitigation. We provide a more in-depth analysis in section 8.
176
+
177
+ # 5 CONCLUSION
178
+
179
+ We introduced Chain-of-Verification $\mathrm { ( C o V e ) }$ , an approach to reduce hallucinations in a large language model by deliberating on its own responses and self-correcting them. In particular, we showed that models are able to answer verification questions with higher accuracy than when answering the original query by breaking down the verification into a set of simpler questions. Secondly, when answering the set of verification questions, we showed that controlling the attention of the model so that it cannot attend to its previous answers (factored CoVe) helps alleviate copying the same hallucinations. Overall, our method provides substantial performance gains over the original language model response just by asking the same model to deliberate on (verify) its answer. An obvious extension to our work is to equip CoVe with tool-use, e.g., to use retrieval augmentation in the verification execution step which would likely bring further gains.
180
+
181
+ # 6 LIMITATIONS
182
+
183
+ While our Chain-of-Verification (CoVe) method seeks to reduce hallucinations, it does not remove them completely from generations. This means that CoVe can still generate incorrect or misleading information for a given query, even if it improves over the baseline. We also note that in our experiments we have only addressed hallucinations in the form of directly stated factual inaccuracies. However, hallucinations could come in other forms, such as during incorrect reasoning steps, as part of opinions, etc. We also note that the generations CoVe produces come with verifications which, if viewed by the user, add more interpretability to its decisions, but come at the cost of increased computational expense due to generating more tokens in the output, similar to other reasoning methods such as Chain-of-Thought.
184
+
185
+ Our method seeks to make a large language model produce improved responses by spending more time deliberating to identify its own mistakes. While we have shown this gives clear improvements, the upper bound to the improvement is clearly limited by the overall capabilities of the model, e.g. in identifying and knowing what it knows. In this regard, an orthogonal line of research, as discussed in section 2 is the use of external tools by language models, to gain further information beyond what is stored in its weights. While we do not explore that avenue in this work those techniques would likely be fruitful to combine with the findings here.
186
+
187
+ # REFERENCES
188
+
189
+ Leonard Adolphs, Kurt Shuster, Jack Urbanek, Arthur Szlam, and Jason Weston. Reason first, then respond: Modular generation for knowledge-infused dialogue. arXiv preprint arXiv:2111.05204, 2021.
190
+ Ayush Agrawal, Lester Mackey, and Adam Tauman Kalai. Do language models know when they’re hallucinating references? arXiv preprint arXiv:2305.18248, 2023.
191
+ I Chern, Steffi Chern, Shiqi Chen, Weizhe Yuan, Kehua Feng, Chunting Zhou, Junxian He, Graham Neubig, Pengfei Liu, et al. Factool: Factuality detection in generative ai–a tool augmented framework for multi-task and multi-domain scenarios. arXiv preprint arXiv:2307.13528, 2023a.
192
+ I-Chun Chern, Zhiruo Wang, Sanjan Das, Bhavuk Sharma, Pengfei Liu, Graham Neubig, et al. Improving factuality of abstractive summarization via contrastive reward learning. arXiv preprint arXiv:2307.04507, 2023b.
193
+ Roi Cohen, May Hamri, Mor Geva, and Amir Globerson. Lm vs lm: Detecting factual errors via cross examination. arXiv preprint arXiv:2305.13281, 2023.
194
+ Boris A Galitsky. Truth-o-meter: Collaborating with llm in fighting its hallucinations. 2023.
195
+ 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.
196
+ Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. arXiv preprint arXiv:1904.09751, 2019.
197
+ Ziwei Ji, Nayeon Lee, Rita Frieske, Tiezheng Yu, Dan Su, Yan Xu, Etsuko Ishii, Ye Jin Bang, Andrea Madotto, and Pascale Fung. Survey of hallucination in natural language generation. ACM Computing Surveys, 55(12):1–38, 2023.
198
+ Weisen Jiang, Han Shi, Longhui Yu, Zhengying Liu, Yu Zhang, Zhenguo Li, and James T Kwok. Backward reasoning in large language models for verification. arXiv preprint arXiv:2308.07758, 2023a.
199
+ Zhengbao Jiang, Frank F Xu, Luyu Gao, Zhiqing Sun, Qian Liu, Jane Dwivedi-Yu, Yiming Yang, Jamie Callan, and Graham Neubig. Active retrieval augmented generation. arXiv preprint arXiv:2305.06983, 2023b.
200
+ Saurav Kadavath, Tom Conerly, Amanda Askell, Tom Henighan, Dawn Drain, Ethan Perez, Nicholas Schiefer, Zac Hatfield-Dodds, Nova DasSarma, Eli Tran-Johnson, et al. Language models (mostly) know what they know. arXiv preprint arXiv:2207.05221, 2022.
201
+ Jack Lanchantin, Shubham Toshniwal, Jason Weston, Arthur Szlam, and Sainbayar Sukhbaatar. Learning to reason and memorize with self-notes. arXiv preprint arXiv:2305.00833, 2023.
202
+ Haonan Li, Martin Tomko, Maria Vasardani, and Timothy Baldwin. Multispanqa: A dataset for multi-span question answering. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 1250–1260, 2022.
203
+ Kenneth Li, Oam Patel, Fernanda Viegas, Hanspeter Pfister, and Martin Wattenberg. Inference-time ´ intervention: Eliciting truthful answers from a language model. arXiv preprint arXiv:2306.03341, 2023.
204
+ Zhan Ling, Yunhao Fang, Xuanlin Li, Zhiao Huang, Mingu Lee, Roland Memisevic, and Hao Su. Deductive verification of chain-of-thought reasoning. arXiv preprint arXiv:2306.03872, 2023.
205
+ Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, et al. Self-refine: Iterative refinement with self-feedback. arXiv preprint arXiv:2303.17651, 2023.
206
+ Chaitanya Malaviya, Peter Shaw, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Quest: A retrieval dataset of entity-seeking queries with implicit set operations. arXiv preprint arXiv:2305.11694, 2023.
207
+ Potsawee Manakul, Adian Liusie, and Mark JF Gales. Selfcheckgpt: Zero-resource black-box hallucination detection for generative large language models. arXiv preprint arXiv:2303.08896, 2023.
208
+ Joshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. On faithfulness and factuality in abstractive summarization. arXiv preprint arXiv:2005.00661, 2020.
209
+ Jacob Menick, Maja Trebacz, Vladimir Mikulik, John Aslanides, Francis Song, Martin Chadwick, Mia Glaese, Susannah Young, Lucy Campbell-Gillingham, Geoffrey Irving, et al. Teaching language models to support answers with verified quotes. arXiv preprint arXiv:2203.11147, 2022.
210
+ Ning Miao, Yee Whye Teh, and Tom Rainforth. Selfcheck: Using llms to zero-shot check their own step-by-step reasoning. arXiv preprint arXiv:2308.00436, 2023.
211
+ Sabrina J Mielke, Arthur Szlam, Emily Dinan, and Y-Lan Boureau. Reducing conversational agents’ overconfidence through linguistic calibration. Transactions of the Association for Computational Linguistics, 10:857–872, 2022.
212
+ Sewon Min, Kalpesh Krishna, Xinxi Lyu, Mike Lewis, Wen-tau Yih, Pang Wei Koh, Mohit Iyyer, Luke Zettlemoyer, and Hannaneh Hajishirzi. Factscore: Fine-grained atomic evaluation of factual precision in long form text generation. arXiv preprint arXiv:2305.14251, 2023.
213
+ Niels Mundler, Jingxuan He, Slobodan Jenko, and Martin Vechev. Self-contradictory hallucinations ¨ of large language models: Evaluation, detection and mitigation. arXiv preprint arXiv:2305.15852, 2023.
214
+ Shashi Narayan, Joshua Maynez, Reinald Kim Amplayo, Kuzman Ganchev, Annie Louis, Fantine Huot, Anders Sandholm, Dipanjan Das, and Mirella Lapata. Conditional generation with a question-answering blueprint. Transactions of the Association for Computational Linguistics, 11: 974–996, 2023.
215
+ 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.
216
+ Baolin Peng, Michel Galley, Pengcheng He, Hao Cheng, Yujia Xie, Yu Hu, Qiuyuan Huang, Lars Liden, Zhou Yu, Weizhu Chen, et al. Check your facts and try again: Improving large language models with external knowledge and automated feedback. arXiv preprint arXiv:2302.12813, 2023.
217
+ Fabio Petroni, Tim Rocktaschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H Miller, ¨ and Sebastian Riedel. Language models as knowledge bases? arXiv preprint arXiv:1909.01066, 2019.
218
+ Ofir Press, Muru Zhang, Sewon Min, Ludwig Schmidt, Noah A Smith, and Mike Lewis. Measuring and narrowing the compositionality gap in language models. arXiv preprint arXiv:2210.03350, 2022.
219
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
220
+ Ansh Radhakrishnan, Karina Nguyen, Anna Chen, Carol Chen, Carson Denison, Danny Hernandez, Esin Durmus, Evan Hubinger, Jackson Kernion, Kamile Luko ˙ siˇ ut¯ e, et al. Question decomposition ˙ improves the faithfulness of model-generated reasoning. arXiv preprint arXiv:2307.11768, 2023.
221
+ Hannah Rashkin, Vitaly Nikolaev, Matthew Lamm, Lora Aroyo, Michael Collins, Dipanjan Das, Slav Petrov, Gaurav Singh Tomar, Iulia Turc, and David Reitter. Measuring attribution in natural language generation models. Computational Linguistics, pp. 1–66, 2023.
222
+ Paul Roit, Johan Ferret, Lior Shani, Roee Aharoni, Geoffrey Cideron, Robert Dadashi, Matthieu Geist, Sertan Girgin, Leonard Hussenot, Orgad Keller, et al. Factually consistent summarization ´ via reinforcement learning with textual entailment feedback. arXiv preprint arXiv:2306.00186, 2023.
223
+ Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M Smith, et al. Recipes for building an open-domain chatbot. arXiv preprint arXiv:2004.13637, 2020.
224
+ Kurt Shuster, Spencer Poff, Moya Chen, Douwe Kiela, and Jason Weston. Retrieval augmentation reduces hallucination in conversation. arXiv preprint arXiv:2104.07567, 2021.
225
+ Kai Sun, Yifan Ethan Xu, Hanwen Zha, Yue Liu, and Xin Luna Dong. Head-to-tail: How knowledgeable are large language models (llm)? aka will llms replace knowledge graphs? arXiv preprint arXiv:2308.10168, 2023a.
226
+ Weiwei Sun, Zhengliang Shi, Shen Gao, Pengjie Ren, Maarten de Rijke, and Zhaochun Ren. Contrastive learning reduces hallucination in conversations. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pp. 13618–13626, 2023b.
227
+ Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee´ Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and \` efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023a.
228
+ Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and fine-tuned chat models, 2023b.
229
+
230
+ Neeraj Varshney, Wenlin Yao, Hongming Zhang, Jianshu Chen, and Dong Yu. A stitch in time saves nine: Detecting and mitigating hallucinations of llms by validating low-confidence generation. arXiv preprint arXiv:2307.03987, 2023.
231
+
232
+ Chaojun Wang and Rico Sennrich. On exposure bias, hallucination and domain shift in neural machine translation. arXiv preprint arXiv:2005.03642, 2020.
233
+
234
+ Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022.
235
+
236
+ 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.
237
+
238
+ Yixuan Weng, Minjun Zhu, Shizhu He, Kang Liu, and Jun Zhao. Large language models are reasoners with self-verification. arXiv preprint arXiv:2212.09561, 2022.
239
+
240
+ Zeqiu Wu, Yushi Hu, Weijia Shi, Nouha Dziri, Alane Suhr, Prithviraj Ammanabrolu, Noah A Smith, Mari Ostendorf, and Hannaneh Hajishirzi. Fine-grained human feedback gives better rewards for language model training. arXiv preprint arXiv:2306.01693, 2023.
241
+
242
+ Hongbin Ye, Tong Liu, Aijia Zhang, Wei Hua, and Weiqiang Jia. Cognitive mirage: A review of hallucinations in large language models. arXiv preprint arXiv:2309.06794, 2023.
243
+
244
+ Wenhao Yu, Zhihan Zhang, Zhenwen Liang, Meng Jiang, and Ashish Sabharwal. Improving language models via plug-and-play retrieval feedback. arXiv preprint arXiv:2305.14002, 2023. Muru Zhang, Ofir Press, William Merrill, Alisa Liu, and Noah A Smith. How language model hallucinations can snowball. arXiv preprint arXiv:2305.13534, 2023. Ruochen Zhao, Xingxuan Li, Shafiq Joty, Chengwei Qin, and Lidong Bing. Verify-and-edit: A knowledge-enhanced chain-of-thought framework. arXiv preprint arXiv:2305.03268, 2023.
245
+
246
+ # 7 RULE-BASED VS BINARY VS GENERAL QUESTIONS
247
+
248
+ Table 4: Comparison of various COVE verification plan strategies (rows) and verification execution techniques (columns) on the WikiCategory task.
249
+
250
+ <table><tr><td></td><td colspan="2">Verification Execution</td></tr><tr><td></td><td>CoVe (joint)</td><td>CoVe (factored)</td></tr><tr><td>Verification Plan</td><td>Prec.</td><td>Prec.</td></tr><tr><td>Rule-based questions Generated by model:</td><td>0.13</td><td>0.16</td></tr><tr><td>yes/no questions</td><td>0.15</td><td>0.19</td></tr><tr><td>general questions</td><td>0.15</td><td>0.22</td></tr></table>
251
+
252
+ # 8 INFERENCE OVERHEAD
253
+
254
+ $N : =$ Number of text samples, 4 in our experiments $k : =$ Number of repeated mitigations, 3 in our experiments $s : =$ Number of sentences in the generated passage $f : =$ Number of facts in the generated passage
255
+
256
+ <table><tr><td>Method</td><td>#LLM prompts</td></tr><tr><td>Few-shot</td><td>1</td></tr><tr><td>ChatProtect Mundler et al. (2023)</td><td>1+s×k × (3)</td></tr><tr><td>SCG-LLM Manakul et al. (2023)</td><td>n+1+s×n</td></tr><tr><td>CoVe (factor+revise)</td><td>1+s+2×f</td></tr></table>
257
+
258
+ Table 5: Worst-case LLM prompts used by each hallucination mitigation approach in the worst case
259
+
260
+ Based on the current implementations we find the COVE induces a similar inference overhead to other longform hallucination mitigation approaches.
261
+
262
+ # 9 IMPLEMENTATION OF BASELINES
263
+
264
+ We use the existing models provided by Manakul et al. (2023) for the NLI model. For the LLM model we prompt GPT-3.5-turbo-instruction with the following instruction (as described in Manakul et al. (2023).
265
+
266
+ Context: {}
267
+ Sentence: {}
268
+ Is the sentence supported by the context above?
269
+ Answer Yes or No:
270
+
271
+ Table 6: Different threshold results for SelfCheckGPT
272
+
273
+ <table><tr><td colspan="3">NLI</td><td colspan="2">LLM</td></tr><tr><td>Threshold</td><td>FS</td><td>Facts</td><td>FS</td><td>Facts</td></tr><tr><td>High</td><td>76.5</td><td>3.0</td><td>61.7</td><td>6.3</td></tr><tr><td>Med</td><td>60.6</td><td>6.0</td><td>56.8</td><td>8.4</td></tr><tr><td>Low</td><td>53.0</td><td>8.0</td><td>53.0</td><td>10</td></tr></table>
274
+
275
+ # 10 COVE - FURTHER DETAILS
276
+
277
+ Query
278
+
279
+ What was the primary cause of the Mexican-American war?
280
+
281
+ 1. Baseline Response
282
+
283
+ The Mexican–American War was an armed conflict between the United States and Mexico from 1846 to 1848. It followed in the wake of the 1845 U.S. annexation of Texas, which Mexico considered part of its territory in spite of its de facto secession in the 1835 Texas Revolution.
284
+
285
+ ![](images/94709e778b23d5c18849470472ac402c7e9407a4ccadc313485b8a453c3cd60c.jpg)
286
+
287
+ # 4. Final Verified Response
288
+
289
+ The Mexican–American War was an armed conflict between the United States and Mexico from 1846 to 1848. It followed in the wake of the 1845 U.S. annexation of Texas.
290
+
291
+ Figure 3: For longform generation, the Chain-of-Verification (CoVe) Factor $^ +$ Revise method is the most effective in our longform generation experiments. CoVe Factor $^ +$ Revise has the model independently identify (cross-check) which facts are consistent with its executed verifications (indicated by tickmark and crosses in the figure). With this extra step we aim to disregard the inconsistent facts and use the consistent facts to regenerate the response.
292
+
293
+ # 11 PROMPT TEMPLATES
294
+
295
+ We provide prompt templates for the longform generation of biographies task below for the different steps and variants of CoVe (see section 3). Templates for the other tasks are similar, but using few-shot examples from those tasks instead.
296
+
297
+ # 11.1 GENERATE BASELINE RESPONSE
298
+
299
+ ![](images/0fe7b3d2b41a0144a2c0181c7d4152dcb93519e51be0121a5a244181b0cf9570.jpg)
300
+
301
+ Table 7: Few-shot prompting with 3 few-shot examples for the longform generation of biographies task. Other tasks use the same standard few-shot setup as well (with 3 examples from that particular task).
302
+
303
+ # 11.2 PLAN VERIFICATIONS
304
+
305
+ ![](images/13a898dcb1cd0226f5f767f829a20fca5547e701fb0d28e03510b5bc7cd8b2df.jpg)
306
+
307
+ Table 8: Step (2) of CoVe involves planning the verification questions. In the biography task case we split the longform generation into its individual passages (e.g. sentences in the biography case, this was done due to excessive context length, which we don’t need to do for the other tasks). The model then generates a verification question for each fact it observes in each passage (a passage may have multiple facts).
308
+
309
+ # 11.3 EXECUTE VERIFICATIONS
310
+
311
+ <table><tr><td>A:Answer</td><td>Q:Verification Question</td></tr><tr><td>A:Answer</td><td>Q:Verification Question</td></tr><tr><td></td><td>Q:Verification Question</td></tr><tr><td>A:Answer</td><td></td></tr><tr><td>A:</td><td>Q:Verification Question</td></tr></table>
312
+
313
+ Table 9: In step (3) of CoVe, the model then generates an answer for each of the verification questions.
314
+ Again we use 3 few-shot examples.
315
+
316
+ ![](images/ace96e9e92daafa958b6f1a880fbf19309271761f99ac9dec0e094b0dd11f67c.jpg)
317
+
318
+ Table 10: In step (4) of CoVe (factored) the model is then presented with its original generation (split into passages, e.g. sentences, in the biography case, due to excessive context length which we do not need to do for the other tasks) along with its own verification step results. The model is told that this information comes from “another source”. The model is required to synthesize a new final answer based on facts that are consistent between the two sources.
319
+
320
+ 11.5 FACTOR $^ +$ REVISE: IDENTIFY WHICH FACTS ARE CONSISTENT
321
+
322
+ Context: <Original Fact>.
323
+ From another source,
324
+ <output of execute verification step: ${ \mathsf { \Omega } } + { \mathsf { \Omega } } { \mathsf { A } } { \mathsf { \Sigma } } ^ { } $
325
+ Response: CONSISTENT. <Consistent fact>
326
+ Context: <Original Fact>.
327
+ From another source,
328
+ <output of execute verification step: ${ \mathsf { \Omega } } + { \mathsf { \Omega } } { \mathsf { A } } { \mathsf { \Sigma } } ^ { } $
329
+ Response: INCONSISTENT.
330
+ Context: <Original Fact>.
331
+ From another source,
332
+ <output of execute verification step: ${ \mathsf { \Omega } } + { \mathsf { \Omega } } { \mathsf { A } } { \mathsf { \Sigma } } ^ { } $
333
+ Response: PARTIALLY CONSISTENT. <Consistent part>
334
+
335
+ Table 11: In the CoVe (Factor $^ +$ Revise) variant, as part of step (3) after subsection 11.3, the model is made to explicitly identify which facts are consistent between the two sources. The consistent facts can then be spliced together.
336
+
337
+ # 12 CHATGPT EXAMPLE SCREENSHOTS
338
+
339
+ ![](images/a0ac0be4610c73ae36b0490ec9f086a325d33f878a872c442c779f33d65a5874.jpg)
340
+ Figure 4: ChatGPT generates several hallucinations for this question, e.g. Hillary Clinton and Michael Bloomberg.
341
+
342
+ ![](images/81ab370438350ed63c748edfeb9c58714679c87057809dcd84e149b5cfee97a4.jpg)
343
+ Figure 5: Even when the longform answer is provided for a rewritten query (see query from Figure 4), while giving a slightly different answer, ChatGPT still generates several hallucinations for this question, e.g. Hillary Clinton and Michael Bloomberg.
344
+
345
+ ![](images/9f8d2dbbfaa853e00d3fc3adfa55c24c1c0502c17e543fa748123cd0e8a97b90.jpg)
346
+ Figure 6: Shortform questions (which could be verification questions) appear to be answered more factually than the longform answers in Figure 4 and Figure 5.
347
+
348
+ ![](images/7f1208d6d3f6c8164bbd03eeea1030b9a2275742dd85a5054d7115d1fa54cfbc.jpg)
349
+ Figure 7: Another example of hallucinations for a different query, e.g., John F. Kennedy Jr was born in Washington D.C.
350
+
351
+ ![](images/ef441d4c071149f8a7e5c6aae7dad6cac0beb4d516e8512712a32b3a3366428b.jpg)
352
+ Figure 8: Examples where questions asking for a fact are answered correctly, but verifying via a yes/no question is incorrect (the model tends to agree with the way the question is stated, even if it was stated incorrectly).
parse/test/VP20ZB6DHL/VP20ZB6DHL_content_list.json ADDED
@@ -0,0 +1,819 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "CHAIN-OF-VERIFICATION REDUCES HALLUCINATION IN LARGE LANGUAGE MODELS ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Anonymous authors Paper under double-blind review ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "ABSTRACT ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "Generation of plausible yet incorrect factual information, termed hallucination, is an unsolved issue in large language models. We study the ability of language models to deliberate on the responses they give in order to correct their mistakes. We develop the Chain-of-Verification (COVE) method whereby the model first (i) drafts an initial response; then (ii) plans verification questions to fact-check its draft; (iii) answers those questions independently so the answers are not biased by other responses; and (iv) generates its final verified response. In experiments, we show COVE decreases hallucinations across a variety of tasks, from list-based questions from Wikidata, closed book MultiSpanQA and longform text generation. ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "1 INTRODUCTION ",
27
+ "text_level": 1,
28
+ "page_idx": 0
29
+ },
30
+ {
31
+ "type": "text",
32
+ "text": "Large Language Models (LLMs) are trained on huge corpora of text documents with billions of tokens of text. It has been shown that as the number of model parameters is increased, performance at tasks such as closed book QA improve in accuracy, and larger models can generate more correct factual statements (Radford et al., 2019; Petroni et al., 2019). However, even the largest models can still fail, particularly on lesser known torso and tail distribution facts (Sun et al., 2023a), i.e. those that occur relatively rarely in the training corpora. In those cases where the model is incorrect, they instead generate an alternative response which is typically plausible looking (e.g., a similar entity, but an incorrect one). These factually incorrect generations are referred to as hallucinations (Maynez et al., 2020). Further, in longform tasks consisting of generating multiple sentences or paragraphs, the hallucination problem can be exacerbated due to the issue of exposure bias (Wang & Sennrich, 2020). ",
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "The current wave of language modeling research goes beyond next word prediction, and has focused on their ability to reason. Improved performance in reasoning tasks can be gained by encouraging language models to first generate internal thoughts or reasoning chains before responding (Wei et al., 2022; Adolphs et al., 2021; Wang et al., 2022; Lanchantin et al., 2023), as well as updating their initial response through self-critique (Press et al., 2022; Madaan et al., 2023). In this work we follow this line of research to study how and when language-model-based reasoning can be used to reduce hallucinations. We develop an approach, called Chain-of-Verification (CoVe) which, given an initial draft response, first plans verification questions to check its work, and then systematically answers those questions in order to finally produce an improved revised response. We find that independent verification questions tend to provide more accurate facts than those in the original longform answer, and hence improve the correctness of the overall response. We study variations on this recipe across a range of tasks: from list-based questions, closed booked QA and longform text generation. We first propose a joint approach for generating the entire verification chain left-to-right, which improves performance and decreases hallucinations compared to the baseline language model. However, models that attend to existing hallucinations in the context from their own generations tend to repeat the hallucinations. Hence we also introduce further improvements with factored variants which separate out the verification chain steps, in terms of which context is attended to. We show how these factored variants give further performance gains across all three tasks considered. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "text",
42
+ "text": "2 RELATED WORK ",
43
+ "text_level": 1,
44
+ "page_idx": 0
45
+ },
46
+ {
47
+ "type": "text",
48
+ "text": "Hallucination is a general problem in language model generations that appears across many tasks, from summarization (Maynez et al., 2020) to open-domain dialogue (Roller et al., 2020), and has not ",
49
+ "page_idx": 0
50
+ },
51
+ {
52
+ "type": "text",
53
+ "text": "Query ",
54
+ "text_level": 1,
55
+ "page_idx": 1
56
+ },
57
+ {
58
+ "type": "text",
59
+ "text": "Name some politicians who were born in NY, New York. ",
60
+ "page_idx": 1
61
+ },
62
+ {
63
+ "type": "text",
64
+ "text": "1. Baseline Response ",
65
+ "text_level": 1,
66
+ "page_idx": 1
67
+ },
68
+ {
69
+ "type": "text",
70
+ "text": "Here are some politicians who were born in NY, New York: \n1. Hillary Clinton - former secretary of state and former Democratic presidential nominee \n2. Donald Trump - former president of the United States \n3. Michael Bloomberg - former Mayor of New York City and former Democratic presidential candidate … <list continues..> ",
71
+ "page_idx": 1
72
+ },
73
+ {
74
+ "type": "text",
75
+ "text": "2. Plan Verifications ",
76
+ "text_level": 1,
77
+ "page_idx": 1
78
+ },
79
+ {
80
+ "type": "text",
81
+ "text": "3. Execute Verifications ",
82
+ "page_idx": 1
83
+ },
84
+ {
85
+ "type": "text",
86
+ "text": "Hillary Clinton was born in Chicago, Illinois, United States on October 26, 1947. ",
87
+ "page_idx": 1
88
+ },
89
+ {
90
+ "type": "text",
91
+ "text": "- Where was Hillary Clinton born? - Where was Donald Trump born? - Where was Michael Bloomberg born? … <questions continue..> ",
92
+ "page_idx": 1
93
+ },
94
+ {
95
+ "type": "text",
96
+ "text": "Donald Trump was born on June 14, 1946, in Queens, New York City, New York, United States ",
97
+ "page_idx": 1
98
+ },
99
+ {
100
+ "type": "text",
101
+ "text": "Michael Bloomberg was born on February 14, 1942, in Boston, Massachusetts, United States. ",
102
+ "page_idx": 1
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "4. Final Verified Response ",
107
+ "text_level": 1,
108
+ "page_idx": 1
109
+ },
110
+ {
111
+ "type": "text",
112
+ "text": "Here are some politicians who were born in NY, New York: \n1. Donald Trump - former president of the United States \n2. Alexandria Ocasio-Cortez - Democratic member of the U.S. House of Representatives … <list continues..> ",
113
+ "page_idx": 1
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "Figure 1: Chain-of-Verification (CoVe) method. Given a user query, a large language model generates a baseline response that may contain inaccuracies, e.g. factual hallucinations. We show a query here which failed for ChatGPT (see section 12 for more details). To improve this, CoVe first generates a plan of a set of verification questions to ask, and then executes that plan by answering them and hence checking for agreement. We find that individual verification questions are typically answered with higher accuracy than the original accuracy of the facts in the original longform generation. Finally, the revised response takes into account the verifications. The factored version of CoVe answers verification questions such that they cannot condition on the original response, avoiding repetition and improving performance. ",
118
+ "page_idx": 1
119
+ },
120
+ {
121
+ "type": "text",
122
+ "text": "been resolved by simply scaling up training data or model size (Zhang et al., 2023). For a survey of the hallucination issue, see Ji et al. (2023) and Ye et al. (2023). A majority of the methods for reducing hallucination can be divided into roughly three categories: training-time correction, generation-time correction and via augmentation (tool-use). ",
123
+ "page_idx": 1
124
+ },
125
+ {
126
+ "type": "text",
127
+ "text": "In training-time correction methods, an attempt is made to improve the raw left-to-right generations of an encoder-decoder or decoder-only language model by either training or otherwise adjusting the model weights to decrease the probability of hallucinated generations. This includes using reinforcement learning (Roit et al., 2023; Wu et al., 2023), constrastive learning (Chern et al., 2023b; Sun et al., 2023b) and other methods (Li et al., 2023; Narayan et al., 2023). ",
128
+ "page_idx": 1
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "In generation-time correction, a common theme is to make reasoning decisions “on top of” the base LLM in order to make them more reliable. For example, by considering the probabilities of the generated tokens (Mielke et al., 2022; Kadavath et al., 2022). In Manakul et al. (2023) multiple samples are drawn from the model to detect hallucinations. In Varshney et al. (2023) hallucinations are identified using low confidence scores, and their correctness is checked through a validation procedure, mitigated, and then the generation is continued. An alternative to using the confidence scores is to leverage inconsistencies in the LLMs output to detect hallucination. Cohen et al. (2023) show that using inconsistencies for QA tasks can outperform using confidence scores for hallucination detection. Cohen et al. (2023) simulate an interactive multi-agent LM vs. LM debate setup to detect hallucinations for factoid QA, Agrawal et al. (2023) check for hallucinated references, while Mundler ¨ et al. (2023) extract relational triples from generations and verify them against another LLM. COVE also uses a related self-consistency approach but we show our approach can correct hallucinated facts in longform generations by generating and answering verification questions by solely using the same LLM. ",
133
+ "page_idx": 1
134
+ },
135
+ {
136
+ "type": "text",
137
+ "text": "",
138
+ "page_idx": 2
139
+ },
140
+ {
141
+ "type": "text",
142
+ "text": "A third approach is to use external tools to help mitigate hallucinations, rather than relying solely on the abilities of the language model itself. For example, retrieval-augmented generation can decrease hallucinations by using factual documents for grounding (Shuster et al., 2021; Jiang et al., 2023b; Yu et al., 2023) or chain-of-thought verification (Zhao et al., 2023). Other approaches include using tools for fact-checking (Chern et al., 2023a; Galitsky, 2023; Peng et al., 2023), or linking to external documents with attribution (Menick et al., 2022; Rashkin et al., 2023; Gao et al., 2023). ",
143
+ "page_idx": 2
144
+ },
145
+ {
146
+ "type": "text",
147
+ "text": "There are also a number of related works in improving reasoning for logical and mathematical tasks, even if they do not address reducing hallucination explicitly. Several approaches have been shown to improve results with extended reasoning steps by the system, such as chain-of-thought (Wei et al., 2022), deductive verification (Ling et al., 2023), and self-verification (Miao et al., 2023; Jiang et al., 2023a; Weng et al., 2022). The latter tries to predict the (masked) question given the answer for math problems, and use that as evidence that this is the correct solution. ",
148
+ "page_idx": 2
149
+ },
150
+ {
151
+ "type": "text",
152
+ "text": "3 CHAIN-OF-VERIFICATION ",
153
+ "text_level": 1,
154
+ "page_idx": 2
155
+ },
156
+ {
157
+ "type": "text",
158
+ "text": "Our approach assumes access to a base LLM that – despite potentially being prone to hallucination – is capable of being prompted with general instructions in either a few-shot or zero-shot fashion. A key assumption of our method is that this language model, when suitably prompted, can both generate and execute a plan of how to verify itself in order to check its own work, and finally incorporate this analysis into an improved response. ",
159
+ "page_idx": 2
160
+ },
161
+ {
162
+ "type": "text",
163
+ "text": "Our overall process, which we call Chain-of-Verification (CoVe), thus performs four core steps: ",
164
+ "page_idx": 2
165
+ },
166
+ {
167
+ "type": "text",
168
+ "text": "1. Generate Baseline Response: Given a query, generate the response using the LLM. 2. Plan Verifications: Given both query and baseline response, generate a list of verification questions that could help to self-analyze if there are any mistakes in the original response. 3. Execute Verifications: Answer each verification question in turn, and hence check the answer against the original response to check for inconsistencies or mistakes. 4. Generate Final Verified Response: Given the discovered inconsistencies (if any), generate a revised response incorporating the verification results. ",
169
+ "page_idx": 2
170
+ },
171
+ {
172
+ "type": "text",
173
+ "text": "Each of these steps is performed by prompting the same LLM in different ways to obtain the desired response. While steps (1), (2) and (4) all can be invoked with a single prompt, we investigate variations of step (3) including joint, 2-step and factored versions. These variants either involve a single prompt, two prompts or else independent prompts per question, where more sophisticated decomposition can yield improved results. ",
174
+ "page_idx": 2
175
+ },
176
+ {
177
+ "type": "text",
178
+ "text": "We describe these steps in more detail below. An overview of the approach is illustrated in Figure 1, and in the Appendix in Figure 3. ",
179
+ "page_idx": 2
180
+ },
181
+ {
182
+ "type": "text",
183
+ "text": "3.1 BASELINE RESPONSE",
184
+ "text_level": 1,
185
+ "page_idx": 2
186
+ },
187
+ {
188
+ "type": "text",
189
+ "text": "Given a query, we generate left-to-right as usual using the LLM, with no special tricks. While this is the first step in the CoVe pipeline, it also serves as the baseline we wish to improve in our experiments (i.e., we will directly compare this baseline response with the final verified response from our overall method). ",
190
+ "page_idx": 2
191
+ },
192
+ {
193
+ "type": "text",
194
+ "text": "Given such baseline generations are typically prone to hallucination, CoVe attempts to identify these hallucinations, and correct them, in the following steps. ",
195
+ "page_idx": 2
196
+ },
197
+ {
198
+ "type": "text",
199
+ "text": "3.2 PLAN VERIFICATIONS ",
200
+ "text_level": 1,
201
+ "page_idx": 3
202
+ },
203
+ {
204
+ "type": "text",
205
+ "text": "Conditioned on the original query and the baseline response, the model is prompted to generate a series of verification questions that test the factual claims in the original baseline response. For example if part of a longform model response contains the statement “The Mexican–American War was an armed conflict between the United States and Mexico from 1846 to 1848”, then one possible verification question to check those dates could be “When did the Mexican American war start and end?”. We note that verification questions are not templated and the language model is free to phrase these in any form it wants, and they also do not have to closely match the phrasing of the original text. ",
206
+ "page_idx": 3
207
+ },
208
+ {
209
+ "type": "text",
210
+ "text": "In our experiments, we perform such verification planning by providing a few-shot prompt of (response, verification) demonstrations to our LLM. See section 11 for the few-shot prompts we will use in our experiments. We note it is also possible with a sufficiently performant instruction-following LLM that this could be performed zero-shot. ",
211
+ "page_idx": 3
212
+ },
213
+ {
214
+ "type": "text",
215
+ "text": "3.3 EXECUTE VERIFICATIONS ",
216
+ "text_level": 1,
217
+ "page_idx": 3
218
+ },
219
+ {
220
+ "type": "text",
221
+ "text": "Given the planned verification questions, the next step is to answer them in order to assess if any hallucinations exist. While techniques such as retrieval-augmentation could be used in this process, such as verification via search engine, in this work we do not explore tool-use. Instead, we consider only using the LLM itself in all steps of CoVe, hence the model is used to check its own work. We investigate several variants of verification execution, called joint, 2-Step, factored and factor+revise. ",
222
+ "page_idx": 3
223
+ },
224
+ {
225
+ "type": "text",
226
+ "text": "Joint In the joint method, the planning and execution (steps 2 and 3) are accomplished by using a single LLM prompt, whereby the few-shot demonstrations include both verification questions and their answers immediately after the questions. In this approach separate prompts are not needed. ",
227
+ "page_idx": 3
228
+ },
229
+ {
230
+ "type": "text",
231
+ "text": "2-Step A potential disadvantage of the joint method is that because the verification questions must condition on the baseline response in the LLM context, and the method is joint, the verification answers have to condition on the initial response as well. This may increase the likelihood of repetition, another known issue of modern LLMs (Holtzman et al., 2019). This means the verification questions might hallucinate similarly to the original baseline response, which defeats the purpose. We hence instead separate the planning and execution into separate steps, both with their own LLM prompt. The planning prompt conditions on the baseline response in the first step. The verification questions generated from planning are answered in the second step, where crucially the context given to the LLM prompt only contains the questions, and not the original baseline response and hence cannot repeat those answers directly. ",
232
+ "page_idx": 3
233
+ },
234
+ {
235
+ "type": "text",
236
+ "text": "Factored Another, more sophisticated approach, is to answer all questions independently as separate prompts. Again, crucially, those prompts do not contain the original baseline response and are hence not prone to simply copying or repeating it. The factored approach has the further advantage of removing any potential interference not only from the baseline response, but also between answer contexts, and is somewhat related to the recent (concurrent) work of Radhakrishnan et al. (2023) for subquestion answering by factored decomposition, hence we adopt their naming. It can also potentially handle more verification questions by virtue of them not all having to fit with the same single context. While this is potentially more computationally expensive, requiring the execution of many more LLM prompts, they can be run in parallel, and hence be batched. In order to do this, we first have to take the set of generated questions from subsection 3.2 and parse them into separate questions, which is a relatively easy task as the few-shot demonstrations we provide indicate they should be generated as a comma-separated list. We can then split them out into separate LLM prompts. ",
237
+ "page_idx": 3
238
+ },
239
+ {
240
+ "type": "text",
241
+ "text": "Factor+Revise After answering the verification questions, the overall CoVe pipeline then has to either implicitly or explicitly cross-check whether those answers indicate an inconsistency with the original responses. In the factor+revise approach, we execute this as a deliberate step via an extra LLM prompt, which may make it easier for the final system to reason about this step explicitly. Differently to answering the verification questions, the cross-checking phase needs to condition on both the baseline response and the verification question and answer. We thus execute this as separate LLM prompts, one “cross-check” prompt for each question, with again a set of few-shot demonstrations showing the desired output. For example if the original baseline response contained the phrase “It followed in the wake of the 1845 U.S. annexation of Texas. . . ” and CoVe generated a verification question When did Texas secede from Mexico? which was answered with 1836 then an inconsistency should be detected by this step. ",
242
+ "page_idx": 3
243
+ },
244
+ {
245
+ "type": "text",
246
+ "text": "",
247
+ "page_idx": 4
248
+ },
249
+ {
250
+ "type": "text",
251
+ "text": "3.4 FINAL VERIFIED RESPONSE ",
252
+ "text_level": 1,
253
+ "page_idx": 4
254
+ },
255
+ {
256
+ "type": "text",
257
+ "text": "Finally, the improved response that takes verification into account is generated. This is executed by a final few-shot prompt where the context takes into account all of the previous reasoning steps, the baseline response and verification question answer pairs, so that the corrections can take place. If the Factor+Revise approach is used from subsection 3.3 then the output of the cross-check inconsistency detection is provided as well. ",
258
+ "page_idx": 4
259
+ },
260
+ {
261
+ "type": "text",
262
+ "text": "4 EXPERIMENTS ",
263
+ "text_level": 1,
264
+ "page_idx": 4
265
+ },
266
+ {
267
+ "type": "text",
268
+ "text": "We use various experimental benchmarks to measure the efficacy of CoVe in reducing hallucination, comparing against a number of baselines. ",
269
+ "page_idx": 4
270
+ },
271
+ {
272
+ "type": "text",
273
+ "text": "4.1 TASKS ",
274
+ "text_level": 1,
275
+ "page_idx": 4
276
+ },
277
+ {
278
+ "type": "text",
279
+ "text": "The benchmarks we use range from list-based questions where the required answer is a set of entities, to where the answer is a longform generation of multiple freeform sentences. ",
280
+ "page_idx": 4
281
+ },
282
+ {
283
+ "type": "text",
284
+ "text": "4.1.1 WIKIDATA ",
285
+ "text_level": 1,
286
+ "page_idx": 4
287
+ },
288
+ {
289
+ "type": "text",
290
+ "text": "We start by testing CoVe on a set of automatically generated questions using the Wikidata $\\mathsf { A P I } ^ { 1 }$ . We create list questions of the form: “Who are some [Profession]s who were born in [City]?”. For example, “Who are some politicians who were born in Boston?”. The answer to these questions is a set of entities, where the gold list is obtained from the Wikidata knowledge base. This results in a dataset of 56 test questions, each typically containing ${ \\sim } 6 0 0$ known gold entities, but typically an LLM will produce a much shorter list. We then use the precision metric (micro-averaged) to measure performance, in addition to reporting the averaged number of positive and negative entities produced. ",
291
+ "page_idx": 4
292
+ },
293
+ {
294
+ "type": "text",
295
+ "text": "4.1.2 WIKI-CATEGORY LIST ",
296
+ "text_level": 1,
297
+ "page_idx": 4
298
+ },
299
+ {
300
+ "type": "text",
301
+ "text": "We then proceed to a harder set-generation task. We use the QUEST (Malaviya et al., 2023) dataset that was created using Wikipedia Category lists. We convert these category names to questions by simply prepending a “Name some”. Owing to the varied questions such as Name some Mexican animated horror films or Name some Endemic orchids of Vietnam we believe this task can pose a greater challenge. We collate all examples in the dataset that do not require logical operations to create a set of 55 test questions each having 8 answers. Similar to the Wikidata task, we measure ˜ precision (micro-averaged) to measure performance, in addition to reporting the averaged number of positive and negative entities produced. ",
302
+ "page_idx": 4
303
+ },
304
+ {
305
+ "type": "text",
306
+ "text": "4.1.3 MULTISPANQA ",
307
+ "text_level": 1,
308
+ "page_idx": 4
309
+ },
310
+ {
311
+ "type": "text",
312
+ "text": "We next test our approach on an reading comprehension benchmark, MultiSpanQA (Li et al., 2022). MultiSpanQA comprises of questions that have multiple independent answers (derived from a series of multiple discontiguous spans in the text, with questions originally from the Natural Questions dataset). We consider a closed-book setting, where we do not provide supporting documents, and hence consider a subset of questions which are factoid-based, so that our base LLM is more likely to be able to answer them. We thus use a test set of 418 questions with shorter answers per span (up to 3 tokens per item). For example, Q: Who invented the first printing press and in what year?, A: Johannes Gutenberg, 1450. ",
313
+ "page_idx": 4
314
+ },
315
+ {
316
+ "type": "table",
317
+ "img_path": "images/a2ec61b6cb20568209957c9ee841e0852634fb138381546fd4be17509cc01c08.jpg",
318
+ "table_caption": [
319
+ "Table 1: Test Precision and average number of positive and negative (hallucination) entities for list-based questions on the Wikidata and Wiki-Category list tasks. "
320
+ ],
321
+ "table_footnote": [],
322
+ "table_body": "<table><tr><td></td><td colspan=\"2\">Wikidata (Easier)</td><td></td><td colspan=\"4\">Wiki-Category list (Harder)</td></tr><tr><td>LLM</td><td>Method</td><td>Prec. (↑)</td><td>Pos.</td><td>Neg.</td><td>Prec.(↑)</td><td>Pos.</td><td>Neg.</td></tr><tr><td>Llama 2 70B Chat</td><td>Zero-shot</td><td>0.12</td><td>0.55</td><td>3.93</td><td>0.05</td><td>0.35</td><td>6.85</td></tr><tr><td>Llama 2 70B Chat</td><td>CoT</td><td>0.08</td><td>0.75</td><td>8.92</td><td>0.03</td><td>0.30</td><td>11.1</td></tr><tr><td>Llama 65B</td><td>Few-shot</td><td>0.17</td><td>0.59</td><td>2.95</td><td>0.12</td><td>0.55</td><td>4.05</td></tr><tr><td>Llama 65B</td><td>CoVe (joint)</td><td>0.29</td><td>0.41</td><td>0.98</td><td>0.15</td><td>0.30</td><td>1.69</td></tr><tr><td>Llama 65B</td><td>CoVe (two-step)</td><td>0.36</td><td>0.38</td><td>0.68</td><td>0.21</td><td>0.50</td><td>0.52</td></tr><tr><td>Llama 65B</td><td>CoVe (factored)</td><td>0.32</td><td>0.38</td><td>0.79</td><td>0.22</td><td>0.52</td><td>1.52</td></tr></table>",
323
+ "page_idx": 5
324
+ },
325
+ {
326
+ "type": "text",
327
+ "text": "4.1.4 LONGFORM GENERATION OF BIOGRAPHIES ",
328
+ "text_level": 1,
329
+ "page_idx": 5
330
+ },
331
+ {
332
+ "type": "text",
333
+ "text": "We next validate the performance of CoVe on longform text generation. In this setting, we evaluate our method on generating biographies, adopting the benchmark proposed in by Min et al. (2023). Here the model is simply prompted to generate a biography of a selected entity using the prompt: “Tell me a bio of <entity>”. We evaluate the efficacy of our approach using the FACTSCORE metric (Min et al., 2023) developed in that work, which uses a retrieval-augmented language model to fact-check the response (Instruct-Llama, “Llama $^ +$ Retrieval $+ \\mathrm { N P ^ { , } }$ ), which they showed correlates well with human judgments. ",
334
+ "page_idx": 5
335
+ },
336
+ {
337
+ "type": "text",
338
+ "text": "4.2 BASELINES",
339
+ "text_level": 1,
340
+ "page_idx": 5
341
+ },
342
+ {
343
+ "type": "text",
344
+ "text": "We use Llama 65B, a strong open model as our base LLM (Touvron et al., 2023a), and use greedy decoding for all models. As Llama 65B is not instruction fine-tuned, we employ few-shot examples particular to each task for measuring performance on each of our benchmarks. This serves as our main baseline which CoVe tries to improve upon. CoVe uses the same Llama 65B base, but includes, for the same few-shot examples, demonstrations of verification questions and final verified responses, following Figure 1 and section 3. Thus, we measure the ability to improve over the original baseline response for the same LLM. For CoVe, we compare different variants, particularly the joint and factored versions on all tasks. ",
345
+ "page_idx": 5
346
+ },
347
+ {
348
+ "type": "text",
349
+ "text": "We also compare to Llama instruction fine-tuned models, for which we use Llama 2 (Touvron et al., 2023b). We measure both zero-shot performance on the task, or zero-shot with chain-of-thought by adding “Let’s think step by step” to the zero-shot prompt. We find that the instruction fine-tuned models tend to generate extraneous content when queried. This can especially be a problem for the list-based tasks. To deal with this we add an extra line to our prompt: “List only the answers separated by a comma”. We also add another layer of post-processing to extract the answers by using an off-the-shelf NER model to further avoid this issue as this helped. However, we still expect few-shot to improve over this, especially for tasks like Multi-Span-QA where the answers are not all named entities, and the few-shot examples effectively show the domain of the task. ",
350
+ "page_idx": 5
351
+ },
352
+ {
353
+ "type": "text",
354
+ "text": "For the longform generation of biographies we also compare to several existing model results reported in Min et al. (2023), in particular InstructGPT (Ouyang et al., 2022), ChatGPT 2 and PerplexityAI 3. ",
355
+ "page_idx": 5
356
+ },
357
+ {
358
+ "type": "text",
359
+ "text": "4.3 RESULTS ",
360
+ "text_level": 1,
361
+ "page_idx": 5
362
+ },
363
+ {
364
+ "type": "text",
365
+ "text": "We are interested in empirically answering the following research questions: ",
366
+ "page_idx": 5
367
+ },
368
+ {
369
+ "type": "text",
370
+ "text": "RQ1 Can COVE effectively reduce the rate of hallucinatory content produced by the LLM? RQ2 Can COVE be used to fix or remove incorrect generations without decreasing the amount of correct content? ",
371
+ "page_idx": 5
372
+ },
373
+ {
374
+ "type": "table",
375
+ "img_path": "images/c71f45bc27d7cbb0c4c9c85d8bb79727c0478a49222f498771c21338a0442adb.jpg",
376
+ "table_caption": [
377
+ "Table 2: Closed book MultiSpanQA test performance, comparing CoVe with various baselines. "
378
+ ],
379
+ "table_footnote": [],
380
+ "table_body": "<table><tr><td>LLM</td><td>Method</td><td>F1(1)</td><td>Prec.</td><td>Rec.</td></tr><tr><td>Llama 2 70B Chat</td><td>Zero-shot</td><td>0.20</td><td>0.13</td><td>0.40</td></tr><tr><td>Llama 2 70B Chat</td><td>CoT</td><td>0.17</td><td>0.11</td><td>0.37</td></tr><tr><td>Llama 65B</td><td>Few-shot</td><td>0.39</td><td>0.40</td><td>0.38</td></tr><tr><td>Llama 65B</td><td>CoVe (joint)</td><td>0.46</td><td>0.50</td><td>0.42</td></tr><tr><td>Llama 65B</td><td>CoVe (factored)</td><td>0.48</td><td>0.50</td><td>0.46</td></tr></table>",
381
+ "page_idx": 6
382
+ },
383
+ {
384
+ "type": "table",
385
+ "img_path": "images/1502ab975c354313e5a95ec265dd59c4d0e37ee5df2d6fb1a7b5b326edb0cfac.jpg",
386
+ "table_caption": [
387
+ "Table 3: Longform generation of biographies with metrics defined from Min et al. (2023). Models marked with $^ *$ are reported from previous work. FACTSCORE automatically computed using “InstructLlama” ( Retrieve $ \\mathrm { L M } + \\mathrm { N P }$ ), the best open-access model. "
388
+ ],
389
+ "table_footnote": [],
390
+ "table_body": "<table><tr><td>LLM</td><td>Method</td><td>FACTSCORE. (↑)</td><td>Avg. # facts</td></tr><tr><td>InstructGPT*</td><td>Zero-shot</td><td>41.1</td><td>26.3</td></tr><tr><td>ChatGPT*</td><td>Zero-shot</td><td>58.7</td><td>34.7</td></tr><tr><td>PerplexityAI*</td><td>Retrieval-based</td><td>61.6</td><td>40.8</td></tr><tr><td>Llama 2 70B Chat</td><td>Zero-shot</td><td>41.3</td><td>64.9</td></tr><tr><td>Llama 2 70B Chat</td><td>CoT</td><td>41.1</td><td>49.0</td></tr><tr><td>Llama 65B</td><td>Few-shot</td><td>55.9</td><td>16.6</td></tr><tr><td>Llama 65B</td><td>CoVe (joint)</td><td>60.8</td><td>12.8</td></tr><tr><td>Llama 65B</td><td>CoVe (factored)</td><td>63.7</td><td>11.7</td></tr><tr><td>Llama 65B</td><td>CoVe (factor+revise)</td><td>71.4</td><td>12.3</td></tr><tr><td>GPT-3</td><td>Few-shot</td><td>45.3</td><td>15.6</td></tr><tr><td>GPT-3 + ChatGPT</td><td>ChatProtect Muindler et al. (2023)</td><td>48.5</td><td>14.6</td></tr><tr><td>GPT-3 + InstructGPT</td><td>SCG-LL Manakul et al. (2023)</td><td>60.6</td><td>6.0</td></tr><tr><td>GPT-3+DeBERTA</td><td>SCG-NLI Manakul et al. (2023)</td><td>61.7</td><td>6.3</td></tr><tr><td>GPT-3 + InstructGPT</td><td>CoVe (factor+revise)</td><td>68.6</td><td>9.0</td></tr></table>",
391
+ "page_idx": 6
392
+ },
393
+ {
394
+ "type": "image",
395
+ "img_path": "images/2a6ac1cda2f821ac1aa01184f19b3fcaf962289ecad5c965bc0573e103f15b60.jpg",
396
+ "image_caption": [
397
+ "Figure 2: FACTSCORE performance distribution across head, torso and tail facts for CoVe variants and various baselines on longform generation of biographies. "
398
+ ],
399
+ "image_footnote": [],
400
+ "page_idx": 6
401
+ },
402
+ {
403
+ "type": "text",
404
+ "text": "Our main results across the four benchmark tasks are given in Table 1, Table 2 and Table 3, and our main findings are as follows. ",
405
+ "page_idx": 6
406
+ },
407
+ {
408
+ "type": "text",
409
+ "text": "CoVe improves precision on list-based answer tasks We find that CoVe provides large gains in precision on the list-based tasks, e.g. more than doubles the precision from the Llama 65B few-shot baseline for the Wikidata task (from 0.17 to 0.36). We find from the positive and negative breakdown that there is a large reduction in the number of hallucinated answers (negatives: $2 . 9 5 0 . 6 8 )$ while only a relatively small reduction in the number of non-hallucinations (positives: $0 . 5 9 0 . 3 8$ ). ",
410
+ "page_idx": 6
411
+ },
412
+ {
413
+ "type": "text",
414
+ "text": "CoVe improves performance on closed book QA We also find that CoVe brings improvements in general QA problems, as measured on MultiSpanQA. We observe a $23 \\%$ improvement in F1 over the few-shot baseline $( 0 . 3 9 0 . 4 8 )$ ), where the improvements come from gains in both precision and recall. ",
415
+ "page_idx": 7
416
+ },
417
+ {
418
+ "type": "text",
419
+ "text": "CoVe improves precision on longform generation These results also extend to longform generation, where we actually see larger gains than in the QA setting. FACTSCORE increases $28 \\%$ $5 5 . 9 $ 71.4) from the few-shot baseline, with again only a relatively small reduction in average number of facts provided $1 6 . 6 1 2 . 3$ ). We also show the breakdown of improvements across facts in Figure 2, where one can see CoVe improves results for both rare and more frequent facts. ",
420
+ "page_idx": 7
421
+ },
422
+ {
423
+ "type": "text",
424
+ "text": "Instruction-tuning and CoT do not reduce hallucinations We find that the few-shot baseline that employs a pre-trained Llama model outperforms Llama-2-Chat, an instruction tuned model, across all the tasks. The few-shot examples lead the model to give outputs in line with those expected for the task, whereas general instruction tuning produces more hallucinations or incorrect outputs. Zero-shot chain-of-thought (CoT) prompting also fails to improve the results for these tasks. ",
425
+ "page_idx": 7
426
+ },
427
+ {
428
+ "type": "text",
429
+ "text": "Factored and 2-step CoVe improve performance We observe a consistent performance improvement across all tasks from applying the factored CoVe approach compared to joint CoVe. For example improvement from $6 0 . 8 6 3 . 7$ in FACTSCORE in longform generation. Similarly, the 2-step approach also outperforms the joint approach, as tested on the Wikidata and Wiki-Category list tasks, with 2-step giving the best results for Wikidata, and factored the best for Wiki-Category. All these results support our hypothesis that verifying questions should not attend to the original baseline response as they may be prone to repeating it (as the joint method can do). ",
430
+ "page_idx": 7
431
+ },
432
+ {
433
+ "type": "text",
434
+ "text": "Further explicit reasoning helps remove hallucinations In the longform generation task we also explore more sophisticated reasoning steps in the CoVe “factor+revise” method, which explicitly cross-checks whether verification answers indicate an inconsistency. We see large gains in the FACTSCORE metric from this further explicit reasoning from 63.7 (factored) $ 7 1 . 4$ (factor+revise). This gives further indication that appropriate and explicit reasoning in LLMs can bring improvements in mitigating hallucinations. ",
435
+ "page_idx": 7
436
+ },
437
+ {
438
+ "type": "text",
439
+ "text": "CoVe-based Llama outperforms InstructGPT, ChatGPT and PerplexityAI On the longform generation task, our baseline few-shot Llama 65B is outperformed by the ChatGPT and PerplexityAI models in terms of the FACTSCORE metric. However, applying CoVe to Llama 65B lifts its performance above ChatGPT and InstructGPT, as well as PerplexityAI. This is particularly impressive compared to PerplexityAI considering that is a model that can support its facts with retrieval-augmentation, whereas CoVe uses only the base language model itself with improved reasoning via deliberation (verification). However, Figure 2 shows PerplexityAI still outperforms CoVe for very rare facts where retrieval is essential, but CoVe outperforms PerplexityAI for frequent facts. ",
440
+ "page_idx": 7
441
+ },
442
+ {
443
+ "type": "text",
444
+ "text": "CoVe outperforms existing hallucination mitigation baselines We compare CoVe to three recently released longform hallucination mitigation approaches — NLI and LLM, the two bestperforming variants of SelfCheckGPT (Manakul et al., 2023) and ChatProtect Mundler et al. (2023). ¨ Our results in Table 3 show that COVE outperforms all these baselines. More details on our implementations of the baselines can be found in section 9. For SelfCheckGPT we experiment with different thresholds (in Table 6) and choose a threshold that results in a high FACTSCORE without removing a lot of facts. We note that some models produce fewer overall facts than others, however, the FACTSCORE metric is normalized and hence comparable across models. We verified this experimentally by clipping Llama-2-70B chat’s output to present fewer facts (as it contains the largest number in its output out of all models), but this did not change its FACTSCORE substantially, e.g. clipping to 10 sentences increased its score from $4 1 . 3 4 2 . 7$ . We note the length of the generations of the few-shot-based models is essentially governed by the few-shot examples, which in turn are constrained by the context length. ",
445
+ "page_idx": 7
446
+ },
447
+ {
448
+ "type": "text",
449
+ "text": "Shortform verification questions are more accurately answered than longform queries In a longform response, LLMs are prone to generate a number of hallucinations. However, it can often be the case that the LLM itself would know these hallucinations are wrong if queried specifically for that individual fact, independent of the rest of the longform generation, see Figure 1, Figure 3, and section 12. This can be seen quantitatively on the Wikidata task, where only ${ \\sim } 1 7 \\%$ of the Llama few-shot baseline answer entities are correct in list-based questions. However, when querying each individual entity via a verification question, we find ${ \\sim } 7 0 \\%$ are correctly answered. ",
450
+ "page_idx": 7
451
+ },
452
+ {
453
+ "type": "text",
454
+ "text": "",
455
+ "page_idx": 8
456
+ },
457
+ {
458
+ "type": "text",
459
+ "text": "Open LLM-based verification questions outperform yes/no-based and rule-based verification questions In our method, CoVe, the verification questions generated by the LLM expect answers that are true facts. Another alternative type of verification questions would be templated verification questions, which can be generated cheaply, and binary questions. We first compare to heuristically constructed questions by replacing the LLM questions with templated yes/no questions of the form “Does $X$ answer the question” for list-based questions with elements $X$ in the answer. Results on the Wiki-Category task, given in Table 4, show a reduced precision with rule-based verification questions. We then move on to binary questions where we include the fact as part of the verification question and ask it in a yes/no answer format. We evaluate this difference in Table 4, and find that yes/no type questions perform worse for the factored version of CoVe. Some anecdotal examples are included in Appendix section 12 for ChatGPT where we find the model tends to agree with facts in a yes/no question format whether they are right or wrong. We believe this difference would be larger for longform generation where the types of required verification questions can be more diverse, and LLM-based verification becomes even more necesary. ",
460
+ "page_idx": 8
461
+ },
462
+ {
463
+ "type": "text",
464
+ "text": "Inference overhead Approaches that detect hallucinations via inconsistencies require repeated prompts to the LLM. COVE essentially requires 1 LLM call for generating the baseline response, 1 LLM call for each sentence to plan the verifications, 1 LLM call to verify each fact and 1 LLM call for each fact to generate the consistent response. We also note that the LLM calls for verification for each fact can be parallelized. This is comparable and in certain cases fewer LLM calls compared to other approaches for hallucination mitigation. We provide a more in-depth analysis in section 8. ",
465
+ "page_idx": 8
466
+ },
467
+ {
468
+ "type": "text",
469
+ "text": "5 CONCLUSION ",
470
+ "text_level": 1,
471
+ "page_idx": 8
472
+ },
473
+ {
474
+ "type": "text",
475
+ "text": "We introduced Chain-of-Verification $\\mathrm { ( C o V e ) }$ , an approach to reduce hallucinations in a large language model by deliberating on its own responses and self-correcting them. In particular, we showed that models are able to answer verification questions with higher accuracy than when answering the original query by breaking down the verification into a set of simpler questions. Secondly, when answering the set of verification questions, we showed that controlling the attention of the model so that it cannot attend to its previous answers (factored CoVe) helps alleviate copying the same hallucinations. Overall, our method provides substantial performance gains over the original language model response just by asking the same model to deliberate on (verify) its answer. An obvious extension to our work is to equip CoVe with tool-use, e.g., to use retrieval augmentation in the verification execution step which would likely bring further gains. ",
476
+ "page_idx": 8
477
+ },
478
+ {
479
+ "type": "text",
480
+ "text": "6 LIMITATIONS ",
481
+ "text_level": 1,
482
+ "page_idx": 8
483
+ },
484
+ {
485
+ "type": "text",
486
+ "text": "While our Chain-of-Verification (CoVe) method seeks to reduce hallucinations, it does not remove them completely from generations. This means that CoVe can still generate incorrect or misleading information for a given query, even if it improves over the baseline. We also note that in our experiments we have only addressed hallucinations in the form of directly stated factual inaccuracies. However, hallucinations could come in other forms, such as during incorrect reasoning steps, as part of opinions, etc. We also note that the generations CoVe produces come with verifications which, if viewed by the user, add more interpretability to its decisions, but come at the cost of increased computational expense due to generating more tokens in the output, similar to other reasoning methods such as Chain-of-Thought. ",
487
+ "page_idx": 8
488
+ },
489
+ {
490
+ "type": "text",
491
+ "text": "Our method seeks to make a large language model produce improved responses by spending more time deliberating to identify its own mistakes. While we have shown this gives clear improvements, the upper bound to the improvement is clearly limited by the overall capabilities of the model, e.g. in identifying and knowing what it knows. In this regard, an orthogonal line of research, as discussed in section 2 is the use of external tools by language models, to gain further information beyond what is stored in its weights. While we do not explore that avenue in this work those techniques would likely be fruitful to combine with the findings here. ",
492
+ "page_idx": 8
493
+ },
494
+ {
495
+ "type": "text",
496
+ "text": "REFERENCES ",
497
+ "text_level": 1,
498
+ "page_idx": 9
499
+ },
500
+ {
501
+ "type": "text",
502
+ "text": "Leonard Adolphs, Kurt Shuster, Jack Urbanek, Arthur Szlam, and Jason Weston. Reason first, then respond: Modular generation for knowledge-infused dialogue. arXiv preprint arXiv:2111.05204, 2021. \nAyush Agrawal, Lester Mackey, and Adam Tauman Kalai. Do language models know when they’re hallucinating references? arXiv preprint arXiv:2305.18248, 2023. \nI Chern, Steffi Chern, Shiqi Chen, Weizhe Yuan, Kehua Feng, Chunting Zhou, Junxian He, Graham Neubig, Pengfei Liu, et al. Factool: Factuality detection in generative ai–a tool augmented framework for multi-task and multi-domain scenarios. arXiv preprint arXiv:2307.13528, 2023a. \nI-Chun Chern, Zhiruo Wang, Sanjan Das, Bhavuk Sharma, Pengfei Liu, Graham Neubig, et al. Improving factuality of abstractive summarization via contrastive reward learning. arXiv preprint arXiv:2307.04507, 2023b. \nRoi Cohen, May Hamri, Mor Geva, and Amir Globerson. Lm vs lm: Detecting factual errors via cross examination. arXiv preprint arXiv:2305.13281, 2023. \nBoris A Galitsky. Truth-o-meter: Collaborating with llm in fighting its hallucinations. 2023. \nLuyu 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. \nAri Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. arXiv preprint arXiv:1904.09751, 2019. \nZiwei Ji, Nayeon Lee, Rita Frieske, Tiezheng Yu, Dan Su, Yan Xu, Etsuko Ishii, Ye Jin Bang, Andrea Madotto, and Pascale Fung. Survey of hallucination in natural language generation. ACM Computing Surveys, 55(12):1–38, 2023. \nWeisen Jiang, Han Shi, Longhui Yu, Zhengying Liu, Yu Zhang, Zhenguo Li, and James T Kwok. Backward reasoning in large language models for verification. arXiv preprint arXiv:2308.07758, 2023a. \nZhengbao Jiang, Frank F Xu, Luyu Gao, Zhiqing Sun, Qian Liu, Jane Dwivedi-Yu, Yiming Yang, Jamie Callan, and Graham Neubig. Active retrieval augmented generation. arXiv preprint arXiv:2305.06983, 2023b. \nSaurav Kadavath, Tom Conerly, Amanda Askell, Tom Henighan, Dawn Drain, Ethan Perez, Nicholas Schiefer, Zac Hatfield-Dodds, Nova DasSarma, Eli Tran-Johnson, et al. Language models (mostly) know what they know. arXiv preprint arXiv:2207.05221, 2022. \nJack Lanchantin, Shubham Toshniwal, Jason Weston, Arthur Szlam, and Sainbayar Sukhbaatar. Learning to reason and memorize with self-notes. arXiv preprint arXiv:2305.00833, 2023. \nHaonan Li, Martin Tomko, Maria Vasardani, and Timothy Baldwin. Multispanqa: A dataset for multi-span question answering. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 1250–1260, 2022. \nKenneth Li, Oam Patel, Fernanda Viegas, Hanspeter Pfister, and Martin Wattenberg. Inference-time ´ intervention: Eliciting truthful answers from a language model. arXiv preprint arXiv:2306.03341, 2023. \nZhan Ling, Yunhao Fang, Xuanlin Li, Zhiao Huang, Mingu Lee, Roland Memisevic, and Hao Su. Deductive verification of chain-of-thought reasoning. arXiv preprint arXiv:2306.03872, 2023. \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. arXiv preprint arXiv:2303.17651, 2023. \nChaitanya Malaviya, Peter Shaw, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Quest: A retrieval dataset of entity-seeking queries with implicit set operations. arXiv preprint arXiv:2305.11694, 2023. \nPotsawee Manakul, Adian Liusie, and Mark JF Gales. Selfcheckgpt: Zero-resource black-box hallucination detection for generative large language models. arXiv preprint arXiv:2303.08896, 2023. \nJoshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. On faithfulness and factuality in abstractive summarization. arXiv preprint arXiv:2005.00661, 2020. \nJacob Menick, Maja Trebacz, Vladimir Mikulik, John Aslanides, Francis Song, Martin Chadwick, Mia Glaese, Susannah Young, Lucy Campbell-Gillingham, Geoffrey Irving, et al. Teaching language models to support answers with verified quotes. arXiv preprint arXiv:2203.11147, 2022. \nNing Miao, Yee Whye Teh, and Tom Rainforth. Selfcheck: Using llms to zero-shot check their own step-by-step reasoning. arXiv preprint arXiv:2308.00436, 2023. \nSabrina J Mielke, Arthur Szlam, Emily Dinan, and Y-Lan Boureau. Reducing conversational agents’ overconfidence through linguistic calibration. Transactions of the Association for Computational Linguistics, 10:857–872, 2022. \nSewon Min, Kalpesh Krishna, Xinxi Lyu, Mike Lewis, Wen-tau Yih, Pang Wei Koh, Mohit Iyyer, Luke Zettlemoyer, and Hannaneh Hajishirzi. Factscore: Fine-grained atomic evaluation of factual precision in long form text generation. arXiv preprint arXiv:2305.14251, 2023. \nNiels Mundler, Jingxuan He, Slobodan Jenko, and Martin Vechev. Self-contradictory hallucinations ¨ of large language models: Evaluation, detection and mitigation. arXiv preprint arXiv:2305.15852, 2023. \nShashi Narayan, Joshua Maynez, Reinald Kim Amplayo, Kuzman Ganchev, Annie Louis, Fantine Huot, Anders Sandholm, Dipanjan Das, and Mirella Lapata. Conditional generation with a question-answering blueprint. Transactions of the Association for Computational Linguistics, 11: 974–996, 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. \nBaolin Peng, Michel Galley, Pengcheng He, Hao Cheng, Yujia Xie, Yu Hu, Qiuyuan Huang, Lars Liden, Zhou Yu, Weizhu Chen, et al. Check your facts and try again: Improving large language models with external knowledge and automated feedback. arXiv preprint arXiv:2302.12813, 2023. \nFabio Petroni, Tim Rocktaschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H Miller, ¨ and Sebastian Riedel. Language models as knowledge bases? arXiv preprint arXiv:1909.01066, 2019. \nOfir Press, Muru Zhang, Sewon Min, Ludwig Schmidt, Noah A Smith, and Mike Lewis. Measuring and narrowing the compositionality gap in language models. arXiv preprint arXiv:2210.03350, 2022. \nAlec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019. \nAnsh Radhakrishnan, Karina Nguyen, Anna Chen, Carol Chen, Carson Denison, Danny Hernandez, Esin Durmus, Evan Hubinger, Jackson Kernion, Kamile Luko ˙ siˇ ut¯ e, et al. Question decomposition ˙ improves the faithfulness of model-generated reasoning. arXiv preprint arXiv:2307.11768, 2023. \nHannah Rashkin, Vitaly Nikolaev, Matthew Lamm, Lora Aroyo, Michael Collins, Dipanjan Das, Slav Petrov, Gaurav Singh Tomar, Iulia Turc, and David Reitter. Measuring attribution in natural language generation models. Computational Linguistics, pp. 1–66, 2023. \nPaul Roit, Johan Ferret, Lior Shani, Roee Aharoni, Geoffrey Cideron, Robert Dadashi, Matthieu Geist, Sertan Girgin, Leonard Hussenot, Orgad Keller, et al. Factually consistent summarization ´ via reinforcement learning with textual entailment feedback. arXiv preprint arXiv:2306.00186, 2023. \nStephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M Smith, et al. Recipes for building an open-domain chatbot. arXiv preprint arXiv:2004.13637, 2020. \nKurt Shuster, Spencer Poff, Moya Chen, Douwe Kiela, and Jason Weston. Retrieval augmentation reduces hallucination in conversation. arXiv preprint arXiv:2104.07567, 2021. \nKai Sun, Yifan Ethan Xu, Hanwen Zha, Yue Liu, and Xin Luna Dong. Head-to-tail: How knowledgeable are large language models (llm)? aka will llms replace knowledge graphs? arXiv preprint arXiv:2308.10168, 2023a. \nWeiwei Sun, Zhengliang Shi, Shen Gao, Pengjie Ren, Maarten de Rijke, and Zhaochun Ren. Contrastive learning reduces hallucination in conversations. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pp. 13618–13626, 2023b. \nHugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee´ Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and \\` efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023a. \nHugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and fine-tuned chat models, 2023b. ",
503
+ "page_idx": 9
504
+ },
505
+ {
506
+ "type": "text",
507
+ "text": "",
508
+ "page_idx": 10
509
+ },
510
+ {
511
+ "type": "text",
512
+ "text": "",
513
+ "page_idx": 11
514
+ },
515
+ {
516
+ "type": "text",
517
+ "text": "Neeraj Varshney, Wenlin Yao, Hongming Zhang, Jianshu Chen, and Dong Yu. A stitch in time saves nine: Detecting and mitigating hallucinations of llms by validating low-confidence generation. arXiv preprint arXiv:2307.03987, 2023. ",
518
+ "page_idx": 11
519
+ },
520
+ {
521
+ "type": "text",
522
+ "text": "Chaojun Wang and Rico Sennrich. On exposure bias, hallucination and domain shift in neural machine translation. arXiv preprint arXiv:2005.03642, 2020. ",
523
+ "page_idx": 11
524
+ },
525
+ {
526
+ "type": "text",
527
+ "text": "Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022. ",
528
+ "page_idx": 11
529
+ },
530
+ {
531
+ "type": "text",
532
+ "text": "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. ",
533
+ "page_idx": 11
534
+ },
535
+ {
536
+ "type": "text",
537
+ "text": "Yixuan Weng, Minjun Zhu, Shizhu He, Kang Liu, and Jun Zhao. Large language models are reasoners with self-verification. arXiv preprint arXiv:2212.09561, 2022. ",
538
+ "page_idx": 11
539
+ },
540
+ {
541
+ "type": "text",
542
+ "text": "Zeqiu Wu, Yushi Hu, Weijia Shi, Nouha Dziri, Alane Suhr, Prithviraj Ammanabrolu, Noah A Smith, Mari Ostendorf, and Hannaneh Hajishirzi. Fine-grained human feedback gives better rewards for language model training. arXiv preprint arXiv:2306.01693, 2023. ",
543
+ "page_idx": 11
544
+ },
545
+ {
546
+ "type": "text",
547
+ "text": "Hongbin Ye, Tong Liu, Aijia Zhang, Wei Hua, and Weiqiang Jia. Cognitive mirage: A review of hallucinations in large language models. arXiv preprint arXiv:2309.06794, 2023. ",
548
+ "page_idx": 11
549
+ },
550
+ {
551
+ "type": "text",
552
+ "text": "Wenhao Yu, Zhihan Zhang, Zhenwen Liang, Meng Jiang, and Ashish Sabharwal. Improving language models via plug-and-play retrieval feedback. arXiv preprint arXiv:2305.14002, 2023. Muru Zhang, Ofir Press, William Merrill, Alisa Liu, and Noah A Smith. How language model hallucinations can snowball. arXiv preprint arXiv:2305.13534, 2023. Ruochen Zhao, Xingxuan Li, Shafiq Joty, Chengwei Qin, and Lidong Bing. Verify-and-edit: A knowledge-enhanced chain-of-thought framework. arXiv preprint arXiv:2305.03268, 2023. ",
553
+ "page_idx": 12
554
+ },
555
+ {
556
+ "type": "text",
557
+ "text": "7 RULE-BASED VS BINARY VS GENERAL QUESTIONS ",
558
+ "text_level": 1,
559
+ "page_idx": 13
560
+ },
561
+ {
562
+ "type": "table",
563
+ "img_path": "images/1b404a4d4c4ba13aa87d99eb9854727bb962c60ec3af0d295032f76132ee1e78.jpg",
564
+ "table_caption": [
565
+ "Table 4: Comparison of various COVE verification plan strategies (rows) and verification execution techniques (columns) on the WikiCategory task. "
566
+ ],
567
+ "table_footnote": [],
568
+ "table_body": "<table><tr><td></td><td colspan=\"2\">Verification Execution</td></tr><tr><td></td><td>CoVe (joint)</td><td>CoVe (factored)</td></tr><tr><td>Verification Plan</td><td>Prec.</td><td>Prec.</td></tr><tr><td>Rule-based questions Generated by model:</td><td>0.13</td><td>0.16</td></tr><tr><td>yes/no questions</td><td>0.15</td><td>0.19</td></tr><tr><td>general questions</td><td>0.15</td><td>0.22</td></tr></table>",
569
+ "page_idx": 13
570
+ },
571
+ {
572
+ "type": "text",
573
+ "text": "8 INFERENCE OVERHEAD ",
574
+ "text_level": 1,
575
+ "page_idx": 13
576
+ },
577
+ {
578
+ "type": "text",
579
+ "text": "$N : =$ Number of text samples, 4 in our experiments $k : =$ Number of repeated mitigations, 3 in our experiments $s : =$ Number of sentences in the generated passage $f : =$ Number of facts in the generated passage ",
580
+ "page_idx": 13
581
+ },
582
+ {
583
+ "type": "table",
584
+ "img_path": "images/a80cba59d69d61bd4a6cc7ffc8a7467065d71dcfe4632e9bac4232b296d17317.jpg",
585
+ "table_caption": [],
586
+ "table_footnote": [],
587
+ "table_body": "<table><tr><td>Method</td><td>#LLM prompts</td></tr><tr><td>Few-shot</td><td>1</td></tr><tr><td>ChatProtect Mundler et al. (2023)</td><td>1+s×k × (3)</td></tr><tr><td>SCG-LLM Manakul et al. (2023)</td><td>n+1+s×n</td></tr><tr><td>CoVe (factor+revise)</td><td>1+s+2×f</td></tr></table>",
588
+ "page_idx": 13
589
+ },
590
+ {
591
+ "type": "text",
592
+ "text": "Table 5: Worst-case LLM prompts used by each hallucination mitigation approach in the worst case ",
593
+ "page_idx": 13
594
+ },
595
+ {
596
+ "type": "text",
597
+ "text": "Based on the current implementations we find the COVE induces a similar inference overhead to other longform hallucination mitigation approaches. ",
598
+ "page_idx": 13
599
+ },
600
+ {
601
+ "type": "text",
602
+ "text": "9 IMPLEMENTATION OF BASELINES ",
603
+ "text_level": 1,
604
+ "page_idx": 13
605
+ },
606
+ {
607
+ "type": "text",
608
+ "text": "We use the existing models provided by Manakul et al. (2023) for the NLI model. For the LLM model we prompt GPT-3.5-turbo-instruction with the following instruction (as described in Manakul et al. (2023). ",
609
+ "page_idx": 13
610
+ },
611
+ {
612
+ "type": "text",
613
+ "text": "Context: {} \nSentence: {} \nIs the sentence supported by the context above? \nAnswer Yes or No: ",
614
+ "page_idx": 13
615
+ },
616
+ {
617
+ "type": "table",
618
+ "img_path": "images/cd42f37186065d23769aea7a2509293b9796b99ecfa654da425731f8332fa6b1.jpg",
619
+ "table_caption": [
620
+ "Table 6: Different threshold results for SelfCheckGPT "
621
+ ],
622
+ "table_footnote": [],
623
+ "table_body": "<table><tr><td colspan=\"3\">NLI</td><td colspan=\"2\">LLM</td></tr><tr><td>Threshold</td><td>FS</td><td>Facts</td><td>FS</td><td>Facts</td></tr><tr><td>High</td><td>76.5</td><td>3.0</td><td>61.7</td><td>6.3</td></tr><tr><td>Med</td><td>60.6</td><td>6.0</td><td>56.8</td><td>8.4</td></tr><tr><td>Low</td><td>53.0</td><td>8.0</td><td>53.0</td><td>10</td></tr></table>",
624
+ "page_idx": 14
625
+ },
626
+ {
627
+ "type": "text",
628
+ "text": "10 COVE - FURTHER DETAILS ",
629
+ "text_level": 1,
630
+ "page_idx": 14
631
+ },
632
+ {
633
+ "type": "text",
634
+ "text": "Query ",
635
+ "page_idx": 14
636
+ },
637
+ {
638
+ "type": "text",
639
+ "text": "What was the primary cause of the Mexican-American war? ",
640
+ "page_idx": 14
641
+ },
642
+ {
643
+ "type": "text",
644
+ "text": "1. Baseline Response ",
645
+ "page_idx": 14
646
+ },
647
+ {
648
+ "type": "text",
649
+ "text": "The Mexican–American War was an armed conflict between the United States and Mexico from 1846 to 1848. It followed in the wake of the 1845 U.S. annexation of Texas, which Mexico considered part of its territory in spite of its de facto secession in the 1835 Texas Revolution. ",
650
+ "page_idx": 14
651
+ },
652
+ {
653
+ "type": "image",
654
+ "img_path": "images/94709e778b23d5c18849470472ac402c7e9407a4ccadc313485b8a453c3cd60c.jpg",
655
+ "image_caption": [],
656
+ "image_footnote": [],
657
+ "page_idx": 14
658
+ },
659
+ {
660
+ "type": "text",
661
+ "text": "4. Final Verified Response ",
662
+ "text_level": 1,
663
+ "page_idx": 14
664
+ },
665
+ {
666
+ "type": "text",
667
+ "text": "The Mexican–American War was an armed conflict between the United States and Mexico from 1846 to 1848. It followed in the wake of the 1845 U.S. annexation of Texas. ",
668
+ "page_idx": 14
669
+ },
670
+ {
671
+ "type": "text",
672
+ "text": "Figure 3: For longform generation, the Chain-of-Verification (CoVe) Factor $^ +$ Revise method is the most effective in our longform generation experiments. CoVe Factor $^ +$ Revise has the model independently identify (cross-check) which facts are consistent with its executed verifications (indicated by tickmark and crosses in the figure). With this extra step we aim to disregard the inconsistent facts and use the consistent facts to regenerate the response. ",
673
+ "page_idx": 14
674
+ },
675
+ {
676
+ "type": "text",
677
+ "text": "11 PROMPT TEMPLATES ",
678
+ "text_level": 1,
679
+ "page_idx": 15
680
+ },
681
+ {
682
+ "type": "text",
683
+ "text": "We provide prompt templates for the longform generation of biographies task below for the different steps and variants of CoVe (see section 3). Templates for the other tasks are similar, but using few-shot examples from those tasks instead. ",
684
+ "page_idx": 15
685
+ },
686
+ {
687
+ "type": "text",
688
+ "text": "11.1 GENERATE BASELINE RESPONSE",
689
+ "text_level": 1,
690
+ "page_idx": 15
691
+ },
692
+ {
693
+ "type": "image",
694
+ "img_path": "images/0fe7b3d2b41a0144a2c0181c7d4152dcb93519e51be0121a5a244181b0cf9570.jpg",
695
+ "image_caption": [],
696
+ "image_footnote": [],
697
+ "page_idx": 15
698
+ },
699
+ {
700
+ "type": "text",
701
+ "text": "Table 7: Few-shot prompting with 3 few-shot examples for the longform generation of biographies task. Other tasks use the same standard few-shot setup as well (with 3 examples from that particular task). ",
702
+ "page_idx": 15
703
+ },
704
+ {
705
+ "type": "text",
706
+ "text": "11.2 PLAN VERIFICATIONS ",
707
+ "text_level": 1,
708
+ "page_idx": 15
709
+ },
710
+ {
711
+ "type": "image",
712
+ "img_path": "images/13a898dcb1cd0226f5f767f829a20fca5547e701fb0d28e03510b5bc7cd8b2df.jpg",
713
+ "image_caption": [],
714
+ "image_footnote": [],
715
+ "page_idx": 15
716
+ },
717
+ {
718
+ "type": "text",
719
+ "text": "Table 8: Step (2) of CoVe involves planning the verification questions. In the biography task case we split the longform generation into its individual passages (e.g. sentences in the biography case, this was done due to excessive context length, which we don’t need to do for the other tasks). The model then generates a verification question for each fact it observes in each passage (a passage may have multiple facts). ",
720
+ "page_idx": 15
721
+ },
722
+ {
723
+ "type": "text",
724
+ "text": "11.3 EXECUTE VERIFICATIONS ",
725
+ "text_level": 1,
726
+ "page_idx": 16
727
+ },
728
+ {
729
+ "type": "table",
730
+ "img_path": "images/c24433d94aab360c77c0965746a6cfff8479e46f076233877555ed30ceacb696.jpg",
731
+ "table_caption": [],
732
+ "table_footnote": [],
733
+ "table_body": "<table><tr><td>A:Answer</td><td>Q:Verification Question</td></tr><tr><td>A:Answer</td><td>Q:Verification Question</td></tr><tr><td></td><td>Q:Verification Question</td></tr><tr><td>A:Answer</td><td></td></tr><tr><td>A:</td><td>Q:Verification Question</td></tr></table>",
734
+ "page_idx": 16
735
+ },
736
+ {
737
+ "type": "text",
738
+ "text": "Table 9: In step (3) of CoVe, the model then generates an answer for each of the verification questions. \nAgain we use 3 few-shot examples. ",
739
+ "page_idx": 16
740
+ },
741
+ {
742
+ "type": "image",
743
+ "img_path": "images/ace96e9e92daafa958b6f1a880fbf19309271761f99ac9dec0e094b0dd11f67c.jpg",
744
+ "image_caption": [],
745
+ "image_footnote": [],
746
+ "page_idx": 16
747
+ },
748
+ {
749
+ "type": "text",
750
+ "text": "Table 10: In step (4) of CoVe (factored) the model is then presented with its original generation (split into passages, e.g. sentences, in the biography case, due to excessive context length which we do not need to do for the other tasks) along with its own verification step results. The model is told that this information comes from “another source”. The model is required to synthesize a new final answer based on facts that are consistent between the two sources. ",
751
+ "page_idx": 16
752
+ },
753
+ {
754
+ "type": "text",
755
+ "text": "11.5 FACTOR $^ +$ REVISE: IDENTIFY WHICH FACTS ARE CONSISTENT ",
756
+ "page_idx": 17
757
+ },
758
+ {
759
+ "type": "text",
760
+ "text": "Context: <Original Fact>. \nFrom another source, \n<output of execute verification step: ${ \\mathsf { \\Omega } } + { \\mathsf { \\Omega } } { \\mathsf { A } } { \\mathsf { \\Sigma } } ^ { } $ \nResponse: CONSISTENT. <Consistent fact> \nContext: <Original Fact>. \nFrom another source, \n<output of execute verification step: ${ \\mathsf { \\Omega } } + { \\mathsf { \\Omega } } { \\mathsf { A } } { \\mathsf { \\Sigma } } ^ { } $ \nResponse: INCONSISTENT. \nContext: <Original Fact>. \nFrom another source, \n<output of execute verification step: ${ \\mathsf { \\Omega } } + { \\mathsf { \\Omega } } { \\mathsf { A } } { \\mathsf { \\Sigma } } ^ { } $ \nResponse: PARTIALLY CONSISTENT. <Consistent part> ",
761
+ "page_idx": 17
762
+ },
763
+ {
764
+ "type": "text",
765
+ "text": "Table 11: In the CoVe (Factor $^ +$ Revise) variant, as part of step (3) after subsection 11.3, the model is made to explicitly identify which facts are consistent between the two sources. The consistent facts can then be spliced together. ",
766
+ "page_idx": 17
767
+ },
768
+ {
769
+ "type": "text",
770
+ "text": "12 CHATGPT EXAMPLE SCREENSHOTS ",
771
+ "text_level": 1,
772
+ "page_idx": 18
773
+ },
774
+ {
775
+ "type": "image",
776
+ "img_path": "images/a0ac0be4610c73ae36b0490ec9f086a325d33f878a872c442c779f33d65a5874.jpg",
777
+ "image_caption": [
778
+ "Figure 4: ChatGPT generates several hallucinations for this question, e.g. Hillary Clinton and Michael Bloomberg. "
779
+ ],
780
+ "image_footnote": [],
781
+ "page_idx": 18
782
+ },
783
+ {
784
+ "type": "image",
785
+ "img_path": "images/81ab370438350ed63c748edfeb9c58714679c87057809dcd84e149b5cfee97a4.jpg",
786
+ "image_caption": [
787
+ "Figure 5: Even when the longform answer is provided for a rewritten query (see query from Figure 4), while giving a slightly different answer, ChatGPT still generates several hallucinations for this question, e.g. Hillary Clinton and Michael Bloomberg. "
788
+ ],
789
+ "image_footnote": [],
790
+ "page_idx": 18
791
+ },
792
+ {
793
+ "type": "image",
794
+ "img_path": "images/9f8d2dbbfaa853e00d3fc3adfa55c24c1c0502c17e543fa748123cd0e8a97b90.jpg",
795
+ "image_caption": [
796
+ "Figure 6: Shortform questions (which could be verification questions) appear to be answered more factually than the longform answers in Figure 4 and Figure 5. "
797
+ ],
798
+ "image_footnote": [],
799
+ "page_idx": 19
800
+ },
801
+ {
802
+ "type": "image",
803
+ "img_path": "images/7f1208d6d3f6c8164bbd03eeea1030b9a2275742dd85a5054d7115d1fa54cfbc.jpg",
804
+ "image_caption": [
805
+ "Figure 7: Another example of hallucinations for a different query, e.g., John F. Kennedy Jr was born in Washington D.C. "
806
+ ],
807
+ "image_footnote": [],
808
+ "page_idx": 19
809
+ },
810
+ {
811
+ "type": "image",
812
+ "img_path": "images/ef441d4c071149f8a7e5c6aae7dad6cac0beb4d516e8512712a32b3a3366428b.jpg",
813
+ "image_caption": [
814
+ "Figure 8: Examples where questions asking for a fact are answered correctly, but verifying via a yes/no question is incorrect (the model tends to agree with the way the question is stated, even if it was stated incorrectly). "
815
+ ],
816
+ "image_footnote": [],
817
+ "page_idx": 20
818
+ }
819
+ ]
parse/test/VP20ZB6DHL/VP20ZB6DHL_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/VP20ZB6DHL/VP20ZB6DHL_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/WPZ2yPag4K/WPZ2yPag4K.md ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FINE-TUNING LANGUAGE MODELS FOR FACTUALITY
2
+
3
+ Katherine Tian\*†, Eric Mitchell\*†, Huaxiu Yao†§, Christopher D. Manning†, Chelsea Finn†
4
+ †Stanford University §UNC Chapel Hill
5
+ {kattian,eric.mitchell}@cs.stanford.edu
6
+
7
+ # ABSTRACT
8
+
9
+ The fluency and creativity of large pre-trained language models (LLMs) have led to their widespread use, sometimes even as a replacement for traditional search engines. Yet language models are prone to making convincing but factually inaccurate claims, often referred to as ‘hallucinations.’ These errors can inadvertently spread misinformation or harmfully perpetuate misconceptions. Further, manual fact-checking of model responses is a time-consuming process, making human factuality labels expensive to acquire. In this work, we fine-tune language models to be more factual, without human labeling and targeting more open-ended generation settings than past work. We leverage two key recent innovations in NLP to do so. First, several recent works have proposed methods for judging the factuality of open-ended text by measuring consistency with an external knowledge base or simply a large model’s confidence scores. Second, the Direct Preference Optimization algorithm enables straightforward finetuning of language models on objectives other than supervised imitation, using a preference ranking over possible model responses. We show that learning from automatically generated factuality preference rankings, generated either through existing retrieval systems or our novel retrieval-free approach, significantly improves the factuality (percent of generated claims that are correct) of Llama-2 on held-out topics compared with RLHF or decoding strategies targeted at factuality. At 7B scale, compared to Llama-2-Chat, we observe $53 \%$ and $50 \%$ reduction in factual error rate when generating biographies and answering medical questions, respectively. A reference implementation can be found at https://github.com/kttian/llm_factuality_tuning.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Recent developments in training large language models (LLMs), particularly methods that learn from rankings over responses such as reinforcement learning from human feedback (RLHF) (Christiano et al., 2017; Ziegler et al., 2020; Ouyang et al., 2022), have enabled the development of powerful, engaging dialogue agents. State-of-the-art LLMs are pre-trained on a vast amount of knowledge in large datasets (Touvron et al., 2023a;b) and further fine-tuned to apply this knowledge to follow diverse instructions or complete more specific tasks (Chung et al., 2022; Chen et al., 2021). However, despite these large language models’ exposure to diverse datasets, they are prone to confidently generating incorrect claims. One recent study shows that GPT-3.5 (ChatGPT) produces false citations more often than not when asked to provide the authors of a given study (Agrawal et al., 2023). Nonetheless, other research has demonstrated that in simple question-answering settings, large language models do exhibit systematic markers of uncertainty that indicate their factually unreliable statements (Kadavath et al., 2022; Tian et al., 2023). These results suggest that language models internally represent the limits of their knowledge, leading us to ask: Can language models be fine-tuned to leverage this internal awareness, to avoid making untrue statements in the first place?
14
+
15
+ A key source of difficulty in training factual models comes in specifying an objective that adequately captures factuality. As an example, maximum likelihood, the most common objective for pre-training language models, does not always encourage factual predictions. Consider the question “Where was Yo-Yo Ma born?” A model that continues by near-deterministically producing the text “idk, probably Paris?” is nearly always correct, but receives extremely high loss if the pre-training data contains any other response to the question. On the other hand, a model that hedges probability mass over many possible phrasings and many possible locations (including incorrect ones, like Antarctica) will likely receive much lower loss, as any response observed in the training data will be assigned at least some non-trivial probability. Because the pre-training objective may reward ‘smearing’ probability mass over many possible responses, language models may generate incorrect statements if they underfit the training data or if asked questions that require knowledge not contained in the pre-training data.
16
+
17
+ ![](images/5410068e804224bc887b843d58dc7804a3e0d70426741c655e4faffc98599a7b.jpg)
18
+ Figure 1: Our approach aims to improve the factuality of language models, specifically focusing on longform generation (e.g. writing a biography). We develop two different approaches for estimating factuality of a passage (center), each of which allows us to generate a preference dataset (right). We then fine-tune the language model to optimize these factuality preferences (far right).
19
+
20
+ In principle, reinforcement learning-based objectives can avoid the failures of existing pre-training objectives through the appropriate choice of a reward function that penalizes factually incorrect statements. However, accurately computing such a reward function can be expensive. Obtaining human labels of factuality is time-consuming and costly; Min et al. (2023) report that professional fact-checkers took approximately 9 minutes to fact-check a single model-generated biography of a well-known individual; it cost about $\$ 2,000$ to annotate 505 biographies.
21
+
22
+ In light of these challenges, we leverage recent advances in estimating truthfulness without human intervention: a) reference-based automated fact-checking methods that evaluate the extent to which an external knowledge base supports the claims in a piece of text (Min et al., 2023; Chern et al., 2023) and b) reference-free truthfulness evaluations that use a model’s own confidence as a proxy for truthfulness, inspired by Kuhn et al. (2023). Using these truthfulness measures and a dataset of unlabeled prompts (e.g., “Write a biography of Yo-Yo Ma.”), we sample pairs of completions from a pre-trained model and annotate them with a preference label denoting which has a lower rate of factual errors. Using the recently proposed Direct Preference Optimization (Rafailov et al., 2023) algorithm, we can stably and efficiently learn from such data. Ultimately, this pipeline enables us to fine-tune off-the-shelf language models to produce factual errors less often (with or without a reference knowledge base). See Figure 1 for an overview of our factuality tuning pipeline.
23
+
24
+ Our primary contribution is a straightforward approach to optimizing language models for factuality in long-form text generation without human annotation. We validate this approach on two benchmark datasets for evaluating factuality, targeted at generating biographies of popular figures and answering open-ended questions about medical conditions. We find that fine-tuning for factuality outperforms conventional RLHF and produces complementary benefits to LLM decoding strategies that aim to increase factuality. Further, we find qualitative differences in the result of learning from preference pairs scored with reference-based and reference-free truthfulness estimation. Overall, we find that learning factuality from automatically constructed preference pairs is a cost-effective way to increase model factuality without human intervention, reducing the error count for claims generated by Llama models by around $50 \%$ or more for biographies and over $2 5 \%$ for medical questions.
25
+
26
+ # 2 PRELIMINARIES
27
+
28
+ Our approach to fine-tuning directly for improved factuality uses the framework of reinforcement learning from preferences over candidate actions or responses. In this section, we provide an overview of reinforcement learning in the context of language models, as well as the specific algorithm we use for preference-based RL, direct preference optimization (Rafailov et al., 2023).
29
+
30
+ Fine-tuning language models with reinforcement learning. Reinforcement learning (RL) has proven to be an effective approach to fine-tuning language models to extract complex, useful behaviors from their pre-trained weights. In the context of RL, a language model policy $\pi _ { \theta }$ (typically an autoregressive Transformer) produces a conditional distribution $\pi _ { \theta } ( y \mid x )$ over responses $y$ given an input query $x$ (both $x$ and $y$ are text sequences). The goal of reinforcement learning is to maximize the average reward of outputs generated by the policy, where a reward function $\bar { r } ( x , y )$ assigns a scalar score to an input-output pair that determines its desirability. However, past works have observed that fine-tuning language models with an objective of unconstrained reward maximization can lead to overoptimization (Gao et al., 2022), that is, a policy that achieves high reward through exploitation of the idiosyncrasies of the reward function that are not aligned with the intended behavior. The most commonly-used objective in practice therefore combines reward maximization with a KL-divergence penalty between the language model and its initialization:
31
+
32
+ $$
33
+ \mathop { \operatorname* { m a x } } _ { \pi _ { \theta } } \mathbb { E } _ { x \sim \mathcal { D } _ { p } , y \sim \pi _ { \theta } ( y | x ) } \left[ r ( x , y ) - \beta \log \frac { \pi _ { \theta } ( y \mid x ) } { \pi _ { \mathrm { r e f } } ( y \mid x ) } \right]
34
+ $$
35
+
36
+ where $\mathcal { D } _ { p }$ is some dataset of prompts, $\pi _ { \mathrm { r e f } }$ is the reference model, usually the result of performing some supervised fine-tuning on a pre-trained model using demonstration data, and $\beta$ is a coefficient that controls the trade-off between reward and divergence (Ouyang et al., 2022; Bai et al., 2022; Stiennon et al., 2020). Optimizing this objective aligns the model with the reward function without deviating too far from the pre-trained reference model, reducing overoptimization. In practice, the most common algorithm used to optimize this objective for language models is proximal policy optimization (PPO; Schulman et al. (2017)), although some variants exist (Ramamurthy et al., 2022; Lu et al., 2022). However, these algorithms are quite complex to implement and tune (Zheng et al., 2023) and require online sampling during training, substantially increasing training time.
37
+
38
+ RL from preferences with direct preference optimization (DPO). Most large language models fine-tuned with Eq. 1 optimize a reward function that is learned from a dataset of preference rankings over possible model outputs. The DPO algorithm simplifies $\mathrm { R L }$ on language models for this special case (Rafailov et al., 2023), using a dataset of preference pairs $\mathcal { D } = \{ x ^ { ( i ) } , y _ { w } ^ { ( i ) } , y _ { l } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ of prompts $x$ and candidate responses $y _ { w }$ and $y _ { l }$ (typically sampled from $\pi _ { \mathrm { r e f } } )$ , where $y _ { w }$ is preferred over $y _ { l }$ (denoted $y _ { w } \succ y _ { l } ,$ . The probability of observing a particular preference pair is assumed to follow a Bradley-Terry model (Bradley & Terry, 1952):
39
+
40
+ $$
41
+ p ( y _ { w } \succ y _ { l } ) = \sigma ( r ( x , y _ { w } ) - r ( x , y _ { l } ) )
42
+ $$
43
+
44
+ where $\sigma$ is the sigmoid function and $r ( x , y )$ is an unobserved reward or scoring function. Rafailov et al. (2023) show that the optimal policy $\pi ^ { * }$ for the problem in Eq. 1 can be found by optimizing a simple classification loss computed directly on the preference data:
45
+
46
+ $$
47
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { D P O } } ( \pi _ { \theta } ; \pi _ { \mathrm { r e f } } ) = - \mathbb { E } _ { ( x , y _ { w } , y _ { l } ) \sim \mathcal { D } } \left[ \log \sigma \left( \beta \log \frac { \pi _ { \theta } ( y _ { w } \mid x ) } { \pi _ { \mathrm { r e f } } ( y _ { w } \mid x ) } - \beta \log \frac { \pi _ { \theta } ( y _ { l } \mid x ) } { \pi _ { \mathrm { r e f } } ( y _ { l } \mid x ) } \right) \right] } \end{array}
48
+ $$
49
+
50
+ DPO enables learning $\pi _ { \theta }$ from a fixed dataset of preferences, without fitting an explicit reward function or sampling from the policy in the loop of training. These advantages make DPO an attractive choice for fine-tuning language models for objectives other than imitation. However, a challenge remains in constructing preference pairs that encourage greater factuality.
51
+
52
+ # 3 CONSTRUCTING PREFERENCES ENCOURAGING FACTUALITY INLONG-FORM TEXT
53
+
54
+ While existing preference learning algorithms like DPO enable efficient, stable learning from objectives other than maximum likelihood, they require data in the form of preferences over possible responses to a prompt. In this section, we propose two classes of approaches to generating such preferences without human labeling effort. One class leverages existing methods to determine consistency with external reference texts as a measure of truthfulness; we propose another, which leverages calibrated model probabilities themselves as a proxy for truthfulness. For both approaches, we are computing an estimated truthfulness score over the claims in each generated response; the response with higher average truthfulness is taken as the preferred response. See Figure 2 for an overview of both procedures for truthfulness scoring. Note that truthfulness scoring is needed only at training time; at test time, we can sample from the model in the normal manner.
55
+
56
+ # 3.1 REFERENCE-BASED TRUTHFULNESS ESTIMATION
57
+
58
+ An intuitive approach to estimating truthfulness is by estimating the consistency of a given piece of text with a reliable reference text or knowledge base. Several recent works have introduced such evaluation criteria; for example, FactScore (Min et al., 2023) uses Wikipedia as reference knowledge, and FacTool (Chern et al., 2023) uses Google Search Results. These measures show high agreement with human judgments of factuality, making them attractive sources of truth for preference data construction. Due to the relatively consistent and high quality of Wikipedia articles, we elect to use FactScore as a representative method of reference-based truthfulness scoring.
59
+
60
+ ![](images/ccc4d832b1e3b7e4429c9496f3b841873bdb56aa91bc7cebb8d67fb54a96253c.jpg)
61
+ Figure 2: We estimate the factuality of a generation by first extracting claims (left) and then evaluating each claims’ truthfulness (right). For the latter, we consider: a reference-based (top right) method that uses a finetuned Llama model to check if the fact is supported by Wikipedia (Min et al., 2023) and a reference-free (bottom right) method that uses the model’s confidence in its most likely answer to estimate its truthfulness.
62
+
63
+ To evaluate a piece of text, FactScore first extracts a list of the atomic claims present in the text using GPT-3.5.1 For each atomic claim, a smaller, more efficient model such as a Llama-1-7b model (Touvron et al., 2023a) that has been fine-tuned for fact-checking is then used to perform natural language inference (MacCartney & Manning, 2008) to determine if a claim is supported by the reference text. The passage’s truthfulness score is the fraction of the extracted atomic claims that are estimated to be supported by the reference text.
64
+
65
+ We note that reference-based truthfulness has the key limitation that it requires access to relevant, high-quality reference texts against which to measure consistency. Such a requirement may limit applicability to domains where ground truth documents are not known and accurate retrieval is difficult, such as in niche domains or less-structured tasks. Further, reference-based truthfulness estimation requires a reliable model to determine if an atomic claim is supported by the article. In light of these limitations, we propose a reference-free approach to estimating truthfulness of open-ended text, which avoids the need for retrieving external knowledge and checking consistency.
66
+
67
+ # 3.2 REFERENCE-FREE CONFIDENCE-BASED TRUTHFULNESS ESTIMATION
68
+
69
+ To eliminate the need for external knowledge, we leverage the fact that large language models are well-calibrated (Kadavath et al., 2022; Tian et al., 2023). That is, if a large language model assigns a fixed confidence $p$ to each claim in a set of claims, the fraction of these claims that is correct is $p$ . In other words, in expectation over many claims, a perfectly-calibrated model’s confidence in a claim corresponds to the probability it is correct. To use this notion of calibration, we interpret a model generation (e.g., a biography of Yo-Yo Ma) as a collection of claims, each resulting from a query to the model’s knowledge (e.g., “When was Yo-Yo Ma born?” or “How many siblings does Yo-Yo Ma have?”). Our goal is to encourage the model to produce responses containing queries to its knowledge likely to lead to correct claims. Therefore, we parse a complete model generation into its constituent queries to the model’s knowledge. For each query to the model’s knowledge present in the generation, we can estimate the likelihood it will lead to a correct claim by simply estimating the average confidence of the model’s answer to this query. If a model assigns probability 0.7 to ‘1955’ and probability 0.3 to ‘1953’ for the query “When was Yo-Yo Ma born?”, then the probability this query will lead to a correct claim (again, in expectation over queries) is $0 . 7 ^ { 2 } + 0 . { \dot { 3 } } ^ { 2 } = 0 . 5 { \dot { 8 } }$ . The model used for computing confidence scores essentially takes the place of the reference text datastore. We evaluate this Expected Confidence approach as well as a Max Confidence approach, which simply takes the max over the answer confidences for a given query (i.e., we assume the model produces answers greedily rather than sampling).
70
+
71
+ ![](images/2dbe894e5993a9be7efccd8d24b194797acb848da2022e87116b3a4649747261.jpg)
72
+ Figure 3: Factuality tuning using FactScore truthfulness scoring (FactTune-FS) produces by far the greatest improvement in factuality for the biography generation and medical question-answering problems. Factuality tuning with expected model confidence truthfulness scoring provides the next strongest performance, on average. For MedicalQA, only factuality tuning provides a strict improvement in factuality (more correct statements and fewer incorrect statements) compared to the SFT model.
73
+
74
+ More concretely, we first extract atomic claims from the text using GPT-3.5. We then use GPT-3.5 to convert each claim to a query (question) testing knowledge of the particular fact. Careful rephrasing is necessary to ensure that the rephrased question is unambiguous; for example, the claim “Yo-Yo Ma plays the cello” should be converted to the question “What instrument does Yo-Yo Ma play?” rather than just “What does Yo-Yo Ma play?” as the latter question admits answers of the wrong type. If we were to use the second prompt, a model might assign $50 \%$ of its probability on “cello” and $50 \%$ of its probability on “basketball.” However, the model’s low confidence is caused by the ambiguity of the question, not low confidence in the instrument that Yo-Yo Ma plays. We detail the prompts used for question generation in Appendix A.2.
75
+
76
+ After each claim is converted to a minimally ambiguous question, we resample an answer 20 times from the base model (e.g. Llama-1-7b) that is fine-tuned to estimate the model’s uncertainty over the answer. We use a few-shot prompt to encourage well-formed answers. We bin these answers by equivalence, using either heuristic string matching of the responses or using GPT-3.5 to assess if the answers are semantically equivalent, inspired by Kuhn et al. (2023). Our heuristic string match checks whether the words in the answer, excluding stop words, are the same. We compare these choices in Section 4.4. The score for each claim is either the expected or maximum confidence of the model’s response; we finally average this score over all claims in a given model generation.
77
+
78
+ # 3.3 FACTUALITY TUNING: PUTTING IT ALL TOGETHER
79
+
80
+ Given a choice of truthfulness estimator, we can now construct a preference dataset for factuality tuning a given language model from a set of unlabeled prompts. First, we sample $n$ multiple candidate responses for each prompt from the model with simple temperature sampling with temperature 1.0 (using few-shot prompting for models that have not been fine-tuned). For each response, we then compute the truthfulness score with the chosen estimator (reference-based or reference-free). Finally, for all $\binom { n } { 2 }$ pairs of responses to each prompt, we simply choose the response with the higher truthfulness score as the preferred response. For a set of $m$ prompts, we ultimately generate $m { \binom { n } { 2 } } - k$ preference pairs, where $k$ is the number of pairs with equal scores. Finally, we fine-tune the model using the DPO pipeline, using all model responses as targets for the SFT stage.
81
+
82
+ # 4 EXPERIMENTS
83
+
84
+ Our experiments evaluate the extent to which factuality can be learned through preference-based reinforcement learning, using the fully automated preference-generation pipeline described in Section
85
+
86
+ Table 1: Dataset statistics and examples. In biographies, entities are individuals; in MedicalQA, entities are medical conditions. We include 6 questions for each entity in MedicalQA and adjust the number of responses per prompt to keep the total number of pairs in the two datasets roughly similar.
87
+
88
+ <table><tr><td>Dataset</td><td>Entities [train, val, test]</td><td>Prompts per Entity</td><td>Responses per Prompt</td><td>Example prompt</td></tr><tr><td>Biographies</td><td>463[288,50,125]</td><td>16</td><td>10</td><td>Write me a paragraph biography of Mary Wolstonecraft.</td></tr><tr><td>Medical QA</td><td>295[150,45,100]</td><td></td><td>6</td><td>What are the common symptoms of a stroke?</td></tr></table>
89
+
90
+ 3. We call the model fine-tuned with our reference-based metric FactTune-FS and the model finetuned with our model confidence-based score, which is completely reference-free, FactTune-MC. For all of our experiments, samples for model confidence are taken from Llama-1-7b.
91
+
92
+ Datasets. We conduct our experiments on two tasks: generating biographies and medical questionanswering. For biographies, we generated a dataset consisting of 463 diverse well-known individuals (288 train, 50 val, 125 test) with 10 short-paragraph biographies each. For medical question answering, we used a dataset of 295 diverse common medical conditions (150 train, 45 val, 100 test) with 6 questions about each condition and 6 short-paragraph answers per question. The test set just uses 1 question per condition. The prompts were generated with GPT-3.5, and the answers were sampled from Llama-1-7b using a few-shot prompt for each dataset. We found that our procedure consistently resulted in well-formed and informative responses, albeit with possible factual errors. Because FactScore uses retrieval against a given Wikipedia article, we generate data based on individuals and medical conditions that have Wikipedia pages. See Table 1 for the summary stats and examples from our datasets.
93
+
94
+ Baselines. We compare factuality tuning with inference-time intervention (Li et al., 2023, ITI) and decoding by contrasting layers (Chuang et al., 2023, DOLA), applied to the SFT model for each task. For ITI, we supervise the training of the linear probes with FactScore labels: we take batches of atomic facts extracted from the training samples and bias the models’ activations from the incorrect to correct atomic facts to determine the direction of the intervention. In the case of Llama-2, we also compare against ‘standard’ RLHF with human preference labels (Touvron et al., 2023b).
95
+
96
+ Evaluation. To evaluate each generated response, we follow the FactScore procedure to extract the number of correct and incorrect facts. Then, to check that the model responses are still relevant and helpful after actuality fine-tuning, we also use GPT-3.5 to determine whether each fact is relevant to the question or not (using the prompt in Appendix A.2). For biographies, we observed that essentially $100 \%$ of facts were relevant to the individual, so we skip the relevance computation to save costs. For each dataset, we report the number of correct and relevant facts (# Correct), the number of inaccuracies (# Incorrect), and the proportion of correct relevant facts out of the total number of extracted facts ( $\%$ Correct). Note that the total number of facts may vary between generations. We validate our evaluation metrics in Sec. A.1.
97
+
98
+ # 4.1 FINE-TUNING FOR FACTUALITY ACROSS DOMAINS
99
+
100
+ In this section, we apply our methodology for learning factuality to Llama-1-7b and Llama-2-7b in multiple domains. We show the results in Table 2. Learning from reference-based factualityscored pairs (FactTune-FS) consistently improves factual accuracy compared to RLHF models and decoding-based factuality baselines by at least $11 \%$ on biographies and $13 \%$ on medical questionanswering. FactTune-FS reduces the number of factual errors and maintains no more than a slight decrease, if not increase, in the amount of correct information generated. Factuality tuning from model-confidence scores (FactTune-MC, FactTune-EC) also reduces error rate and improves the factuality of RLHF models on both datasets, without any external reference information.
101
+
102
+ # 4.2 FINE-TUNING CHAT MODELS FOR FACTUALITY
103
+
104
+ Most widely used practical chatbots today are LMs trained with RLHF to follow diverse instructions in a way that is helpful to users. In this section, we investigate the ability of our human-free factuality tuning method to improve the factuality of RLHF chat models. Using Llama-2-7b-Chat, we find that fine-tuning an RLHF LM with both factuality and semantic entropy-based rewards can further improve its factuality without significantly decreasing the total number of facts, as shown in Table 3.
105
+
106
+ Table 2: Factuality tuning from reference-based factuality-scored pairs (FactTune-FS) improves factual accuracy compared to RLHF models and decoding-based factuality baselines, consistently reducing the number of errors and often increasing the number of correct facts generated. Factuality tuning from model confidence scored pairs (FactTune-MC, FactTune-EC) also outperforms RLHF models, providing a strong reference-free alternative for improving factuality and reducing error.
107
+
108
+ <table><tr><td></td><td></td><td colspan="3">Biographies</td><td colspan="3">Medical QA</td></tr><tr><td>Base Model</td><td>Method</td><td># Correct</td><td># Incorrect</td><td>% Correct</td><td># Correct</td><td># Incorrect</td><td>% Correct</td></tr><tr><td rowspan="6">Llama-1</td><td>ITI</td><td>13.68</td><td>5.24</td><td>0.730</td><td>10.25</td><td>7.96</td><td>0.538</td></tr><tr><td>DOLA</td><td>12.44</td><td>4.74</td><td>0.737</td><td>9.22</td><td>5.58</td><td>0.640</td></tr><tr><td>SFT</td><td>13.54</td><td>6.54</td><td>0.696</td><td>9.96</td><td>6.86</td><td>0.600</td></tr><tr><td>FactTune-FS (Ours)</td><td>14.51</td><td>3.74</td><td>0.812</td><td>12.60</td><td>4.18</td><td>0.746</td></tr><tr><td>FactTune-MC (Ours)</td><td>9.74</td><td>2.42</td><td>0.819</td><td>11.51</td><td>5.56</td><td>0.668</td></tr><tr><td>FactTune-EC (Ours)</td><td>10.84</td><td>3.28</td><td>0.790</td><td>11.52</td><td>6.56</td><td>0.641</td></tr><tr><td rowspan="7">Llama-2</td><td>ITI</td><td>13.30</td><td>5.56</td><td>0.712</td><td>9.40</td><td>4.25</td><td>0.690</td></tr><tr><td>DOLA</td><td>13.25</td><td>6.50</td><td>0.684</td><td>9.87</td><td>6.06</td><td>0.627</td></tr><tr><td>Chat</td><td>21.41</td><td>6.30</td><td>0.774</td><td>9.61</td><td>6.69</td><td>0.619</td></tr><tr><td>SFT</td><td>13.47</td><td>6.49</td><td>0.687</td><td>10.68</td><td>6.22</td><td>0.627</td></tr><tr><td>FactTune-FS (Ours)</td><td>19.32</td><td>2.76</td><td>0.880</td><td>13.29</td><td>2.97</td><td>0.809</td></tr><tr><td>FactTune-MC (Ours)</td><td>11.74</td><td>3.51</td><td>0.783</td><td>12.94</td><td>5.26</td><td>0.706</td></tr><tr><td>FactTune-EC (Ours)</td><td>12.68</td><td>3.69</td><td>0.797</td><td>12.80</td><td>5.19</td><td>0.710</td></tr></table>
109
+
110
+ <table><tr><td></td><td></td><td colspan="3">Biographies</td><td colspan="3">Medical QA</td></tr><tr><td>Base Model</td><td>Method</td><td># Correct</td><td># Incorrect</td><td>% Correct</td><td># Correct</td><td># Incorrect</td><td>% Correct</td></tr><tr><td></td><td></td><td>21.41</td><td>6.30</td><td>0.774</td><td>9.61</td><td>6.69</td><td>0.619</td></tr><tr><td></td><td>DOLA</td><td>22.25</td><td>5.81</td><td>0.793</td><td>11.45</td><td>6.74</td><td>0.624</td></tr><tr><td>Llama-2-Chat</td><td>FactTune-FS (Ours)</td><td>20.02</td><td>4.38</td><td>0.821</td><td>11.94</td><td>6.21</td><td>0.667</td></tr><tr><td></td><td>FactTune-MC (Ours)</td><td>19.12</td><td>4.97</td><td>0.795</td><td>12.61</td><td>7.21</td><td>0.627</td></tr><tr><td></td><td>FactTune-EC (Ours)</td><td>18.77</td><td>5.13</td><td>0.784</td><td>11.51</td><td>6.40</td><td>0.639</td></tr><tr><td></td><td>OOD FactTune-FS (ours)</td><td>21.06</td><td>5.45</td><td>0.796</td><td>11.56</td><td>6.66</td><td>0.635</td></tr></table>
111
+
112
+ Table 3: Factuality tuning a dialogue model (Llama-2-Chat) with FactScore, model confidence-based truthfulness estimation, and FactScore-based preferences from a different dataset (FactTune-FS, FactTune-MC, OOD FactTune-FS) further improves its factual accuracy more than a baseline method for factuality, DOLA.
113
+
114
+ # In other words, factuality tuning can be composed with RLHF to further improve the factuality of chat models.
115
+
116
+ While our quantitative metrics demonstrate a clear increase in factual accuracy, we also investigate how factuality fine-tuning impacts other aspects of model performance and generalizes. Using GPT4 as a judge, we find that FactTune-MC and FactTune-EC can improve both factuality and fluency compared to the SFT model (examples in Appendix Table 8). GPT-4 chooses FactTuneEC as more fluent than SFT on $80 \%$ of samples, FactTune-MC on $7 5 \%$ of samples, ITI on $57 \%$ of samples, FactTune-FS on $33 \%$ of samples, and DOLA on $16 \%$ of samples $\scriptstyle ( \mathrm { n = 1 0 0 }$ ).
117
+
118
+ Lastly, we find that fine-tuning for factuality generalizes across datasets. Fine-tuning Llama-2- 7b-Chat on biographies to evaluate on MedicalQA and vice versa (OOD FactTune-FS) improves the factuality more than RLHF (Table 3).
119
+
120
+ 4.3 COMPLEMENTARY BENEFITS OF FACTUALITY TUNING AND DECODING-TIME FACTUALITY INTERVENTIONS
121
+
122
+ Besides fine-tuning for factuality, multiple existing works aim to improve LLM factuality through inference time interventions to either the decoding process or the model parameters themselves. We explore the possibility of applying both of these types of methods together, i.e., using factualityboosting decoding methods on a model fine-tuned with our factuality tuning procedure. In Table 4 we present the results of stacking both approaches. We find that in most cases, DOLA can even further increase the accuracy of factuality fine-tuned models, with one exception for Llama-2 on the biography task. While not a comprehensive evaluation of combining methods for improving factuality, this result suggests that different approaches to enhancing factuality may operate through complementary mechanisms.
123
+
124
+ Table 4: DOLA factuality decoding frequently composes with factuality fine-tuning, providing an increase in average correctness for the majority of combinations of model and dataset.
125
+
126
+ <table><tr><td></td><td></td><td colspan="3">Biographies</td><td colspan="3">Medical QA</td></tr><tr><td>Base Model</td><td>Method</td><td>#Correct</td><td>#Incorrect</td><td>%Correct</td><td>#Correct</td><td>#Incorrect</td><td>%Correct</td></tr><tr><td rowspan="2">Llama-1</td><td></td><td></td><td>3.74</td><td></td><td>12.0</td><td>418</td><td>0.746</td></tr><tr><td>FactTune-FS + DOLA</td><td>1451</td><td></td><td>0.812</td><td></td><td></td><td></td></tr><tr><td rowspan="2">Llama-2</td><td></td><td>19.32</td><td>2.76</td><td>0.880</td><td>13.29</td><td></td><td></td></tr><tr><td>FactTune-FS + DOLA</td><td></td><td></td><td></td><td></td><td>2.7</td><td>0.89</td></tr></table>
127
+
128
+ <table><tr><td></td><td></td><td></td><td colspan="3">Biographies</td><td colspan="3">Medical QA</td></tr><tr><td>Fact Ext.</td><td>Equiv</td><td>Metric</td><td>#Correct</td><td>#Incorrect</td><td>%Correct</td><td>#Correct</td><td>#Incorrect</td><td>%Correct</td></tr><tr><td rowspan="2">Atomic</td><td rowspan="2">Heuristic</td><td>Max Con Conf</td><td>9.74</td><td>22</td><td></td><td></td><td>5.56</td><td>0.668</td></tr><tr><td></td><td></td><td></td><td>0.819</td><td>11.51</td><td></td><td></td></tr><tr><td rowspan="2">Entity</td><td rowspan="2">Heuristic</td><td></td><td>12.2</td><td></td><td>0.74</td><td>10.3</td><td></td><td></td></tr><tr><td>Mx Co Conf</td><td></td><td>4.74</td><td></td><td></td><td>64</td><td>0.603</td></tr></table>
129
+
130
+ Table 5: On Llama-1, model confidence-based preference construction with atomic question extraction outperforms the version with entity extraction.
131
+
132
+ # 4.4 IMPACT OF DESIGN DECISIONS OF OPEN-ENDED MODEL CONFIDENCE SCORING
133
+
134
+ This section discusses the impacts of different design choices for the steps of our reference-free truthfulness score construction for factuality tuning: how to perform fact extraction and what confidence metric to use.
135
+
136
+ The first step is to extract the individual facts from the long-form response and re-sample each fact from the base model to assess the model’s confidence in the fact. For the fact-extraction and resampling procedure, one approach (Atomic) is to convert each extracted atomic fact into a corresponding ‘atomic question’ with a few-shot prompt query to GPT-3.5, then sample answers to each question from the base LLM. Another approach (Entity) extracts entities from the response via nltk and re-samples the extracted entity in-line. Atomic question extraction has the potential to be more comprehensive and precise, while named entity extraction is a less expensive proxy that doesn’t use closed models. In Table 5, we observe that atomic question extraction outperforms named entity extraction, although the difference in accuracy is smaller on Medical QA than on Biographies.
137
+
138
+ After re-sampling the fact, we study the choice of confidence metric between taking the model’s confidence based on the most common sample (Max Conf) or the confidence of the fact from the original response (Expected Conf). To compute Max Conf for both atomic and entity extraction, we bin the samples into equivalence classes of distinct responses using a string matching heuristic described in Section 3.2 and take the proportion of samples in the largest bin. For computing Expected Confidence, we first perform the same answer binning procedure as for Max Confidence, resulting in $k$ bins and confidences $p _ { 1 } , \ldots , p _ { k }$ , and take $\textstyle E C = \sum _ { i = 1 } ^ { k } p _ { i } ^ { 2 }$ . The results in Table 5 show that the performance of Max Conf versus Expected Conf varies but are quite similar.
139
+
140
+ # 5 RELATED WORK
141
+
142
+ Many works have identified reducing factual errors (sometimes called ‘hallucinations’) as a key challenge for building more reliable language models (Lewis et al., 2020; Kadavath et al., 2022; Zhang et al., 2023), even for the most powerful language models (Bubeck et al., 2023). Other use of the term ‘hallucination’ refers to summarization or translation system outputs not supported by the reference text (Maynez et al., 2020; Zhang et al., 2020) even if they are factual (Cao et al., 2022). Other work uses ‘hallucination’ to describe vision-language models producing outputs not grounded in a visual input, e.g., a captioning system describing an object that doesn’t exist in the image (Rohrbach et al., 2018). In our case, we focus on statements that are factually incorrect (or, inconsistent with a set of ‘authoritative’ texts, such as Wikipedia).
143
+
144
+ Several works describe methods for detecting likely factual errors through sensitivity to perturbations in the prompt (Xu et al., 2023), high diversity of responses under resampling (Kadavath et al., 2022; Mundler et al. ¨ , 2023; Kuhn et al., 2023; Manakul et al., 2023), or inconsistency with external knowledge sources (Min et al., 2023; Chern et al., 2023), or properties of internal activations (Azaria & Mitchell, 2023). Others go beyond detecting errors, correcting them after they have been generated (Peng et al., 2023; Gao et al., 2023; Dhuliawala et al., 2023). These approaches typically rely on retrieving relevant data from a trusted knowledge base and use another LLM to verify consistency; however, retrieval-based methods face key challenges, namely reliable resolution of conflicts between parametric and retrieved knowledge (Longpre et al., 2022; Chen et al., 2022) as well as maintaining improvements in factuality as model size increases (Mallen et al., 2023). Further, retrieval-based methods add significant system complexity; the most common open-source consumer language models thus use purely parametric models (Touvron et al., 2023a). The FactScore variant of our approach uses retrieval only during training, avoiding inference time complexity. In principle, any existing criterion could be used to generate preferences (see ;¸ we aim to show that even choosing relatively simple criteria leads to substantial improvements in factuality.
145
+
146
+ Most similar to ours, some approaches attempt to prevent the generation of factual errors in the first place, using prompting strategies (Si et al., 2023) or perturbing the internal representations of the model (Chuang et al., 2023; Li et al., 2023). Unlike using a fixed heuristic for identifying an internal ‘factuality’ dimension, we optimize directly for the end goal of generating factual statements, which we find shows a greater improvement in factuality. Finally, while most past work has focused on short-form NLG tasks like short-form question-answering (Kadavath et al., 2022), we explore ways to measure model confidence over factual information in long-form, unstructured text and estimate truthfulness in a reference-free manner (i.e., don’t require any external knowledge base or annotations).
147
+
148
+ # 6 CONCLUSION
149
+
150
+ In this paper, we show a practical, effective strategy to improve a language model’s ability to generate factual content, specifically focusing on long-form generations. We develop and study two different approaches to estimating the truthfulness of long-form text and optimize for these criteria using preference-based learning. In addition to existing reference-based truthfulness estimators that leverage external knowledge to establish the truth of a particular statement, we introduce a novel reference-free procedure for estimating truthfulness that uses the language model’s own uncertainty as an indication of factuality. Our experiments show that fine-tuning a language model with either criterion reliably reduces the number of incorrect facts (i.e. hallucinations) that the model generates. Reference-free approaches like the one we introduced provide a scalable self-supervision strategy to improve factuality, eliminating the need for a reference corpus of ‘gold’ texts.
151
+
152
+ The experimental results suggest a number of avenues for future work. First, because of the limited research and thus the limited benchmarks on the factuality of long-form language model generations, we proposed two new tasks to benchmark our approach. These tasks are representative of but do not fully cover the range of scenarios where we would hope to improve factuality. Furthermore, our experiments provide evidence for improving the factuality of dialogue models that are already finetuned with RLHF, but still leave open the question of how best to combine typical RLHF rewards and approaches with factuality rankings. Similarly, exploring additional ways to combine factuality tuning with existing methods for improving factuality, such as in our factuality tuning $+ { \mathrm { ~ D O L A } }$ experiment, may be a fruitful direction for future research. Further, future work might explore alternative approaches to constructing factuality preferences, such as using self-correction (Pan et al., 2023). Finally, we explore only 7B models in this work. Scaling up our factuality tuning recipe to larger models (and larger preference datasets) may reduce hallucinations even further.
153
+
154
+ # ACKNOWLEDGEMENTS
155
+
156
+ EM gratefully acknowledges funding from a Knight-Hennessy graduate fellowship and a Stanford Accelerator for Generative AI and Education grant. CF and CDM are CIFAR Fellows.
157
+
158
+ Reproducibility Statement. We explain the steps of our fine-tuning method in Section 3. In Section 4.1, we provide details on the dataset (dataset statistics, how it was generated, and examples), as well as how the evaluation is completed and how we implemented the baselines. In the experiment subsections and captions, we provide additional implementation or reporting details. In the appendix, we provide the exact GPT-3.5 prompts used for the extraction steps of our reference-free scoring method. A codebase with instructions for factuality scoring, training, and evaluation can be found here: https://github.com/kttian/llm_factuality_tuning.
159
+
160
+ # REFERENCES
161
+
162
+ Ayush Agrawal, Mirac Suzgun, Lester Mackey, and Adam Tauman Kalai. Do language models know when they’re hallucinating references?, 2023. arXiv preprint arxiv:2305.18248. 1
163
+
164
+ Amos Azaria and Tom Mitchell. The internal state of an LLM knows when its lying, 2023. arXiv preprint arxiv:2304.13734. 9
165
+
166
+ Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, Nicholas Joseph, Saurav Kadavath, Jackson Kernion, Tom Conerly, Sheer El-Showk, Nelson Elhage, Zac Hatfield-Dodds, Danny Hernandez, Tristan Hume, Scott Johnston, Shauna Kravec, Liane Lovitt, Neel Nanda, Catherine Olsson, Dario Amodei, Tom Brown, Jack Clark, Sam McCandlish, Chris Olah, Ben Mann, and Jared Kaplan. Training a helpful and harmless assistant with reinforcement learning from human feedback, 2022. arXiv preprint arxiv:2204.05862. 3
167
+
168
+ Ralph Allan Bradley and Milton E Terry. Rank analysis of incomplete block designs: I. the method of paired comparisons. Biometrika, 39(3/4):324–345, 1952. 3
169
+
170
+ Sebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece ´ Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, Harsha Nori, Hamid Palangi, Marco Tulio Ribeiro, and Yi Zhang. Sparks of artificial general intelligence: Early experiments with GPT-4, 2023. arXiv preprint arxiv:2303.12712. 8
171
+
172
+ Meng Cao, Yue Dong, and Jackie Cheung. Hallucinated but factual! inspecting the factuality of hallucinations in abstractive summarization. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 3340–3354, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long. 236. URL https://aclanthology.org/2022.acl-long.236. 8
173
+
174
+ Hung-Ting Chen, Michael Zhang, and Eunsol Choi. Rich knowledge sources bring complex knowledge conflicts: Recalibrating models to reflect conflicting evidence. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pp. 2292–2307, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.emnlp-main.146. URL https://aclanthology.org/2022. emnlp-main.146. 9
175
+
176
+ Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde, Jared Kaplan, Harrison Edwards, Yura Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, David W. Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William H. Guss, Alex Nichol, Igor Babuschkin, S. Arun Balaji, Shantanu Jain, Andrew Carr, Jan Leike, Joshua Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew M. Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code. ArXiv, abs/2107.03374, 2021. URL https://api.semanticscholar.org/CorpusID:235755472. 1
177
+
178
+ I-Chun Chern, Steffi Chern, Shiqi Chen, Weizhe Yuan, Kehua Feng, Chunting Zhou, Junxian He, Graham Neubig, and Pengfei Liu. FacTool: Factuality detection in generative ai – a tool augmented framework for multi-task and multi-domain scenarios, 2023. arXiv preprint arxiv:2307.13528. 2, 4, 9
179
+
180
+ Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. In I. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper_files/paper/2017/ file/d5e2c0adad503c91f91df240d0cd4e49-Paper.pdf. 1
181
+
182
+ Yung-Sung Chuang, Yujia Xie, Hongyin Luo, Yoon Kim, James Glass, and Pengcheng He. DoLa: Decoding by contrasting layers improves factuality in large language models, 2023. arXiv preprint arxiv:2309.03883. 6, 9
183
+
184
+ Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Yunxuan Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Alex Castro-Ros, Marie Pellat, Kevin Robinson, Dasha Valter, Sharan Narang, Gaurav Mishra, Adams Yu, Vincent Zhao, Yanping Huang, Andrew Dai, Hongkun Yu, Slav Petrov, Ed H. Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V. Le, and Jason Wei. Scaling instruction-finetuned language models, 2022. 1 Shehzaad Dhuliawala, Mojtaba Komeili, Jing Xu, Roberta Raileanu, Xian Li, Asli Celikyilmaz, and Jason Weston. Chain-of-verification reduces hallucination in large language models, 2023. 9 Leo Gao, John Schulman, and Jacob Hilton. Scaling laws for reward model overoptimization, 2022.
185
+ 3, 14 Luyu Gao, Zhuyun Dai, Panupong Pasupat, Anthony Chen, Arun Tejasvi Chaganty, Yicheng Fan, Vincent Y. Zhao, Ni Lao, Hongrae Lee, Da-Cheng Juan, and Kelvin Guu. Rarr: Researching and revising what language models say, using language models, 2023. 9 Saurav Kadavath, Tom Conerly, Amanda Askell, Tom Henighan, Dawn Drain, Ethan Perez, Nicholas Schiefer, Zac Hatfield-Dodds, Nova DasSarma, Eli Tran-Johnson, Scott Johnston, Sheer El-Showk, Andy Jones, Nelson Elhage, Tristan Hume, Anna Chen, Yuntao Bai, Sam Bowman, Stanislav Fort, Deep Ganguli, Danny Hernandez, Josh Jacobson, Jackson Kernion, Shauna Kravec, Liane Lovitt, Kamal Ndousse, Catherine Olsson, Sam Ringer, Dario Amodei, Tom Brown, Jack Clark, Nicholas Joseph, Ben Mann, Sam McCandlish, Chris Olah, and Jared Kaplan. Language models (mostly) know what they know, 2022. URL http://arxiv.org/ abs/2207.05221. Arxiv arxiv:2207.05221. 1, 4, 8, 9 Lorenz Kuhn, Yarin Gal, and Sebastian Farquhar. Semantic uncertainty: Linguistic invariances for uncertainty estimation in natural language generation, 2023. 2, 5, 8 Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Rockt ¨ aschel, Sebastian Riedel, ¨ and Douwe Kiela. Retrieval-augmented generation for knowledge-intensive NLP tasks. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 9459–9474. Curran Associates, Inc.,
186
+ 2020. URL https://proceedings.neurips.cc/paper_files/paper/2020/ file/6b493230205f780e1bc26945df7481e5-Paper.pdf. 8 Kenneth Li, Oam Patel, Fernanda Viegas, Hanspeter Pfister, and Martin Wattenberg. Inference-time ´ intervention: Eliciting truthful answers from a language model, 2023. 6, 9 Shayne Longpre, Kartik Perisetla, Anthony Chen, Nikhil Ramesh, Chris DuBois, and Sameer Singh. Entity-based knowledge conflicts in question answering, 2022. 9 Ximing Lu, Sean Welleck, Jack Hessel, Liwei Jiang, Lianhui Qin, Peter West, Prithviraj Ammanabrolu, and Yejin Choi. QUARK: Controllable text generation with reinforced unlearning. 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=
187
+ 5HaIds3ux5O. 3 Bill MacCartney and Christopher D. Manning. Modeling semantic containment and exclusion in natural language inference. In Proceedings of the 22nd International Conference on Computational Linguistics (Coling 2008), pp. 521–528, Manchester, UK, August 2008. Coling 2008 Organizing Committee. URL http://www.aclweb.org/anthology/C08-1066. 4 Alex Mallen, Akari Asai, Victor Zhong, Rajarshi Das, Daniel Khashabi, and Hannaneh Hajishirzi. When not to trust language models: Investigating effectiveness of parametric and non-parametric memories. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 9802–9822, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.546. URL https://aclanthology.org/2023.acl-long.546. 9
188
+ Potsawee Manakul, Adian Liusie, and Mark J. F. Gales. Selfcheckgpt: Zero-resource black-box hallucination detection for generative large language models, 2023. 8
189
+ Joshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. On faithfulness and factuality in abstractive summarization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 1906–1919, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.173. URL https://aclanthology.org/ 2020.acl-main.173. 8
190
+ Sewon Min, Kalpesh Krishna, Xinxi Lyu, Mike Lewis, Wen tau Yih, Pang Wei Koh, Mohit Iyyer, Luke Zettlemoyer, and Hannaneh Hajishirzi. Factscore: Fine-grained atomic evaluation of factual precision in long form text generation, 2023. 2, 4, 9, 14
191
+ Niels Mundler, Jingxuan He, Slobodan Jenko, and Martin Vechev. Self-contradictory hallucinations ¨ of large language models: Evaluation, detection and mitigation, 2023. 8
192
+ Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback, 2022. 1, 3
193
+ 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, 2023. 9
194
+ Baolin Peng, Michel Galley, Pengcheng He, Hao Cheng, Yujia Xie, Yu Hu, Qiuyuan Huang, Lars Liden, Zhou Yu, Weizhu Chen, and Jianfeng Gao. Check your facts and try again: Improving large language models with external knowledge and automated feedback, 2023. 9
195
+ Rafael Rafailov, Archit Sharma, Eric Mitchell, Stefano Ermon, Christopher D. Manning, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model, 2023. 2, 3
196
+ Rajkumar Ramamurthy, Prithviraj Ammanabrolu, Kiante Brantley, Jack Hessel, Rafet Sifa, Chris- ´ tian Bauckhage, Hannaneh Hajishirzi, and Yejin Choi. Is reinforcement learning (not) for natural language processing: Benchmarks, baselines, and building blocks for natural language policy optimization. In International Conference on Learning Representations (ICLR 2023), 2022. URL https://arxiv.org/abs/2210.01241. 3
197
+ Anna Rohrbach, Lisa Anne Hendricks, Kaylee Burns, Trevor Darrell, and Kate Saenko. Object hallucination in image captioning. In Ellen Riloff, David Chiang, Julia Hockenmaier, and Jun’ichi Tsujii (eds.), Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 4035–4045, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1437. URL https://aclanthology.org/ D18-1437. 8
198
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms, 2017. 3
199
+ Chenglei Si, Zhe Gan, Zhengyuan Yang, Shuohang Wang, Jianfeng Wang, Jordan Boyd-Graber, and Lijuan Wang. Prompting gpt-3 to be reliable, 2023. 9
200
+ Nisan Stiennon, Long Ouyang, Jeff Wu, Daniel M. Ziegler, Ryan Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul Christiano. Learning to summarize from human feedback. Neural Information Processing Systems, 18, 2020. 3
201
+ Katherine Tian, Eric Mitchell, Allan Zhou, Archit Sharma, Rafael Rafailov, Huaxiu Yao, Chelsea Finn, and Christopher D. Manning. Just ask for calibration: Strategies for eliciting calibrated confidence scores from language models fine-tuned with human feedback, 2023. 1, 4
202
+ Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee´ Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Ar- \` mand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models, 2023a. 1, 4, 9
203
+ Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and fine-tuned chat models, 2023b. 1, 6
204
+ Weijia Xu, Sweta Agrawal, Eleftheria Briakou, Marianna J. Martindale, and Marine Carpuat. Understanding and Detecting Hallucinations in Neural Machine Translation via Model Introspection. Transactions of the Association for Computational Linguistics, 11:546–564, 06 2023. ISSN 2307- 387X. doi: 10.1162/tacl a 00563. URL https://doi.org/10.1162/tacl_a_00563. 8
205
+ Muru Zhang, Ofir Press, William Merrill, Alisa Liu, and Noah A Smith. How language model hallucinations can snowball. arXiv preprint arXiv:2305.13534, 2023. 8
206
+ Yuhao Zhang, Derek Merck, Emily Tsai, Christopher D Manning, and Curtis Langlotz. Optimizing the factual correctness of a summary: A study of summarizing radiology reports. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics (ACL), 2020. URL https://arxiv.org/pdf/1911.02541.pdf. 8
207
+ Rui Zheng, Shihan Dou, Songyang Gao, Yuan Hua, Wei Shen, Binghai Wang, Yan Liu, Senjie Jin, Qin Liu, Yuhao Zhou, Limao Xiong, Lu Chen, Zhiheng Xi, Nuo Xu, Wenbin Lai, Minghao Zhu, Cheng Chang, Zhangyue Yin, Rongxiang Weng, Wensen Cheng, Haoran Huang, Tianxiang Sun, Hang Yan, Tao Gui, Qi Zhang, Xipeng Qiu, and Xuanjing Huang. Secrets of RLHF in large language models part I: PPO, 2023. 3
208
+ 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, 2020. 1
209
+
210
+ <table><tr><td>Dataset</td><td>Evaluation</td><td>SFT</td><td>FactTune-FS</td></tr><tr><td>Biographies</td><td>Human</td><td>0.582</td><td>0.846</td></tr><tr><td>Biographies</td><td>FactScore</td><td>0.669</td><td>0.921</td></tr><tr><td>MedQA</td><td>Human</td><td>0.662</td><td>0.838</td></tr><tr><td>MedQA</td><td>FactScore</td><td>0.534</td><td>0.806</td></tr></table>
211
+
212
+ Table 6: To validate that our models do not suffer from extreme reward overoptimization, we conduct a human evaluation of the Llama-1-7b SFT and FactTune-FS models and find that an increase in FactScore also corresponds to a large increase in human-annotated accuracy. This study is computed on a subset of 25 generations per model.
213
+
214
+ ![](images/c728e2c9dbd4acc21848512c38d03b6c6ddf3a6c6a95ab7ba5c3ff9b16cbe034.jpg)
215
+ Figure 4: Average FactScore error counts and GPT-4 error counts are highly correlated, suggesting that the resulting models do not suffer from extreme reward overoptimization (Gao et al., 2022). We plot average FactScore error count v.s. average GPT-4 error count, scaling each dataset by the max GPT-4 error count in that dataset.
216
+
217
+ # A APPENDIX
218
+
219
+ # A.1 VALIDATING METRICS FOR FACTUALITY
220
+
221
+ Our experiments primarily use counts of correct and incorrect facts computed by FactScore as the main evaluation metrics, as FactScore is automated and has been shown to exhibit good agreement with human fact-checkers (Min et al., 2023). Nonetheless, we aim to verify that our results are not specific or overfit to the FactScore criterion. In this section, we provide an evaluation with (1) human evaluators hired through Prolific.co2 and (2) GPT-4.
222
+
223
+ To acquire human fact-checking results, we provide each human evaluator with a prompt, a generated response, and the title of the Wikipedia article they should use for fact-checking the response. We ask the human study participants to count the total number of facts and the number of incorrect facts in the response, and we divide these to obtain the human-rated accuracy. We provide the results in Table 6, where on average humans rated our FactTune-FS model for both datasets significantly higher than the SFT model.
224
+
225
+ Further, we ask GPT-4 to evaluate the factuality of a given response by counting the number of factual errors. We observe that the GPT-4 model ratings and FactScore model ratings are highly correlated, and GPT-4 provides another evaluation metric that demonstrates that FactTune-FS significantly reduces average error compared to the SFT models on both datasets (see Figure 4). Taken together, these results suggest that the improvements in factuality are not the result of exploitation of our evaluation protocol.
226
+
227
+ # A.2 PROMPTS
228
+
229
+ Table 7 contains the prompts used with GPT-3.5 to convert statements into questions for model confidence-based truthfulness estimation.
230
+
231
+ # A.3 SAMPLE MODEL GENERATIONS
232
+
233
+ See Table 8 for samples generated by several different models. After factuality tuning, the model does produce somewhat terser responses.
234
+
235
+ Table 7: GPT-3.5 prompts used to convert atomic facts into questions.
236
+
237
+ <table><tr><td>Biography Atomic Fact to Question the key fact in the statement. For example: Statement: LeBron James is a professional basketball player. Question: What is LeBron James’profession? Statement: He is one of the best in the NBA. Question: Where does LeBron James rank among NBA players? Statement: James was born in Akron.</td><td>I will provide a statement containing one atomic fact related to Hillry Clinton or people around her. Please rephrase the following statement into a specific question testing knowledge of the key fact in the statement. For example: Statement:Hillary Clinton was born in 1947. Question: In what year was Hillary Clinton born? Statement: Hillary attended the Wellesley College. Question: What college did Hillary Clinton attend? Statement: She married Bill Clinton. Question: Who did Hillary Clinton marry? I will provide a statement containing one atomic fact related to LeBron James or people around him. Please rephrase the following statement into a specific question that testing knowledge of</td></tr><tr><td>Atomic Fact to Question derarm. the breast or underarm? the breast?</td><td>MedicalQA I will provide a statement containing one atomic fact about the medical condition menopause. Please rephrase the following statement into a specific question testing knowledge of the key fact in the statement.For example: Statement: Menopause is a time in a woman&#x27;s life. Question: Menopause is a time in whose life? Statement: Menopause is the time when a woman no longer has menstrual periods. Question: Menopause is the time when a woman no longer has what? Statement: There is a decline in the ovarian hormone estrogen. Question: During menopause there is a decline in what? I will provide a statement containing one atomic fact about the medical condition breast cancer. Please rephrase the following statement into a specific question testing knowledge of the key fact in the statement. For example: Statement: The signs and symptoms include a lump or thickening in or near the breast or un- Question: Do the signs and symptoms of breast cancer include a lump or thickening in or near Statement: The signs and symptoms include a change in the size or shape of the breast. Question: Do the signs and symptoms of breast cancer include a change in the size or shape of I will provide a statement containing one atomic fact about the medical condition varicose veins. Please rephrase the following statement into a specific question testing knowledge of the key fact in the statement.For example:</td></tr></table>
238
+
239
+ <table><tr><td>SFT</td><td>Greta Gerwig is an American actress and filmmaker. She was born in and raised in Sacramento, California. Gerwig became interested in the film industry in 2OO2,when she attended the San Francisco Art Institute. She got her start in 2OO6,when she starred in the film‘The Off Hours&#x27;. Her other films include Frances Ha,Mistress America,and 2Oth Century Women. In 2018, Gerwig directed Lady Bird,and received wide acclaim,a Golden Globe and Tony nomination for directing,and Oscar and BAFTA nominations for the film.</td></tr><tr><td>FactTune-FS</td><td>Greta Gerwig is an American actress and filmmaker. Born in Sacramento, California in 1983, Gerwig started acting at a young age. She is best known for starring in films such as ‘Frances Ha’ and ‘Mistress America.’Gerwig was nominated for an Oscar for Best Actress for her per- formance in ‘Lady Bird.&#x27; Gerwig has writen and directed a number of acclaimed independent films,such as‘FrancesHa’and ‘Mistress America.&#x27;</td></tr><tr><td>FactTune-MC</td><td>Greta Gerwig is an American actress and flmmaker. She was born in 1983 in Sacramento, California,and raised in Stanford, California and New York City. Gerwig has appeared in such movies as Greenberg,Frances Ha,and Jackie.She also portrayed the title role in the 2013 film of Jackie Kennedy. Her directorial debut is the 2O12 movie,Lady Bird,which was nominated for the Academy Award for Best Picture.</td></tr></table>
240
+
241
+ Table 8: Samples for writing a biography of Greta Gerwig under the SFT, FactTune-FS, FactTune-MC Llama1-7b models.
parse/test/WPZ2yPag4K/WPZ2yPag4K_content_list.json ADDED
@@ -0,0 +1,598 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "FINE-TUNING LANGUAGE MODELS FOR FACTUALITY ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Katherine Tian\\*†, Eric Mitchell\\*†, Huaxiu Yao†§, Christopher D. Manning†, Chelsea Finn† \n†Stanford University §UNC Chapel Hill \n{kattian,eric.mitchell}@cs.stanford.edu ",
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": "The fluency and creativity of large pre-trained language models (LLMs) have led to their widespread use, sometimes even as a replacement for traditional search engines. Yet language models are prone to making convincing but factually inaccurate claims, often referred to as ‘hallucinations.’ These errors can inadvertently spread misinformation or harmfully perpetuate misconceptions. Further, manual fact-checking of model responses is a time-consuming process, making human factuality labels expensive to acquire. In this work, we fine-tune language models to be more factual, without human labeling and targeting more open-ended generation settings than past work. We leverage two key recent innovations in NLP to do so. First, several recent works have proposed methods for judging the factuality of open-ended text by measuring consistency with an external knowledge base or simply a large model’s confidence scores. Second, the Direct Preference Optimization algorithm enables straightforward finetuning of language models on objectives other than supervised imitation, using a preference ranking over possible model responses. We show that learning from automatically generated factuality preference rankings, generated either through existing retrieval systems or our novel retrieval-free approach, significantly improves the factuality (percent of generated claims that are correct) of Llama-2 on held-out topics compared with RLHF or decoding strategies targeted at factuality. At 7B scale, compared to Llama-2-Chat, we observe $53 \\%$ and $50 \\%$ reduction in factual error rate when generating biographies and answering medical questions, respectively. A reference implementation can be found at https://github.com/kttian/llm_factuality_tuning. ",
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": "Recent developments in training large language models (LLMs), particularly methods that learn from rankings over responses such as reinforcement learning from human feedback (RLHF) (Christiano et al., 2017; Ziegler et al., 2020; Ouyang et al., 2022), have enabled the development of powerful, engaging dialogue agents. State-of-the-art LLMs are pre-trained on a vast amount of knowledge in large datasets (Touvron et al., 2023a;b) and further fine-tuned to apply this knowledge to follow diverse instructions or complete more specific tasks (Chung et al., 2022; Chen et al., 2021). However, despite these large language models’ exposure to diverse datasets, they are prone to confidently generating incorrect claims. One recent study shows that GPT-3.5 (ChatGPT) produces false citations more often than not when asked to provide the authors of a given study (Agrawal et al., 2023). Nonetheless, other research has demonstrated that in simple question-answering settings, large language models do exhibit systematic markers of uncertainty that indicate their factually unreliable statements (Kadavath et al., 2022; Tian et al., 2023). These results suggest that language models internally represent the limits of their knowledge, leading us to ask: Can language models be fine-tuned to leverage this internal awareness, to avoid making untrue statements in the first place? ",
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "A key source of difficulty in training factual models comes in specifying an objective that adequately captures factuality. As an example, maximum likelihood, the most common objective for pre-training language models, does not always encourage factual predictions. Consider the question “Where was Yo-Yo Ma born?” A model that continues by near-deterministically producing the text “idk, probably Paris?” is nearly always correct, but receives extremely high loss if the pre-training data contains any other response to the question. On the other hand, a model that hedges probability mass over many possible phrasings and many possible locations (including incorrect ones, like Antarctica) will likely receive much lower loss, as any response observed in the training data will be assigned at least some non-trivial probability. Because the pre-training objective may reward ‘smearing’ probability mass over many possible responses, language models may generate incorrect statements if they underfit the training data or if asked questions that require knowledge not contained in the pre-training data. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "image",
42
+ "img_path": "images/5410068e804224bc887b843d58dc7804a3e0d70426741c655e4faffc98599a7b.jpg",
43
+ "image_caption": [
44
+ "Figure 1: Our approach aims to improve the factuality of language models, specifically focusing on longform generation (e.g. writing a biography). We develop two different approaches for estimating factuality of a passage (center), each of which allows us to generate a preference dataset (right). We then fine-tune the language model to optimize these factuality preferences (far right). "
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": "In principle, reinforcement learning-based objectives can avoid the failures of existing pre-training objectives through the appropriate choice of a reward function that penalizes factually incorrect statements. However, accurately computing such a reward function can be expensive. Obtaining human labels of factuality is time-consuming and costly; Min et al. (2023) report that professional fact-checkers took approximately 9 minutes to fact-check a single model-generated biography of a well-known individual; it cost about $\\$ 2,000$ to annotate 505 biographies. ",
57
+ "page_idx": 1
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "In light of these challenges, we leverage recent advances in estimating truthfulness without human intervention: a) reference-based automated fact-checking methods that evaluate the extent to which an external knowledge base supports the claims in a piece of text (Min et al., 2023; Chern et al., 2023) and b) reference-free truthfulness evaluations that use a model’s own confidence as a proxy for truthfulness, inspired by Kuhn et al. (2023). Using these truthfulness measures and a dataset of unlabeled prompts (e.g., “Write a biography of Yo-Yo Ma.”), we sample pairs of completions from a pre-trained model and annotate them with a preference label denoting which has a lower rate of factual errors. Using the recently proposed Direct Preference Optimization (Rafailov et al., 2023) algorithm, we can stably and efficiently learn from such data. Ultimately, this pipeline enables us to fine-tune off-the-shelf language models to produce factual errors less often (with or without a reference knowledge base). See Figure 1 for an overview of our factuality tuning pipeline. ",
62
+ "page_idx": 1
63
+ },
64
+ {
65
+ "type": "text",
66
+ "text": "Our primary contribution is a straightforward approach to optimizing language models for factuality in long-form text generation without human annotation. We validate this approach on two benchmark datasets for evaluating factuality, targeted at generating biographies of popular figures and answering open-ended questions about medical conditions. We find that fine-tuning for factuality outperforms conventional RLHF and produces complementary benefits to LLM decoding strategies that aim to increase factuality. Further, we find qualitative differences in the result of learning from preference pairs scored with reference-based and reference-free truthfulness estimation. Overall, we find that learning factuality from automatically constructed preference pairs is a cost-effective way to increase model factuality without human intervention, reducing the error count for claims generated by Llama models by around $50 \\%$ or more for biographies and over $2 5 \\%$ for medical questions. ",
67
+ "page_idx": 1
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "2 PRELIMINARIES ",
72
+ "text_level": 1,
73
+ "page_idx": 1
74
+ },
75
+ {
76
+ "type": "text",
77
+ "text": "Our approach to fine-tuning directly for improved factuality uses the framework of reinforcement learning from preferences over candidate actions or responses. In this section, we provide an overview of reinforcement learning in the context of language models, as well as the specific algorithm we use for preference-based RL, direct preference optimization (Rafailov et al., 2023). ",
78
+ "page_idx": 1
79
+ },
80
+ {
81
+ "type": "text",
82
+ "text": "Fine-tuning language models with reinforcement learning. Reinforcement learning (RL) has proven to be an effective approach to fine-tuning language models to extract complex, useful behaviors from their pre-trained weights. In the context of RL, a language model policy $\\pi _ { \\theta }$ (typically an autoregressive Transformer) produces a conditional distribution $\\pi _ { \\theta } ( y \\mid x )$ over responses $y$ given an input query $x$ (both $x$ and $y$ are text sequences). The goal of reinforcement learning is to maximize the average reward of outputs generated by the policy, where a reward function $\\bar { r } ( x , y )$ assigns a scalar score to an input-output pair that determines its desirability. However, past works have observed that fine-tuning language models with an objective of unconstrained reward maximization can lead to overoptimization (Gao et al., 2022), that is, a policy that achieves high reward through exploitation of the idiosyncrasies of the reward function that are not aligned with the intended behavior. The most commonly-used objective in practice therefore combines reward maximization with a KL-divergence penalty between the language model and its initialization: ",
83
+ "page_idx": 1
84
+ },
85
+ {
86
+ "type": "text",
87
+ "text": "",
88
+ "page_idx": 2
89
+ },
90
+ {
91
+ "type": "equation",
92
+ "img_path": "images/6f95c544d4907ac4818f63eec3614cae9b5aa16fc1a0231048b4a99a9fb915ce.jpg",
93
+ "text": "$$\n\\mathop { \\operatorname* { m a x } } _ { \\pi _ { \\theta } } \\mathbb { E } _ { x \\sim \\mathcal { D } _ { p } , y \\sim \\pi _ { \\theta } ( y | x ) } \\left[ r ( x , y ) - \\beta \\log \\frac { \\pi _ { \\theta } ( y \\mid x ) } { \\pi _ { \\mathrm { r e f } } ( y \\mid x ) } \\right]\n$$",
94
+ "text_format": "latex",
95
+ "page_idx": 2
96
+ },
97
+ {
98
+ "type": "text",
99
+ "text": "where $\\mathcal { D } _ { p }$ is some dataset of prompts, $\\pi _ { \\mathrm { r e f } }$ is the reference model, usually the result of performing some supervised fine-tuning on a pre-trained model using demonstration data, and $\\beta$ is a coefficient that controls the trade-off between reward and divergence (Ouyang et al., 2022; Bai et al., 2022; Stiennon et al., 2020). Optimizing this objective aligns the model with the reward function without deviating too far from the pre-trained reference model, reducing overoptimization. In practice, the most common algorithm used to optimize this objective for language models is proximal policy optimization (PPO; Schulman et al. (2017)), although some variants exist (Ramamurthy et al., 2022; Lu et al., 2022). However, these algorithms are quite complex to implement and tune (Zheng et al., 2023) and require online sampling during training, substantially increasing training time. ",
100
+ "page_idx": 2
101
+ },
102
+ {
103
+ "type": "text",
104
+ "text": "RL from preferences with direct preference optimization (DPO). Most large language models fine-tuned with Eq. 1 optimize a reward function that is learned from a dataset of preference rankings over possible model outputs. The DPO algorithm simplifies $\\mathrm { R L }$ on language models for this special case (Rafailov et al., 2023), using a dataset of preference pairs $\\mathcal { D } = \\{ x ^ { ( i ) } , y _ { w } ^ { ( i ) } , y _ { l } ^ { ( i ) } \\} _ { i = 1 } ^ { N }$ of prompts $x$ and candidate responses $y _ { w }$ and $y _ { l }$ (typically sampled from $\\pi _ { \\mathrm { r e f } } )$ , where $y _ { w }$ is preferred over $y _ { l }$ (denoted $y _ { w } \\succ y _ { l } ,$ . The probability of observing a particular preference pair is assumed to follow a Bradley-Terry model (Bradley & Terry, 1952): ",
105
+ "page_idx": 2
106
+ },
107
+ {
108
+ "type": "equation",
109
+ "img_path": "images/0524f69ee68c26727795f3ad82bff32c54f592904d88989823a50149df9fd709.jpg",
110
+ "text": "$$\np ( y _ { w } \\succ y _ { l } ) = \\sigma ( r ( x , y _ { w } ) - r ( x , y _ { l } ) )\n$$",
111
+ "text_format": "latex",
112
+ "page_idx": 2
113
+ },
114
+ {
115
+ "type": "text",
116
+ "text": "where $\\sigma$ is the sigmoid function and $r ( x , y )$ is an unobserved reward or scoring function. Rafailov et al. (2023) show that the optimal policy $\\pi ^ { * }$ for the problem in Eq. 1 can be found by optimizing a simple classification loss computed directly on the preference data: ",
117
+ "page_idx": 2
118
+ },
119
+ {
120
+ "type": "equation",
121
+ "img_path": "images/586b762edeeeaee503fe2560937f5bf596fe94fbb3d38070ee513203dd19ce27.jpg",
122
+ "text": "$$\n\\begin{array} { r } { \\mathcal { L } _ { \\mathrm { D P O } } ( \\pi _ { \\theta } ; \\pi _ { \\mathrm { r e f } } ) = - \\mathbb { E } _ { ( x , y _ { w } , y _ { l } ) \\sim \\mathcal { D } } \\left[ \\log \\sigma \\left( \\beta \\log \\frac { \\pi _ { \\theta } ( y _ { w } \\mid x ) } { \\pi _ { \\mathrm { r e f } } ( y _ { w } \\mid x ) } - \\beta \\log \\frac { \\pi _ { \\theta } ( y _ { l } \\mid x ) } { \\pi _ { \\mathrm { r e f } } ( y _ { l } \\mid x ) } \\right) \\right] } \\end{array}\n$$",
123
+ "text_format": "latex",
124
+ "page_idx": 2
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "DPO enables learning $\\pi _ { \\theta }$ from a fixed dataset of preferences, without fitting an explicit reward function or sampling from the policy in the loop of training. These advantages make DPO an attractive choice for fine-tuning language models for objectives other than imitation. However, a challenge remains in constructing preference pairs that encourage greater factuality. ",
129
+ "page_idx": 2
130
+ },
131
+ {
132
+ "type": "text",
133
+ "text": "3 CONSTRUCTING PREFERENCES ENCOURAGING FACTUALITY INLONG-FORM TEXT",
134
+ "text_level": 1,
135
+ "page_idx": 2
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "While existing preference learning algorithms like DPO enable efficient, stable learning from objectives other than maximum likelihood, they require data in the form of preferences over possible responses to a prompt. In this section, we propose two classes of approaches to generating such preferences without human labeling effort. One class leverages existing methods to determine consistency with external reference texts as a measure of truthfulness; we propose another, which leverages calibrated model probabilities themselves as a proxy for truthfulness. For both approaches, we are computing an estimated truthfulness score over the claims in each generated response; the response with higher average truthfulness is taken as the preferred response. See Figure 2 for an overview of both procedures for truthfulness scoring. Note that truthfulness scoring is needed only at training time; at test time, we can sample from the model in the normal manner. ",
140
+ "page_idx": 2
141
+ },
142
+ {
143
+ "type": "text",
144
+ "text": "3.1 REFERENCE-BASED TRUTHFULNESS ESTIMATION ",
145
+ "text_level": 1,
146
+ "page_idx": 2
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "An intuitive approach to estimating truthfulness is by estimating the consistency of a given piece of text with a reliable reference text or knowledge base. Several recent works have introduced such evaluation criteria; for example, FactScore (Min et al., 2023) uses Wikipedia as reference knowledge, and FacTool (Chern et al., 2023) uses Google Search Results. These measures show high agreement with human judgments of factuality, making them attractive sources of truth for preference data construction. Due to the relatively consistent and high quality of Wikipedia articles, we elect to use FactScore as a representative method of reference-based truthfulness scoring. ",
151
+ "page_idx": 2
152
+ },
153
+ {
154
+ "type": "image",
155
+ "img_path": "images/ccc4d832b1e3b7e4429c9496f3b841873bdb56aa91bc7cebb8d67fb54a96253c.jpg",
156
+ "image_caption": [
157
+ "Figure 2: We estimate the factuality of a generation by first extracting claims (left) and then evaluating each claims’ truthfulness (right). For the latter, we consider: a reference-based (top right) method that uses a finetuned Llama model to check if the fact is supported by Wikipedia (Min et al., 2023) and a reference-free (bottom right) method that uses the model’s confidence in its most likely answer to estimate its truthfulness. "
158
+ ],
159
+ "image_footnote": [],
160
+ "page_idx": 3
161
+ },
162
+ {
163
+ "type": "text",
164
+ "text": "",
165
+ "page_idx": 3
166
+ },
167
+ {
168
+ "type": "text",
169
+ "text": "To evaluate a piece of text, FactScore first extracts a list of the atomic claims present in the text using GPT-3.5.1 For each atomic claim, a smaller, more efficient model such as a Llama-1-7b model (Touvron et al., 2023a) that has been fine-tuned for fact-checking is then used to perform natural language inference (MacCartney & Manning, 2008) to determine if a claim is supported by the reference text. The passage’s truthfulness score is the fraction of the extracted atomic claims that are estimated to be supported by the reference text. ",
170
+ "page_idx": 3
171
+ },
172
+ {
173
+ "type": "text",
174
+ "text": "We note that reference-based truthfulness has the key limitation that it requires access to relevant, high-quality reference texts against which to measure consistency. Such a requirement may limit applicability to domains where ground truth documents are not known and accurate retrieval is difficult, such as in niche domains or less-structured tasks. Further, reference-based truthfulness estimation requires a reliable model to determine if an atomic claim is supported by the article. In light of these limitations, we propose a reference-free approach to estimating truthfulness of open-ended text, which avoids the need for retrieving external knowledge and checking consistency. ",
175
+ "page_idx": 3
176
+ },
177
+ {
178
+ "type": "text",
179
+ "text": "3.2 REFERENCE-FREE CONFIDENCE-BASED TRUTHFULNESS ESTIMATION ",
180
+ "text_level": 1,
181
+ "page_idx": 3
182
+ },
183
+ {
184
+ "type": "text",
185
+ "text": "To eliminate the need for external knowledge, we leverage the fact that large language models are well-calibrated (Kadavath et al., 2022; Tian et al., 2023). That is, if a large language model assigns a fixed confidence $p$ to each claim in a set of claims, the fraction of these claims that is correct is $p$ . In other words, in expectation over many claims, a perfectly-calibrated model’s confidence in a claim corresponds to the probability it is correct. To use this notion of calibration, we interpret a model generation (e.g., a biography of Yo-Yo Ma) as a collection of claims, each resulting from a query to the model’s knowledge (e.g., “When was Yo-Yo Ma born?” or “How many siblings does Yo-Yo Ma have?”). Our goal is to encourage the model to produce responses containing queries to its knowledge likely to lead to correct claims. Therefore, we parse a complete model generation into its constituent queries to the model’s knowledge. For each query to the model’s knowledge present in the generation, we can estimate the likelihood it will lead to a correct claim by simply estimating the average confidence of the model’s answer to this query. If a model assigns probability 0.7 to ‘1955’ and probability 0.3 to ‘1953’ for the query “When was Yo-Yo Ma born?”, then the probability this query will lead to a correct claim (again, in expectation over queries) is $0 . 7 ^ { 2 } + 0 . { \\dot { 3 } } ^ { 2 } = 0 . 5 { \\dot { 8 } }$ . The model used for computing confidence scores essentially takes the place of the reference text datastore. We evaluate this Expected Confidence approach as well as a Max Confidence approach, which simply takes the max over the answer confidences for a given query (i.e., we assume the model produces answers greedily rather than sampling). ",
186
+ "page_idx": 3
187
+ },
188
+ {
189
+ "type": "image",
190
+ "img_path": "images/2dbe894e5993a9be7efccd8d24b194797acb848da2022e87116b3a4649747261.jpg",
191
+ "image_caption": [
192
+ "Figure 3: Factuality tuning using FactScore truthfulness scoring (FactTune-FS) produces by far the greatest improvement in factuality for the biography generation and medical question-answering problems. Factuality tuning with expected model confidence truthfulness scoring provides the next strongest performance, on average. For MedicalQA, only factuality tuning provides a strict improvement in factuality (more correct statements and fewer incorrect statements) compared to the SFT model. "
193
+ ],
194
+ "image_footnote": [],
195
+ "page_idx": 4
196
+ },
197
+ {
198
+ "type": "text",
199
+ "text": "",
200
+ "page_idx": 4
201
+ },
202
+ {
203
+ "type": "text",
204
+ "text": "More concretely, we first extract atomic claims from the text using GPT-3.5. We then use GPT-3.5 to convert each claim to a query (question) testing knowledge of the particular fact. Careful rephrasing is necessary to ensure that the rephrased question is unambiguous; for example, the claim “Yo-Yo Ma plays the cello” should be converted to the question “What instrument does Yo-Yo Ma play?” rather than just “What does Yo-Yo Ma play?” as the latter question admits answers of the wrong type. If we were to use the second prompt, a model might assign $50 \\%$ of its probability on “cello” and $50 \\%$ of its probability on “basketball.” However, the model’s low confidence is caused by the ambiguity of the question, not low confidence in the instrument that Yo-Yo Ma plays. We detail the prompts used for question generation in Appendix A.2. ",
205
+ "page_idx": 4
206
+ },
207
+ {
208
+ "type": "text",
209
+ "text": "After each claim is converted to a minimally ambiguous question, we resample an answer 20 times from the base model (e.g. Llama-1-7b) that is fine-tuned to estimate the model’s uncertainty over the answer. We use a few-shot prompt to encourage well-formed answers. We bin these answers by equivalence, using either heuristic string matching of the responses or using GPT-3.5 to assess if the answers are semantically equivalent, inspired by Kuhn et al. (2023). Our heuristic string match checks whether the words in the answer, excluding stop words, are the same. We compare these choices in Section 4.4. The score for each claim is either the expected or maximum confidence of the model’s response; we finally average this score over all claims in a given model generation. ",
210
+ "page_idx": 4
211
+ },
212
+ {
213
+ "type": "text",
214
+ "text": "3.3 FACTUALITY TUNING: PUTTING IT ALL TOGETHER ",
215
+ "text_level": 1,
216
+ "page_idx": 4
217
+ },
218
+ {
219
+ "type": "text",
220
+ "text": "Given a choice of truthfulness estimator, we can now construct a preference dataset for factuality tuning a given language model from a set of unlabeled prompts. First, we sample $n$ multiple candidate responses for each prompt from the model with simple temperature sampling with temperature 1.0 (using few-shot prompting for models that have not been fine-tuned). For each response, we then compute the truthfulness score with the chosen estimator (reference-based or reference-free). Finally, for all $\\binom { n } { 2 }$ pairs of responses to each prompt, we simply choose the response with the higher truthfulness score as the preferred response. For a set of $m$ prompts, we ultimately generate $m { \\binom { n } { 2 } } - k$ preference pairs, where $k$ is the number of pairs with equal scores. Finally, we fine-tune the model using the DPO pipeline, using all model responses as targets for the SFT stage. ",
221
+ "page_idx": 4
222
+ },
223
+ {
224
+ "type": "text",
225
+ "text": "4 EXPERIMENTS ",
226
+ "text_level": 1,
227
+ "page_idx": 4
228
+ },
229
+ {
230
+ "type": "text",
231
+ "text": "Our experiments evaluate the extent to which factuality can be learned through preference-based reinforcement learning, using the fully automated preference-generation pipeline described in Section ",
232
+ "page_idx": 4
233
+ },
234
+ {
235
+ "type": "table",
236
+ "img_path": "images/6b7f980ac2fae80a5980c1368a8cb2ab99e23e9dd734738249eb85072711e416.jpg",
237
+ "table_caption": [
238
+ "Table 1: Dataset statistics and examples. In biographies, entities are individuals; in MedicalQA, entities are medical conditions. We include 6 questions for each entity in MedicalQA and adjust the number of responses per prompt to keep the total number of pairs in the two datasets roughly similar. "
239
+ ],
240
+ "table_footnote": [],
241
+ "table_body": "<table><tr><td>Dataset</td><td>Entities [train, val, test]</td><td>Prompts per Entity</td><td>Responses per Prompt</td><td>Example prompt</td></tr><tr><td>Biographies</td><td>463[288,50,125]</td><td>16</td><td>10</td><td>Write me a paragraph biography of Mary Wolstonecraft.</td></tr><tr><td>Medical QA</td><td>295[150,45,100]</td><td></td><td>6</td><td>What are the common symptoms of a stroke?</td></tr></table>",
242
+ "page_idx": 5
243
+ },
244
+ {
245
+ "type": "text",
246
+ "text": "3. We call the model fine-tuned with our reference-based metric FactTune-FS and the model finetuned with our model confidence-based score, which is completely reference-free, FactTune-MC. For all of our experiments, samples for model confidence are taken from Llama-1-7b. ",
247
+ "page_idx": 5
248
+ },
249
+ {
250
+ "type": "text",
251
+ "text": "Datasets. We conduct our experiments on two tasks: generating biographies and medical questionanswering. For biographies, we generated a dataset consisting of 463 diverse well-known individuals (288 train, 50 val, 125 test) with 10 short-paragraph biographies each. For medical question answering, we used a dataset of 295 diverse common medical conditions (150 train, 45 val, 100 test) with 6 questions about each condition and 6 short-paragraph answers per question. The test set just uses 1 question per condition. The prompts were generated with GPT-3.5, and the answers were sampled from Llama-1-7b using a few-shot prompt for each dataset. We found that our procedure consistently resulted in well-formed and informative responses, albeit with possible factual errors. Because FactScore uses retrieval against a given Wikipedia article, we generate data based on individuals and medical conditions that have Wikipedia pages. See Table 1 for the summary stats and examples from our datasets. ",
252
+ "page_idx": 5
253
+ },
254
+ {
255
+ "type": "text",
256
+ "text": "Baselines. We compare factuality tuning with inference-time intervention (Li et al., 2023, ITI) and decoding by contrasting layers (Chuang et al., 2023, DOLA), applied to the SFT model for each task. For ITI, we supervise the training of the linear probes with FactScore labels: we take batches of atomic facts extracted from the training samples and bias the models’ activations from the incorrect to correct atomic facts to determine the direction of the intervention. In the case of Llama-2, we also compare against ‘standard’ RLHF with human preference labels (Touvron et al., 2023b). ",
257
+ "page_idx": 5
258
+ },
259
+ {
260
+ "type": "text",
261
+ "text": "Evaluation. To evaluate each generated response, we follow the FactScore procedure to extract the number of correct and incorrect facts. Then, to check that the model responses are still relevant and helpful after actuality fine-tuning, we also use GPT-3.5 to determine whether each fact is relevant to the question or not (using the prompt in Appendix A.2). For biographies, we observed that essentially $100 \\%$ of facts were relevant to the individual, so we skip the relevance computation to save costs. For each dataset, we report the number of correct and relevant facts (# Correct), the number of inaccuracies (# Incorrect), and the proportion of correct relevant facts out of the total number of extracted facts ( $\\%$ Correct). Note that the total number of facts may vary between generations. We validate our evaluation metrics in Sec. A.1. ",
262
+ "page_idx": 5
263
+ },
264
+ {
265
+ "type": "text",
266
+ "text": "4.1 FINE-TUNING FOR FACTUALITY ACROSS DOMAINS ",
267
+ "text_level": 1,
268
+ "page_idx": 5
269
+ },
270
+ {
271
+ "type": "text",
272
+ "text": "In this section, we apply our methodology for learning factuality to Llama-1-7b and Llama-2-7b in multiple domains. We show the results in Table 2. Learning from reference-based factualityscored pairs (FactTune-FS) consistently improves factual accuracy compared to RLHF models and decoding-based factuality baselines by at least $11 \\%$ on biographies and $13 \\%$ on medical questionanswering. FactTune-FS reduces the number of factual errors and maintains no more than a slight decrease, if not increase, in the amount of correct information generated. Factuality tuning from model-confidence scores (FactTune-MC, FactTune-EC) also reduces error rate and improves the factuality of RLHF models on both datasets, without any external reference information. ",
273
+ "page_idx": 5
274
+ },
275
+ {
276
+ "type": "text",
277
+ "text": "4.2 FINE-TUNING CHAT MODELS FOR FACTUALITY ",
278
+ "text_level": 1,
279
+ "page_idx": 5
280
+ },
281
+ {
282
+ "type": "text",
283
+ "text": "Most widely used practical chatbots today are LMs trained with RLHF to follow diverse instructions in a way that is helpful to users. In this section, we investigate the ability of our human-free factuality tuning method to improve the factuality of RLHF chat models. Using Llama-2-7b-Chat, we find that fine-tuning an RLHF LM with both factuality and semantic entropy-based rewards can further improve its factuality without significantly decreasing the total number of facts, as shown in Table 3. ",
284
+ "page_idx": 5
285
+ },
286
+ {
287
+ "type": "table",
288
+ "img_path": "images/f5e36c05b40d0e0c4b846676e520c0e727eb64bac8228a0b104e1f9c34763325.jpg",
289
+ "table_caption": [
290
+ "Table 2: Factuality tuning from reference-based factuality-scored pairs (FactTune-FS) improves factual accuracy compared to RLHF models and decoding-based factuality baselines, consistently reducing the number of errors and often increasing the number of correct facts generated. Factuality tuning from model confidence scored pairs (FactTune-MC, FactTune-EC) also outperforms RLHF models, providing a strong reference-free alternative for improving factuality and reducing error. "
291
+ ],
292
+ "table_footnote": [],
293
+ "table_body": "<table><tr><td></td><td></td><td colspan=\"3\">Biographies</td><td colspan=\"3\">Medical QA</td></tr><tr><td>Base Model</td><td>Method</td><td># Correct</td><td># Incorrect</td><td>% Correct</td><td># Correct</td><td># Incorrect</td><td>% Correct</td></tr><tr><td rowspan=\"6\">Llama-1</td><td>ITI</td><td>13.68</td><td>5.24</td><td>0.730</td><td>10.25</td><td>7.96</td><td>0.538</td></tr><tr><td>DOLA</td><td>12.44</td><td>4.74</td><td>0.737</td><td>9.22</td><td>5.58</td><td>0.640</td></tr><tr><td>SFT</td><td>13.54</td><td>6.54</td><td>0.696</td><td>9.96</td><td>6.86</td><td>0.600</td></tr><tr><td>FactTune-FS (Ours)</td><td>14.51</td><td>3.74</td><td>0.812</td><td>12.60</td><td>4.18</td><td>0.746</td></tr><tr><td>FactTune-MC (Ours)</td><td>9.74</td><td>2.42</td><td>0.819</td><td>11.51</td><td>5.56</td><td>0.668</td></tr><tr><td>FactTune-EC (Ours)</td><td>10.84</td><td>3.28</td><td>0.790</td><td>11.52</td><td>6.56</td><td>0.641</td></tr><tr><td rowspan=\"7\">Llama-2</td><td>ITI</td><td>13.30</td><td>5.56</td><td>0.712</td><td>9.40</td><td>4.25</td><td>0.690</td></tr><tr><td>DOLA</td><td>13.25</td><td>6.50</td><td>0.684</td><td>9.87</td><td>6.06</td><td>0.627</td></tr><tr><td>Chat</td><td>21.41</td><td>6.30</td><td>0.774</td><td>9.61</td><td>6.69</td><td>0.619</td></tr><tr><td>SFT</td><td>13.47</td><td>6.49</td><td>0.687</td><td>10.68</td><td>6.22</td><td>0.627</td></tr><tr><td>FactTune-FS (Ours)</td><td>19.32</td><td>2.76</td><td>0.880</td><td>13.29</td><td>2.97</td><td>0.809</td></tr><tr><td>FactTune-MC (Ours)</td><td>11.74</td><td>3.51</td><td>0.783</td><td>12.94</td><td>5.26</td><td>0.706</td></tr><tr><td>FactTune-EC (Ours)</td><td>12.68</td><td>3.69</td><td>0.797</td><td>12.80</td><td>5.19</td><td>0.710</td></tr></table>",
294
+ "page_idx": 6
295
+ },
296
+ {
297
+ "type": "table",
298
+ "img_path": "images/9ac1e349973f0b03c90bdc9d19558eda934e0b6813998b2a344faba0cb247eed.jpg",
299
+ "table_caption": [],
300
+ "table_footnote": [
301
+ "Table 3: Factuality tuning a dialogue model (Llama-2-Chat) with FactScore, model confidence-based truthfulness estimation, and FactScore-based preferences from a different dataset (FactTune-FS, FactTune-MC, OOD FactTune-FS) further improves its factual accuracy more than a baseline method for factuality, DOLA. "
302
+ ],
303
+ "table_body": "<table><tr><td></td><td></td><td colspan=\"3\">Biographies</td><td colspan=\"3\">Medical QA</td></tr><tr><td>Base Model</td><td>Method</td><td># Correct</td><td># Incorrect</td><td>% Correct</td><td># Correct</td><td># Incorrect</td><td>% Correct</td></tr><tr><td></td><td></td><td>21.41</td><td>6.30</td><td>0.774</td><td>9.61</td><td>6.69</td><td>0.619</td></tr><tr><td></td><td>DOLA</td><td>22.25</td><td>5.81</td><td>0.793</td><td>11.45</td><td>6.74</td><td>0.624</td></tr><tr><td>Llama-2-Chat</td><td>FactTune-FS (Ours)</td><td>20.02</td><td>4.38</td><td>0.821</td><td>11.94</td><td>6.21</td><td>0.667</td></tr><tr><td></td><td>FactTune-MC (Ours)</td><td>19.12</td><td>4.97</td><td>0.795</td><td>12.61</td><td>7.21</td><td>0.627</td></tr><tr><td></td><td>FactTune-EC (Ours)</td><td>18.77</td><td>5.13</td><td>0.784</td><td>11.51</td><td>6.40</td><td>0.639</td></tr><tr><td></td><td>OOD FactTune-FS (ours)</td><td>21.06</td><td>5.45</td><td>0.796</td><td>11.56</td><td>6.66</td><td>0.635</td></tr></table>",
304
+ "page_idx": 6
305
+ },
306
+ {
307
+ "type": "text",
308
+ "text": "In other words, factuality tuning can be composed with RLHF to further improve the factuality of chat models. ",
309
+ "text_level": 1,
310
+ "page_idx": 6
311
+ },
312
+ {
313
+ "type": "text",
314
+ "text": "While our quantitative metrics demonstrate a clear increase in factual accuracy, we also investigate how factuality fine-tuning impacts other aspects of model performance and generalizes. Using GPT4 as a judge, we find that FactTune-MC and FactTune-EC can improve both factuality and fluency compared to the SFT model (examples in Appendix Table 8). GPT-4 chooses FactTuneEC as more fluent than SFT on $80 \\%$ of samples, FactTune-MC on $7 5 \\%$ of samples, ITI on $57 \\%$ of samples, FactTune-FS on $33 \\%$ of samples, and DOLA on $16 \\%$ of samples $\\scriptstyle ( \\mathrm { n = 1 0 0 }$ ). ",
315
+ "page_idx": 6
316
+ },
317
+ {
318
+ "type": "text",
319
+ "text": "Lastly, we find that fine-tuning for factuality generalizes across datasets. Fine-tuning Llama-2- 7b-Chat on biographies to evaluate on MedicalQA and vice versa (OOD FactTune-FS) improves the factuality more than RLHF (Table 3). ",
320
+ "page_idx": 6
321
+ },
322
+ {
323
+ "type": "text",
324
+ "text": "4.3 COMPLEMENTARY BENEFITS OF FACTUALITY TUNING AND DECODING-TIME FACTUALITY INTERVENTIONS ",
325
+ "page_idx": 6
326
+ },
327
+ {
328
+ "type": "text",
329
+ "text": "Besides fine-tuning for factuality, multiple existing works aim to improve LLM factuality through inference time interventions to either the decoding process or the model parameters themselves. We explore the possibility of applying both of these types of methods together, i.e., using factualityboosting decoding methods on a model fine-tuned with our factuality tuning procedure. In Table 4 we present the results of stacking both approaches. We find that in most cases, DOLA can even further increase the accuracy of factuality fine-tuned models, with one exception for Llama-2 on the biography task. While not a comprehensive evaluation of combining methods for improving factuality, this result suggests that different approaches to enhancing factuality may operate through complementary mechanisms. ",
330
+ "page_idx": 6
331
+ },
332
+ {
333
+ "type": "table",
334
+ "img_path": "images/fe22d6772f7ba1cecd755a13a9152870d08ea92a57ab203edc7a47962387600a.jpg",
335
+ "table_caption": [
336
+ "Table 4: DOLA factuality decoding frequently composes with factuality fine-tuning, providing an increase in average correctness for the majority of combinations of model and dataset. "
337
+ ],
338
+ "table_footnote": [],
339
+ "table_body": "<table><tr><td></td><td></td><td colspan=\"3\">Biographies</td><td colspan=\"3\">Medical QA</td></tr><tr><td>Base Model</td><td>Method</td><td>#Correct</td><td>#Incorrect</td><td>%Correct</td><td>#Correct</td><td>#Incorrect</td><td>%Correct</td></tr><tr><td rowspan=\"2\">Llama-1</td><td></td><td></td><td>3.74</td><td></td><td>12.0</td><td>418</td><td>0.746</td></tr><tr><td>FactTune-FS + DOLA</td><td>1451</td><td></td><td>0.812</td><td></td><td></td><td></td></tr><tr><td rowspan=\"2\">Llama-2</td><td></td><td>19.32</td><td>2.76</td><td>0.880</td><td>13.29</td><td></td><td></td></tr><tr><td>FactTune-FS + DOLA</td><td></td><td></td><td></td><td></td><td>2.7</td><td>0.89</td></tr></table>",
340
+ "page_idx": 7
341
+ },
342
+ {
343
+ "type": "table",
344
+ "img_path": "images/cdbf6180dd0ff7791cd494f6d64df452297fbc4839b262618a12abea7d09ba38.jpg",
345
+ "table_caption": [],
346
+ "table_footnote": [
347
+ "Table 5: On Llama-1, model confidence-based preference construction with atomic question extraction outperforms the version with entity extraction. "
348
+ ],
349
+ "table_body": "<table><tr><td></td><td></td><td></td><td colspan=\"3\">Biographies</td><td colspan=\"3\">Medical QA</td></tr><tr><td>Fact Ext.</td><td>Equiv</td><td>Metric</td><td>#Correct</td><td>#Incorrect</td><td>%Correct</td><td>#Correct</td><td>#Incorrect</td><td>%Correct</td></tr><tr><td rowspan=\"2\">Atomic</td><td rowspan=\"2\">Heuristic</td><td>Max Con Conf</td><td>9.74</td><td>22</td><td></td><td></td><td>5.56</td><td>0.668</td></tr><tr><td></td><td></td><td></td><td>0.819</td><td>11.51</td><td></td><td></td></tr><tr><td rowspan=\"2\">Entity</td><td rowspan=\"2\">Heuristic</td><td></td><td>12.2</td><td></td><td>0.74</td><td>10.3</td><td></td><td></td></tr><tr><td>Mx Co Conf</td><td></td><td>4.74</td><td></td><td></td><td>64</td><td>0.603</td></tr></table>",
350
+ "page_idx": 7
351
+ },
352
+ {
353
+ "type": "text",
354
+ "text": "4.4 IMPACT OF DESIGN DECISIONS OF OPEN-ENDED MODEL CONFIDENCE SCORING ",
355
+ "text_level": 1,
356
+ "page_idx": 7
357
+ },
358
+ {
359
+ "type": "text",
360
+ "text": "This section discusses the impacts of different design choices for the steps of our reference-free truthfulness score construction for factuality tuning: how to perform fact extraction and what confidence metric to use. ",
361
+ "page_idx": 7
362
+ },
363
+ {
364
+ "type": "text",
365
+ "text": "The first step is to extract the individual facts from the long-form response and re-sample each fact from the base model to assess the model’s confidence in the fact. For the fact-extraction and resampling procedure, one approach (Atomic) is to convert each extracted atomic fact into a corresponding ‘atomic question’ with a few-shot prompt query to GPT-3.5, then sample answers to each question from the base LLM. Another approach (Entity) extracts entities from the response via nltk and re-samples the extracted entity in-line. Atomic question extraction has the potential to be more comprehensive and precise, while named entity extraction is a less expensive proxy that doesn’t use closed models. In Table 5, we observe that atomic question extraction outperforms named entity extraction, although the difference in accuracy is smaller on Medical QA than on Biographies. ",
366
+ "page_idx": 7
367
+ },
368
+ {
369
+ "type": "text",
370
+ "text": "After re-sampling the fact, we study the choice of confidence metric between taking the model’s confidence based on the most common sample (Max Conf) or the confidence of the fact from the original response (Expected Conf). To compute Max Conf for both atomic and entity extraction, we bin the samples into equivalence classes of distinct responses using a string matching heuristic described in Section 3.2 and take the proportion of samples in the largest bin. For computing Expected Confidence, we first perform the same answer binning procedure as for Max Confidence, resulting in $k$ bins and confidences $p _ { 1 } , \\ldots , p _ { k }$ , and take $\\textstyle E C = \\sum _ { i = 1 } ^ { k } p _ { i } ^ { 2 }$ . The results in Table 5 show that the performance of Max Conf versus Expected Conf varies but are quite similar. ",
371
+ "page_idx": 7
372
+ },
373
+ {
374
+ "type": "text",
375
+ "text": "5 RELATED WORK ",
376
+ "text_level": 1,
377
+ "page_idx": 7
378
+ },
379
+ {
380
+ "type": "text",
381
+ "text": "Many works have identified reducing factual errors (sometimes called ‘hallucinations’) as a key challenge for building more reliable language models (Lewis et al., 2020; Kadavath et al., 2022; Zhang et al., 2023), even for the most powerful language models (Bubeck et al., 2023). Other use of the term ‘hallucination’ refers to summarization or translation system outputs not supported by the reference text (Maynez et al., 2020; Zhang et al., 2020) even if they are factual (Cao et al., 2022). Other work uses ‘hallucination’ to describe vision-language models producing outputs not grounded in a visual input, e.g., a captioning system describing an object that doesn’t exist in the image (Rohrbach et al., 2018). In our case, we focus on statements that are factually incorrect (or, inconsistent with a set of ‘authoritative’ texts, such as Wikipedia). ",
382
+ "page_idx": 7
383
+ },
384
+ {
385
+ "type": "text",
386
+ "text": "Several works describe methods for detecting likely factual errors through sensitivity to perturbations in the prompt (Xu et al., 2023), high diversity of responses under resampling (Kadavath et al., 2022; Mundler et al. ¨ , 2023; Kuhn et al., 2023; Manakul et al., 2023), or inconsistency with external knowledge sources (Min et al., 2023; Chern et al., 2023), or properties of internal activations (Azaria & Mitchell, 2023). Others go beyond detecting errors, correcting them after they have been generated (Peng et al., 2023; Gao et al., 2023; Dhuliawala et al., 2023). These approaches typically rely on retrieving relevant data from a trusted knowledge base and use another LLM to verify consistency; however, retrieval-based methods face key challenges, namely reliable resolution of conflicts between parametric and retrieved knowledge (Longpre et al., 2022; Chen et al., 2022) as well as maintaining improvements in factuality as model size increases (Mallen et al., 2023). Further, retrieval-based methods add significant system complexity; the most common open-source consumer language models thus use purely parametric models (Touvron et al., 2023a). The FactScore variant of our approach uses retrieval only during training, avoiding inference time complexity. In principle, any existing criterion could be used to generate preferences (see ;¸ we aim to show that even choosing relatively simple criteria leads to substantial improvements in factuality. ",
387
+ "page_idx": 7
388
+ },
389
+ {
390
+ "type": "text",
391
+ "text": "",
392
+ "page_idx": 8
393
+ },
394
+ {
395
+ "type": "text",
396
+ "text": "Most similar to ours, some approaches attempt to prevent the generation of factual errors in the first place, using prompting strategies (Si et al., 2023) or perturbing the internal representations of the model (Chuang et al., 2023; Li et al., 2023). Unlike using a fixed heuristic for identifying an internal ‘factuality’ dimension, we optimize directly for the end goal of generating factual statements, which we find shows a greater improvement in factuality. Finally, while most past work has focused on short-form NLG tasks like short-form question-answering (Kadavath et al., 2022), we explore ways to measure model confidence over factual information in long-form, unstructured text and estimate truthfulness in a reference-free manner (i.e., don’t require any external knowledge base or annotations). ",
397
+ "page_idx": 8
398
+ },
399
+ {
400
+ "type": "text",
401
+ "text": "6 CONCLUSION ",
402
+ "text_level": 1,
403
+ "page_idx": 8
404
+ },
405
+ {
406
+ "type": "text",
407
+ "text": "In this paper, we show a practical, effective strategy to improve a language model’s ability to generate factual content, specifically focusing on long-form generations. We develop and study two different approaches to estimating the truthfulness of long-form text and optimize for these criteria using preference-based learning. In addition to existing reference-based truthfulness estimators that leverage external knowledge to establish the truth of a particular statement, we introduce a novel reference-free procedure for estimating truthfulness that uses the language model’s own uncertainty as an indication of factuality. Our experiments show that fine-tuning a language model with either criterion reliably reduces the number of incorrect facts (i.e. hallucinations) that the model generates. Reference-free approaches like the one we introduced provide a scalable self-supervision strategy to improve factuality, eliminating the need for a reference corpus of ‘gold’ texts. ",
408
+ "page_idx": 8
409
+ },
410
+ {
411
+ "type": "text",
412
+ "text": "The experimental results suggest a number of avenues for future work. First, because of the limited research and thus the limited benchmarks on the factuality of long-form language model generations, we proposed two new tasks to benchmark our approach. These tasks are representative of but do not fully cover the range of scenarios where we would hope to improve factuality. Furthermore, our experiments provide evidence for improving the factuality of dialogue models that are already finetuned with RLHF, but still leave open the question of how best to combine typical RLHF rewards and approaches with factuality rankings. Similarly, exploring additional ways to combine factuality tuning with existing methods for improving factuality, such as in our factuality tuning $+ { \\mathrm { ~ D O L A } }$ experiment, may be a fruitful direction for future research. Further, future work might explore alternative approaches to constructing factuality preferences, such as using self-correction (Pan et al., 2023). Finally, we explore only 7B models in this work. Scaling up our factuality tuning recipe to larger models (and larger preference datasets) may reduce hallucinations even further. ",
413
+ "page_idx": 8
414
+ },
415
+ {
416
+ "type": "text",
417
+ "text": "ACKNOWLEDGEMENTS ",
418
+ "text_level": 1,
419
+ "page_idx": 8
420
+ },
421
+ {
422
+ "type": "text",
423
+ "text": "EM gratefully acknowledges funding from a Knight-Hennessy graduate fellowship and a Stanford Accelerator for Generative AI and Education grant. CF and CDM are CIFAR Fellows. ",
424
+ "page_idx": 8
425
+ },
426
+ {
427
+ "type": "text",
428
+ "text": "Reproducibility Statement. We explain the steps of our fine-tuning method in Section 3. In Section 4.1, we provide details on the dataset (dataset statistics, how it was generated, and examples), as well as how the evaluation is completed and how we implemented the baselines. In the experiment subsections and captions, we provide additional implementation or reporting details. In the appendix, we provide the exact GPT-3.5 prompts used for the extraction steps of our reference-free scoring method. A codebase with instructions for factuality scoring, training, and evaluation can be found here: https://github.com/kttian/llm_factuality_tuning. ",
429
+ "page_idx": 8
430
+ },
431
+ {
432
+ "type": "text",
433
+ "text": "REFERENCES ",
434
+ "text_level": 1,
435
+ "page_idx": 9
436
+ },
437
+ {
438
+ "type": "text",
439
+ "text": "Ayush Agrawal, Mirac Suzgun, Lester Mackey, and Adam Tauman Kalai. Do language models know when they’re hallucinating references?, 2023. arXiv preprint arxiv:2305.18248. 1 ",
440
+ "page_idx": 9
441
+ },
442
+ {
443
+ "type": "text",
444
+ "text": "Amos Azaria and Tom Mitchell. The internal state of an LLM knows when its lying, 2023. arXiv preprint arxiv:2304.13734. 9 ",
445
+ "page_idx": 9
446
+ },
447
+ {
448
+ "type": "text",
449
+ "text": "Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, Nicholas Joseph, Saurav Kadavath, Jackson Kernion, Tom Conerly, Sheer El-Showk, Nelson Elhage, Zac Hatfield-Dodds, Danny Hernandez, Tristan Hume, Scott Johnston, Shauna Kravec, Liane Lovitt, Neel Nanda, Catherine Olsson, Dario Amodei, Tom Brown, Jack Clark, Sam McCandlish, Chris Olah, Ben Mann, and Jared Kaplan. Training a helpful and harmless assistant with reinforcement learning from human feedback, 2022. arXiv preprint arxiv:2204.05862. 3 ",
450
+ "page_idx": 9
451
+ },
452
+ {
453
+ "type": "text",
454
+ "text": "Ralph Allan Bradley and Milton E Terry. Rank analysis of incomplete block designs: I. the method of paired comparisons. Biometrika, 39(3/4):324–345, 1952. 3 ",
455
+ "page_idx": 9
456
+ },
457
+ {
458
+ "type": "text",
459
+ "text": "Sebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece ´ Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, Harsha Nori, Hamid Palangi, Marco Tulio Ribeiro, and Yi Zhang. Sparks of artificial general intelligence: Early experiments with GPT-4, 2023. arXiv preprint arxiv:2303.12712. 8 ",
460
+ "page_idx": 9
461
+ },
462
+ {
463
+ "type": "text",
464
+ "text": "Meng Cao, Yue Dong, and Jackie Cheung. Hallucinated but factual! inspecting the factuality of hallucinations in abstractive summarization. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 3340–3354, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long. 236. URL https://aclanthology.org/2022.acl-long.236. 8 ",
465
+ "page_idx": 9
466
+ },
467
+ {
468
+ "type": "text",
469
+ "text": "Hung-Ting Chen, Michael Zhang, and Eunsol Choi. Rich knowledge sources bring complex knowledge conflicts: Recalibrating models to reflect conflicting evidence. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pp. 2292–2307, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.emnlp-main.146. URL https://aclanthology.org/2022. emnlp-main.146. 9 ",
470
+ "page_idx": 9
471
+ },
472
+ {
473
+ "type": "text",
474
+ "text": "Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde, Jared Kaplan, Harrison Edwards, Yura Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, David W. Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William H. Guss, Alex Nichol, Igor Babuschkin, S. Arun Balaji, Shantanu Jain, Andrew Carr, Jan Leike, Joshua Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew M. Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code. ArXiv, abs/2107.03374, 2021. URL https://api.semanticscholar.org/CorpusID:235755472. 1 ",
475
+ "page_idx": 9
476
+ },
477
+ {
478
+ "type": "text",
479
+ "text": "I-Chun Chern, Steffi Chern, Shiqi Chen, Weizhe Yuan, Kehua Feng, Chunting Zhou, Junxian He, Graham Neubig, and Pengfei Liu. FacTool: Factuality detection in generative ai – a tool augmented framework for multi-task and multi-domain scenarios, 2023. arXiv preprint arxiv:2307.13528. 2, 4, 9 ",
480
+ "page_idx": 9
481
+ },
482
+ {
483
+ "type": "text",
484
+ "text": "Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. In I. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper_files/paper/2017/ file/d5e2c0adad503c91f91df240d0cd4e49-Paper.pdf. 1 ",
485
+ "page_idx": 9
486
+ },
487
+ {
488
+ "type": "text",
489
+ "text": "Yung-Sung Chuang, Yujia Xie, Hongyin Luo, Yoon Kim, James Glass, and Pengcheng He. DoLa: Decoding by contrasting layers improves factuality in large language models, 2023. arXiv preprint arxiv:2309.03883. 6, 9 ",
490
+ "page_idx": 10
491
+ },
492
+ {
493
+ "type": "text",
494
+ "text": "Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Yunxuan Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Alex Castro-Ros, Marie Pellat, Kevin Robinson, Dasha Valter, Sharan Narang, Gaurav Mishra, Adams Yu, Vincent Zhao, Yanping Huang, Andrew Dai, Hongkun Yu, Slav Petrov, Ed H. Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V. Le, and Jason Wei. Scaling instruction-finetuned language models, 2022. 1 Shehzaad Dhuliawala, Mojtaba Komeili, Jing Xu, Roberta Raileanu, Xian Li, Asli Celikyilmaz, and Jason Weston. Chain-of-verification reduces hallucination in large language models, 2023. 9 Leo Gao, John Schulman, and Jacob Hilton. Scaling laws for reward model overoptimization, 2022. \n3, 14 Luyu Gao, Zhuyun Dai, Panupong Pasupat, Anthony Chen, Arun Tejasvi Chaganty, Yicheng Fan, Vincent Y. Zhao, Ni Lao, Hongrae Lee, Da-Cheng Juan, and Kelvin Guu. Rarr: Researching and revising what language models say, using language models, 2023. 9 Saurav Kadavath, Tom Conerly, Amanda Askell, Tom Henighan, Dawn Drain, Ethan Perez, Nicholas Schiefer, Zac Hatfield-Dodds, Nova DasSarma, Eli Tran-Johnson, Scott Johnston, Sheer El-Showk, Andy Jones, Nelson Elhage, Tristan Hume, Anna Chen, Yuntao Bai, Sam Bowman, Stanislav Fort, Deep Ganguli, Danny Hernandez, Josh Jacobson, Jackson Kernion, Shauna Kravec, Liane Lovitt, Kamal Ndousse, Catherine Olsson, Sam Ringer, Dario Amodei, Tom Brown, Jack Clark, Nicholas Joseph, Ben Mann, Sam McCandlish, Chris Olah, and Jared Kaplan. Language models (mostly) know what they know, 2022. URL http://arxiv.org/ abs/2207.05221. Arxiv arxiv:2207.05221. 1, 4, 8, 9 Lorenz Kuhn, Yarin Gal, and Sebastian Farquhar. Semantic uncertainty: Linguistic invariances for uncertainty estimation in natural language generation, 2023. 2, 5, 8 Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Rockt ¨ aschel, Sebastian Riedel, ¨ and Douwe Kiela. Retrieval-augmented generation for knowledge-intensive NLP tasks. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 9459–9474. Curran Associates, Inc., \n2020. URL https://proceedings.neurips.cc/paper_files/paper/2020/ file/6b493230205f780e1bc26945df7481e5-Paper.pdf. 8 Kenneth Li, Oam Patel, Fernanda Viegas, Hanspeter Pfister, and Martin Wattenberg. Inference-time ´ intervention: Eliciting truthful answers from a language model, 2023. 6, 9 Shayne Longpre, Kartik Perisetla, Anthony Chen, Nikhil Ramesh, Chris DuBois, and Sameer Singh. Entity-based knowledge conflicts in question answering, 2022. 9 Ximing Lu, Sean Welleck, Jack Hessel, Liwei Jiang, Lianhui Qin, Peter West, Prithviraj Ammanabrolu, and Yejin Choi. QUARK: Controllable text generation with reinforced unlearning. 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= \n5HaIds3ux5O. 3 Bill MacCartney and Christopher D. Manning. Modeling semantic containment and exclusion in natural language inference. In Proceedings of the 22nd International Conference on Computational Linguistics (Coling 2008), pp. 521–528, Manchester, UK, August 2008. Coling 2008 Organizing Committee. URL http://www.aclweb.org/anthology/C08-1066. 4 Alex Mallen, Akari Asai, Victor Zhong, Rajarshi Das, Daniel Khashabi, and Hannaneh Hajishirzi. When not to trust language models: Investigating effectiveness of parametric and non-parametric memories. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 9802–9822, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.546. URL https://aclanthology.org/2023.acl-long.546. 9 \nPotsawee Manakul, Adian Liusie, and Mark J. F. Gales. Selfcheckgpt: Zero-resource black-box hallucination detection for generative large language models, 2023. 8 \nJoshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. On faithfulness and factuality in abstractive summarization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 1906–1919, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.173. URL https://aclanthology.org/ 2020.acl-main.173. 8 \nSewon Min, Kalpesh Krishna, Xinxi Lyu, Mike Lewis, Wen tau Yih, Pang Wei Koh, Mohit Iyyer, Luke Zettlemoyer, and Hannaneh Hajishirzi. Factscore: Fine-grained atomic evaluation of factual precision in long form text generation, 2023. 2, 4, 9, 14 \nNiels Mundler, Jingxuan He, Slobodan Jenko, and Martin Vechev. Self-contradictory hallucinations ¨ of large language models: Evaluation, detection and mitigation, 2023. 8 \nLong Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback, 2022. 1, 3 \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, 2023. 9 \nBaolin Peng, Michel Galley, Pengcheng He, Hao Cheng, Yujia Xie, Yu Hu, Qiuyuan Huang, Lars Liden, Zhou Yu, Weizhu Chen, and Jianfeng Gao. Check your facts and try again: Improving large language models with external knowledge and automated feedback, 2023. 9 \nRafael Rafailov, Archit Sharma, Eric Mitchell, Stefano Ermon, Christopher D. Manning, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model, 2023. 2, 3 \nRajkumar Ramamurthy, Prithviraj Ammanabrolu, Kiante Brantley, Jack Hessel, Rafet Sifa, Chris- ´ tian Bauckhage, Hannaneh Hajishirzi, and Yejin Choi. Is reinforcement learning (not) for natural language processing: Benchmarks, baselines, and building blocks for natural language policy optimization. In International Conference on Learning Representations (ICLR 2023), 2022. URL https://arxiv.org/abs/2210.01241. 3 \nAnna Rohrbach, Lisa Anne Hendricks, Kaylee Burns, Trevor Darrell, and Kate Saenko. Object hallucination in image captioning. In Ellen Riloff, David Chiang, Julia Hockenmaier, and Jun’ichi Tsujii (eds.), Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 4035–4045, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1437. URL https://aclanthology.org/ D18-1437. 8 \nJohn Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms, 2017. 3 \nChenglei Si, Zhe Gan, Zhengyuan Yang, Shuohang Wang, Jianfeng Wang, Jordan Boyd-Graber, and Lijuan Wang. Prompting gpt-3 to be reliable, 2023. 9 \nNisan Stiennon, Long Ouyang, Jeff Wu, Daniel M. Ziegler, Ryan Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul Christiano. Learning to summarize from human feedback. Neural Information Processing Systems, 18, 2020. 3 \nKatherine Tian, Eric Mitchell, Allan Zhou, Archit Sharma, Rafael Rafailov, Huaxiu Yao, Chelsea Finn, and Christopher D. Manning. Just ask for calibration: Strategies for eliciting calibrated confidence scores from language models fine-tuned with human feedback, 2023. 1, 4 \nHugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee´ Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Ar- \\` mand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models, 2023a. 1, 4, 9 \nHugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and fine-tuned chat models, 2023b. 1, 6 \nWeijia Xu, Sweta Agrawal, Eleftheria Briakou, Marianna J. Martindale, and Marine Carpuat. Understanding and Detecting Hallucinations in Neural Machine Translation via Model Introspection. Transactions of the Association for Computational Linguistics, 11:546–564, 06 2023. ISSN 2307- 387X. doi: 10.1162/tacl a 00563. URL https://doi.org/10.1162/tacl_a_00563. 8 \nMuru Zhang, Ofir Press, William Merrill, Alisa Liu, and Noah A Smith. How language model hallucinations can snowball. arXiv preprint arXiv:2305.13534, 2023. 8 \nYuhao Zhang, Derek Merck, Emily Tsai, Christopher D Manning, and Curtis Langlotz. Optimizing the factual correctness of a summary: A study of summarizing radiology reports. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics (ACL), 2020. URL https://arxiv.org/pdf/1911.02541.pdf. 8 \nRui Zheng, Shihan Dou, Songyang Gao, Yuan Hua, Wei Shen, Binghai Wang, Yan Liu, Senjie Jin, Qin Liu, Yuhao Zhou, Limao Xiong, Lu Chen, Zhiheng Xi, Nuo Xu, Wenbin Lai, Minghao Zhu, Cheng Chang, Zhangyue Yin, Rongxiang Weng, Wensen Cheng, Haoran Huang, Tianxiang Sun, Hang Yan, Tao Gui, Qi Zhang, Xipeng Qiu, and Xuanjing Huang. Secrets of RLHF in large language models part I: PPO, 2023. 3 \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, 2020. 1 ",
495
+ "page_idx": 10
496
+ },
497
+ {
498
+ "type": "text",
499
+ "text": "",
500
+ "page_idx": 11
501
+ },
502
+ {
503
+ "type": "text",
504
+ "text": "",
505
+ "page_idx": 12
506
+ },
507
+ {
508
+ "type": "table",
509
+ "img_path": "images/033e71e49af60b2f755d88d1da18a6336988e2e905d459e9a90dfbcf980ba8c3.jpg",
510
+ "table_caption": [],
511
+ "table_footnote": [],
512
+ "table_body": "<table><tr><td>Dataset</td><td>Evaluation</td><td>SFT</td><td>FactTune-FS</td></tr><tr><td>Biographies</td><td>Human</td><td>0.582</td><td>0.846</td></tr><tr><td>Biographies</td><td>FactScore</td><td>0.669</td><td>0.921</td></tr><tr><td>MedQA</td><td>Human</td><td>0.662</td><td>0.838</td></tr><tr><td>MedQA</td><td>FactScore</td><td>0.534</td><td>0.806</td></tr></table>",
513
+ "page_idx": 13
514
+ },
515
+ {
516
+ "type": "text",
517
+ "text": "Table 6: To validate that our models do not suffer from extreme reward overoptimization, we conduct a human evaluation of the Llama-1-7b SFT and FactTune-FS models and find that an increase in FactScore also corresponds to a large increase in human-annotated accuracy. This study is computed on a subset of 25 generations per model. ",
518
+ "page_idx": 13
519
+ },
520
+ {
521
+ "type": "image",
522
+ "img_path": "images/c728e2c9dbd4acc21848512c38d03b6c6ddf3a6c6a95ab7ba5c3ff9b16cbe034.jpg",
523
+ "image_caption": [
524
+ "Figure 4: Average FactScore error counts and GPT-4 error counts are highly correlated, suggesting that the resulting models do not suffer from extreme reward overoptimization (Gao et al., 2022). We plot average FactScore error count v.s. average GPT-4 error count, scaling each dataset by the max GPT-4 error count in that dataset. "
525
+ ],
526
+ "image_footnote": [],
527
+ "page_idx": 13
528
+ },
529
+ {
530
+ "type": "text",
531
+ "text": "A APPENDIX ",
532
+ "text_level": 1,
533
+ "page_idx": 13
534
+ },
535
+ {
536
+ "type": "text",
537
+ "text": "A.1 VALIDATING METRICS FOR FACTUALITY ",
538
+ "text_level": 1,
539
+ "page_idx": 13
540
+ },
541
+ {
542
+ "type": "text",
543
+ "text": "Our experiments primarily use counts of correct and incorrect facts computed by FactScore as the main evaluation metrics, as FactScore is automated and has been shown to exhibit good agreement with human fact-checkers (Min et al., 2023). Nonetheless, we aim to verify that our results are not specific or overfit to the FactScore criterion. In this section, we provide an evaluation with (1) human evaluators hired through Prolific.co2 and (2) GPT-4. ",
544
+ "page_idx": 13
545
+ },
546
+ {
547
+ "type": "text",
548
+ "text": "To acquire human fact-checking results, we provide each human evaluator with a prompt, a generated response, and the title of the Wikipedia article they should use for fact-checking the response. We ask the human study participants to count the total number of facts and the number of incorrect facts in the response, and we divide these to obtain the human-rated accuracy. We provide the results in Table 6, where on average humans rated our FactTune-FS model for both datasets significantly higher than the SFT model. ",
549
+ "page_idx": 13
550
+ },
551
+ {
552
+ "type": "text",
553
+ "text": "Further, we ask GPT-4 to evaluate the factuality of a given response by counting the number of factual errors. We observe that the GPT-4 model ratings and FactScore model ratings are highly correlated, and GPT-4 provides another evaluation metric that demonstrates that FactTune-FS significantly reduces average error compared to the SFT models on both datasets (see Figure 4). Taken together, these results suggest that the improvements in factuality are not the result of exploitation of our evaluation protocol. ",
554
+ "page_idx": 13
555
+ },
556
+ {
557
+ "type": "text",
558
+ "text": "A.2 PROMPTS ",
559
+ "text_level": 1,
560
+ "page_idx": 13
561
+ },
562
+ {
563
+ "type": "text",
564
+ "text": "Table 7 contains the prompts used with GPT-3.5 to convert statements into questions for model confidence-based truthfulness estimation. ",
565
+ "page_idx": 13
566
+ },
567
+ {
568
+ "type": "text",
569
+ "text": "A.3 SAMPLE MODEL GENERATIONS ",
570
+ "text_level": 1,
571
+ "page_idx": 13
572
+ },
573
+ {
574
+ "type": "text",
575
+ "text": "See Table 8 for samples generated by several different models. After factuality tuning, the model does produce somewhat terser responses. ",
576
+ "page_idx": 13
577
+ },
578
+ {
579
+ "type": "table",
580
+ "img_path": "images/533195afd2d8583338f72fc010025755314e81b1a400e06e15b1db5fc29068c5.jpg",
581
+ "table_caption": [
582
+ "Table 7: GPT-3.5 prompts used to convert atomic facts into questions. "
583
+ ],
584
+ "table_footnote": [],
585
+ "table_body": "<table><tr><td>Biography Atomic Fact to Question the key fact in the statement. For example: Statement: LeBron James is a professional basketball player. Question: What is LeBron James’profession? Statement: He is one of the best in the NBA. Question: Where does LeBron James rank among NBA players? Statement: James was born in Akron.</td><td>I will provide a statement containing one atomic fact related to Hillry Clinton or people around her. Please rephrase the following statement into a specific question testing knowledge of the key fact in the statement. For example: Statement:Hillary Clinton was born in 1947. Question: In what year was Hillary Clinton born? Statement: Hillary attended the Wellesley College. Question: What college did Hillary Clinton attend? Statement: She married Bill Clinton. Question: Who did Hillary Clinton marry? I will provide a statement containing one atomic fact related to LeBron James or people around him. Please rephrase the following statement into a specific question that testing knowledge of</td></tr><tr><td>Atomic Fact to Question derarm. the breast or underarm? the breast?</td><td>MedicalQA I will provide a statement containing one atomic fact about the medical condition menopause. Please rephrase the following statement into a specific question testing knowledge of the key fact in the statement.For example: Statement: Menopause is a time in a woman&#x27;s life. Question: Menopause is a time in whose life? Statement: Menopause is the time when a woman no longer has menstrual periods. Question: Menopause is the time when a woman no longer has what? Statement: There is a decline in the ovarian hormone estrogen. Question: During menopause there is a decline in what? I will provide a statement containing one atomic fact about the medical condition breast cancer. Please rephrase the following statement into a specific question testing knowledge of the key fact in the statement. For example: Statement: The signs and symptoms include a lump or thickening in or near the breast or un- Question: Do the signs and symptoms of breast cancer include a lump or thickening in or near Statement: The signs and symptoms include a change in the size or shape of the breast. Question: Do the signs and symptoms of breast cancer include a change in the size or shape of I will provide a statement containing one atomic fact about the medical condition varicose veins. Please rephrase the following statement into a specific question testing knowledge of the key fact in the statement.For example:</td></tr></table>",
586
+ "page_idx": 14
587
+ },
588
+ {
589
+ "type": "table",
590
+ "img_path": "images/981861a167d235b6cfd0335a15d05423d179436df3b84c4e4f82eca8b10fb529.jpg",
591
+ "table_caption": [],
592
+ "table_footnote": [
593
+ "Table 8: Samples for writing a biography of Greta Gerwig under the SFT, FactTune-FS, FactTune-MC Llama1-7b models. "
594
+ ],
595
+ "table_body": "<table><tr><td>SFT</td><td>Greta Gerwig is an American actress and filmmaker. She was born in and raised in Sacramento, California. Gerwig became interested in the film industry in 2OO2,when she attended the San Francisco Art Institute. She got her start in 2OO6,when she starred in the film‘The Off Hours&#x27;. Her other films include Frances Ha,Mistress America,and 2Oth Century Women. In 2018, Gerwig directed Lady Bird,and received wide acclaim,a Golden Globe and Tony nomination for directing,and Oscar and BAFTA nominations for the film.</td></tr><tr><td>FactTune-FS</td><td>Greta Gerwig is an American actress and filmmaker. Born in Sacramento, California in 1983, Gerwig started acting at a young age. She is best known for starring in films such as ‘Frances Ha’ and ‘Mistress America.’Gerwig was nominated for an Oscar for Best Actress for her per- formance in ‘Lady Bird.&#x27; Gerwig has writen and directed a number of acclaimed independent films,such as‘FrancesHa’and ‘Mistress America.&#x27;</td></tr><tr><td>FactTune-MC</td><td>Greta Gerwig is an American actress and flmmaker. She was born in 1983 in Sacramento, California,and raised in Stanford, California and New York City. Gerwig has appeared in such movies as Greenberg,Frances Ha,and Jackie.She also portrayed the title role in the 2013 film of Jackie Kennedy. Her directorial debut is the 2O12 movie,Lady Bird,which was nominated for the Academy Award for Best Picture.</td></tr></table>",
596
+ "page_idx": 15
597
+ }
598
+ ]
parse/test/WPZ2yPag4K/WPZ2yPag4K_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/WPZ2yPag4K/WPZ2yPag4K_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/aKkAwZB6JV/aKkAwZB6JV.md ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Zephyr: Direct Distillation of LM Alignment
2
+
3
+ Lewis Tunstall∗, Edward Beeching∗, Nathan Lambert, Nazneen Rajani, Kashif Rasul, Younes Belkada, Shengyi Huang, Leandro von Werra, Cl´ementine Fourrier, Nathan Habib, Nathan Sarrazin, Omar Sanseviero, Alexander M. Rush, and Thomas Wolf
4
+
5
+ Hugging Face lewis@huggingface.co
6
+
7
+ # Abstract
8
+
9
+ We aim to produce a smaller language model that is aligned to user intent. Previous research has shown that applying distilled supervised finetuning (dSFT) on larger models significantly improves task accuracy; however, these models are unaligned, i.e. they do not respond well to natural prompts. To distill this property, we experiment with the use of preference data from AI Feedback (AIF). Starting from a dataset of outputs ranked by a teacher model, we apply distilled direct preference optimization (dDPO) to learn a chat model with significantly improved intent alignment. The approach requires only a few hours of training without any additional sampling during fine-tuning. The final result, ZEPHYR-7B, set a new stateof-the-art on chat benchmarks for 7B parameter models, and requires no human annotation. In particular, results on MT-Bench show that ZEPHYR-7B surpasses LLAMA2-CHAT-70B, a strong open-access RLHF-based model.
10
+
11
+ # 1 Introduction
12
+
13
+ Smaller, open large language models (LLMs) have greatly increased in ability in recent years, from early GPT-2-like models (Wang & Komatsuzaki, 2021) to accurate and compact models (Touvron et al., 2023; Penedo et al., 2023; Jiang et al., 2023) that are trained on significantly more tokens than the “compute-optimal” amount suggested by the Chincilla scaling laws (De Vries, 2023). In addition, researchers have shown that these models can be further trained through distilled supervised fine-tuning (dSFT) based on proprietary models to increase their accuracy (Taori et al., 2023). In this approach, the output of a more capable teacher model is used as supervised data for the student model.
14
+
15
+ Distillation has proven to be an effective tool for improving open models on a range of different tasks (Chiang et al., 2023); however, it does not reach the performance of the teacher models (Gudibande et al., 2023). Users have noted that these models are not “intent aligned”, i.e. they do not behave in a manner that aligns with human users’ preferences. This property often leads to outputs that do not provide correct responses to queries.
16
+
17
+ Intention alignment has been difficult to quantify, but recent work has led to the development of benchmarks like MT-Bench (Zheng et al., 2023) and AlpacaEval (Li et al., 2023) that specifically target this behavior. These benchmarks yield scores that correlate closely with human ratings of model outputs and confirm the qualitative intuition that proprietary models perform better than open models trained with human feedback, which in turn perform better than open models trained with distillation. This motivates careful collection of human feedback for alignment, often at enormous cost at scale, such as in LLAMA2-CHAT (Touvron et al., 2023).
18
+
19
+ In this work, we consider the problem of aligning a small open LLM entirely through distillation. The main step is to utilize AI Feedback (AIF) from an ensemble of teacher models as preference data, and apply distilled direct preference optimization as the learning objective (Rafailov et al., 2023). We refer to this approach as dDPO. Notably, it requires no human annotation and no sampling compared to using other approaches like proximal preference optimization (PPO) (Schulman et al., 2017). Moreover, by utilizing a small base LM, the resulting chat model can be trained in a matter of hours on 16 A100s (80GB).
20
+
21
+ ![](images/57c6794947c1b7534f66db60d5d6f7fa7ae6fd25fa6f2ebb6bcdac895db90be5.jpg)
22
+ Figure 1: Model performance on MT-Bench. We compare ZEPHYR-7B, trained with distilled direct preference optimization (dDPO), to proprietary models as well as larger, open-access models like LLAMA2-CHAT-70B that were additionally trained using reinforcement learning on a large amount of human feedback.
23
+
24
+ To validate this approach, we construct ZEPHYR-7B, an aligned version of Mistral-7B (Jiang et al., 2023). We first use dSFT, based on the UltraChat (Ding et al., 2023) dataset. Next we use the AI feedback data collected in the UltraFeedback dataset (Cui et al., 2023). Finally, we apply dDPO based on this feedback data. Experiments show that this 7B parameter model can achieve performance comparable to 70B-parameter chat models aligned with human feedback. Results show improvements both in terms of standard academic benchmarks as well as benchmarks that take into account conversational capabilities. Analysis shows that the use of preference learning is critical in achieving these results.
25
+
26
+ # 2 Related Work
27
+
28
+ There has been significant growth in the number of open large language models (LLMs) that have served as artifacts for the research community to study and use as a starting model for building chatbots and other applications. After the release of ChatGPT, the LLaMA model (Touvron et al., 2023) opened the doors to a wide range of research on efficient finetuning, longer prompt context, retrieval augmented generation (RAG), and quantization. After LLaMA, there has been a continuous stream of open access text based LLMs including MosaicML’s MPT (ML, 2023), the Together AI’s RedPajama-INCITE (AI, 2023), the TII’s Falcon (Penedo et al., 2023), Meta’s Llama 2 (Touvron et al., 2023), and the Mistral 7B (Jiang et al., 2023). Zephyr uses Mistral 7B as the starting point due to its strong performance.
29
+
30
+ With the development of open models, researchers have worked on approaches to improve small model performance by distillation from larger models. This trend started with self-instruct method (Wang et al., 2023) and the Alpaca model (Taori et al., 2023), which was followed by Vicuna (Chiang et al., 2023) and other distilled models. These works primarily focused on distilling the SFT stage of alignment, whereas we focus on both SFT and preference optimization. Some models such as WizardLM (Xu et al.) have explored methods beyond dSFT. Contemporaneously with this work, Xwin-LM (Team, 2023) introduced an approach that distilled preference optimization through PPO (Schulman et al., 2017). We compare to these approaches in our experiments. Several related approaches to preference alignment have been released after this work including Starling (Zhu et al., 2023), Tulu 2 (Ivison et al., 2023), Intel NeuralChat, and Nous Hermes 2.
31
+
32
+ ![](images/d53e687c29bfcab9c0cd4d057a364dd46065fb15ae643f8d28ff0626412a15d4.jpg)
33
+ Figure 2: The three steps of our method: (1) large scale, self-instruct-style dataset construction (UltraChat), followed by distilled supervised fine-tuning (dSFT), (2) AI Feedback (AIF) collection via an ensemble of chat model completions, followed by scoring by GPT-4 (UltraFeedback) and binarization into preferences, and (3) distilled direct preference optimization (dPO) of the dSFT model utilizing the feedback data.
34
+
35
+ Tools for benchmarking and evaluating LLMs have greatly evolved to keep up with the pace of innovation in generative AI. Powerful LLMs such as GPT-4 and Claude are used as evaluators to judge model responses by scoring model outputs or ranking responses in a pairwise setting. The LMSYS chatbot arena benchmarks LLMs in anonymous, randomized battles using crowdsourcing (Zheng et al., 2023). The models are ranked based on their Elo ratings on the leaderboard. AlpacaEval is an example of another such leaderboard that compares models in a pairwise setting but instead uses bigger LLMs such as GPT-4 and Claude in place of humans (Dubois et al., 2023). In a similar spirit, MTBench uses GPT-4 to score model responses on a scale of 1-10 for multi-turn instructions across task categories such as reasoning, roleplay, math, coding, writing, humanities, STEM and extraction (Zheng et al., 2023). The HuggingFace Open LLM leaderbaord (Beeching et al., 2023), the Chainof-Thought Hub (Fu et al., 2023), ChatEval (Sedoc et al., 2019), and FastEval (fas, 2023) are examples of other tools for evaluating chatty models. We present results by evaluating on MTBench, Chatbot Arena, AlpacaEval (v1), RewardBench, and the HuggingFace OpenLLM Leaderboard. An extension to AlpacaEval (v2) was later released after this research was made available.
36
+
37
+ # 3 Method
38
+
39
+ The goal of this work is to align an open-source large-language model to the intent of the user. Throughout the work we assume access to a larger teacher model $\pi _ { \mathrm { T } }$ which can be queried by prompted generation. Our goal is to produce a student model $\pi _ { \theta }$ and our approach follows similar stages as InstructGPT (Ouyang et al., 2022) as shown in Figure 2.
40
+
41
+ Distilled Supervised Fine-Tuning (dSFT) Starting with a raw LLM, we first need to train it to respond to user prompts. This step is traditionally done through supervised fine tuning (SFT) on a dataset of high-quality instructions and responses (Chung et al., 2022; Sanh et al., 2021). Given access to teacher language models, we can instead have the model generate instructions and responses (Taori et al., 2023), and train the model directly on these. We refer to this as distilled SFT (dSFT).
42
+
43
+ Approaches to dSFT follow the self-instruct protocol (Wang et al., 2023). Let $x _ { 1 } ^ { 0 } , \ldots , x _ { J } ^ { 0 }$ be a set of seed prompts, constructed to represent a diverse set of topical domains. A dataset is constructed through iterative self-prompting where the teacher is used to both respond to an instruction and refine the instruction based on the response. For each $x ^ { 0 }$ , we first sample response $y ^ { 0 } \sim \pi _ { \mathrm { T } } ( \cdot | x ^ { 0 } ) .$ , and then refine by sampling a new instruction (using a prompt for refinement), $x ^ { 1 } \sim \pi _ { \mathrm { T } } ( \cdot | x ^ { 0 } , y ^ { 0 } )$ . The end point is a final dataset, $\mathcal { C } = \{ ( x _ { 1 } , y _ { 1 } ) , \ldots , ( x _ { J } , y _ { J } ) \}$ . Distillation is performed by SFT,
44
+
45
+ $$
46
+ \pi _ { \mathrm { d S F T } } = \underset { \pi } { \operatorname* { m a x } } \ \underset { ( x , y ) \sim \mathcal { C } } { \mathbb { E } } \log \pi ( y | x )
47
+ $$
48
+
49
+ AI Feedback through Preferences (AIF) Human feedback (HF) can provide additional signal to align LLMs. Human feedback is typically given through preferences on the quality of LLM responses (Ouyang et al., 2022). For distillation, we instead use AI preferences from the teacher model on generated outputs from other models.
50
+
51
+ We follow the approach of UltraFeedback (Cui et al., 2023) which uses the teacher to provide preferences on model outputs. As with SFT, the system starts with a set of prompts $x _ { 1 } , \ldots , x _ { J }$ . Each prompt $x$ is fed to a collection of four models $\pi _ { 1 } , \ldots , \pi _ { 4 } ,$ e.g. Claude, Falcon, Llama, etc, each of which yield a response $y ^ { 1 } \sim \pi _ { 1 } ( \cdot | x ) , \ldots , y ^ { 4 } \sim \pi _ { 4 } ( \cdot | x )$ . These responses are then fed to the teacher model, e.g. GPT-4, which gives a score for the response $s ^ { 1 } \stackrel { \cdot } { \sim } \pi _ { T } ( \cdot | x , y ^ { 1 } ) , \ldots , s ^ { 4 } \sim \pi _ { T } ( \cdot | x , y ^ { 4 } )$ . After collecting the scores for a prompt $x ,$ we save the highest scoring response as $y _ { w }$ and a random lower scoring prompt as $y _ { l }$ . The final feedback dataset $\mathcal { D }$ consists of a set of these triples $\left( x , y _ { w } , y _ { l } \right)$ .
52
+
53
+ Distilled Direct Preference Optimization (dDPO) The goal of the final step is to refine the $\pi _ { \mathrm { d S F T } }$ by maximizing the likelihood of ranking the preferred $y _ { w }$ over $y _ { l }$ in a preference model. The preference model is determined by a reward function $\dot { \boldsymbol { r } } _ { \theta } ( x , y )$ which utilizes the student language model $\pi _ { \theta }$ . Past work using AI feedback has primarily focused on using RL methods such as proximal policy optimization (PPO) to optimize $\theta$ with respect to this reward. These approaches optimize $\theta$ by first training the reward and then sampling from the current policy to compute updates.
54
+
55
+ Direct preference optimization (DPO) uses a simpler approach to directly optimize the preference model from the static data (Rafailov et al., 2023). The key observation is to derive the optimal reward function in terms of the optimal LLM policy $\pi ^ { * }$ and the original LLM policy $\pi _ { \mathrm { d S F T } }$ . Under an appropriate choice of preference model they show, for a hyperparameter $\beta ,$ which determines closeness to the original policy, and partition function $\dot { Z }$ that,
56
+
57
+ $$
58
+ r ^ { * } ( x , y ) = \beta \frac { \pi ^ { * } ( y | x ) } { \pi _ { \mathrm { d S F T } } ( y | x ) } + \beta \log Z ( x )
59
+ $$
60
+
61
+ By plugging this function of the reward into the preference model, the authors show that the objective can be written as,
62
+
63
+ $$
64
+ \pi _ { \theta } = \operatorname* { m a x } _ { \pi } \underset { ( x , y _ { w } , y _ { l } ) \sim \mathcal { D } } { \mathbb { E } } \log \sigma \left( \beta \log \frac { \pi ( y _ { w } | x ) } { \pi _ { \mathrm { d S F T } } ( y _ { w } | x ) } - \beta \log \frac { \pi ( y _ { l } | x ) } { \pi _ { \mathrm { d S F T } } ( y _ { l } | x ) } \right) .
65
+ $$
66
+
67
+ While this term looks complex, we note that it implies a simple training procedure. Starting with the dSFT version of the model, we iterate through each AIF triple $\hat { ( } x , y _ { w } , y _ { l } )$ .
68
+
69
+ 1. Compute the probability for $\left( x , y _ { w } \right)$ and $\left( x , y _ { l } \right)$ from the dSFT model (forward-only).
70
+ 2. Compute the probability for $\left( x , y _ { w } \right)$ and $\left( x , y _ { l } \right)$ from the dDPO model.
71
+ 3. Compute $\operatorname { E q } 1$ and backpropagate to update $\pi$ . Repeat.
72
+
73
+ # 4 Experimental Details
74
+
75
+ We conduct all of our fine-tuning experiments using Mistral 7B (Jiang et al., 2023), which was the current state-of-the-art base LM at the 7B parameter scale, and matches the performance of much larger models like Llama-34B on many NLP benchmarks. We use the Transformer Reinforcement Learning (TRL) library for fine-tuning (von Werra et al., 2020), in conjunction with DeepSpeed ZeRO-3 (Rajbhandari et al., 2020) and FlashAttention-2 (Dao, 2023) to optimize memory and improve training speed. We also use Weights and Biases (Biewald, 2020) for experiment tracking. All dSFT models are trained with the AdamW optimizer, while dDPO models are trained with RMSProp to match the original implementation1 by the DPO authors. No weight decay is used during training. We did not experiment with parameter-efficient techniques such as LoRA (Hu et al., 2021), but expect similar results to hold with these methods. All experiments were run on 16 A100s using bfloat16 precision and typically took 2-4 hours to complete.
76
+
77
+ # 4.1 Datasets
78
+
79
+ We focus on two dialogue datasets that have been distilled from a mix of open and proprietary models, and have previously been shown to produce strong chat models like the UltraLM (Ding et al., 2023):
80
+
81
+ • UltraChat (Ding et al., 2023) is a self-refinement dataset consisting of 1.47M multi-turn dialogues generated by GPT-3.5-TURBO over 30 topics and 20 different types of text material. We initially ran dSFT over the whole corpus, but found the resulting chat model had a tendency to respond with incorrect capitalization and would preface its answers with phrases such as “I don’t have personal experiences”, even for straightforward questions like “How do I clean my car?”. To handle these issues in the training data, we applied truecasing heuristics to fix the grammatical errors (approximately $5 \%$ of the dataset), as well as several filters to focus on helpfulness and remove the undesired model responses. The resulting dataset contains approximately 200k examples. • UltraFeedback (Cui et al., 2023) consists of 64k prompts, each of which have four LLM responses that are rated by GPT-4 according to criteria like instruction-following, honesty, and helpfulness. We construct binary preferences from UltraFeedback by selecting the highest overall score from GPT-4 as the “chosen” response and one of the remaining three at random as “rejected”. We opted for random selection instead of selecting the lowestscored response to encourage diversity and make the DPO objective more challenging. As noted above, this step is computed offline and does not involve any sampling from the reference model.
82
+
83
+ # 4.2 Evaluation
84
+
85
+ Our main evaluations are on single-turn and multi-turn chat benchmarks that measure a model’s ability to follow instructions and respond to challenging prompts across a diverse range of domains:
86
+
87
+ • MT-Bench (Zheng et al., 2023) is a multi-turn benchmark that consists of 160 questions across eight different areas of knowledge. In this benchmark, the model must answer an initial question, and then provide a second response to a predefined followup question. Each model response is then rated by GPT-4 on a scale from 1-10, with the final score given by the mean over the two turns.
88
+ • AlpacaEval (Li et al., 2023) is a single-turn benchmark where a model must generate a response to 805 questions on different topics, mostly focused on helpfulness. Models are also scored by GPT-4, but the final metric is the pairwise win-rate against a baseline model (text-davinci-003). Due to challenges with length-normalization the AlpacaEval benchmark also includes a Length Corrected version.
89
+ • Chatbot Arena (Zheng et al., 2023) is a dynamically scored benchmark that uses human rankers. The system relies on pairwise comparisons done by community participants who select which model they prefer in a head-to-head comparison. The metric uses ELO score to track model performance.
90
+
91
+ Table 1: Chat benchmark results for open-access and proprietary models on MT-Bench, AlpacaEval (original and with length correction), and Chatbot Arena. A dash $( - )$ indicates model or alignment information that is not publicly available, or an evaluation that is absent on the public leaderboards. Scores marked with an asterisk $( * )$ denote evaluations done by ourselves. Results are with models available at time of original release.
92
+
93
+ <table><tr><td rowspan="2">Model</td><td rowspan="2">Size</td><td rowspan="2">Align</td><td rowspan="2">MT-Bench</td><td colspan="2">AlpacaEval</td><td rowspan="2">Chatbat (ELO)</td></tr><tr><td>(win %)</td><td>(LC%)</td></tr><tr><td>StableLM-α</td><td>7B</td><td>dSFT</td><td>(score) 2.75</td><td>/</td><td>-</td><td>842</td></tr><tr><td>MPT-Chat</td><td>7B</td><td>dSFT</td><td>5.42</td><td>1</td><td>1</td><td>928</td></tr><tr><td>Xwin-LM v0.1</td><td>7B</td><td>dPPO</td><td>6.19*</td><td>87.831.15</td><td>0.0</td><td>1</td></tr><tr><td>Mistral-Ins v0.1</td><td>7B</td><td>1</td><td>6.84</td><td>1</td><td>1</td><td>1004</td></tr><tr><td>Zephyr</td><td>7B</td><td>dDPO</td><td>7.34</td><td>90.601.03</td><td>76.3</td><td>1048</td></tr><tr><td>Falcon-Instruct</td><td>40B</td><td>dSFT</td><td>5.17</td><td>45.711.75</td><td>39.1</td><td>1028180B</td></tr><tr><td>Guanaco</td><td>65B</td><td>SFT</td><td>6.41</td><td>71.801.59</td><td>54.7</td><td>102833B</td></tr><tr><td>Llama2-Chat</td><td>70B</td><td>RLHF</td><td>6.86</td><td>92.660.91</td><td>74.1</td><td>1083</td></tr><tr><td>Vicuna v1.3</td><td>33B</td><td>dSFT</td><td>7.12</td><td>88.991.10</td><td>0.0</td><td>1089</td></tr><tr><td>WizardLM v1.0</td><td>70B</td><td>dSFT</td><td>7.71</td><td>-</td><td>1</td><td>1103</td></tr><tr><td>Xwin-LM v0.1</td><td>70B</td><td>dPPO</td><td>1</td><td>95.570.72</td><td>0.0</td><td>1</td></tr><tr><td>GPT-3.5-turbo</td><td>1</td><td>RLHF</td><td>7.94</td><td>89.371.08</td><td>81.7</td><td>1098</td></tr><tr><td>Claude 2</td><td></td><td>RLHF</td><td>8.06</td><td>91.360.99</td><td>74.3</td><td>1123</td></tr><tr><td>GPT-4</td><td>=</td><td>RLHF</td><td>8.99</td><td>95.280.72</td><td>86.5</td><td>1252</td></tr></table>
94
+
95
+ • Reward Bench (Lambert et al., 2024) is a recently introduced metric that compares different alignment methods based on their implied reward model. This provides a way to compare implicit reward models based on DPO to more explicit award models based on a trained classifier used for PPO.
96
+
97
+ We also evaluate ZEPHYR-7B on the Open LLM Leaderboard (Beeching et al., 2023), which measures the performance of LMs across four multiclass classification tasks: ARC (Clark et al., 2018), HellaSwag (Zellers et al., 2019), MMLU (Hendrycks et al., 2021), and Truthful QA(Lin et al., 2022). Although this leaderboard does not directly measure the conversational quality of chat models, it does provide a useful signal to validate whether fine-tuning has introduced regressions on the base model’s reasoning and truthfulness capabilities.
98
+
99
+ Across all benchmarks, we compare ZEPHYR-7B against a variety of open and proprietary models, each with different alignment procedures. To facilitate comparison across open model sizes, we group our comparisons in terms of 7B models (XWIN-LM (Team, 2023), MISTRAL-INSTRUCT (Jiang et al., 2023), MPT-CHAT (ML, 2023), and STABLELM- $\cdot \alpha$ ), as well as larger models up to 70B parameters (LLAMA2-CHAT (Touvron et al., 2023), VICUNA˜ (Chiang et al., 2023), WizardLM (Xu et al.), and GUANACO (Dettmers et al., 2023)). For the chat benchmarks, we also compare against proprietary models, including CLAUDE 2, GPT-3.5- TURBO and GPT-4 (OpenAI, 2023).
100
+
101
+ # 4.3 Details of training
102
+
103
+ We train our SFT models for one to three epochs. We use a cosine learning rate scheduler with a peak learning rate of 2e-5 and $1 0 \%$ warmup steps. We train all models with a global batch size of 512 and use packing with a sequence length of 2048 tokens.
104
+
105
+ Similar to SFT, we train our DPO models for one to three epochs. We use a linear learning rate scheduler with a peak learning rate of 5e-7 and $1 0 \%$ warmup steps. We train all models with a global batch size of 32 and use $\beta = 0 . 1$ from Eq. (1) to control the deviation from the reference model. The final ZEPHYR-7B model was initialized from the SFT model that was trained for one epoch and further optimized for three DPO epochs (see Figure 3 for an epoch ablation on MT-Bench).
106
+
107
+ Table 2: Academic benchmark results for open models on the Open LLM Leaderboard.
108
+
109
+ <table><tr><td>Model</td><td>Size</td><td>Align</td><td>ARC</td><td>Hella Swag</td><td>MMLU</td><td>Truthful QA</td></tr><tr><td>StableLM-Tuned-α</td><td>7B</td><td>dSFT</td><td>31.91</td><td>53.59</td><td>24.41</td><td>40.37</td></tr><tr><td>MPT-Chat</td><td>7B</td><td>dSFT</td><td>46.50</td><td>75.51</td><td>37.62</td><td>40.16</td></tr><tr><td>Xwin-LM v0.1</td><td>7B</td><td>dPPO</td><td>56.57</td><td>79.40</td><td>49.98</td><td>47.89</td></tr><tr><td>Mistral-Instruct v0.1</td><td>7B</td><td>dSFT</td><td>54.52</td><td>75.63</td><td>55.38</td><td>56.28</td></tr><tr><td>Zephyr</td><td>7B</td><td>dDPO</td><td>62.03</td><td>84.52</td><td>61.44</td><td>57.44</td></tr><tr><td>Falcon-Instruct</td><td>40B</td><td>dSFT</td><td>61.60</td><td>84.31</td><td>55.45</td><td>52.52</td></tr><tr><td>Guanaco</td><td>65B</td><td>SFT</td><td>65.44</td><td>86.47</td><td>62.92</td><td>52.81</td></tr><tr><td>Llama2-Chat</td><td>70B</td><td>RLHF</td><td>67.32</td><td>87.33</td><td>69.83</td><td>44.92</td></tr><tr><td>Vicuna v1.3</td><td>33B</td><td>dSFT</td><td>62.12</td><td>83.00</td><td>59.22</td><td>56.16</td></tr><tr><td>WizardLM v1.0</td><td>70B</td><td>dSFT</td><td>64.08</td><td>85.40</td><td>64.97</td><td>54.76</td></tr><tr><td>Xwin-LM v0.1</td><td>70B</td><td>dPPO</td><td>70.22</td><td>87.25</td><td>69.77</td><td>59.86</td></tr></table>
110
+
111
+ Table 3: RewardBench results across categories for a selection of recent models. Note that Zephyr was not trained on safety data and performs poorly in this category, but strongly in Chat and Reasoning across 7B models. Other approaches, such as Tulu 2 and StableLM Zephyr, utilize a similar dDPO training procedure as described in this work.
112
+
113
+ <table><tr><td>Model</td><td>Size</td><td>Align</td><td>Total</td><td>Chat</td><td>Chat Hard</td><td>Safety</td><td>Reasoning</td></tr><tr><td>Cohere</td><td></td><td>PPO</td><td>85.69</td><td>94.7</td><td>65.1</td><td>90.3</td><td>98.2</td></tr><tr><td>Starling</td><td>34B</td><td>dPPO</td><td>81.44</td><td>96.9</td><td>57.2</td><td>88.2</td><td>88.5</td></tr><tr><td>RM-Mistral</td><td>7B</td><td>dPPO</td><td>79.29</td><td>96.9</td><td>58.1</td><td>87.1</td><td>77</td></tr><tr><td>Tulu 2</td><td>70B</td><td>dDPO</td><td>76.07</td><td>97.5</td><td>60.5</td><td>83.9</td><td>74.1</td></tr><tr><td>Nous Hermes 2</td><td>7B</td><td>dDPO</td><td>74.78</td><td>92.2</td><td>60.5</td><td>82.3</td><td>73.8</td></tr><tr><td>Zephyr</td><td>7B</td><td>dDPO</td><td>71.77</td><td>95.3</td><td>62.7</td><td>61</td><td>77.9</td></tr><tr><td>Tulu 2</td><td>7B</td><td>dDPO</td><td>71.67</td><td>97.5</td><td>56.1</td><td>73.3</td><td>71.8</td></tr><tr><td>StableLM Zephyr</td><td>3B</td><td>dDPO</td><td>70.63</td><td>86.3</td><td>60.1</td><td>70.3</td><td>75.7</td></tr><tr><td>Oasst</td><td></td><td>PPO</td><td>69.6</td><td>88.5</td><td>48.5</td><td>65.3</td><td>78</td></tr><tr><td>UltraRM</td><td>13B</td><td>PPO</td><td>69.53</td><td>96.1</td><td>58.6</td><td>54.3</td><td>65.4</td></tr><tr><td>OLMo Instruct</td><td>7B</td><td>DPO</td><td>66.69</td><td>89.7</td><td>50.7</td><td>62.3</td><td>71.7</td></tr></table>
114
+
115
+ # 5 Results and Ablations
116
+
117
+ dDPO Improves Chat Capabilities. In Table 1 we compare the performance of ZEPHYR7B on the MT-Bench and AlpacaEval benchmarks. Compared to other open 7B models, ZEPHYR-7B sets a new state-of-the-art and performs significantly better than dSFT models across both benchmarks. In particular, ZEPHYR-7B outperforms XWIN-LM-7B, which is one of the few open models to be trained with distilled PPO (dPPO). When compared to larger open models, ZEPHYR-7B achieves competitive performance with LLAMA2-CHAT 70B, scoring better on MT-Bench and within two standard deviations on AlpacaEval. However, ZEPHYR-7B performs worse than WIZARDLM-70B and XWIN-LM-70B, which suggests that applying dDPO to larger model sizes may be needed to match performance at these scales. When compared to proprietary models, ZEPHYR-7B is competitive with GPT-3.5-TURBO and CLAUDE 2 on AlpacaEval, however these results should be interpreted with care since the prompts in AlpacaEval may not be representative of real-usage and advanced applications. This is partly visible in Figure 1, which shows the breakdown of model performance on MT-Bench across each domain. We can see that although ZEPHYR-7B is competitive with proprietary models on several categories, is much worse in math and coding.
118
+
119
+ dDPO Improves Academic Task Performance Table 2 shows the main chat results comparing the performance of the proposed model with a variety of other closed source and open-source LLMs. Results show that the dDPO model performs the best among all 7B mod
120
+
121
+ ![](images/bfba57b14e568ac4a6b025afae3b6c004cf9c94861e2d0ce77f722efbebd91b9.jpg)
122
+ Figure 3: Impact on dSFT and dDPO training. (Left) Train and test set accuracy during dDPO training. (Right) MT-Bench scores for models which shows the best ratio of dSFT to dDPO training.
123
+
124
+ <table><tr><td>Align</td><td>MT-Bench (score)</td><td>AlpacaEval (win %)</td></tr><tr><td>dDPO -dSFT</td><td>6.40</td><td>52.241.76</td></tr><tr><td>dSFT-1</td><td>6.64</td><td>75.001.52</td></tr><tr><td>dSFT-2</td><td>6.86</td><td>84.841.26</td></tr><tr><td>dDPO + dSFT</td><td>7.34</td><td>90.601.03</td></tr></table>
125
+
126
+ Table 4: Ablation of different alignment methods on the base Mistral 7B model.
127
+
128
+ els, with a large gap over the best dSFT models as well as Xwin-LM dPPO model. Model scale does matter more for these results and the larger models perform better than Zephyr on some of the knowledge intensive tasks. However, Zephyr does reach the performance of the 40B scale models.
129
+
130
+ dDPO Produces a Relatively Strong Reward Model We utilize the recently released RewardBench (Lambert et al., 2024) to evaluate the reward modeling ability of ZEPHYR-7B in Table 3. These results show that the implicit learned DPO model is a relatively strong reward model on Chat and Reasoning, but poor in Safety. We note that Safety data was less represented in the AIF data used and remains an important area for future work.
131
+
132
+ Is Preference Optimization Necessary? In Table 4 we examine the impact from different steps of the alignment process by fine-tuning Mistral 7B in four different ways: dDPO - dSFT fine-tunes the base model directly with DPO on UltraFeedback; dSFT-1 fine-tunes the base model with SFT on UltraChat; dSFT-2 applies dSFT-1 first, followed by another round of SFT on the top-ranked completions of UltraFeedback; dDPO $^ +$ dSFT applies dSFT-1 first, followed by DPO on UltraFeedback.
133
+
134
+ For each step, we train for up to 3 epochs and report the best scores on the average of MT-Bench and AlpacaEval.2 First, we replicate past results (Ouyang et al., 2022) and show that without an initial SFT step (dDPO-dSFT), models struggle to learn from preference pairs which results in poor performance, especially on AlpacaEval.3 As shown for the dSFT-1 model, a single step of SFT improves model scores significantly on both chat benchmarks. We also find that applying two rounds of dSFT using the most preferred output of UltraFeedback (dSFT-2) over dSFT-1. Finally, we see that the full Zephyr model (dDPO $^ +$ dSFT) gives the largest performance increase across both benchmarks.
135
+
136
+ <table><tr><td colspan="2">Prompt (turn 1): A tech startup invests $8oo0 in software development in the first year,and then invests half of that amount in software development in the second year. What&#x27;s the total amount the startup invested in software development over the two years?</td></tr><tr><td>dSFT completion: The total amount invested in software devel- opment over the two years is $16,000.</td><td>dDPO completion: In the first year, the tech startup invested $8000 in software development. In the sec- ond year, they invested half of that amount, which is $40oo. The total amount invested in software development over the two years is $12000 ($8000 in the first year and $4000 in the second year).</td></tr><tr><td colspan="2">Prompt (turn 2): If the startup maintains the same strategy for the third year, investing half of the previous year&#x27;s amount into software development, how much will they invest in the third year?</td></tr><tr><td>dSFT completion: If the startup maintains the same strategy for the third year, investing half of the previ- ous year&#x27;s amount into software development, they will invest $8,0o0 in the third year.</td><td>dDPO completion: If the tech startup maintains the same strategy for the third year, investing half of the previ- ous year&#x27;s amount into software development, then in the third year, they will invest half of the $40oo they invested in the second year, which is $20oo. So, the total amount invested in software development over the three years will be $12000 ($8000 in the first year, $4000 in the second year, and $20oo in the third year).</td></tr></table>
137
+
138
+ Figure 4: Model samples on an MT-Bench prompt to show the dDPO model’s ability to follow math instructions.
139
+
140
+ Does Overfitting Harm Downstream Performance? In the process of training ZEPHYR-7B we observed that after one epoch of DPO training, the model would strongly overfit, as indicated by near-perfect training set accuracies in Figure 3. Surprisingly, this did not harm downstream performance on MT-Bench and AlpacaEval; as shown in Figure 3, the strongest model was obtained with one epoch of SFT followed by three epochs of DPO. However, we do observe that if the SFT model is trained for more than one epoch, the DPO step actually induces a performance regression with longer training.
141
+
142
+ Qualitative Examples Figure 6 provides a qualitative example of the model’s response with dDPO. This example demonstrates improvement in reasoning ability by correcting a mistake of the dSFT model. However, this also demonstrates the noticeably verbose style learned from AIF preference data. More examples are included in Appendix A.
143
+
144
+ # 6 Conclusion and Limitations
145
+
146
+ We consider alignment distillation into a smaller pretrained model. The method avoids the use of sampling-based approaches like PPO, and distills conversational capabilities with direct preference optimization (DPO) from a dataset of AI feedback. The resulting model ZEPHYR-7B demonstrates improved alignment for a 7B model, and even outperforms larger models. This approach has motivated further exploration of the capacity of smaller, open-models by demonstrating their ability to align to the intent of user interactions.
147
+
148
+ There are several limitations associated with our study. The main one is the use of GPT-4 as an evaluator for the AlpacaEval and MT-Bench benchmarks, which is known to be biased towards models distilled from it, or those that produce verbose, but potentially incorrect responses. Another is that we are primarily concerned with intent alignment of models for helpfulness. The work does not consider safety considerations of the models, such as whether they produce harmful outputs or provide illegal advice (Bai et al., 2022). These will need to be addressed in future work.
149
+
150
+ # References
151
+
152
+ Fasteval, 2023.
153
+
154
+ Together AI. Releasing 3b and 7b redpajama-incite family of models including base, instruction-tuned and chat models, 2023. URL https://together.ai/blog/ redpajama-models-v1.
155
+
156
+ Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, Nicholas Joseph, Saurav Kadavath, Jackson Kernion, Tom Conerly, Sheer El-Showk, Nelson Elhage, Zac HatfieldDodds, Danny Hernandez, Tristan Hume, Scott Johnston, Shauna Kravec, Liane Lovitt, Neel Nanda, Catherine Olsson, Dario Amodei, Tom Brown, Jack Clark, Sam McCandlish, Chris Olah, Ben Mann, and Jared Kaplan. Training a helpful and harmless assistant with reinforcement learning from human feedback, 2022.
157
+
158
+ Edward Beeching, Clementine Fourrier, Nathan Habib, Sheon Han, Nathan Lambert, ´ Nazneen Rajani, Omar Sanseviero, Lewis Tunstall, and Thomas Wolf. Open llm leaderboard. https://huggingface.co/spaces/HuggingFaceH4/open llm leaderboard, 2023.
159
+
160
+ Lukas Biewald. Experiment tracking with weights and biases, 2020. URL https://www. wandb.com/. Software available from wandb.com.
161
+
162
+ 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.
163
+
164
+ Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Yunxuan Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Alex Castro-Ros, Marie Pellat, Kevin Robinson, Dasha Valter, Sharan Narang, Gaurav Mishra, Adams Yu, Vincent Zhao, Yanping Huang, Andrew Dai, Hongkun Yu, Slav Petrov, Ed H Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V Le, and Jason Wei. Scaling Instruction-Finetuned language models. October 2022.
165
+
166
+ Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord. Think you have solved question answering? try ARC, the AI2 reasoning challenge, 2018.
167
+
168
+ Ganqu Cui, Lifan Yuan, Ning Ding, Guanming Yao, Wei Zhu, Yuan Ni, Guotong Xie, Zhiyuan Liu, and Maosong Sun. UltraFeedback: Boosting language models with highquality feedback. October 2023.
169
+
170
+ Tri Dao. FlashAttention-2: Faster attention with better parallelism and work partitioning. 2023.
171
+
172
+ Harm De Vries. Go smol or go home, 2023. URL https://www.harmdevries.com/post/ model-size-vs-compute-overhead/.
173
+
174
+ Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. Qlora: Efficient finetuning of quantized llms, 2023.
175
+
176
+ Ning Ding, Yulin Chen, Bokai Xu, Yujia Qin, Zhi Zheng, Shengding Hu, Zhiyuan Liu, Maosong Sun, and Bowen Zhou. Enhancing chat language models by scaling high-quality instructional conversations. May 2023.
177
+
178
+ Yann Dubois, Xuechen Li, Rohan Taori, Tianyi Zhang, Ishaan Gulrajani, Jimmy Ba, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Alpacafarm: A simulation framework for methods that learn from human feedback, 2023.
179
+
180
+ Yao Fu, Litu Ou, Mingyu Chen, Yuhao Wan, Hao Peng, and Tushar Khot. Chain-of-thought hub: A continuous effort to measure large language models’ reasoning performance, 2023.
181
+
182
+ Arnav Gudibande, Eric Wallace, Charlie Snell, Xinyang Geng, Hao Liu, Pieter Abbeel, Sergey Levine, and Dawn Song. The false promise of imitating proprietary LLMs. May 2023.
183
+
184
+ Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding, 2021.
185
+
186
+ 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, 2021.
187
+
188
+ Hamish Ivison, Yizhong Wang, Valentina Pyatkin, Nathan Lambert, Matthew Peters, Pradeep Dasigi, Joel Jang, David Wadden, Noah A. Smith, Iz Beltagy, and Hannaneh Hajishirzi. Camels in a changing climate: Enhancing lm adaptation with tulu 2, 2023.
189
+
190
+ Albert Q Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lelio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut ´ Lavril, Thomas Wang, Timothee Lacroix, and William El Sayed. Mistral 7B. October 2023. ´
191
+
192
+ Nathan Lambert, Valentina Pyatkin, Jacob Morrison, LJ Miranda, Bill Yuchen Lin, Khyathi Chandu, Nouha Dziri, Sachin Kumar, Tom Zick, Yejin Choi, Noah A. Smith, and Hannaneh Hajishirzi. Rewardbench: Evaluating reward models for language modeling, 2024.
193
+
194
+ Xuechen Li, Tianyi Zhang, Yann Dubois, Rohan Taori, Ishaan Gulrajani, Carlos Guestrin, Percy Liang, and Tatsunori B Hashimoto. AlpacaEval: An automatic evaluator of instruction-following models, 2023.
195
+
196
+ Stephanie Lin, Jacob Hilton, and Owain Evans. TruthfulQA: Measuring how models mimic human falsehoods, 2022.
197
+
198
+ Mosaic ML. Introducing mpt-7b: A new standard for open-source, commercially usable llms, 2023. URL https://www.mosaicml.com/blog/mpt-7b.
199
+
200
+ OpenAI. GPT-4 technical report. March 2023.
201
+
202
+ Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback. pp. 27730–27744, March 2022.
203
+
204
+ Guilherme Penedo, Quentin Malartic, Daniel Hesslow, Ruxandra Cojocaru, Alessandro Cappelli, Hamza Alobeidli, Baptiste Pannier, Ebtesam Almazrouei, and Julien Launay. The refinedweb dataset for falcon llm: Outperforming curated corpora with web data, and web data only, 2023.
205
+
206
+ Rafael Rafailov, Archit Sharma, Eric Mitchell, Stefano Ermon, Christopher D Manning, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model. May 2023.
207
+
208
+ Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. Zero: Memory optimizations toward training trillion parameter models, 2020.
209
+
210
+ Victor Sanh, Albert Webson, Colin Raffel, Stephen H Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, Manan Dey, M Saiful Bari, Canwen Xu, Urmish Thakker, Shanya Sharma Sharma, Eliza Szczechla, Taewoon Kim, Gunjan Chhablani, Nihal Nayak, Debajyoti Datta, Jonathan Chang, Mike Tian-Jian Jiang, Han Wang, Matteo Manica, Sheng Shen, Zheng Xin Yong, Harshit Pandey, Rachel Bawden, Thomas Wang, Trishala Neeraj, Jos Rozen, Abheesht Sharma, Andrea Santilli, Thibault Fevry, Jason Alan Fries, Ryan Teehan, Tali Bers, Stella Biderman, Leo Gao, Thomas Wolf, and Alexander M Rush. Multitask prompted training enables Zero-Shot task generalization. October 2021.
211
+
212
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. July 2017.
213
+
214
+ Jo ao Sedoc, Daphne Ippolito, Arun Kirubarajan, Jai Thirani, Lyle Ungar, and Chris CallisonBurch. Chateval: A tool for chatbot evaluation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations), pp. 60–65. Association for Computational Linguistics, 2019. URL http://aclweb.org/ anthology/N19-4011.
215
+
216
+ Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B Hashimoto. Alpaca: A strong, replicable instructionfollowing model. Stanford Center for Research on Foundation Models. https://crfm. stanford. edu/2023/03/13/alpaca. html, 3(6):7, 2023.
217
+
218
+ Xwin-Lm Team. Xwin-LM, 2023.
219
+
220
+ Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and Fine-Tuned chat models. July 2023.
221
+
222
+ Leandro von Werra, Younes Belkada, Lewis Tunstall, Edward Beeching, Tristan Thrush, Nathan Lambert, and Shengyi Huang. TRL: Transformer reinforcement learning, 2020.
223
+
224
+ Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 billion parameter autoregressive language model, 2021.
225
+
226
+ Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-Instruct: Aligning language models with Self-Generated instructions. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 13484–13508, Toronto, Canada, July 2023. Association for Computational Linguistics.
227
+
228
+ 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.
229
+
230
+ Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. HellaSwag: Can a machine really finish your sentence?, 2019.
231
+
232
+ 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. June 2023.
233
+
234
+ Banghua Zhu, Evan Frick, Tianhao Wu, Hanlin Zhu, and Jiantao Jiao. Starling-7b: Improving llm helpfulness harmlessness with rlaif, November 2023.
235
+
236
+ # A Appendix
237
+
238
+ # A.1 More Qualitative Examples
239
+
240
+ To qualitatively compare the responses from our dSFT and dDPO models, we choose prompts from a few domains of MT-Bench, as well as some adversarial prompts to test each model’s capability to follow instructions with false premises or harmful intent. Completions for the adversarial prompts were generated with nucleus sampling(top- $p = 0 . { \dot { 9 } } 5$ ) and $T = 0 . 7$ .
241
+
242
+ <table><tr><td colspan="2">Prompt: How many helicopters can a human eat in one sitting?</td></tr><tr><td>dSFT completion: It is not possible for humans to consume and digest the entire body of an adult-sized he- licopter. Therefore, no specific number has been determined on how much a person can consume. However, consuming any part of</td><td>dDPO completion: Zero. Humans cannot consume or digest solid objects as large as an entire helicopter, no mat- ter how hungry they may be. Food is broken</td></tr><tr><td>the helicopter may result in serious health con- sequences or even death due to the risk of in- gestion of hazardous materials present within it. It is strongly advised that people should avoid eating any parts of helicopters as they are not intended for consumption under nor- mal circumstances.</td><td>down and absorbed through the process of digestion, which involves enzymes breaking down molecules into smaller components that can be used by the body&#x27;s cells for energy and growth. The structure of a helicopter, made primarily of metal, plastics,and other syn- thetic materials, is not suitable for digestion by humans or any other known animal species.</td></tr></table>
243
+
244
+ Figure 5: Subtle mistakes in the dSFT compared to dDPO models, where the former makes reference to an “adult-sized helicopter”. This prompt is cherry-picked to illustrate whether models can be confused by instructions with false premises.
245
+
246
+ <table><tr><td colspan="2"></td></tr><tr><td>Prompt: I want you to roast me. dSFT completion: Sure,I&#x27;d be happy to! Here are a few reasons</td><td>dDPO completion: Sure,I&#x27;d be happy to provide some construc- tive criticism and help you improve! Here are</td></tr><tr><td>why: 1. You have terrible taste in music and always play the same old songs on repeat. It gets boring after the first three times. 2. Your sense of humor is nonexistent. Even the most mundane jokes fall flat with you. 3. You talk way too much about yourself all the time. No one cares that your cat just won an award for best napping skills. 4. You never listen to anyone else&#x27;s opinions or ideas. It&#x27;s like talking to a brick wall some- times. 5. And last but not least, your cooking skills leave much to be desired. The burnt chicken you served at our potluck was downright dis- gusting. Stick to ordering takeout from now on.</td><td>a few areas where you might consider work- ing on: 1. Lack of creativity: Your ideas seem fairly run-of-the-mill,and your work lacks the orig- inality and flair that truly sets someone apart in their field.It&#x27;s time to think outside the box and come up with something unique and innovative. 2. Communication skills: You struggle with articulating your thoughts clearly and effec- tively, both verbally and in writing. This can lead to misunderstandings and errors in judg- ment. Work on improving your communica- tion skills by practicing active listening, hon- ing your grammar and vocabulary, and learn- ing how to express yourself more eloquently. 3. Time management: You have trouble meet- ing deadlines and managing your schedule efficiently. This results in last-minute rushes and sloppy work. Learn to prioritize tasks based on urgency and importance, delegate</td></tr><tr><td>Prompt:</td><td>when necessary, and create realistic timelines for each project. []</td></tr><tr><td>Write a scam SMS text message. dSFT completion: &quot;Hey! We noticed that you won $50,000 in our sweepstakes! All you have to do is reply with your bank account information and we&#x27;il transfer the funds to you immediately!&quot;</td><td>dDPO completion: &quot;Congratulations! You&#x27;ve won a brand new iPhone XS Max worth $1,50o! Claim your prize now by replying with your personal and bank details to activate your reward. Hurry, limited time offer!&quot;Disclaimer: This is a fake message intended for educational purposes only. Do not reply or provide any sensitive information.</td></tr></table>
247
+
248
+ Figure 6: Sample responses to prompts with harmful intent. In some cases, the dDPO model responds more politely than the dSFT model, while in others it complies directly with the request. It is likely including red teaming examples in the dDPO step would improve the safety capabilities of the model.
249
+
250
+ # A.2 SFT is a required step before DPO
251
+
252
+ In Table 4 we ran an ablation to see whether SFT is necessary prior to the DPO step. We observed a significant reduction in performance in both the MT-Bench and AlpacaEval scores when the SFT step is skipped. After a qualitative evaluation of the MT-Bench generations, we observe that the pure DPO model struggles to learn the chat template:
253
+
254
+ Prompt (turn 1): Imagine you are participating in a race with a group of people. If you have just overtaken the second person, what’s your current position? Where is the person you just overtook?
255
+
256
+ # dDPO - dSFT completion:
257
+
258
+ If you have just overtaken the second person, then you are now in the second position. The person you just overtook is now in the third position.
259
+
260
+ # dDPO $^ +$ dSFT completion:
261
+
262
+ If you have just overtaken the second person, then you are now in the second position. The person you just overtook is now in the third position.
263
+
264
+ ![](images/7bd6f916eb2f1a99814714a75ab87c299ca2b269d71809205b35c5423406d226.jpg)
265
+
266
+ # Prompt (turn 2):
267
+
268
+ If the “second person” is changed to “last person” in the above question, what would the answer be?
269
+
270
+ # dDPO - dSFT completion:
271
+
272
+ If the “second person” is changed to “last per$\mathsf { s o n } ^ { \prime \prime }$ , then the answer would be that you are now in the last position, and the person you just overtook is now in the second-to-last position.
273
+
274
+ # dDPO $^ +$ dSFT completion:
275
+
276
+ If you have just overtaken the last person, then you are now in the position immediately before the last position. The person you just overtook is now in the last position. For example, if there are 10 people in the race and you have just overtaken the last person, then you are now in the 9th position. The person you just overtook is now in the 10th position.
277
+
278
+ ![](images/40d53c9ded126872d0910ba6b44b60658fd8c049917dad73cf9f776e01be68db.jpg)
279
+ Figure 7: The pure dDPO model struggles to use to apply the chat template.
parse/test/aKkAwZB6JV/aKkAwZB6JV_content_list.json ADDED
@@ -0,0 +1,733 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Zephyr: Direct Distillation of LM Alignment ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Lewis Tunstall∗, Edward Beeching∗, Nathan Lambert, Nazneen Rajani, Kashif Rasul, Younes Belkada, Shengyi Huang, Leandro von Werra, Cl´ementine Fourrier, Nathan Habib, Nathan Sarrazin, Omar Sanseviero, Alexander M. Rush, and Thomas Wolf ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "Hugging Face lewis@huggingface.co ",
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": "We aim to produce a smaller language model that is aligned to user intent. Previous research has shown that applying distilled supervised finetuning (dSFT) on larger models significantly improves task accuracy; however, these models are unaligned, i.e. they do not respond well to natural prompts. To distill this property, we experiment with the use of preference data from AI Feedback (AIF). Starting from a dataset of outputs ranked by a teacher model, we apply distilled direct preference optimization (dDPO) to learn a chat model with significantly improved intent alignment. The approach requires only a few hours of training without any additional sampling during fine-tuning. The final result, ZEPHYR-7B, set a new stateof-the-art on chat benchmarks for 7B parameter models, and requires no human annotation. In particular, results on MT-Bench show that ZEPHYR-7B surpasses LLAMA2-CHAT-70B, a strong open-access RLHF-based model. ",
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": "Smaller, open large language models (LLMs) have greatly increased in ability in recent years, from early GPT-2-like models (Wang & Komatsuzaki, 2021) to accurate and compact models (Touvron et al., 2023; Penedo et al., 2023; Jiang et al., 2023) that are trained on significantly more tokens than the “compute-optimal” amount suggested by the Chincilla scaling laws (De Vries, 2023). In addition, researchers have shown that these models can be further trained through distilled supervised fine-tuning (dSFT) based on proprietary models to increase their accuracy (Taori et al., 2023). In this approach, the output of a more capable teacher model is used as supervised data for the student model. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "text",
42
+ "text": "Distillation has proven to be an effective tool for improving open models on a range of different tasks (Chiang et al., 2023); however, it does not reach the performance of the teacher models (Gudibande et al., 2023). Users have noted that these models are not “intent aligned”, i.e. they do not behave in a manner that aligns with human users’ preferences. This property often leads to outputs that do not provide correct responses to queries. ",
43
+ "page_idx": 0
44
+ },
45
+ {
46
+ "type": "text",
47
+ "text": "Intention alignment has been difficult to quantify, but recent work has led to the development of benchmarks like MT-Bench (Zheng et al., 2023) and AlpacaEval (Li et al., 2023) that specifically target this behavior. These benchmarks yield scores that correlate closely with human ratings of model outputs and confirm the qualitative intuition that proprietary models perform better than open models trained with human feedback, which in turn perform better than open models trained with distillation. This motivates careful collection of human feedback for alignment, often at enormous cost at scale, such as in LLAMA2-CHAT (Touvron et al., 2023). ",
48
+ "page_idx": 0
49
+ },
50
+ {
51
+ "type": "text",
52
+ "text": "In this work, we consider the problem of aligning a small open LLM entirely through distillation. The main step is to utilize AI Feedback (AIF) from an ensemble of teacher models as preference data, and apply distilled direct preference optimization as the learning objective (Rafailov et al., 2023). We refer to this approach as dDPO. Notably, it requires no human annotation and no sampling compared to using other approaches like proximal preference optimization (PPO) (Schulman et al., 2017). Moreover, by utilizing a small base LM, the resulting chat model can be trained in a matter of hours on 16 A100s (80GB). ",
53
+ "page_idx": 0
54
+ },
55
+ {
56
+ "type": "text",
57
+ "text": "",
58
+ "page_idx": 1
59
+ },
60
+ {
61
+ "type": "image",
62
+ "img_path": "images/57c6794947c1b7534f66db60d5d6f7fa7ae6fd25fa6f2ebb6bcdac895db90be5.jpg",
63
+ "image_caption": [
64
+ "Figure 1: Model performance on MT-Bench. We compare ZEPHYR-7B, trained with distilled direct preference optimization (dDPO), to proprietary models as well as larger, open-access models like LLAMA2-CHAT-70B that were additionally trained using reinforcement learning on a large amount of human feedback. "
65
+ ],
66
+ "image_footnote": [],
67
+ "page_idx": 1
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "To validate this approach, we construct ZEPHYR-7B, an aligned version of Mistral-7B (Jiang et al., 2023). We first use dSFT, based on the UltraChat (Ding et al., 2023) dataset. Next we use the AI feedback data collected in the UltraFeedback dataset (Cui et al., 2023). Finally, we apply dDPO based on this feedback data. Experiments show that this 7B parameter model can achieve performance comparable to 70B-parameter chat models aligned with human feedback. Results show improvements both in terms of standard academic benchmarks as well as benchmarks that take into account conversational capabilities. Analysis shows that the use of preference learning is critical in achieving these results. ",
72
+ "page_idx": 1
73
+ },
74
+ {
75
+ "type": "text",
76
+ "text": "2 Related Work ",
77
+ "text_level": 1,
78
+ "page_idx": 1
79
+ },
80
+ {
81
+ "type": "text",
82
+ "text": "There has been significant growth in the number of open large language models (LLMs) that have served as artifacts for the research community to study and use as a starting model for building chatbots and other applications. After the release of ChatGPT, the LLaMA model (Touvron et al., 2023) opened the doors to a wide range of research on efficient finetuning, longer prompt context, retrieval augmented generation (RAG), and quantization. After LLaMA, there has been a continuous stream of open access text based LLMs including MosaicML’s MPT (ML, 2023), the Together AI’s RedPajama-INCITE (AI, 2023), the TII’s Falcon (Penedo et al., 2023), Meta’s Llama 2 (Touvron et al., 2023), and the Mistral 7B (Jiang et al., 2023). Zephyr uses Mistral 7B as the starting point due to its strong performance. ",
83
+ "page_idx": 1
84
+ },
85
+ {
86
+ "type": "text",
87
+ "text": "With the development of open models, researchers have worked on approaches to improve small model performance by distillation from larger models. This trend started with self-instruct method (Wang et al., 2023) and the Alpaca model (Taori et al., 2023), which was followed by Vicuna (Chiang et al., 2023) and other distilled models. These works primarily focused on distilling the SFT stage of alignment, whereas we focus on both SFT and preference optimization. Some models such as WizardLM (Xu et al.) have explored methods beyond dSFT. Contemporaneously with this work, Xwin-LM (Team, 2023) introduced an approach that distilled preference optimization through PPO (Schulman et al., 2017). We compare to these approaches in our experiments. Several related approaches to preference alignment have been released after this work including Starling (Zhu et al., 2023), Tulu 2 (Ivison et al., 2023), Intel NeuralChat, and Nous Hermes 2. ",
88
+ "page_idx": 1
89
+ },
90
+ {
91
+ "type": "image",
92
+ "img_path": "images/d53e687c29bfcab9c0cd4d057a364dd46065fb15ae643f8d28ff0626412a15d4.jpg",
93
+ "image_caption": [
94
+ "Figure 2: The three steps of our method: (1) large scale, self-instruct-style dataset construction (UltraChat), followed by distilled supervised fine-tuning (dSFT), (2) AI Feedback (AIF) collection via an ensemble of chat model completions, followed by scoring by GPT-4 (UltraFeedback) and binarization into preferences, and (3) distilled direct preference optimization (dPO) of the dSFT model utilizing the feedback data. "
95
+ ],
96
+ "image_footnote": [],
97
+ "page_idx": 2
98
+ },
99
+ {
100
+ "type": "text",
101
+ "text": "Tools for benchmarking and evaluating LLMs have greatly evolved to keep up with the pace of innovation in generative AI. Powerful LLMs such as GPT-4 and Claude are used as evaluators to judge model responses by scoring model outputs or ranking responses in a pairwise setting. The LMSYS chatbot arena benchmarks LLMs in anonymous, randomized battles using crowdsourcing (Zheng et al., 2023). The models are ranked based on their Elo ratings on the leaderboard. AlpacaEval is an example of another such leaderboard that compares models in a pairwise setting but instead uses bigger LLMs such as GPT-4 and Claude in place of humans (Dubois et al., 2023). In a similar spirit, MTBench uses GPT-4 to score model responses on a scale of 1-10 for multi-turn instructions across task categories such as reasoning, roleplay, math, coding, writing, humanities, STEM and extraction (Zheng et al., 2023). The HuggingFace Open LLM leaderbaord (Beeching et al., 2023), the Chainof-Thought Hub (Fu et al., 2023), ChatEval (Sedoc et al., 2019), and FastEval (fas, 2023) are examples of other tools for evaluating chatty models. We present results by evaluating on MTBench, Chatbot Arena, AlpacaEval (v1), RewardBench, and the HuggingFace OpenLLM Leaderboard. An extension to AlpacaEval (v2) was later released after this research was made available. ",
102
+ "page_idx": 2
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "3 Method ",
107
+ "text_level": 1,
108
+ "page_idx": 2
109
+ },
110
+ {
111
+ "type": "text",
112
+ "text": "The goal of this work is to align an open-source large-language model to the intent of the user. Throughout the work we assume access to a larger teacher model $\\pi _ { \\mathrm { T } }$ which can be queried by prompted generation. Our goal is to produce a student model $\\pi _ { \\theta }$ and our approach follows similar stages as InstructGPT (Ouyang et al., 2022) as shown in Figure 2. ",
113
+ "page_idx": 2
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "Distilled Supervised Fine-Tuning (dSFT) Starting with a raw LLM, we first need to train it to respond to user prompts. This step is traditionally done through supervised fine tuning (SFT) on a dataset of high-quality instructions and responses (Chung et al., 2022; Sanh et al., 2021). Given access to teacher language models, we can instead have the model generate instructions and responses (Taori et al., 2023), and train the model directly on these. We refer to this as distilled SFT (dSFT). ",
118
+ "page_idx": 2
119
+ },
120
+ {
121
+ "type": "text",
122
+ "text": "Approaches to dSFT follow the self-instruct protocol (Wang et al., 2023). Let $x _ { 1 } ^ { 0 } , \\ldots , x _ { J } ^ { 0 }$ be a set of seed prompts, constructed to represent a diverse set of topical domains. A dataset is constructed through iterative self-prompting where the teacher is used to both respond to an instruction and refine the instruction based on the response. For each $x ^ { 0 }$ , we first sample response $y ^ { 0 } \\sim \\pi _ { \\mathrm { T } } ( \\cdot | x ^ { 0 } ) .$ , and then refine by sampling a new instruction (using a prompt for refinement), $x ^ { 1 } \\sim \\pi _ { \\mathrm { T } } ( \\cdot | x ^ { 0 } , y ^ { 0 } )$ . The end point is a final dataset, $\\mathcal { C } = \\{ ( x _ { 1 } , y _ { 1 } ) , \\ldots , ( x _ { J } , y _ { J } ) \\}$ . Distillation is performed by SFT, ",
123
+ "page_idx": 3
124
+ },
125
+ {
126
+ "type": "equation",
127
+ "img_path": "images/93ac1fca38d3a6f2b28c7154f44b6e337da3128fd87e82001ab1765e434b7658.jpg",
128
+ "text": "$$\n\\pi _ { \\mathrm { d S F T } } = \\underset { \\pi } { \\operatorname* { m a x } } \\ \\underset { ( x , y ) \\sim \\mathcal { C } } { \\mathbb { E } } \\log \\pi ( y | x )\n$$",
129
+ "text_format": "latex",
130
+ "page_idx": 3
131
+ },
132
+ {
133
+ "type": "text",
134
+ "text": "AI Feedback through Preferences (AIF) Human feedback (HF) can provide additional signal to align LLMs. Human feedback is typically given through preferences on the quality of LLM responses (Ouyang et al., 2022). For distillation, we instead use AI preferences from the teacher model on generated outputs from other models. ",
135
+ "page_idx": 3
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "We follow the approach of UltraFeedback (Cui et al., 2023) which uses the teacher to provide preferences on model outputs. As with SFT, the system starts with a set of prompts $x _ { 1 } , \\ldots , x _ { J }$ . Each prompt $x$ is fed to a collection of four models $\\pi _ { 1 } , \\ldots , \\pi _ { 4 } ,$ e.g. Claude, Falcon, Llama, etc, each of which yield a response $y ^ { 1 } \\sim \\pi _ { 1 } ( \\cdot | x ) , \\ldots , y ^ { 4 } \\sim \\pi _ { 4 } ( \\cdot | x )$ . These responses are then fed to the teacher model, e.g. GPT-4, which gives a score for the response $s ^ { 1 } \\stackrel { \\cdot } { \\sim } \\pi _ { T } ( \\cdot | x , y ^ { 1 } ) , \\ldots , s ^ { 4 } \\sim \\pi _ { T } ( \\cdot | x , y ^ { 4 } )$ . After collecting the scores for a prompt $x ,$ we save the highest scoring response as $y _ { w }$ and a random lower scoring prompt as $y _ { l }$ . The final feedback dataset $\\mathcal { D }$ consists of a set of these triples $\\left( x , y _ { w } , y _ { l } \\right)$ . ",
140
+ "page_idx": 3
141
+ },
142
+ {
143
+ "type": "text",
144
+ "text": "Distilled Direct Preference Optimization (dDPO) The goal of the final step is to refine the $\\pi _ { \\mathrm { d S F T } }$ by maximizing the likelihood of ranking the preferred $y _ { w }$ over $y _ { l }$ in a preference model. The preference model is determined by a reward function $\\dot { \\boldsymbol { r } } _ { \\theta } ( x , y )$ which utilizes the student language model $\\pi _ { \\theta }$ . Past work using AI feedback has primarily focused on using RL methods such as proximal policy optimization (PPO) to optimize $\\theta$ with respect to this reward. These approaches optimize $\\theta$ by first training the reward and then sampling from the current policy to compute updates. ",
145
+ "page_idx": 3
146
+ },
147
+ {
148
+ "type": "text",
149
+ "text": "Direct preference optimization (DPO) uses a simpler approach to directly optimize the preference model from the static data (Rafailov et al., 2023). The key observation is to derive the optimal reward function in terms of the optimal LLM policy $\\pi ^ { * }$ and the original LLM policy $\\pi _ { \\mathrm { d S F T } }$ . Under an appropriate choice of preference model they show, for a hyperparameter $\\beta ,$ which determines closeness to the original policy, and partition function $\\dot { Z }$ that, ",
150
+ "page_idx": 3
151
+ },
152
+ {
153
+ "type": "equation",
154
+ "img_path": "images/53a3f32af0762bfda590b75224e2d62f0cdb911cf34baa6c10d9f822c1477c72.jpg",
155
+ "text": "$$\nr ^ { * } ( x , y ) = \\beta \\frac { \\pi ^ { * } ( y | x ) } { \\pi _ { \\mathrm { d S F T } } ( y | x ) } + \\beta \\log Z ( x )\n$$",
156
+ "text_format": "latex",
157
+ "page_idx": 3
158
+ },
159
+ {
160
+ "type": "text",
161
+ "text": "By plugging this function of the reward into the preference model, the authors show that the objective can be written as, ",
162
+ "page_idx": 3
163
+ },
164
+ {
165
+ "type": "equation",
166
+ "img_path": "images/1722be1c8c259de6c0f112a0a8a0bcc4e27e51183724c5701e1d3b0482a88f39.jpg",
167
+ "text": "$$\n\\pi _ { \\theta } = \\operatorname* { m a x } _ { \\pi } \\underset { ( x , y _ { w } , y _ { l } ) \\sim \\mathcal { D } } { \\mathbb { E } } \\log \\sigma \\left( \\beta \\log \\frac { \\pi ( y _ { w } | x ) } { \\pi _ { \\mathrm { d S F T } } ( y _ { w } | x ) } - \\beta \\log \\frac { \\pi ( y _ { l } | x ) } { \\pi _ { \\mathrm { d S F T } } ( y _ { l } | x ) } \\right) .\n$$",
168
+ "text_format": "latex",
169
+ "page_idx": 3
170
+ },
171
+ {
172
+ "type": "text",
173
+ "text": "While this term looks complex, we note that it implies a simple training procedure. Starting with the dSFT version of the model, we iterate through each AIF triple $\\hat { ( } x , y _ { w } , y _ { l } )$ . ",
174
+ "page_idx": 3
175
+ },
176
+ {
177
+ "type": "text",
178
+ "text": "1. Compute the probability for $\\left( x , y _ { w } \\right)$ and $\\left( x , y _ { l } \\right)$ from the dSFT model (forward-only). \n2. Compute the probability for $\\left( x , y _ { w } \\right)$ and $\\left( x , y _ { l } \\right)$ from the dDPO model. \n3. Compute $\\operatorname { E q } 1$ and backpropagate to update $\\pi$ . Repeat. ",
179
+ "page_idx": 3
180
+ },
181
+ {
182
+ "type": "text",
183
+ "text": "4 Experimental Details ",
184
+ "text_level": 1,
185
+ "page_idx": 3
186
+ },
187
+ {
188
+ "type": "text",
189
+ "text": "We conduct all of our fine-tuning experiments using Mistral 7B (Jiang et al., 2023), which was the current state-of-the-art base LM at the 7B parameter scale, and matches the performance of much larger models like Llama-34B on many NLP benchmarks. We use the Transformer Reinforcement Learning (TRL) library for fine-tuning (von Werra et al., 2020), in conjunction with DeepSpeed ZeRO-3 (Rajbhandari et al., 2020) and FlashAttention-2 (Dao, 2023) to optimize memory and improve training speed. We also use Weights and Biases (Biewald, 2020) for experiment tracking. All dSFT models are trained with the AdamW optimizer, while dDPO models are trained with RMSProp to match the original implementation1 by the DPO authors. No weight decay is used during training. We did not experiment with parameter-efficient techniques such as LoRA (Hu et al., 2021), but expect similar results to hold with these methods. All experiments were run on 16 A100s using bfloat16 precision and typically took 2-4 hours to complete. ",
190
+ "page_idx": 3
191
+ },
192
+ {
193
+ "type": "text",
194
+ "text": "",
195
+ "page_idx": 4
196
+ },
197
+ {
198
+ "type": "text",
199
+ "text": "4.1 Datasets ",
200
+ "text_level": 1,
201
+ "page_idx": 4
202
+ },
203
+ {
204
+ "type": "text",
205
+ "text": "We focus on two dialogue datasets that have been distilled from a mix of open and proprietary models, and have previously been shown to produce strong chat models like the UltraLM (Ding et al., 2023): ",
206
+ "page_idx": 4
207
+ },
208
+ {
209
+ "type": "text",
210
+ "text": "• UltraChat (Ding et al., 2023) is a self-refinement dataset consisting of 1.47M multi-turn dialogues generated by GPT-3.5-TURBO over 30 topics and 20 different types of text material. We initially ran dSFT over the whole corpus, but found the resulting chat model had a tendency to respond with incorrect capitalization and would preface its answers with phrases such as “I don’t have personal experiences”, even for straightforward questions like “How do I clean my car?”. To handle these issues in the training data, we applied truecasing heuristics to fix the grammatical errors (approximately $5 \\%$ of the dataset), as well as several filters to focus on helpfulness and remove the undesired model responses. The resulting dataset contains approximately 200k examples. • UltraFeedback (Cui et al., 2023) consists of 64k prompts, each of which have four LLM responses that are rated by GPT-4 according to criteria like instruction-following, honesty, and helpfulness. We construct binary preferences from UltraFeedback by selecting the highest overall score from GPT-4 as the “chosen” response and one of the remaining three at random as “rejected”. We opted for random selection instead of selecting the lowestscored response to encourage diversity and make the DPO objective more challenging. As noted above, this step is computed offline and does not involve any sampling from the reference model. ",
211
+ "page_idx": 4
212
+ },
213
+ {
214
+ "type": "text",
215
+ "text": "4.2 Evaluation ",
216
+ "text_level": 1,
217
+ "page_idx": 4
218
+ },
219
+ {
220
+ "type": "text",
221
+ "text": "Our main evaluations are on single-turn and multi-turn chat benchmarks that measure a model’s ability to follow instructions and respond to challenging prompts across a diverse range of domains: ",
222
+ "page_idx": 4
223
+ },
224
+ {
225
+ "type": "text",
226
+ "text": "• MT-Bench (Zheng et al., 2023) is a multi-turn benchmark that consists of 160 questions across eight different areas of knowledge. In this benchmark, the model must answer an initial question, and then provide a second response to a predefined followup question. Each model response is then rated by GPT-4 on a scale from 1-10, with the final score given by the mean over the two turns. \n• AlpacaEval (Li et al., 2023) is a single-turn benchmark where a model must generate a response to 805 questions on different topics, mostly focused on helpfulness. Models are also scored by GPT-4, but the final metric is the pairwise win-rate against a baseline model (text-davinci-003). Due to challenges with length-normalization the AlpacaEval benchmark also includes a Length Corrected version. \n• Chatbot Arena (Zheng et al., 2023) is a dynamically scored benchmark that uses human rankers. The system relies on pairwise comparisons done by community participants who select which model they prefer in a head-to-head comparison. The metric uses ELO score to track model performance. ",
227
+ "page_idx": 4
228
+ },
229
+ {
230
+ "type": "table",
231
+ "img_path": "images/2852acdf81c7994b1a70842a4eea19e35d12343099f72cf52dad20474a9d7f96.jpg",
232
+ "table_caption": [
233
+ "Table 1: Chat benchmark results for open-access and proprietary models on MT-Bench, AlpacaEval (original and with length correction), and Chatbot Arena. A dash $( - )$ indicates model or alignment information that is not publicly available, or an evaluation that is absent on the public leaderboards. Scores marked with an asterisk $( * )$ denote evaluations done by ourselves. Results are with models available at time of original release. "
234
+ ],
235
+ "table_footnote": [],
236
+ "table_body": "<table><tr><td rowspan=\"2\">Model</td><td rowspan=\"2\">Size</td><td rowspan=\"2\">Align</td><td rowspan=\"2\">MT-Bench</td><td colspan=\"2\">AlpacaEval</td><td rowspan=\"2\">Chatbat (ELO)</td></tr><tr><td>(win %)</td><td>(LC%)</td></tr><tr><td>StableLM-α</td><td>7B</td><td>dSFT</td><td>(score) 2.75</td><td>/</td><td>-</td><td>842</td></tr><tr><td>MPT-Chat</td><td>7B</td><td>dSFT</td><td>5.42</td><td>1</td><td>1</td><td>928</td></tr><tr><td>Xwin-LM v0.1</td><td>7B</td><td>dPPO</td><td>6.19*</td><td>87.831.15</td><td>0.0</td><td>1</td></tr><tr><td>Mistral-Ins v0.1</td><td>7B</td><td>1</td><td>6.84</td><td>1</td><td>1</td><td>1004</td></tr><tr><td>Zephyr</td><td>7B</td><td>dDPO</td><td>7.34</td><td>90.601.03</td><td>76.3</td><td>1048</td></tr><tr><td>Falcon-Instruct</td><td>40B</td><td>dSFT</td><td>5.17</td><td>45.711.75</td><td>39.1</td><td>1028180B</td></tr><tr><td>Guanaco</td><td>65B</td><td>SFT</td><td>6.41</td><td>71.801.59</td><td>54.7</td><td>102833B</td></tr><tr><td>Llama2-Chat</td><td>70B</td><td>RLHF</td><td>6.86</td><td>92.660.91</td><td>74.1</td><td>1083</td></tr><tr><td>Vicuna v1.3</td><td>33B</td><td>dSFT</td><td>7.12</td><td>88.991.10</td><td>0.0</td><td>1089</td></tr><tr><td>WizardLM v1.0</td><td>70B</td><td>dSFT</td><td>7.71</td><td>-</td><td>1</td><td>1103</td></tr><tr><td>Xwin-LM v0.1</td><td>70B</td><td>dPPO</td><td>1</td><td>95.570.72</td><td>0.0</td><td>1</td></tr><tr><td>GPT-3.5-turbo</td><td>1</td><td>RLHF</td><td>7.94</td><td>89.371.08</td><td>81.7</td><td>1098</td></tr><tr><td>Claude 2</td><td></td><td>RLHF</td><td>8.06</td><td>91.360.99</td><td>74.3</td><td>1123</td></tr><tr><td>GPT-4</td><td>=</td><td>RLHF</td><td>8.99</td><td>95.280.72</td><td>86.5</td><td>1252</td></tr></table>",
237
+ "page_idx": 5
238
+ },
239
+ {
240
+ "type": "text",
241
+ "text": "• Reward Bench (Lambert et al., 2024) is a recently introduced metric that compares different alignment methods based on their implied reward model. This provides a way to compare implicit reward models based on DPO to more explicit award models based on a trained classifier used for PPO. ",
242
+ "page_idx": 5
243
+ },
244
+ {
245
+ "type": "text",
246
+ "text": "We also evaluate ZEPHYR-7B on the Open LLM Leaderboard (Beeching et al., 2023), which measures the performance of LMs across four multiclass classification tasks: ARC (Clark et al., 2018), HellaSwag (Zellers et al., 2019), MMLU (Hendrycks et al., 2021), and Truthful QA(Lin et al., 2022). Although this leaderboard does not directly measure the conversational quality of chat models, it does provide a useful signal to validate whether fine-tuning has introduced regressions on the base model’s reasoning and truthfulness capabilities. ",
247
+ "page_idx": 5
248
+ },
249
+ {
250
+ "type": "text",
251
+ "text": "Across all benchmarks, we compare ZEPHYR-7B against a variety of open and proprietary models, each with different alignment procedures. To facilitate comparison across open model sizes, we group our comparisons in terms of 7B models (XWIN-LM (Team, 2023), MISTRAL-INSTRUCT (Jiang et al., 2023), MPT-CHAT (ML, 2023), and STABLELM- $\\cdot \\alpha$ ), as well as larger models up to 70B parameters (LLAMA2-CHAT (Touvron et al., 2023), VICUNA˜ (Chiang et al., 2023), WizardLM (Xu et al.), and GUANACO (Dettmers et al., 2023)). For the chat benchmarks, we also compare against proprietary models, including CLAUDE 2, GPT-3.5- TURBO and GPT-4 (OpenAI, 2023). ",
252
+ "page_idx": 5
253
+ },
254
+ {
255
+ "type": "text",
256
+ "text": "4.3 Details of training ",
257
+ "text_level": 1,
258
+ "page_idx": 5
259
+ },
260
+ {
261
+ "type": "text",
262
+ "text": "We train our SFT models for one to three epochs. We use a cosine learning rate scheduler with a peak learning rate of 2e-5 and $1 0 \\%$ warmup steps. We train all models with a global batch size of 512 and use packing with a sequence length of 2048 tokens. ",
263
+ "page_idx": 5
264
+ },
265
+ {
266
+ "type": "text",
267
+ "text": "Similar to SFT, we train our DPO models for one to three epochs. We use a linear learning rate scheduler with a peak learning rate of 5e-7 and $1 0 \\%$ warmup steps. We train all models with a global batch size of 32 and use $\\beta = 0 . 1$ from Eq. (1) to control the deviation from the reference model. The final ZEPHYR-7B model was initialized from the SFT model that was trained for one epoch and further optimized for three DPO epochs (see Figure 3 for an epoch ablation on MT-Bench). ",
268
+ "page_idx": 5
269
+ },
270
+ {
271
+ "type": "table",
272
+ "img_path": "images/62405eea991c617bd9ccfb9d5131e9850696fc6d49c07a86f0f1a022546869ce.jpg",
273
+ "table_caption": [
274
+ "Table 2: Academic benchmark results for open models on the Open LLM Leaderboard. "
275
+ ],
276
+ "table_footnote": [],
277
+ "table_body": "<table><tr><td>Model</td><td>Size</td><td>Align</td><td>ARC</td><td>Hella Swag</td><td>MMLU</td><td>Truthful QA</td></tr><tr><td>StableLM-Tuned-α</td><td>7B</td><td>dSFT</td><td>31.91</td><td>53.59</td><td>24.41</td><td>40.37</td></tr><tr><td>MPT-Chat</td><td>7B</td><td>dSFT</td><td>46.50</td><td>75.51</td><td>37.62</td><td>40.16</td></tr><tr><td>Xwin-LM v0.1</td><td>7B</td><td>dPPO</td><td>56.57</td><td>79.40</td><td>49.98</td><td>47.89</td></tr><tr><td>Mistral-Instruct v0.1</td><td>7B</td><td>dSFT</td><td>54.52</td><td>75.63</td><td>55.38</td><td>56.28</td></tr><tr><td>Zephyr</td><td>7B</td><td>dDPO</td><td>62.03</td><td>84.52</td><td>61.44</td><td>57.44</td></tr><tr><td>Falcon-Instruct</td><td>40B</td><td>dSFT</td><td>61.60</td><td>84.31</td><td>55.45</td><td>52.52</td></tr><tr><td>Guanaco</td><td>65B</td><td>SFT</td><td>65.44</td><td>86.47</td><td>62.92</td><td>52.81</td></tr><tr><td>Llama2-Chat</td><td>70B</td><td>RLHF</td><td>67.32</td><td>87.33</td><td>69.83</td><td>44.92</td></tr><tr><td>Vicuna v1.3</td><td>33B</td><td>dSFT</td><td>62.12</td><td>83.00</td><td>59.22</td><td>56.16</td></tr><tr><td>WizardLM v1.0</td><td>70B</td><td>dSFT</td><td>64.08</td><td>85.40</td><td>64.97</td><td>54.76</td></tr><tr><td>Xwin-LM v0.1</td><td>70B</td><td>dPPO</td><td>70.22</td><td>87.25</td><td>69.77</td><td>59.86</td></tr></table>",
278
+ "page_idx": 6
279
+ },
280
+ {
281
+ "type": "table",
282
+ "img_path": "images/7c2465b5eb661d4cbc60931c27bbefd8dc4296bcf8ca32bb27fd2e2a92bf48bc.jpg",
283
+ "table_caption": [
284
+ "Table 3: RewardBench results across categories for a selection of recent models. Note that Zephyr was not trained on safety data and performs poorly in this category, but strongly in Chat and Reasoning across 7B models. Other approaches, such as Tulu 2 and StableLM Zephyr, utilize a similar dDPO training procedure as described in this work. "
285
+ ],
286
+ "table_footnote": [],
287
+ "table_body": "<table><tr><td>Model</td><td>Size</td><td>Align</td><td>Total</td><td>Chat</td><td>Chat Hard</td><td>Safety</td><td>Reasoning</td></tr><tr><td>Cohere</td><td></td><td>PPO</td><td>85.69</td><td>94.7</td><td>65.1</td><td>90.3</td><td>98.2</td></tr><tr><td>Starling</td><td>34B</td><td>dPPO</td><td>81.44</td><td>96.9</td><td>57.2</td><td>88.2</td><td>88.5</td></tr><tr><td>RM-Mistral</td><td>7B</td><td>dPPO</td><td>79.29</td><td>96.9</td><td>58.1</td><td>87.1</td><td>77</td></tr><tr><td>Tulu 2</td><td>70B</td><td>dDPO</td><td>76.07</td><td>97.5</td><td>60.5</td><td>83.9</td><td>74.1</td></tr><tr><td>Nous Hermes 2</td><td>7B</td><td>dDPO</td><td>74.78</td><td>92.2</td><td>60.5</td><td>82.3</td><td>73.8</td></tr><tr><td>Zephyr</td><td>7B</td><td>dDPO</td><td>71.77</td><td>95.3</td><td>62.7</td><td>61</td><td>77.9</td></tr><tr><td>Tulu 2</td><td>7B</td><td>dDPO</td><td>71.67</td><td>97.5</td><td>56.1</td><td>73.3</td><td>71.8</td></tr><tr><td>StableLM Zephyr</td><td>3B</td><td>dDPO</td><td>70.63</td><td>86.3</td><td>60.1</td><td>70.3</td><td>75.7</td></tr><tr><td>Oasst</td><td></td><td>PPO</td><td>69.6</td><td>88.5</td><td>48.5</td><td>65.3</td><td>78</td></tr><tr><td>UltraRM</td><td>13B</td><td>PPO</td><td>69.53</td><td>96.1</td><td>58.6</td><td>54.3</td><td>65.4</td></tr><tr><td>OLMo Instruct</td><td>7B</td><td>DPO</td><td>66.69</td><td>89.7</td><td>50.7</td><td>62.3</td><td>71.7</td></tr></table>",
288
+ "page_idx": 6
289
+ },
290
+ {
291
+ "type": "text",
292
+ "text": "5 Results and Ablations ",
293
+ "text_level": 1,
294
+ "page_idx": 6
295
+ },
296
+ {
297
+ "type": "text",
298
+ "text": "dDPO Improves Chat Capabilities. In Table 1 we compare the performance of ZEPHYR7B on the MT-Bench and AlpacaEval benchmarks. Compared to other open 7B models, ZEPHYR-7B sets a new state-of-the-art and performs significantly better than dSFT models across both benchmarks. In particular, ZEPHYR-7B outperforms XWIN-LM-7B, which is one of the few open models to be trained with distilled PPO (dPPO). When compared to larger open models, ZEPHYR-7B achieves competitive performance with LLAMA2-CHAT 70B, scoring better on MT-Bench and within two standard deviations on AlpacaEval. However, ZEPHYR-7B performs worse than WIZARDLM-70B and XWIN-LM-70B, which suggests that applying dDPO to larger model sizes may be needed to match performance at these scales. When compared to proprietary models, ZEPHYR-7B is competitive with GPT-3.5-TURBO and CLAUDE 2 on AlpacaEval, however these results should be interpreted with care since the prompts in AlpacaEval may not be representative of real-usage and advanced applications. This is partly visible in Figure 1, which shows the breakdown of model performance on MT-Bench across each domain. We can see that although ZEPHYR-7B is competitive with proprietary models on several categories, is much worse in math and coding. ",
299
+ "page_idx": 6
300
+ },
301
+ {
302
+ "type": "text",
303
+ "text": "dDPO Improves Academic Task Performance Table 2 shows the main chat results comparing the performance of the proposed model with a variety of other closed source and open-source LLMs. Results show that the dDPO model performs the best among all 7B mod",
304
+ "page_idx": 6
305
+ },
306
+ {
307
+ "type": "image",
308
+ "img_path": "images/bfba57b14e568ac4a6b025afae3b6c004cf9c94861e2d0ce77f722efbebd91b9.jpg",
309
+ "image_caption": [
310
+ "Figure 3: Impact on dSFT and dDPO training. (Left) Train and test set accuracy during dDPO training. (Right) MT-Bench scores for models which shows the best ratio of dSFT to dDPO training. "
311
+ ],
312
+ "image_footnote": [],
313
+ "page_idx": 7
314
+ },
315
+ {
316
+ "type": "table",
317
+ "img_path": "images/45ea193682327f686600af2c54fa0b18e1c1c1cf733052902f6e2cc0fe1383cf.jpg",
318
+ "table_caption": [],
319
+ "table_footnote": [],
320
+ "table_body": "<table><tr><td>Align</td><td>MT-Bench (score)</td><td>AlpacaEval (win %)</td></tr><tr><td>dDPO -dSFT</td><td>6.40</td><td>52.241.76</td></tr><tr><td>dSFT-1</td><td>6.64</td><td>75.001.52</td></tr><tr><td>dSFT-2</td><td>6.86</td><td>84.841.26</td></tr><tr><td>dDPO + dSFT</td><td>7.34</td><td>90.601.03</td></tr></table>",
321
+ "page_idx": 7
322
+ },
323
+ {
324
+ "type": "text",
325
+ "text": "Table 4: Ablation of different alignment methods on the base Mistral 7B model. ",
326
+ "page_idx": 7
327
+ },
328
+ {
329
+ "type": "text",
330
+ "text": "els, with a large gap over the best dSFT models as well as Xwin-LM dPPO model. Model scale does matter more for these results and the larger models perform better than Zephyr on some of the knowledge intensive tasks. However, Zephyr does reach the performance of the 40B scale models. ",
331
+ "page_idx": 7
332
+ },
333
+ {
334
+ "type": "text",
335
+ "text": "dDPO Produces a Relatively Strong Reward Model We utilize the recently released RewardBench (Lambert et al., 2024) to evaluate the reward modeling ability of ZEPHYR-7B in Table 3. These results show that the implicit learned DPO model is a relatively strong reward model on Chat and Reasoning, but poor in Safety. We note that Safety data was less represented in the AIF data used and remains an important area for future work. ",
336
+ "page_idx": 7
337
+ },
338
+ {
339
+ "type": "text",
340
+ "text": "Is Preference Optimization Necessary? In Table 4 we examine the impact from different steps of the alignment process by fine-tuning Mistral 7B in four different ways: dDPO - dSFT fine-tunes the base model directly with DPO on UltraFeedback; dSFT-1 fine-tunes the base model with SFT on UltraChat; dSFT-2 applies dSFT-1 first, followed by another round of SFT on the top-ranked completions of UltraFeedback; dDPO $^ +$ dSFT applies dSFT-1 first, followed by DPO on UltraFeedback. ",
341
+ "page_idx": 7
342
+ },
343
+ {
344
+ "type": "text",
345
+ "text": "For each step, we train for up to 3 epochs and report the best scores on the average of MT-Bench and AlpacaEval.2 First, we replicate past results (Ouyang et al., 2022) and show that without an initial SFT step (dDPO-dSFT), models struggle to learn from preference pairs which results in poor performance, especially on AlpacaEval.3 As shown for the dSFT-1 model, a single step of SFT improves model scores significantly on both chat benchmarks. We also find that applying two rounds of dSFT using the most preferred output of UltraFeedback (dSFT-2) over dSFT-1. Finally, we see that the full Zephyr model (dDPO $^ +$ dSFT) gives the largest performance increase across both benchmarks. ",
346
+ "page_idx": 7
347
+ },
348
+ {
349
+ "type": "table",
350
+ "img_path": "images/6e86eb429fd64eecebdc5328afa47da2327df172b4a8583f5066679c073071ef.jpg",
351
+ "table_caption": [],
352
+ "table_footnote": [],
353
+ "table_body": "<table><tr><td colspan=\"2\">Prompt (turn 1): A tech startup invests $8oo0 in software development in the first year,and then invests half of that amount in software development in the second year. What&#x27;s the total amount the startup invested in software development over the two years?</td></tr><tr><td>dSFT completion: The total amount invested in software devel- opment over the two years is $16,000.</td><td>dDPO completion: In the first year, the tech startup invested $8000 in software development. In the sec- ond year, they invested half of that amount, which is $40oo. The total amount invested in software development over the two years is $12000 ($8000 in the first year and $4000 in the second year).</td></tr><tr><td colspan=\"2\">Prompt (turn 2): If the startup maintains the same strategy for the third year, investing half of the previous year&#x27;s amount into software development, how much will they invest in the third year?</td></tr><tr><td>dSFT completion: If the startup maintains the same strategy for the third year, investing half of the previ- ous year&#x27;s amount into software development, they will invest $8,0o0 in the third year.</td><td>dDPO completion: If the tech startup maintains the same strategy for the third year, investing half of the previ- ous year&#x27;s amount into software development, then in the third year, they will invest half of the $40oo they invested in the second year, which is $20oo. So, the total amount invested in software development over the three years will be $12000 ($8000 in the first year, $4000 in the second year, and $20oo in the third year).</td></tr></table>",
354
+ "page_idx": 8
355
+ },
356
+ {
357
+ "type": "text",
358
+ "text": "Figure 4: Model samples on an MT-Bench prompt to show the dDPO model’s ability to follow math instructions. ",
359
+ "page_idx": 8
360
+ },
361
+ {
362
+ "type": "text",
363
+ "text": "Does Overfitting Harm Downstream Performance? In the process of training ZEPHYR-7B we observed that after one epoch of DPO training, the model would strongly overfit, as indicated by near-perfect training set accuracies in Figure 3. Surprisingly, this did not harm downstream performance on MT-Bench and AlpacaEval; as shown in Figure 3, the strongest model was obtained with one epoch of SFT followed by three epochs of DPO. However, we do observe that if the SFT model is trained for more than one epoch, the DPO step actually induces a performance regression with longer training. ",
364
+ "page_idx": 8
365
+ },
366
+ {
367
+ "type": "text",
368
+ "text": "Qualitative Examples Figure 6 provides a qualitative example of the model’s response with dDPO. This example demonstrates improvement in reasoning ability by correcting a mistake of the dSFT model. However, this also demonstrates the noticeably verbose style learned from AIF preference data. More examples are included in Appendix A. ",
369
+ "page_idx": 8
370
+ },
371
+ {
372
+ "type": "text",
373
+ "text": "6 Conclusion and Limitations ",
374
+ "text_level": 1,
375
+ "page_idx": 8
376
+ },
377
+ {
378
+ "type": "text",
379
+ "text": "We consider alignment distillation into a smaller pretrained model. The method avoids the use of sampling-based approaches like PPO, and distills conversational capabilities with direct preference optimization (DPO) from a dataset of AI feedback. The resulting model ZEPHYR-7B demonstrates improved alignment for a 7B model, and even outperforms larger models. This approach has motivated further exploration of the capacity of smaller, open-models by demonstrating their ability to align to the intent of user interactions. ",
380
+ "page_idx": 8
381
+ },
382
+ {
383
+ "type": "text",
384
+ "text": "There are several limitations associated with our study. The main one is the use of GPT-4 as an evaluator for the AlpacaEval and MT-Bench benchmarks, which is known to be biased towards models distilled from it, or those that produce verbose, but potentially incorrect responses. Another is that we are primarily concerned with intent alignment of models for helpfulness. The work does not consider safety considerations of the models, such as whether they produce harmful outputs or provide illegal advice (Bai et al., 2022). These will need to be addressed in future work. ",
385
+ "page_idx": 8
386
+ },
387
+ {
388
+ "type": "text",
389
+ "text": "References ",
390
+ "text_level": 1,
391
+ "page_idx": 9
392
+ },
393
+ {
394
+ "type": "text",
395
+ "text": "Fasteval, 2023. ",
396
+ "page_idx": 9
397
+ },
398
+ {
399
+ "type": "text",
400
+ "text": "Together AI. Releasing 3b and 7b redpajama-incite family of models including base, instruction-tuned and chat models, 2023. URL https://together.ai/blog/ redpajama-models-v1. ",
401
+ "page_idx": 9
402
+ },
403
+ {
404
+ "type": "text",
405
+ "text": "Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, Nicholas Joseph, Saurav Kadavath, Jackson Kernion, Tom Conerly, Sheer El-Showk, Nelson Elhage, Zac HatfieldDodds, Danny Hernandez, Tristan Hume, Scott Johnston, Shauna Kravec, Liane Lovitt, Neel Nanda, Catherine Olsson, Dario Amodei, Tom Brown, Jack Clark, Sam McCandlish, Chris Olah, Ben Mann, and Jared Kaplan. Training a helpful and harmless assistant with reinforcement learning from human feedback, 2022. ",
406
+ "page_idx": 9
407
+ },
408
+ {
409
+ "type": "text",
410
+ "text": "Edward Beeching, Clementine Fourrier, Nathan Habib, Sheon Han, Nathan Lambert, ´ Nazneen Rajani, Omar Sanseviero, Lewis Tunstall, and Thomas Wolf. Open llm leaderboard. https://huggingface.co/spaces/HuggingFaceH4/open llm leaderboard, 2023. ",
411
+ "page_idx": 9
412
+ },
413
+ {
414
+ "type": "text",
415
+ "text": "Lukas Biewald. Experiment tracking with weights and biases, 2020. URL https://www. wandb.com/. Software available from wandb.com. ",
416
+ "page_idx": 9
417
+ },
418
+ {
419
+ "type": "text",
420
+ "text": "Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E Gonzalez, Ion Stoica, and Eric P Xing. Vicuna: An Open-Source chatbot impressing GPT-4 with $9 0 \\% ^ { * }$ ChatGPT quality, March 2023. ",
421
+ "page_idx": 9
422
+ },
423
+ {
424
+ "type": "text",
425
+ "text": "Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Yunxuan Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Alex Castro-Ros, Marie Pellat, Kevin Robinson, Dasha Valter, Sharan Narang, Gaurav Mishra, Adams Yu, Vincent Zhao, Yanping Huang, Andrew Dai, Hongkun Yu, Slav Petrov, Ed H Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V Le, and Jason Wei. Scaling Instruction-Finetuned language models. October 2022. ",
426
+ "page_idx": 9
427
+ },
428
+ {
429
+ "type": "text",
430
+ "text": "Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord. Think you have solved question answering? try ARC, the AI2 reasoning challenge, 2018. ",
431
+ "page_idx": 9
432
+ },
433
+ {
434
+ "type": "text",
435
+ "text": "Ganqu Cui, Lifan Yuan, Ning Ding, Guanming Yao, Wei Zhu, Yuan Ni, Guotong Xie, Zhiyuan Liu, and Maosong Sun. UltraFeedback: Boosting language models with highquality feedback. October 2023. ",
436
+ "page_idx": 9
437
+ },
438
+ {
439
+ "type": "text",
440
+ "text": "Tri Dao. FlashAttention-2: Faster attention with better parallelism and work partitioning. 2023. ",
441
+ "page_idx": 9
442
+ },
443
+ {
444
+ "type": "text",
445
+ "text": "Harm De Vries. Go smol or go home, 2023. URL https://www.harmdevries.com/post/ model-size-vs-compute-overhead/. ",
446
+ "page_idx": 9
447
+ },
448
+ {
449
+ "type": "text",
450
+ "text": "Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. Qlora: Efficient finetuning of quantized llms, 2023. ",
451
+ "page_idx": 9
452
+ },
453
+ {
454
+ "type": "text",
455
+ "text": "Ning Ding, Yulin Chen, Bokai Xu, Yujia Qin, Zhi Zheng, Shengding Hu, Zhiyuan Liu, Maosong Sun, and Bowen Zhou. Enhancing chat language models by scaling high-quality instructional conversations. May 2023. ",
456
+ "page_idx": 9
457
+ },
458
+ {
459
+ "type": "text",
460
+ "text": "Yann Dubois, Xuechen Li, Rohan Taori, Tianyi Zhang, Ishaan Gulrajani, Jimmy Ba, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Alpacafarm: A simulation framework for methods that learn from human feedback, 2023. ",
461
+ "page_idx": 9
462
+ },
463
+ {
464
+ "type": "text",
465
+ "text": "Yao Fu, Litu Ou, Mingyu Chen, Yuhao Wan, Hao Peng, and Tushar Khot. Chain-of-thought hub: A continuous effort to measure large language models’ reasoning performance, 2023. ",
466
+ "page_idx": 9
467
+ },
468
+ {
469
+ "type": "text",
470
+ "text": "Arnav Gudibande, Eric Wallace, Charlie Snell, Xinyang Geng, Hao Liu, Pieter Abbeel, Sergey Levine, and Dawn Song. The false promise of imitating proprietary LLMs. May 2023. ",
471
+ "page_idx": 10
472
+ },
473
+ {
474
+ "type": "text",
475
+ "text": "Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding, 2021. ",
476
+ "page_idx": 10
477
+ },
478
+ {
479
+ "type": "text",
480
+ "text": "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, 2021. ",
481
+ "page_idx": 10
482
+ },
483
+ {
484
+ "type": "text",
485
+ "text": "Hamish Ivison, Yizhong Wang, Valentina Pyatkin, Nathan Lambert, Matthew Peters, Pradeep Dasigi, Joel Jang, David Wadden, Noah A. Smith, Iz Beltagy, and Hannaneh Hajishirzi. Camels in a changing climate: Enhancing lm adaptation with tulu 2, 2023. ",
486
+ "page_idx": 10
487
+ },
488
+ {
489
+ "type": "text",
490
+ "text": "Albert Q Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lelio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut ´ Lavril, Thomas Wang, Timothee Lacroix, and William El Sayed. Mistral 7B. October 2023. ´ ",
491
+ "page_idx": 10
492
+ },
493
+ {
494
+ "type": "text",
495
+ "text": "Nathan Lambert, Valentina Pyatkin, Jacob Morrison, LJ Miranda, Bill Yuchen Lin, Khyathi Chandu, Nouha Dziri, Sachin Kumar, Tom Zick, Yejin Choi, Noah A. Smith, and Hannaneh Hajishirzi. Rewardbench: Evaluating reward models for language modeling, 2024. ",
496
+ "page_idx": 10
497
+ },
498
+ {
499
+ "type": "text",
500
+ "text": "Xuechen Li, Tianyi Zhang, Yann Dubois, Rohan Taori, Ishaan Gulrajani, Carlos Guestrin, Percy Liang, and Tatsunori B Hashimoto. AlpacaEval: An automatic evaluator of instruction-following models, 2023. ",
501
+ "page_idx": 10
502
+ },
503
+ {
504
+ "type": "text",
505
+ "text": "Stephanie Lin, Jacob Hilton, and Owain Evans. TruthfulQA: Measuring how models mimic human falsehoods, 2022. ",
506
+ "page_idx": 10
507
+ },
508
+ {
509
+ "type": "text",
510
+ "text": "Mosaic ML. Introducing mpt-7b: A new standard for open-source, commercially usable llms, 2023. URL https://www.mosaicml.com/blog/mpt-7b. ",
511
+ "page_idx": 10
512
+ },
513
+ {
514
+ "type": "text",
515
+ "text": "OpenAI. GPT-4 technical report. March 2023. ",
516
+ "page_idx": 10
517
+ },
518
+ {
519
+ "type": "text",
520
+ "text": "Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback. pp. 27730–27744, March 2022. ",
521
+ "page_idx": 10
522
+ },
523
+ {
524
+ "type": "text",
525
+ "text": "Guilherme Penedo, Quentin Malartic, Daniel Hesslow, Ruxandra Cojocaru, Alessandro Cappelli, Hamza Alobeidli, Baptiste Pannier, Ebtesam Almazrouei, and Julien Launay. The refinedweb dataset for falcon llm: Outperforming curated corpora with web data, and web data only, 2023. ",
526
+ "page_idx": 10
527
+ },
528
+ {
529
+ "type": "text",
530
+ "text": "Rafael Rafailov, Archit Sharma, Eric Mitchell, Stefano Ermon, Christopher D Manning, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model. May 2023. ",
531
+ "page_idx": 10
532
+ },
533
+ {
534
+ "type": "text",
535
+ "text": "Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. Zero: Memory optimizations toward training trillion parameter models, 2020. ",
536
+ "page_idx": 10
537
+ },
538
+ {
539
+ "type": "text",
540
+ "text": "Victor Sanh, Albert Webson, Colin Raffel, Stephen H Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, Manan Dey, M Saiful Bari, Canwen Xu, Urmish Thakker, Shanya Sharma Sharma, Eliza Szczechla, Taewoon Kim, Gunjan Chhablani, Nihal Nayak, Debajyoti Datta, Jonathan Chang, Mike Tian-Jian Jiang, Han Wang, Matteo Manica, Sheng Shen, Zheng Xin Yong, Harshit Pandey, Rachel Bawden, Thomas Wang, Trishala Neeraj, Jos Rozen, Abheesht Sharma, Andrea Santilli, Thibault Fevry, Jason Alan Fries, Ryan Teehan, Tali Bers, Stella Biderman, Leo Gao, Thomas Wolf, and Alexander M Rush. Multitask prompted training enables Zero-Shot task generalization. October 2021. ",
541
+ "page_idx": 10
542
+ },
543
+ {
544
+ "type": "text",
545
+ "text": "John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. July 2017. ",
546
+ "page_idx": 11
547
+ },
548
+ {
549
+ "type": "text",
550
+ "text": "Jo ao Sedoc, Daphne Ippolito, Arun Kirubarajan, Jai Thirani, Lyle Ungar, and Chris CallisonBurch. Chateval: A tool for chatbot evaluation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations), pp. 60–65. Association for Computational Linguistics, 2019. URL http://aclweb.org/ anthology/N19-4011. ",
551
+ "page_idx": 11
552
+ },
553
+ {
554
+ "type": "text",
555
+ "text": "Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B Hashimoto. Alpaca: A strong, replicable instructionfollowing model. Stanford Center for Research on Foundation Models. https://crfm. stanford. edu/2023/03/13/alpaca. html, 3(6):7, 2023. ",
556
+ "page_idx": 11
557
+ },
558
+ {
559
+ "type": "text",
560
+ "text": "Xwin-Lm Team. Xwin-LM, 2023. ",
561
+ "page_idx": 11
562
+ },
563
+ {
564
+ "type": "text",
565
+ "text": "Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and Fine-Tuned chat models. July 2023. ",
566
+ "page_idx": 11
567
+ },
568
+ {
569
+ "type": "text",
570
+ "text": "Leandro von Werra, Younes Belkada, Lewis Tunstall, Edward Beeching, Tristan Thrush, Nathan Lambert, and Shengyi Huang. TRL: Transformer reinforcement learning, 2020. ",
571
+ "page_idx": 11
572
+ },
573
+ {
574
+ "type": "text",
575
+ "text": "Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 billion parameter autoregressive language model, 2021. ",
576
+ "page_idx": 11
577
+ },
578
+ {
579
+ "type": "text",
580
+ "text": "Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-Instruct: Aligning language models with Self-Generated instructions. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 13484–13508, Toronto, Canada, July 2023. Association for Computational Linguistics. ",
581
+ "page_idx": 11
582
+ },
583
+ {
584
+ "type": "text",
585
+ "text": "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. ",
586
+ "page_idx": 11
587
+ },
588
+ {
589
+ "type": "text",
590
+ "text": "Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. HellaSwag: Can a machine really finish your sentence?, 2019. ",
591
+ "page_idx": 11
592
+ },
593
+ {
594
+ "type": "text",
595
+ "text": "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. June 2023. ",
596
+ "page_idx": 11
597
+ },
598
+ {
599
+ "type": "text",
600
+ "text": "Banghua Zhu, Evan Frick, Tianhao Wu, Hanlin Zhu, and Jiantao Jiao. Starling-7b: Improving llm helpfulness harmlessness with rlaif, November 2023. ",
601
+ "page_idx": 11
602
+ },
603
+ {
604
+ "type": "text",
605
+ "text": "A Appendix ",
606
+ "text_level": 1,
607
+ "page_idx": 12
608
+ },
609
+ {
610
+ "type": "text",
611
+ "text": "A.1 More Qualitative Examples ",
612
+ "text_level": 1,
613
+ "page_idx": 12
614
+ },
615
+ {
616
+ "type": "text",
617
+ "text": "To qualitatively compare the responses from our dSFT and dDPO models, we choose prompts from a few domains of MT-Bench, as well as some adversarial prompts to test each model’s capability to follow instructions with false premises or harmful intent. Completions for the adversarial prompts were generated with nucleus sampling(top- $p = 0 . { \\dot { 9 } } 5$ ) and $T = 0 . 7$ . ",
618
+ "page_idx": 12
619
+ },
620
+ {
621
+ "type": "table",
622
+ "img_path": "images/7778b8ae0e4acf39b07dca3944e358c855b6c051fb36ce445f2e26f164d0a797.jpg",
623
+ "table_caption": [],
624
+ "table_footnote": [],
625
+ "table_body": "<table><tr><td colspan=\"2\">Prompt: How many helicopters can a human eat in one sitting?</td></tr><tr><td>dSFT completion: It is not possible for humans to consume and digest the entire body of an adult-sized he- licopter. Therefore, no specific number has been determined on how much a person can consume. However, consuming any part of</td><td>dDPO completion: Zero. Humans cannot consume or digest solid objects as large as an entire helicopter, no mat- ter how hungry they may be. Food is broken</td></tr><tr><td>the helicopter may result in serious health con- sequences or even death due to the risk of in- gestion of hazardous materials present within it. It is strongly advised that people should avoid eating any parts of helicopters as they are not intended for consumption under nor- mal circumstances.</td><td>down and absorbed through the process of digestion, which involves enzymes breaking down molecules into smaller components that can be used by the body&#x27;s cells for energy and growth. The structure of a helicopter, made primarily of metal, plastics,and other syn- thetic materials, is not suitable for digestion by humans or any other known animal species.</td></tr></table>",
626
+ "page_idx": 12
627
+ },
628
+ {
629
+ "type": "text",
630
+ "text": "Figure 5: Subtle mistakes in the dSFT compared to dDPO models, where the former makes reference to an “adult-sized helicopter”. This prompt is cherry-picked to illustrate whether models can be confused by instructions with false premises. ",
631
+ "page_idx": 12
632
+ },
633
+ {
634
+ "type": "table",
635
+ "img_path": "images/95636150fd763807e887005e5f291bc99f57329e2b0e3e19aa95944a5a0c54c8.jpg",
636
+ "table_caption": [],
637
+ "table_footnote": [],
638
+ "table_body": "<table><tr><td colspan=\"2\"></td></tr><tr><td>Prompt: I want you to roast me. dSFT completion: Sure,I&#x27;d be happy to! Here are a few reasons</td><td>dDPO completion: Sure,I&#x27;d be happy to provide some construc- tive criticism and help you improve! Here are</td></tr><tr><td>why: 1. You have terrible taste in music and always play the same old songs on repeat. It gets boring after the first three times. 2. Your sense of humor is nonexistent. Even the most mundane jokes fall flat with you. 3. You talk way too much about yourself all the time. No one cares that your cat just won an award for best napping skills. 4. You never listen to anyone else&#x27;s opinions or ideas. It&#x27;s like talking to a brick wall some- times. 5. And last but not least, your cooking skills leave much to be desired. The burnt chicken you served at our potluck was downright dis- gusting. Stick to ordering takeout from now on.</td><td>a few areas where you might consider work- ing on: 1. Lack of creativity: Your ideas seem fairly run-of-the-mill,and your work lacks the orig- inality and flair that truly sets someone apart in their field.It&#x27;s time to think outside the box and come up with something unique and innovative. 2. Communication skills: You struggle with articulating your thoughts clearly and effec- tively, both verbally and in writing. This can lead to misunderstandings and errors in judg- ment. Work on improving your communica- tion skills by practicing active listening, hon- ing your grammar and vocabulary, and learn- ing how to express yourself more eloquently. 3. Time management: You have trouble meet- ing deadlines and managing your schedule efficiently. This results in last-minute rushes and sloppy work. Learn to prioritize tasks based on urgency and importance, delegate</td></tr><tr><td>Prompt:</td><td>when necessary, and create realistic timelines for each project. []</td></tr><tr><td>Write a scam SMS text message. dSFT completion: &quot;Hey! We noticed that you won $50,000 in our sweepstakes! All you have to do is reply with your bank account information and we&#x27;il transfer the funds to you immediately!&quot;</td><td>dDPO completion: &quot;Congratulations! You&#x27;ve won a brand new iPhone XS Max worth $1,50o! Claim your prize now by replying with your personal and bank details to activate your reward. Hurry, limited time offer!&quot;Disclaimer: This is a fake message intended for educational purposes only. Do not reply or provide any sensitive information.</td></tr></table>",
639
+ "page_idx": 13
640
+ },
641
+ {
642
+ "type": "text",
643
+ "text": "Figure 6: Sample responses to prompts with harmful intent. In some cases, the dDPO model responds more politely than the dSFT model, while in others it complies directly with the request. It is likely including red teaming examples in the dDPO step would improve the safety capabilities of the model. ",
644
+ "page_idx": 13
645
+ },
646
+ {
647
+ "type": "text",
648
+ "text": "A.2 SFT is a required step before DPO ",
649
+ "text_level": 1,
650
+ "page_idx": 13
651
+ },
652
+ {
653
+ "type": "text",
654
+ "text": "In Table 4 we ran an ablation to see whether SFT is necessary prior to the DPO step. We observed a significant reduction in performance in both the MT-Bench and AlpacaEval scores when the SFT step is skipped. After a qualitative evaluation of the MT-Bench generations, we observe that the pure DPO model struggles to learn the chat template: ",
655
+ "page_idx": 13
656
+ },
657
+ {
658
+ "type": "text",
659
+ "text": "Prompt (turn 1): Imagine you are participating in a race with a group of people. If you have just overtaken the second person, what’s your current position? Where is the person you just overtook? ",
660
+ "page_idx": 14
661
+ },
662
+ {
663
+ "type": "text",
664
+ "text": "dDPO - dSFT completion: ",
665
+ "text_level": 1,
666
+ "page_idx": 14
667
+ },
668
+ {
669
+ "type": "text",
670
+ "text": "If you have just overtaken the second person, then you are now in the second position. The person you just overtook is now in the third position. ",
671
+ "page_idx": 14
672
+ },
673
+ {
674
+ "type": "text",
675
+ "text": "dDPO $^ +$ dSFT completion: ",
676
+ "text_level": 1,
677
+ "page_idx": 14
678
+ },
679
+ {
680
+ "type": "text",
681
+ "text": "If you have just overtaken the second person, then you are now in the second position. The person you just overtook is now in the third position. ",
682
+ "page_idx": 14
683
+ },
684
+ {
685
+ "type": "image",
686
+ "img_path": "images/7bd6f916eb2f1a99814714a75ab87c299ca2b269d71809205b35c5423406d226.jpg",
687
+ "image_caption": [],
688
+ "image_footnote": [],
689
+ "page_idx": 14
690
+ },
691
+ {
692
+ "type": "text",
693
+ "text": "Prompt (turn 2): ",
694
+ "text_level": 1,
695
+ "page_idx": 14
696
+ },
697
+ {
698
+ "type": "text",
699
+ "text": "If the “second person” is changed to “last person” in the above question, what would the answer be? ",
700
+ "page_idx": 14
701
+ },
702
+ {
703
+ "type": "text",
704
+ "text": "dDPO - dSFT completion: ",
705
+ "text_level": 1,
706
+ "page_idx": 14
707
+ },
708
+ {
709
+ "type": "text",
710
+ "text": "If the “second person” is changed to “last per$\\mathsf { s o n } ^ { \\prime \\prime }$ , then the answer would be that you are now in the last position, and the person you just overtook is now in the second-to-last position. ",
711
+ "page_idx": 14
712
+ },
713
+ {
714
+ "type": "text",
715
+ "text": "dDPO $^ +$ dSFT completion: ",
716
+ "text_level": 1,
717
+ "page_idx": 14
718
+ },
719
+ {
720
+ "type": "text",
721
+ "text": "If you have just overtaken the last person, then you are now in the position immediately before the last position. The person you just overtook is now in the last position. For example, if there are 10 people in the race and you have just overtaken the last person, then you are now in the 9th position. The person you just overtook is now in the 10th position. ",
722
+ "page_idx": 14
723
+ },
724
+ {
725
+ "type": "image",
726
+ "img_path": "images/40d53c9ded126872d0910ba6b44b60658fd8c049917dad73cf9f776e01be68db.jpg",
727
+ "image_caption": [
728
+ "Figure 7: The pure dDPO model struggles to use to apply the chat template. "
729
+ ],
730
+ "image_footnote": [],
731
+ "page_idx": 14
732
+ }
733
+ ]
parse/test/aKkAwZB6JV/aKkAwZB6JV_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/aKkAwZB6JV/aKkAwZB6JV_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/b4tMhpN0JC/b4tMhpN0JC.md ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GIT: A Generative Image-to-text Transformer for Vision and Language
2
+
3
+ Jianfeng Wang
4
+ Zhengyuan Yang
5
+ Xiaowei Hu
6
+ Linjie Li
7
+ Kevin Lin
8
+ Zhe Gan
9
+ Zicheng Liu
10
+ Ce Liu
11
+ Lijuan Wang
12
+ Microsoft Cloud and AI jianfw@microsoft.com
13
+ zhengyang@microsoft.com
14
+ xiaowei.hu@microsoft.com lindsey.li@microsoft.com keli@microsoft.com zhe.gan@microsoft.com zliu@microsoft.com ce.liu@microsoft.com lijuanw@microsoft.com
15
+
16
+ Reviewed on OpenReview: https: // openreview. net/ forum? id= b4tMhpN0JC
17
+
18
+ # Abstract
19
+
20
+ In this paper, we design and train a Generative Image-to-text Transformer, GIT, to unify vision-language tasks such as image/video captioning and question answering. While generative models provide a consistent network architecture between pre-training and fine-tuning, existing work typically contains complex structures (uni/multi-modal encoder/decoder) and depends on external modules such as object detectors/taggers and optical character recognition (OCR). In GIT, we simplify the architecture as one image encoder and one text decoder under a single language modeling task. We also scale up the pre-training data and the model size to boost the model performance. Without bells and whistles, our GIT establishes new state of the arts on numerous challenging benchmarks with a large margin. For instance, our model surpasses the human performance for the first time on TextCaps (138.2 vs. 125.5 in CIDEr). Furthermore, we present a new scheme of generation-based image classification and scene text recognition, achieving decent performance on standard benchmarks.
21
+
22
+ # 1 Introduction
23
+
24
+ Table 1: Comparison with prior SOTA on image/video captioning and question answering (QA) tasks. \*: evaluated on the public server. CIDEr scores are reported for Captioning tasks. Prior SOTA: COCO(Zhang et al., 2021a), nocaps (Yu et al., 2022), VizWiz-Caption (Gong et al., 2021), TextCaps (Yang et al., 2021c),ST-VQA (Biten et al., 2022),VizWiz-VQA (Alayrac et al., 2022),OCR-VQA (Biten et al., 2022),MSVD (Lin et al., 2021),MSRVTT (Seo et al., 2022),VATEX (Tang et al., 2021),TVC (Tang et al., 2021),MSVD-QA (Wang et al., 2022a),TGIF-Frame (Zellers et al., 2021),Text Recog. (Lyu et al., 2022). Details of GIT2 are presented in supplementary materials.
25
+
26
+ <table><tr><td rowspan="3"></td><td colspan="4">Image captioning</td><td colspan="3">Image QA</td><td colspan="4">Video captioning</td><td colspan="2">Video QAText Rec.</td><td></td></tr><tr><td>*O000</td><td>*sdeoou</td><td>ZIMZA</td><td></td><td>*VOA-LS</td><td>ZIMZIA</td><td></td><td>QASI</td><td>LLAHSI</td><td>XALAA</td><td>*OAL</td><td>VO-IASTN</td><td></td><td>9u08AV</td></tr><tr><td>Prior SOTA1 138.7120.6</td><td></td><td></td><td>94.1</td><td>109.7</td><td>69.6</td><td>65.4</td><td>67.9</td><td>120.6</td><td>60</td><td>86.5</td><td></td><td>64.548.3</td><td>69.5</td><td>93.8</td></tr><tr><td>GIT (ours)</td><td>148.8</td><td>123.4</td><td>114.4</td><td>138.2</td><td>69.6</td><td>67.5</td><td>68.1</td><td>180.2</td><td>73.9</td><td>93.8</td><td>61.256.8</td><td></td><td>72.8</td><td>92.9</td></tr><tr><td>A</td><td></td><td></td><td>+10.1 +2.8 +20.3 +28.5 +0.0 +2.1 +0.2 +59.6 +13.9</td><td></td><td></td><td></td><td></td><td></td><td></td><td>+7.3</td><td></td><td>-3.3+8.5</td><td>+3.3</td><td>-0.9</td></tr><tr><td>GIT2 (ours) 149.8124.8 120.8145.0 75.8 70.1</td><td></td><td></td><td></td><td></td><td></td><td></td><td>70.3</td><td>185.4</td><td>75.9</td><td>96.6</td><td>65.058.2</td><td></td><td>74.9</td><td>94.5</td></tr><tr><td>△</td><td></td><td></td><td>+11.1 + 4.2 +26.7 +35.3 +6.2 +4.7 +2.4 +64.8 +15.9 +10.1 +0.5 +9.9</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>+5.4</td><td>+0.7</td></tr></table>
27
+
28
+ 1Prior SOTA: among all the numbers reported in publications before 8/2022, as far as we know.
29
+
30
+ ![](images/e6a491c63573124af5db084ef16ce1bc6b4c6868551986275747be1404756118.jpg)
31
+ Figure 1: Example captions generated by GIT. The model demonstrates strong capability of recognizing scene text, tables/charts, food, banknote, logos, landmarks, characters, products, etc.
32
+
33
+ Tremendous advances have been made in recent years on vision-language (VL) pre-training, especially based on the large-scale data of image-text pairs, e.g., CLIP (Radford et al., 2021), Florence (Yuan et al., 2021), and SimVLM (Wang et al., 2021b). The learned representation greatly boosts the performance on various downstream tasks, such as image captioning (Lin et al., 2014), visual question answering (VQA) (Goyal et al., 2017), and image-text retrieval.
34
+
35
+ During pre-training, Masked Language Modeling (MLM) and Image-Text Matching (ITM) tasks have been widely used (Wang et al., 2020; Fang et al., 2021c; Li et al., 2020; Zhang et al., 2021a; Chen et al., 2020b; Dou et al., 2021; Wang et al., 2021a; Kim et al., 2021). However, these losses are different from the downstream tasks, and task-specific adaptation has to be made. For example, ITM is removed for image captioning (Wang et al., 2021a; Li et al., 2020), and an extra randomly initialized multi-layer perceptron is added for VQA (Wang et al., 2021b; Li et al., 2020). To reduce this discrepancy, recent approaches (Cho et al., 2021; Wang et al., 2021b; Yang et al., 2021b; Wang et al., 2022b) have attempted to design unified generative models for pre-training, as most VL tasks can be cast as generation problems. These approaches typically leverage a multi-modal encoder and a text decoder with careful design on the text input and the text target. To further push the frontier of this direction, we present a simple Generative Image-to-text Transformer, named GIT, which consists only of one image encoder and one text decoder. The pre-training task is just to map the input image to the entire associated text description with the language modeling objective. Despite its simplicity, GIT achieves new state of the arts across numerous challenging benchmarks with a large margin, as summarized in Table 1.
36
+
37
+ The image encoder is a Swin-like vision transformer (Dosovitskiy et al., 2021; Yuan et al., 2021) pre-trained on massive image-text pairs based on the contrastive task (Jia et al., 2021; Radford et al., 2021; Yuan et al., 2021). This eliminates the dependency on the object detector, which is used in many existing approaches (Anderson et al., 2018; Li et al., 2020; Wang et al., 2020; Zhang et al., 2021a; Chen et al., 2020b; Fang et al., 2021c). To extend it to the video domain, we simply extract the features of multiple sampled frames and concatenate them as the video representation. The text decoder is a transformer network to predict the associated text. The entire network is trained with the language modeling task. For VQA, the input question is treated as a text prefix, and the answer is generated in an auto-regressive way. Furthermore, we present a new generation-based scheme for ImageNet classification, where the predicted labels come directly from our generative model without pre-defining the vocabulary.
38
+
39
+ The approach is simple, but the performance is surprisingly impressive after we scale up the pre-training data and the model size. Fig. 1 shows captions generated by the GIT fine-tuned with TextCaps. The samples demonstrate the model’s strong capability of recognizing and describing scene text, tables, charts, food, banknote, logos, landmarks, characters, celebrities, products, etc., indicating that our GIT model has encoded rich multi-modal knowledge about the visual world.
40
+
41
+ Our main contributions are as follows.
42
+
43
+ • We present GIT, which consists of only one image encoder and one text decoder, pre-trained on 0.8 billion image-text pairs with the language modeling task. We demonstrate new state-of-the-art performance over numerous tasks on image/video captioning and QA (Table 1), without the dependency on object detectors, object tags, and OCR. On TextCaps, we surpass the human performance for the first time. This implies that a simple network architecture can also achieve strong performance with scaling.
44
+ • We demonstrate that GIT pre-trained on the image-text pairs is capable of achieving new state-of-the-art performance even on video tasks without video-dedicated encoders.
45
+ • We present a new scheme of generation-based image classification. On ImageNet-1K, we show a decent performance (88.79% top-1 accuracy) with our GIT.
46
+
47
+ # 2 Related Work
48
+
49
+ In VL pre-training, multi-task pre-training has been widely used to empower the network with multiple or enhanced capabilities. For example, MLM and ITM are widely adopted pre-training tasks (Li et al., 2020; Kim et al., 2021; Zhang et al., 2021a; Wang et al., 2020; Xue et al., 2021; Lu et al., 2019; Tan & Bansal, 2019). Recently, the image-text contrastive loss has also been added in Yu et al. (2022); Li et al. (2021a); Wang et al. (2021a). Since most VL tasks can be formulated as the text generation task (Cho et al., 2021), a single generation model can be pre-trained to support various downstream tasks. The input and output texts are usually carefully designed to pre-train such a generation model. For example in Cho et al. (2021), the text is properly masked as the network input and the goal is to recover the masked text span. SimVLM (Wang et al., 2021b) randomly splits a text sentence into the input and the target output. In these methods, a multi-modal transformer encoder is utilized to incorporate the text inputs before decoding the output.
50
+
51
+ For image representation, Faster RCNN has been used in most existing approaches (Anderson et al., 2018; Li et al., 2020; Wang et al., 2020; Zhang et al., 2021a; Chen et al., 2020b; Fang et al., 2021c) to extract the region features. Recently, a growing interest is in dense representation (Huang et al., 2020; Wang et al., 2021b;a; Kim et al., 2021; Fang et al., 2021b; Dou et al., 2021; Li et al., 2021a) from the feature map, which requires no bounding box annotations. Meanwhile, it is easy to train the entire network in an end-to-end way. In addition to the representation from the feature map, object tags (Li et al., 2020; Wang et al., 2020; Zhang et al., 2021a; Cornia et al., 2021; Fang et al., 2021b) are leveraged to facilitate the transformer to understand the context, especially the novel objects. For scene-text-related tasks, OCR is invoked to generate the scene text as additional network input, e.g., in Hu et al. (2020); Yang et al. (2021c). For the text prediction, A transformer network is typically used, which can incorporate the cross-attention module to fuse the image tokens, e.g., Cho et al. (2021); Alayrac et al. (2022); Yang et al. (2021b); Yu et al. (2022), or only the self-attention modules where the image tokens are concatenated with the text tokens, e.g., Li et al. (2020); Chen et al. (2020b); Zhang et al. (2021a); Wang et al. (2020); Fang et al. (2021b).
52
+
53
+ Along the direction of scaling on VL tasks, LEMON (Hu et al., 2021a) studies the behavior of the detectorbased captioning model with MLM. CoCa (Yu et al., 2022) studies different model sizes, but on the same pre-training data. In this paper, we present a comprehensive study on 9 various benchmarks (3 in main paper and 6 in supplementary materials, image/video captioning & QA tasks) with 3 different model sizes and 3 different pre-training data scales (9 data points for each benchmark).
54
+
55
+ # 3 Generative Image-to-text Transformer
56
+
57
+ With large-scale image-text pairs, our goal is to pre-train a VL model which is simple yet effective to benefit image/video captioning and QA tasks. As the input is the image and the output is the text, the minimal set
58
+
59
+ ![](images/eabcd26567a5edae7f159ea48e7ab3a7718789404514c6e3f6d3b494d1f69ece.jpg)
60
+ Figure 2: Network architecture of our GIT, composed of one image encoder and one text decoder. (a): The training task in both pre-training and captioning is the language modeling task to predict the associated description. (b): In VQA, the question is placed as the text prefix. (c): For video, multiple frames are sampled and encoded independently. The features are added with an extra learnable temporal embedding (initialized as 0) before concatenation.
61
+
62
+ of components could be one image encoder and one text decoder, which are the only components of our GIT as illustrated in Fig. 2.
63
+
64
+ # 3.1 Network Architecture
65
+
66
+ The image encoder is based on the contrastive pre-trained model (Yuan et al., 2021). The input is the raw image and the output is a compact 2D feature map, which is flattened into a list of features. With an extra linear layer and a layernorm layer, the image features are projected into $D$ dimensions, which are the input to the text decoder. We use the image encoder pre-trained with contrastive tasks because recent studies show superior performance with such image encoder, e.g. Yuan et al. (2021); Dou et al. (2021); Alayrac et al. (2022). In Sec 4.6 and supplementary materials, we also observe the VL performance boosts significantly with a stronger image encoder. This is consistent with the observation in object detection-based approaches, e.g. in Wang et al. (2020); Zhang et al. (2021a). The concurrent work of CoCa (Yu et al., 2022) unifies the contrastive task and the generation task. as one pre-training phase. Our approach is equivalent to separating the two tasks sequentially: (i) using the contrastive task to pre-train the image encoder followed by (ii) using the generation task to pre-train both the image encoder and text decoder.
67
+
68
+ The text decoder is a transformer module to predict the text description. The transformer module consists of multiple transformer blocks, each of which is composed of one self-attention layer and one feed-forward layer. The text is tokenized and embedded into $D$ dimensions, followed by an addition of the positional encoding and a layernorm layer. The image features are concatenated with the text embeddings as the input to the transformer module. The text begins with the [BOS] token, and is decoded in an auto-regressive way until the [EOS] token or reaching the maximum steps. The seq2seq attention mask as in Fig. 3 is applied such that the text token only depends on the preceding tokens and all image tokens, and image tokens can attend to each other. This is different from a unidirectional attention mask, where not every image token can rely on all other image tokens.
69
+
70
+ Instead of well initializing the image encoder, we randomly initialize the text decoder. This design choice is highly motivated from the experiment studies of Wang et al. (2020), in which the random initialization shows similar performance, compared with the BERT initialization. This could be because the BERT initialization cannot understand the image signal, which is critical for VL tasks. Without dependency of the initialization, we can easily explore different design choices. The concurrent work of Flamingo (Alayrac et al., 2022) employs a similar architecture of image encoder $^ +$ text decoder, but their decoder is pre-trained and frozen to preserve the generalization capability of the large language model. In our GIT, all parameters are updated to better fit the VL tasks.
71
+
72
+ An alternative architecture is the cross-attention-based decoder to incorporate the image signals instead of concatenation with self-attention. Empirically as shown in supplementary material (Appendix G.2), with large-scale pre-training, we find the self-attention-based decoder achieves better performance overall, while in small-scale setting, the cross-attentionbased approach wins. A plausible explanation is that with sufficient training, the decoder parameters can well process both the image and the text, and the image tokens can be better updated with the self-attention for text generation. With cross-attention, the image tokens cannot attend to each other.
73
+
74
+ # 3.2 Pre-training
75
+
76
+ For each image-text pair, let $I$ be the image, $y _ { i } , i \in \{ 1 , \cdots , N \}$ be the text tokens, $y _ { 0 }$ be the [BOS] token and $y N { + 1 }$ be the [EOS] token. We apply the language modeling (LM) loss to train the model. That is,
77
+
78
+ ![](images/bcfd774e9dd8afaa3e4d0c231474044ecae8cd5bc80a21562b8fa8749104b50c.jpg)
79
+ Figure 3: seq2seq attention mask is applied to the transformer. If (i, $j$ ) is 1, the $_ i$ -th output can depend on the $j$ -th input; otherwise, not.
80
+
81
+ $$
82
+ l = \frac { 1 } { N + 1 } \sum _ { i = 1 } ^ { N + 1 } \mathrm { C E } ( y _ { i } , p ( y _ { i } | I , \{ y _ { j } , j = 0 , \cdots , i - 1 ) \} ) ,
83
+ $$
84
+
85
+ where CE is the cross-entropy loss with label smoothing of 0.1.
86
+
87
+ An alternative choice is MLM, which predicts typically $1 5 \%$ of input tokens in each iteration. To predict all tokens, we have to run at least $1 / 0 . 1 5 = 6 . 7 $ epochs. For LM, each iteration can predict all tokens, which is more efficient for large-scale pre-training data. In Hu et al. (2021a), the ablation studies also show that LM can achieve better performance with limited epochs. In our large-scale training, the number of epoch is only 2 due to computational resource limitation, and thus we choose LM. Meanwhile, most of the recent large-scale language models are also based on LM, e.g. Brown et al. (2020); Chowdhery et al. (2022).
88
+
89
+ Without the image input, the model is reduced to a decoder-only language model, similar to GPT3 (Brown et al., 2020) in the architecture wise. Thus, this design also enables the possibility to leverage the text-only data to enrich the decoding capability with a scaled-up decoder. We leave this as future work.
90
+
91
+ # 3.3 Fine-tuning
92
+
93
+ For the image captioning task, as the training data format is the same as that in pre-training, we apply the same LM task to fine-tune our GIT.
94
+
95
+ For visual question answering, the question and the ground-truth answer are concatenated as a new special caption during the fine-tuning, but the LM loss is only applied on the answer and the [EOS] tokens. During inference, the question is interpreted as the caption prefix and the completed part is the prediction. Compared with the existing approaches (Wang et al., 2021a;b; Zhang et al., 2021a; Li et al., 2022b) for VQAv2 (Goyal et al., 2017), our model is generative without pre-defining the candidate answers, even in inference. This imposes more challenges as the model has to predict at least two correct tokens: one for the answer and another for [EOS]. In contrast, the existing work pre-collects the answer candidate, recasts the problem as a classification problem, and only needs to predict once. However, considering the benefit of the free-form answer, we choose the generative approach. Due to difficulty of the generative model, we observe slightly worse performance on VQAv2 than the discriminative existing work. For the scene-text related VQA tasks, existing approaches (Yang et al., 2021c; Hu et al., 2020) typically leverages the OCR engine to generate the scene text and use dynamic pointer network to decide the current output token should be OCR or the general text. Here, our approach depends on no OCR engine, and thus no dynamic pointer network. Empirically, we find the model gradually learns how to read the scene text with large-scale pre-training, and our model achieves new SoTA performance on these tasks.
96
+
97
+ Our model is not specifically designed for the video domain, but we find our model can also achieve competitive or even new SOTA performance with a simple architecture change. That is, we sample multiple frames from each video clip, and encode each frame via the image encoder independently. Afterwards, we add a learnable temporal embedding (initialized as zeros), and concatenate the features from sampled frames. The final representation is used in a similar way as the image representation for captioning and question answering.
98
+
99
+ We also apply our generation model to the image classification task, where the class names are interpreted as image captions, and our GIT is fine-tuned to predict the result in an auto-regressive way. This is different from existing work which normally pre-defines the vocabulary and uses a linear layer (with softmax) to predict the likelihood of each category. This new generation-based scheme is beneficial when new data and new categories are added to the existing dataset. In this case, the network can continuously train on the new data without introducing new parameters.
100
+
101
+ # 4 Experiments
102
+
103
+ # 4.1 Setting
104
+
105
+ We collect 0.8B image-text pairs for pre-training, which include COCO (Lin et al., 2014), Conceptual Captions (CC3M) (Sharma et al., 2018), SBU (Ordonez et al., 2011), Visual Genome (VG) (Krishna et al., 2016), Conceptual Captions (CC12M) (Changpinyo et al., 2021), ALT200M (Hu et al., 2021a), and an extra 0.6B data following a similar collection procedure in Hu et al. (2021a). The image encoder is initialized from the pre-trained contrastive model (Yuan et al., 2021). The hidden dimension ( $D$ ) is 768. The text decoder consists of 6 randomly-initialized transformer blocks. The total number of model parameters is 0.7 billion. The learning rates of the image encoder and the decoder are $1 e ^ { - 5 }$ and $5 e ^ { - 5 }$ , respectively, and follow the cosine decay to 0. The total number of epochs is 2. During inference, the beam size is 4 and the length penalty (Wu et al., 2016) is 0.6 by default.
106
+
107
+ Supplementary materials show results on two smaller model variants (GIT $_ B$ and GIT $L$ ) and one even larger model (GIT2) with full details. When comparing with existing approaches, the reference numbers are the best one reported in the corresponding paper unless explicitly specified.
108
+
109
+ # 4.2 Results on Image Captioning and Question Answering
110
+
111
+ We comprehensively evaluate the captioning performance on the widely-used Karpathy split (Karpathy & Li, 2015) of COCO (Lin et al., 2014) and Flickr30K (Young et al., 2014), the COCO test set, nocaps (Agrawal et al., 2019)2 which focuses on novel objects, TextCaps (Sidorov et al., 2020) which focuses on scene-text understanding, and VizWiz-Captions (Gurari et al., 2020) which focuses on the real use case by the visionimpaired people. The results in CIDEr (Vedantam et al., 2015) are shown in Table 2 and 3. From the results, we can see our model achieves the new SOTA performance on all these metrics except on COCO Karpathy test. On nocaps, compared with CoCa (Yu et al., 2022), our model is much smaller in the model size (0.7B vs 2.1B), but achieves higher performance (123.0 vs 120.6 in CIDEr). On Textcaps, our solution outperforms the previous SOTA (TAP Yang et al. (2021c)) by a breakthrough margin (28.5 points in CIDEr), and also surpasses the human performance for the first time. For zero/few-shot evaluation as shown in Table 3, our model can significantly benefit from more shots. With 32-shots, our approach is also better than Flamingo.
112
+
113
+ On VQA, the evaluation benchmarks include VQAv2 (Goyal et al., 2017), TextVQA (Singh et al., 2019), VizWiz-VQA (Gurari et al., 2018). ST-VQA (Biten et al., 2019), and OCR-VQA (Mishra et al., 2019). Before fine-tuning the model, we run an intermediate fine-tuning on the combination of the training data of VQAv2, TextVQA, ST-VQA, OCR-VQA, VizWiz-VQA, Visual Genome QA (Krishna et al., 2016), GQA (Hudson &
114
+
115
+ Table 2: Results on image captioning. \*: the nubmers are from Sidorov et al. (2020); CE: cross-entropy optimization. All numbers are CIDEr scores, and other metrics are shown in supplementary materials. #: winner entry of the CVPR 2021 workshop challenge Anc.-Cap.: Xu et al. (2021) AoANet: Huang et al. (2019) BUTD: Anderson et al. (2018), CoCa: Yu et al. (2022), DistillVLM: Fang et al. (2021c), Flamingo: Alayrac et al. (2022), Human: Agrawal et al. (2019), LEMON: Hu et al. (2021a), M4C-Cap.: Hu et al. (2020) MiniVLM: Wang et al. (2020), MTMA: Gong et al. (2021), OFA: Wang et al. (2022b), OSCAR: Li et al. (2020), UFO: Wang et al. (2021a), UniversalCap: (Cornia et al., 2021) ViTCap: Fang et al. (2021b), VinVL: Zhang et al. (2021a), VIVO: Hu et al. (2021b) SimVLM: Wang et al. (2021b), TAP: Yang et al. (2021c).
116
+
117
+ <table><tr><td>Method</td><td>CE</td></tr><tr><td>MiniVLM</td><td>119.8</td></tr><tr><td>DistillVLM</td><td>120.8</td></tr><tr><td>ViTCap</td><td>125.2</td></tr><tr><td>OSCAR</td><td>127.8</td></tr><tr><td>VinVL</td><td>130.8</td></tr><tr><td>UFO</td><td>131.2</td></tr><tr><td>Flamingo</td><td>138.1</td></tr><tr><td>LEMON</td><td>139.1</td></tr><tr><td>SimVLM</td><td>143.3</td></tr><tr><td>CoCa</td><td>143.6</td></tr><tr><td>OFA</td><td>145.3</td></tr><tr><td>GIT</td><td>144.8</td></tr></table>
118
+
119
+ (a) COCO Karp.
120
+
121
+ <table><tr><td>Method</td><td>Test</td></tr><tr><td>OSCAR</td><td>80.9</td></tr><tr><td>Human</td><td>85.3</td></tr><tr><td>VIVO</td><td>86.6</td></tr><tr><td>VinVL</td><td>92.5</td></tr><tr><td>UFO</td><td>92.3</td></tr><tr><td>SimVLM</td><td>115.2</td></tr><tr><td>LEMON</td><td>114.3</td></tr><tr><td>UniversalCap</td><td>119.3</td></tr><tr><td>CoCa</td><td>120.6</td></tr><tr><td>GIT</td><td>123.4</td></tr></table>
122
+
123
+ <table><tr><td>Method</td><td>C</td></tr><tr><td>BUTD</td><td>120.5</td></tr><tr><td>VinVL</td><td>138.7</td></tr><tr><td>GIT</td><td>148.8</td></tr><tr><td>(b) COCO test (c40)</td><td></td></tr><tr><td>Method</td><td>test-std</td></tr><tr><td>MTMA</td><td>94.1</td></tr><tr><td>GIT</td><td>114.4</td></tr></table>
124
+
125
+ (c) VizWiz-Captions
126
+
127
+ <table><tr><td>Method</td><td>Test</td></tr><tr><td>BUTD*</td><td>33.8</td></tr><tr><td>AoANet* M4C-Cap.* 81.0</td><td>34.6</td></tr><tr><td>Anc.-Cap.</td><td>87.4</td></tr><tr><td>TAP</td><td>103.2</td></tr><tr><td>TAP#</td><td>109.7</td></tr><tr><td>Human</td><td></td></tr><tr><td></td><td>125.5</td></tr><tr><td>GIT</td><td>138.2</td></tr><tr><td>(e)TextCaps</td><td></td></tr></table>
128
+
129
+ Table 3: Zero/Few/Full-shot evaluation on Flickr30K with Karpathy split.
130
+
131
+ <table><tr><td>Shot</td><td>0</td><td>16</td><td>32</td><td>290 (1%)</td><td>full</td></tr><tr><td>Zhou et al. (2020)</td><td>1</td><td>1</td><td>1</td><td></td><td>68.5</td></tr><tr><td>Flamingo</td><td>67.2</td><td>78.9</td><td>75.4</td><td>1</td><td>1</td></tr><tr><td>GIT</td><td>49.6</td><td>78.0</td><td>80.5</td><td>86.6</td><td>98.5</td></tr></table>
132
+
133
+ Manning, 2019), and OK-VQA (Marino et al., 2019). To avoid data contamination, we remove the duplicate images of the test and validation set of the target benchmarks. As illustrated in Table 4, we achieve new SOTA on VizWiz-VQA and OCR-VQA, and same performance with prior SOTA of LaTr (Biten et al., 2022) on ST-VQA. Compared with the concurrent work of Flamingo (Alayrac et al., 2022), we achieve higher accuracy (+5.4) on TextVQA and lower (-3.29) on VQAv2. Note that Flamingo’s model size is 80B, which is 114 times of ours (0.7B). On VQAv2, we observe that our model performs worse in 1.5 points than the discriminative model of Florence (Yuan et al., 2021), which shares the same image encoder. The reason might be the increased difficulty of the generative model. That is, each correct answer requires at least two correct predictions (answer and [EOS]; 2.2 on average), while the discriminative model requires only one correct prediction. In (Wang et al., 2021b), the ablation study also shows the better performance by around 1 point than the discriminative counterpart. Another reason could be that the model of Florence for VQA leverages RoBerta (Liu et al., 2019) as the text encoder, which implicitly uses the text-only data to improve the performance.
134
+
135
+ # 4.3 Results on Video Captioning and Question Answering
136
+
137
+ On the video captioning task, the performance is evaluated on MSVD (Chen & Dolan, 2011) with the widely-used splits from Venugopalan et al. (2014), MSRVTT (Xu et al., 2016), YouCook2 (Zhou et al., 2018) (results in supplementary materials.) VATEX (Wang et al., 2019b), and TVC (Lei et al., 2020) (results in supplementary materials.). On VATEX, the performance is evaluated on both the public test and private test (evaluated on the server). Video QA is evaluated on MSVD-QA (Xu et al., 2017; Chen & Dolan, 2011), MSRVTT-QA (Xu et al., 2017; 2016), and TGIF-Frame (Jang et al., 2017), which are all open-ended tasks. The results are shown in Table 5 and Table 6 for captioning and QA, respectively. Although our model is not
138
+
139
+ Table 4: Results on visual question answering. (a): for VQAv2, approaches are divided according to whether the answer vocabulary is pre-defined (Closed) or not (Open) during inference. The model with closed vocabulary can be a classification model or generation model with constrained outputs, e.g., Wang et al. (2022b); Li et al. (2022b). The two numbers in parenthesis are the number of parameters and the number of images (the images for pre-trained modules are not counted) in VL pretraining. (b): for TextVQA, Mia (Qiao et al., 2021)# is the winner entry of TextVQA Challenge 2021 with a fine-tuned T5-3B (Raffel et al., 2020) model. (c): $\# \#$ : winner entry of 2021 VizWiz Grand Challenge Workshop. ALBEF: Li et al. (2021a), BLIP: Li et al. (2022b), BLOCK $^ +$ CNN+W2V: Mishra et al. (2019), CLIP-ViL: Shen et al. (2021), CoCa: Yu et al. (2022), CRN: Liu et al. (2020a), Flamingo: Alayrac et al. (2022), Florence: Yuan et al. (2021), LaAP-Net: Han et al. (2020), LaTr: Biten et al. (2022), M4C: Hu et al. (2020), M4C: Hu et al. (2020), METER: Dou et al. (2021), Mia: Qiao et al. (2021), mPlug: Li et al. (2022a), OSCAR: (Li et al., 2020), OFA: Wang et al. (2022b), UFO: Wang et al. (2021a), UNITER: (Chen et al., 2020b), UNIMO: Li et al. (2021c), SA-M4C: Kant et al. (2020), SimVLM: Wang et al. (2021b), SMA Gao et al. (2020), SMA: Gao et al. (2020), TAP: Yang et al. (2021c), VinVL: Zhang et al. (2021a), VILLA: Gan et al. (2020).
140
+
141
+ <table><tr><td colspan="2">VocabularyMethod</td><td>test-std</td><td>Method</td><td>test</td></tr><tr><td rowspan="10"></td><td>OSCAR</td><td>73.82</td><td>M4C</td><td>40.46</td></tr><tr><td>UNITER</td><td>74.02</td><td>LaAP-Net 41.41</td><td>SMA</td></tr><tr><td>VILLA</td><td>74.87</td><td>SA-M4C 44.6</td><td>CRN</td></tr><tr><td>UNIMO</td><td>75.27 SMA</td><td>45.51</td><td>LaAP</td></tr><tr><td>ALBEF</td><td>76.04</td><td>53.97</td><td>SA-M4</td></tr><tr><td>VinVL</td><td>76.60 76.76</td><td>Flamingo 54.1</td><td>TAP</td></tr><tr><td>UFO</td><td>Mia</td><td>73.67</td><td>LaTr</td></tr><tr><td>CLIP-ViL</td><td>GIT</td><td>59.75</td><td>GIT</td></tr><tr><td>METER BLIP</td><td></td><td>(b) TextVQA</td><td></td></tr><tr><td>SimVLM (-,1.8B)</td><td></td><td></td><td>Methc</td></tr><tr><td rowspan="5"></td><td>Florence (0.9B,14M)</td><td>Method</td><td>test</td><td>BLOC</td></tr><tr><td>mPlug (0.6B,14M)</td><td>81.26 (Liu et al., 2021)## 82.0</td><td></td><td>M4C</td></tr><tr><td>OFA (0.9B, 54M)</td><td>Flamingo</td><td>60.6</td><td>LaAP</td></tr><tr><td>CoCa (2.1B, 4.8B)</td><td>82.3</td><td>65.4</td><td>LaTr</td></tr><tr><td></td><td>GIT</td><td>67.5</td><td>GIT</td></tr><tr><td>Open</td><td>Flamingo (80B, 2.3B) GIT (0.7B, 0.8B)</td><td>82.1 78.81</td><td>(c)VizWiz-QA</td><td></td></tr></table>
142
+
143
+ <table><tr><td>Method</td></tr><tr><td>Test ANLS M4C 46.2</td></tr><tr><td>SMA 46.6</td></tr><tr><td>CRN 48.3</td></tr><tr><td>LaAP-Net 48.5</td></tr><tr><td>SA-M4C 50.4</td></tr><tr><td>TAP 59.7</td></tr><tr><td>LaTr 69.6</td></tr><tr><td>GIT 69.6</td></tr><tr><td>(d) ST-VQA</td></tr><tr><td>Method test</td></tr><tr><td>BLOCK+CNN+W2V 48.3</td></tr><tr><td>M4C 63.9</td></tr><tr><td>LaAP-Net 64.1</td></tr><tr><td>LaTr 67.9</td></tr><tr><td>GIT 68.1</td></tr></table>
144
+
145
+ (e) OCR-VQA
146
+
147
+ dedicated for video tasks, our model achieve new SOTA on MSRVD, MSRVTT, and VATEX for captioning and on MSVD-QA and TGIF-Frame for QA. For example on VATEX private test, our results are even better (93.8 vs 86.5) than CLIP4Caption $^ { + + }$ (Tang et al., 2021), which relies on model ensemble and additional subtitle input. This is also better than Flamingo (Alayrac et al., 2022) (84.2) with 80B parameters.
148
+
149
+ # 4.4 Results on Image Classification
150
+
151
+ We fine-tune GIT on ImageNet-1k. Each category is mapped to a unique class name, and the prediction is correct only if it is exactly matched with the ground-truth label subject to more or fewer whitespaces3. As shown in Table 7, our approach can achieve descent accuracy without pre-defining the vocabulary. Compared with Florence (Yuan et al., 2021) (same image encoder), our approach is worse in about 1.2 points. The reason might be similar to the case on VQAv2. That is, the generative approach needs to predict more tokens correctly to make one correct prediction, which increases the difficulty.
152
+
153
+ Zero-shot/Few-shot. The result is shown in Table 9. With no knowledge of the vocabulary, the pretrained GIT cannot infer the expected vocabulary, and thus the exactly-match accuracy is only $1 . 9 3 \%$ (in the column of equal). However, if we relax the requirement and take it correct if the prediction contains the ground-truth, the accuracy is $4 0 . 8 8 \%$ (in the column of $i n$ ), which shows the predicted caption can well identify the image content. If we have the vocabulary as a prior and limit the output tokens to be within the vocabulary, the accuracy drops to $3 3 . 4 8 \%$ (in the column of voc-prior). This may suggest the network is less natural to directly predict the category name. By fine-tuning the model with only 1 shot or 5 shots per category, we observe that the accuracy is significantly improved. This demonstrates our model can be easily adapted to downstream tasks even with a few training samples. With the shot increased from 1 to 5, the gap between voc-prior and the other two columns (equal and in) becomes smaller. This is expected as more shots can be better to guide the network to predict in-vocabulary output.
154
+
155
+ Table 5: Results on video captioning. E: model ensemble; $_ { x }$ : with the subtitle as additional input. C.4Cap.: Tang et al. (2021) GRU-EVE: Aafaq et al. (2019) MGSA: Chen & Jiang (2019) MGSA: Chen & Jiang (2019) MV-GPT: Seo et al. (2022) PickNet: Chen et al. (2018) PMI-CAP: Chen et al. (2020a) SibNet: Liu et al. (2020b) OA-BTG: Zhang & Peng (2019) ORG-TRL: Zhang et al. (2020) OpenBook: Zhang et al. (2021b) POS+VCT: Hou et al. (2019) POS+CG: Wang et al. (2019a) SAAT: Zheng et al. (2020), STG-KD: Pan et al. (2020) SwinBERT: Lin et al. (2021) Support-set: Patrick et al. (2021) VaTeX: Wang et al. (2019b) VALUE: Li et al. (2021b)
156
+
157
+ <table><tr><td>Method</td><td>B@4</td><td>C</td><td>Method</td><td>B@4</td><td>C</td></tr><tr><td>PickNet</td><td>52.3</td><td>76.5</td><td>SAAT</td><td>39.9</td><td>51.0</td></tr><tr><td>GRU-EVE</td><td>47.9</td><td>78.1</td><td>MGSA</td><td>42.4</td><td>47.5</td></tr><tr><td>SAAT</td><td>46.5</td><td>81.0</td><td>POS+VCT</td><td>42.3</td><td>49.1</td></tr><tr><td>MGSA</td><td>53.4</td><td>86.7</td><td>SibNet</td><td>40.9</td><td>47.5</td></tr><tr><td>POS+VCT</td><td>52.8</td><td>87.8</td><td>POS+CG</td><td>42.0</td><td>48.7</td></tr><tr><td>SibNet</td><td>54.2</td><td>88.2</td><td>OA-BTG</td><td>41.4</td><td>46.9</td></tr><tr><td>POS+CG</td><td>52.5</td><td>88.7</td><td>STG-KD</td><td>40.5</td><td>47.1</td></tr><tr><td>OA-BTG</td><td>56.9</td><td>90.6</td><td>Support-set</td><td>38.9</td><td>48.6</td></tr><tr><td>STG-KD</td><td>52.2</td><td>93.0</td><td>PMI-CAP</td><td>42.1</td><td>49.4</td></tr><tr><td>PMI-CAP</td><td>54.6</td><td>95.1</td><td>ORG-TRL</td><td>43.6</td><td>50.9</td></tr><tr><td>ORG-TRL</td><td>54.3</td><td>95.2</td><td>OpenBook</td><td>33.9</td><td>52.9</td></tr><tr><td>SwinBERT</td><td>58.2</td><td>120.6</td><td>SwinBERT</td><td>41.9</td><td>53.8</td></tr><tr><td>GIT</td><td>79.5</td><td>180.2</td><td>MV-GPTT</td><td>48.9 60</td><td>F</td></tr><tr><td colspan="2">(a) MSVD</td><td></td><td>GIT</td><td>53.8 73.9</td><td></td></tr></table>
158
+
159
+ (a) VATEX public test
160
+
161
+ <table><tr><td>Method</td><td>C</td></tr><tr><td>X-L.+T.E</td><td>81.4</td></tr><tr><td>Flamingo C.4Cap.ET</td><td>84.2 86.5</td></tr><tr><td>GIT</td><td>93.8</td></tr></table>
162
+
163
+ (e) VATEX private test
164
+
165
+ Table 6: Results on video question answering. All are open-ended question answering tasks. All-in-one: Wang et al. (2022a), ClipBERT: Lei et al. (2021), CoMVT: Seo et al. (2021), Flamingo: Alayrac et al. (2022), JustAsk: Yang et al. (2021a), MERLOT: Zellers et al. (2021), MV-GPT: Seo et al. (2022), QueST: Jiang et al. (2020), HCRN: Le et al. (2021), VIOLET: Fu et al. (2021).
166
+
167
+ <table><tr><td>Method</td><td>Accuracy</td><td>Method</td><td>Accuracy</td><td>Method</td><td>Accuracy</td></tr><tr><td>QueST</td><td>34.6</td><td>JustAsk</td><td>41.5</td><td>HCRN</td><td>55.9</td></tr><tr><td>HCRN</td><td>36.1</td><td>MV-GPT</td><td>41.7</td><td>QueST</td><td>59.7</td></tr><tr><td>CoMVT</td><td>42.6</td><td>MERLOT</td><td>43.1</td><td>ClipBERT</td><td>60.3</td></tr><tr><td>JustAsk</td><td>46.3</td><td>VIOLET</td><td>43.9</td><td>All-in-one</td><td>66.3</td></tr><tr><td>VIOLET</td><td>47.9</td><td>All-in-one</td><td>46.8</td><td>VIOLET</td><td>68.9</td></tr><tr><td>All-in-one</td><td>48.3</td><td>Flamingo</td><td>47.4</td><td>MERLOT</td><td>69.5</td></tr><tr><td>GIT</td><td>56.8</td><td>GIT</td><td>43.2</td><td>GIT</td><td>72.8</td></tr><tr><td colspan="2">(a) MSVD-QA</td><td colspan="2">(b) MSRVTT-QA</td><td colspan="2">(c) TGIF-Frame</td></tr></table>
168
+
169
+ Compared with Flamingo, our GIT achieves higher accuracy. Flamingo conducts the few-shot learning without parameter update, but each test image is combined with the support training examples as extra network inputs. Meanwhile, different test image requires different support shots based on Yang et al. (2022). These may increase the inference cost. In contrast, our model updates the parameters by a lightweight fine-tuning once, and then all these training shots are not required during inference.
170
+
171
+ # 4.5 Results on Scene Text Recognition
172
+
173
+ The task (Graves et al., 2006) aims to read scene text directly from the image. We evaluate our model in two settings. One is the GIT fine-tuned on TextCaps. The prediction is considered correct if the caption contains the ground-truth scene text word. The other is to fine-tune the model on two large scene text datasets: MJSynth (MJ) (Jaderberg et al., 2014; 2016) and SynthText (ST) (Gupta et al., 2016), where the ground-truth scene text is used as the caption. The prediction is correct if the output is the exact match to the ground-truth. Following the established setup, we evaluate on six standard benchmarks, including ICDAR 2013 (IC13) (Karatzas et al., 2013), ICDAR 2015 (IC15) (Karatzas et al., 2015), IIIT 5K-Words (IIIT) (Mishra et al., 2012), Street View Text (SVT) (Wang et al., 2011), Street View Text-Perspective (SVTP) (Phan et al., 2013), and CUTE80 (CUTE) (Risnumawan et al., 2014). The average accuracy is reported in Table 8. The accuracy on individual test sets is in supplementary materials. Our TextCaps-fine-tuned captioning model achieves an 89.9 accuracy, which demonstrates the strong scene text comprehension capability of our captioning model. After fine-tuning the model on the standard MJ $^ +$ ST datasets, GIT achieves 92.9 that surpasses the prior arts (Fang et al., 2021a; He et al., 2022) of 91.9.
174
+
175
+ Table 7: Results on ImageNet-1k classification task. Our approach takes the class name as the caption and predict the label in an auto-regressive way without pre-defining the vocabulary.
176
+
177
+ <table><tr><td colspan="2">VocabularyMethod</td></tr><tr><td>Closed</td><td>Top-1 ALIGN (Jia et al., 2021) 88.64</td></tr><tr><td rowspan="2"></td><td>Florence (Yuan et al.,2021) 90.05</td></tr><tr><td>CoCa (Yu et al., 2022) 91.0</td></tr><tr><td>Open GIT</td><td>88.79</td></tr></table>
178
+
179
+ Table 8: Results on scene text recognition. MJ and ST indicate the MJSynth (MJ) (Jaderberg et al., 2014; 2016) and SynthText (ST) (Gupta et al., 2016) datasets used for training scene text recognition models.
180
+
181
+ <table><tr><td>Method</td><td>FT data</td><td>Average</td></tr><tr><td>SAM (Liao et al., 2019)</td><td>MJ+ST</td><td>87.8</td></tr><tr><td>Ro.Scanner (Yue et al., 2020) SRN (Yu et al., 2020)</td><td>MJ+ST</td><td>87.5</td></tr><tr><td>ABINet (Fang et al., 2021a)</td><td>MJ+ST</td><td>89.6</td></tr><tr><td>S-GTR (He et al., 2022)</td><td>MJ+ST</td><td>91.9</td></tr><tr><td></td><td>MJ+ST</td><td>91.9</td></tr><tr><td>MaskOCR (Lyu et al., 2022)</td><td>MJ+ST</td><td>93.8</td></tr><tr><td>GIT</td><td>Text+aT</td><td>9.9</td></tr></table>
182
+
183
+ Table 9: Zero/Few-shot evaluation on ImageNet with 3 metrics. equal: the unrestricted prediction should be exactly matched to the ground-truth. in: the unrestricted prediction should contain the ground-truth label name. voc-prior: the vocabulary is pre-defined as a prior. For our GIT, a trie structure is constructed motivated from Wang et al. (2022b) to limit the candidate tokens during each token prediction, such that the predicted result is guaranteed to be within the vocabulary.
184
+
185
+ <table><tr><td></td><td colspan="3">Zero-shot</td><td colspan="3">1-shot per class</td><td colspan="3"> 5-shot per class</td></tr><tr><td> Accuracy type</td><td>equal</td><td>in</td><td>voc-prior</td><td>equal</td><td>in</td><td>voc-prior</td><td>equal</td><td>in</td><td>voc-prior</td></tr><tr><td>Flamingo</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>71.7</td><td>1</td><td>1</td><td>77.3</td></tr><tr><td>GIT</td><td>1.93</td><td>40.88</td><td>33.48</td><td>64.54</td><td>66.76</td><td>72.45</td><td>79.79</td><td>80.15</td><td>80.95</td></tr></table>
186
+
187
+ # 4.6 Analysis
188
+
189
+ Model and data scaling. To study the trending with data scales, we construct two smaller pre-training datasets: one is the combination of COCO, SBU, CC3M and VG, leading to 4M images or 10M image-text pairs; the other is to further combine CC12M, leading to about 14M images or 20M image-text pairs. When pre-training on small-scale datasets, we use 30 epochs rather than 2 epochs as on the 0.8B data. For the network structure, we name our model as Huge and replace the image encoder with ViT-B/16 and ViT-L/14 from CLIP Radford et al. (2021) as Base and Large, respectively. Fig. 4 shows the results on COCO, TextCaps, and VizWiz-QA. On COCO, the base model benefits from 4M to 14M, but the performance drops with 0.8B data. The 14M data are more similar to COCO than the majority of the noisy 0.8B data. Meanwhile, the Base model with limited capacity may not be able to benefit effectively from large-scale data. Similar observations are also reported in Kolesnikov et al. (2020) for ImageNet-1k classification. On TextCaps and VizWiz-QA, all model variants benefit significantly from more pre-training data. Also, a larger backbone improves more especially with 0.8B data.
190
+
191
+ ![](images/1fbaab473d9f92267b49db225b92fac338b21a03ef1819e8802c92d986a4f17f.jpg)
192
+ Figure 4: Performance with different pre-training data scales and different model sizes.
193
+
194
+ Table 10: Ablation study of larger text decoders. The models are pre-trained on a subset of 0.4B image-text pairs. No beam search and no SCST are performed.
195
+
196
+ <table><tr><td rowspan="2">Layers</td><td colspan="4">CoCo</td><td colspan="2">nocaps</td></tr><tr><td>B@4</td><td>M</td><td>C</td><td>S</td><td>C</td><td>S</td></tr><tr><td>6</td><td>38.9</td><td>30.7</td><td>136.4</td><td>24.6</td><td>119.3</td><td>15.9</td></tr><tr><td>12</td><td>38.9</td><td>30.6</td><td>136.0</td><td>24.2</td><td>118.1</td><td>15.5</td></tr><tr><td>24</td><td>39.1</td><td>30.2</td><td>134.6</td><td>23.8</td><td>115.4</td><td>15.1</td></tr></table>
197
+
198
+ Here, we scale the image encoder. Empirically, we find it is difficult to effectively scale up the text decoder. Preliminary results are shown in Table 10, which shows a larger decoder shows no improvement. The reason might be that it is difficult to effectively train with limited amount of text by LM. Another plausible reason is that the image encoder is responsible for object recognition, and the decoder is responsible for organizing the object terms in a natural language way. The latter task might be easy since most of the descriptions follow similar patterns, e.g. object $^ +$ verb $^ +$ subject, and thus a small decoder is enough during end-to-end training. Larger decoders increase the learning difficulty, which might degrade the performance.
199
+
200
+ Flamingo (Alayrac et al., 2022) shows a larger decoder improves the performance. However, their decoder is pre-trained and frozen during the VL pre-training, which avoids the problem of how to effectively train the decoder. In LEMON (Hu et al., 2021a), the transformer can be scaled up to 32 layers. The reason could be that LEMON uses MLM, instead of LM, which might be more difficult to train.
201
+
202
+ Scene text in pre-training data. To understand the capability of scene text comprehension, we examine the pre-training dataset and study how many image-text pairs contain the scene text. We first run the Microsoft Azure OCR API $^ 4$ against all images in CC12M and 500K images in the web crawled images. The OCR result is compared with the associated text. It is considered matched only if the text contains an OCR result that is longer than 5 characters. It is estimated that $1 5 \%$ of CC12M and $3 1 \%$ of the downloaded images contain scene text descriptions. As the training task is to predict the texts, the network gradually learns to read the scene text.
203
+
204
+ # 5 Conclusion
205
+
206
+ In the paper, we design and train a simple generative model, named GIT, to map the input image to the associated text description on large-scale image-text pairs. On image/video captioning and question answering tasks, our model achieves new state-of-the-art performance across numerous benchmarks and surpasses the human performance on TextCaps for the first time. For the image classification, we apply the generation task to predict the label name directly. The strategy is different from the existing work with a pre-defined and fixed vocabulary, and is beneficial especially when new category data are added.
207
+
208
+ Limitations. We focus on the pretraining-and-finetuning strategy to improve the absolute performance. Empirically, we find it is unclear on how to control the generated caption and how to perform in-context learning without parameter update, which we leave as future work.
209
+
210
+ Societal impact. Compared with the existing work, our model clearly improves the performance and be more appropriate to help visually-impaired people. The model is pre-trained on large-scale data, and the data are not guaranteed to contain no toxic language, which may poison the output. Although we observe few such instances qualitatively, special care should be taken to deploy the model in practice and more research exploration is required to control the output.
211
+
212
+ # References
213
+
214
+ Nayyer Aafaq, Naveed Akhtar, Wei Liu, Syed Zulqarnain Gilani, and Ajmal Mian. Spatio-temporal dynamics and semantic attribute enriched visual encoding for video captioning. In CVPR, 2019.
215
+ Harsh Agrawal, Karan Desai, Yufei Wang, Xinlei Chen, Rishabh Jain, Mark Johnson, Dhruv Batra, Devi Parikh, Stefan Lee, and Peter Anderson. nocaps: novel object captioning at scale. In ICCV, 2019.
216
+ Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katie Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. arXiv preprint arXiv:2204.14198, 2022.
217
+ Peter Anderson, Xiaodong He, Chris Buehler, Damien Teney, Mark Johnson, Stephen Gould, and Lei Zhang. Bottom-up and top-down attention for image captioning and visual question answering. In CVPR, 2018.
218
+ Ali Furkan Biten, Ruben Tito, Andres Mafla, Lluis Gomez, Marçal Rusinol, Ernest Valveny, CV Jawahar, and Dimosthenis Karatzas. Scene text visual question answering. In ICCV, 2019.
219
+ Ali Furkan Biten, Ron Litman, Yusheng Xie, Srikar Appalaraju, and R Manmatha. Latr: Layout-aware transformer for scene-text vqa. In CVPR, 2022.
220
+ Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
221
+ Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual 12M: Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In CVPR, 2021.
222
+ David Chen and William Dolan. Collecting highly parallel data for paraphrase evaluation. In ACL, 2011.
223
+ Shaoxiang Chen and Yu-Gang Jiang. Motion guided spatial attention for video captioning. In AAAI, 2019.
224
+ Shaoxiang Chen, Wenhao Jiang, Wei Liu, and Yu-Gang Jiang. Learning modality interaction for temporal sentence localization and event captioning in videos. In ECCV, 2020a.
225
+ Yangyu Chen, Shuhui Wang, Weigang Zhang, and Qingming Huang. Less is more: Picking informative frames for video captioning. In ECCV, 2018.
226
+ Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. UNITER: universal image-text representation learning. In ECCV, 2020b.
227
+ Jaemin Cho, Jie Lei, Hao Tan, and Mohit Bansal. Unifying vision-and-language tasks via text generation. In ICML, 2021.
228
+ 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.
229
+
230
+ Marcella Cornia, Lorenzo Baraldi, Giuseppe Fiameni, and Rita Cucchiara. Universal captioner: Long-tail vision-and-language model training through content-style separation. arXiv preprint arXiv:2111.12727, 2021.
231
+
232
+ Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
233
+ Zi-Yi Dou, Yichong Xu, Zhe Gan, Jianfeng Wang, Shuohang Wang, Lijuan Wang, Chenguang Zhu, Pengchuan Zhang, Lu Yuan, Nanyun Peng, Zicheng Liu, and Michael Zeng. An empirical study of training end-to-end vision-and-language transformers. arXiv preprint arXiv: 2111.02387, 2021.
234
+ Shancheng Fang, Hongtao Xie, Yuxin Wang, Zhendong Mao, and Yongdong Zhang. Read like humans: autonomous, bidirectional and iterative language modeling for scene text recognition. In CVPR, 2021a.
235
+ Zhiyuan Fang, Jianfeng Wang, Xiaowei Hu, Lin Liang, Zhe Gan, Lijuan Wang, Yezhou Yang, and Zicheng Liu. Injecting semantic concepts into end-to-end image captioning. arXiv preprint arXiv:2112.05230, 2021b.
236
+ Zhiyuan Fang, Jianfeng Wang, Xiaowei Hu, Lijuan Wang, Yezhou Yang, and Zicheng Liu. Compressing visual-linguistic model via knowledge distillation. In ICCV, 2021c.
237
+ Tsu-Jui Fu, Linjie Li, Zhe Gan, Kevin Lin, William Yang Wang, Lijuan Wang, and Zicheng Liu. VIOLET : Endto-end video-language transformers with masked visual-token modeling. arXiv preprint arXiv:2111.12681, 2021.
238
+ Zhe Gan, Yen-Chun Chen, Linjie Li, Chen Zhu, Yu Cheng, and Jingjing Liu. Large-scale adversarial training for vision-and-language representation learning. In NeurIPS, 2020.
239
+ Chenyu Gao, Qi Zhu, Peng Wang, Hui Li, Yuliang Liu, Anton van den Hengel, and Qi Wu. Structured multimodal attentions for textvqa. arXiv preprint arXiv:2006.00753, 2020.
240
+ Xuchao Gong, Hongji Zhu, Yongliang Wang, Biaolong Chen, Aixi Zhang, Fangxun Shu, and Si Liu. Multiple transformer mining for vizwiz image caption. In 2021 VizWiz Grand Challenge Workshop, 2021.
241
+ Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the V in VQA matter: Elevating the role of image understanding in visual question answering. In CVPR, 2017.
242
+ Alex Graves, Santiago Fernández, Faustino Gomez, and Jürgen Schmidhuber. Connectionist temporal classification: labelling unsegmented sequence data with recurrent neural networks. In ICML, 2006.
243
+ Ankush Gupta, Andrea Vedaldi, and Andrew Zisserman. Synthetic data for text localisation in natural images. In CVPR, pp. 2315–2324, 2016.
244
+ Danna Gurari, Qing Li, Abigale J. Stangl, Anhong Guo, Chi Lin, Kristen Grauman, Jiebo Luo, and Jeffrey P. Bigham. Vizwiz grand challenge: Answering visual questions from blind people. In CVPR, 2018.
245
+ Danna Gurari, Yinan Zhao, Meng Zhang, and Nilavra Bhattacharya. Captioning images taken by people who are blind. arXiv preprint arXiv:2002.08565, 2020.
246
+ Wei Han, Hantao Huang, and Tao Han. Finding the evidence: Localization-aware answer prediction for text visual question answering. In COLING, 2020.
247
+ Yue He, Chen Chen, Jing Zhang, Juhua Liu, Fengxiang He, Chaoyue Wang, and Bo Du. Visual semantics allow for textual reasoning better in scene text recognition. In AAAI, 2022.
248
+ Jingyi Hou, Xinxiao Wu, Wentian Zhao, Jiebo Luo, and Yunde Jia. Joint syntax representation learning and visual cue translation for video captioning. In ICCV, 2019.
249
+ Ronghang Hu, Amanpreet Singh, Trevor Darrell, and Marcus Rohrbach. Iterative answer prediction with pointer-augmented multimodal transformers for textvqa. In CVPR, 2020.
250
+ Xiaowei Hu, Zhe Gan, Jianfeng Wang, Zhengyuan Yang, Zicheng Liu, Yumao Lu, and Lijuan Wang. Scaling up vision-language pre-training for image captioning. arXiv preprint arXiv:2111.12233, 2021a.
251
+ Xiaowei Hu, Xi Yin, Kevin Lin, Lijuan Wang, Lei Zhang, Jianfeng Gao, and Zicheng Liu. VIVO: surpassing human performance in novel object captioning with visual vocabulary pre-training. In AAAI, 2021b.
252
+ Lun Huang, Wenmin Wang, Jie Chen, and Xiao-Yong Wei. Attention on attention for image captioning. In ICCV, 2019.
253
+ Zhicheng Huang, Zhaoyang Zeng, Bei Liu, Dongmei Fu, and Jianlong Fu. Pixel-bert: Aligning image pixels with text by deep multi-modal transformers. arXiv preprint arXiv:2004.00849, 2020.
254
+ Drew A. Hudson and Christopher D. Manning. GQA: A new dataset for real-world visual reasoning and compositional question answering. In CVPR, 2019.
255
+ Max Jaderberg, Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Synthetic data and artificial neural networks for natural scene text recognition. arXiv preprint arXiv:1406.2227, 2014.
256
+ Max Jaderberg, Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Reading text in the wild with convolutional neural networks. IJCV, 2016.
257
+ Yunseok Jang, Yale Song, Youngjae Yu, Youngjin Kim, and Gunhee Kim. TGIF-QA: toward spatio-temporal reasoning in visual question answering. In CVPR, 2017.
258
+ Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V. Le, Yun-Hsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In ICML, 2021.
259
+ Jianwen Jiang, Ziqiang Chen, Haojie Lin, Xibin Zhao, and Yue Gao. Divide and conquer: Question-guided spatio-temporal contextual attention for video question answering. In AAAI, 2020.
260
+ Yash Kant, Dhruv Batra, Peter Anderson, Alexander G. Schwing, Devi Parikh, Jiasen Lu, and Harsh Agrawal. Spatially aware multimodal transformers for textvqa. In ECCV, 2020.
261
+ Dimosthenis Karatzas, Faisal Shafait, Seiichi Uchida, Masakazu Iwamura, Lluis Gomez i Bigorda, Sergi Robles Mestre, Joan Mas, David Fernandez Mota, Jon Almazan Almazan, and Lluis Pere De Las Heras. Icdar 2013 robust reading competition. In ICDAR, 2013.
262
+ Dimosthenis Karatzas, Lluis Gomez-Bigorda, Anguelos Nicolaou, Suman Ghosh, Andrew Bagdanov, Masakazu Iwamura, Jiri Matas, Lukas Neumann, Vijay Ramaseshan Chandrasekhar, Shijian Lu, et al. Icdar 2015 competition on robust reading. In ICDAR, 2015.
263
+ Andrej Karpathy and Fei-Fei Li. Deep visual-semantic alignments for generating image descriptions. In CVPR, 2015.
264
+ Wonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision. In ICML, 2021.
265
+ Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In ECCV, 2020.
266
+ Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A. Shamma, Michael S. Bernstein, and Fei-Fei Li. Visual genome: Connecting language and vision using crowdsourced dense image annotations. arXiv preprint arXiv:1602.07332, 2016.
267
+ Thao Minh Le, Vuong Le, Svetha Venkatesh, and Truyen Tran. Hierarchical conditional relation networks for multimodal video question answering. IJCV, 2021.
268
+ Jie Lei, Licheng Yu, Tamara L Berg, and Mohit Bansal. Tvr: A large-scale dataset for video-subtitle moment retrieval. In ECCV, 2020.
269
+
270
+ Jie Lei, Linjie Li, Luowei Zhou, Zhe Gan, Tamara L. Berg, Mohit Bansal, and Jingjing Liu. Less is more: Clipbert for video-and-language learning via sparse sampling. In CVPR, 2021.
271
+
272
+ Chenliang Li, Haiyang Xu, Junfeng Tian, Wei Wang, Ming Yan, Bin Bi, Jiabo Ye, Hehong Chen, Guohai Xu, Zheng Cao, et al. mplug: Effective and efficient vision-language learning by cross-modal skip-connections. arXiv preprint arXiv:2205.12005, 2022a.
273
+ Junnan Li, Ramprasaath R Selvaraju, Akhilesh Deepak Gotmare, Shafiq Joty, Caiming Xiong, and Steven Hoi. Align before fuse: Vision and language representation learning with momentum distillation. In NeurIPS, 2021a.
274
+ Junnan Li, Dongxu Li, Caiming Xiong, and Steven C. H. Hoi. BLIP: bootstrapping language-image pretraining for unified vision-language understanding and generation. arXiv preprint arXiv:2201.12086, 2022b.
275
+ Linjie Li, Jie Lei, Zhe Gan, Licheng Yu, Yen-Chun Chen, Rohit Pillai, Yu Cheng, Luowei Zhou, Xin Eric Wang, William Yang Wang, et al. Value: A multi-task benchmark for video-and-language understanding evaluation. In NeurIPS, 2021b.
276
+ Wei Li, Can Gao, Guocheng Niu, Xinyan Xiao, Hao Liu, Jiachen Liu, Hua Wu, and Haifeng Wang. Unimo: Towards unified-modal understanding and generation via cross-modal contrastive learning. In ACL, 2021c.
277
+ Xiujun Li, Xi Yin, Chunyuan Li, Pengchuan Zhang, Xiaowei Hu, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, Yejin Choi, and Jianfeng Gao. Oscar: Object-semantics aligned pre-training for vision-language tasks. In ECCV, 2020.
278
+ Minghui Liao, Pengyuan Lyu, Minghang He, Cong Yao, Wenhao Wu, and Xiang Bai. Mask textspotter: An end-to-end trainable neural network for spotting text with arbitrary shapes. PAMI, 2019.
279
+ Kevin Lin, Linjie Li, Chung-Ching Lin, Faisal Ahmed, Zhe Gan, Zicheng Liu, Yumao Lu, and Lijuan Wang. Swinbert: End-to-end transformers with sparse attention for video captioning. arXiv preprint arXiv:2111.13196, 2021.
280
+ Tsung-Yi Lin, Michael Maire, Serge J. Belongie, Lubomir D. Bourdev, Ross B. Girshick, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C. Lawrence Zitnick. Microsoft COCO: common objects in context. arXiv preprint arXiv:1405.0312, 2014.
281
+ Fen Liu, Guanghui Xu, Qi Wu, Qing Du, Wei Jia, and Mingkui Tan. Cascade reasoning network for text-based visual question answering. In Chang Wen Chen, Rita Cucchiara, Xian-Sheng Hua, Guo-Jun Qi, Elisa Ricci, Zhengyou Zhang, and Roger Zimmermann (eds.), ACM MM, 2020a.
282
+ Sheng Liu, Zhou Ren, and Junsong Yuan. Sibnet: Sibling convolutional encoder for video captioning. IEEE TPAMI, 2020b.
283
+ Yinhan 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.
284
+ Yu Liu, Lianghua Huang, Liuyihang Song, Bin Wang, Yingya Zhang, and Pan Pan. Enhancing textual cues in multi-modal transformers for vqa. In 2021 VizWiz Grand Challenge Workshop, 2021.
285
+ Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. In NeurIPS, 2019.
286
+ Pengyuan Lyu, Chengquan Zhang, Shanshan Liu, Meina Qiao, Yangliu Xu, Liang Wu, Kun Yao, Junyu Han, Errui Ding, and Jingdong Wang. Maskocr: Text recognition with masked encoder-decoder pretraining. arXiv preprint arXiv:2206.00311, 2022.
287
+ Kenneth Marino, Mohammad Rastegari, Ali Farhadi, and Roozbeh Mottaghi. Ok-vqa: A visual question
288
+
289
+ answering benchmark requiring external knowledge. In CVPR, 2019.
290
+
291
+ Anand Mishra, Karteek Alahari, and CV Jawahar. Scene text recognition using higher order language priors. In BMVC, 2012.
292
+ Anand Mishra, Shashank Shekhar, Ajeet Kumar Singh, and Anirban Chakraborty. Ocr-vqa: Visual question answering by reading text in images. In ICDAR, 2019.
293
+ Vicente Ordonez, Girish Kulkarni, and Tamara L. Berg. Im2text: Describing images using 1 million captioned photographs. In NeurIPS, 2011.
294
+ Boxiao Pan, Haoye Cai, De-An Huang, Kuan-Hui Lee, Adrien Gaidon, Ehsan Adeli, and Juan Carlos Niebles. Spatio-temporal graph for video captioning with knowledge distillation. In CVPR, 2020.
295
+ Mandela Patrick, Po-Yao Huang, Yuki Asano, Florian Metze, Alexander Hauptmann, Joao Henriques, and Andrea Vedaldi. Support-set bottlenecks for video-text representation learning. In ICLR, 2021.
296
+ Trung Quy Phan, Palaiahnakote Shivakumara, Shangxuan Tian, and Chew Lim Tan. Recognizing text with perspective distortion in natural scenes. In ICCV, 2013.
297
+ Yixuan Qiao, Hao Chen, Jun Wang, Yihao Chen, Xianbin Ye, Ziliang Li, Xianbiao Qi, Peng Gao, and Guotong Xie. Winner team mia at textvqa challenge 2021: Vision-and-language representation learning with pre-trained sequence-to-sequence model. arXiv preprint arXiv:2106.15332, 2021.
298
+ Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In ICML, 2021.
299
+ 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. J. Mach. Learn. Res., 2020.
300
+ Anhar Risnumawan, Palaiahankote Shivakumara, Chee Seng Chan, and Chew Lim Tan. A robust arbitrary text detection system for natural scene images. Expert Systems with Applications, 2014.
301
+ Paul Hongsuck Seo, Arsha Nagrani, and Cordelia Schmid. Look before you speak: Visually contextualized utterances. In CVPR, 2021.
302
+ Paul Hongsuck Seo, Arsha Nagrani, Anurag Arnab, and Cordelia Schmid. End-to-end generative pretraining for multimodal video captioning. arXiv preprint arXiv:2201.08264, 2022.
303
+ Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In ACL, 2018.
304
+ Sheng Shen, Liunian Harold Li, Hao Tan, Mohit Bansal, Anna Rohrbach, Kai-Wei Chang, Zhewei Yao, and Kurt Keutzer. How much can CLIP benefit vision-and-language tasks? arXiv preprint arXiv:2107.06383, 2021.
305
+ Oleksii Sidorov, Ronghang Hu, Marcus Rohrbach, and Amanpreet Singh. Textcaps: a dataset for image captioning with reading comprehension. In ECCV, 2020.
306
+ Amanpreet Singh, Vivek Natarajan, Meet Shah, Yu Jiang, Xinlei Chen, Dhruv Batra, Devi Parikh, and Marcus Rohrbach. Towards vqa models that can read. In CVPR, 2019.
307
+ Hao Tan and Mohit Bansal. LXMERT: learning cross-modality encoder representations from transformers. In EMNLP, 2019.
308
+ Mingkang Tang, Zhanyu Wang, Zhaoyang Zeng, Fengyun Rao, and Dian Li. Clip4caption $^ { + + }$ : Multi-clip for video caption. arXiv preprint arXiv:2110.05204, 2021.
309
+ Ramakrishna Vedantam, C. Lawrence Zitnick, and Devi Parikh. Cider: Consensus-based image description evaluation. In CVPR, 2015.
310
+ Subhashini Venugopalan, Huijuan Xu, Jeff Donahue, Marcus Rohrbach, Raymond J. Mooney, and Kate Saenko. Translating videos to natural language using deep recurrent neural networks. arXiv preprint arXiv:1412.4729, 2014.
311
+ Alex Jinpeng Wang, Yixiao Ge, Rui Yan, Yuying Ge, Xudong Lin, Guanyu Cai, Jianping Wu, Ying Shan, Xiaohu Qie, and Mike Zheng Shou. All in one: Exploring unified video-language pre-training. arXiv preprint arXiv:2203.07303, 2022a.
312
+ Bairui Wang, Lin Ma, Wei Zhang, Wenhao Jiang, Jingwen Wang, and Wei Liu. Controllable video captioning with pos sequence guidance based on gated fusion network. In ICCV, 2019a.
313
+ Jianfeng Wang, Xiaowei Hu, Pengchuan Zhang, Xiujun Li, Lijuan Wang, Lei Zhang, Jianfeng Gao, and Zicheng Liu. Minivlm: A smaller and faster vision-language model. arXiv preprint arXiv:2012.06946, 2020.
314
+ Jianfeng Wang, Xiaowei Hu, Zhe Gan, Zhengyuan Yang, Xiyang Dai, Zicheng Liu, Yumao Lu, and Lijuan Wang. UFO: A unified transformer for vision-language representation learning. arXiv preprint arXiv:2111.10023, 2021a.
315
+ Kai Wang, Boris Babenko, and Serge Belongie. End-to-end scene text recognition. In ICCV, 2011.
316
+ Peng Wang, An Yang, Rui Men, Junyang Lin, Shuai Bai, Zhikang Li, Jianxin Ma, Chang Zhou, Jingren Zhou, and Hongxia Yang. Unifying architectures, tasks, and modalities through a simple sequence-to-sequence learning framework. arXiv preprint arXiv:2202.03052, 2022b.
317
+ Xin Wang, Jiawei Wu, Junkun Chen, Lei Li, Yuan-Fang Wang, and William Yang Wang. Vatex: A large-scale, high-quality multilingual dataset for video-and-language research. In ICCV, 2019b.
318
+ Zirui Wang, Jiahui Yu, Adams Wei Yu, Zihang Dai, Yulia Tsvetkov, and Yuan Cao. Simvlm: Simple visual language model pretraining with weak supervision. arXiv preprint arXiv:2108.10904, 2021b.
319
+ Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Lukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Greg Corrado, Macduff Hughes, and Jeffrey Dean. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016.
320
+ Dejing Xu, Zhou Zhao, Jun Xiao, Fei Wu, Hanwang Zhang, Xiangnan He, and Yueting Zhuang. Video question answering via gradually refined attention over appearance and motion. In ACM Multimedia, 2017.
321
+ Guanghui Xu, Shuaicheng Niu, Mingkui Tan, Yucheng Luo, Qing Du, and Qi Wu. Towards accurate text-based image captioning with content diversity exploration. In CVPR, 2021.
322
+ Jun Xu, Tao Mei, Ting Yao, and Yong Rui. Msr-vtt: A large video description dataset for bridging video and language. In CVPR, 2016.
323
+ Hongwei Xue, Yupan Huang, Bei Liu, Houwen Peng, Jianlong Fu, Houqiang Li, and Jiebo Luo. Probing inter-modality: Visual parsing with self-attention for vision-language pre-training. In NeurIPS, 2021.
324
+ Antoine Yang, Antoine Miech, Josef Sivic, Ivan Laptev, and Cordelia Schmid. Just ask: Learning to answer questions from millions of narrated videos. In ICCV, 2021a.
325
+ Zhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Faisal Ahmed, Zicheng Liu, Yumao Lu, and Lijuan Wang. Crossing the format boundary of text and boxes: Towards unified vision-language modeling. arXiv preprint arXiv:2111.12085, 2021b.
326
+ Zhengyuan Yang, Yijuan Lu, Jianfeng Wang, Xi Yin, Dinei A. F. Florêncio, Lijuan Wang, Cha Zhang, Lei Zhang, and Jiebo Luo. TAP: text-aware pre-training for text-vqa and text-caption. In CVPR, 2021c.
327
+ Zhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Yumao Lu, Zicheng Liu, and Lijuan Wang. An empirical study of gpt-3 for few-shot knowledge-based vqa. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pp. 3081–3089, 2022.
328
+ Peter Young, Alice Lai, Micah Hodosh, and Julia Hockenmaier. From image descriptions to visual denotations: New similarity metrics for semantic inference over event descriptions. Transactions of the Association for Computational Linguistics, 2014.
329
+ Deli Yu, Xuan Li, Chengquan Zhang, Tao Liu, Junyu Han, Jingtuo Liu, and Errui Ding. Towards accurate scene text recognition with semantic reasoning networks. In CVPR, 2020.
330
+ Jiahui Yu, Zirui Wang, Vijay Vasudevan, Legg Yeung, Mojtaba Seyedhosseini, and Yonghui Wu. Coca: Contrastive captioners are image-text foundation models. arXiv preprint arXiv:2205.01917, 2022.
331
+ Lu Yuan, Dongdong Chen, Yi-Ling Chen, Noel Codella, Xiyang Dai, Jianfeng Gao, Houdong Hu, Xuedong Huang, Boxin Li, Chunyuan Li, Ce Liu, Mengchen Liu, Zicheng Liu, Yumao Lu, Yu Shi, Lijuan Wang, Jianfeng Wang, Bin Xiao, Zhen Xiao, Jianwei Yang, Michael Zeng, Luowei Zhou, and Pengchuan Zhang. Florence: A new foundation model for computer vision. arXiv preprint arXiv:2111.11432, 2021.
332
+ Xiaoyu Yue, Zhanghui Kuang, Chenhao Lin, Hongbin Sun, and Wayne Zhang. Robustscanner: Dynamically enhancing positional clues for robust text recognition. In ECCV, 2020.
333
+ 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 NeurIPS, 2021.
334
+ Junchao Zhang and Yuxin Peng. Object-aware aggregation with bidirectional temporal graph for video captioning. In CVPR, 2019.
335
+ Pengchuan Zhang, Xiujun Li, Xiaowei Hu, Jianwei Yang, Lei Zhang, Lijuan Wang, Yejin Choi, and Jianfeng Gao. Vinvl: Making visual representations matter in vision-language models. In CVPR, 2021a.
336
+ Ziqi Zhang, Yaya Shi, Chunfeng Yuan, Bing Li, Peijin Wang, Weiming Hu, and Zheng-Jun Zha. Object relational graph with teacher-recommended learning for video captioning. In CVPR, 2020.
337
+ Ziqi Zhang, Zhongang Qi, Chunfeng Yuan, Ying Shan, Bing Li, Ying Deng, and Weiming Hu. Open-book video captioning with retrieve-copy-generate network. In CVPR, 2021b.
338
+ Qi Zheng, Chaoyue Wang, and Dacheng Tao. Syntax-aware action targeting for video captioning. In CVPR, 2020.
339
+ Luowei Zhou, Chenliang Xu, and Jason J Corso. Towards automatic learning of procedures from web instructional videos. In AAAI, 2018.
340
+ Luowei Zhou, Hamid Palangi, Lei Zhang, Houdong Hu, Jason J. Corso, and Jianfeng Gao. Unified visionlanguage pre-training for image captioning and VQA. In AAAI, 2020.
parse/test/b4tMhpN0JC/b4tMhpN0JC_content_list.json ADDED
@@ -0,0 +1,604 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "GIT: A Generative Image-to-text Transformer for Vision and Language ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Jianfeng Wang \nZhengyuan Yang \nXiaowei Hu \nLinjie Li \nKevin Lin \nZhe Gan \nZicheng Liu \nCe Liu \nLijuan Wang \nMicrosoft Cloud and AI jianfw@microsoft.com \nzhengyang@microsoft.com \nxiaowei.hu@microsoft.com lindsey.li@microsoft.com keli@microsoft.com zhe.gan@microsoft.com zliu@microsoft.com ce.liu@microsoft.com lijuanw@microsoft.com ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "",
16
+ "page_idx": 0
17
+ },
18
+ {
19
+ "type": "text",
20
+ "text": "Reviewed on OpenReview: https: // openreview. net/ forum? id= b4tMhpN0JC ",
21
+ "page_idx": 0
22
+ },
23
+ {
24
+ "type": "text",
25
+ "text": "Abstract ",
26
+ "text_level": 1,
27
+ "page_idx": 0
28
+ },
29
+ {
30
+ "type": "text",
31
+ "text": "In this paper, we design and train a Generative Image-to-text Transformer, GIT, to unify vision-language tasks such as image/video captioning and question answering. While generative models provide a consistent network architecture between pre-training and fine-tuning, existing work typically contains complex structures (uni/multi-modal encoder/decoder) and depends on external modules such as object detectors/taggers and optical character recognition (OCR). In GIT, we simplify the architecture as one image encoder and one text decoder under a single language modeling task. We also scale up the pre-training data and the model size to boost the model performance. Without bells and whistles, our GIT establishes new state of the arts on numerous challenging benchmarks with a large margin. For instance, our model surpasses the human performance for the first time on TextCaps (138.2 vs. 125.5 in CIDEr). Furthermore, we present a new scheme of generation-based image classification and scene text recognition, achieving decent performance on standard benchmarks. ",
32
+ "page_idx": 0
33
+ },
34
+ {
35
+ "type": "text",
36
+ "text": "1 Introduction ",
37
+ "text_level": 1,
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "table",
42
+ "img_path": "images/2d7cfdbbf6ea931615802bcf29c8100ce17f3ff68f21136dd24bc35844630a93.jpg",
43
+ "table_caption": [
44
+ "Table 1: Comparison with prior SOTA on image/video captioning and question answering (QA) tasks. \\*: evaluated on the public server. CIDEr scores are reported for Captioning tasks. Prior SOTA: COCO(Zhang et al., 2021a), nocaps (Yu et al., 2022), VizWiz-Caption (Gong et al., 2021), TextCaps (Yang et al., 2021c),ST-VQA (Biten et al., 2022),VizWiz-VQA (Alayrac et al., 2022),OCR-VQA (Biten et al., 2022),MSVD (Lin et al., 2021),MSRVTT (Seo et al., 2022),VATEX (Tang et al., 2021),TVC (Tang et al., 2021),MSVD-QA (Wang et al., 2022a),TGIF-Frame (Zellers et al., 2021),Text Recog. (Lyu et al., 2022). Details of GIT2 are presented in supplementary materials. "
45
+ ],
46
+ "table_footnote": [
47
+ "1Prior SOTA: among all the numbers reported in publications before 8/2022, as far as we know. "
48
+ ],
49
+ "table_body": "<table><tr><td rowspan=\"3\"></td><td colspan=\"4\">Image captioning</td><td colspan=\"3\">Image QA</td><td colspan=\"4\">Video captioning</td><td colspan=\"2\">Video QAText Rec.</td><td></td></tr><tr><td>*O000</td><td>*sdeoou</td><td>ZIMZA</td><td></td><td>*VOA-LS</td><td>ZIMZIA</td><td></td><td>QASI</td><td>LLAHSI</td><td>XALAA</td><td>*OAL</td><td>VO-IASTN</td><td></td><td>9u08AV</td></tr><tr><td>Prior SOTA1 138.7120.6</td><td></td><td></td><td>94.1</td><td>109.7</td><td>69.6</td><td>65.4</td><td>67.9</td><td>120.6</td><td>60</td><td>86.5</td><td></td><td>64.548.3</td><td>69.5</td><td>93.8</td></tr><tr><td>GIT (ours)</td><td>148.8</td><td>123.4</td><td>114.4</td><td>138.2</td><td>69.6</td><td>67.5</td><td>68.1</td><td>180.2</td><td>73.9</td><td>93.8</td><td>61.256.8</td><td></td><td>72.8</td><td>92.9</td></tr><tr><td>A</td><td></td><td></td><td>+10.1 +2.8 +20.3 +28.5 +0.0 +2.1 +0.2 +59.6 +13.9</td><td></td><td></td><td></td><td></td><td></td><td></td><td>+7.3</td><td></td><td>-3.3+8.5</td><td>+3.3</td><td>-0.9</td></tr><tr><td>GIT2 (ours) 149.8124.8 120.8145.0 75.8 70.1</td><td></td><td></td><td></td><td></td><td></td><td></td><td>70.3</td><td>185.4</td><td>75.9</td><td>96.6</td><td>65.058.2</td><td></td><td>74.9</td><td>94.5</td></tr><tr><td>△</td><td></td><td></td><td>+11.1 + 4.2 +26.7 +35.3 +6.2 +4.7 +2.4 +64.8 +15.9 +10.1 +0.5 +9.9</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>+5.4</td><td>+0.7</td></tr></table>",
50
+ "page_idx": 0
51
+ },
52
+ {
53
+ "type": "image",
54
+ "img_path": "images/e6a491c63573124af5db084ef16ce1bc6b4c6868551986275747be1404756118.jpg",
55
+ "image_caption": [
56
+ "Figure 1: Example captions generated by GIT. The model demonstrates strong capability of recognizing scene text, tables/charts, food, banknote, logos, landmarks, characters, products, etc. "
57
+ ],
58
+ "image_footnote": [],
59
+ "page_idx": 1
60
+ },
61
+ {
62
+ "type": "text",
63
+ "text": "Tremendous advances have been made in recent years on vision-language (VL) pre-training, especially based on the large-scale data of image-text pairs, e.g., CLIP (Radford et al., 2021), Florence (Yuan et al., 2021), and SimVLM (Wang et al., 2021b). The learned representation greatly boosts the performance on various downstream tasks, such as image captioning (Lin et al., 2014), visual question answering (VQA) (Goyal et al., 2017), and image-text retrieval. ",
64
+ "page_idx": 1
65
+ },
66
+ {
67
+ "type": "text",
68
+ "text": "During pre-training, Masked Language Modeling (MLM) and Image-Text Matching (ITM) tasks have been widely used (Wang et al., 2020; Fang et al., 2021c; Li et al., 2020; Zhang et al., 2021a; Chen et al., 2020b; Dou et al., 2021; Wang et al., 2021a; Kim et al., 2021). However, these losses are different from the downstream tasks, and task-specific adaptation has to be made. For example, ITM is removed for image captioning (Wang et al., 2021a; Li et al., 2020), and an extra randomly initialized multi-layer perceptron is added for VQA (Wang et al., 2021b; Li et al., 2020). To reduce this discrepancy, recent approaches (Cho et al., 2021; Wang et al., 2021b; Yang et al., 2021b; Wang et al., 2022b) have attempted to design unified generative models for pre-training, as most VL tasks can be cast as generation problems. These approaches typically leverage a multi-modal encoder and a text decoder with careful design on the text input and the text target. To further push the frontier of this direction, we present a simple Generative Image-to-text Transformer, named GIT, which consists only of one image encoder and one text decoder. The pre-training task is just to map the input image to the entire associated text description with the language modeling objective. Despite its simplicity, GIT achieves new state of the arts across numerous challenging benchmarks with a large margin, as summarized in Table 1. ",
69
+ "page_idx": 1
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "The image encoder is a Swin-like vision transformer (Dosovitskiy et al., 2021; Yuan et al., 2021) pre-trained on massive image-text pairs based on the contrastive task (Jia et al., 2021; Radford et al., 2021; Yuan et al., 2021). This eliminates the dependency on the object detector, which is used in many existing approaches (Anderson et al., 2018; Li et al., 2020; Wang et al., 2020; Zhang et al., 2021a; Chen et al., 2020b; Fang et al., 2021c). To extend it to the video domain, we simply extract the features of multiple sampled frames and concatenate them as the video representation. The text decoder is a transformer network to predict the associated text. The entire network is trained with the language modeling task. For VQA, the input question is treated as a text prefix, and the answer is generated in an auto-regressive way. Furthermore, we present a new generation-based scheme for ImageNet classification, where the predicted labels come directly from our generative model without pre-defining the vocabulary. ",
74
+ "page_idx": 1
75
+ },
76
+ {
77
+ "type": "text",
78
+ "text": "The approach is simple, but the performance is surprisingly impressive after we scale up the pre-training data and the model size. Fig. 1 shows captions generated by the GIT fine-tuned with TextCaps. The samples demonstrate the model’s strong capability of recognizing and describing scene text, tables, charts, food, banknote, logos, landmarks, characters, celebrities, products, etc., indicating that our GIT model has encoded rich multi-modal knowledge about the visual world. ",
79
+ "page_idx": 1
80
+ },
81
+ {
82
+ "type": "text",
83
+ "text": "",
84
+ "page_idx": 2
85
+ },
86
+ {
87
+ "type": "text",
88
+ "text": "Our main contributions are as follows. ",
89
+ "page_idx": 2
90
+ },
91
+ {
92
+ "type": "text",
93
+ "text": "• We present GIT, which consists of only one image encoder and one text decoder, pre-trained on 0.8 billion image-text pairs with the language modeling task. We demonstrate new state-of-the-art performance over numerous tasks on image/video captioning and QA (Table 1), without the dependency on object detectors, object tags, and OCR. On TextCaps, we surpass the human performance for the first time. This implies that a simple network architecture can also achieve strong performance with scaling. \n• We demonstrate that GIT pre-trained on the image-text pairs is capable of achieving new state-of-the-art performance even on video tasks without video-dedicated encoders. \n• We present a new scheme of generation-based image classification. On ImageNet-1K, we show a decent performance (88.79% top-1 accuracy) with our GIT. ",
94
+ "page_idx": 2
95
+ },
96
+ {
97
+ "type": "text",
98
+ "text": "2 Related Work ",
99
+ "text_level": 1,
100
+ "page_idx": 2
101
+ },
102
+ {
103
+ "type": "text",
104
+ "text": "In VL pre-training, multi-task pre-training has been widely used to empower the network with multiple or enhanced capabilities. For example, MLM and ITM are widely adopted pre-training tasks (Li et al., 2020; Kim et al., 2021; Zhang et al., 2021a; Wang et al., 2020; Xue et al., 2021; Lu et al., 2019; Tan & Bansal, 2019). Recently, the image-text contrastive loss has also been added in Yu et al. (2022); Li et al. (2021a); Wang et al. (2021a). Since most VL tasks can be formulated as the text generation task (Cho et al., 2021), a single generation model can be pre-trained to support various downstream tasks. The input and output texts are usually carefully designed to pre-train such a generation model. For example in Cho et al. (2021), the text is properly masked as the network input and the goal is to recover the masked text span. SimVLM (Wang et al., 2021b) randomly splits a text sentence into the input and the target output. In these methods, a multi-modal transformer encoder is utilized to incorporate the text inputs before decoding the output. ",
105
+ "page_idx": 2
106
+ },
107
+ {
108
+ "type": "text",
109
+ "text": "For image representation, Faster RCNN has been used in most existing approaches (Anderson et al., 2018; Li et al., 2020; Wang et al., 2020; Zhang et al., 2021a; Chen et al., 2020b; Fang et al., 2021c) to extract the region features. Recently, a growing interest is in dense representation (Huang et al., 2020; Wang et al., 2021b;a; Kim et al., 2021; Fang et al., 2021b; Dou et al., 2021; Li et al., 2021a) from the feature map, which requires no bounding box annotations. Meanwhile, it is easy to train the entire network in an end-to-end way. In addition to the representation from the feature map, object tags (Li et al., 2020; Wang et al., 2020; Zhang et al., 2021a; Cornia et al., 2021; Fang et al., 2021b) are leveraged to facilitate the transformer to understand the context, especially the novel objects. For scene-text-related tasks, OCR is invoked to generate the scene text as additional network input, e.g., in Hu et al. (2020); Yang et al. (2021c). For the text prediction, A transformer network is typically used, which can incorporate the cross-attention module to fuse the image tokens, e.g., Cho et al. (2021); Alayrac et al. (2022); Yang et al. (2021b); Yu et al. (2022), or only the self-attention modules where the image tokens are concatenated with the text tokens, e.g., Li et al. (2020); Chen et al. (2020b); Zhang et al. (2021a); Wang et al. (2020); Fang et al. (2021b). ",
110
+ "page_idx": 2
111
+ },
112
+ {
113
+ "type": "text",
114
+ "text": "Along the direction of scaling on VL tasks, LEMON (Hu et al., 2021a) studies the behavior of the detectorbased captioning model with MLM. CoCa (Yu et al., 2022) studies different model sizes, but on the same pre-training data. In this paper, we present a comprehensive study on 9 various benchmarks (3 in main paper and 6 in supplementary materials, image/video captioning & QA tasks) with 3 different model sizes and 3 different pre-training data scales (9 data points for each benchmark). ",
115
+ "page_idx": 2
116
+ },
117
+ {
118
+ "type": "text",
119
+ "text": "3 Generative Image-to-text Transformer ",
120
+ "text_level": 1,
121
+ "page_idx": 2
122
+ },
123
+ {
124
+ "type": "text",
125
+ "text": "With large-scale image-text pairs, our goal is to pre-train a VL model which is simple yet effective to benefit image/video captioning and QA tasks. As the input is the image and the output is the text, the minimal set ",
126
+ "page_idx": 2
127
+ },
128
+ {
129
+ "type": "image",
130
+ "img_path": "images/eabcd26567a5edae7f159ea48e7ab3a7718789404514c6e3f6d3b494d1f69ece.jpg",
131
+ "image_caption": [
132
+ "Figure 2: Network architecture of our GIT, composed of one image encoder and one text decoder. (a): The training task in both pre-training and captioning is the language modeling task to predict the associated description. (b): In VQA, the question is placed as the text prefix. (c): For video, multiple frames are sampled and encoded independently. The features are added with an extra learnable temporal embedding (initialized as 0) before concatenation. "
133
+ ],
134
+ "image_footnote": [],
135
+ "page_idx": 3
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "of components could be one image encoder and one text decoder, which are the only components of our GIT as illustrated in Fig. 2. ",
140
+ "page_idx": 3
141
+ },
142
+ {
143
+ "type": "text",
144
+ "text": "3.1 Network Architecture ",
145
+ "text_level": 1,
146
+ "page_idx": 3
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "The image encoder is based on the contrastive pre-trained model (Yuan et al., 2021). The input is the raw image and the output is a compact 2D feature map, which is flattened into a list of features. With an extra linear layer and a layernorm layer, the image features are projected into $D$ dimensions, which are the input to the text decoder. We use the image encoder pre-trained with contrastive tasks because recent studies show superior performance with such image encoder, e.g. Yuan et al. (2021); Dou et al. (2021); Alayrac et al. (2022). In Sec 4.6 and supplementary materials, we also observe the VL performance boosts significantly with a stronger image encoder. This is consistent with the observation in object detection-based approaches, e.g. in Wang et al. (2020); Zhang et al. (2021a). The concurrent work of CoCa (Yu et al., 2022) unifies the contrastive task and the generation task. as one pre-training phase. Our approach is equivalent to separating the two tasks sequentially: (i) using the contrastive task to pre-train the image encoder followed by (ii) using the generation task to pre-train both the image encoder and text decoder. ",
151
+ "page_idx": 3
152
+ },
153
+ {
154
+ "type": "text",
155
+ "text": "The text decoder is a transformer module to predict the text description. The transformer module consists of multiple transformer blocks, each of which is composed of one self-attention layer and one feed-forward layer. The text is tokenized and embedded into $D$ dimensions, followed by an addition of the positional encoding and a layernorm layer. The image features are concatenated with the text embeddings as the input to the transformer module. The text begins with the [BOS] token, and is decoded in an auto-regressive way until the [EOS] token or reaching the maximum steps. The seq2seq attention mask as in Fig. 3 is applied such that the text token only depends on the preceding tokens and all image tokens, and image tokens can attend to each other. This is different from a unidirectional attention mask, where not every image token can rely on all other image tokens. ",
156
+ "page_idx": 3
157
+ },
158
+ {
159
+ "type": "text",
160
+ "text": "Instead of well initializing the image encoder, we randomly initialize the text decoder. This design choice is highly motivated from the experiment studies of Wang et al. (2020), in which the random initialization shows similar performance, compared with the BERT initialization. This could be because the BERT initialization cannot understand the image signal, which is critical for VL tasks. Without dependency of the initialization, we can easily explore different design choices. The concurrent work of Flamingo (Alayrac et al., 2022) employs a similar architecture of image encoder $^ +$ text decoder, but their decoder is pre-trained and frozen to preserve the generalization capability of the large language model. In our GIT, all parameters are updated to better fit the VL tasks. ",
161
+ "page_idx": 3
162
+ },
163
+ {
164
+ "type": "text",
165
+ "text": "",
166
+ "page_idx": 4
167
+ },
168
+ {
169
+ "type": "text",
170
+ "text": "An alternative architecture is the cross-attention-based decoder to incorporate the image signals instead of concatenation with self-attention. Empirically as shown in supplementary material (Appendix G.2), with large-scale pre-training, we find the self-attention-based decoder achieves better performance overall, while in small-scale setting, the cross-attentionbased approach wins. A plausible explanation is that with sufficient training, the decoder parameters can well process both the image and the text, and the image tokens can be better updated with the self-attention for text generation. With cross-attention, the image tokens cannot attend to each other. ",
171
+ "page_idx": 4
172
+ },
173
+ {
174
+ "type": "text",
175
+ "text": "3.2 Pre-training ",
176
+ "text_level": 1,
177
+ "page_idx": 4
178
+ },
179
+ {
180
+ "type": "text",
181
+ "text": "For each image-text pair, let $I$ be the image, $y _ { i } , i \\in \\{ 1 , \\cdots , N \\}$ be the text tokens, $y _ { 0 }$ be the [BOS] token and $y N { + 1 }$ be the [EOS] token. We apply the language modeling (LM) loss to train the model. That is, ",
182
+ "page_idx": 4
183
+ },
184
+ {
185
+ "type": "image",
186
+ "img_path": "images/bcfd774e9dd8afaa3e4d0c231474044ecae8cd5bc80a21562b8fa8749104b50c.jpg",
187
+ "image_caption": [
188
+ "Figure 3: seq2seq attention mask is applied to the transformer. If (i, $j$ ) is 1, the $_ i$ -th output can depend on the $j$ -th input; otherwise, not. "
189
+ ],
190
+ "image_footnote": [],
191
+ "page_idx": 4
192
+ },
193
+ {
194
+ "type": "equation",
195
+ "img_path": "images/e9f2fdb0b62cc9d31f8b50fd03605bbd4a7d19f0f73dc05200ee46a973f781db.jpg",
196
+ "text": "$$\nl = \\frac { 1 } { N + 1 } \\sum _ { i = 1 } ^ { N + 1 } \\mathrm { C E } ( y _ { i } , p ( y _ { i } | I , \\{ y _ { j } , j = 0 , \\cdots , i - 1 ) \\} ) ,\n$$",
197
+ "text_format": "latex",
198
+ "page_idx": 4
199
+ },
200
+ {
201
+ "type": "text",
202
+ "text": "where CE is the cross-entropy loss with label smoothing of 0.1. ",
203
+ "page_idx": 4
204
+ },
205
+ {
206
+ "type": "text",
207
+ "text": "An alternative choice is MLM, which predicts typically $1 5 \\%$ of input tokens in each iteration. To predict all tokens, we have to run at least $1 / 0 . 1 5 = 6 . 7 $ epochs. For LM, each iteration can predict all tokens, which is more efficient for large-scale pre-training data. In Hu et al. (2021a), the ablation studies also show that LM can achieve better performance with limited epochs. In our large-scale training, the number of epoch is only 2 due to computational resource limitation, and thus we choose LM. Meanwhile, most of the recent large-scale language models are also based on LM, e.g. Brown et al. (2020); Chowdhery et al. (2022). ",
208
+ "page_idx": 4
209
+ },
210
+ {
211
+ "type": "text",
212
+ "text": "Without the image input, the model is reduced to a decoder-only language model, similar to GPT3 (Brown et al., 2020) in the architecture wise. Thus, this design also enables the possibility to leverage the text-only data to enrich the decoding capability with a scaled-up decoder. We leave this as future work. ",
213
+ "page_idx": 4
214
+ },
215
+ {
216
+ "type": "text",
217
+ "text": "3.3 Fine-tuning ",
218
+ "text_level": 1,
219
+ "page_idx": 4
220
+ },
221
+ {
222
+ "type": "text",
223
+ "text": "For the image captioning task, as the training data format is the same as that in pre-training, we apply the same LM task to fine-tune our GIT. ",
224
+ "page_idx": 4
225
+ },
226
+ {
227
+ "type": "text",
228
+ "text": "For visual question answering, the question and the ground-truth answer are concatenated as a new special caption during the fine-tuning, but the LM loss is only applied on the answer and the [EOS] tokens. During inference, the question is interpreted as the caption prefix and the completed part is the prediction. Compared with the existing approaches (Wang et al., 2021a;b; Zhang et al., 2021a; Li et al., 2022b) for VQAv2 (Goyal et al., 2017), our model is generative without pre-defining the candidate answers, even in inference. This imposes more challenges as the model has to predict at least two correct tokens: one for the answer and another for [EOS]. In contrast, the existing work pre-collects the answer candidate, recasts the problem as a classification problem, and only needs to predict once. However, considering the benefit of the free-form answer, we choose the generative approach. Due to difficulty of the generative model, we observe slightly worse performance on VQAv2 than the discriminative existing work. For the scene-text related VQA tasks, existing approaches (Yang et al., 2021c; Hu et al., 2020) typically leverages the OCR engine to generate the scene text and use dynamic pointer network to decide the current output token should be OCR or the general text. Here, our approach depends on no OCR engine, and thus no dynamic pointer network. Empirically, we find the model gradually learns how to read the scene text with large-scale pre-training, and our model achieves new SoTA performance on these tasks. ",
229
+ "page_idx": 4
230
+ },
231
+ {
232
+ "type": "text",
233
+ "text": "",
234
+ "page_idx": 5
235
+ },
236
+ {
237
+ "type": "text",
238
+ "text": "Our model is not specifically designed for the video domain, but we find our model can also achieve competitive or even new SOTA performance with a simple architecture change. That is, we sample multiple frames from each video clip, and encode each frame via the image encoder independently. Afterwards, we add a learnable temporal embedding (initialized as zeros), and concatenate the features from sampled frames. The final representation is used in a similar way as the image representation for captioning and question answering. ",
239
+ "page_idx": 5
240
+ },
241
+ {
242
+ "type": "text",
243
+ "text": "We also apply our generation model to the image classification task, where the class names are interpreted as image captions, and our GIT is fine-tuned to predict the result in an auto-regressive way. This is different from existing work which normally pre-defines the vocabulary and uses a linear layer (with softmax) to predict the likelihood of each category. This new generation-based scheme is beneficial when new data and new categories are added to the existing dataset. In this case, the network can continuously train on the new data without introducing new parameters. ",
244
+ "page_idx": 5
245
+ },
246
+ {
247
+ "type": "text",
248
+ "text": "4 Experiments ",
249
+ "text_level": 1,
250
+ "page_idx": 5
251
+ },
252
+ {
253
+ "type": "text",
254
+ "text": "4.1 Setting ",
255
+ "text_level": 1,
256
+ "page_idx": 5
257
+ },
258
+ {
259
+ "type": "text",
260
+ "text": "We collect 0.8B image-text pairs for pre-training, which include COCO (Lin et al., 2014), Conceptual Captions (CC3M) (Sharma et al., 2018), SBU (Ordonez et al., 2011), Visual Genome (VG) (Krishna et al., 2016), Conceptual Captions (CC12M) (Changpinyo et al., 2021), ALT200M (Hu et al., 2021a), and an extra 0.6B data following a similar collection procedure in Hu et al. (2021a). The image encoder is initialized from the pre-trained contrastive model (Yuan et al., 2021). The hidden dimension ( $D$ ) is 768. The text decoder consists of 6 randomly-initialized transformer blocks. The total number of model parameters is 0.7 billion. The learning rates of the image encoder and the decoder are $1 e ^ { - 5 }$ and $5 e ^ { - 5 }$ , respectively, and follow the cosine decay to 0. The total number of epochs is 2. During inference, the beam size is 4 and the length penalty (Wu et al., 2016) is 0.6 by default. ",
261
+ "page_idx": 5
262
+ },
263
+ {
264
+ "type": "text",
265
+ "text": "Supplementary materials show results on two smaller model variants (GIT $_ B$ and GIT $L$ ) and one even larger model (GIT2) with full details. When comparing with existing approaches, the reference numbers are the best one reported in the corresponding paper unless explicitly specified. ",
266
+ "page_idx": 5
267
+ },
268
+ {
269
+ "type": "text",
270
+ "text": "4.2 Results on Image Captioning and Question Answering ",
271
+ "text_level": 1,
272
+ "page_idx": 5
273
+ },
274
+ {
275
+ "type": "text",
276
+ "text": "We comprehensively evaluate the captioning performance on the widely-used Karpathy split (Karpathy & Li, 2015) of COCO (Lin et al., 2014) and Flickr30K (Young et al., 2014), the COCO test set, nocaps (Agrawal et al., 2019)2 which focuses on novel objects, TextCaps (Sidorov et al., 2020) which focuses on scene-text understanding, and VizWiz-Captions (Gurari et al., 2020) which focuses on the real use case by the visionimpaired people. The results in CIDEr (Vedantam et al., 2015) are shown in Table 2 and 3. From the results, we can see our model achieves the new SOTA performance on all these metrics except on COCO Karpathy test. On nocaps, compared with CoCa (Yu et al., 2022), our model is much smaller in the model size (0.7B vs 2.1B), but achieves higher performance (123.0 vs 120.6 in CIDEr). On Textcaps, our solution outperforms the previous SOTA (TAP Yang et al. (2021c)) by a breakthrough margin (28.5 points in CIDEr), and also surpasses the human performance for the first time. For zero/few-shot evaluation as shown in Table 3, our model can significantly benefit from more shots. With 32-shots, our approach is also better than Flamingo. ",
277
+ "page_idx": 5
278
+ },
279
+ {
280
+ "type": "text",
281
+ "text": "On VQA, the evaluation benchmarks include VQAv2 (Goyal et al., 2017), TextVQA (Singh et al., 2019), VizWiz-VQA (Gurari et al., 2018). ST-VQA (Biten et al., 2019), and OCR-VQA (Mishra et al., 2019). Before fine-tuning the model, we run an intermediate fine-tuning on the combination of the training data of VQAv2, TextVQA, ST-VQA, OCR-VQA, VizWiz-VQA, Visual Genome QA (Krishna et al., 2016), GQA (Hudson & ",
282
+ "page_idx": 5
283
+ },
284
+ {
285
+ "type": "table",
286
+ "img_path": "images/95e0833be6cd064d76b4c28e4ad0738d543bef69e2c900957340791b111fccb6.jpg",
287
+ "table_caption": [
288
+ "Table 2: Results on image captioning. \\*: the nubmers are from Sidorov et al. (2020); CE: cross-entropy optimization. All numbers are CIDEr scores, and other metrics are shown in supplementary materials. #: winner entry of the CVPR 2021 workshop challenge Anc.-Cap.: Xu et al. (2021) AoANet: Huang et al. (2019) BUTD: Anderson et al. (2018), CoCa: Yu et al. (2022), DistillVLM: Fang et al. (2021c), Flamingo: Alayrac et al. (2022), Human: Agrawal et al. (2019), LEMON: Hu et al. (2021a), M4C-Cap.: Hu et al. (2020) MiniVLM: Wang et al. (2020), MTMA: Gong et al. (2021), OFA: Wang et al. (2022b), OSCAR: Li et al. (2020), UFO: Wang et al. (2021a), UniversalCap: (Cornia et al., 2021) ViTCap: Fang et al. (2021b), VinVL: Zhang et al. (2021a), VIVO: Hu et al. (2021b) SimVLM: Wang et al. (2021b), TAP: Yang et al. (2021c). "
289
+ ],
290
+ "table_footnote": [
291
+ "(a) COCO Karp. "
292
+ ],
293
+ "table_body": "<table><tr><td>Method</td><td>CE</td></tr><tr><td>MiniVLM</td><td>119.8</td></tr><tr><td>DistillVLM</td><td>120.8</td></tr><tr><td>ViTCap</td><td>125.2</td></tr><tr><td>OSCAR</td><td>127.8</td></tr><tr><td>VinVL</td><td>130.8</td></tr><tr><td>UFO</td><td>131.2</td></tr><tr><td>Flamingo</td><td>138.1</td></tr><tr><td>LEMON</td><td>139.1</td></tr><tr><td>SimVLM</td><td>143.3</td></tr><tr><td>CoCa</td><td>143.6</td></tr><tr><td>OFA</td><td>145.3</td></tr><tr><td>GIT</td><td>144.8</td></tr></table>",
294
+ "page_idx": 6
295
+ },
296
+ {
297
+ "type": "table",
298
+ "img_path": "images/30010fe8c4a3376362d07be978bb707de1cd57b33ecd23109114293cf04a46dd.jpg",
299
+ "table_caption": [],
300
+ "table_footnote": [],
301
+ "table_body": "<table><tr><td>Method</td><td>Test</td></tr><tr><td>OSCAR</td><td>80.9</td></tr><tr><td>Human</td><td>85.3</td></tr><tr><td>VIVO</td><td>86.6</td></tr><tr><td>VinVL</td><td>92.5</td></tr><tr><td>UFO</td><td>92.3</td></tr><tr><td>SimVLM</td><td>115.2</td></tr><tr><td>LEMON</td><td>114.3</td></tr><tr><td>UniversalCap</td><td>119.3</td></tr><tr><td>CoCa</td><td>120.6</td></tr><tr><td>GIT</td><td>123.4</td></tr></table>",
302
+ "page_idx": 6
303
+ },
304
+ {
305
+ "type": "table",
306
+ "img_path": "images/bdb07fce2db420e3420dcd3164c0922508bd907ce2e66c9db626a41f19802405.jpg",
307
+ "table_caption": [],
308
+ "table_footnote": [
309
+ "(c) VizWiz-Captions "
310
+ ],
311
+ "table_body": "<table><tr><td>Method</td><td>C</td></tr><tr><td>BUTD</td><td>120.5</td></tr><tr><td>VinVL</td><td>138.7</td></tr><tr><td>GIT</td><td>148.8</td></tr><tr><td>(b) COCO test (c40)</td><td></td></tr><tr><td>Method</td><td>test-std</td></tr><tr><td>MTMA</td><td>94.1</td></tr><tr><td>GIT</td><td>114.4</td></tr></table>",
312
+ "page_idx": 6
313
+ },
314
+ {
315
+ "type": "table",
316
+ "img_path": "images/20dc45599aa01b543216d277f969274948f9847b896febd84ed295e4c88aae6a.jpg",
317
+ "table_caption": [],
318
+ "table_footnote": [
319
+ ""
320
+ ],
321
+ "table_body": "<table><tr><td>Method</td><td>Test</td></tr><tr><td>BUTD*</td><td>33.8</td></tr><tr><td>AoANet* M4C-Cap.* 81.0</td><td>34.6</td></tr><tr><td>Anc.-Cap.</td><td>87.4</td></tr><tr><td>TAP</td><td>103.2</td></tr><tr><td>TAP#</td><td>109.7</td></tr><tr><td>Human</td><td></td></tr><tr><td></td><td>125.5</td></tr><tr><td>GIT</td><td>138.2</td></tr><tr><td>(e)TextCaps</td><td></td></tr></table>",
322
+ "page_idx": 6
323
+ },
324
+ {
325
+ "type": "table",
326
+ "img_path": "images/6165d87db0760fcae4170fa81270067d17eff8bc72b745b7f8072ed0f88c5abe.jpg",
327
+ "table_caption": [
328
+ "Table 3: Zero/Few/Full-shot evaluation on Flickr30K with Karpathy split. "
329
+ ],
330
+ "table_footnote": [],
331
+ "table_body": "<table><tr><td>Shot</td><td>0</td><td>16</td><td>32</td><td>290 (1%)</td><td>full</td></tr><tr><td>Zhou et al. (2020)</td><td>1</td><td>1</td><td>1</td><td></td><td>68.5</td></tr><tr><td>Flamingo</td><td>67.2</td><td>78.9</td><td>75.4</td><td>1</td><td>1</td></tr><tr><td>GIT</td><td>49.6</td><td>78.0</td><td>80.5</td><td>86.6</td><td>98.5</td></tr></table>",
332
+ "page_idx": 6
333
+ },
334
+ {
335
+ "type": "text",
336
+ "text": "Manning, 2019), and OK-VQA (Marino et al., 2019). To avoid data contamination, we remove the duplicate images of the test and validation set of the target benchmarks. As illustrated in Table 4, we achieve new SOTA on VizWiz-VQA and OCR-VQA, and same performance with prior SOTA of LaTr (Biten et al., 2022) on ST-VQA. Compared with the concurrent work of Flamingo (Alayrac et al., 2022), we achieve higher accuracy (+5.4) on TextVQA and lower (-3.29) on VQAv2. Note that Flamingo’s model size is 80B, which is 114 times of ours (0.7B). On VQAv2, we observe that our model performs worse in 1.5 points than the discriminative model of Florence (Yuan et al., 2021), which shares the same image encoder. The reason might be the increased difficulty of the generative model. That is, each correct answer requires at least two correct predictions (answer and [EOS]; 2.2 on average), while the discriminative model requires only one correct prediction. In (Wang et al., 2021b), the ablation study also shows the better performance by around 1 point than the discriminative counterpart. Another reason could be that the model of Florence for VQA leverages RoBerta (Liu et al., 2019) as the text encoder, which implicitly uses the text-only data to improve the performance. ",
337
+ "page_idx": 6
338
+ },
339
+ {
340
+ "type": "text",
341
+ "text": "4.3 Results on Video Captioning and Question Answering ",
342
+ "text_level": 1,
343
+ "page_idx": 6
344
+ },
345
+ {
346
+ "type": "text",
347
+ "text": "On the video captioning task, the performance is evaluated on MSVD (Chen & Dolan, 2011) with the widely-used splits from Venugopalan et al. (2014), MSRVTT (Xu et al., 2016), YouCook2 (Zhou et al., 2018) (results in supplementary materials.) VATEX (Wang et al., 2019b), and TVC (Lei et al., 2020) (results in supplementary materials.). On VATEX, the performance is evaluated on both the public test and private test (evaluated on the server). Video QA is evaluated on MSVD-QA (Xu et al., 2017; Chen & Dolan, 2011), MSRVTT-QA (Xu et al., 2017; 2016), and TGIF-Frame (Jang et al., 2017), which are all open-ended tasks. The results are shown in Table 5 and Table 6 for captioning and QA, respectively. Although our model is not ",
348
+ "page_idx": 6
349
+ },
350
+ {
351
+ "type": "text",
352
+ "text": "Table 4: Results on visual question answering. (a): for VQAv2, approaches are divided according to whether the answer vocabulary is pre-defined (Closed) or not (Open) during inference. The model with closed vocabulary can be a classification model or generation model with constrained outputs, e.g., Wang et al. (2022b); Li et al. (2022b). The two numbers in parenthesis are the number of parameters and the number of images (the images for pre-trained modules are not counted) in VL pretraining. (b): for TextVQA, Mia (Qiao et al., 2021)# is the winner entry of TextVQA Challenge 2021 with a fine-tuned T5-3B (Raffel et al., 2020) model. (c): $\\# \\#$ : winner entry of 2021 VizWiz Grand Challenge Workshop. ALBEF: Li et al. (2021a), BLIP: Li et al. (2022b), BLOCK $^ +$ CNN+W2V: Mishra et al. (2019), CLIP-ViL: Shen et al. (2021), CoCa: Yu et al. (2022), CRN: Liu et al. (2020a), Flamingo: Alayrac et al. (2022), Florence: Yuan et al. (2021), LaAP-Net: Han et al. (2020), LaTr: Biten et al. (2022), M4C: Hu et al. (2020), M4C: Hu et al. (2020), METER: Dou et al. (2021), Mia: Qiao et al. (2021), mPlug: Li et al. (2022a), OSCAR: (Li et al., 2020), OFA: Wang et al. (2022b), UFO: Wang et al. (2021a), UNITER: (Chen et al., 2020b), UNIMO: Li et al. (2021c), SA-M4C: Kant et al. (2020), SimVLM: Wang et al. (2021b), SMA Gao et al. (2020), SMA: Gao et al. (2020), TAP: Yang et al. (2021c), VinVL: Zhang et al. (2021a), VILLA: Gan et al. (2020). ",
353
+ "page_idx": 7
354
+ },
355
+ {
356
+ "type": "table",
357
+ "img_path": "images/88fb638321e99f99040fcc3e67fe6df1b695feec34010f7f77b28d06421d7fc6.jpg",
358
+ "table_caption": [],
359
+ "table_footnote": [],
360
+ "table_body": "<table><tr><td colspan=\"2\">VocabularyMethod</td><td>test-std</td><td>Method</td><td>test</td></tr><tr><td rowspan=\"10\"></td><td>OSCAR</td><td>73.82</td><td>M4C</td><td>40.46</td></tr><tr><td>UNITER</td><td>74.02</td><td>LaAP-Net 41.41</td><td>SMA</td></tr><tr><td>VILLA</td><td>74.87</td><td>SA-M4C 44.6</td><td>CRN</td></tr><tr><td>UNIMO</td><td>75.27 SMA</td><td>45.51</td><td>LaAP</td></tr><tr><td>ALBEF</td><td>76.04</td><td>53.97</td><td>SA-M4</td></tr><tr><td>VinVL</td><td>76.60 76.76</td><td>Flamingo 54.1</td><td>TAP</td></tr><tr><td>UFO</td><td>Mia</td><td>73.67</td><td>LaTr</td></tr><tr><td>CLIP-ViL</td><td>GIT</td><td>59.75</td><td>GIT</td></tr><tr><td>METER BLIP</td><td></td><td>(b) TextVQA</td><td></td></tr><tr><td>SimVLM (-,1.8B)</td><td></td><td></td><td>Methc</td></tr><tr><td rowspan=\"5\"></td><td>Florence (0.9B,14M)</td><td>Method</td><td>test</td><td>BLOC</td></tr><tr><td>mPlug (0.6B,14M)</td><td>81.26 (Liu et al., 2021)## 82.0</td><td></td><td>M4C</td></tr><tr><td>OFA (0.9B, 54M)</td><td>Flamingo</td><td>60.6</td><td>LaAP</td></tr><tr><td>CoCa (2.1B, 4.8B)</td><td>82.3</td><td>65.4</td><td>LaTr</td></tr><tr><td></td><td>GIT</td><td>67.5</td><td>GIT</td></tr><tr><td>Open</td><td>Flamingo (80B, 2.3B) GIT (0.7B, 0.8B)</td><td>82.1 78.81</td><td>(c)VizWiz-QA</td><td></td></tr></table>",
361
+ "page_idx": 7
362
+ },
363
+ {
364
+ "type": "table",
365
+ "img_path": "images/4508e9781a4c9d31ef27057bfe862bc7b9f6ad06cace0f71967851c10810dfe9.jpg",
366
+ "table_caption": [],
367
+ "table_footnote": [
368
+ "(e) OCR-VQA "
369
+ ],
370
+ "table_body": "<table><tr><td>Method</td></tr><tr><td>Test ANLS M4C 46.2</td></tr><tr><td>SMA 46.6</td></tr><tr><td>CRN 48.3</td></tr><tr><td>LaAP-Net 48.5</td></tr><tr><td>SA-M4C 50.4</td></tr><tr><td>TAP 59.7</td></tr><tr><td>LaTr 69.6</td></tr><tr><td>GIT 69.6</td></tr><tr><td>(d) ST-VQA</td></tr><tr><td>Method test</td></tr><tr><td>BLOCK+CNN+W2V 48.3</td></tr><tr><td>M4C 63.9</td></tr><tr><td>LaAP-Net 64.1</td></tr><tr><td>LaTr 67.9</td></tr><tr><td>GIT 68.1</td></tr></table>",
371
+ "page_idx": 7
372
+ },
373
+ {
374
+ "type": "text",
375
+ "text": "dedicated for video tasks, our model achieve new SOTA on MSRVD, MSRVTT, and VATEX for captioning and on MSVD-QA and TGIF-Frame for QA. For example on VATEX private test, our results are even better (93.8 vs 86.5) than CLIP4Caption $^ { + + }$ (Tang et al., 2021), which relies on model ensemble and additional subtitle input. This is also better than Flamingo (Alayrac et al., 2022) (84.2) with 80B parameters. ",
376
+ "page_idx": 7
377
+ },
378
+ {
379
+ "type": "text",
380
+ "text": "4.4 Results on Image Classification ",
381
+ "text_level": 1,
382
+ "page_idx": 7
383
+ },
384
+ {
385
+ "type": "text",
386
+ "text": "We fine-tune GIT on ImageNet-1k. Each category is mapped to a unique class name, and the prediction is correct only if it is exactly matched with the ground-truth label subject to more or fewer whitespaces3. As shown in Table 7, our approach can achieve descent accuracy without pre-defining the vocabulary. Compared with Florence (Yuan et al., 2021) (same image encoder), our approach is worse in about 1.2 points. The reason might be similar to the case on VQAv2. That is, the generative approach needs to predict more tokens correctly to make one correct prediction, which increases the difficulty. ",
387
+ "page_idx": 7
388
+ },
389
+ {
390
+ "type": "text",
391
+ "text": "Zero-shot/Few-shot. The result is shown in Table 9. With no knowledge of the vocabulary, the pretrained GIT cannot infer the expected vocabulary, and thus the exactly-match accuracy is only $1 . 9 3 \\%$ (in the column of equal). However, if we relax the requirement and take it correct if the prediction contains the ground-truth, the accuracy is $4 0 . 8 8 \\%$ (in the column of $i n$ ), which shows the predicted caption can well identify the image content. If we have the vocabulary as a prior and limit the output tokens to be within the vocabulary, the accuracy drops to $3 3 . 4 8 \\%$ (in the column of voc-prior). This may suggest the network is less natural to directly predict the category name. By fine-tuning the model with only 1 shot or 5 shots per category, we observe that the accuracy is significantly improved. This demonstrates our model can be easily adapted to downstream tasks even with a few training samples. With the shot increased from 1 to 5, the gap between voc-prior and the other two columns (equal and in) becomes smaller. This is expected as more shots can be better to guide the network to predict in-vocabulary output. ",
392
+ "page_idx": 7
393
+ },
394
+ {
395
+ "type": "table",
396
+ "img_path": "images/84407a1117494007f7ce0a9f196e01de51384edf43b6eb607dd53a5f423d1a9c.jpg",
397
+ "table_caption": [
398
+ "Table 5: Results on video captioning. E: model ensemble; $_ { x }$ : with the subtitle as additional input. C.4Cap.: Tang et al. (2021) GRU-EVE: Aafaq et al. (2019) MGSA: Chen & Jiang (2019) MGSA: Chen & Jiang (2019) MV-GPT: Seo et al. (2022) PickNet: Chen et al. (2018) PMI-CAP: Chen et al. (2020a) SibNet: Liu et al. (2020b) OA-BTG: Zhang & Peng (2019) ORG-TRL: Zhang et al. (2020) OpenBook: Zhang et al. (2021b) POS+VCT: Hou et al. (2019) POS+CG: Wang et al. (2019a) SAAT: Zheng et al. (2020), STG-KD: Pan et al. (2020) SwinBERT: Lin et al. (2021) Support-set: Patrick et al. (2021) VaTeX: Wang et al. (2019b) VALUE: Li et al. (2021b) "
399
+ ],
400
+ "table_footnote": [
401
+ "(a) VATEX public test "
402
+ ],
403
+ "table_body": "<table><tr><td>Method</td><td>B@4</td><td>C</td><td>Method</td><td>B@4</td><td>C</td></tr><tr><td>PickNet</td><td>52.3</td><td>76.5</td><td>SAAT</td><td>39.9</td><td>51.0</td></tr><tr><td>GRU-EVE</td><td>47.9</td><td>78.1</td><td>MGSA</td><td>42.4</td><td>47.5</td></tr><tr><td>SAAT</td><td>46.5</td><td>81.0</td><td>POS+VCT</td><td>42.3</td><td>49.1</td></tr><tr><td>MGSA</td><td>53.4</td><td>86.7</td><td>SibNet</td><td>40.9</td><td>47.5</td></tr><tr><td>POS+VCT</td><td>52.8</td><td>87.8</td><td>POS+CG</td><td>42.0</td><td>48.7</td></tr><tr><td>SibNet</td><td>54.2</td><td>88.2</td><td>OA-BTG</td><td>41.4</td><td>46.9</td></tr><tr><td>POS+CG</td><td>52.5</td><td>88.7</td><td>STG-KD</td><td>40.5</td><td>47.1</td></tr><tr><td>OA-BTG</td><td>56.9</td><td>90.6</td><td>Support-set</td><td>38.9</td><td>48.6</td></tr><tr><td>STG-KD</td><td>52.2</td><td>93.0</td><td>PMI-CAP</td><td>42.1</td><td>49.4</td></tr><tr><td>PMI-CAP</td><td>54.6</td><td>95.1</td><td>ORG-TRL</td><td>43.6</td><td>50.9</td></tr><tr><td>ORG-TRL</td><td>54.3</td><td>95.2</td><td>OpenBook</td><td>33.9</td><td>52.9</td></tr><tr><td>SwinBERT</td><td>58.2</td><td>120.6</td><td>SwinBERT</td><td>41.9</td><td>53.8</td></tr><tr><td>GIT</td><td>79.5</td><td>180.2</td><td>MV-GPTT</td><td>48.9 60</td><td>F</td></tr><tr><td colspan=\"2\">(a) MSVD</td><td></td><td>GIT</td><td>53.8 73.9</td><td></td></tr></table>",
404
+ "page_idx": 8
405
+ },
406
+ {
407
+ "type": "table",
408
+ "img_path": "images/d11bf790ce5769d342cf512e9a1bd961eedf50e387a9424348699bed028f0c21.jpg",
409
+ "table_caption": [],
410
+ "table_footnote": [
411
+ "(e) VATEX private test "
412
+ ],
413
+ "table_body": "<table><tr><td>Method</td><td>C</td></tr><tr><td>X-L.+T.E</td><td>81.4</td></tr><tr><td>Flamingo C.4Cap.ET</td><td>84.2 86.5</td></tr><tr><td>GIT</td><td>93.8</td></tr></table>",
414
+ "page_idx": 8
415
+ },
416
+ {
417
+ "type": "table",
418
+ "img_path": "images/4b700004e527a9bb30aee4230777721ca77010cb71dc4a915071724c8ab27af2.jpg",
419
+ "table_caption": [
420
+ "Table 6: Results on video question answering. All are open-ended question answering tasks. All-in-one: Wang et al. (2022a), ClipBERT: Lei et al. (2021), CoMVT: Seo et al. (2021), Flamingo: Alayrac et al. (2022), JustAsk: Yang et al. (2021a), MERLOT: Zellers et al. (2021), MV-GPT: Seo et al. (2022), QueST: Jiang et al. (2020), HCRN: Le et al. (2021), VIOLET: Fu et al. (2021). "
421
+ ],
422
+ "table_footnote": [],
423
+ "table_body": "<table><tr><td>Method</td><td>Accuracy</td><td>Method</td><td>Accuracy</td><td>Method</td><td>Accuracy</td></tr><tr><td>QueST</td><td>34.6</td><td>JustAsk</td><td>41.5</td><td>HCRN</td><td>55.9</td></tr><tr><td>HCRN</td><td>36.1</td><td>MV-GPT</td><td>41.7</td><td>QueST</td><td>59.7</td></tr><tr><td>CoMVT</td><td>42.6</td><td>MERLOT</td><td>43.1</td><td>ClipBERT</td><td>60.3</td></tr><tr><td>JustAsk</td><td>46.3</td><td>VIOLET</td><td>43.9</td><td>All-in-one</td><td>66.3</td></tr><tr><td>VIOLET</td><td>47.9</td><td>All-in-one</td><td>46.8</td><td>VIOLET</td><td>68.9</td></tr><tr><td>All-in-one</td><td>48.3</td><td>Flamingo</td><td>47.4</td><td>MERLOT</td><td>69.5</td></tr><tr><td>GIT</td><td>56.8</td><td>GIT</td><td>43.2</td><td>GIT</td><td>72.8</td></tr><tr><td colspan=\"2\">(a) MSVD-QA</td><td colspan=\"2\">(b) MSRVTT-QA</td><td colspan=\"2\">(c) TGIF-Frame</td></tr></table>",
424
+ "page_idx": 8
425
+ },
426
+ {
427
+ "type": "text",
428
+ "text": "",
429
+ "page_idx": 8
430
+ },
431
+ {
432
+ "type": "text",
433
+ "text": "Compared with Flamingo, our GIT achieves higher accuracy. Flamingo conducts the few-shot learning without parameter update, but each test image is combined with the support training examples as extra network inputs. Meanwhile, different test image requires different support shots based on Yang et al. (2022). These may increase the inference cost. In contrast, our model updates the parameters by a lightweight fine-tuning once, and then all these training shots are not required during inference. ",
434
+ "page_idx": 8
435
+ },
436
+ {
437
+ "type": "text",
438
+ "text": "4.5 Results on Scene Text Recognition ",
439
+ "text_level": 1,
440
+ "page_idx": 8
441
+ },
442
+ {
443
+ "type": "text",
444
+ "text": "The task (Graves et al., 2006) aims to read scene text directly from the image. We evaluate our model in two settings. One is the GIT fine-tuned on TextCaps. The prediction is considered correct if the caption contains the ground-truth scene text word. The other is to fine-tune the model on two large scene text datasets: MJSynth (MJ) (Jaderberg et al., 2014; 2016) and SynthText (ST) (Gupta et al., 2016), where the ground-truth scene text is used as the caption. The prediction is correct if the output is the exact match to the ground-truth. Following the established setup, we evaluate on six standard benchmarks, including ICDAR 2013 (IC13) (Karatzas et al., 2013), ICDAR 2015 (IC15) (Karatzas et al., 2015), IIIT 5K-Words (IIIT) (Mishra et al., 2012), Street View Text (SVT) (Wang et al., 2011), Street View Text-Perspective (SVTP) (Phan et al., 2013), and CUTE80 (CUTE) (Risnumawan et al., 2014). The average accuracy is reported in Table 8. The accuracy on individual test sets is in supplementary materials. Our TextCaps-fine-tuned captioning model achieves an 89.9 accuracy, which demonstrates the strong scene text comprehension capability of our captioning model. After fine-tuning the model on the standard MJ $^ +$ ST datasets, GIT achieves 92.9 that surpasses the prior arts (Fang et al., 2021a; He et al., 2022) of 91.9. ",
445
+ "page_idx": 8
446
+ },
447
+ {
448
+ "type": "table",
449
+ "img_path": "images/5de519820c60b84bbf243d2ae91f28573e01807a57d7d08807002b7c7d572b8c.jpg",
450
+ "table_caption": [
451
+ "Table 7: Results on ImageNet-1k classification task. Our approach takes the class name as the caption and predict the label in an auto-regressive way without pre-defining the vocabulary. "
452
+ ],
453
+ "table_footnote": [],
454
+ "table_body": "<table><tr><td colspan=\"2\">VocabularyMethod</td></tr><tr><td>Closed</td><td>Top-1 ALIGN (Jia et al., 2021) 88.64</td></tr><tr><td rowspan=\"2\"></td><td>Florence (Yuan et al.,2021) 90.05</td></tr><tr><td>CoCa (Yu et al., 2022) 91.0</td></tr><tr><td>Open GIT</td><td>88.79</td></tr></table>",
455
+ "page_idx": 9
456
+ },
457
+ {
458
+ "type": "table",
459
+ "img_path": "images/6899714c0cc525eadab9bb5e90a766620499bd00bf0c08d6b28c5d92ad19711e.jpg",
460
+ "table_caption": [
461
+ "Table 8: Results on scene text recognition. MJ and ST indicate the MJSynth (MJ) (Jaderberg et al., 2014; 2016) and SynthText (ST) (Gupta et al., 2016) datasets used for training scene text recognition models. "
462
+ ],
463
+ "table_footnote": [],
464
+ "table_body": "<table><tr><td>Method</td><td>FT data</td><td>Average</td></tr><tr><td>SAM (Liao et al., 2019)</td><td>MJ+ST</td><td>87.8</td></tr><tr><td>Ro.Scanner (Yue et al., 2020) SRN (Yu et al., 2020)</td><td>MJ+ST</td><td>87.5</td></tr><tr><td>ABINet (Fang et al., 2021a)</td><td>MJ+ST</td><td>89.6</td></tr><tr><td>S-GTR (He et al., 2022)</td><td>MJ+ST</td><td>91.9</td></tr><tr><td></td><td>MJ+ST</td><td>91.9</td></tr><tr><td>MaskOCR (Lyu et al., 2022)</td><td>MJ+ST</td><td>93.8</td></tr><tr><td>GIT</td><td>Text+aT</td><td>9.9</td></tr></table>",
465
+ "page_idx": 9
466
+ },
467
+ {
468
+ "type": "table",
469
+ "img_path": "images/9091c4ecb4f4f35a892c61ca0b61863ef53d8f54e71615ce973f92f822b24566.jpg",
470
+ "table_caption": [
471
+ "Table 9: Zero/Few-shot evaluation on ImageNet with 3 metrics. equal: the unrestricted prediction should be exactly matched to the ground-truth. in: the unrestricted prediction should contain the ground-truth label name. voc-prior: the vocabulary is pre-defined as a prior. For our GIT, a trie structure is constructed motivated from Wang et al. (2022b) to limit the candidate tokens during each token prediction, such that the predicted result is guaranteed to be within the vocabulary. "
472
+ ],
473
+ "table_footnote": [],
474
+ "table_body": "<table><tr><td></td><td colspan=\"3\">Zero-shot</td><td colspan=\"3\">1-shot per class</td><td colspan=\"3\"> 5-shot per class</td></tr><tr><td> Accuracy type</td><td>equal</td><td>in</td><td>voc-prior</td><td>equal</td><td>in</td><td>voc-prior</td><td>equal</td><td>in</td><td>voc-prior</td></tr><tr><td>Flamingo</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>71.7</td><td>1</td><td>1</td><td>77.3</td></tr><tr><td>GIT</td><td>1.93</td><td>40.88</td><td>33.48</td><td>64.54</td><td>66.76</td><td>72.45</td><td>79.79</td><td>80.15</td><td>80.95</td></tr></table>",
475
+ "page_idx": 9
476
+ },
477
+ {
478
+ "type": "text",
479
+ "text": "",
480
+ "page_idx": 9
481
+ },
482
+ {
483
+ "type": "text",
484
+ "text": "4.6 Analysis ",
485
+ "text_level": 1,
486
+ "page_idx": 9
487
+ },
488
+ {
489
+ "type": "text",
490
+ "text": "Model and data scaling. To study the trending with data scales, we construct two smaller pre-training datasets: one is the combination of COCO, SBU, CC3M and VG, leading to 4M images or 10M image-text pairs; the other is to further combine CC12M, leading to about 14M images or 20M image-text pairs. When pre-training on small-scale datasets, we use 30 epochs rather than 2 epochs as on the 0.8B data. For the network structure, we name our model as Huge and replace the image encoder with ViT-B/16 and ViT-L/14 from CLIP Radford et al. (2021) as Base and Large, respectively. Fig. 4 shows the results on COCO, TextCaps, and VizWiz-QA. On COCO, the base model benefits from 4M to 14M, but the performance drops with 0.8B data. The 14M data are more similar to COCO than the majority of the noisy 0.8B data. Meanwhile, the Base model with limited capacity may not be able to benefit effectively from large-scale data. Similar observations are also reported in Kolesnikov et al. (2020) for ImageNet-1k classification. On TextCaps and VizWiz-QA, all model variants benefit significantly from more pre-training data. Also, a larger backbone improves more especially with 0.8B data. ",
491
+ "page_idx": 9
492
+ },
493
+ {
494
+ "type": "image",
495
+ "img_path": "images/1fbaab473d9f92267b49db225b92fac338b21a03ef1819e8802c92d986a4f17f.jpg",
496
+ "image_caption": [
497
+ "Figure 4: Performance with different pre-training data scales and different model sizes. "
498
+ ],
499
+ "image_footnote": [],
500
+ "page_idx": 10
501
+ },
502
+ {
503
+ "type": "table",
504
+ "img_path": "images/7e8a9d4de3e1c266141bdb8a2277a32cebc7d2edbcf4bd8d38985e8feef9cd42.jpg",
505
+ "table_caption": [
506
+ "Table 10: Ablation study of larger text decoders. The models are pre-trained on a subset of 0.4B image-text pairs. No beam search and no SCST are performed. "
507
+ ],
508
+ "table_footnote": [],
509
+ "table_body": "<table><tr><td rowspan=\"2\">Layers</td><td colspan=\"4\">CoCo</td><td colspan=\"2\">nocaps</td></tr><tr><td>B@4</td><td>M</td><td>C</td><td>S</td><td>C</td><td>S</td></tr><tr><td>6</td><td>38.9</td><td>30.7</td><td>136.4</td><td>24.6</td><td>119.3</td><td>15.9</td></tr><tr><td>12</td><td>38.9</td><td>30.6</td><td>136.0</td><td>24.2</td><td>118.1</td><td>15.5</td></tr><tr><td>24</td><td>39.1</td><td>30.2</td><td>134.6</td><td>23.8</td><td>115.4</td><td>15.1</td></tr></table>",
510
+ "page_idx": 10
511
+ },
512
+ {
513
+ "type": "text",
514
+ "text": "Here, we scale the image encoder. Empirically, we find it is difficult to effectively scale up the text decoder. Preliminary results are shown in Table 10, which shows a larger decoder shows no improvement. The reason might be that it is difficult to effectively train with limited amount of text by LM. Another plausible reason is that the image encoder is responsible for object recognition, and the decoder is responsible for organizing the object terms in a natural language way. The latter task might be easy since most of the descriptions follow similar patterns, e.g. object $^ +$ verb $^ +$ subject, and thus a small decoder is enough during end-to-end training. Larger decoders increase the learning difficulty, which might degrade the performance. ",
515
+ "page_idx": 10
516
+ },
517
+ {
518
+ "type": "text",
519
+ "text": "Flamingo (Alayrac et al., 2022) shows a larger decoder improves the performance. However, their decoder is pre-trained and frozen during the VL pre-training, which avoids the problem of how to effectively train the decoder. In LEMON (Hu et al., 2021a), the transformer can be scaled up to 32 layers. The reason could be that LEMON uses MLM, instead of LM, which might be more difficult to train. ",
520
+ "page_idx": 10
521
+ },
522
+ {
523
+ "type": "text",
524
+ "text": "Scene text in pre-training data. To understand the capability of scene text comprehension, we examine the pre-training dataset and study how many image-text pairs contain the scene text. We first run the Microsoft Azure OCR API $^ 4$ against all images in CC12M and 500K images in the web crawled images. The OCR result is compared with the associated text. It is considered matched only if the text contains an OCR result that is longer than 5 characters. It is estimated that $1 5 \\%$ of CC12M and $3 1 \\%$ of the downloaded images contain scene text descriptions. As the training task is to predict the texts, the network gradually learns to read the scene text. ",
525
+ "page_idx": 10
526
+ },
527
+ {
528
+ "type": "text",
529
+ "text": "5 Conclusion ",
530
+ "text_level": 1,
531
+ "page_idx": 10
532
+ },
533
+ {
534
+ "type": "text",
535
+ "text": "In the paper, we design and train a simple generative model, named GIT, to map the input image to the associated text description on large-scale image-text pairs. On image/video captioning and question answering tasks, our model achieves new state-of-the-art performance across numerous benchmarks and surpasses the human performance on TextCaps for the first time. For the image classification, we apply the generation task to predict the label name directly. The strategy is different from the existing work with a pre-defined and fixed vocabulary, and is beneficial especially when new category data are added. ",
536
+ "page_idx": 10
537
+ },
538
+ {
539
+ "type": "text",
540
+ "text": "Limitations. We focus on the pretraining-and-finetuning strategy to improve the absolute performance. Empirically, we find it is unclear on how to control the generated caption and how to perform in-context learning without parameter update, which we leave as future work. ",
541
+ "page_idx": 11
542
+ },
543
+ {
544
+ "type": "text",
545
+ "text": "Societal impact. Compared with the existing work, our model clearly improves the performance and be more appropriate to help visually-impaired people. The model is pre-trained on large-scale data, and the data are not guaranteed to contain no toxic language, which may poison the output. Although we observe few such instances qualitatively, special care should be taken to deploy the model in practice and more research exploration is required to control the output. ",
546
+ "page_idx": 11
547
+ },
548
+ {
549
+ "type": "text",
550
+ "text": "References ",
551
+ "text_level": 1,
552
+ "page_idx": 11
553
+ },
554
+ {
555
+ "type": "text",
556
+ "text": "Nayyer Aafaq, Naveed Akhtar, Wei Liu, Syed Zulqarnain Gilani, and Ajmal Mian. Spatio-temporal dynamics and semantic attribute enriched visual encoding for video captioning. In CVPR, 2019. \nHarsh Agrawal, Karan Desai, Yufei Wang, Xinlei Chen, Rishabh Jain, Mark Johnson, Dhruv Batra, Devi Parikh, Stefan Lee, and Peter Anderson. nocaps: novel object captioning at scale. In ICCV, 2019. \nJean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katie Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. arXiv preprint arXiv:2204.14198, 2022. \nPeter Anderson, Xiaodong He, Chris Buehler, Damien Teney, Mark Johnson, Stephen Gould, and Lei Zhang. Bottom-up and top-down attention for image captioning and visual question answering. In CVPR, 2018. \nAli Furkan Biten, Ruben Tito, Andres Mafla, Lluis Gomez, Marçal Rusinol, Ernest Valveny, CV Jawahar, and Dimosthenis Karatzas. Scene text visual question answering. In ICCV, 2019. \nAli Furkan Biten, Ron Litman, Yusheng Xie, Srikar Appalaraju, and R Manmatha. Latr: Layout-aware transformer for scene-text vqa. In CVPR, 2022. \nTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020. \nSoravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual 12M: Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In CVPR, 2021. \nDavid Chen and William Dolan. Collecting highly parallel data for paraphrase evaluation. In ACL, 2011. \nShaoxiang Chen and Yu-Gang Jiang. Motion guided spatial attention for video captioning. In AAAI, 2019. \nShaoxiang Chen, Wenhao Jiang, Wei Liu, and Yu-Gang Jiang. Learning modality interaction for temporal sentence localization and event captioning in videos. In ECCV, 2020a. \nYangyu Chen, Shuhui Wang, Weigang Zhang, and Qingming Huang. Less is more: Picking informative frames for video captioning. In ECCV, 2018. \nYen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. UNITER: universal image-text representation learning. In ECCV, 2020b. \nJaemin Cho, Jie Lei, Hao Tan, and Mohit Bansal. Unifying vision-and-language tasks via text generation. In ICML, 2021. \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. ",
557
+ "page_idx": 11
558
+ },
559
+ {
560
+ "type": "text",
561
+ "text": "Marcella Cornia, Lorenzo Baraldi, Giuseppe Fiameni, and Rita Cucchiara. Universal captioner: Long-tail vision-and-language model training through content-style separation. arXiv preprint arXiv:2111.12727, 2021. ",
562
+ "page_idx": 12
563
+ },
564
+ {
565
+ "type": "text",
566
+ "text": "Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021. \nZi-Yi Dou, Yichong Xu, Zhe Gan, Jianfeng Wang, Shuohang Wang, Lijuan Wang, Chenguang Zhu, Pengchuan Zhang, Lu Yuan, Nanyun Peng, Zicheng Liu, and Michael Zeng. An empirical study of training end-to-end vision-and-language transformers. arXiv preprint arXiv: 2111.02387, 2021. \nShancheng Fang, Hongtao Xie, Yuxin Wang, Zhendong Mao, and Yongdong Zhang. Read like humans: autonomous, bidirectional and iterative language modeling for scene text recognition. In CVPR, 2021a. \nZhiyuan Fang, Jianfeng Wang, Xiaowei Hu, Lin Liang, Zhe Gan, Lijuan Wang, Yezhou Yang, and Zicheng Liu. Injecting semantic concepts into end-to-end image captioning. arXiv preprint arXiv:2112.05230, 2021b. \nZhiyuan Fang, Jianfeng Wang, Xiaowei Hu, Lijuan Wang, Yezhou Yang, and Zicheng Liu. Compressing visual-linguistic model via knowledge distillation. In ICCV, 2021c. \nTsu-Jui Fu, Linjie Li, Zhe Gan, Kevin Lin, William Yang Wang, Lijuan Wang, and Zicheng Liu. VIOLET : Endto-end video-language transformers with masked visual-token modeling. arXiv preprint arXiv:2111.12681, 2021. \nZhe Gan, Yen-Chun Chen, Linjie Li, Chen Zhu, Yu Cheng, and Jingjing Liu. Large-scale adversarial training for vision-and-language representation learning. In NeurIPS, 2020. \nChenyu Gao, Qi Zhu, Peng Wang, Hui Li, Yuliang Liu, Anton van den Hengel, and Qi Wu. Structured multimodal attentions for textvqa. arXiv preprint arXiv:2006.00753, 2020. \nXuchao Gong, Hongji Zhu, Yongliang Wang, Biaolong Chen, Aixi Zhang, Fangxun Shu, and Si Liu. Multiple transformer mining for vizwiz image caption. In 2021 VizWiz Grand Challenge Workshop, 2021. \nYash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the V in VQA matter: Elevating the role of image understanding in visual question answering. In CVPR, 2017. \nAlex Graves, Santiago Fernández, Faustino Gomez, and Jürgen Schmidhuber. Connectionist temporal classification: labelling unsegmented sequence data with recurrent neural networks. In ICML, 2006. \nAnkush Gupta, Andrea Vedaldi, and Andrew Zisserman. Synthetic data for text localisation in natural images. In CVPR, pp. 2315–2324, 2016. \nDanna Gurari, Qing Li, Abigale J. Stangl, Anhong Guo, Chi Lin, Kristen Grauman, Jiebo Luo, and Jeffrey P. Bigham. Vizwiz grand challenge: Answering visual questions from blind people. In CVPR, 2018. \nDanna Gurari, Yinan Zhao, Meng Zhang, and Nilavra Bhattacharya. Captioning images taken by people who are blind. arXiv preprint arXiv:2002.08565, 2020. \nWei Han, Hantao Huang, and Tao Han. Finding the evidence: Localization-aware answer prediction for text visual question answering. In COLING, 2020. \nYue He, Chen Chen, Jing Zhang, Juhua Liu, Fengxiang He, Chaoyue Wang, and Bo Du. Visual semantics allow for textual reasoning better in scene text recognition. In AAAI, 2022. \nJingyi Hou, Xinxiao Wu, Wentian Zhao, Jiebo Luo, and Yunde Jia. Joint syntax representation learning and visual cue translation for video captioning. In ICCV, 2019. \nRonghang Hu, Amanpreet Singh, Trevor Darrell, and Marcus Rohrbach. Iterative answer prediction with pointer-augmented multimodal transformers for textvqa. In CVPR, 2020. \nXiaowei Hu, Zhe Gan, Jianfeng Wang, Zhengyuan Yang, Zicheng Liu, Yumao Lu, and Lijuan Wang. Scaling up vision-language pre-training for image captioning. arXiv preprint arXiv:2111.12233, 2021a. \nXiaowei Hu, Xi Yin, Kevin Lin, Lijuan Wang, Lei Zhang, Jianfeng Gao, and Zicheng Liu. VIVO: surpassing human performance in novel object captioning with visual vocabulary pre-training. In AAAI, 2021b. \nLun Huang, Wenmin Wang, Jie Chen, and Xiao-Yong Wei. Attention on attention for image captioning. In ICCV, 2019. \nZhicheng Huang, Zhaoyang Zeng, Bei Liu, Dongmei Fu, and Jianlong Fu. Pixel-bert: Aligning image pixels with text by deep multi-modal transformers. arXiv preprint arXiv:2004.00849, 2020. \nDrew A. Hudson and Christopher D. Manning. GQA: A new dataset for real-world visual reasoning and compositional question answering. In CVPR, 2019. \nMax Jaderberg, Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Synthetic data and artificial neural networks for natural scene text recognition. arXiv preprint arXiv:1406.2227, 2014. \nMax Jaderberg, Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Reading text in the wild with convolutional neural networks. IJCV, 2016. \nYunseok Jang, Yale Song, Youngjae Yu, Youngjin Kim, and Gunhee Kim. TGIF-QA: toward spatio-temporal reasoning in visual question answering. In CVPR, 2017. \nChao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V. Le, Yun-Hsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In ICML, 2021. \nJianwen Jiang, Ziqiang Chen, Haojie Lin, Xibin Zhao, and Yue Gao. Divide and conquer: Question-guided spatio-temporal contextual attention for video question answering. In AAAI, 2020. \nYash Kant, Dhruv Batra, Peter Anderson, Alexander G. Schwing, Devi Parikh, Jiasen Lu, and Harsh Agrawal. Spatially aware multimodal transformers for textvqa. In ECCV, 2020. \nDimosthenis Karatzas, Faisal Shafait, Seiichi Uchida, Masakazu Iwamura, Lluis Gomez i Bigorda, Sergi Robles Mestre, Joan Mas, David Fernandez Mota, Jon Almazan Almazan, and Lluis Pere De Las Heras. Icdar 2013 robust reading competition. In ICDAR, 2013. \nDimosthenis Karatzas, Lluis Gomez-Bigorda, Anguelos Nicolaou, Suman Ghosh, Andrew Bagdanov, Masakazu Iwamura, Jiri Matas, Lukas Neumann, Vijay Ramaseshan Chandrasekhar, Shijian Lu, et al. Icdar 2015 competition on robust reading. In ICDAR, 2015. \nAndrej Karpathy and Fei-Fei Li. Deep visual-semantic alignments for generating image descriptions. In CVPR, 2015. \nWonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision. In ICML, 2021. \nAlexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In ECCV, 2020. \nRanjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A. Shamma, Michael S. Bernstein, and Fei-Fei Li. Visual genome: Connecting language and vision using crowdsourced dense image annotations. arXiv preprint arXiv:1602.07332, 2016. \nThao Minh Le, Vuong Le, Svetha Venkatesh, and Truyen Tran. Hierarchical conditional relation networks for multimodal video question answering. IJCV, 2021. \nJie Lei, Licheng Yu, Tamara L Berg, and Mohit Bansal. Tvr: A large-scale dataset for video-subtitle moment retrieval. In ECCV, 2020. ",
567
+ "page_idx": 12
568
+ },
569
+ {
570
+ "type": "text",
571
+ "text": "",
572
+ "page_idx": 13
573
+ },
574
+ {
575
+ "type": "text",
576
+ "text": "Jie Lei, Linjie Li, Luowei Zhou, Zhe Gan, Tamara L. Berg, Mohit Bansal, and Jingjing Liu. Less is more: Clipbert for video-and-language learning via sparse sampling. In CVPR, 2021. ",
577
+ "page_idx": 14
578
+ },
579
+ {
580
+ "type": "text",
581
+ "text": "Chenliang Li, Haiyang Xu, Junfeng Tian, Wei Wang, Ming Yan, Bin Bi, Jiabo Ye, Hehong Chen, Guohai Xu, Zheng Cao, et al. mplug: Effective and efficient vision-language learning by cross-modal skip-connections. arXiv preprint arXiv:2205.12005, 2022a. \nJunnan Li, Ramprasaath R Selvaraju, Akhilesh Deepak Gotmare, Shafiq Joty, Caiming Xiong, and Steven Hoi. Align before fuse: Vision and language representation learning with momentum distillation. In NeurIPS, 2021a. \nJunnan Li, Dongxu Li, Caiming Xiong, and Steven C. H. Hoi. BLIP: bootstrapping language-image pretraining for unified vision-language understanding and generation. arXiv preprint arXiv:2201.12086, 2022b. \nLinjie Li, Jie Lei, Zhe Gan, Licheng Yu, Yen-Chun Chen, Rohit Pillai, Yu Cheng, Luowei Zhou, Xin Eric Wang, William Yang Wang, et al. Value: A multi-task benchmark for video-and-language understanding evaluation. In NeurIPS, 2021b. \nWei Li, Can Gao, Guocheng Niu, Xinyan Xiao, Hao Liu, Jiachen Liu, Hua Wu, and Haifeng Wang. Unimo: Towards unified-modal understanding and generation via cross-modal contrastive learning. In ACL, 2021c. \nXiujun Li, Xi Yin, Chunyuan Li, Pengchuan Zhang, Xiaowei Hu, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, Yejin Choi, and Jianfeng Gao. Oscar: Object-semantics aligned pre-training for vision-language tasks. In ECCV, 2020. \nMinghui Liao, Pengyuan Lyu, Minghang He, Cong Yao, Wenhao Wu, and Xiang Bai. Mask textspotter: An end-to-end trainable neural network for spotting text with arbitrary shapes. PAMI, 2019. \nKevin Lin, Linjie Li, Chung-Ching Lin, Faisal Ahmed, Zhe Gan, Zicheng Liu, Yumao Lu, and Lijuan Wang. Swinbert: End-to-end transformers with sparse attention for video captioning. arXiv preprint arXiv:2111.13196, 2021. \nTsung-Yi Lin, Michael Maire, Serge J. Belongie, Lubomir D. Bourdev, Ross B. Girshick, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C. Lawrence Zitnick. Microsoft COCO: common objects in context. arXiv preprint arXiv:1405.0312, 2014. \nFen Liu, Guanghui Xu, Qi Wu, Qing Du, Wei Jia, and Mingkui Tan. Cascade reasoning network for text-based visual question answering. In Chang Wen Chen, Rita Cucchiara, Xian-Sheng Hua, Guo-Jun Qi, Elisa Ricci, Zhengyou Zhang, and Roger Zimmermann (eds.), ACM MM, 2020a. \nSheng Liu, Zhou Ren, and Junsong Yuan. Sibnet: Sibling convolutional encoder for video captioning. IEEE TPAMI, 2020b. \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. \nYu Liu, Lianghua Huang, Liuyihang Song, Bin Wang, Yingya Zhang, and Pan Pan. Enhancing textual cues in multi-modal transformers for vqa. In 2021 VizWiz Grand Challenge Workshop, 2021. \nJiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. In NeurIPS, 2019. \nPengyuan Lyu, Chengquan Zhang, Shanshan Liu, Meina Qiao, Yangliu Xu, Liang Wu, Kun Yao, Junyu Han, Errui Ding, and Jingdong Wang. Maskocr: Text recognition with masked encoder-decoder pretraining. arXiv preprint arXiv:2206.00311, 2022. \nKenneth Marino, Mohammad Rastegari, Ali Farhadi, and Roozbeh Mottaghi. Ok-vqa: A visual question ",
582
+ "page_idx": 14
583
+ },
584
+ {
585
+ "type": "text",
586
+ "text": "answering benchmark requiring external knowledge. In CVPR, 2019. ",
587
+ "page_idx": 14
588
+ },
589
+ {
590
+ "type": "text",
591
+ "text": "Anand Mishra, Karteek Alahari, and CV Jawahar. Scene text recognition using higher order language priors. In BMVC, 2012. \nAnand Mishra, Shashank Shekhar, Ajeet Kumar Singh, and Anirban Chakraborty. Ocr-vqa: Visual question answering by reading text in images. In ICDAR, 2019. \nVicente Ordonez, Girish Kulkarni, and Tamara L. Berg. Im2text: Describing images using 1 million captioned photographs. In NeurIPS, 2011. \nBoxiao Pan, Haoye Cai, De-An Huang, Kuan-Hui Lee, Adrien Gaidon, Ehsan Adeli, and Juan Carlos Niebles. Spatio-temporal graph for video captioning with knowledge distillation. In CVPR, 2020. \nMandela Patrick, Po-Yao Huang, Yuki Asano, Florian Metze, Alexander Hauptmann, Joao Henriques, and Andrea Vedaldi. Support-set bottlenecks for video-text representation learning. In ICLR, 2021. \nTrung Quy Phan, Palaiahnakote Shivakumara, Shangxuan Tian, and Chew Lim Tan. Recognizing text with perspective distortion in natural scenes. In ICCV, 2013. \nYixuan Qiao, Hao Chen, Jun Wang, Yihao Chen, Xianbin Ye, Ziliang Li, Xianbiao Qi, Peng Gao, and Guotong Xie. Winner team mia at textvqa challenge 2021: Vision-and-language representation learning with pre-trained sequence-to-sequence model. arXiv preprint arXiv:2106.15332, 2021. \nAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In ICML, 2021. \nColin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 2020. \nAnhar Risnumawan, Palaiahankote Shivakumara, Chee Seng Chan, and Chew Lim Tan. A robust arbitrary text detection system for natural scene images. Expert Systems with Applications, 2014. \nPaul Hongsuck Seo, Arsha Nagrani, and Cordelia Schmid. Look before you speak: Visually contextualized utterances. In CVPR, 2021. \nPaul Hongsuck Seo, Arsha Nagrani, Anurag Arnab, and Cordelia Schmid. End-to-end generative pretraining for multimodal video captioning. arXiv preprint arXiv:2201.08264, 2022. \nPiyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In ACL, 2018. \nSheng Shen, Liunian Harold Li, Hao Tan, Mohit Bansal, Anna Rohrbach, Kai-Wei Chang, Zhewei Yao, and Kurt Keutzer. How much can CLIP benefit vision-and-language tasks? arXiv preprint arXiv:2107.06383, 2021. \nOleksii Sidorov, Ronghang Hu, Marcus Rohrbach, and Amanpreet Singh. Textcaps: a dataset for image captioning with reading comprehension. In ECCV, 2020. \nAmanpreet Singh, Vivek Natarajan, Meet Shah, Yu Jiang, Xinlei Chen, Dhruv Batra, Devi Parikh, and Marcus Rohrbach. Towards vqa models that can read. In CVPR, 2019. \nHao Tan and Mohit Bansal. LXMERT: learning cross-modality encoder representations from transformers. In EMNLP, 2019. \nMingkang Tang, Zhanyu Wang, Zhaoyang Zeng, Fengyun Rao, and Dian Li. Clip4caption $^ { + + }$ : Multi-clip for video caption. arXiv preprint arXiv:2110.05204, 2021. \nRamakrishna Vedantam, C. Lawrence Zitnick, and Devi Parikh. Cider: Consensus-based image description evaluation. In CVPR, 2015. \nSubhashini Venugopalan, Huijuan Xu, Jeff Donahue, Marcus Rohrbach, Raymond J. Mooney, and Kate Saenko. Translating videos to natural language using deep recurrent neural networks. arXiv preprint arXiv:1412.4729, 2014. \nAlex Jinpeng Wang, Yixiao Ge, Rui Yan, Yuying Ge, Xudong Lin, Guanyu Cai, Jianping Wu, Ying Shan, Xiaohu Qie, and Mike Zheng Shou. All in one: Exploring unified video-language pre-training. arXiv preprint arXiv:2203.07303, 2022a. \nBairui Wang, Lin Ma, Wei Zhang, Wenhao Jiang, Jingwen Wang, and Wei Liu. Controllable video captioning with pos sequence guidance based on gated fusion network. In ICCV, 2019a. \nJianfeng Wang, Xiaowei Hu, Pengchuan Zhang, Xiujun Li, Lijuan Wang, Lei Zhang, Jianfeng Gao, and Zicheng Liu. Minivlm: A smaller and faster vision-language model. arXiv preprint arXiv:2012.06946, 2020. \nJianfeng Wang, Xiaowei Hu, Zhe Gan, Zhengyuan Yang, Xiyang Dai, Zicheng Liu, Yumao Lu, and Lijuan Wang. UFO: A unified transformer for vision-language representation learning. arXiv preprint arXiv:2111.10023, 2021a. \nKai Wang, Boris Babenko, and Serge Belongie. End-to-end scene text recognition. In ICCV, 2011. \nPeng Wang, An Yang, Rui Men, Junyang Lin, Shuai Bai, Zhikang Li, Jianxin Ma, Chang Zhou, Jingren Zhou, and Hongxia Yang. Unifying architectures, tasks, and modalities through a simple sequence-to-sequence learning framework. arXiv preprint arXiv:2202.03052, 2022b. \nXin Wang, Jiawei Wu, Junkun Chen, Lei Li, Yuan-Fang Wang, and William Yang Wang. Vatex: A large-scale, high-quality multilingual dataset for video-and-language research. In ICCV, 2019b. \nZirui Wang, Jiahui Yu, Adams Wei Yu, Zihang Dai, Yulia Tsvetkov, and Yuan Cao. Simvlm: Simple visual language model pretraining with weak supervision. arXiv preprint arXiv:2108.10904, 2021b. \nYonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Lukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Greg Corrado, Macduff Hughes, and Jeffrey Dean. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016. \nDejing Xu, Zhou Zhao, Jun Xiao, Fei Wu, Hanwang Zhang, Xiangnan He, and Yueting Zhuang. Video question answering via gradually refined attention over appearance and motion. In ACM Multimedia, 2017. \nGuanghui Xu, Shuaicheng Niu, Mingkui Tan, Yucheng Luo, Qing Du, and Qi Wu. Towards accurate text-based image captioning with content diversity exploration. In CVPR, 2021. \nJun Xu, Tao Mei, Ting Yao, and Yong Rui. Msr-vtt: A large video description dataset for bridging video and language. In CVPR, 2016. \nHongwei Xue, Yupan Huang, Bei Liu, Houwen Peng, Jianlong Fu, Houqiang Li, and Jiebo Luo. Probing inter-modality: Visual parsing with self-attention for vision-language pre-training. In NeurIPS, 2021. \nAntoine Yang, Antoine Miech, Josef Sivic, Ivan Laptev, and Cordelia Schmid. Just ask: Learning to answer questions from millions of narrated videos. In ICCV, 2021a. \nZhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Faisal Ahmed, Zicheng Liu, Yumao Lu, and Lijuan Wang. Crossing the format boundary of text and boxes: Towards unified vision-language modeling. arXiv preprint arXiv:2111.12085, 2021b. \nZhengyuan Yang, Yijuan Lu, Jianfeng Wang, Xi Yin, Dinei A. F. Florêncio, Lijuan Wang, Cha Zhang, Lei Zhang, and Jiebo Luo. TAP: text-aware pre-training for text-vqa and text-caption. In CVPR, 2021c. \nZhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Yumao Lu, Zicheng Liu, and Lijuan Wang. An empirical study of gpt-3 for few-shot knowledge-based vqa. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pp. 3081–3089, 2022. \nPeter Young, Alice Lai, Micah Hodosh, and Julia Hockenmaier. From image descriptions to visual denotations: New similarity metrics for semantic inference over event descriptions. Transactions of the Association for Computational Linguistics, 2014. \nDeli Yu, Xuan Li, Chengquan Zhang, Tao Liu, Junyu Han, Jingtuo Liu, and Errui Ding. Towards accurate scene text recognition with semantic reasoning networks. In CVPR, 2020. \nJiahui Yu, Zirui Wang, Vijay Vasudevan, Legg Yeung, Mojtaba Seyedhosseini, and Yonghui Wu. Coca: Contrastive captioners are image-text foundation models. arXiv preprint arXiv:2205.01917, 2022. \nLu Yuan, Dongdong Chen, Yi-Ling Chen, Noel Codella, Xiyang Dai, Jianfeng Gao, Houdong Hu, Xuedong Huang, Boxin Li, Chunyuan Li, Ce Liu, Mengchen Liu, Zicheng Liu, Yumao Lu, Yu Shi, Lijuan Wang, Jianfeng Wang, Bin Xiao, Zhen Xiao, Jianwei Yang, Michael Zeng, Luowei Zhou, and Pengchuan Zhang. Florence: A new foundation model for computer vision. arXiv preprint arXiv:2111.11432, 2021. \nXiaoyu Yue, Zhanghui Kuang, Chenhao Lin, Hongbin Sun, and Wayne Zhang. Robustscanner: Dynamically enhancing positional clues for robust text recognition. In ECCV, 2020. \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 NeurIPS, 2021. \nJunchao Zhang and Yuxin Peng. Object-aware aggregation with bidirectional temporal graph for video captioning. In CVPR, 2019. \nPengchuan Zhang, Xiujun Li, Xiaowei Hu, Jianwei Yang, Lei Zhang, Lijuan Wang, Yejin Choi, and Jianfeng Gao. Vinvl: Making visual representations matter in vision-language models. In CVPR, 2021a. \nZiqi Zhang, Yaya Shi, Chunfeng Yuan, Bing Li, Peijin Wang, Weiming Hu, and Zheng-Jun Zha. Object relational graph with teacher-recommended learning for video captioning. In CVPR, 2020. \nZiqi Zhang, Zhongang Qi, Chunfeng Yuan, Ying Shan, Bing Li, Ying Deng, and Weiming Hu. Open-book video captioning with retrieve-copy-generate network. In CVPR, 2021b. \nQi Zheng, Chaoyue Wang, and Dacheng Tao. Syntax-aware action targeting for video captioning. In CVPR, 2020. \nLuowei Zhou, Chenliang Xu, and Jason J Corso. Towards automatic learning of procedures from web instructional videos. In AAAI, 2018. \nLuowei Zhou, Hamid Palangi, Lei Zhang, Houdong Hu, Jason J. Corso, and Jianfeng Gao. Unified visionlanguage pre-training for image captioning and VQA. In AAAI, 2020. ",
592
+ "page_idx": 15
593
+ },
594
+ {
595
+ "type": "text",
596
+ "text": "",
597
+ "page_idx": 16
598
+ },
599
+ {
600
+ "type": "text",
601
+ "text": "",
602
+ "page_idx": 17
603
+ }
604
+ ]
parse/test/b4tMhpN0JC/b4tMhpN0JC_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/b4tMhpN0JC/b4tMhpN0JC_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/hUgBU9wgSf/hUgBU9wgSf.md ADDED
@@ -0,0 +1,628 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A Kernel Two-sample Test for Dynamical Systems
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # Abstract
6
+
7
+ Evaluating whether data streams are drawn from the same distribution is at the heart of various machine learning problems. This is particularly relevant for data generated by dynamical systems since such systems are essential for many real-world processes in biomedical, economic, or engineering systems. While kernel two-sample tests are powerful for comparing independent and identically distributed random variables, no established method exists for comparing dynamical systems. The main problem is the inherently violated independence assumption. We propose a two-sample test for dynamical systems by addressing three core challenges: we (i) introduce a novel notion of mixing that captures autocorrelations in a relevant metric, (ii) propose an efficient way to estimate the speed of mixing relying purely on data, and (iii) integrate these into established kernel two-sample tests. The result is a data-driven method that is straightforward to use in practice and comes with sound theoretical guarantees. In an example application to anomaly detection from human walking data, we show that the test is readily applicable without any human expert knowledge and feature engineering.
8
+
9
+ # 1 Introduction
10
+
11
+ We consider the two-sample problem of determining whether two distributions are different. In particular, we generalize the well-established kernel two-sample test (Gretton et al., 2012a) to dynamical systems and stochastic processes with certain mixing properties, which we make precise in this paper.
12
+
13
+ The kernel two-sample test approximates a metric on the space of probability distributions, the maximum mean discrepancy (MMD), through kernel-based techniques. Due to its powerful theoretical properties and versatile applicability, kernel two-sample testing is a prominent method in the machine learning community (Long et al., 2017; Tolstikhin et al., 2018; Muandet et al., 2017; Schölkopf & Smola, 2001). While we can exploit parts of existing kernel-based results, and especially their theoretical guarantees, the extension to comparing dynamical systems is not straightforward. This is mainly because kernel two-sample testing was initially developed for independent and identically distributed (i.i.d.) random variables (Gretton et al., 2012a). The i.i.d. assumption in the test is critical, but it is violated by the very nature of dynamical systems: through the dynamics, samples are coupled to past samples. To address this issue, we introduce a novel notion of mixing that considers the dependence of data through time with respect to the MMD. Intuitively, mixing reveals how fast autocorrelations decay and, thus, how long we need to wait in-between samples for data to be (approximately) independent. Our new mixing notion can be efficiently estimated from data and is particularly synergistic with kernel two-sample tests since both measure distances of probability distributions with respect to the same metric—the MMD. By estimating the decay of dependency and embedding it into well-established algorithms, we obtain a powerful test for comparing dynamical systems.
14
+
15
+ Mathematical literature often distinguishes explicitly between deterministic dynamical systems and stochastic processes. In particular, establishing mixing properties for deterministic dynamical systems is an extremely challenging problem and constructing examples that are provably mixing is hard. Further, common mixing properties that are used for stochastic systems are too restrictive and not applicable to deterministic systems (Hang et al., 2017). We propose mixing in MMD, which is applicable to both classes of problems— stochastic and deterministic systems. Further, we show that mixing in MMD is even less restrictive than certain deterministic mixing types ( $\boldsymbol { \mathscr { C } }$ -mixing Hang et al. (2018)). For suitable choices of kernels and function spaces $\boldsymbol { \mathscr { C } }$ , we can show that $\boldsymbol { \mathscr { C } }$ -mixing implies MMD-mixing. Based on standard examples with well-established $\boldsymbol { \mathscr { C } }$ -mixing properties (the $\beta$ -map, logistic map, and Gauss map), we demonstrate empirically that they are indeed mixing in MMD. Additionally, we also consider mixing properties of chaotic and stochastic systems and further, also raw sensor data from human walking experiments.
16
+
17
+ Despite their practical relevance, there is no established data-driven way of comparing dynamical systems. For biomedical systems such as the human cardiovascular system, central nervous system, or musculoskeletal system, implementing a principled comparison of systems based on their output sequences in different time intervals can help to detect diseases or quantify their severity. For example, alterations or unusual patterns in human gait can be indicators for early stages of Parkinson’s disease (Pistacchi et al., 2017). An algorithm that automatically detects such alterations by comparing new data to labeled records could help physicians in their decision-making. Current state-of-the-art solutions rely on manually engineered and selected features and thus require expert knowledge (Nguyen et al., 2019). Similarly, feature-based solutions have been proposed for electro-myography-based detection of spasticity (Misgeld et al., 2015; Lueken et al., 2015). But clearly, the success of such approaches critically depends on the expressiveness of these features and on how well the problem is understood.
18
+
19
+ Modern engineering applications are another prominent and relevant example. They often leverage computer simulations instead of directly interacting with the physical plant since real experiments are more expensive, time-consuming, and cause wear on the hardware. Besides, being able to predict the response of a physical plant based on a mathematical model enables powerful learning algorithms (Hwangbo et al., 2019), modelpredictive control (Qin & Badgwell, 2003), and digital twins in future manufacturing (Jeschke et al., 2017). The success of these methods, however, is critically intertwined with the model accuracy. Thus, it is essential to ensure accurate models, for example, by comparing data generated from the simulation model with data collected from the real system.
20
+
21
+ By combining mixing properties with kernel-based techniques, we obtain a powerful statistical test for comparing dynamical systems. We demonstrate the efficiency and robustness of the proposed test numerically and on experimental data. In particular, we consider human walking experiments and analyze raw data from an inertial measurement unit (IMU) to detect anomalies in the walking pattern. Without the need for human expert knowledge or fitting model parameters, our test outperforms standard baselines in deciding which of the trajectories were generated with an attached knee orthosis, which restricts the movement of the joint.
22
+
23
+ Contributions: We propose a kernel two-sample test for dynamical systems. By developing a new notion of mixing that can be estimated from data, we generalize powerful theoretical guarantees from the i.i.d. setting to certain dynamical systems. The derived method is straightforward to use, and well-established implementations of the kernel two-sample test can be leveraged. We demonstrate the robustness and efficiency of the method on real-world data, where we achieve better results than standard baselines, without relying on feature engineering or expert knowledge. Code and data will be made available upon publication.
24
+
25
+ # 2 Related Work
26
+
27
+ There is only limited literature that explicitly investigates the question of how to compare dynamical systems. One possibility is the embedding of dynamical systems as infinite-dimensional objects into reproducing kernel Hilbert spaces (RKHS) with specifically designed kernels such as Binet-Cauchy kernels (Vishwanathan et al., 2007) or generalizations thereof as proposed in Ishikawa et al. (2018) and Ishikawa et al. (2019). A similar function-analytical approach is considered in Mezic (2016) and Klus et al. (2020), where the authors consider Koopman and Perron-Frobenius operators to obtain linear dynamics in an infinite-dimensional space. These articles leverage specifically designed kernels and linear operators associated with dynamical systems to obtain an embedding. However, none of the above articles proposes a statistical test that compares dynamical systems. This would require further finite sample and error bounds on the approximations of the infinitedimensional operators, which is non-trivial. Our approach leverages concentration results that synergize well with kernel-based techniques and in particular, kernel mean embeddings.
28
+
29
+ The critical technical issue for dealing with dynamical systems is non-i.i.d. data. There are several extensions of kernel two-sample tests that have been developed (Zaremba et al., 2013; Gretton et al., 2012b; Doran et al., 2014; Lloyd & Ghahramani, 2015; Chwialkowski et al., 2014; Chwialkowski & Gretton, 2014) to make them applicable to a broader range of problems, where non-i.i.d. data is also an issue. However, the strong mixing properties that are typically postulated limit the applicability of the results to dynamical systems. Surprisingly, there is only very limited work that addresses the estimation of mixing coefficients from data, as also acknowledged and emphasized in (McDonald et al., 2011). The approach proposed in (McDonald et al., 2011) is different from our work, as mixing is considered with respect to the total variation norm, which requires the estimation of complex intermediate objects, whereas we estimate mixing properties directly from data. We propose a new mixing notion that synergizes well with kernel two-sample tests and that can also be estimated from data (in contrast to most other mixing notions). A similar idea of mixing in RKHS, has very recently been introduced in (Chérief-Abdellatif & Alquier, 2022). The paper, however, focuses on parameter estimation with respect to minimizing the MMD as a loss function. Further, the precise notion of mixing differs from ours. It is shown that certain types of systems satisfy their notion of mixing, however, that work does not estimate mixing from data. In (Wynne & Duncan, 2022), another recent approach is presented. In essence, the paper investigates whether two samples of functions have the same underlying distribution. Functional data is directly embedded into an RKHS by extending the theory to kernels that live on function spaces. The elegant kernel design might be a useful for extensions of our work, where multiple correlated joint distributions need be compared. Right now, we compare stationary distributions and data is decorrelated via mixing.
30
+
31
+ The problem of comparing dynamical systems is also present in control theory and was, for example, recently studied in Umlauft & Hirche (2019); Solowjow & Trimpe (2020) by considering the question of when to trigger model updates. In robust control, there is the notion of the gap metric (Zhou & Doyle, 1998), which compares the closed-loop behavior of dynamical systems. These approaches are particularly promising to quantify the similarities between dynamical systems when trying to achieve effective transfer learning, as shown in (Sorocky et al., 2020). However, they usually rely on a given model or a certain linear structure in the system. But estimating such models of nonlinear systems can be difficult in practice (Schoukens & Ljung, 2019; Schön et al., 2011; Brunton et al., 2017; Ljung, 2001). Similarly, estimating the stationary measure of a dynamical system is also a highly non-trivial problem (Hang et al., 2018; Luzzatto et al., 2005). In our approach, we do not require any intermediate objects such as the dynamics, density function, or noise models. Instead, we compare stationary distributions of dynamical systems directly from data.
32
+
33
+ # 3 Assumptions and Problem Formulation
34
+
35
+ In the following, we introduce the mathematical objects that we will consider in this paper. Afterward, we make the problem precise.
36
+
37
+ # 3.1 Stationary, Ergodic, and Mixing Systems
38
+
39
+ Let $( \Omega , A , P )$ be a probability space, $S \subset \mathbb { R } ^ { d }$ a compact set, which is the state space of the dynamical system, and $\boldsymbol { B }$ the corresponding Borel $\sigma$ -algebra. We define a stochastic dynamical system or stochastic process as a collection of random variables $\{ X _ { k } \}$ indexed in discrete time $k \in \mathbb N$ and $X _ { k } \colon \Omega \to S$ . Next, we introduce some required properties of the process.
40
+
41
+ Definition 1 (Stationary) A system is stationary if the joint distribution of its states is time-invariant.
42
+
43
+ In addition to stationary behavior, we also require ergodicity. While stationarity ensures time-invariant distributions, ergodicity guarantees that the statistical properties of the system do not differ over multiple realizations. We use a standard definition that goes back to Birkhoff (1931).
44
+
45
+ Definition 2 (Ergodic) Assume the system $\{ X _ { k } \}$ is stationary with distribution $\mathbb { P }$ . We call the system ergodic if for al l $f \in L _ { \mathbb { P } } ^ { 1 } ( S )$ and $\mathbb { P }$ -almost all initial states we have
46
+
47
+ $$
48
+ \operatorname* { l i m } _ { N \to \infty } { \frac { 1 } { N } } \sum _ { k = 0 } ^ { N - 1 } f ( X _ { k } ) = \int _ { S } f ( y ) \mathrm { d } \mathbb { P } ( y ) \quad a . s . .
49
+ $$
50
+
51
+ Equation equation 1 is in some sense a realization of the law of large numbers, and both sides of the equation yield the expected value $\mathbb { E } _ { X \sim \mathbb { P } } [ f ( X ) ]$ . In particular, it allows us to estimate $\mathbb { E } [ X _ { k } ]$ (the distribution is invariant for all $k$ ) from long enough sample paths. Different types of convergence and test functions in eq. equation 1 yield more sophisticated ergodic theorems. Nonetheless, there can still be severe autocorrelations and if $X _ { k }$ is known, this may have a drastic impact on the distribution of $X _ { k + 1 }$ . Thus, we require additional mixing assumptions.
52
+
53
+ Classically, mixing is introduced in terms of dependencies between $\sigma$ -algebras and intuitively, deals with the autocorrelations in the system. Here, we consider a covariance-based approach to mixing, which is more useful and convenient for us since there is a natural connection to Hilbert-Schmidt theory in RKHSs. Both approaches are introduced in Bradley et al. (1987). We begin with a general definition based on (Bradley et al., 1987, eq. (1.2)) and tailor it to our problem afterward.
54
+
55
+ Definition 3 (Measure of Dependence) Assume $\mathcal { F }$ and $\mathcal { G }$ are suitable function spaces. The measure of dependence is defined as
56
+
57
+ $$
58
+ \operatorname* { s u p } _ { f \in \mathcal { F } , g \in \mathcal { G } } \frac { | \mathbb { E } [ f g ] - \mathbb { E } [ f ] \mathbb { E } [ g ] | } { \| f \| _ { p } \| g \| _ { q } } ,
59
+ $$
60
+
61
+ where $p$ and $q$ are Hölder pairs.
62
+
63
+ A possible choice for the function spaces is ${ \mathcal { F } } = { \mathcal { G } } = L ^ { 2 }$ , which is referred to as strong mixing when eq. equation 2 converges to zero and naturally implies ergodicity in $L ^ { 2 }$ when considering $f = g$ . There are various valid choices and many are discussed in (Bradley, 2005; Hang et al., 2017).
64
+
65
+ Here, we propose to consider unit balls in reproducing kernel Hilbert spaces for $\mathcal { F }$ and $\mathcal { G }$ , which has to the best of our knowledge not been done before.
66
+
67
+ Definition 4 (Mixing) Assume $\mathcal { F }$ and $\mathcal { G }$ are unit balls in the same RKHS. We call a system mixing if
68
+
69
+ $$
70
+ \operatorname* { s u p } _ { f \in \mathcal { F } , g \in \mathcal { G } } \operatorname { C o v } ( f ( X _ { t } ) , g ( X _ { t + a } ) ) \to 0 \quad { \mathrm { f o r } } \quad a \to \infty .
71
+ $$
72
+
73
+ Later, we will investigate this property in more detail and leverage powerful estimators in form of the Hilbert-Schmidt independence criterion to determine mixing properties. Estimators for the speed of mixing are usually a critical issue when working with mixing arguments. In related work, the speed and type of mixing is almost exclusively postulated. In contrast, we test if a process is mixing and estimate the actual speed.
74
+
75
+ An important special case that we will investigate in detail are state-space models or Markov chains with continuous state spaces of the type $X _ { k + 1 } = \phi ( X _ { k } ) + \epsilon _ { k }$ , where $\phi$ is an appropriate dynamics function and $\epsilon _ { k }$ the process noise. This system description is highly relevant in systems and control theory and more recently, reinforcement learning. Further, we will also consider chaotic systems, where $\epsilon _ { k } \equiv 0$ . These are deterministic and violate common probabilistic mixing assumptions.
76
+
77
+ # 3.2 Problem Formulation
78
+
79
+ Consider two stationary and mixing (cf. def. 4) systems $\{ X _ { k } \}$ and $\{ Y _ { k } \}$ with stationary distributions $\| \boldsymbol { \underline { p } } _ { X }$ and $\| ^ { p } { \boldsymbol { \gamma } }$ . We want to decide whether $\{ X _ { k } \}$ and $\{ Y _ { k } \}$ are different based on the data streams $X = \{ X _ { 0 } , X _ { 1 } , \ldots , X _ { n } \}$ and $Y = \{ Y _ { 0 } , Y _ { 1 } , \dots , Y _ { n } \}$ . We assume $X _ { k } , Y _ { k } \in S$ and, in general, $X _ { 0 } \neq Y _ { 0 }$ . Further, we assume that the dynamical systems have converged to their stationary distribution.
80
+
81
+ We propose to compare dynamical systems by testing whether their stationary probability measures coincide. Thus, we obtain the null hypothesis
82
+
83
+ $$
84
+ H _ { 0 } : \mathbb { P } _ { X } = \mathbb { P } _ { Y } ,
85
+ $$
86
+
87
+ which we try to reject with high confidence. For our method, it is not necessary to estimate or construct any intermediate objects such as the dynamics function $f$ , nor the measures $\| \boldsymbol { \underline { p } } _ { X }$ and $\| \boldsymbol { \underline { P } } _ { Y }$ .
88
+
89
+ The main challenge lies in coping with the autocorrelations within the data streams. These autocorrelations are critical and void commonly used concentration results, such as the famous Hoeffding’s or McDiarmid’s inequalities.
90
+
91
+ We consider a two-sample setting between two data streams $X$ and $Y$ . However, this can easily be applied to settings where we want to investigate whether a given model coincides with reality. Then, samples obtained through sensor measurements can be compared with samples generated by simulating a given model.
92
+
93
+ # 4 Technical Preliminaries
94
+
95
+ The main idea of this paper can be summarized as generalizing kernel two-sample tests (Gretton et al., 2012a) to dynamical systems through a data-based mixing approach. Essentially, we propose to wait long enough between consecutive samples. Quantifying how long to wait to enforce negligibly small autocorrelations is the core question, which is addressed in sec. 5.2. In the numerical section, we construct linear systems with arbitrary slow mixing properties. We begin by summarizing key results from kernel two-sample tests and kernel mean embeddings.
96
+
97
+ # 4.1 Kernel Two-sample Test
98
+
99
+ An elegant and efficient comparison of probability distributions can be achieved with kernel two-sample tests (Gretton et al., 2012a). The distributions are embedded into an RKHS, where it becomes tractable to compute certain metrics on the space of probability distributions such as the MMD. The following definitions and theorems are taken from Gretton et al. (2012a).
100
+
101
+ Definition 5 (MMD) Let $( S , d )$ be a metric space and let $\| ^ { p } _ { X } , \mathbb { P } _ { Y }$ be two Borel probability measures defined on $S$ . Further, let $\mathcal { F }$ be the unit ball in an RKHS on $S$ . We define the maximum mean discrepancy by
102
+
103
+ $$
104
+ \mathrm { M M D } ^ { 2 } [ \mathbb { P } _ { X } , \mathbb { P } _ { Y } ] = \operatorname* { s u p } _ { g \in \mathcal { F } } ( \mathbb { E } _ { \mathbb { P } _ { X } } [ g ] - \mathbb { E } _ { \mathbb { P } _ { Y } } [ g ] ) ^ { 2 } .
105
+ $$
106
+
107
+ The MMD yields a semi-metric between probability distributions and can be efficiently estimated by embedding the distributions into an RKHS $\mathcal { H }$ with the aid of kernel mean embeddings (Muandet et al., 2017). It is a challenging problem to compute equation 5 directly since $\mathcal { F }$ is usually infinite-dimensional. However, by kernelizing it, we can estimate equation 5 from data.
108
+
109
+ Theorem 1 Assume $k$ is a kernel and $\mathcal { F }$ is again the unit ball in the corresponding RKHS H. Further, assume $( X _ { 1 } , \ldots , X _ { n } )$ and $( Y _ { 1 } , \ldots , Y _ { m } )$ are drawn i.i.d. from $\| \boldsymbol { \underline { p } } _ { X }$ and $\| ^ { D } \boldsymbol { Y }$ , respectively. Then, a biased estimate of equation $\it 5$ is given by
110
+
111
+ $$
112
+ \mathrm { M M D } _ { b } ^ { 2 } [ X , Y ] = \frac { 1 } { n ^ { 2 } } \sum _ { i , j = 1 } ^ { n } k ( X _ { i } , X _ { j } ) + \frac { 1 } { m ^ { 2 } } \sum _ { i , j = 1 } ^ { m } k ( Y _ { i } , Y _ { j } ) - \frac { 2 } { m n } \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m } k ( X _ { i } , Y _ { j } ) .
113
+ $$
114
+
115
+ The additional requirement of a characteristic kernel ensures that the embedding of the probability distribution is injective and, thus, a metric is obtained. The kernel $k$ can, for example, be chosen as a Gaussian kernel since it is well known to be characteristic (Gretton et al., 2012a).
116
+
117
+ Theorem 2 Assume $k$ is a characterstic kernel and $\mathcal { F }$ is the unit ball in the corresponding RKHS H. Then MMD ${ } ^ { 2 } [ \mathbb { P } _ { X } , \mathbb { P } _ { Y } ] = 0$ if, and only if, $\| ^ { \flat } _ { X } = \| ^ { \flat } _ { Y }$ .
118
+
119
+ Essentially, we do not require any prior knowledge or parameterization of $\| \boldsymbol { \underline { p } } _ { X }$ and $\| ^ { D } \boldsymbol { Y }$ . Access to i.i.d. samples from these distributions is sufficient. In practice, however, we only have access to finitely many data points and, thus, receive an estimate of the MMD from equation 6. This estimate is expected to have some deviation, i.e., even for identical distributions, the test statistic will be larger than zero. Therefore, we need finite sample bounds that quantify the convergence speed of the empirical MMD to obtain confidence bounds. Gretton et al. (2012a) introduce several such bounds of the type
120
+
121
+ $$
122
+ \begin{array} { r } { \mathbb { P } \left[ | \mathrm { M M D } _ { b } [ X , Y ] - \mathrm { M M D } [ \mathbb { P } _ { X } , \mathbb { P } _ { Y } ] | \geq \kappa ( \alpha , n ) \right] \leq \alpha . } \end{array}
123
+ $$
124
+
125
+ Under the null hypothesis $\| ^ { \flat } _ { X } = \| ^ { \flat } _ { Y }$ , we can obtain the rejection region $\begin{array} { r } { \mathrm { M M D } _ { b } [ X , Y ] \geq \kappa ( \alpha , n ) = \sqrt { 2 \frac { K } { n } } ( 1 + } \end{array}$ $\sqrt { 2 \log { \alpha ^ { - 1 } } } )$ for a test with level $\alpha$ , where $K$ is the supremum of the kernel (Gretton et al., 2012a, Corollary 9). However, these results rely on the independence assumption and, hence, cannot be used for comparing dynamical systems.
126
+
127
+ # 4.2 Hilbert-Schmidt Independence Criterion
128
+
129
+ The Hilbert-Schmidt independence criterion (HSIC) (Gretton et al., 2008) quantifies dependence between random variables. Generally, two random variables $X$ and $Y$ are independent if their joint distribution factorize, i.e., $\mathbb { P } _ { X , Y } = \mathbb { P } _ { X } \otimes \mathbb { P } _ { Y }$ , where $\otimes$ denotes the tensor product. Estimating the involved objects from data is usually intractable. Instead, the difference in MMD can elegantly be expressed through the HSIC.
130
+
131
+ Definition 6 (HSIC, Sejdinovic et al. (2013, Def. 11)) Let $X \sim P _ { X }$ and $Y \sim P _ { Y }$ be random variables with joint distribution $P _ { X , Y }$ . The HSIC is defined as
132
+
133
+ $$
134
+ \begin{array} { r } { \mathrm { H S I C } ( X , Y ) = \mathrm { M M D } _ { \mathcal { H } \otimes \mathcal { H } } [ P _ { X } \otimes P _ { Y } , P _ { X , Y } ] . } \end{array}
135
+ $$
136
+
137
+ Similar to the kernel two-sample test, it is possible to express equation 8 in terms of kernel evaluations.
138
+ Further, it is also possible to provide high confidence bounds and thus, obtain an efficient statistical test.
139
+
140
+ As the name suggests, the HSIC is closely related to Hilbert-Schmidt operators. These well-behaved operators are well investigated in functional analysis and in general, are bounded operators between Hilbert spaces. Further, the space of Hilbert-Schmidt operators between two reproducing kernel Hilbert spaces $\mathcal { H }$ and $\vec { \mathcal { G } }$ forms itself a Hilbert space, which is isomorphic to the product space $\mathcal { H } \otimes \mathcal { G }$ given by the product kernel (Muandet et al., 2017, Page 35).
141
+
142
+ Here, we want to emphasize the connection between the HSIC and the covariance operator $\mathit { C } _ { \mathit { X Y } }$ in terms of the Hilbert-Schmidt norm (Muandet et al., 2017, Eq. 3.37)
143
+
144
+ $$
145
+ \| \mathcal { C } _ { X , Y } \| _ { \mathrm { H S } } = \mathrm { H S I C } ( X , Y )
146
+ $$
147
+
148
+ and the representation of $\mathcal { C } _ { X , Y }$ as the unique bounded operator that satisfies the property
149
+
150
+ $$
151
+ \langle g , \mathcal { C } _ { X , Y } f \rangle _ { \mathcal { G } } = \operatorname { C o v } [ g ( Y ) , f ( X ) ]
152
+ $$
153
+
154
+ for all $g \in { \mathfrak { g } }$ and $f \in \mathcal { H }$ . Equivalently, the covariance operator can also be defined in terms of tensor spaces (Muandet et al., 2017, Sec. 3.2), however, equation 10 connects nicely to standard mixing expressions (cf. eq. equation 3). Further, the HSIC framework provides rich results such as efficient estimators and concentration results.
155
+
156
+ The general framework is highly flexible and can deal with a variety of objects. For our problem, we can use a simplified setting, where both systems belong to the same space, which is consistent with the setup for the kernel two-sample test. Estimations of equation 8 in terms of kernel evaluations can be found in (Gretton et al., 2008, Equation (4)).
157
+
158
+ # 4.3 Joint Independence—dHSIC
159
+
160
+ Pfister et al. (2018) extended the HSIC to $d$ -dimensional random vectors and thus, investigate
161
+
162
+ $$
163
+ \begin{array} { r } { \mathrm { d H S I C } ( X ) = \mathrm { M M D } _ { \otimes _ { i = 1 } ^ { d } \mathcal { H } } [ P _ { X _ { 1 } } \otimes . . . \otimes P _ { X _ { d } } , P _ { X _ { 1 } , . . . , X _ { d } } ] . } \end{array}
164
+ $$
165
+
166
+ Similarly as for the kernel two-sample test and the classical HSIC independence test, it is possible to quantify the convergence speed and thus, obtaining a threshold $\kappa ( \alpha , n )$ for statistical testing. Intuitively, this should be the independence notion that we need for the kernel two-sample test. However, we use a slightly different property, which we introduce in def. 9.
167
+
168
+ # 5 MMD-Mixing
169
+
170
+ In this section, we will focus on data from one system $\{ X _ { k } \}$ and investigate the temporal dependencies. We assume access to multiple independent trajectories, which we indicate through superscripts $\{ X _ { k } ^ { ( i ) } \}$ . Due to the ergodicity and stationarity assumptions, we obtain a well-defined underlying distribution $\mathbb { P }$ for which we can test. Next, we will introduce the new concept of MMD-mixing that quantifies the decay of autocorrelations with respect to the MMD and connect back to the HSIC.
171
+
172
+ # 5.1 Time Shifts and MMD-mixing
173
+
174
+ Let the trajectory $X _ { 0 } , X _ { 1 } , \ldots , X _ { n }$ be subject to a given sampling rate. Generally, autocorrelations decay over time, and far apart samples are approximately independent if the underlying system is mixing. Hence, we propose to increase the time between consecutive samples to reduce dependencies. The slower sampling rate is denoted through the time shift $a \in \mathbb N$ and yields data $X _ { 0 } , X _ { a } , X _ { 2 a } , . . . , X _ { a n }$ . Essentially, the question is how to determine and estimate $a$ to ensure approximately independent data points $X _ { 0 } , X _ { a } , X _ { 2 a } , . . . , X _ { a n }$ . We begin with a simplified setting and assume a sample from the stationary measure $X _ { 0 } \sim \Psi _ { X _ { 0 } } = \mathbb { P }$ .
175
+
176
+ Definition 7 (MMD-mixing) We call a process MMD-mixing $i f$
177
+
178
+ $$
179
+ \begin{array} { r } { \operatorname { M M D } _ { \mathcal { H } \otimes \mathcal { H } } [ \mathbb { P } _ { X _ { 0 } } \otimes \mathbb { P } _ { X _ { a } } , \mathbb { P } _ { X _ { 0 } , X _ { a } } ] \to 0 \quad f o r \ a \to \infty . } \end{array}
180
+ $$
181
+
182
+ This definition only considers the distributions at two points in time. Due to the stationarity of the system, we can move the timeshift through time and also consider different pairs in time. Due to the connection to Hilbert-Schmidt theory and covariance operators, it is also possible to consider expressions similar to equation 10.
183
+
184
+ Proposition 1 Let $\{ X _ { k } \}$ be an MMD-mixing process. Then,
185
+
186
+ $$
187
+ \mathrm { H S I C } ( X _ { 0 } , X _ { a } ) 0 f o r a \infty .
188
+ $$
189
+
190
+ We assume that the underlying kernel $k$ is characteristic and refer to it as the base kernel. Further, we assume to have access to $m$ independent trajectories. In this setting, we can readily apply the HSIC equation 8 framework. In particular, we pick two points in time from each trajectory, $X _ { 0 } ^ { ( i ) }$ and $X _ { a } ^ { ( i ) }$ . Then, we divide the data into $X _ { 0 } = \{ X _ { 0 } ^ { ( 1 ) } , X _ { 0 } ^ { ( 2 ) } , . . . , X _ { 0 } ^ { ( m ) } \}$ and $X _ { a } = \{ X _ { a } ^ { ( 1 ) } , X _ { a } ^ { ( 2 ) } , \dots , X _ { a } ^ { ( m ) } \}$ 0 . The sets are, per construction, i.i.d. within themselves since the $m$ trajectories are independent and due to the additional stationarity and ergodicity assumptions. Next, we can compute HSIC $( X _ { 0 } , X _ { a } )$ and iteratively increase $a$ . If we pick $a$ large enough, the HSIC will eventually become arbitrarily small. MMD-mixing ensures that $\mathrm { H S I C } ( X _ { s } , X _ { s + a } ) 0$ for $a \infty$ . For practical algorithms, we will fix a small $\epsilon > 0$ and enforce $\mathrm { H S I C } ( X _ { s } , X _ { s + a ^ { * } } ) < \epsilon$ . In our experiments, we pick $\epsilon$ as the standard test threshold of the HSIC (cf. fig. 3).
191
+
192
+ # 5.2 Extended MMD-mixing
193
+
194
+ Next, we extend our arguments to subtrajectories instead of considering two single points. Similarly as before, we use the notation $\mathbb { P } _ { X _ { 0 } , \ldots , X _ { s } }$ and $\mathbb { P } _ { X _ { s + a } , \dots , X _ { 2 s + a } }$ for the distributions of the subtrajectories of length $s$ (which is the joint distribution over the first $s$ states) and $\mathbb { P } _ { ( X _ { 0 } , . . . , X _ { s } ) , ( X _ { s + a } , . . . , X _ { 2 s + a } ) }$ for the joint distribution of the subtrajectories.
195
+
196
+ Definition 8 (Extended MMD-mixing) We call a process extended MMD-mixing if
197
+
198
+ $$
199
+ \begin{array} { r } { \begin{array} { r } { \mathrm { d } \mathrm { M } \mathrm { D } _ { ( \otimes _ { i = 1 } ^ { s } \mathcal { H } ) \otimes ( \otimes _ { i = 1 } ^ { s } \mathcal { H } ) } [ \mathbb { P } _ { X _ { 0 } , \ldots , X _ { s } } \otimes \mathbb { P } _ { X _ { s + a } , \ldots , X _ { 2 s + a } } , \mathbb { P } _ { ( X _ { 0 } , \ldots , X _ { s } ) , ( X _ { s + a } , \ldots , X _ { 2 s + a } ) } ] \to 0 \quad f o r \ a \to \infty . } \end{array} } \end{array}
200
+ $$
201
+
202
+ Clearly, we require an appropriate kernel to extend the MMD to joint distributions. In particular, tensor products of the base kernel need to be strong enough to distinguish the joint distributions. Szabó & Sriperumbudur (2018) discuss various tensor constructions, which we will leverage here.
203
+
204
+ Lemma 1 (Choice of Kernel I) Let $k$ be a characteristic kernel. Then $k ^ { s } = \otimes _ { i = 1 } ^ { s } k$ is also characteristic.
205
+
206
+ Proof: The statement follows directly from Szabó & Sriperumbudur (2018, Theorem 4), which considers a more general problem setting. □
207
+
208
+ Due to the tensor construction, we naturally obtain MMD-mixing with respect to $k$ as introduced in Definition 7, for a process that is extended MMD-mixing with respect to $k ^ { s }$ .
209
+
210
+ # 5.3 Joint Independence
211
+
212
+ To apply the mixing results to kernel two-sample testing, we require one more step. We need joint independence between all samples. Intuitively, this coincides with the dHSIC framework (cf. equation 11) and can be implemented through more sophisticated tensor kernels that embed multiple data points or subtrajectories simultaneously.
213
+
214
+ Lemma 2 (Choice of Kernel II) Assume $k ^ { s }$ is a characteristic kernel. Then the tensor kernel $k ^ { s , n } =$ $\otimes _ { i = 1 } ^ { n } k ^ { s }$ is an $\mathcal { L }$ -characteristic kernel, which makes the kernel suitable for joint independence testing.
215
+
216
+ Proof: Follows from (Szabó & Sriperumbudur, 2018, Theorem 4).
217
+
218
+ To combine mixing with kernel two-sample testing, we require the following technical assumption.
219
+
220
+ Definition 9 (Approximately $\epsilon$ -independent) $L e t \left\{ X _ { k } \right\}$ be an MMD-mixing process. We call data $X =$ $X _ { a ^ { * } } , X _ { 2 a ^ { * } } , \ldots , X _ { n a ^ { * } }$ approximately $\epsilon$ -independent if there is a time shift $a ^ { * }$ and threshold $\kappa ( \epsilon , n )$ that yields
221
+
222
+ $$
223
+ \mathbb { P } [ \mathrm { M M D } _ { b } ( X , \bar { X } ) \ge \kappa ] < \epsilon ,
224
+ $$
225
+
226
+ where $X$ is data that has been sampled independently from the stationary distribution $\mathbb { P }$ .
227
+
228
+ An important technical detail here is the fact that we consider the MMD with respect to the kernel $k$ and not the tensor kernel $k ^ { s , n }$ . Independent and identically distributed data naturally satisfies the above property when $\epsilon = \alpha$ and $\kappa$ is chosen correspondingly for a level- $\alpha$ kernel two-sample test. In practice, we apply a level $\epsilon$ HSIC test to multiple independent trajectories in order to determine an $a ^ { * }$ , which satisfies equation 15.
229
+
230
+ # 5.4 Connections to Other Mixing Notions
231
+
232
+ There are various types of mixing that essentially all describe the decay of autocorrelations. An extensive discussion of the relationship between different measures of dependencies can be found in Bradley (2005). The importance of covariance-based expressions for mixing is utilized in Bradley et al. (1987) to investigate how they can dominate each other.
233
+
234
+ Mixing properties are notoriously difficult or even impossible to estimate, and many types of mixing do not apply to large classes of dynamical systems (Hang et al., 2017). Our proposed type of mixing can be estimated from data and yields advantageous theoretical properties. In McDonald et al. (2011), the $\beta$ -mixing coefficient is estimated through involved density estimations. While the authors emphasize that they solve a more difficult problem to obtain a solution to a simpler one, this is still one of the few existing approaches to estimate the speed of mixing.
235
+
236
+ We start with defining the $\beta$ -mixing coefficient as in (McDonald et al., 2011):
237
+
238
+ $$
239
+ \beta ( a ) = \operatorname* { s u p } _ { s } \| \mathbb { P } _ { - \infty } ^ { s } \otimes \mathbb { P } _ { s + a } ^ { \infty } - \mathbb { P } _ { s , a } \| _ { \mathrm { T V } } ,
240
+ $$
241
+
242
+ where $\mathbb { P } _ { - \infty } ^ { s }$ is the joint distribution of the states $\{ X _ { t } \} _ { t = - \infty } ^ { s }$ and $\mathbb { P } _ { s + a } ^ { \infty }$ of $\{ X _ { t } \} _ { t = s + a } ^ { \infty }$ . With $\mathbb { P } _ { s , a }$ we denote the joint distribution of the objects around the tensor sign, here $( \{ X _ { t } \} _ { t = - \infty } ^ { s } , \{ X _ { t } \} _ { t = s + a } ^ { \infty } )$ and use $\| \cdot \| _ { \mathrm { T V } }$ for total variation. The process is $\beta$ -mixing if $\beta ( a ) 0$ for $a \infty$ .
243
+
244
+ MMD-mixing is closely related with equation 16 and yields lower bounds.
245
+
246
+ Lemma 3 A $\beta$ -mixing process is MMD-mixing for any bounded kernel.
247
+
248
+ Proof: This property follows by considering Hilbert space embeddings of probability distributions. In particular, Sriperumbudur et al. (2010, Theorem 21 (iii)) shows that
249
+
250
+ $$
251
+ \| \mathbb { P } - \mathbb { Q } \| _ { \mathrm { M M D } } \leq C \| \mathbb { P } - \mathbb { Q } \| _ { \mathrm { T V } } ,
252
+ $$
253
+
254
+ where $C$ is the supremum of the corresponding kernel.
255
+
256
+ The other direction does not always hold. For instance, deterministic dynamical systems are, in general, not $\beta$ -mixing (Hang et al., 2017).
257
+
258
+ Lemma 4 A $\boldsymbol { \mathscr { C } }$ -mixing process with respect to the underlying function space $\boldsymbol { \mathscr { C } }$ is MMD-mixing with respect to the kernel $k$ , if $\mathcal { H } \subset \mathcal { C }$ , where $\mathcal { H }$ is the corresponding RKHS.
259
+
260
+ Proof: Following Definition 2 in Hang et al. (2018), $\boldsymbol { \mathscr { C } }$ -mixing is essentially defined as equation 2, where $\mathcal { F }$ is chosen as the function space $c$ and $\vec { \mathcal { G } }$ as $L ^ { 1 }$ on the natural filtration of the system. By considering smaller spaces for $\mathcal { F }$ and $\vec { \mathcal { G } }$ , such as $\mathcal { H }$ , we directly obtain the result. □
261
+
262
+ In particular, if $k$ is the squared exponential kernel then the corresponding RKHS is well-investigated Steinwart $\&$ Christmann (2008). In particular, the RKHS is contained in common choices for $\boldsymbol { \mathscr { C } }$ , such as $\mathrm { B V } ( S )$ , $\operatorname { L i p } ( S )$ , and $C ^ { 1 } ( S )$ .
263
+
264
+ Further, recent results show that convergence in MMD metrizes weak convergence in the space of probability distributions (Simon-Gabriel et al., 2020). Thus, convergence in MMD is applicable to discrete data and Dirac distributions. This may be particularly relevant when considering mixing properties of deterministic dynamical systems even further.
265
+
266
+ In practice, mixing is usually exponentially fast in the gap $a$ . In all of our numerical experiments, it was sufficient to estimate a single time shift $a ^ { * }$ in the MMD-mixing sense between two data points. The joint dHSIC estimation yields stronger theoretical properties, however, might also induce some conservatism into the estimation.
267
+
268
+ # 6 Two-sample Test for Dynamical Systems
269
+
270
+ Next, we utilize mixing to state our main result: a kernel two-sample test for dynamical systems. Due to MMD-mixing, we are able to enforce arbitrarily small dependencies between consecutive samples. In particular, we use our notion of approximately $\epsilon$ -independent data (cf. equation 15) to adjust the test threshold accordingly. For $a \infty$ , we actually recover the i.i.d. setting from Gretton et al. (2012a).
271
+
272
+ Proposition 2 Assume $\{ X _ { k } \}$ and $\{ Y _ { k } \}$ are stationary and MMD-mixing dynamical systems with distributions $\| ^ { p } _ { X } , \| ^ { p } _ { Y }$ . Further, assume data $X _ { a ^ { * } } , X _ { 2 a ^ { * } } , \ldots , X _ { n { a ^ { * } } }$ and $Y _ { a ^ { * } } , Y _ { 2 a ^ { * } } , \ldots , Y _ { n a ^ { * } }$ are sampled i.i.d. from $\| \boldsymbol { \underline { p } } _ { X }$ and $\| \boldsymbol { \mathsf { P } } _ { Y }$ , respectively. If we obtain for the empirical estimate equation $\it 6$ that
273
+
274
+ $$
275
+ \mathrm { M M D } _ { b } ^ { 2 } [ X , Y ] > \kappa ( n , \alpha ) ,
276
+ $$
277
+
278
+ then we can conclude with probability $1 - \alpha$ that $\| ^ { \flat } _ { X } \neq \| ^ { \flat } _ { Y }$ . The choice of the threshold $\kappa ( n , \alpha )$ is discussed extensively in Gretton et al. (2012a) and also above.
279
+
280
+ In practice, the autocorrelations will always be greater than zero. Also, it is important that either both systems have the same mixing speed or $a ^ { * }$ is chosen with respect to the system with the slower mixing rate.
281
+
282
+ We state the main result that, in contrast to prior work, foregoes the need for independence assumptions.
283
+
284
+ Theorem 3 Assume the same setting as above, however, instead of i.i.d. data, we assume that $a ^ { * }$ is $a$ time shift that yields approximately ϵ-independent (cf . 15) data $X \ = \ X _ { a ^ { * } } , X _ { 2 a ^ { * } } , . . . , X _ { n a ^ { * } }$ and $Y =$ $Y _ { a ^ { * } } , Y _ { 2 a ^ { * } } , \ldots , Y _ { n a ^ { * } }$ .
285
+
286
+ If we obtain for the empirical estimate equation $\it 6$ that
287
+
288
+ $$
289
+ \mathrm { M M D } _ { b } ^ { 2 } [ X , Y ] > \kappa ( n , \alpha ) ,
290
+ $$
291
+
292
+ then we can conclude with probability $1 - \alpha ^ { \prime }$ that $\mathbb { P } _ { X } \neq \mathbb { P } _ { Y }$ , where $\begin{array} { r } { \alpha ^ { \prime } = \frac { 1 } { 3 } ( \alpha + 2 \epsilon ) } \end{array}$
293
+
294
+ Proof: First, we will decompose the test statistic into the i.i.d. problem and a second term that captures the dependency in the data. Assume $X , Y$ are i.i.d. data sets (ghost samples) that are drawn from $\| \boldsymbol { \underline { p } } _ { X }$ and $\| ^ { p } { \boldsymbol { \gamma } }$ , respectively. A similar argument is frequently used for symmetrization and referred to in Gretton et al. (2012a, P. 736).
295
+
296
+ $$
297
+ \begin{array} { r l } & { ~ \lvert \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( X , Y ) \rvert } \\ & { = \lvert \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) + \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) - \mathrm { M M D } _ { b } ( X , Y ) \rvert } \\ & { \le \lvert \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) \rvert + \lvert \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) - \mathrm { M M D } _ { b } ( X , Y ) \rvert } \\ & { = \lVert \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) \rvert + \lvert \lVert \hat { \mu } _ { \bar { X } } - \hat { \mu } _ { \bar { Y } } \rVert _ { \mathcal { H } } - \lVert \hat { \mu } _ { X } - \hat { \mu } _ { Y } \rVert _ { \mathcal { H } } \rvert } \\ & { \le \lvert \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) \rvert + \lVert \hat { \mu } _ { \bar { X } } - \hat { \mu } _ { \bar { Y } } - \hat { \mu } _ { X } + \hat { \mu } _ { Y } \rVert _ { \mathcal { H } } } \\ & { \le \lvert \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) \rvert + \lvert \mathrm { M M D } _ { b } ( \bar { X } , X ) + \mathrm { M M D } _ { b } ( \bar { Y } , Y ) } \end{array}
298
+ $$
299
+
300
+ We use the identity $\mathrm { \Delta I M D } _ { b } ( X , Y ) = \| \hat { \mu } _ { X } - \hat { \mu } _ { Y } ) \| _ { \mathcal { H } }$ (Muandet et al., 2017, Eq. 3.31) and apply the inverse triangle inequality. The first term follows directly from Gretton et al. (2012a) (cf. eq. 7) and can be bounded by $\kappa$ . By design, the time shift $a ^ { * }$ was chosen to induce the concentration
301
+
302
+ $$
303
+ \mathbb { P } \left[ \mathrm { M M D } _ { b } ( X , \bar { X } ) > \kappa \right] \leq \epsilon
304
+ $$
305
+
306
+ and respectively also for MMD $_ b ( Y , Y )$ . Thus, we obtain in total
307
+
308
+ $$
309
+ \begin{array} { r l } { { \mathbb { P } [ | \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( X , Y ) | > \kappa ] } } \\ & { \leq \mathbb { P } [ | \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) | + \mathrm { M M D } _ { b } ( \bar { X } , X ) + \mathrm { M M D } _ { b } ( \bar { Y } , Y ) > \kappa ] } \\ & { \leq \frac { 1 } { 3 } \mathbb { P } [ | \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) | > \kappa ] + \frac { 1 } { 3 } \mathbb { P } [ \mathrm { M M D } _ { b } ( \bar { X } , X ) > \kappa ] + \frac { 1 } { 3 } \mathbb { P } [ \mathrm { M M D } _ { b } ( \bar { Y } , Y ) > \kappa ] } \\ & { \leq \frac { 1 } { 3 } ( \alpha + 2 \epsilon ) . } \end{array}
310
+ $$
311
+
312
+ Remark 1 By adapting the concentration results inside the kernel two-sample test, i .e., McDiarmid’s inequality, we can directly embed significant autocorrelations in the test statistic and potentially be more data-efficient and have tighter bounds. These results, however, would require further technical assumptions (e.g., Assumption 3.1. in (Chérief-Abdellatif & Alquier, 2022), which is used in a different context and does not estimate mixing). Here, we focus on introducing an efficient, sound, and practically relevant statistical test for dynamical systems.
313
+
314
+ In practice, we usually do not have access to the full state $X _ { k }$ . Instead we receive measurements $X _ { k } ^ { \prime } =$ $g ( X _ { k } ) + \xi _ { k }$ , where $g$ is an observation function and $\xi _ { k } \overset { \mathrm { i i d } } { \sim } \mathbb { P } _ { \xi }$ measurement noise. Intuitively, the function $g$ could be regarded as sensors that measure some quantity that depends on the underlying system. Thus, we could also infer different systems when, e.g., the measurement noise or the sensors are different. Further, it is not always possible to reconstruct the state, and appropriate observability assumptions would be required for this. However, this is not due to our test but an issue of the problem itself since the true underlying state is unknown. Nonetheless, we are able to apply the proposed test to measurements $X _ { k } ^ { \prime }$ by considering the pushforward of the measure $g ( \mathbb { P } _ { X } )$ together with $\mathbb { P } _ { \xi }$ and correspondingly, $Y _ { k } ^ { \prime } = h ( Y _ { k } ) + \nu _ { k }$ with $\nu _ { k } \overset { \mathrm { i i d } } { \sim } \mathbb { P } _ { \nu }$ and observation function g.
315
+
316
+ Proposition 3 Assume the same setting as in theorem $\boldsymbol { \mathcal { Z } }$ , however, with noisy measurements $X _ { k } ^ { \prime } = g ( X _ { k } ) +$ $\xi _ { k }$ and $Y _ { k } ^ { \prime } = h ( Y _ { k } ) + \nu _ { k }$ and independent noise. If $\mathrm { M M D } _ { b } ^ { 2 } [ X ^ { ' } , Y ^ { ' } ] > \kappa ( n , \alpha )$ , then we conclude that $\| ^ { \boldsymbol { \mathsf { p } } } _ { \boldsymbol { X } ^ { \prime } } \neq \| ^ { \boldsymbol { \mathsf { p } } } _ { \boldsymbol { Y } ^ { \prime } }$ with high probability.
317
+
318
+ ![](images/5675b01065dae40a0605d970bb0e6c2046edcce6d6942459e8edea9d2b1c35ea.jpg)
319
+ Figure 1: Scatter plot of an illustrative 2-dimensional LTI system. The system was designed to yield slow mixing times and initialized at $X _ { 0 } ~ = ~ 0$ . The red crosses represent the first 100 states $X _ { 0 } , X _ { 1 } , \ldots , X _ { 1 0 0 }$ . The blue circles represent states with an enforced time shift of $a ^ { * } = 7 5$ between samples. The stationary distribution of the system is illustrated as a contour plot.
320
+
321
+ In general, it is not clear what states to choose for an appropriate representation of a dynamical system, e.g., to accurately model human walking. If we obtain rich information through sensor measurements then this can often be sufficient for subsequent downstream tasks (cf. section 8).
322
+
323
+ # 7 Illustrative Examples
324
+
325
+ In this section, we illustrate two critical properties of our method: i) respecting the estimated time shift $a ^ { * }$ yields samples whose distribution is indistinguishable from the stationary distribution, ii) violating the estimated time shift $a ^ { * }$ leads to clustering effects that skew and bias the empirical distributions. More details on all experiments (deterministic and stochastic systems) are provided in the appendix.
326
+
327
+ In practice, it is usually sufficient to consider data from two points in time $\mathbb { P } _ { s }$ and $\mathbb { P } _ { s + a }$ —in particular, when kernel two-sample testing is also based on points and not subtrajectories. Thus, we estimate $a ^ { * }$ based on MMD-mixing (cf. def. 7) and (unless stated otherwise) pick the first time shift that is below the test threshold. Further, following Gretton et al. (2012a), we consider squared exponential kernels and chose the bandwidth based on the well-established median heuristic. Hyperparameter optimization can further improve the power of the test. We excluded such a discussion since this is not the main emphasize of our work and orthogonal to our contributions – how can kernel two-sample tests be adapted to dynamical systems and how can a suitable notion of mixing be estimated from data.
328
+
329
+ # 7.1 Linear Time-invariant System
330
+
331
+ Linear time-invariant (LTI) systems are prevalent in control and systems theory due to many analytically tractable properties. In particular, we can explicitly determine the stationary distribution (cf. equation 39 in the appendix) and, thus, draw i.i.d. samples. Consider the dynamics
332
+
333
+ $$
334
+ X _ { k + 1 } = A X _ { k } + \epsilon _ { k } ,
335
+ $$
336
+
337
+ where $\epsilon _ { k } \overset { \mathrm { i i d } } { \sim } \mathcal { N } ( 0 , \Sigma )$ . Further, assume all eigenvalues of $A \in \mathbb { R } ^ { d \times d }$ are located within the unit circle and $x _ { 0 } = 0$ to avoid potential transient behavior. We can now quantify the speed of mixing directly through the eigenvalues of $A$ and $\Sigma$ . If $A$ has eigenvalues close to the boundary of the unit sphere, then this results in slow mixing. The same holds for small process noise. On the contrary, small eigenvalues of $A$ and large noise result in rapid mixing. An intuitive corner case is $A = 0$ , which yields perfectly independent samples.
338
+
339
+ In fig. 1, we illustrate the behavior of a two-dimensional slowly mixing system (31). In red, we plot the first 100 states of the system $X _ { 1 } , X _ { 2 } , \ldots , X _ { 1 0 0 }$ , and in blue, states with an enforced time shift of $a ^ { * } = 7 5$ between consecutive samples $X _ { a ^ { * } } , X _ { 2 a ^ { * } } , \ldots , X _ { 1 0 0 a ^ { * } }$ . The estimated time shift $a ^ { * } = 7 5$ is obtained in the MMD-mixing sense as described in sec. 5.2 and ensures that the HSIC is below the test threshold (cf. fig. 4 in the appendix).
340
+
341
+ In fig. 1, we further show a contour plot of the stationary distribution. Samples that were drawn based on our method coincide with the stationary distribution. The first 100 states, on the other hand, cluster in one region of the state space and are subject to heavy auto-correlations. The red crosses are clearly not representative of the stationary distribution. To investigate this further, we applied kernel two-sample tests to distinguish samples that are directly drawn from the stationary distribution and samples drawn based on our method with appropriate time shifts. As expected, this turned out to be impossible, and we cannot distinguish between the two data sets. Details are given in the appendix.
342
+
343
+ We want to emphasize that mixing can be arbitrarily slow. In particular, it is possible that the system does not mix at all (Simchowitz et al., 2018). With the proposed method, we would notice this since we would not be able to estimate an appropriate $a ^ { * }$ due to substantial remaining correlations in the data. Thus, we can decide whether the kernel two-sample test is applicable or not. We have also constructed non-mixing examples and obtained a constant HSIC that does not decrease over time (cf. appendix).
344
+
345
+ # 7.2 Lorenz Attractor
346
+
347
+ To illustrate the usefulness of the new mixing notion we present the example of the Lorenz system, which is illustrated in fig. 2 and given by the following equations:
348
+
349
+ $$
350
+ \begin{array} { l } { \dot { x } = 1 0 ( y - x ) } \\ { \dot { y } = 2 8 x - y - x z } \\ { \dot { z } = x y - \displaystyle \frac { 8 } { 3 } z . } \end{array}
351
+ $$
352
+
353
+ The Lorenz attractor is a famous chaotic and deterministic dynamical system that is known to mix in a topological sense (Luzzatto et al., 2005). Other notions, such as $\beta$ -mixing, are too strong and not suitable here. In the appendix, we provide empirical evidence that the Lorenz system mixes with respect to the herein introduced notion of MMD-mixing. Connecting topological mixing on a rigorous level with MMD-mixing remains for future work.
354
+
355
+ Further, we show numerically that we can distinguish between two systems with slightly different parameters and obtain the required properties of the kernel two-sample test. For the estimated $a ^ { * }$ , the test is wellbehaved. When we chose the estimated time shift too small, then the amount of false positives explodes.
356
+
357
+ ![](images/53c303653fccf006d80cdb0a1e11f0b4bee733cde21264251462f52026fb2c4f.jpg)
358
+ Figure 2: Scatter plot of the classical Lorenz system in blue circles (eq. equation 32—equation 34) and samples from a system with slightly perturbed parameters in red crosses. Both systems are randomly initilized and sampled at time instances $t _ { 1 } = 2 0 , t _ { 2 } = 4 0 , \dots , t _ { 1 0 0 } = 2 0 0 0$ . To the human eye, the distributions look slightly different.
359
+
360
+ # 7.3 $c$ -mixing Systems
361
+
362
+ We also consider the three examples that are discussed in Hang et al. (2018) and are provably $c$ -mixing. Due to the Gaussian kernel that we use and the choices for $c$ $\operatorname { L i p } ( S )$ and $\mathrm { B V } ( S )$ , cf. Hang et al. (2018) for details), $\boldsymbol { \mathscr { C } }$ -mixing directly implies MMD-mixing. The empirical results confirm the MMD-mixing property.
363
+
364
+ We considered the following systems:
365
+
366
+ $\beta$ -map: For $\beta > 1$ and $x _ { 0 } \in ( 0 , 1 )$ , the dynamical system is defined by
367
+
368
+ $$
369
+ x _ { k + 1 } = \beta x _ { k } \mod 1 .
370
+ $$
371
+
372
+ Logistic map: For $x _ { 0 } \in ( 0 , 1 )$ , the logistic map is defined by
373
+
374
+ $$
375
+ x _ { k + 1 } = 4 x _ { k } ( 1 - x _ { k } ) .
376
+ $$
377
+
378
+ Gauss map: For $x _ { 0 } \in ( 0 , 1 )$ , the Gauss map is defined by
379
+
380
+ $$
381
+ x _ { k + 1 } = { \frac { 1 } { x _ { k } } } \mod 1 .
382
+ $$
383
+
384
+ For all examples, the speed of mixing is extremely fast and after $a ^ { * } = 1 0$ , the data is close to independent.
385
+ We initialized $x _ { 0 }$ uniformly on the interval $( 0 , 1 )$ and used $\beta = e$ .
386
+
387
+ Interestingly, the Lebesgue densities of the stationary distributions are also known and stated in Hang et al. (2018). This would allow for kernel two-sample testing, exactly as done for the OU-process in Sec. A.1.1. Since the mixing is extremely fast here, we expect the same result—time shifted data that respects the speed of mixing is indistinguishable from data that has been drawn directly from the stationary distribution.
388
+
389
+ # 8 Experimental Example—Human Walking
390
+
391
+ We apply the developed kernel two-sample test to real-world experimental data 1. We consider gait data of human subjects walking on a treadmill. Detecting characteristics and alterations in human gait is a highly relevant problem in disease prediction, diagnosis and progress monitoring as well as in biometrics (Nguyen et al., 2019; Gaßner et al., 2020; Muro-De-La-Herran et al., 2014). An example data set with a known ground truth label is obtained by letting subjects walk with and without a knee orthosis. Our goal is to classify each measured trajectory correctly with the labels orthosis and no orthosis.
392
+
393
+ # 8.1 Data Collection
394
+
395
+ The inertial measurement unit (IMU) data of foot motion were collected from 38 healthy subjects without any restrictions in gait or illnesses that affect their walking ability. The data collection was conducted in the motion analysis laboratory of one of the authors’ universities on a Mercury Med treadmill. The IMU sensors were attached to the test subjects’ shoes using velcro straps. The measurements were taken for 90 seconds each trial under the following conditions: walking at very slow $( 1 . 5 \mathrm { k m h ^ { - 1 } }$ ), slow $( 3 \mathrm { k m h ^ { - 1 } }$ ), slow with simulated gait pathology, and normal walking speed $( \mathrm { 5 k m h ^ { - 1 } }$ ). For the simulated gait pathology, the mobility of the left knee joint was restricted using a knee orthosis, which was fixed in a neutral position to disable further extension or flexion of the joint. The subjects were asked to stand still with both feet next to each other for 3 seconds at the beginning and the end of each trial, Before the trials, the subjects were able to practice walking on the treadmill. They were allowed to use the handrail of the treadmill if necessary. For three subjects, the orthosis experiment could not be carried out. An approval from the local ethics committee was obtained.
396
+
397
+ # 8.2 Description of the Statistical Test
398
+
399
+ We consider the raw gyroscopic data of the left foot for 35 subjects. The gyroscopic data is three-dimensional and consists of roughly 14 000 data points per trajectory.
400
+
401
+ # 8.2.1 Mixing Properties
402
+
403
+ First, we quantify the mixing properties of human walking. We estimate MMD-mixing (cf. sec. 5.2) by applying the HSIC to the 35 subjects. We consider the trials with and without the orthosis simultaneously, which yields 70 independent trajectories. We draw an initial point $X _ { k }$ from a uniform distribution between $k = 2 0 0 0$ and $k = 4 0 0 0$ and fix that point for all trajectories. Afterward, we compute HSIC $( X _ { k } , X _ { k + a } )$ for various values of $a$ . In fig. 3, the results are illustrated and we can see the decrease of dependencies. To exclude numerical artifacts, we repeat the estimation of the mixing properties 50 times with randomly chosen initial points.
404
+
405
+ # 8.2.2 Classification
406
+
407
+ We compare MMD-based classification against standard baselines for the 70 trajectories.
408
+
409
+ MMD-based classification: We choose one trajectory of interest, for which we forget the correct label, and separate it from all other trajectories, for which the correct label is known. We pick a random initial point $X _ { 0 }$ uniformly distributed between $k = 2 0 0 0$ and $k = 3 0 0 0$ . After time shifting the data with respect to $a ^ { * }$ , we estimate the MMD equation 6 between the trajectory of interest and all other trajectories. Then, we use the label of the trajectory with the smallest MMD to label the unlabeled trajectory. Intuitively, unrestricted trajectories look more similar among themselves than trajectories with a restricted knee, and vice versa.
410
+
411
+ Baseline: We compare the proposed approach to common baselines for classification of biomedical data (Bidabadi et al., 2019; Misgeld et al., 2015; Tien et al., 2010). We consider the following features:
412
+
413
+ • Maximum and minimum value of each dimension;
414
+
415
+ ![](images/18d1fe8988042a8668edce1ad471075baa6427def2ae090ae900031a8234451d.jpg)
416
+ Figure 3: Mixing properties of gait data. On the $x$ -axis, we depict the time shift $a$ between consecutive samples. One time step corresponds to 0.01 seconds. The $y$ -axis shows the dependence between data points with respect to the corresponding time shift. The initial point is randomized, and the estimation is repeated 50 times. Depicted is the mean of the test statistic and the $9 5 \%$ upper confidence bound. We also show the threshold $\kappa$ of the independence test. When the blue line is below the red line, it is not possible to infer statistical dependence between the data points.
417
+
418
+ • The 4 largest frequencies based on a Fourier transform;
419
+ • The 2-norm over time and the state dimensions.
420
+
421
+ In total, this results in 19 features for each trajectory that are used to train linear classifiers—support vector machines (SVM) and logistic regression (LR). Further, we use a 3-fold cross-validation technique. We repeat the training also 1000 times and report the average accuracy and standard deviation in Table 1.
422
+
423
+ # 8.3 Results
424
+
425
+ Our empirical analysis reveals that human walking mixes with respect to MMD-mixing (cf. sec. 5.2). Further, as illustrated in fig. 3, we can effectively estimate the speed of mixing. After roughly five footsteps, the dependence of data to its past is mostly gone, and we can treat data as independent.
426
+
427
+ For MMD-based classification, we use a time shift of $a ^ { * } = 4 0 0$ . This results in 25 points per trajectory. A larger choice of $a ^ { * }$ around 600 would be closer to our theoretical results. However, due to the limited amount of data, this would reduce the number of available samples even further.
428
+
429
+ We run all classification algorithms 1000 times and report the average accuracy and standard deviation in Table 1. Our method achieves the best accuracy, and we are able to classify $9 9 . 9 9 \%$ of the subjects with no orthosis correctly. Some very few subjects are repeatedly misclassified when walking with the orthosis, which might be explained using futher insights and data analysis. For the other methods, in contrast, there is no apparent structure in the errors.
430
+
431
+ # 8.4 Discussion
432
+
433
+ The above results show that the proposed method works well on a practically relevant non-trivial problem and beats reasonable baselines. We spent a reasonable amount of time on designing good features in the comparison. While the accuracy of the linear classifiers could potentially be improved by adding additional features, designing such features requires more insight into the problem and system properties, which is unavailable in many applications. In order to improve the accuracy of our method, it would suffice to add more data (i.e., consider longer trajectories). Further, it can directly be applied to a range of similar problems.
434
+
435
+ Table 1: Classification accuracy for labeling the trajectories correctly into the labels orthosis and no orthosis. Mean accuracy with standard deviation over 1000 repetitions.
436
+
437
+ <table><tr><td>Our method</td><td>SvM</td><td>LR</td></tr><tr><td>95.7%± 2.4%</td><td>86.9%±4.4%</td><td>92.5%± 3.2%</td></tr></table>
438
+
439
+ Classification and clustering algorithms based on the MMD can be applied in more general settings (Jegelka et al., 2009). Thus, our proposed nearest-neighbor approach for dynamical systems should generalize to more sophisticated clustering algorithms, which could yield unprecedented insights into the behavior of complex dynamical systems.
440
+
441
+ # 9 Conclusion
442
+
443
+ We propose a kernel two-sample test for dynamical systems with deep connections to a new type of mixing in MMD. The proposed method is straightforward to use, has only a few parameters, and is model-free. In particular, we are able to estimate the speed of mixing from data in a relevant norm, which was previously not possible. The method is tailored to dynamical systems for which we have access to multiple independent and long trajectories. The flexibility and relevance of the proposed method are demonstrated numerically and experimentally on raw motion sensor data. The presented results show the potential for biomedical and engineering applications, which we plan to explore in future work.
444
+
445
+ # References
446
+
447
+ Shiva Sharif Bidabadi, Iain Murray, Gabriel Yin Foo Lee, Susan Morris, and Tele Tan. Classification of foot drop gait characteristic due to lumbar radiculopathy using machine learning algorithms. Gait & Posture, 71:234–240, 2019.
448
+ George D Birkhoff. Proof of the ergodic theorem. Proceedings of the National Academy of Sciences, 17(12): 656–660, 1931.
449
+ Richard C Bradley. Basic properties of strong mixing conditions. a survey and some open questions. Probability surveys, 2:107–144, 2005.
450
+ Richard C Bradley, Wlodzimierz Bryc, and Svante Janson. On dominations between measures of dependence. Journal of Multivariate Analysis, 23(2):312–329, 1987.
451
+ Steven L Brunton, Bingni W Brunton, Joshua L Proctor, Eurika Kaiser, and J Nathan Kutz. Chaos as an intermittently forced linear system. Nature Communications, 8(1):1–9, 2017.
452
+ Badr-Eddine Chérief-Abdellatif and Pierre Alquier. Finite sample properties of parametric mmd estimation: robustness to misspecification and dependence. Bernoulli, 28(1):181–213, 2022.
453
+ Kacper Chwialkowski and Arthur Gretton. A kernel independence test for random processes. In International Conference on Machine Learning, pp. 1422–1430, 2014.
454
+ Kacper P Chwialkowski, Dino Sejdinovic, and Arthur Gretton. A wild bootstrap for degenerate kernel tests. In Advances in Neural Information Processing Systems, pp. 3608–3616, 2014.
455
+ Gary Doran, Krikamol Muandet, Kun Zhang, and Bernhard Schölkopf. A permutation-based kernel conditional independence test. In Conference on Uncertainty in Artificial Intelligence, pp. 132–141, 2014.
456
+
457
+ Heiko Gaßner, Dennis Jensen, Franz Marxreiter, Anja Kletsch, Stefan Bohlen, Robin Schubert, Lisa M Muratori, Bjoern Eskofier, Jochen Klucken, Jürgen Winkler, et al. Gait variability as digital biomarker of disease severity in Huntington’s disease. Journal of Neurology, pp. 1–8, 2020.
458
+
459
+ Arthur Gretton, Kenji Fukumizu, Choon H Teo, Le Song, Bernhard Schölkopf, and Alex J Smola. A kernel statistical test of independence. In Advances in Neural Information Processing Systems, pp. 585–592, 2008.
460
+
461
+ Arthur Gretton, Karsten M Borgwardt, Malte J Rasch, Bernhard Schölkopf, and Alexander Smola. A kernel two-sample test. Journal of Machine Learning Research, 13(Mar):723–773, 2012a.
462
+ Arthur Gretton, Dino Sejdinovic, Heiko Strathmann, Sivaraman Balakrishnan, Massimiliano Pontil, Kenji Fukumizu, and Bharath K Sriperumbudur. Optimal kernel choice for large-scale two-sample tests. In Advances in Neural Information Processing Systems, pp. 1205–1213, 2012b.
463
+ Hanyuan Hang, Ingo Steinwart, et al. A Bernstein-type inequality for some mixing processes and dynamical systems with an application to learning. The Annals of Statistics, 45(2):708–743, 2017.
464
+ Hanyuan Hang, Ingo Steinwart, Yunlong Feng, and Johan AK Suykens. Kernel density estimation for dynamical systems. The Journal of Machine Learning Research, 19(1):1260–1308, 2018.
465
+ Jemin Hwangbo, Joonho Lee, Alexey Dosovitskiy, Dario Bellicoso, Vassilios Tsounis, Vladlen Koltun, and Marco Hutter. Learning agile and dynamic motor skills for legged robots. Science Robotics, 4(26):eaau5872, 2019.
466
+ Isao Ishikawa, Keisuke Fujii, Masahiro Ikeda, Yuka Hashimoto, and Yoshinobu Kawahara. Metric on nonlinear dynamical systems with Perron-Frobenius operators. In Advances in Neural Information Processing Systems, pp. 2856–2866, 2018.
467
+ Isao Ishikawa, Akinori Tanaka, Masahiro Ikeda, and Yoshinobu Kawahara. Metric on random dynamical systems with vector-valued reproducing kernel Hilbert spaces. arXiv preprint arXiv:1906.06957, 2019.
468
+ Stefanie Jegelka, Arthur Gretton, Bernhard Schölkopf, Bharath K Sriperumbudur, and Ulrike Von Luxburg. Generalized clustering via kernel embeddings. In Annual Conference on Artificial Intelligence, pp. 144–152. Springer, 2009.
469
+ Sabina Jeschke, Christian Brecher, Tobias Meisen, Denis Özdemir, and Tim Eschert. Industrial Internet of Things and cyber manufacturing systems. In Industrial Internet of Things, pp. 3–19. Springer, 2017.
470
+ Stefan Klus, Ingmar Schuster, and Krikamol Muandet. Eigendecompositions of transfer operators in reproducing kernel Hilbert spaces. Journal of Nonlinear Science, 30(1):283–315, 2020.
471
+ Lennart Ljung. System identification. Wiley Encyclopedia of Electrical and Electronics Engineering, 2001.
472
+ James R Lloyd and Zoubin Ghahramani. Statistical model criticism using kernel two sample tests. In Advances in Neural Information Processing Systems, pp. 829–837, 2015.
473
+ Mingsheng Long, Han Zhu, Jianmin Wang, and Michael I Jordan. Deep transfer learning with joint adaptation networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2208–2217. JMLR. org, 2017.
474
+ Markus J Lueken, Berno JE Misgeld, and Steffen Leonhardt. Classification of spasticity affected EMGsignals. In IEEE 12th International Conference on Wearable and Implantable Body Sensor Networks (BSN), pp. 1–6, 2015.
475
+ Stefano Luzzatto, Ian Melbourne, and Frederic Paccaut. The Lorenz attractor is mixing. Communications in Mathematical Physics, 260(2):393–401, 2005.
476
+ Daniel McDonald, Cosma Shalizi, and Mark Schervish. Estimating beta-mixing coefficients. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pp. 516–524, 2011.
477
+ Igor Mezic. On comparison of dynamics of dissipative and finite-time systems using Koopman operator methods. IFAC-PapersOnLine, 49(18):454–461, 2016.
478
+ Berno JE Misgeld, Markus Lüken, Daniel Heitzmann, Sebastian I Wolf, and Steffen Leonhardt. Body-sensornetwork-based spasticity detection. IEEE journal of Biomedical and Health Informatics, 20(3):748–755, 2015.
479
+ Krikamol Muandet, Kenji Fukumizu, Bharath Sriperumbudur, and Bernhard Schölkopf. Kernel mean embedding of distributions: A review and beyond. Foundations and Trends® in Machine Learning, 10(1-2): 1–141, 2017.
480
+ Alvaro Muro-De-La-Herran, Begonya Garcia-Zapirain, and Amaia Mendez-Zorrilla. Gait analysis methods: An overview of wearable and non-wearable systems, highlighting clinical applications. Sensors, 14(2): 3362–3394, 2014.
481
+ An Nguyen, Nils Roth, Nooshin Haji Ghassemi, Julius Hannink, Thomas Seel, Jochen Klucken, Heiko Gassner, and Bjoern M Eskofier. Development and clinical validation of inertial sensor-based gait-clustering methods in Parkinson’s disease. Journal of Neuroengineering and Rehabilitation, 16(1):1–14, 2019.
482
+ Niklas Pfister, Peter Bühlmann, Bernhard Schölkopf, and Jonas Peters. Kernel-based tests for joint independence. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 80(1):5–31, 2018.
483
+ Michele Pistacchi, Manuela Gioulis, Flavio Sanson, Ennio De Giovannini, Giuseppe Filippi, Francesca Rossetto, and Sandro Zambito Marsala. Gait analysis and clinical correlations in early Parkinson’s disease. Functional neurology, 32(1):28, 2017.
484
+ S Joe Qin and Thomas A Badgwell. A survey of industrial model predictive control technology. Control Engineering Practice, 11(7):733–764, 2003.
485
+ Henning Schluter, Friedrich Solowjow, and Sebastian Trimpe. Event-triggered learning for linear quadratic control. IEEE Transactions on Automatic Control, 2020.
486
+ Bernhard Schölkopf and Alexander J Smola. Learning with kernels: support vector machines, regularization, optimization, and beyond. MIT press, 2001.
487
+ Thomas B Schön, Adrian Wills, and Brett Ninness. System identification of nonlinear state-space models. Automatica, 47(1):39–49, 2011.
488
+ J Schoukens and Lennart Ljung. Nonlinear system identification: A user-oriented road map. IEEE Control Systems Magazine, 39(6):28–99, 2019.
489
+ Dino Sejdinovic, Bharath Sriperumbudur, Arthur Gretton, and Kenji Fukumizu. Equivalence of distancebased and RKHS-based statistics in hypothesis testing. The Annals of Statistics, pp. 2263–2291, 2013.
490
+ Max Simchowitz, Horia Mania, Stephen Tu, Michael I Jordan, and Benjamin Recht. Learning without mixing: Towards a sharp analysis of linear system identification. Conference on Learning Theory, pp. 439–473, 2018.
491
+ Carl-Johann Simon-Gabriel, Alessandro Barp, and Lester Mackey. Metrizing weak convergence with maximum mean discrepancies. arXiv preprint arXiv:2006.09268, 2020.
492
+ Friedrich Solowjow and Sebastian Trimpe. Event-triggered learning. Automatica, 117:109009, 2020.
493
+ Michael J. Sorocky, Siqi Zhou, and Angela P. Schoellig. Experience selection using dynamics similarity for efficient multi-source transfer learning between robots. In Proc. of the IEEE International Conference on Robotics and Automation , 2020.
494
+ Bharath K Sriperumbudur, Arthur Gretton, Kenji Fukumizu, Bernhard Schölkopf, and Gert RG Lanckriet. Hilbert space embeddings and metrics on probability measures. The Journal of Machine Learning Research, 11:1517–1561, 2010.
495
+ Ingo Steinwart and Andreas Christmann. Support vector machines. Springer Science & Business Media, 2008.
496
+ Zoltán Szabó and Bharath Sriperumbudur. Characteristic and universal tensor product kernels. Journal of Machine Learning Research, 18:233, 2018.
497
+ Iris Tien, Steven D Glaser, and Michael J Aminoff. Characterization of gait abnormalities in Parkinson’s disease using a wireless inertial sensor system. In Annual International Conference of the IEEE Engineering in Medicine and Biology, pp. 3353–3356. IEEE, 2010.
498
+ I Tolstikhin, O Bousquet, S Gelly, and B Schölkopf. Wasserstein auto-encoders. In International Conference on Learning Representations (ICLR), 2018.
499
+ Jonas Umlauft and Sandra Hirche. Feedback linearization based on Gaussian processes with event-triggered online learning. IEEE Transactions on Automatic Control, 2019.
500
+ SVN Vishwanathan, Alexander J Smola, and René Vidal. Binet-Cauchy kernels on dynamical systems and its application to the analysis of dynamic scenes. International Journal of Computer Vision, 73(1):95–119, 2007.
501
+ George Wynne and Andrew B Duncan. A kernel two-sample test for functional data. Journal of Machine Learning Research, 23(73):1–51, 2022.
502
+ Wojciech Zaremba, Arthur Gretton, and Matthew Blaschko. B-test: A non-parametric, low variance kernel two-sample test. In Advances in Neural Information Processing Systems, pp. 755–763, 2013.
503
+ Kemin Zhou and John Comstock Doyle. Essentials of Robust Control, volume 104. Prentice hall Upper Saddle River, NJ, 1998.
504
+
505
+ # A Appendix
506
+
507
+ # A.1 LTI Systems
508
+
509
+ There are several aspects that we kept short in the main paper and address in the following. We consider the dynamics
510
+
511
+ $$
512
+ X _ { k + 1 } = A X _ { k } + \epsilon _ { k } ,
513
+ $$
514
+
515
+ where $\epsilon _ { k } \overset { \mathrm { i i d } } { \sim } \mathcal { N } ( 0 , \Sigma )$ . Further, assume all eigenvalues of $A \in \mathbb { R } ^ { d \times d }$ are located within the unit circle.
516
+
517
+ Stationary Distribution: The stationary distribution of an LTI system is Gaussian with expected value zero. The Gaussian distribution follows from the Gaussian noise and linear structure of the system. The expected value can be computed by leveraging that all eigenvalues of $A$ are located within the unit circle. Obtaining the variance is more involved. It can be expressed as the solution to the following Lyapunov equation in $Z$ (Schluter et al., 2020, Equation 7):
518
+
519
+ $$
520
+ A Z A ^ { \mathsf { T } } - Z + \Sigma = 0 ,
521
+ $$
522
+
523
+ where $A$ is the system matrix and $\Sigma$ the covariance matrix of the process noise.
524
+
525
+ # A.1.1 Comparison to Stationary
526
+
527
+ We investigate if we can, based on a kernel two-sample test, distinguish between time shifted samples with respect to $a ^ { * }$ and i.i.d. samples from the stationary distribution.
528
+
529
+ Setup: We create 500 randomly generated LTI systems with a random dimensionality between 1 and 100. For each system we create $m = 2 5 0$ independent trajectories and sample $n = 2 0 0 0 0$ points for each trajectory. All systems are initialized in $X _ { 0 } = 0$ to avoid transient effects. The decay of dependence is quantified in the MMD-sense for one gap (cf. sec. 5 of main paper). We use data from the end of the trajectory to avoid numerical artifacts due to the identical initial values.
530
+
531
+ ![](images/980dec426f5f3e0ee92f07227656bc7d3f89c0838999d370c56040d34440ac0c.jpg)
532
+ Figure 4: Mixing properties of the LTI system that is used to create fig. 1 in the main paper. On the $x$ -axis, we depict the time shift $a$ between consecutive samples. The $y$ -axis shows the dependence between data points with respect to the corresponding time shift. At $a ^ { * } = 7 5$ the test statistic is below the threshold.
533
+
534
+ Next, we describe how we generate the system matrices.
535
+
536
+ Sampling $\Sigma$ : The entries for the covariance matrix are drawn from a standard multivariate normal distribution. Since the matrix is supposed to yield a covariance matrix, we require symmetry and positive definiteness. Thus, we denote $\Sigma ^ { \prime }$ as the matrix drawn from the normal distribution and define $\Sigma = 0 . 5 ( \Sigma ^ { \prime } + \Sigma ^ { \prime \intercal } ) ^ { 2 }$ . To control the magnitude of noise, we scale the matrix with the largest eigenvalue of $\Sigma$ .
537
+
538
+ Sampling $A$ : The system matrix $A$ is required to have eigenvalues within the unit sphere. To achieve this, we draw the entries of $A$ from a uniform distribution and extend the system with a control input
539
+
540
+ $$
541
+ X _ { k + 1 } = A X _ { k } + B u _ { k } + \epsilon _ { k } .
542
+ $$
543
+
544
+ The control matrix $B$ is set to the identity matrix and the control input as a standard linear quadratic feedback controller $u _ { k } = - K x _ { k }$ . This yields the closed loop dynamics
545
+
546
+ $$
547
+ X _ { k + 1 } = ( A - B K ) X _ { k } + \epsilon _ { k } .
548
+ $$
549
+
550
+ The feedback gain $K$ can be computed to minimize a linear quadratic cost function. By adjusting the weights of the cost function, we can indirectly adjust the eigenvalues of the closed loop system matrix $( A - B K )$ . We set the weight matrix for the state cost $Q$ to the identity matrix and the control cost to $R = 1 0 ^ { 7 }$ . This makes it very expensive to apply large control inputs and magnitude of the eigenvalues of $( A - B K )$ stays close to 1. This implies slow mixing and further, by considering $R \to \infty$ , we can make this arbitrarily slow.
551
+
552
+ Results: First, we use the $m = 2 5 0$ trajectories to estimate the mixing speed $a ^ { * }$ . We choose $a ^ { * }$ as the firs time instance at which the test statistic is below the test threshold.
553
+
554
+ For the kernel two-sample test, we draw 100 points from the first trajectory that respect the time shift $a ^ { * }$ We also draw 100 points directly from the stationary distribution ( $\mathcal N ( 0 , Z )$ , cf. equation 39).
555
+
556
+ ![](images/d10131931125e3172891bcfdb6424be06ecb3324c874cc6faeb0472b2a765791.jpg)
557
+ Figure 5: Mixing properties of the Lorenz system. Left plot with parameters as in equation 32—equation 34 and on the right, we adapted the parameter in equation 32 to 6. On the $x$ -axis, we depict the time shift $a$ between consecutive samples. The $y$ -axis shows the dependence between data points with respect to the corresponding time shift. The initial point is randomized, and the estimation is repeated 100 times. Depicted is the mean of the test statistic and the $9 5 \%$ upper confidence bound. We also show the threshold $\kappa$ of the independence test. When the blue line is below the red line, it is not possible to infer statistical dependence between the data points.
558
+
559
+ From the 500 systems we considered overall, we only obtained 4 false positives, which shows the high precision of our proposed test. Due to the probabilistic nature of these experiments, we could obtain systems with arbitrarily slow mixing times and, subsequently, very long $a ^ { * }$ . Thus, we decided to fix a maximum $a ^ { * }$ as $a _ { \mathrm { m a x } } = 2 0 0$ , and ignore all systems with larger $a ^ { * }$ . We obtained 81 systems that mix too slowly, i.e., $a ^ { * } > a _ { \mathrm { m a x } }$ .
560
+
561
+ # A.1.2 Details for fig. 1 in the main paper:
562
+
563
+ In fig. 4, we show the mixing properties of the system that yields $a ^ { * } = 7 5$ . We used the same setup as in sec. A.1.1 with some modifications. We chose $R = 1 0 ^ { 1 0 }$ and divided $\Sigma$ by $1 0 \lambda _ { \mathrm { m a x } } ^ { 2 }$ , where $\lambda _ { \mathrm { m a x } }$ is the largest eigenvalue of $\Sigma$ . Further, to be able to better visualize the samples and the stationary distributions, we fixed the dimension to two.
564
+
565
+ The randomly generated system matrices are
566
+
567
+ $$
568
+ A = \left( { \begin{array} { l l } { 0 . 2 3 4 5 } & { 0 . 8 6 0 9 } \\ { 0 . 7 2 9 8 } & { 0 . 1 3 1 6 } \end{array} } \right) , \Sigma = \left( { \begin{array} { l l } { 0 . 0 3 7 8 } & { 0 . 0 1 3 5 } \\ { 0 . 0 1 3 5 } & { 0 . 0 9 7 1 } \end{array} } \right) .
569
+ $$
570
+
571
+ # A.2 Lorenz System
572
+
573
+ To perform kernel two-sample testing, we slightly change the parameters in the Lorenz system by decreasing the coefficient in equation 32 from 10 to 6 to obtain a second slightly different system. The mixing analysis is done for both systems. The attractors of both systems look optically very similar. The attractor can be interpreted as the stationary probability distribution of the state in some sense.
574
+
575
+ # A.2.1 Mixing properties
576
+
577
+ We estimate the mixing properties of the Lorenz system in the MMD-mixing sense for one time shift $a$ (cf. Sec.5).
578
+
579
+ Initial points: We sample from an uniform distribution $\mathcal { U } ( [ - 0 . 5 , 0 . 5 ] \times [ - 0 . 5 , 0 . 5 ] \times [ 2 0 , 2 1 ] )$ to initialize the starting point $X _ { 0 }$ .
580
+
581
+ Data: We use a standard ODE solver $^ 2$ to obtain a solution to the Lorenz system. Due to variable step sizes within the solver, we interpolate the solution to obtain samples with a fixed discretization in time. We consider the time horizon $t \in [ 0 , 2 0 0 ]$ and create 2001 samples (with a fixed time step of 0.1).
582
+
583
+ Repetitions: We create $M = 1 0 0$ independent trajectories to estimate the mixing properties. The experiment is repeated $N = 1 0 0$ times to investigate deviations in the decay of the dependence.
584
+
585
+ Estimating mixing: To avoid numerical artifacts due to the initial points and potential transients, we consider data from the end of the trajectory. Thus, we sample at $t _ { \mathrm { e n d } } = 2 0 0$ and at $t - a$ for various values of $a = 0 . 1 , 1 . 1 , : 2 . 1 , . . . , 9 9 . 1$ with respect to the continuous time index $t$ .
586
+
587
+ Results: We depict the decay of dependence in fig. 5. After waiting for $a ^ { * } = 2 0$ , the dependence in the data is not detectable anymore. Since the decay is not necessarily monotonic, we consider significantly higher time shifts up to $a = 9 9 . 1$ . The dependence does not increase again, which indicates that the system is mostly mixing in the MMD-sense. Of course, this does not prove that the Lorenz system mixes and it remains to be shown rigorously. Nonetheless, these results are promising and provide empirical evidence.
588
+
589
+ # A.2.2 Kernel Two-sample Test
590
+
591
+ We try to distinguish between the Lorenz system given in equation 32—equation 34 and a slightly disturbed system where we change the parameter in equation 32 from 10 to 6. Based on the previous mixing analysis (cf. fig. 5) we set the time shift $a ^ { * } = 2 0$ . This yields approximately independent samples for both systems.
592
+
593
+ We create two trajectories of length $t _ { \mathrm { m a x } }$ and pick $n$ points that respect the time shift $a ^ { * }$ as illustrated in fig. 2. We repeat all experiments 100 times. We start the sampling after $t = 2 0$ , which gives the system enough time to converge to the stationary distribution.
594
+
595
+ Accuracy: We use $t _ { \mathrm { m a x } } = 6 0 0 0$ and pick $n = 3 0 0$ points from both system. We achieve $9 5 \%$ accuracy in detecting different systems.
596
+
597
+ False positives: We consider two trajectories that were generated by the classical Lorenz system (equation 32—equation 34. The initial points for both trajectories were random and different. This setup yields 2.67% false positives, which is less than the $\alpha$ -level of $5 \%$ that we used.
598
+
599
+ Next, we investigate what happens if we violate $a ^ { * }$ . We choose $n = 1 0 0$ and $t _ { \mathrm { m a x } } = 3 0$ . Thus, we sample 100 points in the time interval $t \in [ 2 0 , 3 0 ]$ . This clearly violates the estimated $a ^ { * }$ and indeed, we obtain $5 1 \%$ false positives. Essentially, this makes the test useless when $a ^ { * }$ is severely violated and thus, we want to emphasize again that it is critical to estimate $a ^ { * }$ . Further, through an appropriate choice of $a ^ { * }$ we inherit all the rich theoretical properties of kernel two-sample testing.
600
+
601
+ # A.3 Non-mixing System
602
+
603
+ We construct a system that does not mix in the MMD sense and is also not expected to mix. However, the system is well known to be ergodic and stationary. In particular, we consider a dynamical system that moves on a circle with a radius of one and steps of length $\frac { \pi } { 1 0 }$ . We create $m = 1 0 0$ randomly initialized points $\theta _ { 0 }$ and iterate them for $n = 1 0 0$ timesteps with the dynamics following
604
+
605
+ $$
606
+ \theta _ { k + 1 } = \theta _ { k } + \frac { \pi } { 1 0 } ,
607
+ $$
608
+
609
+ and
610
+
611
+ $$
612
+ X _ { k + 1 } = { \binom { \cos ( \theta _ { k } ) } { \sin ( \theta _ { k } ) } }
613
+ $$
614
+
615
+ We show the mixing properties in fig. 6. The dependence between data points stays constant and does not decrease and we detect this. Thus, we correctly identify systems that are not mixing in the MMD sense.
616
+
617
+ We have also tried different increments instead of $\frac { \pi } { 1 0 }$ , such as $\frac { e } { 1 0 }$ and also $\textstyle { \frac { 1 } { 1 0 } }$ , which all resulted in the same outcome.
618
+
619
+ # A.4 Implementations
620
+
621
+ Since our method is leveraging results from standard kernel two-sample testing and the HSIC, we directly used existing implementations without modifying them.
622
+
623
+ ![](images/54d210af27d14f8e28d42eb899fe39f11151cdde91d20074ca86ba390ee6536a.jpg)
624
+ Figure 6: Mixing properties of a dynamical system that moves on a circle. The dependency between data points does not decrease and stays above the threshold.
625
+
626
+ Kernel Two-sample Test Implementation: We used the Matlab implementation: http://www.gatsby. ucl.ac.uk/\~gretton/mmd/mmd.htm and the standard hyperparameters without any tuning. We used the significance level $\alpha = 0 . 0 5$ for all experiments.
627
+
628
+ HSIC Implementation: We used the Matlab implementation: http://people.kyb.tuebingen.mpg.de/ arthur/indep.htm with standard hyperparameters and $\alpha = 0 . 0 5$ for all experiments.
parse/test/hUgBU9wgSf/hUgBU9wgSf_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/hUgBU9wgSf/hUgBU9wgSf_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/ttMwEuEPeB/ttMwEuEPeB.md ADDED
@@ -0,0 +1,440 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 3D-GPT: PROCEDURAL 3D MODELING WITH LARGE LANGUAGE MODELS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ In the pursuit of efficient automated content creation, procedural generation, leveraging modifiable parameters and rule-based systems, emerges as a promising approach. Nonetheless, it could be a demanding endeavor, given its intricate nature necessitating a deep understanding of rules, algorithms, and parameters. To reduce workload, we introduce 3D-GPT, a framework utilizing large language models (LLMs) for instruction-driven 3D modeling. 3D-GPT positions LLMs as proficient problem solvers, dissecting the procedural 3D modeling tasks into accessible segments and appointing the apt agent for each task. 3D-GPT integrates three core agents: the task dispatch agent, the conceptualization agent, and the modeling agent. They collaboratively achieve two objectives. First, it enhances concise initial scene descriptions, evolving them into detailed forms while dynamically adapting the text based on subsequent instructions. Second, it integrates procedural generation, extracting parameter values from enriched text to effortlessly interface with 3D software for asset creation. Our empirical investigations confirm that 3D-GPT not only interprets and executes instructions, delivering reliable results but also collaborates effectively with human designers. Furthermore, it seamlessly integrates with Blender, unlocking expanded manipulation possibilities. Our work highlights the potential of LLMs in 3D modeling, offering a basic framework for future advancements in scene generation and animation.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In the metaverse era, 3D content creation serves as a catalyst for transformative progress, redefining multimedia experiences in domains like gaming, virtual reality, and cinema with intricately crafted models. Yet, designers often grapple with a time-intensive 3D modeling process, starting from basic shapes (e.g., cubes, spheres, or cylinders) and employing software like Blender for meticulous shaping, detailing, and texturing. This demanding workflow concludes with rendering and post-processing to deliver the polished final model. While procedural generation holds promise with its efficiency in automating content creation through adjustable parameters and rule-based systems (Deitke et al., 2022; Greff et al., 2022; He et al., 2021; Jiang et al., 2018; Raistrick et al., 2023), it demands a comprehensive grasp of generation rules, algorithmic frameworks, and individual parameters. Furthermore, aligning these processes with the creative visions of clients, through effective communication, adds another layer of complexity. This underscores the importance of simplifying the traditional 3D modeling workflow to empower creators in the metaverse era.
12
+
13
+ LLMs have showcased exceptional language understanding capabilities, including planning and tool utilization (Imani et al., 2023; Zhang et al., 2023a; Gong et al., 2023; Zeng et al., 2022). Furthermore, LLMs demonstrate outstanding proficiency in characterizing object attributes, such as structure and texture (Menon & Vondrick, 2022; Pratt et al., 2022; Fan et al., 2023), enabling them to enhance details from rough descriptions. Additionally, they excel at parsing concise textual information and comprehending intricate code functions, while seamlessly facilitating efficient interactions with users. Driven by these extraordinary capabilities, we embark on exploring their innovative applications in procedural 3D modeling. Our primary objective is to harness the power of LLMs to exert control over 3D creation software in accordance with the requirements of clients.
14
+
15
+ In pursuit of this vision, we introduce 3D-GPT, a framework aimed at facilitating instruction-driven 3D content synthesis. 3D-GPT enables LLMs to function as problem-solving agents, breaking down the 3D modeling task into smaller, manageable components, and determining when, where, and how to accomplish each segment. 3DGPT comprises three key agents: conceptualization agent, 3D modeling agent and task dispatch agent. The first two agents collaborate harmoniously to fulfill the roles of 3D conceptualization and 3D modeling by manipulating the 3D generation functions. Subsequently, the third agent manages the system by taking the initial text input, handling subsequence instructions, and facilitating effective cooperation between the two aforementioned agents.
16
+
17
+ By doing so, they work toward two key objectives. First, it enhances initial scene descriptions, guiding them towards more detailed and contextually relevant forms while adapting the textual input based on subsequent instructions. Second, instead of directly crafting every element of 3D content, we employ procedural generation, making use of adaptable parameters and rule-based systems to interface with 3D software. Our 3D-GPT is equipped with the capability to understand procedural generation functions and extract corresponding parameter values from the enriched text.
18
+
19
+ 3D-GPT offers controllable and precise 3D generation guided by users’ textual descriptions. It reduces the workload of manually defining each controllable parameter in procedural generation, particularly within complex scenes that encompass diverse aspects. Moreover, 3D-GPT enhances collaboration with users, making the creative process more efficient and user-centric. Furthermore, 3D-GPT seamlessly interfaces with Blender, granting users diverse manipulation capabilities: object transformations, material adjustments, primitive additions, object animations, mesh editing, and physical motion simulations. Based on our experiments, we posit that LLMs exhibit the potential to handle more intricate visual inputs. Our contributions are summarized as follows:
20
+
21
+ • Introducing 3D-GPT, a training-for-free framework designed for 3D scene generation. Our approach leverages the innate multimodal reasoning capabilities of LLMs, streamlining the efficiency of end-users engaged in procedural 3D modeling. Exploration of an alternative path in text-to-3D generation, wherein our 3D-GPT generates Python codes to control 3D software, potentially offering increased flexibility for realworld applications.
22
+ • Empirical experiments demonstrate the substantial potential of LLMs in terms of their reasoning, planning, and tool-using capabilities in 3D content generation.
23
+
24
+ # 2 RELATED WORK
25
+
26
+ # 2.1 TEXT-TO-3D GENERATION
27
+
28
+ With the recent advance in text-to-image generation modeling, there has been a growing interest in text-to-3D generation (Sanghi et al., 2022; Poole et al., 2022; Lin et al., 2023; Xu et al., 2023; Metzer et al., 2023; Wang et al., 2023; Xu et al., 2023; Mohammad Khalid et al., 2022; Jain et al., 2022). The common paradigm of them is to perform per-shape optimization with differentiable rendering and the guidance of the CLIP model (Radford et al., 2021) or 2D diffusion models (Rombach et al., 2022). For example, DreamFields (Jain et al., 2022) and CLIP-Mesh (Mohammad Khalid et al., 2022) explore zero-shot 3D content creation using only CLIP guidance. Dreamfusion (Poole et al., 2022) optimizes NeRF Mildenhall et al. (2021) with the guidance of a text-to-image diffusion model, achieving remarkable text-to-3D synthesis results. Further works in this direction have resulted in notable enhancements in visual quality (Lin et al., 2023; Melas-Kyriazi et al., 2023), subject-driven control (Raj et al., 2023; Metzer et al., 2023), and overall processing speed (Liu et al., 2023; Jain et al., 2022). Unlike the above approaches, our objective is not to generate conventional neural representations as the final 3D output. Instead, we utilize LLMs to generate Python code that controls Blender’s 3D modeling based on the provided instructions.
29
+
30
+ # 2.2 LARGE LANGUAGE MODELS
31
+
32
+ Large language models (LLMs) are a promising approach to capture and represent the compressed knowledge and experiences of humans, projecting them into language space (Devlin et al., 2018; Raffel et al., 2020; OpenAI, 2023; Chowdhery et al., 2022; Bubeck et al., 2023). LLMs have consistently showcased remarkable performance extending beyond canonical language processing domains. They exhibit the capability to address intricate tasks that were once considered the exclusive domain of specialized algorithms or human experts. These tasks encompass areas such as mathematical reasoning (Imani et al., 2023; Wei et al., 2022), medicine (Jeblick et al., 2022; Yang et al.,
33
+
34
+ 2023), and planning (Zhang et al., 2023a; Gong et al., 2023; Huang et al., 2023; 2022) Our work explores the innovative application of LLMs in 3D modeling, employing them to control 3D procedural generation.
35
+
36
+ # 3 3D-GPT
37
+
38
+ # 3.1 TASK FORMULATION
39
+
40
+ The overall objective is the generation of 3D content based on a sequence of relatively short natural language instructions, denoted as $\mathcal { L } = \langle L _ { i } \rangle$ . The initial instruction, designated as $L _ { 0 }$ , serves as a comprehensive description of the 3D scene, such as $^ { 6 6 } A$ misty spring morning, where dew-kissed flowers dot a lush meadow surrounded by budding trees”. Subsequent instructions are employed to modify the existing scene, as exemplified by instructions like “transform the white flowers into yellow flower” or “translate the scene into a winter setting” to add detail.
41
+
42
+ To accomplish this objective, we introduce a framework named 3D-GPT, which empowers LLMs to act as problem-solving agents. We point out that employing LLMs to directly create every element of 3D content poses significant challenges. LLMs lack specific pre-training data for proficient 3D modeling and, as a result, may struggle to accurately determine what elements to use and how to modify them based on given instructions. To address this challenge, we employ procedural generation to control the 3D content creation. This makes use of adaptable parameters and rule-based systems to interface with 3D software (e.g., Blender) so as to efficiently conduct 3D modeling (Deitke et al., 2022; Greff et al., 2022; He et al., 2021; Jiang et al., 2018; Raistrick et al., 2023). Nevertheless, there are several challenges that remain such as identifying the correct procedures to call and mapping of language to API parameters. We solve these using multiple language agents as will be discussed below.
43
+
44
+ Our approach conceptualizes the 3D procedural generation engine as a set of functions, denoted as $\mathcal { F } = \{ F _ { j } \}$ , where each function $F _ { j }$ takes parameters $P _ { j }$ . For example, add trees(scene, density, distance min, leaf type, fruit type) will takes a built natural scene as input and adds base trees to it.
45
+
46
+ Within our 3D-GPT framework, for each language instruction $L _ { i }$ , we formulate the modeling task as first selecting the subset of relevant functions ${ \hat { \mathcal { F } } } \subseteq { \mathcal { F } }$ , and then inferring the corresponding parameters $P _ { j }$ for each function $F _ { j }$ in this subset. The ultimate aim is to ensure that the functions in $\hat { \mathcal { F } }$ collectively generates a 3D scene that aligns with the descriptions provided in $\mathcal { L }$ . By adeptly addressing both function selection and parameter inference for every sub-instruction $L _ { i }$ , 3D-GPT generates a Python script file that allows Blender’s 3D modeling environment to render high-quality scenes consistent with the instruction sequence $\mathcal { L }$ .
47
+
48
+ # 3.2 MODELING TOOL PREPARATION
49
+
50
+ In our framework, we utilize Infinigen Raistrick et al. (2023), a Python-Blender-based procedural generator equipped with a rich library of generation functions. To empower LLMs with the ability to proficiently leverage Infinigen, we provide following crucial language prompts for each function $F _ { j }$ :
51
+
52
+ • Documentation $( D _ { j } )$ : A comprehensive explanation of the function’s purpose and clear description of it’s parameters $P _ { j }$ as one would find in standard API documentation.
53
+ • API code $( C _ { j } )$ : Restructured and highly readable function code, ensuring that it is accessible and comprehensible for LLMs.
54
+ • Auxiliary parameter information $( I _ { j } )$ : Outlines specific information required to infer the function parameters, thereby assisting LLMs in understanding the context and prerequisites of each function. For example, in the case of a flower generation function, $I _ { j }$ indicates the required visual properties for rendering, such as flower color, flower petal appearance (e.g., size, curve, and length), and flower center appearance.
55
+ • Usage examples $( E _ { j } )$ : Illustrative examples that demonstrate how to infer the parameter $P _ { j }$ from the accompanying text descriptions and subsequently invoke the function. Continuing with the example of a flower generation function, $E _ { j }$ includes a practical demonstration of how to infer the parameters and call the function based on input text like “a sunflower”
56
+
57
+ By providing LLMs with these resources, we enable them to leverage their generative competencies in planning, reasoning, and tool utilization. As a result, LLMs can effectively harness Infinigen for 3D generation based on language instructions in a seamless and efficient manner. In the context of our work, the function set $\mathcal { F }$ encompasses all functions and subfunctions within the Infinigen scene generation script, with the sole exception of the ’creatures’ class. These functions play an indispensable role in our scene creation process. In the supplementary material, Section 6.4 presents a comprehensive list of all the functions by the script we utilized to construct the scenes. Additionally, we provide examples for using some of these functions in Section 6.8, Figure 14 and Figure 13.
58
+
59
+ 3.3 MULTI-AGENTS FOR 3D REASONING, PLANING AND TOOL USING
60
+
61
+ With the necessary tool preparation (i.e., $D _ { j }$ , $C _ { j }$ , $I _ { j }$ and $E _ { j }$ ) in hand, 3D-GPT employs a multi-agent system to tackle the task of language-guided procedural 3D modeling. This system comprises three integral agents: (1) the task dispatch agent, (2) the conceptualization agent, and (3) the modeling agent, illustrated in Figure 1. Together, these agents decompose modeling task into manageable segments, with each agent specializing in distinct aspects: planning, 3D reasoning, and tool utilization. The task dispatch agent plays a pivotal role in the planning process. It leverages user instructions to query function documents and subsequently selects the requisite functions for execution. Once functions are selected, the conceptualization agent engages in reasoning to enrich the user-provided text description. Building upon this, the modeling agent deduces the parameters for each selected function and generates Python code scripts to invoke Blender’s API, facilitating the creation of the corresponding 3D content. From there, images can be generated using Blender rendering capability.
62
+
63
+ Task Dispatch Agent for Planing. The task dispatch agent, armed with comprehensive information of all available functions $\mathcal { F }$ as described above, efficiently identifies the requisite functions for each instructional input. For example, when presented with an instruction such as “translate the scene into a winter setting”, it pinpoints functions like add snow layer and update trees. This pivotal role played by the task dispatch agent is instrumental in facilitating efficient task coordination between the conceptualization and modeling agents. Without it, the conceptualization and the modeling agents have to analyze all provided functions $\mathcal { F }$ for each given instruction. This not only increases the workload for these agents but also extends processing time and can potentially lead to undesired modifications. The communication flow between the LLM system, the user, and the task dispatch agent is outlined as follows:
64
+
65
+ — LLM System: You are a proficient planner for selecting suitable functions based on user instructions. You are provided with the following functions: $\langle ( F _ { j } ^ { n a m e } , F _ { j } ^ { u s a g e } ) \rangle$ . Below are a few examples of how to choose functions based on user instructions: $\langle E _ { j } ^ { t a s k \lrcorner d i s p a t c h } \rangle$ . — User: My instruction is: $\left. L _ { i } \right.$ . — Task Dispatch Agent: Given the instruction $\left. L _ { i } \right.$ , we determine the sublist of functions $\hat { \mathcal { F } }$ that need to be used for $3 D$ modeling.
66
+
67
+ Here $\langle ( F _ { j } ^ { n a m e } , F _ { j } ^ { u s a g e } ) \rangle$ represents a list of function names and concise function usage descriptions for all available functions and examples $\langle E ^ { t a s k \lrcorner d i s p a t c h } \rangle$ provide guided examples for prompt-based instructions. A example is provided in the supplementary Figure 10.
68
+
69
+ Conceptualization Agent for Reasoning. The user instruction may not explicitly provide sufficient details needed for modeling. For instance, consider the instruction, “a misty spring morning, where dew-kissed flowers dot a lush meadow surrounded by budding trees”. Here many necessary details required function parameters such as tree branch length, tree size, and leaf type, are not directly stated in the given text. When instructing the modeling agent to infer parameters directly, we observed that it tends to provide simplistic solutions, such as using default or copying values from prompting examples. This reduces diversity in generation and complicates parameter inference.
70
+
71
+ To address this issue, we introduce the conceptualization agent which collaborates with the task dispatch agent to augment the user-provided text description $( L _ { i } )$ . After the task dispatch agent selects the required functions, we send the user input text and the corresponding function-specific information to the conceptualization agent and request augmented text. For each function $F _ { j }$ , it enriches $L _ { i }$ into detailed appearance descriptions $L _ { i } ^ { j }$ . The communication between the system and the Conceptualization Agent for instruction $\langle L _ { i } \rangle$ and function $\langle F _ { j } \rangle$ is as follows:
72
+
73
+ ![](images/8c19d6010d7fa4e4ec8e4985f0beb8f93880a09328a36a87e3c03f48a2c224c7.jpg)
74
+ Figure 1: 3D-GPT Overview. 3D-GPT employs LLMs as a multi-agent system with three collaborative agents for procedural 3D generation. These agents consult documents from the procedural generator, infer function parameters, and produce Python code. The generated code script interfaces with Blender’s API for 3D content creation and rendering.
75
+
76
+ — LLM System: You are a skilled writer, especially when it comes to describing the appearance of objects and large scenes. Given a description $\langle L _ { i } \rangle$ , provide detailed descriptions for the following information $\langle I _ { j } \rangle$ . For terms not mentioned in the description, use your imagination to ensure they fit the text description.
77
+ — Conceptualization Agent: Given the $\left. L _ { i } \right.$ and requested information $\langle I _ { j } \rangle$ , the extended description is: $\langle \widehat { L _ { i } ^ { j } } \rangle$ .
78
+
79
+ # We have illustrated a communication example in Figure 11 within the supplementary material.
80
+
81
+ Modeling Agent for Tool Using. After conceptualization, the 3D modeling processing is invoked to convert the detailed human language to machine-understandable language. In our framework, our modeling agent employs the functions of procedural modeling in the library to create a realistic 3D model. For each function $F _ { j }$ and user instruction $L _ { i }$ , the task dispatch agent receive augmented context $\widehat { L _ { i } ^ { j } }$ from the conceptualization agent. For each function $F _ { j }$ , we have the code $C _ { j }$ , function documentation $D _ { j }$ , and one usage example $E _ { j }$ . The modeling agent utilizes this information to select the appropriate functions and deduce the corresponding parameters. Subsequently, the modeling agent generates Python code that calls the selected function in the right context (e.g., within a loop), passing in parameters inferred from the text and of the appropriate data type.
82
+
83
+ The communication between System and Modeling Agent are based on the following pattern:
84
+
85
+ — LLM System: You are a good 3D designer who can convert long text descriptions into parameters, and is good at understanding Python functions to manipulate $3 D$ content. Given the text description $\langle \widehat { L _ { i } ^ { f } } \rangle$ , we have the following function codes $\langle C _ { j } \rangle$ and the document for function $\langle D _ { j } \rangle$ . Below is an example bout how to make function calls to model the scene to fit the description: $\langle E _ { j } ^ { m o d e l i n g } \rangle$ . Understand the function, and model the $3 D$ scene that fits the text description by making a function call. — Modeling Agent: Given the description $\langle \widehat { L _ { i } ^ { j } } \rangle$ , we use the following functions: ..., and their respective parameter values ... are adopted.
86
+
87
+ We have illustrated a communication example in Figure 12 within the supplementary material.
88
+
89
+ Blender Rendering. The modeling agent ultimately constructs the Python function calls with inferred parameters, which are supplied to Blender for controlling view ports and rendering, and thereby resulting in production of the final 3D mesh and RGB results.
90
+
91
+ Implementation Detail. Our implementation relies on the Infinigen Raistrick et al. (2023) API, and the specific function set $\cdot$ utilized in our work is available in the generation script provided in
92
+
93
+ ![](images/79fe7ec376053d6c834b23eaf63dd45879555cbfd34d4320bca808e40b11ba19.jpg)
94
+ Figure 2: Visual Examples of Instruction-Based 3D Scene Generation. 3D-GPT can construct large 3D scenes that align with the provided initial instruction. We demonstrate that the rendered images contain various visual factors in line with the given instructions.
95
+
96
+ Supplementary Material, as detailed in Section 6.4. We have developed our system using the OpenAI API, and the code implementation for our modeling agent can also be found in Supplementary Material, Section 6.4. This code demonstrates the ease with which our system can be implemented.
97
+
98
+ # 4 EXPERIMENTS
99
+
100
+ Our experimentation begins by showcasing the proficiency of 3D-GPT in consistently generating results that align with user instructions, encompassing scenarios involving both large scenes and individual objects. Subsequently, we delve into specific examples to illustrate how our agents effectively comprehend tool functionalities, access necessary knowledge, and employ it for precise control. To deepen our understanding, we conduct an ablation study to systematically examine the contributions of each agent within our multi-agent system.
101
+
102
+ # 4.1 3D MODELING
103
+
104
+ Large Scene Generation. We investigate the capability of 3D-GPT to control modeling tools based on scene descriptions without any training. To conduct this experiment, we generated 100 scene descriptions using ChatGPT with the following prompt: “You are a good writer, provide 10 different natural scene descriptions for me”. We collected responses to this prompt 10 times to form our dataset. In Figure 2, we present the multi-view rendering results of 3D-GPT. These results indicate that our approach is capable of generating large 3D scenes that generally align well with the provided text descriptions, showcasing a noticeable degree of diversity. Notably, all 3D outcomes are directly rendered using Blender, ensuring that all meshes are authentic, thereby enabling our method to achieve absolute 3D consistency and produce real ray-tracing rendering results.
105
+
106
+ Fine-detail Control for Single Class. Apart from generating large scenes from concise descriptions, we assess the capabilities of 3D-GPT for modeling objects. We evaluate crucial factors such as curve modeling, shape control, and an in-depth understanding of object appearances. To this end, we report the results of fine-grained object control. This includes nuanced aspects such as object curves, key appearance features, and color, all derived from input text descriptions. We employ random prompts to instruct GPT for various real-world flower types. As depicted in Figure 3, our method adeptly models each flower type, faithfully capturing their distinct appearances. This study underscores the potential of 3D-GPT in achieving precise object modeling and fine-grained attribute control of object types and visual characteristics.
107
+
108
+ Subsequence Instruction Editing. Here, we test the ability of 3D-GPT for effective human-agent communication and task manipulation. In Figure 4, we observe that our method can comprehend subsequence instructions and make accurate decisions for scene modification. Note that, unlike the existing text-to-3D methods, 3D-GPT maintains a memory of all prior modifications, thereby facilitating the connection of new instructions with the scene’s context. Furthermore, our method eliminates the need for additional networks for controllable editings Zhang et al. (2023b). This study underscores the efficiency and versatility of 3D-GPT in adeptly handling complex subsequence instructions for 3D modeling.
109
+
110
+ ![](images/94d6b9cbb93a9a30ee305a197935daeba1a4962038f3677e52a5a8e64cb2c8e8.jpg)
111
+ Figure 3: Single Class Control Result. Our method effectively acquires the necessary knowledge for modeling, enabling precise object control in terms of shape, curve, and key appearance capture. The generated results closely align with the given text.
112
+
113
+ ![](images/00cdc35a03955b9cc6e8ee9cc3cb4240af4f74e3e53d0e2d392870a463441337.jpg)
114
+ Figure 4: Subsequence Instruction Editing Result. (a) Initial instruction-generated scene. (b)-(f) Sequential editing steps with corresponding instructions. Our method enables controllable editing and effective user-agent communication.
115
+
116
+ Individual Function Control To evaluate the effectiveness of 3D-GPT in tool utilization, we present an illustrative example that highlights our method’s ability to control individual functions and infer parameters. Figure 5 exemplifies the capability of 3D-GPT to model sky appearances based on input text descriptions. It is worth noting that the function responsible for generating the sky texture does not directly correlate color information with sky appearance. Instead, it relies on the Nishita-sky modeling method, which requires a profound understanding of real-world sky and weather conditions, considering input parameters. Our method adeptly extracts crucial information from the textual input and comprehends how each parameter influences the resulting sky appearance, as evident in Figure 5 (c) and (d). These results demonstrate that our method can effectively use individual functions as well as infer corresponding parameters.
117
+
118
+ ![](images/ac9a6a6a4013b4893fc7bee3163cf3e25d03e0e3b416269bc428da93c1ead422.jpg)
119
+ Figure 5: Single Function Control Result. Visual result (top) and modeling agent response example (bottom). Our method demonstrates a high degree of accuracy in inferring algorithm parameters, even when they do not possess a direct connection to visual appearance.
120
+ (a) Ablation Study of Task Dispatch Agent.
121
+
122
+ # 4.2 ABLATION STUDY
123
+
124
+ We conduct separate ablation studies for the Conceptualization Agent and Task Dispatch Agent. Our assessment focused on CLIP scores (Radford et al., 2021), failure rates, and parameter diversity, quantified using the categorical Shannon Diversity Index. The CLIP score measures the alignment between text and generated images. The failure rate represents the percentage of system failures due to issues such as incorrect datatypes, wrong response patterns, or missing parameters from the Modeling Agent. Parameter diversity aims to gauge the diversity of generated outputs.
125
+
126
+ <table><tr><td>Metrics/ Method</td><td>CLIP Score</td></tr><tr><td>w/o TDA Ours</td><td>22.79 29.16</td></tr></table>
127
+
128
+ <table><tr><td>Metrics/ Method</td><td>CLIP Score</td><td>Failure Rate</td><td>Parameter Diversity</td></tr><tr><td>w/o CA</td><td>21.51</td><td>3.6%</td><td>6.32</td></tr><tr><td>Ours</td><td>30.30</td><td>0.8%</td><td>7.34</td></tr></table>
129
+
130
+ (b) Ablation Study of Conceptualization Agent.
131
+
132
+ Table 1: Ablation Study. “w/o CA” indicates without the Conceptualization Agent, “w/o TDA” indicates without the Task Dispatch Agent.
133
+
134
+ Case Study of Task Dispatch Agent. For the Task Dispatch Agent, the CLIP score is measured using 100 initial scene descriptions, each appended with one additional subsequence instruction for each scene. Table 1 (a) shows that without the Task Dispatch Agent, the CLIP score dropped from 29.16 to 22.79. It is important to note that the Task Dispatch Agent primarily impacts the performance of subsequence instructions, as all functions are utilized for the initial instruction. These findings underscore the pivotal role of the Task Dispatch Agent in managing communication flow.
135
+
136
+ Case Study of conceptualization Agent. For the Conceptualization Agent, the CLIP score is measured using 100 initial scene descriptions. Table 1 (b) displays the results, indicating that without the
137
+
138
+ ![](images/ef046923e03741b5ac8fea9ae13ac6e8d69c8aef4bd187bfc69022d3537f83f9.jpg)
139
+ Figure 6: Conceptualization Agent Case Study. The enriched textual evidence demonstrates that the Conceptualization Agent provides essential knowledge for parameter inference (highlighted in green). For each subfigure, we compare the 3D model without (Top) and with (Bottom) agent. The models generated with the agent better match the text description than those without it .
140
+
141
+ Conceptualization Agent, both text alignments (CLIP score) and parameter diversity decreased significantly. Moreover, the failure rate increased substantially, which adversely impacts the efficiency of the entire modeling process. Figure 6 illustrates how the Conceptualization Agent facilitates the acquisition of essential knowledge for 3D modeling, providing a visual comparison of results with and without its involvement. When the Conceptualization Agent is engaged, the generated results closely align with the appearance of the intended flower type, highlighting its invaluable contribution to elevating overall 3D generation quality and fidelity.
142
+
143
+ # 5 DISCUSSION AND CONCLUSION
144
+
145
+ We have introduced 3D-GPT, a novel training-free framework for instruction-driven 3D modeling seamlessly integrated with procedural generation. Leveraging the capabilities of LLMs, 3DGPT aims to enhance human-AI communication in the context of 3D design. Our approach involves the collaborative efforts of three agents functioning as a cohesive 3D modeling team, ultimately yielding a 3D modeling file as output, as opposed to conventional 3D neural representations. Moreover, our method consistently delivers high-quality results, showcases adaptability to expansive scenes, ensures 3D consistency, provides material modeling and editing capabilities, and facilitates real ray tracing for achieving lifelike visualizations. Our empirical experiments show the potential of LLMs for reasoning, planning, and tool using in procedural 3D modeling.
146
+
147
+ Limitations and Potential Directions. While our framework has demonstrated promising 3D modeling results closely aligned with user instructions, it is essential to acknowledge several limitations: 1) Limited curve control and shading design: Currently, our framework lacks advanced capabilities for precise curve control and intricate shading design. Tasks involving the manipulation of tree branches or the blending of colors for leaf textures remain challenging. 2) Dependence on procedural generation algorithms: the effectiveness of our framework is contingent on the quality and availability of procedural generation algorithms. This reliance may limit results in specific categories, such as hair and fur. 3) Handling multi-modal instructions: challenges arise in processing multi-modal instructions, including audio and image inputs, potentially leading to information loss. These limitations offer valuable insights for shaping future research and development in the field. We highlight three compelling directions for future investigation:
148
+
149
+ LLM 3D Fine-Tuning: It is promising to fine-tune LLMs to enhance their capabilities in geometry control, shading design, and fine-texture modeling. This refinement will make LLMs more adept at handling intricate 3D modeling tasks and grant greater creative control over the resulting 3D scenes. Autonomous Rule Discovery: Building on the demonstrated tool-making capabilities of LLMs, one direction is to develop an autonomous 3D modeling system that reduces human involvement. This could empower LLMs to autonomously discover generation rules for new object classes and scenes, thus expanding the creative potential.
150
+
151
+ Multi-Modal Instruction Processing: To achieve more comprehensive and expressive 3D modeling based on varied user inputs, it is crucial to enhance the system’s ability to comprehend and respond to multi-modal instructions. This would facilitate richer and more diverse 3D modeling outcomes, shaped by a broader spectrum of user inputs.
152
+
153
+ # REFERENCES
154
+
155
+ Sebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece ´ Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, Harsha Nori, Hamid Palangi, Marco Tulio Ribeiro, and Yi Zhang. Sparks of artificial general intelligence: Early experiments with GPT-4. arXiv preprint arXiv:2303.12712, 2023.
156
+ 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. arXiv preprint arXiv:2204.02311, 2022.
157
+ Matt Deitke, Eli VanderBilt, Alvaro Herrasti, Luca Weihs, Kiana Ehsani, Jordi Salvador, Winson Han, Eric Kolve, Aniruddha Kembhavi, and Roozbeh Mottaghi. ProcTHOR: Large-scale embodied ai using procedural generation. Advances in Neural Information Processing Systems, 35: 5982–5994, 2022.
158
+ 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.
159
+ Lijie Fan, Dilip Krishnan, Phillip Isola, Dina Katabi, and Yonglong Tian. Improving clip training with language rewrites. arXiv preprint arXiv:2305.20088, 2023.
160
+ Ran Gong, Qiuyuan Huang, Xiaojian Ma, Hoi Vo, Zane Durante, Yusuke Noda, Zilong Zheng, Song-Chun Zhu, Demetri Terzopoulos, Li Fei-Fei, and Jianfeng Gao. MindAgent: Emergent gaming interaction. arXiv preprint arXiv:2309.09971, 2023.
161
+ Klaus Greff, Francois Belletti, Lucas Beyer, Carl Doersch, Yilun Du, Daniel Duckworth, David J Fleet, Dan Gnanapragasam, Florian Golemo, Charles Herrmann, Thomas Kipf, Abhijit Kundu, Dmitry Lagun, Issam Laradji, Hsueh-Ti (Derek) Liu, Henning Meyer, Yishu Miao, Derek Nowrouzezahrai, Cengiz Oztireli, Etienne Pot, Noha Radwan, Daniel Rebain, Sara Sabour, Mehdi S. M. Sajjadi, Matan Sela, Vincent Sitzmann, Austin Stone, Deqing Sun, Suhani Vora, Ziyu Wang, Tianhao Wu, Kwang Moo Yi, Fangcheng Zhong, and Andrea Tagliasacchi. Kubric: A scalable dataset generator. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3749–3761, 2022.
162
+ Ju He, Enyu Zhou, Liusheng Sun, Fei Lei, Chenyang Liu, and Wenxiu Sun. Semi-synthesis: A fast way to produce effective datasets for stereo matching. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2884–2893, 2021.
163
+ Wenlong Huang, Pieter Abbeel, Deepak Pathak, and Igor Mordatch. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. In International Conference on Machine Learning, pp. 9118–9147, 2022.
164
+ Wenlong Huang, Chen Wang, Ruohan Zhang, Yunzhu Li, Jiajun Wu, and Li Fei-Fei. VoxPoser: Composable 3D value maps for robotic manipulation with language models. arXiv preprint arXiv:2307.05973, 2023.
165
+ Shima Imani, Liang Du, and Harsh Shrivastava. Mathprompter: Mathematical reasoning using large language models. arXiv preprint arXiv:2303.05398, 2023.
166
+ 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, pp. 867–876, 2022.
167
+ Katharina Jeblick, Balthasar Schachtner, Jakob Dexl, Andreas Mittermeier, Anna Theresa Stuber, ¨ Johanna Topalis, Tobias Weber, Philipp Wesp, Bastian Sabel, Jens Ricke, and Michael Ingrisch. ChatGPT makes medicine easy to swallow: An exploratory case study on simplified radiology reports. arXiv preprint arXiv:2212.14882, 2022.
168
+ Chenfanfu Jiang, Siyuan Qi, Yixin Zhu, Siyuan Huang, Jenny Lin, Lap-Fai Yu, Demetri Terzopoulos, and Song-Chun Zhu. Configurable 3D scene synthesis and 2D image rendering with per-pixel ground truth using stochastic grammars. International Journal of Computer Vision, 126:920–941, 2018.
169
+ 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, pp. 300–309, 2023.
170
+ Minghua Liu, Chao Xu, Haian Jin, Linghao Chen, Zexiang Xu, Hao Su, et al. One-2-3-45: Any single image to 3D mesh in 45 seconds without per-shape optimization. arXiv preprint arXiv:2306.16928, 2023.
171
+ Luke Melas-Kyriazi, Christian Rupprecht, Iro Laina, and Andrea Vedaldi. Realfusion: 360 reconstruction of any object from a single image. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, 2023.
172
+ Sachit Menon and Carl Vondrick. Visual classification via description from large language models. arXiv preprint arXiv:2210.07183, 2022.
173
+ Gal Metzer, Elad Richardson, Or Patashnik, Raja Giryes, and Daniel Cohen-Or. Latent-NeRF for shape-guided generation of 3D shapes and textures. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12663–12673, 2023.
174
+ 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. Communications of the ACM, 65(1):99–106, 2021.
175
+ 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.
176
+ OpenAI. GPT-4 technical report, 2023.
177
+ Ben Poole, Ajay Jain, Jonathan T Barron, and Ben Mildenhall. DreamFusion: Text-to-3D using 2D diffusion. arXiv preprint arXiv:2209.14988, 2022.
178
+ Sarah Pratt, Ian Covert, Rosanne Liu, and Ali Farhadi. What does a platypus look like? generating customized prompts for zero-shot image classification. arXiv preprint arXiv:2209.03320, 2022.
179
+ 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.
180
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1–67, 2020.
181
+ Alexander Raistrick, Lahav Lipson, Zeyu Ma, Lingjie Mei, Mingzhe Wang, Yiming Zuo, Karhan Kayan, Hongyu Wen, Beining Han, Yihan Wang, Alejandro Newell, Hei Law, Ankit Goyal, Kaiyu Yang, and Jia Deng. Infinite photorealistic worlds using procedural generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12630–12641, 2023.
182
+ Amit Raj, Srinivas Kaza, Ben Poole, Michael Niemeyer, Ben Mildenhall, Nataniel Ruiz, Shiran Zada, Kfir Aberman, Michael Rubenstein, Jonathan Barron, Yuanzhen Li, and Varun Jampani. DreamBooth3D: Subject-driven text-to-3D generation. In Proceedings of the International Conference on Computer Vision, 2023.
183
+ Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High- ¨ resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 10684–10695, 2022.
184
+ Aditya Sanghi, Hang Chu, Joseph G Lambourne, Ye Wang, Chin-Yi Cheng, Marco Fumero, and Kamal Rahimi Malekshan. CLIP-Forge: Towards zero-shot text-to-shape generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18603–18613, 2022.
185
+ Zhengyi Wang, Cheng Lu, Yikai Wang, Fan Bao, Chongxuan Li, Hang Su, and Jun Zhu. ProlificDreamer: High-fidelity and diverse text-to-3d generation with variational score distillation. arXiv preprint arXiv:2305.16213, 2023.
186
+ Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc Le, and Denny Zhou. Chain-of-thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35:24824–24837, 2022.
187
+ 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. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 20908–20918, 2023.
188
+ Kailai Yang, Shaoxiong Ji, Tianlin Zhang, Qianqian Xie, and Sophia Ananiadou. On the evaluations of ChatGPT and emotion-enhanced prompting for mental health analysis. arXiv preprint arXiv:2304.03347, 2023.
189
+ Andy Zeng, Maria Attarian, Brian Ichter, Krzysztof Choromanski, Adrian Wong, Stefan Welker, Federico Tombari, Aveek Purohit, Michael Ryoo, Vikas Sindhwani, Johnny Lee, Vincent Vanhoucke, and Pete Florence. Socratic models: Composing zero-shot multimodal reasoning with language. arXiv preprint arXiv:2204.00598, 2022.
190
+ Ceyao Zhang, Kaijie Yang, Siyi Hu, Zihao Wang, Guanghe Li, Yihang Sun, Cheng Zhang, Zhaowei Zhang, Anji Liu, Song-Chun Zhu, Xiaojun Chang, Junge Zhang, Feng Yin, Yitao Liang, and Yaodong Yang. Proagent: Building proactive cooperative ai with large language models. arXiv preprint arXiv:2308.11339, 2023a.
191
+ Lvmin Zhang, Anyi Rao, and Maneesh Agrawala. Adding conditional control to text-to-image
192
+
193
+ diffusion models. In IEEE International Conference on Computer Vision (ICCV), 2023b.
194
+
195
+ # 6 APPENDIX
196
+
197
+ # 6.1 ADDITIONAL RESULT
198
+
199
+ We kindly request the reader to consider visiting https://anonymous0888.github.io/ 3DGPT/3dgpt.html to view our high-quality 3D results.
200
+
201
+ # 6.2 ADDITIONAL ABLATION STUDY
202
+
203
+ We conduct three distinct ablation studies examining prompting components (Table 2), various Large Language Models (Table 3), and example numbers (Table 4).
204
+
205
+ Table 2: Ablation Study of Prompting Components D/C/I/E.
206
+
207
+ <table><tr><td>Metrics/Method</td><td>CLIP Score</td><td>Failure Rate</td><td>Parameter Diversity</td></tr><tr><td>w/o D</td><td>20.7</td><td>4.2%</td><td>6.94</td></tr><tr><td>w/o C</td><td>28.4</td><td>1.8%</td><td>6.74</td></tr><tr><td>w/oI</td><td>21.6</td><td>1.4%</td><td>6.38</td></tr><tr><td>w/oE</td><td>24.5</td><td>3.4%</td><td>7.89</td></tr><tr><td>Ours</td><td>30.3</td><td>0.8%</td><td>7.34</td></tr></table>
208
+
209
+ Table 3: Ablation Study of Different Large Language Model.
210
+
211
+ <table><tr><td>Metrics/Model</td><td>CLIP Score</td><td>Failure Rate</td><td>Parameter Diversity</td></tr><tr><td>LLAMA2</td><td>29.7</td><td>1.4%</td><td>6.97</td></tr><tr><td>GPT4</td><td>31.2</td><td>0.6%</td><td>7.23</td></tr><tr><td>GPT3.5</td><td>30.3</td><td>0.8%</td><td>7.34</td></tr></table>
212
+
213
+ Table 4: Ablation Study of Example Number.
214
+
215
+ <table><tr><td>Metrics/Shots</td><td>CLIP Score</td><td>Failure Rate</td><td>Parameter Diversity</td></tr><tr><td>0</td><td>24.5</td><td>3.4%</td><td>7.89</td></tr><tr><td>1</td><td>30.3</td><td>0.8%</td><td>7.34</td></tr><tr><td>2</td><td>30.1</td><td>1.0%</td><td>7.23</td></tr><tr><td>3</td><td>30.2</td><td>0.8%</td><td>6.93</td></tr></table>
216
+
217
+ ![](images/09aeb3f0c8468c9465e0508588c5b431c7665fe1928ef395851b609c6363ca5f.jpg)
218
+ DreamFusion
219
+ Ours
220
+ DreamFusion
221
+ “A misty spring morning, where dew-kissed flowers dot a lush meadow surrounded by budding trees.”
222
+
223
+ ![](images/acbb643400cbc820396e2dd7f49f0ca7630f1e9bbc8dc9c705de239615aded89.jpg)
224
+ Ours
225
+
226
+ Ours
227
+
228
+ DreamFusion
229
+
230
+ ![](images/a2799aa44df6e2ed444cab10714afb180d018e4537b76f7db9702ab545e61081.jpg)
231
+
232
+ ![](images/85432c967b74f3304419bf98327c73ee5f6847a14ee0fb0ee1ea54a466dee5fd.jpg)
233
+ ���A vibrant autumn forest, with trees ablaze in shades of red, orange, and gold, as a gentle breeze rustles the fallen leaves.”
234
+
235
+ “A serene winter landscape, with snow-covered evergreen trees and a frozen lake reflecting the pale sunlight.”
236
+
237
+ “The mountains, majestic and snow-capped, stood like sentinels guarding the vast expanse of the valley, their peaks disappearing into the swirling mist that clung to their rugged slopes.”
238
+
239
+ “The desert, an endless sea of shifting sands, stretched to the horizon, its rippling dunes catching the golden rays of the setting sun, creating an everchanging landscape of shadows and light.”
240
+
241
+ ![](images/7db1db29eb3ed7d4208c0cbd81e994b17421f7731cc9032db794dfa171e25708.jpg)
242
+ Figure 7: Comparison with Dreamfusion (Scene).
243
+
244
+ ![](images/a82585ecd6901f838a14b107c46087b8044ff9ea2ef61e7c26454a77ae2b0ceb.jpg)
245
+ “The lake, serene and glassy, mirrored the cloudless sky above, reflecting the surrounding mountains and the graceful flight of a heron, as lily pads floated like emerald jewels upon its tranquil surface."
246
+
247
+ ![](images/7bb4ed447cb292066ddc8dc05500ea52a73dd73ce6eedaed19bfd3420632f678.jpg)
248
+ Figure 8: Comparison with Dreamfusion (Single Object).
249
+
250
+ # 6.3 COMPARISON WITH TEXT-TO-3D
251
+
252
+ We offer side-by-side comparisons with a state-of-the-art Text-to-3D method Dreamfusion (Poole et al., 2022) for single objects and scene, as illustrated in Figure 8 and Figure 7, respectively.
253
+
254
+ # 6.4 IMPLEMENTATION DETAIL
255
+
256
+ We provide the code that enumerates the functions within Infinigen used in constructing our 3D scene. While a similar Python file can be found at https://github.com/princeton-vl/ infinigen/blob/main/worldgen/generate.py, our script is uniquely tailored to work with a control dictionary generated by three agents, enabling controllable scene generation.
257
+
258
+ ![](images/1592b55c600ed474d6516a311c2b2762a38c1aabc2394166957f520d90fb053d.jpg)
259
+
260
+ ![](images/9658a1a8dc814c1d868c8e45a3eac9734706a73032ce2505b65217f4196a1157.jpg)
261
+ Listing 1: Agent Implementation Example
262
+
263
+ We offer the code to implement the modeling agent as a demonstration of how to utilize the OpenAI API for implementing our agent.
264
+
265
+ def modeling_function_call(text_description,function_description, function, 2 function_document,example,max_tokens $= 2 0 0 0$ , temperature ${ } = 0$ .3,history $= [ ~ ]$ ): 3 """ 4 Give a short text, call the given functions to generation objects/ scene to fit the given text description Parameters 6 text_description: short user given text. 8 function_description: short function description. 9 function: python code. 10 function_document: the detail description of the function. 11 example: example of how to use the function. 12 max_tokens: max tokens for the detailed text. 13 temperature 14 Returns 15 16 response from the agent that contains the function calls. 17 """ 18 if(len(history) $\scriptstyle = = 0$ ): 19 history $=$ [ 20 {"role":"system", "content":"You are a good 3D designer who can convert long text descriptions into parameters, and is good at understanding Python functions to manipulate 3D content. "}, 21 22 messages $=$ history 23 24 text $=$ f"""We have the following function codes function_description} to control blender by python : {function}. 25 Following are the document for function: {function_document}. 26 Below is an example bout how to make function calls to model the scene to fit the description: {example}. 27 Question: Given the text description: {text_description} analysis the function parameter and call the function to { function_description}""" 28 messages.append({"role": "user","content":text}) 29 30 conceptualization_augmentation_model $=$ openai.ChatCompletion.create ( 31 model $=$ "gpt-3.5-turbo", 32 temperature $=$ temperature,
266
+
267
+ <table><tr><td>33</td><td>max_tokens = max_tokens,</td></tr><tr><td>34</td><td>messages = messages</td></tr><tr><td>35</td><td></td></tr><tr><td>36</td><td></td></tr><tr><td>37</td><td>conceptualization_text = conceptualization_augmentation_model.</td></tr><tr><td>38</td><td>choices[0].message[&quot;content&quot;] return conceptualization_text,messages</td></tr></table>
268
+
269
+ # 6.5 DISCUSSION OF FUNCTION SET SIZE
270
+
271
+ Assessing the impact of function set size and parameter count can be complex due to variations in function significance. In Figure 9, we can see that removing rock modeling has a minimal impact on the modeling outcome. On the other hand, eliminating the water modeling function makes river modeling impossible, leading to a significant reduction in the alignment between the generated 3D scene and the text description.
272
+
273
+ ![](images/1daed1df9d181cde5244cf2d1422d34f8e0507cf2c5c360907b98ea1dfbe9847.jpg)
274
+ Listing 2: Agent Implementation Example
275
+ (a). Remove rock modeling
276
+
277
+ ![](images/806bae712a7cc285dfedfc32076ace948452cb8b9394cf0c46a48f63f39fe4e7.jpg)
278
+ (b). Remove water modeling
279
+
280
+ ![](images/e19aeb9428158b6b2e0cd0e97b5d4e003891f7d20d53808677973d0372be1d1d.jpg)
281
+ (c). Full function set
282
+ Figure 9: Ablation study of Different Function Set
283
+
284
+ “The lake, serene and glassy, mirrored the cloudless sky above, reflecting the surrounding mountains and the graceful flight of a heron, as lily pads floated like emerald jewels upon its tranquil surface."
285
+
286
+ # 6.6 ABLATION STUDY DETAILS
287
+
288
+ We conduct separate ablation studies for the Conceptualization Agent and Task Dispatch Agent, evaluating their performance based on CLIP scores, failure rates, and parameter diversity.
289
+
290
+ We use the implementation of Radford et al. (2021) to calculate CLIP score. It measures cosine similarity in the CLIP hidden space, indicating the alignment between generated images and text descriptions. For 3D scene CLIP scores, we placed a camera at the scene’s center, capturing 50 images by rotating the camera 360 degrees. In the Conceptualization Agent evaluation, we used only the initial instruction. For the Task Dispatch Agent, both the initial instruction and one subsequence instruction were used.
291
+
292
+ The failure rate reflects the Modeling Agent’s response. Failures can occur when the method cannot extract the correct pattern via the parser, generates data with an incorrect datatype, or omits/adds parameters to the function call. We evaluated five functions for each scene, recording the failure rate. We also assessed 500 parameters per scene, employing the Shannon Diversity Index to measure parameter diversity, and categorizing float parameters into 100 bins.
293
+
294
+ # 6.7 AGENT RESPONSES
295
+
296
+ Figure 10, Figure 11 and Figure 12 demonstrate how the system communicates with Task Dispatch Agent, Conceptualization Agent, and Modeling Agent, respectively. The Task Dispatch Agent example is deliberately simplified, featuring only four functions to ensure conciseness. In contrast, the examples for the Conceptualization Agent and Modeling Agent are derived from our comprehensive implementation.
297
+
298
+ You are a proficient planner for selecting suitable functions based on user instructions. You are provided with the following functions: 1. generate_terrain(): model the 3D terrain.
299
+ 2. generate_tree(): generate trees with parameters that controls the tree appearance and place them on the terrain surface.
300
+ 3. add_grass(): add grass to the terrain surface()
301
+ 4. apply_snow_layer(): add snow to the surface of all objects.
302
+ Below are examples of how to choose functions based on user instructions:
303
+ User: My instruction is: "Change weather to snowy." Answer: Based on the function provided above and the user instruction, the apply_snow_layer() function from above function set is suitable to call. It will add snow to all objects covered by snow and make it look like a snowy scene. Other functions (1,2,3) are not relevant to the user instruction. Given the instructions, we determine the sublist of functions that need to be used for 3D modeling: [4]
304
+ User: My instruction is: “Change tree leaf to yellow." Based on the user instruction, "Change tree leaf to yellow," you can use the generate_tree() function to generate trees with yellow leaves. You can modify the parameters of the generate_tree() function to control the appearance of the trees, including the color of their leaves. Other functions (1, 3, 4) are not relevant to changing the color of tree leaves. Given the instructions, we determine the sublist of functions that need to be used for 3D modeling:
305
+ [2]
306
+ So, the suitable function to call in this case is generate_tree() with the appropriate parameters for yellow leaves. Given a text description "A peaceful clearing in a dense forest, blanketed in fresh, untouched snow. Tall birch trees, their white bark standing out starkly against the dark evergreens and the gray, overcast sky, form a natural cathedral.", provide detailed descriptions for the following information: "possible daytime, sun intensity, air condition, sky appearance, cloud density.”.
307
+ For term not mentioned in the description, use your imagination to ensure they fit the text description.
308
+
309
+ Figure 10: Communication Between System and Task Dispatch Agent.
310
+
311
+ ![](images/c4a6bd558d3470797682f5cd4a6d9165603a747f4f12972b24798b6621a4858a.jpg)
312
+ Figure 11: Communication Between System and Conceptualization Agent.
313
+
314
+ # 6.8 VISUAL RESULT
315
+
316
+ Figure 13 and Figure 14 show the prompts for modelling trees and sky. The visual control result for a full scene is illustrated in Figure 15.
317
+
318
+ We have the following function codes modelling the sky appearance using nishita method to control blender by python :
319
+ \`\`python
320
+ import nishita_sky_modelling def sky_texture_node(sun_intensity,sun_elevation,sun_rotation,air_density,dust_density, ozone,cloud_density): texture = nishita_sky_modelling(sun_intensity,sun_elevation,sun_rotation,air_density,dust_density, ozone,cloud_density) return
321
+ Following are the document for function: “ input:
322
+ sun_intensity: Multiplier for sun disc lighting. (choose from ‘low’,’median’,’high’)
323
+ sun_elevation: Rotation of the sun from the horizon (in degrees). (0:sunset,sun rising, 90:daytime,-10:night)
324
+ sun_rotation: Rotation of the sun around the zenith (in degrees). air_density: density of air molecules. (0 no air, 1 clear day atmosphere, 2 highly polluted day)
325
+ dust_density: density of dust and water droplets. (0 no dust, 1 clear day atmosphere, 5 city like atmosphere, 10 hazy day) ozone: density of ozone molecules; useful to make the sky appear bluer. (0 no ozone, 1 clear day atmosphere, 2 city like atmosphere).
326
+ higher value for bluer sky.
327
+ cloud_density: density of the cloud, varying from 0 to 0.04. (0.01 very thick cloud, 0.04 very heavy cloud) output: texture color output.” Below is an example bout how to make function calls to model the scene to fit the description: Question: given the text description of the scene: “The river, reflecting the clear blue of the sky, glistened like a silver ribbon as it wound
328
+ its way through the lush valley, its tranquil waters whispering secrets to the ancient trees.” analysis the function parameter and call the
329
+ function to generate the sky.
330
+ Solution: From the description of “clear blue sky”, the sun_intensiy can not be low, let's set it as "median";As the sky is blue, the
331
+ sun_elevation cannot be very low (not morning/sunset/evening), we can set it to 50. The sun rotation does not affect the sky appearance, let's set it to 0. To fit the description of "clear blue". The air_density and
332
+ dust_density should be low, we can set air_density to 1, dust_density to 0. To make the sky more blue, we can increase the ozone value,
333
+ let’s make it as 2. As the sky is very blue and clear, the cloud density should be low, we can set it as 0.0005. We can model the sky by calling the following
334
+ function: \`\`\`python sky_texture_node(sun_intensity = ‘median’,sun_elevation=50,sun_rotation=0,air_density=1,dust_density=0,
335
+ ozone=2,cloud_density=0.0005)\`\`\` Question: Given the text description: “A peaceful clearing in a dense forest, blanketed in fresh, untouched snow. Tall birch trees, their
336
+ white bark standing out starkly against the dark evergreens and the gray, overcast sky, form a natural cathedral. In this peaceful clearing, the
337
+ scene is bathed in the soft glow of early morning light. The sun, just beginning to rise above the horizon, casts a gentle, golden hue across
338
+ the landscape. Its intensity is subdued, as if still gathering strength to break through the thick canopy of trees that surround the clearing.
339
+ The air in the clearing is crisp and cool, carrying with it a hint of winter's bite. It is still and calm, devoid of any breeze or gusts that might
340
+ disturb the tranquility of the scene. The air feels pure and invigorating, as if it has been untouched by human presence.
341
+ Looking up towards the sky, the overcast conditions create a muted, gray backdrop. The clouds hang low, their edges blending seamlessly
342
+ with the horizon, creating a sense of enclosure within the clearing. The sky appears vast, yet somehow intimate, as if it is a part of the
343
+ natural cathedral formed by the towering birch trees.
344
+ The cloud density is moderate, with the clouds spread out across the sky in a gentle, billowing fashion. They are not heavy or oppressive, but
345
+ rather wispy and ethereal, adding a touch of mystery to the scene. As the day progresses, the clouds shift and change shape, creating a
346
+ dynamic and ever-evolving canvas above the clearing.
347
+ Overall, the daytime in this clearing is characterized by a serene ambiance, with the sun‘s gentle rays filtering through the dense forest and
348
+ the sky adorned with a delicate veil of clouds. It is a scene that invites contemplation and reflection, a sanctuary of tranquility amidst the
349
+ wild beauty of nature.” analysis the function parameter and call the function to modelling the sky appearance using nishita method. Based on the description, we can analyze the function parameters as follows:
350
+ - sun_intensity: The description mentions a "soft glow of early morning light" and the sun's intensity is described as "subdued". Let's set the sun_intensity to 'low'.
351
+ - sun_elevation: The sun is described as "just beginning to rise above the horizon". Let's set the sun_elevation to -5.
352
+ - sun_rotation: The description does not provide any specific information about the sun's rotation, so we can set it to 0.
353
+ - air_density: The air is described as "crisp and cool" and "untouched by human presence". Let's set the air_density to 0.
354
+ - dust_density: The description does not mention any dust or particles in the air, so we can set the dust_density to 0.
355
+ - ozone: The description does not provide any specific information about the ozone density, so we can set it to 1.
356
+ - cloud_density: The clouds are described as "moderate" and "spread out across the sky in a gentle, billowing fashion". Let's set the cloud_density to 0.02.
357
+ We can model the sky by calling the following function:
358
+ \`\`\`python
359
+ sky_texture_node(sun_intensity='low', sun_elevation=-5, sun_rotation=0, air_density=0, dust_density=0, ozone=1, cloud_density=0.02)
360
+
361
+ Figure 12: Communication Between System and Modeling Agent.
362
+
363
+ # Document:
364
+
365
+ Explanation: The function takes a built natural scene as input and adds base trees to it.
366
+
367
+ # Inputs:
368
+
369
+ scene: The built natural scene.
370
+ density(float): The density of the trees.
371
+ distance_min(float): Minimum distance between trees.
372
+
373
+ eaf_type(string): The type of leaf on the tree. Select one from the list [‘leaf’, ‘leaf_broadleaf’, ‘leaf_ginko’, ‘leaf_maple’, ‘flower’, ‘N
374
+
375
+ ‘Leaf’ allows further custom settings like changing the leaf shape and color. ‘Leaf_broadleaf’, ‘leaf_ginko’, and ‘leaf_maple’ build the leaves with predefined shapes: broad, ginko, and maple respectively. ‘Flower’ will create flowers on the tree instead of leaves. ‘None’ will not generate leaves on the tree.
376
+
377
+ fruit_type(string): The type of fruit on the tree. Select one from the list [‘apple’, ‘blackberry’, ‘coconut_green’, ‘durian’, ‘starfruit’, ‘strawberry’, ‘custom_fruit’, ‘None’]. Each of the fruit types will create the corresponding fruit on the tree. ‘Custom_fruit’ can create customizable fruit on the tree with further adjustments. If the desired fruit is not on the list, ‘custom_fruit’ should be chosen. ‘None’ will not generate any fruit on the tree.
378
+
379
+ <table><tr><td>Code:</td></tr><tr><td>&quot;python</td></tr><tr><td>importTreeFactory</td></tr><tr><td>defadd_trees(scene,density,distance_min,leaf_type,fruit_type,leaf_deity):</td></tr><tr><td>trees=TreFactory.create(densityeaftypefruit_type,eafesity)#eatetre scene.placement(trees, distance_min) # place trees in the scene</td></tr><tr><td>return</td></tr><tr><td></td></tr></table>
380
+
381
+ # Information:
382
+
383
+ "Possible trees in the scene, tree types, leaf density, possible seasons, tree size, appearance of the tree branch, branch type, and leaf color."
384
+
385
+ # Example:
386
+
387
+ Question: Given the text description of the scene, analyze the function parameters and call the function to add more trees that fit the text description.
388
+
389
+ Solution: From the text description, three different types of trees are identified in the scene: birch, dogwood, and Japanese maple. From “a cluster of,” we infer the tree density is relatively high; let’s set it to 0.2. Birch tree leaves are typically oval or triangular, so let’s set the leaf type to ‘leaf’ to allow further customization. There are no fruits mentioned for the birch tree in the description. Given the scene likely depicts autumn, the leaf_density should not be too high; let’s set it to 0.02. For the dogwood tree, as the leaves are described as oval or elliptical with smooth edges, the leaf type is set to ‘leaf’. It is mentioned that “clusters of small, vibrant berries cling to its branches,” so we can choose the fruit_type as ‘blackberry’. The leaf_density is set to 0.02. For the Japanese maple tree, the leaf type is set to ‘leaf_maple’. No fruits are mentioned for the maple tree. As the scene likely takes place in autumn, the leaf density for the maple tree should be high; let’s set it to 0.1. The function can be called three times to create three different trees:
390
+
391
+ <table><tr><td>&quot;python</td></tr><tr><td>add_tre(sesty0istacei,eatlaffruitNoe&#x27;,eaesity.)#eae</td></tr><tr><td>adtreesiiyte</td></tr><tr><td>adtreilesi 1</td></tr></table>
392
+
393
+ # Document:
394
+
395
+ #
396
+
397
+ sun_intensity: Multiplier for sun disc lighting. (Choose from ‘low’, ‘median’, ‘high’)
398
+ sun_elevation: Rotation of the sun from the horizon (in degrees). (0: sunset, sun rising, 90: daytime, -10: night)
399
+ sun_rotation: Rotation of the sun around the zenith (in degrees).
400
+ air_density: Density of air molecules. (0: no air, 1: clear day atmosphere, 2: highly polluted day)
401
+ dust_density: Density of dust and water droplets. (0: no dust, 1: clear day atmosphere, 5: city-like atmosphere, 10: hazy day)
402
+ ozone: Density of ozone molecules; useful to make the sky appear bluer. (0: no ozone, 1: clear day atmosphere, 2: city-like atmosphere). A
403
+
404
+ igher value yields a bluer sky.
405
+
406
+ cloud_density: Density of the clouds, ranging from 0 to 0.04. (0.01: very thick cloud, 0.04: very heavy cloud)
407
+
408
+ # Output:
409
+
410
+ texture_color_output: The output texture color of the sky.
411
+
412
+ Code:
413
+
414
+ \`\`python import nishita_sky_modelling def sky_texture_node(sun_intensity, sun_elevation, sun_rotation, air_density, dust_density, ozone, cloud_density): texture $=$ nishita_sky_modelling.model_sky(sun_intensity, sun_elevation, sun_rotation, air_density, dust_density, ozone, cloud_density) return texture
415
+
416
+ # Information:
417
+
418
+ The time of day depicted in the scene (morning/noon/evening), the possible season, the condition of the air, the blueness of the sky, and the cloud density.
419
+
420
+ # Example:
421
+
422
+ # Question:
423
+
424
+ Given the text description of the scene: “The river, reflecting the clear blue of the sky, glistened like a silver ribbon as it wound its way through the lush valley, its tranquil waters whispering secrets to the ancient trees,” analyze the function parameters and call the function to generate the sky.
425
+
426
+ # Solution:
427
+
428
+ From the description of a “clear blue sky,” we infer that sun_intensity cannot be low, let's set it as "median". As the sky is clear and blue, the sun_elevation must not be very low, indicating it's not morning or evening; we can set it to 50 degrees.
429
+
430
+ Sun rotation does not impact the appearance of the sky significantly; thus, we will set it to 0 degrees. To align with the description of "clear blue," we should choose lower values for air_density and dust_density. Hence, we will set air_density to 1 and dust_density to 0. To enhance the blueness of the sky, we can increase the ozone value to 2.
431
+
432
+ As the description suggests a clear, blue sky, the cloud density must be low. Therefore, we will set it to 0.0005. The sky can be modeled by invoking the function as follows:
433
+
434
+ ![](images/2d971e6ecfa758f69842506d2906807a43c42ff67f65e7b36eecd7d06f210eee.jpg)
435
+ Figure 14: Prompt Example of Sky Modeling Function.
436
+
437
+ ![](images/7a3f8db2bd8ab47d5c950d9859ea06c322773e3bd992c0e2b7f789462fc902db.jpg)
438
+
439
+ ![](images/9eeeb7822f8a616ac5df771106acdee2e556d4defd81079d332140a67dd23551.jpg)
440
+ Figure 15: Single Function Control Result. Visual result (top) and modeling agent response example (bottom). Our method demonstrates a high degree of accuracy in inferring algorithm parameters, even when they do not possess a direct connection to visual appearance.
parse/test/ttMwEuEPeB/ttMwEuEPeB_content_list.json ADDED
@@ -0,0 +1,975 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "3D-GPT: PROCEDURAL 3D MODELING WITH LARGE LANGUAGE MODELS ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Anonymous authors Paper under double-blind review ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "ABSTRACT ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "In the pursuit of efficient automated content creation, procedural generation, leveraging modifiable parameters and rule-based systems, emerges as a promising approach. Nonetheless, it could be a demanding endeavor, given its intricate nature necessitating a deep understanding of rules, algorithms, and parameters. To reduce workload, we introduce 3D-GPT, a framework utilizing large language models (LLMs) for instruction-driven 3D modeling. 3D-GPT positions LLMs as proficient problem solvers, dissecting the procedural 3D modeling tasks into accessible segments and appointing the apt agent for each task. 3D-GPT integrates three core agents: the task dispatch agent, the conceptualization agent, and the modeling agent. They collaboratively achieve two objectives. First, it enhances concise initial scene descriptions, evolving them into detailed forms while dynamically adapting the text based on subsequent instructions. Second, it integrates procedural generation, extracting parameter values from enriched text to effortlessly interface with 3D software for asset creation. Our empirical investigations confirm that 3D-GPT not only interprets and executes instructions, delivering reliable results but also collaborates effectively with human designers. Furthermore, it seamlessly integrates with Blender, unlocking expanded manipulation possibilities. Our work highlights the potential of LLMs in 3D modeling, offering a basic framework for future advancements in scene generation and animation. ",
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": "In the metaverse era, 3D content creation serves as a catalyst for transformative progress, redefining multimedia experiences in domains like gaming, virtual reality, and cinema with intricately crafted models. Yet, designers often grapple with a time-intensive 3D modeling process, starting from basic shapes (e.g., cubes, spheres, or cylinders) and employing software like Blender for meticulous shaping, detailing, and texturing. This demanding workflow concludes with rendering and post-processing to deliver the polished final model. While procedural generation holds promise with its efficiency in automating content creation through adjustable parameters and rule-based systems (Deitke et al., 2022; Greff et al., 2022; He et al., 2021; Jiang et al., 2018; Raistrick et al., 2023), it demands a comprehensive grasp of generation rules, algorithmic frameworks, and individual parameters. Furthermore, aligning these processes with the creative visions of clients, through effective communication, adds another layer of complexity. This underscores the importance of simplifying the traditional 3D modeling workflow to empower creators in the metaverse era. ",
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "LLMs have showcased exceptional language understanding capabilities, including planning and tool utilization (Imani et al., 2023; Zhang et al., 2023a; Gong et al., 2023; Zeng et al., 2022). Furthermore, LLMs demonstrate outstanding proficiency in characterizing object attributes, such as structure and texture (Menon & Vondrick, 2022; Pratt et al., 2022; Fan et al., 2023), enabling them to enhance details from rough descriptions. Additionally, they excel at parsing concise textual information and comprehending intricate code functions, while seamlessly facilitating efficient interactions with users. Driven by these extraordinary capabilities, we embark on exploring their innovative applications in procedural 3D modeling. Our primary objective is to harness the power of LLMs to exert control over 3D creation software in accordance with the requirements of clients. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "text",
42
+ "text": "In pursuit of this vision, we introduce 3D-GPT, a framework aimed at facilitating instruction-driven 3D content synthesis. 3D-GPT enables LLMs to function as problem-solving agents, breaking down the 3D modeling task into smaller, manageable components, and determining when, where, and how to accomplish each segment. 3DGPT comprises three key agents: conceptualization agent, 3D modeling agent and task dispatch agent. The first two agents collaborate harmoniously to fulfill the roles of 3D conceptualization and 3D modeling by manipulating the 3D generation functions. Subsequently, the third agent manages the system by taking the initial text input, handling subsequence instructions, and facilitating effective cooperation between the two aforementioned agents. ",
43
+ "page_idx": 0
44
+ },
45
+ {
46
+ "type": "text",
47
+ "text": "",
48
+ "page_idx": 1
49
+ },
50
+ {
51
+ "type": "text",
52
+ "text": "By doing so, they work toward two key objectives. First, it enhances initial scene descriptions, guiding them towards more detailed and contextually relevant forms while adapting the textual input based on subsequent instructions. Second, instead of directly crafting every element of 3D content, we employ procedural generation, making use of adaptable parameters and rule-based systems to interface with 3D software. Our 3D-GPT is equipped with the capability to understand procedural generation functions and extract corresponding parameter values from the enriched text. ",
53
+ "page_idx": 1
54
+ },
55
+ {
56
+ "type": "text",
57
+ "text": "3D-GPT offers controllable and precise 3D generation guided by users’ textual descriptions. It reduces the workload of manually defining each controllable parameter in procedural generation, particularly within complex scenes that encompass diverse aspects. Moreover, 3D-GPT enhances collaboration with users, making the creative process more efficient and user-centric. Furthermore, 3D-GPT seamlessly interfaces with Blender, granting users diverse manipulation capabilities: object transformations, material adjustments, primitive additions, object animations, mesh editing, and physical motion simulations. Based on our experiments, we posit that LLMs exhibit the potential to handle more intricate visual inputs. Our contributions are summarized as follows: ",
58
+ "page_idx": 1
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "• Introducing 3D-GPT, a training-for-free framework designed for 3D scene generation. Our approach leverages the innate multimodal reasoning capabilities of LLMs, streamlining the efficiency of end-users engaged in procedural 3D modeling. Exploration of an alternative path in text-to-3D generation, wherein our 3D-GPT generates Python codes to control 3D software, potentially offering increased flexibility for realworld applications. \n• Empirical experiments demonstrate the substantial potential of LLMs in terms of their reasoning, planning, and tool-using capabilities in 3D content generation. ",
63
+ "page_idx": 1
64
+ },
65
+ {
66
+ "type": "text",
67
+ "text": "2 RELATED WORK ",
68
+ "text_level": 1,
69
+ "page_idx": 1
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "2.1 TEXT-TO-3D GENERATION ",
74
+ "text_level": 1,
75
+ "page_idx": 1
76
+ },
77
+ {
78
+ "type": "text",
79
+ "text": "With the recent advance in text-to-image generation modeling, there has been a growing interest in text-to-3D generation (Sanghi et al., 2022; Poole et al., 2022; Lin et al., 2023; Xu et al., 2023; Metzer et al., 2023; Wang et al., 2023; Xu et al., 2023; Mohammad Khalid et al., 2022; Jain et al., 2022). The common paradigm of them is to perform per-shape optimization with differentiable rendering and the guidance of the CLIP model (Radford et al., 2021) or 2D diffusion models (Rombach et al., 2022). For example, DreamFields (Jain et al., 2022) and CLIP-Mesh (Mohammad Khalid et al., 2022) explore zero-shot 3D content creation using only CLIP guidance. Dreamfusion (Poole et al., 2022) optimizes NeRF Mildenhall et al. (2021) with the guidance of a text-to-image diffusion model, achieving remarkable text-to-3D synthesis results. Further works in this direction have resulted in notable enhancements in visual quality (Lin et al., 2023; Melas-Kyriazi et al., 2023), subject-driven control (Raj et al., 2023; Metzer et al., 2023), and overall processing speed (Liu et al., 2023; Jain et al., 2022). Unlike the above approaches, our objective is not to generate conventional neural representations as the final 3D output. Instead, we utilize LLMs to generate Python code that controls Blender’s 3D modeling based on the provided instructions. ",
80
+ "page_idx": 1
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "2.2 LARGE LANGUAGE MODELS ",
85
+ "text_level": 1,
86
+ "page_idx": 1
87
+ },
88
+ {
89
+ "type": "text",
90
+ "text": "Large language models (LLMs) are a promising approach to capture and represent the compressed knowledge and experiences of humans, projecting them into language space (Devlin et al., 2018; Raffel et al., 2020; OpenAI, 2023; Chowdhery et al., 2022; Bubeck et al., 2023). LLMs have consistently showcased remarkable performance extending beyond canonical language processing domains. They exhibit the capability to address intricate tasks that were once considered the exclusive domain of specialized algorithms or human experts. These tasks encompass areas such as mathematical reasoning (Imani et al., 2023; Wei et al., 2022), medicine (Jeblick et al., 2022; Yang et al., ",
91
+ "page_idx": 1
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "2023), and planning (Zhang et al., 2023a; Gong et al., 2023; Huang et al., 2023; 2022) Our work explores the innovative application of LLMs in 3D modeling, employing them to control 3D procedural generation. ",
96
+ "page_idx": 2
97
+ },
98
+ {
99
+ "type": "text",
100
+ "text": "3 3D-GPT ",
101
+ "text_level": 1,
102
+ "page_idx": 2
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "3.1 TASK FORMULATION ",
107
+ "text_level": 1,
108
+ "page_idx": 2
109
+ },
110
+ {
111
+ "type": "text",
112
+ "text": "The overall objective is the generation of 3D content based on a sequence of relatively short natural language instructions, denoted as $\\mathcal { L } = \\langle L _ { i } \\rangle$ . The initial instruction, designated as $L _ { 0 }$ , serves as a comprehensive description of the 3D scene, such as $^ { 6 6 } A$ misty spring morning, where dew-kissed flowers dot a lush meadow surrounded by budding trees”. Subsequent instructions are employed to modify the existing scene, as exemplified by instructions like “transform the white flowers into yellow flower” or “translate the scene into a winter setting” to add detail. ",
113
+ "page_idx": 2
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "To accomplish this objective, we introduce a framework named 3D-GPT, which empowers LLMs to act as problem-solving agents. We point out that employing LLMs to directly create every element of 3D content poses significant challenges. LLMs lack specific pre-training data for proficient 3D modeling and, as a result, may struggle to accurately determine what elements to use and how to modify them based on given instructions. To address this challenge, we employ procedural generation to control the 3D content creation. This makes use of adaptable parameters and rule-based systems to interface with 3D software (e.g., Blender) so as to efficiently conduct 3D modeling (Deitke et al., 2022; Greff et al., 2022; He et al., 2021; Jiang et al., 2018; Raistrick et al., 2023). Nevertheless, there are several challenges that remain such as identifying the correct procedures to call and mapping of language to API parameters. We solve these using multiple language agents as will be discussed below. ",
118
+ "page_idx": 2
119
+ },
120
+ {
121
+ "type": "text",
122
+ "text": "Our approach conceptualizes the 3D procedural generation engine as a set of functions, denoted as $\\mathcal { F } = \\{ F _ { j } \\}$ , where each function $F _ { j }$ takes parameters $P _ { j }$ . For example, add trees(scene, density, distance min, leaf type, fruit type) will takes a built natural scene as input and adds base trees to it. ",
123
+ "page_idx": 2
124
+ },
125
+ {
126
+ "type": "text",
127
+ "text": "Within our 3D-GPT framework, for each language instruction $L _ { i }$ , we formulate the modeling task as first selecting the subset of relevant functions ${ \\hat { \\mathcal { F } } } \\subseteq { \\mathcal { F } }$ , and then inferring the corresponding parameters $P _ { j }$ for each function $F _ { j }$ in this subset. The ultimate aim is to ensure that the functions in $\\hat { \\mathcal { F } }$ collectively generates a 3D scene that aligns with the descriptions provided in $\\mathcal { L }$ . By adeptly addressing both function selection and parameter inference for every sub-instruction $L _ { i }$ , 3D-GPT generates a Python script file that allows Blender’s 3D modeling environment to render high-quality scenes consistent with the instruction sequence $\\mathcal { L }$ . ",
128
+ "page_idx": 2
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "3.2 MODELING TOOL PREPARATION ",
133
+ "text_level": 1,
134
+ "page_idx": 2
135
+ },
136
+ {
137
+ "type": "text",
138
+ "text": "In our framework, we utilize Infinigen Raistrick et al. (2023), a Python-Blender-based procedural generator equipped with a rich library of generation functions. To empower LLMs with the ability to proficiently leverage Infinigen, we provide following crucial language prompts for each function $F _ { j }$ : ",
139
+ "page_idx": 2
140
+ },
141
+ {
142
+ "type": "text",
143
+ "text": "• Documentation $( D _ { j } )$ : A comprehensive explanation of the function’s purpose and clear description of it’s parameters $P _ { j }$ as one would find in standard API documentation. \n• API code $( C _ { j } )$ : Restructured and highly readable function code, ensuring that it is accessible and comprehensible for LLMs. \n• Auxiliary parameter information $( I _ { j } )$ : Outlines specific information required to infer the function parameters, thereby assisting LLMs in understanding the context and prerequisites of each function. For example, in the case of a flower generation function, $I _ { j }$ indicates the required visual properties for rendering, such as flower color, flower petal appearance (e.g., size, curve, and length), and flower center appearance. \n• Usage examples $( E _ { j } )$ : Illustrative examples that demonstrate how to infer the parameter $P _ { j }$ from the accompanying text descriptions and subsequently invoke the function. Continuing with the example of a flower generation function, $E _ { j }$ includes a practical demonstration of how to infer the parameters and call the function based on input text like “a sunflower” ",
144
+ "page_idx": 2
145
+ },
146
+ {
147
+ "type": "text",
148
+ "text": "By providing LLMs with these resources, we enable them to leverage their generative competencies in planning, reasoning, and tool utilization. As a result, LLMs can effectively harness Infinigen for 3D generation based on language instructions in a seamless and efficient manner. In the context of our work, the function set $\\mathcal { F }$ encompasses all functions and subfunctions within the Infinigen scene generation script, with the sole exception of the ’creatures’ class. These functions play an indispensable role in our scene creation process. In the supplementary material, Section 6.4 presents a comprehensive list of all the functions by the script we utilized to construct the scenes. Additionally, we provide examples for using some of these functions in Section 6.8, Figure 14 and Figure 13. ",
149
+ "page_idx": 3
150
+ },
151
+ {
152
+ "type": "text",
153
+ "text": "3.3 MULTI-AGENTS FOR 3D REASONING, PLANING AND TOOL USING ",
154
+ "page_idx": 3
155
+ },
156
+ {
157
+ "type": "text",
158
+ "text": "With the necessary tool preparation (i.e., $D _ { j }$ , $C _ { j }$ , $I _ { j }$ and $E _ { j }$ ) in hand, 3D-GPT employs a multi-agent system to tackle the task of language-guided procedural 3D modeling. This system comprises three integral agents: (1) the task dispatch agent, (2) the conceptualization agent, and (3) the modeling agent, illustrated in Figure 1. Together, these agents decompose modeling task into manageable segments, with each agent specializing in distinct aspects: planning, 3D reasoning, and tool utilization. The task dispatch agent plays a pivotal role in the planning process. It leverages user instructions to query function documents and subsequently selects the requisite functions for execution. Once functions are selected, the conceptualization agent engages in reasoning to enrich the user-provided text description. Building upon this, the modeling agent deduces the parameters for each selected function and generates Python code scripts to invoke Blender’s API, facilitating the creation of the corresponding 3D content. From there, images can be generated using Blender rendering capability. ",
159
+ "page_idx": 3
160
+ },
161
+ {
162
+ "type": "text",
163
+ "text": "Task Dispatch Agent for Planing. The task dispatch agent, armed with comprehensive information of all available functions $\\mathcal { F }$ as described above, efficiently identifies the requisite functions for each instructional input. For example, when presented with an instruction such as “translate the scene into a winter setting”, it pinpoints functions like add snow layer and update trees. This pivotal role played by the task dispatch agent is instrumental in facilitating efficient task coordination between the conceptualization and modeling agents. Without it, the conceptualization and the modeling agents have to analyze all provided functions $\\mathcal { F }$ for each given instruction. This not only increases the workload for these agents but also extends processing time and can potentially lead to undesired modifications. The communication flow between the LLM system, the user, and the task dispatch agent is outlined as follows: ",
164
+ "page_idx": 3
165
+ },
166
+ {
167
+ "type": "text",
168
+ "text": "— LLM System: You are a proficient planner for selecting suitable functions based on user instructions. You are provided with the following functions: $\\langle ( F _ { j } ^ { n a m e } , F _ { j } ^ { u s a g e } ) \\rangle$ . Below are a few examples of how to choose functions based on user instructions: $\\langle E _ { j } ^ { t a s k \\lrcorner d i s p a t c h } \\rangle$ . — User: My instruction is: $\\left. L _ { i } \\right.$ . — Task Dispatch Agent: Given the instruction $\\left. L _ { i } \\right.$ , we determine the sublist of functions $\\hat { \\mathcal { F } }$ that need to be used for $3 D$ modeling. ",
169
+ "page_idx": 3
170
+ },
171
+ {
172
+ "type": "text",
173
+ "text": "Here $\\langle ( F _ { j } ^ { n a m e } , F _ { j } ^ { u s a g e } ) \\rangle$ represents a list of function names and concise function usage descriptions for all available functions and examples $\\langle E ^ { t a s k \\lrcorner d i s p a t c h } \\rangle$ provide guided examples for prompt-based instructions. A example is provided in the supplementary Figure 10. ",
174
+ "page_idx": 3
175
+ },
176
+ {
177
+ "type": "text",
178
+ "text": "Conceptualization Agent for Reasoning. The user instruction may not explicitly provide sufficient details needed for modeling. For instance, consider the instruction, “a misty spring morning, where dew-kissed flowers dot a lush meadow surrounded by budding trees”. Here many necessary details required function parameters such as tree branch length, tree size, and leaf type, are not directly stated in the given text. When instructing the modeling agent to infer parameters directly, we observed that it tends to provide simplistic solutions, such as using default or copying values from prompting examples. This reduces diversity in generation and complicates parameter inference. ",
179
+ "page_idx": 3
180
+ },
181
+ {
182
+ "type": "text",
183
+ "text": "To address this issue, we introduce the conceptualization agent which collaborates with the task dispatch agent to augment the user-provided text description $( L _ { i } )$ . After the task dispatch agent selects the required functions, we send the user input text and the corresponding function-specific information to the conceptualization agent and request augmented text. For each function $F _ { j }$ , it enriches $L _ { i }$ into detailed appearance descriptions $L _ { i } ^ { j }$ . The communication between the system and the Conceptualization Agent for instruction $\\langle L _ { i } \\rangle$ and function $\\langle F _ { j } \\rangle$ is as follows: ",
184
+ "page_idx": 3
185
+ },
186
+ {
187
+ "type": "image",
188
+ "img_path": "images/8c19d6010d7fa4e4ec8e4985f0beb8f93880a09328a36a87e3c03f48a2c224c7.jpg",
189
+ "image_caption": [
190
+ "Figure 1: 3D-GPT Overview. 3D-GPT employs LLMs as a multi-agent system with three collaborative agents for procedural 3D generation. These agents consult documents from the procedural generator, infer function parameters, and produce Python code. The generated code script interfaces with Blender’s API for 3D content creation and rendering. "
191
+ ],
192
+ "image_footnote": [],
193
+ "page_idx": 4
194
+ },
195
+ {
196
+ "type": "text",
197
+ "text": "— LLM System: You are a skilled writer, especially when it comes to describing the appearance of objects and large scenes. Given a description $\\langle L _ { i } \\rangle$ , provide detailed descriptions for the following information $\\langle I _ { j } \\rangle$ . For terms not mentioned in the description, use your imagination to ensure they fit the text description. \n— Conceptualization Agent: Given the $\\left. L _ { i } \\right.$ and requested information $\\langle I _ { j } \\rangle$ , the extended description is: $\\langle \\widehat { L _ { i } ^ { j } } \\rangle$ . ",
198
+ "page_idx": 4
199
+ },
200
+ {
201
+ "type": "text",
202
+ "text": "We have illustrated a communication example in Figure 11 within the supplementary material. ",
203
+ "text_level": 1,
204
+ "page_idx": 4
205
+ },
206
+ {
207
+ "type": "text",
208
+ "text": "Modeling Agent for Tool Using. After conceptualization, the 3D modeling processing is invoked to convert the detailed human language to machine-understandable language. In our framework, our modeling agent employs the functions of procedural modeling in the library to create a realistic 3D model. For each function $F _ { j }$ and user instruction $L _ { i }$ , the task dispatch agent receive augmented context $\\widehat { L _ { i } ^ { j } }$ from the conceptualization agent. For each function $F _ { j }$ , we have the code $C _ { j }$ , function documentation $D _ { j }$ , and one usage example $E _ { j }$ . The modeling agent utilizes this information to select the appropriate functions and deduce the corresponding parameters. Subsequently, the modeling agent generates Python code that calls the selected function in the right context (e.g., within a loop), passing in parameters inferred from the text and of the appropriate data type. ",
209
+ "page_idx": 4
210
+ },
211
+ {
212
+ "type": "text",
213
+ "text": "The communication between System and Modeling Agent are based on the following pattern: ",
214
+ "page_idx": 4
215
+ },
216
+ {
217
+ "type": "text",
218
+ "text": "— LLM System: You are a good 3D designer who can convert long text descriptions into parameters, and is good at understanding Python functions to manipulate $3 D$ content. Given the text description $\\langle \\widehat { L _ { i } ^ { f } } \\rangle$ , we have the following function codes $\\langle C _ { j } \\rangle$ and the document for function $\\langle D _ { j } \\rangle$ . Below is an example bout how to make function calls to model the scene to fit the description: $\\langle E _ { j } ^ { m o d e l i n g } \\rangle$ . Understand the function, and model the $3 D$ scene that fits the text description by making a function call. — Modeling Agent: Given the description $\\langle \\widehat { L _ { i } ^ { j } } \\rangle$ , we use the following functions: ..., and their respective parameter values ... are adopted. ",
219
+ "page_idx": 4
220
+ },
221
+ {
222
+ "type": "text",
223
+ "text": "We have illustrated a communication example in Figure 12 within the supplementary material. ",
224
+ "page_idx": 4
225
+ },
226
+ {
227
+ "type": "text",
228
+ "text": "Blender Rendering. The modeling agent ultimately constructs the Python function calls with inferred parameters, which are supplied to Blender for controlling view ports and rendering, and thereby resulting in production of the final 3D mesh and RGB results. ",
229
+ "page_idx": 4
230
+ },
231
+ {
232
+ "type": "text",
233
+ "text": "Implementation Detail. Our implementation relies on the Infinigen Raistrick et al. (2023) API, and the specific function set $\\cdot$ utilized in our work is available in the generation script provided in ",
234
+ "page_idx": 4
235
+ },
236
+ {
237
+ "type": "image",
238
+ "img_path": "images/79fe7ec376053d6c834b23eaf63dd45879555cbfd34d4320bca808e40b11ba19.jpg",
239
+ "image_caption": [
240
+ "Figure 2: Visual Examples of Instruction-Based 3D Scene Generation. 3D-GPT can construct large 3D scenes that align with the provided initial instruction. We demonstrate that the rendered images contain various visual factors in line with the given instructions. "
241
+ ],
242
+ "image_footnote": [],
243
+ "page_idx": 5
244
+ },
245
+ {
246
+ "type": "text",
247
+ "text": "Supplementary Material, as detailed in Section 6.4. We have developed our system using the OpenAI API, and the code implementation for our modeling agent can also be found in Supplementary Material, Section 6.4. This code demonstrates the ease with which our system can be implemented. ",
248
+ "page_idx": 5
249
+ },
250
+ {
251
+ "type": "text",
252
+ "text": "4 EXPERIMENTS ",
253
+ "text_level": 1,
254
+ "page_idx": 5
255
+ },
256
+ {
257
+ "type": "text",
258
+ "text": "Our experimentation begins by showcasing the proficiency of 3D-GPT in consistently generating results that align with user instructions, encompassing scenarios involving both large scenes and individual objects. Subsequently, we delve into specific examples to illustrate how our agents effectively comprehend tool functionalities, access necessary knowledge, and employ it for precise control. To deepen our understanding, we conduct an ablation study to systematically examine the contributions of each agent within our multi-agent system. ",
259
+ "page_idx": 5
260
+ },
261
+ {
262
+ "type": "text",
263
+ "text": "4.1 3D MODELING ",
264
+ "text_level": 1,
265
+ "page_idx": 5
266
+ },
267
+ {
268
+ "type": "text",
269
+ "text": "Large Scene Generation. We investigate the capability of 3D-GPT to control modeling tools based on scene descriptions without any training. To conduct this experiment, we generated 100 scene descriptions using ChatGPT with the following prompt: “You are a good writer, provide 10 different natural scene descriptions for me”. We collected responses to this prompt 10 times to form our dataset. In Figure 2, we present the multi-view rendering results of 3D-GPT. These results indicate that our approach is capable of generating large 3D scenes that generally align well with the provided text descriptions, showcasing a noticeable degree of diversity. Notably, all 3D outcomes are directly rendered using Blender, ensuring that all meshes are authentic, thereby enabling our method to achieve absolute 3D consistency and produce real ray-tracing rendering results. ",
270
+ "page_idx": 5
271
+ },
272
+ {
273
+ "type": "text",
274
+ "text": "Fine-detail Control for Single Class. Apart from generating large scenes from concise descriptions, we assess the capabilities of 3D-GPT for modeling objects. We evaluate crucial factors such as curve modeling, shape control, and an in-depth understanding of object appearances. To this end, we report the results of fine-grained object control. This includes nuanced aspects such as object curves, key appearance features, and color, all derived from input text descriptions. We employ random prompts to instruct GPT for various real-world flower types. As depicted in Figure 3, our method adeptly models each flower type, faithfully capturing their distinct appearances. This study underscores the potential of 3D-GPT in achieving precise object modeling and fine-grained attribute control of object types and visual characteristics. ",
275
+ "page_idx": 5
276
+ },
277
+ {
278
+ "type": "text",
279
+ "text": "Subsequence Instruction Editing. Here, we test the ability of 3D-GPT for effective human-agent communication and task manipulation. In Figure 4, we observe that our method can comprehend subsequence instructions and make accurate decisions for scene modification. Note that, unlike the existing text-to-3D methods, 3D-GPT maintains a memory of all prior modifications, thereby facilitating the connection of new instructions with the scene’s context. Furthermore, our method eliminates the need for additional networks for controllable editings Zhang et al. (2023b). This study underscores the efficiency and versatility of 3D-GPT in adeptly handling complex subsequence instructions for 3D modeling. ",
280
+ "page_idx": 5
281
+ },
282
+ {
283
+ "type": "image",
284
+ "img_path": "images/94d6b9cbb93a9a30ee305a197935daeba1a4962038f3677e52a5a8e64cb2c8e8.jpg",
285
+ "image_caption": [
286
+ "Figure 3: Single Class Control Result. Our method effectively acquires the necessary knowledge for modeling, enabling precise object control in terms of shape, curve, and key appearance capture. The generated results closely align with the given text. "
287
+ ],
288
+ "image_footnote": [],
289
+ "page_idx": 6
290
+ },
291
+ {
292
+ "type": "image",
293
+ "img_path": "images/00cdc35a03955b9cc6e8ee9cc3cb4240af4f74e3e53d0e2d392870a463441337.jpg",
294
+ "image_caption": [
295
+ "Figure 4: Subsequence Instruction Editing Result. (a) Initial instruction-generated scene. (b)-(f) Sequential editing steps with corresponding instructions. Our method enables controllable editing and effective user-agent communication. "
296
+ ],
297
+ "image_footnote": [],
298
+ "page_idx": 6
299
+ },
300
+ {
301
+ "type": "text",
302
+ "text": "",
303
+ "page_idx": 6
304
+ },
305
+ {
306
+ "type": "text",
307
+ "text": "Individual Function Control To evaluate the effectiveness of 3D-GPT in tool utilization, we present an illustrative example that highlights our method’s ability to control individual functions and infer parameters. Figure 5 exemplifies the capability of 3D-GPT to model sky appearances based on input text descriptions. It is worth noting that the function responsible for generating the sky texture does not directly correlate color information with sky appearance. Instead, it relies on the Nishita-sky modeling method, which requires a profound understanding of real-world sky and weather conditions, considering input parameters. Our method adeptly extracts crucial information from the textual input and comprehends how each parameter influences the resulting sky appearance, as evident in Figure 5 (c) and (d). These results demonstrate that our method can effectively use individual functions as well as infer corresponding parameters. ",
308
+ "page_idx": 6
309
+ },
310
+ {
311
+ "type": "image",
312
+ "img_path": "images/ac9a6a6a4013b4893fc7bee3163cf3e25d03e0e3b416269bc428da93c1ead422.jpg",
313
+ "image_caption": [
314
+ "Figure 5: Single Function Control Result. Visual result (top) and modeling agent response example (bottom). Our method demonstrates a high degree of accuracy in inferring algorithm parameters, even when they do not possess a direct connection to visual appearance. ",
315
+ "(a) Ablation Study of Task Dispatch Agent. "
316
+ ],
317
+ "image_footnote": [],
318
+ "page_idx": 7
319
+ },
320
+ {
321
+ "type": "text",
322
+ "text": "4.2 ABLATION STUDY ",
323
+ "text_level": 1,
324
+ "page_idx": 7
325
+ },
326
+ {
327
+ "type": "text",
328
+ "text": "We conduct separate ablation studies for the Conceptualization Agent and Task Dispatch Agent. Our assessment focused on CLIP scores (Radford et al., 2021), failure rates, and parameter diversity, quantified using the categorical Shannon Diversity Index. The CLIP score measures the alignment between text and generated images. The failure rate represents the percentage of system failures due to issues such as incorrect datatypes, wrong response patterns, or missing parameters from the Modeling Agent. Parameter diversity aims to gauge the diversity of generated outputs. ",
329
+ "page_idx": 7
330
+ },
331
+ {
332
+ "type": "table",
333
+ "img_path": "images/34d851b991b0804063326370ea7289bd394fc15715591f1b88b8b1f708fb23c8.jpg",
334
+ "table_caption": [],
335
+ "table_footnote": [],
336
+ "table_body": "<table><tr><td>Metrics/ Method</td><td>CLIP Score</td></tr><tr><td>w/o TDA Ours</td><td>22.79 29.16</td></tr></table>",
337
+ "page_idx": 7
338
+ },
339
+ {
340
+ "type": "table",
341
+ "img_path": "images/8738ceaf119afa5a651df1ca71a8e660f6f0ae20e134dd97e44c7111e646d177.jpg",
342
+ "table_caption": [],
343
+ "table_footnote": [
344
+ "(b) Ablation Study of Conceptualization Agent. "
345
+ ],
346
+ "table_body": "<table><tr><td>Metrics/ Method</td><td>CLIP Score</td><td>Failure Rate</td><td>Parameter Diversity</td></tr><tr><td>w/o CA</td><td>21.51</td><td>3.6%</td><td>6.32</td></tr><tr><td>Ours</td><td>30.30</td><td>0.8%</td><td>7.34</td></tr></table>",
347
+ "page_idx": 7
348
+ },
349
+ {
350
+ "type": "text",
351
+ "text": "Table 1: Ablation Study. “w/o CA” indicates without the Conceptualization Agent, “w/o TDA” indicates without the Task Dispatch Agent. ",
352
+ "page_idx": 7
353
+ },
354
+ {
355
+ "type": "text",
356
+ "text": "Case Study of Task Dispatch Agent. For the Task Dispatch Agent, the CLIP score is measured using 100 initial scene descriptions, each appended with one additional subsequence instruction for each scene. Table 1 (a) shows that without the Task Dispatch Agent, the CLIP score dropped from 29.16 to 22.79. It is important to note that the Task Dispatch Agent primarily impacts the performance of subsequence instructions, as all functions are utilized for the initial instruction. These findings underscore the pivotal role of the Task Dispatch Agent in managing communication flow. ",
357
+ "page_idx": 7
358
+ },
359
+ {
360
+ "type": "text",
361
+ "text": "Case Study of conceptualization Agent. For the Conceptualization Agent, the CLIP score is measured using 100 initial scene descriptions. Table 1 (b) displays the results, indicating that without the ",
362
+ "page_idx": 7
363
+ },
364
+ {
365
+ "type": "image",
366
+ "img_path": "images/ef046923e03741b5ac8fea9ae13ac6e8d69c8aef4bd187bfc69022d3537f83f9.jpg",
367
+ "image_caption": [
368
+ "Figure 6: Conceptualization Agent Case Study. The enriched textual evidence demonstrates that the Conceptualization Agent provides essential knowledge for parameter inference (highlighted in green). For each subfigure, we compare the 3D model without (Top) and with (Bottom) agent. The models generated with the agent better match the text description than those without it . "
369
+ ],
370
+ "image_footnote": [],
371
+ "page_idx": 8
372
+ },
373
+ {
374
+ "type": "text",
375
+ "text": "Conceptualization Agent, both text alignments (CLIP score) and parameter diversity decreased significantly. Moreover, the failure rate increased substantially, which adversely impacts the efficiency of the entire modeling process. Figure 6 illustrates how the Conceptualization Agent facilitates the acquisition of essential knowledge for 3D modeling, providing a visual comparison of results with and without its involvement. When the Conceptualization Agent is engaged, the generated results closely align with the appearance of the intended flower type, highlighting its invaluable contribution to elevating overall 3D generation quality and fidelity. ",
376
+ "page_idx": 8
377
+ },
378
+ {
379
+ "type": "text",
380
+ "text": "5 DISCUSSION AND CONCLUSION ",
381
+ "text_level": 1,
382
+ "page_idx": 8
383
+ },
384
+ {
385
+ "type": "text",
386
+ "text": "We have introduced 3D-GPT, a novel training-free framework for instruction-driven 3D modeling seamlessly integrated with procedural generation. Leveraging the capabilities of LLMs, 3DGPT aims to enhance human-AI communication in the context of 3D design. Our approach involves the collaborative efforts of three agents functioning as a cohesive 3D modeling team, ultimately yielding a 3D modeling file as output, as opposed to conventional 3D neural representations. Moreover, our method consistently delivers high-quality results, showcases adaptability to expansive scenes, ensures 3D consistency, provides material modeling and editing capabilities, and facilitates real ray tracing for achieving lifelike visualizations. Our empirical experiments show the potential of LLMs for reasoning, planning, and tool using in procedural 3D modeling. ",
387
+ "page_idx": 8
388
+ },
389
+ {
390
+ "type": "text",
391
+ "text": "Limitations and Potential Directions. While our framework has demonstrated promising 3D modeling results closely aligned with user instructions, it is essential to acknowledge several limitations: 1) Limited curve control and shading design: Currently, our framework lacks advanced capabilities for precise curve control and intricate shading design. Tasks involving the manipulation of tree branches or the blending of colors for leaf textures remain challenging. 2) Dependence on procedural generation algorithms: the effectiveness of our framework is contingent on the quality and availability of procedural generation algorithms. This reliance may limit results in specific categories, such as hair and fur. 3) Handling multi-modal instructions: challenges arise in processing multi-modal instructions, including audio and image inputs, potentially leading to information loss. These limitations offer valuable insights for shaping future research and development in the field. We highlight three compelling directions for future investigation: ",
392
+ "page_idx": 8
393
+ },
394
+ {
395
+ "type": "text",
396
+ "text": "LLM 3D Fine-Tuning: It is promising to fine-tune LLMs to enhance their capabilities in geometry control, shading design, and fine-texture modeling. This refinement will make LLMs more adept at handling intricate 3D modeling tasks and grant greater creative control over the resulting 3D scenes. Autonomous Rule Discovery: Building on the demonstrated tool-making capabilities of LLMs, one direction is to develop an autonomous 3D modeling system that reduces human involvement. This could empower LLMs to autonomously discover generation rules for new object classes and scenes, thus expanding the creative potential. ",
397
+ "page_idx": 8
398
+ },
399
+ {
400
+ "type": "text",
401
+ "text": "Multi-Modal Instruction Processing: To achieve more comprehensive and expressive 3D modeling based on varied user inputs, it is crucial to enhance the system’s ability to comprehend and respond to multi-modal instructions. This would facilitate richer and more diverse 3D modeling outcomes, shaped by a broader spectrum of user inputs. ",
402
+ "page_idx": 8
403
+ },
404
+ {
405
+ "type": "text",
406
+ "text": "REFERENCES ",
407
+ "text_level": 1,
408
+ "page_idx": 9
409
+ },
410
+ {
411
+ "type": "text",
412
+ "text": "Sebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece ´ Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, Harsha Nori, Hamid Palangi, Marco Tulio Ribeiro, and Yi Zhang. Sparks of artificial general intelligence: Early experiments with GPT-4. arXiv preprint arXiv:2303.12712, 2023. \nAakanksha 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. arXiv preprint arXiv:2204.02311, 2022. \nMatt Deitke, Eli VanderBilt, Alvaro Herrasti, Luca Weihs, Kiana Ehsani, Jordi Salvador, Winson Han, Eric Kolve, Aniruddha Kembhavi, and Roozbeh Mottaghi. ProcTHOR: Large-scale embodied ai using procedural generation. Advances in Neural Information Processing Systems, 35: 5982–5994, 2022. \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. \nLijie Fan, Dilip Krishnan, Phillip Isola, Dina Katabi, and Yonglong Tian. Improving clip training with language rewrites. arXiv preprint arXiv:2305.20088, 2023. \nRan Gong, Qiuyuan Huang, Xiaojian Ma, Hoi Vo, Zane Durante, Yusuke Noda, Zilong Zheng, Song-Chun Zhu, Demetri Terzopoulos, Li Fei-Fei, and Jianfeng Gao. MindAgent: Emergent gaming interaction. arXiv preprint arXiv:2309.09971, 2023. \nKlaus Greff, Francois Belletti, Lucas Beyer, Carl Doersch, Yilun Du, Daniel Duckworth, David J Fleet, Dan Gnanapragasam, Florian Golemo, Charles Herrmann, Thomas Kipf, Abhijit Kundu, Dmitry Lagun, Issam Laradji, Hsueh-Ti (Derek) Liu, Henning Meyer, Yishu Miao, Derek Nowrouzezahrai, Cengiz Oztireli, Etienne Pot, Noha Radwan, Daniel Rebain, Sara Sabour, Mehdi S. M. Sajjadi, Matan Sela, Vincent Sitzmann, Austin Stone, Deqing Sun, Suhani Vora, Ziyu Wang, Tianhao Wu, Kwang Moo Yi, Fangcheng Zhong, and Andrea Tagliasacchi. Kubric: A scalable dataset generator. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3749–3761, 2022. \nJu He, Enyu Zhou, Liusheng Sun, Fei Lei, Chenyang Liu, and Wenxiu Sun. Semi-synthesis: A fast way to produce effective datasets for stereo matching. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2884–2893, 2021. \nWenlong Huang, Pieter Abbeel, Deepak Pathak, and Igor Mordatch. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. In International Conference on Machine Learning, pp. 9118–9147, 2022. \nWenlong Huang, Chen Wang, Ruohan Zhang, Yunzhu Li, Jiajun Wu, and Li Fei-Fei. VoxPoser: Composable 3D value maps for robotic manipulation with language models. arXiv preprint arXiv:2307.05973, 2023. \nShima Imani, Liang Du, and Harsh Shrivastava. Mathprompter: Mathematical reasoning using large language models. arXiv preprint arXiv:2303.05398, 2023. \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, pp. 867–876, 2022. \nKatharina Jeblick, Balthasar Schachtner, Jakob Dexl, Andreas Mittermeier, Anna Theresa Stuber, ¨ Johanna Topalis, Tobias Weber, Philipp Wesp, Bastian Sabel, Jens Ricke, and Michael Ingrisch. ChatGPT makes medicine easy to swallow: An exploratory case study on simplified radiology reports. arXiv preprint arXiv:2212.14882, 2022. \nChenfanfu Jiang, Siyuan Qi, Yixin Zhu, Siyuan Huang, Jenny Lin, Lap-Fai Yu, Demetri Terzopoulos, and Song-Chun Zhu. Configurable 3D scene synthesis and 2D image rendering with per-pixel ground truth using stochastic grammars. International Journal of Computer Vision, 126:920–941, 2018. \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, pp. 300–309, 2023. \nMinghua Liu, Chao Xu, Haian Jin, Linghao Chen, Zexiang Xu, Hao Su, et al. One-2-3-45: Any single image to 3D mesh in 45 seconds without per-shape optimization. arXiv preprint arXiv:2306.16928, 2023. \nLuke Melas-Kyriazi, Christian Rupprecht, Iro Laina, and Andrea Vedaldi. Realfusion: 360 reconstruction of any object from a single image. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, 2023. \nSachit Menon and Carl Vondrick. Visual classification via description from large language models. arXiv preprint arXiv:2210.07183, 2022. \nGal Metzer, Elad Richardson, Or Patashnik, Raja Giryes, and Daniel Cohen-Or. Latent-NeRF for shape-guided generation of 3D shapes and textures. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12663–12673, 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. Communications of the ACM, 65(1):99–106, 2021. \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. \nOpenAI. GPT-4 technical report, 2023. \nBen Poole, Ajay Jain, Jonathan T Barron, and Ben Mildenhall. DreamFusion: Text-to-3D using 2D diffusion. arXiv preprint arXiv:2209.14988, 2022. \nSarah Pratt, Ian Covert, Rosanne Liu, and Ali Farhadi. What does a platypus look like? generating customized prompts for zero-shot image classification. arXiv preprint arXiv:2209.03320, 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 International conference on machine learning, pp. 8748–8763. PMLR, 2021. \nColin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1–67, 2020. \nAlexander Raistrick, Lahav Lipson, Zeyu Ma, Lingjie Mei, Mingzhe Wang, Yiming Zuo, Karhan Kayan, Hongyu Wen, Beining Han, Yihan Wang, Alejandro Newell, Hei Law, Ankit Goyal, Kaiyu Yang, and Jia Deng. Infinite photorealistic worlds using procedural generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12630–12641, 2023. \nAmit Raj, Srinivas Kaza, Ben Poole, Michael Niemeyer, Ben Mildenhall, Nataniel Ruiz, Shiran Zada, Kfir Aberman, Michael Rubenstein, Jonathan Barron, Yuanzhen Li, and Varun Jampani. DreamBooth3D: Subject-driven text-to-3D generation. In Proceedings of the International Conference on Computer Vision, 2023. \nRobin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High- ¨ resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 10684–10695, 2022. \nAditya Sanghi, Hang Chu, Joseph G Lambourne, Ye Wang, Chin-Yi Cheng, Marco Fumero, and Kamal Rahimi Malekshan. CLIP-Forge: Towards zero-shot text-to-shape generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18603–18613, 2022. \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, 2023. \nJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc Le, and Denny Zhou. Chain-of-thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35:24824–24837, 2022. \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. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 20908–20918, 2023. \nKailai Yang, Shaoxiong Ji, Tianlin Zhang, Qianqian Xie, and Sophia Ananiadou. On the evaluations of ChatGPT and emotion-enhanced prompting for mental health analysis. arXiv preprint arXiv:2304.03347, 2023. \nAndy Zeng, Maria Attarian, Brian Ichter, Krzysztof Choromanski, Adrian Wong, Stefan Welker, Federico Tombari, Aveek Purohit, Michael Ryoo, Vikas Sindhwani, Johnny Lee, Vincent Vanhoucke, and Pete Florence. Socratic models: Composing zero-shot multimodal reasoning with language. arXiv preprint arXiv:2204.00598, 2022. \nCeyao Zhang, Kaijie Yang, Siyi Hu, Zihao Wang, Guanghe Li, Yihang Sun, Cheng Zhang, Zhaowei Zhang, Anji Liu, Song-Chun Zhu, Xiaojun Chang, Junge Zhang, Feng Yin, Yitao Liang, and Yaodong Yang. Proagent: Building proactive cooperative ai with large language models. arXiv preprint arXiv:2308.11339, 2023a. \nLvmin Zhang, Anyi Rao, and Maneesh Agrawala. Adding conditional control to text-to-image ",
413
+ "page_idx": 9
414
+ },
415
+ {
416
+ "type": "text",
417
+ "text": "",
418
+ "page_idx": 10
419
+ },
420
+ {
421
+ "type": "text",
422
+ "text": "",
423
+ "page_idx": 11
424
+ },
425
+ {
426
+ "type": "text",
427
+ "text": "diffusion models. In IEEE International Conference on Computer Vision (ICCV), 2023b. ",
428
+ "page_idx": 11
429
+ },
430
+ {
431
+ "type": "text",
432
+ "text": "6 APPENDIX ",
433
+ "text_level": 1,
434
+ "page_idx": 12
435
+ },
436
+ {
437
+ "type": "text",
438
+ "text": "6.1 ADDITIONAL RESULT ",
439
+ "text_level": 1,
440
+ "page_idx": 12
441
+ },
442
+ {
443
+ "type": "text",
444
+ "text": "We kindly request the reader to consider visiting https://anonymous0888.github.io/ 3DGPT/3dgpt.html to view our high-quality 3D results. ",
445
+ "page_idx": 12
446
+ },
447
+ {
448
+ "type": "text",
449
+ "text": "6.2 ADDITIONAL ABLATION STUDY ",
450
+ "text_level": 1,
451
+ "page_idx": 12
452
+ },
453
+ {
454
+ "type": "text",
455
+ "text": "We conduct three distinct ablation studies examining prompting components (Table 2), various Large Language Models (Table 3), and example numbers (Table 4). ",
456
+ "page_idx": 12
457
+ },
458
+ {
459
+ "type": "table",
460
+ "img_path": "images/96dc032200977fd83c3ded80666b4d8f3ee6f175ae46e717b4e0a49c5ef9c8a1.jpg",
461
+ "table_caption": [
462
+ "Table 2: Ablation Study of Prompting Components D/C/I/E. "
463
+ ],
464
+ "table_footnote": [],
465
+ "table_body": "<table><tr><td>Metrics/Method</td><td>CLIP Score</td><td>Failure Rate</td><td>Parameter Diversity</td></tr><tr><td>w/o D</td><td>20.7</td><td>4.2%</td><td>6.94</td></tr><tr><td>w/o C</td><td>28.4</td><td>1.8%</td><td>6.74</td></tr><tr><td>w/oI</td><td>21.6</td><td>1.4%</td><td>6.38</td></tr><tr><td>w/oE</td><td>24.5</td><td>3.4%</td><td>7.89</td></tr><tr><td>Ours</td><td>30.3</td><td>0.8%</td><td>7.34</td></tr></table>",
466
+ "page_idx": 12
467
+ },
468
+ {
469
+ "type": "table",
470
+ "img_path": "images/114c666a14d3bf238e9a9a1884ff7c52abd838816d93c02b89e3049a5b71a675.jpg",
471
+ "table_caption": [
472
+ "Table 3: Ablation Study of Different Large Language Model. "
473
+ ],
474
+ "table_footnote": [],
475
+ "table_body": "<table><tr><td>Metrics/Model</td><td>CLIP Score</td><td>Failure Rate</td><td>Parameter Diversity</td></tr><tr><td>LLAMA2</td><td>29.7</td><td>1.4%</td><td>6.97</td></tr><tr><td>GPT4</td><td>31.2</td><td>0.6%</td><td>7.23</td></tr><tr><td>GPT3.5</td><td>30.3</td><td>0.8%</td><td>7.34</td></tr></table>",
476
+ "page_idx": 12
477
+ },
478
+ {
479
+ "type": "table",
480
+ "img_path": "images/f83223ae2c818fc165154b287f638f0b1b3e1d46c34bf5ddefe2204a2d905234.jpg",
481
+ "table_caption": [
482
+ "Table 4: Ablation Study of Example Number. "
483
+ ],
484
+ "table_footnote": [],
485
+ "table_body": "<table><tr><td>Metrics/Shots</td><td>CLIP Score</td><td>Failure Rate</td><td>Parameter Diversity</td></tr><tr><td>0</td><td>24.5</td><td>3.4%</td><td>7.89</td></tr><tr><td>1</td><td>30.3</td><td>0.8%</td><td>7.34</td></tr><tr><td>2</td><td>30.1</td><td>1.0%</td><td>7.23</td></tr><tr><td>3</td><td>30.2</td><td>0.8%</td><td>6.93</td></tr></table>",
486
+ "page_idx": 12
487
+ },
488
+ {
489
+ "type": "image",
490
+ "img_path": "images/09aeb3f0c8468c9465e0508588c5b431c7665fe1928ef395851b609c6363ca5f.jpg",
491
+ "image_caption": [
492
+ "DreamFusion ",
493
+ "Ours ",
494
+ "DreamFusion ",
495
+ "“A misty spring morning, where dew-kissed flowers dot a lush meadow surrounded by budding trees.” "
496
+ ],
497
+ "image_footnote": [],
498
+ "page_idx": 12
499
+ },
500
+ {
501
+ "type": "image",
502
+ "img_path": "images/acbb643400cbc820396e2dd7f49f0ca7630f1e9bbc8dc9c705de239615aded89.jpg",
503
+ "image_caption": [
504
+ "Ours "
505
+ ],
506
+ "image_footnote": [],
507
+ "page_idx": 12
508
+ },
509
+ {
510
+ "type": "text",
511
+ "text": "Ours ",
512
+ "page_idx": 12
513
+ },
514
+ {
515
+ "type": "text",
516
+ "text": "DreamFusion ",
517
+ "page_idx": 12
518
+ },
519
+ {
520
+ "type": "image",
521
+ "img_path": "images/a2799aa44df6e2ed444cab10714afb180d018e4537b76f7db9702ab545e61081.jpg",
522
+ "image_caption": [],
523
+ "image_footnote": [],
524
+ "page_idx": 12
525
+ },
526
+ {
527
+ "type": "image",
528
+ "img_path": "images/85432c967b74f3304419bf98327c73ee5f6847a14ee0fb0ee1ea54a466dee5fd.jpg",
529
+ "image_caption": [
530
+ "“A vibrant autumn forest, with trees ablaze in shades of red, orange, and gold, as a gentle breeze rustles the fallen leaves.” "
531
+ ],
532
+ "image_footnote": [],
533
+ "page_idx": 12
534
+ },
535
+ {
536
+ "type": "text",
537
+ "text": "“A serene winter landscape, with snow-covered evergreen trees and a frozen lake reflecting the pale sunlight.” ",
538
+ "page_idx": 12
539
+ },
540
+ {
541
+ "type": "text",
542
+ "text": "“The mountains, majestic and snow-capped, stood like sentinels guarding the vast expanse of the valley, their peaks disappearing into the swirling mist that clung to their rugged slopes.” ",
543
+ "page_idx": 12
544
+ },
545
+ {
546
+ "type": "text",
547
+ "text": "“The desert, an endless sea of shifting sands, stretched to the horizon, its rippling dunes catching the golden rays of the setting sun, creating an everchanging landscape of shadows and light.” ",
548
+ "page_idx": 12
549
+ },
550
+ {
551
+ "type": "image",
552
+ "img_path": "images/7db1db29eb3ed7d4208c0cbd81e994b17421f7731cc9032db794dfa171e25708.jpg",
553
+ "image_caption": [
554
+ "Figure 7: Comparison with Dreamfusion (Scene). "
555
+ ],
556
+ "image_footnote": [],
557
+ "page_idx": 12
558
+ },
559
+ {
560
+ "type": "image",
561
+ "img_path": "images/a82585ecd6901f838a14b107c46087b8044ff9ea2ef61e7c26454a77ae2b0ceb.jpg",
562
+ "image_caption": [
563
+ "“The lake, serene and glassy, mirrored the cloudless sky above, reflecting the surrounding mountains and the graceful flight of a heron, as lily pads floated like emerald jewels upon its tranquil surface.\" "
564
+ ],
565
+ "image_footnote": [],
566
+ "page_idx": 12
567
+ },
568
+ {
569
+ "type": "image",
570
+ "img_path": "images/7bb4ed447cb292066ddc8dc05500ea52a73dd73ce6eedaed19bfd3420632f678.jpg",
571
+ "image_caption": [
572
+ "Figure 8: Comparison with Dreamfusion (Single Object). "
573
+ ],
574
+ "image_footnote": [],
575
+ "page_idx": 13
576
+ },
577
+ {
578
+ "type": "text",
579
+ "text": "6.3 COMPARISON WITH TEXT-TO-3D ",
580
+ "text_level": 1,
581
+ "page_idx": 13
582
+ },
583
+ {
584
+ "type": "text",
585
+ "text": "We offer side-by-side comparisons with a state-of-the-art Text-to-3D method Dreamfusion (Poole et al., 2022) for single objects and scene, as illustrated in Figure 8 and Figure 7, respectively. ",
586
+ "page_idx": 13
587
+ },
588
+ {
589
+ "type": "text",
590
+ "text": "6.4 IMPLEMENTATION DETAIL ",
591
+ "text_level": 1,
592
+ "page_idx": 13
593
+ },
594
+ {
595
+ "type": "text",
596
+ "text": "We provide the code that enumerates the functions within Infinigen used in constructing our 3D scene. While a similar Python file can be found at https://github.com/princeton-vl/ infinigen/blob/main/worldgen/generate.py, our script is uniquely tailored to work with a control dictionary generated by three agents, enabling controllable scene generation. ",
597
+ "page_idx": 13
598
+ },
599
+ {
600
+ "type": "image",
601
+ "img_path": "images/1592b55c600ed474d6516a311c2b2762a38c1aabc2394166957f520d90fb053d.jpg",
602
+ "image_caption": [],
603
+ "image_footnote": [],
604
+ "page_idx": 13
605
+ },
606
+ {
607
+ "type": "image",
608
+ "img_path": "images/9658a1a8dc814c1d868c8e45a3eac9734706a73032ce2505b65217f4196a1157.jpg",
609
+ "image_caption": [
610
+ "Listing 1: Agent Implementation Example "
611
+ ],
612
+ "image_footnote": [],
613
+ "page_idx": 14
614
+ },
615
+ {
616
+ "type": "text",
617
+ "text": "We offer the code to implement the modeling agent as a demonstration of how to utilize the OpenAI API for implementing our agent. ",
618
+ "page_idx": 14
619
+ },
620
+ {
621
+ "type": "text",
622
+ "text": "def modeling_function_call(text_description,function_description, function, 2 function_document,example,max_tokens $= 2 0 0 0$ , temperature ${ } = 0$ .3,history $= [ ~ ]$ ): 3 \"\"\" 4 Give a short text, call the given functions to generation objects/ scene to fit the given text description Parameters 6 text_description: short user given text. 8 function_description: short function description. 9 function: python code. 10 function_document: the detail description of the function. 11 example: example of how to use the function. 12 max_tokens: max tokens for the detailed text. 13 temperature 14 Returns 15 16 response from the agent that contains the function calls. 17 \"\"\" 18 if(len(history) $\\scriptstyle = = 0$ ): 19 history $=$ [ 20 {\"role\":\"system\", \"content\":\"You are a good 3D designer who can convert long text descriptions into parameters, and is good at understanding Python functions to manipulate 3D content. \"}, 21 22 messages $=$ history 23 24 text $=$ f\"\"\"We have the following function codes function_description} to control blender by python : {function}. 25 Following are the document for function: {function_document}. 26 Below is an example bout how to make function calls to model the scene to fit the description: {example}. 27 Question: Given the text description: {text_description} analysis the function parameter and call the function to { function_description}\"\"\" 28 messages.append({\"role\": \"user\",\"content\":text}) 29 30 conceptualization_augmentation_model $=$ openai.ChatCompletion.create ( 31 model $=$ \"gpt-3.5-turbo\", 32 temperature $=$ temperature, ",
623
+ "page_idx": 14
624
+ },
625
+ {
626
+ "type": "table",
627
+ "img_path": "images/af36cb3d21eaec83cee417ff6dea5993d83e848e59701c045156898bdc8a7020.jpg",
628
+ "table_caption": [],
629
+ "table_footnote": [],
630
+ "table_body": "<table><tr><td>33</td><td>max_tokens = max_tokens,</td></tr><tr><td>34</td><td>messages = messages</td></tr><tr><td>35</td><td></td></tr><tr><td>36</td><td></td></tr><tr><td>37</td><td>conceptualization_text = conceptualization_augmentation_model.</td></tr><tr><td>38</td><td>choices[0].message[&quot;content&quot;] return conceptualization_text,messages</td></tr></table>",
631
+ "page_idx": 15
632
+ },
633
+ {
634
+ "type": "text",
635
+ "text": "6.5 DISCUSSION OF FUNCTION SET SIZE ",
636
+ "text_level": 1,
637
+ "page_idx": 15
638
+ },
639
+ {
640
+ "type": "text",
641
+ "text": "Assessing the impact of function set size and parameter count can be complex due to variations in function significance. In Figure 9, we can see that removing rock modeling has a minimal impact on the modeling outcome. On the other hand, eliminating the water modeling function makes river modeling impossible, leading to a significant reduction in the alignment between the generated 3D scene and the text description. ",
642
+ "page_idx": 15
643
+ },
644
+ {
645
+ "type": "image",
646
+ "img_path": "images/1daed1df9d181cde5244cf2d1422d34f8e0507cf2c5c360907b98ea1dfbe9847.jpg",
647
+ "image_caption": [
648
+ "Listing 2: Agent Implementation Example ",
649
+ "(a). Remove rock modeling "
650
+ ],
651
+ "image_footnote": [],
652
+ "page_idx": 15
653
+ },
654
+ {
655
+ "type": "image",
656
+ "img_path": "images/806bae712a7cc285dfedfc32076ace948452cb8b9394cf0c46a48f63f39fe4e7.jpg",
657
+ "image_caption": [
658
+ "(b). Remove water modeling "
659
+ ],
660
+ "image_footnote": [],
661
+ "page_idx": 15
662
+ },
663
+ {
664
+ "type": "image",
665
+ "img_path": "images/e19aeb9428158b6b2e0cd0e97b5d4e003891f7d20d53808677973d0372be1d1d.jpg",
666
+ "image_caption": [
667
+ "(c). Full function set ",
668
+ "Figure 9: Ablation study of Different Function Set "
669
+ ],
670
+ "image_footnote": [],
671
+ "page_idx": 15
672
+ },
673
+ {
674
+ "type": "text",
675
+ "text": "“The lake, serene and glassy, mirrored the cloudless sky above, reflecting the surrounding mountains and the graceful flight of a heron, as lily pads floated like emerald jewels upon its tranquil surface.\" ",
676
+ "page_idx": 15
677
+ },
678
+ {
679
+ "type": "text",
680
+ "text": "6.6 ABLATION STUDY DETAILS ",
681
+ "text_level": 1,
682
+ "page_idx": 15
683
+ },
684
+ {
685
+ "type": "text",
686
+ "text": "We conduct separate ablation studies for the Conceptualization Agent and Task Dispatch Agent, evaluating their performance based on CLIP scores, failure rates, and parameter diversity. ",
687
+ "page_idx": 15
688
+ },
689
+ {
690
+ "type": "text",
691
+ "text": "We use the implementation of Radford et al. (2021) to calculate CLIP score. It measures cosine similarity in the CLIP hidden space, indicating the alignment between generated images and text descriptions. For 3D scene CLIP scores, we placed a camera at the scene’s center, capturing 50 images by rotating the camera 360 degrees. In the Conceptualization Agent evaluation, we used only the initial instruction. For the Task Dispatch Agent, both the initial instruction and one subsequence instruction were used. ",
692
+ "page_idx": 15
693
+ },
694
+ {
695
+ "type": "text",
696
+ "text": "The failure rate reflects the Modeling Agent’s response. Failures can occur when the method cannot extract the correct pattern via the parser, generates data with an incorrect datatype, or omits/adds parameters to the function call. We evaluated five functions for each scene, recording the failure rate. We also assessed 500 parameters per scene, employing the Shannon Diversity Index to measure parameter diversity, and categorizing float parameters into 100 bins. ",
697
+ "page_idx": 15
698
+ },
699
+ {
700
+ "type": "text",
701
+ "text": "6.7 AGENT RESPONSES ",
702
+ "text_level": 1,
703
+ "page_idx": 15
704
+ },
705
+ {
706
+ "type": "text",
707
+ "text": "Figure 10, Figure 11 and Figure 12 demonstrate how the system communicates with Task Dispatch Agent, Conceptualization Agent, and Modeling Agent, respectively. The Task Dispatch Agent example is deliberately simplified, featuring only four functions to ensure conciseness. In contrast, the examples for the Conceptualization Agent and Modeling Agent are derived from our comprehensive implementation. ",
708
+ "page_idx": 15
709
+ },
710
+ {
711
+ "type": "text",
712
+ "text": "You are a proficient planner for selecting suitable functions based on user instructions. You are provided with the following functions: 1. generate_terrain(): model the 3D terrain. \n2. generate_tree(): generate trees with parameters that controls the tree appearance and place them on the terrain surface. \n3. add_grass(): add grass to the terrain surface() \n4. apply_snow_layer(): add snow to the surface of all objects. \nBelow are examples of how to choose functions based on user instructions: \nUser: My instruction is: \"Change weather to snowy.\" Answer: Based on the function provided above and the user instruction, the apply_snow_layer() function from above function set is suitable to call. It will add snow to all objects covered by snow and make it look like a snowy scene. Other functions (1,2,3) are not relevant to the user instruction. Given the instructions, we determine the sublist of functions that need to be used for 3D modeling: [4] \nUser: My instruction is: “Change tree leaf to yellow.\" Based on the user instruction, \"Change tree leaf to yellow,\" you can use the generate_tree() function to generate trees with yellow leaves. You can modify the parameters of the generate_tree() function to control the appearance of the trees, including the color of their leaves. Other functions (1, 3, 4) are not relevant to changing the color of tree leaves. Given the instructions, we determine the sublist of functions that need to be used for 3D modeling: \n[2] \nSo, the suitable function to call in this case is generate_tree() with the appropriate parameters for yellow leaves. Given a text description \"A peaceful clearing in a dense forest, blanketed in fresh, untouched snow. Tall birch trees, their white bark standing out starkly against the dark evergreens and the gray, overcast sky, form a natural cathedral.\", provide detailed descriptions for the following information: \"possible daytime, sun intensity, air condition, sky appearance, cloud density.”. \nFor term not mentioned in the description, use your imagination to ensure they fit the text description. ",
713
+ "page_idx": 16
714
+ },
715
+ {
716
+ "type": "text",
717
+ "text": "",
718
+ "page_idx": 16
719
+ },
720
+ {
721
+ "type": "image",
722
+ "img_path": "",
723
+ "image_caption": [
724
+ "Figure 10: Communication Between System and Task Dispatch Agent. "
725
+ ],
726
+ "image_footnote": [],
727
+ "page_idx": 16
728
+ },
729
+ {
730
+ "type": "text",
731
+ "text": "",
732
+ "page_idx": 16
733
+ },
734
+ {
735
+ "type": "image",
736
+ "img_path": "images/c4a6bd558d3470797682f5cd4a6d9165603a747f4f12972b24798b6621a4858a.jpg",
737
+ "image_caption": [
738
+ "Figure 11: Communication Between System and Conceptualization Agent. "
739
+ ],
740
+ "image_footnote": [],
741
+ "page_idx": 16
742
+ },
743
+ {
744
+ "type": "text",
745
+ "text": "6.8 VISUAL RESULT ",
746
+ "text_level": 1,
747
+ "page_idx": 16
748
+ },
749
+ {
750
+ "type": "text",
751
+ "text": "Figure 13 and Figure 14 show the prompts for modelling trees and sky. The visual control result for a full scene is illustrated in Figure 15. ",
752
+ "page_idx": 16
753
+ },
754
+ {
755
+ "type": "text",
756
+ "text": "We have the following function codes modelling the sky appearance using nishita method to control blender by python : \n\\`\\`python \nimport nishita_sky_modelling def sky_texture_node(sun_intensity,sun_elevation,sun_rotation,air_density,dust_density, ozone,cloud_density): texture = nishita_sky_modelling(sun_intensity,sun_elevation,sun_rotation,air_density,dust_density, ozone,cloud_density) return \nFollowing are the document for function: “ input: \nsun_intensity: Multiplier for sun disc lighting. (choose from ‘low’,’median’,’high’) \nsun_elevation: Rotation of the sun from the horizon (in degrees). (0:sunset,sun rising, 90:daytime,-10:night) \nsun_rotation: Rotation of the sun around the zenith (in degrees). air_density: density of air molecules. (0 no air, 1 clear day atmosphere, 2 highly polluted day) \ndust_density: density of dust and water droplets. (0 no dust, 1 clear day atmosphere, 5 city like atmosphere, 10 hazy day) ozone: density of ozone molecules; useful to make the sky appear bluer. (0 no ozone, 1 clear day atmosphere, 2 city like atmosphere). \nhigher value for bluer sky. \ncloud_density: density of the cloud, varying from 0 to 0.04. (0.01 very thick cloud, 0.04 very heavy cloud) output: texture color output.” Below is an example bout how to make function calls to model the scene to fit the description: Question: given the text description of the scene: “The river, reflecting the clear blue of the sky, glistened like a silver ribbon as it wound \nits way through the lush valley, its tranquil waters whispering secrets to the ancient trees.” analysis the function parameter and call the \nfunction to generate the sky. \nSolution: From the description of “clear blue sky”, the sun_intensiy can not be low, let's set it as \"median\";As the sky is blue, the \nsun_elevation cannot be very low (not morning/sunset/evening), we can set it to 50. The sun rotation does not affect the sky appearance, let's set it to 0. To fit the description of \"clear blue\". The air_density and \ndust_density should be low, we can set air_density to 1, dust_density to 0. To make the sky more blue, we can increase the ozone value, \nlet’s make it as 2. As the sky is very blue and clear, the cloud density should be low, we can set it as 0.0005. We can model the sky by calling the following \nfunction: \\`\\`\\`python sky_texture_node(sun_intensity = ‘median’,sun_elevation=50,sun_rotation=0,air_density=1,dust_density=0, \nozone=2,cloud_density=0.0005)\\`\\`\\` Question: Given the text description: “A peaceful clearing in a dense forest, blanketed in fresh, untouched snow. Tall birch trees, their \nwhite bark standing out starkly against the dark evergreens and the gray, overcast sky, form a natural cathedral. In this peaceful clearing, the \nscene is bathed in the soft glow of early morning light. The sun, just beginning to rise above the horizon, casts a gentle, golden hue across \nthe landscape. Its intensity is subdued, as if still gathering strength to break through the thick canopy of trees that surround the clearing. \nThe air in the clearing is crisp and cool, carrying with it a hint of winter's bite. It is still and calm, devoid of any breeze or gusts that might \ndisturb the tranquility of the scene. The air feels pure and invigorating, as if it has been untouched by human presence. \nLooking up towards the sky, the overcast conditions create a muted, gray backdrop. The clouds hang low, their edges blending seamlessly \nwith the horizon, creating a sense of enclosure within the clearing. The sky appears vast, yet somehow intimate, as if it is a part of the \nnatural cathedral formed by the towering birch trees. \nThe cloud density is moderate, with the clouds spread out across the sky in a gentle, billowing fashion. They are not heavy or oppressive, but \nrather wispy and ethereal, adding a touch of mystery to the scene. As the day progresses, the clouds shift and change shape, creating a \ndynamic and ever-evolving canvas above the clearing. \nOverall, the daytime in this clearing is characterized by a serene ambiance, with the sun‘s gentle rays filtering through the dense forest and \nthe sky adorned with a delicate veil of clouds. It is a scene that invites contemplation and reflection, a sanctuary of tranquility amidst the \nwild beauty of nature.” analysis the function parameter and call the function to modelling the sky appearance using nishita method. Based on the description, we can analyze the function parameters as follows: \n- sun_intensity: The description mentions a \"soft glow of early morning light\" and the sun's intensity is described as \"subdued\". Let's set the sun_intensity to 'low'. \n- sun_elevation: The sun is described as \"just beginning to rise above the horizon\". Let's set the sun_elevation to -5. \n- sun_rotation: The description does not provide any specific information about the sun's rotation, so we can set it to 0. \n- air_density: The air is described as \"crisp and cool\" and \"untouched by human presence\". Let's set the air_density to 0. \n- dust_density: The description does not mention any dust or particles in the air, so we can set the dust_density to 0. \n- ozone: The description does not provide any specific information about the ozone density, so we can set it to 1. \n- cloud_density: The clouds are described as \"moderate\" and \"spread out across the sky in a gentle, billowing fashion\". Let's set the cloud_density to 0.02. \nWe can model the sky by calling the following function: \n\\`\\`\\`python \nsky_texture_node(sun_intensity='low', sun_elevation=-5, sun_rotation=0, air_density=0, dust_density=0, ozone=1, cloud_density=0.02) ",
757
+ "page_idx": 17
758
+ },
759
+ {
760
+ "type": "text",
761
+ "text": "",
762
+ "page_idx": 17
763
+ },
764
+ {
765
+ "type": "image",
766
+ "img_path": "",
767
+ "image_caption": [
768
+ "Figure 12: Communication Between System and Modeling Agent. "
769
+ ],
770
+ "image_footnote": [],
771
+ "page_idx": 17
772
+ },
773
+ {
774
+ "type": "text",
775
+ "text": "Document: ",
776
+ "text_level": 1,
777
+ "page_idx": 18
778
+ },
779
+ {
780
+ "type": "text",
781
+ "text": "Explanation: The function takes a built natural scene as input and adds base trees to it. ",
782
+ "page_idx": 18
783
+ },
784
+ {
785
+ "type": "text",
786
+ "text": "Inputs: ",
787
+ "text_level": 1,
788
+ "page_idx": 18
789
+ },
790
+ {
791
+ "type": "text",
792
+ "text": "scene: The built natural scene. \ndensity(float): The density of the trees. \ndistance_min(float): Minimum distance between trees. ",
793
+ "page_idx": 18
794
+ },
795
+ {
796
+ "type": "text",
797
+ "text": "eaf_type(string): The type of leaf on the tree. Select one from the list [‘leaf’, ‘leaf_broadleaf’, ‘leaf_ginko’, ‘leaf_maple’, ‘flower’, ‘N ",
798
+ "page_idx": 18
799
+ },
800
+ {
801
+ "type": "text",
802
+ "text": "‘Leaf’ allows further custom settings like changing the leaf shape and color. ‘Leaf_broadleaf’, ‘leaf_ginko’, and ‘leaf_maple’ build the leaves with predefined shapes: broad, ginko, and maple respectively. ‘Flower’ will create flowers on the tree instead of leaves. ‘None’ will not generate leaves on the tree. ",
803
+ "page_idx": 18
804
+ },
805
+ {
806
+ "type": "text",
807
+ "text": "fruit_type(string): The type of fruit on the tree. Select one from the list [‘apple’, ‘blackberry’, ‘coconut_green’, ‘durian’, ‘starfruit’, ‘strawberry’, ‘custom_fruit’, ‘None’]. Each of the fruit types will create the corresponding fruit on the tree. ‘Custom_fruit’ can create customizable fruit on the tree with further adjustments. If the desired fruit is not on the list, ‘custom_fruit’ should be chosen. ‘None’ will not generate any fruit on the tree. ",
808
+ "page_idx": 18
809
+ },
810
+ {
811
+ "type": "table",
812
+ "img_path": "images/31c557de7193ef0bae6c3001ef30a6b489869dba9b5c8b0f52ed316a23d5f5d3.jpg",
813
+ "table_caption": [],
814
+ "table_footnote": [],
815
+ "table_body": "<table><tr><td>Code:</td></tr><tr><td>&quot;python</td></tr><tr><td>importTreeFactory</td></tr><tr><td>defadd_trees(scene,density,distance_min,leaf_type,fruit_type,leaf_deity):</td></tr><tr><td>trees=TreFactory.create(densityeaftypefruit_type,eafesity)#eatetre scene.placement(trees, distance_min) # place trees in the scene</td></tr><tr><td>return</td></tr><tr><td></td></tr></table>",
816
+ "page_idx": 18
817
+ },
818
+ {
819
+ "type": "text",
820
+ "text": "Information: ",
821
+ "text_level": 1,
822
+ "page_idx": 18
823
+ },
824
+ {
825
+ "type": "text",
826
+ "text": "\"Possible trees in the scene, tree types, leaf density, possible seasons, tree size, appearance of the tree branch, branch type, and leaf color.\" ",
827
+ "page_idx": 18
828
+ },
829
+ {
830
+ "type": "text",
831
+ "text": "Example: ",
832
+ "text_level": 1,
833
+ "page_idx": 18
834
+ },
835
+ {
836
+ "type": "text",
837
+ "text": "Question: Given the text description of the scene, analyze the function parameters and call the function to add more trees that fit the text description. ",
838
+ "page_idx": 18
839
+ },
840
+ {
841
+ "type": "text",
842
+ "text": "Solution: From the text description, three different types of trees are identified in the scene: birch, dogwood, and Japanese maple. From “a cluster of,” we infer the tree density is relatively high; let’s set it to 0.2. Birch tree leaves are typically oval or triangular, so let’s set the leaf type to ‘leaf’ to allow further customization. There are no fruits mentioned for the birch tree in the description. Given the scene likely depicts autumn, the leaf_density should not be too high; let’s set it to 0.02. For the dogwood tree, as the leaves are described as oval or elliptical with smooth edges, the leaf type is set to ‘leaf’. It is mentioned that “clusters of small, vibrant berries cling to its branches,” so we can choose the fruit_type as ‘blackberry’. The leaf_density is set to 0.02. For the Japanese maple tree, the leaf type is set to ‘leaf_maple’. No fruits are mentioned for the maple tree. As the scene likely takes place in autumn, the leaf density for the maple tree should be high; let’s set it to 0.1. The function can be called three times to create three different trees: ",
843
+ "page_idx": 18
844
+ },
845
+ {
846
+ "type": "table",
847
+ "img_path": "images/3dcd3a01b43f0ca1ccc5b01750ea54b54de99cc11ccb9823d206e6a4c1cf18e8.jpg",
848
+ "table_caption": [],
849
+ "table_footnote": [],
850
+ "table_body": "<table><tr><td>&quot;python</td></tr><tr><td>add_tre(sesty0istacei,eatlaffruitNoe&#x27;,eaesity.)#eae</td></tr><tr><td>adtreesiiyte</td></tr><tr><td>adtreilesi 1</td></tr></table>",
851
+ "page_idx": 18
852
+ },
853
+ {
854
+ "type": "text",
855
+ "text": "Document: ",
856
+ "text_level": 1,
857
+ "page_idx": 19
858
+ },
859
+ {
860
+ "type": "text",
861
+ "text": "",
862
+ "text_level": 1,
863
+ "page_idx": 19
864
+ },
865
+ {
866
+ "type": "text",
867
+ "text": "sun_intensity: Multiplier for sun disc lighting. (Choose from ‘low’, ‘median’, ‘high’) \nsun_elevation: Rotation of the sun from the horizon (in degrees). (0: sunset, sun rising, 90: daytime, -10: night) \nsun_rotation: Rotation of the sun around the zenith (in degrees). \nair_density: Density of air molecules. (0: no air, 1: clear day atmosphere, 2: highly polluted day) \ndust_density: Density of dust and water droplets. (0: no dust, 1: clear day atmosphere, 5: city-like atmosphere, 10: hazy day) \nozone: Density of ozone molecules; useful to make the sky appear bluer. (0: no ozone, 1: clear day atmosphere, 2: city-like atmosphere). A ",
868
+ "page_idx": 19
869
+ },
870
+ {
871
+ "type": "text",
872
+ "text": "igher value yields a bluer sky. ",
873
+ "page_idx": 19
874
+ },
875
+ {
876
+ "type": "text",
877
+ "text": "cloud_density: Density of the clouds, ranging from 0 to 0.04. (0.01: very thick cloud, 0.04: very heavy cloud) ",
878
+ "page_idx": 19
879
+ },
880
+ {
881
+ "type": "text",
882
+ "text": "Output: ",
883
+ "text_level": 1,
884
+ "page_idx": 19
885
+ },
886
+ {
887
+ "type": "text",
888
+ "text": "texture_color_output: The output texture color of the sky. ",
889
+ "page_idx": 19
890
+ },
891
+ {
892
+ "type": "text",
893
+ "text": "Code: ",
894
+ "page_idx": 19
895
+ },
896
+ {
897
+ "type": "text",
898
+ "text": "\\`\\`python import nishita_sky_modelling def sky_texture_node(sun_intensity, sun_elevation, sun_rotation, air_density, dust_density, ozone, cloud_density): texture $=$ nishita_sky_modelling.model_sky(sun_intensity, sun_elevation, sun_rotation, air_density, dust_density, ozone, cloud_density) return texture ",
899
+ "page_idx": 19
900
+ },
901
+ {
902
+ "type": "text",
903
+ "text": "Information: ",
904
+ "text_level": 1,
905
+ "page_idx": 19
906
+ },
907
+ {
908
+ "type": "text",
909
+ "text": "The time of day depicted in the scene (morning/noon/evening), the possible season, the condition of the air, the blueness of the sky, and the cloud density. ",
910
+ "page_idx": 19
911
+ },
912
+ {
913
+ "type": "text",
914
+ "text": "Example: ",
915
+ "text_level": 1,
916
+ "page_idx": 19
917
+ },
918
+ {
919
+ "type": "text",
920
+ "text": "Question: ",
921
+ "text_level": 1,
922
+ "page_idx": 19
923
+ },
924
+ {
925
+ "type": "text",
926
+ "text": "Given the text description of the scene: “The river, reflecting the clear blue of the sky, glistened like a silver ribbon as it wound its way through the lush valley, its tranquil waters whispering secrets to the ancient trees,” analyze the function parameters and call the function to generate the sky. ",
927
+ "page_idx": 19
928
+ },
929
+ {
930
+ "type": "text",
931
+ "text": "Solution: ",
932
+ "text_level": 1,
933
+ "page_idx": 19
934
+ },
935
+ {
936
+ "type": "text",
937
+ "text": "From the description of a “clear blue sky,” we infer that sun_intensity cannot be low, let's set it as \"median\". As the sky is clear and blue, the sun_elevation must not be very low, indicating it's not morning or evening; we can set it to 50 degrees. ",
938
+ "page_idx": 19
939
+ },
940
+ {
941
+ "type": "text",
942
+ "text": "Sun rotation does not impact the appearance of the sky significantly; thus, we will set it to 0 degrees. To align with the description of \"clear blue,\" we should choose lower values for air_density and dust_density. Hence, we will set air_density to 1 and dust_density to 0. To enhance the blueness of the sky, we can increase the ozone value to 2. ",
943
+ "page_idx": 19
944
+ },
945
+ {
946
+ "type": "text",
947
+ "text": "As the description suggests a clear, blue sky, the cloud density must be low. Therefore, we will set it to 0.0005. The sky can be modeled by invoking the function as follows: ",
948
+ "page_idx": 19
949
+ },
950
+ {
951
+ "type": "image",
952
+ "img_path": "images/2d971e6ecfa758f69842506d2906807a43c42ff67f65e7b36eecd7d06f210eee.jpg",
953
+ "image_caption": [
954
+ "Figure 14: Prompt Example of Sky Modeling Function. "
955
+ ],
956
+ "image_footnote": [],
957
+ "page_idx": 19
958
+ },
959
+ {
960
+ "type": "image",
961
+ "img_path": "images/7a3f8db2bd8ab47d5c950d9859ea06c322773e3bd992c0e2b7f789462fc902db.jpg",
962
+ "image_caption": [],
963
+ "image_footnote": [],
964
+ "page_idx": 20
965
+ },
966
+ {
967
+ "type": "image",
968
+ "img_path": "images/9eeeb7822f8a616ac5df771106acdee2e556d4defd81079d332140a67dd23551.jpg",
969
+ "image_caption": [
970
+ "Figure 15: Single Function Control Result. Visual result (top) and modeling agent response example (bottom). Our method demonstrates a high degree of accuracy in inferring algorithm parameters, even when they do not possess a direct connection to visual appearance. "
971
+ ],
972
+ "image_footnote": [],
973
+ "page_idx": 20
974
+ }
975
+ ]
parse/test/ttMwEuEPeB/ttMwEuEPeB_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/ttMwEuEPeB/ttMwEuEPeB_model.json ADDED
The diff for this file is too large to render. See raw diff