localbenchmark is a Python package for local LLM evaluation: coding benchmarks, long-context stress tests, speed probes, and ranking plots — driven through LM Studio (OpenAI-compatible API). It answers a practical question: can this model still write correct code when the context window is large, and is it fast enough that you would actually use it? ⭐️Star it if you like it⭐️
Key Features
| Feature | Description |
|---|---|
| Coding benchmark | HumanEval-style tasks via LM Studio; temperature 0 for comparable runs |
| Long context | Test fixed windows (e.g. 50k–180k); optional context fill so the KV cache is exercised |
| Speed probe | Prefill / decode tok/s at controlled tokens-in-cache levels |
| Resume-safe CSVs | Durable results; skip finished configs; retry LLM errors |
| Slow-model abort | Stop a config after a streak of low decode speed; ranking accounts for incomplete runs |
| Rank-sum plots | Pass rate, decode speed, TTFT, GPU peak, context — weighted ranking (model × context and per model) |
Installation
Install from PyPI
pip install localbenchmark
Install from GitHub
pip install git+https://github.com/erdogant/localbenchmark
Install from source
pip install git+https://github.com/erdogant/localbenchmark
Quick start — Dry run
Make a dry run. This is ideal for a fast check of model GPU requirements and their theoretical (expected) coding speed.
# Run for all models with context window 120K and quantization of Q4_K_M
localbenchmark --dry-run --contexts 120000 --quants Q4_K_M
localbenchmark --dry-run --contexts 120000 --quants Q4_K_M --models unsloth/qwen3-coder-30b-a3b-instruct openai/gpt-oss-20b
Output:
rank model quant context total GB headroom GB offload % bandwidth decode ceiling tok/s
----------------------------------------------------------------------------------------------------------------------
1 gpt-oss-20b Q4_K_M 120k 13.1 4.0 0% GPU 74
2 qwen3-coder-30b-a3b-instruct Q4_K_M 120k 18.5 -1.4 8% GPU+RAM 21
Quick start — coding benchmark
Start LM Studio, enable the local server, load a coding model, then:
# Full default suite (models × context windows)
localbenchmark
# Full default with base URL
localbenchmark --base-url http://localhost:1234
# Subset of models/contexts
localbenchmark --models unsloth/qwen3-coder-30b-a3b-instruct openai/gpt-oss-20b --contexts 50000 80000 100000 --base-url http://localhost:1234
Start LM Studio, enable the local server, load a coding model, then:
# Different types of benchmarks
localbenchmark --benchmark humaneval --models "openai/gpt-oss-20b"
localbenchmark --benchmark mbpp --models "openai/gpt-oss-20b"
localbenchmark --benchmark swebench --models "openai/gpt-oss-20b" --contexts 80000 150000
Results are written to CSV. Configurations already present in the summary CSV are skipped on the next run. Configurations that abort for low tok/s stay in the summary so they are not reloaded endlessly.
Useful flags
| Flag | Meaning |
|---|---|
--models |
One or more LM Studio model keys |
--contexts |
Context sizes in tokens (default includes 50k, 80k, 100k, 120k, 150k, 180k) |
--limit |
Run only the first N HumanEval problems |
--results |
Results CSV path (default depends on --benchmark) |
--benchmark |
humaneval, mbpp, swebench or suite |
--suite |
Suite file (.jsonl) for --benchmark suite |
--docs |
Document folder for suite mode (default company_docs) |
--docs-limit |
Use only the first N documents, in name order |
--docs-ids |
Use exactly these document file names |
Custom (Company) QA
Suite mode asks questions about a set of company documents. Every selected document goes into the prompt, and we score each answer. The suite includes unanswerable questions: the correct answer is to say the documents do not contain the information. An invented answer scores zero, which is the most important check for company use.
Commands
Run the suite with LM Studio running:
Example of lines:
{"id":"ctry-01","domain":"countries","type":"short","prompt":"What is the capital of Australia?","accept":["Canberra"],"distractors":["Sydney","Melbourne"]}
{"id":"ctry-03","domain":"countries","type":"numeric","prompt":"Roughly how large is Iceland, in square kilometres?","gold":103000,"rel_tol":0.05}
{"id":"co-04","domain":"companies","type":"short","prompt":"Which company acquired LinkedIn in 2016?","accept":["Microsoft"],"distractors":["Google","Oracle"]}
{"id":"co-01","domain":"companies","type":"numeric","prompt":"In which year was Microsoft founded?","gold":1975}
localbenchmark --benchmark suite --suite general_knowledge.jsonl --models "openai/gpt-oss-20b" --contexts 120000
Run with longer/ more detailled answers
company_docs/: the document folder. Any.txtor.mdfile can be used.suites/<name>.jsonl: one question per line. Each question names its source documents incontext.
The demo suite (northwind_demo) is fictional: 12 documents for a company called Northwind Analytics and 40 questions, 30 answerable and 10 unanswerable.
Example of jsonl:
{"id": "nw-01", "domain": "hr", "type": "short", "prompt": "How many days of annual leave do full-time employees get per calendar year?", "accept": ["25"], "context": ["hr_leave_policy.md"]}
Commands
Run the suite with LM Studio running:
localbenchmark --benchmark suite --suite northwind_demo.jsonl --docs path/to/company_docs \
--models "openai/gpt-oss-20b" --contexts 120000
Use fewer documents:
# first 40 files, in name order
localbenchmark --benchmark suite --suite northwind_demo.jsonl --docs path/to/company_docs \
--models "openai/gpt-oss-20b" --docs-limit 40
localbenchmark --benchmark suite --suite northwind_demo.jsonl --docs path/to/company_docs \
--models "openai/gpt-oss-20b" --docs-ids hr_leave_policy.md expense_policy.md
Output
suite_results_<suite>.csv: one row per question, with the score (0 to 1), pass/fail, domain, item type, whether the cited documents were included, and an error label (WRONG_ANSWER,INVENTED_ANSWER,MISSING_DOC,TRUNCATED,EMPTY_RESPONSE,LLM_ERROR).suite_results_<suite>_by_domain.csv: pass rate and mean score per domain. The console also shows answerable and unanswerable results separately, and the number of invented answers.
Plots and ranking
localbenchmarkplot --rank-agg sum # default
localbenchmarkplot --rank-agg mean
localbenchmarkplot --rank-agg median
# Only large windows (context_actual >= 100000)
localbenchmarkplot --min-context 100000
Ranking metrics (lower combined score is better):
- Pass rate (early aborts count unfinished work against the model)
- Decode speed (percentage of best — large speed gaps stay large)
- Time to first token
- Peak GPU memory
- Context size (percentage of best)
Pass rate and decode speed are weighted. Figures include pass rate vs context, tok/s, TTFT, GPU memory, quality–speed trade-off, and rank-sum panels (model × context and per model).
What is measured
| Signal | Why it matters |
|---|---|
| Pass rate | Generated code must pass the unit tests |
| Decode speed (tok/s) | Inference has to be usable, not only correct |
| TTFT | Latency before the first useful token |
| Peak GPU memory | Whether the setup fits your hardware |
| Context | Behaviour as the window grows |
Default context grid:
50k → 80k → 100k → 120k → 150k → 180k
Any context sizes present in the results file are included in the rank plots (not limited to a hard-coded list).
Resources and Links
- Documentation: Website
- Issues: GitHub Issues
- Source: github.com/erdogant/localbenchmark
Maintainer
Metadata
Release files for localbenchmark 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| localbenchmark-1.0.0.tar.gz | 74.8 kB | Without provenance | Details for localbenchmark-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| localbenchmark-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for localbenchmark-1.0.0-py3-none-any.whl |
Total release size: 153.1 kB
Release files / localbenchmark-1.0.0.tar.gz
| Download URL | localbenchmark-1.0.0.tar.gz |
|---|---|
| Size | 74.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aec0846fac9077bfaf0a92f87a7f8da59c84da888cdb25b6fbfca5e2ef83ba14
|
|
BLAKE2b-256 checksum How to use checksums |
fafb8409b39ab0b45d8ffe4b83c958c91511456930d338340dc2e3350024b902
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / localbenchmark-1.0.0-py3-none-any.whl
| Download URL | localbenchmark-1.0.0-py3-none-any.whl |
|---|---|
| Size | 78.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a60ebc603bd07b72328e827546313716594793b0252fce560a2a41a2bd4a9f66
|
|
BLAKE2b-256 checksum How to use checksums |
e7257c8d98874665e355271413d502d7fc741989cdfa4be7ab10d128bcc4be98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for localbenchmark 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.