The Training API is currently in private preview. Request early access to get started.
What is the Training API?
Fireworks Training API lets you write training logic in plain Python on your local machine while model computation runs on remote GPUs managed by Fireworks. Most users should start from cookbook recipes, the recommended entry point for standard SFT, DPO, GRPO-style training, and experimental async RL loops for agentic RL. Fork a recipe when you want to adapt an existing loop with your own loss, reward, rollout function, data loading, or checkpointing behavior. Use the Direct SDK when you need full control over Training API behavior.Choose serverless or dedicated infrastructure
After choosing the Training API, decide how compute is provided:- Serverless Training: shared pooled trainer, LoRA SFT or RL on supported models, no provisioning, per-token billing.
- Dedicated Training: provisioned trainer and deployment resources, broader model and method support, explicit checkpoint/resume/deployment control.
Who does what
System architecture
How service-mode training works
Minimal training step lifecycle
- Create an SDK-managed service and connect a training client.
- Send tokenized datums (with loss weights).
- Run
forward_backward_custom(...).result(). - Run
optim_step(...).result(). - Save sampler weights and refresh the SDK-managed sampler.
Datums
A Datum is the unit of training data sent to the remote GPU. It wraps tokenized input and per-token weights that your loss function needs. For SFT, token weight0.0 marks prompt tokens and 1.0 marks response tokens. Cookbook renderers construct these weights from chat messages.
Logprobs and forward_backward_custom
When you callforward_backward_custom, the GPU runs a forward pass and returns per-token log-probabilities as PyTorch tensors with requires_grad=True. Your loss function computes a scalar loss, the API calls loss.backward(), and gradients are sent back to the GPU for the model backward pass.
After accumulating gradients, call optim_step to apply the update. See the Dedicated Training Quickstart for one complete runnable Datum, loss, and optimizer loop.
Futures
Remote training operations such asforward, forward_backward, optim_step, and checkpoint saves return future-like results. Call .result() on operations that return one so failures surface.
Checkpointing and weight sync
After training, you export checkpoints for serving:- Base snapshot: a complete chain anchor for the trainable state. For LoRA this is the adapter; for full-parameter training it is model weights.
- Delta snapshot: a change relative to a prior full-parameter base snapshot.
- Serverless: save a snapshot and bind an in-session sampling client to that snapshot. There is no deployment weight sync. See Serverless Training.
- Dedicated: save a snapshot and refresh an SDK-managed deployment sampler, which syncs weights onto the deployment. See Dedicated Training and Sampling.
Key APIs
Renderers
Chat-template formatting, stop-token handling, and loss-weight masking for SFT/DPO datasets are handled by renderers — pluggable per-model classes that turn raw conversations into the trainer’sDatum shape. Most users never touch a renderer directly; cookbook recipes pick the right one for the base_model you set. If you need to author a new one or debug parity against HuggingFace, the implementation depth lives in the cookbook’s skills/renderer/ skill.
Comparing Training API pricing vs DIY bare metal
When comparing a managed training platform with a self-managed bare-metal stack, optimize for cost per successful iteration, not just headline$ / GPU-hour.
What to compare
- Time to first deployed model: include environment setup, training orchestration, checkpoint handoff, and serving integration.
- Iteration cycle time (
train -> eval -> deploy -> repeat): include all retrain/redeploy plumbing, not just GPU runtime. - Infra engineering overhead: include one-time setup and recurring maintenance for containers, runtimes, deployment workflows, and compatibility fixes.
- Effective
$ / GPU-hourat real utilization: include idle capacity, reservation constraints, and burst/overflow behavior. - Train/serve parity risk: account for potential quality drift when training and inference runtimes diverge.
- Parallel experiment capacity: compare fixed-reservation throughput against elastic capacity for sweeps and multi-seed runs.
Useful formulas
Keep assumptions explicit
Document assumptions so readers can adjust them for their own workload:- team size and fully-loaded engineering cost
- average cycle duration in each setup
- expected utilization and burst profile
- average turn count for production agent workflows
- required concurrent experiment count
FAQ
Why is my training run “doing nothing” even though code executed?
Usually because.result() was not called on futures, so failures were never surfaced.
What’s the difference between base and delta checkpoints, and when should I use each?
Let the SDK select automatically. LoRA snapshots contain the full adapter; full-parameter delta snapshots can accelerate synchronization but are not promotable. See Saving and Loading.Do I need to manage distributed training infra?
No. You implement training logic while Fireworks manages GPU provisioning and distributed infrastructure.Should I start with Cookbook or Direct SDK?
Start with Cookbook for most SFT/DPO/GRPO adaptations. Use the Direct SDK when you need custom loop semantics and full control.Can I evaluate serving behavior during training?
Yes. On serverless, save a snapshot and sample from it in the same session. On dedicated infrastructure, sync a snapshot to the SDK-managed deployment sampler and evaluate there.How should I compare Training API pricing vs a DIY bare-metal setup?
Use the framework in Comparing Training API pricing vs DIY bare metal. Focus on total iteration economics (cycle time, engineering overhead, utilization-adjusted cost, and quality-parity risk), then plug in your own assumptions.How can I compare rollout cost vs other providers?
See the Price comparison vs Tinker calculator to estimate scenario-based costs on Fireworks Dedicated against Tinker’s per-token pricing.Next steps
- Dedicated quickstart — run a minimal dedicated custom loop
- Choose infrastructure — compare serverless and dedicated training
- Serverless Training — shared pooled LoRA training
- Dedicated Training — provisioned trainer and deployment lifecycle
- Dedicated Training and Sampling — deployment-sampling lifecycle
- Loss Functions — built-in and custom loss functions
- Vision Inputs — fine-tune vision-language models with image and text data
- The Cookbook — ready-to-run recipes for SFT, DPO, ORPO, GRPO/IGPO, and async RL (experimental)