Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ModelSwapBench

Open-source model portability testing for real AI workflows.

Run the same workflow across local, open-weight, self-hosted, and hosted models. Measure quality, latency, policy compliance, and cost per successful outcome before you commit to a vendor.

Status: v0.1.0-alpha — usable and fully offline-capable. APIs may change before 1.0.


Why it exists

Teams are told a cheaper or local model "can't replace" their expensive hosted model — but rarely with evidence tied to the actual workflow. ModelSwapBench answers the real question:

Can a cheaper, local, open-weight, or alternative-provider model replace my current model without breaking my workflow — and what does it cost per successful outcome?

It is a decision-support tool for model replacement, not a leaderboard, not a foundation-model laboratory, and not proof that one model is universally better.

Anti-lock-in by design

  • Provider-neutral benchmark definitions in plain YAML/JSON you own and edit.
  • Portable JSON, CSV, Markdown, and HTML reports; raw results always exportable.
  • Standard HTTP provider interfaces; OpenAI-compatible local endpoints; Ollama; Forge.
  • No mandatory hosted service, account, cloud database, or telemetry.
  • Replaceable model adapters, evaluators, and pricing registries.
  • Everything runs local-first; hosted providers are opt-in per suite.

Architecture

benchmark.yaml ─► config (typed, validated) ─► runner ─► providers ─► models
                                                  │
                                     evaluators ◄─┘ (deterministic, evidence-based)
                                                  │
             scoring / economics / replacement ◄──┘
                                                  │
        storage (SQLite index + files) ◄──────────┤──► reports (md/json/csv/html)
                                                  │
                          reproducibility manifest

Five-minute offline example (no downloads, no credentials)

Install from PyPI:

python -m pip install modelswapbench

Install this repository for development:

git clone https://github.com/sekacorn/ModelSwapBench.git
cd ModelSwapBench
python -m venv .venv
# Windows:
.venv\Scripts\python -m pip install -e ".[dev]"
# Linux/macOS:
.venv/bin/python -m pip install -e ".[dev]"

modelswapbench doctor
modelswapbench validate examples/support-ticket-triage/benchmark.yaml
modelswapbench run examples/support-ticket-triage/benchmark.yaml
modelswapbench report latest --format markdown
modelswapbench compare latest

The first example runs entirely with the deterministic provider — no paid model credentials and no model downloads required.

Run against a real local model (Ollama)

ollama pull qwen2.5:3b
# Edit a suite so a model uses: provider: ollama, model: qwen2.5:3b, deployment: local
modelswapbench run examples/support-ticket-triage/benchmark.yaml

No model is ever pulled automatically, and there is no silent hosted fallback.

Benchmark YAML

name: support-ticket-triage
version: "1.0"
baseline_model: hosted-baseline
models:
  - {alias: local-candidate, provider: ollama, model: qwen2.5:3b, deployment: local}
  - {alias: hosted-baseline, provider: deterministic, model: baseline-fixture, deployment: test}
cases:
  - id: duplicate-billing
    input: {message: "I was charged twice and need help."}
    expected: {category: billing, escalation_required: true}
evaluators: [json_parse, json_schema, field_match, forbidden_content]
constraints: {minimum_success_rate: 0.80, maximum_cost_per_success_usd: 0.05}
replacement: {baseline: hosted-baseline, candidates: [local-candidate], maximum_quality_drop: 0.05}

Print the full JSON Schema any time: modelswapbench schema.

Cost per successful outcome

The primary economic metric is:

cost_per_success = total_cost / successful_cases

Zero successful cases is handled safely (reported as "n/a", never a divide error). Cost can be computed as zero-marginal (token/API pricing) or estimated compute (electricity, GPU amortization, cloud-GPU-equivalent) from an operator-supplied profile. Estimates are always clearly labeled as estimates.

Replacement recommendations

A candidate is recommended only when every required gate passes. The decision is transparent and always carries its evidence — failures are never hidden behind an aggregate score. Possible outcomes: recommended replacement · recommended with conditions · suitable as first-stage model with escalation · not recommended · insufficient evidence.

