Training parameters reference

Every training setting, its default, and how the "auto" defaults are chosen. You rarely need to set any of them.

Every recipe works with only model= and a dataset. Anything you leave out takes the default below, and grad train --dry-run (or client.runs.plan(...)) prints the value each setting resolved to before you spend anything. To pin every resolved value, export a run's config with grad runs inspect <run_id> --yaml and check it into Git.

Names are the same in every SDK, with each language's own casing: max_cost_usd is maxCostUsd in TypeScript, MaxCostUSD in Go and --max-cost-usd in the CLI.

Common run parameters#

These apply to every recipe and to client.runs.create(...).

ParameterDefaultWhat it does
model"qwen/qwen3-8b"; "qwen/qwen3-0.6b" for RouterRecipe; "qwen/qwen3-4b" for DistillRecipe; chosen by the recipe for DecisionModelRecipe and EmbeddingRecipeBase model ID, or an Artifact from SFTRecipe or DPORecipe to keep training its LoRA adapter (rank and alpha are inherited; merged exports can't be continued). Router, decision, cartridge, embedding, distillation and reward-model runs start from a base model. The dry run names the model it resolved. See Supported models.
datasetrequiredA Dataset from client.datasets.push(name, records_or_path), client.datasets.from_hf(...) or an import with client.datasets.import_file(...).
namerequiredOutput name. Artifacts are versioned under it (name@<date>-<n>).
max_cost_usdnoneSpend cap. When it's reached, the run stops gracefully, saves a checkpoint and ends with status stopped_budget. Raise it and continue with client.runs.resume(run_id, max_cost_usd=...).
splitsplits.BySession(eval_fraction=0.10); 0.15 for routers and decision models; splits.ByGroup for DPO and reward modelsHolds out sessions for evaluation. Records with the same session_id (or preference pairs with the same group_id) stay on the same side. splits.Random(...) holds out single records. Every split takes seed= (default 42).
idempotency_keya fresh UUID per callPass your own to make a rerun of your script return the run the first call created instead of starting another (TypeScript { idempotencyKey }, Go RunParams.IdempotencyKey, Rust runs().create(&req, Some(key)), CLI --idempotency-key).

Two more settings every recipe takes:

  • evals: up to four extra evals scored on every checkpoint during training: datasets (a benchmark from client.datasets.from_benchmark(...) brings its answer check) or EvalSpec(dataset, rubric=..., limit=..., name=...) with judges, regexes and validators. The plan pins each dataset version and rubric and estimates the cost per checkpoint; each eval is billed like any eval and isn't capped by max_cost_usd. Results are in run.checkpoint_evals and the final eval_report. A checkpoint the inference endpoint can't serve gets a failed entry; the run continues. Gradiated Cloud doesn't serve checkpoints, so there a recipe with evals answers 422 checkpoint_evals_unsupported_on_cloud: evaluate run.artifact after training.
  • loggers: up to four experiment trackers that receive the run's metrics: loggers.WandB(project, secret="wandb-key", entity=..., host=..., run_name=...) or loggers.MLflow(tracking_uri, experiment=..., secret=..., run_name=...). Keys live in workspace secrets (grad secrets set wandb-key); MLflow's secret is an optional bearer token. For an MLflow or W&B server of your own, store the key with its host (--allowed-host). A tracker that fails is dropped and reported in the worker log; it never fails or slows the run. The dry run warns about a secret it can't find.

In the CLI, both go in a run file for grad train -f, as lists under evals: (dataset, rubric, limit, name) and loggers: (kind: wandb or kind: mlflow plus the fields above).

Live metrics from run.metrics(follow=True) include step, loss, grad_norm, lr, tokens_per_sec, running tokens and cost_usd, and on eval steps eval_loss and eval_metrics (held-out metrics by name; None between evals).

Optimization#

ParameterDefaultWhat it does
lr"auto"Looked up per base model and recipe, then scaled for your batch size. See How "auto" values resolve. Pass a float to override.
lr_scale1.0Multiplies the resolved lr. Sweep 0.5, 1.0 and 2.0 to tune without picking raw numbers.
adapteradapters.LoRA(rank=32)alpha stays at 32 by default, so changing rank doesn't change the right learning rate. Ranks 8–16 are enough for datasets under about 5,000 records; use 64–128 for SFT on more than about 50,000.
optimizeroptim.AdamW(lr="auto", betas=(0.9, 0.95), weight_decay=0.0, grad_clip=1.0)Standard settings for LoRA. AdamW is the only optimizer; grad_clip=0 disables clipping.
schedule, warmup"linear", 0.03Linear decay to zero after a 3% warmup. schedule also takes "cosine" or "constant"; warmup is a fraction of steps up to 0.5.
batch_size128 examples (SFT records, DPO pairs, router and decision records, embedding triplets); a quarter of the training examples (at least 8) when that's smaller, except for embeddingExamples per optimizer step.
epochs1Passes over the data (1–20). The dry run warns when a run has fewer than 100 optimizer steps and suggests a smaller batch.
lossset per recipe (see each recipe below)

Data and chat templates#

ParameterDefaultWhat it does
train_on"last" for chat recordsTrains only the final assistant turn. "all_assistant" trains every assistant turn, for multi-turn agent traces. Tool outputs and user turns are never trained.
"train" on a messageunset"train": true or false on a single message overrides train_on for that message.
thinking"auto""auto" keeps the base model's thinking mode, and records with no <think> block train with thinking off. Also takes "on" or "off" (True and False map to them). A target that contradicts the setting fails the dry run with its record ID. There are no effort levels: Qwen3 chat templates only switch thinking on or off.
preserve_thinkingFalseWhether earlier assistant turns keep their reasoning in the prompt. Set True for agents that rely on reasoning from previous turns.
reduction (SFT)"per_example"Averages the loss within each example and then across the batch, so long examples don't drown out short ones. "per_token" weights every trained token equally.
session_id (record field)one per recordGroups records from the same conversation for the train/eval split.

Preview the exact tokens and which ones are trained with grad render <dataset> --model <model> or client.datasets.render(dataset, model=..., limit=3). The dry run prints the pinned template revision (such as qwen3@3) and the share of tokens trained. See Chat templates and loss masks.

Checkpoints and evaluation#

ParameterDefaultWhat it does
Checkpoint frequencyevery 10% of steps (at least every 20 steps) or every 5 minutes, whichever comes firstManaged runs checkpoint automatically, including optimizer state, so a lost GPU costs a few minutes at most. Training pauses only for an in-memory copy; the upload runs in the background, one checkpoint at a time. Resume with client.runs.resume(run_id).
eval_every"auto" (every 25% of the run)How often the held-out split is evaluated during training: every 25% of the run, at most every 20 steps, and at the end. An eval step is always also a checkpoint, so the best one can be promoted. Pass a number to evaluate every N optimizer steps.
select"best"run.artifact is the best checkpoint by the recipe's held-out metric (listed under each recipe below). "last" keeps the final one.
checkpoint_ttl_days30How long intermediate checkpoints are kept. A run keeps its last 3 checkpoints plus its best one while it trains (older ones are deleted), the best and final checkpoints never expire, and ckpt.promote(name=...) turns any unexpired checkpoint into an artifact.

The run's resolved_config records the base model, adapter, chat template revision, thinking, train_on, the resolved lr (with lr_source and rule_version), the checkpoint and eval intervals, and the split. run.checkpoints() lists checkpoints with step, eval_score, best, final and expires_at.

Where code runs#

Built-in checks (Judge, validators.* and Rubrics made of them) run on the server and need no packaging. Your own Python Scorer functions run in your process: ev.wait() scores eval outputs locally. Training recipes don't take Python functions; a managed sandbox for them is coming soon. See Where your code runs.

ParameterDefaultWhat it does
requirements (on Scorer)[]Packages your function imports. evals.create checks them against your local Python environment and runs the scorer once on a sample record before any model is called.
network (on Scorer)FalseAccepted for forward compatibility; local functions can always reach the network.
runtime (on Scorer)"local"The only runtime for Python functions. A Scorer that wraps a validators.* check runs on the server.

SFTRecipe#

ParameterDefaultWhat it does
model"qwen/qwen3-8b"Base model or a previous Artifact.
adapter, lradapters.LoRA(rank=32), "auto" (about 5e-4)See Optimization.
train_on, thinking, reduction"last", "auto", "per_example"See Data and chat templates.
merge_on_exportFalseExports a standalone merged checkpoint instead of a LoRA adapter. A merged export can't be continued with model=.

Best checkpoint by held-out eval loss.

DPORecipe#

ParameterDefaultWhat it does
loss, betalosses.DPO(beta=0.1)Higher beta (0.2–0.5) stays closer to the starting model; lower (0.05) pushes harder away from rejected answers. beta= is shorthand for loss=losses.DPO(beta=...).
lr"auto" (about 2e-5)Much lower than SFT, so formatting taught by SFT survives.
adapterthe starting artifact's adapter when model= is an artifact; otherwise adapters.LoRA(rank=32)When continuing an artifact, leave it out or match its rank and alpha.
Reference modelthe starting checkpointLoaded for you; never passed explicitly.

To run DPO after SFT, wait for the SFT run and pass its artifact: DPORecipe(model=sft.artifact). Best checkpoint by held-out preference accuracy.

GRPORecipe#

Coming soon; see RL for agents. The server rejects it today (422 recipe_deferred). Pass either rubric= (single-turn) or env= (single- or multi-turn).

ParameterDefaultWhat it does
model"qwen/qwen3-8b"Base model, or an Artifact (for example from SFT) to start RL from.
rubricnoneHow to score single-turn answers: a Rubric, Judge, Scorer, score name or function.
envnoneAn Environment: environments.Tools(...) or your own subclass.
batch_size32Prompts per training step.
group_size8Attempts per prompt, scored against each other. Raise to 16 when most groups score all 0 or all 1.
max_new_tokens"auto"Generation limit per turn. See How "auto" values resolve. Cut-off answers score 0.
temperature1.0Sampling temperature for training attempts.
lr"auto" (about 5e-5)
adapteradapters.LoRA(rank=32)Ranks as low as 8 work well for RL.
loss"auto"See How "auto" values resolve.
advantageadvantages.GroupStd()How each attempt's score becomes an advantage relative to its group.
max_staleness0The one async setting: how many weight versions a rollout may lag behind the trainer. 1–2 overlaps slow container rollouts with training. Stale rollouts are kept, not discarded.
kl_coef0.0Penalty for drifting from the starting model. Set 0.01–0.05 only if outputs drift from its style.
max_turnsthe environment's ownTurn limit for multi-turn environments.
thinking"auto"Use "off" when the task doesn't need long reasoning and answers are getting cut off.

RL metrics: mean_reward; truncation_rate, the share of attempts cut off at max_new_tokens (above 5% needs attention); and for async runs, staleness_mean and staleness_max.

DistillRecipe#

See Distillation.

ParameterDefaultWhat it does
model"qwen/qwen3-4b"The student: a LoRA (adapters.LoRA(rank=32)) on this base model. adapters.LoRA(merge_on_export=True) exports merged weights instead.
teacherrequiredOn-policy: a catalog model that shares the student's tokenizer, loaded by the trainer on the same GPU as the student, so the pair must fit in its memory (a 14B teacher for a 4B student, not a 32B one). Off-policy: any catalog model, or one of your Artifacts served by the inference endpoint.
rolloutOnPolicy(max_new_tokens="auto")The student writes each answer (temperature 1) and the teacher scores those tokens. OffPolicy(max_new_tokens=1024) has the teacher answer each prompt once in a labeling eval before training (greedy, billed as an eval, estimated in runs.plan().labeling) and trains on those answers.
losslosses.TopKKLDistill(top_k=32)On-policy: matches the teacher's top-k next-token probabilities; top_k of 16–32 captures almost all the signal. Off-policy: losses.CrossEntropy() on the teacher's answers.
contextnoneA Context to bake into a LoRA fine-tune: the teacher reads it before every prompt and the student doesn't (on-policy only).
lr"auto" (about 2e-4)

On-policy runs meter each prompt's tokens twice at the student's price (it writes an answer, then trains on it), plus the teacher's prompt and answer tokens at the teacher's catalog price; the teacher also answers the held-out prompts once. runs.plan().teacher shows the teacher's share, which estimated_cost_usd includes. Metrics report answer_tokens and truncation_rate.

Best checkpoint by KL to the teacher on held-out prompts (eval_kl, on the teacher's own answers; base_kl is the untrained student's), or by held-out loss off-policy.

RouterRecipe#

ParameterDefaultWhat it does
model"qwen/qwen3-0.6b"Router backbone: qwen/qwen3-0.6b or qwen/qwen3-1.7b.
modelsthe models found in metadata.model (or model-keyed scores) in your logsCandidate models, at least two. Required with a Judge or Rubric. Candidates must be catalog models or workspace artifacts served by the inference endpoint.
rubricthe score on your logsA score name on your records (pass it when records carry several scores), or a Judge or Rubric of judges and validators. With a Judge or Rubric, the server replays each prompt against models and scores the answers in a labeling eval before training; it's billed as an eval, isn't capped by max_cost_usd, and its estimate is in runs.plan().labeling. Python functions (Scorer(fn=...)) are coming soon.
max_quality_drop0.02Training target: how much quality, compared with the fallback model, the router may trade for cost savings (0–0.5).
pricingnoneUSD per request per candidate via pricing=, else metrics.cost_usd on your logs (with a Judge rubric the labeling eval records each call's cost at catalog prices). Without either, cost_savings_pct is null.
fallbackthe best-scoring candidateThe candidate that gets every request the router doesn't offload. Must be one of models.

DecisionModelRecipe#

ParameterDefaultWhat it does
modelgradiated/linden-1, chosen by the recipePass "qwen/qwen3-0.6b" to train from a general open model instead.
lossby question type: losses.CrossEntropy() (choice), losses.BCEWithLogits() (noul), losses.OrdinalBCE() (score)Not overridable; passing loss= is an error.
adapteradapters.LoRA(rank=32)adapters.FrozenHead() trains only the heads on a frozen backbone (linden-1 only).
lr"auto" (about 3e-4 on linden-1)Printed by the dry run.

Best checkpoint by held-out loss.

RewardModelRecipe#

See Reward models.

ParameterDefaultWhat it does
model"qwen/qwen3-8b"4B–8B models score in milliseconds.
adapteradapters.LoRA(rank=32)Rank 8–16 is enough for a few thousand pairs.
rubricnoneA score name in [0, 1] on records ending in an assistant turn, trained pointwise (BCEWithLogits) next to the Bradley-Terry loss on pairs.
lr"auto" (about 1e-4)

Pairs stay on the same side of the split. Best checkpoint by held-out pair accuracy (preference_accuracy), or by held-out loss when there are only scored answers.

EmbeddingRecipe#

ParameterDefaultWhat it does
modelbaai/bge-small-en-v1.5, chosen by the recipeCompact encoder with sub-10 ms inference.
Weights trainedAll encoder weights (managed by the recipe)Small encoders (33M params) train fast end-to-end and usually beat LoRA.
poolpooling.Mean()Averages token vectors into one vector. pooling.CLS() uses the first token's vector instead. The pooling is saved with the artifact.
loss, templosses.InfoNCE(temp=0.05)Lower temp (0.03) sharpens rankings when negatives are near-duplicates. Without negatives, other documents in the batch serve as negatives. temp= is shorthand for loss=losses.InfoNCE(temp=...).
lr"auto" (about 2e-5)

Best checkpoint by held-out top-10 hit rate.

CartridgeRecipe#

ParameterDefaultWhat it does
contextrequiredContext.from_text(...) or Context.from_file(...). The context plus each prompt must fit the model's 32,768-token window.
num_tokens256Size of the compressed prefix (16–4096). Try 512–1024 for very large contexts.
teacherthe same model reading the full contextPass a larger catalog model of the same family to distill from it as well.
losslosses.TopKKLDistill(top_k=20)Pass losses.TopKKLDistill(top_k=...) to change top_k (the SDK's bare TopKKLDistill() means 32).
slot_tokenthe first reserved token that tokenizes atomicallyThe token that marks where the cartridge goes in a prompt.
max_new_tokens256Length of the teacher's answer to each prompt during distillation (1–8192).
lr"auto" (about 1e-2)Prefix KV tokens need a far higher learning rate than LoRA weights. Keep overrides within 1e-2–2e-2.

Best checkpoint by closeness to the model reading the full context.

Environments#

Environments are coming soon with GRPORecipe; see Environments. The SDK types environments.Tools today.

ParameterDefaultWhat it does
environments.Tools(tools, ...)—Turns typed Python functions into tools; each signature and docstring becomes the tool's JSON schema. An empty list gives a single-turn environment.
Tools(tasks=, rubric=)noneThe task dataset, and how each finished attempt is scored.
Tools(max_turns=)10; 1 with no toolsMaximum model turns per attempt.
Tools(system_prompt=)noneSystem instructions added to every task.
Tools(requirements=)[]Packages your tool functions import.

Judge and Scorer#

ParameterDefaultWhat it does
Judge(model=)requiredThere's no default model that could change under you. The eval records every judge model it used (judge_models).
Judge(prompt=), Judge(name=)none, "judge"Scoring instructions (up to 8,000 characters) and the score's name.
Judge(weight=), Scorer(weight=)1.0Weight of this check in the Rubric's overall score.
requirements, network, runtimesee Where code runs

Evaluations#

For client.evals.create(...) and client.evals.plan(...).

ParameterDefaultWhat it does
datasetrequiredThe dataset whose prompts every model answers: your own, or a benchmark from client.datasets.from_benchmark(...).
rubricthe dataset's own (a benchmark's answer check), else validators.NonEmpty()Judges, validators.* and local Scorers, alone or in a Rubric.
samples1Attempts per task (1–32). pass@1 and pass@samples are reported. Use 3–4 for decisions you'll act on.
baselinenoneA model or artifact for a paired comparison, with a confidence interval on the difference.
pass_threshold1.0 when every check is binary (regex or validator), 0.5 otherwiseThe score at or above which an attempt counts as passing, for pass@k.
temperature, max_tokens0.7, 1024Sampling settings for the evaluated models.
limitthe whole datasetEvaluates only the first limit records.

client.evals.plan(...) returns estimated_cost_usd at $0. Eval usage is billed: the finished eval reports total_cost_usd, and each model's summary its cost_per_1k_tasks_usd.

Deploy#

How "auto" values resolve#

ValueHow it's chosen
lr="auto"A per-model, per-recipe table, calibrated by a learning-rate sweep on each base model. Each entry is measured at batch_size=128, LoRA(rank=32, alpha=32), linear decay with 3% warmup and AdamW(betas=(0.9, 0.95)), then scaled by the square root of your batch size over 128 and by lr_scale. A model trains only the recipes it has an entry for (client.models.list() and GET /v1/base-models list them as recipes and calibrated_lrs); self-hosted servers register extra models, with their learning rates, through GRAD_EXTRA_MODELS_JSON.
loss="auto" (GRPO, coming soon)losses.GRPO(clip_low=0.2, clip_high=0.28) for on-policy runs. With max_staleness > 0 it adds mask_ratio=(0.5, 2.0), which drops tokens whose probability under the current weights has moved more than 2× from the sampler's. auto never picks losses.CISPO, and the dry run warns if you combine CISPO with max_staleness > 0.
max_new_tokens="auto" (distillation)The 95th-percentile length of the assistant turns already in your records, rounded up to a multiple of 32 and kept between 32 and 1024, or 256 when the records have none. Metrics report truncation_rate.
thinking="auto"The base model's own default. For Qwen3, thinking is on, and records with no <think> block train with thinking off.

Resolved learning rates on each recipe's default model at batch_size=128:

RecipeDefault modellr
SFT (LoRA)qwen/qwen3-8b5e-4
DPOqwen/qwen3-8b2e-5
Routerqwen/qwen3-0.6b5e-4
Decision modelgradiated/linden-13e-4
Context Cartridgeqwen/qwen3-8b1e-2
Embeddings (encoder)baai/bge-small-en-v1.52e-5
Distillationqwen/qwen3-4b2e-4
Reward modelqwen/qwen3-8b1e-4

Rule versions. The auto rules are versioned. Each run's resolved_config records the version it used (rule_version: auto@2) and where its lr came from (lr_source, for example auto@2: calibrated for qwen/qwen3-8b at batch 128, sqrt batch scaling). If we change what a rule resolves to, it gets a new version, and existing run configs keep the old one.