betterweb / README.md
hynky's picture
Upload README.md with huggingface_hub
7ae5186 verified
---
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}
}
```