Live and Continuously Updated Benchmarks › Building a live benchmark: an implementation
Language AI HandbookAll chapters Use a synthetic timeline to exercise the parts of a benchmark that sit outside the model. We generate item records, publish exactly three batches from a reserved pool, and score a retrospective panel of three fixed simulated models. The comparison retains the public release date of every item. Sealed rows remain in a distinct evaluation pool and do not appear in the public report.
PythonIn [3]Expand
import hashlib
import json
import random
from collections import defaultdict
from dataclasses import dataclass
from datetime import date, timedelta
from itertools import combinations
from statistics import stdev
import numpy as np
DEMO_SEED = 7
def digest(data):
payload = json.dumps(data, sort_keys=True, separators=(",", ":")).encode()
return hashlib.sha256(payload).hexdigest()The item record and its lifecycle states
An item has a creation date, a family, a prompt and an answer key. The public release date starts unset. A reserved item is eligible for publication. The toy has no route from the permanently sealed cohort to a public release. In a real service, retirement would remove an item from future active snapshots while preserving its historic release manifests. The notebook builds its snapshots once and uses immutable tuples for membership and frozen copies of the scored prompt and reference data.
PythonIn [4]Expand
@dataclass
class Item:
item_id: str
created: date
family: str
question: str
answer: str
visibility: str
canary: str
released_on: date | None = None
@dataclass(frozen=True)
class ScoredItem:
item_id: str
family: str
question: str
answer: str
created: date
released_on: date
@classmethod
def snapshot(cls, item):
if item.visibility != "released" or item.released_on is None:
raise ValueError("Only public items can enter the scored snapshot")
return cls(
item.item_id,
item.family,
item.question,
item.answer,
item.created,
item.released_on,
)
@dataclass(frozen=True)
class Release:
release_id: int
release_date: date
public_items: tuple[str, ...]
anchor_items: tuple[str, ...]
scored_items: tuple[ScoredItem, ...]
@property
def scored_ids(self):
return tuple(item.item_id for item in self.scored_items)
def validated_scored_items(release):
rows = release.scored_items
if not rows:
raise ValueError("A scored snapshot needs at least one item")
if len(set(release.scored_ids)) != len(rows):
raise ValueError("A scored snapshot needs unique item IDs")
if any(
item.released_on is None
or not item.created <= item.released_on <= release.release_date
for item in rows
):
raise ValueError(
"Each scored item needs a valid first-public date by the release"
)
return rowsThe publication operation checks the selected item's state and its time ordering. The initial sealed ID set is saved separately from mutable visibility. That makes the final invariant meaningful even if a later bug changes an item's state.
PythonIn [5]Expand
def publish(item, release_date):
if item.visibility != "reserved" or item.released_on is not None:
raise ValueError("Only unpublished reserved items may be published")
if release_date < item.created:
raise ValueError("Release date precedes item creation")
item.visibility = "released"
item.released_on = release_dateGenerating fresh items with cutoff dates
Create 60 items at nine-day intervals from January 1, 2024. Forty are reserved for possible publication and twenty are permanently sealed. Items cycle through three synthetic family labels. The text and canonical answers are placeholders. They give us repeatable cases without requiring a real arithmetic, reasoning or retrieval model. Each canary is a short hash-derived string within this fixture.
PythonIn [6]Expand
def make_item(i, created, family, visibility):
return Item(
item_id=f"it{i:03d}",
created=created,
family=family,
question=f"[{family}] synthetic item #{i} created {created.isoformat()}",
answer=str((i * 7) % 100),
visibility=visibility,
canary="TOY-CANARY-" + digest(["item", i])[:16],
)
families = ("arithmetic", "logic", "retrieval")
base = date(2024, 1, 1)
items = [
make_item(
i,
base + timedelta(days=i * 9),
families[i % len(families)],
"reserved" if i < 40 else "sealed",
)
for i in range(60)
]
by_id = {item.item_id: item for item in items}
permanently_sealed = {
item.item_id for item in items if item.visibility == "sealed"
}ConsoleOut [7]Expand
Generated 60 items across 3 families.
Initial private pools: {'reserved': 40, 'sealed': 20}A model's training cutoff and the contamination question
The three model labels carry stated cutoffs. Count items created strictly after a cutoff separately from those published on or before it. An older item can have a public release date later than the cutoff. A pre-cutoff publication indicates public availability. Actual training inclusion remains unobserved.
PythonIn [8]Expand
@dataclass(frozen=True)
class Model:
name: str
training_cutoff: date
models = [
Model("model_early", date(2024, 6, 1)),
Model("model_mid", date(2024, 12, 1)),
Model("model_late", date(2025, 6, 1)),
]
def freshness_exposed(items, model):
return [
item
for item in items
if item.released_on is not None
and item.released_on <= model.training_cutoff
]
def freshness_clean(items, model):
return [item for item in items if item.created > model.training_cutoff]ConsoleOut [9]Expand
model_early cutoff=2024-06-01 created-after=43 model_mid cutoff=2024-12-01 created-after=22 model_late cutoff=2025-06-01 created-after= 2
The creation-after counts are 43, 22 and 2 on the same 60-item cohort. None of those counts says how much of a model's training data is known. The stated cutoff and a precise creation timestamp matter most when you are trying to rule out that exact item being present in the covered collection. The task pattern or source material can predate the item.
Releases and anchors
Publish 12 newly released items at a time, on the creation date of the last item in the batch. Each later scored set also includes the first four new items from the preceding release. The release keeps the new and reused IDs separate. Four of the original reserved items remain unpublished after the three releases.
PythonIn [10]Expand
def make_releases(items, n_releases=3, items_per_release=12, anchor_count=4):
pool = sorted(
(item for item in items if item.visibility == "reserved"),
key=lambda item: (item.created, item.item_id),
)
if (
n_releases < 1
or items_per_release < 1
or not 0 <= anchor_count <= items_per_release
):
raise ValueError(
"Release and anchor counts are outside the fixture range"
)
if len(pool) < n_releases * items_per_release:
raise ValueError(
"Insufficient reserved items for the requested releases"
)
if len({item.item_id for item in items}) != len(items):
raise ValueError("Item IDs must be unique")
if any(item.released_on is not None for item in pool):
raise ValueError("Reserved items cannot have a publication date")
catalog = {item.item_id: item for item in items}
releases = []
for index in range(n_releases):
start = index * items_per_release
new = pool[start : start + items_per_release]
earlier = releases[-1].public_items[:anchor_count] if releases else ()
release_date = new[-1].created
for item in new:
publish(item, release_date)
newly_published = tuple(item.item_id for item in new)
scored_ids = sorted(set(newly_published) | set(earlier))
snapshot = tuple(
ScoredItem.snapshot(catalog[item_id]) for item_id in scored_ids
)
releases.append(
Release(index + 1, release_date, newly_published, earlier, snapshot)
)
return releases
releases = make_releases(items)ConsoleOut [11]Expand
Release 1 on 2024-04-09: 12 new, 0 anchors Release 2 on 2024-07-26: 12 new, 4 anchors Release 3 on 2024-11-11: 12 new, 4 anchors model_early: 12 public by stated cutoff model_mid: 36 public by stated cutoff model_late: 36 public by stated cutoff
The scoring sets have 12, 16 and 16 items. Consecutive scoring sets share four items each, while releases 1 and 3 share none. The different cutoff dates produce a separate public-availability view. For example, April 9 predates the early model's cutoff and July 26 follows it, so that model has 12 public items by its cutoff. All three releases predate the other two cutoffs.
PythonIn [12]Expand
freshness_rows = []
for model in models:
public = len(freshness_exposed(items, model))
later = len(freshness_clean(items, model))
freshness_rows.append((public, len(items) - public - later, later))The remainder after those two counted cohorts is already created without a public release observed by the cutoff. The middle category can include a future release, a reserved item, or a sealed item. This categorization uses the dates in the fixture rather than the visibility label stored today.
VisualizationOut [13]Expand

