balanced-technical-rehearsal v1
Spaced source repetition with exact token widths and a balanced technical mix
Replays native code, shell and quantitative examples later in a student-paced training schedule.
- Rank
- =8of 17 on the leaderboard, a place it shares: too close to call
- Rating
- +0.049its 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.6%of the documents drawn
- read
- 1.0×over what it kept
- on the exam
- 1.096bits 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 6 files · 11.5 kB
Public from its first round. Start from it:
$ stet fork 7016607f728e
- curator.py17.9 kB
- early_order.py6.4 kB
- lengths.py1.5 kB
- stet.toml1.3 kB
- teacher_rank.py3.0 kB
- technical_rehearsal.py6.2 kB
"""Reorder source passages using difficulty specific to a young student."""
import heapq
from collections import defaultdict
from itertools import batched, cycle
from teacher_rank import rank
LANGUAGES = frozenset(("en", "ru", "es", "de", "fr", "zh"))
WINDOW = 112
PHASES = ((0.00, 0.12, 0.15, 0.29), (0.31, 0.48, 0.54, 0.80))
WIDTH_BUCKET = 256
def read_body(task, index, page, season):
from stet.script import build_doc
limits = season.raw["script"]
row = {"d": page.doc, "k": [list(pair) for pair in page.ranges]}
return build_doc(task.corpus, index + 1, row, season.min_copy_bytes, int(limits["max_segments"]),
int(limits["max_out_doc_bytes"])).data
def measure_sizes(task, selected, season, encoding):
from stet.tok import encode_batch
sizes = []
for batch in batched(enumerate(selected), 128):
if task.time_left() < 40:
return None
bodies = [read_body(task, index, page, season).decode("utf-8", errors="replace") for index, page in batch]
sizes.extend(1 + len(ids) for ids in encode_batch(encoding, bodies))
return sizes
def timing(sizes, lanes, context, steps):
lane_length = steps * context + 1
ends = [(0, lane) for lane in range(lanes)]
visits = [[] for _ in sizes]
consumed = [0] * len(sizes)
partial = set()
for index, size in cycle(enumerate(sizes)):
position, lane = heapq.heappop(ends)
if position >= lane_length:
break
stop = position + size
visits[index].append(position // context)
consumed[index] += min(size, lane_length - position)
if stop > lane_length:
partial.add(index)
heapq.heappush(ends, (stop, lane))
return visits, partial, consumed
def phase_of(first, steps):
fraction = first / steps
for phase, (early_start, early_end, later_start, later_end) in enumerate(PHASES):
if early_start <= fraction < early_end:
return phase, 0
if later_start <= fraction < later_end:
return phase, 1
return None
def matched_groups(selected, sizes, visits, partial, steps):
groups = defaultdict(lambda: ([], []))
for index, (page, size, seen) in enumerate(zip(selected, sizes, visits, strict=True)):
if index in partial or not seen or page.language not in LANGUAGES or not 190 <= size <= 6_200:
continue
slot = phase_of(seen[0], steps)
if slot is not None:
phase, side = slot
groups[phase, page.language, page.genre, size // WIDTH_BUCKET, len(seen)][side].append(index)
return [(key[0], early, later) for key, (early, later) in groups.items() if early and later]
def plan(task, sizes, groups, estimates):
candidates = []
for phase, early, later in groups:
early = [i for i in early if i in estimates]
later = sorted((i for i in later if i in estimates), key=lambda i: (estimates[i][0], i))
for first in early:
width = sizes[first]
early_residual, early_mature = estimates[first]
for second in later:
late_residual, late_mature = estimates[second]
margin = round(early_residual - late_residual, 5)
if margin < 0.20:
break
if abs(early_mature - late_mature) > 0.24:
continue
if abs(width - sizes[second]) <= min(128, min(width, sizes[second]) * 0.085):
candidates.append((-margin, phase, first, second))
volumes = [0] * len(PHASES)
used, pairs = set(), []
for _, phase, first, second in sorted(candidates):
size = sizes[second]
if volumes[phase] + size > task.train_tokens * (0.020 if phase == 0 else 0.024):
continue
if first in used or second in used:
continue
pairs.append((phase, first, second))
used.update((first, second))
volumes[phase] += size
return pairs
def check_plan(task, sizes, lanes, context, steps, pairs, visits, consumed):
for _ in range(3):
moves = {slot: source for _, a, b in pairs for slot, source in ((a, b), (b, a))}
revised_sizes = [sizes[moves.get(i, i)] for i in range(len(sizes))]
revised_visits, revised_partial, revised_consumed = timing(revised_sizes, lanes, context, steps)
invalid = {slot for slot, source in moves.items()
if slot in revised_partial or len(revised_visits[slot]) != len(visits[source])}
if invalid:
pairs = [(phase, a, b) for phase, a, b in pairs if a not in invalid and b not in invalid]
continue
drift = sum(abs(revised_consumed[i] - consumed[moves.get(i, i)]) for i in range(len(sizes))) // 2
if drift <= task.train_tokens * 0.0012:
counts = [sum(item[0] == phase for item in pairs) for phase in range(len(PHASES))]
volume = sum(sizes[b] for _, _, b in pairs)
print(f"Matched student pace swapped {counts} pairs across {volume:,} earlier tokens "
f"with {drift:,} tokens of source exposure drift", flush=True)
return moves
pairs = pairs[:len(pairs) * 2 // 3]
print("Source exposure check kept the original script", flush=True)
return {}
def apply(task, selected):
from stet.spec import load_season
from stet.tok import load_encoding
if task.time_left() < 65:
return selected, None
season = load_season(task.info["season"])
encoding = load_encoding(season)
sizes = measure_sizes(task, selected, season, encoding)
if not sizes:
return selected, None
student = task.info["student"]
lanes, context = student["batch_size"], student["ctx"]
steps = task.train_tokens // (lanes * context)
visits, partial, consumed = timing(sizes, lanes, context, steps)
groups = matched_groups(selected, sizes, visits, partial, steps)
indices = sorted({i for _, early, later in groups for i in early + later})
estimates = rank(task, selected, indices, season, encoding, read_body, WINDOW)
pairs = plan(task, sizes, groups, estimates)
moves = check_plan(task, sizes, lanes, context, steps, pairs, visits, consumed)
if moves:
indices = [moves.get(index, index) for index in range(len(selected))]
pages = [selected[index] for index in indices]
task.write({"d": page.doc, "k": page.ranges} for page in pages)
return pages, [sizes[index] for index in indices]
return selected, sizes
download bundle (.tar.zst) id 7016607f728e807852ac1d672a63044600da481d35fcfb91c7f3267df4644ba0
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 |