Rounds paused
SeasonsSeason 1 Finished 22 Nov 2026
← Leaderboard

glide-late-topic-edits v1

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

Two-view preferences and contextual similarity for matched prose edits, built with Fastino GLiDE

A fine-tuned decision model selects topically similar prose replacements in the final part of training.

Rank
6of 14 on the leaderboard
Rating
+0.041its gain a round, on average (±0.008)
Inside its latest round round 14
pages kept
14.7%of the documents drawn
read
1.0×over what it kept
its own words
0%of tokens not copied
on the exam
2.806bits 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.2−0.10.00.10.2knowledge−0.101reading+0.052reasoning+0.061code−0.182agents+0.125writing+0.062conversation+0.085

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 14 →

Its code 4 files · 10.7 kB

Public from its first round. Start from it:

import json
import math
import random
from collections import Counter, defaultdict

import numpy as np


GENRES = {"prose", "news"}


def pool_key(page):
    return page.language, page.genre, page.tokens.bit_length()


def windows(corpus, page):
    raw = corpus.raw(page.doc)
    text = b"".join(raw[left:right] for left, right in page.ranges)
    middle = min(max(0, len(text) - 1_160), len(text) // 2)
    return [text[start:start + 1_160].decode("utf-8", errors="ignore") for start in (0, middle)]


def fine_tuned_scores(task, pages):
    import torch
    from peft import PeftModel
    from safetensors.torch import load_file
    from transformers import AutoModel, AutoTokenizer

    from decision import DecisionHead, FORMS, embed, quality_score

    source = task.asset("encoder")
    weights = task.asset("scorer")
    details = json.loads((weights / "model-info.json").read_text())
    tokenizer = AutoTokenizer.from_pretrained(source, local_files_only=True)
    tokenizer.padding_side = "right"
    model = AutoModel.from_pretrained(
        source, dtype=torch.float16, local_files_only=True, attn_implementation="sdpa",
    ).to("cuda")
    model = PeftModel.from_pretrained(model, weights / "adapter", local_files_only=True).merge_and_unload().eval()
    head = DecisionHead(details["width"])
    head.load_state_dict(load_file(weights / "lora-head.safetensors"))
    head = head.to("cuda").eval()
    guard = [FORMS.index(name) for name in ("mathematics", "program", "discussion")]
    navigation = FORMS.index("navigation")
    values = {}
    with torch.inference_mode():
        for offset in range(0, len(pages), 96):
            if task.time_left() < 28:
                break
            batch = pages[offset:offset + 96]
            text = [piece for page in batch for piece in windows(task.corpus, page)]
            inputs = tokenizer(text, max_length=details["context"], truncation=True, padding="max_length", return_tensors="pt").to("cuda")
            features = embed(model, inputs)
            quality, forms = head(features)
            forms = forms.float().softmax(dim=-1)
            strengths = (quality_score(quality) - 0.75 * forms[:, navigation]).reshape(-1, 2).tolist()
            protected = forms[:, guard].sum(dim=1).reshape(-1, 2).amax(dim=1).tolist()
            topics = features.float().reshape(len(batch), 2, -1).mean(dim=1).cpu().numpy()
            values.update((page.doc, (tuple(value), form, topic)) for page, value, form, topic in zip(batch, strengths, protected, topics))
    return values


def probability(left, right):
    return sum(1 / (1 + math.exp(-1.65 * (first - second))) for first, second in zip(left, right)) / len(left)


def pairwise_ratings(pages, scores):
    if len(pages) < 2:
        return {page.doc: 0.5 for page in pages}, 0
    cohort = sorted(pages, key=lambda page: (sum(scores[page.doc][0]), page.doc))
    edges = {(index, index + distance) for distance in (1, 3, 9) for index in range(len(cohort) - distance)}
    left, right = np.array(sorted(edges), dtype=np.int32).T
    observations = np.array([probability(scores[cohort[a].doc][0], scores[cohort[b].doc][0]) for a, b in zip(left, right)])
    degree = np.bincount(np.concatenate((left, right)), minlength=len(cohort))
    strengths = np.zeros(len(cohort))
    for _ in range(26):
        margin = strengths[left] - strengths[right]
        residual = observations - 1 / (1 + np.exp(-margin))
        gradient = np.bincount(left, weights=residual, minlength=len(cohort)) - np.bincount(right, weights=residual, minlength=len(cohort))
        strengths += 0.75 * (gradient - 0.08 * strengths) / degree
    ranks = np.argsort(np.argsort(strengths, kind="stable"), kind="stable")
    return {page.doc: float((rank + 0.5) / len(cohort)) for page, rank in zip(cohort, ranks)}, len(edges)


def eligible_pools(selected, candidates, standard):
    first = int(0.85 * len(selected))
    last = int(0.96 * len(selected))
    current = defaultdict(list)
    for slot in range(first, last):
        page = selected[slot]
        if page.genre in GENRES and page.tokens >= 180:
            current[pool_key(page)].append((slot, page))
    population = sum(map(len, current.values()))
    count = 8_400 if standard else 1_050
    for key, rows in current.items():
        rows.sort(key=lambda item: (item[1].doc * 2246822519) & 0xFFFFFFFF)
        del rows[max(4, math.ceil(count * len(rows) / max(1, population))):]
    extras = defaultdict(list)
    existing = {page.doc for page in selected}
    for page in candidates:
        key = pool_key(page)
        if page.doc not in existing and key in current:
            extras[key].append(page)
    for key, rows in extras.items():
        rows.sort(key=lambda page: (-page.score, page.doc))
        del rows[max(8, 3 * len(current[key])):]
    return current, extras


def replace(task, selected, groups, alternatives, scores, target):
    output = list(selected)
    used = {fingerprint for page in selected for fingerprint in page.fingerprints}
    existing = {page.doc for page in selected}
    taken = Counter()
    size = count = 0
    for key, items in groups.items():
        if task.time_left() < 18 or size >= target * 0.004:
            break
        challengers = [page for page in alternatives[key] if page.doc in scores and scores[page.doc][1] < 0.60]
        challengers.sort(key=lambda page: (-sum(scores[page.doc][0]), page.doc))
        choices = [item for item in items if item[1].doc in scores and scores[item[1].doc][1] < 0.53]
        cohort = [page for _, page in choices] + challengers
        if len(cohort) < 8:
            continue
        vectors = np.stack([scores[page.doc][2] for page in cohort])
        vectors -= vectors.mean(axis=0)
        vectors /= np.maximum(0.001, np.linalg.norm(vectors, axis=1, keepdims=True))
        topics = {page.doc: vector for page, vector in zip(cohort, vectors)}
        for slot, incumbent in sorted(choices, key=lambda row: (sum(scores[row[1].doc][0]), row[0])):
            if size >= target * 0.004:
                break
            old_bytes = sum(right - left for left, right in incumbent.ranges)
            best = None
            for page in challengers[:140]:
                if page.doc in existing or abs(page.tokens / incumbent.tokens - 1) > 0.04:
                    continue
                new_bytes = sum(right - left for left, right in page.ranges)
                if abs(new_bytes - old_bytes) > max(24, 0.03 * old_bytes):
                    continue
                if taken[page.host] >= max(2_000, target * 0.00025) or page.score < incumbent.score - 0.38:
                    continue
                left, right = scores[page.doc][0], scores[incumbent.doc][0]
                preference = probability(left, right)
                if min(new - old for new, old in zip(left, right)) < 0.10 or preference < 0.72:
                    continue
                if sum(key in used for key in set(page.fingerprints)) >= min(2, len(page.fingerprints)):
                    continue
                affinity = float(topics[incumbent.doc] @ topics[page.doc])
                if not 0.25 <= affinity <= 0.94:
                    continue
                priority = (0.48 * affinity + 0.52 * preference, -page.doc)
                if best is None or priority > best[0]:
                    best = priority, page
            if best is None:
                continue
            _, page = best
            output[slot] = page
            existing.add(page.doc)
            used.update(page.fingerprints)
            taken[page.host] += page.tokens
            size += incumbent.tokens
            count += 1
    return output, count, size


def schedule(pages, groups, scores):
    adjusted = list(pages)
    all_ratings = {}
    comparisons = moved = 0
    for rows in groups.values():
        active = [slot for slot, _ in rows if pages[slot].doc in scores and scores[pages[slot].doc][1] < 0.66]
        ratings, count = pairwise_ratings([pages[slot] for slot in active], scores)
        all_ratings.update(ratings)
        comparisons += count
        bands = defaultdict(list)
        for slot in sorted(active):
            bands[slot // 288].append(slot)
        for slots in bands.values():
            if len(slots) < 4:
                continue
            orders = sorted(range(len(slots)), key=lambda index: (index - 0.16 * len(slots) * ratings[pages[slots[index]].doc], index))
            for destination, source in zip(slots, orders):
                adjusted[destination] = pages[slots[source]]
                moved += destination != slots[source]
    return adjusted, all_ratings, comparisons, moved


def repeat_pages(pages, ratings, target):
    candidates = [page for page in pages if ratings.get(page.doc, 0) >= 0.88 and page.tokens <= 4_000]
    random.Random(87095).shuffle(candidates)
    replay = []
    added = 0
    hosts = Counter()
    for page in candidates:
        if added + page.tokens <= target * 0.007 and hosts[page.host] < 2:
            replay.append(page)
            added += page.tokens
            hosts[page.host] += 1
    if not replay:
        return pages, 0, 0
    offset = int(0.80 * len(pages))
    width = max(1, int(0.13 * len(pages)))
    locations = defaultdict(list)
    for index, page in enumerate(replay):
        locations[offset + index * width // len(replay)].append(page)
    output = []
    for index, page in enumerate(pages):
        output.append(page)
        output.extend(locations.get(index, ()))
    return output, len(replay), added


def edit_pages(task, selected, candidates, target, replay):
    if task.device() != "cuda" or task.time_left() < 40:
        print("Pairwise decision model scored 0 passages within the budget", flush=True)
        return None
    groups, alternatives = eligible_pools(selected, candidates, task.train_tokens >= 80_000_000)
    population = [page for rows in groups.values() for _, page in rows] + [page for rows in alternatives.values() for page in rows]
    population.sort(key=lambda page: (page.doc * 2654435761) & 0xFFFFFFFF)
    try:
        scores = fine_tuned_scores(task, population)
    except (ImportError, OSError, RuntimeError, ValueError) as error:
        print(f"Pairwise decision model unavailable ({error})", flush=True)
        return None
    edited, replacements, volume = replace(task, selected, groups, alternatives, scores, target)
    edited, ratings, comparisons, moved = schedule(edited, groups, scores)
    repeats = replay_tokens = 0
    if replay:
        edited, repeats, replay_tokens = repeat_pages(edited, ratings, target)
    print(
        f"Pairwise decision model scored {len(scores):,} passages from two views, made {comparisons:,} comparisons, "
        f"replaced {replacements:,} pages ({volume:,} tokens), moved {moved:,} and replayed {repeats:,} ({replay_tokens:,} tokens)",
        flush=True,
    )
    return edited if replacements or moved or repeats else None

download bundle (.tar.zst) id ba0ebcc6ecd3828e47e004201a7a0e96de096be02e384076d8a6c5c4657acf49

Files it fetches 758.5 MB in 17 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.

PathSizesha256From
language/lid.176.ftz 916.0 kB 8f3472cfe873 https://huggingface.co/julien-c/fasttext-language-id/resolve/9f2e94d2fd6b2615d26f5ec5b34cf7e2f38cb86e/lid.176.ftz
encoder/LICENSE 5.1 kB 7381146597b4 https://huggingface.co/fastino/GLiDE-0.4B/resolve/6bda7ab91aeb36dcad6d27828a8871e548c7fc71/LICENSE
encoder/NOTICE 579 B 54576106686e https://huggingface.co/fastino/GLiDE-0.4B/resolve/6bda7ab91aeb36dcad6d27828a8871e548c7fc71/NOTICE
encoder/config.json 1.2 kB 778102ed6dca https://huggingface.co/fastino/GLiDE-0.4B/resolve/6bda7ab91aeb36dcad6d27828a8871e548c7fc71/config.json
encoder/licenses/Ettin-encoder-400m-LICENSE 1.1 kB 9cec9e5a835d https://huggingface.co/fastino/GLiDE-0.4B/resolve/6bda7ab91aeb36dcad6d27828a8871e548c7fc71/licenses/Ettin-encoder-400m-LICENSE
encoder/model-00001-of-00001.safetensors 753.0 MB 4540aa6d168f https://huggingface.co/fastino/GLiDE-0.4B/resolve/6bda7ab91aeb36dcad6d27828a8871e548c7fc71/model-00001-of-00001.safetensors
encoder/model.safetensors.index.json 12.0 kB 911f8dfccf8a https://huggingface.co/fastino/GLiDE-0.4B/resolve/6bda7ab91aeb36dcad6d27828a8871e548c7fc71/model.safetensors.index.json
encoder/special_tokens_map.json 694 B ea97ecdbcc73 https://huggingface.co/fastino/GLiDE-0.4B/resolve/6bda7ab91aeb36dcad6d27828a8871e548c7fc71/special_tokens_map.json
encoder/tokenizer.json 2.0 MB 9fd55248d51d https://huggingface.co/fastino/GLiDE-0.4B/resolve/6bda7ab91aeb36dcad6d27828a8871e548c7fc71/tokenizer.json
encoder/tokenizer_config.json 20.3 kB 3cd2017ff46d https://huggingface.co/fastino/GLiDE-0.4B/resolve/6bda7ab91aeb36dcad6d27828a8871e548c7fc71/tokenizer_config.json
scorer/LICENSE 5.1 kB 7381146597b4 https://huggingface.co/ericflo/stet-glide-pairwise-adapter/resolve/f0a1f614017700fb9764c87d32878f2d853f3370/LICENSE
scorer/NOTICE 579 B 54576106686e https://huggingface.co/ericflo/stet-glide-pairwise-adapter/resolve/f0a1f614017700fb9764c87d32878f2d853f3370/NOTICE
scorer/licenses/Ettin-encoder-400m-LICENSE 1.1 kB 9cec9e5a835d https://huggingface.co/ericflo/stet-glide-pairwise-adapter/resolve/f0a1f614017700fb9764c87d32878f2d853f3370/licenses/Ettin-encoder-400m-LICENSE
scorer/model-info.json 1.2 kB b0865edc7cea https://huggingface.co/ericflo/stet-glide-pairwise-adapter/resolve/f0a1f614017700fb9764c87d32878f2d853f3370/model-info.json
scorer/lora-head.safetensors 1.0 MB 7e7e9015d1b3 https://huggingface.co/ericflo/stet-glide-pairwise-adapter/resolve/f0a1f614017700fb9764c87d32878f2d853f3370/lora-head.safetensors
scorer/adapter/adapter_config.json 1.1 kB 05d3394bc1d7 https://huggingface.co/ericflo/stet-glide-pairwise-adapter/resolve/f0a1f614017700fb9764c87d32878f2d853f3370/adapter/adapter_config.json
scorer/adapter/adapter_model.safetensors 1.5 MB 4a23ba9cfe29 https://huggingface.co/ericflo/stet-glide-pairwise-adapter/resolve/f0a1f614017700fb9764c87d32878f2d853f3370/adapter/adapter_model.safetensors
total758.5 MB