Skip to content
Back to skills

Optimize Model

ASecurity

Find fast serving settings for a model on its GPUs in hours, not days: research what the model, its checkpoints and the engine offer (FP8 weights, KV cache and drafters by default, speculative decoding when it exists), check the answers first, then change one setting per round in a draft and measure it with a short probe, keep what wins, and run the full benchmark once on the result. Use when the operator asks to optimize, tune, speed up or benchmark a model, to add a model to a catalog, or t...

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
businessrustgoapibackendperformance

Works with

  • cli
  • api

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add onprem-ai/platform --skill optimize-model --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Optimize Model?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Optimize Model
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/onprem-ai-optimize-model/badge)](https://www.skillsdirectory.com/skills/onprem-ai-optimize-model)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: optimize-model
description: >-
  Find fast serving settings for a model on its GPUs in hours, not days: research what the
  model, its checkpoints and the engine offer (FP8 weights, KV cache and drafters by default,
  speculative decoding when it exists), check the answers first, then change one setting per
  round in a draft and measure it with a short probe, keep what wins, and run the full
  benchmark once on the result. Use when the operator asks to optimize, tune, speed up or
  benchmark a model, to add a model to a catalog, or to find better settings for its
  compose.yaml.
---

The method, the probe and the answer checks are in docs:guides/tuning-model-performance.md.
Read it before you start. A guided search, not a grid: find by reading the few levers this
model, checkpoint, engine and GPU have; check the answers before any speed number; change one
lever per round and measure it with a short probe; run the full benchmark once, on the chosen
settings.

## 0. Agree on the plan and keep the clock

- Find the model: the inference service, its deploy profile and catalog, the GPUs its replica
  runs on (`inference_services_read`). Read the profile's `compose.yaml`, `ai-deploy.yaml`
  and latest `journal/` entries (`model_catalog_read`, operation `catalogs_files_read`): what
  was tried before.
- Propose the plan to the operator: the draft, the test service and its GPUs, the goal
  (single-user speed, throughput at many users, long context, or a balance), the time budget,
  and the levers in the order you will try them. Wait for the confirmation. With it, you
  change the draft and redeploy the test service in every round without asking again.
- Never change the production service, never publish, and never exceed the time budget
  without asking again.
- Write the start time down and check it every round. When the budget is spent, or the
  operator asks you to decide, decide: one set of settings, then the full benchmark.

## 1. Research before you touch a GPU

Most of the result is decided here, by reading; up to half an hour. The guide's "Research"
section lists what to read.

- **Precision: FP8 by default.** The model weights, the KV cache and any drafter are FP8, or
  a smaller format where the publisher or engine recommends one for this GPU (NVFP4 on
  Blackwell). Set the KV cache precision explicitly: an engine's default is the model's
  16-bit type. Without a trusted FP8 checkpoint, quantize the official weights at load time
  rather than serve 16-bit. 16-bit is used only for a specific reason: an explicit
  recommendation by the publisher or the engine against FP8 for this model, or a quality
  loss your answer checks measured. A missing recommendation for FP8 is not a reason. The
  journal names the precision of all three, and quotes each reason for 16-bit with a link to
  its source.
- **Speculative decoding: check for it, and use it when it exists.** Built-in prediction
  heads (MTP, `num_nextn_predict_layers` in `config.json`), a drafter from the publisher, a
  trusted drafter, then a model-free method of the engine. If one exists, the baseline runs
  with it on, as the publisher recommends it.
- **The engine and image.** Which engine and version support the architecture natively, and
  whether the publisher ships its own image or plugin. Confirm support inside the exact image
  you pin. Use the reasoning and tool-call parsers the publisher names.
- **Performance first.** When a setting needs something the image lacks (a package, a
  plugin), build the image rather than take a weaker setting, and say so to the operator.
- Write the candidate levers in the order you expect them to matter: speculative length, KV
  cache and context, scheduler limits, kernels and backends, load-adaptive options.

## 2. Set up

- A catalog that follows an upstream takes no changes: duplicate only this profile into a
  catalog without an upstream (`model_catalog_change`, operation
  `catalogs_files_duplicate_deploy_profile`), or create a draft (`model_catalog_change`,
  operation `catalogs_drafts_create`).
- Give the profile its own model name, in `ai-deploy.yaml` (`api.routing_model_id`) and in
  `compose.yaml` (the served model name), for example with `-tuning`, so the test service
  gets no client's request. Commit it (`model_catalog_change`, operation
  `catalogs_files_commit`).
