paced-prose-selection v1
Two-student pacing and exact-length late prose substitutions within each language and form
Keeps a student-paced training schedule and replaces selected late prose with more coherent sources of the same token length.
- Rank
- =8of 17 on the leaderboard, a place it shares: too close to call
- Rating
- +0.048its gain a round, on average, held nearer everyone's while its rounds are few (±0.008)
Round by round
3 rounds
Where it came in each round, and its gain.
Inside its latest round round 10
- pages kept
- 14.7%of the documents drawn
- read
- 1.0×over what it kept
- on the exam
- 1.101bits per byte, against 1.152 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.
The model, learning from it
Training loss on its pages. Low here is not the goal; the exam is.
Its code 7 files · 11.8 kB
Public from its first round. Start from it:
$ stet fork b4fe039a5827
- continuity.py3.8 kB
- curator.py17.4 kB
- early_order.py6.4 kB
- lengths.py1.5 kB
- prose_selection.py3.9 kB
- stet.toml1.3 kB
- teacher_rank.py3.0 kB
import math
import random
import re
from array import array
from collections import defaultdict
from xxhash import xxh3_64_intdigest as digest
WORDS = re.compile(r"[^\W\d_]{2,}")
UNSEGMENTED = re.compile(r"[\u0e00-\u0eff\u1000-\u109f\u1780-\u17ff\u3040-\u30ff\u3400-\u9fff]")
BUCKET_BITS = 20
BUCKET_MASK = (1 << BUCKET_BITS) - 1
def words(text):
for match in WORDS.finditer(text):
word = match.group()
# Long unsegmented scripts still have recurring local characters.
if len(word) > 3 and not word.isascii() and UNSEGMENTED.search(word):
for start in range(len(word) - 2):
yield word[start:start + 3]
elif len(word) >= 3:
yield word
def build_frequencies(task):
corpus = task.corpus
sample = random.Random(499).sample(range(len(corpus)), min(len(corpus), 16_000))
first = array("I", [0]) * (1 << BUCKET_BITS)
second = array("I", [0]) * (1 << BUCKET_BITS)
observed = 0
for doc in sample:
if observed % 128 == 0 and task.time_left() < 65:
break
raw = corpus.raw(doc)
offset = len(raw) // 3
excerpt = raw[:1200] + b" " + raw[offset:offset + 1200]
text = excerpt.decode("utf-8", errors="ignore").lower()
for word in set(words(text)):
key = digest(word.encode())
first[key & BUCKET_MASK] += 1
second[key >> 32 & BUCKET_MASK] += 1
observed += 1
print(f"Estimated topic frequencies from {observed:,} source pages", flush=True)
return first, second, observed
def continuity(clean, frequencies):
if len(clean) < 550:
return None
if len(clean) > 5400:
middle = len(clean) // 2
clean = b" ".join((clean[:1800], clean[middle - 900:middle + 900], clean[-1800:]))
terms = list(words(clean.decode("utf-8", errors="ignore").lower()))
if len(terms) < 72:
return None
segments = min(6, len(terms) // 26)
width = (len(terms) + segments - 1) // segments
by_term = {}
contexts = set()
repeated = 0
for index in range(1, len(terms) - 1):
word = terms[index]
before, after = terms[index - 1], terms[index + 1]
context = before, word, after
if context in contexts:
repeated += 1
continue
contexts.add(context)
segment = index // width
by_term[word] = by_term.get(word, 0) | (1 << segment)
first, second, observed = frequencies
common = max(12, observed * 0.012)
anchor_weight = 0.0
linked = 0
for word, occurrences in by_term.items():
count = occurrences.bit_count()
if count < 2:
continue
key = digest(word.encode())
frequency = min(first[key & BUCKET_MASK], second[key >> 32 & BUCKET_MASK])
if frequency >= common:
continue
anchor_weight += min(2, count - 1) / math.sqrt(1 + frequency / 5)
linked |= occurrences
revisit = math.sqrt(anchor_weight / width) * linked.bit_count() / segments
return revisit - 1.75 * repeated / len(terms)
def rescore(candidates):
groups = defaultdict(list)
for page in candidates:
if page.continuity is not None:
key = page.language, page.genre, page.tokens.bit_length()
groups[key].append(page)
changed = 0
for pages in groups.values():
if len(pages) < 45:
continue
values = sorted(page.continuity for page in pages)
median = values[len(values) // 2]
iqr = max(0.09, values[3 * len(values) // 4] - values[len(values) // 4])
for page in pages:
shift = max(-1.15, min(1.15, (page.continuity - median) / iqr))
page.score += 0.34 * shift
changed += len(pages)
print(f"Topical continuity reranked {changed:,} pages across {len(groups):,} language, form and length groups", flush=True)
download bundle (.tar.zst) id b4fe039a582713def1066b9711e33a0de9e09ed4b2c62819c94ad1f0b004c113
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.
| Path | Size | sha256 | From |
|---|---|---|---|
| language/lid.176.ftz | 916.0 kB | 8f3472cfe873 | https://huggingface.co/julien-c/fasttext-language-id/resolve/9f2e94d2fd6b2615d26f5ec5b34cf7e2f38cb86e/lid.176.ftz |
| difficulty/early.safetensors | 56.0 MB | f828164714bf | https://huggingface.co/ericflo/stet-matched-student-pace/resolve/a11215d67107307d0e76180494f41755edf4917d/early.safetensors |
| difficulty/mature.safetensors | 56.0 MB | 64c2afc22042 | https://huggingface.co/ericflo/stet-matched-student-pace/resolve/a11215d67107307d0e76180494f41755edf4917d/mature.safetensors |
| difficulty/calibration.json | 170 B | 3be8effd9fd9 | https://huggingface.co/ericflo/stet-matched-student-pace/resolve/a11215d67107307d0e76180494f41755edf4917d/calibration.json |
| total | 112.9 MB |