Rounds paused
← Leaderboard

early-phrase-coverage v1

by ericflo-sol62 (github.com/ericflo) entered 24 Nov 2026

Cross-site phrase counts and equal-token curriculum swaps within language and writing form

Moves passages with reusable phrases earlier in training while preserving every selected page.

Rank
not yet1 of the 3 rounds it needs to be ranked
Rating
+0.053its gain a round, on average, held nearer everyone's while its rounds are few (±0.014)

Against the record holder, fineweb2: ahead by +0.010 a round over 1 shared round. Tested at 5, 4 to go. the race →

Round by round

1 round

Where it came in each round, and its gain.

  1. Round 11 3rd of 7 one grader +0.064
Inside its latest round round 11
pages kept
14.6%of the documents drawn
read
1.0×over what it kept
on the exam
1.085bits per byte, against 1.149 unedited

Where the gain comes from

Its gain on each part of the exam, in bits per byte better than unedited. The kinds of writing are three quarters of the score, the skills one quarter. Right is better.

bits per byte better than unedited−0.050.000.050.100.15reference+0.092news+0.093technical+0.053conversation+0.079agents−0.005reading+0.019logic+0.110grammar+0.021numbers+0.001programs+0.007knowledge−0.032

The model, learning from it

Training loss on its pages. Low here is not the goal; the exam is.

46810training loss, bits per tokenstep 48step 9,696

who ran and graded it in round 11 →

Its code 10 files · 16.3 kB

Public from its first round. Start from it:

$ stet fork dff6832d6a78
"""Move pages with reusable phrases earlier while retaining every source row."""

import json
import math
import random
from collections import Counter
from types import SimpleNamespace

from stet.script import build_doc
from stet.spec import load_season
from xxhash import xxh3_64_intdigest

from continuity import words
from curator import find_genre, host_of, language_of
from packing_blocks import alternatives, distribute, replay


FORMS = frozenset(("prose", "news", "reference", "discussion", "technical"))
HOST_FOLDS = 12
FOLD_MASK = (1 << HOST_FOLDS) - 1


def phase(step, total):
    progress = step / total
    if 0.04 <= progress < 0.20:
        return 0, 0
    if 0.24 <= progress < 0.46:
        return 0, 1
    return None


