ZHANGYUXUAN-zR commited on
Commit
b953378
·
verified ·
1 Parent(s): 362331b

Add files using upload-large-folder tool

Browse files
parse/dev/3jooF27-0Wy/3jooF27-0Wy_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/3jooF27-0Wy/3jooF27-0Wy_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/3jooF27-0Wy/3jooF27-0Wy_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/45L_dgP48Vd/45L_dgP48Vd_content_list.json ADDED
@@ -0,0 +1,2025 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "GRAPH-AUGMENTED NORMALIZING FLOWS FOR ANOMALY DETECTION OF MULTIPLE TIME SERIES ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 176,
8
+ 99,
9
+ 789,
10
+ 146
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Enyan Dai∗ Pennsylvania State University emd5759@psu.edu ",
17
+ "bbox": [
18
+ 183,
19
+ 170,
20
+ 382,
21
+ 212
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Jie Chen† MIT-IBM Watson AI Lab, IBM Research chenjie@us.ibm.com ",
28
+ "bbox": [
29
+ 470,
30
+ 169,
31
+ 743,
32
+ 212
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "ABSTRACT ",
39
+ "text_level": 1,
40
+ "bbox": [
41
+ 454,
42
+ 250,
43
+ 544,
44
+ 263
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "Anomaly detection is a widely studied task for a broad variety of data types; among them, multiple time series appear frequently in applications, including for example, power grids and traffic networks. Detecting anomalies for multiple time series, however, is a challenging subject, owing to the intricate interdependencies among the constituent series. We hypothesize that anomalies occur in low density regions of a distribution and explore the use of normalizing flows for unsupervised anomaly detection, because of their superior quality in density estimation. Moreover, we propose a novel flow model by imposing a Bayesian network among constituent series. A Bayesian network is a directed acyclic graph (DAG) that models causal relationships; it factorizes the joint probability of the series into the product of easy-to-evaluate conditional probabilities. We call such a graph-augmented normalizing flow approach GANF and propose joint estimation of the DAG with flow parameters. We conduct extensive experiments on real-world datasets and demonstrate the effectiveness of GANF for density estimation, anomaly detection, and identification of time series distribution drift. ",
51
+ "bbox": [
52
+ 233,
53
+ 275,
54
+ 764,
55
+ 483
56
+ ],
57
+ "page_idx": 0
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "1 INTRODUCTION ",
62
+ "text_level": 1,
63
+ "bbox": [
64
+ 176,
65
+ 498,
66
+ 336,
67
+ 513
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "Anomaly detection (Pimentel et al., 2014; Ruff et al., 2018) is the task of identifying unusual samples that significantly deviate from the majority of the data instances. It is applied in a broad variety of domains, including risk management (Aven, 2016), video surveillance (Kiran et al., 2018), adversarial example detection (Grosse et al., 2017), and fraud detection (Roy & George, 2017). Representative classical methods for anomaly detection are one-class support vector machines (Scholkopf ¨ et al., 2001) and kernel density estimation (Parzen, 1962; Kim & Scott, 2012). These methods rely on handcrafted features and often are not robust for high-dimensional data (e.g., images, speech signals, and time series). In recent years, inspired by the success of deep learning for complex data, many deep anomaly detection methods were proposed and they are remarkably effective in applications (Ruff et al., 2018; Sabokrou et al., 2018; Goyal et al., 2020). ",
74
+ "bbox": [
75
+ 174,
76
+ 522,
77
+ 823,
78
+ 661
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "Apart from these demonstrated applications, increasing demand exists for the anomaly detection of even more complex data; i.e., multiple time series. They contain a set of multivariate time series that often interact with each other in a system. A prominent example of the source of multiple time series is the power grid, where each constituent series is the grid state over time, recorded by a sensor deployed at a certain geographic location. The grid state includes many attributes; e.g., current magnitude and angle, voltage magnitude and angle, and frequency. Time series readings from sensors at nearby locations are often correlated and their behavior may be causal under cascading effects. Anomaly detection amounts to timely identifying abnormal grid conditions such as generator trip and insulator damage. ",
85
+ "bbox": [
86
+ 174,
87
+ 670,
88
+ 825,
89
+ 795
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "Anomaly detection of multiple time series is rather challenging, due to high dimensionality, interdependency, and label scarcity. First, a straightforward approach is to concatenate the constituent series along the attribute dimension and apply a detection method for multivariate time series. However, when the system contains many constituents, the resulting data suffer high dimensionality. Second, constituent series bear intricate interdependencies, which may be implicit and challenging to model. When an explicit graph topology is known, graph neural networks are widely used to digest the relational information (Seo et al., 2016; Li et al., 2018b; Yu et al., 2018; Zhao et al., 2019). However, a graph may not always be known (because, for example, it is sensitive information) and hence graph structure learning becomes an indispensable component of the solution (Kipf et al., 2018; Wu et al., 2020; Shang et al., 2021; Deng & Hooi, 2021). Third, labeling information is often limited. Even if certain labels are present, in practice, many anomalies may still stay unidentified because labeling is laborious and expensive. Hence, unsupervised approaches are the most suitable choice. However, albeit many unsupervised detection methods were proposed (Ruff et al., 2018; Sabokrou et al., 2018; Malhotra et al., 2016; Hendrycks et al., 2019), they are not effective for multiple time series. ",
96
+ "bbox": [
97
+ 174,
98
+ 803,
99
+ 823,
100
+ 887
101
+ ],
102
+ "page_idx": 0
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "",
107
+ "bbox": [
108
+ 174,
109
+ 103,
110
+ 825,
111
+ 215
112
+ ],
113
+ "page_idx": 1
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "In this work, we explore the use of normalizing flows (Dinh et al., 2016; Papamakarios et al., 2017) for anomaly detection, based on a hypothesis that anomalies often lie on low density regions of the data distribution. Normalizing flows are a class of deep generative models for learning the underlying distribution of data samples. They are unsupervised and they resolve the label scarcity challenge aforementioned. An advantage of normalizing flows is that they are particularly effective in estimating the density of any sample. A recent work by Rasul et al. (2021) extends normalizing flows for time series data by expressing the density of a series through successive conditioning on historical data and applying conditional flows to learn each conditional density, paving ways to build sophisticated flows for multiple time series. ",
118
+ "bbox": [
119
+ 174,
120
+ 223,
121
+ 825,
122
+ 348
123
+ ],
124
+ "page_idx": 1
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "We address the high dimensionality and interdependency challenges by learning the relational structure among constituent series. To this end, Bayesian networks (Pearl, 1985; 2000) that model causal relationships of variables are a principled choice. A Bayesian network is a directed acyclic graph (DAG) where a node is conditionally independent of its non-descendents given its parents. Such a structure allows factorizing the intractable joint density of all graph nodes into a product of easyto-evaluate conditional densities of each node. Hence, learning the relational structure among constituent series amounts to identifying a DAG that maximizes the densities of observed data. ",
129
+ "bbox": [
130
+ 174,
131
+ 357,
132
+ 825,
133
+ 455
134
+ ],
135
+ "page_idx": 1
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "We propose a novel framework, GANF (Graph-Augmented Normalizing Flow), to augment a normalizing flow with graph structure learning and to apply it for anomaly detection. There are nontrivial technical problems to resolve to materialize this framework: (i) How does one inject a graph into a normalizing flow, which essentially maps one distribution to another? (ii) How does one learn a DAG, which is a discrete object, inside a continuous flow model? The solution we take is to factorize the density of a multiple time series along the attribute, the temporal, and the series dimensions and use a graph-based dependency encoder to model the conditional densities resulting from factorization. Therein, the graph adjacency matrix is a continuous variable and we impose a differentiable constraint to ensure that the corresponding graph is acyclic (Zheng et al., 2018; Yu et al., 2019). We propose a joint training algorithm to optimize both the graph adjacency matrix and the flow parameters. ",
140
+ "bbox": [
141
+ 174,
142
+ 463,
143
+ 825,
144
+ 616
145
+ ],
146
+ "page_idx": 1
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "In addition to resolving the high dimensionality and interdependency challenges, an advantage of modeling the relational graph structure among constituent series is that one can easily observe the dynamics of the data distribution from the graph. For time series datasets that span a long period, one naturally questions if the distribution changes over time. The graph structure is a useful indicator of distribution drift. We will study the graph evolution empirically observed. ",
151
+ "bbox": [
152
+ 174,
153
+ 625,
154
+ 825,
155
+ 694
156
+ ],
157
+ "page_idx": 1
158
+ },
159
+ {
160
+ "type": "text",
161
+ "text": "We highlight the following contributions of this work: ",
162
+ "bbox": [
163
+ 178,
164
+ 703,
165
+ 527,
166
+ 718
167
+ ],
168
+ "page_idx": 1
169
+ },
170
+ {
171
+ "type": "text",
172
+ "text": "• We propose a framework to augment a normalizing flow with graph structure learning, to model interdependencies exhibited inside multiple time series. \n• We apply the augmented flow model to detect anomalies in multiple time series data and perform extensive empirical evaluation to demonstrate its effectiveness on real-world data sets. \n• We study the evolution of the learned graph structure and identify distribution drift in time series data that span a long time period. ",
173
+ "bbox": [
174
+ 184,
175
+ 726,
176
+ 825,
177
+ 829
178
+ ],
179
+ "page_idx": 1
180
+ },
181
+ {
182
+ "type": "text",
183
+ "text": "2 RELATED WORK ",
184
+ "text_level": 1,
185
+ "bbox": [
186
+ 176,
187
+ 843,
188
+ 346,
189
+ 859
190
+ ],
191
+ "page_idx": 1
192
+ },
193
+ {
194
+ "type": "text",
195
+ "text": "Anomaly Detection. Anomaly detection is a widely studied subject owing to its diverse applications. Recently, inspired by the success of deep learning, several deep anomaly detection methods are proposed and they achieve remarkable success on complex data, such as individual time series (Malhotra et al., 2016), images (Sabokrou et al., 2018), and videos (Ionescu et al., 2019). These methods generally fall under three categories: deep one-class models, generative model-based methods, and transformation-based methods. Deep one-class models (Ruff et al., 2018; Wu et al., 2019) treat normal instances as the target class and identify instances that do not belong to this class. In generative model-based methods (Malhotra et al., 2016; Nguyen et al., 2019; Li et al., 2018a), an autoencoder or a generative adversarial network is used to model the data distribution. Then, an anomaly measure is defined, such as the reconstruction error in autoencoding. Transformationbased methods (Golan & El-Yaniv, 2018; Hendrycks et al., 2019) are based on the premise that transformations applied to normal instances can be identified while anomalies not. Various transformations such as rotations and affine transforms have been investigated. On the other hand, anomaly detection of multiple time series is under explored. Recently, Deng & Hooi (2021) study the use of graph neural networks in combination with structure learning to detect anomalies. Our method substantially differs from this work in that the learned structure is a Bayesian network, which allows density estimation. Moreover, the Bayesian network identifies conditional dependencies among the constituent series and induces a better interpretation of the graph as well as the data distribution. ",
196
+ "bbox": [
197
+ 174,
198
+ 867,
199
+ 823,
200
+ 924
201
+ ],
202
+ "page_idx": 1
203
+ },
204
+ {
205
+ "type": "text",
206
+ "text": "",
207
+ "bbox": [
208
+ 174,
209
+ 103,
210
+ 825,
211
+ 299
212
+ ],
213
+ "page_idx": 2
214
+ },
215
+ {
216
+ "type": "text",
217
+ "text": "Normalizing Flows. Normalizing flows are generative models that normalize complex real-world data distributions to “standard” distributions by using a sequence of invertible and differentiable transformations. Dinh et al. (2016) introduce a widely used normalizing flow architecture— RealNVP—for density estimation. Various extensions and improvements are proposed (Papamakarios et al., 2017; Hoogeboom et al., 2019; Kingma & Dhariwal, 2018). For example, Papamakarios et al. (2017) view an autoregressive model as a normalizing flow. To model temporal data, Rasul et al. (2021) use sequential models to parameterize conditional flows. Moreover, graph normalizing flows are proposed to handle graph structured data and improve predictions and generations (Liu et al., 2019). In contrast, normalizing flows for multiple time series are rarely studied in the literature. In this work, we develop a graph-augmented flow for density estimation and anomaly detection of multiple time series. ",
218
+ "bbox": [
219
+ 174,
220
+ 305,
221
+ 825,
222
+ 457
223
+ ],
224
+ "page_idx": 2
225
+ },
226
+ {
227
+ "type": "text",
228
+ "text": "3 PRELIMINARIES ",
229
+ "text_level": 1,
230
+ "bbox": [
231
+ 176,
232
+ 470,
233
+ 339,
234
+ 486
235
+ ],
236
+ "page_idx": 2
237
+ },
238
+ {
239
+ "type": "text",
240
+ "text": "We first recall key concepts and familiarize the reader with notations to be used throughout the paper. ",
241
+ "bbox": [
242
+ 173,
243
+ 494,
244
+ 820,
245
+ 508
246
+ ],
247
+ "page_idx": 2
248
+ },
249
+ {
250
+ "type": "text",
251
+ "text": "3.1 NORMALIZING FLOWS ",
252
+ "text_level": 1,
253
+ "bbox": [
254
+ 174,
255
+ 518,
256
+ 372,
257
+ 534
258
+ ],
259
+ "page_idx": 2
260
+ },
261
+ {
262
+ "type": "text",
263
+ "text": "Let $\\mathbf { x } \\in \\mathbb { R } ^ { D }$ be a $D$ -dimensional random variable. A normalizing flow is a vector-valued invertible mapping $\\mathbf { f } ( \\mathbf { x } ) : \\mathbb { R } ^ { D } \\mathbb { R } ^ { D }$ that normalizes the distribution of $\\mathbf { x }$ to a “standard” distribution (or called base distribution). This distribution is usually taken to be an isotropic Gaussian or other ones that are easy to sample from and whose density is easy to evaluate. Let ${ \\bf z } = { \\bf f } ( { \\bf x } )$ with probability density function $q ( \\mathbf { z } )$ . With the change-of-variable formula, we can express the density of the $\\mathbf { x }$ , $p ( \\mathbf { x } )$ , by: ",
264
+ "bbox": [
265
+ 173,
266
+ 536,
267
+ 825,
268
+ 619
269
+ ],
270
+ "page_idx": 2
271
+ },
272
+ {
273
+ "type": "equation",
274
+ "img_path": "images/31e716b9222bff2d6138bc69b6efc31951c7c9e312e5fc1b4e4bdfc6c2676810.jpg",
275
+ "text": "$$\n\\begin{array} { r } { \\log p ( \\mathbf { x } ) = \\log q ( \\mathbf { f } ( \\mathbf { x } ) ) + \\log | \\operatorname* { d e t } \\nabla _ { \\mathbf { x } } \\mathbf { f } ( \\mathbf { x } ) | . } \\end{array}\n$$",
276
+ "text_format": "latex",
277
+ "bbox": [
278
+ 352,
279
+ 618,
280
+ 647,
281
+ 636
282
+ ],
283
+ "page_idx": 2
284
+ },
285
+ {
286
+ "type": "text",
287
+ "text": "In practical uses, the Jacobian determinant in (1) needs be easy to compute, so that the density $p ( \\mathbf { x } )$ can be evaluated. Moreover, as a generative model, the invertibility of $\\mathbf { f }$ allows drawing new instances $\\mathbf { x } = \\mathbf { f } ^ { - 1 } ( \\mathbf { z } )$ through sampling the base distribution. One example of such f is the masked autoregressive flow (Papamakarios et al., 2017), which yields $\\mathbf { z } = [ z _ { 1 } , \\dots , z _ { D } ]$ from $\\mathbf { x } = [ x _ { 1 } , \\dots , x _ { D } ]$ through ",
288
+ "bbox": [
289
+ 174,
290
+ 645,
291
+ 825,
292
+ 715
293
+ ],
294
+ "page_idx": 2
295
+ },
296
+ {
297
+ "type": "equation",
298
+ "img_path": "images/1e7ffda1c622f534f729e0e20888e7ae7a13edb5b4a76e0552c119c4bf3d5e15.jpg",
299
+ "text": "$$\nz _ { i } = ( x _ { i } - \\mu _ { i } ( \\mathbf { x } _ { 1 : i - 1 } ) ) \\exp ( \\alpha _ { i } ( \\mathbf { x } _ { 1 : i - 1 } ) ) ,\n$$",
300
+ "text_format": "latex",
301
+ "bbox": [
302
+ 362,
303
+ 714,
304
+ 633,
305
+ 731
306
+ ],
307
+ "page_idx": 2
308
+ },
309
+ {
310
+ "type": "text",
311
+ "text": "where $\\mu _ { i }$ and $\\alpha _ { i }$ are neural networks such as the multilayer perceptron. ",
312
+ "bbox": [
313
+ 174,
314
+ 734,
315
+ 638,
316
+ 750
317
+ ],
318
+ "page_idx": 2
319
+ },
320
+ {
321
+ "type": "text",
322
+ "text": "A flow may be augmented with conditional information $\\mathbf { h } \\in \\mathbb { R } ^ { d }$ with a possibly different dimension. Such a flow is a conditional flow and is denoted by $\\textbf { f } : \\mathbb { R } ^ { D } \\times \\mathbb { R } ^ { d } \\overset { \\cdot } { } \\mathbb { R } ^ { D }$ . The log-density of $\\mathbf { x }$ conditioned on $\\mathbf { h }$ admits the following formula: ",
323
+ "bbox": [
324
+ 174,
325
+ 755,
326
+ 825,
327
+ 797
328
+ ],
329
+ "page_idx": 2
330
+ },
331
+ {
332
+ "type": "equation",
333
+ "img_path": "images/89bce4df64b3a456a0f3924c55f4d3967ec20ce31e2030418b1d885fb003d2f5.jpg",
334
+ "text": "$$\n\\begin{array} { r } { \\log p ( { \\mathbf x } | { \\mathbf h } ) = \\log q ( { \\mathbf f } ( { \\mathbf x } ; { \\mathbf h } ) ) + \\log | \\operatorname* { d e t } \\nabla _ { { \\mathbf x } } { \\mathbf f } ( { \\mathbf x } ; { \\mathbf h } ) | . } \\end{array}\n$$",
335
+ "text_format": "latex",
336
+ "bbox": [
337
+ 326,
338
+ 804,
339
+ 671,
340
+ 821
341
+ ],
342
+ "page_idx": 2
343
+ },
344
+ {
345
+ "type": "text",
346
+ "text": "We now consider a normalizing flow for time series. Let $\\mathbf { X } = [ \\mathbf { x } _ { 1 } , \\mathbf { x } _ { 2 } , \\ldots , \\mathbf { x } _ { T } ]$ denote a time series of length $T$ , where $\\mathbf { x } _ { t } \\in \\mathbb { R } ^ { D }$ . Through successive conditioning, the density of the time series can be written as: ",
347
+ "bbox": [
348
+ 174,
349
+ 835,
350
+ 825,
351
+ 876
352
+ ],
353
+ "page_idx": 2
354
+ },
355
+ {
356
+ "type": "equation",
357
+ "img_path": "images/6bb53b5f1bf2db720f2d1eab6b3ead4f0b69b849d10d0e4c989ca5087b4c1b98.jpg",
358
+ "text": "$$\np ( \\mathbf { X } ) = p ( \\mathbf { x } _ { 1 } ) p ( \\mathbf { x } _ { 2 } | \\mathbf { x } _ { < 2 } ) \\cdot \\cdot \\cdot p ( \\mathbf { x } _ { T } | \\mathbf { x } _ { < T } ) ,\n$$",
359
+ "text_format": "latex",
360
+ "bbox": [
361
+ 361,
362
+ 876,
363
+ 633,
364
+ 892
365
+ ],
366
+ "page_idx": 2
367
+ },
368
+ {
369
+ "type": "text",
370
+ "text": "where $\\mathbf { x } _ { < t }$ denotes all variables before time $t$ . When the conditional probabilities are parameterized, Rasul et al. (2021) propose to model each $p ( \\mathbf { x } _ { t } | \\mathbf { x } _ { < t } )$ as $p ( \\mathbf x _ { t } | \\mathbf h _ { t - 1 } )$ , where $\\mathbf { h } _ { t - 1 }$ summarizes the ",
371
+ "bbox": [
372
+ 173,
373
+ 895,
374
+ 828,
375
+ 925
376
+ ],
377
+ "page_idx": 2
378
+ },
379
+ {
380
+ "type": "text",
381
+ "text": "past information $\\mathbf { x } _ { < t }$ . For example, $\\mathbf { h } _ { t - 1 }$ is the hidden state of a recurrent neural network before accepting input $\\mathbf { x } _ { t }$ . Then, a conditional normalizing flow can be applied to evaluate each $p ( \\mathbf x _ { t } | \\mathbf h _ { t - 1 } )$ . ",
382
+ "bbox": [
383
+ 171,
384
+ 103,
385
+ 823,
386
+ 133
387
+ ],
388
+ "page_idx": 3
389
+ },
390
+ {
391
+ "type": "text",
392
+ "text": "3.2 BAYESIAN NETWORKS ",
393
+ "text_level": 1,
394
+ "bbox": [
395
+ 174,
396
+ 143,
397
+ 370,
398
+ 157
399
+ ],
400
+ "page_idx": 3
401
+ },
402
+ {
403
+ "type": "text",
404
+ "text": "Let $X ^ { i }$ denote a general random variable, either scalar valued, vector valued, or even matrix valued. A Bayesian network of $n$ variables $( X ^ { 1 } , \\ldots , X ^ { n } )$ is a directed acyclic graph of the variables as nodes. Let A denote the weighted adjacency matrix of the graph, where $\\mathbf { A } _ { i j } \\neq 0$ if $X ^ { j }$ is the parent of $X ^ { i }$ . A Bayesian network describes the conditional independence among variables. Specifically, a node $X ^ { i }$ is conditionally independent of its non-descendents given its parents. In other words, the density of the joint distribution of $( X ^ { 1 } , \\ldots , X ^ { n } )$ is ",
405
+ "bbox": [
406
+ 173,
407
+ 162,
408
+ 825,
409
+ 248
410
+ ],
411
+ "page_idx": 3
412
+ },
413
+ {
414
+ "type": "equation",
415
+ "img_path": "images/13fb2f600f599b8863430f03cdac89802048a96b6d659abcc26d5ba11d8eecd3.jpg",
416
+ "text": "$$\np ( X ^ { 1 } , \\ldots , X ^ { n } ) = \\prod _ { i = 1 } ^ { n } p ( X ^ { i } | \\operatorname { p a } ( X ^ { i } ) ) ,\n$$",
417
+ "text_format": "latex",
418
+ "bbox": [
419
+ 370,
420
+ 256,
421
+ 625,
422
+ 299
423
+ ],
424
+ "page_idx": 3
425
+ },
426
+ {
427
+ "type": "text",
428
+ "text": "where $\\operatorname { p a } ( X ^ { i } ) = \\{ X ^ { j } : \\mathbf { A } _ { i j } \\neq 0 \\}$ denotes the set of parents of $X ^ { i }$ ",
429
+ "bbox": [
430
+ 173,
431
+ 306,
432
+ 612,
433
+ 323
434
+ ],
435
+ "page_idx": 3
436
+ },
437
+ {
438
+ "type": "text",
439
+ "text": "4 PROBLEM STATEMENT ",
440
+ "text_level": 1,
441
+ "bbox": [
442
+ 174,
443
+ 337,
444
+ 393,
445
+ 353
446
+ ],
447
+ "page_idx": 3
448
+ },
449
+ {
450
+ "type": "text",
451
+ "text": "In this paper, we focus on unsupervised anomaly detection with multiple time series. The training set $\\mathcal { D }$ consists of only unlabeled instances and we assume that the majority of them are not anomalies. Each instance $\\mathcal { X } \\in \\mathcal { D }$ contains $n$ constituent series with $D$ attributes and of length $T$ ; i.e., $\\mathcal { X } =$ $( \\mathbf { X } ^ { 1 } , \\mathbf { X } ^ { 2 } , \\ldots , \\mathbf { X } ^ { n } )$ where $\\mathbf { X } ^ { i } \\in \\mathbb { R } ^ { T \\times D }$ . We use a Bayesian network (DAG) to model the relational structure of the constituent series $\\mathbf { X } ^ { i }$ and augment a normalizing flow to compute the density of $\\mathcal { X }$ through a factorization in the form (5). Let $\\bar { \\mathbf { A } } \\in \\mathbb { R } ^ { n \\times n }$ be the adjacency matrix of the DAG and let $\\mathcal { F } : ( \\mathcal { X } , \\mathbf { A } ) \\mathcal { Z }$ denote the augmented flow. Because anomaly points tend to have low densities, we propose to conduct unsupervised anomaly detection by evaluating the density of a multiple time series computed through the augmented flow. The problem is formulated as the following. ",
452
+ "bbox": [
453
+ 173,
454
+ 361,
455
+ 825,
456
+ 488
457
+ ],
458
+ "page_idx": 3
459
+ },
460
+ {
461
+ "type": "text",
462
+ "text": "Problem 1. Given a training set $\\mathcal { D } = \\{ \\mathcal { X } _ { i } \\} _ { i = 1 } ^ { | \\mathcal { D } | }$ of multiple time series, we aim to simultaneously learn the adjacency matrix A of the Bayesian Network that represents the conditional dependencies among the constituent series, as well as the correspondingly graph-augmented normalizing flow $\\mathcal { F } : ( \\mathcal { X } , \\mathbf { A } ) \\mathcal { Z }$ , which is used to estimate the density of an instance $\\mathcal { X }$ . Here, $\\mathcal { Z }$ is a random variable with $a$ “simple” distribution, such as the anisotropic Gaussian. ",
463
+ "bbox": [
464
+ 173,
465
+ 494,
466
+ 825,
467
+ 569
468
+ ],
469
+ "page_idx": 3
470
+ },
471
+ {
472
+ "type": "text",
473
+ "text": "5 METHOD ",
474
+ "text_level": 1,
475
+ "bbox": [
476
+ 174,
477
+ 583,
478
+ 282,
479
+ 599
480
+ ],
481
+ "page_idx": 3
482
+ },
483
+ {
484
+ "type": "text",
485
+ "text": "In this section, we materialize the graph-augmented normalizing flow $\\mathcal { F } : ( \\mathcal { X } , \\mathbf { A } ) \\mathcal { Z }$ introduced in the problem statement and use it to compute the density of a multiple time series $\\mathcal { X }$ . The central idea is factorization: we factorize $p ( \\mathcal { X } )$ along the series dimension by using a Bayesian network and then factorize along the temporal dimension by using conditional normalizing flows. Then, we employ a novel graph-based dependency encoder to parameterize the conditional probabilities resulting from the factorization. The DAG used for factorization is a discrete object and is usually intractable to learn; however, the discrete structure is reflected in the dependency encoder through a graph adjacency matrix A that is differentiable. Moreover, the requirement that A must correspond to a DAG can be expressed as a differentiable equation. Hence, one can jointly optimize A and the flow components by using gradient based optimization. Once $\\mathcal { F }$ is learned, the density $p ( \\mathcal { X } )$ is straightforwardly evaluated for anomaly detection. An illustration of the framework GANF is shown in Figure 1. ",
486
+ "bbox": [
487
+ 173,
488
+ 608,
489
+ 825,
490
+ 775
491
+ ],
492
+ "page_idx": 3
493
+ },
494
+ {
495
+ "type": "text",
496
+ "text": "5.1 FACTORIZATION ",
497
+ "text_level": 1,
498
+ "bbox": [
499
+ 174,
500
+ 786,
501
+ 328,
502
+ 801
503
+ ],
504
+ "page_idx": 3
505
+ },
506
+ {
507
+ "type": "text",
508
+ "text": "Figure 1 shows a toy example of a Bayesian network as a DAG. Based on (5), the density of a multiple time series $\\mathbf { \\dot { \\mathcal { X } } } = ( \\hat { \\mathbf { X } } ^ { 1 } , \\mathbf { X } ^ { 2 } , \\dots , \\mathbf { \\bar { X } } ^ { n } )$ can be computed as the product of $p ( \\mathbf { X } ^ { i } | \\mathbf { \\theta } \\mathrm { p a } ( \\mathbf { X } ^ { i } ) )$ for all nodes, where recall that $\\operatorname { p a } ( \\mathbf { X } ^ { i } )$ denotes the set of parents of $\\mathbf { X } ^ { i }$ . Then, following Rasul et al. (2021), we further factorize each conditional density along the temporal dimension. Specifically, for a time step $t$ , $\\mathbf { x } _ { t } ^ { i }$ depends on its past history as well as its parents in the DAG. We write ",
509
+ "bbox": [
510
+ 173,
511
+ 806,
512
+ 825,
513
+ 877
514
+ ],
515
+ "page_idx": 3
516
+ },
517
+ {
518
+ "type": "equation",
519
+ "img_path": "images/2314f5c93324b3a583dbbcc0cef9dc0a2dcf1331421b3b61a6a94ce73add3607.jpg",
520
+ "text": "$$\np ( \\mathcal { X } ) = \\prod _ { i = 1 } ^ { n } p ( \\mathbf { X } ^ { i } | \\mathbf { \\ p a } ( \\mathbf { X } ^ { i } ) ) = \\prod _ { i = 1 } ^ { n } \\prod _ { t = 1 } ^ { T } p ( \\mathbf { x } _ { t } ^ { i } | \\mathbf { \\ p a } ( \\mathbf { x } ^ { i } ) _ { 1 : t } , \\mathbf { x } _ { 1 : t - 1 } ^ { i } ) ,\n$$",
521
+ "text_format": "latex",
522
+ "bbox": [
523
+ 287,
524
+ 885,
525
+ 709,
526
+ 928
527
+ ],
528
+ "page_idx": 3
529
+ },
530
+ {
531
+ "type": "image",
532
+ "img_path": "images/479b110e042725c882a59d4c8ec44a3cb69d4efafc0caaddae39db4637011020.jpg",
533
+ "image_caption": [
534
+ "Figure 1: Illustration of a Bayesian network and the proposed framework GANF. "
535
+ ],
536
+ "image_footnote": [],
537
+ "bbox": [
538
+ 176,
539
+ 103,
540
+ 803,
541
+ 260
542
+ ],
543
+ "page_idx": 4
544
+ },
545
+ {
546
+ "type": "text",
547
+ "text": "where $\\mathbf { x } _ { 1 : t - 1 } ^ { i }$ denotes the history of node $i$ before time $t$ , and $\\mathrm { p a } ( \\mathbf { x } ^ { i } ) _ { 1 : t } = \\{ \\mathbf { x } _ { 1 : t } ^ { j } : \\mathbf { A } _ { i j } \\neq 0 \\}$ . In the next subsection, we will parameterize each conditional density $p ( \\mathbf { x } _ { t } ^ { i } \\mid \\mathrm { p a } ( \\mathbf { x } ^ { i } ) _ { 1 : t } , \\mathbf { x } _ { 1 : t - 1 } ^ { i } )$ by using a graph-based dependency encoder. Note that so far the factorization (6) has been based on the discrete structure of the Bayesian network. The dependency encoder we introduce next, however, uses the adjacency matrix A in a differentiable manner, which is sufficient to ensure that $\\mathbf { x } _ { t } ^ { i }$ will not depend on nodes other than its parents and itself. ",
548
+ "bbox": [
549
+ 173,
550
+ 291,
551
+ 826,
552
+ 377
553
+ ],
554
+ "page_idx": 4
555
+ },
556
+ {
557
+ "type": "text",
558
+ "text": "5.2 NEURAL NETWORK PARAMETERIZATION ",
559
+ "text_level": 1,
560
+ "bbox": [
561
+ 173,
562
+ 386,
563
+ 501,
564
+ 400
565
+ ],
566
+ "page_idx": 4
567
+ },
568
+ {
569
+ "type": "text",
570
+ "text": "According to Sec. 3.1, conditional densities $p ( \\mathbf { x } _ { t } ^ { i } \\mid \\mathrm { p a } ( \\mathbf { x } ^ { i } ) _ { 1 : t } , \\mathbf { x } _ { 1 : t - 1 } ^ { i } )$ can be learned by using conditional normalizing flows. However, the conditional information $\\mathrm { p a } ( \\mathbf { x } ^ { i } ) _ { 1 : t }$ and $\\mathbf { x } _ { 1 : t - 1 } ^ { i }$ cannot be directly used for parameterization, because its size is not fixed. Therefore, as is illustrated in Figure 1, we design a graph-based dependency encoder to summarize the conditional information into a fixed length vector $\\bar { \\mathbf { d } } _ { t } ^ { i } \\in \\mathbb { R } ^ { d }$ . Then, a conditional normalizing flow is used to evaluate $p ( \\mathbf { x } _ { t } ^ { i } | \\mathbf { d } _ { t } ^ { i } )$ , which is equivalent to $\\breve { p } ( \\mathbf { x } _ { t } ^ { i } | \\mathrm { \\ p a } ( \\mathbf { x } ^ { i } ) _ { 1 : t } , \\mathbf { x } _ { 1 : t - 1 } ^ { i } )$ . ",
571
+ "bbox": [
572
+ 173,
573
+ 404,
574
+ 825,
575
+ 492
576
+ ],
577
+ "page_idx": 4
578
+ },
579
+ {
580
+ "type": "text",
581
+ "text": "Dependency Encoder. Since the history has an arbitrary length, we first employ a recurrent neural network (RNN) to map multiple time steps to a vector of fixed length. For a time series $\\mathbf { x } _ { 1 : t } ^ { i }$ , the recurrent model abstracts it into a hidden state $\\mathbf { h } _ { t } ^ { i } \\in \\mathbb { R } ^ { d }$ through the following recurrence ",
582
+ "bbox": [
583
+ 173,
584
+ 497,
585
+ 825,
586
+ 540
587
+ ],
588
+ "page_idx": 4
589
+ },
590
+ {
591
+ "type": "equation",
592
+ "img_path": "images/b94eeb3023a8d545afe61091c5119533717362c17a8e80903b83886e3e73f21f.jpg",
593
+ "text": "$$\n\\mathbf h _ { t } ^ { i } = \\mathbf { R N N } ( \\mathbf x _ { t } ^ { i } , \\mathbf h _ { t - 1 } ^ { i } ) ,\n$$",
594
+ "text_format": "latex",
595
+ "bbox": [
596
+ 423,
597
+ 545,
598
+ 573,
599
+ 564
600
+ ],
601
+ "page_idx": 4
602
+ },
603
+ {
604
+ "type": "text",
605
+ "text": "where $\\mathbf { h } _ { t } ^ { i }$ summarizes the time series up to step $t$ . The RNN can be any sequential model, such as the LSTM (Hochreiter & Schmidhuber, 1997) and in a broad sense a transformer (Vaswani et al., 2017). We let the RNN parameters be shared across all nodes in the DAG to avoid overfitting and to reduce computational costs. ",
606
+ "bbox": [
607
+ 173,
608
+ 569,
609
+ 825,
610
+ 626
611
+ ],
612
+ "page_idx": 4
613
+ },
614
+ {
615
+ "type": "text",
616
+ "text": "With (7), the conditional information of $\\mathbf { x } _ { t } ^ { i }$ is all summarized in $\\{ \\mathbf { h } _ { t } ^ { j } : \\mathbf { A } _ { i j } \\neq 0 \\} \\cup \\{ \\mathbf { h } _ { t - 1 } ^ { i } \\}$ . Inspired by the success of GCN (Kipf & Welling, 2016) in node representation learning through neighborhood aggregation, we design a graph convolution layer to aggregate hidden states of the parents for dependency encoding. This layer produces dependency representations $\\mathbf { D } _ { t } = ( \\mathbf { d } _ { t } ^ { 1 } , \\dots , \\mathbf { \\bar { d } } _ { t } ^ { n } )$ for all constituent series at time $t$ : ",
617
+ "bbox": [
618
+ 173,
619
+ 633,
620
+ 825,
621
+ 704
622
+ ],
623
+ "page_idx": 4
624
+ },
625
+ {
626
+ "type": "equation",
627
+ "img_path": "images/8bb657293924f86e4b463753a405a837fbf93bfb4507b032d2b723e3bc284817.jpg",
628
+ "text": "$$\n\\mathbf { D } _ { t } = \\operatorname { R e L U } ( \\mathbf { A } \\mathbf { H } _ { t } \\mathbf { W } _ { 1 } + \\mathbf { H } _ { t - 1 } \\mathbf { W } _ { 2 } ) \\cdot \\mathbf { W } _ { 3 } ,\n$$",
629
+ "text_format": "latex",
630
+ "bbox": [
631
+ 356,
632
+ 709,
633
+ 642,
634
+ 727
635
+ ],
636
+ "page_idx": 4
637
+ },
638
+ {
639
+ "type": "text",
640
+ "text": "where $\\mathbf { H } _ { t } \\ = \\ ( \\mathbf { h } _ { t } ^ { 1 } , \\ldots , \\mathbf { h } _ { t } ^ { n } )$ contains all the hidden states at time $t$ . Here, $\\mathbf { W } _ { 1 } ~ \\in ~ \\mathbb { R } ^ { d \\times d }$ and $\\mathbf { W } _ { 2 } ~ \\in ~ \\mathbb { R } ^ { d \\times d }$ are parameters to transform the aggregated representations of the parents and the node’s historical information, respectively; while $\\mathbf { \\check { W } } _ { 3 } ^ { - } \\in \\mathbb { R } ^ { d \\times d }$ is an additional transformation to improve the dependency representation. ",
641
+ "bbox": [
642
+ 173,
643
+ 729,
644
+ 825,
645
+ 787
646
+ ],
647
+ "page_idx": 4
648
+ },
649
+ {
650
+ "type": "text",
651
+ "text": "Density Estimation. With the dependency encoder, we obtain the representations ${ \\bf d } _ { t } ^ { i }$ of the conditional information. Then, a normalizing flow $\\mathbf { f } : \\mathbb { R } ^ { D } \\times \\mathbb { R } ^ { d } \\to \\mathbb { R } ^ { D }$ conditioned on ${ \\bf d } _ { t } ^ { i }$ is applied to model each $p ( \\mathbf { x } _ { t } ^ { i } | \\mathrm { \\ p a } ( \\mathbf { x } ^ { i } ) _ { 1 : t } , \\mathbf { x } _ { 1 : t - 1 } ^ { i } )$ . Similar to the computation of the hidden states, the parameters of the conditional flow are also shared among nodes, to avoid overfitting. Based on (3), the conditional density of $\\mathbf { x } _ { t } ^ { i }$ can be written as: ",
652
+ "bbox": [
653
+ 173,
654
+ 794,
655
+ 825,
656
+ 864
657
+ ],
658
+ "page_idx": 4
659
+ },
660
+ {
661
+ "type": "equation",
662
+ "img_path": "images/1ce41990b952fc9256ebe28f3a100d306eaa49bad54da6f11c3a96529a958e06.jpg",
663
+ "text": "$$\n\\log p ( \\mathbf { x } _ { t } ^ { i } \\mid \\operatorname { p a } ( \\mathbf { x } ^ { i } ) _ { 1 : t } , \\mathbf { x } _ { 1 : t - 1 } ^ { i } ) = \\log p ( \\mathbf { x } _ { t } ^ { i } \\mid \\mathbf { d } _ { t } ^ { i } ) = \\log q ( \\mathbf { f } ( \\mathbf { x } _ { t } ^ { i } ; \\mathbf { d } _ { t } ^ { i } ) ) + \\log \\mid \\operatorname* { d e t } \\nabla _ { \\mathbf { x } _ { t } ^ { i } } \\mathbf { f } ( \\mathbf { x } _ { t } ^ { i } ; \\mathbf { d } _ { t } ^ { i } ) \\mid ,\n$$",
664
+ "text_format": "latex",
665
+ "bbox": [
666
+ 191,
667
+ 868,
668
+ 787,
669
+ 888
670
+ ],
671
+ "page_idx": 4
672
+ },
673
+ {
674
+ "type": "text",
675
+ "text": "where $q ( \\mathbf { z } )$ is chosen to be the standard normal $\\mathcal { N } ( \\mathbf { z } | \\mathbf { 0 } , \\mathbf { I } )$ with $\\textbf { z } \\in \\mathbb { R } ^ { D }$ . The conditional flow f can be any effective one proposed by the literature, such as RealNVP (Dinh et al., 2016) and ",
676
+ "bbox": [
677
+ 176,
678
+ 895,
679
+ 825,
680
+ 924
681
+ ],
682
+ "page_idx": 4
683
+ },
684
+ {
685
+ "type": "text",
686
+ "text": "MAF (Papamakarios et al., 2017). Combining (9) and (6), we obtain the log-density of a multiple time series $\\mathcal { X }$ : ",
687
+ "bbox": [
688
+ 171,
689
+ 103,
690
+ 823,
691
+ 132
692
+ ],
693
+ "page_idx": 5
694
+ },
695
+ {
696
+ "type": "equation",
697
+ "img_path": "images/fc5b058b21f7b1e606eb72e5b9d77c06fc88d571cb8a4be5734b4ab5550231a3.jpg",
698
+ "text": "$$\n\\log p ( \\mathcal { X } ) = \\sum _ { i = 1 } ^ { n } \\sum _ { t = 1 } ^ { T } \\Big [ \\log q ( \\mathbf { f } ( \\mathbf { x } _ { t } ^ { i } ; \\mathbf { d } _ { t } ^ { i } ) ) + \\log | \\operatorname* { d e t } \\nabla _ { \\mathbf { x } _ { t } ^ { i } } \\mathbf { f } ( \\mathbf { x } _ { t } ^ { i } ; \\mathbf { d } _ { t } ^ { i } ) | \\Big ] .\n$$",
699
+ "text_format": "latex",
700
+ "bbox": [
701
+ 282,
702
+ 130,
703
+ 715,
704
+ 174
705
+ ],
706
+ "page_idx": 5
707
+ },
708
+ {
709
+ "type": "text",
710
+ "text": "Anomaly Measure. Because anomalies deviate significantly from the majority of the data instances, we hypothesize that their densities are low. Thus, we use the density computed by (10) as the anomaly measure, where a lower density indicates a more likely anomaly. Apart from evaluating the density for the entire $\\mathcal { X }$ , the computation also produces conditional densities $\\log p ( \\mathbf { X } ^ { i } | \\operatorname { p a } ( \\mathbf { X } ^ { i } ) ) =$ $\\begin{array} { r } { \\sum _ { t = 1 } ^ { T } \\log p ( \\mathbf { x } _ { t } ^ { i } | \\mathbf { d } _ { t } ^ { i } ) } \\end{array}$ for each constituent series $\\mathbf { X } ^ { i }$ . We use this conditional density as the anomaly measure for constituent series. A low density $p ( \\mathcal { X } )$ is caused by one or a few low conditional densities $p ( \\mathbf { X } ^ { i } | \\operatorname { p a } ( \\mathbf { X } ^ { i } ) )$ in the Bayesian network, suggesting that abnormal behaviors could be traced to individual series. ",
711
+ "bbox": [
712
+ 173,
713
+ 179,
714
+ 825,
715
+ 295
716
+ ],
717
+ "page_idx": 5
718
+ },
719
+ {
720
+ "type": "text",
721
+ "text": "5.3 JOINT TRAINING ",
722
+ "text_level": 1,
723
+ "bbox": [
724
+ 174,
725
+ 303,
726
+ 333,
727
+ 318
728
+ ],
729
+ "page_idx": 5
730
+ },
731
+ {
732
+ "type": "text",
733
+ "text": "Learning a Bayesian network is a challenging combinatorial problem, due to the intractable search space superexponential in the number of nodes. A recent work by Zheng et al. (2018) proposes the equation $\\operatorname { t r } ( e ^ { \\mathbf { A } \\circ \\mathbf { A } } ) = n$ that characterizes the acyclicity of the corresponding graph of A, where $e$ is matrix exponential and $\\circ$ denotes element-wise multiplication. We will impose this equation as a constraint in the training of GANF. ",
734
+ "bbox": [
735
+ 173,
736
+ 321,
737
+ 825,
738
+ 391
739
+ ],
740
+ "page_idx": 5
741
+ },
742
+ {
743
+ "type": "text",
744
+ "text": "Training Objective. Following the training of a usual normalizing flow, the joint density (likelihood) of the observed data is the training objective, which is equivalent to the Kullback–Leibler divergence between the true distribution of data and the flow recovered distribution. Together with the DAG constraint, the optimization problem reads ",
745
+ "bbox": [
746
+ 173,
747
+ 397,
748
+ 825,
749
+ 454
750
+ ],
751
+ "page_idx": 5
752
+ },
753
+ {
754
+ "type": "equation",
755
+ "img_path": "images/da9272db6182a82dee559f3f12135a7c3964f6e471a8a97c676135fb27b1a7d7.jpg",
756
+ "text": "$$\n\\operatorname* { m i n } _ { \\mathbf { A } , \\theta } \\mathcal { L } ( \\mathbf { A } , \\theta ) = \\frac { 1 } { | \\mathcal { D } | } \\sum _ { i = 1 } ^ { | \\mathcal { D } | } - \\log p ( \\mathcal { X } _ { i } ) ,\n$$",
757
+ "text_format": "latex",
758
+ "bbox": [
759
+ 367,
760
+ 455,
761
+ 627,
762
+ 500
763
+ ],
764
+ "page_idx": 5
765
+ },
766
+ {
767
+ "type": "text",
768
+ "text": "where $\\pmb \\theta$ contains all neural network parameters, including those of the dependency encoder and the normalizing flow. Here, the DAG constraint $h ( \\mathbf { A } )$ admits an easy-to-evaluate gradient $\\nabla h ( { \\mathbf A } ) =$ $( e ^ { \\mathbf { A } \\circ \\mathbf { A } } ) ^ { T } \\circ \\mathsf { 2 } \\mathbf { A }$ , which allows a gradient based optimizer to solve (11). ",
769
+ "bbox": [
770
+ 173,
771
+ 520,
772
+ 825,
773
+ 563
774
+ ],
775
+ "page_idx": 5
776
+ },
777
+ {
778
+ "type": "text",
779
+ "text": "Training Algorithm. Problem (11) is a nonlinear equality-constrained optimization. Such problems are extensively studied and the augmented Lagrangian method (Bertsekas, 1999; Yu et al., 2019) is one of the most widely used approaches. The augmented Lagrangian is defined as ",
780
+ "bbox": [
781
+ 173,
782
+ 569,
783
+ 825,
784
+ 611
785
+ ],
786
+ "page_idx": 5
787
+ },
788
+ {
789
+ "type": "equation",
790
+ "img_path": "images/362029f1e745ed1b154d12b1ba7f762ed1ea92c9326786caea0c80ebd03a3486.jpg",
791
+ "text": "$$\n\\mathcal { L } _ { c } = \\mathcal { L } ( { \\bf A } , \\pmb \\theta ) + \\lambda h ( { \\bf A } ) + \\frac { c } { 2 } | h ( { \\bf A } ) | ^ { 2 } ,\n$$",
792
+ "text_format": "latex",
793
+ "bbox": [
794
+ 370,
795
+ 612,
796
+ 624,
797
+ 638
798
+ ],
799
+ "page_idx": 5
800
+ },
801
+ {
802
+ "type": "text",
803
+ "text": "where $\\lambda$ and $c$ denote the Lagrange multiplier and the penalty parameter, respectively. The general idea of the method is to gradually increase the penalty parameter to ensure that the constraint is eventually satisfied. Over iterations, $\\lambda$ as a dual variable will converge to the Lagrangian multiplier of (11). The update rule at the $k$ th iteration reads the following: ",
804
+ "bbox": [
805
+ 174,
806
+ 638,
807
+ 825,
808
+ 694
809
+ ],
810
+ "page_idx": 5
811
+ },
812
+ {
813
+ "type": "equation",
814
+ "img_path": "images/f60693a4fabf9eeb90b6a1b9e8a84a983aed9234cc1159ac33c47a32ed90b7dc.jpg",
815
+ "text": "$$\n\\mathbf { A } ^ { k } , \\theta ^ { k } = \\arg \\operatorname* { m i n } _ { \\mathbf { A } , \\theta } \\mathcal { L } _ { c ^ { k } } ; \\quad \\lambda ^ { k + 1 } = \\lambda ^ { k } + c ^ { k } h ( \\mathbf { A } ^ { k } ) ; \\quad c ^ { k + 1 } = \\left\\{ \\begin{array} { l l } { \\eta c ^ { k } } & { \\mathrm { i f } \\left| h ( \\mathbf { A } ^ { k } ) \\right| > \\gamma \\left| h ( \\mathbf { A } ^ { k - 1 } ) \\right| ; } \\\\ { c ^ { k } } & { \\mathrm { e l s e } , } \\end{array} \\right.\n$$",
816
+ "text_format": "latex",
817
+ "bbox": [
818
+ 171,
819
+ 694,
820
+ 812,
821
+ 729
822
+ ],
823
+ "page_idx": 5
824
+ },
825
+ {
826
+ "type": "text",
827
+ "text": "where $\\eta \\in \\left( 1 , + \\infty \\right)$ and $\\gamma \\in \\mathsf { \\Gamma } ( 0 , 1 )$ are hyperparameters to be tuned. We set $\\eta$ and $\\gamma$ as 10 and 0.5, respectively. The subproblem of optimizing A and $\\pmb { \\theta }$ can be solved by using the Adam optimizer (Kingma & Ba, 2014). The training algorithm is summarized in Appendix A. ",
828
+ "bbox": [
829
+ 173,
830
+ 739,
831
+ 825,
832
+ 784
833
+ ],
834
+ "page_idx": 5
835
+ },
836
+ {
837
+ "type": "text",
838
+ "text": "6 EXPERIMENTS ",
839
+ "text_level": 1,
840
+ "bbox": [
841
+ 174,
842
+ 794,
843
+ 328,
844
+ 810
845
+ ],
846
+ "page_idx": 5
847
+ },
848
+ {
849
+ "type": "text",
850
+ "text": "In this section, we conduct a comprehensive set of experiments to validate the effectiveness of the proposed GANF framework. In particular, they are designed to answer the following questions: ",
851
+ "bbox": [
852
+ 176,
853
+ 818,
854
+ 823,
855
+ 845
856
+ ],
857
+ "page_idx": 5
858
+ },
859
+ {
860
+ "type": "text",
861
+ "text": "• Q1: Can GANF accurately detect anomalies and estimate densities? \n• Q2: Does the proposed graph structure learning help? Is the framework sufficiently flexible to include various normalizing flow backbones? \n• Q3: What can one observe for a dataset spanning a long time? E.g., does the graph pattern change? ",
862
+ "bbox": [
863
+ 171,
864
+ 849,
865
+ 826,
866
+ 922
867
+ ],
868
+ "page_idx": 5
869
+ },
870
+ {
871
+ "type": "text",
872
+ "text": "6.1 SETTINGS ",
873
+ "text_level": 1,
874
+ "bbox": [
875
+ 174,
876
+ 103,
877
+ 285,
878
+ 117
879
+ ],
880
+ "page_idx": 6
881
+ },
882
+ {
883
+ "type": "text",
884
+ "text": "Datasets. To evaluate the effectiveness of GANF for anomaly detection and density estimation, we conduct experiments on two power grid datasets, one water system dataset, and one traffic dataset. ",
885
+ "bbox": [
886
+ 174,
887
+ 122,
888
+ 823,
889
+ 151
890
+ ],
891
+ "page_idx": 6
892
+ },
893
+ {
894
+ "type": "text",
895
+ "text": "• PMU-B and PMU-C: These two datasets correspond to two separate interconnects of the U.S. power grid, containing time series recorded by 38 and 132 phasor measurement units (PMUs), respectively. We process one-year data at the frequency of one second to form a ten-month training set, one-month validation set, and one-month test set. Each multiple time series is obtained by shifting a one-minute window. Additionally, to investigate distribution drift, we shift a one-month window to obtain multiple training/validation/test sets (12 in total, because of availability of twoyear data). Sparse grid events (anomalies) labeled by domain experts exist for evaluation; but note that the labels are both noisy and incomplete. These datasets are proprietary. ",
896
+ "bbox": [
897
+ 174,
898
+ 160,
899
+ 825,
900
+ 271
901
+ ],
902
+ "page_idx": 6
903
+ },
904
+ {
905
+ "type": "text",
906
+ "text": "• SWaT: We also use a public dataset for evaluation. The Secure Water Treatment (SWaT) dataset originates from an operational water treatment test-bed coordinated with Singapore’s Public Utility Board (Goh et al., 2016). The data collects 51 sensor recordings lasting four days, at the frequency of one second. A total of 36 attacks were conducted, resulting in approximately $11 \\%$ time steps as anomaly ground truths. We use a sliding window of 60 seconds to construct series data and perform a 60/20/20 chronological split for training, validation, and testing, respectively. ",
907
+ "bbox": [
908
+ 174,
909
+ 279,
910
+ 825,
911
+ 363
912
+ ],
913
+ "page_idx": 6
914
+ },
915
+ {
916
+ "type": "text",
917
+ "text": "• METR-LA: This dataset is also public; it contains speed records of 207 sensors deployed on the highways of Los Angles, CA (Li et al., 2018b). No anomaly labels exist however and we use this dataset for exploratory analysis only. Results are deferred to Appendix E. ",
918
+ "bbox": [
919
+ 178,
920
+ 371,
921
+ 821,
922
+ 412
923
+ ],
924
+ "page_idx": 6
925
+ },
926
+ {
927
+ "type": "text",
928
+ "text": "Evaluation metrics (under noisy labels). For SWaT, which offers reliable ground truths, we use the standard ROC and AUC metrics for evaluation. For the two PMU datasets, however, the resolution of the time series and the granularity of the events result in rather noisy ground truths. Hence, we adapt ROC for noisy labels. We smooth the time point of a “ground truth” event (anomaly) by introducing probabilities to the label. Specifically, the probability that a multiple time series starting at time t is a ground truth anomaly is maxi{exp(− (t−ti)2σ2 ) , where $t _ { i }$ is the starting time of the ith labeled anomaly. Then, when computing the confusion matrix, we sum probabilities rather than counting 0/1s. The smoothing window $\\sigma$ is chosen to be 6 time steps. ",
929
+ "bbox": [
930
+ 173,
931
+ 420,
932
+ 825,
933
+ 536
934
+ ],
935
+ "page_idx": 6
936
+ },
937
+ {
938
+ "type": "text",
939
+ "text": "Baselines. We compare with the following representative, state-of-the-art deep methods. ",
940
+ "bbox": [
941
+ 171,
942
+ 544,
943
+ 753,
944
+ 559
945
+ ],
946
+ "page_idx": 6
947
+ },
948
+ {
949
+ "type": "text",
950
+ "text": "• EncDecAD (Malhotra et al., 2016): In this method, an autoencoder based on LSTM is trained. The reconstruction error is used as the anomaly measure. \n• DeepSVDD (Ruff et al., 2018): This method minimizes the volume of a hypersphere that encloses the representations of data. Samples distant from the hypersphere center are considered anomalies. \n• ALOCC (Sabokrou et al., 2020): In this GAN-based method, the generator learns to reconstruct normal instances, while the discriminator works as an anomaly detector. \n• DROCC (Goyal et al., 2020): This method performs adversarial training to learn robust representations of data and identifies anomalies. \n• DeepSAD (Ruff et al., 2020): This method extends DeepSVDD with a semi-supervised loss term for training. We use noisy labels as supervision. ",
951
+ "bbox": [
952
+ 173,
953
+ 566,
954
+ 826,
955
+ 741
956
+ ],
957
+ "page_idx": 6
958
+ },
959
+ {
960
+ "type": "text",
961
+ "text": "To apply these baselines on multiple time series, we concatenate the constituent series along the attribute dimension (resulting in high-dimensional series) and use LSTM or CNN as the backbones. On the other hand, for the proposed method, we use LSTM as the RNN model and MAF as the normalizing flow. See Appendix C for more implementation details. ",
962
+ "bbox": [
963
+ 173,
964
+ 748,
965
+ 825,
966
+ 805
967
+ ],
968
+ "page_idx": 6
969
+ },
970
+ {
971
+ "type": "text",
972
+ "text": "6.2 PERFORMANCE OF ANOMALY DETECTION AND DENSITY ESTIMATION ",
973
+ "text_level": 1,
974
+ "bbox": [
975
+ 174,
976
+ 815,
977
+ 704,
978
+ 830
979
+ ],
980
+ "page_idx": 6
981
+ },
982
+ {
983
+ "type": "table",
984
+ "img_path": "images/b57f72ba2e2b3bf3d00a0a55ebddd6d46c07b7638121c17df8d2306dfc5a4f1e.jpg",
985
+ "table_caption": [
986
+ "Table 1: AUC-ROC $( \\% )$ of anomaly detection. "
987
+ ],
988
+ "table_footnote": [],
989
+ "table_body": "<table><tr><td>Dataset</td><td>EncDecAD</td><td>DeepSVDD</td><td>ALOCC</td><td>DROCC</td><td>DeepSAD</td><td>GANF</td></tr><tr><td>PMU-B</td><td>55.6±1.8</td><td>55.6±3.3</td><td>62.9±2.2</td><td>58.6±3.0</td><td>63.7±0.9</td><td>67.5±0.8</td></tr><tr><td>PMU-C</td><td>53.7±0.5</td><td>56.9±0.9</td><td>60.9±1.3</td><td>61.9±2.7</td><td>60.1±1.4</td><td>70.6±3.3</td></tr><tr><td>SWaT</td><td>76.5±0.7</td><td>68.8±2.0</td><td>75.4±2.3</td><td>73.3±1.6</td><td>75.4±1.2</td><td>79.6±0.9</td></tr></table>",
990
+ "bbox": [
991
+ 197,
992
+ 853,
993
+ 795,
994
+ 933
995
+ ],
996
+ "page_idx": 6
997
+ },
998
+ {
999
+ "type": "image",
1000
+ "img_path": "images/0182cd87323f8eccf82a7e8c7e959c983a6a81c3a5f1a4e551d6ee4c0c786d10.jpg",
1001
+ "image_caption": [
1002
+ "Figure 2: ROC curves of anomaly detection on various datasets. "
1003
+ ],
1004
+ "image_footnote": [],
1005
+ "bbox": [
1006
+ 174,
1007
+ 101,
1008
+ 816,
1009
+ 255
1010
+ ],
1011
+ "page_idx": 7
1012
+ },
1013
+ {
1014
+ "type": "image",
1015
+ "img_path": "images/a4c4c691d6a4c102d4ca64ea76182f6b184fdbfa981359a56314388f33833b00.jpg",
1016
+ "image_caption": [
1017
+ "Figure 3: Qualitative evaluation of GANF on PMU-C. (a) Distribution of log-densities on the test set (note in log scale). (b) Anomaly detection results for a week in the test set. "
1018
+ ],
1019
+ "image_footnote": [],
1020
+ "bbox": [
1021
+ 207,
1022
+ 291,
1023
+ 797,
1024
+ 406
1025
+ ],
1026
+ "page_idx": 7
1027
+ },
1028
+ {
1029
+ "type": "text",
1030
+ "text": "To answer Q1, we evaluate quantitatively and qualitatively on datasets with labels. ",
1031
+ "bbox": [
1032
+ 176,
1033
+ 455,
1034
+ 712,
1035
+ 469
1036
+ ],
1037
+ "page_idx": 7
1038
+ },
1039
+ {
1040
+ "type": "text",
1041
+ "text": "Anomaly detection. We compare GANF with the aforementioned baselines in Table 1, where standard deviations of the AUC scores are additionally reported through five random repetitions of model training. The table suggests an overwhelmingly high AUC score achieved by GANF. Observations follow. (i) GANF outperforms generative model-based methods (EncDecAD and ALOCC). Being a generative model as well, normalizing flows augmented with a graph structure leverage the interdependencies of constituent series more effectively, leading to a substantial improvement in detection. (ii) GANF significantly outperforms deep one-class models (DeepSVDD and DROCC), corroborating the appeal of using densities for detection. (iii) GANF also performs better than the semi-supervised method DeepSAD, probably because such methods rely on high quality labels for supervision (especially in the case of label scarcity) and they are less effective facing noisy labels. ",
1042
+ "bbox": [
1043
+ 174,
1044
+ 479,
1045
+ 825,
1046
+ 618
1047
+ ],
1048
+ "page_idx": 7
1049
+ },
1050
+ {
1051
+ "type": "text",
1052
+ "text": "Besides a single score, we also plot the ROC curve in Figure 2. One sees that the curve of GANF dominates those of others. This behavior is generally more salient in the low false-alarm regime. ",
1053
+ "bbox": [
1054
+ 174,
1055
+ 627,
1056
+ 823,
1057
+ 656
1058
+ ],
1059
+ "page_idx": 7
1060
+ },
1061
+ {
1062
+ "type": "text",
1063
+ "text": "Density estimation. We investigate the densities estimated by GANF, shown in Figure 3. Distributions of the log-densities in the test set are shown in Figure 3a. We use log-density as the anomaly measure; the lower the more likely. Note that the vertical axis is in the log-scale. One sees that a log-density of 16 approximately separates the majority normal instances from the minority anomalies. To cross-verify that the instances with low densities are suspiciously anomalous, we investigate Figure 3b, which is a temporal plot of log-densities for a week, overlaid with given labels. From this plot, one sees that the noisily labeled series generally have low densities or are near a low density time step. Additionally, GANF discovers a few suspicious time steps with low densities undetected earlier. These new discoveries raise interest to power system experts for analysis and archiving. ",
1064
+ "bbox": [
1065
+ 173,
1066
+ 665,
1067
+ 825,
1068
+ 791
1069
+ ],
1070
+ "page_idx": 7
1071
+ },
1072
+ {
1073
+ "type": "text",
1074
+ "text": "6.3 ABLATION STUDY ",
1075
+ "text_level": 1,
1076
+ "bbox": [
1077
+ 174,
1078
+ 803,
1079
+ 341,
1080
+ 818
1081
+ ],
1082
+ "page_idx": 7
1083
+ },
1084
+ {
1085
+ "type": "table",
1086
+ "img_path": "images/ae126db196a90e59ddeca6cbd9bbed9b15578ae56f0eaf98567676ee6527e14d.jpg",
1087
+ "table_caption": [
1088
+ "Table 2: Performance of variants of the proposed method. "
1089
+ ],
1090
+ "table_footnote": [],
1091
+ "table_body": "<table><tr><td>Dataset</td><td>Metrics</td><td>GANF\\G</td><td>GANF\\D</td><td>GANF\\T</td><td>GANFRNVP</td><td>GANF</td></tr><tr><td>PMU-B</td><td>AUC-ROC</td><td>0.641</td><td>0.643</td><td>0.653</td><td>0.661</td><td>0.678</td></tr><tr><td></td><td>Log-Density</td><td>15.31</td><td>8.70</td><td>15.09</td><td>15.90</td><td>16.22</td></tr><tr><td>PMU-C</td><td>AUC-ROC</td><td>0.630</td><td>0.544</td><td>0.688</td><td>0.703</td><td>0.705</td></tr><tr><td></td><td>Log-Density</td><td>15.55</td><td>8.94</td><td>15.70</td><td>17.06</td><td>16.98</td></tr></table>",
1092
+ "bbox": [
1093
+ 227,
1094
+ 842,
1095
+ 767,
1096
+ 928
1097
+ ],
1098
+ "page_idx": 7
1099
+ },
1100
+ {
1101
+ "type": "image",
1102
+ "img_path": "images/7f3477b00990454c8877e5fbcc19886a345e053b895db50d9c56433f3385a42a.jpg",
1103
+ "image_caption": [
1104
+ "Figure 4: Evolution of the learned DAG on PMU-B over time. "
1105
+ ],
1106
+ "image_footnote": [],
1107
+ "bbox": [
1108
+ 194,
1109
+ 102,
1110
+ 799,
1111
+ 195
1112
+ ],
1113
+ "page_idx": 8
1114
+ },
1115
+ {
1116
+ "type": "image",
1117
+ "img_path": "images/6179561de59950c927c4469f8af6d429b6f7b13e40d944019fb33668fdc27d6c.jpg",
1118
+ "image_caption": [
1119
+ "Figure 5: Evolution of edge weights in the DAG learned by GANF over time (PMU-B). "
1120
+ ],
1121
+ "image_footnote": [],
1122
+ "bbox": [
1123
+ 178,
1124
+ 226,
1125
+ 810,
1126
+ 315
1127
+ ],
1128
+ "page_idx": 8
1129
+ },
1130
+ {
1131
+ "type": "text",
1132
+ "text": "To answer Q2, we conduct an ablation study (including varying architecture components) to investigate impacts of DAG structure learning and the flexibility of the GANF framework. To investigate the power of modeling pairwise relationship, we train a variant GANF\\G that factorizes $\\begin{array} { r } { p ( \\mathcal { X } ) = \\prod _ { i = 1 } ^ { n ^ { * } } p ( \\mathbf { X } ^ { i } ) } \\end{array}$ ; i.e., assuming independence among constituent series. To investigate the effectiveness of graph structure learning, we train a variant GANF\\D that decomposes the joint density as $\\begin{array} { r } { p ( \\mathbf { \\mathcal { X } } ) \\mathbf { \\bar { \\Phi } } = \\prod _ { i = 1 } ^ { n } p ( \\mathbf { X } ^ { i } | \\mathbf { X } ^ { < i } ) } \\end{array}$ ; i.e., a full decomposition without a DAG. It is equivalent to concatenating the series along the attribute dimension and running MAF on the resulting series. To verify the contribution of joint training of $\\mathbf { A }$ and $\\pmb { \\theta }$ , we train a variant GANF\\T where A is separately learned by using NOTEARS (Zheng et al., 2018). To prove the flexibility of GANF, we replace the MAF-based normalizing flow by RealNVP, denoted as GANFRNVP. ",
1133
+ "bbox": [
1134
+ 173,
1135
+ 338,
1136
+ 825,
1137
+ 477
1138
+ ],
1139
+ "page_idx": 8
1140
+ },
1141
+ {
1142
+ "type": "text",
1143
+ "text": "Results are presented in Table 2. Apart from AUC-ROC, the log-density is also reported. Observations follow. (i) GANF significantly outperforms GANF\\G and GANF\\D, corroborating the importance of interdependency modeling among constituent series. Note that GANF\\D results in particularly poor performance in general, likely because the high dimensional input (resulting from concatenating too many series) impedes the learning of normalizing flows. (iii) GANF\\T is slightly better than GANF\\G, because of the presence of relational modeling, but it cannot match the performance of GANFRNVP and GANF that jointly train the DAG and the flow. (ii) These latter two models are the best for both datasets and both metrics. MAF works more often better than RealNVP. ",
1144
+ "bbox": [
1145
+ 174,
1146
+ 484,
1147
+ 825,
1148
+ 595
1149
+ ],
1150
+ "page_idx": 8
1151
+ },
1152
+ {
1153
+ "type": "text",
1154
+ "text": "6.4 EVOLUTION OF THE DAG STRUCTURE ",
1155
+ "text_level": 1,
1156
+ "bbox": [
1157
+ 176,
1158
+ 604,
1159
+ 482,
1160
+ 619
1161
+ ],
1162
+ "page_idx": 8
1163
+ },
1164
+ {
1165
+ "type": "text",
1166
+ "text": "To answer Q3, we investigate how the learned DAG evolves by shifting the train/validation/test sets month by month. The graphs within the first three-month shiftings are shown in Figure 4 and more can be found in Appendix F. In addition to the graph structure, we plot in Figure 5 the learned edge weights over time, one column per edge. The appearance and disappearance of edges demonstrate changes of the conditional independence structure among constituent series over time, suggesting data distribution drift (i.e., a change of internal data generation mechanism). It is interesting to observe the seasonal effect. The columns (edges) in Figure 5 can be loosely grouped in three clusters: those persisting the entire year, those appearing in the first half of the year, and those existing more briefly (e.g., within a season). Such a pattern plausibly correlates with electricity consumption, which is also seasonal. Were spatial information of the PMUs known, these identified DAGs would help mapping the seasonal patterns to geography and help planning a more resilient grid. ",
1167
+ "bbox": [
1168
+ 174,
1169
+ 623,
1170
+ 825,
1171
+ 776
1172
+ ],
1173
+ "page_idx": 8
1174
+ },
1175
+ {
1176
+ "type": "text",
1177
+ "text": "7 CONCLUSIONS ",
1178
+ "text_level": 1,
1179
+ "bbox": [
1180
+ 176,
1181
+ 789,
1182
+ 328,
1183
+ 805
1184
+ ],
1185
+ "page_idx": 8
1186
+ },
1187
+ {
1188
+ "type": "text",
1189
+ "text": "In this paper, we present a graph-augmented normalizing flow GANF for anomaly detection of multiple time series. The graph is materialized as a Bayesian network, which models the conditional dependencies among constituent time series. A graph-based dependency decoder is designed to summarize the conditional information needed by the normalizing flow that calculates series density. Anomalies are detected through identifying instances with low density. Extensive experiments on real-world datasets demonstrate the effectiveness of the framework. Ablation studies confirm the contribution of the learned graph structure in anomaly detection. Additionally, we investigate the evolution of the graph and offer insights of distribution drift over time. ",
1190
+ "bbox": [
1191
+ 174,
1192
+ 813,
1193
+ 825,
1194
+ 924
1195
+ ],
1196
+ "page_idx": 8
1197
+ },
1198
+ {
1199
+ "type": "text",
1200
+ "text": "ACKNOWLEDGMENT AND DISCLAIMER ",
1201
+ "text_level": 1,
1202
+ "bbox": [
1203
+ 176,
1204
+ 104,
1205
+ 446,
1206
+ 117
1207
+ ],
1208
+ "page_idx": 9
1209
+ },
1210
+ {
1211
+ "type": "text",
1212
+ "text": "This material is based upon work supported by the Department of Energy under Award Number(s) DE-OE0000910. This report was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor any agency thereof, nor any of their employees, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or any agency thereof. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof. ",
1213
+ "bbox": [
1214
+ 174,
1215
+ 122,
1216
+ 825,
1217
+ 275
1218
+ ],
1219
+ "page_idx": 9
1220
+ },
1221
+ {
1222
+ "type": "text",
1223
+ "text": "REFERENCES ",
1224
+ "text_level": 1,
1225
+ "bbox": [
1226
+ 174,
1227
+ 287,
1228
+ 285,
1229
+ 304
1230
+ ],
1231
+ "page_idx": 9
1232
+ },
1233
+ {
1234
+ "type": "text",
1235
+ "text": "Terje Aven. Risk assessment and risk management: Review of recent advances on their foundation. European Journal of Operational Research, 253(1):1–13, 2016. ",
1236
+ "bbox": [
1237
+ 174,
1238
+ 311,
1239
+ 821,
1240
+ 339
1241
+ ],
1242
+ "page_idx": 9
1243
+ },
1244
+ {
1245
+ "type": "text",
1246
+ "text": "Dimitri P. Bertsekas. Nonlinear Programming. Athena Scientific, 2nd edition, 1999. ",
1247
+ "bbox": [
1248
+ 173,
1249
+ 348,
1250
+ 727,
1251
+ 363
1252
+ ],
1253
+ "page_idx": 9
1254
+ },
1255
+ {
1256
+ "type": "text",
1257
+ "text": "Ailin Deng and Bryan Hooi. Graph neural network-based anomaly detection in multivariate time series. In AAAI, 2021. ",
1258
+ "bbox": [
1259
+ 173,
1260
+ 372,
1261
+ 823,
1262
+ 401
1263
+ ],
1264
+ "page_idx": 9
1265
+ },
1266
+ {
1267
+ "type": "text",
1268
+ "text": "Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real nvp. arXiv preprint arXiv:1605.08803, 2016. ",
1269
+ "bbox": [
1270
+ 173,
1271
+ 410,
1272
+ 823,
1273
+ 439
1274
+ ],
1275
+ "page_idx": 9
1276
+ },
1277
+ {
1278
+ "type": "text",
1279
+ "text": "Jonathan Goh, Sridhar Adepu, Khurum Nazir Junejo, and Aditya Mathur. A dataset to support research in the design of secure water treatment systems. In International conference on critical information infrastructures security, pp. 88–99. Springer, 2016. ",
1280
+ "bbox": [
1281
+ 173,
1282
+ 448,
1283
+ 826,
1284
+ 491
1285
+ ],
1286
+ "page_idx": 9
1287
+ },
1288
+ {
1289
+ "type": "text",
1290
+ "text": "Izhak Golan and Ran El-Yaniv. Deep anomaly detection using geometric transformations. arXiv preprint arXiv:1805.10917, 2018. ",
1291
+ "bbox": [
1292
+ 171,
1293
+ 500,
1294
+ 823,
1295
+ 529
1296
+ ],
1297
+ "page_idx": 9
1298
+ },
1299
+ {
1300
+ "type": "text",
1301
+ "text": "Sachin Goyal, Aditi Raghunathan, Moksh Jain, Harsha Vardhan Simhadri, and Prateek Jain. Drocc: Deep robust one-class classification. In International Conference on Machine Learning, pp. 3711–3721. PMLR, 2020. ",
1302
+ "bbox": [
1303
+ 173,
1304
+ 536,
1305
+ 825,
1306
+ 580
1307
+ ],
1308
+ "page_idx": 9
1309
+ },
1310
+ {
1311
+ "type": "text",
1312
+ "text": "Kathrin Grosse, Praveen Manoharan, Nicolas Papernot, Michael Backes, and Patrick McDaniel. On the (statistical) detection of adversarial examples. arXiv preprint arXiv:1702.06280, 2017. ",
1313
+ "bbox": [
1314
+ 171,
1315
+ 588,
1316
+ 825,
1317
+ 618
1318
+ ],
1319
+ "page_idx": 9
1320
+ },
1321
+ {
1322
+ "type": "text",
1323
+ "text": "Dan Hendrycks, Mantas Mazeika, Saurav Kadavath, and Dawn Song. Using self-supervised learning can improve model robustness and uncertainty. arXiv preprint arXiv:1906.12340, 2019. ",
1324
+ "bbox": [
1325
+ 171,
1326
+ 626,
1327
+ 823,
1328
+ 656
1329
+ ],
1330
+ "page_idx": 9
1331
+ },
1332
+ {
1333
+ "type": "text",
1334
+ "text": "Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997. ",
1335
+ "bbox": [
1336
+ 171,
1337
+ 665,
1338
+ 823,
1339
+ 693
1340
+ ],
1341
+ "page_idx": 9
1342
+ },
1343
+ {
1344
+ "type": "text",
1345
+ "text": "Emiel Hoogeboom, Rianne Van Den Berg, and Max Welling. Emerging convolutions for generative normalizing flows. In International Conference on Machine Learning, pp. 2771–2780. PMLR, 2019. ",
1346
+ "bbox": [
1347
+ 178,
1348
+ 702,
1349
+ 823,
1350
+ 744
1351
+ ],
1352
+ "page_idx": 9
1353
+ },
1354
+ {
1355
+ "type": "text",
1356
+ "text": "Radu Tudor Ionescu, Fahad Shahbaz Khan, Mariana-Iuliana Georgescu, and Ling Shao. Objectcentric auto-encoders and dummy anomalies for abnormal event detection in video. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7842–7851, 2019. ",
1357
+ "bbox": [
1358
+ 174,
1359
+ 753,
1360
+ 825,
1361
+ 810
1362
+ ],
1363
+ "page_idx": 9
1364
+ },
1365
+ {
1366
+ "type": "text",
1367
+ "text": "JooSeuk Kim and Clayton D Scott. Robust kernel density estimation. The Journal of Machine Learning Research, 13(1):2529–2565, 2012. ",
1368
+ "bbox": [
1369
+ 173,
1370
+ 819,
1371
+ 821,
1372
+ 848
1373
+ ],
1374
+ "page_idx": 9
1375
+ },
1376
+ {
1377
+ "type": "text",
1378
+ "text": "Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. ",
1379
+ "bbox": [
1380
+ 174,
1381
+ 857,
1382
+ 821,
1383
+ 886
1384
+ ],
1385
+ "page_idx": 9
1386
+ },
1387
+ {
1388
+ "type": "text",
1389
+ "text": "Diederik P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. arXiv preprint arXiv:1807.03039, 2018. ",
1390
+ "bbox": [
1391
+ 174,
1392
+ 895,
1393
+ 820,
1394
+ 922
1395
+ ],
1396
+ "page_idx": 9
1397
+ },
1398
+ {
1399
+ "type": "text",
1400
+ "text": "Thomas Kipf, Ethan Fetaya, Kuan-Chieh Wang, Max Welling, and Richard Zemel. Neural relational inference for interacting systems. In ICML, 2018. ",
1401
+ "bbox": [
1402
+ 171,
1403
+ 103,
1404
+ 823,
1405
+ 132
1406
+ ],
1407
+ "page_idx": 10
1408
+ },
1409
+ {
1410
+ "type": "text",
1411
+ "text": "Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016. ",
1412
+ "bbox": [
1413
+ 173,
1414
+ 140,
1415
+ 823,
1416
+ 170
1417
+ ],
1418
+ "page_idx": 10
1419
+ },
1420
+ {
1421
+ "type": "text",
1422
+ "text": "B Ravi Kiran, Dilip Mathew Thomas, and Ranjith Parakkal. An overview of deep learning based methods for unsupervised and semi-supervised anomaly detection in videos. Journal of Imaging, 4(2):36, 2018. ",
1423
+ "bbox": [
1424
+ 176,
1425
+ 179,
1426
+ 823,
1427
+ 222
1428
+ ],
1429
+ "page_idx": 10
1430
+ },
1431
+ {
1432
+ "type": "text",
1433
+ "text": "Dan Li, Dacheng Chen, Jonathan Goh, and See-kiong Ng. Anomaly detection with generative adversarial networks for multivariate time series. arXiv preprint arXiv:1809.04758, 2018a. ",
1434
+ "bbox": [
1435
+ 171,
1436
+ 231,
1437
+ 823,
1438
+ 260
1439
+ ],
1440
+ "page_idx": 10
1441
+ },
1442
+ {
1443
+ "type": "text",
1444
+ "text": "Yaguang Li, Rose Yu, Cyrus Shahabi, and Yan Liu. Diffusion convolutional recurrent neural network: Data-driven traffic forecasting. In ICLR, 2018b. ",
1445
+ "bbox": [
1446
+ 173,
1447
+ 267,
1448
+ 821,
1449
+ 297
1450
+ ],
1451
+ "page_idx": 10
1452
+ },
1453
+ {
1454
+ "type": "text",
1455
+ "text": "Jenny Liu, Aviral Kumar, Jimmy Ba, Jamie Kiros, and Kevin Swersky. Graph normalizing flows. arXiv preprint arXiv:1905.13177, 2019. ",
1456
+ "bbox": [
1457
+ 169,
1458
+ 306,
1459
+ 823,
1460
+ 335
1461
+ ],
1462
+ "page_idx": 10
1463
+ },
1464
+ {
1465
+ "type": "text",
1466
+ "text": "Pankaj Malhotra, Anusha Ramakrishnan, Gaurangi Anand, Lovekesh Vig, Puneet Agarwal, and Gautam Shroff. Lstm-based encoder-decoder for multi-sensor anomaly detection. arXiv preprint arXiv:1607.00148, 2016. ",
1467
+ "bbox": [
1468
+ 173,
1469
+ 344,
1470
+ 825,
1471
+ 387
1472
+ ],
1473
+ "page_idx": 10
1474
+ },
1475
+ {
1476
+ "type": "text",
1477
+ "text": "Duc Tam Nguyen, Zhongyu Lou, Michael Klar, and Thomas Brox. Anomaly detection with multiple-hypotheses predictions. In International Conference on Machine Learning, pp. 4800– 4809. PMLR, 2019. ",
1478
+ "bbox": [
1479
+ 171,
1480
+ 395,
1481
+ 825,
1482
+ 439
1483
+ ],
1484
+ "page_idx": 10
1485
+ },
1486
+ {
1487
+ "type": "text",
1488
+ "text": "George Papamakarios, Theo Pavlakou, and Iain Murray. Masked autoregressive flow for density estimation. arXiv preprint arXiv:1705.07057, 2017. ",
1489
+ "bbox": [
1490
+ 173,
1491
+ 446,
1492
+ 823,
1493
+ 477
1494
+ ],
1495
+ "page_idx": 10
1496
+ },
1497
+ {
1498
+ "type": "text",
1499
+ "text": "Emanuel Parzen. On estimation of a probability density function and mode. The annals of mathematical statistics, 33(3):1065–1076, 1962. ",
1500
+ "bbox": [
1501
+ 173,
1502
+ 484,
1503
+ 823,
1504
+ 515
1505
+ ],
1506
+ "page_idx": 10
1507
+ },
1508
+ {
1509
+ "type": "text",
1510
+ "text": "Judea Pearl. Bayesian networks: A model of self-activated memory for evidential reasoning. In Proceedings of the 7th Conference of the Cognitive Science Society, 1985. ",
1511
+ "bbox": [
1512
+ 173,
1513
+ 523,
1514
+ 820,
1515
+ 553
1516
+ ],
1517
+ "page_idx": 10
1518
+ },
1519
+ {
1520
+ "type": "text",
1521
+ "text": "Judea Pearl. Causality: Models, Reasoning, and Inference. Cambridge University Press, 2000. ",
1522
+ "bbox": [
1523
+ 171,
1524
+ 560,
1525
+ 795,
1526
+ 577
1527
+ ],
1528
+ "page_idx": 10
1529
+ },
1530
+ {
1531
+ "type": "text",
1532
+ "text": "Marco AF Pimentel, David A Clifton, Lei Clifton, and Lionel Tarassenko. A review of novelty detection. Signal Processing, 99:215–249, 2014. ",
1533
+ "bbox": [
1534
+ 173,
1535
+ 584,
1536
+ 821,
1537
+ 614
1538
+ ],
1539
+ "page_idx": 10
1540
+ },
1541
+ {
1542
+ "type": "text",
1543
+ "text": "Kashif Rasul, Abdul-Saboor Sheikh, Ingmar Schuster, Urs Bergmann, and Roland Vollgraf. Multivariate probabilistic time series forecasting via conditioned normalizing flows. In ICLR, 2021. ",
1544
+ "bbox": [
1545
+ 171,
1546
+ 622,
1547
+ 823,
1548
+ 652
1549
+ ],
1550
+ "page_idx": 10
1551
+ },
1552
+ {
1553
+ "type": "text",
1554
+ "text": "Riya Roy and K Thomas George. Detecting insurance claims fraud using machine learning techniques. In 2017 International Conference on Circuit, Power and Computing Technologies (ICCPCT), pp. 1–6. IEEE, 2017. ",
1555
+ "bbox": [
1556
+ 174,
1557
+ 660,
1558
+ 823,
1559
+ 704
1560
+ ],
1561
+ "page_idx": 10
1562
+ },
1563
+ {
1564
+ "type": "text",
1565
+ "text": "Lukas Ruff, Robert Vandermeulen, Nico Goernitz, Lucas Deecke, Shoaib Ahmed Siddiqui, Alexander Binder, Emmanuel Muller, and Marius Kloft. Deep one-class classification. In¨ International conference on machine learning, pp. 4393–4402. PMLR, 2018. ",
1566
+ "bbox": [
1567
+ 173,
1568
+ 712,
1569
+ 825,
1570
+ 756
1571
+ ],
1572
+ "page_idx": 10
1573
+ },
1574
+ {
1575
+ "type": "text",
1576
+ "text": "Lukas Ruff, Robert A. Vandermeulen, Nico Gornitz, Alexander Binder, Emmanuel M ¨ uller, Klaus- ¨ Robert Muller, and Marius Kloft. Deep semi-supervised anomaly detection. In ¨ International Conference on Learning Representations, 2020. URL https://openreview.net/forum? id $=$ HkgH0TEYwH. ",
1577
+ "bbox": [
1578
+ 173,
1579
+ 763,
1580
+ 825,
1581
+ 820
1582
+ ],
1583
+ "page_idx": 10
1584
+ },
1585
+ {
1586
+ "type": "text",
1587
+ "text": "Mohammad Sabokrou, Mohammad Khalooei, Mahmood Fathy, and Ehsan Adeli. Adversarially learned one-class classifier for novelty detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3379–3388, 2018. ",
1588
+ "bbox": [
1589
+ 174,
1590
+ 829,
1591
+ 823,
1592
+ 872
1593
+ ],
1594
+ "page_idx": 10
1595
+ },
1596
+ {
1597
+ "type": "text",
1598
+ "text": "Mohammad Sabokrou, Mahmood Fathy, Guoying Zhao, and Ehsan Adeli. Deep end-to-end oneclass classifier. IEEE transactions on neural networks and learning systems, 32(2):675–684, 2020. ",
1599
+ "bbox": [
1600
+ 174,
1601
+ 881,
1602
+ 825,
1603
+ 924
1604
+ ],
1605
+ "page_idx": 10
1606
+ },
1607
+ {
1608
+ "type": "text",
1609
+ "text": "Bernhard Scholkopf, John C Platt, John Shawe-Taylor, Alex J Smola, and Robert C Williamson. ¨ Estimating the support of a high-dimensional distribution. Neural computation, 13(7):1443–1471, 2001. ",
1610
+ "bbox": [
1611
+ 176,
1612
+ 103,
1613
+ 823,
1614
+ 146
1615
+ ],
1616
+ "page_idx": 11
1617
+ },
1618
+ {
1619
+ "type": "text",
1620
+ "text": "Youngjoo Seo, Michael Defferrard, Pierre Vandergheynst, and Xavier Bresson. Structured sequence ¨ modeling with graph convolutional recurrent networks. arXiv:1612.07659, 2016. ",
1621
+ "bbox": [
1622
+ 173,
1623
+ 155,
1624
+ 823,
1625
+ 184
1626
+ ],
1627
+ "page_idx": 11
1628
+ },
1629
+ {
1630
+ "type": "text",
1631
+ "text": "Chao Shang, Jie Chen, and Jinbo Bi. Discrete graph structure learning for forecasting multiple time series. In ICLR, 2021. ",
1632
+ "bbox": [
1633
+ 173,
1634
+ 193,
1635
+ 823,
1636
+ 222
1637
+ ],
1638
+ "page_idx": 11
1639
+ },
1640
+ {
1641
+ "type": "text",
1642
+ "text": "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. ",
1643
+ "bbox": [
1644
+ 176,
1645
+ 229,
1646
+ 823,
1647
+ 273
1648
+ ],
1649
+ "page_idx": 11
1650
+ },
1651
+ {
1652
+ "type": "text",
1653
+ "text": "Peng Wu, Jing Liu, and Fang Shen. A deep one-class neural network for anomalous event detection in complex scenes. IEEE transactions on neural networks and learning systems, 31(7):2609– 2622, 2019. ",
1654
+ "bbox": [
1655
+ 173,
1656
+ 281,
1657
+ 825,
1658
+ 324
1659
+ ],
1660
+ "page_idx": 11
1661
+ },
1662
+ {
1663
+ "type": "text",
1664
+ "text": "Zonghan Wu, Shirui Pan, Guodong Long, Jing Jiang, Xiaojun Chang, and Chengqi Zhang. Connecting the dots: Multivariate time series forecasting with graph neural networks. In KDD, 2020. ",
1665
+ "bbox": [
1666
+ 173,
1667
+ 333,
1668
+ 823,
1669
+ 363
1670
+ ],
1671
+ "page_idx": 11
1672
+ },
1673
+ {
1674
+ "type": "text",
1675
+ "text": "Bing Yu, Haoteng Yin, and Zhanxing Zhu. Spatio-temporal graph convolutional networks: A deep learning framework for traffic forecasting. In IJCAI, 2018. ",
1676
+ "bbox": [
1677
+ 173,
1678
+ 371,
1679
+ 823,
1680
+ 400
1681
+ ],
1682
+ "page_idx": 11
1683
+ },
1684
+ {
1685
+ "type": "text",
1686
+ "text": "Yue Yu, Jie Chen, Tian Gao, and Mo Yu. DAG-GNN: DAG structure learning with graph neural networks. In ICML, 2019. ",
1687
+ "bbox": [
1688
+ 173,
1689
+ 409,
1690
+ 823,
1691
+ 438
1692
+ ],
1693
+ "page_idx": 11
1694
+ },
1695
+ {
1696
+ "type": "text",
1697
+ "text": "Ling Zhao, Yujiao Song, Chao Zhang, Yu Liu, Pu Wang, Tao Lin, Min Deng, and Haifeng Li. T-GCN: A temporal graph convolutional network for traffic prediction. IEEE Transactions on Intelligent Transportation Systems, 2019. ",
1698
+ "bbox": [
1699
+ 174,
1700
+ 446,
1701
+ 823,
1702
+ 489
1703
+ ],
1704
+ "page_idx": 11
1705
+ },
1706
+ {
1707
+ "type": "text",
1708
+ "text": "Xun Zheng, Bryon Aragam, Pradeep Ravikumar, and Eric P. Xing. DAGs with NO TEARS: Continuous optimization for structure learning. In NeurIPS, 2018. ",
1709
+ "bbox": [
1710
+ 173,
1711
+ 498,
1712
+ 823,
1713
+ 527
1714
+ ],
1715
+ "page_idx": 11
1716
+ },
1717
+ {
1718
+ "type": "text",
1719
+ "text": "A TRAINING ALGORITHM ",
1720
+ "text_level": 1,
1721
+ "bbox": [
1722
+ 176,
1723
+ 102,
1724
+ 406,
1725
+ 117
1726
+ ],
1727
+ "page_idx": 12
1728
+ },
1729
+ {
1730
+ "type": "text",
1731
+ "text": "We summarize the training method in Algorithm 1. ",
1732
+ "bbox": [
1733
+ 176,
1734
+ 126,
1735
+ 509,
1736
+ 140
1737
+ ],
1738
+ "page_idx": 12
1739
+ },
1740
+ {
1741
+ "type": "text",
1742
+ "text": "Algorithm 1 Training Algorithm of GANF \nInput: Training set $\\mathcal { D }$ , hyperparameters $\\eta$ and $\\gamma$ \nOutput: GANF $\\mathcal { F }$ and adjacency matrix A of the DAG \n1: Initialize $c \\gets 0$ and initialize $\\lambda$ randomly \n2: for $k = 0 , 1 , 2 , \\ldots$ do \n3: Compute $\\mathbf { A } ^ { k }$ and $\\pmb { \\theta } ^ { k }$ as a minimizer of (12) by using the Adam optimizer, where the loss $\\mathcal { L }$ and the constraint $h$ are defined in (11), the log-density $\\log p ( \\mathcal { X } )$ is defined in (10), the dependency representation ${ \\bf d } _ { t } ^ { i }$ is defined in (8), the hidden state $\\mathbf { h } _ { t } ^ { i }$ is defined in (7), and the conditional flow f is RealNVP or MAF \n4: Update Lagrange multiplier $\\lambda \\gets \\lambda + c h ( \\mathbf { A } ^ { k } )$ \n5: if $k > 0$ and $| h ( { \\bf A } ^ { k } ) | > \\gamma | h ( { \\bf A } ^ { k - 1 } ) |$ then \n6: $c \\eta c$ \n7: end if \n8: if $h ( \\mathbf { A } ^ { k } ) = = 0$ then \n9: break \n10: end if \n11: end for \n12: return A and $\\mathcal { F }$ (including f , the neural network (8), and the RNN (7)) ",
1743
+ "bbox": [
1744
+ 176,
1745
+ 155,
1746
+ 826,
1747
+ 417
1748
+ ],
1749
+ "page_idx": 12
1750
+ },
1751
+ {
1752
+ "type": "text",
1753
+ "text": "B CODE ",
1754
+ "text_level": 1,
1755
+ "bbox": [
1756
+ 174,
1757
+ 439,
1758
+ 258,
1759
+ 455
1760
+ ],
1761
+ "page_idx": 12
1762
+ },
1763
+ {
1764
+ "type": "text",
1765
+ "text": "Code is available at https://github.com/EnyanDai/GANF. ",
1766
+ "bbox": [
1767
+ 176,
1768
+ 464,
1769
+ 625,
1770
+ 478
1771
+ ],
1772
+ "page_idx": 12
1773
+ },
1774
+ {
1775
+ "type": "text",
1776
+ "text": "C ADDITIONAL DETAILS OF EXPERIMENT SETTINGS ",
1777
+ "bbox": [
1778
+ 176,
1779
+ 491,
1780
+ 627,
1781
+ 507
1782
+ ],
1783
+ "page_idx": 12
1784
+ },
1785
+ {
1786
+ "type": "text",
1787
+ "text": "C.1 IMPLEMENTATION DETAILS OF GANF. ",
1788
+ "bbox": [
1789
+ 176,
1790
+ 515,
1791
+ 486,
1792
+ 530
1793
+ ],
1794
+ "page_idx": 12
1795
+ },
1796
+ {
1797
+ "type": "text",
1798
+ "text": "An LSTM is used as the RNN model in the dependency encoder. For normalizing flows, we use MAF with six flow blocks. All hidden dimensions as set as 32. The initial learning rate is set as 0.001 for the adjacency matrix A and the model parameters $\\pmb \\theta$ . Learning rate decay is 0.1. To avoid gradient explosion, we clip the gradients whose values are larger than 1.0. ",
1799
+ "bbox": [
1800
+ 174,
1801
+ 534,
1802
+ 825,
1803
+ 589
1804
+ ],
1805
+ "page_idx": 12
1806
+ },
1807
+ {
1808
+ "type": "text",
1809
+ "text": "For hyperparameter tuning, we select the hyperparameters that yield the highest log-density on the validation set. Specifically, we conduct grid search by varying the number of normalizing flow blocks from $\\{ 1 , 2 , 4 , 6 , 8 \\}$ , the learning rate from $\\left. 0 . 0 0 3 , 0 . 0 0 1 , 0 . 0 0 0 3 , 0 . 0 0 0 1 \\right.$ , and the hidden dimension from $\\{ 1 6 , 3 2 , 6 4 , 1 2 8 \\}$ . ",
1810
+ "bbox": [
1811
+ 173,
1812
+ 597,
1813
+ 825,
1814
+ 654
1815
+ ],
1816
+ "page_idx": 12
1817
+ },
1818
+ {
1819
+ "type": "text",
1820
+ "text": "C.2 IMPLEMENTATION DETAILS OF BASELINES. ",
1821
+ "bbox": [
1822
+ 174,
1823
+ 662,
1824
+ 519,
1825
+ 678
1826
+ ],
1827
+ "page_idx": 12
1828
+ },
1829
+ {
1830
+ "type": "text",
1831
+ "text": "• EncDecAD (Malhotra et al., 2016): This method is applied for anomaly detection on time series. Thus, we concatenate constituent series along the attribute dimension and adopt the code released by the authors in https://github.com/chickenbestlover/ RNN-Time-series-Anomaly-Detection. \n• DeepSVDD (Ruff et al., 2018): To handle time series data, we replace the backbone to an LSTM based on the official implementation https://github.com/lukasruff/ Deep-SVDD-PyTorch. \n• ALOCC (Sabokrou et al., 2020): We use the official implementation released by the authors in https://github.com/khalooei/ALOCC-CVPR2018. We replace the two-dimensional convolution to one-dimensional convolution to build a GAN for time series data. \n• DROCC (Goyal et al., 2020): Similar to other baselines, this method is proposed for tabular data and image data. We replace the backbone to LSTM to deal with multiple time series by revising the encoder in https://github.com/microsoft/EdgeML/tree/master/pytorch. \n• DeepSAD (Ruff et al., 2020): This is a semi-supervised approach, which requires labeling. We utilize the noisy labels in PMU-B and PMU-C as supervision. We use LSTM as the ",
1832
+ "bbox": [
1833
+ 171,
1834
+ 684,
1835
+ 826,
1836
+ 925
1837
+ ],
1838
+ "page_idx": 12
1839
+ },
1840
+ {
1841
+ "type": "text",
1842
+ "text": "backbone, based on the official implementation in https://github.com/lukasruff/ Deep-SAD-PyTorch. ",
1843
+ "bbox": [
1844
+ 183,
1845
+ 103,
1846
+ 821,
1847
+ 132
1848
+ ],
1849
+ "page_idx": 13
1850
+ },
1851
+ {
1852
+ "type": "text",
1853
+ "text": "All hyperparameters of the baselines are tuned based on the validation set to make fair comparisons. ",
1854
+ "bbox": [
1855
+ 181,
1856
+ 138,
1857
+ 820,
1858
+ 154
1859
+ ],
1860
+ "page_idx": 13
1861
+ },
1862
+ {
1863
+ "type": "text",
1864
+ "text": "D TIME COMPLEXITY ANALYSIS ",
1865
+ "text_level": 1,
1866
+ "bbox": [
1867
+ 176,
1868
+ 165,
1869
+ 464,
1870
+ 183
1871
+ ],
1872
+ "page_idx": 13
1873
+ },
1874
+ {
1875
+ "type": "text",
1876
+ "text": "The GANF framework involves Bayesian network structure learning, which is known to be highly challenging, owing to the intractable search space superexponential in the number of graph nodes. In this work, we formulate a continuous optimization of the graph structure, so that the training of GANF is more scalable. In what follows, we analyze the time complexity. ",
1877
+ "bbox": [
1878
+ 174,
1879
+ 189,
1880
+ 825,
1881
+ 246
1882
+ ],
1883
+ "page_idx": 13
1884
+ },
1885
+ {
1886
+ "type": "text",
1887
+ "text": "Recall that each instance $\\mathcal { X }$ of the multiple time series dataset contains $n$ constituent series with $D$ attributes and of length $T$ ; i.e., $\\mathcal { X } = \\left( \\mathbf { \\bar { X } } ^ { 1 } , \\mathbf { X } ^ { 2 } , \\ldots , \\mathbf { X } ^ { n } \\right)$ where $\\mathbf { X } ^ { i } \\in \\mathbb { R } ^ { T \\times D }$ . In the evaluation of the model, the dominant costs appear in running the dependency encoder and the normalizing flow. For the dependency encoder, an RNN is first deployed to map the multiple time series to hidden vectors; the time complexity is $O ( n T D )$ . Then, graph convolution is conducted to obtain dependency vectors; the convolution cost is $O ( n ^ { 2 } T )$ . For the normalizing flow module, the time complexity is $O ( n T D )$ . Therefore, the time complexity of computing log-density of one instance is $O ( n T ( D + n ) )$ . If we use a batch size $B$ for training, the time cost of calculating the augmented Lagrangian $\\mathcal { L } ( \\mathbf { A } , \\pmb \\theta )$ in (12) is $O ( n B T ( D + n ) )$ . Additionally, the time cost of calculating the constraint $\\underline { { h } } ( \\mathbf { A } )$ is ${ \\dot { O } } ( n ^ { 3 } )$ . Thus, the overall time complexity of one training iteration is $O ( n ( B T D +$ $B T n + n ^ { 2 } )$ ). ",
1888
+ "bbox": [
1889
+ 173,
1890
+ 253,
1891
+ 825,
1892
+ 406
1893
+ ],
1894
+ "page_idx": 13
1895
+ },
1896
+ {
1897
+ "type": "text",
1898
+ "text": "E RESULTS FOR METR-LA ",
1899
+ "text_level": 1,
1900
+ "bbox": [
1901
+ 176,
1902
+ 417,
1903
+ 419,
1904
+ 434
1905
+ ],
1906
+ "page_idx": 13
1907
+ },
1908
+ {
1909
+ "type": "text",
1910
+ "text": "METR-LA contains speed records of 207 sensors deployed on the highways of Los Angles, CA (Li et al., 2018b). The records are in four months at the frequency of five minutes. We shift a one-hour window to obtain multiple time series. The first three months are used for training and the last month is split in halves for validation and testing. No anomaly labels exist however and we use this dataset for exploratory analysis only. ",
1911
+ "bbox": [
1912
+ 174,
1913
+ 443,
1914
+ 825,
1915
+ 512
1916
+ ],
1917
+ "page_idx": 13
1918
+ },
1919
+ {
1920
+ "type": "image",
1921
+ "img_path": "images/7207a90be0d4fa7fb6bcae65b3b42d54486ab1527bfcd9447f60e7f9b9d8fae3.jpg",
1922
+ "image_caption": [
1923
+ "Figure 6: Density estimation for METR-LA. "
1924
+ ],
1925
+ "image_footnote": [],
1926
+ "bbox": [
1927
+ 200,
1928
+ 525,
1929
+ 818,
1930
+ 650
1931
+ ],
1932
+ "page_idx": 13
1933
+ },
1934
+ {
1935
+ "type": "text",
1936
+ "text": "Figure 6a shows the traffic speed on four main highways on June 13, 2012. Each speed is the average over all sensors on the same highway. We observe that despite spatial proximity, the speeds vary significantly around 4PM (rush hour) but they are unanimously high around 5AM and 8PM– 12AM. The estimated densities, shown in Figure 6b, tracks this pattern rather closely, with rush hours corresponding to low density and night traffics corresponding to high density. Note the nature of traffic: speed varies smoothly on the macroscopic level and hence does density, too. Such a phenomenon is in striking contrast to power systems where events are rare and abrupt. ",
1937
+ "bbox": [
1938
+ 173,
1939
+ 690,
1940
+ 825,
1941
+ 790
1942
+ ],
1943
+ "page_idx": 13
1944
+ },
1945
+ {
1946
+ "type": "text",
1947
+ "text": "F ADDITIONAL ANOMALY DETECTION RESULTS ON PMU DATASETS ",
1948
+ "text_level": 1,
1949
+ "bbox": [
1950
+ 171,
1951
+ 102,
1952
+ 766,
1953
+ 118
1954
+ ],
1955
+ "page_idx": 14
1956
+ },
1957
+ {
1958
+ "type": "text",
1959
+ "text": "See Figure 7 and Figure 8 for additional anomaly detection results on the test sets of PMU-C and PMU-B, respectively. The observations are rather similar to those of Figure 3b. ",
1960
+ "bbox": [
1961
+ 173,
1962
+ 126,
1963
+ 823,
1964
+ 155
1965
+ ],
1966
+ "page_idx": 14
1967
+ },
1968
+ {
1969
+ "type": "image",
1970
+ "img_path": "images/1dbb3cb3787ff749f25dc066c021866228c6e9a36a9f14bcc40951bd9f3c20d8.jpg",
1971
+ "image_caption": [
1972
+ "Figure 7: Additional anomaly detection results on the test set of PMU-C. "
1973
+ ],
1974
+ "image_footnote": [],
1975
+ "bbox": [
1976
+ 199,
1977
+ 176,
1978
+ 795,
1979
+ 434
1980
+ ],
1981
+ "page_idx": 14
1982
+ },
1983
+ {
1984
+ "type": "image",
1985
+ "img_path": "images/990a8bb8a0194c7139f1682004d6775423a1b918886f8ef7fc9b1924d409bac4.jpg",
1986
+ "image_caption": [
1987
+ "Figure 8: Anomaly detection results on the test set of PMU-B. "
1988
+ ],
1989
+ "image_footnote": [],
1990
+ "bbox": [
1991
+ 200,
1992
+ 483,
1993
+ 795,
1994
+ 878
1995
+ ],
1996
+ "page_idx": 14
1997
+ },
1998
+ {
1999
+ "type": "text",
2000
+ "text": "G ADDITIONAL RESULTS FOR DAG EVOLUTION ",
2001
+ "text_level": 1,
2002
+ "bbox": [
2003
+ 173,
2004
+ 102,
2005
+ 593,
2006
+ 118
2007
+ ],
2008
+ "page_idx": 15
2009
+ },
2010
+ {
2011
+ "type": "image",
2012
+ "img_path": "images/44e232ed700af5607f0b62a3010874861be6f5636fcb0f1c56165e8da474d39a.jpg",
2013
+ "image_caption": [
2014
+ "Figure 9: Evolution of the learned DAG on PMU-B over time. "
2015
+ ],
2016
+ "image_footnote": [],
2017
+ "bbox": [
2018
+ 209,
2019
+ 128,
2020
+ 789,
2021
+ 809
2022
+ ],
2023
+ "page_idx": 15
2024
+ }
2025
+ ]
parse/dev/FjNys5c7VyY/FjNys5c7VyY.md ADDED
@@ -0,0 +1,434 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DREAMFUSION: TEXT-TO-3D USING 2D DIFFUSION
2
+
3
+ Ben Poole1, Ajay Jain2, Jonathan T. Barron1, Ben Mildenhall1 1Google Research, $^ 2 \mathrm { U C }$ Berkeley {pooleb, barron, bmild}@google.com, ajayj@berkeley.edu
4
+
5
+ # ABSTRACT
6
+
7
+ Recent breakthroughs in text-to-image synthesis have been driven by diffusion models trained on billions of image-text pairs. Adapting this approach to 3D synthesis would require large-scale datasets of labeled 3D data and efficient architectures for denoising 3D data, neither of which currently exist. In this work, we circumvent these limitations by using a pretrained 2D text-to-image diffusion model to perform text-to-3D synthesis. We introduce a loss based on probability density distillation that enables the use of a 2D diffusion model as a prior for optimization of a parametric image generator. Using this loss in a DeepDream-like procedure, we optimize a randomly-initialized 3D model (a Neural Radiance Field, or NeRF) via gradient descent such that its 2D renderings from random angles achieve a low loss. The resulting 3D model of the given text can be viewed from any angle, relit by arbitrary illumination, or composited into any 3D environment. Our approach requires no 3D training data and no modifications to the image diffusion model, demonstrating the effectiveness of pretrained image diffusion models as priors. See dreamfusionpaper.github.io for a more immersive view into our 3D results.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Generative image models conditioned on text now support high-fidelity, diverse and controllable image synthesis (Nichol et al., 2022; Ramesh et al., 2021; 2022; Saharia et al., 2022; 2021a; Yu et al., 2022; Saharia et al., 2021b). These quality improvements have come from large aligned image-text datasets (Schuhmann et al., 2022) and scalable generative model architectures. Diffusion models are particularly effective at learning high-quality image generators with a stable and scalable denoising objective (Ho et al., 2020; Sohl-Dickstein et al., 2015; Song et al., 2021). Applying diffusion models to other modalities has been successful, but requires large amounts of modality-specific training data (Chen et al., 2020; Ho et al., 2022; Kong et al., 2021). In this work, we develop techniques to transfer pretrained 2D image-text diffusion models to 3D object synthesis, without any 3D data (see Figure 1). Though 2D image generation is widely applicable, simulators and digital media like video games and movies demand thousands of detailed 3D assets to populate rich interactive environments. 3D assets are currently designed by hand in modeling software like Blender and Maya3D, a process requiring a great deal of time and expertise. Text-to-3D generative models could lower the barrier to entry for novices and improve the workflow of experienced artists.
12
+
13
+ 3D generative models can be trained on explicit representations of structure like voxels (Wu et al., 2016; Chen et al., 2018) and point clouds (Yang et al., 2019; Cai et al., 2020; Zhou et al., 2021), but the 3D data needed is relatively scarce compared to plentiful 2D images. Our approach learns 3D structure using only a 2D diffusion model trained on images, and sidesteps this issue. GANs can learn controllable 3D generators from photographs of a single object category, by placing an adversarial loss on 2D image renderings of the output 3D object or scene (Henzler et al., 2019; Nguyen-Phuoc et al., 2019; Or-El et al., 2022). Though these approaches have yielded promising results on specific object categories such as faces, they have not yet been demonstrated to support arbitrary text.
14
+
15
+ Neural Radiance Fields, or NeRF (Mildenhall et al., 2020) are an approach towards inverse rendering in which a volumetric raytracer is combined with a neural mapping from spatial coordinates to color and volumetric density. NeRF has become a critical tool for neural inverse rendering (Tewari et al., 2022). Originally, NeRF was found to work well for “classic” 3D reconstruction tasks: many images of a scene are provided as input to a model, and a NeRF is optimized to recover the geometry of that specific scene, which allows for novel views of that scene from unobserved angles to be synthesized.
16
+
17
+ ![](images/0bd2930acb4252008e8b68701335902308ff2d7ec67914892566ff693333aa97.jpg)
18
+ zoomed out view of Tower Bridge made out of gingerbread and candy‡ a robot and dinosaur playing chess, high resolution\*
19
+ a squirrel gesturing in front of an easel showing colorful pie charts
20
+ Figure 1: DreamFusion uses a pretrained text-to-image diffusion model to generate realistic 3D models from text prompts. Rendered 3D models are presented from two views, with textureless renders and normals to the right. See dreamfusionpaper.github.io for videos of these results. Symbols indicate the following prompt prefixes which we found helped to improve the quality and realism:
21
+
22
+ Many 3D generative approaches have found success in incorporating NeRF-like models in the generative process (Schwarz et al., 2020; Chan et al., 2021b;a; Gu et al., 2021; Liu et al., 2022). One such approach is Dream Fields (Jain et al., 2022), which uses the frozen image-text joint embedding models from CLIP (Radford et al., 2021) and an optimization-based approach to train NeRFs. This work showed that pretrained 2D image-text models may be used for 3D synthesis, though 3D objects produced by this approach tend to lack realism and accuracy. CLIP has been used to guide other approaches based on voxel grids and meshes (Sanghi et al., 2022; Jetchev, 2021; Wang et al., 2022).
23
+
24
+ We adopt a similar approach to Dream Fields, but replace CLIP with a loss derived from distillation of a 2D diffusion model. Our loss is based on probabilty density distillation, minimizing the KL divergence between a family of Gaussian distribution with shared means based on the forward process of diffusion and the score functions learned by the pretrained diffusion model. The resulting Score Distillation Sampling (SDS) method enables sampling via optimization in differentiable image parameterizations. By combining SDS with a NeRF variant tailored to this 3D generation task, DreamFusion generates high-fidelity coherent 3D objects and scenes for a diverse set of user-provided text prompts.
25
+
26
+ # 2 DIFFUSION MODELS AND SCORE DISTILLATION SAMPLING
27
+
28
+ Diffusion models are latent-variable generative models that learn to gradually transform a sample from a tractable noise distribution towards a data distribution (Sohl-Dickstein et al., 2015; Ho et al., 2020). Diffusion models consist of a forward process $q$ that slowly removes structure from data $\mathbf { x }$ by adding noise, and a reverse process or generative model $p$ that slowly adds structure starting from noise $\mathbf { z } _ { t }$ . The forward process is typically a Gaussian distribution that transitions from the previous less noisy latent at timestep $t$ to a noisier latent at timestep $t + 1$ . We can compute the marginal distribution of the latent variables at timestep $t$ given an initial datapoint $\mathbf { x }$ by integrating out intermediate timesteps: $q ( \mathbf { z } _ { t } | \mathbf { x } ) = \mathcal { N } ( \alpha _ { t } \mathbf { x } , \sigma _ { t } ^ { 2 } \mathbf { I } )$ . The marginals integrating out the data density $q ( \mathbf { x } )$ are $\begin{array} { r } { q ( \mathbf { z } _ { t } ) = \int q ( \mathbf { z } _ { t } \mathbf { \bar { | x \rangle } } q ( \mathbf { x } ) \dot { d } \mathbf { x } } \end{array}$ , and correspond to smoothed versions of the data distribution. The coefficients $\alpha _ { t }$ and $\sigma _ { t }$ are chosen such that $q ( \mathbf { z } _ { t } )$ is close to the data density at the start of the process $( \sigma _ { 0 } \approx 0 )$ ) and close to Gaussian at the end of the forward process $( \sigma _ { T } \approx 1 )$ ), with $\alpha _ { t } ^ { 2 } = 1 - \sigma _ { t } ^ { 2 }$ chosen to preserve variance (Kingma et al., 2021; Song et al., 2021).
29
+
30
+ The generative model $p$ is trained to slowly add structure starting from random noise $p ( \mathbf { z } _ { T } ) = \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ with transitions $p _ { \phi } ( \mathbf { z } _ { t - 1 } | \mathbf { z } _ { t } )$ . Theoretically, with enough timesteps, the optimal reverse process step is also Gaussian and related to an optimal MSE denoiser (Sohl-Dickstein et al., 2015). Transitions are typically parameterized as $\begin{array} { r } { p _ { \phi } ( \bar { \mathbf { z } } _ { t - 1 } \vert \mathbf { z } _ { t } ) = q ( \mathbf { z } _ { t - 1 } \vert \mathbf { z } _ { t } , \mathbf { x } = \hat { \mathbf { x } } _ { \phi } ( \mathbf { z } _ { t } ; t ) ) } \end{array}$ where $q ( \mathbf { z } _ { t - 1 } | \mathbf { z } _ { t } , \mathbf { x } )$ is a posterior distribution derived from the forward process and $\hat { \mathbf { x } } _ { \phi } ( \mathbf { z } _ { t } ; t )$ is a learned approximation of the optimal denoiser. Instead of directly predicting $\hat { \mathbf { x } } _ { \phi }$ , Ho et al. (2020) trains an image-to-image U-Net $\epsilon _ { \phi } ( \mathbf { z } _ { t } ; t )$ that predicts the noise content of the latent $\mathbf { z } _ { t }$ : $\mathbb { E } [ { \bf x } | { \bf z } _ { t } ] \approx \hat { \bf x } _ { \phi } ( { \bf z } _ { t } ; t ) = \left( { \bf z } _ { t } - \sigma _ { t } \epsilon _ { \phi } ( { \bf z } _ { t } ; t ) \right) / \alpha _ { t }$ The predicted noise can be related to a predicted score function for the smoothed density $\nabla _ { \mathbf { z } _ { t } } \log p ( \mathbf { z } _ { t } )$ through Tweedie’s formula (Robbins, 1992): $\epsilon _ { \phi } ( { \bf z } _ { t } ; t ) = - \sigma _ { t } s _ { \phi } ( { \bf z } _ { t } ; t )$ .
31
+
32
+ Training the generative model with a (weighted) evidence lower bound (ELBO) simplifies to a weighted denoising score matching objective for parameters $\phi$ (Ho et al., 2020; Kingma et al., 2021):
33
+
34
+ $$
35
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { D i f f } } ( \phi , \mathbf { x } ) = \mathbb { E } _ { t \sim \mathcal { U } ( 0 , 1 ) , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) } \left[ w ( t ) \lVert \epsilon _ { \phi } ( \alpha _ { t } \mathbf { x } + \sigma _ { t } \epsilon ; t ) - \epsilon \rVert _ { 2 } ^ { 2 } \right] , } \end{array}
36
+ $$
37
+
38
+ where $w ( t )$ is a weighting function that depends on the timestep $t$ . Diffusion model training can thereby be viewed as either learning a latent-variable model (Sohl-Dickstein et al., 2015; Ho et al., 2020), or learning a sequence of score functions corresponding to noisier versions of the data (Vincent, 2011; Song & Ermon, 2019; Song et al., 2021). We will use $p _ { \phi } ( \mathbf { z } _ { t } ; t )$ to denote the approximate marginal distribution whose score function is given by $s _ { \phi } ( \mathbf { z } _ { t } ; t ) = - \epsilon _ { \phi } ( \mathbf { z } _ { t } ; t ) / \sigma _ { t }$ .
39
+
40
+ Our work builds on text-to-image diffusion models that learn $\epsilon _ { \phi } ( \mathbf { z } _ { t } ; t , y )$ conditioned on text embeddings $y$ (Saharia et al., 2022; Ramesh et al., 2022; Nichol et al., 2022). These models use classifier-free guidance (CFG, Ho & Salimans, 2022), which jointly learns an unconditional model to enable higher quality generation via a guidance scale parameter $\omega$ : $\hat { \epsilon } _ { \phi } ( \mathbf { z } _ { t } ; y , t ) = ( 1 + \omega ) \epsilon _ { \phi } ( \mathbf { z } _ { t } ; y , t ) - \omega \epsilon _ { \phi } ( \mathbf { z } _ { t } ; t )$ . CFG alters the score function to prefer regions where the ratio of the conditional density to the unconditional density is large. In practice, setting $\omega > 0$ improves sample fidelity at the cost of diversity. We use $\hat { \epsilon }$ and $\hat { p }$ throughout to denote the guided version of the noise prediction and marginal distribution.
41
+
42
+ ![](images/e4012591e85d612a6271517ec26bbd6501cd811289b9f649fe46e7d3c9e067a7.jpg)
43
+ Figure 2: Comparison of 2D sampling methods from a text-to-image diffusion model with text “ $\dot { \mathbf { \zeta } } _ { a }$ photo of a tree frog wearing a sweater.” For score distillation sampling, as an example we use an image generator that restricts images to be symmetric by having $\mathbf { x } = ( \mathrm { f i i p } ( \theta ) , \theta )$ .
44
+
45
+ # 2.1 HOW CAN WE SAMPLE IN PARAMETER SPACE, NOT PIXEL SPACE?
46
+
47
+ Existing approaches for sampling from diffusion models generate a sample that is the same type and dimensionality as the observed data the model was trained on (Song et al., 2021; 2020). Though conditional diffusion sampling enables quite a bit of flexibility (e.g. inpainting), diffusion models trained on pixels have traditionally been used to sample only pixels. We are not interested in sampling pixels; we instead want to create 3D models that look like good images when rendered from random angles. Such models can be specified as a differentiable image parameterization (DIP, Mordvintsev et al., 2018), where a differentiable generator $g$ transforms parameters $\theta$ to create an image $\mathbf { x } = g ( \theta )$ . DIPs allow us to express constraints, optimize in more compact spaces (e.g. arbitrary resolution coordinate-based MLPs), or leverage more powerful optimization algorithms for traversing pixel space. For 3D, we let $\theta$ be parameters of a 3D volume and $g$ a volumetric renderer. To learn these parameters, we require a loss function that can be applied to diffusion models.
48
+
49
+ Our approach leverages the structure of diffusion models to enable tractable sampling via optimization — a loss function that, when minimized, yields a sample. We optimize over parameters $\theta$ such that $\mathbf { x } = g ( \theta )$ looks like a sample from the frozen diffusion model. To perform this optimization, we need a differentiable loss function where plausible images have low loss, and implausible images have high loss, in a similar style to DeepDream (Mordvintsev et al., 2015). We first investigated reusing the diffusion training loss (Eqn. 1) to find modes of the learned conditional density $p ( \mathbf { x } | y )$ . While modes of generative models in high dimensions are often far from typical samples (Nalisnick et al., 2018), the multiscale nature of diffusion model training may help to avoid these pathologies. Minimizing the diffusion training loss with respect to a generated datapoint $\mathbf { x } = { \boldsymbol { g } } ( \theta )$ gives $\begin{array} { r } { \theta ^ { * } = \arg \operatorname* { m i n } _ { \theta } \mathcal { L } _ { \mathrm { D i f f } } ( \phi , \mathbf { x } = g ( \theta ) ) } \end{array}$ . In practice, we found that this loss function did not produce realistic samples even when using an identity DIP where $\mathbf { x } = { \boldsymbol { \theta } }$ . Concurrent work from Graikos et al. (2022) shows that this method can be made to work with carefully chosen timestep schedules, but we found this objective brittle and its timestep schedules challenging to tune.
50
+
51
+ To understand the difficulties of this approach, consider the gradient of ${ \mathcal { L } } _ { \mathrm { D i f f } }$ :
52
+
53
+ $$
54
+ \nabla _ { \boldsymbol { \theta } } \mathcal { L } _ { \mathrm { D i f f } } ( \boldsymbol { \phi } , \mathbf { x } = g ( \boldsymbol { \theta } ) ) = \mathbb { E } _ { t , \epsilon } \left[ w ( t ) \underbrace { ( \hat { \epsilon } _ { \boldsymbol { \phi } } ( \mathbf { z } _ { t } ; y , t ) - \epsilon ) } _ { \mathrm { N o i s e ~ R e s i d u a l } } \underbrace { \frac { \partial \hat { \epsilon } _ { \boldsymbol { \phi } } ( \mathbf { z } _ { t } ; y , t ) } { \mathbf { z } _ { t } } } _ { \mathrm { U - N e t ~ J a c o b i a n } } \underbrace { \frac { \partial \mathbf { x } } { \partial \boldsymbol { \theta } } } _ { \mathrm { G e n e r a t o r ~ J a c o b i a n } } \right]
55
+ $$
56
+
57
+ where we absorb the constant $\alpha _ { t } \mathbf { I } = \partial \mathbf { z } _ { t } / \partial \mathbf { x }$ into $w ( t )$ , and use the classifier-free-guided $\hat { \epsilon } _ { \phi }$ . In practice, the U-Net Jacobian term is expensive to compute (requires backpropagating through the diffusion model U-Net), and poorly conditioned for small noise levels as it is trained to approximate the scaled Hessian of the marginal density. We found that omitting the U-Net Jacobian term leads to an effective gradient for optimizing DIPs with diffusion models:
58
+
59
+ $$
60
+ \nabla _ { \boldsymbol { \theta } } \mathcal { L } _ { \mathrm { S D S } } ( \boldsymbol { \phi } , \mathbf { x } = g ( \boldsymbol { \theta } ) ) \triangleq \mathbb { E } _ { t , \epsilon } \left[ w ( t ) \left( \hat { \epsilon } _ { \boldsymbol { \phi } } ( \mathbf { z } _ { t } ; y , t ) - \epsilon \right) \frac { \partial \mathbf { x } } { \partial \boldsymbol { \theta } } \right]
61
+ $$
62
+
63
+ Intuitively, this loss perturbs $\mathbf { x }$ with a random amount of noise corresponding to the timestep $t$ , and estimates an update direction that follows the score function of the diffusion model to move to a higher density region. While this gradient for learning DIPs with diffusion models may appear ad hoc, in Appendix A.4 we show that it is the gradient of a weighted probability density distillation loss (van den Oord et al., 2018) using the learned score functions from the diffusion model:
64
+
65
+ $$
66
+ \begin{array} { r l } & { \nabla _ { \theta } \mathcal { L } _ { \mathrm { S D S } } ( \phi , \mathbf { x } = g ( \theta ) ) = \nabla _ { \theta } \mathbb { E } _ { t } \left[ \sigma _ { t } / \alpha _ { t } w ( t ) \mathrm { K L } ( q ( \mathbf { z } _ { t } | g ( \theta ) ; y , t ) | | p _ { \phi } ( \mathbf { z } _ { t } ; y , t ) ) \right] . } \end{array}
67
+ $$
68
+
69
+ ![](images/366d9638e643e39655f0c0b5228a22361e9c75fe28ba8f7f0cc5c4208eacd091.jpg)
70
+ Figure 3: DreamFusion generates 3D objects from a natural language caption such as “a DSLR photo of a peacock on a surfboard.” The scene is represented by a Neural Radiance Field that is randomly initialized and trained from scratch for each caption. Our NeRF parameterizes volumetric density and albedo (color) with an MLP. We render the NeRF from a random camera, using normals computed from gradients of the density to shade the scene with a random lighting direction. Shading reveals geometric details that are ambiguous from a single viewpoint. To compute parameter updates, DreamFusion diffuses the rendering and reconstructs it with a (frozen) conditional Imagen model to predict the injected noise $\hat { \epsilon } _ { \phi } ( \mathbf { z } _ { t } | y ; t )$ . This contains structure that should improve fidelity, but is high variance. Subtracting the injected noise produces a low variance update direction stopgrad $[ \hat { \epsilon } _ { \phi } - \hat { \epsilon } ]$ that is backpropagated through the rendering process to update the NeRF MLP parameters.
71
+
72
+ We name our sampling approach Score Distillation Sampling (SDS) as it is related to distillation, but uses score functions instead of densities. We refer to it as a sampler because the noise in the variational family $q ( \mathbf { z } _ { t } | \ldots )$ disappears as $t 0$ and the mean parameter of the variational distribution $g ( \theta )$ becomes the sample of interest. Our loss is easy to implement (see Fig. 8), and relatively robust to the choice of weighting $w ( t )$ . Since the diffusion model directly predicts the update direction, we do not need to backpropagate through the diffusion model; the model simply acts like an efficient, frozen critic that predicts image-space edits.
73
+
74
+ Given the mode-seeking nature of $\mathcal { L } _ { \mathrm { { S D S } } }$ , it may be unclear if minimizing this loss will produce good samples. In Fig. 2, we demonstrate that SDS can generate constrained images with reasonable quality. Empirically, we found that setting the guidance weight $\omega$ to a large value for classifier-free guidance improves quality (Appendix Table 10). SDS produces detail comparable to ancestral sampling, but enables new transfer learning applications because it operates in parameter space.
75
+
76
+ # 3 THE DREAMFUSION ALGORITHM
77
+
78
+ Now that we have demonstrated how a diffusion model can be used as a loss within a generic continuous optimization problem to generate samples, we will construct our specific algorithm that allows us to generate 3D assets from text. For the diffusion model, we use the Imagen model from Saharia et al. (2022), which has been trained to synthesize images from text. We only use the $6 4 \times 6 4$ base model (not the super-resolution cascade for generating higher-resolution images), and use this pretrained model as-is with no modifications. To synthesize a scene from text, we initialize a NeRF-like model with random weights, then repeatedly render views of that NeRF from random camera positions and angles, using these renderings as the input to our score distillation loss function that wraps around Imagen. As we will demonstrate, simple gradient descent with this approach eventually results in a 3D model (parameterized as a NeRF) that resembles the text. See Fig. 3 for an overview of our approach.
79
+
80
+ # 3.1 NEURAL RENDERING OF A 3D MODEL
81
+
82
+ NeRF is a technique for neural inverse rendering that consists of a volumetric raytracer and a multilayer perceptron (MLP). Rendering an image from a NeRF is done by casting a ray for each pixel from a camera’s center of projection through the pixel’s location in the image plane and out into the world. Sampled 3D points $\pmb { \mu }$ along each ray are then passed through an MLP, which produces 4 scalar values as output: a volumetric density $\tau$ (how opaque the scene geometry at that 3D coordinate is) and an RGB color $^ c$ . These densities and colors are then alpha-composited from the back of the ray towards the camera, producing the final rendered RGB value for the pixel:
83
+
84
+ $$
85
+ \begin{array} { r } { { \bf C } = \sum _ { i } w _ { i } { \bf c } _ { i } , \qquad w _ { i } = \alpha _ { i } \prod _ { j < i } ( 1 - \alpha _ { j } ) , \qquad \alpha _ { i } = 1 - \exp \left( - \tau _ { i } \left. \mu _ { i } - \mu _ { i + 1 } \right. \right) , } \end{array}
86
+ $$
87
+
88
+ In the traditional NeRF use-case we are given a dataset of input images and associated camera positions and the NeRF MLP is trained from random initialization using a mean squared error loss function between each pixel’s rendered color and the corresponding ground-truth color from the input image. This yields a 3D model (parameterized by the weights of the MLP) that can produce realistic renderings from previously-unseen views. Our model is built upon mip-NeRF 360 (Barron et al., 2022), which is an improved version of NeRF that reduces aliasing. Though mip-NeRF 360 was originally designed for 3D reconstruction from images, its improvements are also helpful for our generative text-to-3D task (see Appendix for details).
89
+
90
+ Shading. Traditional NeRF models emit radiance, which is RGB color conditioned on the ray direction from which the 3D point is being observed. In contrast, our MLP parameterizes the color of the surface itself, which is then lit by an illumination that we control (a process commonly referred to as “shading”). Previous work on generative or multiview 3D reconstruction using NeRF-like models have proposed a variety of reflectance models (Bi et al., 2020; Boss et al., 2021; Srinivasan et al., 2021; Pan et al., 2022). We use an RGB albedo $\rho$ (the color of the material) for each point:
91
+
92
+ $$
93
+ \left( \tau , \rho \right) = \mathrm { M L P } \left( \mu ; \theta \right) ,
94
+ $$
95
+
96
+ where $\tau$ is volumetric density. Calculating the final shaded output color for the 3D point requires a normal vector indicating the local orientation of the object’s geometry. This surface normal vector can be computed by normalizing the negative gradient of density $\tau$ with respect to the 3D coordinate $\pmb { \mu }$ : $\pmb { n } = - \bar { \nabla } _ { \pmb { \mu } } \tau / \| \bar { \nabla } _ { \pmb { \mu } } \tau \|$ (Yariv et al., 2020; Srinivasan et al., 2021). With each normal $\textbf { \em n }$ and material albedo $\rho$ , assuming some point light source with 3D coordinate $\ell$ and color $\ell _ { \rho }$ , and an ambient light color $\ell _ { a }$ , we render each point along the ray using diffuse reflectance (Lambert, 1760; Ramamoorthi & Hanrahan, 2001) to produce a color c for each point:
97
+
98
+ $$
99
+ \mathbf { c } = \rho \circ ( \ell _ { \rho } \circ \operatorname* { m a x } \left( 0 , \pmb { n } \cdot ( \ell - \pmb { \mu } ) / \left. \ell - \pmb { \mu } \right. \right) + \ell _ { a } ) \ .
100
+ $$
101
+
102
+ With these colors and our previously-generated densities, we approximate the volume rendering integral with the same rendering weights $w _ { i }$ used in standard NeRF (Equation 5). As in previous work on text-to-3D generation (Hong et al., 2022; Michel et al., 2021), we find it beneficial to randomly replace the albedo color $\rho$ with white $( 1 , 1 , 1 )$ to produce a “textureless” shaded output. This prevents the model from producing a degenerate solution in which scene content is drawn onto flat geometry to satisfy the text conditioning. For example, this encourages optimization to yield a 3D squirrel instead of a flat surface containing an image of a squirrel, both of which may appear identical from certain viewing angles and illumination conditions.
103
+
104
+ Scene Structure. While our method can generate some complex scenes, we find that it is helpful to only query the NeRF scene representation within a fixed bounding sphere, and use an environment map generated from a second MLP that takes positionally-encoded ray direction as input to compute a background color (architecture details in Appendix A.2). We composite the rendered ray color on top of this background color using the accumulated $\alpha$ value. This prevents the NeRF model from filling up space with density very close to the camera while still allowing it to paint an appropriate color or backdrop behind the generated scene. For generating single objects instead of scenes, a reduced bounding sphere can be useful.
105
+
106
+ Geometry regularizers. The mip-NeRF 360 model we build upon contains many other details that we omit for brevity. We include a regularization penalty on the opacity along each ray similar to Jain et al. (2022) to prevent unneccesarily filling in of empty space. To prevent pathologies in the density field where normal vectors face backwards away from the camera we use a modified version of the orientation loss proposed in Ref-NeRF (Verbin et al., 2022). This penalty is important when including textureless shading as the density field will otherwise attempt to orient normals away from the camera so that the shading becomes darker. Full details on these regularizers and additional hyperparameters of NeRF are presented in the Appendix A.2.
107
+
108
+ # 3.2 TEXT-TO-3D SYNTHESIS
109
+
110
+ Given a pretrained text-to-image diffusion model, a differentiable image parameterization in the form of a NeRF, and a loss function whose minima are good samples, we have all the components needed for text-to-3D synthesis using no 3D data. For each text prompt, we train a randomly initialized NeRF from scratch. Each iteration of DreamFusion optimization performs the following: (1) randomly sample a camera and light, (2) render an image of the NeRF from that camera and shade with the light, (3) compute gradients of the SDS loss with respect to the NeRF parameters, (4) update the NeRF parameters using an optimizer. We detail each of these steps below, and present pseudocode in Appendix 8.
111
+
112
+ ![](images/fe2890cae922a442eb322501bd7f3d6413aa36f2803ad697d34de5454d5eb803.jpg)
113
+ Figure 4: DreamFusion can be used to create and refine 3D scenes. Here we iteratively refine an example text prompt, while rendering each generated scene from four different viewpoints.
114
+
115
+ 1. Random camera and light sampling. At each iteration, a camera position is randomly sampled in spherical coordinates, with elevation angle $\phi _ { \mathrm { c a m } } \in [ - 1 0 ^ { \circ } , 9 0 ^ { \circ } ]$ , azimuth angle $\theta _ { \mathrm { c a m } } \in [ 0 ^ { \circ } , 3 6 0 ^ { \circ } ]$ , and distance from the origin in [1, 1.5]. For reference, the scene bounding sphere described previously has radius 1.4. We also sample a “look-at” point around the origin and an “up” vector, and combine these with the camera position to create a camera pose matrix. We additionally sample a focal length multiplier $\lambda _ { \mathrm { f o c a l } } \in \mathcal { U } ( 0 . 7 , 1 . 3 5 )$ such that the focal length is $\lambda _ { \mathrm { f o c a l } } w$ , where $w = 6 4$ is the image width in pixels. The point light position $\ell$ is sampled from a distribution centered around the camera position. We found using a wide range of camera locations to be critical for synthesizing coherent 3D scenes, and a wide range of camera distances helps to improve the resolution of the learned scene.
116
+
117
+ 2. Rendering. Given the camera pose and light position, we render the shaded NeRF model at $6 4 \times 6 4$ resolution as described in Section 3.1. We randomly choose between the illuminated color render, a textureless render, and a rendering of the albedo without any shading.
118
+
119
+ 3. Diffusion loss with view-dependent conditioning. Text prompts often describe canonical views of an object that are not good descriptions when sampling different views. We therefore found it beneficial to append view-dependent text to the provided input text based on the location of the randomly sampled camera. For high elevation angles $\phi _ { \mathrm { c a m } } > 6 0 ^ { \circ }$ , we append “overhead view.” For $\phi _ { \mathrm { c a m } } \leq 6 0 ^ { \circ }$ , we use a weighted combination of the text embeddings for appending “front view,” “side view,” or “back view” depending on the value of the azimuth angle $\theta _ { \mathrm { c a m } }$ (see App. A.2 for details). We use the pretrained $6 4 \times 6 4$ base text-to-image model from Saharia et al. (2022). This model was trained on large-scale web-image-text data, and is conditioned on T5-XXL text embeddings (Raffel et al., 2020). We use a weighting function of $w ( t ) = \sigma _ { t } ^ { 2 }$ , but found that a uniform weighting performed similarly. We sample $t \sim \mathcal { U } ( 0 . 0 2 , 0 . 9 8 )$ , avoiding very high and low noise levels due to numerical instabilities. For classifier-free guidance, we set $\omega = 1 0 0$ , finding that higher guidance weights give improved sample quality. This is much larger than image sampling methods, and is likely required due to the mode-seeking nature of our objective which results in oversmoothing at small guidance weights (see Appendix Table. 10). Given the rendered image and sampled timestep $t$ , we sample noise $\epsilon$ and compute the gradient of the NeRF parameters according to Eqn. 3.
120
+
121
+ 4. Optimization. Our 3D scenes are optimized on a TPUv4 machine with 4 chips. Each chip renders a separate view and evaluates the diffusion U-Net with per-device batch size of 1. We optimize for 15,000 iterations which takes around 1.5 hours. Compute time is split evenly between rendering the NeRF and evaluating the diffusion model. Parameters are optimized using the Distributed Shampoo optimizer (Anil et al., 2020). See Appendix A.2 for optimization settings.
122
+
123
+ Table 1: Evaluating the coherence of DreamFusion generations with their caption using different CLIP retrieval models. We compare to the ground-truth MS-COCO images in the object-centric subset of Jain et al. (2022) as well as Khalid et al. (2022). †Evaluated with only 1 seed per prompt. Metrics shown in parentheses may be overfit, as the same CLIP model is used during training and eval.
124
+
125
+ <table><tr><td>Method</td><td colspan="3">R-Precision ↑ CLIP-B/32 CLIP-B/16 CLIP-L/14</td></tr><tr><td>GT Images</td><td>Color Geo 77.1 1</td><td>Color Geo 79.1 1</td><td>1 1</td></tr><tr><td>Dream Fields</td><td>68.3 1</td><td>74.2 1</td><td>1</td></tr><tr><td>(reimpl.) CLIP-Mesh</td><td>78.6 1.3</td><td>(99.9)</td><td>(0.8) 82.9 74.5t</td><td>1.4</td></tr><tr><td></td><td>67.8</td><td>1 75.8 84.7</td><td>1</td><td>1 0.05</td></tr><tr><td>DreamFusion (base)</td><td>81.5</td><td>0.02</td><td>0.03</td><td>88.4</td></tr><tr><td>DreamFusion</td><td>75.1</td><td>42.5 77.5</td><td>46.6</td><td>79.7 58.5</td></tr></table>
126
+
127
+ ![](images/9b00a4422a018d428033860da36890d098840ee6611dcdd4680022d464671871.jpg)
128
+ Figure 5: Qualitative comparison with baselines.
129
+
130
+ # 4 EXPERIMENTS
131
+
132
+ We evaluate the ability of DreamFusion to generate coherent 3D scenes from a variety of text prompts. We compare to existing zero-shot text-to-3D generative models, identify the key components of our model that enable accurate 3D geometry, and explore the qualitative capabilities of DreamFusion such as the compositional generation shown in Figure 4.
133
+
134
+ 3D reconstruction tasks are typically evaluated using reference-based metrics which compares recovered geometry to some ground truth. The view-synthesis literature often uses PSNR to compare rendered views with a held-out photograph. These reference-based metrics are difficult to apply to zero-shot text-to-3D generation, as there is no “true” 3D scene corresponding to our text prompts. Following Jain et al. (2022), we evaluate the CLIP R-Precision (Park et al., 2021a), an automated metric for the consistency of rendered images with respect to the input caption. The R-Precision is the accuracy with which CLIP (Radford et al., 2021) retrieves the correct caption among a set of distractors given a rendering of the scene. We use the 153 prompts from the object-centric COCO validation subset of Dream Fields. We also measure CLIP R-Precision on textureless renders to evaluate geometry since we found existing metrics do not capture the quality of the geometry, often yielding high values when texture is painted on flat geometry.
135
+
136
+ Table 1 reports CLIP R-Precision for DreamFusion and several baselines. These include Dream Fields, CLIP-Mesh (which optimizes a mesh with CLIP), DreamFusion without any view augmentations, view-dependent prompts, or shading (base) and an oracle that evaluates the original captioned image pairs in MS-COCO. We also compare against an enhanced reimplementation of Dream Fields where we use our own 3D representation (Sec. 3.1). Since this evaluation is based on CLIP, Dream Fields and CLIP-Mesh have an unfair advantage as they use CLIP during training. Despite this, DreamFusion outperforms both baselines on color images, and approaches the performance of ground truth images. While our implementation of Dream Fields performs nearly at chance when evaluating geometry (Geo) with textureless renders, DreamFusion is consistent with captions $5 8 . 5 \%$ of the time. See Appendix A.3 for more details of the experimental setup.
137
+
138
+ Ablations. Fig. 6 shows CLIP R-Precision for a simplified DreamFusion ablation and progressively adds in optimization choices: a large ranges of viewpoints (ViewAug), view-dependent prompts (ViewDep), optimizing illuminated renders in addition to unlit albedo color renders (Lighting), and optimizing textureless shaded geometry images (Textureless). We measure R-Precision on the albedo render as in baselines (left), the full shaded render (middle) and the textureless render (right) to check geometric quality. Geometry significantly improves with each of these choices and full renderings improve by $+ 1 2 . 5 \%$ . Fig. 6 shows qualitative results for the ablation. This ablation also highlights how the albedo renders can be deceiving: our base model achieves the highest score, but exhibits poor geometry (the dog has multiple heads). Recovering accurate geometry requires view-dependent prompts, illumination and textureless renders.
139
+
140
+ ![](images/f856779d96303370f9647561763be7259e6771b3a400afd98c5a15551a9db963.jpg)
141
+ Figure 6: An ablation study of DreamFusion. Left: We evaluate components of our unlit renderings on albedo, full shaded and illuminated renderings and textureless illuminated geometry using CLIP L/14 on object-centric COCO. Right: visualizations of the impact of each ablation for “A bulldog is wearing a black pirate hat.” on albedo (top), shaded (middle), and textureless renderings (bottom). The base method (i) without view-dependent prompts results in a multi-faced dog with flat geometry. Adding in view-dependent prompts (ii) improves geometry, but the surfaces are highly non-smooth and result in poor shaded renders. Introducing lighting (iii) improves geometry but darker areas (e.g. the hat) remain non-smooth. Rendering without color (iv) helps to smooth the geometry, but also causes some color details like the skull and crossbones to be “carved” into the geometry.
142
+
143
+ # 5 DISCUSSION
144
+
145
+ We have presented DreamFusion, an effective technique for text-to-3D synthesis for a wide range of text prompts. DreamFusion works by transferring scalable, high-quality 2D image diffusion models to the 3D domain through our use of a novel Score Distillation Sampling approach and a novel NeRF-like rendering engine. DreamFusion does not require 3D or multi-view training data, and uses only a pre-trained 2D diffusion model (trained on only 2D images) to perform 3D synthesis.
146
+
147
+ Though DreamFusion produces compelling results and outperforms prior work on this task, it still has several limitations. SDS is not a perfect loss function when applied to image sampling, and often produces oversaturated and oversmoothed results relative to ancestral sampling. While dynamic thresholding (Saharia et al., 2022) partially ameliorates this issue when applying SDS to images, it did not resolve this issue in a NeRF context. Additionally, 2D image samples produced using SDS tend to lack diversity compared to ancestral sampling, and our 3D results exhibit few differences across random seeds. This may be fundamental to our use of reverse KL divergence, which has been previously noted to have mode-seeking properties in the context of variational inference and probability density distillation.
148
+
149
+ DreamFusion uses the $6 4 \times 6 4$ Imagen model, and as such our 3D synthesized models tend to lack fine details. Using a higher-resolution diffusion model and a bigger NeRF would presumably address this, but synthesis would become impractically slow. Hopefully improvements in the efficiency of diffusion and neural rendering will enable tractable 3D synthesis at high resolution in the future.
150
+
151
+ The problem of 3D reconstruction from 2D observations is widely understood to be highly ill-posed, and this ambiguity has consequences in the context of 3D synthesis. Fundamentally, our task is hard for the same reason that inverse rendering is hard: there exist many possible 3D worlds that result in identical 2D images. The optimization landscape of our task is therefore highly non-convex, and many of the details of this work are designed specifically to sidestep these local minima. But despite our best efforts we still sometimes observe local minima, such as 3D reconstructions where all scene content is “painted” onto a single flat surface. Though the techniques presented in this work are effective, this task of “lifting” 2D observations into a 3D world is inherently ambiguous, and may benefit from more robust 3D priors.
152
+
153
+ # ETHICS STATEMENT
154
+
155
+ Generative models for synthesizing images carry with them several ethical concerns, and these concerns are shared by (or perhaps exacerbated in) 3D generative models such as ours.
156
+
157
+ Because DreamFusion uses the Imagen diffusion model as a prior, it inherits any problematic biases and limitations that Imagen may have. While Imagen’s dataset was partially filtered, the LAION400M (Schuhmann et al., 2022) subset of its data was found to contain undesirable images (Birhane et al., 2021). Imagen is also conditioned on features from a pretrained large language model, which itself may have unwanted biases. It is important to be careful about the contents of datasets that are used in text-to-image and image-to-3D models so as to not propagate hateful media.
158
+
159
+ Generative models, in the hands of bad actors, could be used to generate disinformation. Disinformation in the form of 3D objects may be more convincing than 2D images (though renderings of our synthesized 3D models are less realistic than the state of the art in 2D image synthesis).
160
+
161
+ Generative models such as ours may have the potential to displace creative workers via automation.
162
+ That said, these tools may also enable growth and improve accessibility for the creative industry.
163
+
164
+ # REPRODUCIBILITY STATEMENT
165
+
166
+ The mip-NeRF 360 model that we build upon is publicly available through the “MultiNeRF” code repository (Mildenhall et al., 2022). While the Imagen diffusion model is not publicly available, other conditional diffusion models may produce similar results with the DreamFusion algorithm. To aid reproducibility, we have included a schematic overview of the algorithm in Figure 3, pseudocode for Score Distillation Sampling in Figure 8, hyperparameters in Appendix A.2, and additional evaluation setup details in Appendix A.3. Derivations for our loss are also included in Appendix A.4.
167
+
168
+ # REFERENCES
169
+
170
+ Rohan Anil, Vineet Gupta, Tomer Koren, Kevin Regan, and Yoram Singer. Scalable second order optimization for deep learning, 2020. URL https://arxiv.org/abs/2002.09018.
171
+
172
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv:1607.06450, 2016.
173
+
174
+ Jonathan T Barron, Ben Mildenhall, Matthew Tancik, Peter Hedman, Ricardo Martin-Brualla, and Pratul P Srinivasan. Mip-NeRF: A multiscale representation for anti-aliasing neural radiance fields. ICCV, 2021.
175
+
176
+ Jonathan T. Barron, Ben Mildenhall, Dor Verbin, Pratul P. Srinivasan, and Peter Hedman. Mip-NeRF 360: Unbounded anti-aliased neural radiance fields. CVPR, 2022.
177
+
178
+ Sai Bi, Zexiang Xu, Pratul Srinivasan, Ben Mildenhall, Kalyan Sunkavalli, Milos Ha ˇ san, Yannick ˇ Hold-Geoffroy, David Kriegman, and Ravi Ramamoorthi. Neural reflectance fields for appearance acquisition. arXiv:2008.03824, 2020.
179
+
180
+ Abeba Birhane, Vinay Uday Prabhu, and Emmanuel Kahembwe. Multimodal datasets: misogyny, pornography, and malignant stereotypes. arXiv:2110.01963, 2021.
181
+
182
+ Mark Boss, Raphael Braun, Varun Jampani, Jonathan T. Barron, Ce Liu, and Hendrik P.A. Lensch. NeRD: Neural reflectance decomposition from image collections. ICCV, 2021.
183
+
184
+ Ruojin Cai, Guandao Yang, Hadar Averbuch-Elor, Zekun Hao, Serge Belongie, Noah Snavely, and Bharath Hariharan. Learning gradient fields for shape generation. ECCV, 2020.
185
+
186
+ Eric R. Chan, Connor Z. Lin, Matthew A. Chan, Koki Nagano, Boxiao Pan, Shalini De Mello, Orazio Gallo, Leonidas Guibas, Jonathan Tremblay, Sameh Khamis, Tero Karras, and Gordon Wetzstein. Efficient geometry-aware 3D generative adversarial networks. arXiv, 2021a.
187
+
188
+ Eric R. Chan, Marco Monteiro, Petr Kellnhofer, Jiajun Wu, and Gordon Wetzstein. pi-GAN: Periodic implicit generative adversarial networks for 3d-aware image synthesis. CVPR, 2021b.
189
+
190
+ Kevin Chen, Christopher B Choy, Manolis Savva, Angel X Chang, Thomas Funkhouser, and Silvio Savarese. Text2shape: Generating shapes from natural language by learning joint embeddings. arXiv:1803.08495, 2018.
191
+
192
+ Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, and William Chan. Wavegrad: Estimating gradients for waveform generation. arXiv:2009.00713, 2020.
193
+
194
+ Alexandros Graikos, Nikolay Malkin, Nebojsa Jojic, and Dimitris Samaras. Diffusion models as plug-and-play priors. arXiv:2206.09012, 2022.
195
+
196
+ Will Grathwohl, Kuan-Chieh Wang, Joern-Henrik Jacobsen, David Duvenaud, and Richard Zemel. Learning the stein discrepancy for training and evaluating energy-based models without sampling. ICML, 2020.
197
+
198
+ Jiatao Gu, Lingjie Liu, Peng Wang, and Christian Theobalt. StyleNeRF: A style-based 3d-aware generator for high-resolution image synthesis, 2021.
199
+
200
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CVPR, 2016.
201
+
202
+ Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (GELUs). arXiv:1606.08415, 2016.
203
+
204
+ Philipp Henzler, Niloy J Mitra, , and Tobias Ritschel. Escaping Plato’s Cave: 3D shape from adversarial rendering. ICCV, 2019.
205
+
206
+ Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv:2207.12598, 2022.
207
+
208
+ Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. NeurIPS, 2020.
209
+
210
+ Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J Fleet. Video diffusion models. arXiv:2204.03458, 2022.
211
+
212
+ Fangzhou Hong, Mingyuan Zhang, Liang Pan, Zhongang Cai, Lei Yang, and Ziwei Liu. AvatarCLIP: Zero-shot text-driven generation and animation of 3D avatars. ACM Transactions on Graphics (TOG), 2022.
213
+
214
+ Tianyang Hu, Zixiang Chen, Hanxi Sun, Jincheng Bai, Mao Ye, and Guang Cheng. Stein neural sampler. arXiv:1810.03545, 2018.
215
+
216
+ Chin-Wei Huang, Faruk Ahmed, Kundan Kumar, Alexandre Lacoste, and Aaron C. Courville. Probability distillation: A caveat and alternatives. UAI, 2019.
217
+
218
+ Ajay Jain, Ben Mildenhall, Jonathan T. Barron, Pieter Abbeel, and Ben Poole. Zero-shot text-guided object generation with dream fields. CVPR, 2022.
219
+
220
+ Nikolay Jetchev. ClipMatrix: Text-controlled creation of 3d textured meshes. arXiv:2109.12922, 2021.
221
+
222
+ Nasir Mohammad Khalid, Tianhao Xie, Eugene Belilovsky, and Popa Tiberiu. CLIP-Mesh: Generating textured meshes from text using pretrained image-text models. SIGGRAPH Asia 2022 Conference Papers, 2022.
223
+
224
+ Diederik P Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. NeurIPS, 2021.
225
+
226
+ Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. Diffwave: A versatile diffusion model for audio synthesis. ICLR, 2021.
227
+
228
+ Johann Heinrich Lambert. Photometria sive de mensura et gradibus luminis, colorum et umbrae. sumptibus vidvae E. Klett, typis CP Detleffsen, 1760.
229
+
230
+ Jae Hyun Lim, Aaron C. Courville, Christopher J. Pal, and Chin-Wei Huang. AR-DAE: towards unbiased neural entropy gradient estimation. ICML, 2020.
231
+
232
+ Zhengzhe Liu, Yi Wang, Xiaojuan Qi, and Chi-Wing Fu. Towards implicit text-guided 3d shape generation. CVPR, 2022.
233
+
234
+ Oscar Michel, Roi Bar-On, Richard Liu, Sagie Benaim, and Rana Hanocka. Text2Mesh: Text-driven neural stylization for meshes. arXiv:2112.03221, 2021.
235
+
236
+ 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. ECCV, 2020.
237
+
238
+ Ben Mildenhall, Dor Verbin, Pratul P. Srinivasan, Peter Hedman, Ricardo Martin-Brualla, and Jonathan T. Barron. MultiNeRF: A Code Release for Mip-NeRF 360, Ref-NeRF, and RawNeRF, 2022. URL https://github.com/google-research/multinerf.
239
+
240
+ Alexander Mordvintsev, Christopher Olah, and Mike Tyka. Inceptionism: Going deeper into neural networks, 2015. URL https://research.googleblog.com/2015/06/ inceptionism-going-deeper-into-neural.html.
241
+
242
+ Alexander Mordvintsev, Nicola Pezzotti, Ludwig Schubert, and Chris Olah. Differentiable image parameterizations. Distill, 2018. doi: 10.23915/distill.00012.
243
+
244
+ Eric Nalisnick, Akihiro Matsukawa, Yee Whye Teh, Dilan Gorur, and Balaji Lakshminarayanan. Do deep generative models know what they don’t know?, 2018. URL https://arxiv.org/abs/ 1810.09136.
245
+
246
+ Thu Nguyen-Phuoc, Chuan Li, Lucas Theis, Christian Richardt, and Yong-Liang Yang. HoloGAN: Unsupervised learning of 3d representations from natural images. ICCV, 2019.
247
+
248
+ Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. In ICML, 2022.
249
+
250
+ Roy Or-El, Xuan Luo, Mengyi Shan, Eli Shechtman, Jeong Joon Park, and Ira KemelmacherShlizerman. StyleSDF: High-Resolution 3D-Consistent Image and Geometry Generation. CVPR, 2022.
251
+
252
+ Xingang Pan, Ayush Tewari, Lingjie Liu, and Christian Theobalt. Gan2x: Non-lambertian inverse rendering of image gans. 3DV, 2022.
253
+
254
+ Dong Huk Park, Samaneh Azadi, Xihui Liu, Trevor Darrell, and Anna Rohrbach. Benchmark for compositional text-to-image synthesis. In NeurIPS Datasets and Benchmarks, 2021a.
255
+
256
+ Keunhong Park, Utkarsh Sinha, Jonathan T Barron, Sofien Bouaziz, Dan B Goldman, Steven M Seitz, and Ricardo Martin-Brualla. Nerfies: Deformable neural radiance fields. ICCV, 2021b.
257
+
258
+ Wei Ping, Kainan Peng, and Jitong Chen. ClariNet: Parallel wave generation in end-to-end text-tospeech. ICLR, 2019.
259
+
260
+ 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. ICML, 2021.
261
+
262
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 2020.
263
+
264
+ Ravi Ramamoorthi and Pat Hanrahan. A signal-processing framework for inverse rendering. SIGGRAPH, 2001.
265
+
266
+ Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. ICML, 2021.
267
+
268
+ Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents, 2022. URL https://arxiv.org/abs/2204. 06125.
269
+
270
+ Herbert E. Robbins. An Empirical Bayes Approach to Statistics. Springer New York, 1992.
271
+
272
+ Geoffrey Roeder, Yuhuai Wu, and David Duvenaud. Sticking the landing: Simple, lower-variance gradient estimators for variational inference, 2017. URL https://arxiv.org/abs/1703.09194.
273
+
274
+ Chitwan Saharia, William Chan, Huiwen Chang, Chris A. Lee, Jonathan Ho, Tim Salimans, David J. Fleet, and Mohammad Norouzi. Palette: Image-to-image diffusion models, 2021a. URL https: //arxiv.org/abs/2111.05826.
275
+
276
+ Chitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J. Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement, 2021b. URL https://arxiv.org/abs/2104. 07636.
277
+
278
+ Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S. Sara Mahdavi, Rapha Gontijo Lopes, Tim Salimans, Jonathan Ho, David J Fleet, and Mohammad Norouzi. Photorealistic text-to-image diffusion models with deep language understanding. arXiv:2205.11487, 2022.
279
+
280
+ Aditya Sanghi, Hang Chu, Joseph G Lambourne, Ye Wang, Chin-Yi Cheng, and Marco Fumero. CLIP-Forge: Towards zero-shot text-to-shape generation. CVPR, 2022.
281
+
282
+ Christoph Schuhmann, Romain Beaumont, Cade W Gordon, Ross Wightman, mehdi cherti, Theo Coombes, Aarush Katta, Clayton Mullis, Patrick Schramowski, Srivatsa R Kundurthy, Katherine Crowson, Richard Vencu, Ludwig Schmidt, Robert Kaczmarczyk, and Jenia Jitsev. LAION-5b: An open large-scale dataset for training next generation image-text models. NeurIPS Datasets and Benchmarks Track, 2022.
283
+
284
+ Katja Schwarz, Yiyi Liao, Michael Niemeyer, and Andreas Geiger. GRAF: Generative radiance fields for 3d-aware image synthesis. NeurIPS, 2020.
285
+
286
+ Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. ICML, 2015.
287
+
288
+ Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. CoRR, abs/2010.02502, 2020. URL https://arxiv.org/abs/2010.02502.
289
+
290
+ Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. NeurIPS, 2019.
291
+
292
+ Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. ICLR, 2021.
293
+
294
+ Pratul P Srinivasan, Boyang Deng, Xiuming Zhang, Matthew Tancik, Ben Mildenhall, and Jonathan T Barron. NeRV: Neural reflectance and visibility fields for relighting and view synthesis. CVPR, 2021.
295
+
296
+ Ayush Tewari, Justus Thies, Ben Mildenhall, Pratul Srinivasan, Edgar Tretschk, W Yifan, Christoph Lassner, Vincent Sitzmann, Ricardo Martin-Brualla, Stephen Lombardi, et al. Advances in neural rendering. Computer Graphics Forum, 2022.
297
+
298
+ Aaron van den Oord, Yazhe Li, Igor Babuschkin, Karen Simonyan, Oriol Vinyals, Koray Kavukcuoglu, ¨ George van den Driessche, Edward Lockhart, Luis C. Cobo, Florian Stimberg, Norman Casagrande, Dominik Grewe, Seb Noury, Sander Dieleman, Erich Elsen, Nal Kalchbrenner, Heiga Zen, Alex Graves, Helen King, Tom Walters, Dan Belov, and Demis Hassabis. Parallel WaveNet: Fast high-fidelity speech synthesis. ICML, 2018.
299
+
300
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. NeurIPS, 2017.
301
+
302
+ Dor Verbin, Peter Hedman, Ben Mildenhall, Todd Zickler, Jonathan T. Barron, and Pratul P. Srinivasan. Ref-NeRF: Structured view-dependent appearance for neural radiance fields. CVPR, 2022.
303
+
304
+ Pascal Vincent. A connection between score matching and denoising autoencoders. Neural computation, 2011.
305
+
306
+ Can Wang, Menglei Chai, Mingming He, Dongdong Chen, and Jing Liao. CLIP-NeRF: Text-andimage driven manipulation of neural radiance fields. CVPR, 2022.
307
+
308
+ Jiajun Wu, Chengkai Zhang, Tianfan Xue, William T Freeman, and Joshua B Tenenbaum. Learning a probabilistic latent space of object shapes via 3d generative-adversarial modeling. NeurIPS, 2016.
309
+
310
+ Guandao Yang, Xun Huang, Zekun Hao, Ming-Yu Liu, Serge Belongie, and Bharath Hariharan. Pointflow: 3d point cloud generation with continuous normalizing flows. ICCV, 2019.
311
+
312
+ Lior Yariv, Yoni Kasten, Dror Moran, Meirav Galun, Matan Atzmon, Basri Ronen, and Yaron Lipman. Multiview neural surface reconstruction by disentangling geometry and appearance. NeurIPS, 2020.
313
+
314
+ Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, Ben Hutchinson, Wei Han, Zarana Parekh, Xin Li, Han Zhang, Jason Baldridge, and Yonghui Wu. Scaling autoregressive models for content-rich text-to-image generation. arXiv:2206.10789, 2022.
315
+
316
+ Linqi Zhou, Yilun Du, and Jiajun Wu. 3D shape generation and completion through point-voxel diffusion. ICCV, 2021.
317
+
318
+ # A APPENDIX
319
+
320
+ A.1 PSEUDOCODE FOR ANCESTRAL SAMPLING AND OUR SCORE DISTILLATION SAMPLING.
321
+
322
+ $z _ { - } , \ t _ { } =$ random.normal(img_shape)
323
+ for t in linspace(tmax, tmin, nstep): epshat_t $=$ diffusion_model.epshat(z_t, y, t) # Score function evaluation. if t $>$ tmin: eps $=$ random.normal(img_shape) $z _ { - } , t ~ =$ ddpm_update(z_t, epshat_t, eps) # 1 iteration, decreases noise level.
324
+ $\times \ =$ diffusion_model.xhat(z_t, epshat_t, t_min) # Tweedie’s formula: denoise the last step.
325
+ return x
326
+ params $=$ generator.init()
327
+ opt_state $=$ optimizer.init(params)
328
+ diffusion_model $=$ diffusion.load_model()
329
+ for nstep in iterations: $\textrm { \texttt { t } } =$ random.uniform(0., 1.) alpha_t, sigma_t $=$ diffusion_model.get_coeffs(t) eps $=$ random.normal(img_shape) $\times \ =$ generator(params, <other arguments>...) # Get an image observation. $z _ { - } , t ~ =$ alpha_t $\times ~ \times ~ +$ sigma_t $\star$ eps # Diffuse observation. epshat_t $=$ diffusion_model.epshat(z_t, y, t) # Score function evaluation. $\ g \ =$ grad(weight(t) $\star$ dot(stopgradient[epshat_t - eps], x), params) params, opt_state $=$ optimizer.update(g, opt_state) # Update params with optimizer.
330
+ return params
331
+
332
+ Figure 8: Pseudocode for Score Distillation Sampling with an application-specific generator that defines a differentiable mapping from parameters to images. The gradient $\mathsf { g }$ is computed without backpropagating through the diffusion model’s U-Net. We used the stopgradient operator to express the loss, but the parameter update can also be easily computed with an explicit VJP: $\textrm { \tiny { g } } =$ matmul(weight(t) $\star$ (-epshat t - eps), grad(x, params)).
333
+
334
+ # A.2 NERF DETAILS AND TRAINING HYPERPARAMETERS
335
+
336
+ Our model builds upon mip-NeRF 360 (Barron et al., 2022) (starting from the publicly available implementation 2022), which is an improved version of NeRF (Mildenhall et al., 2020). The main modification this model makes to NeRF is in how 3D point information is passed to the NeRF MLP. In NeRF, each 3D input point is mapped to a higher dimensional space using a sinusoidal positional encoding function (Vaswani et al., 2017). In mip-NeRF, this is replaced by an integrated positional encoding that accounts for the “width” of the ray being rendered (based on its pixel footprint in the image plane) and the length of each interval $[ d _ { i } , d _ { i + 1 } ]$ sampled along the ray (Barron et al., 2021). This allows each interval along a ray to be represented as a Gaussian distribution with mean $\pmb { \mu }$ and covariance matrix $\pmb { \Sigma }$ that approximates the interval’s 3D volume.
337
+
338
+ Mip-NeRF covariance annealing. As in mip-NeRF, each mean $\pmb { \mu }$ is the 3D coordinate of the center of the ray interval, but unlike mip-NeRF we do not use a covariance derived from camera geometry, but instead define each $\pmb { \Sigma }$ as:
339
+
340
+ $$
341
+ \pmb { \Sigma } = \lambda _ { \pmb { \Sigma } } ^ { 2 } \mathbf { I } _ { 3 }
342
+ $$
343
+
344
+ Where $\lambda _ { \pmb { \Sigma } }$ is a scale parameter that is linearly annealed from a large value to a small value during training. Representative settings are $5 \times 1 0 ^ { - 2 }$ and $2 \times 1 0 ^ { - 3 }$ for the initial and final values of $\lambda _ { \pmb { \Sigma } }$ , linearly annealed for the first $5 \mathrm { k }$ steps of optimization (out of $1 5 \mathrm { k }$ total). This “coarse to fine”
345
+
346
+ annealing of a scale parameter has a similar effect as the annealing used by Park et al. (2021b) but uses integrated positional encoding instead of traditional positional encoding. The underlying sinusoidal positional encoding function uses frequencies $2 ^ { 0 } , 2 ^ { \hat { 1 } } , \ldots , 2 ^ { L - 1 }$ , where we set $L = 8$ .
347
+
348
+ MLP architecture changes. Our NeRF MLP consists of 5 ResNet blocks (He et al., 2016) with 128 hidden units, Swish/SiLU activation (Hendrycks & Gimpel, 2016), and layer normalization (Ba et al., 2016) between blocks. We use an exp activation to produce density $\tau$ and a sigmoid activation to produce RGB albedo $\rho$ .
349
+
350
+ Environment Map MLP. We use an additional MLP to create an environment map allowing the bounded NeRF MLP to be rendered on a contextually-relevant and optimized background. This MLP takes a positionally-encoded ray direction as input, and outputs an RGB color. We use positional encodings with frequencies $2 ^ { 0 } , \ldots , 2 ^ { 4 }$ , and an MLP with 3 hidden layers of 64 units. The output of this MLP is passed through a sigmoid activation to produce RGB values between 0 and 1.
351
+
352
+ Shading hyperparameters. For the first 1k steps of optimization we set the ambient light color $\ell _ { a }$ to 1 and the diffuse light color $\ell _ { \rho }$ to 0, which effectively disables diffuse shading. For the remaining steps we set $\ell _ { a } = [ 0 . 1 , 0 . 1 , 0 . 1 ]$ ] and $\ell _ { \rho } = [ 0 . 9 , 0 . 9 , 0 . 9 ]$ with probability 0.75, otherwise $\ell _ { a } = { \bf 1 }$ , $\ell _ { \rho } = 0$ , i.e. we use diffuse shading $7 5 \%$ of the time. When shading is on $( \ell _ { \rho } > 0 )$ ), we choose textureless shading $\mathbf { \nabla } \cdot \mathbf { \rho } \mathbf { \rho } \rho = 1 \mathbf { \dot { \rho } } .$ ) with probability 0.5.
353
+
354
+ Spatial density bias. To aid in the early stages of optimization, we add a small “blob” of density around the origin to the output of the MLP. This helps focus scene content at the center of the 3D coordinate space, rather than directly next to the sampled cameras. We use a Gaussian PDF to parameterize the added density:
355
+
356
+ $$
357
+ \tau _ { \mathrm { i n i t } } ( \pmb { \mu } ) = \lambda _ { \tau } \cdot \exp \left( - \frac { \| \pmb { \mu } \| ^ { 2 } } { 2 \sigma _ { \tau } ^ { 2 } } \right) .
358
+ $$
359
+
360
+ Representative settings are $\lambda _ { \tau } = 5$ for the scale parameter and $\sigma _ { \tau } = 0 . 2$ for the width parameter.
361
+ This density is added to the $\tau$ output of the NeRF MLP.
362
+
363
+ Additional camera and light sampling details. Uniformly sampling camera elevation $\phi _ { \mathrm { c a m } }$ in angular space does not produce uniform samples over the surface of the sphere — the area around the pole is oversampled. We found this bias to be helpful in practice, so we sample $\phi _ { \mathrm { c a m } }$ from this biased distribution with probability 0.5, otherwise we sample from a true uniform-in-area distribution on a half-sphere. The sampled camera position is perturbed by a small uniform offset $\mathcal { U } ( - 0 . 1 , 0 . 1 ) ^ { 3 }$ . The “look-at” point is sampled from $\mathcal { N } ( \mathbf { 0 } , 0 . 2 \mathbf { I } )$ and the default “up” vector is perturbed by noise sampled from $\mathcal { N } ( \bar { \bf 0 } , 0 . 0 2 { \bf I } )$ . This noise acts as an additional augmentation, and ensures a wider diversity of viewpoints are seen during training.
364
+
365
+ We separately sample the direction and norm of the light position vector $\ell$ . To sample the direction, we sample from $\mathcal { N } ( \mathbf { p } _ { \mathrm { c a m } } , \mathbf { I } )$ where $\mathbf { p } _ { \mathrm { c a m } }$ is the camera position (this ensures that the point light usually ends up on the same side of the object as the camera). The norm $\| \ell \|$ is sampled from $\mathcal { U } ( 0 . 8 , 1 . 5 )$ , while $\| \mathbf { p } _ { \mathrm { c a m } } \| \sim \mathcal { U } ( 1 . 0 , 1 . 5 )$ .
366
+
367
+ Regularizer hyperparameters. We use the orientation loss proposed by Ref-NeRF (Verbin et al., 2022) to encourage normal vectors of the density field to face toward the camera when they are visible (so that the camera does not observe geometry that appears to face “backwards” when shaded). We place a stop-gradient on the rendering weights $w _ { i }$ , which helps prevent unintended local minima where the generated object shrinks or disappears:
368
+
369
+ $$
370
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { o r i e n t } } = \sum _ { i } \mathrm { s t o p . g r a d } ( w _ { i } ) \operatorname* { m a x } ( 0 , \boldsymbol { n } _ { i } \cdot \boldsymbol { v } ) ^ { 2 } , } \end{array}
371
+ $$
372
+
373
+ where $\textbf { { v } }$ is the direction of the ray (the viewing direction). We also apply a small regularization to the accumulated alpha value (opacity) along each ray: $\begin{array} { r } { \mathcal { L } _ { \mathrm { o p a c i t y } } = \sqrt { ( \sum _ { i } w _ { i } ) ^ { 2 } + 0 . 0 1 } } \end{array}$ . This discourages optimization from unnecessarily filling in empty space, and improves foreground/background separation.
374
+
375
+ For orientation loss $\mathcal { L } _ { \mathrm { o r i e n t } }$ , we find reasonable weights to lie in $[ 1 0 ^ { - 1 } , 1 0 ^ { - 3 } ]$ . If orientation loss is too high, surfaces become oversmoothed. In most experiments, we set the weight to $1 0 ^ { - 2 }$ . This weight is annealed in starting from $1 0 ^ { - 4 }$ over the first $5 \mathrm { k }$ (out of $1 5 \mathrm { k } )$ ) steps. For accumulated alpha loss $\mathcal { L } _ { \mathrm { o p a c i t y } }$ , we find reasonable weights to lie in $[ 1 0 ^ { - 3 } , 5 \times 1 0 ^ { - 3 } ]$ .
376
+
377
+ View-dependent prompting. We interpolate between front/side/back view prompt augmentations based on which quadrant contains the sampled azimuth $\theta _ { \mathrm { { c a m } } }$ . We experimented with different ways of interpolating the text embeddings, but found that simply taking the text embedding closest to the sampled azimuth worked well.
378
+
379
+ Optimizer. We use Distributed Shampoo (Anil et al., 2020) with $\beta _ { 1 } ~ = ~ 0 . 9$ , $\beta _ { 2 } ~ = ~ 0 . 9$ , exponent override $= 2$ , block size $= ~ 1 2 8$ , graft type $= \mathsf { S Q R T } \mathbf { \Lambda } _ { - } \mathsf { N }$ , $\epsilon = 1 0 ^ { - 6 }$ , and a linear warmup of learning rate over 3000 steps from $1 0 ^ { - 9 }$ to $1 0 ^ { - 4 }$ followed by cosine decay down to $1 0 ^ { - 6 }$ . We found this long warmup period to be helpful for improving the coherence of generated geometry.
380
+
381
+ # A.3 EXPERIMENTAL SETUP
382
+
383
+ Our computation of R-Precision differs slightly from baselines. As mentioned, CLIP-based text-to-3D systems are prone to overfitting the evaluation CLIP R-Precision metric since the model used for training is similar to the evaluation model. To minimize this problem, Dream Fields (Jain et al., 2022) and CLIP-Mesh (Khalid et al., 2022) evaluate renderings at a single held out view at a $4 5 ^ { \circ }$ elevation, higher than is seen during training (maximum $3 0 ^ { \circ }$ ). DreamFusion evaluates at $3 0 ^ { \circ }$ since it is not prone to this issue, but averages the metric over multiple azimuths to reduce variance. In our main results in Table 1, we evaluate all captions with 2 generation seeds unless otherwise noted.
384
+
385
+ # A.4 DERIVING THE SCORE DISTILLATION SAMPLING LOSS AND GRADIENTS
386
+
387
+ The score distillation sampling loss ${ \mathcal { L } } _ { \mathrm { S D S } }$ presented in Eqn. 4 was inspired by work on probability density distillation (Huang et al., 2019; Ping et al., 2019; van den Oord et al., 2018). We use this loss to find modes of the score functions that are present across all noise levels in the diffusion process. Here we show how the gradient of this loss leads to the same update as optimizing the training loss ${ \mathcal { L } } _ { \mathrm { D i f f } }$ , but without the term corresponding to the Jacobian of the diffusion U-Net. First, we consider gradients with respect to a single KL term:
388
+
389
+ $$
390
+ \begin{array} { r l } & { \quad \mathrm { K L } ( q ( \mathbf { z } _ { t } | \mathbf { x } = g ( \theta ) ) \| p _ { \phi } ( \mathbf { z } _ { t } | y ) ) = \mathbb { E } _ { \epsilon } \left[ \log q ( \mathbf { z } _ { t } | \mathbf { x } = g ( \theta ) ) - \log p _ { \phi } ( \mathbf { z } _ { t } | y ) \right] } \\ & { \nabla _ { \theta } \mathrm { K L } ( q ( \mathbf { z } _ { t } | \mathbf { x } = g ( \theta ) ) \| p _ { \phi } ( \mathbf { z } _ { t } | y ) ) = \mathbb { E } _ { \epsilon } \Big [ \underbrace { \nabla _ { \theta } \log q ( \mathbf { z } _ { t } | \mathbf { x } = g ( \theta ) ) } _ { \mathrm { ( A ) } } - \underbrace { \nabla _ { \theta } \log p _ { \phi } ( \mathbf { z } _ { t } | y ) } _ { \mathrm { ( B ) } } \Big ] } \end{array}
391
+ $$
392
+
393
+ The second term (B) can be related to $\hat { \epsilon }$ by the chain rule, relying on $s _ { \phi } ( \mathbf { z } _ { t } | y ) \approx \nabla _ { \mathbf { z } _ { t } } \log p _ { \phi } ( \mathbf { z } _ { t } | y )$ :
394
+
395
+ $$
396
+ \nabla _ { \boldsymbol { \theta } } \log p _ { \phi } ( \mathbf { z } _ { t } | y ) = s _ { \phi } ( \mathbf { z } _ { t } | y ) \frac { \partial \mathbf { z } _ { t } } { \partial \boldsymbol { \theta } } = \alpha _ { t } s _ { \phi } ( \mathbf { z } _ { t } | y ) \frac { \partial \mathbf { x } } { \partial \boldsymbol { \theta } } = - \frac { \alpha _ { t } } { \sigma _ { t } } \hat { \epsilon } _ { \phi } ( \mathbf { z } _ { t } | y ) \frac { \partial \mathbf { x } } { \partial \boldsymbol { \theta } }
397
+ $$
398
+
399
+ The first term (A) is the gradient of the entropy of the forward process with respect to the mean parameter, holding the variance fixed. Because of the fixed variance, the entropy is constant for a given $t$ and the total gradient of (A) is 0. However, we can still write out its gradient in terms of the “score function” (the gradient of the log probability with respect to parameters) and path derivative (the gradient of the log probability with respect to the sample):
400
+
401
+ $$
402
+ \nabla _ { \theta } \log q ( \mathbf { z } _ { t } | \mathbf { x } ) = \Big ( \underbrace { \frac { \partial \log q ( \mathbf { z } _ { t } | \mathbf { x } ) } { \partial \mathbf { x } } } _ { \mathrm { p a r a m e t e r s c o r e } } + \underbrace { \frac { \partial \log q ( \mathbf { z } _ { t } | \mathbf { x } ) } { \partial \mathbf { z } _ { t } } \frac { \partial \mathbf { z } _ { t } } { \partial \mathbf { x } } } _ { \mathrm { p a t h d e r i v a t i v e } } \Big ) \alpha _ { t } \frac { \partial \mathbf { x } } { \partial \theta } = \Big ( \frac { \alpha _ { t } } { \sigma _ { t } } \epsilon - \frac { \alpha _ { t } } { \sigma _ { t } } \epsilon \Big ) \alpha _ { t } \frac { \partial \mathbf { x } } { \partial \theta } = 0 .
403
+ $$
404
+
405
+ Sticking-the-Landing (Roeder et al., 2017) shows that keeping the path derivative gradient while discarding the score function gradient can lead to reduced variance as the path derivative term can be correlated with other terms in the loss. Here, the other term (B) corresponds to a prediction of $\epsilon$ , which is certainly correlated with the RHS of equation 14. Putting these together, we can use a “sticking-the-landing”-style gradient of our loss by thinking of $\epsilon$ as a control variate for $\hat { \epsilon }$ :
406
+
407
+ $$
408
+ \begin{array} { l } { \displaystyle \nabla _ { \boldsymbol { \theta } } \mathcal { L } _ { \mathrm { S D S } } = \mathbb { E } _ { t , \mathbf { z } _ { t } | \mathbf { x } } \Big [ w ( t ) \frac { \sigma _ { t } } { \alpha _ { t } } \nabla _ { \boldsymbol { \theta } } \mathrm { K L } \big ( q ( \mathbf { z } _ { t } | \mathbf { x } = g ( \boldsymbol { \theta } ) ) \| p _ { \phi } ( \mathbf { z } _ { t } | y ) \big ) \Big ] } \\ { \displaystyle = \mathbb { E } _ { t , \epsilon } \left[ w ( t ) \big ( \hat { \epsilon } ( \mathbf { z } _ { t } | y ) - \epsilon \big ) \frac { \partial \mathbf { x } } { \partial \boldsymbol { \theta } } \right] . } \end{array}
409
+ $$
410
+
411
+ In practice, we find that including $\epsilon$ in the gradient leads to lower-variance gradients that speed up optimization and can produce better final results.
412
+
413
+ In related work, Graikos et al. (2022) also sample diffusion models by optimization, thereby allowing parameterized samples. Their divergence $\begin{array} { r } { \mathrm { K L } ( h ( { \bf x } ) \| { \bf p } _ { \phi } ( { \bf x } | { \bf \bar { \boldsymbol { y } } } ) ) } \end{array}$ reduces to the loss $\mathbb { E } _ { \epsilon , t } \| \epsilon - \hat { \epsilon } _ { \theta } ( \mathbf { z } _ { t } | y ; t ) \| _ { 2 } ^ { 2 } - \log c ( \mathbf { x } , y )$ . The squared error requires costly backpropagation through the diffusion model $\hat { \epsilon } _ { \theta }$ , unlike SDS. DDPM-PnP also uses an auxiliary classifier $c$ , while we use CFG.
414
+
415
+ A few other works have updates resembling Score Distillation Sampling for different applications. Gradients of the entropy of an implicit model have been estimated with an amortized score model at a single noise level (Lim et al., 2020), though that work does not use our control variate based on subtracting the noise from ϵˆ. SDS could also ease optimization by using multiple noise levels. GAN-like amortized samplers can be learned by minimizing the Stein discrepancy (Hu et al., 2018; Grathwohl et al., 2020), where the optimal critic resembles the difference of scores in our loss (Eqn. 3).
416
+
417
+ # A.5 IMPACT OF SEED AND GUIDANCE WEIGHT
418
+
419
+ We find that large guidance weights are important for learning high-quality 3D models. Unlike image synthesis models that use guidance weights $\omega \in [ 5 , 3 0 ]$ , DreamFusion uses weights up $\omega = 1 0 0$ , and works at even larger guidance scales without severe artifacts. This may be due to the constrained nature of the optimization problem: colors output by our MLP are bounded to [0, 1] by a sigmoid nonlinearity, whereas image samplers need clipping.
420
+
421
+ We also find that our method does not yield large amounts of diversity across random seeds. This is likely due to the mode-seeking properties of $\mathcal { L } _ { \mathrm { { S D S } } }$ combined with the fact that at high noise levels, the smoothed densities may not have many distinct modes. Understanding the interplay between guidance strength, diversity, and loss functions remains an important open direction for future research.
422
+
423
+ # A.6 EXTENDED QUALITATIVE COMPARISON WITH PRIOR WORK
424
+
425
+ In Figure 11, we compare DreamFusion to Dream Fields on several prompts from the object-centric MS-COCO validation set.
426
+
427
+ ![](images/d150d656b9e577be3d033a6afe712676e5d5634210b62cb69aee69bf5d649306.jpg)
428
+ Figure 9: A 2D sweep over guidance weights and random seeds for two different prompts (“a zoomed out DSLR photo of a robot couple fine dining” and “a DSLR photo of a chimpanzee dressed like Henry VIII king of England”).
429
+
430
+ ![](images/e491841948e9b88ddab53aefd4d219b5b1b99fb6b822944c031d508cc38a87de.jpg)
431
+ Figure 10: Comparison of the CLIP loss from Dream Fields (top) and our SDS loss. For fair comparison of the loss functions in isolation, we use all of our proposed methods including viewdependent prompts, shading, optimizing untextured renderings, and regularizers, with the same 3D NeRF representation. Qualitatively, 3D scenes generated with SDS (ours) are much more coherent than scenes generated with a CLIP loss.
432
+
433
+ ![](images/c97be3cf2c798b178b3491389ec6fc12ad6a558694c9b9cc4c4f2b459ae0e28f.jpg)
434
+ Figure 11: Comparison between DreamFusion and Dream Fields (Jain et al., 2022) on object-centric MS-COCO prompts. Odd rows are results from DreamFusion, and even rows are results from Dream Fields. DreamFusion exhibits increased global coherence and quality.
parse/dev/FjNys5c7VyY/FjNys5c7VyY_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/FjNys5c7VyY/FjNys5c7VyY_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/FjNys5c7VyY/FjNys5c7VyY_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/JTmO2V9Xpz/JTmO2V9Xpz.md ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MEGABYTE: Modeling Million-byte Sequences with Multiscale Transformers
2
+
3
+ Lili Yu∗ Dániel Simig∗ Colin Flaherty∗ Armen Aghajanyan
4
+
5
+ Luke Zettlemoyer Mike Lewis
6
+
7
+ Meta AI
8
+
9
+ # Abstract
10
+
11
+ Autoregressive transformers are spectacular models for short sequences but scale poorly to long sequences such as high-resolution images, podcasts, code, or books. We propose MEGABYTE, a multi-scale decoder architecture that enables end-to-ModModelModelModel end differentiable modeling of sequences of over one million bytes. MEGABYTE segments sequences into patches and uses a local submodel within patches and a_ m e g _ b y t _ ' ' t r _ n global model between patches. This enables sub-quadratic self-attention, much larger feedforward layers for the same compute, and improved parallelism during decoding—unlocking better performance at reduced cost for both training and gen-Global Model eration. Extensive experiments show that MEGABYTE allows byte-level models to perform competitively with subword models on long context language modeling, achieve state-of-the-art density estimation on ImageNet, and model audio from raw files. Together, these results establish the viability of tokenization-free autoregressive sequence modeling at scale.
12
+
13
+ # 1 Introduction
14
+
15
+ Sequences of millions of bytes are ubiquitous; for example, music, image, or video files typically consist of multiple megabytes. However, large transformer decoders (LLMs) typically only use several thousand tokens of context (Brown et al., 2020; Zhang et al., 2022a)—both because of the quadratic cost of self-attention but also, more importantly, the cost of large feedforward networks per-position. This severely limits the set of tasks where LLMs can be applied.
16
+
17
+ We introduce MEGABYTE, a new approach to modeling long byte sequences. First, byte sequences are segmented into fixed-sized patches, loosely analogous to tokens. Our model then consists of three parts: (1) a patch embedder, which simply encodes a patch by losslessly concatenating embeddings of each byte, (2) a global module, a large autoregressive transformer that inputs and outputs patch representations and (3) a local module, a small autoregressive model
18
+
19
+ ![](images/9c9eaf2be8ee5fc0f21f129f854af58487fc6fdfd0633343e83fb1ee0b2baf18.jpg)
20
+ Figure 1: Overview of MEGABYTE with patch size $P =$ 4. A small local model autoregressively predicts each patch byte-by-byte, using the output of a larger global model to condition on previous patches. Global and Local inputs are padded by $P$ and 1 token respectively to avoid leaking information about future tokens.
21
+
22
+ that predicts bytes within a patch. Crucially, we observe that for many tasks, most byte predictions
23
+
24
+ $$
25
+ \begin{array} { r l r } { \iota _ { t } ^ { \mathrm { c o b i s c d } } } & { = E _ { x _ { t } } ^ { \mathrm { i o b o l . } \mathrm { c o n b e d } } + E _ { t } ^ { \mathrm { i o s } } } & { t \in [ 0 . . T ) , E ^ { \mathrm { g l o b a i c m e d } } \ \in \mathbb { R } ^ { N \times D G } , } \\ & { } & { E ^ { \mathrm { p o s } } \in \mathbb { R } ^ { T \times N \times D G } , \ k ^ { \mathrm { c o b d . } } \in \mathbb { R } ^ { T \times N \times D _ { G } } } \\ & { } & { E ^ { \mathrm { p l o b a i s i n } } } \\ & { \iota _ { k } ^ { \mathrm { g l o b a i s a l } } } & { = \left\{ \begin{array} { l l } { E ^ { \mathrm { g l o b a l . } \mathrm { p o s d . } } } & { \mathrm { i f } \ k = 0 , } \\ { h _ { t } ^ { \mathrm { i o s } } ( \mathrm { p . e } - 1 ) \cdot p \cdot ( k \cdot p ) } & { k \in [ 1 , \ldots , K ) , } \\ { w _ { 0 } \times \mathrm { c o n . } \mathrm { c o n } } & { 1 } \end{array} \right. } \\ & { } & { \mathrm { p l o b . ~ } } \\ { \iota _ { t , k } ^ { \mathrm { p o t a i n } } } & { = \mathrm { t r a s i o n ~ c l o b a i ~ } \left( b _ { 0 , k } ^ { \mathrm { g l o b a i . } } \right) } \\ & { } & { \mathrm { i f ~ } \mu _ { k , p } ^ { \mathrm { c o s i s a l } } + \frac { \mu _ { k } ^ { \mathrm { i n d . } } \mu _ { k } ^ { \mathrm { f l o c a l . } } } { \mu _ { k , p } ^ { \mathrm { i n d . } } } } \end{array}
26
+ $$
27
+
28
+ are relatively easy (for example, completing a word given the first few characters), meaning that large networks per-byte are unnecessary, and a much smaller model can be used for intra-patch modelling.
29
+
30
+ MEGABYTE has three main advantages over Transformers for long sequence modeling:
31
+
32
+ 1. Sub-quadratic self-attention Most work on long sequence models has focused on mitigating the quadratic cost of self-attention. MEGABYTE decomposes long sequences into two shorter sequences, and optimal patch sizes reduces the self-attention cost to $O ( N ^ { \frac { 4 } { 3 } } )$ , which remains tractable for even long sequences.
33
+
34
+ 2. Per-patch feedforward layers In GPT3-size models, more than $9 8 \%$ of FLOPS are used in computing position-wise feedforward layers. MEGABYTE uses large feedforward layers per-patch rather than per-position, enabling much larger and more expressive models for the same cost. With patch size $P$ , where a baseline transformer would use the same feedforward layer with $m$ parameters $P$ times, MEGABYTE can use a layer with $m P$ parameters once for the same cost.
35
+
36
+ 3. Parallelism in Decoding Transformers must perform all computations serially during generation because the input to each timestep is the output from the previous timestep. By reusing the global representation over multiple time steps during local model decoding, MEGABYTE allows greater parallelism during generation. For example, a MEGABYTE model with 1.5B parameters can generate sequences $40 \%$ faster than a standard 350M Transformer, whilst also improving perplexity when trained with the same compute.
37
+
38
+ Together, these improvements allow us to train much larger and better-performing models for the same compute budget, scale to very long sequences, and improve generation speed during deployment.
39
+
40
+ MEGABYTE also provides a strong contrast to existing autoregressive models that typically use some form of tokenization, where sequences of bytes are mapped to larger discrete tokens (Sennrich et al., 2015; Ramesh et al., 2021; Hsu et al., 2021). Tokenization complicates pre-processing, multi-modal modelling, and transfer to new domains, while hiding useful structure from the model. It also means that most state-of-the-art models are not truly end to end. The most widely used approaches to tokenization require language-specific heuristics (Radford et al., 2019) or lose information (Ramesh et al., 2021). Replacing tokenization with efficient and performant byte models would therefore have many advantages.
41
+
42
+ We conduct extensive experiments for both MEGABYTE and strong baselines. We use a fixed compute and data budget across all models to focus our comparisons solely on the model architecture rather than training resources, which are known to benefit all models. We find that MEGABYTE allows byte-level models to perform competitively with subword models on long context language modeling, achieve state-of-the-art perplexities for density estimation on ImageNet, and allow audio modelling from raw audio files. Together, these results establish the viability of tokenization-free autoregressive sequence modeling at scale.
43
+
44
+ # 2 MEGABYTE Transformer
45
+
46
+ # 2.1 Overview
47
+
48
+ MEGABYTE is an autoregressive model for efficiently modeling long input sequences. MEGABYTE is comprised of 3 components: (1) a patch embedder that inputs a discrete sequence, embeds each element, and chunks it into patches of length $P$ (2) a large global Transformer that contextualizes patch representations by performing self-attention over previous patches, and (3) a smaller local Transformer that inputs a contextualized patch representation from the global model, and autoregressively predict the next patch.
49
+
50
+ # 2.2 Components
51
+
52
+ Patch Embedder with patch size of $P$ maps a byte sequence $x _ { 0 . . T }$ to a sequence of patch embeddings of length $\begin{array} { r } { K = { \frac { T } { P } } } \end{array}$ and dimension $P \cdot D _ { G }$ .
53
+
54
+ First, each byte is embedded with a lookup table $E$ global-embed $\in \mathbb { R } ^ { V \times D _ { G } }$ to an embedding of size $D _ { G }$ and positional embeddings are added.
55
+
56
+ $$
57
+ h _ { t } ^ { \mathrm { e m b e d } } = E _ { x _ { t } } ^ { \mathrm { g l o b a l - e m b e d } } + E _ { t } ^ { \mathrm { p o s } } \qquad t \in [ 0 . . T ]
58
+ $$
59
+
60
+ Then, byte embeddings are reshaped into a sequence of $K$ patch embeddings with dimension $P \cdot D _ { G }$ . To allow autoregressive modelling, the patch sequence is padded to start with a trainable patch-sized padding embedding $( E ^ { \mathrm { g l o b a l - p a d } } \ \in \ \mathbb { R } ^ { P \times D _ { G } } )$ ), and the last patch is removed from the input. This sequence is the input to the global model, and is denoted hglobal-in ∈ RK×(P ·DG).
61
+
62
+ $$
63
+ \begin{array} { r } { h _ { k } ^ { \mathrm { g l o b a l - i n } } = \left\{ \begin{array} { l l } { E ^ { \mathrm { g l o b a l - p a d } } , } & { \mathrm { i f } k = 0 , } \\ { h _ { ( ( k - 1 ) \cdot P ) : ( k \cdot P ) } ^ { \mathrm { e m b e d } } , } & { k \in [ 1 , . . , K ) , } \end{array} \right. } \end{array}
64
+ $$
65
+
66
+ Global Model is a decoder-only Transformer with dimension $P \cdot D _ { G }$ that operates on a sequence of
67
+ $K$ tween patchpresentation uts a sequence of by performing se patch representations attention over previous , and outputs an updated. $K$ $h _ { 0 : K } ^ { \mathrm { g l o b a l - i n } }$ $h _ { 0 : K } ^ { \mathrm { g l o b a l - o u t } }$
68
+
69
+ $$
70
+ h _ { 0 ; K } ^ { \mathrm { g l o b a l - o u t } } = \mathrm { t r a n s f o r m e r } ^ { \mathrm { g l o b a l } } ( h _ { 0 : K } ^ { \mathrm { g l o b a l - i n } } )
71
+ $$
72
+
73
+ The output of the final global layer $h _ { 0 : K } ^ { \mathrm { g l o b a l } }$ contains $K$ patc epresentations imension $P \cdot D _ { G }$ .
74
+ For each of these, we reshape them into sequences of length $P$ $D _ { G }$ , where position $p$
75
+ uses dimensions $p \cdot D _ { G }$ to $( p + 1 ) \cdot D _ { G }$ . Each position is then projected to the dimension of the local
76
+ model with a matrix these with byte embe $w ^ { \mathrm { G L } } \in \mathbb { R } ^ { D _ { G } \times D _ { L } }$ where for th $D _ { L }$ is the local model dikens in the next patch combineocal byte $D _ { L }$ $E _ { x _ { ( k \cdot P + p - 1 ) } } ^ { \mathrm { l o c a l - e m b e d } }$ $( E ^ { \mathrm { l o c a l - p a d } } \in \mathbb { R } ^ { D _ { L } } )$
77
+ autoregressive modelling within a patch. This results in a tensor hlocal-in ∈ RK×P ×DL .
78
+
79
+ $$
80
+ h _ { k , p } ^ { \mathrm { l o c a l - i n } } = w ^ { \mathrm { G L } } h _ { k , ( p \cdot D _ { G } ) : ( ( p + 1 ) \cdot D _ { G } ) } ^ { \mathrm { g l o b a l - o u t } } + E _ { x _ { ( k \cdot P + p - 1 ) } } ^ { \mathrm { l o c a l - e m b e d } }
81
+ $$
82
+
83
+ Local Model is a smaller decoder-only Transformer of dimension $D _ { L }$ that operates on a single patch $k$ containing $P$ elements, each of which is the sum of an output from the global model and an embedding of the previous byte in the sequence. $K$ copies of the local models are run on each patch independently (and in parallel during training), computing a representation $h ^ { \mathrm { l o c a l - o u t } } \in \mathbb { R } ^ { K \times P \cdot \hat { D } _ { L } }$ .
84
+
85
+ $$
86
+ h _ { k , 0 : P } ^ { \mathrm { l o c a l - o u t } } = \mathrm { t r a n s f o r m e r } ^ { \mathrm { l o c a l } } ( h _ { k , 0 : P } ^ { \mathrm { l o c a l - i n } } )
87
+ $$
88
+
89
+ Finally, we can compute the probability distribution over the vocabulary at each position. The $p$ th element of the $k$ th patch corresponds to element $t$ of the complete sequence, where $t = k \cdot P + p$ :
90
+
91
+ $$
92
+ p ( x _ { t } | x _ { 0 : t } ) = \mathrm { s o f t m a x } \big ( E ^ { \mathrm { l o c a l - e m b e d } } h _ { k , p } ^ { \mathrm { l o c a l - o u t } } \big ) _ { x _ { t } }
93
+ $$
94
+
95
+ # 2.3 Variations and Extensions
96
+
97
+ Convolutional Patch Encoder: One limitation of patchifying sequences is that it is not translation invariant, and byte sequences may receive a different representation depending on their position in the patch. This may mean, for example, that a model has to relearn the meaning of a word at different offsets. To mitigate this issue, we experimented with augmenting the Patch Embedder with causal convolutional layers, which allow translation-invariant contextual representations of the bytes before they are chunked into patches. We use a stack of convolutional layers, with filter sizes of 3, 5 and 7.
98
+
99
+ Cross-patch Attention: The Local model uses short sequences for efficiency, and relies on the Global model for long-range information. However, we can increase the context of the Local model with little overhead by allowing it to condition on $r$ elements from the previous patch. This approach allows the Global model to focus on a longer-range context. Specifically, when computing selfattention in each layer, we concatenate the keys and values with the last $r$ keys and queries from the previous patch. We use rotary embeddings (Su et al., 2021) to model relative positions between elements in the sequence. This approach is reminiscent of TransformerXL (Dai et al., 2019) but differs by being fully differentiable.
100
+
101
+ Strided Inference: We observed empirically that the per-token loss within each patch increases towards the end of the patch, as the prediction relies more on the weaker Local model. To alleviate this issue, we propose strided inference, in which we predict the sequence with two forward passes of the full model, whose inputs are offset by $p / 2$ positions from each other. We then combine the first $p / 2$ positions in each patch for our predictions to predict the complete sequence. Similarly to sliding window methods (Press et al., 2020), this approach doubles the cost of inference but improves results.
102
+
103
+ # 3 Efficiency Analysis
104
+
105
+ # 3.1 Training Efficiency
106
+
107
+ Attention The cost of attention in a transformer architecture for a sequence of length $T$ has $O ( T ^ { 2 } )$ complexity. Much work has been explored reducing this; for example, Sparse Transformers (Child et al., 2019) and Routing Transformers (Roy et al., 2020) show strong results with a complexity $O ( T ^ { \frac { 3 } { 2 } } )$ . Many linear attention mechanisms have also been proposed (Katharopoulos et al., 2020; Choromanski et al., 2020), although we are not aware of competitive results on large scale language modeling tasks. As a function of sequence length $T$ and patch size $P$ , the Global model has a sequence of length $\textstyle { \frac { P } { T } }$ so uses $\scriptstyle O ( { \frac { T ^ { 2 } } { P ^ { 2 } } } )$ operations, and the Local model uses $\textstyle { \frac { P } { T } }$ sequences of length $P$ so uses $\begin{array} { r } { O ( \frac { T P ^ { 2 } } { P } ) = O ( P T ) } \end{array}$ operations. The overall cost of MEGABYTE is therefore in $\begin{array} { r } { O ( \frac { T ^ { 2 } } { P ^ { 2 } } + T P ) } \end{array}$ . $P$ is a hyperparameter that is chosen to create an architecture for sequences of size $T$ . By setting $P = T ^ { \frac { 1 } { 3 } }$ the complexity is in $O ( T ^ { \frac { 4 } { 3 } } )$ . Using much shorter patches of $P = T ^ { \frac { 1 } { 5 } }$ would give a complexity of $O ( T ^ { \frac { 8 } { 5 } } )$ . The cost is less than the transformer for all non-trivial values of $P$ such that $1 < P < T$ .
108
+
109
+ Feedforward Layers However, attention is not the main cost in large transformers. Instead of increasing the sequence length, transformers are more commonly scaled by increasing the dimension of their latent state $d$ , and the feedforward network cost dominates the model’s overall cost (Kaplan et al., 2020). For example, in the GPT3 architecture, the quadratic self-attention computation accounts for only $1 . 4 \%$ of FLOPS. Following the approximation of (Kaplan et al., 2020), a forward pass with a large transformer with $m$ non-embedding parameters on a sequence of length $T$ uses roughly $2 m T$ FLOPS. MEGABYTE contains two transformers: the Global model uses $m _ { g }$ parameters on a sequence of length $\textstyle { \frac { T } { P } }$ , and a Local model with $m _ { l }$ parameters that sees $\textstyle { \frac { T } { P } }$ sequences of length $P$ giving an estimate of $2 T ( \frac { m _ { g } } { P } + m _ { l } )$ FLOPS. When $m _ { g } \gg m _ { l }$ , the FLOPS used by MEGABYTE is approximately $\frac { 2 T m _ { g } } { P }$ , allowing a model $P$ times larger than a transformer with equivalent FLOPS. This analysis holds irrespective of any efficient attention mechanisms used in the transformer.
110
+
111
+ Combined Analysis To understand efficiency at different sequence lengths and model sizes, we calculate the total FLOPS used by transformers, Linear Transformers and MEGABYTE. For each operation, we use FLOP estimates from (Kaplan et al., 2020), except for attention in Linear Transformers, which we estimate as $9 D$ FLOPS/token1, where $D$ is the model embedding dimension. Figure 3 shows that for models of size 660M to 173B and sequence lengths of up to 1M tokens,
112
+
113
+ MEGABYTE with $P = 8$ uses less FLOPS than either transformers or Linear Transformers. Baseline model architectures are based on GPT3, and Megabyte global/local model sizes are 452M/151M, 5.8B/604M, 170B/3.2B respectively.
114
+
115
+ # 3.2 Generation Efficiency
116
+
117
+ Generating long sequences with transformers is slow, because the input to each timestep is the output from the previous timestep, meaning each layer must be computed for each token serially. As running a layer on a single token typically does not saturate the amount of parallelism available within a GPU, for analysis, we model each layer as a constant cost independently of size. Consider a MEGABYTE model with $L _ { \mathrm { g l o b a l } }$ layers in the Global model and $L _ { \mathrm { l o c a l } }$ layers in the Local model and patch size $P$ , compared with a Transformer architecture with $L _ { \mathrm { l o c a l } } + L _ { \mathrm { g l o b a l } }$ layers. Generating each patch with MEGABYTE requires a sequence of $O ( L _ { \mathrm { g l o b a l } } + P \cdot L _ { \mathrm { l o c a l } } )$ serial operations, whereas the Transformer requires $\bar { O } ( P \cdot L _ { \mathrm { g l o b a l } } + P \cdot L _ { \mathrm { l o c a l } } )$ serial operations. When $L _ { \mathrm { g l o b a l } } \gg L _ { \mathrm { l o c a l } }$ (i.e. the Global model has many more layers than the Local model), MEGABYTE can reduce inference costs by a factor close to $P$ .
118
+
119
+ ![](images/e8f0a6e0f7c644ca9ccbba9ab18c4479b142ce34ba180bc4fb7aac86bb662f60.jpg)
120
+ Figure 3: Computational cost (FLOPS/token) for different model architectures at different scales. MEGABYTE architectures (here with $P = 8$ ) use less FLOPS than equivalently sized Transformers and Linear Transformers (Katharopoulos et al., 2020) across a wide range of model sizes and sequence lengths, allowing larger models to be used for the same computational cost.
121
+
122
+ # 4 Experimental setup
123
+
124
+ Controlling for Compute and Data Models show consistent improvements when increasing both data and compute Kaplan et al. (2020); Hoffmann et al. (2022), meaning that one model can outperform another because of an increased training budget instead of an improved architecture. However, in practice, both compute and data are typically limited. We conduct experiments using a fixed compute and data budget across all models to focus comparisons solely on the model architecture rather than training resources. To achieve this, we adjust model hyperparameters (mainly, number of layers) within each architecture so that the forward pass time taken per byte is matched, and then train all models for the same number of bytes.
125
+
126
+ Comparison Systems We compare MEGABYTE with both a standard decoder-only Transformer and PerceiverAR (Hawthorne et al., 2022). PerceiverAR extends the original transformer with a single cross-attention layer over a much longer context sequence, and is the best performing general purpose autoregressive model we are aware of and achieves state-of-the-art results across several modalities. We implemented both models in the same codebase, and all models share a similar data loader, preprocessing step, and trainer to avoid any artifacts in our compute-controlled experiments.
127
+
128
+ Training Procedure All models were trained using the Metaseq2 code base Zhang et al. (2022b). The training used the PyTorch framework Paszke et al. (2019), with fairscale to improve memory efficiency through fully sharded model and optimizer states Baines et al. (2021). Mixed precision training was used to improve training efficiency at scale Micikevicius et al. (2017). More training details and various model parameters can be found in Section A.1 in the Appendix. To validate our implementation of PerceiverAR, we reproduced their experiments on downsized ImageNet at 64 pixels. By carefully matching hyperparameters, we achieved a bits per byte (bpb) score of 3.53, compared to the reported 3.54 in the original paper.
129
+
130
+ Inference Methods Several techniques have been proposed for trading off speed for performance during inference with language models, including sliding windows Press et al. (2020) and our strided inference. We only use these methods when comparing with prior published work (Tables 2 and 3).
131
+
132
+ <table><tr><td>Dataset</td><td>Total Bytes</td><td>bytes/doc</td><td>Transformer</td><td>PerceiverAR</td><td>MEGABYTE</td></tr><tr><td>PG-19</td><td>10.1GB</td><td>411,404</td><td>1.057</td><td>1.104</td><td>1.000</td></tr><tr><td>Stories</td><td>21.3GB</td><td>35,265</td><td>1.064</td><td>1.070</td><td>0.978</td></tr><tr><td>Books</td><td>79.7GB</td><td>509,526</td><td>1.097</td><td>1.104</td><td>1.007</td></tr><tr><td>arXiv</td><td>91.5GB</td><td>58,518</td><td>0.816</td><td>0.791</td><td>0.678</td></tr><tr><td>Code</td><td>353.7GB</td><td>7,461</td><td>0.575</td><td>0.546</td><td>0.411</td></tr></table>
133
+
134
+ Table 1: Text dataset sizes and mean document lengths. We also report bpb of various models (Transformer, PerceiverAR, and MEGABYTE) trained with the same compute.
135
+
136
+ <table><tr><td></td><td>Tokenizer</td><td>Vocab</td><td>Context Length</td><td>Validation</td><td>Test</td></tr><tr><td>TransformerXL Rae et al. (2019a)</td><td>SentPiece</td><td>32k</td><td>512+1024</td><td>45.5</td><td>36.3</td></tr><tr><td>CompressiveTransformer Rae et al. (2019a)</td><td>SentPiece</td><td>32k</td><td>512+512+2x512</td><td>43.4</td><td>33.6</td></tr><tr><td>PerceiverAR Hawthorne et al. (2022)</td><td>SentPiece</td><td>32k</td><td>2048</td><td>45.9</td><td>28.9</td></tr><tr><td>BlockRecurrent Hutchins et al. (2022)</td><td>SentPiece</td><td>32k</td><td>1024+recurrence</td><td>-</td><td>26.5</td></tr><tr><td>Transformer byte-level (ours)</td><td>Bytes</td><td>256</td><td>2048</td><td>81.6</td><td>69.4</td></tr><tr><td>PerceiverAR byte-level (ours)</td><td>Bytes</td><td>256</td><td>8192</td><td>119.1</td><td>88.8</td></tr><tr><td>MEGABYTE</td><td>Bytes</td><td>256</td><td>8192</td><td>42.8</td><td>36.4</td></tr></table>
137
+
138
+ Table 2: Larger scale experiments on PG19, converting bits-per-byte to word-level perplexities for comparison with prior work. Results below the line are compute-matched. MEGABYTE outperforms other byte models by a wide margin, and gives results competitive with state-of-the-art models trained on subwords.
139
+
140
+ # 5 Language Modeling
141
+
142
+ We evaluated the performance of MEGABYTE on language modeling on a set of 5 diverse datasets emphasizing long-range dependencies: Project Gutenberg (PG-19), Books, Stories, arXiv, and Code.
143
+
144
+ Datasets We experiment on a range of long form text datasets. The PG-19 dataset Rae et al. (2019b) consists of English-language books written before 1919 and is extracted from the Project Gutenberg online library. The Stories dataset Trinh & Le (2018) is a subset of CommonCrawl data meant to emulate Winograd schemas. Books Gao et al. (2020) is another collection of English-language books. The arXiv dataset contains technical publications written in $\mathrm { I A T _ { E } X }$ from the arXiv online archive. Finally, the Code dataset is a large publicly available dataset of open source code, under Apache, BSD or MIT licenses. More details on dataset sizes and document lengths are shared in Table 1.
145
+
146
+ Controlled Experiments Table 1 lists bpb on each dataset. Each model is trained for 80 billion bytes, and models are scaled to use the same compute budget. We carefully tune hyperparameters for all architectures to best utilize the available compute budget. MEGABYTE consistently outperforms both transformers and PerceiverAR across all datasets. We use the same sets of parameters on all dataset. In all experiments presented in Table 1, transformer has size of 320M with context length of 1024, PerceiverAR has size of 248M with context size of 8192 and latent size of 1024, and MEGABYTE global/local model sizes are 758M/262M with context length of 8192 and patch size of 8.
147
+
148
+ Scaling Experiment We scale up our training data on PG-19 (Table 2), and compare MEGABYTE with byte baselines, as well as converting all results to word-level perplexities to benchmark with stateof-art token based models. We train a byte-level Transformer, PerceiverAR and MEGABYTE models for 400B bytes and the same compute budget using same model parameters as in the controlled experiments. We find that MEGABYTE outperforms other byte-level models by a wide margin at this scale.3 We also compare with the best previously reported numbers for sub-word models. These results may be confounded by differing amounts of compute and tuning used, but show that MEGABYTE gives results competitive with state-of-the-art models trained on subwords. These results suggest that MEGABYTE may allow future large language models to be tokenization-free.
149
+
150
+ # 6 Image Modeling
151
+
152
+ Sequence Modeling on ImageNet We test MEGABYTE on variants of the autoregressive image generation task on ImageNet (Oord et al., 2016), to measure its ability to efficiently use long context. We test on three different resolutions of images, ranging from $6 4 { \times } 6 4$ to $6 4 0 { \times } 6 4 0$ pixels – the latter requiring the effective modeling of sequences with over 1.2M tokens. This generation task becomes increasingly challenging as the image’s resolution grows: doing well on this task requires the modeling of local patterns (textures, lines, etc.) and long-range context that provides information about the high level structure of the image. Inspired by recent works in Vision Transformers (Dosovitskiy et al., 2020), we model image data patch by patch (more details can be found in Appendix D.1).
153
+
154
+ Comparison with State of the Art We train a large MEGABYTE model on ImageNet 64x64 with Global and Local models sized 2.7B and 350M parameters, respectively, for 1.4T tokens. We estimate that training this model consumed less than half the GPU hours we would have needed to reproduce the best PerceiverAR model described by (Hawthorne et al., 2022). As shown in Table 2, MEGABYTE matches the state-of-the-art performance of PerceiverAR whilst using only half the compute.
155
+
156
+ <table><tr><td>ImageNet64</td><td>bpb</td></tr><tr><td>Routing Transformer (Roy et al.,2020)</td><td>3.43</td></tr><tr><td>Combiner (Ren et al., 2021)</td><td>3.42</td></tr><tr><td>Perceiver AR (Hawthorne et al.,2022)</td><td>3.40</td></tr><tr><td>MEGABYTE</td><td>3.40</td></tr></table>
157
+
158
+ Table 3: Bits per byte (bpb) on ImageNet $6 4 { \times } 6 4$ . MEGABYTE matches the current state-of-the-art while only using half the amount of GPU hours to train.
159
+
160
+ <table><tr><td></td><td>Context</td><td>Image64</td><td>Image256</td><td>Image640</td></tr><tr><td>Total len</td><td></td><td>12288</td><td>196608</td><td>1228800</td></tr><tr><td>Transformer</td><td>1024</td><td>3.62</td><td>3.801</td><td>2.847</td></tr><tr><td>Perceiver AR</td><td>12000</td><td>3.55</td><td>3.373</td><td>2.345</td></tr><tr><td>MEGABYTE</td><td>Full</td><td>3.52</td><td>3.158</td><td>2.282</td></tr></table>
161
+
162
+ Table 4: Bits per byte (bpb) on ImageNet with different resolutions. All models use the same compute and data. MEGABYTE scales well to sequences of over 1M tokens.
163
+
164
+ Scaling to higher resolutions We compare three transformer variants (vanilla, PerceiverAR, MEGABYTE) to test scalability to long sequences on increasingly large image resolutions. We use our own implementations of these in the same framework and budget the same amount of GPU hours and data to train each of these model variants.
165
+
166
+ MEGABYTE is able to handle all sequence lengths with a single forward pass of up to 1.2M tokens. We found neither the standard Transformer nor PerceiverAR could model such long sequences at a reasonable model size, so instead we split images into segments of size 1024 and 12000 respectively. For Megabyte, we set patch size as 12 for Image64 and patch size as 192 for Image256 and Image640 datasets. Model sizes are adjusted to match overall training speeds across models and we do not use any form of sliding window evaluation in this experiment. As seen in Table 4, MEGABYTE outperforms baselines across all resolutions in this compute-controlled setting. The precise settings used for each of the baseline models such as context length and number of latents are summarized in Table 12. Results show that MEGABYTE outperforms the other systems at all resolutions, demonstrating an effective model of sequences of over 1M bytes.
167
+
168
+ # 7 Audio Modeling
169
+
170
+ Audio has aspects of both the sequential structure of text and the continuous nature of images, so is an interesting application for MEGABYTE.
171
+
172
+ Raw audio is typically stored as a sequence of 16-bit integer values (one per timestep); a softmax layer would need to output 65,536 probabilities per timestep to model all possible values. To address this issue, various techniques have been developed to reduce the memory and computational requirements of the softmax layer. For instance, van den Oord et al. (2016) apply $\mu$ -law companding transformation and quantizes the input into 256 possible values. Alternatively, van den Oord et al. (2017) model the samples using the discretized mixture of logistics distribution introduced by Salimans et al. (2017). Finally, Kalchbrenner et al. (2018) use a dual softmax technique to produce 8 coarse and 8 fine bits. In our approach, we simplify the audio modeling process by directly reading the bytes (256 possible values) from the audio file and conducting an autoregressive language model on top of that. This greatly streamlines the modeling process, making it easier and more efficient.
173
+
174
+ Our audio modeling approach focuses on $1 6 \ \mathrm { k H z }$ , 16-bit audio, which equates to 32k bytes per one-second clip. We use an extensive audio dataset consisting of 2 terabytes (roughly 18,000 hours) of audio. We use a sequence length of 524,288, a patch size of 32, and a batch size of 32 to facilitate model training. By utilizing these settings, we can effectively train our model on large volumes of audio data, helping to improve its accuracy and efficacy. Our model obtains bpb of 3.477, much lower than the results with perceiverAR (3.543) and vanilla transformer model (3.567). More ablation results are presented in Table 6.
175
+
176
+ <table><tr><td></td><td>Global Size</td><td>(Local) Size</td><td>bpb</td><td>Generation Time (s)</td></tr><tr><td>Transformer</td><td>1</td><td>350M</td><td>1.064</td><td>132</td></tr><tr><td>MEGABYTE</td><td>1.3B</td><td>218M</td><td>0.991</td><td>93</td></tr></table>
177
+
178
+ Table 5: Comparison of bits per byte (bpb) and generation speed of 8192 bytes of transformer model (with context length 1024) and MEGABYTE with context length 8192 and patch size 8.
179
+
180
+ # 8 Analysis
181
+
182
+ We study different behaviors of MEGABYTE. All experiments in the same group use the same compute.
183
+
184
+ Generation speed We also compare the text generation speed between MEGABYTE and a transformer. We compare a 350M parameter baseline transfomer and a MEGABYTE model with a 1.3B parameter Global model and a 218M parameter local model, trained on PG19 with equal compute. As shown in Table 5, the MEGABYTE model achieves much lower perplexity as expected. However, MEGABYTE also generates a sequence of 8192 tokens $40 \%$ faster than transformer, despite having over 4 times the parameters. This speed up is due to the bulk of the parameters being in the Global model, which only needs to be computed once for every 8 tokens, whereas all the parameters in the baseline model are used on every token.
185
+
186
+ Model Components In Table 6, we analyze the significance of different components in the MEGABYTE architecture by studying arXiv, Librilight-L and ImageNet256 datasets. Removing Local (w/o local model) or global (w/o global model) model, we observe a substantial increase in bpb on all datasets, showing that both parts are crucial. The performance of the model without the cross-patch local model (w/o cross-patch local model) is competitive, indicating that the architecture is robust to this modification. We observe slight improvement on the Librilight-L and ImageNet256 datasets by augmenting the MEGABYTE model with a CNN encoder (w/ CNN encoder). This suggests that the MEGABYTE architecture can benefit from integrating alternative encoding mechanisms.
187
+
188
+ Effective Use of Context Long-context models often struggle to benefit from the full context (Sun et al., 2021). Figure 7 shows that later tokens within each context window have a higher likelihood, indicating that MEGABYTE can effectively use at least 8k bytes of context on the PG19 dataset.
189
+
190
+ <table><tr><td></td><td>Arxiv</td><td>Audio</td><td>Image256</td></tr><tr><td>MEGABYTE</td><td>0.6871</td><td>3.477</td><td>3.158</td></tr><tr><td>w/o local model</td><td>1.263</td><td>5.955</td><td>4.768</td></tr><tr><td>w/o global model</td><td>1.373</td><td>3.659</td><td>3.181</td></tr><tr><td>w/o cross-patch attention</td><td>0.6781</td><td>3.481</td><td>3.259</td></tr><tr><td>w/ CNN encoder</td><td>0.6871</td><td>3.475</td><td>3.155</td></tr></table>
191
+
192
+ Table 6: Ablation of MEGABYTE model components. Models with the same dataset are trained using the same compute. The hyperparameters are listed in Table 12.
193
+
194
+ ![](images/90c84fe96cac33e09d97caa58837c9c14e67b272857b7839b989a5774524a4fd.jpg)
195
+ Table 7: Average log probability assigned to different positions within the context length by MEGABYTE and by a vanilla transformer model on PG19 test set.
196
+
197
+ ![](images/1b1ce533147ed97a72fa744e530bc7463349ed2c77c8a979df6b2807e63b709d.jpg)
198
+ Table 8: An illustration of strided inference with patch size 8. Blue and yellow represents two inferences that are shifted by half patch size. Solid line indicates final probablity being taking during strided inference.
199
+
200
+ <table><tr><td>Method</td><td>Inference Cost</td><td>bpb</td></tr><tr><td>Basic Inference</td><td>1X</td><td>0.9079</td></tr><tr><td>w/ Sliding Window</td><td>2X</td><td>0.8918</td></tr><tr><td>w/ Strided Inference</td><td>2X</td><td>0.8926</td></tr><tr><td>w/ Sliding&amp; Strided</td><td>4X</td><td>0.8751</td></tr></table>
201
+
202
+ Table 9: Performance of various inference techniques on the PG19 test set using our best MEGABYTE model.
203
+
204
+ Strided Inference We find that within a single patch, on average, the MEGABYTE performs worse on later tokens within a patch (see Figure 8). Section 2.3 proposes strided inference as a solution, where two forward passes are performed offset by $\textstyle { \frac { P } { 2 } }$ tokens, and results from the first half of each patch are combined. Table 9 shows performance improvements from strided inference, which are additive with the standard sliding window.
205
+
206
+ Patch Size. We experimented with various patch sizes on Image256 dataset and found a wide range of values where MEGABYTE performs similarly. We found similar robustness to patch size choices across all modalities, although the optimal patch size itself can be different across modalities.
207
+
208
+ Local to Global model Size Ratio. We experimented with different Local/Global model size ratios on PG19 dataset. By grouping bytes into patches, MEGABYTE effectively uses $P$ times less tokens for the Global model as on the Local model—enabling us to increase the size of the Global model with reduced cost. We find that a given compute budget is spent optimally when the Global model is larger than the Local model, consistently across all modalities and various patch sizes.
209
+
210
+ <table><tr><td>Patch</td><td>Global Size</td><td>Local Size</td><td>bpb</td></tr><tr><td>48</td><td>125M</td><td>114M (L=11)</td><td>3.178</td></tr><tr><td>192</td><td>125M</td><td>125M (L=12)</td><td>3.158</td></tr><tr><td>768</td><td>125M</td><td>83M(L=8)</td><td>3.186</td></tr></table>
211
+
212
+ Table 10: Effects of patch size on performance on the Image256 dataset. All versions use the same amount of GPU hours and data.
213
+
214
+ <table><tr><td>Global Size</td><td>Local Size</td><td>bpb</td></tr><tr><td>350M (D=1024,L=24)</td><td>290M (D=1024,L=20)</td><td>1.014</td></tr><tr><td>760M (D=1536,L=24)</td><td>262M (D=1024,L=18)</td><td>1.002</td></tr><tr><td>1.3B (D=2048,L=24)</td><td>218M (D=1024,L=15)</td><td>0.991</td></tr></table>
215
+
216
+ Table 11: Effects of Local / Global model size on the PG19 dataset. Increasing the capacity of global model improves performance. Models are compute and data matched.
217
+
218
+ # 9 Related Work
219
+
220
+ Prior research has explored the possibility of improving the efficiency of Transformers on long sequences, primarily motivated by mitigating the quadratic cost of self-attention.
221
+
222
+ Efficient Encoder Models Several related techniques to ours have been developed for transformer encoder architectures but cannot be straightforwardly applied to decoders. In particular, patchifying operations have previously been used in image encoder models such as ViT (Dosovitskiy et al., 2020), and down- and up-sampling operations have been used for text encoders (Clark et al., 2022), but such methods cannot be naively applied to decoder-only models without leaking information to future bytes in the same patch. MEGABYTE generalizes these approaches to an efficient decoder model by using a intra-patch transformer to predict each sequence element’s likelihood, and offseting the inputs to the two models to avoid leaking information. Jaegle et al. (2021) use self-attention on a shorter latent sequence also resembles patchification, but this technique cannot easily be applied to decoder architectures without leaking information to future timesteps.
223
+
224
+ Efficient Decoder models Improving the efficiency of decoder models is harder because of the need to make one prediction per timestep, and not leak information to future timesteps. The most popular approaches can be categorized as (1) chunking sequences into smaller blocks, and propagating information from previous blocks with either recurrence (Dai et al., 2019; Hutchins et al., 2022) or cross-attention (Hawthorne et al., 2022), (2) linear alternatives to attention, which typically involve forms of token-level recurrence (Katharopoulos et al., 2020) or state space models (Gu et al., 2021; Smith et al., 2022; Ma et al., 2022), or (3) sparse approximations of attention (Kitaev et al., 2020; Beltagy et al., 2020; Child et al., 2019; Wu et al., 2022). However, the performance of dense attention means it is typically still chosen for large scale decoders (Touvron et al., 2023; Chowdhery et al., 2022). MEGABYTE takes the alternative approach of decomposing the complete sequence into two shorter sequences, giving sub-quadratic attention. We also note that feedforward networks are the dominant cost in large decoders, not self-attention. Our approach to compressing sequences allows much larger models than would be possible when using large feedforward networks at every timestep.
225
+
226
+ Tokenization The most common approach to shortening sequence lengths in Transformer decoders is to pre-process the input with a form of tokenization, in which multiple bytes are mapped to a single discrete token from a fixed vocabulary. For text, this can be done losslessly using methods such as BPE (Sennrich et al., 2015) and SentencePiece (Kudo & Richardson, 2018), but these approaches can require language-specific heuristics (Radford et al., 2019), limit out-of-domain performance (Sharami et al., 2023), and can affect prompting and truncated sampling in unpredictable ways.4 The amount of high-frequency information in images and audio means that tokenization cannot be performed losslessly, and instead clustering (Hsu et al., 2021) or discrete auto-encoders (Ramesh et al., 2021) are used to compress the inputs, which lose information and likely limit generative model performance. Our patches are analogous to traditional lossless tokens, and the Local model performs the role of mapping a hidden state to a distribution over possible patches.
227
+
228
+ # 10 Conclusion
229
+
230
+ We introduced MEGABYTE, a scaleable architecture for modeling long sequences. MEGABYTE outperforms existing byte-level models across a range of tasks and modalities, allowing large models of sequences of over 1 million tokens. It also gives competitive language modeling results with subword models, which may allow byte-level models to replace tokenization. However, the scale of experiments here is far below those of state-of-the-art language models (Brown et al., 2020), and future work should explore scaling MEGABYTE to much larger models and datasets.
231
+
232
+ # References
233
+
234
+ Baines, M., Bhosale, S., Caggiano, V., Goyal, N., Goyal, S., Ott, M., Lefaudeux, B., Liptchinsky, V., Rabbat, M., Sheiffer, S., Sridhar, A., and Xu, M. FairScale: A general purpose modular PyTorch library for high performance and large scale training. https://github.com/ facebookresearch/fairscale, 2021.
235
+ Beltagy, I., Peters, M. E., and Cohan, A. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150, 2020.
236
+ Brown, T., Mann, B., Ryder, N., Subbiah, M., Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
237
+ Child, R., Gray, S., Radford, A., and Sutskever, I. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.
238
+ Choromanski, K., Likhosherstov, V., Dohan, D., Song, X., Gane, A., Sarlos, T., Hawkins, P., Davis, J., Mohiuddin, A., Kaiser, L., et al. Rethinking attention with performers. arXiv preprint arXiv:2009.14794, 2020.
239
+ Chowdhery, A., Narang, S., Devlin, J., Bosma, M., Mishra, G., Roberts, A., Barham, P., Chung, H. W., Sutton, C., Gehrmann, S., et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
240
+ Clark, J. H., Garrette, D., Turc, I., and Wieting, J. Canine: Pre-training an efficient tokenization-free encoder for language representation. Transactions of the Association for Computational Linguistics, 10:73–91, 2022.
241
+ Dai, Z., Yang, Z., Yang, Y., Carbonell, J., Le, Q. V., and Salakhutdinov, R. Transformer-xl: Attentive language models beyond a fixed-length context, 2019. URL https://arxiv.org/abs/1901. 02860.
242
+ Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020.
243
+ Gao, L., Biderman, S., Black, S., Golding, L., Hoppe, T., Foster, C., Phang, J., He, H., Thite, A., Nabeshima, N., Presser, S., and Leahy, C. The pile: An 800gb dataset of diverse text for language modeling, 2020.
244
+ Gu, A., Goel, K., and Ré, C. Efficiently modeling long sequences with structured state spaces. arXiv preprint arXiv:2111.00396, 2021.
245
+ Hawthorne, C., Jaegle, A., Cangea, C., Borgeaud, S., Nash, C., Malinowski, M., Dieleman, S., Vinyals, O., Botvinick, M., Simon, I., et al. General-purpose, long-context autoregressive modeling with perceiver ar. In International Conference on Machine Learning, pp. 8535–8558. PMLR, 2022.
246
+ Hoffmann, J., Borgeaud, S., Mensch, A., Buchatskaya, E., Cai, T., Rutherford, E., Casas, D. d. L., Hendricks, L. A., Welbl, J., Clark, A., et al. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556, 2022.
247
+ Hsu, W.-N., Bolte, B., Tsai, Y.-H. H., Lakhotia, K., Salakhutdinov, R., and Mohamed, A. Hubert: Self-supervised speech representation learning by masked prediction of hidden units. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 29:3451–3460, 2021.
248
+ Hutchins, D., Schlag, I., Wu, Y., Dyer, E., and Neyshabur, B. Block-recurrent transformers. arXiv preprint arXiv:2203.07852, 2022.
249
+ Jaegle, A., Gimeno, F., Brock, A., Vinyals, O., Zisserman, A., and Carreira, J. Perceiver: General perception with iterative attention. In International conference on machine learning, pp. 4651–4664. PMLR, 2021.
250
+ Kalchbrenner, N., Elsen, E., Simonyan, K., Noury, S., Casagrande, N., Lockhart, E., Stimberg, F., van den Oord, A., Dieleman, S., and Kavukcuoglu, K. Efficient neural audio synthesis. CoRR, abs/1802.08435, 2018. URL http://arxiv.org/abs/1802.08435.
251
+ Kaplan, J., McCandlish, S., Henighan, T., Brown, T. B., Chess, B., Child, R., Gray, S., Radford, A., Wu, J., and Amodei, D. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
252
+ Katharopoulos, A., Vyas, A., Pappas, N., and Fleuret, F. Transformers are rnns: Fast autoregressive transformers with linear attention. In International Conference on Machine Learning, pp. 5156– 5165. PMLR, 2020.
253
+ Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. In ICLR, 2015.
254
+ Kitaev, N., Kaiser, Ł., and Levskaya, A. Reformer: The efficient transformer. arXiv preprint arXiv:2001.04451, 2020.
255
+ Kudo, T. and Richardson, J. Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. arXiv preprint arXiv:1808.06226, 2018.
256
+ Ma, X., Zhou, C., Kong, X., He, J., Gui, L., Neubig, G., May, J., and Zettlemoyer, L. Mega: moving average equipped gated attention. arXiv preprint arXiv:2209.10655, 2022.
257
+ Micikevicius, P., Narang, S., Alben, J., Diamos, G., Elsen, E., Garcia, D., Ginsburg, B., Houston, M., Kuchaiev, O., Venkatesh, G., et al. Mixed precision training. arXiv preprint arXiv:1710.03740, 2017.
258
+ Oord, A. v. d., Kalchbrenner, N., and Kavukcuoglu, K. Pixel Recurrent Neural Networks. ICML, 4:2611–2620, 1 2016. doi: 10.48550/arxiv.1601.06759. URL https://arxiv.org/abs/1601. 06759v3.
259
+ Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., et al. PyTorch: An imperative style, high-performance deep learning library. In NeurIPS, 2019.
260
+ Press, O., Smith, N. A., and Lewis, M. Shortformer: Better language modeling using shorter inputs. arXiv preprint arXiv:2012.15832, 2020.
261
+ Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., and Sutskever, I. Language models are unsupervised multitask learners. 2019.
262
+ Rae, J. W., Potapenko, A., Jayakumar, S. M., and Lillicrap, T. P. Compressive transformers for long-range sequence modelling. arXiv preprint arXiv:1911.05507, 2019a.
263
+ Rae, J. W., Potapenko, A., Jayakumar, S. M., and Lillicrap, T. P. Compressive transformers for long-range sequence modelling. arXiv preprint arXiv:1911.05507, 2019b.
264
+ Ramesh, A., Pavlov, M., Goh, G., Gray, S., Voss, C., Radford, A., Chen, M., and Sutskever, I. Zeroshot text-to-image generation. In International Conference on Machine Learning, pp. 8821–8831. PMLR, 2021.
265
+ Ren, H., Dai, H., Dai, Z., Yang, M., Leskovec, J., Schuurmans, D., and Dai, B. Combiner: Full attention transformer with sparse computation cost, 2021. URL https://arxiv.org/abs/2107. 05768.
266
+ Roy, A., Saffar, M., Vaswani, A., and Grangier, D. Efficient content-based sparse attention with routing transformers, 2020. URL https://arxiv.org/abs/2003.05997.
267
+ Salimans, T., Karpathy, A., Chen, X., and Kingma, D. P. Pixelcnn $^ { + + }$ : Improving the pixelcnn with discretized logistic mixture likelihood and other modifications. CoRR, abs/1701.05517, 2017. URL http://arxiv.org/abs/1701.05517.
268
+ Sennrich, R., Haddow, B., and Birch, A. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909, 2015.
269
+ Sharami, J., Shterionov, D., and Spronck, P. A systematic analysis of vocabulary and bpe settings for optimal fine-tuning of nmt: A case study of in-domain translation. arXiv preprint arXiv:2303.00722, 2023.
270
+ Smith, J. T., Warrington, A., and Linderman, S. W. Simplified state space layers for sequence modeling. arXiv preprint arXiv:2208.04933, 2022.
271
+ Su, J., Lu, Y., Pan, S., Murtadha, A., Wen, B., and Liu, Y. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864, 2021.
272
+ Sun, S., Krishna, K., Mattarella-Micke, A., and Iyyer, M. Do long-range language models actually use long-range context? arXiv preprint arXiv:2109.09115, 2021.
273
+ Touvron, H., Lavril, T., Izacard, G., Martinet, X., Lachaux, M.-A., Lacroix, T., Rozière, B., Goyal, N., Hambro, E., Azhar, F., et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023.
274
+ Trinh, T. H. and Le, Q. V. A simple method for commonsense reasoning. arXiv preprint arXiv:1806.02847, 2018.
275
+ van den Oord, A., Dieleman, S., Zen, H., Simonyan, K., Vinyals, O., Graves, A., Kalchbrenner, N., Senior, A. W., and Kavukcuoglu, K. Wavenet: A generative model for raw audio. CoRR, abs/1609.03499, 2016. URL http://arxiv.org/abs/1609.03499.
276
+ van den Oord, A., Li, Y., Babuschkin, I., Simonyan, K., Vinyals, O., Kavukcuoglu, K., van den Driessche, G., Lockhart, E., Cobo, L. C., Stimberg, F., Casagrande, N., Grewe, D., Noury, S., Dieleman, S., Elsen, E., Kalchbrenner, N., Zen, H., Graves, A., King, H., Walters, T., Belov, D., and Hassabis, D. Parallel wavenet: Fast high-fidelity speech synthesis. CoRR, abs/1711.10433, 2017. URL http://arxiv.org/abs/1711.10433.
277
+ Wu, Y., Rabe, M. N., Hutchins, D., and Szegedy, C. Memorizing transformers. arXiv preprint arXiv:2203.08913, 2022.
278
+ Zhang, S., Roller, S., Goyal, N., Artetxe, M., Chen, M., Chen, S., Dewan, C., Diab, M., Li, X., Lin, V., Mihaylov, T., Ott, M., Shleifer, S., Shuster, K., Simig, D., Koura, S., Sridhar, A., Wang, T., Zettlemoyer, L., and Ai, M. OPT: Open Pre-trained Transformer Language Models. 5 2022a. doi: 10.48550/arxiv.2205.01068. URL https://arxiv.org/abs/2205.01068v4.
279
+ Zhang, S., Roller, S., Goyal, N., Artetxe, M., Chen, M., Chen, S., Dewan, C., Diab, M., Li, X., Lin, X. V., et al. Opt: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068, 2022b.
280
+
281
+ # A Supplementary Material
282
+
283
+ # A.1 Training Details
284
+
285
+ To ensure stable training, we applied gradient clipping with a maximum norm of 1.0 and used the Adam optimizer with $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 8$ Kingma & Ba (2015). We used the built-in polynomial decay learning rate scheduler in MetaSeq with 500 warmup updates and the end learning rate set to 0. All models are trained with pre-norm and using ReLU activation. We apply a dropout of 0.1 throughout, but we do not apply any dropout to embeddings. We also use weight decay of 0.1. To initialize the weights, we use a variant based on Megatron-LM codebase, which involves using a normal distribution with a mean of zero and a standard deviation of 0.006. We truncate this normal distribution within two standard deviations and observed substantial gain in both training stability and performance.
286
+
287
+ # A.2 Motivation
288
+
289
+ Why is the local model needed? Many of the efficiency advantages of the MEGABYTE design could be realized with the Global model alone, which would resemble a decoder version of ViT (Dosovitskiy et al., 2020). However, the joint distribution over the patch $p ( x _ { t + 1 } , . . , x _ { t + P } | x _ { 0 . . t } )$ has an output space of size $2 5 6 ^ { P }$ so direct modeling is only tractable for very small patches. We could instead factor the joint distribution into conditionally independent distributions $p ( x _ { t + 1 } | x _ { 0 . . t } ) . . p ( x _ { t + P } | x _ { 0 . . t } )$ , but this would greatly limit the model’s expressive power. For example, it would be unable to express a patch distribution such as $50 \%$ cat and $50 \%$ dog, and would instead have to assign probability mass to strings such as cag and dot. Instead, our autoregressive Local model conditions on previous characters within the patch, allowing it to only assign probability to the desired strings.
290
+
291
+ Increasing Parameters for Fixed Compute Transformer models have shown consistent improvements with parameter counts (Kaplan et al., 2020). However, the size of models is limited by their increasing computational cost. MEGABYTE allows larger models for the same cost, both by making self attention sub-quadratic, and by using large feedforward layers across patches rather than individual tokens.
292
+
293
+ Re-use of Established Components MEGABYTE consists of two transformer models interleaved with shifting, reshaping and a linear projection. This re-use increases the likelihood that the architecture will inherit the desirable scaling properties of transformers.
294
+
295
+ # A.3 Model Details
296
+
297
+ As discussed in Section 4, we conduct experiments using a fixed compute and data budget across all models to focus our comparisons solely on the model architecture rather than training resources. To achieve this, we adjust model hyperparameters within each architecture so that the time taken for a single update is matched and then train all models for the same number of updates. We list all of model details in Table 12 and Table 13.
298
+
299
+ <table><tr><td></td><td>Model</td><td>#L</td><td>dmodel</td><td>#H</td><td>dhead</td></tr><tr><td>S1</td><td>125M</td><td>12</td><td>768</td><td>12</td><td>64</td></tr><tr><td>S2</td><td>350M</td><td>24</td><td>1024</td><td>16</td><td>64</td></tr><tr><td>S3</td><td>760M</td><td>24</td><td>1536</td><td>16</td><td>96</td></tr><tr><td>S4</td><td>1.3B</td><td>24</td><td>2048</td><td>32</td><td>64</td></tr><tr><td>S5</td><td>2.7B</td><td>32</td><td>2560</td><td>32</td><td>80</td></tr><tr><td>S6</td><td>6.7B</td><td>32</td><td>4096</td><td>32</td><td>128</td></tr></table>
300
+
301
+ Listing 1: Pseudocode of Megabyte model
302
+
303
+ <table><tr><td>Model</td><td>(Global) Size</td><td>Local Size</td><td>BS</td><td>LR</td><td>Context Length (in bytes)</td></tr><tr><td colspan="6">arXiv</td></tr><tr><td>Transformer</td><td>320M (D=1024,L=22)</td><td>N/A</td><td></td><td>2.00E-04</td><td>1,024</td></tr><tr><td>Perceiver AR</td><td>248M(D=1024,L=17)</td><td>N/A</td><td></td><td>2.00E-04</td><td>8,192 (1024 latents)</td></tr><tr><td>MEGABYTE</td><td>758M(D=2048,L=14)</td><td>262M (D=1024,L=18)</td><td>27248</td><td>2.00E-04</td><td>8,192 (patch size 8)</td></tr><tr><td>w/o Local model</td><td>2.3B (D=2560,L=20)</td><td>N/A</td><td>48</td><td>1.50E-04</td><td>8,192 (patch size 4)</td></tr><tr><td>w/o global model</td><td>N/A</td><td>350M (D=1024,L=24)</td><td>192</td><td>2.00E-04</td><td>8,192 (patch size 8)</td></tr><tr><td>w/o cross-patch Local model</td><td>921M (D=2048,L=17)</td><td>350M(D=1024,L=24)</td><td>48</td><td>2.00E-04</td><td>8,192 (patch size 8)</td></tr><tr><td>w/ CNN encoder</td><td>704M (D=2048,L=13)</td><td>262M (D=1024,L=18)</td><td>48</td><td>2.00E-04</td><td>8,192 (patch size 8)</td></tr><tr><td colspan="6">Image task 64 (Table 2)</td></tr><tr><td>MEGABYTE</td><td>2.7B (D=2560,L=32)</td><td>350M (D=1024,L=24)</td><td>2</td><td>2.00E-04</td><td>12,288 (patch size 12)</td></tr><tr><td colspan="6">Image task 64 (Table 4)</td></tr><tr><td>Transformer</td><td>760M (D=1536,L=24)</td><td>N/A</td><td>512</td><td>3.00E-04</td><td>2.048</td></tr><tr><td>Perceiver AR</td><td>227M(D=1024,L=16)</td><td>N/A</td><td>512</td><td>3.00E-04</td><td>12,288 (1024 latents)</td></tr><tr><td>MEGABYTE</td><td>1.3B (D=2048,L=24)</td><td>1.3B (D=2048,L=24)</td><td>256</td><td>3.00E-04</td><td>12,288 (patch size 12)</td></tr><tr><td colspan="6">Image task 256</td></tr><tr><td>Transformer</td><td>62M (D=768,L=6)</td><td>N/A</td><td>1536</td><td>2.00E-04</td><td>1,024</td></tr><tr><td>Perceiver AR</td><td>62M (D=768,L=6)</td><td>N/A</td><td>256</td><td>2.00E-04</td><td>8,192 (768 latents)</td></tr><tr><td>MEGABYTE</td><td>125M (D=768,L=12)</td><td>125M (D=768,L=12)</td><td>16</td><td>2.00E-04</td><td>196,608 (patch size 192)</td></tr><tr><td>w/o local model</td><td>2.7B (D=4096,L=32)</td><td>N/A</td><td>16</td><td>2.00E-04</td><td>196,608 (patch size 48)</td></tr><tr><td>w/o global model</td><td>125M (D=768,L=12)</td><td>125M (D=768,L=12)</td><td>16</td><td>2.00E-04</td><td>196,608(patch size 192)</td></tr><tr><td>w/o cross-patch Local model</td><td>250M</td><td>156M (D=768,L=15)</td><td>16</td><td>2.00E-04</td><td>196,608 (patch size 192)</td></tr><tr><td>w/ CNN encoder</td><td>125M (D=768,L=12)</td><td>125M (D=768,L=12)</td><td>16</td><td>2.00E-04</td><td>196,608 (patch size 192)</td></tr><tr><td colspan="6">Image task 640</td></tr><tr><td>Transformer</td><td>83M (D=768,L=8)</td><td>N/A</td><td></td><td>3.00E-04</td><td>1,024</td></tr><tr><td>Perceiver AR</td><td>62M (D=768,L=6)</td><td>N/A</td><td>4800 2048</td><td>3.00E-04</td><td>4,096 (1024 latents)</td></tr><tr><td>MEGABYTE</td><td>125M (D=768,L=12)</td><td>83M (D=768,L=8)</td><td>32</td><td>3.00E-04</td><td>1,228,800 (192 patch size)</td></tr><tr><td colspan="6">audio</td></tr><tr><td>Transformer</td><td>135M(D=768,L=13)</td><td>N/A</td><td>2048</td><td>2.00E-04</td><td>1024</td></tr><tr><td>Perceiver AR</td><td>62M(D=768,L=6)</td><td>N/A</td><td>384</td><td>2.00E-04</td><td>8,192 (1024 latents)</td></tr><tr><td>MEGABYTE</td><td>350M(D=1024,L=24)</td><td>125M (D=768,L=12)</td><td>256</td><td>2.00E-04</td><td>524,288 (32 patch size)</td></tr><tr><td>w/o local model</td><td>2.7B (D=4096,L=32)</td><td>125M (D=768,L=12)</td><td>256</td><td>2.00E-04</td><td>524,288(32 patch size)</td></tr><tr><td>w/o global model</td><td>350M(D=1024,L=24)</td><td>125M(D=768,L=12)</td><td>256</td><td>2.00E-04</td><td>524,288 (32 patch size)</td></tr><tr><td>w/o cross-patch Local model</td><td>350M(D=1024,L=24)</td><td>146M(D=768,L=14)</td><td>256</td><td>2.00E-04</td><td>524,288 (32 patch size)</td></tr><tr><td>w/ CNN encoder</td><td>350M (D=1024,L=24)</td><td>125M (D=768,L=12)</td><td>256</td><td>2.00E-04</td><td>524,288 (32 patch size)</td></tr></table>
304
+
305
+ Table 13: Model architecture details. We report the model size, the embedding size (D), number of layaers(L), total batch size (BS), learning rate(LR), and context length. When we vary the number of model layers from the standard amount for the given size (Table 12), we note this accordingly. For PerceiverAR models, we note the number of latents used, and for MEGABYTE models we note the patch sizes.
306
+
307
+ # B Pseudocode
308
+
309
+ class MegaByteDecoder : def _init_ self , global_args , local_args , patch_size , ) : self . pad $\qquad = \quad 0$ self . patch_size $=$ patch_size self . globalmodel $=$ TransformerDecoder ( global_args ) self . localmodel $=$ TransformerDecoder ( local_args ) def forward ( self , bytes , ) : bytes_global , bytes_local $=$ self . prepare_input ( bytes )
310
+
311
+ global_bytes_embedded $=$ self . globalmodel . embed ( bytes_global ) global_in $=$ rearrange ( global_bytes_embedded , "b (t p) e -> b t (p e)", $\mathtt { p } =$ self . patch_size , ) global_output $=$ self . globalmodel ( global_in ) global_output_reshaped $=$ rearrange ( global_output , "b t (p e) -> (b t) p e", p = self . patch_size , ) local_bytes_embedded $=$ self . localmodel . embed ( bytes_local ) local_in $=$ local_bytes_embedded $^ +$ global_output_reshaped local_output $=$ self . localmodel ( local_in ) batch_size $=$ bytes_global . shape [0] x $=$ rearrange ( local_output , "(b t) l v -> b (t l) v", b = batch_size ) return x def prepare_input ( self , bytes ) : padding_global $=$ bytes . new ( bytes . shape [0] , self . patch_size ) . fill_ ( self . pad ) bytes_global $=$ torch . cat (( padding_global , bytes [: , : - self . patch_size ]) , -1) bytes_input $=$ rearrange ( bytes , "b (t p) -> (b t) p", $\mathtt { p } = \mathtt { s e l f }$ . patch_size ) padding_local $=$ bytes_input . new ( bytes_input . shape [0] , 1) . fill_ ( self . pad ) bytes_local $=$ torch . cat (( padding_local , bytes_input [: , : -1]) , -1) return bytes_global , bytes_local
312
+
313
+ # C PerceiverAR Implementation
314
+
315
+ To reproduce PerceiverAR in a compute-controlled setting we extended the standard transformer implementation in metaseq with an additonal cross attention layer to compute the latents and match the architecture of PerceiverAR. We trained the model by sampling random spans from each text, matching the procedure used in the PerceiverAR codebase. To be consistent with the original work, we use sliding window evaluation with a stride of num_latents/2 unless otherwise noted. In several cases we used the standard metaseq implementation as opposed to specific techniques reported in the original paper: 1) we used standard attention dropout instead of cross-attention dropout 2) We did not implement chunked attention. We verified our implementation by reproducing the "Standard Ordering" experiments in Table 5 of the Perceiver AR paper. After carefully matching context size, number of latents, the amount of data and training steps used and learning rate, we achieved $3 . 5 3 \mathrm { b p b }$ vs 3.54 reported in the original paper.
316
+
317
+ # D More results
318
+
319
+ # D.1 Patch scan Implementation
320
+
321
+ Images have a natural structure, containing a grid of $n \times n$ pixels each composed of 3 bytes (corresponding to color channels). We explore two ways of converting images to sequences for modeling (see Figure 4). Firstly, raster scan where the pixels are linearized into 3 bytes and concatenated row-by-row. Secondly, patch scan where we create patches of shape $p \times p \times 3$ bytes where $p = { \sqrt { \frac { P } { 3 } } }$ , and then use a raster scan both within and between patches. Unless otherwise specified, MEGABYTE models use patch scan for image data.
322
+
323
+ ![](images/482fa286848fccc0c9dffcb9d5c629e37eb15f80f4564e61233305e612f026f3.jpg)
324
+ Figure 4: Two ways to model 2D data sequentially. Left, raster scan, by taking bytes row by row and left to right; right, patch scan, where we first split an image into patches, and do raster scan across patches and within a patch. $( \mathrm { T } { = } 3 6 , \mathrm { K } { = } 9 , \mathrm { P } { = } 4 )$ .
325
+
326
+ # D.2 Patch scan vs Raster scan
327
+
328
+ The patch scan method is inspired by recent works in Vision Transformers (Dosovitskiy et al., 2020), and it is more effective than raster scan for modeling image sequencing. We found it improves both MEGABYTE and Perceiver AR.
329
+
330
+ <table><tr><td></td><td>(Global) Size</td><td>Local Size</td><td>context</td><td>bpb</td></tr><tr><td>MEGABYTE (patch scan)</td><td>62M (D=768,L=6)</td><td>N/A</td><td>8,192 (768 latents)</td><td>3.158</td></tr><tr><td>MEGABYTE (raster scan)</td><td>62M (D=768,L=6)</td><td>N/A</td><td>8,192 (768 latents)</td><td>3.428</td></tr><tr><td>Perceiver AR (patch scan)</td><td>125M (D=768,L=12)</td><td>125M (D=768,L=12)</td><td>196,608 (patch size 192)</td><td>3.373</td></tr><tr><td>Perceiver AR (raster scan)</td><td>125M (D=768,L=12)</td><td>125M (D=768,L=12)</td><td>196,608 (patch size 192)</td><td>3.552</td></tr></table>
331
+
332
+ Table 14: ImageNet256 performance with patch scan vs raster scan for MEGABYTE and Perceiver AR.
333
+
334
+ # D.3 Longer sequence modeling
335
+
336
+ For our $\mathsf { p g l 9 }$ scaling experiment, we also use longer context length for MEGABYTE. The results are shown in Table 15. With longer sequence, we didn’t observer further improvement, consistent with findings in Hawthorne et al. (2022). We think we will benefit more from longer sequence when we futher scale up the model size and data.
337
+
338
+ <table><tr><td></td><td>context</td><td>bpb</td></tr><tr><td>MEGABYTE</td><td>8,192 (patch size 8)</td><td>0.8751</td></tr><tr><td>MEGABYTE</td><td>16,384 (patch size 8)</td><td>0.8787</td></tr></table>
339
+
340
+ Table 15: Longer sequence for PG19 dataset. For both experiments, we set global model as 1.3b, local model as $3 5 0 \mathrm { m }$ , and MEGABYTE patch size as 8.
parse/dev/JTmO2V9Xpz/JTmO2V9Xpz_content_list.json ADDED
@@ -0,0 +1,1557 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "MEGABYTE: Modeling Million-byte Sequences with Multiscale Transformers ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 183,
8
+ 122,
9
+ 816,
10
+ 172
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Lili Yu∗ Dániel Simig∗ Colin Flaherty∗ Armen Aghajanyan ",
17
+ "bbox": [
18
+ 261,
19
+ 220,
20
+ 738,
21
+ 237
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Luke Zettlemoyer Mike Lewis ",
28
+ "bbox": [
29
+ 383,
30
+ 257,
31
+ 614,
32
+ 272
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "Meta AI ",
39
+ "bbox": [
40
+ 470,
41
+ 285,
42
+ 526,
43
+ 299
44
+ ],
45
+ "page_idx": 0
46
+ },
47
+ {
48
+ "type": "text",
49
+ "text": "Abstract ",
50
+ "text_level": 1,
51
+ "bbox": [
52
+ 462,
53
+ 335,
54
+ 535,
55
+ 352
56
+ ],
57
+ "page_idx": 0
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "Autoregressive transformers are spectacular models for short sequences but scale poorly to long sequences such as high-resolution images, podcasts, code, or books. We propose MEGABYTE, a multi-scale decoder architecture that enables end-to-ModModelModelModel end differentiable modeling of sequences of over one million bytes. MEGABYTE segments sequences into patches and uses a local submodel within patches and a_ m e g _ b y t _ ' ' t r _ n global model between patches. This enables sub-quadratic self-attention, much larger feedforward layers for the same compute, and improved parallelism during decoding—unlocking better performance at reduced cost for both training and gen-Global Model eration. Extensive experiments show that MEGABYTE allows byte-level models to perform competitively with subword models on long context language modeling, achieve state-of-the-art density estimation on ImageNet, and model audio from raw files. Together, these results establish the viability of tokenization-free autoregressive sequence modeling at scale. ",
62
+ "bbox": [
63
+ 233,
64
+ 367,
65
+ 766,
66
+ 546
67
+ ],
68
+ "page_idx": 0
69
+ },
70
+ {
71
+ "type": "text",
72
+ "text": "1 Introduction ",
73
+ "text_level": 1,
74
+ "bbox": [
75
+ 174,
76
+ 564,
77
+ 312,
78
+ 582
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "Sequences of millions of bytes are ubiquitous; for example, music, image, or video files typically consist of multiple megabytes. However, large transformer decoders (LLMs) typically only use several thousand tokens of context (Brown et al., 2020; Zhang et al., 2022a)—both because of the quadratic cost of self-attention but also, more importantly, the cost of large feedforward networks per-position. This severely limits the set of tasks where LLMs can be applied. ",
85
+ "bbox": [
86
+ 174,
87
+ 589,
88
+ 485,
89
+ 741
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "We introduce MEGABYTE, a new approach to modeling long byte sequences. First, byte sequences are segmented into fixed-sized patches, loosely analogous to tokens. Our model then consists of three parts: (1) a patch embedder, which simply encodes a patch by losslessly concatenating embeddings of each byte, (2) a global module, a large autoregressive transformer that inputs and outputs patch representations and (3) a local module, a small autoregressive model ",
96
+ "bbox": [
97
+ 174,
98
+ 748,
99
+ 485,
100
+ 886
101
+ ],
102
+ "page_idx": 0
103
+ },
104
+ {
105
+ "type": "image",
106
+ "img_path": "images/9c9eaf2be8ee5fc0f21f129f854af58487fc6fdfd0633343e83fb1ee0b2baf18.jpg",
107
+ "image_caption": [
108
+ "Figure 1: Overview of MEGABYTE with patch size $P =$ 4. A small local model autoregressively predicts each patch byte-by-byte, using the output of a larger global model to condition on previous patches. Global and Local inputs are padded by $P$ and 1 token respectively to avoid leaking information about future tokens. "
109
+ ],
110
+ "image_footnote": [],
111
+ "bbox": [
112
+ 508,
113
+ 583,
114
+ 813,
115
+ 780
116
+ ],
117
+ "page_idx": 0
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "that predicts bytes within a patch. Crucially, we observe that for many tasks, most byte predictions ",
122
+ "bbox": [
123
+ 173,
124
+ 887,
125
+ 821,
126
+ 901
127
+ ],
128
+ "page_idx": 0
129
+ },
130
+ {
131
+ "type": "equation",
132
+ "img_path": "images/296dd6a15492835d98ce52c74a3fa97f29f0dfda31eed36c12172bec4d5a2b6b.jpg",
133
+ "text": "$$\n\\begin{array} { r l r } { \\iota _ { t } ^ { \\mathrm { c o b i s c d } } } & { = E _ { x _ { t } } ^ { \\mathrm { i o b o l . } \\mathrm { c o n b e d } } + E _ { t } ^ { \\mathrm { i o s } } } & { t \\in [ 0 . . T ) , E ^ { \\mathrm { g l o b a i c m e d } } \\ \\in \\mathbb { R } ^ { N \\times D G } , } \\\\ & { } & { E ^ { \\mathrm { p o s } } \\in \\mathbb { R } ^ { T \\times N \\times D G } , \\ k ^ { \\mathrm { c o b d . } } \\in \\mathbb { R } ^ { T \\times N \\times D _ { G } } } \\\\ & { } & { E ^ { \\mathrm { p l o b a i s i n } } } \\\\ & { \\iota _ { k } ^ { \\mathrm { g l o b a i s a l } } } & { = \\left\\{ \\begin{array} { l l } { E ^ { \\mathrm { g l o b a l . } \\mathrm { p o s d . } } } & { \\mathrm { i f } \\ k = 0 , } \\\\ { h _ { t } ^ { \\mathrm { i o s } } ( \\mathrm { p . e } - 1 ) \\cdot p \\cdot ( k \\cdot p ) } & { k \\in [ 1 , \\ldots , K ) , } \\\\ { w _ { 0 } \\times \\mathrm { c o n . } \\mathrm { c o n } } & { 1 } \\end{array} \\right. } \\\\ & { } & { \\mathrm { p l o b . ~ } } \\\\ { \\iota _ { t , k } ^ { \\mathrm { p o t a i n } } } & { = \\mathrm { t r a s i o n ~ c l o b a i ~ } \\left( b _ { 0 , k } ^ { \\mathrm { g l o b a i . } } \\right) } \\\\ & { } & { \\mathrm { i f ~ } \\mu _ { k , p } ^ { \\mathrm { c o s i s a l } } + \\frac { \\mu _ { k } ^ { \\mathrm { i n d . } } \\mu _ { k } ^ { \\mathrm { f l o c a l . } } } { \\mu _ { k , p } ^ { \\mathrm { i n d . } } } } \\end{array}\n$$",
134
+ "text_format": "latex",
135
+ "bbox": [
136
+ 181,
137
+ 88,
138
+ 825,
139
+ 253
140
+ ],
141
+ "page_idx": 1
142
+ },
143
+ {
144
+ "type": "text",
145
+ "text": "are relatively easy (for example, completing a word given the first few characters), meaning that large networks per-byte are unnecessary, and a much smaller model can be used for intra-patch modelling. ",
146
+ "bbox": [
147
+ 174,
148
+ 310,
149
+ 823,
150
+ 339
151
+ ],
152
+ "page_idx": 1
153
+ },
154
+ {
155
+ "type": "text",
156
+ "text": "MEGABYTE has three main advantages over Transformers for long sequence modeling: ",
157
+ "bbox": [
158
+ 173,
159
+ 345,
160
+ 748,
161
+ 359
162
+ ],
163
+ "page_idx": 1
164
+ },
165
+ {
166
+ "type": "text",
167
+ "text": "1. Sub-quadratic self-attention Most work on long sequence models has focused on mitigating the quadratic cost of self-attention. MEGABYTE decomposes long sequences into two shorter sequences, and optimal patch sizes reduces the self-attention cost to $O ( N ^ { \\frac { 4 } { 3 } } )$ , which remains tractable for even long sequences. ",
168
+ "bbox": [
169
+ 214,
170
+ 380,
171
+ 825,
172
+ 438
173
+ ],
174
+ "page_idx": 1
175
+ },
176
+ {
177
+ "type": "text",
178
+ "text": "2. Per-patch feedforward layers In GPT3-size models, more than $9 8 \\%$ of FLOPS are used in computing position-wise feedforward layers. MEGABYTE uses large feedforward layers per-patch rather than per-position, enabling much larger and more expressive models for the same cost. With patch size $P$ , where a baseline transformer would use the same feedforward layer with $m$ parameters $P$ times, MEGABYTE can use a layer with $m P$ parameters once for the same cost. ",
179
+ "bbox": [
180
+ 214,
181
+ 458,
182
+ 825,
183
+ 542
184
+ ],
185
+ "page_idx": 1
186
+ },
187
+ {
188
+ "type": "text",
189
+ "text": "3. Parallelism in Decoding Transformers must perform all computations serially during generation because the input to each timestep is the output from the previous timestep. By reusing the global representation over multiple time steps during local model decoding, MEGABYTE allows greater parallelism during generation. For example, a MEGABYTE model with 1.5B parameters can generate sequences $40 \\%$ faster than a standard 350M Transformer, whilst also improving perplexity when trained with the same compute. ",
190
+ "bbox": [
191
+ 214,
192
+ 564,
193
+ 825,
194
+ 647
195
+ ],
196
+ "page_idx": 1
197
+ },
198
+ {
199
+ "type": "text",
200
+ "text": "Together, these improvements allow us to train much larger and better-performing models for the same compute budget, scale to very long sequences, and improve generation speed during deployment. ",
201
+ "bbox": [
202
+ 178,
203
+ 666,
204
+ 823,
205
+ 695
206
+ ],
207
+ "page_idx": 1
208
+ },
209
+ {
210
+ "type": "text",
211
+ "text": "MEGABYTE also provides a strong contrast to existing autoregressive models that typically use some form of tokenization, where sequences of bytes are mapped to larger discrete tokens (Sennrich et al., 2015; Ramesh et al., 2021; Hsu et al., 2021). Tokenization complicates pre-processing, multi-modal modelling, and transfer to new domains, while hiding useful structure from the model. It also means that most state-of-the-art models are not truly end to end. The most widely used approaches to tokenization require language-specific heuristics (Radford et al., 2019) or lose information (Ramesh et al., 2021). Replacing tokenization with efficient and performant byte models would therefore have many advantages. ",
212
+ "bbox": [
213
+ 174,
214
+ 700,
215
+ 825,
216
+ 813
217
+ ],
218
+ "page_idx": 1
219
+ },
220
+ {
221
+ "type": "text",
222
+ "text": "We conduct extensive experiments for both MEGABYTE and strong baselines. We use a fixed compute and data budget across all models to focus our comparisons solely on the model architecture rather than training resources, which are known to benefit all models. We find that MEGABYTE allows byte-level models to perform competitively with subword models on long context language modeling, achieve state-of-the-art perplexities for density estimation on ImageNet, and allow audio modelling from raw audio files. Together, these results establish the viability of tokenization-free autoregressive sequence modeling at scale. ",
223
+ "bbox": [
224
+ 174,
225
+ 819,
226
+ 825,
227
+ 916
228
+ ],
229
+ "page_idx": 1
230
+ },
231
+ {
232
+ "type": "text",
233
+ "text": "2 MEGABYTE Transformer ",
234
+ "text_level": 1,
235
+ "bbox": [
236
+ 174,
237
+ 88,
238
+ 423,
239
+ 107
240
+ ],
241
+ "page_idx": 2
242
+ },
243
+ {
244
+ "type": "text",
245
+ "text": "2.1 Overview ",
246
+ "text_level": 1,
247
+ "bbox": [
248
+ 174,
249
+ 113,
250
+ 281,
251
+ 127
252
+ ],
253
+ "page_idx": 2
254
+ },
255
+ {
256
+ "type": "text",
257
+ "text": "MEGABYTE is an autoregressive model for efficiently modeling long input sequences. MEGABYTE is comprised of 3 components: (1) a patch embedder that inputs a discrete sequence, embeds each element, and chunks it into patches of length $P$ (2) a large global Transformer that contextualizes patch representations by performing self-attention over previous patches, and (3) a smaller local Transformer that inputs a contextualized patch representation from the global model, and autoregressively predict the next patch. ",
258
+ "bbox": [
259
+ 173,
260
+ 131,
261
+ 825,
262
+ 215
263
+ ],
264
+ "page_idx": 2
265
+ },
266
+ {
267
+ "type": "text",
268
+ "text": "2.2 Components ",
269
+ "text_level": 1,
270
+ "bbox": [
271
+ 173,
272
+ 223,
273
+ 302,
274
+ 238
275
+ ],
276
+ "page_idx": 2
277
+ },
278
+ {
279
+ "type": "text",
280
+ "text": "Patch Embedder with patch size of $P$ maps a byte sequence $x _ { 0 . . T }$ to a sequence of patch embeddings of length $\\begin{array} { r } { K = { \\frac { T } { P } } } \\end{array}$ and dimension $P \\cdot D _ { G }$ . ",
281
+ "bbox": [
282
+ 173,
283
+ 241,
284
+ 823,
285
+ 270
286
+ ],
287
+ "page_idx": 2
288
+ },
289
+ {
290
+ "type": "text",
291
+ "text": "First, each byte is embedded with a lookup table $E$ global-embed $\\in \\mathbb { R } ^ { V \\times D _ { G } }$ to an embedding of size $D _ { G }$ and positional embeddings are added. ",
292
+ "bbox": [
293
+ 169,
294
+ 276,
295
+ 823,
296
+ 308
297
+ ],
298
+ "page_idx": 2
299
+ },
300
+ {
301
+ "type": "equation",
302
+ "img_path": "images/fbd371f83072666d11f3dbac6272c1233685ffd57721ec010b8c94921894f6ee.jpg",
303
+ "text": "$$\nh _ { t } ^ { \\mathrm { e m b e d } } = E _ { x _ { t } } ^ { \\mathrm { g l o b a l - e m b e d } } + E _ { t } ^ { \\mathrm { p o s } } \\qquad t \\in [ 0 . . T ]\n$$",
304
+ "text_format": "latex",
305
+ "bbox": [
306
+ 303,
307
+ 330,
308
+ 694,
309
+ 352
310
+ ],
311
+ "page_idx": 2
312
+ },
313
+ {
314
+ "type": "text",
315
+ "text": "Then, byte embeddings are reshaped into a sequence of $K$ patch embeddings with dimension $P \\cdot D _ { G }$ . To allow autoregressive modelling, the patch sequence is padded to start with a trainable patch-sized padding embedding $( E ^ { \\mathrm { g l o b a l - p a d } } \\ \\in \\ \\mathbb { R } ^ { P \\times D _ { G } } )$ ), and the last patch is removed from the input. This sequence is the input to the global model, and is denoted hglobal-in ∈ RK×(P ·DG). ",
316
+ "bbox": [
317
+ 173,
318
+ 362,
319
+ 826,
320
+ 420
321
+ ],
322
+ "page_idx": 2
323
+ },
324
+ {
325
+ "type": "equation",
326
+ "img_path": "images/e2fe38df9666626c0b52e08c0b29c77900098e6684701c587264e108576d9877.jpg",
327
+ "text": "$$\n\\begin{array} { r } { h _ { k } ^ { \\mathrm { g l o b a l - i n } } = \\left\\{ \\begin{array} { l l } { E ^ { \\mathrm { g l o b a l - p a d } } , } & { \\mathrm { i f } k = 0 , } \\\\ { h _ { ( ( k - 1 ) \\cdot P ) : ( k \\cdot P ) } ^ { \\mathrm { e m b e d } } , } & { k \\in [ 1 , . . , K ) , } \\end{array} \\right. } \\end{array}\n$$",
328
+ "text_format": "latex",
329
+ "bbox": [
330
+ 344,
331
+ 425,
332
+ 650,
333
+ 468
334
+ ],
335
+ "page_idx": 2
336
+ },
337
+ {
338
+ "type": "text",
339
+ "text": "Global Model is a decoder-only Transformer with dimension $P \\cdot D _ { G }$ that operates on a sequence of \n$K$ tween patchpresentation uts a sequence of by performing se patch representations attention over previous , and outputs an updated. $K$ $h _ { 0 : K } ^ { \\mathrm { g l o b a l - i n } }$ $h _ { 0 : K } ^ { \\mathrm { g l o b a l - o u t } }$ ",
340
+ "bbox": [
341
+ 174,
342
+ 478,
343
+ 825,
344
+ 541
345
+ ],
346
+ "page_idx": 2
347
+ },
348
+ {
349
+ "type": "equation",
350
+ "img_path": "images/47b32affd6e4d369b5584e179987c1e82555ea48ccb3f5d9746a22a161ea1831.jpg",
351
+ "text": "$$\nh _ { 0 ; K } ^ { \\mathrm { g l o b a l - o u t } } = \\mathrm { t r a n s f o r m e r } ^ { \\mathrm { g l o b a l } } ( h _ { 0 : K } ^ { \\mathrm { g l o b a l - i n } } )\n$$",
352
+ "text_format": "latex",
353
+ "bbox": [
354
+ 370,
355
+ 564,
356
+ 625,
357
+ 585
358
+ ],
359
+ "page_idx": 2
360
+ },
361
+ {
362
+ "type": "text",
363
+ "text": "The output of the final global layer $h _ { 0 : K } ^ { \\mathrm { g l o b a l } }$ contains $K$ patc epresentations imension $P \\cdot D _ { G }$ . \nFor each of these, we reshape them into sequences of length $P$ $D _ { G }$ , where position $p$ \nuses dimensions $p \\cdot D _ { G }$ to $( p + 1 ) \\cdot D _ { G }$ . Each position is then projected to the dimension of the local \nmodel with a matrix these with byte embe $w ^ { \\mathrm { G L } } \\in \\mathbb { R } ^ { D _ { G } \\times D _ { L } }$ where for th $D _ { L }$ is the local model dikens in the next patch combineocal byte $D _ { L }$ $E _ { x _ { ( k \\cdot P + p - 1 ) } } ^ { \\mathrm { l o c a l - e m b e d } }$ $( E ^ { \\mathrm { l o c a l - p a d } } \\in \\mathbb { R } ^ { D _ { L } } )$ \nautoregressive modelling within a patch. This results in a tensor hlocal-in ∈ RK×P ×DL . ",
364
+ "bbox": [
365
+ 173,
366
+ 597,
367
+ 826,
368
+ 702
369
+ ],
370
+ "page_idx": 2
371
+ },
372
+ {
373
+ "type": "equation",
374
+ "img_path": "images/57fac0566a900d9c6ee74281ba1af564352dc9aafd60b8d471eb346877a6dbcf.jpg",
375
+ "text": "$$\nh _ { k , p } ^ { \\mathrm { l o c a l - i n } } = w ^ { \\mathrm { G L } } h _ { k , ( p \\cdot D _ { G } ) : ( ( p + 1 ) \\cdot D _ { G } ) } ^ { \\mathrm { g l o b a l - o u t } } + E _ { x _ { ( k \\cdot P + p - 1 ) } } ^ { \\mathrm { l o c a l - e m b e d } }\n$$",
376
+ "text_format": "latex",
377
+ "bbox": [
378
+ 333,
379
+ 707,
380
+ 661,
381
+ 731
382
+ ],
383
+ "page_idx": 2
384
+ },
385
+ {
386
+ "type": "text",
387
+ "text": "Local Model is a smaller decoder-only Transformer of dimension $D _ { L }$ that operates on a single patch $k$ containing $P$ elements, each of which is the sum of an output from the global model and an embedding of the previous byte in the sequence. $K$ copies of the local models are run on each patch independently (and in parallel during training), computing a representation $h ^ { \\mathrm { l o c a l - o u t } } \\in \\mathbb { R } ^ { K \\times P \\cdot \\hat { D } _ { L } }$ . ",
388
+ "bbox": [
389
+ 173,
390
+ 741,
391
+ 825,
392
+ 799
393
+ ],
394
+ "page_idx": 2
395
+ },
396
+ {
397
+ "type": "equation",
398
+ "img_path": "images/28abec1b597658611fe17622707aa5bf47c656ea54da0e344c02f51c1540c634.jpg",
399
+ "text": "$$\nh _ { k , 0 : P } ^ { \\mathrm { l o c a l - o u t } } = \\mathrm { t r a n s f o r m e r } ^ { \\mathrm { l o c a l } } ( h _ { k , 0 : P } ^ { \\mathrm { l o c a l - i n } } )\n$$",
400
+ "text_format": "latex",
401
+ "bbox": [
402
+ 382,
403
+ 821,
404
+ 616,
405
+ 842
406
+ ],
407
+ "page_idx": 2
408
+ },
409
+ {
410
+ "type": "text",
411
+ "text": "Finally, we can compute the probability distribution over the vocabulary at each position. The $p$ th element of the $k$ th patch corresponds to element $t$ of the complete sequence, where $t = k \\cdot P + p$ : ",
412
+ "bbox": [
413
+ 169,
414
+ 853,
415
+ 825,
416
+ 882
417
+ ],
418
+ "page_idx": 2
419
+ },
420
+ {
421
+ "type": "equation",
422
+ "img_path": "images/2ea6fe3ee1f071463d574625618e5740e8274338ccc31780995c69475c8f705a.jpg",
423
+ "text": "$$\np ( x _ { t } | x _ { 0 : t } ) = \\mathrm { s o f t m a x } \\big ( E ^ { \\mathrm { l o c a l - e m b e d } } h _ { k , p } ^ { \\mathrm { l o c a l - o u t } } \\big ) _ { x _ { t } }\n$$",
424
+ "text_format": "latex",
425
+ "bbox": [
426
+ 352,
427
+ 887,
428
+ 643,
429
+ 909
430
+ ],
431
+ "page_idx": 2
432
+ },
433
+ {
434
+ "type": "text",
435
+ "text": "2.3 Variations and Extensions ",
436
+ "text_level": 1,
437
+ "bbox": [
438
+ 174,
439
+ 92,
440
+ 395,
441
+ 106
442
+ ],
443
+ "page_idx": 3
444
+ },
445
+ {
446
+ "type": "text",
447
+ "text": "Convolutional Patch Encoder: One limitation of patchifying sequences is that it is not translation invariant, and byte sequences may receive a different representation depending on their position in the patch. This may mean, for example, that a model has to relearn the meaning of a word at different offsets. To mitigate this issue, we experimented with augmenting the Patch Embedder with causal convolutional layers, which allow translation-invariant contextual representations of the bytes before they are chunked into patches. We use a stack of convolutional layers, with filter sizes of 3, 5 and 7. ",
448
+ "bbox": [
449
+ 174,
450
+ 109,
451
+ 825,
452
+ 193
453
+ ],
454
+ "page_idx": 3
455
+ },
456
+ {
457
+ "type": "text",
458
+ "text": "Cross-patch Attention: The Local model uses short sequences for efficiency, and relies on the Global model for long-range information. However, we can increase the context of the Local model with little overhead by allowing it to condition on $r$ elements from the previous patch. This approach allows the Global model to focus on a longer-range context. Specifically, when computing selfattention in each layer, we concatenate the keys and values with the last $r$ keys and queries from the previous patch. We use rotary embeddings (Su et al., 2021) to model relative positions between elements in the sequence. This approach is reminiscent of TransformerXL (Dai et al., 2019) but differs by being fully differentiable. ",
459
+ "bbox": [
460
+ 174,
461
+ 199,
462
+ 825,
463
+ 310
464
+ ],
465
+ "page_idx": 3
466
+ },
467
+ {
468
+ "type": "text",
469
+ "text": "Strided Inference: We observed empirically that the per-token loss within each patch increases towards the end of the patch, as the prediction relies more on the weaker Local model. To alleviate this issue, we propose strided inference, in which we predict the sequence with two forward passes of the full model, whose inputs are offset by $p / 2$ positions from each other. We then combine the first $p / 2$ positions in each patch for our predictions to predict the complete sequence. Similarly to sliding window methods (Press et al., 2020), this approach doubles the cost of inference but improves results. ",
470
+ "bbox": [
471
+ 173,
472
+ 316,
473
+ 825,
474
+ 398
475
+ ],
476
+ "page_idx": 3
477
+ },
478
+ {
479
+ "type": "text",
480
+ "text": "3 Efficiency Analysis ",
481
+ "text_level": 1,
482
+ "bbox": [
483
+ 176,
484
+ 412,
485
+ 362,
486
+ 429
487
+ ],
488
+ "page_idx": 3
489
+ },
490
+ {
491
+ "type": "text",
492
+ "text": "3.1 Training Efficiency ",
493
+ "text_level": 1,
494
+ "bbox": [
495
+ 174,
496
+ 438,
497
+ 346,
498
+ 452
499
+ ],
500
+ "page_idx": 3
501
+ },
502
+ {
503
+ "type": "text",
504
+ "text": "Attention The cost of attention in a transformer architecture for a sequence of length $T$ has $O ( T ^ { 2 } )$ complexity. Much work has been explored reducing this; for example, Sparse Transformers (Child et al., 2019) and Routing Transformers (Roy et al., 2020) show strong results with a complexity $O ( T ^ { \\frac { 3 } { 2 } } )$ . Many linear attention mechanisms have also been proposed (Katharopoulos et al., 2020; Choromanski et al., 2020), although we are not aware of competitive results on large scale language modeling tasks. As a function of sequence length $T$ and patch size $P$ , the Global model has a sequence of length $\\textstyle { \\frac { P } { T } }$ so uses $\\scriptstyle O ( { \\frac { T ^ { 2 } } { P ^ { 2 } } } )$ operations, and the Local model uses $\\textstyle { \\frac { P } { T } }$ sequences of length $P$ so uses $\\begin{array} { r } { O ( \\frac { T P ^ { 2 } } { P } ) = O ( P T ) } \\end{array}$ operations. The overall cost of MEGABYTE is therefore in $\\begin{array} { r } { O ( \\frac { T ^ { 2 } } { P ^ { 2 } } + T P ) } \\end{array}$ . $P$ is a hyperparameter that is chosen to create an architecture for sequences of size $T$ . By setting $P = T ^ { \\frac { 1 } { 3 } }$ the complexity is in $O ( T ^ { \\frac { 4 } { 3 } } )$ . Using much shorter patches of $P = T ^ { \\frac { 1 } { 5 } }$ would give a complexity of $O ( T ^ { \\frac { 8 } { 5 } } )$ . The cost is less than the transformer for all non-trivial values of $P$ such that $1 < P < T$ . ",
505
+ "bbox": [
506
+ 173,
507
+ 455,
508
+ 825,
509
+ 626
510
+ ],
511
+ "page_idx": 3
512
+ },
513
+ {
514
+ "type": "text",
515
+ "text": "Feedforward Layers However, attention is not the main cost in large transformers. Instead of increasing the sequence length, transformers are more commonly scaled by increasing the dimension of their latent state $d$ , and the feedforward network cost dominates the model’s overall cost (Kaplan et al., 2020). For example, in the GPT3 architecture, the quadratic self-attention computation accounts for only $1 . 4 \\%$ of FLOPS. Following the approximation of (Kaplan et al., 2020), a forward pass with a large transformer with $m$ non-embedding parameters on a sequence of length $T$ uses roughly $2 m T$ FLOPS. MEGABYTE contains two transformers: the Global model uses $m _ { g }$ parameters on a sequence of length $\\textstyle { \\frac { T } { P } }$ , and a Local model with $m _ { l }$ parameters that sees $\\textstyle { \\frac { T } { P } }$ sequences of length $P$ giving an estimate of $2 T ( \\frac { m _ { g } } { P } + m _ { l } )$ FLOPS. When $m _ { g } \\gg m _ { l }$ , the FLOPS used by MEGABYTE is approximately $\\frac { 2 T m _ { g } } { P }$ , allowing a model $P$ times larger than a transformer with equivalent FLOPS. This analysis holds irrespective of any efficient attention mechanisms used in the transformer. ",
516
+ "bbox": [
517
+ 173,
518
+ 635,
519
+ 825,
520
+ 795
521
+ ],
522
+ "page_idx": 3
523
+ },
524
+ {
525
+ "type": "text",
526
+ "text": "Combined Analysis To understand efficiency at different sequence lengths and model sizes, we calculate the total FLOPS used by transformers, Linear Transformers and MEGABYTE. For each operation, we use FLOP estimates from (Kaplan et al., 2020), except for attention in Linear Transformers, which we estimate as $9 D$ FLOPS/token1, where $D$ is the model embedding dimension. Figure 3 shows that for models of size 660M to 173B and sequence lengths of up to 1M tokens, ",
527
+ "bbox": [
528
+ 173,
529
+ 803,
530
+ 825,
531
+ 873
532
+ ],
533
+ "page_idx": 3
534
+ },
535
+ {
536
+ "type": "text",
537
+ "text": "MEGABYTE with $P = 8$ uses less FLOPS than either transformers or Linear Transformers. Baseline model architectures are based on GPT3, and Megabyte global/local model sizes are 452M/151M, 5.8B/604M, 170B/3.2B respectively. ",
538
+ "bbox": [
539
+ 174,
540
+ 90,
541
+ 826,
542
+ 133
543
+ ],
544
+ "page_idx": 4
545
+ },
546
+ {
547
+ "type": "text",
548
+ "text": "3.2 Generation Efficiency ",
549
+ "text_level": 1,
550
+ "bbox": [
551
+ 176,
552
+ 148,
553
+ 362,
554
+ 162
555
+ ],
556
+ "page_idx": 4
557
+ },
558
+ {
559
+ "type": "text",
560
+ "text": "Generating long sequences with transformers is slow, because the input to each timestep is the output from the previous timestep, meaning each layer must be computed for each token serially. As running a layer on a single token typically does not saturate the amount of parallelism available within a GPU, for analysis, we model each layer as a constant cost independently of size. Consider a MEGABYTE model with $L _ { \\mathrm { g l o b a l } }$ layers in the Global model and $L _ { \\mathrm { l o c a l } }$ layers in the Local model and patch size $P$ , compared with a Transformer architecture with $L _ { \\mathrm { l o c a l } } + L _ { \\mathrm { g l o b a l } }$ layers. Generating each patch with MEGABYTE requires a sequence of $O ( L _ { \\mathrm { g l o b a l } } + P \\cdot L _ { \\mathrm { l o c a l } } )$ serial operations, whereas the Transformer requires $\\bar { O } ( P \\cdot L _ { \\mathrm { g l o b a l } } + P \\cdot L _ { \\mathrm { l o c a l } } )$ serial operations. When $L _ { \\mathrm { g l o b a l } } \\gg L _ { \\mathrm { l o c a l } }$ (i.e. the Global model has many more layers than the Local model), MEGABYTE can reduce inference costs by a factor close to $P$ . ",
561
+ "bbox": [
562
+ 174,
563
+ 167,
564
+ 485,
565
+ 444
566
+ ],
567
+ "page_idx": 4
568
+ },
569
+ {
570
+ "type": "image",
571
+ "img_path": "images/e8f0a6e0f7c644ca9ccbba9ab18c4479b142ce34ba180bc4fb7aac86bb662f60.jpg",
572
+ "image_caption": [
573
+ "Figure 3: Computational cost (FLOPS/token) for different model architectures at different scales. MEGABYTE architectures (here with $P = 8$ ) use less FLOPS than equivalently sized Transformers and Linear Transformers (Katharopoulos et al., 2020) across a wide range of model sizes and sequence lengths, allowing larger models to be used for the same computational cost. "
574
+ ],
575
+ "image_footnote": [],
576
+ "bbox": [
577
+ 503,
578
+ 156,
579
+ 813,
580
+ 358
581
+ ],
582
+ "page_idx": 4
583
+ },
584
+ {
585
+ "type": "text",
586
+ "text": "4 Experimental setup ",
587
+ "text_level": 1,
588
+ "bbox": [
589
+ 176,
590
+ 462,
591
+ 369,
592
+ 479
593
+ ],
594
+ "page_idx": 4
595
+ },
596
+ {
597
+ "type": "text",
598
+ "text": "Controlling for Compute and Data Models show consistent improvements when increasing both data and compute Kaplan et al. (2020); Hoffmann et al. (2022), meaning that one model can outperform another because of an increased training budget instead of an improved architecture. However, in practice, both compute and data are typically limited. We conduct experiments using a fixed compute and data budget across all models to focus comparisons solely on the model architecture rather than training resources. To achieve this, we adjust model hyperparameters (mainly, number of layers) within each architecture so that the forward pass time taken per byte is matched, and then train all models for the same number of bytes. ",
599
+ "bbox": [
600
+ 174,
601
+ 489,
602
+ 825,
603
+ 601
604
+ ],
605
+ "page_idx": 4
606
+ },
607
+ {
608
+ "type": "text",
609
+ "text": "Comparison Systems We compare MEGABYTE with both a standard decoder-only Transformer and PerceiverAR (Hawthorne et al., 2022). PerceiverAR extends the original transformer with a single cross-attention layer over a much longer context sequence, and is the best performing general purpose autoregressive model we are aware of and achieves state-of-the-art results across several modalities. We implemented both models in the same codebase, and all models share a similar data loader, preprocessing step, and trainer to avoid any artifacts in our compute-controlled experiments. ",
610
+ "bbox": [
611
+ 174,
612
+ 614,
613
+ 825,
614
+ 696
615
+ ],
616
+ "page_idx": 4
617
+ },
618
+ {
619
+ "type": "text",
620
+ "text": "Training Procedure All models were trained using the Metaseq2 code base Zhang et al. (2022b). The training used the PyTorch framework Paszke et al. (2019), with fairscale to improve memory efficiency through fully sharded model and optimizer states Baines et al. (2021). Mixed precision training was used to improve training efficiency at scale Micikevicius et al. (2017). More training details and various model parameters can be found in Section A.1 in the Appendix. To validate our implementation of PerceiverAR, we reproduced their experiments on downsized ImageNet at 64 pixels. By carefully matching hyperparameters, we achieved a bits per byte (bpb) score of 3.53, compared to the reported 3.54 in the original paper. ",
621
+ "bbox": [
622
+ 174,
623
+ 710,
624
+ 825,
625
+ 821
626
+ ],
627
+ "page_idx": 4
628
+ },
629
+ {
630
+ "type": "text",
631
+ "text": "Inference Methods Several techniques have been proposed for trading off speed for performance during inference with language models, including sliding windows Press et al. (2020) and our strided inference. We only use these methods when comparing with prior published work (Tables 2 and 3). ",
632
+ "bbox": [
633
+ 176,
634
+ 843,
635
+ 823,
636
+ 885
637
+ ],
638
+ "page_idx": 4
639
+ },
640
+ {
641
+ "type": "table",
642
+ "img_path": "images/fafe1bab78de4470dcbe5848c63413723a5f88b952b852e1018c954a9e255858.jpg",
643
+ "table_caption": [],
644
+ "table_footnote": [
645
+ "Table 1: Text dataset sizes and mean document lengths. We also report bpb of various models (Transformer, PerceiverAR, and MEGABYTE) trained with the same compute. "
646
+ ],
647
+ "table_body": "<table><tr><td>Dataset</td><td>Total Bytes</td><td>bytes/doc</td><td>Transformer</td><td>PerceiverAR</td><td>MEGABYTE</td></tr><tr><td>PG-19</td><td>10.1GB</td><td>411,404</td><td>1.057</td><td>1.104</td><td>1.000</td></tr><tr><td>Stories</td><td>21.3GB</td><td>35,265</td><td>1.064</td><td>1.070</td><td>0.978</td></tr><tr><td>Books</td><td>79.7GB</td><td>509,526</td><td>1.097</td><td>1.104</td><td>1.007</td></tr><tr><td>arXiv</td><td>91.5GB</td><td>58,518</td><td>0.816</td><td>0.791</td><td>0.678</td></tr><tr><td>Code</td><td>353.7GB</td><td>7,461</td><td>0.575</td><td>0.546</td><td>0.411</td></tr></table>",
648
+ "bbox": [
649
+ 243,
650
+ 88,
651
+ 754,
652
+ 179
653
+ ],
654
+ "page_idx": 5
655
+ },
656
+ {
657
+ "type": "table",
658
+ "img_path": "images/bd9457e48b6a56ca125b125716ec6a52eb5fd7b529642573e0c24f76093f36f6.jpg",
659
+ "table_caption": [],
660
+ "table_footnote": [],
661
+ "table_body": "<table><tr><td></td><td>Tokenizer</td><td>Vocab</td><td>Context Length</td><td>Validation</td><td>Test</td></tr><tr><td>TransformerXL Rae et al. (2019a)</td><td>SentPiece</td><td>32k</td><td>512+1024</td><td>45.5</td><td>36.3</td></tr><tr><td>CompressiveTransformer Rae et al. (2019a)</td><td>SentPiece</td><td>32k</td><td>512+512+2x512</td><td>43.4</td><td>33.6</td></tr><tr><td>PerceiverAR Hawthorne et al. (2022)</td><td>SentPiece</td><td>32k</td><td>2048</td><td>45.9</td><td>28.9</td></tr><tr><td>BlockRecurrent Hutchins et al. (2022)</td><td>SentPiece</td><td>32k</td><td>1024+recurrence</td><td>-</td><td>26.5</td></tr><tr><td>Transformer byte-level (ours)</td><td>Bytes</td><td>256</td><td>2048</td><td>81.6</td><td>69.4</td></tr><tr><td>PerceiverAR byte-level (ours)</td><td>Bytes</td><td>256</td><td>8192</td><td>119.1</td><td>88.8</td></tr><tr><td>MEGABYTE</td><td>Bytes</td><td>256</td><td>8192</td><td>42.8</td><td>36.4</td></tr></table>",
662
+ "bbox": [
663
+ 173,
664
+ 227,
665
+ 830,
666
+ 342
667
+ ],
668
+ "page_idx": 5
669
+ },
670
+ {
671
+ "type": "text",
672
+ "text": "Table 2: Larger scale experiments on PG19, converting bits-per-byte to word-level perplexities for comparison with prior work. Results below the line are compute-matched. MEGABYTE outperforms other byte models by a wide margin, and gives results competitive with state-of-the-art models trained on subwords. ",
673
+ "bbox": [
674
+ 173,
675
+ 348,
676
+ 826,
677
+ 386
678
+ ],
679
+ "page_idx": 5
680
+ },
681
+ {
682
+ "type": "text",
683
+ "text": "5 Language Modeling ",
684
+ "text_level": 1,
685
+ "bbox": [
686
+ 174,
687
+ 393,
688
+ 374,
689
+ 411
690
+ ],
691
+ "page_idx": 5
692
+ },
693
+ {
694
+ "type": "text",
695
+ "text": "We evaluated the performance of MEGABYTE on language modeling on a set of 5 diverse datasets emphasizing long-range dependencies: Project Gutenberg (PG-19), Books, Stories, arXiv, and Code. ",
696
+ "bbox": [
697
+ 173,
698
+ 417,
699
+ 825,
700
+ 446
701
+ ],
702
+ "page_idx": 5
703
+ },
704
+ {
705
+ "type": "text",
706
+ "text": "Datasets We experiment on a range of long form text datasets. The PG-19 dataset Rae et al. (2019b) consists of English-language books written before 1919 and is extracted from the Project Gutenberg online library. The Stories dataset Trinh & Le (2018) is a subset of CommonCrawl data meant to emulate Winograd schemas. Books Gao et al. (2020) is another collection of English-language books. The arXiv dataset contains technical publications written in $\\mathrm { I A T _ { E } X }$ from the arXiv online archive. Finally, the Code dataset is a large publicly available dataset of open source code, under Apache, BSD or MIT licenses. More details on dataset sizes and document lengths are shared in Table 1. ",
707
+ "bbox": [
708
+ 173,
709
+ 452,
710
+ 825,
711
+ 549
712
+ ],
713
+ "page_idx": 5
714
+ },
715
+ {
716
+ "type": "text",
717
+ "text": "Controlled Experiments Table 1 lists bpb on each dataset. Each model is trained for 80 billion bytes, and models are scaled to use the same compute budget. We carefully tune hyperparameters for all architectures to best utilize the available compute budget. MEGABYTE consistently outperforms both transformers and PerceiverAR across all datasets. We use the same sets of parameters on all dataset. In all experiments presented in Table 1, transformer has size of 320M with context length of 1024, PerceiverAR has size of 248M with context size of 8192 and latent size of 1024, and MEGABYTE global/local model sizes are 758M/262M with context length of 8192 and patch size of 8. ",
718
+ "bbox": [
719
+ 173,
720
+ 556,
721
+ 825,
722
+ 652
723
+ ],
724
+ "page_idx": 5
725
+ },
726
+ {
727
+ "type": "text",
728
+ "text": "Scaling Experiment We scale up our training data on PG-19 (Table 2), and compare MEGABYTE with byte baselines, as well as converting all results to word-level perplexities to benchmark with stateof-art token based models. We train a byte-level Transformer, PerceiverAR and MEGABYTE models for 400B bytes and the same compute budget using same model parameters as in the controlled experiments. We find that MEGABYTE outperforms other byte-level models by a wide margin at this scale.3 We also compare with the best previously reported numbers for sub-word models. These results may be confounded by differing amounts of compute and tuning used, but show that MEGABYTE gives results competitive with state-of-the-art models trained on subwords. These results suggest that MEGABYTE may allow future large language models to be tokenization-free. ",
729
+ "bbox": [
730
+ 174,
731
+ 659,
732
+ 826,
733
+ 784
734
+ ],
735
+ "page_idx": 5
736
+ },
737
+ {
738
+ "type": "text",
739
+ "text": "6 Image Modeling ",
740
+ "text_level": 1,
741
+ "bbox": [
742
+ 174,
743
+ 796,
744
+ 343,
745
+ 814
746
+ ],
747
+ "page_idx": 5
748
+ },
749
+ {
750
+ "type": "text",
751
+ "text": "Sequence Modeling on ImageNet We test MEGABYTE on variants of the autoregressive image generation task on ImageNet (Oord et al., 2016), to measure its ability to efficiently use long context. We test on three different resolutions of images, ranging from $6 4 { \\times } 6 4$ to $6 4 0 { \\times } 6 4 0$ pixels – the latter requiring the effective modeling of sequences with over 1.2M tokens. This generation task becomes increasingly challenging as the image’s resolution grows: doing well on this task requires the modeling of local patterns (textures, lines, etc.) and long-range context that provides information about the high level structure of the image. Inspired by recent works in Vision Transformers (Dosovitskiy et al., 2020), we model image data patch by patch (more details can be found in Appendix D.1). ",
752
+ "bbox": [
753
+ 174,
754
+ 820,
755
+ 825,
756
+ 862
757
+ ],
758
+ "page_idx": 5
759
+ },
760
+ {
761
+ "type": "text",
762
+ "text": "",
763
+ "bbox": [
764
+ 174,
765
+ 90,
766
+ 825,
767
+ 161
768
+ ],
769
+ "page_idx": 6
770
+ },
771
+ {
772
+ "type": "text",
773
+ "text": "Comparison with State of the Art We train a large MEGABYTE model on ImageNet 64x64 with Global and Local models sized 2.7B and 350M parameters, respectively, for 1.4T tokens. We estimate that training this model consumed less than half the GPU hours we would have needed to reproduce the best PerceiverAR model described by (Hawthorne et al., 2022). As shown in Table 2, MEGABYTE matches the state-of-the-art performance of PerceiverAR whilst using only half the compute. ",
774
+ "bbox": [
775
+ 173,
776
+ 178,
777
+ 825,
778
+ 247
779
+ ],
780
+ "page_idx": 6
781
+ },
782
+ {
783
+ "type": "table",
784
+ "img_path": "images/6853aa8b7679c08d0640c6249772388ed9ad2c000816a89fd641093272914bf6.jpg",
785
+ "table_caption": [],
786
+ "table_footnote": [
787
+ "Table 3: Bits per byte (bpb) on ImageNet $6 4 { \\times } 6 4$ . MEGABYTE matches the current state-of-the-art while only using half the amount of GPU hours to train. "
788
+ ],
789
+ "table_body": "<table><tr><td>ImageNet64</td><td>bpb</td></tr><tr><td>Routing Transformer (Roy et al.,2020)</td><td>3.43</td></tr><tr><td>Combiner (Ren et al., 2021)</td><td>3.42</td></tr><tr><td>Perceiver AR (Hawthorne et al.,2022)</td><td>3.40</td></tr><tr><td>MEGABYTE</td><td>3.40</td></tr></table>",
790
+ "bbox": [
791
+ 184,
792
+ 262,
793
+ 452,
794
+ 334
795
+ ],
796
+ "page_idx": 6
797
+ },
798
+ {
799
+ "type": "table",
800
+ "img_path": "images/1104e0915e55bbc64854d470e02d7c9a85ac7660e944d664af941f0b4a7d29d3.jpg",
801
+ "table_caption": [],
802
+ "table_footnote": [
803
+ "Table 4: Bits per byte (bpb) on ImageNet with different resolutions. All models use the same compute and data. MEGABYTE scales well to sequences of over 1M tokens. "
804
+ ],
805
+ "table_body": "<table><tr><td></td><td>Context</td><td>Image64</td><td>Image256</td><td>Image640</td></tr><tr><td>Total len</td><td></td><td>12288</td><td>196608</td><td>1228800</td></tr><tr><td>Transformer</td><td>1024</td><td>3.62</td><td>3.801</td><td>2.847</td></tr><tr><td>Perceiver AR</td><td>12000</td><td>3.55</td><td>3.373</td><td>2.345</td></tr><tr><td>MEGABYTE</td><td>Full</td><td>3.52</td><td>3.158</td><td>2.282</td></tr></table>",
806
+ "bbox": [
807
+ 465,
808
+ 265,
809
+ 828,
810
+ 344
811
+ ],
812
+ "page_idx": 6
813
+ },
814
+ {
815
+ "type": "text",
816
+ "text": "Scaling to higher resolutions We compare three transformer variants (vanilla, PerceiverAR, MEGABYTE) to test scalability to long sequences on increasingly large image resolutions. We use our own implementations of these in the same framework and budget the same amount of GPU hours and data to train each of these model variants. ",
817
+ "bbox": [
818
+ 174,
819
+ 422,
820
+ 825,
821
+ 477
822
+ ],
823
+ "page_idx": 6
824
+ },
825
+ {
826
+ "type": "text",
827
+ "text": "MEGABYTE is able to handle all sequence lengths with a single forward pass of up to 1.2M tokens. We found neither the standard Transformer nor PerceiverAR could model such long sequences at a reasonable model size, so instead we split images into segments of size 1024 and 12000 respectively. For Megabyte, we set patch size as 12 for Image64 and patch size as 192 for Image256 and Image640 datasets. Model sizes are adjusted to match overall training speeds across models and we do not use any form of sliding window evaluation in this experiment. As seen in Table 4, MEGABYTE outperforms baselines across all resolutions in this compute-controlled setting. The precise settings used for each of the baseline models such as context length and number of latents are summarized in Table 12. Results show that MEGABYTE outperforms the other systems at all resolutions, demonstrating an effective model of sequences of over 1M bytes. ",
828
+ "bbox": [
829
+ 173,
830
+ 484,
831
+ 825,
832
+ 622
833
+ ],
834
+ "page_idx": 6
835
+ },
836
+ {
837
+ "type": "text",
838
+ "text": "7 Audio Modeling ",
839
+ "text_level": 1,
840
+ "bbox": [
841
+ 174,
842
+ 637,
843
+ 339,
844
+ 655
845
+ ],
846
+ "page_idx": 6
847
+ },
848
+ {
849
+ "type": "text",
850
+ "text": "Audio has aspects of both the sequential structure of text and the continuous nature of images, so is an interesting application for MEGABYTE. ",
851
+ "bbox": [
852
+ 176,
853
+ 662,
854
+ 823,
855
+ 690
856
+ ],
857
+ "page_idx": 6
858
+ },
859
+ {
860
+ "type": "text",
861
+ "text": "Raw audio is typically stored as a sequence of 16-bit integer values (one per timestep); a softmax layer would need to output 65,536 probabilities per timestep to model all possible values. To address this issue, various techniques have been developed to reduce the memory and computational requirements of the softmax layer. For instance, van den Oord et al. (2016) apply $\\mu$ -law companding transformation and quantizes the input into 256 possible values. Alternatively, van den Oord et al. (2017) model the samples using the discretized mixture of logistics distribution introduced by Salimans et al. (2017). Finally, Kalchbrenner et al. (2018) use a dual softmax technique to produce 8 coarse and 8 fine bits. In our approach, we simplify the audio modeling process by directly reading the bytes (256 possible values) from the audio file and conducting an autoregressive language model on top of that. This greatly streamlines the modeling process, making it easier and more efficient. ",
862
+ "bbox": [
863
+ 174,
864
+ 696,
865
+ 825,
866
+ 835
867
+ ],
868
+ "page_idx": 6
869
+ },
870
+ {
871
+ "type": "text",
872
+ "text": "Our audio modeling approach focuses on $1 6 \\ \\mathrm { k H z }$ , 16-bit audio, which equates to 32k bytes per one-second clip. We use an extensive audio dataset consisting of 2 terabytes (roughly 18,000 hours) of audio. We use a sequence length of 524,288, a patch size of 32, and a batch size of 32 to facilitate model training. By utilizing these settings, we can effectively train our model on large volumes of audio data, helping to improve its accuracy and efficacy. Our model obtains bpb of 3.477, much lower than the results with perceiverAR (3.543) and vanilla transformer model (3.567). More ablation results are presented in Table 6. ",
873
+ "bbox": [
874
+ 174,
875
+ 842,
876
+ 825,
877
+ 911
878
+ ],
879
+ "page_idx": 6
880
+ },
881
+ {
882
+ "type": "table",
883
+ "img_path": "images/c7536b82290dc2757e2c61030a57add8f530d47ea0bd26a834ae8757386eee33.jpg",
884
+ "table_caption": [],
885
+ "table_footnote": [
886
+ "Table 5: Comparison of bits per byte (bpb) and generation speed of 8192 bytes of transformer model (with context length 1024) and MEGABYTE with context length 8192 and patch size 8. "
887
+ ],
888
+ "table_body": "<table><tr><td></td><td>Global Size</td><td>(Local) Size</td><td>bpb</td><td>Generation Time (s)</td></tr><tr><td>Transformer</td><td>1</td><td>350M</td><td>1.064</td><td>132</td></tr><tr><td>MEGABYTE</td><td>1.3B</td><td>218M</td><td>0.991</td><td>93</td></tr></table>",
889
+ "bbox": [
890
+ 320,
891
+ 88,
892
+ 679,
893
+ 154
894
+ ],
895
+ "page_idx": 7
896
+ },
897
+ {
898
+ "type": "text",
899
+ "text": "",
900
+ "bbox": [
901
+ 171,
902
+ 215,
903
+ 823,
904
+ 243
905
+ ],
906
+ "page_idx": 7
907
+ },
908
+ {
909
+ "type": "text",
910
+ "text": "8 Analysis ",
911
+ "text_level": 1,
912
+ "bbox": [
913
+ 173,
914
+ 256,
915
+ 276,
916
+ 273
917
+ ],
918
+ "page_idx": 7
919
+ },
920
+ {
921
+ "type": "text",
922
+ "text": "We study different behaviors of MEGABYTE. All experiments in the same group use the same compute. ",
923
+ "bbox": [
924
+ 173,
925
+ 280,
926
+ 823,
927
+ 309
928
+ ],
929
+ "page_idx": 7
930
+ },
931
+ {
932
+ "type": "text",
933
+ "text": "Generation speed We also compare the text generation speed between MEGABYTE and a transformer. We compare a 350M parameter baseline transfomer and a MEGABYTE model with a 1.3B parameter Global model and a 218M parameter local model, trained on PG19 with equal compute. As shown in Table 5, the MEGABYTE model achieves much lower perplexity as expected. However, MEGABYTE also generates a sequence of 8192 tokens $40 \\%$ faster than transformer, despite having over 4 times the parameters. This speed up is due to the bulk of the parameters being in the Global model, which only needs to be computed once for every 8 tokens, whereas all the parameters in the baseline model are used on every token. ",
934
+ "bbox": [
935
+ 173,
936
+ 318,
937
+ 825,
938
+ 428
939
+ ],
940
+ "page_idx": 7
941
+ },
942
+ {
943
+ "type": "text",
944
+ "text": "Model Components In Table 6, we analyze the significance of different components in the MEGABYTE architecture by studying arXiv, Librilight-L and ImageNet256 datasets. Removing Local (w/o local model) or global (w/o global model) model, we observe a substantial increase in bpb on all datasets, showing that both parts are crucial. The performance of the model without the cross-patch local model (w/o cross-patch local model) is competitive, indicating that the architecture is robust to this modification. We observe slight improvement on the Librilight-L and ImageNet256 datasets by augmenting the MEGABYTE model with a CNN encoder (w/ CNN encoder). This suggests that the MEGABYTE architecture can benefit from integrating alternative encoding mechanisms. ",
945
+ "bbox": [
946
+ 173,
947
+ 435,
948
+ 825,
949
+ 547
950
+ ],
951
+ "page_idx": 7
952
+ },
953
+ {
954
+ "type": "text",
955
+ "text": "Effective Use of Context Long-context models often struggle to benefit from the full context (Sun et al., 2021). Figure 7 shows that later tokens within each context window have a higher likelihood, indicating that MEGABYTE can effectively use at least 8k bytes of context on the PG19 dataset. ",
956
+ "bbox": [
957
+ 173,
958
+ 555,
959
+ 825,
960
+ 597
961
+ ],
962
+ "page_idx": 7
963
+ },
964
+ {
965
+ "type": "table",
966
+ "img_path": "images/ab22e4f8ecf30b34edaca7aa157b6adb491be69b7e9f57abb1daef5643bd685d.jpg",
967
+ "table_caption": [],
968
+ "table_footnote": [
969
+ "Table 6: Ablation of MEGABYTE model components. Models with the same dataset are trained using the same compute. The hyperparameters are listed in Table 12. "
970
+ ],
971
+ "table_body": "<table><tr><td></td><td>Arxiv</td><td>Audio</td><td>Image256</td></tr><tr><td>MEGABYTE</td><td>0.6871</td><td>3.477</td><td>3.158</td></tr><tr><td>w/o local model</td><td>1.263</td><td>5.955</td><td>4.768</td></tr><tr><td>w/o global model</td><td>1.373</td><td>3.659</td><td>3.181</td></tr><tr><td>w/o cross-patch attention</td><td>0.6781</td><td>3.481</td><td>3.259</td></tr><tr><td>w/ CNN encoder</td><td>0.6871</td><td>3.475</td><td>3.155</td></tr></table>",
972
+ "bbox": [
973
+ 173,
974
+ 622,
975
+ 514,
976
+ 707
977
+ ],
978
+ "page_idx": 7
979
+ },
980
+ {
981
+ "type": "image",
982
+ "img_path": "images/90c84fe96cac33e09d97caa58837c9c14e67b272857b7839b989a5774524a4fd.jpg",
983
+ "image_caption": [
984
+ "Table 7: Average log probability assigned to different positions within the context length by MEGABYTE and by a vanilla transformer model on PG19 test set. "
985
+ ],
986
+ "image_footnote": [],
987
+ "bbox": [
988
+ 553,
989
+ 613,
990
+ 818,
991
+ 717
992
+ ],
993
+ "page_idx": 7
994
+ },
995
+ {
996
+ "type": "image",
997
+ "img_path": "images/1b1ce533147ed97a72fa744e530bc7463349ed2c77c8a979df6b2807e63b709d.jpg",
998
+ "image_caption": [
999
+ "Table 8: An illustration of strided inference with patch size 8. Blue and yellow represents two inferences that are shifted by half patch size. Solid line indicates final probablity being taking during strided inference. "
1000
+ ],
1001
+ "image_footnote": [],
1002
+ "bbox": [
1003
+ 178,
1004
+ 772,
1005
+ 503,
1006
+ 837
1007
+ ],
1008
+ "page_idx": 7
1009
+ },
1010
+ {
1011
+ "type": "table",
1012
+ "img_path": "images/2cdc9284060898074f51abd884273406d009861919534b8294b6270839317992.jpg",
1013
+ "table_caption": [],
1014
+ "table_footnote": [
1015
+ "Table 9: Performance of various inference techniques on the PG19 test set using our best MEGABYTE model. "
1016
+ ],
1017
+ "table_body": "<table><tr><td>Method</td><td>Inference Cost</td><td>bpb</td></tr><tr><td>Basic Inference</td><td>1X</td><td>0.9079</td></tr><tr><td>w/ Sliding Window</td><td>2X</td><td>0.8918</td></tr><tr><td>w/ Strided Inference</td><td>2X</td><td>0.8926</td></tr><tr><td>w/ Sliding&amp; Strided</td><td>4X</td><td>0.8751</td></tr></table>",
1018
+ "bbox": [
1019
+ 549,
1020
+ 786,
1021
+ 836,
1022
+ 859
1023
+ ],
1024
+ "page_idx": 7
1025
+ },
1026
+ {
1027
+ "type": "text",
1028
+ "text": "Strided Inference We find that within a single patch, on average, the MEGABYTE performs worse on later tokens within a patch (see Figure 8). Section 2.3 proposes strided inference as a solution, where two forward passes are performed offset by $\\textstyle { \\frac { P } { 2 } }$ tokens, and results from the first half of each patch are combined. Table 9 shows performance improvements from strided inference, which are additive with the standard sliding window. ",
1029
+ "bbox": [
1030
+ 174,
1031
+ 90,
1032
+ 825,
1033
+ 161
1034
+ ],
1035
+ "page_idx": 8
1036
+ },
1037
+ {
1038
+ "type": "text",
1039
+ "text": "Patch Size. We experimented with various patch sizes on Image256 dataset and found a wide range of values where MEGABYTE performs similarly. We found similar robustness to patch size choices across all modalities, although the optimal patch size itself can be different across modalities. ",
1040
+ "bbox": [
1041
+ 173,
1042
+ 166,
1043
+ 823,
1044
+ 209
1045
+ ],
1046
+ "page_idx": 8
1047
+ },
1048
+ {
1049
+ "type": "text",
1050
+ "text": "Local to Global model Size Ratio. We experimented with different Local/Global model size ratios on PG19 dataset. By grouping bytes into patches, MEGABYTE effectively uses $P$ times less tokens for the Global model as on the Local model—enabling us to increase the size of the Global model with reduced cost. We find that a given compute budget is spent optimally when the Global model is larger than the Local model, consistently across all modalities and various patch sizes. ",
1051
+ "bbox": [
1052
+ 174,
1053
+ 215,
1054
+ 825,
1055
+ 285
1056
+ ],
1057
+ "page_idx": 8
1058
+ },
1059
+ {
1060
+ "type": "table",
1061
+ "img_path": "images/b1f43e98a431f09037b9c4f7905b9094376f622781db1ac5c49e012f89191520.jpg",
1062
+ "table_caption": [],
1063
+ "table_footnote": [
1064
+ "Table 10: Effects of patch size on performance on the Image256 dataset. All versions use the same amount of GPU hours and data. "
1065
+ ],
1066
+ "table_body": "<table><tr><td>Patch</td><td>Global Size</td><td>Local Size</td><td>bpb</td></tr><tr><td>48</td><td>125M</td><td>114M (L=11)</td><td>3.178</td></tr><tr><td>192</td><td>125M</td><td>125M (L=12)</td><td>3.158</td></tr><tr><td>768</td><td>125M</td><td>83M(L=8)</td><td>3.186</td></tr></table>",
1067
+ "bbox": [
1068
+ 181,
1069
+ 303,
1070
+ 452,
1071
+ 363
1072
+ ],
1073
+ "page_idx": 8
1074
+ },
1075
+ {
1076
+ "type": "table",
1077
+ "img_path": "images/4efc0a7b623ddb94e7adf92c346c498c3232a0cbce63a2b1ddace9e253c9f80b.jpg",
1078
+ "table_caption": [],
1079
+ "table_footnote": [
1080
+ "Table 11: Effects of Local / Global model size on the PG19 dataset. Increasing the capacity of global model improves performance. Models are compute and data matched. "
1081
+ ],
1082
+ "table_body": "<table><tr><td>Global Size</td><td>Local Size</td><td>bpb</td></tr><tr><td>350M (D=1024,L=24)</td><td>290M (D=1024,L=20)</td><td>1.014</td></tr><tr><td>760M (D=1536,L=24)</td><td>262M (D=1024,L=18)</td><td>1.002</td></tr><tr><td>1.3B (D=2048,L=24)</td><td>218M (D=1024,L=15)</td><td>0.991</td></tr></table>",
1083
+ "bbox": [
1084
+ 482,
1085
+ 303,
1086
+ 812,
1087
+ 363
1088
+ ],
1089
+ "page_idx": 8
1090
+ },
1091
+ {
1092
+ "type": "text",
1093
+ "text": "9 Related Work ",
1094
+ "text_level": 1,
1095
+ "bbox": [
1096
+ 173,
1097
+ 449,
1098
+ 321,
1099
+ 465
1100
+ ],
1101
+ "page_idx": 8
1102
+ },
1103
+ {
1104
+ "type": "text",
1105
+ "text": "Prior research has explored the possibility of improving the efficiency of Transformers on long sequences, primarily motivated by mitigating the quadratic cost of self-attention. ",
1106
+ "bbox": [
1107
+ 173,
1108
+ 477,
1109
+ 823,
1110
+ 505
1111
+ ],
1112
+ "page_idx": 8
1113
+ },
1114
+ {
1115
+ "type": "text",
1116
+ "text": "Efficient Encoder Models Several related techniques to ours have been developed for transformer encoder architectures but cannot be straightforwardly applied to decoders. In particular, patchifying operations have previously been used in image encoder models such as ViT (Dosovitskiy et al., 2020), and down- and up-sampling operations have been used for text encoders (Clark et al., 2022), but such methods cannot be naively applied to decoder-only models without leaking information to future bytes in the same patch. MEGABYTE generalizes these approaches to an efficient decoder model by using a intra-patch transformer to predict each sequence element’s likelihood, and offseting the inputs to the two models to avoid leaking information. Jaegle et al. (2021) use self-attention on a shorter latent sequence also resembles patchification, but this technique cannot easily be applied to decoder architectures without leaking information to future timesteps. ",
1117
+ "bbox": [
1118
+ 173,
1119
+ 511,
1120
+ 825,
1121
+ 650
1122
+ ],
1123
+ "page_idx": 8
1124
+ },
1125
+ {
1126
+ "type": "text",
1127
+ "text": "Efficient Decoder models Improving the efficiency of decoder models is harder because of the need to make one prediction per timestep, and not leak information to future timesteps. The most popular approaches can be categorized as (1) chunking sequences into smaller blocks, and propagating information from previous blocks with either recurrence (Dai et al., 2019; Hutchins et al., 2022) or cross-attention (Hawthorne et al., 2022), (2) linear alternatives to attention, which typically involve forms of token-level recurrence (Katharopoulos et al., 2020) or state space models (Gu et al., 2021; Smith et al., 2022; Ma et al., 2022), or (3) sparse approximations of attention (Kitaev et al., 2020; Beltagy et al., 2020; Child et al., 2019; Wu et al., 2022). However, the performance of dense attention means it is typically still chosen for large scale decoders (Touvron et al., 2023; Chowdhery et al., 2022). MEGABYTE takes the alternative approach of decomposing the complete sequence into two shorter sequences, giving sub-quadratic attention. We also note that feedforward networks are the dominant cost in large decoders, not self-attention. Our approach to compressing sequences allows much larger models than would be possible when using large feedforward networks at every timestep. ",
1128
+ "bbox": [
1129
+ 173,
1130
+ 655,
1131
+ 826,
1132
+ 835
1133
+ ],
1134
+ "page_idx": 8
1135
+ },
1136
+ {
1137
+ "type": "text",
1138
+ "text": "Tokenization The most common approach to shortening sequence lengths in Transformer decoders is to pre-process the input with a form of tokenization, in which multiple bytes are mapped to a single discrete token from a fixed vocabulary. For text, this can be done losslessly using methods such as BPE (Sennrich et al., 2015) and SentencePiece (Kudo & Richardson, 2018), but these approaches can require language-specific heuristics (Radford et al., 2019), limit out-of-domain performance (Sharami et al., 2023), and can affect prompting and truncated sampling in unpredictable ways.4 The amount of high-frequency information in images and audio means that tokenization cannot be performed losslessly, and instead clustering (Hsu et al., 2021) or discrete auto-encoders (Ramesh et al., 2021) are used to compress the inputs, which lose information and likely limit generative model performance. Our patches are analogous to traditional lossless tokens, and the Local model performs the role of mapping a hidden state to a distribution over possible patches. ",
1139
+ "bbox": [
1140
+ 174,
1141
+ 842,
1142
+ 823,
1143
+ 911
1144
+ ],
1145
+ "page_idx": 8
1146
+ },
1147
+ {
1148
+ "type": "text",
1149
+ "text": "",
1150
+ "bbox": [
1151
+ 174,
1152
+ 90,
1153
+ 825,
1154
+ 174
1155
+ ],
1156
+ "page_idx": 9
1157
+ },
1158
+ {
1159
+ "type": "text",
1160
+ "text": "10 Conclusion ",
1161
+ "text_level": 1,
1162
+ "bbox": [
1163
+ 176,
1164
+ 188,
1165
+ 308,
1166
+ 204
1167
+ ],
1168
+ "page_idx": 9
1169
+ },
1170
+ {
1171
+ "type": "text",
1172
+ "text": "We introduced MEGABYTE, a scaleable architecture for modeling long sequences. MEGABYTE outperforms existing byte-level models across a range of tasks and modalities, allowing large models of sequences of over 1 million tokens. It also gives competitive language modeling results with subword models, which may allow byte-level models to replace tokenization. However, the scale of experiments here is far below those of state-of-the-art language models (Brown et al., 2020), and future work should explore scaling MEGABYTE to much larger models and datasets. ",
1173
+ "bbox": [
1174
+ 173,
1175
+ 212,
1176
+ 825,
1177
+ 296
1178
+ ],
1179
+ "page_idx": 9
1180
+ },
1181
+ {
1182
+ "type": "text",
1183
+ "text": "References ",
1184
+ "text_level": 1,
1185
+ "bbox": [
1186
+ 174,
1187
+ 316,
1188
+ 266,
1189
+ 333
1190
+ ],
1191
+ "page_idx": 9
1192
+ },
1193
+ {
1194
+ "type": "text",
1195
+ "text": "Baines, M., Bhosale, S., Caggiano, V., Goyal, N., Goyal, S., Ott, M., Lefaudeux, B., Liptchinsky, V., Rabbat, M., Sheiffer, S., Sridhar, A., and Xu, M. FairScale: A general purpose modular PyTorch library for high performance and large scale training. https://github.com/ facebookresearch/fairscale, 2021. \nBeltagy, I., Peters, M. E., and Cohan, A. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150, 2020. \nBrown, T., Mann, B., Ryder, N., Subbiah, M., Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. \nChild, R., Gray, S., Radford, A., and Sutskever, I. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019. \nChoromanski, K., Likhosherstov, V., Dohan, D., Song, X., Gane, A., Sarlos, T., Hawkins, P., Davis, J., Mohiuddin, A., Kaiser, L., et al. Rethinking attention with performers. arXiv preprint arXiv:2009.14794, 2020. \nChowdhery, A., Narang, S., Devlin, J., Bosma, M., Mishra, G., Roberts, A., Barham, P., Chung, H. W., Sutton, C., Gehrmann, S., et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022. \nClark, J. H., Garrette, D., Turc, I., and Wieting, J. Canine: Pre-training an efficient tokenization-free encoder for language representation. Transactions of the Association for Computational Linguistics, 10:73–91, 2022. \nDai, Z., Yang, Z., Yang, Y., Carbonell, J., Le, Q. V., and Salakhutdinov, R. Transformer-xl: Attentive language models beyond a fixed-length context, 2019. URL https://arxiv.org/abs/1901. 02860. \nDosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. \nGao, L., Biderman, S., Black, S., Golding, L., Hoppe, T., Foster, C., Phang, J., He, H., Thite, A., Nabeshima, N., Presser, S., and Leahy, C. The pile: An 800gb dataset of diverse text for language modeling, 2020. \nGu, A., Goel, K., and Ré, C. Efficiently modeling long sequences with structured state spaces. arXiv preprint arXiv:2111.00396, 2021. \nHawthorne, C., Jaegle, A., Cangea, C., Borgeaud, S., Nash, C., Malinowski, M., Dieleman, S., Vinyals, O., Botvinick, M., Simon, I., et al. General-purpose, long-context autoregressive modeling with perceiver ar. In International Conference on Machine Learning, pp. 8535–8558. PMLR, 2022. \nHoffmann, J., Borgeaud, S., Mensch, A., Buchatskaya, E., Cai, T., Rutherford, E., Casas, D. d. L., Hendricks, L. A., Welbl, J., Clark, A., et al. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556, 2022. \nHsu, W.-N., Bolte, B., Tsai, Y.-H. H., Lakhotia, K., Salakhutdinov, R., and Mohamed, A. Hubert: Self-supervised speech representation learning by masked prediction of hidden units. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 29:3451–3460, 2021. \nHutchins, D., Schlag, I., Wu, Y., Dyer, E., and Neyshabur, B. Block-recurrent transformers. arXiv preprint arXiv:2203.07852, 2022. \nJaegle, A., Gimeno, F., Brock, A., Vinyals, O., Zisserman, A., and Carreira, J. Perceiver: General perception with iterative attention. In International conference on machine learning, pp. 4651–4664. PMLR, 2021. \nKalchbrenner, N., Elsen, E., Simonyan, K., Noury, S., Casagrande, N., Lockhart, E., Stimberg, F., van den Oord, A., Dieleman, S., and Kavukcuoglu, K. Efficient neural audio synthesis. CoRR, abs/1802.08435, 2018. URL http://arxiv.org/abs/1802.08435. \nKaplan, J., McCandlish, S., Henighan, T., Brown, T. B., Chess, B., Child, R., Gray, S., Radford, A., Wu, J., and Amodei, D. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020. \nKatharopoulos, A., Vyas, A., Pappas, N., and Fleuret, F. Transformers are rnns: Fast autoregressive transformers with linear attention. In International Conference on Machine Learning, pp. 5156– 5165. PMLR, 2020. \nKingma, D. P. and Ba, J. Adam: A method for stochastic optimization. In ICLR, 2015. \nKitaev, N., Kaiser, Ł., and Levskaya, A. Reformer: The efficient transformer. arXiv preprint arXiv:2001.04451, 2020. \nKudo, T. and Richardson, J. Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. arXiv preprint arXiv:1808.06226, 2018. \nMa, X., Zhou, C., Kong, X., He, J., Gui, L., Neubig, G., May, J., and Zettlemoyer, L. Mega: moving average equipped gated attention. arXiv preprint arXiv:2209.10655, 2022. \nMicikevicius, P., Narang, S., Alben, J., Diamos, G., Elsen, E., Garcia, D., Ginsburg, B., Houston, M., Kuchaiev, O., Venkatesh, G., et al. Mixed precision training. arXiv preprint arXiv:1710.03740, 2017. \nOord, A. v. d., Kalchbrenner, N., and Kavukcuoglu, K. Pixel Recurrent Neural Networks. ICML, 4:2611–2620, 1 2016. doi: 10.48550/arxiv.1601.06759. URL https://arxiv.org/abs/1601. 06759v3. \nPaszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., et al. PyTorch: An imperative style, high-performance deep learning library. In NeurIPS, 2019. \nPress, O., Smith, N. A., and Lewis, M. Shortformer: Better language modeling using shorter inputs. arXiv preprint arXiv:2012.15832, 2020. \nRadford, A., Wu, J., Child, R., Luan, D., Amodei, D., and Sutskever, I. Language models are unsupervised multitask learners. 2019. \nRae, J. W., Potapenko, A., Jayakumar, S. M., and Lillicrap, T. P. Compressive transformers for long-range sequence modelling. arXiv preprint arXiv:1911.05507, 2019a. \nRae, J. W., Potapenko, A., Jayakumar, S. M., and Lillicrap, T. P. Compressive transformers for long-range sequence modelling. arXiv preprint arXiv:1911.05507, 2019b. \nRamesh, A., Pavlov, M., Goh, G., Gray, S., Voss, C., Radford, A., Chen, M., and Sutskever, I. Zeroshot text-to-image generation. In International Conference on Machine Learning, pp. 8821–8831. PMLR, 2021. \nRen, H., Dai, H., Dai, Z., Yang, M., Leskovec, J., Schuurmans, D., and Dai, B. Combiner: Full attention transformer with sparse computation cost, 2021. URL https://arxiv.org/abs/2107. 05768. \nRoy, A., Saffar, M., Vaswani, A., and Grangier, D. Efficient content-based sparse attention with routing transformers, 2020. URL https://arxiv.org/abs/2003.05997. \nSalimans, T., Karpathy, A., Chen, X., and Kingma, D. P. Pixelcnn $^ { + + }$ : Improving the pixelcnn with discretized logistic mixture likelihood and other modifications. CoRR, abs/1701.05517, 2017. URL http://arxiv.org/abs/1701.05517. \nSennrich, R., Haddow, B., and Birch, A. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909, 2015. \nSharami, J., Shterionov, D., and Spronck, P. A systematic analysis of vocabulary and bpe settings for optimal fine-tuning of nmt: A case study of in-domain translation. arXiv preprint arXiv:2303.00722, 2023. \nSmith, J. T., Warrington, A., and Linderman, S. W. Simplified state space layers for sequence modeling. arXiv preprint arXiv:2208.04933, 2022. \nSu, J., Lu, Y., Pan, S., Murtadha, A., Wen, B., and Liu, Y. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864, 2021. \nSun, S., Krishna, K., Mattarella-Micke, A., and Iyyer, M. Do long-range language models actually use long-range context? arXiv preprint arXiv:2109.09115, 2021. \nTouvron, H., Lavril, T., Izacard, G., Martinet, X., Lachaux, M.-A., Lacroix, T., Rozière, B., Goyal, N., Hambro, E., Azhar, F., et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023. \nTrinh, T. H. and Le, Q. V. A simple method for commonsense reasoning. arXiv preprint arXiv:1806.02847, 2018. \nvan den Oord, A., Dieleman, S., Zen, H., Simonyan, K., Vinyals, O., Graves, A., Kalchbrenner, N., Senior, A. W., and Kavukcuoglu, K. Wavenet: A generative model for raw audio. CoRR, abs/1609.03499, 2016. URL http://arxiv.org/abs/1609.03499. \nvan den Oord, A., Li, Y., Babuschkin, I., Simonyan, K., Vinyals, O., Kavukcuoglu, K., van den Driessche, G., Lockhart, E., Cobo, L. C., Stimberg, F., Casagrande, N., Grewe, D., Noury, S., Dieleman, S., Elsen, E., Kalchbrenner, N., Zen, H., Graves, A., King, H., Walters, T., Belov, D., and Hassabis, D. Parallel wavenet: Fast high-fidelity speech synthesis. CoRR, abs/1711.10433, 2017. URL http://arxiv.org/abs/1711.10433. \nWu, Y., Rabe, M. N., Hutchins, D., and Szegedy, C. Memorizing transformers. arXiv preprint arXiv:2203.08913, 2022. \nZhang, S., Roller, S., Goyal, N., Artetxe, M., Chen, M., Chen, S., Dewan, C., Diab, M., Li, X., Lin, V., Mihaylov, T., Ott, M., Shleifer, S., Shuster, K., Simig, D., Koura, S., Sridhar, A., Wang, T., Zettlemoyer, L., and Ai, M. OPT: Open Pre-trained Transformer Language Models. 5 2022a. doi: 10.48550/arxiv.2205.01068. URL https://arxiv.org/abs/2205.01068v4. \nZhang, S., Roller, S., Goyal, N., Artetxe, M., Chen, M., Chen, S., Dewan, C., Diab, M., Li, X., Lin, X. V., et al. Opt: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068, 2022b. ",
1196
+ "bbox": [
1197
+ 171,
1198
+ 340,
1199
+ 828,
1200
+ 890
1201
+ ],
1202
+ "page_idx": 9
1203
+ },
1204
+ {
1205
+ "type": "text",
1206
+ "text": "",
1207
+ "bbox": [
1208
+ 169,
1209
+ 36,
1210
+ 828,
1211
+ 920
1212
+ ],
1213
+ "page_idx": 10
1214
+ },
1215
+ {
1216
+ "type": "text",
1217
+ "text": "",
1218
+ "bbox": [
1219
+ 171,
1220
+ 36,
1221
+ 828,
1222
+ 848
1223
+ ],
1224
+ "page_idx": 11
1225
+ },
1226
+ {
1227
+ "type": "text",
1228
+ "text": "A Supplementary Material ",
1229
+ "text_level": 1,
1230
+ "bbox": [
1231
+ 176,
1232
+ 89,
1233
+ 415,
1234
+ 107
1235
+ ],
1236
+ "page_idx": 12
1237
+ },
1238
+ {
1239
+ "type": "text",
1240
+ "text": "A.1 Training Details ",
1241
+ "text_level": 1,
1242
+ "bbox": [
1243
+ 174,
1244
+ 119,
1245
+ 330,
1246
+ 136
1247
+ ],
1248
+ "page_idx": 12
1249
+ },
1250
+ {
1251
+ "type": "text",
1252
+ "text": "To ensure stable training, we applied gradient clipping with a maximum norm of 1.0 and used the Adam optimizer with $\\beta _ { 1 } = 0 . 9$ , $\\beta _ { 2 } = 0 . 9 8$ Kingma & Ba (2015). We used the built-in polynomial decay learning rate scheduler in MetaSeq with 500 warmup updates and the end learning rate set to 0. All models are trained with pre-norm and using ReLU activation. We apply a dropout of 0.1 throughout, but we do not apply any dropout to embeddings. We also use weight decay of 0.1. To initialize the weights, we use a variant based on Megatron-LM codebase, which involves using a normal distribution with a mean of zero and a standard deviation of 0.006. We truncate this normal distribution within two standard deviations and observed substantial gain in both training stability and performance. ",
1253
+ "bbox": [
1254
+ 173,
1255
+ 145,
1256
+ 825,
1257
+ 270
1258
+ ],
1259
+ "page_idx": 12
1260
+ },
1261
+ {
1262
+ "type": "text",
1263
+ "text": "A.2 Motivation ",
1264
+ "text_level": 1,
1265
+ "bbox": [
1266
+ 174,
1267
+ 286,
1268
+ 294,
1269
+ 301
1270
+ ],
1271
+ "page_idx": 12
1272
+ },
1273
+ {
1274
+ "type": "text",
1275
+ "text": "Why is the local model needed? Many of the efficiency advantages of the MEGABYTE design could be realized with the Global model alone, which would resemble a decoder version of ViT (Dosovitskiy et al., 2020). However, the joint distribution over the patch $p ( x _ { t + 1 } , . . , x _ { t + P } | x _ { 0 . . t } )$ has an output space of size $2 5 6 ^ { P }$ so direct modeling is only tractable for very small patches. We could instead factor the joint distribution into conditionally independent distributions $p ( x _ { t + 1 } | x _ { 0 . . t } ) . . p ( x _ { t + P } | x _ { 0 . . t } )$ , but this would greatly limit the model’s expressive power. For example, it would be unable to express a patch distribution such as $50 \\%$ cat and $50 \\%$ dog, and would instead have to assign probability mass to strings such as cag and dot. Instead, our autoregressive Local model conditions on previous characters within the patch, allowing it to only assign probability to the desired strings. ",
1276
+ "bbox": [
1277
+ 173,
1278
+ 311,
1279
+ 825,
1280
+ 438
1281
+ ],
1282
+ "page_idx": 12
1283
+ },
1284
+ {
1285
+ "type": "text",
1286
+ "text": "Increasing Parameters for Fixed Compute Transformer models have shown consistent improvements with parameter counts (Kaplan et al., 2020). However, the size of models is limited by their increasing computational cost. MEGABYTE allows larger models for the same cost, both by making self attention sub-quadratic, and by using large feedforward layers across patches rather than individual tokens. ",
1287
+ "bbox": [
1288
+ 174,
1289
+ 443,
1290
+ 825,
1291
+ 512
1292
+ ],
1293
+ "page_idx": 12
1294
+ },
1295
+ {
1296
+ "type": "text",
1297
+ "text": "Re-use of Established Components MEGABYTE consists of two transformer models interleaved with shifting, reshaping and a linear projection. This re-use increases the likelihood that the architecture will inherit the desirable scaling properties of transformers. ",
1298
+ "bbox": [
1299
+ 174,
1300
+ 518,
1301
+ 825,
1302
+ 560
1303
+ ],
1304
+ "page_idx": 12
1305
+ },
1306
+ {
1307
+ "type": "text",
1308
+ "text": "A.3 Model Details ",
1309
+ "text_level": 1,
1310
+ "bbox": [
1311
+ 174,
1312
+ 577,
1313
+ 313,
1314
+ 590
1315
+ ],
1316
+ "page_idx": 12
1317
+ },
1318
+ {
1319
+ "type": "text",
1320
+ "text": "As discussed in Section 4, we conduct experiments using a fixed compute and data budget across all models to focus our comparisons solely on the model architecture rather than training resources. To achieve this, we adjust model hyperparameters within each architecture so that the time taken for a single update is matched and then train all models for the same number of updates. We list all of model details in Table 12 and Table 13. ",
1321
+ "bbox": [
1322
+ 173,
1323
+ 602,
1324
+ 825,
1325
+ 671
1326
+ ],
1327
+ "page_idx": 12
1328
+ },
1329
+ {
1330
+ "type": "table",
1331
+ "img_path": "images/efd2750e3b01375c95e871bf18e53f79ec6540aa3a3e96f7d9b639404e6816e8.jpg",
1332
+ "table_caption": [],
1333
+ "table_footnote": [],
1334
+ "table_body": "<table><tr><td></td><td>Model</td><td>#L</td><td>dmodel</td><td>#H</td><td>dhead</td></tr><tr><td>S1</td><td>125M</td><td>12</td><td>768</td><td>12</td><td>64</td></tr><tr><td>S2</td><td>350M</td><td>24</td><td>1024</td><td>16</td><td>64</td></tr><tr><td>S3</td><td>760M</td><td>24</td><td>1536</td><td>16</td><td>96</td></tr><tr><td>S4</td><td>1.3B</td><td>24</td><td>2048</td><td>32</td><td>64</td></tr><tr><td>S5</td><td>2.7B</td><td>32</td><td>2560</td><td>32</td><td>80</td></tr><tr><td>S6</td><td>6.7B</td><td>32</td><td>4096</td><td>32</td><td>128</td></tr></table>",
1335
+ "bbox": [
1336
+ 354,
1337
+ 681,
1338
+ 643,
1339
+ 792
1340
+ ],
1341
+ "page_idx": 12
1342
+ },
1343
+ {
1344
+ "type": "table",
1345
+ "img_path": "images/32f54562f6cec38fd8ad7a5f002eac64de6c8acebf8a4d06b5ef18fc73f27e3a.jpg",
1346
+ "table_caption": [
1347
+ "Listing 1: Pseudocode of Megabyte model "
1348
+ ],
1349
+ "table_footnote": [
1350
+ "Table 13: Model architecture details. We report the model size, the embedding size (D), number of layaers(L), total batch size (BS), learning rate(LR), and context length. When we vary the number of model layers from the standard amount for the given size (Table 12), we note this accordingly. For PerceiverAR models, we note the number of latents used, and for MEGABYTE models we note the patch sizes. "
1351
+ ],
1352
+ "table_body": "<table><tr><td>Model</td><td>(Global) Size</td><td>Local Size</td><td>BS</td><td>LR</td><td>Context Length (in bytes)</td></tr><tr><td colspan=\"6\">arXiv</td></tr><tr><td>Transformer</td><td>320M (D=1024,L=22)</td><td>N/A</td><td></td><td>2.00E-04</td><td>1,024</td></tr><tr><td>Perceiver AR</td><td>248M(D=1024,L=17)</td><td>N/A</td><td></td><td>2.00E-04</td><td>8,192 (1024 latents)</td></tr><tr><td>MEGABYTE</td><td>758M(D=2048,L=14)</td><td>262M (D=1024,L=18)</td><td>27248</td><td>2.00E-04</td><td>8,192 (patch size 8)</td></tr><tr><td>w/o Local model</td><td>2.3B (D=2560,L=20)</td><td>N/A</td><td>48</td><td>1.50E-04</td><td>8,192 (patch size 4)</td></tr><tr><td>w/o global model</td><td>N/A</td><td>350M (D=1024,L=24)</td><td>192</td><td>2.00E-04</td><td>8,192 (patch size 8)</td></tr><tr><td>w/o cross-patch Local model</td><td>921M (D=2048,L=17)</td><td>350M(D=1024,L=24)</td><td>48</td><td>2.00E-04</td><td>8,192 (patch size 8)</td></tr><tr><td>w/ CNN encoder</td><td>704M (D=2048,L=13)</td><td>262M (D=1024,L=18)</td><td>48</td><td>2.00E-04</td><td>8,192 (patch size 8)</td></tr><tr><td colspan=\"6\">Image task 64 (Table 2)</td></tr><tr><td>MEGABYTE</td><td>2.7B (D=2560,L=32)</td><td>350M (D=1024,L=24)</td><td>2</td><td>2.00E-04</td><td>12,288 (patch size 12)</td></tr><tr><td colspan=\"6\">Image task 64 (Table 4)</td></tr><tr><td>Transformer</td><td>760M (D=1536,L=24)</td><td>N/A</td><td>512</td><td>3.00E-04</td><td>2.048</td></tr><tr><td>Perceiver AR</td><td>227M(D=1024,L=16)</td><td>N/A</td><td>512</td><td>3.00E-04</td><td>12,288 (1024 latents)</td></tr><tr><td>MEGABYTE</td><td>1.3B (D=2048,L=24)</td><td>1.3B (D=2048,L=24)</td><td>256</td><td>3.00E-04</td><td>12,288 (patch size 12)</td></tr><tr><td colspan=\"6\">Image task 256</td></tr><tr><td>Transformer</td><td>62M (D=768,L=6)</td><td>N/A</td><td>1536</td><td>2.00E-04</td><td>1,024</td></tr><tr><td>Perceiver AR</td><td>62M (D=768,L=6)</td><td>N/A</td><td>256</td><td>2.00E-04</td><td>8,192 (768 latents)</td></tr><tr><td>MEGABYTE</td><td>125M (D=768,L=12)</td><td>125M (D=768,L=12)</td><td>16</td><td>2.00E-04</td><td>196,608 (patch size 192)</td></tr><tr><td>w/o local model</td><td>2.7B (D=4096,L=32)</td><td>N/A</td><td>16</td><td>2.00E-04</td><td>196,608 (patch size 48)</td></tr><tr><td>w/o global model</td><td>125M (D=768,L=12)</td><td>125M (D=768,L=12)</td><td>16</td><td>2.00E-04</td><td>196,608(patch size 192)</td></tr><tr><td>w/o cross-patch Local model</td><td>250M</td><td>156M (D=768,L=15)</td><td>16</td><td>2.00E-04</td><td>196,608 (patch size 192)</td></tr><tr><td>w/ CNN encoder</td><td>125M (D=768,L=12)</td><td>125M (D=768,L=12)</td><td>16</td><td>2.00E-04</td><td>196,608 (patch size 192)</td></tr><tr><td colspan=\"6\">Image task 640</td></tr><tr><td>Transformer</td><td>83M (D=768,L=8)</td><td>N/A</td><td></td><td>3.00E-04</td><td>1,024</td></tr><tr><td>Perceiver AR</td><td>62M (D=768,L=6)</td><td>N/A</td><td>4800 2048</td><td>3.00E-04</td><td>4,096 (1024 latents)</td></tr><tr><td>MEGABYTE</td><td>125M (D=768,L=12)</td><td>83M (D=768,L=8)</td><td>32</td><td>3.00E-04</td><td>1,228,800 (192 patch size)</td></tr><tr><td colspan=\"6\">audio</td></tr><tr><td>Transformer</td><td>135M(D=768,L=13)</td><td>N/A</td><td>2048</td><td>2.00E-04</td><td>1024</td></tr><tr><td>Perceiver AR</td><td>62M(D=768,L=6)</td><td>N/A</td><td>384</td><td>2.00E-04</td><td>8,192 (1024 latents)</td></tr><tr><td>MEGABYTE</td><td>350M(D=1024,L=24)</td><td>125M (D=768,L=12)</td><td>256</td><td>2.00E-04</td><td>524,288 (32 patch size)</td></tr><tr><td>w/o local model</td><td>2.7B (D=4096,L=32)</td><td>125M (D=768,L=12)</td><td>256</td><td>2.00E-04</td><td>524,288(32 patch size)</td></tr><tr><td>w/o global model</td><td>350M(D=1024,L=24)</td><td>125M(D=768,L=12)</td><td>256</td><td>2.00E-04</td><td>524,288 (32 patch size)</td></tr><tr><td>w/o cross-patch Local model</td><td>350M(D=1024,L=24)</td><td>146M(D=768,L=14)</td><td>256</td><td>2.00E-04</td><td>524,288 (32 patch size)</td></tr><tr><td>w/ CNN encoder</td><td>350M (D=1024,L=24)</td><td>125M (D=768,L=12)</td><td>256</td><td>2.00E-04</td><td>524,288 (32 patch size)</td></tr></table>",
1353
+ "bbox": [
1354
+ 173,
1355
+ 87,
1356
+ 910,
1357
+ 529
1358
+ ],
1359
+ "page_idx": 13
1360
+ },
1361
+ {
1362
+ "type": "text",
1363
+ "text": "B Pseudocode ",
1364
+ "text_level": 1,
1365
+ "bbox": [
1366
+ 173,
1367
+ 618,
1368
+ 305,
1369
+ 635
1370
+ ],
1371
+ "page_idx": 13
1372
+ },
1373
+ {
1374
+ "type": "text",
1375
+ "text": "class MegaByteDecoder : def _init_ self , global_args , local_args , patch_size , ) : self . pad $\\qquad = \\quad 0$ self . patch_size $=$ patch_size self . globalmodel $=$ TransformerDecoder ( global_args ) self . localmodel $=$ TransformerDecoder ( local_args ) def forward ( self , bytes , ) : bytes_global , bytes_local $=$ self . prepare_input ( bytes ) ",
1376
+ "bbox": [
1377
+ 173,
1378
+ 672,
1379
+ 825,
1380
+ 901
1381
+ ],
1382
+ "page_idx": 13
1383
+ },
1384
+ {
1385
+ "type": "text",
1386
+ "text": "global_bytes_embedded $=$ self . globalmodel . embed ( bytes_global ) global_in $=$ rearrange ( global_bytes_embedded , \"b (t p) e -> b t (p e)\", $\\mathtt { p } =$ self . patch_size , ) global_output $=$ self . globalmodel ( global_in ) global_output_reshaped $=$ rearrange ( global_output , \"b t (p e) -> (b t) p e\", p = self . patch_size , ) local_bytes_embedded $=$ self . localmodel . embed ( bytes_local ) local_in $=$ local_bytes_embedded $^ +$ global_output_reshaped local_output $=$ self . localmodel ( local_in ) batch_size $=$ bytes_global . shape [0] x $=$ rearrange ( local_output , \"(b t) l v -> b (t l) v\", b = batch_size ) return x def prepare_input ( self , bytes ) : padding_global $=$ bytes . new ( bytes . shape [0] , self . patch_size ) . fill_ ( self . pad ) bytes_global $=$ torch . cat (( padding_global , bytes [: , : - self . patch_size ]) , -1) bytes_input $=$ rearrange ( bytes , \"b (t p) -> (b t) p\", $\\mathtt { p } = \\mathtt { s e l f }$ . patch_size ) padding_local $=$ bytes_input . new ( bytes_input . shape [0] , 1) . fill_ ( self . pad ) bytes_local $=$ torch . cat (( padding_local , bytes_input [: , : -1]) , -1) return bytes_global , bytes_local ",
1387
+ "bbox": [
1388
+ 171,
1389
+ 93,
1390
+ 823,
1391
+ 550
1392
+ ],
1393
+ "page_idx": 14
1394
+ },
1395
+ {
1396
+ "type": "text",
1397
+ "text": "C PerceiverAR Implementation ",
1398
+ "text_level": 1,
1399
+ "bbox": [
1400
+ 176,
1401
+ 582,
1402
+ 455,
1403
+ 599
1404
+ ],
1405
+ "page_idx": 14
1406
+ },
1407
+ {
1408
+ "type": "text",
1409
+ "text": "To reproduce PerceiverAR in a compute-controlled setting we extended the standard transformer implementation in metaseq with an additonal cross attention layer to compute the latents and match the architecture of PerceiverAR. We trained the model by sampling random spans from each text, matching the procedure used in the PerceiverAR codebase. To be consistent with the original work, we use sliding window evaluation with a stride of num_latents/2 unless otherwise noted. In several cases we used the standard metaseq implementation as opposed to specific techniques reported in the original paper: 1) we used standard attention dropout instead of cross-attention dropout 2) We did not implement chunked attention. We verified our implementation by reproducing the \"Standard Ordering\" experiments in Table 5 of the Perceiver AR paper. After carefully matching context size, number of latents, the amount of data and training steps used and learning rate, we achieved $3 . 5 3 \\mathrm { b p b }$ vs 3.54 reported in the original paper. ",
1410
+ "bbox": [
1411
+ 174,
1412
+ 617,
1413
+ 825,
1414
+ 770
1415
+ ],
1416
+ "page_idx": 14
1417
+ },
1418
+ {
1419
+ "type": "text",
1420
+ "text": "D More results ",
1421
+ "text_level": 1,
1422
+ "bbox": [
1423
+ 173,
1424
+ 794,
1425
+ 315,
1426
+ 810
1427
+ ],
1428
+ "page_idx": 14
1429
+ },
1430
+ {
1431
+ "type": "text",
1432
+ "text": "D.1 Patch scan Implementation ",
1433
+ "text_level": 1,
1434
+ "bbox": [
1435
+ 176,
1436
+ 828,
1437
+ 405,
1438
+ 843
1439
+ ],
1440
+ "page_idx": 14
1441
+ },
1442
+ {
1443
+ "type": "text",
1444
+ "text": "Images have a natural structure, containing a grid of $n \\times n$ pixels each composed of 3 bytes (corresponding to color channels). We explore two ways of converting images to sequences for modeling (see Figure 4). Firstly, raster scan where the pixels are linearized into 3 bytes and concatenated row-by-row. Secondly, patch scan where we create patches of shape $p \\times p \\times 3$ bytes where $p = { \\sqrt { \\frac { P } { 3 } } }$ , and then use a raster scan both within and between patches. Unless otherwise specified, MEGABYTE models use patch scan for image data. ",
1445
+ "bbox": [
1446
+ 174,
1447
+ 856,
1448
+ 823,
1449
+ 911
1450
+ ],
1451
+ "page_idx": 14
1452
+ },
1453
+ {
1454
+ "type": "image",
1455
+ "img_path": "images/482fa286848fccc0c9dffcb9d5c629e37eb15f80f4564e61233305e612f026f3.jpg",
1456
+ "image_caption": [
1457
+ "Figure 4: Two ways to model 2D data sequentially. Left, raster scan, by taking bytes row by row and left to right; right, patch scan, where we first split an image into patches, and do raster scan across patches and within a patch. $( \\mathrm { T } { = } 3 6 , \\mathrm { K } { = } 9 , \\mathrm { P } { = } 4 )$ . "
1458
+ ],
1459
+ "image_footnote": [],
1460
+ "bbox": [
1461
+ 308,
1462
+ 92,
1463
+ 689,
1464
+ 220
1465
+ ],
1466
+ "page_idx": 15
1467
+ },
1468
+ {
1469
+ "type": "text",
1470
+ "text": "",
1471
+ "bbox": [
1472
+ 174,
1473
+ 295,
1474
+ 823,
1475
+ 333
1476
+ ],
1477
+ "page_idx": 15
1478
+ },
1479
+ {
1480
+ "type": "text",
1481
+ "text": "D.2 Patch scan vs Raster scan ",
1482
+ "text_level": 1,
1483
+ "bbox": [
1484
+ 174,
1485
+ 349,
1486
+ 395,
1487
+ 364
1488
+ ],
1489
+ "page_idx": 15
1490
+ },
1491
+ {
1492
+ "type": "text",
1493
+ "text": "The patch scan method is inspired by recent works in Vision Transformers (Dosovitskiy et al., 2020), and it is more effective than raster scan for modeling image sequencing. We found it improves both MEGABYTE and Perceiver AR. ",
1494
+ "bbox": [
1495
+ 174,
1496
+ 375,
1497
+ 828,
1498
+ 416
1499
+ ],
1500
+ "page_idx": 15
1501
+ },
1502
+ {
1503
+ "type": "table",
1504
+ "img_path": "images/f0ec245b6296d63a9fb1eef37f017cd7945fdaaaa08234d2f0e151caa3020431.jpg",
1505
+ "table_caption": [],
1506
+ "table_footnote": [
1507
+ "Table 14: ImageNet256 performance with patch scan vs raster scan for MEGABYTE and Perceiver AR. "
1508
+ ],
1509
+ "table_body": "<table><tr><td></td><td>(Global) Size</td><td>Local Size</td><td>context</td><td>bpb</td></tr><tr><td>MEGABYTE (patch scan)</td><td>62M (D=768,L=6)</td><td>N/A</td><td>8,192 (768 latents)</td><td>3.158</td></tr><tr><td>MEGABYTE (raster scan)</td><td>62M (D=768,L=6)</td><td>N/A</td><td>8,192 (768 latents)</td><td>3.428</td></tr><tr><td>Perceiver AR (patch scan)</td><td>125M (D=768,L=12)</td><td>125M (D=768,L=12)</td><td>196,608 (patch size 192)</td><td>3.373</td></tr><tr><td>Perceiver AR (raster scan)</td><td>125M (D=768,L=12)</td><td>125M (D=768,L=12)</td><td>196,608 (patch size 192)</td><td>3.552</td></tr></table>",
1510
+ "bbox": [
1511
+ 173,
1512
+ 428,
1513
+ 862,
1514
+ 506
1515
+ ],
1516
+ "page_idx": 15
1517
+ },
1518
+ {
1519
+ "type": "text",
1520
+ "text": "D.3 Longer sequence modeling ",
1521
+ "text_level": 1,
1522
+ "bbox": [
1523
+ 174,
1524
+ 563,
1525
+ 401,
1526
+ 577
1527
+ ],
1528
+ "page_idx": 15
1529
+ },
1530
+ {
1531
+ "type": "text",
1532
+ "text": "For our $\\mathsf { p g l 9 }$ scaling experiment, we also use longer context length for MEGABYTE. The results are shown in Table 15. With longer sequence, we didn’t observer further improvement, consistent with findings in Hawthorne et al. (2022). We think we will benefit more from longer sequence when we futher scale up the model size and data. ",
1533
+ "bbox": [
1534
+ 174,
1535
+ 587,
1536
+ 826,
1537
+ 642
1538
+ ],
1539
+ "page_idx": 15
1540
+ },
1541
+ {
1542
+ "type": "table",
1543
+ "img_path": "images/27ea3c47e203c02726b9569edb70c26534ce4c958bbc12951fd891e26286a663.jpg",
1544
+ "table_caption": [],
1545
+ "table_footnote": [
1546
+ "Table 15: Longer sequence for PG19 dataset. For both experiments, we set global model as 1.3b, local model as $3 5 0 \\mathrm { m }$ , and MEGABYTE patch size as 8. "
1547
+ ],
1548
+ "table_body": "<table><tr><td></td><td>context</td><td>bpb</td></tr><tr><td>MEGABYTE</td><td>8,192 (patch size 8)</td><td>0.8751</td></tr><tr><td>MEGABYTE</td><td>16,384 (patch size 8)</td><td>0.8787</td></tr></table>",
1549
+ "bbox": [
1550
+ 334,
1551
+ 656,
1552
+ 663,
1553
+ 713
1554
+ ],
1555
+ "page_idx": 15
1556
+ }
1557
+ ]
parse/dev/JTmO2V9Xpz/JTmO2V9Xpz_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/PvOo1sHKzf/PvOo1sHKzf.md ADDED
@@ -0,0 +1,418 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # COUNTERFACTUAL MEMORIZATIONIN NEURAL LANGUAGE MODELS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Modern neural language models widely used in tasks across NLP risk memorizing sensitive information from their training data. Understanding this memorization is important from a learning-theoretical perspective and is practically crucial in real world applications. An open question in previous studies of language model memorization is how to filter out “common” memorization. In fact, most memorization criteria strongly correlate with the number of occurrences in the training set, capturing memorized familiar phrases, public knowledge, templated texts, or other repeated data. We formulate a notion of counterfactual memorization which characterizes how a model’s predictions change if a particular document is omitted during training. We identify and study counterfactually-memorized training examples in standard text datasets. We estimate the influence of each training example on the validation set and on generated texts, showing how this can provide direct evidence of the source of memorization at test time.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Modern neural language models (LMs) have achieved impressive results in generating high quality text (Brown et al., 2020) and have led to breakthroughs in many downstream natural language processing tasks (Devlin et al., 2019; Raffel et al., 2020b; Bommasani et al., 2021). The paradigm of taking a single large-scale pre-trained model and fine-tuning it for many tasks motivates the study of these models’ ability to generalize by avoiding memorizing their training data.
12
+
13
+ Previous work on memorization in neural language models demonstrated the ability to extract memorized training data, including sensitive data such as phone numbers and usernames (Carlini et al., 2020; Ziegler, 2021; Carlini et al., 2019; Henderson et al., 2017; Thakkar et al., 2020; Thomas et al., 2020). One issue with these extraction attacks is that they often identify primarily “common” and frequently occurring strings in the training set. For example, as shown in the analysis of Lee et al. (2021), near-duplicate training examples are very common in standard text corpora, and account for a large majority of the memorized content. To filter out such commonly occurring strings from all memorized texts, previous work applied various heuristic rules to distinguish frequently-occurring sequences from memorization of isolated pieces of information.
14
+
15
+ In this paper, we propose a principled causal perspective to disentangle such memorization of common or isolated data, by directly tying a model’s predictions to the presence or absence of individual training examples. To this end, we define counterfactual memorization, a measure of the expected change in a model’s prediction when a particular example is excluded from the training set. Counterfactual memorization accounts for the commonality of a piece of information as removing one instance of a text that is common across multiple document will have a minor effect on the model’s prediction on that text. Counterfactual memorization extends a prior mathematical formalization of label memorization by Feldman & Zhang (2020) to the context of neural language modeling.
16
+
17
+ More formally, we say a training example $x$ is counterfactually memorized, when the model predicts $x$ accurately if and only $i f$ the model was trained on $x$ . This allows us to construct a mathematical model for measuring the memorization of isolated pieces of text, whose sole presence in the training dataset have a large effect on the model’s predictions for that text.
18
+
19
+ Following Feldman & Zhang (2020), we further extend this definition to counterfactual influence, which measures the influence of a memorized training text sample on another text example. Counterfactual influence allows us to trace the source of information for a model’s predictions, by locating the training example(s) which significantly contributed to it. With these tools, we study memorization across several standard text datasets. Our main contributions are as follows:
20
+
21
+ 1. We define counterfactual memorization in neural LMs which gives us a principled perspective to distinguish memorization of “rare” and “common” information in neural LMs (Section 2). 2. We estimate counterfactual memorization on several standard text datasets, and confirm that rare memorized examples exist in all of them. We study common patterns across memorized text and the memorization profiles of individual internet domains. (Section 3). 3. We extend the definition of counterfactual memorization to counterfactual influence, and study the impact of memorized examples on the test-time prediction of the validation set examples and generated examples (Section 4).
22
+
23
+ # 2 COUNTERFACTUAL MEMORIZATION
24
+
25
+ To quantify the undesirable memorization of rare details in a specific training document, we define the following notion of counterfactual memorization. The mathematical formulation is borrowed from Feldman & Zhang (2020), where it is used to quantify label memorization in multi-class classification problems. We extend it to the context of unsupervised neural language modeling.
26
+
27
+ Definition 2.1 (Counterfactual Memorization). Given a training algorithm $A$ that maps a training dataset $D$ to a trained model $f$ , and a measure $M ( f , x )$ of the performance of $f$ on a specific example $x$ , the counterfactual memorization of a training example $x$ in $D$ is given by
28
+
29
+ $$
30
+ \begin{array} { r } { \mathsf { m e m } ( x ) \triangleq \underbrace { \mathbb { E } _ { S \subset D , x \in S } [ M ( A ( S ) , x ) ] } _ { \mathrm { p e r f ~ o n ~ } x \mathrm { ~ w h e n ~ t r a i n e d ~ o n ~ } x } - \underbrace { \mathbb { E } _ { S ^ { \prime } \subset D , x \notin S ^ { \prime } } [ M ( A ( S ^ { \prime } ) , x ) ] } _ { \mathrm { p e r f ~ o n ~ } x \mathrm { ~ w h e n ~ n o t ~ t r a i n e d ~ o n ~ } x } , } \end{array}
31
+ $$
32
+
33
+ where $S$ and $S ^ { \prime }$ are subsets of training examples sampled from $D$ . The expectation is taken with respect to the random sampling of $S$ and $S ^ { \prime }$ , as well as the randomness in the training algorithm $A$ .
34
+
35
+ That is, our memorization definition compares the difference between two expected performance measures on a given example $x$ . On one side, we compute the expected performance of a model when trained on datasets that contain the example $x$ , and, on the other side, we compute the expected performance of a model when trained on datasets that do not contain the example $x$ .
36
+
37
+ The expectations in Equation equation 1 can be empirically estimated via sampling. Specifically, we train $m$ different models on independently sampled subsets $S _ { 1 } , \ldots , S _ { m }$ of equal size $| S _ { i } | = { \bf \dot { r } } | D |$ for a fixed $r \in ( 0 , 1 )$ . We then divide these models into two groups: the first group contains all models trained on subsets $S$ where $x \in S$ ; and the second group are all models trained on subsets $S ^ { \prime }$ where $x \notin S ^ { \prime }$ . We take the average performance on $x$ in the two groups separately and compute the difference between the two:
38
+
39
+ $$
40
+ \widehat { \mathsf { m e m } } ( x ) \triangleq \operatorname* { m e a n } _ { i : x \in S _ { i } } [ M ( A ( S _ { i } ) , x ) ] - \operatorname* { m e a n } _ { i : x \notin S _ { i } ^ { \prime } } [ M ( A ( S _ { i } ^ { \prime } ) , x ) ] .
41
+ $$
42
+
43
+ This difference quantifies how the presence or absence of the example $x$ in a model’s training set affect the model’s performance on $x$ . If there is a large difference between including an example in the training set versus not including it, then we consider this example counterfactually memorized.
44
+
45
+ For each $x$ , we refer to models trained with $x$ in the training set ( $\{ A ( S _ { i } ) : x \in S _ { i } \} )$ ) as IN models and the models $x$ was not trained on $\langle { A ( S _ { i } ^ { \prime } ) : x \notin S _ { i } ^ { \prime } } \rangle )$ as OUT models. Note we do not need to retrain a model for each example $x$ . Instead, we train $m$ models once on random subsets of $D$ , and compute the estimation (Equation 2) for all examples using the same set of $m$ models. Ilyas et al. (2022) recently showed that it may also be possible to directly predict these scores using a regression model, yet this approach is computationally prohibitive for large language models. Throughout this paper we use per-token accuracy as the measure $M$ . In other words, we ask the model to predict the next token based on the preceding tokens, measure the 0-1 loss of the argmax token prediction, and then average it across all predicted tokens.
46
+
47
+ # 3 ANALYZING COUNTERFACTUAL MEMORIZATION
48
+
49
+ We estimate and analyze counterfactual memorization of training examples in several standard text datasets: RealNews (Zellers et al., 2019), C4 (Raffel et al., 2020a) and Wiki40B:en (Guo et al.,
50
+
51
+ Table 1: Examples of RealNews training set sampled at high, intermediate and low memorization. The URL of each document is included at the beginning of each example. [...] indicate omitted text for brevity. In the last block, two near-duplicate examples are shown; the yellow highlights in the last block indicate differences.
52
+
53
+ <table><tr><td>Index</td><td>mem</td><td>Text</td></tr><tr><td>2090855</td><td>0.6546</td><td>link &gt; THE AMERICAN JEWISH CONGRESS ANNOUNCED TODAY THE PUBLICATION OF A REPORT ON JEWISH NON- EMPLOYMENT AS A RESULT OF ECONOMIC DISCRIMINATION,[]THEREAFTER ONE OF THE DEPARTMENTS OF A.T.&amp;T. ”ALMOSTUNPRECEDENTEDLY &quot;ENGAGED A JEWISH APPLICANT. link×RECIPE:Chinese Pork &amp; Vegetable Soup with Wonton Noodles ChinesePork&amp; Vegetable Soup with Wonton Noodleslpork</td></tr><tr><td>2085736</td><td>0.5755</td><td>tenderloin(about1-1poudsize)ookedandcutito-nchcubes5cupslower-sodumchickenbothcupwater**cupke serving (about1/cupseach)RecipebyPorkBeInspiredcomwithadaptationsbyculinarydititian&amp;nutritionistKimGaleaz,DNCD</td></tr><tr><td>1680600</td><td>0.5807</td><td>linkLangaEgish..Aab.ackoedgeentofountry.acetouldlikekoldgatis being heldonthe traditional landsof the(appropriate group)people,and paymyrespecttoelders both pastand present.&quot;] linkATexashonorsstudentpunishedforsayingthathomosexualitywas wronghashadhissuspensionrescinded.WesteHlsHigh</td></tr><tr><td>2074805</td><td>0.2835</td><td>madethecorectdeisioninreversingtheircourseofction.&quot;hedecisiontorescindthesuspensionisthecorrctoneThesuspesionwas Wrongandimproper”saidStaver.aplaudthestudentforstandingup.Westoodwithhimtoresistanunjustsuspensionandwearepleased thatsuspensionsbeenreversed”LibertyCunselwillontiuetheighttoexecisfreedmofonscienceandeligion”saidtave &quot;ThesestacecreasidillotiutceaseuesCrstsdpeoplevelirtyadudstisila</td></tr><tr><td>449808</td><td>0.0361</td><td>linkInvestors in Digital Realty Trust, Inc. (DLR) sawnewoptionsbegintradingthisweek, for the February2014 expiration.At Stock Options Cannel,ourYeldBostforulahaslookedupanddowtheDLRoptioschainforthenewFebruary014contractsandidetfed one putandonecallcontractof particular interest.The put contractatthe $45.OO strike price has acurrent bidof $1.00 []</td></tr><tr><td>1157311</td><td>0.0356</td><td>link&gt; Investors in Abercrombie &amp;Fitch Co. (ANF) sawnewoptionsb becomeavailable today,forthe April4th expiration.At Stock Options Channel, our YieldBoost formula has looked up and down the ANF options chain for the new April 4th contracts and identified one put and one call contract of particular interest.The put contract at the $34.OO strike price has a current bid of $1.97. [.]</td></tr></table>
54
+
55
+ 2020). Unless otherwise specified, we use Transformer-based language models (Vaswani et al., 2017) equivalent to T5-base (Raffel et al., 2020b) with ${ \sim } 1 1 2 \mathbf { M }$ parameters. To save computation and enable more direct comparisons across datasets, we truncate the training set for each datasets by taking the first $2 ^ { 2 1 }$ $( { \sim } 2 \mathbf { M } )$ examples. To estimate counterfactual memorization, we train 400 models for each dataset, each on a random $2 5 \%$ subset of the training examples. In practice, text corpora are too large to be loaded entirely into memory, and data loading APIs only allow sequential visits to examples, so we use a hash-based filtering mechanism to efficiently approximate random subset sampling (more details in Appendix H).
56
+
57
+ We train each model for 60 epochs1 using the Adam optimizer (Kingma & Ba, 2015) with learning rate 0.1 and weight decay $1 0 ^ { - 5 }$ . For C4/RealNews/Wiki40B:en, respectively, our models converge to an average per-token accuracy of $4 4 . 2 1 \% / 4 7 . 5 9 \% / 6 6 . 3 5 \%$ on the subsampled training set, and $2 7 . 9 0 \% / 3 1 . 0 9 \% / 4 9 . 5 5 \%$ on the validation set. On average, the models start to overfit at around epoch 5, as indicated by the validation accuracy starting to decrease.
58
+
59
+ # 3.1 DISTRIBUTION OF MEMORIZATION
60
+
61
+ Table 1 shows examples from the RealNews training set sampled at various memorization levels. Examples with high memorization are generally unconventional text such as all-capital letters, structured formats (i.e., tables or bullet list), and multilingual texts. Examples with intermediate memorization are less artificial and are most often news reports of specific events. Examples with low memorization are generally templated documents with many near-duplicate copies in the training data. C4 and Wiki40B:en had similar trends. Interestingly, though Wikipedia articles are less likely to be auto-generated from templates than the web in general, we do observe repetitive patterns in lowscoring documents, such as “ START ARTICLE <place name>, Virginia START PARAGRAPH <place name> is an unincorporated community in <county name>, in the U.S. state of Virginia.”
62
+
63
+ To visualize the distribution of memorization, we plot 2D histograms in Figure 1, where the $\mathbf { X }$ -axis shows the difference of IN-accuracy and OUT-accuracy, and the y-axis shows the sum of the two, which we term “simplicity”. A simple example is one that is scored highly regardless of whether a model saw it during training. The histograms are plotted in log scale to better visualize the exponential decay in the tail for high memorization and simplicity levels.
64
+
65
+ From the 2D density plots, we find that easy examples tend to have low memorization. However, there is no simple linear correlation. Peak memorization occurs for examples of intermediate simplicity. For the hardest examples, the memorization scores are low, because even the IN-models could not learn them well. Many hard examples consist of ill formatted, foreign or garbage texts. As a result, in
66
+
67
+ ![](images/bfacdc603c38bbe2f5a23591bf0895680d883e196f560a85ca82046727034b83.jpg)
68
+ Figure 1: The joint distribution of counterfactual memorization (X axis) and simplicity (Y axis), where simplicity is measured as the overall accuracy for an example across all models. (Histograms are in log-scale).
69
+
70
+ ![](images/58fff0584b9833181241cdb6ad7902b99db0941d2588a71a1f7258d90eb0f47f.jpg)
71
+ Figure 2: For each web domain, we plot the 95-percentile of memorization against the number of examples from that domain in (a) RealNews and (b) C4. The red dotted line indicates a threshold of a minimum of 1000 articles for RealNews and 50 articles for C4. The memorization distributions of a few representative domains are shown for (c) RealNews and (d) C4.
72
+
73
+ Wiki40B:en, which contains higher quality texts, the lower bound of the histogram is higher than the other two datasets. Interestingly, the choice of data distribution has a relatively minor effect on memorization: the shape of the memorization histogram is generally consistent across the three datasets; the range of memorization values is only slightly compressed for Wiki40B:en.
74
+
75
+ Figure 1 shows the overall distribution of memorization for each training datasets. To obtain a more granular view, we can also analyze the distributions for texts sourced from individual web domains in RealNews and C4, to see whether different data sources display different memorization profiles. Web domains such as news portals, blogs, and forums differ both stylistically and in how much they reference or even copy from other websites. Additionally, some domains are represented much more frequently than others in the datasets we studied. This could lead to considerably different memorization profiles for examples coming from one domain as compared to another.
76
+
77
+ To investigate these effects, we visualize the 95th percentile memorization score in each web domain against the number of examples in that domain for RealNews (Figure 2a) and C4 (Figure 2b). C4 contains many more domain names than RealNews since the latter is collected only from news websites. For both datasets, the domains with a large number of crawled documents show a smaller variance in the 95-percentile values, while “smaller” domains depict a wide range of variety in memorization profiles. The memorization profiles of a few representative domains are visualized in Figures 2c and 2d. The domains we selected for visualization are: the largest domain (blue), the domain with highest 95 percentile memorization (orange), and two domains that have more than 1000 and 50 articles in RealNews and C4 respectively (green and red).
78
+
79
+ ![](images/be3b26f3a901a426e0878ea9350509e41f50c810b54e6437736d3b9fba35d027.jpg)
80
+ Figure 3: (a) Spearman’s R between memorization rankings from two disjoint sets of $m$ models. The rankings are variable at low numbers of models, but starts to converge at 192 models. All of our other experiments use 400 models. Reported values are averages over up to 10 partitions, with error bars of 10 standard deviations. (b) For RealNews, we plot memorization scores against the number of near-duplicates an example had in the dataset.
81
+
82
+ In RealNews (Figure 2c), reuters.com contains the largest number of documents but low memorization scores on average. The domain digitallibrary.un.org, the United Nations Digital Library, has high memorization scores potentially because it contains many multilingual documents. We have observed that less frequently occurring tokens, like those in foreign languages or ALL-CAPITAL words tend to cause high memorization. Similarly, flattened structured data (e.g. tabular texts) also deviates significantly from normal English texts and potentially leads to high memorization, as demonstrated by zap2it.com, a website for TV program listings. On the other hand, hotair.com is a news commentary website that frequently quotes other major news articles. This may lead to duplicate text in the dataset which we suspect contributes to its overall lower memorization distribution.
83
+
84
+ The observations are similar on C4: blogspot.com contains a large number of documents in the training set with only moderate amounts of memorization; zh.wikipedia.org and buckinghamautos.com.au have high memorization due to foreign (Chinese) or structured (car sales listings) text; and www.unitedstateszipcodes.org has very low memorization scores because common templates are re-used to generate similar pages for individual zip codes.
85
+
86
+ # 3.2 NUMBER OF MODELS NEEDED
87
+
88
+ To evaluate the impact of a single training example, one may wish to train two models that differ only in that single example. In practice, the stochasticity in a single run of common training algorithms (e.g. SGD) produces too low signal-to-noise ratios to be useful for such estimation. Moreover, leave-one-out estimation means a separate pair of models needs to be trained for each training example, which is computationally costly. Therefore, we formulated our estimation in Section 2 by accumulating statistics from $m$ models independently trained on random training subsets. In our experiments, we set $m = 4 0 0$ . To understand how sensitive our results are to $m$ , we analyze the rankings produced by distinct sets of models of size $m$ . We vary $m$ from 6 to 192, and partition our set of 400 models into up to 10 sets of $m$ models (e.g. for $m = 1 9 2$ , we construct 2 partitions, and for $m = 6$ , we construct 10). We then compute the Spearman’s R between these partitions to measure the agreement between the rankings produced by each partition. If the rankings are very similar (have Spearman’s R close to 1), then this number of models is reliably estimating the true ranking of memorization scores. We plot these Spearman’s R values in Figure 3. Even at 96 models, this correlation begins to plateau near 1, lending confidence that 400 models is sufficient for reliable estimation of memorization scores. See Appendix E for more analysis on the sensitivity to $m$ .
89
+
90
+ # 3.3 IMPACT OF NUMBER OF TRAINING EPOCHS
91
+
92
+ As expected, the overall amount of memorization grows consistently with the number of epochs of training (Figure 4a). This makes sense since training for more epochs increases overfitting. As training progresses, we also see an increasingly long tail of examples with high memorization scores. On RealNews, about $59 \%$ of examples had consistently increasing memorization scores across all epochs considered. There were no examples whose memorization decreased in a significant way over training (all observed decreases can be attributed either to noise or to instability early in training). Only $0 . 5 \%$ of examples stayed completely un-memorized with scores which never rose above 0.1, while $85 \%$ of examples had memorization scores which never rose above 0.2. Figure 4b shows the fraction of memorized examples as training progresses, at several thresholds of memorization. We can see that more training epochs significantly increases memorization.
93
+
94
+ ![](images/d0a6d4e7988d56a3d0487d6693d2f20e36c77a4c22a789bdfe38f1b0bbab9551.jpg)
95
+ Figure 4: (a) The distribution in memorization of RealNews examples as training progresses. (b) The fraction of RealNews examples with memorization consistently above the specified threshold as training progresses.
96
+
97
+ # 3.4 DUPLICATE TEXT AND MEMORIZATION
98
+
99
+ By manually inspecting the sequences with low counterfactual memorization (e.g., those in Table 1) we find that those sequences with near-duplicates in the training set tend to have low counterfactual memorization (as expected). In this section, we provide a quantitative study of the (anti-)correlation between redundancy and memorization. Following the method from (Lee et al., 2021), we first use MinHash (Broder, 1997) to identify near-duplicate examples in RealNews train set. Out of the 2.01 million examples, ${ \sim } 3 8 { , } 0 0 0$ are identified as being a near-duplicate with at least one other example. Among these frequently-occurring examples, the Pearson correlation between an example’s memorization score and the number of near-duplicates for that example is -0.39; in other words, memorization does quantitatively decrease when data is repeated more often. This matches our qualitative observations from earlier. From Figure 3b we can see that especially for the examples with a large number of near-duplicates, the memorization score is small. However, the overall anticorrelation is not strong. Especially for examples with no near-duplicates, memorization scores span the whole range of possible values, and depend on how easy it is to predict each example from the knowledge learned from the rest of the training corpus. This is to be contrasted with “generation-time memorization” (discussed in Section B) that measures the textual overlap between model generated texts and the training documents. There, the number of occurrences strongly correlate with the measured memorization (Carlini et al., 2020; Lee et al., 2021). This shows that counterfactual memorization goes beyond simple text matching, and can measure more nuanced qualities about training examples such as how easy or hard they are to be fit.
100
+
101
+ # 4 FROM MEMORIZATION TO INFLUENCE
102
+
103
+ Counterfactual memorization identifies training examples that contain rare information not conveyed by other examples. A natural question to ask is whether a model would leak the information in a memorized example during inference. Previous paper studies membership inference attack (Shokri et al., 2017; Sablayrolles et al., 2019; Long et al., 2020) where an attacker tries to figure out if a particular example exists in the training set. In this paper, we consider standard model evaluation without adversarial attackers, and quantify “does seeing a particular training example strongly influence the prediction on a validation example?” Another way of asking this is if a single example in the training set has an large and over-representative impact on the prediction of a validation example. We answer these questions by measuring counterfactual influence with a formulation adapted from Feldman & Zhang (2020):
104
+
105
+ Definition 4.1 (Counterfactual Influence). Given a training algorithm $A$ that maps a training set $D$ to a trained model, and a performance measure $M$ , the counterfactual influence of a training example $x \in D$ on another example $x ^ { \prime }$ is
106
+
107
+ $$
108
+ \mathsf { i n f l } ( x \Rightarrow x ^ { \prime } ) \triangleq \mathbb { E } _ { S \subset D , x \in S } [ M ( A ( S ) , x ^ { \prime } ) ] - \mathbb { E } _ { S \subset D , x \notin S } [ M ( A ( S ) , x ^ { \prime } ) ] ,
109
+ $$
110
+
111
+ ![](images/ecf1e9e9562f3fbee3397b846314bbc663749142e6372c1bfef64d8104714ced.jpg)
112
+ Figure 5: Histogram of the influence of all the training examples on a specific test example for three different test examples. The blue and orange examples have high and intermediate influence from some training examples, as indicated by the outlier values to the right of the each histogram plot. The green (#123456) is a random example, where the influence from all individual training examples are close to zero.
113
+
114
+ where $S$ is a subset of training examples sampled from $D$ . The expectation is taken with respect to the random sampling of $S$ , as well as the randomness in the training algorithm $A$ . Here $x ^ { \prime }$ can be an example from the validation set or test set, a generated example or a training example.
115
+
116
+ An empirical estimation of the influence can be computed similarly to counterfactual memorization by uniformly sampling $m$ subsets $S _ { 1 } , \ldots , S _ { m }$ from $D$ , where $| S _ { i } | = r | D |$ , and calculating
117
+
118
+ $$
119
+ \mathfrak { i n f l } ( x \Rightarrow x ^ { \prime } ) \triangleq \operatorname* { m e a n } _ { i : x \in S _ { i } } [ M ( A ( S _ { i } ) , x ^ { \prime } ) ] - \operatorname* { m e a n } _ { i : x \notin S _ { i } } [ M ( A ( S _ { i } ) , x ^ { \prime } ) ] .
120
+ $$
121
+
122
+ This measures how much a training sample $x$ ’s presence influences the prediction of a different example $x ^ { \prime }$ . Note, ${ \mathsf { m e m } } ( x ) = { \mathsf { i n f l } } ( x \Rightarrow x )$ , i.e., counterfactual memorization is self influence.
123
+
124
+ Influence on Examples of the Validation Set. With the same models trained for estimating memorization, we can estimate the counterfactual influence on the validation set according to Equation equation 4. For each example in the validation set, we can estimate the influence on it from each training example. Figure 5 shows the distribution of influence from all training example on three different examples from the validation set. The green example was randomly chosen and represents the behavior for most validation examples: it receive close-to-zero influence from all the (individual) training examples. The blue and orange examples were sampled to have high and intermediate maximum influence. Each of them has one (or a few) strong influencer from the training set, as indicated by the bars to the right of the histogram. They also only receive tiny influence from all the rest of the training examples, though the variance of influence is larger than for the green example.
125
+
126
+ Intuitively, most training examples will have small influence on validation set examples because the models learn distributional patterns shared across many training examples, and individual training examples tend to have insignificant influence here. However, a training example $x$ with high counterfactual memorization contains rare information that are not shared with other examples. Therefore, if a validation set example $x ^ { \prime }$ contains similar information, $\mathsf { i n f l } ( x \Rightarrow x ^ { \prime } )$ could be large. Figure 6 shows the relationship between memorization and influence by plotting $\mathsf { m e m } ( x )$ of each training example $x$ against its maximum influence $\mathrm { m a x } _ { x ^ { \prime } } \mathsf { i n f l } ( x \Rightarrow x ^ { \prime } )$ on $x ^ { \bar { \prime } }$ across the validation set.
127
+
128
+ Consistent with our intuition, examples with small memorization scores have small max-influence scores. Larger influence scores on the validation set generally requires larger memorization scores of the training example itself. However, not all training examples with large memorization scores lead to large influence scores. In particular, the max-influences drop significantly for examples with memorization larger than 0.4. One potential reason is that many examples with very high memorization are simply low quality text, so memorization is required in order to learn them, but they do not encode anything interesting that could influence a validation example. On the other hand, even if a memorized example encodes some rare and useful information, the max-influence could still be low because the validation set does not contain a relevant document. This is especially true given that all datasets have considerably smaller validation sets than training sets.
129
+
130
+ Table 2 shows train-validation example pairs from RealNews sampled at different influence value ranges. We found that the train-validation pairs with the highest influence are almost identical, except some superficial differences, such as different handling of quotation / em dash marks. As we move to intermediate influence ranges, we commonly found reports on the same events. Large paragraphs of identical text indicate that one document might be citing the other or both citing from a third party. At low influence, two types of correlations are commonly observed: 1) templated texts with high similarity—the reason for a low influence is that there are many similar training examples that split the influence; 2) superficially related documents due to a shared prefix such as ST. CLOUD – This week in our “Behind the Scenes” series on WJON or a shared substring of some common knowledge like FSIS, the Centers for Disease Control and Prevention. Due to high signal-to-noise ratio, here were no noticeable relationships in the document pairs with influence scores below 0.02.
131
+
132
+ ![](images/d4998edbe97d2385c3505a2bc849c3fccd443f0ad99ebde15a122eaa8649936a.jpg)
133
+ Figure 6: The joint distribution of the memorization score of each training example and its maximum influence on any validation set example. The histograms are in log scale to better visualize the tail of the distributions.
134
+
135
+ Table 2: Train-validation example pairs of RealNews sampled at a variety of influence levels. [...] indicate text omitted for brevity. Differences in each document pair are highlighted yellow.
136
+
137
+ <table><tr><td rowspan=1 colspan=9>Index Estim. Text</td></tr><tr><td rowspan=1 colspan=9>Validation infl link &gt; Identical URL except with the http:// protocol instead of https://. The text is identical to the training example.</td></tr><tr><td rowspan=1 colspan=1>1334662</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan=2 colspan=1>Train</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan=3 colspan=8>0.3780mem linkByAribiovichZEELLLYsrael(Reuters)-sposableperacemassoeritleproteconfroodsof0.3780 dustatfillthlfeereelceolistseapgsightoopelelvdtoarsdiiby Jeffrey Heller/Jeremy Gaunt)</td></tr><tr><td rowspan=1 colspan=1>2077314</td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=3 colspan=9>Validation infl link →VATICAN CITY(AP)Emeritus Pope Benedict XVI is ofering a first-ever papal assessment of his own pontificate in a book that838341 0.1209 recountshisecisiotoigisuseathisceordisptstmantlathcallteVatian’s&quot;gyb&quot;dctXVI:TheFinaloesatioteptebstViarelyspreainggosipatawebsites, but (almost) identical report.</td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=4 colspan=8>websites, but (almost) identical report.mem link &gt;VATICAN CITY EmeritusPopeBenedictXVIisofferingafirst-everpapalassessmentofhisownpontificate inabookthatrecounts0.1650 hisdecisiontosipiseatsscodiseptstosmatleathecallthVatian&#x27;sgaloby&quot;ecXFinalConveseoutiebtestaalysprdigosiathaylloleifat www.twitter.com/nwinfield</td></tr><tr><td rowspan=1 colspan=1>Train</td></tr><tr><td rowspan=1 colspan=1>614881</td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=2 colspan=9>Validation infl linkANAHOigthnFracoseauchinadtosissirotdCrisrogerbockedixsotsino69682107 0.0673 Ducks fans might have been lost without their programs on Wednesday night.it.It&#x27;s only the first game of the preseason,but anew era has</td></tr><tr><td rowspan=1 colspan=1>682107</td><td rowspan=1 colspan=1>0.0673</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=4 colspan=7>clearlybegun.AgroupofmostlyewcomersinDucksuiformsbeatPhoenix3-2inashootoutonWednesdayatHondaCenterfamliarface made the biggest impact,however,a,as Bobby Ryan scored two goals.Ryan also scored two goals in the Ducks&#x27;preseason opener last year[...] Different websites on the same event with slightly different wordings.linkANAHEM-Onanight whenFrancois Beaucheminhad twoasistsinTorontoandChris Prongerblocked sixshots inDetroit,the13,869Ducks&#x27;fanswhoshowed atat Honda CenterWednesdayneeded programsttoidentifytheplayerson theirfavorite team. It&#x27;s only the</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>twogoals in the</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>494435</td><td rowspan=1 colspan=1>0.1439</td><td rowspan=1 colspan=2>toidentifytheplayerson theirfavorite team. It&#x27;s only the</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=7>firstgameofthepreseason,utaeerasearlygnAgropofostlyewcorsicksuforsbatPoenix3-2ioutalthoughafamiliarface made thebiggest impactasBobby Ryanscoredtwo goalsinregulationandanotherinthe shootout.Ryanalso scoredtwo goals in the Ducks’ preseason opener last year[...]</td></tr><tr><td rowspan=1 colspan=1>Validation</td><td rowspan=1 colspan=1>infl</td><td rowspan=1 colspan=1>link×</td><td rowspan=5 colspan=6>link×Morethan 70.ooo poundsof Butterball turkeyrecalled because of potential salmonella WASHINGTON- The U.S. Departmentof Agriculture&#x27;sodfetyndIspectiossviceaoncednWedneayeyeesippdtoatioideetailadsitiollocationss. RELATED: View the fullrecall FSIS, the Centers for Disease Control and Prevention and [..] Different websitesreporting the same event, one embeded a lot more information than the other.link&gt;×EButterball recallsnearly80Oo0 pounds of turkeyaftersalmonellacases WASHNGTON—The U.S.Departmentof Agriculture&#x27;sFood Safety and InspectionserviceannouncedWednesday [.] The raw ground turkey was produced on July 7, 2018. The following products</td></tr><tr><td rowspan=1 colspan=1>1165799</td><td rowspan=1 colspan=1>0.0360</td><td></td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td></td></tr><tr><td></td><td rowspan=1 colspan=1></td><td rowspan=3 colspan=7> same event, one embeded a lot more information than the other.link&gt;×EButterball recallsnearly80Oo0 pounds of turkeyaftersalmonellacases WASHNGTON—The U.S.Departmentof Agriculture&#x27;sFood Safety and InspectionserviceannouncedWednesday [.] The raw ground turkey was produced on July 7, 2018. The following productsunder recallwereshipped tonationwide retailand institutional locations: 48-oz. plastic wrapped traycontaining“BUTTERBALL everydayFresh Ground Turkey WITHNATURALFLAVORING (85%LEAN/15%FAT) with sellorfreeze bydateof 726/18,lot code 8188,andUPCcodes 2655-71555or65-71557representedonthelabel.48-oz.plastic wrappedtraycontaining&quot;BUERBALLeverydayFreshGround Turkey WITH NATURAL FLAVORING (93% LEAN/7% FAT)&quot; with sell or freeze by date of 7/26/18, lot[[..]labels here.FSIS,the</td><td rowspan=1 colspan=1>es WASHIN</td></tr><tr><td rowspan=1 colspan=1>1571976</td><td rowspan=1 colspan=1>0.2094</td></tr><tr><td rowspan=2 colspan=1></td><td rowspan=2 colspan=1></td></tr><tr><td rowspan=1 colspan=7>Centers for Disease Control and Prevention and</td></tr></table>
138
+
139
+ Influence turns out to be an effective tool for analyzing and attributing the model predictions at test time: for predictions that rely on information obtained by (counterfactual) memorization, we can identify exactly which training example provided such information. Our observation of nearduplicated training-validation document pairs is consistent with recent studies that identifies data contamination in large Internet crawled text corpus (Lee et al., 2021; Dodge et al., 2021).
140
+
141
+ Table 3: Pairs of RealNews training examples and Grover generations sampled at several influence levels. “link” contains the document URL. [...] indicate text omitted for brevity. Differences in each pair are highlighted.
142
+
143
+ <table><tr><td rowspan=1 colspan=5>Index Estim. Text</td></tr><tr><td rowspan=4 colspan=5>Generation infl link &gt; Baku, Azerbaijan,April15 Trend:Offcial exchange rateof the US dollar and euro against Azerbaijani manat was setat1.7and1.92251361 0.1805 manats, respectively, for April115.Below are the rates of Azerbaijani manat against world currencies,according to the data from the CentralBank of AzerbaijanforApril15.[0OJapaneseyen10JY1.51871NewZealanddollr1NZD11513FollowTrendonTelegram.Only most interesting and important newsTrain mem linkBaku,Azerbaijanch5Tend:OfcialehangateoftheUSdolarandroainstAzerbajanimaatwassetat7nd2072973 0.3534 1.9241 manats,respectivelyforarch5.Belowretheatesofzerbijanimanataganstorldurrencies,accordingtotetafrotheCentralBankofAzerbaijanforMarch15.0Japaneseyen1JY1.52201NewZealanddolar1NZD1.1636FollowendonTelegram. Only most interesting and important news</td></tr><tr><td rowspan=1 colspan=1>1361</td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=5>Generation infl link &gt;NEW DELHI: India is likely to see average monsoon rains this year., the state-run weather office said on Monday, which should support</td></tr><tr><td rowspan=1 colspan=5>21998 0.0218 agriculturalproucioocowthisia’sdbgesoyerealfofacksgatiool</td></tr><tr><td rowspan=2 colspan=5>isexpectedtobe96 percentofthelong-termaverage,M.Rajeevan,secretaryatthe Ministryof Earth Sciences,,told a news conference.TheIndiaMeteorolicaepatsgealfallae9tdpetofa89 centimeters for the entire four-month season beginning June.[]India&#x27;s weather office will update its forecast in the first week of June.However,onagetheasforestacuatelyoyoceeeryfiveyearsovrtepasttead,eaftertingtaerror band of plus or minus 5 percentage points.</td></tr><tr><td rowspan=1 colspan=2></td></tr><tr><td rowspan=2 colspan=1>Train</td><td rowspan=2 colspan=1>mem</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td rowspan=3 colspan=1>linkNEW(euters)dislikeltceieveraemosoiin8teweatrocesidasingteohigherfaroocothisia’sdgeoyeealfofadcksatioooislloeexpectedtobe97ppercent ofalong-termaverage,K.J. Ramesh, director general of the state-run India</td></tr><tr><td rowspan=5 colspan=1>326212</td><td rowspan=5 colspan=1>0.1555</td><td rowspan=2 colspan=2>of the country&#x27;s $2 trillion economy, are</td></tr><tr><td rowspan=1 colspan=1>reexpecter</td></tr><tr><td rowspan=1 colspan=3>Meteorological Department (IMD), told a news conference.&quot;We see very less probability of a deficit monsoon,&quot; Ramesh said on Monday.Otherthanliftingfarmandwideronomicgowth,aspellofgoodrainswillkeepalidonfation,potentiallytmptingPrieister</td></tr><tr><td rowspan=1 colspan=3>NarendraModitobingfrwardgneralelectiosdueia19.Idia’sweathofcefiesaverag,noal,aifallastwee96percentand104 percentofa50-yearaverageof89cmsforthe entire four-month season beginning June.[ saidaMumbai-based dealer</td></tr><tr><td rowspan=1 colspan=3>witha globaltrading firm.Average monsoonrainfallwillhelp India retain its position as the world’s toprice exporter</td></tr></table>
144
+
145
+ Influence on Generated Texts. The influence estimation is not restricted to the validation set. We can also estimate influence on generated examples. In this section, we evaluate on the publicly released generations from the Grover (Zellers et al., 2019) modelstrained on RealNews. Specifically, we take the generations from Grover-Mega $\scriptstyle \left( \mathrm { p = 0 . 9 6 } \right)$ , a 1.5-billion-parameter model trained on the RealNews dataset. Comparing with the train-validation influence in Figure 6a, the histogram (c.f. Figure 11 in Appendix.) decays faster as max-influence grows. Moreover, the value range of maxinfluence is also twice smaller. The reason that we did not find a lot of highly influenced generated examples are two folds: 1) there are only 24,576 generation in the public release, which is much fewer than the validation examples. As a result, the corresponding example of many memorized training examples do not get sampled in the generations. For comparison, previous work (Carlini et al., 2020; Lee et al., 2021) generated $1 0 0 { , } 0 0 0 { + }$ examples to identify memorization in generation. These approaches also count duplicates in the training set, which counterfactual memorization filters out. 2) The Grover model was trained on the full RealNews training set, while we have restricted our analysis to the first 2M training examples. There could be potentially more high influence training examples that are missed in our calculation.
146
+
147
+ Table 3 show examples of train-generation pairs sampled from different influence ranges. The patterns generally follow the train-validation pairs shown above, although many of the relations are due to some form of templating.
148
+
149
+ # 5 SUMMARY AND DISCUSSION
150
+
151
+ We studied memorization in neural language models. Inspired by a taxonomy of human memory in Psychology, we formulated a notion of counterfactual memorization as a tool that can systematically ignore “common” memorization such as common phrases (“How are you?”) and captures memorization of rare information present in specific training examples. We conducted experiments on three commonly used text corpus in language modeling and found memorization in all of them. We further analyze the per-domain memorization profiles for Internet-crawled data, and found that different sources could have substantially different memorization profiles.
152
+
153
+ Furthermore, we analyzed how memorized training examples could impact the model predictions at test time via counterfactual influence. We found that for examples from both the validation set and the model generated texts, the model predictions could be drastically different depending on the presence or absence of a particular training example with high memorization.
154
+
155
+ # REFERENCES
156
+
157
+ Samyadeep Basu, Philip Pope, and Soheil Feizi. Influence functions in deep learning are fragile. ArXiv, abs/2006.14651, 2021.
158
+
159
+ Rishi Bommasani, Drew A Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, Erik Brynjolfsson, Shyamal Buch, Dallas Card, Rodrigo Castellon, Niladri Chatterji, Annie Chen, Kathleen Creel, Jared Quincy Davis, Dora Demszky, Chris Donahue, Moussa Doumbouya, Esin Durmus, Stefano Ermon, John Etchemendy, Kawin Ethayarajh, Li Fei-Fei, Chelsea Finn, Trevor Gale, Lauren Gillespie, Karan Goel, Noah Goodman, Shelby Grossman, Neel Guha, Tatsunori Hashimoto, Peter Henderson, John Hewitt, Daniel E Ho, Jenny Hong, Kyle Hsu, Jing Huang, Thomas Icard, Saahil Jain, Dan Jurafsky, Pratyusha Kalluri, Siddharth Karamcheti, Geoff Keeling, Fereshte Khani, Omar Khattab, Pang Wei Kohd, Mark Krass, Ranjay Krishna, Rohith Kuditipudi, Ananya Kumar, Faisal Ladhak, Mina Lee, Tony Lee, Jure Leskovec, Isabelle Levent, Xiang Lisa Li, Xuechen Li, Tengyu Ma, Ali Malik, Christopher D Manning, Suvir Mirchandani, Eric Mitchell, Zanele Munyikwa, Suraj Nair, Avanika Narayan, Deepak Narayanan, Ben Newman, Allen Nie, Juan Carlos Niebles, Hamed Nilforoshan, Julian Nyarko, Giray Ogut, Laurel Orr, Isabel Papadimitriou, Joon Sung Park, Chris Piech, Eva Portelance, Christopher Potts, Aditi Raghunathan, Rob Reich, Hongyu Ren, Frieda Rong, Yusuf Roohani, Camilo Ruiz, Jack Ryan, Christopher Re, Dorsa Sadigh, ´ Shiori Sagawa, Keshav Santhanam, Andy Shih, Krishnan Srinivasan, Alex Tamkin, Rohan Taori, Armin W Thomas, Florian Tramer, Rose E Wang, William Wang, Bohan Wu, Jiajun Wu, Yuhuai \` Wu, Sang Michael Xie, Michihiro Yasunaga, Jiaxuan You, Matei Zaharia, Michael Zhang, Tianyi Zhang, Xikun Zhang, Yuhui Zhang, Lucia Zheng, Kaitlyn Zhou, and Percy Liang. On the opportunities and risks of foundation models. August 2021.
160
+
161
+ James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: composable transformations of Python+NumPy programs, 2018. URL http://github.com/google/jax.
162
+
163
+ Andrei Z Broder. On the resemblance and containment of documents. In Proceedings. Compression and Complexity of SEQUENCES 1997 (Cat. No. 97TB100171), pp. 21–29. IEEE, 1997.
164
+
165
+ Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D 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 Ziegler, Jeffrey Wu, Clemens Winter, Chris 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 H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 1877–1901. Curran Associates, Inc., 2020. URL https://proceedings.neurips. cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf.
166
+
167
+ Nicholas Carlini, Chang Liu, Ulfar Erlingsson, Jernej Kos, and Dawn Song. The secret sharer: Evalu- ´ ating and testing unintended memorization in neural networks. In USENIX Security Symposium, 2019.
168
+
169
+ Nicholas Carlini, Florian Tramer, Eric Wallace, Matthew Jagielski, Ariel Herbert-Voss, Katherine Lee, Adam Roberts, Tom Brown, Dawn Song, Ulfar Erlingsson, et al. Extracting training data from large language models. arXiv preprint arXiv:2012.07805, 2020.
170
+
171
+ Nicholas Carlini, Steve Chien, Milad Nasr, Shuang Song, Andreas Terzis, and Florian Tramer. Membership inference attacks from first principles, 2021.
172
+
173
+ 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, Volume 1 (Long and Short Papers), pp. 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https: //aclanthology.org/N19-1423.
174
+
175
+ Jesse Dodge, Maarten Sap, Ana Marasovic, William Agnew, Gabriel Ilharco, Dirk Groeneveld, and Matt Gardner. Documenting the english colossal clean crawled corpus. arXiv preprint arXiv:2104.08758, 2021.
176
+
177
+ Cynthia Dwork, Aaron Roth, et al. The algorithmic foundations of differential privacy. Found. Trends Theor. Comput. Sci., 9(3-4):211–407, 2014.
178
+
179
+ Vitaly Feldman. Does learning require memorization? A short tale about a long tail. In STOC, 2020.
180
+
181
+ Vitaly Feldman and Chiyuan Zhang. What neural networks memorize and why: Discovering the long tail via influence estimation. In Advances in Neural Information Processing Systems, 2020.
182
+
183
+ Mandy Guo, Zihang Dai, Denny Vrandecic, and Rami Al-Rfou. Wiki-40b: Multilingual language model dataset. In LREC 2020, 2020.
184
+
185
+ Frank R Hampel. The influence curve and its role in robust estimation. Journal of the american statistical association, 69(346):383–393, 1974.
186
+
187
+ Jonathan Heek, Anselm Levskaya, Avital Oliver, Marvin Ritter, Bertrand Rondepierre, Andreas Steiner, and Marc van Zee. Flax: A neural network library and ecosystem for JAX, 2020. URL http://github.com/google/flax.
188
+
189
+ Peter Henderson, Koustuv Sinha, Nicolas Angelard-Gontier, Nan Rosemary Ke, Genevieve Fried, Ryan Lowe, and Joelle Pineau. Ethical challenges in data-driven dialogue systems, 2017.
190
+
191
+ Andrew Ilyas, Sung Min Park, Logan Engstrom, Guillaume Leclerc, and Aleksander Madry. Datamodels: Predicting predictions from training data. arXiv preprint arXiv:2202.00622, 2022.
192
+
193
+ Matthew Jagielski, Jonathan Ullman, and Alina Oprea. Auditing differentially private machine learning: How private is private sgd?, 2020.
194
+
195
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In The International Conference for Learning Representations, 2015.
196
+
197
+ Pang Wei Koh and Percy Liang. Understanding black-box predictions via influence functions. ArXiv, abs/1703.04730, 2017.
198
+
199
+ Pang Wei Koh, Kai-Siang Ang, Hubert Hua Kian Teo, and Percy Liang. On the accuracy of influence functions for measuring group effects. In NeurIPS, 2019.
200
+
201
+ Katherine Lee, Daphne Ippolito, Andrew Nystrom, Chiyuan Zhang, Douglas Eck, Chris CallisonBurch, and Nicholas Carlini. Deduplicating training data makes language models better. CoRR, abs/2107.06499, 2021. URL https://arxiv.org/abs/2107.06499.
202
+
203
+ Yunhui Long, Lei Wang, Diyue Bu, Vincent Bindschaedler, Xiaofeng Wang, Haixu Tang, Carl A Gunter, and Kai Chen. A pragmatic approach to membership inferences on machine learning models. In 2020 IEEE European Symposium on Security and Privacy (EuroS&P), pp. 521–534. IEEE, 2020.
204
+
205
+ Sayan Mukherjee, Partha Niyogi, Tomaso Poggio, and Ryan Rifkin. Learning theory: stability is sufficient for generalization and necessary and sufficient for consistency of empirical risk minimization. Advances in Computational Mathematics, 25(1):161–193, 2006.
206
+
207
+ Milad Nasr, Shuang Song, Abhradeep Thakurta, Nicolas Papernot, and Nicholas Carlini. Adversary instantiation: Lower bounds for differentially private machine learning, 2021.
208
+
209
+ Garima Pruthi, Frederick Liu, Mukund Sundararajan, and Satyen Kale. Estimating training data influence by tracking gradient descent. ArXiv, abs/2002.08484, 2020.
210
+
211
+ 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, 2020a. URL http://jmlr.org/papers/v21/20-074.html.
212
+
213
+ 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, 2020b. URL http://jmlr.org/papers/v21/20-074.html.
214
+
215
+ Vikas Raunak, Arul Menezes, and Marcin Junczys-Dowmunt. The curious case of hallucinations in neural machine translation. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 1172–1183, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.naacl-main. 92. URL https://aclanthology.org/2021.naacl-main.92.
216
+
217
+ Alexandre Sablayrolles, Matthijs Douze, Yann Ollivier, Cordelia Schmid, and Herve J ´ egou. White- ´ box vs black-box: Bayes optimal strategies for membership inference, 2019.
218
+
219
+ Reza Shokri, Marco Stronati, Congzheng Song, and Vitaly Shmatikov. Membership inference attacks against machine learning models. In 2017 IEEE Symposium on Security and Privacy (SP), pp. 3–18. IEEE, 2017.
220
+
221
+ Larry R Squire. Memory and the hippocampus: a synthesis from findings with rats, monkeys, and humans. Psychological review, 99(2):195, 1992.
222
+
223
+ Om Thakkar, Swaroop Ramaswamy, Rajiv Mathews, and Franc¸oise Beaufays. Understanding unintended memorization in federated learning, 2020.
224
+
225
+ Aleena Thomas, David Ifeoluwa Adelani, Ali Davody, Aditya Mogadala, and Dietrich Klakow. Investigating the impact of pre-trained word embeddings on memorization in neural networks. In International Conference on Text, Speech, and Dialogue, pp. 273–281. Springer, 2020.
226
+
227
+ Endel Tulving. Elements of episodic memory. Oxford University Press, 1983. ISBN 9780198521259.
228
+
229
+ 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.
230
+
231
+ Tianhao Wang and Ruoxi Jia. Data banzhaf: A data valuation framework with maximal robustness to learning stochasticity. arXiv preprint arXiv:2205.15466, 2022.
232
+
233
+ Santiago Zanella-Beguelin, Lukas Wutschitz, Shruti Tople, Victor R ´ uhle, Andrew Paverd, Olga ¨ Ohrimenko, Boris Kopf, and Marc Brockschmidt. Analyzing information leakage of updates to ¨ natural language models. Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security, Oct 2020. doi: 10.1145/3372297.3417880. URL http://dx.doi.org/ 10.1145/3372297.3417880.
234
+
235
+ Rowan Zellers, Ari Holtzman, Hannah Rashkin, Yonatan Bisk, Ali Farhadi, Franziska Roesner, and Yejin Choi. Defending against neural fake news. In Advances in Neural Information Processing Systems, 2019.
236
+
237
+ Albert Ziegler. GitHub Copilot: Parrot or crow? https://docs.github.com/en/github/copilot/researchrecitation, 2021.
238
+
239
+ # A EXTENDED RELATED WORK
240
+
241
+ The relation to previous work are briefly explained in the Introduction and Section B. In this section, we present an extended discussion. Previous work analyzed the memorization of large language models on sensitive information (e.g. phone numbers) in the training data (Carlini et al., 2020; Ziegler, 2021) or synthetically injected “canaries” (Carlini et al., 2019; Henderson et al., 2017; Thakkar et al., 2020; Thomas et al., 2020). However, not all the memorized texts are equally interesting — as confirmed in a later study (Lee et al., 2021), near-duplicated training examples are very common in standard text corpus, and those commonly occurring phrases contribute significantly to memorized texts. In order to distinguish “common” memorization of common phrases or public knowledge from “rare” memorization of private, rare information, various heuristics were adopted in previous investigations. Our paper proposed a principled perspective towards this problem. Our intuition comes from psychologies studies that categorize human (declarative) memory into episodic memory (Tulving, 1983) of specific contents of individual events, and semantic memory (Squire, 1992) about general knowledge like grammars and factual information. We would like the models to obtain semantic memory but avoid episodic memory. The capture the latter, we proposed a notion of counterfactual memorization. The mathematical formulation of counterfactual memorization is borrowed from a notion of label memorization in Feldman (2020) and adapted to the context of neural LMs in this paper. This formulation has been studied empirically in the context of computer vision in Feldman & Zhang (2020). In a follow up work, Ilyas et al. (2022) showed that it is possible to fit a datamodel to predict the outcome of training a model on a specific training subset and evaluating on a specific input. However, this procedure requires training a massive number of models (e.g. 300,000 for CIFAR-10) on random subsets of the training data, thus is computationally infeasible for the scale of language models considered here.
242
+
243
+ The general idea of measuring model behavior on held-out training data is common in machine learning. In cross validation, held-out data is used to estimate the test performance for model selection; in learning theory, leave-one-out stability was shown to be deeply connected to generalization (e.g. Mukherjee et al., 2006); in differential privacy, the worst case performance difference of models trained on two “neighboring” datasets (identical except a single example being held-out or replaced) quantifies the privacy guarantee of a learning algorithm (Dwork et al., 2014; Nasr et al., 2021; Jagielski et al., 2020). Most previous work aimed for an overall measurement, while our paper focused on characterizing the behaviors of individual examples.
244
+
245
+ We estimated a counterfactual influence to study how a memorized training example impact the model prediction at test time. Influence functions have been used in statistics to assess robust estimators since Hampel (1974). Previous papers adopted it to analyze neural network predictions (Koh & Liang, 2017; Koh et al., 2019). However, the estimation was found to be computational expensive and fragile (Basu et al., 2021). Pruthi et al. (2020) tracks the gradient updates during training to estimate the influence from a training example; Feldman (2020); Feldman & Zhang (2020) use aggregated statistics from multiple models independently trained on heldout data subsets to estimate the influence. Further extensions were shown to work well on detecting mislabeled data in classification problems (Wang & Jia, 2022) and characterizing hallucinations in Neural Machine Translation (Raunak et al., 2021). We adapt the approach from Feldman (2020), and formulate counterfactual influence directly with subset sampling, as oppose to leave-one-out influence. We also extend the estimation to assess the influence on generated examples.
246
+
247
+ # B DIFFERENCE BETWEEN COUNTERFACTUAL AND GENERATION-TIME MEMORIZATION
248
+
249
+ Many definitions of memorization operate at generation-time: a sequence of generated text is marked as memorized if a sufficient amount of overlap is found in the training dataset (Carlini et al., 2020). When the training data is not available, heuristic-based methods comparing language model perplexities are used to predict whether a generation contains memorized content (Carlini et al., 2019; Thakkar et al., 2020; Thomas et al., 2020; Carlini et al., 2020; Zanella-Beguelin et al., ´ 2020). One difficulty with these approaches is that generation-time instances of memorization are strongly correlated with the number of similar or near-duplicate examples in the training set. As observed in Lee et al. (2021), large clusters of near-duplicated examples do exist in common language datasets, dominating memorization detected in generated text. Generation-time methods for measuring memorization are forced to design heuristics to avoid simply identifying these uninteresting instances of memorization.
250
+
251
+ ![](images/d6b7cd073c36cced687e1b21716ff01f115b0679cd55f5f11cf402afd0e9471a.jpg)
252
+ Figure 7: Per-token accuracy of training examples evaluated on IN models vs OUT models.
253
+
254
+ In contrast, the counterfactual memorization we study in this paper handles the issue of near-duplicates automatically without the need for heuristics. For a training example, $x$ , with many near-duplicate copies in the training set, $\mathsf { m e m } ( x )$ will be small (because other samples $x ^ { \prime } \approx x$ will be present in the training dataset whether or not $x$ is). This does not mean that counterfactual memorization is the opposite of generation-time memorization. An example, $x$ , with high $\mathsf { m e m } ( x )$ may have a high chance of being generated if a model is appropriately prompted, despite and possibly because it is rare, and thus the example is considered memorized by both definitions. In summary, generationtime memorization measures the chance a model will directly copy from training examples, while counterfactual memorization aims to discover rare information that is memorized.
255
+
256
+ # C AVERAGE ACCURACY OF IN MODELS VS OUT MODELS
257
+
258
+ Figure 7 compares the per-token accuracy between the IN models and OUT models for the training examples from three different datasets. Counterfactual memorization is estimated by taking the difference between the average IN-accuracy and the average OUT-accuracy. Thus, the examples closer to the upper left corner are more counterfactually memorized, while the examples near the diagonal are not.
259
+
260
+ ![](images/88af36f51f2a789b51f61e55f1647eb17fccb379ffd89c6aa6c014ee08c03929.jpg)
261
+ Figure 8: The joint distribution of memorization and simplicity. The histograms are plotted in log scale to better visualize the tail of the distributions.
262
+
263
+ # D THE IMPACT OF DATA DEDUPLICATION ON MEMORIZATION
264
+
265
+ To investigate the impact of data deduplication on counterfactual memorization, we compared C4 with C4-NEARDUP (Lee et al., 2021), which is derived from C4 with deduplication using approximate document matching. Figure 8 compares the distribution of memorization between the original C4 and the deuplicated dataset. We did not find significant difference between the two datasets. One potential reason is that the deduplication criterion was relatively conservative, which removed only $\sim 3 \%$ of the training examples. In fact, we can still easily see near duplicate examples in C4-NEARDUP among examples with low memorization, as shown below:
266
+
267
+ Example 1380925 $\mathsf { m e m } = 0 . 0 3 7 4$ ) link $\vartriangleright$ This is a placeholder page for Joshua Baldridge, which means this person is not currently on this site. We do suggest using the tools below to find Joshua Baldridge. You are visiting the placeholder page for Joshua Baldridge. This page is here because someone used our placeholder utility to look for Joshua Baldridge. We created this page automatically in hopes Joshua Baldridge would find it. If you are not Joshua Baldridge, but are an alumni of Brecksville Broadview Heights High School, register on this site for free now.
268
+
269
+ Example 2048352 $\mathrm { { ( m e m = 0 . 0 3 2 0 ) } }$ ) link $\vartriangleright$ This is a placeholder page for Laytoya Brannon, which means this person is not currently on this site. We do suggest using the tools below to find Laytoya Brannon. You are visiting the placeholder page for Laytoya Brannon. This page is here because someone used our placeholder utility to look for Laytoya Brannon. We created this page automatically in hopes Laytoya Brannon would find it. If you are not Laytoya Brannon, but are an alumni of Mainland High School, register on this site for free now.
270
+
271
+ Example 1314053 $\mathsf { m e m } = 0 . 0 2 7 8$ ) link $\vartriangleright$ This is a placeholder page for Devin Mcguire, which means this person is not currently on this site. We do suggest using the tools below to find Devin Mcguire. You are visiting the placeholder page for Devin Mcguire. This page is here because someone used our placeholder utility to look for Devin Mcguire. We created this page automatically in hopes Devin Mcguire would find it. If you are not Devin Mcguire, but are an alumni of Kankakee Valley High School, register on this site for free now.
272
+
273
+ Example 1085524 $\mathrm { { ( m e m = 0 . 0 2 0 9 } }$ ) link $\vartriangleright$ This is a placeholder page for Anthony Christie, which means this person is not currently on this site. We do suggest using the tools below to find Anthony Christie. You are visiting the placeholder page for Anthony Christie. This page is here because someone used our placeholder utility to look for Anthony Christie. We created this page automatically in hopes Anthony Christie would find it. If you are not Anthony Christie, but are an alumni of Old Bridge High School, register on this site for free now.
274
+
275
+ Measurements of the edit distances show that they are near the boundary of the deduplication threshold chosen in Lee et al. (2021). On the other hand, the tail of the distribution — examples with high counterfactual memorization are mostly unaffected by text deduplication.
276
+
277
+ # E VARIANCE OF MEMORIZATION SCORES
278
+
279
+ In Figure 9, we measure the Spearman’s R between our total set of 400 models and an $m$ model subset. As expected, as $m$ increases, so does Spearman’s R—in particular, at 192 models, the Spearman’s R is at least $9 9 . 2 \%$ for all datasets, and increasing $m$ already appears to have diminishing returns.
280
+
281
+ Using the same partitioning into size $m$ sets of models, we analyze the variance of memorization scores assigned to each sample. To do this, within each partition, we compute the memorization score assigned to each sample. We then compute the standard deviation of all partitions’ memorization scores for each sample. In Figure 10, we plot each sample’s standard deviation — in all, this demonstrates the distribution of the variance of memorization scores. We find that the variance decreases substantially as $m$ grows, and concentrates near 0 already with $m = 1 9 2$ , for all datasets.
282
+
283
+ ![](images/26aea76ca290743149e4ad00fe5e4f81eae37dfbec2235921ed21f52db8b6d5b.jpg)
284
+ Figure 9: Spearman’s R between memorization rankings from a set of $m$ models and our full set of 400 models. As more models are trained, the ranking changes very little, with the ranking at 192 models having a Spearman’s R of at least 0.992 on all datasets.
285
+
286
+ ![](images/75216c5c1c0bd5522585baf1a1e5e6f109b3b50f07d723ef47321e9451100a1c.jpg)
287
+ Figure 10: The variance in memorization scores decreases significantly as the number of models increases for all 3 datasets.
288
+
289
+ # F HISTOGRAM OF MAX-INFLUENCE ON GENERATED TEXTS
290
+
291
+ Figure 11 shows the histogram of max-influence on each generated example by Grover-Mega $\scriptstyle \left( \mathrm { p } = 0 . 9 6 \right)$ (Zellers et al., 2019), from the RealNews training examples. Those generated examples are publicly released at https://github.com/rowanz/grover/tree/master/generation examples.
292
+
293
+ # G MISCELLANEOUS EXPERIMENT DETAILS
294
+
295
+ Our experiments are implemented using JAX (Bradbury et al., 2018) and Flax (Heek et al., 2020), both open sourced library under the Apache-2.0 license. In the study of influence on generated texts, we use the publicly released generations from the Grover models (Zellers et al., 2019), available at their open source code repository, under the Apache-2.0 license.
296
+
297
+ ![](images/342278db852936d78838bbbd9f3bb6b043c253c136e24f3361bd9c0672597eae.jpg)
298
+ Figure 11: Histogram of max-influence on each generated example by Grover-Mega $\scriptstyle ( \mathtt { p } = 0 . 9 6$ ), from the RealNews training examples.
299
+
300
+ ![](images/373182d507c1b0ceb6e156f7e66b669279d775b7b015e505f906a6dfe1086a33.jpg)
301
+ Figure 12: Comparison of hash based subset sampling with numpy.random.choice.
302
+
303
+ We run the experiments using our internal cluster. The majority of the compute is consumed by model training. In this paper, we use standard training setup for transformer based neural language models, which could run on single node machines with one or multiple GPUs. However, to carry out the full analysis, we need to train 400 different models for each of the three datasets analyzed in this paper.
304
+
305
+ # H SUBSAMPLING PROCEDURE
306
+
307
+ In the estimation of memorization and influence, we trained 400 models each on an independent random subset of training examples. We use Tensorflow Datasets (TFDS) 2 to load our training data. TFDS supports loading a continuous range of examples, but does not support subset loading from a list of indices of individual examples. The API has a filter function which allows us to provide a Tensorflow predicate to precisely control the subset loading. However, a naive implementation of checking whether the index of the current example is in a given list of subset indices is very slow and scales poorly with the subset size.
308
+
309
+ To mitigate the issue, we implemented a hash based subset sampling predicate that can be evaluated efficiently for each example, and (approximately) select a random subset of a specified size. Let $N$ be the total number of training examples, $n < N$ be the expected subset size. The idea is to map the index $i$ of each example to $N / n$ hash buckets, and select all the examples that fall into one particular bucket. To make sure each model gets an independent subset sampling, we need to use different hash functions for different models. In our implementation, we compose a known hash function for uint64 types with a simple pseudo number based on the index of the current model to achieve this. Note the subset size sampled is close to $n$ but is not guaranteed to be exactly $n$ . But this is not a problem in our settings. The specific implementation is shown below:
310
+
311
+ def hash_sampler(mod, seed, system): """Get hash based subset sampler.
312
+
313
+ mod: total_n_egs // subset_size
314
+ seed: different seed leads to different subset sample system: 'np' or 'tf'.
315
+ Returns: A Tensorflow or Numpy subset sampler.
316
+ ==
317
+ np_hash $=$ hash_uint64_builder('np')
318
+ mul, offset, remainder $=$ np_hash(seed $^ +$ 1234 + np.arange(3))
319
+ remainder $=$ remainder % mod
320
+
321
+ if system $= =$ 'np': def np_sampler(n_total): $\mathrm { ~ \bf ~ { ~ x ~ } ~ } =$ np.arange(n_total, dtype=np.uint64) return np_hash(x\*mul $^ +$ offset) $\%$ mod $= =$ remainder
322
+
323
+ return np_sampler elif system $= =$ 'tf': tf_hash $=$ hash_uint64_builder('tf') def tf_filter(idx, _): return tf.equal(tf_hash(idx\*mul $^ +$ offset) % mod, remainder) return tf_filter raise KeyError(f'Unknown system: {system}')
324
+
325
+ def hash_uint64_builder(system): """Build a hash function in tf/np for uint64.""" if system $\ d = \ d \cdot \mathsf { n p } ^ { \prime }$ : uint64_cast $=$ functools.partial(np.array, dtype=np.uint64) op_xor $=$ operator.xor op_rshift $=$ operator.rshift elif system $= =$ 'tf': uint64_cast $=$ functools.partial(tf.cast, dtype $=$ tf.uint64) op_xor $=$ tf.bitwise.bitwise_xor op_rshift $=$ tf.bitwise.right_shift else: raise KeyError(f'Unknown system: {system}')
326
+
327
+ # https://stackoverflow.com/questions/664014/
328
+ # what-integer-hash-function-are-good-that-accepts-an-integer-hash-key
329
+ def hash_uint64(x): $\times \ =$ uint64_cast(x) $\times \ =$ op_xor(x, op_rshift(x, 30)) $\star$ uint64_cast(0xbf58476d1ce4e5b9) x = op_xor(x, op_rshift(x, 27)) $\star$ uint64_cast(0x94d049bb133111eb) x = op_xor(x, op_rshift(x, 31)) return x
330
+
331
+ return hash_uint64
332
+
333
+ In Figure 12, we compare our hash-based subset sampler with numpy.random.choice(N, size=n, replace $=$ False). The leftmost section of the figure shows that the sampling procedure always samples close to $n$ points, with a small variance. The middle section plots a histogram of the empirical fraction of total models that each point appears in. Note that, because we use $r = 0 . 2 5$ , this fraction should be 0.25 on average, although, because we only use 400 models, each value will not be identically 0.25. We find that our hash-based sampler produces probabilities which are highly consistent with those produced by numpy.random.choice. We also measure the pairwise independence of the hash-based sampler, measuring the probability that two different training points $x _ { 1 } , x _ { 2 }$ appear both IN or OUT of a model’s training set. We expect this value to be 0.625 $\bar { ( } = r ^ { 2 } + ( 1 - r ) ^ { \bar { 2 } } )$ . We plot this in the right portion of the figure, demonstrating that the independence of our hash-based sampler is very similar to numpy.random.choice.
334
+
335
+ # I ALTERNATIVE MEMORIZATION METRICS WITH LOGIT SCALING
336
+
337
+ We defined the counterfactual memorization in equation 1 with a generic performance measure $M$ . Throughout the paper, we define $M$ as per-token accuracy–the fraction of the times the model assigns the highest score to the true next token in the sequence. The finite value range could cause unnecessary compression for values near the interval boundary. As a result, the resolution of memorization estimation is lower for models with very high or very low performance. To mitigate this issue, we explore an alternative measure by taking the logit on the per-token accuracy (Carlini et al., 2021). The logit function maps to $( - \infty , \infty )$ before aggregating across independently trained models. Figure 13 compares the scatter plots of average performance on IN / OUT models measured by the logit scaled per-token accuracy and the raw per-token accuracy. Comparing to the raw pertoken accuracy, the scatter plots generated with the logit scaled measure are no longer artificially constrained to be a triangular shape. As a result, the memorization estimation, which is proportional to the distance to the diagonal line, has a higher resolution on the two ends (lower left and upper right) than the unscaled version.
338
+
339
+ ![](images/8fee35af3e4ac36edc9aecb7576a8e4300e3b6c85ed902916de6fbdd7405317d.jpg)
340
+ Figure 13: Comparison of directly using the per-token-accuracy vs. taking the logit of the per-tokenaccuracy. Top row: logit(per-token-accuracy). Bottom row: per-token-accuracy. Figures exactly the same as Figure 7.
341
+
342
+ Note there is no absolutely right or wrong measure. While the scaled version has better resolution on the two ends, the advantage of the unscaled version is that the value range $[ 0 , 1 ]$ makes it straightforward to interpret the numerical values of counterfactual memorization. Since the consistency between the two versions are high (Spearman’s $\rho$ correlation between the two versions are $0 . 9 4 7 \mathrm { ~ / ~ } 0 . 9 0 3 \mathrm { ~ / ~ }$ 0.944 on RealNews/ C4/ Wiki40B:en), we use the unscaled version throughout the paper for easier interpretation.
343
+
344
+ # J EXAMPLES SAMPLED AT DIFFERENT LEVEL OF MEMORIZATION
345
+
346
+ Figure 14, Figure 15, and Figure 16 show full examples from RealNews sampled at high, middle and low memorization value ranges, respectively. Similarly, Figure 17, Figure 18, and Figure 19 show examples from C4 sampled at high, middle and low memorization value ranges, respectively. Figure 20, Figure 21, and Figure 22 show examples from Wiki40B:en sampled at high, middle and low memorization value ranges, respectively.
347
+
348
+ # K EXAMPLE PAIRS SAMPLED AT DIFFERENT LEVEL OF INFLUENCE
349
+
350
+ Figure 23, Figure 24, Figure 25, Figure 26, and Figure 27 show train-validation example pairs from RealNews sampled from high to low influence ranges. For each pair, we show the validation set example first, and then show the corresponding training example with a difflib generated visualization of textual difference with the training example.
351
+
352
+ Similarly, Figure 28 and Figure 29 show train-validation example pairs from C4, and Figure 30 and Figure 31 from Wiki40B:en.
353
+
354
+ We also show train-generation influence pairs between RealNews training set and Grover (Zellers et al., 2019) model generation in Figure 32, Figure 33, and Figure 34.
355
+
356
+ ![](images/e15e769a7bd49107e412d462036b4ae5bf4110bfcea584a3cdb079ab3a8de8ee.jpg)
357
+ Figure 14: Text examples from RealNews with high memorization.
358
+
359
+ ![](images/43c2374b7687824149c79dc39eb22990dccb270f4be29b10122eb935c66302dc.jpg)
360
+ Figure 15: Text examples from RealNews with intermediate memorization.
361
+
362
+ ![](images/92cbcfcf80563200e46d9f07ac9b558bb3b0643a222cc96602f3237157cb0fc3.jpg)
363
+ Figure 16: Text examples from RealNews with low memorization.
364
+
365
+ ![](images/85972ec483bb0953974be8475d489973e7f59eed25e630b28c13484c01d6c70d.jpg)
366
+ Figure 17: Text examples from C4 with high memorization.
367
+
368
+ ![](images/647302d692e929d3a2f71ca51f748f47a66af90a270eb0d52a2262375dd8c802.jpg)
369
+ Figure 18: Text examples from C4 with intermediate memorization.
370
+
371
+ ![](images/f6de3023dc141f076e16a2386a8c05d5939ad501b682ff99aa134edb643ebc13.jpg)
372
+
373
+ Figure 19: Text examples from C4 with low memorization.
374
+
375
+ ![](images/25cb3b93c4769762ec5568f65fe9d5033b7d16f29ba2e204e40a9cd3b2a0e55a.jpg)
376
+ Figure 20: Text examples from Wiki40B:en with high memorization.
377
+
378
+ ![](images/19ede8206739c88aa65d83e0ff78d82143ddafe00f8ec07a7eb420d8d8e93738.jpg)
379
+ Figure 21: Text examples from Wiki40B:en with intermediate memorization.
380
+
381
+ ![](images/11cf9ecbc5d9b7768cbc140af953da9233953bec17583f2c32663ea691358ba9.jpg)
382
+ Figure 22: Text examples from Wiki40B:en with low memorization.
383
+
384
+ ![](images/75089a072b60472742cb48595f2ce20ee7f9e30f33b55760fb81bf1f2f71430a.jpg)
385
+ Figure 23: Validation / training example pair from RealNews with high influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
386
+
387
+ ![](images/f761da1e56899bfe58dcce89787abbcb8d84f846258c670a3be0a87c1740cd75.jpg)
388
+ Figure 24: Validation / training example pair from RealNews with relatively high influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
389
+
390
+ ![](images/46f6947275b0177569c905bf0e14a394858e087eeecbd9368e6c12466f323d3e.jpg)
391
+ Figure 25: Validation / training example pair from RealNews with intermediate influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
392
+
393
+ ![](images/0413f3adf2592da123d98b77c35b002a58b73e1383259ae7beaf4ef96fa46fd8.jpg)
394
+ Figure 26: Validation / training example pair from RealNews with relatively low influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
395
+
396
+ ![](images/803201165d3056a1901e9a5b53aead0661b0d203851d3579ef2c6d497a59e0f9.jpg)
397
+ Figure 27: Validation / training example pair from RealNews with low influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
398
+
399
+ ![](images/a053dd50b9c95531fa68e43d382b41c04b1bbf912d9567040cfb5e8c1a2f4cc5.jpg)
400
+ Figure 28: Validation / training example pair from C4 with high to intermediate influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
401
+
402
+ ![](images/d7b4e7b16cf36a6c8a883358966bb4939da75ee32d93fe65cd5c3446f76379ef.jpg)
403
+ Figure 29: Validation / training example pair from C4 with intermediate to low influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
404
+
405
+ ![](images/4477e43dcc9394d7f26cc596d3ad13d385f7a51365dd02e29510c0e0c66225cd.jpg)
406
+ Figure 30: Validation / training example pair from Wiki40B:en with high to intermediate influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
407
+
408
+ ![](images/6889d1a96d4aeab6d9f714b584a696e3860134b2a2eb017873baed1f4c4a8fdd.jpg)
409
+ Figure 31: Validation / training example pair from Wiki40B:en with intermediate to low influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
410
+
411
+ ![](images/ee30293c63e317c713291407b37627b0a1e9db70a8a1ea609b2113697c4cba9a.jpg)
412
+ Figure 32: Generated / training example pair from RealNews with high to intermediate influence. The generated examples are directly taken from publicly released generations of the Grover-Mega $\scriptstyle \left( \mathrm { p } = 0 . 9 6 \right)$ model (Zellers et al., 2019). Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
413
+
414
+ ![](images/cb7a5e4c9f654367d6f35bde2feadef7d059717985d4b12eaa982ae45f0baa8b.jpg)
415
+ Figure 33: Generated / training example pair from RealNews with intermediate to low influence. The generated examples are directly taken from publicly released generations of the Grover-Mega $\scriptstyle \left( \mathrm { p } = 0 . 9 6 \right)$ model (Zellers et al., 2019). Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
416
+
417
+ ![](images/9ff2fe9fe73de467a14ab3828d3b3deefaa34ebb5860845c23ab04c9234be577.jpg)
418
+ Figure 34: Generated / training example pair from RealNews with low influence. The generated examples are directly taken from publicly released generations of the Grover-Mega $\scriptstyle \left( \mathrm { p } = 0 . 9 6 \right)$ model (Zellers et al., 2019). Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
parse/dev/PvOo1sHKzf/PvOo1sHKzf_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/PvOo1sHKzf/PvOo1sHKzf_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/Qg2vi4ZbHM9/Qg2vi4ZbHM9_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/akddwRG6EGi/akddwRG6EGi.md ADDED
@@ -0,0 +1,416 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # High-dimensional Asymptotics of Feature Learning: How One Gradient Step Improves the Representation
2
+
3
+ Jimmy $\mathbf { B a } ^ { 1 }$ , Murat A. Erdogdu1, Taiji Suzuki2, Zhichao Wang3, Denny $\mathbf { W } \mathbf { u } ^ { 1 }$ , Greg Yang4
4
+
5
+ 1University of Toronto and Vector Institute, 2University of Tokyo and RIKEN AIP, 3University of California, San Diego, 4Microsoft Research AI
6
+
7
+ {jba,erdogdu,dennywu}@cs.toronto.edu, taiji@mist.i.u-tokyo.ac.jp, zhw036@ucsd.edu, gregyang@microsoft.com
8
+
9
+ # Abstract
10
+
11
+ We study the first gradient descent step on the first-layer parameters $W$ in a twolayer neural network: √1N a⊤σ(W ⊤x), where W ∈ Rd×N , a ∈ RN $\textstyle { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } ( f ( { \dot { \mathbf { x } } } _ { i } ) - y _ { i } ) ^ { 2 }$ ed, and the training objective is the empiri. In the proportional asymptotic limit where $n , d , N \to \infty$ at the same rate, and an idealized student-teacher setting where the teacher $f ^ { * }$ is a single-index model, we compute the prediction risk of ridge regression on the conjugate kernel after one gradient step on $W$ with learning rate $\eta$ . We consider two scalings of the first step learning rate $\eta$ . For small $\eta$ , we establish a Gaussian equivalence property for the trained feature map, and prove that the learned kernel improves upon the initial random feature model, but cannot defeat the best linear model on the input. Whereas for sufficiently large $\eta$ , we prove that for certain $f ^ { * }$ , the same ridge estimator on trained features can go beyond this “linear regime” and outperform a wide range of (fixed) kernels. Our results demonstrate that even one gradient step can lead to a considerable advantage over random features, and highlight the role of learning rate scaling in the initial phase of training.
12
+
13
+ # 1 Introduction
14
+
15
+ We consider the training of a fully-connected two-layer neural network (NN) with $N$ neurons,
16
+
17
+ $$
18
+ f _ { \mathrm { N N } } ( \pmb x ) = \frac { 1 } { \sqrt { N } } \sum _ { i = 1 } ^ { N } a _ { i } \sigma ( \langle \pmb x , \pmb w _ { i } \rangle ) = \frac { 1 } { \sqrt { N } } \pmb a ^ { \top } \sigma ( \pmb W ^ { \top } \pmb x ) ,
19
+ $$
20
+
21
+ where $\pmb { x } \in \mathbb { R } ^ { d } , \pmb { W } \in \mathbb { R } ^ { d \times N } , \pmb { a } \in \mathbb { R } ^ { N }$ , $\sigma$ is the nonlinear activation function applied entry-wise, and the training objective is to minimize the empirical risk. Our analysis will be made in the proportional asymptotic limit, i.e., the number of training data $n$ , the input dimensionality $d$ , and the number of neurons $N$ jointly tend to infinity. Intuitively, this regime reflects the setting where the network width and data size are comparable, which is consistent with practical choices of model scaling.
22
+
23
+ When the first layer $W$ is fixed and the second layer $\textbf { \em a }$ is optimized, we arrive at a kernel model, where the kernel defined by features $\pmb { x } \mapsto \sigma ( \pmb { W } ^ { \top } \pmb { x } )$ (often called the hidden representation) is referred to as the conjugate kernel (CK) [Nea95]. When $W$ is randomly initialized, this model is an example of the random features (RF) model [RR08], the training and test performance of which has been extensively studied in the proportional limit [LLC18, MM22]. These precise characterizations reveal interesting phenomena also present in practical deep learning [BHMM19].
24
+
25
+ However, RF models do not fully explain the empirical success of NNs: one crucial advantage of deep learning is the ability to learn useful features [GDDM14, DCLT18] that “adapt” to the learning problem [Suz18]. In fact, recent works have shown that such adaptivity enables NNs optimized by gradient descent to outperform a wide range of linear/kernel estimators [AZL19, GMMM19]. While many explanations of this separation have been proposed, our starting point is the empirical finding that “non-kernel” behavior often occurs in the early phase of NN optimization, especially under large learning rates $[ \mathrm { J } \mathrm { S F } ^ { + } 2 0 $ , $\mathrm { F D P } ^ { + } 2 0 ]$ ]. The goal of this work is to answer the following question:
26
+
27
+ Can we precisely capture the emergence of feature learning in the early phase of gradient descent, and demonstrate its improvement over the initial (fixed) kernel in the proportional limit?
28
+
29
+ # 1.1 Contributions
30
+
31
+ Motivated by the above observations, we investigate a simplified scenario of the “early phase” of learning: how the first gradient step on the first-layer parameters $W$ impacts the representation of the two-layer NN (1.1). Specifically, we consider regression with the squared loss (MSE), and a studentteacher setting in the proportional asymptotic limit; we aim to characterize the prediction risk of the kernel ridge regression estimator on top of the first-layer CK feature $\pmb { x } \mapsto \sigma ( \pmb { W } ^ { \top } \pmb { x } )$ , before and after one gradient descent step on the empirical risk (starting from Gaussian initialization).
32
+
33
+ Following prior works on the precise asymptotics of RF regression $[ \mathrm { G L K ^ { + } } 2 0$ , DL20], we focus on the setting where the input $_ { \textbf { \em x } }$ is Gaussian and the teacher $f ^ { * }$ is a single-index model. In this case, the prediction risk of a large class of RF/kernel ridge regression estimators is lower-bounded by the $L ^ { 2 }$ -norm of the “nonlinear” component of the teacher $\| \mathsf { P } _ { > 1 } f ^ { * } \| _ { L ^ { 2 } } ^ { 2 }$ , i.e., they only learn linear functions on the input. After one gradient step on $W$ , we compute the CK ridge estimator using separate training data, and compare its prediction risk against this linear lower bound. Our analysis will be made under two choices of learning rate scalings:
34
+
35
+ • Small lr: $\eta = \Theta ( 1 )$ . In Section 4, we extend the Gaussian Equivalence Theorem (GET) in [HL20] to the updated feature map after one gradient descent step on W with learning rate $\overset { \cdot } { \eta } = \Theta ( 1 )$ ; this allows us to precisely characterize the prediction risk using random matrix theoretical tools. We prove that after one gradient step, the ridge regression estimator on the learned CK features already exhibits nontrivial improvement over the initial RF ridge regression model (see pink curve in Figure 1), but it remains in the “linear regime” and cannot outperform the best linear estimator on the input (black dashed line).
36
+
37
+ ![](images/9ad82a3f45fd7e6b88f6bfefa6ff20b703394e4fe7a63d3ce5d4745b9be8411c.jpg)
38
+ Figure 1: Prediction risk of ridge regression on trained CK features (erf) after one feature learning step. Markers represent empirical simulations and solid curves are predicted asymptotic values; red line indicates $\Theta ( d / n )$ rate.
39
+
40
+ • Large lr: $\eta = \Theta ( \sqrt { N } )$ . In Section 5, we analyze a larger learning rate that coincides with the maximal update parameterization in [YH20]. For certain target functions $f ^ { * }$ , we prove that kernel ridge regression after one feature learning step can achieve lower risk than the lower bound $\| \mathsf { P } _ { > 1 } f ^ { * } \| _ { L ^ { 2 } } ^ { 2 }$ ; thus, it outperforms a wide range of kernel estimators (see purple curve in Figure 1).
41
+
42
+ # 1.2 Related works
43
+
44
+ Asymptotics of kernel regression. Recent works provided precise analysis of RF and kernel models in the proportional limit $[ \mathrm { G L K ^ { + } } 2 0$ , DL20, LCM20, AP20, MM22]. These results typically build upon analyses of the spectrum of kernel matrices, a key ingredient in which is the “linearization” of nonlinear random matrices via Taylor expansion [EK10] or orthogonal polynomials [CS13, PW17].
45
+
46
+ Consequently, a large class of kernel models are essentially linear in the proportional asymptotic limit [LR20, BMR21]. In the case of RF models, a similar property is captured by the Gaussian Equivalence Theorem [GMKZ20, HL20, $\mathrm { G L R } ^ { + } 2 1 ]$ , which roughly states that RF estimators achieve the same prediction risk as a (noisy) linear model. For inputs with unit norm, [GMMM21, MMM21] showed that sample size $n = \Omega ( \dot { d } ^ { 2 } )$ is required to go beyond this “linear” regime. As we will see in certain settings, such a limitation can also be overcome (in the $n \asymp d$ scaling) by training the feature map for one gradient step with a sufficiently large learning rate.
47
+
48
+ Advantage of NNs over fixed kernels. It is well-known that under a specific initialization, the learning dynamics of overparameterized NNs can be described by the neural tangent kernel (NTK) [JGH18]. However, the NTK description essentially “freezes” the model around its initialization [COB19], and thus does not explain the presence of feature learning in NNs [YH20].
49
+
50
+ In fact, various works have shown that deep learning is more powerful than kernel methods in terms of approximation and estimation ability [Bac17, Suz18, IF19, SH20, GMMM20]. Moreover, in some specialized settings, NNs optimized with gradient-based methods can outperform the NTK (or more generally any kernel estimators) in terms of generalization error [AZL19, WLLM19, GMMM19, LMZ20, DM20, SA20, AZL20, RGKZ21, KWLS21, $\mathbf { A B A B } ^ { + } 2 1 ]$ (see [MKAS21, Table 2] for a survey). These results often require a careful analysis of the landscape (e.g., properties of global optimum) or optimization dynamics; in contrast, our goal is to precisely characterize the first gradient step and demonstrate a similar separation.
51
+
52
+ Early phase of NN optimization. Recent empirical studies suggest that properties of the final trained model is strongly influenced by the early stages of optimization [GAS19, LM20, PPVF21], and the NTK evolves most rapidly in the first few epochs $[ \mathrm { F D P } ^ { + } 2 0 ]$ . Large learning rate in the initial steps can impact the conditioning of loss surface $[ \mathrm { J } \mathrm { S } \mathrm { F } ^ { + } 2 0 $ , $\mathbf { C K L } ^ { + } 2 1 ]$ and potentially improve the generalization performance [LWM19, $\mathrm { L B D } ^ { + } 2 0 ]$ . Under structural assumptions on the data, it has been proved that one gradient step with sufficiently large learning rate can drastically decrease the training loss [CLB21], extract task-relevant features [DM20, FCB22], or escape the trivial stationary point at initialization [HCG21]. While these works also highlight the benefit of one feature learning step, to our knowledge this advantage has not been precisely characterized in the proportional regime (where the performance of RF models has been extensively studied).
53
+
54
+ # 2 Problem setup and assumptions
55
+
56
+ Notations. Throughout this paper, $\| \cdot \|$ denotes the $\ell _ { 2 }$ -norm for vectors and the $\ell _ { 2 } \to \ell _ { 2 }$ operator norm for matrices, and $\| \cdot \| _ { F }$ is the Frobenius norm. For matrix $M \in \mathbb { R } ^ { n \times n }$ , $\textstyle \operatorname { t r } ( M ) = { \frac { 1 } { n } } \operatorname { T r } ( M )$ is the normalized trace. $\mathcal { O } _ { d } ( \cdot )$ and $o _ { d } ( \cdot )$ stand for the standard big-O and little-o notations, where the subscript highlights the asymptotic variable; we write $\tilde { \mathcal { O } } ( \cdot )$ when the (poly-)logarithmic factors are ignored. $\mathcal { O } _ { d , \mathbb { P } } ( \cdot )$ (resp. $o _ { d , \mathbb { P } } ( \cdot ) _ { , }$ ) represents big-O (resp. little-o) in probability as $d \to \infty$ . $\Omega ( \cdot ) , \Theta ( \cdot )$ are defined analogously. $\Gamma$ is the standard Gaussian distribution in $\mathbb { R } ^ { d }$ . Given $f : \mathbb { R } ^ { d } \mathbb { R }$ , we denote its $L ^ { p }$ -norm w.r.t. $\Gamma$ as $\| f \| _ { L ^ { p } ( \mathbb { R } ^ { d } , \Gamma ) }$ , which we abbreviate as $\| f \| _ { L ^ { p } }$ when the context is clear.
57
+
58
+ # 2.1 Training procedure
59
+
60
+ Gradient descent on the 1st layer. Given training examples $\{ ( \pmb { x } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ , we learn the two-layer NN (1.1) by minimizing the empirical risk: $\begin{array} { r } { { \mathcal { L } } ( f ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( f ( \pmb { x } _ { i } ) , \overleftarrow { y _ { i } } ) } \end{array}$ , where $\ell$ is the squared loss $\textstyle \ell ( x , y ) = { \frac { 1 } { 2 } } ( x - y ) ^ { 2 }$ . As previously remarked, fixing the first layer $W$ at random initialization and learning the second layer $^ { a }$ yields an RF model, which is a convex problem with closed-form solution. In contrast, we are interested in learning the feature map (representation); hence we first fix $^ { a }$ (at initialization) and perform gradient descent on $W$ . We write the initialized first-layer as $W _ { 0 }$ , and the weights after one gradient step as $W _ { 1 }$ . The gradient update, which we refer to as the feature learning step, with learning rate $\eta$ is given as: $\pmb { W } _ { 1 } = \pmb { W } _ { 0 } + \eta \sqrt { N } \cdot \pmb { G } _ { 0 }$ where
61
+
62
+ $$
63
+ G _ { 0 } : = \frac { 1 } { n } X ^ { \top } \left[ \left( \frac { 1 } { \sqrt { N } } \left( y - \frac { 1 } { \sqrt { N } } \sigma ( X W _ { 0 } ) \pmb { a } \right) \pmb { a } ^ { \top } \right) \odot \sigma ^ { \prime } ( X W _ { 0 } ) \right] ,
64
+ $$
65
+
66
+ in which $\odot$ is the Hadamard product, $\sigma ^ { \prime }$ is the derivative of $\sigma$ (acting entry-wise), and we denoted the input feature matrix √ $\pmb { X } \in \mathbb { R } ^ { n \times d }$ , and the corresponding label vector $\boldsymbol { y } \in \mathbb { R } ^ { n }$ . We remark that the $\sqrt { N }$ -scaling in front of $\eta$ accounts for the $\scriptstyle { \frac { 1 } { \sqrt { N } } }$ -prefactor in our definition of two-layer NN (1.1).
67
+
68
+ Ridge regression for the 2nd layer. After obtaining the updated weights $W _ { 1 }$ , we evaluate the quality of the new CK features by computing the prediction risk of the kernel ridge regression estimator on top of the first-layer representation. Note that if ridge regression is performed on the same data $\boldsymbol { X }$ , then after one feature learning step, $W _ { 1 }$ is no longer independent of $\boldsymbol { X }$ , which significantly complicates the analysis. To circumvent this difficulty, we estimate the regression coefficients $\hat { \textbf { \textit a } }$ using a new set of training data $\{ \tilde { \pmb { x } } _ { i } , \tilde { y } _ { i } \} _ { i = 1 } ^ { n }$ , which for simplicity we assume to have the same size as the original dataset. This can be interpreted as the representation being “pretrained” on separate data before the ridge regression estimator is learned.
69
+
70
+ Denoting the feature matrix on the fresh training set $\{ \tilde { X } , \tilde { y } \}$ as $\begin{array} { r } { \Phi : = \frac { 1 } { \sqrt { N } } \sigma ( \tilde { { X } } W _ { 1 } ) \in \mathbb { R } ^ { n \times N } } \end{array}$ , the CK ridge regression estimator can be obtained by solving $\begin{array} { r } { \hat { \pmb { a } } = \mathrm { a r g m i n } _ { \pmb { a } } \left\{ \frac { 1 } { n } \| \tilde { \pmb { y } } - \pmb { \Phi } \pmb { a } \| ^ { 2 } + \frac { \lambda } { N } \| \pmb { a } \| ^ { 2 } \right\} } \end{array}$ .
71
+
72
+ # 2.2 Student-teacher setting and main assumptions
73
+
74
+ Given a target function (teacher model) $f ^ { * }$ and a learned model $\hat { f }$ , we evaluate the model performance using the prediction risk: $\mathcal { R } ( \hat { f } ) = \mathbb { E } _ { \pmb { x } } ( \hat { f } ( \pmb { x } ) - f ^ { * } ( \pmb { x } ) ) ^ { 2 } = \| \hat { f } - f ^ { * } \| _ { L ^ { 2 } } ^ { 2 }$ , where the expectation is taken over the test data from the same training distribution.
75
+
76
+ We utilize the orthogonal decomposition of the activation function $\sigma$ . Define the coefficients
77
+
78
+ $$
79
+ \mu _ { 0 } = \mathbb { E } [ \sigma ( z ) ] , \quad \mu _ { 1 } = \mathbb { E } [ z \sigma ( z ) ] , \quad \mu _ { 2 } = { \sqrt { \mathbb { E } [ \sigma ( z ) ^ { 2 } ] - \mu _ { 0 } ^ { 2 } - \mu _ { 1 } ^ { 2 } } } , \quad { \mathrm { ~ w h e r e ~ } } z \sim { \mathcal { N } } ( 0 , 1 ) .
80
+ $$
81
+
82
+ This implies $\sigma ( z ) = \mu _ { 0 } + \mu _ { 1 } z + \sigma _ { \bot } ( z )$ , where $\mathbb { E } [ \sigma _ { \perp } ( z ) ] = \mathbb { E } [ z \sigma _ { \perp } ( z ) ] = 0$ , and $\mathbb { E } [ \sigma _ { \perp } ( z ) ^ { 2 } ] = \mu _ { 2 } ^ { 2 }$ .
83
+
84
+ Similarly, for square integrable target function $f ^ { * }$ , we have the orthogonal decomposition
85
+
86
+ $$
87
+ f ^ { * } ( \pmb { x } ) = \mu _ { 0 } ^ { * } + \mu _ { 1 } ^ { * } \langle \pmb { x } , \pmb { \beta } _ { * } \rangle + \pmb { \mathrm { P } } _ { > 1 } f ^ { * } ( \pmb { x } ) , \mu _ { 1 } ^ { * } \pmb { \beta } _ { * } = \mathbb { E } [ \pmb { x } f ^ { * } ( \pmb { x } ) ] ,
88
+ $$
89
+
90
+ where $\mathsf { P } _ { > 1 }$ is the projector orthogonal to constant and linear functions in $L ^ { 2 } ( \mathbb { R } ^ { d } , \Gamma )$ , which implies that ${ \mathbb E } [ \mathsf { P } _ { > 1 } f ^ { * } ( { \pmb x } ) ] = 0 , { \mathbb E } [ { \pmb x } \mathsf { P } _ { > 1 } \bar { f } ^ { * } ( { \pmb x } ) ] = { \mathbf 0 }$ . As $d \to \infty$ , quantities defined in (2.3) satisfy $\| \beta _ { * } \| =$ 1, $\| \mathsf { P } _ { > 1 } f ^ { * } \| _ { L ^ { 2 } } \to \mu _ { 2 } ^ { * }$ , where $\mu _ { 0 } ^ { * } , \mu _ { 1 } ^ { * } , \mu _ { 2 } ^ { * }$ are bounded constants. Intuitively, $\mu _ { 0 } ^ { * } , \mu _ { 1 } ^ { * }$ , and $\mu _ { 2 } ^ { * }$ can be interpreted as the “magnitude” of the constant, linear, and nonlinear components of $f ^ { * }$ , respectively.
91
+
92
+ # Assumption 1.
93
+
94
+ 1. Proportional limit. $n , d , N \to \infty , n / d \to \psi _ { 1 } , N / d \to \psi _ { 2 }$ , where $\psi _ { 1 } , \psi _ { 2 } \in ( 0 , \infty )$ .
95
+
96
+ 2. Gaussian initialization. $\sqrt { d } \cdot [ \boldsymbol { W } _ { 0 } ] _ { i j } \stackrel { \mathrm { i . i . d . } } { \sim } \mathcal { N } ( 0 , 1 ) , ~ \sqrt { N } \cdot [ \boldsymbol { a } ] _ { j } \stackrel { \mathrm { i . i . d . } } { \sim } \mathcal { N } ( 0 , 1 ) , f o r ~ i \in [ d ] , j \in [ N ] .$
97
+
98
+ 3. Normalized activation. The activation function $\sigma$ has $\lambda _ { \sigma }$ -bounded first three derivatives almost surely. In addition, $\sigma$ satisfies $\mu _ { 0 } = 0$ and $\mu _ { 1 } , \mu _ { 2 } \neq 0$ defined in (2.2).
99
+
100
+ 4. Single-index teacher. Labels are generated as $y _ { i } = f ^ { * } ( { \pmb x } _ { i } ) + \varepsilon _ { i }$ , where $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ i.i.d. ∼ $\mathcal { N } ( 0 , \pmb { I } )$ , and $\varepsilon _ { i }$ is i.i.d. sub-Gaussian noise with mean 0 and variance $\sigma _ { \varepsilon } ^ { 2 }$ . The teacher $f ^ { * } ( { \pmb x } ) = \sigma ^ { * } ( \langle { \pmb x } , { \pmb \beta } _ { * } \rangle )$ , where $\beta _ { * } \in \mathbb { R } ^ { d }$ with $\| \beta _ { * } \| = 1$ , and $\sigma ^ { * }$ is Lipschitz with $\mu _ { 0 } ^ { * } = 0 ;$ , $\mu _ { 1 } ^ { * } \neq 0$ as defined in (2.3).
101
+
102
+ Remark. We make the following comments on the above assumptions.
103
+
104
+ • Following [HL20], we assume smooth centered activation to simplify the computation; empirical evidence suggests that similar result holds beyond this condition (e.g. $I L G C ^ { + } 2 I J ,$ . We also expect the Gaussian input assumption may be replaced by weaker orthogonality conditions as in [FW20].
105
+
106
+ • The single-index setting has been extensively studied in the proportional regime $I G L K ^ { + } 2 0$ , DL20, HL20]. However, prior works only considered training the coefficients $\textbf { \em a }$ on top of fixed feature map, and such RF models cannot efficiently learn a single-index $f ^ { * }$ in high dimensions [YS19].
107
+
108
+ Under Assumption 1, a relatively large sample size corresponds to larger $\psi _ { 1 }$ , and a relatively large network width corresponds to larger $\psi _ { 2 }$ . The proportional scaling of $n , d , N$ implies that the model width is not significantly larger than the training set size, in contrast to the polynomial overparameterization often required in NTK analyses [DZPS19], which may be less realistic in practical settings.
109
+
110
+ Importantly, the initialization of our two-layer NN (1.1) resembles the mean-field parameterization [MMN18, CB18]: the second layer is divided by an additional $\sqrt { N }$ -factor compared to the kernel (NTK) scaling — this ensures that $f _ { \mathrm { N N } } ( \pmb { x } ) =$ $o _ { d , \mathbb { P } } ( 1 )$ at initialization and enables feature learning (see [YH20, Corollary 3.10]). As an illustrative example in Figure 2, we plot the gradient descent trajectory of the first-layer parameters $W$ in two coordinates. Observe that under the meanfield parameterization (main figure), the neurons travel away from the initialization and align with the target function (black dashed lines), whereas in the NTK parameterization (subfigure, which omits the $\scriptstyle { \frac { 1 } { \sqrt { N } } }$ -prefactor), the parameters remain close to their initialization and hence do not learn useful features.
111
+
112
+ ![](images/c1730669cc0da6bf1d6a01d1945a29c26816f91380766d4898e0e58a59cbc7dd.jpg)
113
+ Figure 2: 2D visualization of optimization trajectory under mean-field (main) and NTK (subfigure) parameterizations. $f ^ { * }$ consists of two ReLU neurons and the student is a two-layer ReLU neural network. Darker color indicates earlier in training, and vice versa. We set $d = 5 1 2$ , $\psi _ { 1 } = \psi _ { 2 } =$ 10; both models are optimized until training losses are below $1 0 ^ { - 3 }$ .
114
+
115
+ # 3 Preliminary results
116
+
117
+ # 3.1 Lower bound for kernel ridge regression
118
+
119
+ To illustrate the benefits of feature learning, we compare the prediction risk of ridge regression on the trained CK (after one gradient step) against that on the initial RF and fixed kernels. Specifically, given training data $\{ \pmb { x } _ { i } , y _ { i } \} _ { i = 1 } ^ { n }$ , we consider the following classes of kernel models for comparison.
120
+
121
+ • Random features model. We introduce two RF kernels associated with (1.1) at initialization: the conjugate kernel (CK) defined by features $\begin{array} { r } { \phi _ { \mathrm { C K } } ( \pmb { x } ) = \frac { 1 } { \sqrt { N } } \sigma ( \pmb { W } _ { 0 } ^ { \top } \pmb { x } ) \in \mathbb { R } ^ { N } } \end{array}$ , and the neural tangent kernel (NTK) [JGH18] defined by features $\begin{array} { r } { \phi _ { \mathrm { N T K } } ( \pmb { x } ) \overset { \cdot } { = } \frac { 1 } { \sqrt { N d } } \pmb { \mathrm { V e c } } \big ( \pmb { \sigma } ^ { \prime } ( \pmb { W } _ { 0 } ^ { \top } \pmb { x } ) \pmb { x } ^ { \top } \big ) \in \mathbb { R } ^ { N d } } \end{array}$ . Given a feature map $\mathbf { R F } \in \{ \mathbf { C K } , \mathbf { N T K } \}$ , the RF ridge regression estimator can be written as
122
+
123
+ $$
124
+ \hat { f } _ { \mathrm { R F } } ( \boldsymbol { x } ) = \langle \phi _ { \mathrm { R F } } ( \boldsymbol { x } ) , \hat { a } \rangle , \hat { a } = \operatorname * { a r g m i n } _ { a \in \mathbb { R } ^ { N } } \Big \{ \frac { 1 } { n } \sum _ { i = 1 } ^ { n } ( y _ { i } - \langle \phi _ { \mathrm { R F } } ( \boldsymbol { x } _ { i } ) , a \rangle ) ^ { 2 } + \frac { \lambda } { N } \| a \| ^ { 2 } \Big \} .
125
+ $$
126
+
127
+ • Rotation invariant kernel model. Consider the inner-product kernel: $\begin{array} { r } { k ( \pmb { x } , \pmb { y } ) = g \bigg ( \frac { \langle \pmb { x } , \pmb { y } \rangle } { d } \bigg ) } \end{array}$ , and the Euclidean distance kernel: $\scriptstyle k ( { \pmb x } , { \pmb y } ) = g \left( { \frac { \| { \pmb x } - { \pmb y } \| ^ { 2 } } { d } } \right)$ , where $g$ satisfies the smoothness conditions in [EK10]. Denoting the associated RKHS with $\mathcal { H }$ , the kernel ridge estimator is given by
128
+
129
+ $$
130
+ \hat { f } _ { \mathrm { k e r } } = \underset { f \in \mathcal { H } } { \operatorname { a r g m i n } } \left\{ \frac { 1 } { n } \sum _ { i = 1 } ^ { n } ( y _ { i } - f ( x _ { i } ) ) ^ { 2 } + \lambda \Vert f \Vert _ { \mathcal { H } } ^ { 2 } \right\} \Rightarrow \hat { f } _ { \mathrm { k e r } } ( \boldsymbol { x } ) = k ( \boldsymbol { x } , \boldsymbol { X } ) ^ { \top } ( \boldsymbol { K } + \lambda \boldsymbol { I } ) ^ { - 1 } \boldsymbol { y } .
131
+ $$
132
+
133
+ We write the prediction risk of the above kernel estimators as $\mathcal { R } _ { \mathrm { C K } } ( \lambda ) , \mathcal { R } _ { \mathrm { N T K } } ( \lambda ) , \mathcal { R } _ { \mathrm { k e r } } ( \lambda )$ , respectively. The following lower bound on the prediction risk is a simple combination of existing results.
134
+
135
+ Proposition 1 ([HL20, MZ20, BMR21]). Under Assumption $I$ , we have
136
+
137
+ $$
138
+ \operatorname* { i n f } _ { \lambda > 0 } \operatorname* { m i n } \{ \mathcal { R } _ { \mathrm { C K } } ( \lambda ) , \mathcal { R } _ { \mathrm { N T K } } ( \lambda ) , \mathcal { R } _ { \mathrm { k e r } } ( \lambda ) \} \ge \| P _ { > 1 } f ^ { * } \| _ { L ^ { 2 } } ^ { 2 } + o _ { d , \mathbb { P } } ( 1 ) ,
139
+ $$
140
+
141
+ where $P _ { > 1 }$ denotes the projector orthogonal to constant and linear functions in $L ^ { 2 } ( \mathbb { R } ^ { d } , \Gamma )$ .
142
+
143
+ This proposition implies that in the proportional limit, ridge regression on the RF or rotationally invariant kernels defined above does not outperform the best linear estimator on the input – it cannot achieve vanishing risk unless the target function is linear $( \| \mathsf { P } _ { > 1 } f ^ { * } \| _ { L ^ { 2 } } = 0 )$ ). In the following, we compare the prediction risk of the ridge estimator on trained features against this lower bound.
144
+
145
+ # 3.2 Almost rank-1 property of the gradient matrix
146
+
147
+ Before we analyze the prediction risk of the ridge regression estimator on the trained CK, we first need to understand the gradient matrix $G _ { 0 }$ in (2.1). The following proposition shows that the first gradient step on $W$ can be approximated in operator norm by a rank-1 matrix under Assumption 1.
148
+
149
+ Proposition 2. Define $\begin{array} { r } { G _ { 0 } : = \frac { 1 } { \eta \sqrt { N } } ( W _ { 1 } - W _ { 0 } ) } \end{array}$ and a rank-1 matrix $\begin{array} { r } { \pmb { A } : = \frac { \mu _ { 1 } } { n \sqrt { N } } \pmb { X } ^ { \top } \pmb { y } \pmb { a } ^ { \top } } \end{array}$ . Given Assumption $I$ , there exist some constants $c , C > 0$ such that for all large $n , N$ , and $d$ , we have
150
+
151
+ $$
152
+ \| G _ { 0 } - A \| \leq \frac { C \log ^ { 2 } n } { \sqrt { n } } \cdot \| G _ { 0 } \| ,
153
+ $$
154
+
155
+ with probability at least 1 − ne−c log2 n.
156
+
157
+ Scaling of learning rate $\eta$ . Based on the above proposition, we can now specify an appropriate learning rate $\eta$ such that the change in the first-layer weights after one gradient descent step is neither insignificant nor unreasonably large. Assumption 1 implies that, for proportional √ $n , d , N$ , the initial weight matrix satisfies $\| \pmb { W } _ { 0 } \| = \Theta _ { d , \mathbb { P } } ( 1 ) , \| \pmb { W } _ { 0 } \| _ { F } = \Theta _ { d , \mathbb { P } } ( \sqrt { d } )$ , and due to Proposition 2, the first gradient step satisfies $\sqrt { N } \lVert G _ { 0 } \rVert = \Theta _ { d , \mathbb { P } } ( 1 ) , \sqrt { N } \lVert G _ { 0 } \rVert _ { F } = \Theta _ { d , \mathbb { P } } ( 1 )$ .
158
+
159
+ In light of the above scaling, if we write $\eta = \Theta ( N ^ { \alpha } )$ , then $\alpha \geq 0$ is required so that the change in the weight matrix is non-negligible (one may verify that for $\eta = o _ { d } ( 1 )$ , the test performance of kernel ridge regression remains unchanged after one GD step). On the other hand, when $\alpha > 1 / 2$ , the gradient update “overwhelms” the initialized parameters $W _ { 0 }$ , and the preactivation feature $\langle \pmb { x } , \pmb { w } _ { i } \rangle$ in the NN (1.1) becomes unbounded as $N \infty$ . This motivates us to consider the following two egimes of learning rate scaling.
160
+
161
+ In Section 4, we consider small step size $\eta = \Theta ( 1 )$ , which is parallel to common practice in NN optimization1. Whereas in Section 5, we analyze the larger step size $\eta = \Theta ( \sqrt { N } )$ , which resembles the learning rate scaling in the maximal update parameterization in [YH20]; in particular, from Lemma 10 in Appendix B.1, one can easily verify that given data point $\mathbf { \boldsymbol { x } } \sim \mathcal { N } ( \mathbf { \boldsymbol { 0 } } , \mathbf { \boldsymbol { I } } )$ , the change in each coordinate of the feature vector is roughly of the same order as its initialized magnitude, that is, for $i \in [ N ]$ , $\big | \sigma ( W _ { 1 } ^ { \top } \pmb { x } ) - \sigma ( \pmb { W } _ { 0 } ^ { \top } \pmb { x } ) \big | _ { i } \asymp \mathsf { \bar { | } } \bar { \sigma ( \pmb { W } _ { 0 } ^ { \top } \pmb { x } ) \big | _ { i } } = \tilde { \Theta } ( 1 )$ with probability 1 as $N \to \infty$ .
162
+
163
+ # 4 $\eta = \Theta ( 1 )$ : improvement over the initial CK
164
+
165
+ From Proposition 2, we observe that the dominant rank-1 direction in the first-step gradient matrix $G _ { 0 }$ contains information of the teacher model $f ^ { * }$ (through label vector $\textbf { { y } }$ ). Intuitively, this indicates that the learned feature map after one GD step $\mathbf { \boldsymbol { x } } \mapsto \bar { \sigma } ( \mathbf { \boldsymbol { W } } _ { 1 } ^ { \top } \mathbf { \boldsymbol { x } } )$ can “adapt” to $f ^ { * }$ , and hence we may expect the ridge regression estimator on the trained CK to achieve better performance. In this section, we precisely characterize the CK prediction risk under the small learning rate $\eta = \Theta ( 1 )$ . We first introduce the Gaussian equivalence property which will be useful in the risk computation.
166
+
167
+ # 4.1 The Gaussian equivalence property
168
+
169
+ The Gaussian Equivalence Theorem (GET) states that the performance of a nonlinear kernel model is the same as that of a noisy linear model. Specifically, for the ridge regression estimator, define
170
+
171
+ $$
172
+ \begin{array} { r l } & { \mathcal { R } _ { \mathrm { F } } ( \lambda ) = \mathbb { E } _ { { \pmb x } } \big ( \langle \phi _ { \mathrm { F } } ( { \pmb x } ) , \hat { \pmb a } _ { \lambda } \rangle - f ^ { * } ( { \pmb x } ) \big ) ^ { 2 } , } \\ & { \hat { \pmb a } _ { \lambda } = \mathrm { a r g m i n } _ { { \pmb a } } \Big \{ \displaystyle \frac { 1 } { n } \sum _ { i = 1 } ^ { n } ( y _ { i } - \langle \phi _ { \mathrm { F } } ( { \pmb x } _ { i } ) , \pmb a \rangle ) ^ { 2 } + \displaystyle \frac { \lambda } { N } \| \pmb a \| ^ { 2 } \Big \} , } \end{array}
173
+ $$
174
+
175
+ where $\mathrm { ~ F ~ } \in \ \{ \mathrm { C K } , \mathrm { G E } \}$ indicates the choice of feature map, which can be either the nonlinear CK feature $\begin{array} { r } { \phi _ { \mathrm { C K } } ( \pmb { x } ) = \frac { 1 } { \sqrt { N } } \sigma ( \pmb { W } ^ { \top } \pmb { x } ) } \end{array}$ , or the linear Gaussian equivalent (GE) feature $\phi _ { \mathrm { G E } } ( \pmb { x } ) =$ $\begin{array} { r } { \frac { 1 } { \sqrt { N } } \left( \mu _ { 1 } \pmb { W } ^ { \top } \pmb { x } + \mu _ { 2 } \pmb { z } \right) } \end{array}$ where $z \sim \mathcal { N } ( 0 , I )$ is independent of $_ { \textbf { \em x } }$ , $W$ . In the following, for both $\phi _ { \mathrm { C K } }$ and $\phi _ { \mathrm { G E } }$ , we take $W$ to be the updated weight matrix $W _ { 1 }$ after one GD step.
176
+
177
+ The Gaussian equivalence refers to the universality phenomenon $\mathcal { R } _ { \mathrm { C K } } ( \lambda ) \approx \mathcal { R } _ { \mathrm { G E } } ( \lambda )$ . For RF models (3.1), the GET has been rigorously proved in [HL20, MS22, MM22]. Furthermore, $[ \mathrm { G L R ^ { + } } 2 1$ , $\mathrm { L G C } ^ { + } 2 1 ]$ provided empirical evidence that such equivalence holds for more general feature maps, including the representation of certain pretrained NNs (e.g., see $[ \mathrm { L G C ^ { + } } 2 1$ , Figure 4]). Since our setting goes beyond RF models and cannot be covered by the prior results, we establish the GET for our trained feature map under small learning rate.
178
+
179
+ Theorem 3. Suppose that Assumption 1 holds and the activation $\sigma$ is an odd function. If the learning of $W _ { 1 }$ in (2.1) and estimation of $\hat { \pmb { a } } _ { \lambda }$ in (4.1) are performed on independent training data $\boldsymbol { X }$ and $\tilde { \boldsymbol { X } }$ , respectively, then the GET holds after the first-layer weight is trained for one gradient step with learning rate $\eta = \Theta ( 1 )$ ; that is, for the CK feature $\begin{array} { r } { \phi _ { \mathrm { C K } } ( \pmb { x } ) = \frac { 1 } { \sqrt { N } } \sigma ( \pmb { W } _ { 1 } ^ { \top } \pmb { x } ) } \end{array}$ , and $\lambda > 0$ ,
180
+
181
+ $$
182
+ | \mathcal { R } _ { \mathrm { C K } } ( \lambda ) - \mathcal { R } _ { \mathrm { G E } } ( \lambda ) | = o _ { d , \mathbb { P } } ( 1 ) .
183
+ $$
184
+
185
+ This is to say, for learning rate $\eta \ : = \ : \Theta ( 1 )$ , the Gaussian equivalent model provides an accurate description of the prediction risk of CK ridge regression after one feature learning step. The important observation is that even though the trained parameters in $W _ { 1 }$ are no longer i.i.d., the Gaussian equivalence property can still hold when $W _ { 1 } - W _ { 0 }$ remains “small” (in some norm, see (C.3) in Appendix C.1 for details), which entails that the neurons remain nearly orthogonal to one another.
186
+
187
+ Implications of Gaussian equivalence. Under the GET, we can alternatively compute $\mathcal { R } _ { \mathrm { G E } } ( \lambda )$ , the prediction risk of ridge regression on noisy Gaussian features $\phi _ { \mathrm { G E } }$ , which is much easier to analyze. Theorem 3 is empirically validated in Figure 3(a)(b), where we observe an agreement between the experimental values and the analytic predictions2 from Section 4.2. On the other hand, the GET also implies that the kernel estimator is essentially “linear” in high dimensions. For the squared loss, it is straightforward to verify that the Gaussian equivalent model cannot learn the nonlinear component of the target function $\mathsf { P } _ { > 1 } f ^ { * }$ as follows.
188
+
189
+ Fact 4. Under the same assumptions as Theorem 3, $\mathcal { R } _ { \mathrm { G E } } ( \lambda ) \geq \left. P _ { > 1 } f ^ { * } \right. _ { L ^ { 2 } } ^ { 2 }$ for any $\psi _ { 1 } , \psi _ { 2 } , \lambda > 0 .$
190
+
191
+ Hence when $\eta = \Theta ( 1 )$ , even though training the first-layer $W$ for one step can lead to non-trivial improvement over the initial RF model (which we precisely quantify in Section 4.2), the learned CK cannot outperform the best linear model on the input features. In other words, to (possibly) learn a nonlinear $f ^ { * }$ , the trained feature map needs to violate the GET. In the case of one gradient step on $W$ , this amounts to using a sufficiently large step size, which we analyze in Section 5.
192
+
193
+ # 4.2 Precise asymptotics of CK ridge regression
194
+
195
+ Having established the Gaussian equivalence property for the CK ridge estimator after one gradient step with $\eta = \Theta ( 1 )$ , we can now compute the asymptotic prediction risk for the trained kernel and compare with the initialized RF. To quantify the discrepancy in the prediction risk (4.1), we write $\mathcal { R } _ { 0 } ( \bar { \lambda } )$ as the prediction risk of the initialized RF ridge regression estimator (on the feature map $\pmb { x } \mapsto \sigma ( \pmb { W } _ { 0 } ^ { \top } \pmb { x } ) )$ , and $\mathcal { R } _ { 1 } ( \lambda )$ as the prediction risk of the ridge estimator on the trained feature map after one feature learning step $\pmb { x } \mapsto \sigma ( \pmb { W } _ { 1 } ^ { \top } \pmb { x } )$ .
196
+
197
+ Importantly, because of the dependency between the trained weights $W _ { 1 }$ and the teacher model $f ^ { * }$ (due to the gradient update (2.1)), we cannot simply apply a rotation invariance argument (e.g., [MM22, Lemma 9.2]) to remove the dependency on the true parameters $\beta _ { * }$ and reduce the prediction risk to the trace of certain rational functions of the kernel matrix. In other words, knowing the spectrum (or the Stieltjes transform) of the CK is not sufficient for these purposes. Instead, we utilize the GET and the almost rank-1 property of $G _ { 0 }$ in Proposition 2, which, in combination with techniques from operator-valued free probability theory [MS17, AP20], enables us to obtain the asymptotic expression of the difference in the prediction risk before and after one gradient step.
198
+
199
+ Theorem 5. Under the same assumptions as Theorem 3 and $\eta = \Theta ( 1 )$ , we have
200
+
201
+ $$
202
+ \mathcal { R } _ { 0 } ( \lambda ) - \mathcal { R } _ { 1 } ( \lambda ) \overset { \mathbb { P } } { } \delta ( \eta , \lambda , \psi _ { 1 } , \psi _ { 2 } ) \geq 0 ,
203
+ $$
204
+
205
+ where $\delta ( \eta , \lambda , \psi _ { 1 } , \psi _ { 2 } )$ is defined by (C.19) in Appendix C.3. Here, $\delta$ is a non-negative function of $\eta , \lambda , \psi _ { 1 } , \psi _ { 2 } \in ( 0 , + \infty )$ with parameters $\mu _ { 1 } ^ { * } , \mu _ { 1 } , \mu _ { 2 }$ , and it vanishes if and only $i f$ (at least) one of $\mu _ { 1 } ^ { * } , \mu _ { 1 }$ and $\eta$ is equal to zero.
206
+
207
+ Remark. Performance of the initial $R F$ ridge estimator $\mathcal { R } _ { 0 } ( \lambda )$ has been characterized by the prior works $I G L K ^ { + } 2 0$ , MM22]; hence, the precise asymptotics of $\delta$ provided in Theorem 5 allows us to explicitly compute the asymptotic prediction risk of the CK model after one gradient step, i.e. $\mathcal { R } _ { 1 } ( \lambda )$ .
208
+
209
+ Theorem 5 confirms our intuition that training the first-layer parameters improves the CK model, as shown in Figure 3(a)(b). Remarkably, this improvement (when $\delta > 0$ ) holds for any $\psi _ { 1 } , \psi _ { 2 } \in$ $( 0 , \infty )$ , that is, taking one gradient step (with learning rate $\eta = \Theta ( 1 ) )$ is always beneficial, even when the training set size $n$ is small. Moreover, we do not require the student and teacher models to have the same nonlinearity — a non-vanishing decrease in the prediction risk is present as long as $\mu _ { 1 } , \mu _ { 1 } ^ { * } \neq 0$ . On the other hand, the GET also implies an upper bound on the possible improvement: $\delta \leq \bar { \mathcal { R } } _ { 0 } ( \lambda ) - \mu _ { 2 } ^ { * 2 }$ as $n , d , N \to \infty$ ; this is to say, the trained CK remains in the “linear” regime.
210
+
211
+ Fore the details of Theorem 5, see Appendix C.3.2. Additionally, from inspecting the asymptotic risk formulae (C.19), we can arrive at the following characterization of two special cases of interest.
212
+
213
+ • Large sample regime $( \psi _ { 1 } \infty )$ ): $\delta$ is increasing with respect to the learning rate $\eta$ ; that is, taking a larger step results in greater decrease in the prediction risk, as shown in Figure 3(a).
214
+
215
+ • Large width regime $\psi _ { 2 } \infty ,$ ): In this case $\delta 0$ ; thus, the benefit of one-step feature learning (with $\eta = \Theta ( 1 ) _ { . }$ ) becomes less significant as the width increases, as shown in Figure 3(b).
216
+
217
+ ![](images/dffa55939bf41c57569e2cc4bce9d4d6b638b79efa3a3500cb84ffd1f3275cb1.jpg)
218
+ Figure 3: Prediction risk of CK ridge regression on trained features: dots represent empirical simulations $d = 5 1 2$ , averaged over 50 runs) and solid curves are asymptotic predictions; dashed black line corresponds to the kernel lower bound (3.3). (a) $\eta = \Theta ( 1 )$ , $\sigma =$ tanh, $\sigma ^ { * } = { }$ SoftPlus; we set $\psi _ { 2 } = 2$ , $\lambda = 1 0 ^ { - 4 }$ , $\sigma _ { \varepsilon } = 0 . 2 5$ . (b) $\eta = \Theta ( 1 )$ , $\sigma = \operatorname { t a n h }$ , $\sigma ^ { * } = \mathrm { R e L U }$ ; we set $\psi _ { 1 } = 5$ , $\lambda = 1 0 ^ { - 2 }$ , $\sigma _ { \varepsilon } = 0 . 1$ . (c) $\eta = N ^ { \alpha }$ for $\alpha \in [ 0 , 1 / 2 ]$ ; brighter color represents larger step size. We choose $\sigma = \sigma ^ { * } = \operatorname { e r f }$ , $\psi _ { 2 } = 2$ , $\lambda = 1 0 ^ { - 3 }$ , and $\sigma _ { \varepsilon } = 0 . 1$ .
219
+
220
+ # 5 $\eta = \Theta ( \sqrt { N } )$ : improvement over the kernel lower bound
221
+
222
+ In this section, we consider a gradient step with large learning rate $\eta = \Theta ( \sqrt { N } )$ , which matches the asymptotic order of the Frobenius norm of the gradient $G _ { 0 }$ and that of the initialized weight matrix $W _ { 0 }$ . Note that after absorbing the prefactors, this learning rate scaling is analogous to the maximal update parameterization [YH20], which admits a feature learning limit. More specifically, the change in each coordinate of the feature vector $[ { \boldsymbol { \sigma } } ( \mathbf { W } ^ { \top } { \boldsymbol { \mathbf { x } } } ) ] _ { i }$ is $\tilde { \Theta } _ { d , \mathbb { P } } ( \bar { 1 } )$ , which has roughly the same order of magnitude as its value at initialization.
223
+
224
+ Due to the large step size, columns of the updated weight matrix $W _ { 1 }$ are no longer near-orthogonal, which is an important property in existing analyses of the Gaussian equivalence (e.g., see Proposition 13 in Appendix C.1 or [HL20, Equation (66)]). Indeed, we will see that in this regime, the ridge regression estimator on the trained CK features is no longer “linear” and can potentially outperform the kernel lower bound (3.3) in the proportional limit. However, in the absence of GET, it is difficult to derive the precise asymptotics of the CK model. As an alternative, we establish an upper bound on the prediction risk $\bar { \mathcal { R } } _ { 1 } ( \bar { \lambda } )$ , which we then compare against the kernel ridge lower bound.
225
+
226
+ Existence of a “good” solution. Given the trained first-layer weights $W _ { 1 }$ , we first construct a second-layer $\tilde { \mathbf { \alpha } }$ for which the prediction risk can be upper-bounded. For a pair of nonlinearities $( \sigma , \sigma ^ { * } )$ , we introduce a scalar $\tau ^ { * }$ which is the optimum of the following minimization problem:
227
+
228
+ $$
229
+ \tau ^ { * } : = \operatorname* { i n f } _ { \kappa \in \mathbb { R } } \mathbb { E } _ { \xi _ { 1 } } \Big [ \big ( \sigma ^ { * } ( \xi _ { 1 } ) - \mathbb { E } _ { \xi _ { 2 } } \sigma ( \kappa \xi _ { 1 } + \xi _ { 2 } ) \big ) ^ { 2 } \Big ] ,
230
+ $$
231
+
232
+ where $\xi _ { 1 } , \xi _ { 2 } \stackrel { \mathrm { i . i . d . } } { \sim } \mathcal { N } ( 0 , 1 )$ . We write $\kappa ^ { * }$ as an optimal value at which $\tau ^ { * }$ is attained (when $\tau ^ { * }$ is not achieved by a finite $\kappa$ , the same argument holds by introducing a small tolerance factor $\epsilon > 0$ in $\tau ^ { * }$ ; see Appendix D.2). Roughly speaking, $\tau ^ { * }$ approximates the prediction risk of a specific student model which takes the form of an average over a subset of neurons (after one feature learning step). In particular, the first term on the RHS of (5.1) containing $\sigma ^ { * }$ corresponds to the teacher $f ^ { * }$ , and the second term $\mathbb { E } _ { \xi _ { 2 } }$ represents the constructed student model. The following lemma shows that we can find some $\tilde { \mathbf { a } }$ on the trained CK features whose prediction risk is approximately $\tau ^ { * }$ , under the additional assumption that the activation function $\sigma$ is bounded. For more details, see Appendix D.
233
+
234
+ Lemma 6 (Informal). Suppose that Assumption √ $I$ holds and $\sigma$ is bounded. Then, after one gradient step on $W$ with $\eta = \Theta ( \sqrt { N } )$ , there exist some second-layer coefficients $\tilde { \mathbf { a } }$ such that the constructed student model $\begin{array} { r } { \tilde { f } ( \pmb { x } ) = \frac { 1 } { \sqrt { N } } \tilde { \pmb { a } } ^ { \top } \sigma ( \pmb { W } _ { 1 } ^ { \top } \pmb { x } ) } \end{array}$ achieves a prediction risk which is “close” to $\tau ^ { * }$ .
235
+
236
+ It is worth noting that the definition of $\tau ^ { * }$ does not involve the specific value of the learning rate $\eta$ . This is because for any choice of $\eta = \Theta ( \sqrt { N } )$ , due to the Gaussian initialization of $a _ { i }$ , we can find a subset of weights that receive a “good” learning rate (with high probability) such that the corresponding neurons are useful for learning the teacher model. In addition, observe that $\tau ^ { * }$ is a simple Gaussian integral which can be numerically or analytically computed (see Appendix D.2 for more examples). For instance, when $\sigma = \sigma ^ { * } =$ erf, one can easily verify that $\kappa ^ { * } = \sqrt { 3 }$ and $\tau ^ { * } = 0$ .
237
+
238
+ Prediction risk of ridge regression. Since we have established the existence of a “good” student model $\tilde { f }$ that can achieve a prediction risk close to $\tau ^ { * }$ (as defined in (5.1)), in what follows, we prove an upper bound for the prediction risk of the ridge regression estimator on the trained CK features $\mathcal { R } _ { 1 } ( \bar { \lambda } \bar { ) }$ in terms of the scalar $\tau ^ { * }$ . The proof of the following result is shown in Appendix D.3.
239
+
240
+ Theorem 7. Under the same assumptions as Lemma √ $6$ , after one gradient step on $W$ with $\eta =$ $\Theta ( { \sqrt { N } } )$ , there exist constants $C , \psi _ { 1 } ^ { * } > 0$ such that for any $n / d > \psi _ { 1 } ^ { * }$ , the ridge regression estimator (4.1) with regularization parameter $n ^ { \varepsilon - 1 } < N ^ { - 1 } \dot { \lambda } < n ^ { - \varepsilon }$ for some small $\varepsilon > 0$ satisfies
241
+
242
+ $$
243
+ \begin{array} { r } { \mathcal { R } _ { 1 } ( \lambda ) \leq 1 0 \tau ^ { * } + C \Big ( \sqrt { \tau ^ { * } } \cdot \sqrt { \frac { d } { n } } + \frac { d } { n } \Big ) , } \end{array}
244
+ $$
245
+
246
+ with probability 1 as $n , d , N \to \infty$ proportionally.
247
+
248
+ While Theorem 7 does not provide exact expression of the prediction risk, the upper bound still allows us to compare the prediction risk of the CK ridge regression before and after one large gradient step. In particular, if $\left. \mathsf { P } _ { > 1 } f ^ { * } \right. _ { L ^ { 2 } } ^ { 2 } \ge 1 0 \tau ^ { * }$ (the constant 10 is not optimized), we know that the trained CK can outperform the kernel lower bound (3.3) (and also the initialized CK) in the proportional limit, when the ratio $\psi _ { 1 } = n / d$ is sufficiently large. The following corollary provides two examples of this separation (see Figure 3(c)).
249
+
250
+ Corollary 8. Under the same conditions as Theorem 7, there exists a constant $\psi _ { 1 } ^ { * }$ such that for any $\psi _ { 1 } > \psi _ { 1 } ^ { * }$ , the following holds with probability $^ { l }$ when $n , d , N \to \infty$ proportionally:
251
+
252
+ • For $\sigma { = } \sigma ^ { * } { = } \mathrm { e r f }$ , we have $\mathcal { R } _ { 1 } ( \lambda ) { = } \mathcal { O } ( d / n )$ . • For $\sigma = \sigma ^ { * } = \operatorname { t a n h }$ , we have $\mathcal { R } _ { 1 } ( \lambda ) < \| \mathsf { P } _ { > 1 } f ^ { * } \| _ { L ^ { 2 } } ^ { 2 }$
253
+
254
+ In the two examples outlined above, training the features by taking one large gradient step on the first-layer parameters can lead to substantial improvement in the performance of the CK model. In fact, the new ridge regression estimator may outperform a wide range of kernel models as described in Section 3.1, and as shown in Figure 3(c). However, we emphasize that this separation is only present in specific pairs of $( \sigma , \sigma ^ { * } )$ for which the scalar $\tau ^ { * }$ is sufficiently small. In general settings, learning a good representation would likely require a training procedure that takes more than one gradient step (even if $f ^ { * }$ is as simple as a single-index model, see Figure 4(c) in Appendix A.1).
255
+
256
+ # 6 Conclusion
257
+
258
+ We investigated how the conjugate kernel of a two-layer neural network (1.1) benefits from feature learning in an idealized student-teacher setting, where the first-layer parameters $W$ are updated by one gradient descent step on the empirical risk. Based on the approximate low-rank property of the gradient matrix, we quantified the improvement in the prediction risk of conjugate kernel ridge regression under two different scalings of first-step learning rate $\eta$ . To the best of our knowledge, this is the first work that rigorously characterizes the precise asymptotics of kernel models (defined by neural networks) in the presence of feature learning.
259
+
260
+ We outline a few limitations of our current analysis as well as future directions.
261
+
262
+ • Dependence between $W _ { 1 }$ and $\boldsymbol { X }$ . One crucial assumption that we make is that the trained weight matrix $W _ { 1 }$ is independent of the data $\tilde { \boldsymbol X }$ on which the CK is computed. While this does not cover the important scenario where feature learning and kernel evaluation are performed on the same data, our setting is very natural in the analysis of pretrained models or transfer learning, which would be an interesting extension.
263
+
264
+ • Scaling of learning rate. Our findings illustrate that different learning rate scalings such as √ $\eta =$ $\Theta ( 1 )$ and $\eta \ : = \ : \Theta ( \sqrt { N } )$ result in drastically different behavior. One natural question to ask is whether there exists a “phase transition” in between the two regimes that dictates whether the GET holds. Interestingly, [RGKZ21] showed that instead of breaking the near-orthogonality of the weights $W$ (via large gradient step), one can also introduce sufficiently large low-rank shifts to the input $\boldsymbol { X }$ to enable the initial RF model to fit a nonlinear $f ^ { * }$ . Intuitively, this may be due to the “dual” relation of the inputs $\boldsymbol { X }$ and the weights $W$ in the CK model.
265
+
266
+ # Acknowledgement
267
+
268
+ The authors would like to thank (in alphabetical order) Konstantin Donhauser, Zhou Fan, Hong Hu, Masaaki Imaizumi, Ryo Karakida, Bruno Loureiro, Yue M. Lu, Atsushi Nitanda, Sejun Park, Ji Xu, Yiqiao Zhong for discussions and feedback on the manuscript.
269
+
270
+ JB was supported by NSERC Grant [2020-06904], CIFAR AI Chairs program, Google Research Scholar Program and Amazon Research Award. MAE was supported by NSERC Grant [2019- 06167], Connaught New Researcher Award, CIFAR AI Chairs program, and CIFAR AI Catalyst grant. TS was partially supported by JSPS KAKENHI (20H00576) and JST CREST. ZW was supported by NSF Grant DMS-2055340. DW was partially supported by a Borealis AI Fellowship. Part of this work was completed when DW interned at Microsoft Research (hosted by GY).
271
+
272
+ # References
273
+
274
+ $[ \mathrm { A B A B } ^ { + } 2 1 ]$ Emmanuel Abbe, Enric Boix Adsera, Matthew Brennan, Guy Bresler, and Dheeraj Nagaraj, The staircase property: How hierarchical structure can guide deep learning, Advances in Neural Information Processing Systems 34 (2021).
275
+ [ABAM22] Emmanuel Abbe, Enric Boix-Adsera, and Theodor Misiakiewicz, The mergedstaircase property: a necessary and nearly sufficient condition for sgd learning of sparse functions on two-layer neural networks, arXiv preprint arXiv:2202.08658 (2022).
276
+ [Ada15] Radoslaw Adamczak, A note on the hanson-wright inequality for random vectors with dependencies, Electronic Communications in Probability 20 (2015), 1–13.
277
+ $[ \mathrm { A D H ^ { + } } 1 9 ]$ Sanjeev Arora, Simon S Du, Wei Hu, Zhiyuan Li, Russ R Salakhutdinov, and Ruosong Wang, On exact computation with an infinitely wide neural net, Advances in Neural Information Processing Systems 32 (2019).
278
+ [AP20] Ben Adlam and Jeffrey Pennington, The neural tangent kernel in high dimensions: Triple descent and a multi-scale theory of generalization, International Conference on Machine Learning, PMLR, 2020, pp. 74–84.
279
+ [AZL19] Zeyuan Allen-Zhu and Yuanzhi Li, What can resnet learn efficiently, going beyond kernels?, Advances in Neural Information Processing Systems 32 (2019).
280
+ [AZL20] , Backward feature correction: How deep learning performs deep learning, arXiv preprint arXiv:2001.04413 (2020).
281
+ [AZLL19] Zeyuan Allen-Zhu, Yuanzhi Li, and Yingyu Liang, Learning and generalization in overparameterized neural networks, going beyond two layers, Advances in neural information processing systems 32 (2019).
282
+ [Bac17] Francis Bach, Breaking the curse of dimensionality with convex neural networks, The Journal of Machine Learning Research 18 (2017), no. 1, 629–681.
283
+ [Bac23] , Learning theory from first principles, MIT Press, 2023.
284
+ $[ \mathrm { B E S ^ { + } } 2 2 ]$ Jimmy Ba, Murat A Erdogdu, Taiji Suzuki, Zhichao Wang, Denny Wu, and Greg Yang, High-dimensional asymptotics of feature learning in the early phase of neural network training, In Preparation (2022).
285
+ [BHMM19] Mikhail Belkin, Daniel Hsu, Siyuan Ma, and Soumik Mandal, Reconciling modern machine-learning practice and the classical bias–variance trade-off, Proceedings of the National Academy of Sciences 116 (2019), no. 32, 15849–15854.
286
+ [BL20] Yu Bai and Jason D. Lee, Beyond linearization: On quadratic and higher-order approximation of wide neural networks, International Conference on Learning Representations, 2020.
287
+ [BM21] Antoine Bodin and Nicolas Macris, Model, sample, and epoch-wise descents: exact solution of gradient flow in the random feature model, Advances in Neural Information Processing Systems 34 (2021).
288
+ [BMR21] Peter L Bartlett, Andrea Montanari, and Alexander Rakhlin, Deep learning: a statistical viewpoint, Acta numerica 30 (2021), 87–201.
289
+
290
+ Lucas Benigni and Sandrine Pech ´ e,´ Eigenvalue distribution of some nonlinear models of random matrices, Electronic Journal of Probability 26 (2021), 1–37.
291
+
292
+ , Largest eigenvalues of the conjugate kernel of single-layered neural networks, arXiv preprint arXiv:2201.04753 (2022).
293
+
294
+ Zhi-Dong Bai and Jack W Silverstein, No eigenvalues outside the support of the limiting spectral distribution of large-dimensional sample covariance matrices, The Annals of Probability 26 (1998), no. 1, 316–345.
295
+
296
+ Zhidong Bai and Jack W Silverstein, Spectral analysis of large dimensional random matrices, vol. 20, Springer, 2010.
297
+
298
+ Lenaic Chizat and Francis Bach, On the global convergence of gradient descent for over-parameterized models using optimal transport, Advances in neural information processing systems, 2018, pp. 3036–3046.
299
+
300
+ , Implicit bias of gradient descent for wide two-layer neural networks trained with the logistic loss, Conference on Learning Theory, PMLR, 2020, pp. 1305–1338.
301
+
302
+ Lena ´ ¨ıc Chizat, Mean-field langevin dynamics: Exponential convergence and annealing, arXiv preprint arXiv:2202.01009 (2022).
303
+
304
+ Jeremy Cohen, Simran Kaur, Yuanzhi Li, J Zico Kolter, and Ameet Talwalkar, Gradient descent on neural networks typically occurs at the edge of stability, International Conference on Learning Representations, 2021.
305
+
306
+ Niladri S Chatterji, Philip M Long, and Peter L Bartlett, When does gradient descent with logistic loss find interpolating two-layer networks?, Journal of Machine Learning Research 22 (2021), no. 159, 1–48.
307
+
308
+ Lenaic Chizat, Edouard Oyallon, and Francis Bach, On lazy training in differentiable programming, Advances in Neural Information Processing Systems 32 (2019).
309
+
310
+ Xiuyuan Cheng and Amit Singer, The spectrum of random inner-product kernel matrices, Random Matrices: Theory and Applications 2 (2013), no. 04, 1350010.
311
+
312
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova, Bert: Pretraining of deep bidirectional transformers for language understanding, arXiv preprint arXiv:1810.04805 (2018).
313
+
314
+ Ethan Dyer and Guy Gur-Ari, Asymptotics of wide networks from feynman diagrams, International Conference on Learning Representations, 2020.
315
+
316
+ Oussama Dhifallah and Yue M Lu, A precise performance analysis of learning with random features, arXiv preprint arXiv:2008.11904 (2020).
317
+
318
+ Amit Daniely and Eran Malach, Learning parities with neural networks, Advances in Neural Information Processing Systems 33 (2020), 20356–20365.
319
+
320
+ Yen Do and Van Vu, The spectrum of random kernel matrices: universality results for rough and varying kernels, Random Matrices: Theory and Applications 2 (2013), no. 03, 1350005.
321
+
322
+ Edgar Dobriban and Stefan Wager, High-dimensional asymptotics of prediction: Ridge regression and classification, The Annals of Statistics 46 (2018), no. 1, 247– 279.
323
+
324
+ Konstantin Donhauser, Mingqi Wu, and Fanny Yang, How rotational invariance of common kernels prevents generalization in high dimensions, International Conference on Machine Learning, PMLR, 2021, pp. 2804–2814.
325
+
326
+ Simon S. Du, Xiyu Zhai, Barnabas Poczos, and Aarti Singh, Gradient descent provably optimizes over-parameterized neural networks, International Conference on Learning Representations, 2019.
327
+
328
+ Noureddine El Karoui, The spectrum of kernel random matrices, The Annals of Statistics 38 (2010), no. 1, 1–50.
329
+
330
+ On the impact of predictor geometry on the performance on highdimensional ridge-regularized generalized robust regression estimators, Probability Theory and Related Fields 170 (2018), no. 1, 95–175.
331
+
332
+ [FCB22] Spencer Frei, Niladri S Chatterji, and Peter L Bartlett, Random feature amplification: Feature learning and generalization in neural networks, arXiv preprint arXiv:2202.07626 (2022).
333
+ $[ \mathrm { F D P ^ { + } } 2 0 ]$ Stanislav Fort, Gintare Karolina Dziugaite, Mansheej Paul, Sepideh Kharaghani, Daniel M Roy, and Surya Ganguli, Deep learning versus kernel learning: an empirical study of loss landscape geometry and the time evolution of the neural tangent kernel, Advances in Neural Information Processing Systems 33 (2020), 5850–5861.
334
+ [FM19] Zhou Fan and Andrea Montanari, The spectral norm of random inner-product kernel matrices, Probability Theory and Related Fields 173 (2019), no. 1-2, 27–85.
335
+ [FOBS06] Reza Rashidi Far, Tamer Oraby, Wlodzimierz Bryc, and Roland Speicher, Spectra of large block matrices, arXiv preprint cs/0610045 (2006).
336
+ [FW20] Zhou Fan and Zhichao Wang, Spectra of the conjugate kernel and neural tangent kernel for linear-width neural networks, Advances in neural information processing systems 33 (2020), 7710–7721.
337
+ [GAS19] Aditya Sharad Golatkar, Alessandro Achille, and Stefano Soatto, Time matters in regularizing deep networks: Weight decay and data augmentation affect early learning dynamics, matter little near convergence, Advances in Neural Information Processing Systems 32 (2019).
338
+ [GDDM14] Ross Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik, Rich feature hierarchies for accurate object detection and semantic segmentation, Proceedings of the IEEE conference on computer vision and pattern recognition, 2014, pp. 580–587.
339
+ $[ \mathrm { G L K ^ { + } } 2 0 ]$ Federica Gerace, Bruno Loureiro, Florent Krzakala, Marc Mezard, and Lenka Zde-´ borova,´ Generalisation error in learning with random features and the hidden manifold model, International Conference on Machine Learning, PMLR, 2020, pp. 3452– 3462.
340
+ $[ \mathrm { G L R } ^ { + } 2 1 ]$ Sebastian Goldt, Bruno Loureiro, Galen Reeves, Florent Krzakala, Marc Mezard, and ´ Lenka Zdeborova,´ The gaussian equivalence of generative models for learning with shallow neural networks, Proceedings of Machine Learning Research vol 145 (2021), 1–46.
341
+ [GMKZ20] Sebastian Goldt, Marc Mezard, Florent Krzakala, and Lenka Zdeborov ´ a,´ Modeling the influence of data structure on learning in neural networks: The hidden manifold model, Physical Review X 10 (2020), no. 4, 041044.
342
+ [GMMM19] Behrooz Ghorbani, Song Mei, Theodor Misiakiewicz, and Andrea Montanari, Limitations of lazy training of two-layers neural network, Advances in Neural Information Processing Systems 32 (2019).
343
+ [GMMM20] , When do neural networks outperform kernel methods?, Advances in Neural Information Processing Systems 33 (2020), 14820–14830.
344
+ [GMMM21] Linearized two-layers neural networks in high dimension, The Annals of Statistics 49 (2021), no. 2, 1029–1054.
345
+ [GSJW20] Mario Geiger, Stefano Spigler, Arthur Jacot, and Matthieu Wyart, Disentangling feature and lazy training in deep neural networks, Journal of Statistical Mechanics: Theory and Experiment 2020 (2020), no. 11, 113301.
346
+ [HCG21] Karl Hajjar, Lena ´ ¨ıc Chizat, and Christophe Giraud, Training integrable parameterizations of deep neural networks in the infinite-width limit, arXiv preprint arXiv:2110.15596 (2021).
347
+ [HFS07] J William Helton, Reza Rashidi Far, and Roland Speicher, Operator-valued semicircular elements: solving a quadratic matrix equation with positivity constraints, International Mathematics Research Notices 2007 (2007), no. 9, rnm086–rnm086.
348
+ [HL20] Hong Hu and Yue M Lu, Universality laws for high-dimensional learning with random features, arXiv preprint arXiv:2009.07669 (2020).
349
+ [HMS18] J William Helton, Tobias Mai, and Roland Speicher, Applications of realizations (aka linearizations) to free probability, Journal of Functional Analysis 274 (2018), no. 1, 1–79.
350
+ [MS17] James A Mingo and Roland Speicher, Free probability and random matrices, vol. 35, Springer, 2017.
351
+ [MS22] Andrea Montanari and Basil N Saeed, Universality of empirical risk minimization, Conference on Learning Theory, PMLR, 2022, pp. 4310–4312.
352
+ [MZ20] Andrea Montanari and Yiqiao Zhong, The interpolation phase transition in neural networks: Memorization and generalization under lazy training, arXiv preprint arXiv:2007.12826v1 (2020).
353
+ [Nea95] Radford M Neal, Bayesian learning for neural networks, vol. 118, Springer Science & Business Media, 1995.
354
+ [Ngu21] Phan-Minh Nguyen, Analysis of feature learning in weight-tied autoencoders via the mean field lens, arXiv preprint arXiv:2102.08373 (2021).
355
+ [NS17] Atsushi Nitanda and Taiji Suzuki, Stochastic particle gradient descent for infinite ensembles, arXiv preprint arXiv:1712.05438 (2017).
356
+ [NWS22] Atsushi Nitanda, Denny Wu, and Taiji Suzuki, Convex analysis of the mean field langevin dynamics, arXiv preprint arXiv:2201.10469 (2022).
357
+ [Pec19] ´ S Pech ´ e,´ A note on the pennington-worah distribution, Electronic Communications in Probability 24 (2019), 1–7.
358
+ [PPVF21] Scott Pesme, Loucas Pillaud-Vivien, and Nicolas Flammarion, Implicit bias of sgd for diagonal linear networks: a provable benefit of stochasticity, Advances in Neural Information Processing Systems 34 (2021).
359
+ [PW17] Jeffrey Pennington and Pratik Worah, Nonlinear random matrix theory for deep learning, Advances in Neural Information Processing Systems, 2017, pp. 2637–2646.
360
+ [RGKZ21] Maria Refinetti, Sebastian Goldt, Florent Krzakala, and Lenka Zdeborova,´ Classifying high-dimensional gaussian mixtures: Where kernel methods fail and neural networks succeed, International Conference on Machine Learning, PMLR, 2021, pp. 8936– 8947.
361
+ [RR08] Ali Rahimi and Benjamin Recht, Random features for large-scale kernel machines, Advances in neural information processing systems, 2008, pp. 1177–1184.
362
+ [SA20] Taiji Suzuki and Shunta Akiyama, Benefit of deep learning with non-convex noisy gradient descent: Provable excess risk bound and superiority to kernel methods, arXiv preprint arXiv:2012.03224 (2020).
363
+ [SH20] Johannes Schmidt-Hieber, Nonparametric regression using deep neural networks with relu activation function, The Annals of Statistics 48 (2020), no. 4, 1875–1897.
364
+ [Suz18] Taiji Suzuki, Adaptivity of deep relu network for learning in besov and mixed smooth besov spaces: optimal rate and curse of dimensionality, arXiv preprint arXiv:1810.08033 (2018).
365
+ [TAP21] Nilesh Tripuraneni, Ben Adlam, and Jeffrey Pennington, Covariate shift in highdimensional random feature regression, arXiv preprint arXiv:2111.08234 (2021).
366
+ [Ver18] Roman Vershynin, High-dimensional probability: An introduction with applications in data science, vol. 47, Cambridge university press, 2018.
367
+ $[ \mathrm { V S L } ^ { + } 2 2 ]$ Rodrigo Veiga, Ludovic Stephan, Bruno Loureiro, Florent Krzakala, and Lenka Zdeborova,´ Phase diagram of stochastic gradient descent in high-dimensional two-layer neural networks, arXiv preprint arXiv:2202.00293 (2022).
368
+ $[ \mathrm { W G L } ^ { + } 2 0 ]$ Blake Woodworth, Suriya Gunasekar, Jason D Lee, Edward Moroshko, Pedro Savarese, Itay Golan, Daniel Soudry, and Nathan Srebro, Kernel and rich regimes in overparametrized models, Conference on Learning Theory, PMLR, 2020, pp. 3635– 3673.
369
+ [WLLM19] Colin Wei, Jason D Lee, Qiang Liu, and Tengyu Ma, Regularization matters: Generalization and optimization of neural nets vs their induced kernel, Advances in Neural Information Processing Systems, 2019, pp. 9712–9724.
370
+ [WX20] Denny Wu and Ji Xu, On the optimal weighted $\ell _ { 2 }$ regularization in overparameterized linear regression, Advances in Neural Information Processing Systems 33 (2020), 10112–10123.
371
+
372
+ <table><tr><td>[HY20]</td><td>Jiaoyang Huang and Horng-Tzer Yau, Dynamics of deep neural networks and neu- ral tangent hierarchy, International conference on machine learning, PMLR, 2020,</td></tr><tr><td>[IF19]</td><td>pp. 4542-4551. Masaaki Imaizumi and Kenji Fukumizu, Deep neural networks learn non-smooth functions effectively, The 22nd international conference on artificial intelligence and</td></tr><tr><td>[JGH18]</td><td>statistics, PMLR,2019, pp. 869-878. Arthur Jacot, Franck Gabriel, and Clément Hongler, Neural tangent kernel: Conver- gence and generalization in neural networks, Advances in neural information process-</td></tr><tr><td>[JSF+20]</td><td>ing systems, 2018, pp. 8571-8580. Stanislaw Jastrzebski, Maciej Szymczak, Stanislav Fort, Devansh Arpit, Jacek Tabor, Kyunghyun Cho, and Krzysztof Geras, The break-even point on optimization trajecto-</td></tr><tr><td>[JT20]</td><td>ries of deep neural networks, International Conference on Learning Representations, 2020. Ziwei Ji and Matus Telgarsky, Polylogarithmic width suffices for gradient descent to achieve arbitrarily small test error with shallow relu networks, International Confer-</td></tr><tr><td>[KWLS21]</td><td>ence on Learning Representations, 2020. Stefani Karp,Ezra Winston, Yuanzhi Li,and Aarti Singh, Local signal adaptivity: Provable feature learning in neural networks beyond kernels,Advances in Neural</td></tr><tr><td>[LBD+20]</td><td>Information Processing Systems 34 (2021). Aitor Lewkowycz, Yasaman Bahri, Ethan Dyer, Jascha Sohl-Dickstein,and Guy Gur- Ari, The large learning rate phase of deep learning: the catapult mechanism, arXiv</td></tr><tr><td>[LCM20]</td><td>preprint arXiv:2003.02218 (020). Zhenyu Liao, Romain Couillet,and Michael W Mahoney, A random matrix analysis of random fourier features: beyond the gaussian kernel, a precise phase transition, and the corresponding double descent, Advances in Neural Information Processing</td></tr><tr><td>[LGC+21]</td><td>Systems 33 (2020),13939-13950. Bruno Loureiro, Cedric Gerbelot, Hugo Cui, Sebastian Goldt,Florent Krzakala,Marc Mezard, and Lenka Zdeborova, Learning curves of generic features maps for realistic datasets with a teacher-student model, Advances in Neural Information Processing</td></tr><tr><td>[LLC18]</td><td>Systems 34 (2021). Cosme Louart, Zhenyu Liao, and Romain Couillet, A random matrix approach to neural networks, The Annals of Applied Probability 28 (2018), no.2,1190-1248.</td></tr><tr><td>[LM20]</td><td>Guillaume Leclerc and Aleksander Madry, The two regimes of deep network training, arXiv preprint arXiv:2002.10376 (2020).</td></tr><tr><td>[LMZ20]</td><td>Yuanzhi Li, Tengyu Ma, and Hongyang R Zhang, Learning over-parametrized two- layer neural networks beyond ntk, Conference on learning theory, PMLR,2020, pp. 2613-2682.</td></tr><tr><td>[LR20]</td><td>Tengyuan Liang and Alexander Rakhlin, Just interpolate: Kernel “ridgeless” regres- sion can generalize, The Annals of Statistics 48 (202O), no.3, 1329-1347.</td></tr><tr><td>[LWM19]</td><td>Yuanzhi Li, Colin Wei, and Tengyu Ma, Towards explaining the regularization effect of initial large learning rate in training neural networks,Advances in Neural Infor- mation Processing Systems,2019, pp. 11674-11685.</td></tr><tr><td>[MKAS21]</td><td>Eran Malach, Pritish Kamath, Emmanuel Abbe, and Nathan Srebro, Quantifying the benefit of using differentiable learning over tangent kernels, International Conference on Machine Learning,PMLR, 2021, pp. 7379-7389.</td></tr><tr><td>[MM22]</td><td>Song Mei and Andrea Montanari, The generalization error of random features regres- sion: Precise asymptotics and the double descent curve, Communications on Pure and Applied Mathematics 75 (2022), no.4, 667-766.</td></tr><tr><td>[MMM21]</td><td>Song Mei, Theodor Misiakiewicz, and Andrea Montanari, Generalization error of random feature and kernel methods: hypercontractivity and kernel matrix concentra-</td></tr><tr><td>[MMN18]</td><td>tion,Applied and Computational Harmonic Analysis (2021). Song Mei, Andrea Montanari,and Phan-Minh Nguyen, A mean field view of the land- scape of two-layer neural networks, Proceedings of the National Academy of Sciences 115 (2018), no. 33,E7665-E7671.</td></tr></table>
373
+
374
+ # [WZ21]
375
+
376
+ Zhichao Wang and Yizhe Zhu, Deformed semicircle law and concentration of nonlinear random matrices for ultra-wide neural networks, arXiv preprint arXiv:2109.09304 (2021).
377
+
378
+ Greg Yang, Tensor programs iii: Neural matrix laws, arXiv preprint arXiv:2009.10685 (2020).
379
+
380
+ Greg Yang and Edward J Hu, Feature learning in infinite-width neural networks, arXiv preprint arXiv:2011.14522 (2020).
381
+
382
+ Gilad Yehudai and Ohad Shamir, On the power and limitations of random features for understanding neural networks, Advances in Neural Information Processing Systems 32 (2019).
383
+
384
+ # Checklist
385
+
386
+ 1. For all authors...
387
+
388
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
389
+ (b) Did you describe the limitations of your work? [Yes]
390
+ (c) Did you discuss any potential negative societal impacts of your work? [No]
391
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
392
+
393
+ 2. If you are including theoretical results...
394
+
395
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes]
396
+
397
+ 3. If you ran experiments...
398
+
399
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [N/A]
400
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [N/A]
401
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A]
402
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A]
403
+
404
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
405
+
406
+ (a) If your work uses existing assets, did you cite the creators? [N/A]
407
+ (b) Did you mention the license of the assets? [N/A]
408
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
409
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
410
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
411
+
412
+ 5. If you used crowdsourcing or conducted research with human subjects...
413
+
414
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
415
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
416
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
parse/dev/akddwRG6EGi/akddwRG6EGi_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/akddwRG6EGi/akddwRG6EGi_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/r9b6T088_75/r9b6T088_75_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/r9b6T088_75/r9b6T088_75_model.json ADDED
The diff for this file is too large to render. See raw diff