Metadata-Version: 2.5
Name: duelbench
Version: 0.1.0
Summary: Compare AI models head-to-head on the same items, with paired statistics that say who really wins: LLMs (local or API), vision models, embeddings, agents, small specialised networks.
Project-URL: Documentation, https://github.com/cyyyp100/duelbench/tree/main/docs
Project-URL: Source, https://github.com/cyyyp100/duelbench
Project-URL: Issues, https://github.com/cyyyp100/duelbench/issues
Project-URL: Results, https://github.com/cyyyp100/duelbench/tree/main/results
Project-URL: Changelog, https://github.com/cyyyp100/duelbench/blob/main/CHANGELOG.md
Author: cyyyp100
License-Expression: MIT
License-File: LICENSE
Keywords: ai-agents,ai-benchmark,benchmark,benchmarking,computer-vision,embeddings,evaluation,head-to-head,image-classification,llm,llm-benchmark,llm-evaluation,local-ai,local-llm,model-comparison,model-evaluation,non-llm,ollama,on-device-ai,reproducibility,significance-testing,small-models,statistics,vlm
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27
Requires-Dist: numpy>=1.26
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=13.7
Provides-Extra: all
Requires-Dist: accelerate>=0.33; extra == 'all'
Requires-Dist: anthropic>=0.40; extra == 'all'
Requires-Dist: datasets>=3.0; extra == 'all'
Requires-Dist: huggingface-hub>=0.24; extra == 'all'
Requires-Dist: math-verify>=0.7; extra == 'all'
Requires-Dist: pillow>=10.0; extra == 'all'
Requires-Dist: sentence-transformers>=3.0; extra == 'all'
Requires-Dist: timm>=1.0; extra == 'all'
Requires-Dist: torch>=2.2; extra == 'all'
Requires-Dist: torchvision>=0.17; extra == 'all'
Requires-Dist: transformers>=4.45; extra == 'all'
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.40; extra == 'anthropic'
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Provides-Extra: embeddings
Requires-Dist: sentence-transformers>=3.0; extra == 'embeddings'
Provides-Extra: hf
Requires-Dist: datasets>=3.0; extra == 'hf'
Requires-Dist: huggingface-hub>=0.24; extra == 'hf'
Requires-Dist: pillow>=10.0; extra == 'hf'
Provides-Extra: math
Requires-Dist: math-verify>=0.7; extra == 'math'
Provides-Extra: transformers
Requires-Dist: accelerate>=0.33; extra == 'transformers'
Requires-Dist: pillow>=10.0; extra == 'transformers'
Requires-Dist: torch>=2.2; extra == 'transformers'
Requires-Dist: transformers>=4.45; extra == 'transformers'
Provides-Extra: vision
Requires-Dist: pillow>=10.0; extra == 'vision'
Requires-Dist: timm>=1.0; extra == 'vision'
Requires-Dist: torch>=2.2; extra == 'vision'
Requires-Dist: torchvision>=0.17; extra == 'vision'
Requires-Dist: transformers>=4.45; extra == 'vision'
Description-Content-Type: text/markdown

# duelbench

**Any AI against any other, on the same items, with statistics that say who really wins.**