Cascade strategy

Run a cheap/local model first and escalate only failing or low-confidence cases to a stronger model. Reports escalation rate, combined success, and combined cost per success — see examples/cascade-routing.

Privacy

  • Local providers allowed by default; hosted providers denied by default.
  • Benchmark data never leaves the machine unless you pass --allow-hosted and set privacy.allow_hosted_providers: true, after an explicit warning.
  • No telemetry, no uploads; raw outputs stored locally; secrets redacted from logs and reports; API keys are read from environment variables and never written out.

Evaluators

exact_match · contains / forbidden_content · regex · json_parse · json_schema · field_match · tool_selection · policy_compliance · citation · latency · cost · optional rubric (keyword heuristic; never the sole evaluator; judge-model mode on the roadmap).

CLI

doctor · init · validate · schema · models · providers · run · compare · report · runs list|show · reproduce · clean · pricing show|validate|set · examples list.

Exit codes: 0 success · 1 constraints failed · 2 invalid input · 3 provider unavailable · 4 partial run · 5 internal error.

Output formats

Markdown (human report), JSON (full machine record), CSV (per-model summary), and self-contained HTML. Raw model outputs and evaluator evidence are stored per run.

Reproducibility

Every run writes a manifest (suite hash, package/Forge/Python versions, platform, models, execution params, seed, git commit). modelswapbench reproduce RUN_ID re-runs the recorded suite and warns on version drift rather than pretending the run is identical.

Known limitations

  • Results are evidence for a replacement decision, not proof one model is best.
  • Cost figures are estimates, not measured billing.
  • Deterministic providers simulate behavior; only Ollama / OpenAI-compatible runs reflect real models.
  • Small case counts yield low-confidence decisions.
  • The Forge adapter exercises the provider layer, not full agent orchestration (roadmap).

Roadmap

v0.1 deterministic + Ollama + Forge + OpenAI-compatible providers, YAML suites, deterministic evaluators, cost/latency/reliability metrics, replacement decisions, cascade analysis, JSON/CSV/Markdown reports, offline tests. v0.2 richer hosted adapters, compute-cost profiler, statistical confidence, variance analysis, CI regression gates, HTML dashboards. v0.3 benchmark registries, signed manifests, distributed execution, richer tool-use evaluation.

Contributing

See CONTRIBUTING.md, ARCHITECTURE.md, and docs/. Issues and PRs welcome.

License

MIT — Copyright (c) 2026 sekacorn. See LICENSE. Dependency licenses are listed in docs/dependency-licenses.md.

Download files

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

Source Distribution

modelswapbench-0.1.0a2.tar.gz (78.4 kB view details)

Uploaded Source

Built Distribution

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

modelswapbench-0.1.0a2-py3-none-any.whl (81.7 kB view details)

Uploaded Python 3

File details

Details for the file modelswapbench-0.1.0a2.tar.gz.

File metadata

  • Download URL: modelswapbench-0.1.0a2.tar.gz
  • Upload date:
  • Size: 78.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for modelswapbench-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 ef60c562ae9e3e7eab08dbeea223d7c74ddf5a81308c5ab088e4457c6723eca1
MD5 969af6fc53e5e87884c35384dac5eb4c
BLAKE2b-256 139c2a7ccae080daed51a3ea5b02993b1fcdcfa92327e8e7f7a028ef4e8b9528

See more details on using hashes here.

Provenance

The following attestation bundles were made for modelswapbench-0.1.0a2.tar.gz:

Publisher: release.yml on sekacorn/ModelSwapBench

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

File details

Details for the file modelswapbench-0.1.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for modelswapbench-0.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 b09287c12027457037293b08e48dfb4d5bcb650d898f6d745f4ed9782e9e4bc9
MD5 1710c43d47aeb9b9e1672cd36dc9952a
BLAKE2b-256 428c8bd0b32aac6fd112795782815bd315bb342842d7845cd8642755396c73f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for modelswapbench-0.1.0a2-py3-none-any.whl:

Publisher: release.yml on sekacorn/ModelSwapBench

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 Sentry Error logging StatusPage Status page