> ## Documentation Index
> Fetch the complete documentation index at: https://docs.infercrane.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Prove an engine upgrade

> Prove a new engine release, or another model revision or base model, before it ships, on your own servers or on fresh ones, with one command or a pull-request check.

# Prove an engine upgrade

An upgrade Proof answers one question before you ship: is the same setup on the new engine release
at least as fast, and are its answers as good? It measures the setup that serves today against the
same setup upgraded, each on its own server, in the same window, on the same traffic. A gain must
repeat on a fresh server, and the upgraded setup's answers are checked against the current one's.
Nothing that serves production changes until you roll out an upgrade that passed.

```bash theme={"theme":"css-variables"}
infercrane optimize upgrade deploy/support-bot.yaml --engine-version 0.34.0 \
  --endpoint support-bot --objective throughput --max-cost-usd 5 --wait 3h
```

The command exits with the verdict: `PASS`, `WATCH`, `BLOCK`, or `UNKNOWN`, decided from the run's
signed report. `BLOCK` and `UNKNOWN` exit non-zero.

Engine releases change what runs under the same flags. vLLM ships a new release every few weeks,
and a release can move batch budgets, KV cache sizing, and CUDA graph capture without a single flag
in your spec changing. An upgrade Proof measures the release as a whole, on your setup, instead of
reading release notes. With `--endpoint` it runs on your own GPUs, under the workload profile you
choose. On fresh servers of the same GPU it can replay your captured traffic.

## What an upgrade Proof measures

| | Engine upgrade | Model change |
| - | - | - |
| What changes | The image the server runs: a new `runtime.version`, or a new `runtime.workload.image` for a setup that pins its own | `model.id` and `model.revision`, pinned to a commit |
| What must stay the same | Everything else: engine, flags, environment, GPU, provider, scaling | Everything else: engine release, flags, GPU, provider, scaling |
| Answer check | The built-in check, or your eval set, against the current setup's answers | A [task set](https://docs.infercrane.com/features/semantic-quality.md#task-sets) of at least 100 items is required. The new model's answers must hold within 1 point |
| Name it with | `--engine-version VERSION`, or `--image IMAGE` too for a setup that pins its own image | `--model OWNER/NAME@COMMIT --eval-set TASK_SET` |

The run is an ordinary optimization run of two setups, judged by the same judge as any other: the
paired comparison against the noise measured in the same window, the confirmation on a fresh server,
Release Guard, and the answer check. Only the current setup and the upgraded one are measured.

One upgrade at a time. The command refuses a pair that changes the engine release and the model
together, so the run can tell which one made the difference, and a pair that also changes anything
else. An engine upgrade must change the image that runs. A new `runtime.version` on the same pinned
image, or a version that names the same release (`0.34.0` and `v0.34.0`), is refused, because the
new release would never run. Each setup names its `runtime.version`, and a version or image named
with a flag is checked as it would be in a spec file, before anything is planned.

A setup that runs InferCrane's pinned image upgrades with `--engine-version` alone. That holds whether
its spec leaves `runtime.workload` out or spells out that release's pinned image and contract: the
upgraded setup gets the new release's. `--image` names the new image of a setup that pins its own. To
move from InferCrane's image to one of your own, pass the upgraded spec as a second file:
`optimize upgrade CURRENT.yaml UPGRADED.yaml`.

