> ## 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.

# Run training jobs on spot capacity

> Run a training job on idle GPUs in your organization, move a queued job onto spot capacity, and plan for preemption.

Spot capacity runs a job on GPUs that would otherwise sit idle, wherever they are in your organization. Use it when you need more than your [dedicated capacity](https://docs.baseten.co/training/gpu-capacity.md) allows, or you don't want to wait in the [queue](https://docs.baseten.co/training/job-queueing.md), for example to run extra experiments while your dedicated GPUs are busy.

## Prerequisites

* Spot capacity turned on for your organization. [Contact us](mailto:support@baseten.co) to request access.

## How spot capacity is counted

Spot jobs must fit within your organization's spot quota, counting dedicated and spot usage across every team. They also need available GPUs on an eligible cluster. Your team's quota and the [shared pool](https://docs.baseten.co/training/gpu-capacity.md#shared-pool) don't apply.

That has two effects:

* A team at its quota with an empty pool doesn't stop a spot job. The job runs on capacity that belongs to another team's quota.
* When your organization's entire dedicated capacity is in use, spot jobs keep running in the band between the on-demand quota and the spot quota.

Available spot capacity is your spot quota minus everything running now, on-demand and spot. In the [GPU capacity example](https://docs.baseten.co/training/gpu-capacity.md#check-capacity-and-usage), 3 of 8 L4 GPUs are in use, so spot can add 5 more. Spot reaches all 8 when nothing else is running, and 4 when the organization's on-demand capacity is full.

## Run a job on spot capacity

> [!WARNING]
>
> Baseten can reclaim spot capacity whenever it needs that capacity for dedicated work. A reclaimed job moves to the [`TRAINING_JOB_PREEMPTED`](https://docs.baseten.co/training/lifecycle) state and doesn't resume on its own, so [save checkpoints](https://docs.baseten.co/training/concepts/checkpoints.md) as the job runs.

**To run a job on spot capacity**:

> [tab] Baseten CLI
>
> Pass `--spot` to [`baseten train push`](https://docs.baseten.co/reference/cli/baseten/train):
>
> ```bash theme={"system"}
> baseten train push --config config.py --spot
> ```

> [tab] Training SDK
>
> Set [`availability_model`](https://docs.baseten.co/reference/sdk/training#param-availability-model) on `Compute` in `config.py`:
>
> ```python config.py theme={"system"}
> from truss_train import AvailabilityModel, Compute, Image, Runtime, TrainingJob, TrainingProject
> from truss.base.truss_config import AcceleratorSpec
>
> training_job = TrainingJob(
>     image=Image(base_image="pytorch/pytorch:2.7.0-cuda12.8-cudnn9-runtime"),
>     compute=Compute(
>         accelerator=AcceleratorSpec(accelerator="H100", count=1),
>         availability_model=AvailabilityModel.SPOT,
>     ),
>     runtime=Runtime(
>         start_commands=["python train.py"],
>     ),
> )
>
> training_project = TrainingProject(name="qwen3-4b-lora-sft", job=training_job)
> ```

`--spot` overrides the config for that push, while `availability_model` applies to every push of that config. Without either, a job runs on dedicated capacity. The API sets the same value in `compute.availability_model` when it creates a job, and a `PATCH` request changes it only while the job is pending.

To check which capacity a job runs on, describe it:

```bash theme={"system"}
baseten train job describe --job-id <job_id>
```

The `Availability:` line reads `spot` for spot jobs and `standard` for dedicated ones.

## Move a queued job onto spot capacity

A job that waits in [`TRAINING_JOB_PENDING`](https://docs.baseten.co/training/lifecycle) for dedicated capacity can move to spot capacity without resubmitting. You can change its capacity only while the job is pending.

**To move a pending job onto spot capacity**:

> [tab] Baseten CLI
>
> Run the following command:
>
> ```bash theme={"system"}
> baseten train job update --job-id <job_id> --availability-model spot
> ```
>
> The command prints the job ID and the change, as in `Set training job <job_id> availability model to spot.`

> [tab] Training API
>
> The `curl` examples authenticate with `BASETEN_API_KEY`. Export your [API key](https://docs.baseten.co/organization/api-keys.md) first.
>
> Send a `PATCH` request to [Update a training job](https://docs.baseten.co/reference/training-api/update-training-job.md), replacing `<project_id>` and `<job_id>` with the project and job IDs:
>
> ```bash theme={"system"}
> curl --request PATCH \
>   --url "https://api.baseten.co/v1/training_projects/<project_id>/jobs/<job_id>" \
>   --header "Authorization: Bearer $BASETEN_API_KEY" \
>   --header "Content-Type: application/json" \
>   --data '{"availability_model": "spot"}'
> ```
>
> The response's `training_job.availability_model` is `spot`.

## When Baseten reclaims spot capacity

You can't predict or control when Baseten reclaims spot capacity, or which of your spot jobs stops first, so treat every spot job as interruptible. To continue the work, start a new job that [loads the latest checkpoint](https://docs.baseten.co/training/loading.md).

## Next steps

* [Job queueing and priority](https://docs.baseten.co/training/job-queueing.md): See how Baseten admits and orders jobs that wait for quota.
* [Load a checkpoint into a new job](https://docs.baseten.co/training/loading.md): Continue after a preemption.
