Spaces:
Runtime error
Runtime error
victormiller
commited on
Commit
•
8580754
1
Parent(s):
8feeca0
Update main.py
Browse files
main.py
CHANGED
@@ -210,51 +210,344 @@ intro_list1 = Ol(
|
|
210 |
)
|
211 |
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
Section(
|
224 |
-
|
225 |
-
|
226 |
-
|
|
|
|
|
|
|
227 |
),
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
"
|
234 |
-
|
235 |
-
"
|
236 |
-
D_cite(bibtex_key="refinedweb"),
|
237 |
-
").",
|
238 |
),
|
239 |
-
P(
|
240 |
-
|
|
|
|
|
|
|
241 |
),
|
242 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
),
|
244 |
-
|
245 |
-
|
246 |
-
P(
|
247 |
-
|
248 |
-
),
|
249 |
-
P("
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
),
|
256 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
),
|
|
|
258 |
id="inner-text",
|
259 |
)
|
260 |
|
|
|
210 |
)
|
211 |
|
212 |
|
213 |
+
dataset_comparison1 = pd.DataFrame(
|
214 |
+
{
|
215 |
+
"Dataset": [
|
216 |
+
"TxT360",
|
217 |
+
"FineWeb",
|
218 |
+
"RefinedWeb",
|
219 |
+
"RedPajama-v2",
|
220 |
+
"C4",
|
221 |
+
"Dolma",
|
222 |
+
"RedPajama-v1",
|
223 |
+
"The Pile",
|
224 |
+
],
|
225 |
+
"CommonCrawl": [
|
226 |
+
"99 Snapshots",
|
227 |
+
"96 Snapshots",
|
228 |
+
"90 Snapshots",
|
229 |
+
"84 Snapshots",
|
230 |
+
"1 Snapshots",
|
231 |
+
"24 Snapshots",
|
232 |
+
"5 Snapshots",
|
233 |
+
"0.6% of 74 Snapshots",
|
234 |
+
],
|
235 |
+
"Papers": [
|
236 |
+
"5 Sources",
|
237 |
+
"-",
|
238 |
+
"-",
|
239 |
+
"-",
|
240 |
+
"-",
|
241 |
+
"1 Source",
|
242 |
+
"1 Source",
|
243 |
+
"4 Sources",
|
244 |
+
],
|
245 |
+
"Wikipedia": [
|
246 |
+
"310+ Languages",
|
247 |
+
"-",
|
248 |
+
"-",
|
249 |
+
"-",
|
250 |
+
"-",
|
251 |
+
"what does a check mark mean?",
|
252 |
+
"what does a check mark mean?",
|
253 |
+
"English Only",
|
254 |
+
],
|
255 |
+
"FreeLaw": [
|
256 |
+
"Included",
|
257 |
+
"-",
|
258 |
+
"-",
|
259 |
+
"-",
|
260 |
+
"-",
|
261 |
+
"-",
|
262 |
+
"-",
|
263 |
+
"Included",
|
264 |
+
],
|
265 |
+
"DM Math": [
|
266 |
+
"Included",
|
267 |
+
"-",
|
268 |
+
"-",
|
269 |
+
"-",
|
270 |
+
"-",
|
271 |
+
"-",
|
272 |
+
"-",
|
273 |
+
"Included",
|
274 |
+
],
|
275 |
+
"USPTO": [
|
276 |
+
"Included",
|
277 |
+
"-",
|
278 |
+
"-",
|
279 |
+
"-",
|
280 |
+
"-",
|
281 |
+
"-",
|
282 |
+
"-",
|
283 |
+
"Included",
|
284 |
+
],
|
285 |
+
|
286 |
+
}
|
287 |
+
)
|
288 |
+
|
289 |
+
table_html = dataset_comparison1.to_html(index=False, border=0)
|
290 |
+
table_div_1 = Div(NotStr(table_html), style="margin: 40px;")
|
291 |
+
|
292 |
+
dataset_comparison2 = pd.DataFrame(
|
293 |
+
{
|
294 |
+
"Dataset": [
|
295 |
+
"TxT360",
|
296 |
+
"FineWeb",
|
297 |
+
"RefinedWeb",
|
298 |
+
"RedPajama-v2",
|
299 |
+
"C4",
|
300 |
+
"Dolma",
|
301 |
+
"RedPajama-v1",
|
302 |
+
"The Pile",
|
303 |
+
],
|
304 |
+
|
305 |
+
"PG-19": [
|
306 |
+
"Included",
|
307 |
+
"-",
|
308 |
+
"-",
|
309 |
+
"-",
|
310 |
+
"-",
|
311 |
+
"Included",
|
312 |
+
"Included",
|
313 |
+
"Included",
|
314 |
+
],
|
315 |
+
"HackerNews": [
|
316 |
+
"Included",
|
317 |
+
"-",
|
318 |
+
"-",
|
319 |
+
"-",
|
320 |
+
"-",
|
321 |
+
"-",
|
322 |
+
"-",
|
323 |
+
"Included",
|
324 |
+
],
|
325 |
+
"Ubuntu IRC": [
|
326 |
+
"Included",
|
327 |
+
"-",
|
328 |
+
"-",
|
329 |
+
"-",
|
330 |
+
"-",
|
331 |
+
"-",
|
332 |
+
"-",
|
333 |
+
"Included",
|
334 |
+
],
|
335 |
+
"EuroParl": [
|
336 |
+
"Included",
|
337 |
+
"-",
|
338 |
+
"-",
|
339 |
+
"-",
|
340 |
+
"-",
|
341 |
+
"-",
|
342 |
+
"-",
|
343 |
+
"Included",
|
344 |
+
],
|
345 |
+
"StackExchange": [
|
346 |
+
"Included",
|
347 |
+
"-",
|
348 |
+
"-",
|
349 |
+
"-",
|
350 |
+
"-",
|
351 |
+
"-",
|
352 |
+
"Included",
|
353 |
+
"Included",
|
354 |
+
],
|
355 |
+
"Code": [
|
356 |
+
"- what is this?",
|
357 |
+
"-",
|
358 |
+
"-",
|
359 |
+
"-",
|
360 |
+
"-",
|
361 |
+
"Included",
|
362 |
+
"Included",
|
363 |
+
"Included",
|
364 |
+
],
|
365 |
+
}
|
366 |
+
)
|
367 |
+
|
368 |
+
table_html2 = dataset_comparison2.to_html(index=False, border=0)
|
369 |
+
table_div_2 = Div(NotStr(table_html2), style="margin: 40px;")
|
370 |
+
|
371 |
+
dataset_sources = pd.DataFrame(
|
372 |
+
{
|
373 |
+
"Data Source": [
|
374 |
+
"CommonCrawl",
|
375 |
+
"Papers",
|
376 |
+
"Wikipedia",
|
377 |
+
"Freelaw",
|
378 |
+
"DM Math",
|
379 |
+
"USPTO",
|
380 |
+
"PG-19",
|
381 |
+
"HackerNews",
|
382 |
+
"Ubuntu IRC",
|
383 |
+
"Europarl",
|
384 |
+
"StackExchange",
|
385 |
+
],
|
386 |
+
"Raw Data Size": [
|
387 |
+
"11 TB",
|
388 |
+
"712 GB",
|
389 |
+
"210 GB",
|
390 |
+
"23 GB",
|
391 |
+
"22 GB",
|
392 |
+
"45 GB",
|
393 |
+
"11 GB",
|
394 |
+
"4.1 GB",
|
395 |
+
"4.7 GB",
|
396 |
+
"6.1 GB",
|
397 |
+
"45 GB",
|
398 |
+
],
|
399 |
+
"Token Count": [
|
400 |
+
"5.71T",
|
401 |
+
"154.96B",
|
402 |
+
"4.75B",
|
403 |
+
"7.34B",
|
404 |
+
"5.23B",
|
405 |
+
"4.95B",
|
406 |
+
"2.94B",
|
407 |
+
"1.08B",
|
408 |
+
"1.54B",
|
409 |
+
"1.96B",
|
410 |
+
"8.37B",
|
411 |
+
],
|
412 |
+
"Cut-Off Date": [
|
413 |
+
"2024-30",
|
414 |
+
"Q4 2023",
|
415 |
+
"-",
|
416 |
+
"Q1 2024",
|
417 |
+
"-",
|
418 |
+
"Q4 2023",
|
419 |
+
"-",
|
420 |
+
"Q4 2023",
|
421 |
+
"Q4 2023",
|
422 |
+
"-",
|
423 |
+
"Q4 2023",
|
424 |
+
],
|
425 |
+
}
|
426 |
+
)
|
427 |
+
|
428 |
+
table_html_data = dataset_sources.to_html(index=False, border=0)
|
429 |
+
table_div_data = Div(NotStr(table_html_data), style="margin: 40px;")
|
430 |
+
|
431 |
+
|
432 |
+
def get_curated_chart():
|
433 |
+
# Dataset
|
434 |
+
data = {
|
435 |
+
'Source': ['ArXiv', 'PubMed Central', 'PubMed Abstract', 'S2ORC Full Text', 'S2ORC Abstract', 'PhilPapers', 'Wikipedia', 'StackExchange', 'EuroParl', 'Ubuntu IRC', 'Freelaw', 'PG19', 'USPTO', 'HackerNews', 'DM Maths'],
|
436 |
+
'Category': ['Papers', 'Papers', 'Papers', 'Papers', 'Papers', 'Papers', 'Internet', 'Conversational', 'Legal/Formal', 'Conversational', 'Legal/Formal', 'Books', 'Legal/Formal', 'Conversational', 'Reasoning'],
|
437 |
+
'Count': [100, 200, 150, 120, 80, 90, 300, 250, 180, 150, 150, 250, 180, 120, 90],
|
438 |
+
'Details': [
|
439 |
+
'A repository of scientific papers in various disciplines, including computer science, physics, mathematics, and more.',
|
440 |
+
'A database of biomedical and life sciences research articles.',
|
441 |
+
'Abstracts of biomedical literature from various sources.',
|
442 |
+
'Full-text articles from the Semantic Scholar Open Research Corpus.',
|
443 |
+
'Abstracts of articles from the Semantic Scholar Open Research Corpus.',
|
444 |
+
'Papers from the PhilPapers database, a comprehensive index and bibliography of philosophy research.',
|
445 |
+
'A collaborative online encyclopedia that covers a wide range of topics.',
|
446 |
+
'A network of question-and-answer websites on various subjects, including programming, science, mathematics, and more.',
|
447 |
+
'A collection of multilingual parallel corpora of parliamentary debates from the European Parliament.',
|
448 |
+
'Chat logs from the Ubuntu Internet Relay Chat (IRC) channels.',
|
449 |
+
'Legal documents and court cases from various jurisdictions.',
|
450 |
+
'A collection of books from Project Gutenberg, a digital library of public domain works.',
|
451 |
+
'Patent documents from the United States Patent and Trademark Office.',
|
452 |
+
'User-generated news and discussion platform focused on technology and startups.',
|
453 |
+
'Deep Mind Maths dataset with generated questions.'
|
454 |
+
]
|
455 |
+
}
|
456 |
+
# Calculate percentage for each data source
|
457 |
+
total_count = sum(data['Count'])
|
458 |
+
data['Percentage'] = [count / total_count * 100 for count in data['Count']]
|
459 |
+
|
460 |
+
# Create treemap
|
461 |
+
fig = px.treemap(data, path=['Category', 'Source'], values='Count', hover_data=['Details', 'Percentage'], hover_name='Source')
|
462 |
+
|
463 |
+
# Set the size of the chart
|
464 |
+
fig.update_layout(width=800, height=600)
|
465 |
+
|
466 |
+
# Display treemap
|
467 |
+
st.plotly_chart(fig)
|
468 |
+
|
469 |
+
overview_div = Div(
|
470 |
Section(
|
471 |
+
H2("Overview"),
|
472 |
+
H3("What This Section Contains"),
|
473 |
+
Ul(
|
474 |
+
Li("Motivation Behind TxT360", style = "margin-bottom: 5px"),
|
475 |
+
Li("The Highlevel Data Process Approach", style = "margin-bottom: 5px"),
|
476 |
+
Li("Introduction to Global Deduplication", style = "margin-bottom: 5px"),
|
477 |
),
|
478 |
+
H2("Motivation Behind Txt360"),
|
479 |
+
H3("TxT360 is the first dataset to combine both web and curated data sources commonly used in pretraining."),
|
480 |
+
P("The quality and size of a pre-training dataset play a crucial role in the performance of large language models (LLMs). Data is often referred as low quality if it has not been filtered to review unwanted text. The community has introduced a variety of filtered datasets including purely web-based datasets. Commonly used pretraining datasets are:"),
|
481 |
+
Ul(
|
482 |
+
Li("RefinedWeb - cite", style = "margin-bottom: 5px"),
|
483 |
+
Li("RedPajama-Data-V2- cite", style = "margin-bottom: 5px"),
|
484 |
+
Li("DCLM- cite", style = "margin-bottom: 5px"),
|
485 |
+
Li("FineWeb- cite", style = "margin-bottom: 5px"),
|
|
|
|
|
486 |
),
|
487 |
+
P("Conversely, there are similar datasets that focus on filtering curated sources to for high-quality, domain specific knowledge. Commonly used curated datasets include:"),
|
488 |
+
Ul(
|
489 |
+
Li("The Pile - cite", style = "margin-bottom: 5px"),
|
490 |
+
Li("RedPajama-Data-V1- cite", style = "margin-bottom: 5px"),
|
491 |
+
Li("Dolma- cite", style = "margin-bottom: 5px"),
|
492 |
),
|
493 |
+
P("In pretraining, it is common to combine web data and curated sources (cite). Web data is included to provide a vast quantity of long tail and diverse data, while curated datasets are often information rich and provide the 'deep-dive' domain information. Both datasets play critical for effective LLM pre-training."),
|
494 |
+
H4("The Gap TxT360 Fills"),
|
495 |
+
P("Despite advancements in filtering and source material for both data types, each type of dataset has its limitations. RefinedWeb is known for its high quality content but and only about 10% of the entire dataset has been disclosed and the processing scripts have not been released. For datasets that have combined curated sources with web data, the web component is relatively small (NEED TO UPDATE - citation needed)."),
|
496 |
+
P("By integrating the extensive reach of web data with the exceptional quality of curated sources, TxT360 meets and surpasess the rigorous standards required for state-of-the-art LLM pre-training as demostated in the Results section."),
|
497 |
+
|
498 |
+
P("Table 1: The following table shows TxT360 and other well-known datasets on the coverage and size of data sources."),
|
499 |
+
table_div_1,
|
500 |
+
table_div_2,
|
501 |
+
P("Table 2: Basic TxT360 Statistics."),
|
502 |
+
table_div_data,
|
503 |
),
|
504 |
+
Section(
|
505 |
+
H2("Our Generalizable Approach to Data Processing"),
|
506 |
+
P("To produce TxT360, a comprehensive and transparent data processing pipeline was designed to account for the nuances of both web and curated datasets. The pipeline presents a unified framework for processing both data types, making it convenient and easily adaptive for users to revise and fine-tune the pipeline for their own use cases."),
|
507 |
+
P("Web datasets are inherently noisy and varied. Thus, the pipeline includes sophisticated filtering and deduplication techniques to clean the data and remove redundancies or irrelevant information."),
|
508 |
+
P("Curated datasets are typically already structured and consistently formatted. TxT360 filters these sources with selective steps to maintain their integrity while providing seamless integration into the larger dataset."),
|
509 |
+
P("We will open-source the scripts for the whole pipeline, allowing the community to review, replicate, and build upon our processes."),
|
510 |
+
Img(src="images/pipeline.png", height = "300", width = "600" ),
|
511 |
+
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."),
|
512 |
+
),
|
513 |
+
Section(
|
514 |
+
H2("Introducing Global Deduplication"),
|
515 |
+
P("Deduplication is crucial in language model pre-training for several reasons (NEEDS CITATION). Main hypothesis on why deduplicaiton is necessary and help include:"),
|
516 |
+
Ul(
|
517 |
+
Li("reducing data volume reduces training time (and cost)", style = "margin-bottom: 5px"),
|
518 |
+
Li("removing duplicataive data can lead to better accuracy", style = "margin-bottom: 5px"),
|
519 |
+
Li("prevent train-test overlap", style = "margin-bottom: 5px"),
|
520 |
+
Li("minimizes the risk of memorization leading to test loss", style = "margin-bottom: 5px"),
|
521 |
+
),
|
522 |
+
P("Furthermore, by controlling the pretraining data distribution through deduplication and selective upsampling avoida relying on the often inconsistent distribution of internet-sourced data."),
|
523 |
+
H3("Highlights of the TxT360 Deduplication Process"),
|
524 |
+
P("Our deduplication process began with 61.8 TB of 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."),
|
525 |
+
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."),
|
526 |
+
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:"),
|
527 |
+
Ul(
|
528 |
+
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."),
|
529 |
+
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."),
|
530 |
+
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."),
|
531 |
),
|
532 |
+
P("All Deduplication details can be found in the Global Data Processing Steps section."),
|
533 |
+
),
|
534 |
+
)
|
535 |
+
|
536 |
+
@app.get("/intro")
|
537 |
+
def intro():
|
538 |
+
return Div(
|
539 |
+
Section(
|
540 |
+
H2("About TxT360"),
|
541 |
+
P("We introduce Trillion eXtracted Text (TxT360): the highest quality, most comprehensive, and production ready pretraining dataset released to date, an open source pre training textual dataset with the widest coverage to date, including all 99 Common Crawl snapshots released to date and 14 widely used curated sources such as Wikipedia, StackExchange, and ArXiv."),
|
542 |
+
|
543 |
+
P("Building on top of the prior study on pre-training data, (cite C4, chinchilla, fineweb, refinedweb, 2305.16264, ) TxT360 carefully implements data processing steps such as extraction, filtering, deduplication, PII removal and so on. Notably, we design a schema to provide users with full control on the weights of each data point, instead of relying on unknown distribution from the raw dataset. Specifically, we strive to make each data point appear only once, via global deduplication across the whole corpus. Importantly, we store enough metadata to recover the raw distribution, and additionally allow one to have fine-grained control to create data distributions and corpus of desired size. As an example, we present one simple upsampling scheme that takes into account the duplication counts, resulting in a 15~16 trillion token corpus, outperforming FineWeb and our non-upsampling baselines, on diverse evaluations. Unlike DCLM and RedPajama V2, we present the final deduplicated dataset that is ready to go."),
|
544 |
+
|
545 |
+
P("We have carefully implemented a large set of filters by carefully reviewing the input, output from data samples and tailored design for each data source. We learned from and compared our implementation with prior data pipelines, such as Chinchilla, C4, DataTrove, Dolma, and RedPajama Data V2 to make carefully considered decisions."),
|
546 |
+
P("In light of the 360 open source spirit, we will open source the code and document all the implementation details in this blog post, along with the examples and why each decision is made, hoping to shed some light on this important but tedious step."),
|
547 |
+
|
548 |
+
id="section1",
|
549 |
),
|
550 |
+
overview_div,
|
551 |
id="inner-text",
|
552 |
)
|
553 |
|