К основному содержанию
скилл CX Codex

benchmark-model — скилл для Claude Code: замер производительности MAX

Гоняет нагрузку на запущенный max serve и выдаёт tokens/sec, TTFT и TPOT. Нужен, когда надо понять, сколько модель держит и где проседает latency.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add modular/skills --skill benchmark-model -a claude-code
Открыть на GitHub

Что делает benchmark-model

Скилл превращает агент в генератор нагрузки для уже работающего сервера MAX. Он шлёт запросы на живой эндпоинт max serve, замеряет их и отдаёт throughput в токенах в секунду и задержки: TTFT, TPOT, inter-token latency. Режим выбирать не надо — каждый прогон показывает и скорость, и задержку сразу.

Главное здесь — подобрать нагрузку под вопрос. Хочешь лучшую задержку одного запроса — ставь --max-concurrency 1 и фиксированную форму через --random-input-len и --random-output-len. Нужен пик throughput и точка, где latency начинает расти — гони свип --max-concurrency 1,2,4,8,16,32 с большим --num-prompts. Датасет тоже выбирается: random для чистых микрозамеров, sharegpt для реального чата, arxiv-summarization для длинного контекста.

Перед прогоном нужен установленный MAX через pip или pixi и запущенный сервер. Имя в --model должно точно совпадать с --served-model-name сервера, иначе все запросы падают. Если серверное имя — алиас без /, передай настоящий Hugging Face ID в --tokenizer, иначе прогон умрёт с ошибкой про невалидный идентификатор. Для --collect-gpu-stats бенчмарк должен идти на той же машине с NVIDIA, что и сервер. И ещё: свип до --max-concurrency 32 против сервера с --max-batch-size 1 просто ставит запросы в очередь — высокие точки ничего не значат, пока не поднимешь batch size.

Какие задачи решает

  • получить tokens/sec и TTFT для модели на MAX
  • найти точку, где рост concurrency начинает портить latency
  • сравнить прогоны между собой по сохранённому JSON
  • подобрать размер деплоя под целевую нагрузку
  • разобраться, почему прогон не подключается или выдаёт нули

Примеры запросов агенту

  • замерь latency одного запроса к модели на localhost:8000
  • прогони свип по concurrency и покажи, где throughput упирается в потолок
  • сделай бенчмарк на sharegpt и сохрани результат в results/throughput.json

Как установить benchmark-model

1Через Skills CLI (Vercel)

npx skills add modular/skills --skill benchmark-model -a claude-code

2Вручную: положить файлы

~/.claude/skills/benchmark-model/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/benchmark-model/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о benchmark-model

Как установить benchmark-model в Claude?

Выполни npx skills add modular/skills --skill benchmark-model -a claude-code. Скилл появится в ~/.claude/skills/benchmark-model/SKILL.md.

Что делает benchmark-model?

Шлёт нагрузку на работающий max serve и возвращает throughput в токенах в секунду и задержки TTFT, TPOT и inter-token. Заодно может собирать статистику по GPU.

Что нужно, чтобы прогон прошёл?

Установленный MAX через pip или pixi и запущенный сервер. Имя в --model должно совпадать с --served-model-name сервера, а для --collect-gpu-stats бенчмарк идёт на той же NVIDIA-машине.

Исходный текст

SKILL.md · Apache-2.0
---
name: benchmark-model
description: >
  Benchmark a model served on MAX with the `max benchmark` command: measure
  throughput (tokens/sec), latency (TTFT, TPOT, inter-token latency), and GPU
  utilization by driving load against a running `max serve` endpoint. Use this
  whenever the user wants to benchmark, load-test, or measure the performance of
  a MAX model, get tokens-per-second / TTFT / TPOT numbers, run a concurrency or
  request-rate sweep, compare latency vs throughput, size a deployment, or
  produce benchmark JSON, even if they don't say "benchmark" by name. Also use
  when a `max benchmark` run fails to connect or reports zero/garbage numbers.
compatibility: Requires a pip or pixi MAX install and a running `max serve` endpoint; GPU stats (`--collect-gpu-stats`) need the benchmark to run on the same NVIDIA machine as the server.
argument-hint: "[what to measure, for example 'single-request latency' or 'peak throughput']"
---

# Benchmark a model on MAX

`max benchmark` measures a **running** model server. It's a load generator: it
sends inference requests to a live `max serve` endpoint, times them, and reports
throughput (tokens/sec) and latency (TTFT, TPOT, inter-token latency). A
benchmark combines two things: a server under test, and a workload that matches
the question you're asking.

Every run reports both throughput and latency, so there's no mode to select.
Decide what you want to learn first, then pick the workload that measures it.
Single-stream latency and peak throughput come from different workloads, so the
workload you choose *is* the measurement. Get that right and a clean number
falls out.

