Skip to main content
The fireworks backend is rLLM’s managed-training backend for Fireworks AI. It extends the tinker backend architecture with Fireworks-specific infrastructure: trainer jobs and inference deployments are provisioned via the Fireworks training cookbook, rollouts run through FireworksEngine (DeploymentSampler), and policy updates use FireworksPolicyTrainer with WeightSyncer for hot-loading weights into the inference deployment.

Overview

Fireworks backend features:
  • Managed infrastructure: Trainer jobs and inference deployments are provisioned and torn down automatically at startup/shutdown
  • Async-first design: Native async/await support inherited from the tinker backend path
  • Unified architecture: Same AgentTrainer API for agent and workflow training
  • Server-side losses: Builtin GRPO, DAPO, CISPO, and GSPO kernels on Firetitan
  • Weight hot-loading: WeightSyncer syncs trainer weights to the rollout deployment after each step
Python version: Requires Python >= 3.11 (same as tinker; Fireworks training SDK depends on tinker types).
API key: Set FIREWORKS_API_KEY in your environment before training. The trainer job and inference deployment are created on Fireworks at startup and deleted on shutdown.

Installation

Install rLLM with the Fireworks backend:
Export your API key:

Dependencies

The Fireworks backend includes (from pyproject.toml):
The cookbook provides training.provision.init_fireworks_infra and the RL loss utilities used by FireworksPolicyTrainer.

Models and training shapes

Fireworks RL training uses two kinds of IDs from the shared public catalog under the fireworks account: A base model is the model you fine-tune (for example accounts/fireworks/models/qwen3-4b). A training shape is a pre-configured GPU and runtime profile — you pass the full path (for example accounts/fireworks/trainingShapes/qwen3-4b-minimum-lora) and the SDK resolves the pinned version, image tag, GPU layout, and linked deployment shape for you. See the Fireworks training shapes documentation for the searchable catalog, per-model RFT support matrix, and shape roles.
For rLLM you only need to pick a compatible model + training shape pair from that catalog. You do not need to specify versioned shape refs, image tags, or GPU counts manually — the shape owns that infrastructure.

Shape roles (RFT / RL)

During reinforcement fine-tuning (RFT), Fireworks deploys separate trainer and inference resources. The catalog lists shapes by role: The rollout inference deployment is provisioned automatically from the shape linked to your policy trainer; you do not pick a deployment shape separately unless you reattach via fireworks_infra.deployments.rollout.deployment_id.

Picking a model for RL

In the training shapes catalog, select a model and check the RFT LoRA or RFT Full-Param row in the training method support matrix. Only models marked supported there can be used with the Fireworks backend for RL. Examples of models with RFT LoRA support (see the live catalog for GPU totals and context limits): Wire a chosen pair into Hydra overrides:
Use the full training shape path including the accounts/fireworks/trainingShapes/ prefix. Do not override shape-owned fields (accelerator_type, accelerator_count, node_count, custom_image_tag, or linked deployment shape) — configure lora_rank, learning_rate, and replica counts instead. See What you can and can’t change in the Fireworks docs.

Basic Usage

Workflow Training

Train a countdown workflow on Fireworks using the unified trainer. See examples/countdown/unified_trainer/ for the full example:
train_countdown_unified_fireworks.py
Run with async training (recommended for throughput):
Or invoke Hydra directly:

Agent Training

Use the same AgentTrainer API with an AgentFlow and Evaluator (see the math cookbook):
Select the Fireworks backend via Hydra:

Architecture

Fireworks backend extends TinkerBackend and overrides only what differs:
Inherited unchanged from tinker: dataloader, episode generation, advantage computation, batch transforms, validation hooks. Fireworks-specific: infrastructure provisioning, FireworksEngine, FireworksPolicyTrainer, DCP checkpointing, weight sync, and model promotion.

Configuration

The Fireworks backend uses fireworks.yaml (selected when rllm/backend=fireworks):

Model Configuration

string
Fireworks model ID (accounts path)
string
default:"Qwen/Qwen3-4B-Instruct-2507"
HuggingFace tokenizer model for chat template rendering
integer
default:"32"
LoRA rank. Set to 0 for full-parameter training (requires reference trainer for KL)
boolean
default:"false"
Train LoRA on output embedding layer
boolean
default:"true"
Train LoRA on attention layers
boolean
default:"true"
Train LoRA on MLP layers

Training Configuration

integer
required
Number of rollouts per prompt (for GRPO)
float
default:"1e-5"
Learning rate for Adam optimizer
string
default:"constant"
LR schedule: "constant", "linear", or "cosine"
float
default:"0.0"
Warmup steps as a ratio of total steps (0 to 1)
integer
default:"null"
Maximum sequence length. Auto-derived from the training shape when null
integer
default:"3600"
Timeout for forward / forward_backward / optim_step calls (seconds)
string
default:"null"
Source trainer job ID for loading a DCP checkpoint from another job
string
default:"null"
Explicit DCP checkpoint name to load; null uses the latest on the source/current job

Fireworks Trainer / Deployment Shapes

string
Training shape for the policy trainer job
integer
default:"1"
Replica count for the policy trainer
integer
default:"1"
Replica count for the inference deployment used during rollouts
string
Reference trainer shape (only needed for full-parameter RFT with kl_beta > 0)
integer
default:"0"
Reference trainer replica count. Leave at 0 for LoRA (policy serves as frozen reference)

Validation Configuration

integer
required
Number of rollouts per validation prompt

Data Configuration

