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

# Dedicated Training

> Run Training API workloads with provisioned trainer and deployment resources on Fireworks, with explicit checkpoints, weight-sync, and lifecycle control.

> [!NOTE]
>
> Serverless Training is now generally available and a great starting point. Graduate to Dedicated Training for larger workloads, more model selection, or full-parameter training. [Request access here](https://fireworks.ai/contact-training).

Dedicated training provisions trainer and deployment resources for your run. Use it when you need a model outside the serverless pool, full-parameter training, sustained workloads, explicit checkpoint resume, or control over rollout and evaluation deployments.

If LoRA SFT, DPO, ORPO, RL, distillation, or a custom loop on a supported shared-pool model is sufficient, compare this path with [Serverless Training](https://fireworks.ai/docs/fine-tuning/training-api/serverless.md) before provisioning resources.

> [!TIP]
>
> **Start from the cookbook.** Clone [`fw-ai-external/cookbook`](https://github.com/fw-ai-external/cookbook), fork the closest recipe under [`training/recipes/`](https://github.com/fw-ai-external/cookbook/tree/main/training/recipes), and use the [Fireworks training skill](https://github.com/fw-ai-external/cookbook/tree/main/skills/fireworks-training) for losses, checkpoints, and debugging depth.

## How dedicated training runs

1 · Local
**Your Python loop**
Controls data, losses, rewards, and experiment logic.

2 · Provisioned
**Dedicated trainer**
Runs remote model and optimizer operations on the selected shape.

3 · Persistent
**Training artifacts**
Stores sampler snapshots or resumable training state.

4 · Optional
**Inference deployment**
Loads sampler weights for rollouts and evaluation.

5 · Explicit
**Promote and clean up**
Register the selected model, then release billable compute.

The trainer and inference deployment are separate resources with separate billing and cleanup. Promotion registers a model but does not deploy it.

## What you can run

> [card] SFT, DPO, and ORPO
>
> Use cookbook recipes with LoRA or full-parameter configurations supported by the selected training shape.

> [card] RL and RFT
>
> Run synchronous or asynchronous rollouts with custom rewards, losses, environments, and deployment sampling.

> [card] Distillation
>
> Provision student and teacher resources for sampled reverse KL, top-k forward KL, and related workflows.

> [card] Custom loops
>
> Use the Tinker-compatible training client directly when a maintained recipe does not express the required behavior.

## Dedicated training quickstart

### Step 1: Install the SDK and cookbook

For this source-recipe workflow, clone and install the cookbook in editable mode. To import published recipes without a checkout, use [the PyPI installation](https://fireworks.ai/docs/fine-tuning/training-api/cookbook/overview.md#installation).

```bash theme={null}
git clone https://github.com/fw-ai-external/cookbook
cd cookbook
pip install -e ./training
export FIREWORKS_API_KEY="fw_..."
```

### Step 2: Choose the closest recipe

| Task | Start here |
| - | - |
| SFT | [`sft_loop.py`](https://github.com/fw-ai-external/cookbook/blob/main/training/recipes/sft_loop.py) |
| DPO | [`dpo_loop.py`](https://github.com/fw-ai-external/cookbook/blob/main/training/recipes/dpo_loop.py) |
| RL | [`rl_loop.py`](https://github.com/fw-ai-external/cookbook/blob/main/training/recipes/rl_loop.py) |
| Async RL | [`async_rl_loop.py`](https://github.com/fw-ai-external/cookbook/blob/main/training/recipes/async_rl_loop.py) |
| Distillation | [`distillation_loop.py`](https://github.com/fw-ai-external/cookbook/blob/main/training/recipes/distillation_loop.py) |

Smoke test (bounded SFT):

```bash theme={null}
python training/examples/sft/train_sft.py \
  --output-model-id dedicated-sft-smoke \
  --max-examples 10 --epochs 1 --lora-rank 8 \
  --training-shape accounts/fireworks/trainingShapes/<shape>
```

### Step 3: Pick model and shape

Choose a shape from [Models](https://fireworks.ai/docs/fine-tuning/models.md). Pass the full shared shape ID as `training_shape_id`; the SDK resolves the validated version and linked deployment shape.

### Step 4–10: Train, checkpoint, promote, deploy, tear down

Follow the forked recipe. Record trainer and deployment IDs, checkpoint cadence, and cleanup flags before launch.

## Training and sampling lifecycle

Dedicated recipes use two independently billed resources:

1. Create or reconnect to a trainer from the selected training shape.
2. Create an inference deployment when the loop needs rollouts or evaluation.
3. Run one or more forward/backward calls, then apply one optimizer step.
4. Save sampler weights and refresh the deployment before collecting new rollouts.
5. Save resumable state on the approved cadence, promote the selected checkpoint, then delete or scale down billable resources.

Keep stable trainer and deployment IDs so retries reconnect instead of provisioning duplicates. The trainer owns optimization state; the deployment owns serving and sampling.

Serverless and dedicated sampling use the same `DeploymentSampler` request contract. See [`DeploymentSampler`: RL rollout sampling](https://fireworks.ai/docs/fine-tuning/training-api/reference/deployment-sampler#rl-rollout-sampling) for SDK-specific batching behavior, and use [Inference for RL rollouts](https://fireworks.ai/docs/guides/rollout-inference.md) as the canonical session-affinity reference.

## Loss functions

| Need | Start from |
| - | - |
| SFT | `sft_loop.py` and its weighted token objective |
| DPO or ORPO | `dpo_loop.py` or `orpo_loop.py` |
| Standard RL | `rl_loop.py` or `async_rl_loop.py` |
| New research objective | Fork the closest recipe and use `forward_backward_custom` deliberately |

Call forward/backward multiple times before one `optim_step()` for gradient accumulation. Validate datum fields, token masks, and normalization locally. Detailed loss and datum routing lives in the [Training API losses skill reference](https://github.com/fw-ai-external/cookbook/blob/main/skills/fireworks-training/references/training-api-losses.md).

## Saving and loading

Dedicated training has three distinct checkpoint purposes:

| Purpose | Contains | Use |
| - | - | - |
| Sampler snapshot | Weights for inference | Refresh a rollout or evaluation deployment |
| Resumable state | Weights and optimizer state | Continue an interrupted training run |
| Promotable checkpoint | Deployable model artifact | Register the selected result as a Fireworks model |

Do not pass a sampler snapshot to a resumable-state API. Keep the same trainer ID and log path for exact continuation; use the recipe's explicit initialization option for a new job. See the [checkpoint skill reference](https://github.com/fw-ai-external/cookbook/blob/main/skills/fireworks-training/references/sdk-checkpoints.md).

## Deep dives (cookbook skill)

| Topic | Skill reference |
| - | - |
| Losses, datums, gradient accumulation | [training-api-losses](https://github.com/fw-ai-external/cookbook/blob/main/skills/fireworks-training/references/training-api-losses.md) |
| Checkpoints, resume, promote | [sdk-checkpoints](https://github.com/fw-ai-external/cookbook/blob/main/skills/fireworks-training/references/sdk-checkpoints.md) |
| Custom RL objectives | [rl-custom-loss](https://github.com/fw-ai-external/cookbook/blob/main/skills/fireworks-training/references/rl-custom-loss.md) |
| Async RL and concurrency | [rl-async](https://github.com/fw-ai-external/cookbook/blob/main/skills/fireworks-training/references/rl-async.md) |
| Recipe catalog | [sdk-recipes](https://github.com/fw-ai-external/cookbook/blob/main/skills/fireworks-training/references/sdk-recipes.md) |

Config class reference (short): [Cookbook Reference](https://fireworks.ai/docs/fine-tuning/training-api/cookbook/reference.md).

## Compare infrastructure

See [Serverless vs dedicated](https://fireworks.ai/docs/fine-tuning/training-api/introduction.md#infrastructure).

## Next steps

> [card] [Cookbook overview](https://fireworks.ai/docs/fine-tuning/training-api/cookbook/overview.md)
>
> Recipe entry points

> [card] [Training Shapes](https://fireworks.ai/docs/fine-tuning/training-api/training-shapes.md)
>
> What a shape pins

> [card] [Models](https://fireworks.ai/docs/fine-tuning/models.md)
>
> Per-model shape catalog

> [card] [Cleanup](https://fireworks.ai/docs/fine-tuning/training-api/reference/cleanup.md)
>
> Teardown contract


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