Skip to content

Leaderboards

leaderboard

Leaderboards: the scores of finished runs, gathered and ranked.

Two steps, the same two the web app takes:

  1. board(runs) gathers the latest cell per (model, dataset) from sweep results, newest run first, the way /leaderboard does: a cell is taken whole from one run, its reward plus every metric that run recorded, and eol_days is added to every cell of a model.
  2. rank(board, ...) scores the models of a leaderboard's scope, the port of the frontend's lib/criteria.ts: each metric normalized per dataset to [FLOOR, 1] against the models in scope (linear for the reward and eol_days, log for magnitudes), combined as a weighted geometric mean, and averaged over the datasets. A model must be scored on every dataset in scope, and a metric only carries weight when every cell in scope records it. The Pareto frontier is marked over the weighted metrics.

Plain dicts in and out, so the CLI prints them and a caller can dump them.

board

board(runs: list[dict], *, today: date | None = None, eol: bool = True) -> dict

The leaderboard over runs, each {"id", "result": <run_sweep result>, "model_ids": {name: id}}, newest first.

The one aggregation: the backend's /leaderboard and openarena leaderboards run both read the board from here. A row's model is what the board reports; model_ids maps it to the id it called, for eol_days and the entry's model_id (the name itself when absent).

Returns {"datasets", "metrics", "entries"}, entries being {"model", "model_id", "scores": {dataset: {"value", "direction", "run_id", "metrics": {name: {"value", "direction"}}}}, "mean"}, best mean first. eol off leaves eol_days out (it asks the outside world).

rank

rank(data: dict, *, datasets: list[str] | None = None, models: list[str] | None = None, shares: dict[str, float] | None = None, budgets: list[dict] | None = None, group_shares: dict[str, float] | None = None, dataset_shares: dict[str, float] | None = None) -> dict

Rank the models of the scope, as the leaderboard page does.

datasets / models empty or None mean everything the board has, as in a saved leaderboard. shares are percents per metric; a share on a metric the scope only partly records is dropped, and none at all means the default preset. group_shares / dataset_shares weigh the datasets (dataset_weights); one at 0 is out of the score and not required. Returns {"datasets", "models", "shares", "axes", "rows", "skipped", "gaps", "excluded"}: rows best first, each {"rank", "model", "score", "values", "contributions", "per_dataset", "dataset_contributions", "on_frontier", "runs"}; skipped the models in scope left unranked and gaps why, per model a list of {"dataset", "missing"} (missing None: never scored there).

budgets are hard limits, {"metric", "op": "lte" | "gte", "value"}: a model breaking one on any dataset is left out before anything is normalized, so it cannot stretch the scale of the ones kept, and comes back in excluded, {"model", "failed": [budget, ...]}.

default_shares

default_shares(metrics: list[str]) -> dict[str, float]

The page's default preset, "Reward first": the reward high, the other measurements low, model facts off.

normalize

normalize(name: str, direction: str, values: list[float]) -> list[float]

One metric column to [FLOOR, 1], higher better: linear for LINEAR, else log when every value is positive.

pareto_frontier

pareto_frontier(points: dict[str, dict[str, float]], axes: list[tuple[str, str]]) -> set[str]

The ids no other point dominates: at least as good on every axis and strictly better on one.