File size: 15,046 Bytes
d597bd4
 
 
 
 
 
 
 
 
 
 
 
 
a89d144
d597bd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a89d144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d597bd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a89d144
7af4892
d597bd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c2d67bd
 
d597bd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7af4892
 
d597bd4
c2d67bd
d597bd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
from fasthtml.common import *
from fasthtml.components import *
from fasthtml.components import D_title, D_article, D_front_matter, D_contents, D_byline
from plotly import graph_objects as go
from fh_plotly import plotly2fasthtml
import pandas as pd
import json
from rich import print
import curated
import web
import common
import results

dataset_comparison1 = pd.DataFrame(
        {
            "Dataset": [
                "TxT360",
                "FineWeb",
                "RefinedWeb",
                "RedPajama-v2",
                "C4",
                "Dolma",
                "RedPajama-v1",
                "The Pile",
            ],
            "CommonCrawl": [
                "99 Snapshots",
                "96 Snapshots",
                "90 Snapshots",
                "84 Snapshots",
                "1 Snapshots",
                "24 Snapshots",
                "5 Snapshots",
                "0.6% of 74 Snapshots",
            ],
            "Papers": [
                "5 Sources",
                "-",
                "-",
                "-",
                "-",
                "1 Source",
                "1 Source",
                "4 Sources",
            ],
            "Wikipedia": [
                "310+ Languages",
                "-",
                "-",
                "-",
                "-",
                "what does a check mark mean?",
                "what does a check mark mean?",
                "English Only",
            ],
            "FreeLaw": [
                "Included",
                "-",
                "-",
                "-",
                "-",
                "-",
                "-",
                "Included",
            ],
            "DM Math": [
                "Included",
                "-",
                "-",
                "-",
                "-",
                "-",
                "-",
                "Included",
            ],
            "USPTO": [
                "Included",
                "-",
                "-",
                "-",
                "-",
                "-",
                "-",
                "Included",
            ],
            
        }
    )

table_html = dataset_comparison1.to_html(index=False, border=0)
table_div_1 = Div(NotStr(table_html), style="margin: 40px;")

dataset_comparison2 = pd.DataFrame(
        {
            "Dataset": [
                "TxT360",
                "FineWeb",
                "RefinedWeb",
                "RedPajama-v2",
                "C4",
                "Dolma",
                "RedPajama-v1",
                "The Pile",
            ],        
            
            "PG-19": [
                "Included",
                "-",
                "-",
                "-",
                "-",
                "Included",
                "Included",
                "Included",
            ],
            "HackerNews": [
                "Included",
                "-",
                "-",
                "-",
                "-",
                "-",
                "-",
                "Included",
            ],
            "Ubuntu IRC": [
                "Included",
                "-",
                "-",
                "-",
                "-",
                "-",
                "-",
                "Included",
            ],
            "EuroParl": [
                "Included",
                "-",
                "-",
                "-",
                "-",
                "-",
                "-",
                "Included",
            ],
            "StackExchange": [
                "Included",
                "-",
                "-",
                "-",
                "-",
                "-",
                "Included",
                "Included",
            ],
            "Code": [
                "- what is this?",
                "-",
                "-",
                "-",
                "-",
                "Included",
                "Included",
                "Included",
            ],
        }
    )

table_html2 = dataset_comparison2.to_html(index=False, border=0)
table_div_2 = Div(NotStr(table_html2), style="margin: 40px;")

dataset_sources = pd.DataFrame(
        {
            "Data Source": [
                "CommonCrawl",
                "Papers",
                "Wikipedia",
                "Freelaw",
                "DM Math",
                "USPTO",
                "PG-19",
                "HackerNews",
                "Ubuntu IRC",
                "Europarl",
                "StackExchange",
            ],
            "Raw Data Size": [
                "11 TB",
                "712 GB",
                "210 GB",
                "23 GB",
                "22 GB",
                "45 GB",
                "11 GB",
                "4.1 GB",
                "4.7 GB",
                "6.1 GB",
                "45 GB",
            ],
            "Token Count": [
                "5.71T",
                "154.96B",
                "4.75B",
                "7.34B",
                "5.23B",
                "4.95B",
                "2.94B",
                "1.08B",
                "1.54B",
                "1.96B",
                "8.37B",
            ],
            "Cut-Off Date": [
                "2024-30",
                "Q4 2023",
                "-",
                "Q1 2024",
                "-",
                "Q4 2023",
                "-",
                "Q4 2023",
                "Q4 2023",
                "-",
                "Q4 2023",
            ],
        }
    )

