Skip to main content

Catch LLM and VLM regressions with lightweight, parameterized benchmarks for any Python callable.

Project description

ParametricBench

PyPI License: MPL 2.0

Catch LLM and VLM regressions by running the same evaluation cases across configurable prompts, models, and generation settings.

ParametricBench is a lightweight, provider-independent test runner for validating model behavior with plain Python. Use it to compare configurations, test prompt changes, validate text or multimodal responses, and run repeatable model checks locally or in CI.

Installation

pip install parametricbench

Usage

Run several checks in one benchmark while keeping case-specific expectations and settings together:

from parametricbench import benchmark


def model(prompt, temperature=0):
    return prompt.upper()


def contains_expected(response, case):
    return case["expected"] in response


cases = [
    {"name": "uppercase-greeting", "input": "hello", "expected": "HELLO"},
    {
        "name": "uppercase-question",
        "input": "how are you?",
        "expected": "HOW ARE YOU?",
        "params": {"temperature": 0.2},
    },
    {
        "name": "contains-keyword",
        "input": "parametric benchmarks",
        "expected": "BENCHMARKS",
    },
]

report = benchmark(
    target=model,
    cases=cases,
    evaluators=[contains_expected],
    params={"temperature": 0},
)

print(f"Passed: {report['passed_count']}/{report['total']}")
for result in report["results"]:
    print(result["name"], result["passed"], result["score"])

Why ParametricBench?

Model behavior can change when prompts, providers, models, retrieved context, or generation settings change. Manual checks are difficult to reproduce and easy to forget. ParametricBench turns them into reusable Python benchmarks for development, automated tests, production checks, and CI.

It is intentionally smaller than a complete evaluation platform:

  • No provider lock-in or required model SDK
  • No server, database, dashboard, or configuration language
  • No runtime dependencies or infrastructure to deploy

Use it when an ad hoc script is too fragile but a full evaluation platform is unnecessary.

Compare configurations

report = benchmark(
    target=model,
    cases=cases,
    variants=[
        {"name": "deterministic", "params": {"temperature": 0}},
        {"name": "creative", "params": {"temperature": 0.8}},
    ],
    evaluators=[contains_expected],
)

Each case runs once with every named variant. Parameters are merged without mutation in this order: global, then variant, then case-specific parameters, with later values taking precedence.

Custom evaluators

Evaluators receive the response and complete benchmark case:

def exact_match(response, case):
    return response == case["expected"]

They may return a boolean or a numeric score from 0.0 to 1.0. Multiple scores are averaged. Without evaluators, a successful target call scores 1.0; a target error scores 0.0. Target and evaluator errors are captured without stopping later cases.

LLM and VLM inputs

Inputs can be any Python value:

case = {
    "input": {"image": "traffic-light.png", "prompt": "Which object is shown?"},
    "expected": "traffic light",
}

ParametricBench passes the value to your target without loading or interpreting it.

Use cases

  • Detect regressions after prompt or model changes
  • Compare model versions, providers, temperatures, or environments
  • Validate structured, text, and multimodal responses
  • Reuse the same checks in development, production, and CI

Features

  • Any Python callable and arbitrary inputs
  • Global, variant, and case parameters
  • Boolean or numeric evaluators and configurable thresholds
  • Ordered dictionary reports with timing and concise errors
  • No runtime dependencies

Issues

Report issues at https://github.com/edujbarrios/parametricbench.

Author

Eduardo J. Barrios — edujbarrios@outlook.com

License

Mozilla Public License 2.0

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

parametricbench-0.1.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

parametricbench-0.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: parametricbench-0.1.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for parametricbench-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cb18b4c828345a8fc74fa581cb7aec5525e5a8c0b8f0150e140f79fb9f9fede5
MD5 50d2bc8fbea53c4f098f56b67684c796
BLAKE2b-256 59fa565622bfcbb968b8c0ac0bf2b6e0ff4f1629ed35a13339126e0ac7617fe3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for parametricbench-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0666f5d81f1cc7cf1a122a8ab737e0ab77dd1005a47a21e6d97deec2270a26f
MD5 f0851d008e0f98e22371491ff4d1d6a2
BLAKE2b-256 1e5f8b8451db350a33baca424e9bee671ea3839e3475b32328567b9e14ce7644

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