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

# Load new weights into a rollout deployment

> Request a published snapshot with the hot-load API, check that every replica loaded it, and recover when a replica rejects it.

A rollout deployment loads new weights without redeploying. You request a snapshot you've [published](https://docs.baseten.co/rl-rollouts/publish-checkpoints.md), and each replica prepares the update while it keeps serving, then pauses briefly to swap weights.

## Prerequisites

* A running rollout deployment, with the model ID and deployment ID that [`baseten model push`](https://docs.baseten.co/reference/cli/baseten/model#push) printed. To create one, see [Deploy RL Rollouts](https://docs.baseten.co/rl-rollouts/deploy.md).
* A published snapshot in your bucket. To publish one, see [Publish checkpoints](https://docs.baseten.co/rl-rollouts/publish-checkpoints.md).

The `curl` examples authenticate with `BASETEN_API_KEY`. Export your [API key](https://docs.baseten.co/organization/api-keys.md) first:

```sh theme={"system"}
export BASETEN_API_KEY="YOUR_API_KEY"
```

## Request a snapshot

**To load a delta**:

Send a `POST` request with the snapshot's identity and the delta's formats. Replace `<model_id>` and `<deployment_id>` with your deployment's IDs:

```sh theme={"system"}
curl -sS -X POST "https://api.baseten.co/v1/models/<model_id>/deployments/<deployment_id>/hot_load" \
  -H "Authorization: Bearer $BASETEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"identity": "step000002", "incremental_snapshot_metadata": {"compression_format": "arc_v2", "checksum_format": "alder32"}}'
```

To load an anchor, send only its identity, such as `{"identity": "step000003"}`.

The response is `{"revision": N}`: Baseten stored the request, and every replica loads it. `revision` increases with each request, and the newest request wins, so you can request snapshots faster than replicas apply them. The API doesn't check the snapshot. Each replica checks it and reports a bad one as `rejected` while it keeps serving its current snapshot.

For more information, see [Set the target snapshot](https://docs.baseten.co/reference/management-api/deployments/set-hot-load-snapshot.md).

## Check that every replica loaded it

**To check each replica's state**:

Send a `GET` request to the same URL:

```sh theme={"system"}
curl -sS "https://api.baseten.co/v1/models/<model_id>/deployments/<deployment_id>/hot_load" \
  -H "Authorization: Bearer $BASETEN_API_KEY"
```

The response lists every replica of the deployment, in every cluster it runs in. Repeat the request until every entry in `replicas` reports:

* `replica_status: "ready"`
* `loading_state.current_snapshot_identity` set to the snapshot you requested
* `loading_state.hotload_stage: "done"`
* `loading_state.revision` equal to the top-level `revision`

A replica that's `done` at an older revision hasn't loaded your request yet. `loading_state` is `null` for a replica that hasn't reported a state.

Replicas update independently, so rollouts can briefly come from different policies. To record which policy produced each rollout, request `engine_data` and save its `policy_version` and replica with each sample; see the [RL request and response fields](https://github.com/basetenlabs/rl-rollouts/blob/main/docs/rl-api.md).

For more information, see [Get snapshot loading status](https://docs.baseten.co/reference/management-api/deployments/get-hot-load-status.md).

## Recover from a rejected or failed load

When a replica's `hotload_stage` is `rejected` or `error`, `loading_state.reason` says why. A replica that rejects a snapshot keeps serving its current one. Fix the cause, then send the request again, or request an anchor. If the snapshot itself was bad, such as a delta built against the wrong parent, publish it again under a new identity, because published snapshots can't change.

## Clean up

The deployment bills for its GPUs until you deactivate it. To stop serving and stop the charges:

```sh theme={"system"}
baseten model deployment deactivate --model-id <model_id> --deployment-id <deployment_id>
```

The command prompts for confirmation. Add `--yes` to skip the prompt when you script it.

## Next steps

* [Publish checkpoints](https://docs.baseten.co/rl-rollouts/publish-checkpoints.md): Publish the next delta or a new anchor.
* [Deploy RL Rollouts](https://docs.baseten.co/rl-rollouts/deploy.md#upgrade-a-deployment): Upgrade the runtime or model configuration.
