File size: 4,700 Bytes
7ae5186
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
language:
- en
license: odc-by
tags:
- fineweb
- web-data
- pretraining
- quality-filtered
- ensemble
dataset_info:
  features:
  - name: text
    dtype: string
  - name: id
    dtype: string
  - name: url
    dtype: string
  - name: dump
    dtype: string
  - name: language_score
    dtype: float64
  - name: token_count
    dtype: int64
  - name: dclm_score
    dtype: float64
  - name: edu_score
    dtype: float64
  - name: edu_int_score
    dtype: int64
  - name: wq_vocabulary_richness
    dtype: float64
  - name: wq_info_density
    dtype: float64
  - name: wq_sentence_quality
    dtype: float64
  - name: wq_structure_score
    dtype: float64
  - name: wq_composite
    dtype: float64
  - name: ensemble_score
    dtype: float64
  - name: quality_tier
    dtype: int64
---

# BetterWeb: An Improved FineWeb

BetterWeb is a quality-filtered version of [FineWeb](https://huggingface.co/datasets/HuggingFaceFW/fineweb) that applies **ensemble quality scoring** inspired by state-of-the-art web data curation research.

## What makes it better?

BetterWeb combines three complementary quality signals, inspired by the findings of multiple research papers:

### 1. DCLM FastText Quality Classifier
From [DataComp-LM (arXiv:2406.11794)](https://arxiv.org/abs/2406.11794):
- Trained on OpenHermes-2.5 + ELI5 (positive) vs RefinedWeb (negative)
- **Best-performing single classifier**: 7B model trained on DCLM-filtered data achieved MMLU 63.7
- Measures general instruction-following quality and reasoning clarity

### 2. FineWeb-Edu Educational Classifier
From [FineWeb (arXiv:2406.17557)](https://arxiv.org/abs/2406.17557):
- Linear regression on Snowflake-arctic-embed-m embeddings
- Trained on 460K LLM-annotated samples (0-5 educational scale)
- **FineWeb-Edu reaches FineWeb's MMLU score 10x faster** (38B vs 350B tokens)

### 3. Writing Quality Heuristics
Novel set of heuristic metrics measuring:
- **Vocabulary richness**: Guiraud's corrected type-token ratio
- **Information density**: Content-word ratio (excluding stop words)
- **Sentence quality**: Length distribution and variation
- **Structural quality**: Penalizes list-heavy content

### Ensemble Strategy (from Nemotron-CC)
From [Nemotron-CC (arXiv:2412.02595)](https://arxiv.org/abs/2412.02595):
- FineWeb-Edu and DCLM classifiers **only overlap on ~10% of documents**
- Using union (keep if EITHER classifier says high-quality) recovers **2.5x more HQ tokens**
- This dataset uses `union` mode: keep if `dclm_score >= 0.5` OR `edu_int_score >= 3`

## Quality Tiers

Each document has a `quality_tier` (0-4) for flexible filtering:

| Tier | Label | Criteria |
|------|-------|----------|
| 4 | Exceptional | DCLM ≥ 0.80 AND edu ≥ 4 |
| 3 | High | DCLM ≥ 0.65 OR edu ≥ 4 |
| 2 | Good | DCLM ≥ 0.50 OR edu ≥ 3 |
| 1 | Moderate | DCLM ≥ 0.30 OR edu ≥ 2 |
| 0 | Low | Below all thresholds |

## Usage

```python
from datasets import load_dataset

# Load all BetterWeb data
ds = load_dataset("hynky/betterweb")

# Filter by quality tier
ds_high = ds.filter(lambda x: x["quality_tier"] >= 3)

# Custom filtering using individual scores
ds_custom = ds.filter(lambda x: x["dclm_score"] >= 0.7 and x["edu_int_score"] >= 3)
```

## Scores Explanation

| Column | Range | Description |
|--------|-------|-------------|
| `dclm_score` | 0-1 | DCLM fastText P(high_quality) |
| `edu_score` | 0-5 | FineWeb-Edu continuous score |
| `edu_int_score` | 0-5 | FineWeb-Edu rounded integer score |
| `wq_vocabulary_richness` | 0-1 | Guiraud's corrected TTR |
| `wq_info_density` | 0-1 | Content word density |
| `wq_sentence_quality` | 0-1 | Sentence structure quality |
| `wq_structure_score` | 0-1 | Anti-list-content score |
| `wq_composite` | 0-1 | Weighted writing quality |
| `ensemble_score` | 0-1 | Final composite score |
| `quality_tier` | 0-4 | Discrete quality bucket |

## Source

Filtered from [FineWeb sample-10BT](https://huggingface.co/datasets/HuggingFaceFW/fineweb) (10 billion tokens).

## License

ODC-By 1.0 (same as FineWeb)

## Citation

If you use this dataset, please cite the underlying research:

```bibtex
@article{penedo2024fineweb,
  title={The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scale},
  author={Penedo, Guilherme and Kydlíček, Hynek and others},
  journal={NeurIPS 2024 Datasets and Benchmarks Track},
  year={2024}
}

@article{li2024datacomp,
  title={DataComp-LM: In search of the next data frontier for language models},
  author={Li, Jeffrey and others},
  journal={NeurIPS 2024},
  year={2024}
}

@article{su2024nemotron,
  title={Nemotron-CC: Transforming Web Data into High-Quality Synthetic Data},
  author={Su, Weixin and others},
  year={2024}
}
```