Simulating model predictions and scoring
The simulator draws one fixed value for a given model, item and trial offset. A content hash supplies its seed, so rearranging items or moving across interpreter processes does not change a draw. The three simulated models share family-specific base probabilities. A ten percentage point bonus applies to items whose known publication precedes or equals that model's stated cutoff. The two later cutoffs cover every scored public item. The early cutoff covers the first release and the four April anchors carried forward into July. Even when two models have the same modeled success probability on a given item, their draws can differ. The observed score differences mix item families and finite simulator draws. The outputs demonstrate the versioned scoring protocol and the effect of a planted probability rule. They do not measure training exposure or demonstrate a controlled difference between real models.
The scorer compares canonical strings by exact equality. Other answer formats require their own documented extraction or normalization contract. One reason to keep this fixture strict is to make the expected outcome auditable before introducing flexible matching.
PythonIn [14]Expand
BASE_ACCURACY = {"arithmetic": 0.75, "logic": 0.55, "retrieval": 0.65}
PROTOCOL = {
"version": "toy-v1",
"score": "exact canonical answer string v1",
"sampling": "fixed SHA-256 per model and item v1",
"seed": DEMO_SEED,
}
def draw(model, item, seed_offset=0):
seed = int(
digest(
[
DEMO_SEED,
model.name,
model.training_cutoff.isoformat(),
item.item_id,
seed_offset,
]
),
16,
)
return random.Random(seed).random()
def predict(model, item, seed_offset=0, paraphrase=False):
base = BASE_ACCURACY[item.family]
public_by_cutoff = (
item.released_on is not None
and item.released_on <= model.training_cutoff
)
bonus = 0.10 if public_by_cutoff else 0.0
if paraphrase:
base -= 0.02
bonus *= 0.2
return (
item.answer
if draw(model, item, seed_offset) < base + bonus
else "WRONG"
)
def scored(model, item, seed_offset=0):
return int(predict(model, item, seed_offset) == item.answer)
def score_batch(model, snapshot, seed_offset=0):
if not snapshot:
return float("nan")
return sum(scored(model, item, seed_offset) for item in snapshot) / len(
snapshot
)ConsoleOut [15]Expand
model rel1 rel2 rel3 model_early 0.92 0.94 0.56 model_mid 0.83 1.00 0.69 model_late 0.75 0.69 0.88
Score each fixed model on each public release. The names early, mid and late refer to their cutoffs. The table is a retrospective replay of item snapshots. It is not reporting scores obtained on each historical release date. A row compares the same fixed simulator across cohorts, not versions of a model improving over time. Headline differences across releases include composition changes.
Comparing on anchors, and refusing invalid comparisons
To compare on a common panel, intersect the actual scored IDs, including newly released and carried IDs. Require the complete scored item fields to agree for a shared ID. Compute one difference per item. If the aim is to estimate a mean difference over a sampled population of independent paired items, the estimated standard error is the sample standard deviation of those differences divided by the square root of the item count. A fixed fixture of four deliberately selected anchors supports descriptive counts. A zero observed spread on such a fixture gives no assurance about unseen items.
PythonIn [16]Expand
def binomial_se(p, n):
return float(np.sqrt(p * (1 - p) / n)) if n > 0 else float("nan")
def scored_manifest(rows):
return [
[
item.item_id,
item.family,
item.question,
item.answer,
item.created.isoformat(),
item.released_on.isoformat(),
]
for item in rows
]
def compare_on_common(model_a, model_b, rel_a, rel_b, seed_offset=0):
earlier = {item.item_id: item for item in validated_scored_items(rel_a)}
later = {item.item_id: item for item in validated_scored_items(rel_b)}
candidate_ids = sorted(earlier.keys() & later.keys())
common = [
earlier[item_id]
for item_id in candidate_ids
if earlier[item_id] == later[item_id]
]
changed_ids = [
item_id
for item_id in candidate_ids
if earlier[item_id] != later[item_id]
]
metadata = {
"models": (model_a.name, model_b.name),
"releases": (rel_a.release_id, rel_b.release_id),
"n_common": len(common),
"common_ids": [item.item_id for item in common],
"excluded_changed_ids": changed_ids,
}
if not common:
return {
**metadata,
"status": "all_shared_ids_changed"
if changed_ids
else "no_shared_ids",
"common_content_hash": None,
"acc_a": None,
"acc_b": None,
"diff": None,
"a_only": None,
"b_only": None,
"se_diff": None,
}
a = [scored(model_a, item, seed_offset) for item in common]
b = [scored(model_b, item, seed_offset) for item in common]
differences = [u - v for u, v in zip(a, b)]
n = len(common)
return {
**metadata,
"status": "available",
"common_content_hash": digest(scored_manifest(common)),
"acc_a": round(sum(a) / n, 3),
"acc_b": round(sum(b) / n, 3),
"diff": round(sum(differences) / n, 3),
"a_only": differences.count(1),
"b_only": differences.count(-1),
"se_diff": round(stdev(differences) / n**0.5, 3) if n > 1 else None,
}ConsoleOut [17]Expand
{'models': ('model_early', 'model_late'), 'releases': (1, 3), 'n_common': 0, 'common_ids': [], 'excluded_changed_ids': [], 'status': 'no_shared_ids', 'common_content_hash': None, 'acc_a': None, 'acc_b': None, 'diff': None, 'a_only': None, 'b_only': None, 'se_diff': None}
{'models': ('model_early', 'model_late'), 'releases': (2, 3), 'n_common': 4, 'common_ids': ['it012', 'it013', 'it014', 'it015'], 'excluded_changed_ids': [], 'status': 'available', 'common_content_hash': 'e2c9974e587b5d7f3e74bda745c69c4cbdc7ba94f523517e1594e4f5e10476fa', 'acc_a': 1.0, 'acc_b': 1.0, 'diff': 0.0, 'a_only': 0, 'b_only': 0, 'se_diff': 0.0}The first cross-release request reports no_shared_ids and leaves the paired metrics empty. The second reports four common items and their content hash, plus the numbers of items only one model gets right. A shared ID with differing scored content is excluded and listed separately. When every shared ID has changed, the report keeps those exclusions, marks the link all_shared_ids_changed, and leaves the metrics empty.
For planning, suppose both correctness indicators have marginal success probability and correlation on the same item. With independent item pairs, the standard error is
where:
- is the difference between the two binary correctness outcomes for one item.
- is its sample mean over independently sampled item pairs.
- is the common marginal success probability.
- is the within-item correlation of correctness outcomes.
Each outcome has variance . Subtracting the outcomes subtracts twice their covariance from the total variance. This example varies the covariance at a fixed marginal probability so you can see why independent-standard-error arithmetic may be inappropriate for a shared panel. It is a planning example rather than an interval on the toy's anchor counts.
PythonIn [18]Expand
p_ref = 0.7
anchor_sizes = np.array([4, 8, 16, 32, 64, 128, 256])
se_examples = {
rho: np.sqrt(2 * p_ref * (1 - p_ref) * (1 - rho) / anchor_sizes)
for rho in (0.0, 0.6)
}VisualizationOut [19]Expand

