dclm v1
fastText quality classifier (OH-2.5 + ELI5 vs web), top of the ranking
DCLM-Baseline's recipe, rebuilt: English pages, exact duplicates dropped, ranked by the published fastText classifier (OpenHermes 2.5 and ELI5 against random web), the top kept. A reference: the best published filter for 1B to 7B models.
- Rank
- 11of 14 on the leaderboard
- Rating
- −0.079its gain a round, on average (±0.005)
Against the record holder, ericflo-sol-6-2: behind by −0.126 a round over 13 shared rounds. Tested at 20, 7 to go. the race →
Round by round
13 rounds
Where it came in each round, and its gain.
- Round 14 10th of 11 one grader −0.052
- Round 13 10th of 11 one grader −0.091
- Round 12 10th of 11 one grader −0.073
- Round 11 6th of 8 one grader −0.081
- Round 10 6th of 8 one grader −0.101
- Round 9 6th of 8 one grader −0.108
- Round 8 8th of 9 one grader −0.094
- Round 7 8th of 11 one grader −0.011
- Round 6 8th of 11 one grader −0.080
- Round 5 7th of 10 one grader −0.085
- Round 4 6th of 8 one grader −0.074
- Round 3 6th of 8 one grader −0.097
- Round 2 4th of 6 one grader −0.079
Inside its latest round round 14
- pages kept
- 20.1%of the documents drawn
- read
- 1.0×over what it kept
- its own words
- 0%of tokens not copied
- on the exam
- 2.881bits per byte, against 2.829 unedited
Where the gain comes from
Its gain on each thing the exam tests, in bits per byte better than unedited. Each counts the same. Right is better.
The model, learning from it
Training loss on its pages. Low here is not the goal; the exam is.
Its code 2 files · 1.9 kB
Public from its first round. Start from it:
"""DCLM-Baseline's filter, rebuilt as a reference curator.
DataComp-LM (Li et al., 2024) found that the best filter for its 1B to 7B models was a
fastText classifier telling instruction-style text (OpenHermes 2.5, and highly rated ELI5
answers) from random web pages, keeping the top tenth. This curator uses that classifier, as
published (mlfoundations/fasttext-oh-eli5):
1. English pages, exact duplicates dropped.
2. Each page scored by the classifier's probability that it is the instruction-style kind.
3. The best pages kept until the training budget is filled once, in a fixed random order.
It is a reference, not an entry to beat. An exam is checked by whether it puts this, and
FineWeb-Edu's filter, above heuristic filtering, and that above raw crawl text, as the
published results did. Whole pages only, so it spends no ink.
"""
import hashlib
import random
import sys
from stet.curator import Task
BYTES_PER_TOKEN = 3.7
LID_MIN = 0.65 # RefinedWeb's and FineWeb's threshold for English
_lid = None
def looks_english(task, text: str) -> bool:
"""English, as the published recipes decide it: fastText language identification, the
English score at least 0.65 (Meta's model, facebook/fasttext-language-identification)."""
global _lid
if _lid is None:
import fasttext
_lid = fasttext.load_model(str(task.asset("lid/model.bin")))
if len(text) < 200:
return False
labels, probs = _lid.predict(" ".join(text[:2000].split()))
return labels[0] == "__label__eng_Latn" and float(probs[0]) >= LID_MIN
def edit(task: Task):
import fasttext
model = fasttext.load_model(str(task.asset("dclm-fasttext/openhermes_reddit_eli5_vs_rw_v2_bigram_200k_train.bin")))
print(f"classifier loaded, {task.time_left():.0f}s left", file=sys.stderr)
corpus = task.corpus
seen: set[bytes] = set()
scored = []
for i, text in corpus:
if not looks_english(task, text):
continue
key = hashlib.blake2b(text.encode("utf-8", "replace"), digest_size=8).digest()
if key in seen:
continue
seen.add(key)
labels, probs = model.predict(" ".join(text.split())[:100_000])
p = float(probs[0]) if labels[0] == "__label__hq" else 1.0 - float(probs[0])
scored.append((round(p, 4), i, len(text.encode("utf-8", "replace"))))
scored.sort(key=lambda t: (-t[0], t[1]))
budget, used, chosen = task.train_tokens * BYTES_PER_TOKEN, 0, []
for _, i, size in scored:
if used >= budget:
break
chosen.append(i)
used += size
print(f"{len(scored):,} English pages scored, {len(chosen):,} kept", file=sys.stderr)
random.Random(0).shuffle(chosen)
return chosen
def main():
task = Task.from_env()
task.write(edit(task))
if __name__ == "__main__":
main()
download bundle (.tar.zst) id d472f24a31308653c2f770eec6cf0b2fd79d4854897b1744c49e541a37d7eb9f
Files it fetches 3.3 GB in 2 files
Too large for the bundle, so named in it by address and hash. Every machine that runs it downloads each one and checks its sha256 before the curator starts, and the curator still has no network.
| Path | Size | sha256 | From |
|---|---|---|---|
| dclm-fasttext/openhermes_reddit_eli5_vs_rw_v2_bigram_200k_train.bin | 2.2 GB | f8da53846636 | https://huggingface.co/mlfoundations/fasttext-oh-eli5/resolve/cd8b714a90f2dbcd3b02cf5fc972e5d7c7f4f107/openhermes_reddit_eli5_vs_rw_v2_bigram_200k_train.bin |
| lid/model.bin | 1.1 GB | 8ded5749a2ad | https://huggingface.co/facebook/fasttext-language-identification/resolve/3af127d4124fc58b75666f3594bb5143b9757e78/model.bin |
| total | 3.3 GB |