table_html_data = dataset_sources.to_html(index=False, border=0)
table_div_data = Div(NotStr(table_html_data), style="margin: 40px;")


def get_curated_chart():
        # Dataset
    data = {
      'Source': ['ArXiv', 'PubMed Central', 'PubMed Abstract', 'S2ORC Full Text', 'S2ORC Abstract', 'PhilPapers', 'Wikipedia', 'StackExchange', 'EuroParl', 'Ubuntu IRC', 'Freelaw', 'PG19', 'USPTO', 'HackerNews', 'DM Maths'],
      'Category': ['Papers', 'Papers', 'Papers', 'Papers', 'Papers', 'Papers', 'Internet', 'Conversational', 'Legal/Formal', 'Conversational', 'Legal/Formal', 'Books', 'Legal/Formal', 'Conversational', 'Reasoning'],
      'Count': [100, 200, 150, 120, 80, 90, 300, 250, 180, 150, 150, 250, 180, 120, 90],
      'Details': [
        'A repository of scientific papers in various disciplines, including computer science, physics, mathematics, and more.',
        'A database of biomedical and life sciences research articles.',
        'Abstracts of biomedical literature from various sources.',
        'Full-text articles from the Semantic Scholar Open Research Corpus.',
        'Abstracts of articles from the Semantic Scholar Open Research Corpus.',
        'Papers from the PhilPapers database, a comprehensive index and bibliography of philosophy research.',
        'A collaborative online encyclopedia that covers a wide range of topics.',
        'A network of question-and-answer websites on various subjects, including programming, science, mathematics, and more.',
        'A collection of multilingual parallel corpora of parliamentary debates from the European Parliament.',
        'Chat logs from the Ubuntu Internet Relay Chat (IRC) channels.',
        'Legal documents and court cases from various jurisdictions.',
        'A collection of books from Project Gutenberg, a digital library of public domain works.',
        'Patent documents from the United States Patent and Trademark Office.',
        'User-generated news and discussion platform focused on technology and startups.',
        'Deep Mind Maths dataset with generated questions.'
      ]
    }
    # Calculate percentage for each data source
    total_count = sum(data['Count'])
    data['Percentage'] = [count / total_count * 100 for count in data['Count']]
    
    # Create treemap
    fig = px.treemap(data, path=['Category', 'Source'], values='Count', hover_data=['Details', 'Percentage'], hover_name='Source')
    
    # Set the size of the chart
    fig.update_layout(width=800, height=600)
    
    # Display treemap
    st.plotly_chart(fig)

overview_div = Div(
        Section(
            H2("Combining the Best of Web and Curated Sources"),
            P("""The quality and size of a pre-training dataset play a crucial role in the performance of large language models (LLMs). 
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")}, 
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")}. 
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, 
both critical for effective LLM pre-training."""),
            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."),
            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."),
            H3("TxT360 combines both the web data and highly-curated sources, which none of the existing datasets have covered."),
            P("Table 1: The following table shows TxT360 and other well-known datasets on the coverage and size of data sources."),
            table_div_1,
            table_div_2,
            P("Table 2: Basic TxT360 Statistics."),
            table_div_data,
        ),
    Section(
            H2("Our General Appoach to Data Processing"),
            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. "),
            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."),
            P("We will open-source the scripts for the whole pipeline, allowing the community to review, replicate, and build upon our processes."),
            Img(src="images/pipeline.png", height = "300", width = "600" ),
            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.")
        ),
    Section(
            H2("Global Deduplication"),
            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."),
            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."),
            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."),
            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:"),
            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.")),
        ),
)

def overview():
    return Div(Section(
            overview_div,
            id="inner-text",
        )
    )