Rounds paused
SeasonsSeason 1 Finished 22 Nov 2026
← Leaderboard

tidy v1

by stet entered 19 Nov 2026 entered by the organisers

prose-line ranges + dedup + crude quality rank, shuffled

English prose only, exact duplicates dropped, navigation and boilerplate lines cut out of each page, the best budget's worth kept, shuffled. No model, no GPU.

Rank
13of 14 on the leaderboard
Rating
−0.146its gain a round, on average (±0.006)

Against the record holder, ericflo-sol-6-2: behind by −0.191 a round over 13 shared rounds. Tested at 20, 7 to go. the race →

Inside its latest round round 14
pages kept
28.6%of the documents drawn
read
1.2×over what it kept
its own words
0%of tokens not copied
on the exam
3.015bits 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.

bits per byte better than unedited−0.3−0.2−0.10.0knowledge−0.223reading−0.240reasoning−0.114code−0.036agents−0.126writing−0.213conversation−0.190

The model, learning from it

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

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

who ran and graded it in round 14 →

Its code 2 files · 2.0 kB

Public from its first round. Start from it:

"""An afternoon of heuristics: the baseline a serious entry should beat.

  1. Keep English prose.
  2. Drop exact duplicates.
  3. Inside each document, cut lines that look like navigation or boilerplate.
  4. Rank what is left by a crude "is this explanatory prose" score.
  5. Keep the best documents until the training budget is filled once, and shuffle them.

No model, no GPU, a few seconds per shard. Everything here is a cut of at least
min_copy_bytes, so it spends no ink.
"""

import hashlib
import random
import re

from stet.curator import Task

SENTENCE_END = re.compile(r"[.!?][\"')\]]?\s")
STOPWORDS = (" the ", " of ", " and ", " to ", " in ", " is ", " that ", " for ")
# Rough, for English prose under the season tokenizer, and on the generous side: a stream
# that runs over the budget is cut off, one that falls short repeats from the top.
BYTES_PER_TOKEN = 3.7


def looks_english(text: str) -> bool:
    sample = text[:3000]
    if len(sample) < 200:
        return False
    letters = sum(c.isascii() and (c.isalpha() or c == " ") for c in sample)
    if letters / len(sample) < 0.75:
        return False
    low = sample.lower()
    return sum(low.count(w) for w in STOPWORDS) >= max(4, len(sample) // 300)


def prose_ranges(text: str, min_copy: int = 64) -> tuple[list[list[int]], int]:
    """Byte ranges of the lines worth keeping, and how many bytes they hold."""
    ranges: list[list[int]] = []
    pos = 0
    for line in text.split("\n"):
        n = len(line.encode("utf-8")) + 1  # + the newline
        body = line.strip()
        words = body.count(" ") + 1
        is_prose = len(body) >= 60 and words >= 10 and (SENTENCE_END.search(body + " ") is not None)
        if is_prose:
            if ranges and ranges[-1][1] == pos:
                ranges[-1][1] = pos + n
            else:
                ranges.append([pos, pos + n])
        pos += n
    # A kept run shorter than min_copy bytes would be charged as ink. Drop those.
    ranges = [r for r in ranges if r[1] - r[0] >= min_copy + 4]
    return ranges, sum(b - a for a, b in ranges)


def score(text: str, kept: int) -> float:
    """Higher is better. Rewards documents that are mostly prose and long enough to say something."""
    total = max(1, len(text.encode("utf-8")))
    density = kept / total
    length = min(1.0, kept / 3000)
    low = text[:4000].lower()
    explains = sum(low.count(w) for w in (" because ", " therefore ", " however ", " for example ", " which ", " whereas "))
    sells = sum(low.count(w) for w in (" buy ", " price", " shipping", " cart", " sale", " click ", " subscribe", " cookies"))
    return density * 1.0 + length * 1.0 + min(explains, 8) * 0.08 - min(sells, 8) * 0.1


def edit(task: Task):
    corpus = task.corpus
    min_copy = int(task.info.get("min_copy_bytes", 64))
    seen: set[bytes] = set()
    scored = []
    for i, text in corpus:
        if not looks_english(text):
            continue
        ranges, kept = prose_ranges(text, min_copy)
        if kept < 400:
            continue
        key = hashlib.blake2b(text[:2000].encode("utf-8", "replace"), digest_size=8).digest()
        if key in seen:
            continue
        seen.add(key)
        size = corpus.size(i)
        # Clamp to the document: the last line may not end in a newline.
        ranges = [[a, min(b, size)] for a, b in ranges if a < size and min(b, size) - a >= min_copy]
        scored.append((score(text, kept), i, ranges, kept))

    scored.sort(key=lambda t: -t[0])
    budget_bytes = task.train_tokens * BYTES_PER_TOKEN
    chosen = []
    used = 0
    for _, i, ranges, kept in scored:
        if used >= budget_bytes:
            break
        chosen.append({"d": i, "k": ranges})
        used += kept
    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 b82597376e3b604cd7daef4b0e0cd66e1c74934fa81db51407988e8d1e7b9c03