Prove another kind of change with [`optimize compare`](https://docs.infercrane.com/cli#optimize-create), and moving to another engine
(vLLM to SGLang, for example) too, because it changes every default.

## Worked example: vLLM 0.22.1 to 0.34.0

InferCrane made this upgrade itself: vLLM 0.34.0 replaced 0.22.1 as the pinned release (see
[Move a deployment from vLLM 0.22.1 to 0.34.0](https://docs.infercrane.com/upgrade.md#move-a-deployment-from-vllm-0-22-1-to-0-34-0)).
Under the same flags, 0.34.0 changes the KV cache block from 16 to 64 tokens, sizes the KV cache
from the memory free after CUDA-graph capture with `gpu_memory_utilization` defaulting to 1.0
instead of 0.92, and raises the batch budget to 16,384 tokens on GPUs with 160 GiB or more. The vLLM release notes
report 6–18% higher per-token decode latency at concurrency 128 on some H200 models from the new KV
cache sizing. Whether your setup gains or loses is what the Proof measures.

The endpoint `support-bot` is served by an InferCrane agent in your Kubernetes cluster. The spec in
your repository says what its server runs:

```yaml deploy/support-bot.yaml theme={"theme":"css-variables"}
apiVersion: infercrane.dev/v1
kind: Deployment
name: support-bot
model:
  id: Qwen/Qwen3-8B
  revision: b968826d9c46dd6066d109eabc6255188de91218
runtime:
  engine: vllm
  version: 0.22.1
  args:
    - --enable-prefix-caching
resources:
  gpu: NVIDIA-L4
provider:
  cloud: kubernetes
```

**1. See what the run would prove**

`--plan` builds the run locally and contacts nothing:

```bash theme={"theme":"css-variables"}
infercrane optimize upgrade deploy/support-bot.yaml --engine-version 0.34.0 \
  --endpoint support-bot --objective throughput --plan
```

```text theme={"theme":"css-variables"}
Upgrade    engine: vllm 0.22.1 → vllm 0.34.0
Objective  throughput · throughput load
Current    endpoint support-bot's own server, as you declared it; it keeps serving and is never restarted
Upgraded   its own server, measured in the same window on the same traffic; a gain is measured again on a fresh server
Answers    the built-in check, compared with the current setup's answers
Mutation   none: nothing that serves production changes until you roll out a passing upgrade

Nothing was created. Run the same command without --plan to create the run.
```

**2. Run it**

The same command without `--plan` creates the run. `--max-cost-usd` approves it (in a terminal,
after showing the cap and the setups; `--yes` skips the question), and `--wait` waits for the
verdict:

```bash theme={"theme":"css-variables"}
infercrane optimize upgrade deploy/support-bot.yaml --engine-version 0.34.0 \
  --endpoint support-bot --objective throughput --max-cost-usd 5 --wait 3h
```

The agent starts vLLM 0.34.0 with your flags on its own server beside the endpoint's server,
measures both in the same window, starts the upgraded setup again on a new server if it gained,
and runs the answer check on both. Only numbers, per-item scores, and digests leave your
cluster. On your own GPUs the cap bounds nothing InferCrane bills; it is still required, as for
every run.

**3. Read the verdict**

The command ends with the proof gate's verdict for the upgraded setup, decided from the run's
signed report. Closing the command does not stop the run: read the verdict later with
`infercrane optimize gate RUN_ID`, and the full comparison with `infercrane optimize results
        RUN_ID`.

This page shows no measured result for the example: the upgrade has not been run on a GPU for this
page, so how 0.34.0 compares on an L4 is unknown here. `examples/proof-gate/dry-run.sh` runs the
whole pull-request path of this upgrade against a fake control plane, without a GPU, with a sample
report.

## Run it on your own servers or on fresh ones

* **On your own servers** (`--endpoint ENDPOINT`): the InferCrane agent that serves the endpoint
  measures the endpoint's own server as the current setup and starts the upgraded setup in your
  cluster ([Optimization runs on an agent's endpoint](https://docs.infercrane.com/architecture/agent.md#optimization-runs-on-an-agent%E2%80%99s-endpoint)).
  The agent cannot read an engine's flags, so the spec is your declaration of what the server runs;
  the run records it and its answer rules rest on it. The agent needs its executor enabled and the
  new release's image on its allowlist. A gain counts as confirmed on a fresh machine only when the
  agent shows the new server ran on another node, so that confirmation needs a second GPU node. The
  agent measures the workload profile, not a replayed trace, and cannot start a setup with
  environment variables, LoRA adapters, or a private model's credential yet.
* **On fresh servers** (no `--endpoint`): InferCrane starts both setups on fresh, isolated servers
  of the spec's provider and GPU, as [`optimize compare`](https://docs.infercrane.com/cli#optimize-create) does. They are
  billable up to `--max-cost-usd`. `--workload-fingerprint` replays your captured traffic on both.

## Change the model revision or base model

A model change gives other answers by design, so its answers carry the weight. It needs a task set:
an eval set graded `answer_line`, with one expected answer per item and at least 100 items. The new
model passes only when the lower end of the 95% interval of the per-item difference lies above −1
point (the rule for a setup that changes answers, [task sets](https://docs.infercrane.com/features/semantic-quality.md#task-sets)).
With fewer than 100 items one item moves the score by more than a point, so the rule cannot be
resolved, and two models that score alike on a few items would pass it.

Expect most base-model changes to end `UNKNOWN` or `BLOCK`. The interval's width comes from the
items the two models answer differently: each item that only one of them gets right widens it. Two base models
usually disagree on many items, so even when their scores are close the interval reaches below −1
point, and the answers are not shown to hold. A base-model change passes only when the two models
agree on nearly all graded items, or when the new model is right clearly more often (the whole
interval above zero). That is the check working: a similar score is not evidence that the answers
held.

```bash theme={"theme":"css-variables"}
infercrane optimize upgrade deploy/support-bot.yaml \
  --model Qwen/Qwen3-8B@NEW_COMMIT --eval-set evals/support-tasks.json \
  --endpoint support-bot --objective throughput --max-cost-usd 5 --wait 3h
```

Without a task set the command refuses before it contacts anything:

```text theme={"theme":"css-variables"}
Error: a model change is proved on its answers, so it needs a task set: an eval set with grading answer_line and an expected answer for every item (see infercrane evaluation set). Name it with --eval-set
```

`--eval-set` takes a digest or the set's file. A file is read and checked on your machine and named by
its digest; it is not uploaded. On fresh servers the control plane reads the set, so upload it first
(`infercrane evaluation set upload FILE`); a run whose set is missing, is not a task set, or has
fewer than 100 items is refused (`quality_eval_set_not_found`, `quality_eval_set_not_task_set`,
`quality_eval_set_too_small`). On your own servers the agent keeps
the set beside it (Helm `executor.evalSets`), and a model change whose answers did not come from a
task set ends inconclusive with `quality_model_change_needs_task_set`, and one answered on fewer
than 100 items with `quality_model_change_task_set_too_small`. A model change and an engine
upgrade are never proved in one run.

## Gate pull requests that upgrade

`examples/proof-gate/upgrade-workflow.yml` runs an upgrade Proof when a pull request changes the
spec's engine release or model. It uses the [proof gate](https://docs.infercrane.com/integrations/github-actions.md#gate-a-pull-request-on-the-proof)
with `proof: upgrade`:

```yaml theme={"theme":"css-variables"}
- uses: infercrane/infercrane/actions/infercrane@COMMIT_SHA
  with:
    mode: proof-gate
    proof: upgrade
    spec: deploy/support-bot.yaml
    endpoint: support-bot
    objective: throughput
    max-cost-usd: "5"
  env:
    INFERCRANE_URL: ${{ secrets.INFERCRANE_URL }}
    INFERCRANE_API_KEY: ${{ secrets.INFERCRANE_API_KEY }}
```

The spec on the pull request's base commit is the current setup. The gate first asks
`infercrane optimize upgrade CURRENT UPGRADED --plan`, which contacts nothing, and spends nothing
until that answer is an upgrade:

* A pull request that keeps the engine release and the model and changes nothing else is skipped.
* One that names a new `runtime.version` but would run the same image fails the check, because the
  new release would never run. The message says how to fix the spec: name the new release's image in
  `runtime.workload.image`, or, on InferCrane's pinned image, a release that has its own image.
* One that changes something other than the engine release or the model fails the check and says
  what it changes. Examples: an engine argument such as `--kv-cache-dtype fp8`, or another engine.
  Prove those with `proof: change`, which proves any change to the spec.
* One that changes an upgrade together with something else fails the same way.

A model change is planned on its task set, so set `eval-set` to the set's file or digest. Pin a
release tag or commit SHA of the action that includes `proof: upgrade`.

## After a verdict

* `PASS`: ship the upgrade the way you ship any spec change: merge it and apply it. On an endpoint
  whose traffic the agent serves (`agent-managed`), `infercrane optimize activate RUN_ID --candidate
  SETUP_ID` rolls the upgraded setup out with your own server as its fallback ([the winner's guarded
  rollout](https://docs.infercrane.com/architecture/agent.md#the-winner%E2%80%99s-guarded-rollout)).
* `WATCH`: a change inside the warning band. The command and the check pass with a warning; the
  proof gate's `on-watch: fail` makes the check fail instead.
* `BLOCK`: the upgrade is slower beyond the measured noise, or its answers failed the check. Stay on
  the current release.
* `UNKNOWN`: the run could not decide, for example it had not finished, or the answers of a model
  change were not shown to hold. Nothing is claimed either way.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.