File size: 13,090 Bytes
386c4d0 6b97519 3f647aa 6b97519 3f647aa 6b97519 3f647aa 6b97519 3f647aa 6b97519 3f647aa 6b97519 3f647aa 6b97519 3f647aa 6b97519 3f647aa 1db80b5 0e2b983 d9e5e62 0e2b983 d9e5e62 0e2b983 d9e5e62 0e2b983 d9e5e62 0e2b983 d9e5e62 0e2b983 d9e5e62 0e2b983 d9e5e62 0e2b983 d9e5e62 a2aeb39 d7dfe44 386c4d0 d7dfe44 385af25 3005797 d6fd95e c880c86 77dffb8 5f12f18 e95ad84 454e691 81cd535 386c4d0 6b97519 1db80b5 0e2b983 a2aeb39 386c4d0 d7dfe44 385af25 3005797 d6fd95e c880c86 77dffb8 5f12f18 e95ad84 454e691 81cd535 386c4d0 b5648b9 8d2edf0 b5648b9 118e0a6 b5648b9 |
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 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
---
dataset_info:
- config_name: C
features:
- name: blob_id
dtype: large_string
- name: language
dtype: large_string
- name: repo_name
dtype: large_string
- name: path
dtype: large_string
- name: src_encoding
dtype: large_string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
- name: detected_licenses
large_list: large_string
- name: license_type
dtype: large_string
splits:
- name: train
num_bytes: 1100442974
num_examples: 5848375
download_size: 571816053
dataset_size: 1100442974
- config_name: CSharp
features:
- name: blob_id
dtype: string
- name: language
dtype: string
- name: repo_name
dtype: string
- name: path
dtype: string
- name: src_encoding
dtype: string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
splits:
- name: train
num_bytes: 1868459403.9283383
num_examples: 11425016
download_size: 1217425523
dataset_size: 1868459403.9283383
- config_name: Cpp
features:
- name: blob_id
dtype: large_string
- name: language
dtype: large_string
- name: repo_name
dtype: large_string
- name: path
dtype: large_string
- name: src_encoding
dtype: large_string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
- name: detected_licenses
large_list: large_string
- name: license_type
dtype: large_string
splits:
- name: train
num_bytes: 3167426435
num_examples: 16246746
download_size: 1632803797
dataset_size: 3167426435
- config_name: Go
features:
- name: blob_id
dtype: string
- name: language
dtype: string
- name: repo_name
dtype: string
- name: path
dtype: string
- name: src_encoding
dtype: string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
splits:
- name: train
num_bytes: 264121853.30269703
num_examples: 1917163
download_size: 172795994
dataset_size: 264121853.30269703
- config_name: Java
features:
- name: blob_id
dtype: string
- name: language
dtype: string
- name: repo_name
dtype: string
- name: path
dtype: string
- name: src_encoding
dtype: string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
splits:
- name: train
num_bytes: 8052241351.786225
num_examples: 44990158
download_size: 5225632804
dataset_size: 8052241351.786225
- config_name: JavaScript
features:
- name: blob_id
dtype: string
- name: language
dtype: string
- name: repo_name
dtype: string
- name: path
dtype: string
- name: src_encoding
dtype: string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
splits:
- name: train
num_bytes: 2047070211.6887486
num_examples: 13253431
download_size: 1270586356
dataset_size: 2047070211.6887486
- config_name: Markdown
features:
- name: blob_id
dtype: string
- name: language
dtype: string
- name: repo_name
dtype: string
- name: path
dtype: string
- name: src_encoding
dtype: string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
splits:
- name: train
num_bytes: 3084028046.5768914
num_examples: 20687077
download_size: 2023721165
dataset_size: 3084028046.5768914
- config_name: PHP
features:
- name: blob_id
dtype: string
- name: language
dtype: string
- name: repo_name
dtype: string
- name: path
dtype: string
- name: src_encoding
dtype: string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
splits:
- name: train
num_bytes: 1489550005.454035
num_examples: 9914497
download_size: 968613058
dataset_size: 1489550005.454035
- config_name: Python
features:
- name: blob_id
dtype: string
- name: language
dtype: string
- name: repo_name
dtype: string
- name: path
dtype: string
- name: src_encoding
dtype: string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
splits:
- name: train
num_bytes: 3720485148.4425817
num_examples: 25286019
download_size: 2468949715
dataset_size: 3720485148.4425817
- config_name: Ruby
features:
- name: blob_id
dtype: string
- name: language
dtype: string
- name: repo_name
dtype: string
- name: path
dtype: string
- name: src_encoding
dtype: string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
splits:
- name: train
num_bytes: 442935449.42350453
num_examples: 2976874
download_size: 280009998
dataset_size: 442935449.42350453
- config_name: Rust
features:
- name: blob_id
dtype: string
- name: language
dtype: string
- name: repo_name
dtype: string
- name: path
dtype: string
- name: src_encoding
dtype: string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
splits:
- name: train
num_bytes: 158802257.43148246
num_examples: 1135379
download_size: 100605171
dataset_size: 158802257.43148246
- config_name: SQL
features:
- name: blob_id
dtype: string
- name: language
dtype: string
- name: repo_name
dtype: string
- name: path
dtype: string
- name: src_encoding
dtype: string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
splits:
- name: train
num_bytes: 384998995.138193
num_examples: 2504412
download_size: 256836639
dataset_size: 384998995.138193
- config_name: Shell
features:
- name: blob_id
dtype: string
- name: language
dtype: string
- name: repo_name
dtype: string
- name: path
dtype: string
- name: src_encoding
dtype: string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
splits:
- name: train
num_bytes: 586236950.3127995
num_examples: 4133547
download_size: 386805586
dataset_size: 586236950.3127995
- config_name: Swift
features:
- name: blob_id
dtype: string
- name: language
dtype: string
- name: repo_name
dtype: string
- name: path
dtype: string
- name: src_encoding
dtype: string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
splits:
- name: train
num_bytes: 408330793.98799247
num_examples: 2454309
download_size: 254708210
dataset_size: 408330793.98799247
- config_name: TypeScript
features:
- name: blob_id
dtype: string
- name: language
dtype: string
- name: repo_name
dtype: string
- name: path
dtype: string
- name: src_encoding
dtype: string
- name: length_bytes
dtype: int64
- name: score
dtype: float64
- name: int_score
dtype: int64
splits:
- name: train
num_bytes: 709628890.4418851
num_examples: 4290356
download_size: 419501643
dataset_size: 709628890.4418851
configs:
- config_name: C
data_files:
- split: train
path: C/train-*
- config_name: CSharp
data_files:
- split: train
path: CSharp/train-*
- config_name: Cpp
data_files:
- split: train
path: Cpp/train-*
- config_name: Go
data_files:
- split: train
path: Go/train-*
- config_name: Java
data_files:
- split: train
path: Java/train-*
- config_name: JavaScript
data_files:
- split: train
path: JavaScript/train-*
- config_name: Markdown
data_files:
- split: train
path: Markdown/train-*
- config_name: PHP
data_files:
- split: train
path: PHP/train-*
- config_name: Python
data_files:
- split: train
path: Python/train-*
- config_name: Ruby
data_files:
- split: train
path: Ruby/train-*
- config_name: Rust
data_files:
- split: train
path: Rust/train-*
- config_name: SQL
data_files:
- split: train
path: SQL/train-*
- config_name: Shell
data_files:
- split: train
path: Shell/train-*
- config_name: Swift
data_files:
- split: train
path: Swift/train-*
- config_name: TypeScript
data_files:
- split: train
path: TypeScript/train-*
---
# 💻 Stack-Edu
Stack-Edu is a 125B token dataset of educational code filtered from [The Stack v2](https://huggingface.co/datasets/bigcode/the-stack-v2), precisely the curated training corpus of [StarCoder2](https://arxiv.org/abs/2402.19173) models denoted StarCoder2Data. It is intended for Language Models training.
This dataset was curated using a classifier-based filtering strategy, inspired by [📚 FineWeb-Edu](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu), to retain only the highest-quality educational programming content.
## Downloading the data
This dataset only contains the SWHIDs to download the code files and not the content of the files itself. The contents can be downloaded from Software Heritage's S3 bucket to ensure data compliance.
Please refer to [the-stack-v2](https://huggingface.co/datasets/bigcode/the-stack-v2-train-full-ids) for the data license.
When running on a 16-core AWS `us-east-1` instance, this script takes ~6 hours to download the files:
```python
import boto3
import gzip
from datasets import load_dataset
from botocore.exceptions import ClientError
num_proc = 16
s3 = boto3.client('s3')
bucket_name = "softwareheritage"
def download_contents(blob_id):
key = f"content/{blob_id}"
try:
obj = s3.get_object(Bucket=bucket_name, Key=key)
with gzip.GzipFile(fileobj=obj['Body']) as fin:
content = fin.read().decode("utf-8", errors="ignore")
return {"text": content, "download_success": True}
except ClientError as e:
if e.response['Error']['Code'] == 'NoSuchKey':
print(f"File not found: {key}")
return {"text": "", "download_success": False}
else:
raise
# For Python
ds = load_dataset("HuggingFaceTB/stack-edu", "Python", split="train", num_proc=num_proc)
ds = ds.map(download_contents, input_columns="blob_id", num_proc=num_proc)
# Filter out failed downloads
ds = ds.filter(lambda x: x['download_success'])
# Optionally, print the first example to verify the data
print(ds[0])
```
## Details
The table below shows the number of tokens in each programming language using [SmolLM2](https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct) tokenizer.
| Language | Stack-Edu (B tokens) |
|------------|----------------------|
| Python | 21.8 |
| Cpp | 16.0 |
| Markdown | 14.0 |
| C | 11.1 |
| JavaScript | 11.1 |
| Java | 42.1 |
| SQL | 9.62 |
| PHP | 9.07 |
| C-Sharp | 8.87 |
| TypeScript | 3.03 |
| Shell | 3.13 |
| Swift | 1.83 |
| Go | 1.80 |
| Rust | 1.75 |
| Ruby | 1.61 |
## Dataset curation and results
To build Stack-Edu, we:
- Selected 15 largest programming languages from StarCoder2Data
- Trained 15 language-specific classifiers, using [StarEncoder](https://huggingface.co/bigcode/starencoder) model on synthetic annotations generated by Llama3-70B-Instruct. The classifiers for each language are available in this [collection](https://huggingface.co/collections/HuggingFaceTB/the-ultimate-collection-of-code-classifiers-67b5aa3eb8994a4b71453005).
- Applied a filtering threshold of 3 (out of 5) to retain highly educational content, except for Java, which performed best at threshold 2.
Stack-Edu shows consistent improvement over StarCoder2data on all the programming languages on MultiPL-E benchmark.
<img src="https://cdn-uploads.huggingface.co/production/uploads/61c141342aac764ce1654e43/GWnPgD0diMu0I8buK6mvG.png" width="600"/>
### Citation Information
```
@misc{allal2025smollm2smolgoesbig,
title={SmolLM2: When Smol Goes Big -- Data-Centric Training of a Small Language Model},
author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Gabriel Martín Blázquez and Guilherme Penedo and Lewis Tunstall and Andrés Marafioti and Hynek Kydlíček and Agustín Piqueres Lajarín and Vaibhav Srivastav and Joshua Lochner and Caleb Fahlgren and Xuan-Son Nguyen and Clémentine Fourrier and Ben Burtenshaw and Hugo Larcher and Haojun Zhao and Cyril Zakka and Mathieu Morlon and Colin Raffel and Leandro von Werra and Thomas Wolf},
year={2025},
eprint={2502.02737},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2502.02737},
}
```
|