Skip to main content

A small, deterministic Elo arena for local model comparisons

Project description

localarena

localarena is a zero-dependency Elo arena for deterministic, local head-to-head comparisons. It keeps contestant metadata, match history, and ratings together in a portable versioned snapshot.

pip install localarena
from localarena import Arena, Result

arena = Arena(
    {
        "model-a": {"provider": "local"},
        "model-b": {"provider": "local"},
    }
)

arena.record("model-a", "model-b", Result.LEFT, {"prompt_id": "demo-1"})

for row in arena.standings():
    print(row.rank, row.name, row.rating)

pair = arena.next_pair()
payload = arena.to_json()
restored = Arena.from_json(payload)

API

  • Arena(contestants, initial_rating=1000, k_factor=32) accepts an iterable of unique names or a mapping of names to metadata.
  • add(name, metadata=None) registers another contestant.
  • record(left, right, result, metadata=None) records a match and applies an Elo update. Results are "left", "right", or "draw".
  • standings() and its alias leaderboard() return immutable rows ordered by rating descending, then name.
  • next_pair() chooses the least-played unordered pair deterministically.
  • matches and history() expose immutable match records.
  • snapshot() / to_json() produce schema-v1 data with contestants sorted by name; from_snapshot() / from_json() validate and replay that history.
  • expected_score() and round_robin() are available as standalone helpers.

Metadata must be a JSON object. Nested dictionaries, lists, tuples, strings, booleans, None, finite numbers, and interoperable safe integers are accepted. Public records recursively freeze metadata; snapshots return detached ordinary dictionaries and lists.

The npm package uses the same result values and schema-v1 snapshot format, so match histories can move between Python and JavaScript.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

localarena-0.1.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

localarena-0.1.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file localarena-0.1.0.tar.gz.

File metadata

  • Download URL: localarena-0.1.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for localarena-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8dc3c601d8beedd2a62d2bb231254f632e5179e8fa8531ef45e8ab1ae856f7e1
MD5 0c8f865d417c2c3eedbf665463617678
BLAKE2b-256 8db13c62109ab0b0807951f1f21b1f6766ecca8baa85e62ed4b75f1313813b63

See more details on using hashes here.

File details

Details for the file localarena-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: localarena-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for localarena-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b8724d59f6553f8f30250a5679fd668b0479a3bb7f731c9ed633096e0c5fb7c
MD5 c5b4e6463574184e580ca9c8818f3d7b
BLAKE2b-256 f3480d1c07248511e19b1e5adb4867589538a600a9536ec597c19e594a678315

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page