Use this skill when you want a performance number for a model on MAX:
tokens/sec, TTFT / TPOT, a concurrency or request-rate sweep, a
latency-vs-throughput tradeoff, or deployment sizing.

Don't use this skill when no server is running yet. `max benchmark` is a client,
so start a server with the `serve-model` skill first. To find out *where*
inference time goes at the kernel level, use `profile-model`. To check *whether
the output is correct*, treat it as a parity task (`import-model`, then
`debug-model`) rather than a benchmark.

This skill works anywhere MAX is installed (pip or pixi). Add `pixi run` in a
pixi project.

## References

The following table lists the reference files and when to read each one:

| File | Read when |
|------|-----------|
| [references/flags.md](references/flags.md) | Choosing any flag or dataset beyond the ones below |
| [references/metrics.md](references/metrics.md) | Turning the throughput and latency numbers into a conclusion |
| [references/troubleshooting.md](references/troubleshooting.md) | A run won't connect, requests fail, or the numbers look wrong |

Read the reference for what you're doing, not all of them upfront.

## 1. Check the server and read its model name

```bash
curl -s http://localhost:8000/v1/health     # 200 = ready
curl -s http://localhost:8000/v1/models      # note the served model name
```

Both checks matter before you spend a run:

- The benchmark's `--model` must equal the server's `--served-model-name`
  exactly, or every request fails. Take the value from `/v1/models` rather than
  guessing it.
- If that served name is an *alias* rather than a Hugging Face ID (no `/` in
  it), `--tokenizer` defaults to it and can't resolve, and the run dies with
  "not a valid model identifier." Pass the model's real Hugging Face ID as
  `--tokenizer`.

If nothing is serving, start a server with `max serve` (for a custom
architecture, use the `serve-model` skill). One more server setting matters:
`--max-batch-size` caps real concurrency. A sweep to `--max-concurrency 32`
against a server started with `--max-batch-size 1` queues requests instead of
batching them, so raise the server's batch size to match the sweep or the
high-concurrency points mean nothing.

Wait for `Server ready` *then* benchmark. Benchmarking during compile or warmup
produces garbage first-token times.

## 2. Pick the workload for your question

The workload is the measurement. Match it to what you want to learn:

| What you want to know | Workload |
|---|---|
| Best-case single-request latency (TTFT, TPOT) | `--max-concurrency 1`, fixed `random` shape, small `--num-prompts` |
| Peak throughput and where latency degrades | `--max-concurrency 1,2,4,8,16,32` sweep, more prompts |
| Performance under a realistic mix | `--dataset-name sharegpt`, moderate concurrency |
| Behavior at a target load | `--request-rate 1,2,4,8` sweep (requests/sec) |

A sweep answers the first two rows at once: the concurrency-1 point is the
best-case latency number, and the peak across the sweep is the throughput
number. Reach for a dedicated concurrency-1 run when you only want the latency
figure and don't want to pay for the rest of the curve.

The key knobs are the following (`references/flags.md` has the full catalog):

- `--dataset-name`: pick `random` (synthetic, shape it with
  `--random-input-len` and `--random-output-len`), `sharegpt` (real chat), or
  `arxiv-summarization` (long context). `random` works best for clean,
  reproducible micro-measurements.
- `--max-concurrency` and `--request-rate`: take a single value or a
  comma-separated *sweep* (`1,2,4,8`). A sweep is how you find the throughput
  knee.
- `--endpoint`: use `/v1/completions` for base LMs, which need no chat template,
  or `/v1/chat/completions` for instruct and chat models, which must have a chat
  template or the requests return 400.
- `--max-output-len`: sets the decode length, which dominates how long the run
  takes.
- `--num-prompts`: required for single-turn runs.

## 3. Run it, save results, add GPU stats

For best-case single-request latency, pin concurrency to 1 and keep the shape
fixed:

```bash
pixi run max benchmark --backend modular --base-url http://localhost:8000 \
  --model <served-model-name> --endpoint /v1/completions \
  --dataset-name random --random-input-len 128 --random-output-len 128 \
  --max-output-len 128 --num-prompts 32 --max-concurrency 1 \
  --result-filename results/latency.json --collect-gpu-stats
```

For peak throughput and the latency knee, sweep concurrency and send more
prompts:

```bash
pixi run max benchmark --backend modular --base-url http://localhost:8000 \
  --model <served-model-name> --endpoint /v1/completions \
  --dataset-name random --random-input-len 512 --random-output-len 128 \
  --max-output-len 128 --num-prompts 200 \
  --max-concurrency 1,2,4,8,16,32 \
  --result-filename results/throughput.json --collect-gpu-stats
```