integer
default:"32"
Training batch size
integer
default:"32"
Validation batch size
integer
default:"30720"
Maximum prompt length in tokens
integer
default:"2048"
Maximum response length in tokens

Trainer Configuration

integer
default:"10"
Number of training epochs
integer
default:"5"
Validation frequency (in steps)
integer
default:"20"
Checkpoint save frequency (in steps). In async mode, must be a multiple of trigger_parameter_sync_step
string
default:"default"
Experiment name (used for promoted model IDs: {experiment_name}-step-{step})

Fireworks Infrastructure

The fireworks_infra section controls provisioning. rLLM mirrors key training knobs into this document before calling the cookbook’s init_fireworks_infra. You typically configure shapes and replica counts via fireworks_config rather than editing fireworks_infra directly.
Do not change fireworks_infra unless you are familiar with the Fireworks provisioning API. Use fireworks_config for common overrides.
Key provisioning fields:
string
default:"null"
Attach to an existing deployment (null creates a new one per run)
string
default:"null"
Attach to an existing trainer job (null creates a new job)
integer
default:"600"
Timeout for weight hot-loading into the deployment (seconds)
string
default:"https://api.fireworks.ai"
Fireworks API base URL
Resources are cleaned up on shutdown (cleanup_on_close=True, cleanup_existing=True). Each run provisions fresh trainer and deployment resources unless you explicitly set job_id or deployment_id to reattach.

LoRA Training

LoRA is the default path (model.lora_rank=32). With LoRA, the frozen reference policy is reused from the policy trainer — leave reference_trainer_replica_count=0.
For full-parameter training (model.lora_rank=0), enable a reference trainer for KL divergence:

Sampling Configuration

Rollout sampling uses rllm.rollout (not a separate sampling block):
float
default:"1.0"
Training sampling temperature
float
default:"1.0"
Training top-p (nucleus) sampling
float
default:"1.0"
Validation sampling temperature
float
default:"1.0"
Validation top-p sampling
Important: Setting temperature or top_p away from 1.0 can cause logprob accuracy issues. Keep both at 1.0 unless you understand the off-policy implications.

Rollout Engine Configuration

string
default:"medium"
Reasoning effort level: "low", "medium", "high"
boolean
default:"false"
Accumulate reasoning tokens across steps
boolean
default:"false"
Disable thinking tokens in responses
boolean
default:"false"
Bypass renderer and use parser directly
string
default:"null"
Optional renderer name for chat template rendering

Concurrency

Fireworks rollout concurrency is controlled via the cookbook ConcurrencyConfig:
string
default:"adaptive"
Concurrency mode: "adaptive" or "fixed"
integer
default:"null"
Starting window for adaptive mode (null = 8 × replica count)
integer
default:"256"
Maximum concurrent requests
float
default:"0.5"
Target prefill queue duration (seconds) for adaptive mode

Algorithm Configuration

Fireworks uses server-side builtin loss kernels. Configure via rllm.algorithm:
string
default:"grpo"
Advantage estimator: "grpo", "reinforce", etc.
string
default:"null"
Policy loss: null (GRPO default), "dapo", "cispo", or "gspo"
string
default:"null"
Loss aggregation: null (backend default), "token-mean", "seq-mean-token-sum", or "seq-mean-token-mean"
string
default:"disabled"
Router replay mode: "disabled" or "R3" ("R2" is not supported)
boolean
default:"true"
When true, rollout logprobs are used as proximal policy (decoupled PPO bypass). Set false for active TIS correction
string
default:"null"
Truncated importance sampling mode: null, "token", or "sequence" (requires bypass_mode=false)

Async Training

Async training overlaps rollouts with policy updates for higher throughput:
When async training is enabled, save_freq must be a multiple of trigger_parameter_sync_step. Checkpoint promotion requires a sampler snapshot created at sync time.

Checkpointing

Fireworks checkpoints are stored as DCP (Distributed Checkpoint) on the trainer job. After each sync step, weights are hot-loaded to the inference deployment. When saving, checkpoints can be promoted to a Fireworks model ID.

Automatic Checkpointing

On training end, a final DCP checkpoint is saved and weights are synced.

Resume from Checkpoint

Resume from the latest DCP on the current or source job:
Resume from a specific checkpoint:
Or from another job:
Promoted models are named {experiment_name}-step-{global_step}.

Limitations

fuse_forward_backward_and_optim_step must be false for the Fireworks backend. The fused optimizer path is not supported.

Example Configuration

Complete configuration for countdown workflow training:
config.yaml

Performance Optimization

Enable async training

Set rllm.async_training.enable=true to overlap rollouts and policy updates

Tune concurrency

Increase concurrency.max_window and deployment replica_count for higher rollout throughput

Use LoRA

LoRA training (model.lora_rank > 0) is faster and avoids provisioning a reference trainer

Parallel workflows

Increase rllm.workflow.n_parallel_tasks for workflow-based training

Troubleshooting

Export your API key before launching training:
The Fireworks backend does not support fused optimizer steps:
In async mode, save_freq must be a multiple of trigger_parameter_sync_step:
Keep rollout temperature and top_p at 1.0:
If training exits abnormally before shutdown(), trainer jobs and deployments may keep running on Fireworks. Reattach with job_id / deployment_id or delete them from the Fireworks console.
Use R3 or disabled:

Comparison with tinker

See Backend Comparison for the full verl vs tinker feature matrix.

See Also

tinker Backend

Local or remote tinker service training

verl Backend

Distributed training with verl

Backend Comparison

Compare training backends

Unified Trainer

Learn about the unified trainer architecture

Fireworks Training Cookbook

Official Fireworks training cookbook