Skip to main content

Fireworks Training Cookbook

Training loops for RL, preference optimization, SFT and embedding fine-tuning on Fireworks. Full docs: Training API.

New here? The Muse Glimmer mini cookbook runs a free first fine-tune on preloaded example data in about 10 minutes.

Versioned installations

Applications can depend on fireworks-training-cookbook==<version> from PyPI instead of a Git URL once the first release has been published. Imports remain training.*. GitHub tag cookbook-v2026.10.26.1 maps to version 2026.10.26.1 (an illustrative version; select an available version from PyPI).

Layout

The tree is layered so each kind of change has one home:

recipes/              One file per training loop; fork to change the algorithm
recipes/experiment/   Loops not yet stable (serverless async RL, SAO/PPO)
utils/                Reusable pieces recipes assemble: config, data, losses,
                      rollout helpers, metrics (structured, per step)
examples/             Task code + one recipe call; no loop logic
  muse_glimmer/        Free first fine-tune walkthrough (Managed and serverless SFT)
  sft/ dpo/ orpo/ embedding/ distillation/
  rl/                 deepmath (text) · visual_toolbench (vision) ·
                      frozen_lake (multi-turn env) · multihop_qa (IGPO) ·
                      experiment/sao
  harbor_rl/          Sandboxed agentic RL: tasks/ × harnesses/ over tito/
  tools/              Standalone checkpoint, promotion and trainer utilities
  archive/            Deprecated examples, kept importable; do not extend
case-studies/         End-to-end notebooks (data -> eval -> train -> eval)
renderer/             Chat renderers and parity verifier
datasets/             Lightweight dataset validation and image geometry checks
tests/                Unit and smoke tests

Inside an example folder, train_<task>.py runs on a dedicated trainer + deployment and train_<task>_serverless.py on the shared serverless pool with the same task code. A new task belongs in examples/; a new objective in a forked recipe; anything two recipes need in utils/. Dataset checks shared with preflight validation belong in datasets/, which stays independent of the renderer registry and training runtime.

Recipes

Recipe File What it does
GRPO recipes/rl_loop.py Synchronous on-policy RL; trainer's built-in GRPO loss clipped against rollout logprobs. IGPO runs here via prepare_batch_fn
Async GRPO recipes/async_rl_loop.py Same update with rollout/train overlap and bounded staleness
Distillation / OPD recipes/distillation_loop.py On-policy distillation from a frozen teacher's token scores
SDFT Customer guide Maintained in the external Fireworks Tinker-Cookbook fork
DPO recipes/dpo_loop.py Preference optimization with cached reference logprobs
ORPO recipes/orpo_loop.py Odds-ratio preference optimization; no reference model
SFT recipes/sft_loop.py Response-only cross-entropy; serverless=True uses the shared pool
Embedding recipes/embedding_loop.py In-batch InfoNCE on (query, positive) pairs
SAO / PPO (experimental) recipes/experiment/ppo_value_head_loop.py Actor-critic with a value-head critic; see examples/rl/experiment/sao/
Serverless async RL (experimental) recipes/experiment/async_rl_loop_serverless.py Async GRPO on the shared LoRA pool

Sync RL collects and trains one complete batch; async RL sends currently ready groups together. Both wait for every backward before one optimizer update. prompt_groups_per_step defines optimizer membership; remove the old pipeline_chunks_per_step field. See the skills for losses and metrics.

To train another RL objective, fork a recipe and replace its loss implementation; see rl-custom-loss.md. Optional reference KL uses utils/rl/reference.py: LoRA scores the frozen base with adapters disabled on its trainer; full-parameter tuning scores a separate frozen base-model inference deployment. Reference setup and scoring stay outside both stock loops.

Case studies

Self-contained, runnable notebooks in case-studies/ — each takes one real problem end-to-end (build data -> evaluate the base model -> fine-tune -> evaluate again and measure the improvement). These run on the Fireworks Python SDK (fireworks-ai) plus the eval-protocol framework — no firectl required. Most need no cookbook training loop either; embedding_support_search is the exception, since it drives recipes/embedding_loop.py directly.

Case study Technique Dataset "Customer problem" Open
sft_prompt_router Text SFT / classification (Python SDK), dedicated + serverless Prompt-Routing-Dataset Route prompts to a small vs big model (multi-field classifier) dedicated Open In Colab · serverless Open In Colab
sft_cord_receipts Vision SFT (Python SDK) CORD receipts Teach the model a new structured-output task Open In Colab
dpo_style DPO (Python SDK) HelpSteer3 "Write the way we write" (style/quality preferences) Open In Colab
reasoning_rl GRPO via Training API (legacy managed RFT notebook is deprecated) GSM8K Improve step-by-step reasoning deepmath
embedding_support_search Contrastive embedding fine-tuning (embedding_loop recipe) Airbnb Help Center scenarios Retrieve the help article that governs a situation, not the one that sounds like it Open In Colab
agentic_rl_text2sql Serverless tool-calling GRPO (Training API SDK) BIRD text-to-SQL Train a multi-turn tool-calling SQL agent; evaluate on unseen (out-of-distribution) databases Open In Colab
sft_bfcl_toolcalls SFT on the Training API: serverless, dedicated, and managed compared (Python SDK) xLAM function-calling-60k + xlam-irrelevance-7.5k, scored on BFCL V4 non-live Fix tool-call emission/abstention on a public benchmark, not a metric we invented Open In Colab
multilora_fleet LoRA SFT + multi-LoRA serving (Python SDK) MASSIVE (51 locales) One deployment, a per-tenant specialist for every locale Open In Colab
grpo_countdown Serverless non-agentic GRPO (Training API SDK) TinyZero Countdown Own the single-turn GRPO loop on serverless; same algorithm as a dedicated config swap Open In Colab

