victormiller commited on
Commit
d597bd4
1 Parent(s): 37e0b82

Create overview.py

Browse files
Files changed (1) hide show
  1. overview.py +289 -0
overview.py ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fasthtml.common import *
2
+ from fasthtml.components import *
3
+ from fasthtml.components import D_title, D_article, D_front_matter, D_contents, D_byline
4
+ from plotly import graph_objects as go
5
+ from fh_plotly import plotly2fasthtml
6
+ import pandas as pd
7
+ import json
8
+ from rich import print
9
+ import curated
10
+ import web
11
+ import common
12
+ import results
13
+
14
+ dataset_comparison = pd.DataFrame(
15
+ {
16
+ "Dataset": [
17
+ "TxT360",
18
+ "FineWeb",
19
+ "RefinedWeb",
20
+ "RedPajama-v2",
21
+ "C4",
22
+ "Dolma",
23
+ "RedPajama-v1",
24
+ "The Pile",
25
+ ],
26
+ "CommonCrawl": [
27
+ "99 Snapshots",
28
+ "96 Snapshots",
29
+ "90 Snapshots",
30
+ "84 Snapshots",
31
+ "1 Snapshots",
32
+ "24 Snapshots",
33
+ "5 Snapshots",
34
+ "0.6% of 74 Snapshots",
35
+ ],
36
+ "Papers": [
37
+ "5 Sources",
38
+ "-",
39
+ "-",
40
+ "-",
41
+ "-",
42
+ "1 Source",
43
+ "1 Source",
44
+ "4 Sources",
45
+ ],
46
+ "Wikipedia": [
47
+ "310+ Languages",
48
+ "-",
49
+ "-",
50
+ "-",
51
+ "-",
52
+ "what does a check mark mean?",
53
+ "what does a check mark mean?",
54
+ "English Only",
55
+ ],
56
+ "FreeLaw": [
57
+ "Included",
58
+ "-",
59
+ "-",
60
+ "-",
61
+ "-",
62
+ "-",
63
+ "-",
64
+ "Included",
65
+ ],
66
+ "DM Math": [
67
+ "Included",
68
+ "-",
69
+ "-",
70
+ "-",
71
+ "-",
72
+ "-",
73
+ "-",
74
+ "Included",
75
+ ],
76
+ "USPTO": [
77
+ "Included",
78
+ "-",
79
+ "-",
80
+ "-",
81
+ "-",
82
+ "-",
83
+ "-",
84
+ "Included",
85
+ ],
86
+ "PG-19": [
87
+ "Included",
88
+ "-",
89
+ "-",
90
+ "-",
91
+ "-",
92
+ "Included",
93
+ "Included",
94
+ "Included",
95
+ ],
96
+ "HackerNews": [
97
+ "Included",
98
+ "-",
99
+ "-",
100
+ "-",
101
+ "-",
102
+ "-",
103
+ "-",
104
+ "Included",
105
+ ],
106
+ "Ubuntu IRC": [
107
+ "Included",
108
+ "-",
109
+ "-",
110
+ "-",
111
+ "-",
112
+ "-",
113
+ "-",
114
+ "Included",
115
+ ],
116
+ "EuroParl": [
117
+ "Included",
118
+ "-",
119
+ "-",
120
+ "-",
121
+ "-",
122
+ "-",
123
+ "-",
124
+ "Included",
125
+ ],
126
+ "StackExchange": [
127
+ "Included",
128
+ "-",
129
+ "-",
130
+ "-",
131
+ "-",
132
+ "-",
133
+ "Included",
134
+ "Included",
135
+ ],
136
+ "Code": [
137
+ "- what is this?",
138
+ "-",
139
+ "-",
140
+ "-",
141
+ "-",
142
+ "Included",
143
+ "Included",
144
+ "Included",
145
+ ],
146
+ }
147
+ )
148
+
149
+ table_html = dataset_comparison.to_html(index=False, border=0)
150
+ table_div = Div(NotStr(table_html), style="margin: 40px;")
151
+
152
+ dataset_sources = pd.DataFrame(
153
+ {
154
+ "Data Source": [
155
+ "CommonCrawl",
156
+ "Papers",
157
+ "Wikipedia",
158
+ "Freelaw",
159
+ "DM Math",
160
+ "USPTO",
161
+ "PG-19",
162
+ "HackerNews",
163
+ "Ubuntu IRC",
164
+ "Europarl",
165
+ "StackExchange",
166
+ ],
167
+ "Raw Data Size": [
168
+ "11 TB",
169
+ "712 GB",
170
+ "210 GB",
171
+ "23 GB",
172
+ "22 GB",
173
+ "45 GB",
174
+ "11 GB",
175
+ "4.1 GB",
176
+ "4.7 GB",
177
+ "6.1 GB",
178
+ "45 GB",
179
+ ],
180
+ "Token Count": [
181
+ "5.71T",
182
+ "154.96B",
183
+ "4.75B",
184
+ "7.34B",
185
+ "5.23B",
186
+ "4.95B",
187
+ "2.94B",
188
+ "1.08B",
189
+ "1.54B",
190
+ "1.96B",
191
+ "8.37B",
192
+ ],
193
+ "Cut-Off Date": [
194
+ "2024-30",
195
+ "Q4 2023",
196
+ "-",
197
+ "Q1 2024",
198
+ "-",
199
+ "Q4 2023",
200
+ "-",
201
+ "Q4 2023",
202
+ "Q4 2023",
203
+ "-",
204
+ "Q4 2023",
205
+ ],
206
+ }
207
+ )
208
+
209
+ table_html = dataset_sources.to_html(index=False, border=0)
210
+ table_div1 = Div(NotStr(table_html), style="margin: 40px;")
211
+
212
+
213
+ def get_curated_chart():
214
+ # Dataset
215
+ data = {
216
+ 'Source': ['ArXiv', 'PubMed Central', 'PubMed Abstract', 'S2ORC Full Text', 'S2ORC Abstract', 'PhilPapers', 'Wikipedia', 'StackExchange', 'EuroParl', 'Ubuntu IRC', 'Freelaw', 'PG19', 'USPTO', 'HackerNews', 'DM Maths'],
217
+ 'Category': ['Papers', 'Papers', 'Papers', 'Papers', 'Papers', 'Papers', 'Internet', 'Conversational', 'Legal/Formal', 'Conversational', 'Legal/Formal', 'Books', 'Legal/Formal', 'Conversational', 'Reasoning'],
218
+ 'Count': [100, 200, 150, 120, 80, 90, 300, 250, 180, 150, 150, 250, 180, 120, 90],
219
+ 'Details': [
220
+ 'A repository of scientific papers in various disciplines, including computer science, physics, mathematics, and more.',
221
+ 'A database of biomedical and life sciences research articles.',
222
+ 'Abstracts of biomedical literature from various sources.',
223
+ 'Full-text articles from the Semantic Scholar Open Research Corpus.',
224
+ 'Abstracts of articles from the Semantic Scholar Open Research Corpus.',
225
+ 'Papers from the PhilPapers database, a comprehensive index and bibliography of philosophy research.',
226
+ 'A collaborative online encyclopedia that covers a wide range of topics.',
227
+ 'A network of question-and-answer websites on various subjects, including programming, science, mathematics, and more.',
228
+ 'A collection of multilingual parallel corpora of parliamentary debates from the European Parliament.',
229
+ 'Chat logs from the Ubuntu Internet Relay Chat (IRC) channels.',
230
+ 'Legal documents and court cases from various jurisdictions.',
231
+ 'A collection of books from Project Gutenberg, a digital library of public domain works.',
232
+ 'Patent documents from the United States Patent and Trademark Office.',
233
+ 'User-generated news and discussion platform focused on technology and startups.',
234
+ 'Deep Mind Maths dataset with generated questions.'
235
+ ]
236
+ }
237
+ # Calculate percentage for each data source
238
+ total_count = sum(data['Count'])
239
+ data['Percentage'] = [count / total_count * 100 for count in data['Count']]
240
+
241
+ # Create treemap
242
+ fig = px.treemap(data, path=['Category', 'Source'], values='Count', hover_data=['Details', 'Percentage'], hover_name='Source')
243
+
244
+ # Set the size of the chart
245
+ fig.update_layout(width=800, height=600)
246
+
247
+ # Display treemap
248
+ st.plotly_chart(fig)
249
+
250
+ overview_div = Div(
251
+ Section(
252
+ H2("Combining the Best of Web and Curated Sources"),
253
+ P("""The quality and size of a pre-training dataset play a crucial role in the performance of large language models (LLMs).
254
+ The community has introduced a variety of datasets for this purpose, including purely web-based datasets like RefinedWeb{citation_obj.display_citation("refinedweb")}, RedPajama-Data-V2{citation_obj.display_citation("redpajama-v2")}, DCLM{citation_obj.display_citation("dclm")}, and FineWeb{citation_obj.display_citation("fineweb")},
255
+ as well as comprehensive datasets derived from multiple highly-curated data sources such as The Pile{citation_obj.display_citation("thepile")}, RedPajama-Data-V1{citation_obj.display_citation("redpajama-v1")}, and Dolma{citation_obj.display_citation("dolma")}.
256
+ It is commonly known that web-based datasets provide a vast quantity of data, while highly-curated multi-source datasets consistently deliver high quality and diversity,
257
+ both critical for effective LLM pre-training."""),
258
+ P("However, despite the advancements in both types of data, each type of dataset has its limitations. For instance, the processing scripts for the web dataset, RefinedWeb, known for its high quality, are not public, and only about 10% of the entire dataset has been disclosed. Conversely, the web component of existing highly-curated multi-source datasets is relatively small compared to purely web-based datasets, limiting their coverage and diversity compared to the scale of information from the internet."),
259
+ P("By integrating the extensive reach of web data with the exceptional quality of curated sources, TxT360 is crafted to meet and surpass the rigorous standards required for state-of-the-art LLM pre-training."),
260
+ H3("TxT360 combines both the web data and highly-curated sources, which none of the existing datasets have covered."),
261
+ P("Table 1: The following table shows TxT360 and other well-known datasets on the coverage and size of data sources."),
262
+ table_div,
263
+ P("Table 2: Basic TxT360 Statistics."),
264
+ table_div1,
265
+ ),
266
+ Section(
267
+ H2("Our General Appoach to Data Processing"),
268
+ P("We enforce a fully transparent data processing pipeline when producing TxT360, designed to handle both web and curated datasets with precision and clarity. This transparent pipeline presents a unified framework for processing both data types, making it convenient and adaptive for users to revise and fine-tune the pipeline. "),
269
+ P("For web datasets, the pipeline focuses on extracting meaningful, high-quality text from raw web content, which is inherently noisy and varied. The process includes sophisticated filtering and deduplication techniques to clean the data and remove any redundancies or irrelevant information. On the other hand, curated datasets, which are already more structured and reliable, are processed with selective steps to maintain their integrity while integrating them seamlessly into the larger dataset."),
270
+ P("We will open-source the scripts for the whole pipeline, allowing the community to review, replicate, and build upon our processes."),
271
+ Img(src="images/pipeline.png", height = "300", width = "600" ),
272
+ P("Figure 1: Data processing pipeline. All the steps are adopted for processing web data while the yellow blocks are adopted for processing curated sources.")
273
+ ),
274
+ Section(
275
+ H2("Global Deduplication"),
276
+ P("Deduplication is crucial in language model (LM) pre-training for several reasons. It reduces the volume of training data, leading to shorter training times and potentially better accuracy. It also prevents train-test overlap, improves evaluation metrics, and minimizes the risk of memorization, which can cause test loss to increase during training. By controlling the pretraining data distribution through deduplication and selective upsampling, we avoid relying on the often inconsistent distribution of internet-sourced data."),
277
+ P("Our deduplication process began with 61.8 TB of high-quality, filtered, and compressed documents, totaling approximately 48.83 billion documents. We first performed exact deduplication using a Bloom filter, reducing the dataset by 17% to 40.21 billion documents. For global near-deduplication, we scaled methodologies from prior works like SlimPajama to handle the entire dataset, including 87 Common Crawl dumps and other curated data. This involved generating document signatures, matching them to identify near-duplicates, and clustering these to retain only one document per cluster. We prioritized retaining documents from curated sources and more recent CommonCrawl dumps. Throughout the deduplication stages, we extensively used Dask for distributed data processing."),
278
+ P("After the global near-deduplication of all 87 CommonCrawl dumps and other curated data, we removed around 85% of the total documents. This leaves us with approximately 4.24 trillion deduplicated tokens, which aligns with what FineWeb has reported for their iterative global deduplication. Along with the list of duplicated documents to delete, our deduplication code also saves some metadata about the duplicate clusters that we find. We save statistics about every duplicate cluster we find, with the document ID of the document we retain from the cluster as the key and with a value capturing the distribution of the duplicates within the cluster over the CommonCrawl dumps (identified by the first 2 digits of every document ID). This way, we always have information about the duplicates we have deleted, allowing us to upsample any data distribution we want for training."),
279
+ P("During deduplication, it is not feasible to store all the duplicate clusters we form, but we do save some samples at every size. Here are some observations we made by examining these sample duplicate clusters:"),
280
+ Ul(Li("Smaller components tend to have more overlap in their MinHash bands. The smallest components, which are essentially pairs, consist of exact duplicate documents that local exact deduplication missed."),Li("When clusters contain three or more documents, incremental changes in the text become apparent. For example, there may be a growing list of personnel over the years."),Li("In sizable clusters comprising 1,000 or more documents, we observe a trend towards templatization. This involves the recurrent use of standardized language to convey general topics such as terms and conditions, warnings, and disclaimers. Such language is prevalent on commercial websites, offering a consistent and efficient way to communicate commonly encountered information.")),
281
+ ),
282
+ )
283
+
284
+ def overview():
285
+ return Div(Section(
286
+ overview_div,
287
+ id="inner-text",
288
+ )
289
+ )