A public headline comparison requires matching benchmark, release date and ID, scored content, and protocol. Headline and paired reports both require a nonempty snapshot with unique item IDs. Every scored item must have first become public at or after creation and by the release date. The headline report hashes the item manifest separately from the scoring settings. The alternative protocol ID below demonstrates refusal when the other fields agree. A deployed harness also needs the exact scorer source or a versioned executable receipt.
PythonIn [20]Expand
def run_report(model, release, protocol_version):
rows = validated_scored_items(release)
return {
"benchmark": "live-demo",
"model": model.name,
"release_id": release.release_id,
"release_date": release.release_date.isoformat(),
"protocol_version": protocol_version,
"protocol_hash": digest({**PROTOCOL, "version": protocol_version}),
"item_set_hash": digest(scored_manifest(rows)),
"n_items": len(rows),
"accuracy": round(score_batch(model, rows), 4),
"freshness_cutoff": model.training_cutoff.isoformat(),
}
def can_compare(run_a, run_b):
for report in (run_a, run_b):
count = report.get("n_items")
accuracy = report.get("accuracy")
valid_count = type(count) is int and count > 0
valid_accuracy = type(accuracy) in (int, float) and 0 <= accuracy <= 1
if not (valid_count and valid_accuracy):
return False, "invalid scored observations"
for key, reason in (
("benchmark", "different benchmark"),
("protocol_version", "different scoring protocol"),
("protocol_hash", "different scoring configuration"),
("release_id", "different release; compare on anchors separately"),
("release_date", "different release date"),
("item_set_hash", "different scored content"),
("n_items", "different scored item counts"),
):
if run_a[key] != run_b[key]:
return False, reason
return True, "comparable"
r1 = run_report(models[0], releases[0], "toy-v1")
r2 = run_report(models[1], releases[1], "toy-v1")
r3 = run_report(models[1], releases[1], "toy-v2")ConsoleOut [21]Expand
r1 vs r2: (False, 'different release; compare on anchors separately') r2 vs r3: (False, 'different scoring protocol')
Contamination controls in code
Add five synthetic canary strings to an inspected token set and look for exact matches. The result establishes token-string presence in that synthetic corpus, not that the item body or answer traveled with it. You need a scan target, agreement on its provenance, and the ability to inspect it. A clean scan is limited to those artifacts and those strings.
PythonIn [22]Expand
released = [item for item in items if item.released_on is not None]
leaked_canaries = {item.canary for item in released[:5]}
def canary_leaks(items, observed_tokens):
return [item for item in items if item.canary in observed_tokens]ConsoleOut [23]Expand
Synthetic corpus canary matches: ['it000', 'it001', 'it002', 'it003', 'it004']
A second diagnostic compares a planted perturbation with the original. This fixture uses the same item and random draw in both conditions. It subtracts two percentage points from the base probability and keeps one fifth of the simulated public bonus. That setup illustrates how to count paired differences. It generates neither actual paraphrased prompts nor evidence about a trained model.
PythonIn [24]Expand
def paraphrase_gap(model, item_ids):
ids = tuple(dict.fromkeys(item_ids))
if not ids:
return float("nan")
paired_differences = []
for item_id in ids:
item = by_id[item_id]
original = int(predict(model, item) == item.answer)
perturbed = int(predict(model, item, paraphrase=True) == item.answer)
paired_differences.append(original - perturbed)
return sum(paired_differences) / len(ids)ConsoleOut [25]Expand
model_early planted perturbation gap: +0.028 model_mid planted perturbation gap: +0.167 model_late planted perturbation gap: +0.056
Group the same item-level differences by the assigned family. The three families have equal counts among the 36 newly published items. The figure shows the observed variability of the planted mechanism across those small cohorts. It does not convert a gap into a probability of contamination.
PythonIn [26]Expand
gap_rows = {
model.name: {
family: paraphrase_gap(
model, [it.item_id for it in released if it.family == family]
)
for family in families
}
for model in models
}VisualizationOut [27]Expand