Note these three things about saving and instrumenting a run:

- `--result-filename`: writes metrics to JSON and creates the directories it
  needs. Set it whenever you want to track or compare runs; without it, MAX
  saves nothing. `--metadata key=value` stamps the JSON, for example
  `--metadata tp=1 gpu=b200`. A sweep also drops a `results-<N>-median.json`
  per step under `--log-dir`.
- `--collect-gpu-stats`: adds GPU utilization and peak memory. This works only
  when the benchmark runs on the **same machine** as the server (NVIDIA).
- For version-controlled configs, put options under a `benchmark_config:` key in
  a YAML file and pass `--config-file file.yaml`. Keys use `snake_case`, and CLI
  flags override the file.

## 4. Read the metrics

The run prints throughput and latency, and a sweep prints one row per point. The
headline numbers are the following:

- Output token throughput (tok/s): the main throughput number.
- TTFT (time to first token): prefill responsiveness. Watch p50 and p99.
- TPOT and ITL (time per output token and inter-token latency): decode speed.
- GPU utilization and peak memory: reported with `--collect-gpu-stats`.

For how to turn these numbers into a conclusion, and the latency-vs-throughput
tradeoff a sweep reveals, see `references/metrics.md`.

## Troubleshooting

Match the symptom against `references/troubleshooting.md`, which covers
connection failures, model-name mismatches, tokenizer-alias errors,
chat-template 400s, flat throughput from a batch-size cap, and warmup-skewed
first-token times. Confirm that `curl /v1/health` returns 200 before you check
anything else.

© modular · Apache-2.0 · modular/skills

Похожие скиллы

Всё по теме «ИИ и ML» →
cost-trend ruvnet Скилл читает журналы бенчмарков из docs/benchmarks/runs/*.json и показывает, как со временем меняются win rate, latency, escalation rate и стоимость. Ловит регрессии, которые smoke-тест пропускает. CX Codex +1 683установок best-ai-marketing-platform-benchmark reason-machines Скилл собирает сравнительный обзор платформ, которые отслеживают упоминания бренда в ответах ChatGPT, Perplexity и Google AI Overviews. Пригодится, когда выбираете, чем мониторить видимость в ИИ-поиске. CX Codex +1 903установок cost-benchmark ruvnet Запускает бенчмарки на локальном корпусе задач и сравнивает затраты с базовыми моделями Gemini и Claude. Пригодится для проверки точности и расходов перед релизом. CX Codex +1 679установок benchmark-paper-template HKUSTDial Разбирает статью о бенчмарке по пяти опорам и выдаёт скелет разделов, логическую цепочку введения и чек-лист перед подачей. CX Codex +1 679установок benchmark affaan-m Скилл измеряет скорость страниц, API и сборки, а затем сравнивает показатели до и после изменений. Пригодится перед релизом или когда страницу считают медленной. CX Codex +1 4 500установок benchmark-checklist backnotprop Скилл задаёт агенту список вопросов, которые нужно закрыть доказательствами из прогона, прежде чем докладывать об ускорении или регрессии. CX Codex +1 4 100установок

Из того же набора10

mojo-python-interop Скилл для агентов, которые пишут код на Mojo с вызовами Python: подсказывает актуальный синтаксис вместо устаревшего из обучающих данных. CX Codex +1 2 600установок mojo-gpu-fundamentals Инструкция для ИИ-агентов по низкоуровневой разработке на Mojo под GPU NVIDIA, AMD и Apple silicon. Избавляет модель от попыток вставлять синтаксис CUDA. CX Codex +1 2 600установок new-modular-project Создаёт и настраивает проекты на Mojo или MAX через менеджеры pixi либо uv. Скилл запрашивает только недостающие параметры и подключает каналы stable или nightly. CX Codex +1 2 400установок import-model Скилл ведёт агента через порт архитектуры из Hugging Face в MAX: разбор конфига, реализация слоёв, проверка против эталона. CX Codex +1 1 400установок debug-model Протокол отладки модели MAX, которая запускается и выдаёт токены, но расходится с эталоном: сначала дампы тензоров, потом правки. CX Codex +1 1 300установок profile-model Профилирует модели MAX, чтобы проверить загрузку GPU и найти самые долгие GPU-ядра. Нужен при медленном инференсе или разборе трассировки. CX Codex +1 1 200установок eval-model Гоняет текстовую модель за MAX по стандартным бенчмаркам и пишет воспроизводимые оценки по каждой задаче. Пригодится, когда надо сверить серверную модель с карточкой. CX Codex +1 981установок serve-model Скилл помогает поднять OpenAI-совместимый сервер для модели через max serve: от установки окружения до подбора флагов. CX Codex +1 949установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой