"""Which lc0 self-play runs to draw from, and in what proportion. Tiers follow generation quality: the networks producing the games get weaker as you go down, so the lower tiers contribute noisier, more exploratory positions. Keeping a minority of them is deliberate — a corpus drawn only from the strongest run is narrow in exactly the way this corpus is meant not to be. Availability was surveyed against storage.lczero.org on 2026-08-25 and differs from the run list usually quoted: * test70, test77, test76, test50, test20 and test10 are not hosted at all. * test78 and test90 exist but every tar is a 10 KB placeholder. * test80's retained window now starts 2024-04-01; earlier tars were pruned. * test80 stopped producing on 2025-09-24. test91 is the live run. * test71 is the Chess960 run — measured 30-36% Chess960 against at most 1.2% elsewhere — so it is excluded rather than tiered. test71_5 measured 0%. Named substitutes for the missing runs stay in era and strength order: test79 and test75 stand in for T70/T78 in the mid tier, test71_5 for T50. """ from __future__ import annotations from dataclasses import dataclass, field @dataclass(frozen=True) class Run: name: str # Restrict to a slice of the run's date-sorted tars, as "late test60" and # "early test60" belong to different tiers. first: float = 0.0 last: float = 1.0 weight: float = 1.0 @dataclass(frozen=True) class Tier: name: str share: float runs: tuple[Run, ...] note: str = "" TIERS: tuple[Tier, ...] = ( Tier( "strong", 0.60, (Run("test80", weight=2.0), Run("test91", weight=1.0)), "Mature run1 plus the live run2. Core modern play.", ), Tier( "mid", 0.22, (Run("test79"), Run("test75"), Run("test60", first=0.60)), "Late-T60 through T79: transitional styles, sound but more varied.", ), Tier( "low", 0.13, (Run("test40"), Run("test60", last=0.35), Run("test71_5", weight=0.5)), "2019-2020 nets. Messier tactics and unusual structures.", ), Tier( "early", 0.05, (Run("test30"), Run("run3", weight=0.5)), "2018-2019 semi-initial play. Kept small; maximum noise.", ), ) EXCLUDED = { "test71": "Chess960 run; 30-36% of positions are Chess960", "test78": "all tars are 10 KB placeholders", "test90": "all tars are 10 KB placeholders", } def quotas(total: int) -> dict[str, int]: """Positions per tier, with the rounding residue given to the largest.""" assigned = {tier.name: int(total * tier.share) for tier in TIERS} largest = max(TIERS, key=lambda t: t.share).name assigned[largest] += total - sum(assigned.values()) return assigned def run_quotas(tier: Tier, tier_total: int) -> dict[str, int]: """Positions per (run, slice) inside one tier, split by run weight.""" total_weight = sum(r.weight for r in tier.runs) out: dict[str, int] = {} for run in tier.runs: key = f"{run.name}:{run.first:.2f}-{run.last:.2f}" out[key] = int(tier_total * run.weight / total_weight) residue = tier_total - sum(out.values()) if out: out[next(iter(out))] += residue return out assert abs(sum(t.share for t in TIERS) - 1.0) < 1e-9