[![ci](https://github.com/cyyyp100/duelbench/actions/workflows/ci.yml/badge.svg)](https://github.com/cyyyp100/duelbench/actions/workflows/ci.yml) ![license: MIT](https://img.shields.io/badge/license-MIT-blue) ![python: 3.11+](https://img.shields.io/badge/python-3.11%2B-blue) ![status: alpha](https://img.shields.io/badge/status-alpha-orange) ![local AI first](https://img.shields.io/badge/local%20AI-first-blueviolet) [![results: welcome](https://img.shields.io/badge/results-welcome-brightgreen)](https://github.com/cyyyp100/duelbench/blob/main/results/README.md)

duelbench puts AI systems head to head on exactly the same items: LLMs (local with Ollama, llama.cpp or vLLM,
or through an API), image classifiers, embedding models, agents, or your own Python function. It records every
answer, compares the contestants item by item, and ends each comparison with a plain verdict: *A is better*,
*B is better*, or *no clear difference*, with a confidence interval, an exact paired test and a correction for
the number of comparisons. It is made for comparing AIs of different kinds, on the hardware you actually own,
with results anyone can recompute ([why another evaluation tool?](https://github.com/cyyyp100/duelbench/blob/main/docs/why-duelbench.md)).

## First results

Three duels on a CPU-only laptop (Intel Core i5-1035G1, 8 GB of RAM, 12 W). Each card gives the question, the
plan fixed before the run, the limits, and the raw records to recompute every number.

| Question | Verdict | Time on this laptop |
|---|---|---|
| [A CNN, zero-shot CLIP or a small vision-language model on ImageNetV2?](https://github.com/cyyyp100/duelbench/blob/main/results/2026-11-30-cnn-clip-vlm-imagenetv2/RESULT.md) | ResNet-50 **68.6%** > CLIP 52.7% > Qwen3.5 0.8B 28.0% (each p < 0.001) | median 0.15 s, 0.11 s and 4 s per photo |
| [Three local embedding models on STS-B](https://github.com/cyyyp100/duelbench/blob/main/results/2026-11-30-local-embeddings-stsb/RESULT.md) | EmbeddingGemma 84.9 ≈ nomic 84.2 (no clear difference); both beat MiniLM 82.0 (p = 0.002) | median 212, 96 and 25 ms per pair |
| [Does thinking pay? Qwen3 1.7B on GSM8K](https://github.com/cyyyp100/duelbench/blob/main/results/2026-11-30-qwen3-thinking-gsm8k/RESULT.md) | thinking on **88.7%** > off 76.3% (+12.3 points, p < 0.001) | 16.6 h against 1.5 h for 300 problems |

All results, rankings by task and [duels we would love to see](https://github.com/cyyyp100/duelbench/blob/main/results/README.md#duels-we-would-love-to-see):
[results/](https://github.com/cyyyp100/duelbench/blob/main/results/README.md).

Your hardware (a GPU, a Mac, a Raspberry Pi), your AIs and your ideas are exactly what is missing, especially
for AIs that are not LLMs. [Propose a duel](https://github.com/cyyyp100/duelbench/issues/new/choose),
[share a result](https://github.com/cyyyp100/duelbench/blob/main/results/README.md#submit-a-result) or
[argue about a method](https://github.com/cyyyp100/duelbench/discussions). Francophone ? On peut aussi en discuter en français.

## Install

```bash
pip install duelbench             # API and Ollama contestants, your own tasks, reports
pip install "duelbench[all]"      # + the Hugging Face catalog, vision, embeddings, transformers, Anthropic
```

Python 3.11 or later. Smaller extras: `hf` (benchmarks on the Hugging Face Hub), `vision`, `embeddings`,
`transformers`, `math`, `anthropic`. On Linux without an NVIDIA GPU, install the CPU build of PyTorch first:
`pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu`. Latest version:
`pip install "duelbench @ git+https://github.com/cyyyp100/duelbench"`.

## Use

```bash
duel doctor                     # what this machine offers: GPU, Docker, Ollama, API keys
duel tasks                      # the catalog: GSM8K, MMLU-Pro, GPQA, AIME, HumanEval+, ImageNet, STS-B, games...
duel run -t gsm8k --limit 200 -m "small=ollama:qwen3:1.7b?think=false" -m "big=openai:gpt-5-mini"
```

A verdict looks like this (a toy task from `examples/` that needs no model: the gold answers against a weak
lookup):

```text
capitals (accuracy, 12 items)
 contestant   score [95% CI]         errors   median latency
 oracle       100.0% [75.8, 100.0]   0        –
 lookup       8.3% [1.5, 35.4]       0        0 ms
  oracle − lookup: +91.7 pts [+49.3, +100.0], p < 0.001 → oracle is better
```

Each run writes `runs/<date>-<name>/`: `report.html` (charts and every answer), `report.md` (verdict sentences
ready to quote), `results.json`, every record and the exact command. Interrupted runs resume from the cache. A
whole comparison can live in a file and run with `duel run duel.yaml`:

```yaml
name: small-models
models: ["qwen=ollama:qwen3:1.7b?think=false", "gemma=ollama:gemma3:1b"]
tasks: [gsm8k, arc_challenge, humaneval_plus]
limit: 200
```

| Contestant | What |
|---|---|
| `ollama:…`, `llamacpp:…`, `vllm:…`, `lmstudio:…`, `mlx:…` | a local model |
| `openai:…`, `anthropic:…`, `gemini:…`, `openrouter:…`, `mistral:…`... | an API |
| `timm:…`, `clip:…`, `st:…`, `hf:…` | an image classifier, zero-shot CLIP/SigLIP, an embedding model, a transformers model |
| `py:module:function`, `cmd:program` | anything else: a Python function, or a program reading and writing JSON |

- **Your own task**: `duel new my_task --kind choice` writes a `task.yaml` and a `data.jsonl`; `duel check`
  verifies it ([writing tasks](https://github.com/cyyyp100/duelbench/blob/main/docs/writing-tasks.md)).
- **Code written by models** runs in a Docker container without network, or under Seatbelt on a Mac
  ([sandbox](https://github.com/cyyyp100/duelbench/blob/main/docs/sandbox.md)).
- **Results from other tools**: `duel import results.csv` applies the same statistics to per-item scores from
  lm-evaluation-harness, Inspect or Harbor.

[Documentation](https://github.com/cyyyp100/duelbench/blob/main/docs/README.md) ·
[statistics](https://github.com/cyyyp100/duelbench/blob/main/docs/statistics.md) ·
[contestants](https://github.com/cyyyp100/duelbench/blob/main/docs/contestants.md) ·
[catalog](https://github.com/cyyyp100/duelbench/blob/main/docs/tasks.md) ·
[contributing](https://github.com/cyyyp100/duelbench/blob/main/CONTRIBUTING.md) ·
[security](https://github.com/cyyyp100/duelbench/blob/main/SECURITY.md). Alpha: formats may still change.
Code under [MIT](https://github.com/cyyyp100/duelbench/blob/main/LICENSE), published results under
[CC BY 4.0](https://github.com/cyyyp100/duelbench/blob/main/results/LICENSE); datasets are not redistributed:
each task downloads its data from the original source, whose license and terms apply.