- Deploy it as the test service on the agreed GPUs (`inference_services_change`, operation
  `deploy`, with `dry_run` first), and wait until its replica is ready (`wait_seconds`
  between checks). docs:guides/deploying-models.md explains the deploy.

## 3. Check the answers before any speed number

A faster model that answers worse is a failed result. With the baseline settings, check
through the path clients use: every reasoning mode, tool calls (parallel ones if claimed), an
answer built from a tool result, every input type and API the card claims, a fixed set of
short questions with known answers repeated several times, and a hidden fact at increasing
context lengths up to the card's maximum. Read the start-up log (docs:guides/model-logs.md):
weights, KV cache tokens, kernels and backends chosen, every warning. Repeat the checks in
every round that can change answers: precision, quantization, speculative settings that are
not lossless.

## 4. Rounds: one change, a short probe

The probe holds a fixed number of requests in flight against the engine, with unique
prompts, a warm-up and a fixed window (the guide's "The probe"). Calibrate it once against
the full benchmark; decide on the inter-token latency and per-user speed, which repeat
closely, not on a throughput figure inside the noise.

For each lever, one at a time:

1. Change one setting in the draft's `compose.yaml`; commit with a message naming it and its
   value.
2. Redeploy the test service (`inference_services_change`, operation `redeploy`); wait until
   it is ready. When it does not start, read the replica's log, record why, set the change
   back, and continue with the next lever.
3. Repeat the answer checks the change could affect.
4. Probe at the agreed levels: 1, a middle level, a high one.
5. Read the engine's own figures for the round: KV cache size and use, running and waiting
   requests, speculative acceptance.
6. Keep the change only when it wins where the goal needs it, above the noise. Stop a
   direction when it loses at every level; bracket a numeric winner with one value on each
   side. If a setting wins at one end and loses at the other, look for a load-adaptive option
   before you pick an end, and check that the engine supports the combination.
7. Write the round down at once, and tell the operator its result in one line.

## 5. Decide, then run the full benchmark once

- Choose against the goal from step 0; without one, the best single-user speed that keeps
  most of the throughput. Say what the choice gives up.
- Commit the chosen settings, redeploy, and run the full benchmark on exactly them
  (`inference_services_change`, operation `replicas_benchmark_start`, all workloads; read it
  with `inference_services_read`, operation `replicas_benchmark_get`, until it is no longer
  `running`). Read the replica's GPU memory every half minute while it runs: the highest
  value is the peak (the `measure-gpu-memory` skill). If the machine was lost, bring it back
  and start again; if the run failed for another reason, find why before you run it again.
- When the full benchmark fails on one workload (a failed request, an engine crash, a
  collapse at some level), never rerun the whole benchmark to test the fix: the workloads that
  passed take most of its hour. Find the cause, change one setting, then run only the failing
  workload against the replica (`replicas_benchmark_start` with `workloads` naming it, or the
  load generator with `-workload <name>`) up to and past the level where it failed. Run the
  full benchmark again only after that workload passes, once, on the final settings.

## 6. Finish

- Commit the run's `benchmark_file` as it is, at its `benchmark_file_path` under the profile
  (`benchmarks/<YYYY-MM-DD>-<HHMM>Z-llmperfbench.yaml`), with only a `journal:` line added
  naming the session's entry. Never edit its figures and never replace another run's file.
  Its numbers belong to the compose file it measured, so measure the committed settings.
- Write the measured GPU memory into `ai-deploy.yaml` and the session's journal entry
  (`journal/<date>-<topic>.md`): the GPU, the engine and image, the precision of weights, KV
  cache and drafter with the reasons, every round with its numbers, failed rounds included,
  and the ideas not tried.
- Set the model name back to the published one, in both files, and commit; check the profile
  (`model_catalog_read`, operation `deploy_profiles_check`).
- Undeploy the test service (`inference_services_change`, operation `undeploy`; confirm
  first: it is destructive).
- Report in a few lines: the baseline, the winner and what made it, the full benchmark's
  headline figures, the memory peak against the booking, what is still open. Publishing the
  draft and redeploying the production service are the operator's decisions: offer them, and
  run them only when the operator says so.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in business →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.