Setup. Follow the install instructions below, using uv pip install -e '.[eval]' to include the SDK and Eval Protocol, and create a .env with FIREWORKS_API_KEY (FIREWORKS_ACCOUNT_ID for the deploy/RFT cells). A couple of case studies add extras, noted in their own READMEs. Train/deploy cells provision real GPU and cost money. Each folder has its own README with the specifics.

Open Weight Room

Open Weight Room case studies explore changes in model behavior through small adapters: concise answers, editing, output constraints, writing style, visual design, and clarification before acting. Each study includes recorded evidence and explains its evaluation limits. Training walkthroughs and recorded-results analyses are labeled separately.

Study Focus Entry point
Caveman Concision with factual checks Read the walkthrough · Source
Humanizer Preservation and restraint when editing SFT walkthrough
E-vasion Useful answers without the letter e SFT + GRPO study
Anti-slop Preference optimization and reward tradeoffs DPO walkthrough
Taste Visual preference versus functionality Recorded comparison
Ask Before Acting Clarification in simulated tasks RL walkthrough

Getting started

git clone https://github.com/fw-ai/cookbook.git && cd cookbook/training
uv venv --python 3.12 && source .venv/bin/activate
uv pip install -e .                      # installs the SDK and recipe dependencies
export FIREWORKS_API_KEY=...             # or put it in training/.env
python -m training.examples.sft.train_sft --help

The eval and dev extras install eval-protocol==0.3.33 from PyPI, which supports the tested LiteLLM 1.105.0 release.

Each recipe's Config dataclass documents its fields. Leave TrainerConfig() empty for SDK-selected defaults, or set training_shape_id; deployments resolve their shape from the training shape. Weight sync, shapes, HSDP replicas, reservations and distillation teachers are covered by the skills and the configuration reference.

Tests

uv pip install -e ".[dev]"
pytest tests/

SDFT

SDFT is maintained in the Fireworks Tinker-Cookbook fork. See the customer guide for where to start.

Publishing releases

Releases are managed by the maintainers' private CI after the reviewed promotion PR merges. Promotion commits the calendar version in pyproject.toml and the root package entry in uv.lock before review. For example, cookbook-v2026.1.2.1 publishes package version 2026.1.2.1.

The publisher builds the wheel from the source distribution, validates both artifacts, publishes to PyPI, and verifies the installed version. This repository has no publishing workflow or stored release credentials. Contact a maintainer to retry a failed release.

The eval extra pins eval-protocol==0.3.33. Release builds reject direct URL dependencies in all extras so Git pins cannot break PyPI publication.

Metadata

Release files for fireworks-training-cookbook 2026.11.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fireworks-training-cookbook 2026.11.5.1
File Size Uploaded Provenance Actions
fireworks_training_cookbook-2026.11.5.1.tar.gz 4.3 MB Without provenance Details for fireworks_training_cookbook-2026.11.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fireworks-training-cookbook 2026.11.5.1
File Interpreter ABI Platform Actions
fireworks_training_cookbook-2026.11.5.1-py3-none-any.whl Python 3 none any Details for fireworks_training_cookbook-2026.11.5.1-py3-none-any.whl

Total release size: 8.9 MB

Release files / fireworks_training_cookbook-2026.11.5.1.tar.gz

Download URL fireworks_training_cookbook-2026.11.5.1.tar.gz
Size 4.3 MB
Tags Source
SHA-256 checksum
How to use checksums
139fcc4a29d1a51c842e33d28f11122c50523d656a5dd3cf1baaa26505305dba
BLAKE2b-256 checksum
How to use checksums
d0f614a7e45dbafc349b0c9773791e948f51e1ab872d783bd8323dee36509871
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / fireworks_training_cookbook-2026.11.5.1-py3-none-any.whl

Download URL fireworks_training_cookbook-2026.11.5.1-py3-none-any.whl
Size 4.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
24edf9b11eb1fa7757f8c5e2f5cc7dc6058da0a59ceede00aa49b61c716024f5
BLAKE2b-256 checksum
How to use checksums
47d68a4249017f60d2a4428cca0052f1e904b6f1e73ac6a158d86daaae22f0af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Security for fireworks-training-cookbook 2026.11.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page