A release report can retain several exposure indicators without collapsing them into a single risk score. The synthetic rubric tracks observed canary strings, date ordering, known public availability, and sealed membership. These indicators answer separate questions and need not be mutually exclusive.
PythonIn [28]Expand
def risk_rubric(items, model, observed_tokens):
return {
"canary present in inspected tokens": len(
canary_leaks(items, observed_tokens)
),
"created after stated cutoff": len(freshness_clean(items, model)),
"public by stated cutoff": len(freshness_exposed(items, model)),
"sealed in this fixture": sum(
item.visibility == "sealed" for item in items
),
}ConsoleOut [29]Expand
{
"canary present in inspected tokens": 5,
"created after stated cutoff": 43,
"public by stated cutoff": 12,
"sealed in this fixture": 20
}The rolling report
Run the reporting cell after the release, scoring and shared-panel cells. It calls the earlier compare_on_common function for every model pair and consecutive release link. Each run record contains the model, cutoff, benchmark, release date, score, item count, protocol identity and scored-content hash. The separate anchor table identifies the retained shared item IDs and hash, with changed shared IDs listed as exclusions. It also keeps rows for links with no eligible paired items, with a status describing why the metrics are unavailable. These three releases produce nine headline runs and six model-pair comparisons across two adjacent links.
PythonIn [30]Expand
def build_report(models, releases, protocol_version):
runs = [
run_report(model, release, protocol_version)
for release in releases
for model in models
]
anchors = [
compare_on_common(model_a, model_b, earlier, later)
for earlier, later in zip(releases, releases[1:])
for model_a, model_b in combinations(models, 2)
]
return {
"benchmark": "live-demo",
"protocol_version": protocol_version,
"runs": runs,
"anchor_comparisons": anchors,
"control_notes": [
"Publication and creation chronology are tracked separately.",
"The canary scan observes only the synthetic token corpus.",
"The sealed cohort is omitted from all public-item reports.",
"Perturbation probabilities are specified by the simulator.",
],
"uncontrolled_channels": [
"Equivalent material present before item creation",
"Unobserved training, tuning, and evaluation-time sources",
],
}
report = build_report(models, releases, "toy-v1")ConsoleOut [31]Expand
Runs: 9 | Comparisons: 6
{'models': ('model_early', 'model_mid'), 'releases': (1, 2), 'n_common': 4, 'common_ids': ['it000', 'it001', 'it002', 'it003'], 'excluded_changed_ids': [], 'status': 'available', 'common_content_hash': 'd33e72c7d8c4ba5378f6dc6aeffbb3b02fc6c6e342cc1c2602251d986649f869', 'acc_a': 1.0, 'acc_b': 1.0, 'diff': 0.0, 'a_only': 0, 'b_only': 0, 'se_diff': 0.0}
{'models': ('model_early', 'model_late'), 'releases': (1, 2), 'n_common': 4, 'common_ids': ['it000', 'it001', 'it002', 'it003'], 'excluded_changed_ids': [], 'status': 'available', 'common_content_hash': 'd33e72c7d8c4ba5378f6dc6aeffbb3b02fc6c6e342cc1c2602251d986649f869', 'acc_a': 1.0, 'acc_b': 0.75, 'diff': 0.25, 'a_only': 1, 'b_only': 0, 'se_diff': 0.25}
{'models': ('model_mid', 'model_late'), 'releases': (1, 2), 'n_common': 4, 'common_ids': ['it000', 'it001', 'it002', 'it003'], 'excluded_changed_ids': [], 'status': 'available', 'common_content_hash': 'd33e72c7d8c4ba5378f6dc6aeffbb3b02fc6c6e342cc1c2602251d986649f869', 'acc_a': 1.0, 'acc_b': 0.75, 'diff': 0.25, 'a_only': 1, 'b_only': 0, 'se_diff': 0.25}
{'models': ('model_early', 'model_mid'), 'releases': (2, 3), 'n_common': 4, 'common_ids': ['it012', 'it013', 'it014', 'it015'], 'excluded_changed_ids': [], 'status': 'available', 'common_content_hash': 'e2c9974e587b5d7f3e74bda745c69c4cbdc7ba94f523517e1594e4f5e10476fa', 'acc_a': 1.0, 'acc_b': 1.0, 'diff': 0.0, 'a_only': 0, 'b_only': 0, 'se_diff': 0.0}
{'models': ('model_early', 'model_late'), 'releases': (2, 3), 'n_common': 4, 'common_ids': ['it012', 'it013', 'it014', 'it015'], 'excluded_changed_ids': [], 'status': 'available', 'common_content_hash': 'e2c9974e587b5d7f3e74bda745c69c4cbdc7ba94f523517e1594e4f5e10476fa', 'acc_a': 1.0, 'acc_b': 1.0, 'diff': 0.0, 'a_only': 0, 'b_only': 0, 'se_diff': 0.0}
{'models': ('model_mid', 'model_late'), 'releases': (2, 3), 'n_common': 4, 'common_ids': ['it012', 'it013', 'it014', 'it015'], 'excluded_changed_ids': [], 'status': 'available', 'common_content_hash': 'e2c9974e587b5d7f3e74bda745c69c4cbdc7ba94f523517e1594e4f5e10476fa', 'acc_a': 1.0, 'acc_b': 1.0, 'diff': 0.0, 'a_only': 0, 'b_only': 0, 'se_diff': 0.0}A check on the sealed holdout
The published panel covers 36 distinct item IDs, with memberships retained independently of item status. Compare the complete union of scored IDs with the original sealed IDs. Do this before publishing a real draft report. A production implementation would also gate item access, test both the data and metadata paths, and log who accessed the private scoring environment.
PythonIn [32]Expand
released_ids = {
item_id for release in releases for item_id in release.scored_ids
}
if permanently_sealed & released_ids:
raise ValueError("A release included a permanently sealed item")ConsoleOut [33]Expand
Sealed items: 20 | Evaluated public IDs: 36 Sealed items in any release: []
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!