def phrases(text):
    size = 600
    if len(text) < 3 * size:
        windows = (text,)
    else:
        middle = len(text) // 2
        windows = text[:size], text[middle - size // 2:middle + size // 2], text[-size:]
    result = set()
    for window in windows:
        terms = list(words(window.casefold()))
        for phrase in zip(terms, terms[1:], terms[2:]):
            result.add(xxh3_64_intdigest(" ".join(phrase).encode()))
    return result


def evidence(rows, streams, widths, scale, read, urls):
    start = round(scale.steps * 0.56) * scale.ctx
    end = round(scale.steps * 0.96) * scale.ctx
    candidates = [slot.row for lane in streams for slot in lane
                  if start <= slot.offset and slot.offset + widths[slot.row] <= end]
    random.Random(42_861).shuffle(candidates)
    seen, support = set(), {}
    hosts = Counter()
    for index in candidates:
        doc = rows[index]["d"]
        host = host_of(urls[doc])
        if doc in seen or hosts[host] >= 8:
            continue
        seen.add(doc)
        hosts[host] += 1
        bit = 1 << (host % HOST_FOLDS)
        for phrase in phrases(read(index)):
            support[phrase] = (support.get(phrase, 0) + (1 << HOST_FOLDS)) | bit
        if len(seen) == 12_000:
            break
    print(f"Estimated phrase reuse from {len(seen):,} later sources across {len(hosts):,} hosts", flush=True)
    return support


def describe(rows, streams, widths, scale, read, urls, detector, support):
    repeats = Counter(row["d"] for row in rows)
    tags, scores = [None] * len(rows), [0.0] * len(rows)
    for slot in (slot for lane in streams for slot in lane if phase(slot.offset // scale.ctx, scale.steps)):
        index = slot.row
        doc = rows[index]["d"]
        if repeats[doc] > 1 or not 240 <= widths[index] <= 6_200:
            continue
        text = read(index)
        raw = text[:5_500].encode()
        genre = find_genre(raw, urls[doc].lower(), raw.count(b"\n"))[0]
        if genre not in FORMS:
            continue
        context = phrases(text)
        if len(context) < 35:
            continue
        language = language_of(text, detector)
        host = host_of(urls[doc])
        others = FOLD_MASK ^ (1 << (host % HOST_FOLDS))
        reuse = 0.0
        for phrase in context:
            record = support.get(phrase, 0)
            count = record >> HOST_FOLDS
            folds = (record & others).bit_count()
            if folds >= 2 and count <= 100:
                reuse += math.log1p(folds) / math.sqrt(count)
        tags[index] = language, genre
        scores[index] = reuse / len(context)
    return tags, scores


def choose(groups, widths, scores, budget):
    def value(span):
        return sum(widths[row] * scores[row] for row in span.rows) / span.width

    candidates = []
    for key, (front, back) in groups.items():
        if not front or not back:
            continue
        early = sorted(((value(span), span) for span in front), key=lambda pair: pair[0])
        later = sorted(((value(span), span) for span in back), key=lambda pair: -pair[0])
        for left_value, left in early:
            for right_value, right in later[:8]:
                advantage = right_value - left_value
                if advantage <= 0:
                    break
                candidates.append((advantage, key[0], left, right))
    candidates.sort(key=lambda item: (-item[0], -item[2].width, item[2].rows, item[3].rows))
    moved, improved = 0, 0.0
    used, swaps = set(), []
    for margin, cohort, front, back in candidates:
        selected = front.rows + back.rows
        if moved + front.width > budget or used.intersection(selected):
            continue
        used.update(selected)
        swaps.append((cohort, front, back))
        moved += front.width
        improved += front.width * margin
    return swaps, moved, improved


def apply(task, widths, detector):
    if detector is None or task.train_tokens < 80000000 or task.time_left() < 135:
        return
    student = task.info["student"]
    context, batch = student["ctx"], student["batch_size"]
    scale = SimpleNamespace(steps=task.train_tokens // (context * batch), ctx=context, batch_size=batch)
    with (task.out / "script.jsonl").open(encoding="utf-8") as stream:
        rows = [json.loads(line) for line in stream]
    if len(rows) != len(widths) or any("d" not in row for row in rows):
        return
    streams, consumed = distribute(widths, batch, scale.steps * context + 1)
    if streams is None:
        return
    season = load_season(task.info["season"])
    limits = season.raw["script"]
    bounds = season.min_copy_bytes, int(limits["max_segments"]), int(limits["max_out_doc_bytes"])

    def read(index):
        built = build_doc(task.corpus, index + 1, rows[index], *bounds)
        return built.data.decode("utf-8", errors="replace")

    support = evidence(rows, streams, widths, scale, read, task.corpus.urls)
    if task.time_left() < 70:
        return
    tags, scores = describe(rows, streams, widths, scale, read, task.corpus.urls, detector, support)
    groups = alternatives(streams, widths, tags, scale.steps, context, phase, 3)
    swaps, moved, improved = choose(groups, widths, scores, round(task.train_tokens * 0.018))
    if not swaps or task.time_left() < 8:
        return
    order = replay(streams, widths, swaps, consumed)
    if sorted(order) != list(range(len(rows))):
        raise ValueError("The phrase curriculum lost or duplicated a source row")
    task.write(rows[index] for index in order)
    print(f"Moved {len(swaps):,} exact-width passages with {moved:,} tokens earlier, "
          f"improving estimated phrase reuse by {improved / moved:.5f}", flush=True)


download bundle (.tar.zst) id dff6832d6a789152c78bb445ba86645da8f2c3625af464c49261ba43894b4e6f

Files it fetches 112.9 MB in 4 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.