Skip to main content

tourney

PyPI Python CI License

Local-first benchmarking runner for AI models. Run your prompts against the field.

tourney runs your own prompts and datasets against multiple model APIs (your keys, your machine) and measures quality, latency, cost, and token usage — with the statistical rigor researchers expect: bootstrap confidence intervals, pinned model IDs, seeds, config hashes, and full run metadata in a local SQLite database. No hosted service, no telemetry.

Install

Requires Python 3.11+.

pip install tourney                 # CLI + library
pip install "tourney[dashboard]"    # adds the local results dashboard (tourney serve)

Or with uv:

uv tool install tourney             # install the CLI globally
uv run --with tourney tourney --help   # or run it without installing

Five-minute quickstart

tourney init            # scaffolds benchmark.yaml + cases.jsonl
tourney run benchmark.yaml
tourney show latest --failures
tourney serve           # local dashboard at http://127.0.0.1:8355

benchmark.yaml:

name: math-word-problems
models:
  - provider: openai
    model: gpt-4o-2024-08-06          # pin dated IDs for reproducibility
  - provider: anthropic
    model: claude-sonnet-5
  - provider: gemini
    model: gemini-2.5-flash
  - provider: openai_compat           # anything OpenAI-compatible: Ollama, vLLM, OpenRouter...
    model: llama3.1:8b
    base_url: http://localhost:11434/v1
defaults: {temperature: 0, max_tokens: 256, seed: 42}
prompt:
  system: "Answer with only the final number."
  user: "{{ question }}"              # Jinja2 over each case's input
dataset: {path: cases.jsonl}
graders:
  - {type: numeric, tolerance: 0.001}
run: {concurrency: 8, retries: 3, timeout_s: 60}

API keys come from environment variables (OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY, or a custom api_key_env) — never from config files.

math-word-problems · run 01J9X4… · $0.213
┌──────────────────────┬───────┬──────────────┬─────────┬─────────┬─────────┬────────┐
│ model                │ score │ 95% CI       │ p50 lat │ p99 lat │ cost    │ errors │
├──────────────────────┼───────┼──────────────┼─────────┼─────────┼─────────┼────────┤
│ claude-sonnet-5      │ 0.960 │ [0.89, 1.00] │   944ms │  2107ms │ $0.0920 │      0 │
│ gpt-4o-2024-08-06    │ 0.940 │ [0.86, 0.98] │   812ms │  2431ms │ $0.1210 │      0 │
└──────────────────────┴───────┴──────────────┴─────────┴─────────┴─────────┴────────┘

Why another eval tool?

  • Local-first. Results live in ./.tourney/results.db (SQLite). Copy it, query it, commit exports.
  • Reproducible. Config hash, tourney/Python versions, and git commit stored per run. Deterministic graders by default; stats are seeded.
  • Cheap to iterate. Responses are content-address cached — rerunning an unchanged benchmark costs $0.
  • CI-native. tourney run --json --fail-under 0.85 exits non-zero when a model regresses.
  • Honest statistics. Bootstrap CIs over cases; errors score 0 instead of being dropped. pass@k and pass^k when you sample more than once.

pass@k and pass^k

Sample each case more than once and report how often a model gets there at all versus how often it gets there reliably:

run: {repeats: 10}
report:
  pass_at_k: [1, 5]     # P(at least one of k attempts passes)
  pass_hat_k: [5]       # P(all k attempts pass)

pass@k uses the unbiased estimator from the Codex paper; pass^k is its hypergeometric counterpart. Both are computed per case and averaged over cases, and both need repeats >= k — configs that ask for more are rejected at load time rather than after a paid run.

A sample counts as passing only when every grader on it passed, so partial credit contributes to score but not to these columns. Repeats are cached independently, so distinct samples stay distinct; set temperature above 0 or every repeat will be the same answer and pass@k will equal pass@1.

Graders

type what it checks
exact_match normalized string equality (normalize: [strip, lowercase, collapse_whitespace])
contains substring presence
regex pattern match (pattern:)
numeric last number in the response vs expected, within tolerance
json_schema output is valid JSON, optionally conforming to schema:

Multiple graders per benchmark average into the case score. LLM-as-judge is planned as strictly opt-in.

Library

import tourney

result = tourney.run("benchmark.yaml")
result.summary()      # per-model dicts: score, CI, latency percentiles, cost
result.to_records()   # per-completion rows -> pd.DataFrame(result.to_records())

CLI reference

tourney init                     scaffold a new benchmark
tourney run <config>             run it (--model, --limit, --no-cache, --json, --fail-under)
tourney list                     recent runs
tourney show <run|latest>        summary table (--failures for the failing cases)
tourney export <run> --format    jsonl | csv | md
tourney serve                    local dashboard (requires tourney[dashboard])

Extending

Third-party providers and graders register via entry points (tourney.providers, tourney.graders) — publish a package with a Provider or Grader subclass and it becomes available by name in configs. A mock provider ships in the box for dry runs and tests.

Development

pip install -e ".[dev]"
pytest        # fully offline — network is disabled in the test suite

Apache-2.0.

Download files

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

Source Distribution

tourney-0.3.1.tar.gz (43.4 kB view details)

Uploaded Source

Built Distribution

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

tourney-0.3.1-py3-none-any.whl (44.9 kB view details)

Uploaded Python 3

File details

Details for the file tourney-0.3.1.tar.gz.

File metadata

  • Download URL: tourney-0.3.1.tar.gz
  • Upload date:
  • Size: 43.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for tourney-0.3.1.tar.gz
Algorithm Hash digest
SHA256 0fd6091fa112a01f11090dba65392b04160f10c6215be870809128c35a0cf19b
MD5 5d4b47986565b814d8a8ef7ff6d23d8c
BLAKE2b-256 df695f82f95f136c5aa97294c2d3aebea9419ef3762d0e62648193cd89c4a116

See more details on using hashes here.

Provenance

The following attestation bundles were made for tourney-0.3.1.tar.gz:

Publisher: release.yml on k-rthik/tourney

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tourney-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: tourney-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 44.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for tourney-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1c3b595731901a67563c7130823b0007e0a1d4b031b7a776410cac29995dafb2
MD5 0d50859eb694be0c79103b52b2571f73
BLAKE2b-256 8599573b3fcc2a0da65ce55fcb9ef279a79c7af8421df910eb206b8575910515

See more details on using hashes here.

Provenance

The following attestation bundles were made for tourney-0.3.1-py3-none-any.whl:

Publisher: release.yml on k-rthik/tourney

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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