benchmarking

benchmarking is a skill for Claude Code, Codex from Blaizzy/mlx-vlm. It costs 74 tokens per session (1,142 once invoked), scanned A, original, MIT.

A workflow for measuring MLX-VLM code changes with repeatable performance tests. It compares versions or isolated modules using timing, memory, correctness checks, and parameter sweeps.

In plain words
What is it for?
Use it to create PR-ready comparisons, test how performance changes with sequence length or batch size, report peak memory, and write reproducible benchmark scripts.
Why use it?
It reduces the risk of presenting misleading benchmark results by requiring warmups, median timings, synchronized work, and checks that both implementations produce the right result.

Skill for Claude CodeCodex

Part of the mlx-vlm-skills plugin — 8 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/blaizzy/mlx-vlm/benchmarking
Any agent
npx skills add Blaizzy/mlx-vlm --skill benchmarking
Clone the repo
git clone --depth 1 https://github.com/Blaizzy/mlx-vlm

Made for: Claude Code, Codex.

Or install mlx-vlm-skills, the plugin that ships this one along with the rest of its 8 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for benchmarking

README.md
[![agentmods](https://agentmods.dev/badge/skills/blaizzy/mlx-vlm/benchmarking.svg)](https://agentmods.dev/skills/blaizzy/mlx-vlm/benchmarking)
Your own site
<a href="https://agentmods.dev/skills/blaizzy/mlx-vlm/benchmarking"><img src="https://agentmods.dev/badge/skills/blaizzy/mlx-vlm/benchmarking.svg" alt="Measured on agentmods" height="20"></a>
Per session 74 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,142 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00074 $0.01142
Opus 5 $0.00037 $0.00571
Sonnet 5 $0.00015 $0.00228
Haiku 4.5 $0.00007 $0.00114

Measured 4d ago against content hash c8751953842b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

benchmarking scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/skills/benchmarking/SKILL.md · 80 lines

How it starts

The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Benchmarking & PR A/B Testing

Use this workflow to produce credible, reproducible performance numbers for a PR.

Rules for a trustworthy benchmark

  • Median of N (not mean), with a few warmup iterations discarded.
  • Call mx.eval(...) / mx.synchronize() before stopping the timer (MLX is lazy — untimed work hides otherwise).
  • Report peak memory via mx.get_peak_memory()/1e9 (GB); reset with mx.reset_peak_memory() if available.
  • Include an inline correctness check — a benchmark that computes the wrong thing is meaningless. Assert the new path matches the baseline (exactly in the degenerate limit, or within tolerance).
  • Sweep one parameter (sequence length, batch, tokens, layers) and print a markdown table with flush=True.
  • Prefer a random-init synthetic model (tiny config) so the script needs no checkpoint download and runs on a fresh checkout.
  • State the hardware (Apple-Silicon chip + RAM). A model must fit in RAM; isolate the module under test with random weights if the full model won't fit — don't run large models on an 8 GB machine.

Fork-vs-main A/B (paste into the PR body)

Clones upstream main and your fork, runs the identical bench on both, and joins into a speedup table:

#!/usr/bin/env bash
# <feature> perf: upstream main vs fork, random-init tiny <model>, swept over <param>.
set -euo pipefail
W=$(mktemp -d)
git clone -q --depth 1 https://github.com/Blaizzy/mlx-vlm "$W/main"
git clone -q --depth 1 https://github.com/<you>/mlx-vlm   "$W/fork"

cat > "$W/b.py" <<'PY'
import time, numpy as np, mlx.core as mx
from mlx_vlm.models.<model> import Model, ModelConfig
cfg = ModelConfig(...tiny config...)          # small enough to fit in RAM
m = Model(cfg); m.eval(); mx.eval(m.parameters())
def ms(T):
    c = m.make_cache(); p = 0
    while p < T:                               # chunked prefill avoids OOM
        n = min(256, T - p)
        mx.eval(m(mx.array(np.random.randint(0, cfg.vocab_size, (1, n))), cache=c).logits); p += n
    for _ in range(4): mx.eval(m(mx.array([[0]]), cache=c).logits)   # warmup
    t = time.perf_counter()
    for _ in range(20): mx.eval(m(mx.array([[0]]), cache=c).logits)
    return (time.perf_counter() - t) / 20 * 1e3
for T in (16384, 32768, 65536):
    print(T, round(ms(T), 2), flush=True)
PY

run() { uv venv -q "$1/.venv"; uv pip install -q -e "$1" --python "$1/.venv/bin/python"; "$1/.venv/bin/python" "$W/b.py"; }
run "$W/main" > "$W/m.txt"
run "$W/fork" > "$W/f.txt"
echo; printf "| param | main | fork | speedup |\n|--:|--:|--:|--:|\n"
join "$W/m.txt" "$W/f.txt" | awk '{printf "| %d | %.2f ms | %.2f ms | %.2fx |\n", $1, $2, $3, $2/$3}'

Read the full file on GitHub · 80 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 80 lines · 74 tokens per session scan A c8751953842b

Subscribe to this mod's changes

benchmarking is a skill published in the GitHub repository Blaizzy/mlx-vlm (5,466 stars, last pushed today), licensed MIT. It adds 74 tokens to every session and 1,142 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

auditing-subgroup-fairness

Audit an OpenMed NER or de-identification model for performance disparities across demographic subgroups (sex, age band, race/ethnicity when available) using openmed.eval.fairnessreport. Use when the user wants per-subgroup recall and leakage, wants to check whether de-identification under-protects a group, wants to…

maziyarpanahi/openmed · 148 tokens

benchmarking-clinical-ner

Score an OpenMed clinical or biomedical NER model against a user-supplied gold corpus with entity-level precision, recall, and F1, then break errors down per label. Use when the user wants a seqeval-style scorecard, strict vs partial (relaxed) span matching, a per-label confusion matrix, false-negative /…

maziyarpanahi/openmed · 164 tokens

gating-deid-leakage

Add a CI gate that fails the build when an OpenMed de-identification model's recall on a held-out PHI set drops below threshold or any critical identifier leaks. Use when the user wants a pytest test or CLI step that exits nonzero on de-id regression, wants to wire OpenMed's leakage-first release gates into GitHub…

maziyarpanahi/openmed · 152 tokens

querying-openfda-labels

Looks up FDA drug labels, NDC directory entries, indications, boxed warnings, and recalls/enforcement actions via the free public OpenFDA API to enrich drugs that OpenMed extracts. Use when the user wants the prescribing information for a drug, its boxed warning, approved indications, dosage forms and routes, package…

maziyarpanahi/openmed · 189 tokens

benchmark-pii-recall

Benchmark an OpenMed PII model with synthetic gold spans and report label-aware exact-span and grapheme recall without emitting identifier surfaces. Use when an agent must compare a model, threshold, backend, or quantized artifact and enforce a recall floor before release.

maziyarpanahi/openmed · 57 tokens

pick-a-pii-model

Select an on-device OpenMed PII model from the committed registry by language, runtime format, and size budget, then require recall validation before deployment. Use when an agent must choose a local PII detector for CPU, Apple Silicon, or a mobile export without relying on live model discovery.

maziyarpanahi/openmed · 64 tokens