vlmeter — Accuracy × Cost Meter for Multimodal LLMs
English | 简体中文
Evaluate vision-language models on your own images and labels, side by side — API models (GPT-4o, DeepSeek, GLM-4V, Qwen-VL, Claude, Gemini) and locally served ones (vLLM, Ollama) — and get a comparison report of accuracy and cost to drive model selection.
vlmeter run --models deepseek-flash,gpt-4o,qwen2.5-vl-7b --data data/sample.jsonl --judge deepseek-v4-pro
Features
- One dataset, many models: OpenAI-compatible endpoints (GPT-4o / DeepSeek / GLM-4V / Qwen-VL / vLLM / sglang / LM Studio), Anthropic Claude, Google Gemini, local Ollama — adding a model is a few lines in
vlmeter/config/models.yaml, no code changes
- Three task types:
classification (option matching), checklist (multiple yes/no scene checks per image — e.g. "bicycle present + checkout counter clean" — answered in a single call), vqa (open-ended, with exact / contains / numeric / LLM-judge scoring)
- Resumable runs: results cached per question; reruns only fill in what's missing; failed requests retry automatically
- Recall-oriented threshold sweep (v0.3): checklist verdicts carry
confidence; the report simulates a production confidence gate (only high-confidence "pass" is released, everything else goes to review) and reports, per check, the threshold t* that minimizes review burden at ≥95% recall — direct selection data for miss-fatal scenarios (inspection / compliance)
- Cost accounting: per-model token pricing × actual usage, with a built-in accuracy-vs-cost tradeoff table (total / per-call / per-1000-calls)
- Unified price source (LiteLLM cost map) (v0.3.1): models without explicit prices in models.yaml automatically fall back to the LiteLLM model cost map snapshot (4300+ models, USD converted to CNY via a configurable
usd_to_cny rate). Resolution chain: explicit yaml price > LiteLLM snapshot > unpriced. vlmeter prices shows each model's price and source, --refresh updates the snapshot; reports disclose the price source per model, and models the map doesn't cover (e.g. GLM direct) are honestly marked "unpriced"
- Continuous regression / model canary (v0.4):
vlmeter snapshot freezes a baseline (dataset + prompt fingerprints recorded), vlmeter check re-runs the frozen set on a schedule and compares — overall drop ≥2pp or any check drop ≥5pp exits non-zero, so a cron/CI job becomes a drift watchdog; vlmeter diff compares any two result sets (accuracy / per-check / cost deltas + new-failure list)
- Multi-image input + bbox localization scoring (v0.5):
images lists unlock reference-comparison tasks (standard vs scene photo); checklist checks can declare a bbox contract — answering no requires the problem region, matched against the gold region at IoU ≥ 0.5 (row-level iou_threshold tunable; or evidence-existence when no gold region), covering "a fail must carry evidence" localization tasks
- Production feedback loop (v0.6):
vlmeter feedback turns production human-review verdicts (false alarms / misses / confirmed) into eval items — accumulating dedup by (image × check), --update-gold refreshes gold on human re-judgment, bad rows are skipped with per-row reasons. The eval set evolves with the production distribution: from "your labeled data" to "your production traffic"
- Accuracy × cost Pareto scatter (v0.3): inline SVG in the HTML report — spot the "accurate and cheap" models at a glance
- Reports in two formats: Markdown + a self-contained HTML report (single file, no external deps, shareable) with Wilson 95% confidence intervals on accuracy, per-check accuracy heatmaps, small-sample warnings (\<10 judgments), and expandable wrong-case details
Common use cases
- Model selection before launch — public leaderboard scores don't predict your domain. Evaluate 200–500 real business images with labels; the accuracy-vs-cost table answers questions like "93% at ¥6/1k calls vs 98% at ¥80/1k calls" directly.
- Site-inspection compliance checks (checklist's home turf) — one store/factory photo, many yes/no checks ("bicycles inside parking lines", "checkout counter free of clutter", "fire exit unblocked"). The same prompt structure carries straight into production.
- Annotation & criteria iteration — subjective checks ("clean", "tidy") fail on ambiguous standards, not model ability. Read the model's
reason in wrong cases; if the model "has a point", tighten the criteria and rerun to quantify the improvement per check.
- Regression testing against silent API upgrades — API models get upgraded without notice. Freeze your dataset (results are cached by content fingerprint) and rerun monthly or on vendor announcements; accuracy drops surface immediately.
- Self-hosted vs API break-even — add a local vLLM model (API cost = 0) to the same run; if it scores 95% vs the API's 97%, the tradeoff table tells you at what call volume giving up 2 points pays for the GPU.
- Vendor acceptance testing — a supplier claims "99% accuracy". Run your own labeled acceptance set, break it down per check/category, and challenge cases line by line from the wrong-case list.
Install
pip install vlmeter # or from source: pip install -r requirements.txt
cp .env.example .env # fill in the API keys you have (auto-loaded by run)
Quick start (10 minutes)
python3 scripts/make_sample_data.py # generate a 15-item synthetic sample set (shapes/colors/counting/OCR)
vlmeter list-models # see registered models
vlmeter run --models mock --data data/sample.jsonl # offline self-test, costs nothing
vlmeter run --models deepseek-flash --data data/sample.jsonl --judge deepseek-v4-pro
vlmeter report --data data/sample.jsonl # regenerate reports anytime
Every run writes a Markdown report (results/report_*.md) and a self-contained HTML report (results/report_*.html — double-click to open, safe to send to anyone). Raw per-question results live in results/<model>/*.jsonl. Every row records the image paths it was judged from (images), so a result file can be traced back to its photos without the dataset.
Using your own data
Scene checks (recommended): many checks per image
The typical need: give one image, answer multiple yes/no checks — "is there a bicycle?", "is the checkout counter clean?". One data row = one image + all its checks, answered in one model call (saves N-1 calls):
{"id": "shop001", "image": "images/shop001.jpg", "task": "checklist",
"checks": [
{"name": "bicycle present", "answer": true},
{"name": "checkout counter clean", "answer": false,
"criteria": "no litter, no visible stains, no clutter on the counter; light dust does not count"},
{"name": "no clutter in store", "answer": true}
]}
answer is the human-labeled ground truth (true/false). Omit it for unlabelled photos (production judging): the check is judged but never scored, and run does not ask again on resume; a localization check may still require evidence with bbox: true
- Multi-image (reference comparison, e.g. standard vs scene photo): use an
images list (cap 8) instead of image — {"id": "shop001-ref", "images": ["images/standard.jpg", "images/shop001.jpg"], "task": "checklist", "checks": [...]}
- Localization checks ("a fail must carry evidence"): add
bbox to a check — the model must output the problem region when it answers no, or the item counts as wrong. {"name": "fire extinguisher missing", "answer": false, "bbox": [0.12, 0.30, 0.45, 0.80]}: with a 0-1 normalized gold region, the model's bbox must reach IoU ≥ 0.5 to score correct (row-level iou_threshold: 0.3 lowers the gate for recall-biased setups); "bbox": true only requires a valid bbox. Model output accepts 0-1000 integers (Qwen-VL/GLM style) or 0-1 floats — normalized automatically; result records carry bbox and iou fields
- Choosing a model for localization (capabilities vary widely — always measure): grounding-trained families (Qwen-VL / GLM-4V line) are the most reliable, emitting normalized boxes natively; general flagships (GPT / Claude / Gemini) produce boxes but aren't grounding-trained — positions drift, small targets suffer, and they sometimes skip the bbox entirely; dedicated detectors (YOLO / Grounding DINO) are pixel-accurate but only box, no semantic judgment. The sweet spot for VLM bboxes is "a fail with location evidence"; high-precision localization still belongs to detectors. Tips: prompt the model to describe the location before emitting the box, or overlay numbered markers (Set-of-Mark)
name is a short label (used as the report column and result ID); for subjective checks always add criteria — the judging standard goes into the prompt only, aligning the model with your annotators. This is the single biggest factor in subjective-check accuracy
- The model returns
verdict (yes/no, or 不确定 when the photo cannot show the check) + confidence (0–1 judgment confidence) + reason (one-sentence visual evidence) per check. An abstain is never scored and goes to review. Reasons and confidence are stored and shown in the report's wrong-case section, so you can tell "model was wrong" from "the standard was ambiguous"; models that skip confidence degrade gracefully to a no-sweep baseline
- The report breaks accuracy down per check name (e.g. "checkout counter clean: 71%"), making weak scenes obvious; the threshold sweep table further reports per check the raw missed / false-alarm / abstained counts and the t* gate threshold that keeps recall ≥95% at the smallest review burden — the "recall-biased" production knob
- Parsing tolerates format variants (bare yes/no, booleans, arrays); unanswered or garbage answers count as wrong and are tagged
parse_fail
Labels work in Chinese or English — the sample data and prompts use Chinese; English content is handled equally well.
Single-question mode
One row per question, for datasets where each image gets a different question. Prepare a JSONL (or CSV with the same columns), image paths relative to the dataset file:
{"id": "q001", "image": "images/001.jpg", "task": "classification",
"question": "Which product model is shown?", "choices": ["A1", "B2", "C3"],
"answer": "B2", "category": "model-id"}
{"id": "q002", "image": "images/002.jpg", "task": "vqa",
"question": "Where is the damage: top-left, top-right, bottom-left or bottom-right?",
"answer": "bottom-left", "match": "judge", "category": "defect-location"}
{"id": "q003", "image": "images/003.jpg", "task": "vqa",
"question": "How many safety hazards are visible? Answer with a number only.",
"answer": "3", "match": "numeric", "category": "counting"}
Field reference:
| Field |
Required |
Notes |
image |
✅ |
Path to the image; auto-compressed if > 4MB or longest side > 1568px |
task |
|
classification (needs choices) / checklist (needs checks) / vqa (default) |
question |
cls/vqa |
The question text |
answer |
cls/vqa |
Ground truth; for classification use the option text or its letter |
choices |
|
Options for classification |
checks |
|
Checklist items [{name, answer, criteria?}]; answer is true/false, or omitted for an unlabelled photo |
match |
|
VQA scoring strategy; default is judge-if-configured, else contains |
category |
|
Business category for per-category breakdown (checklists use check names automatically) |
tolerance |
|
Allowed error for numeric matching, default 0 |
Choosing a VQA scoring strategy
numeric: answers are numbers (counts, readings); Chinese numerals ("三个") supported
exact: unique unambiguous answers (IDs, yes/no), case/punctuation-insensitive
contains: gold answer must appear in the prediction (loose; good for keyword answers)
judge: LLM-judge semantic scoring (recommended for open-ended answers). The judge only sees question/gold/prediction text — never the image — so any text model can judge. Most robust for long or open answers.
Adding models
Edit vlmeter/config/models.yaml and add an entry (flip enabled to true):
glm-4v:
enabled: true
provider: openai # any OpenAI-compatible endpoint
model: glm-4v-plus
base_url: https://open.bigmodel.cn/api/paas/v4/
api_key_env: ZHIPUAI_API_KEY # read from .env / environment
concurrency: 4
Local models, two ways:
# Option 1: vLLM (recommended, OpenAI-compatible)
vllm serve Qwen/Qwen2.5-VL-7B-Instruct --port 8000
# Option 2: Ollama
ollama pull llava
Preset entries qwen2.5-vl-7b (vLLM) and llava (Ollama) are already in the yaml — just enable them.
Where prices come from: price_input / price_output (per 1M tokens) are optional — run vlmeter prices --refresh once to fetch the LiteLLM cost-map snapshot, and any model without explicit prices is priced from it (USD × the usd_to_cny rate, default 7.2, overridable at the top of models.yaml). Priority: explicit yaml price > LiteLLM snapshot > unpriced; vlmeter prices lists each model's source and amount. For self-hosted models set an explicit 0 (hosting-provider prices from the map don't apply to your own GPU).
Note: if your machine sets OPENAI_BASE_URL to a proxy, the official-OpenAI entry must hard-code base_url: https://api.openai.com/v1/ with its own key variable, so keys never get sent to the wrong server.
Running & reports
vlmeter run --models a,b,c --data data/my.jsonl \
--judge deepseek-v4-pro \ # optional judge model (any text model)
--limit 20 \ # pilot run on the first 20 items
--fresh # ignore cache, rerun everything
vlmeter report --data data/my.jsonl # regenerate reports anytime
- Interrupted or rate-limited? Run the same command again — only failed/missing items are retried
- Result files are keyed by dataset content hash; switching datasets starts fresh files automatically
- Reasoning models (e.g. DeepSeek) can exhaust
max_tokens on thinking and return empty output — the runner retries automatically; if it happens often, raise max_tokens in the model config
Live dashboard
While an eval is running, open a second terminal and watch progress in the browser (standard library only, zero new dependencies):
vlmeter dashboard --data data/my.jsonl # pin the dataset (gives the progress bar a denominator)
vlmeter dashboard # or auto-scan all dataset groups under results/
vlmeter dashboard --open # open the browser on start (default port 8756)
- Polls the per-item JSONL under
results/ every 1.5 s and refreshes live: per-model progress bars, accuracy + 95% CI, cost, error counts
- Click the error count to expand wrong-case drill-down (gold vs model answer + scoring rationale); plus a live answer stream and a per-category accuracy table
- Aggregation shares the same code as the static report (reuses the report.py functions), so dashboard numbers always match
- Listens on 127.0.0.1 only — never exposed to the LAN
Dataset health (v0.7.0)
A dataset that grows from production feedback is a living document. vlmeter health answers "can this ruler still measure?":