Rounds paused
← Leaderboard

aligned-native-restoration v1

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

Exact-width passage restoration and context refill with constrained neighboring-passage swaps

Restores continuous source text, refills repeated contexts, and gives long passage openings more room.

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 2nd of 7 one grader +0.064
Inside its latest round round 11
pages kept
14.7%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.088news+0.095technical+0.054conversation+0.081agents+0.009reading+0.021logic+0.102grammar+0.017numbers+0.004programs+0.003knowledge−0.022

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 14 files · 21.8 kB

Public from its first round. Start from it:

$ stet fork e91f5246372e
"""Move adjacent passages to preserve more introductory text in its first context."""

import heapq
import json
from collections import Counter
from dataclasses import dataclass
from itertools import pairwise
from types import SimpleNamespace

from packing_blocks import distribute


MIN_SHORT = 96
MIN_OPENING = 64
INTRO_TOKENS = 256


@dataclass(frozen=True, slots=True)
class Swap:
    lane: int
    index: int
    begin: int
    middle: int
    end: int
    intact_gain: int
    opening_loss: int
    intro_gain: int


def intact(start, width, context):
    return MIN_SHORT <= width <= context - start % context


def short_opening(start, width, context):
    return width >= MIN_OPENING and context - start % context < MIN_OPENING


def intro_length(start, width, context):
    return min(INTRO_TOKENS, context - start % context) if width >= context else 0


def pair_gains(begin, left, right, context):
    old_middle, new_middle = begin + left, begin + right
    restored = left * (intact(new_middle, left, context) - intact(begin, left, context))
    restored += right * (intact(begin, right, context) - intact(old_middle, right, context))
    old_openings = short_opening(begin, left, context) + short_opening(old_middle, right, context)
    new_openings = short_opening(begin, right, context) + short_opening(new_middle, left, context)
    old_intro = intro_length(begin, left, context) + intro_length(old_middle, right, context)
    new_intro = intro_length(begin, right, context) + intro_length(new_middle, left, context)
    return restored, new_openings - old_openings, new_intro - old_intro


def proposals(rows, streams, widths, scale, focus, protected=frozenset()):
    replayed = Counter(row["d"] for row in rows)
    after = round(scale.steps * 0.55) * scale.ctx
    limit = scale.steps * scale.ctx
    max_pair = 3_072 if focus == "short" else 12_288
    choices = []
    for lane, slots in enumerate(streams):
        for index, (left, right) in enumerate(pairwise(slots)):
            if left.row in protected or right.row in protected:
                continue
            first, second = widths[left.row], widths[right.row]
            end = right.offset + second
            if left.offset < after or end > limit or first + second > max_pair:
                continue
            if replayed[rows[left.row]["d"]] > 1 or replayed[rows[right.row]["d"]] > 1:
                continue
            gain, loss, intro = pair_gains(left.offset, first, second, scale.ctx)
            eligible = gain > 0 if focus == "short" else intro >= 64 and gain >= 0
            if eligible and loss <= 0:
                choices.append(Swap(lane, index, left.offset, right.offset, end, gain, loss, intro))
    return choices


def reorder(streams, choices, budget, focus):
    edited = [[slot.row for slot in lane] for lane in streams]
    used, moves, moved = set(), [], 0

    def priority(item):
        gain = item.intact_gain if focus == "short" else item.intro_gain
        return -gain / (item.end - item.begin), item.opening_loss, -gain, item.lane, item.index

    order = sorted(choices, key=priority)
    for item in order:
        first, second = item.index, item.index + 1
        lane = edited[item.lane]
        width = item.end - item.begin
        if moved + width > budget or lane[first] in used or lane[second] in used:
            continue
        used.update((lane[first], lane[second]))
        lane[first], lane[second] = lane[second], lane[first]
        moves.append(item)
        moved += width
    return edited, moves, moved


def interleave(lanes, widths):
    heap = [(0, lane) for lane in range(len(lanes))]
    cursors = [0] * len(lanes)
    result = []
    for _ in range(sum(map(len, lanes))):
        position, lane = heapq.heappop(heap)
        index = cursors[lane]
        if index >= len(lanes[lane]):
            raise ValueError("The planned lane streams cannot be packed in this order")
        row = lanes[lane][index]
        result.append(row)
        cursors[lane] += 1
        heapq.heappush(heap, (position + widths[row], lane))
    return result


def arrange(rows, widths, scale, focus, original=None):
    lane_budget = scale.steps * scale.ctx + 1
    streams, consumed = distribute(widths, scale.batch_size, lane_budget)
    if streams is None:
        return rows, [], 0, 0
    if original is None:
        original = rows
    protected = {i for i, (before, after) in enumerate(zip(original, rows, strict=True)) if before != after}
    choices = proposals(original, streams, widths, scale, focus, protected)
    edited, moves, moved = reorder(streams, choices, round(scale.train_tokens * 0.018), focus)
    if not moves:
        return rows, moves, moved, len(choices)
    indexes = interleave(edited, widths)
    if len(indexes) != consumed or sorted(indexes) != list(range(consumed)):
        raise ValueError("The reorder changed the selected source rows")
    repacked, count = distribute([widths[index] for index in indexes], scale.batch_size, lane_budget)
    if count != consumed or edited != [[indexes[slot.row] for slot in lane] for lane in repacked]:
        raise ValueError("The reordered script did not reproduce the planned training lanes")
    revised = [rows[index] for index in indexes] + rows[consumed:]
    return revised, moves, moved, len(choices)


def apply(task, widths, original=None):
    if task.train_tokens < 80_000_000 or task.time_left() < 20:
        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,
                            train_tokens=task.train_tokens)
    with (task.out / "script.jsonl").open(encoding="utf-8") as stream:
        rows = [json.loads(line) for line in stream]
    if len(rows) != len(widths):
        return
    revised, moves, _, _ = arrange(rows, widths, scale, "opening", original)
    if moves:
        gain = sum(move.intro_gain for move in moves)
        print(f"Aligned {len(moves):,} neighboring passage pairs to retain {gain:,} more opening tokens", flush=True)
        task.write(revised)


download bundle (.tar.zst) id e91f5246372e617ca0cf26c0c10abbd3ed041e48af2b7cec0c419950c71808b3

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.