Skip to content

v0.2.0-alpha.10

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 30 Nov 16:16
· 125 commits to main since this release

Trainers: an interactive training loop on grad's GPUs (docs/TRAINER_API.md). Migrations 0014_trainers.sql,
0016_trainer_lanes.sql, 0017_eval_env_and_gates.sql, 0019_trainer_ops_order_index.sql,
0020_checkpoint_ttl_and_metadata.sql, 0021_trainer_mode_and_sampled_usage.sql, and
0022_stream_media_hotswap.sql (expand-only). Before upgrading, note:

  • Breaking (API): Checkpoint.run_id is nullable (a trainer's checkpoints have trainer_id), and
    ArtifactProvenance has trainer_id and the source value trainer.

  • Breaking (API, SDKs, CLI, Web UI): released artifacts are now strictly immutable — removed
    artifact deletion (DELETE /v1/artifacts/{id}, artifacts.delete, grad artifacts delete, UI
    Delete button) and artifact pinning (POST/DELETE /v1/artifacts/{id}/pins,
    PUT/DELETE /internal/v1/workspaces/{ws}/artifacts/{id}/pins/{holder}, Artifact.pins,
    ArtifactPin), as well as the internal workspace-state push endpoints
    (GET/PUT /internal/v1/workspaces/{ws}/state). GET /internal/v1/workspaces/{ws}/artifacts/{id}
    continues to work and accepts both artifacts:read and legacy artifacts:pin JWT scopes for
    zero-downtime rolling upgrades; Postgres tables remain expand-only (no destructive DROP TABLE),
    and checkpoint expiration (ttl_s, PATCH /v1/checkpoints/{id}, 410 checkpoint_expired) is
    unchanged.

  • Upgrade grad-server before trainer workers: a worker of this release claims trainer jobs by default
    (GRAD_WORKER_KINDS now defaults to train,import,trainer; the Helm GPU pool's kinds are
    [train, trainer]), and an older server refuses that kind in a claim.

  • Trainers (POST /v1/trainers, client.trainers.create(...) in all four SDKs, grad trainers list|show|close,
    and a Trainers page in the console): a LoRA on one GPU worker that a client drives with forward_backward
    (cross_entropy or linear; Python's losses.CustomLoss computes any loss of the log-probs in local torch
    and sends its gradient as a linear loss, with grad-sdk[torch]), forward (current, base or starting
    weights), optim_step (AdamW), sample, save_state, export (a peft_lora artifact) and render. Every
    op returns a future and carries a client-assigned seq, so retries are idempotent and ops run in order.
    Per-token arrays are binary on the wire, and large requests and results live in storage, not in Postgres.
    An idle trainer parks (state saved, GPU released, nothing billed) and resumes on the next op; a drain parks
    it without losing the running op; a lost worker fails it loudly with the checkpoint to resume from.
    max_cost_usd is a hard cap checked before every op, and usage flows through the Cloud usage export as
    kind: trainer.

  • Trainer futures compose with async code. Python: await fut waits without blocking the event loop, and
    fut.future() is the op as a concurrent.futures.Future (as_completed, asyncio.wrap_future); one
    background long-poll per trainer serves every awaited op. TypeScript: an OpFuture is a PromiseLike, so
    await fut and Promise.all([a, b]) work without .result().

  • Multimodal Vision & Audio support across SFT, Trainer API, Evals, all 4 SDKs, and CLI:

    • Added modalities (["text"], ["text", "image"], ["text", "image", "audio"]) to TrainableModel, Trainer, JudgeModel, and catalog models (qwen/qwen3.5-*, qwen/qwen3.8-27b, qwen/qwen3.6-35b-a3b, google/gemma-4-{12b,26b-a4b,31b}-it → vision; google/gemma-4-{e2b,e4b}-it → vision + audio), surfaced in grad models list.
    • Added strict API validation for OpenAI image_url (inline PNG/JPEG/WebP base64 data URIs ≤ 5 MiB; zero SSRF: rejects http(s):///file:// with 422 invalid_media_uri) and input_audio (RIFF/WAVE ≤ 10 MiB, rejected if non-WAV with 422 invalid_media), role gating (422 invalid_media_role), modality gating (422 unsupported_modality across SFT, non-SFT recipes, Trainer ops, and Evals), bounded per-datum/per-op limits (≤ 8 images, ≤ 4 audio clips, ≤ 20 MiB decoded media/op, 32 MiB trainer body limit), media-aware token bounding (4096/image, 1024/audio), and eval scoring base64 stripping with multimodal judge passthrough.
    • Added pure-PIL (pillow==13.0.0, zero torchvision) + pure-Python RIFF/WAVE & NumPy FFT 16 kHz resampler multimodal pipeline in grad_trainer (multimodal.py, templates.py, engine.py, session.py, recipes/sft.py, sampler.py, _vllm_worker.py) supporting Qwen3_5ForConditionalGeneration / Qwen3_5MoeForConditionalGeneration and Gemma4ForConditionalGeneration with zero regression on text-only varlen fast paths, /dev/shm sha256-deduped vLLM media IPC with auto-mode fallback to HFSampler, and processor saving on merged exports.
    • Added zero-extra-dependency multimodal helpers (image_part/audio_part/MediaItem/extract_media, plus Image/Audio in Python and *FromFile in TS/Go/Rust) and client-side SampledPrompt.media / TokenSegment.media propagation (Datum.from_sample, Datum.from_trajectory, SnapshotProxy) across Python, TypeScript, Go, and Rust SDKs.
  • RL losses on trainers: importance_sampling, ppo (clip_low, clip_high; recommended default for async/stale rollouts), cispo (clip_low, clip_high), and dro (beta, strictly masked by weights) read the datum fields sampling_logprobs and advantages with weights as the mask, and report kl_sample_train, kl_sample_train_v2, sample_train_max_diff, ratio_mean, ratio_max, and (ppo/cispo) clip_fraction. forward and forward_backward take temperature (the soft-capped logits divided by it, as the sampler does).

  • Calibrated lr="auto" on optim_step (all 4 SDKs): optim.AdamW(lr="auto", objective="sft"|"rl"|"dpo") resolves the model's calibrated LR server-side from catalog.ts (including calibrated rl LRs across trainable Qwen3/3.5/3.6/3.8 and Gemma 4 models), exposes Trainer.calibrated_lrs, returns the applied numeric lr on OptimStepResult, and refuses uncalibrated models/objectives with 422 uncalibrated_model.

  • top_k, top_logprobs, and prompt_logprobs on sample (both HFSampler and colocated VLLMSampler, all 4 SDKs): sample accepts top_k (1..1000), top_logprobs (0..20, returning per-token [{token_id, logprob}] sorted descending from the processed sampling distribution), and prompt_logprobs (bool, returning per-prompt-token float32 log-probs with index 0 = 0.0 matching forward()).

  • Checkpoint TTLs, save_state(metadata=...), and 410 checkpoint_expired (migration 0020, all 4 SDKs, CLI, Web UI): POST /v1/trainers accepts checkpoint_ttl_s (300..7776000 s) for automatic autosave/park checkpoints; save_state accepts optional ttl_s (300..7776000, omitted/null = permanent) and metadata (JSON object ≤ 16 KiB serialized UTF-8) returned on SaveStateResult.checkpoint.{expires_at, metadata}; final close checkpoints stay permanent; maintenance sweeps expired trainer checkpoint S3 blobs outside DB locks while keeping tombstone rows so resuming returns 410 checkpoint_expired.

  • Expanded built-in verified HF benchmarks (4 → 13) + math_equivalence and ifeval validators (all 4 SDKs, CLI): added pinned, public benchmarks arc_easy, hellaswag, winogrande, truthfulqa_mc1, boolq, openbookqa, commonsense_qa, math500 (HuggingFaceH4/MATH-500, 500 rows, scored with math_equivalence supporting nested \boxed{...}, fractions, radicals, \pi/trig, intervals/tuples/sets, symbolic probing, and numeric tolerance), and ifeval (google/IFEval, 541 rows, deterministic verifier for all 25 Google IFEval instruction IDs returning exact satisfied / total fraction).

  • StableReinforce RL loss + per-step entropy and clip_fraction diagnostics (all 4 SDKs): added stable_reinforce (clip_low=0.2, clip_high=0.28, kl_coef=0.0 with non-negative k3 KL penalty; Python grad.StableReinforce / losses.StableReinforce, TS losses.stableReinforce, Go grad.StableReinforce, Rust Loss::StableReinforce) and surfaced Monte-Carlo entropy (-mean(sampling_logprobs)) across all RL losses plus clip_fraction on clipped RL losses.

  • 32K Trainer context, Qwen3.5 vLLM default, true token-by-token sample streaming, content-addressed media uploads, and warm checkpoint/artifact hot-swap (migration 0022, all 4 SDKs):

    • Raised TRAINER_MAX_SEQ_LEN from 8192 → 32768 (min(model.max_context_tokens, 32768)), enabled "Qwen3_5ForConditionalGeneration" in DEFAULT_VLLM_ALLOW_ARCHS, and capped colocated VLLMSampler max_model_len safely to min(model_max_pos, 32768) (respecting GRAD_VLLM_MAX_MODEL_LEN).
    • Added token-by-token SSE streaming on sample (stream: true, GET /v1/trainers/{id}/ops/{op_id}/stream, worker POST /v1/trainer-jobs/{id}/ops/{op_id}/chunks, backed by Valkey/Redis Streams via optional REDIS_URL with XADD MAXLEN ~ 2000, 5 min TTL, and XREAD BLOCK, falling back to a bounded in-memory OpStreamBus when REDIS_URL is unset — zero Postgres chunk writes, never coalesced on the sample lane). Added valkey/valkey:8-alpine to Docker Compose and optional redis.url / redis.existingSecret / networkPolicy.redisEgress to the Helm chart. Added sample_stream / sampleStream / SampleStream across Python, TypeScript, Go, and Rust SDKs, and upgraded SnapshotProxy (OpenAI /v1/chat/completions and Anthropic /v1/messages) to stream live token deltas while preserving exact Trajectory and sampling_logprobs capture.
    • Added content-addressed, workspace-isolated media uploads (POST /v1/media accepting JSON or raw image/png, image/jpeg, image/webp, audio/wav, GET /v1/media/{id}) deduplicated by (workspace_id, sha256) in grad_media + S3, usable via grad://media/med_..., input_audio.media_id, or MediaItem.media_id with a bounded worker LRU MediaCache and client.media.upload / get helpers across all 4 SDKs.
    • Added instant checkpoint/artifact hot-swap on warm mode: "sample" sessions via weights: "checkpoint:<id>" | "artifact:<id>" | "base" | "initial" on sample, validated for workspace ownership (404), expiration (410 checkpoint_expired), base-model compatibility (422 incompatible_base_model), and sample-only mode (422 invalid_weights), backed by a bounded worker LRU _AdapterCache (vLLM external LoRARequest + HF PEFT/base swap).
    • Upgraded the Web Console /playground (server/ui) with live token-by-token SSE streaming (stream: true + GET /v1/trainers/{id}/ops/{op_id}/stream with Authorization headers, live <think> folding, Stop/Cancel abort, and polling fallback), single-GPU warm checkpoint/artifact/base hot-swap (including shared single-GPU Compare A/B when targets share base_model), content-addressed POST /v1/media attachment uploads (grad://media/<id> / media_id reuse across turns), and updated Phase 11 "Copy as Python" (sample_stream, weights, grad.Image.upload/grad.Audio.upload).
  • Opt-in LoRA Multimodal Projector Adaptation & Multimodal DPO / Off-Policy Distill / Reward Recipes (all 4 SDKs, CLI):

    • Added optional adapter.train_multimodal_projector (default false) on LoRA runs and trainers (grad.Lora(..., train_multimodal_projector=True), TS adapters.lora({ trainMultimodalProjector: true }), Go LoRA{TrainMultimodalProjector: true}, Rust AdapterSpec / TrainerOptions.train_multimodal_projector). Rejected synchronously with 422 unsupported_modality on text-only models; when enabled on multimodal models, targets only the vision/audio-to-language projector/merger linear layers (visual.merger.* on Qwen3.5/3.6/3.8, embed_vision.* / embed_audio.* on Gemma 4) alongside language decoder layers while keeping heavy vision/audio encoder backbones frozen, persists cleanly in adapter_config.json and trainer engine.json, and keeps GRAD_SAMPLER=auto safe by falling back to HFSampler (rejecting explicit GRAD_SAMPLER=vllm with RecipeConfigError).
    • Enabled multimodal (image and audio) datasets across DPORecipe (preference pairs preserving exact padded sdpa + position_ids=None policy & disabled-adapter reference log-probs), off-policy DistillRecipe, and RewardRecipe (pairwise & pointwise multimodal scoring with left-truncation media-token protection), plus calibrated distill/reward LRs on all trainable multimodal catalog models. On-policy distill, incompatible recipes (embedding, classifier, router, cartridge, decision), and text-only models continue to reject multimodal datasets with 422 unsupported_modality, and immutable dataset records/evals consistently reject Trainer-API-scoped grad://media/med_... / input_audio.media_id references synchronously with 422 invalid_media_uri.
  • Decoupled SamplingClient (mode: "sample" on Trainers, migration 0021, all 4 SDKs): POST /v1/trainers accepts mode: "train" | "sample" (default "train"), allowing eval-only catalog LLMs (e.g. qwen/qwen3-32b) in sample mode, rejecting training/mutation ops (forward_backward, optim_step, save_state, export) with 422 sample_only_trainer, skipping optimizer/gradient buffers and parking without a checkpoint while giving colocated VLLMSampler higher VRAM headroom (up to 0.75 vs 0.45). Added client.open_sampler(...) / SamplingClient across Python, TypeScript, Go, and Rust.

  • Mutable checkpoint TTL & metadata (PATCH /v1/checkpoints/{id}, all 4 SDKs, CLI): updates an active checkpoint's ttl_s (300..7776000 s from now, or null for permanent) and/or replacement user metadata while preserving internal manifest keys; returns 404 checkpoint_not_found or 410 checkpoint_expired. Exposed via checkpoints.update(...) in all 4 SDKs and grad checkpoints update <id> [--ttl-s <secs> | --permanent] [--metadata <json>].

  • console_url deep-links & sampled-token usage accounting (migration 0021, all 4 SDKs, CLI, Web UI): optional GRAD_CONSOLE_URL adds console_url on Trainer, Run, EvalRun, and Checkpoint (/trainers/{id}, /runs/{id}, /evals/{id}, /artifacts?checkpoint={id}), displayed in CLI detail views and copyable in the Web Console. Sample ops report prompt_tokens and sampled_tokens on TrainerOp.usage, Trainer.usage, GET /v1/usage, and GET /v1/usage/summary (sampled_tokens breakdown alongside tokens).

  • Interactive Checkpoint Chat Playground, Checkpoint TTL/Metadata Editor & Phase 9 Web Console (server/ui): added /playground for chatting with unexpired checkpoints, promoted peft_lora artifacts, or catalog LLMs (including eval-only models) via mode: "sample" trainer sessions with side-by-side A/B compare, optional image (PNG/JPEG/WebP ≤ 5 MiB) and WAV audio (≤ 10 MiB) attachments, collapsible <think> blocks, and an interactive per-token logprob & top-5 alternative inspector. Added inline PATCH /v1/checkpoints/{id} TTL/metadata editing (presets, custom seconds, permanent ttl_s: null, 16 KiB JSON validation, 410 checkpoint_expired handling), ?checkpoint=<id> highlighting on /artifacts, "Chat in Playground" deep-links, mode / entropy / clip_fraction / sampled_tokens displays across Trainers and Usage, and MATH-500 / IFEval benchmark & validator badges across Evals and Datasets.

  • CLI diagnostics, credential hygiene & DevEx (grad doctor, grad completions, grad local up): added grad doctor [--json] (checks config/credentials 0600 permissions, /health/ready latency & /v1/models auth + multimodal count, Docker/Compose & local stack status, disk//dev/shm/GPU hardware, and Python SDK version parity), added grad completions as an alias for grad completion, tightened config directory permissions to 0700 on save with permissive-file warnings in grad config show and grad doctor, redacted api_key in CLI Global Debug output, added actionable CLI error hints for connection failures, 401, 410 checkpoint_expired, 422 uncalibrated_model, 422 unsupported_modality, 422 sample_only_trainer, and 422 recipe_not_supported_for_model, and surfaced the /playground URL and grad doctor quickstart in grad local up / grad local status.

  • Environments run, on your machine (Python). env.rollout_groups(policy, tasks, group_size=8) and
    env.iter_rollout_groups(...) (groups as they finish) run multi-turn rollouts of an Environment or
    ToolsEnvironment (sync or async def; setup= gives tools per-rollout state) against a policy: a
    Trainer (snapshot, sample, release), a trainer.snapshot(), or policies.OpenAI(model, base_url=). Each
    rollout runs on its own thread; timeout_s counts environment time only, and a timeout or an environment
    error is a typed error/timeout outcome, dropped from training and reported (grad.rollout_metrics:
    timeout_rate, error_rate, parse_fail_rate, reset_rate, truncation_rate). Teardown always runs;
    abandoned hung calls count against max_concurrency (EnvironmentHung when they hold every slot). A
    Trajectory carries its exact token segments (TokenSegment) and runtime fields that to_record() drops;
    Datum.from_trajectory, grad.with_advantages(groups, advantages.GroupStd(min_std=) | GroupMean() | RLOO(), skip_zero_var=1e-6, kl=grad.KL(trainer, coef=, weights="base", discount=0.0)) -> Batch (with its sampling
    temperature and, when kl= is passed, zero-centered KL-to-reference advantage shaping via one
    trainer.forward(..., weights=..., temperature=...) call plus kl_policy_ref/kl_policy_ref_v2 in
    batch.metrics), grad.recompute_logprobs, grad.mean_reward. grad.GroupScorer(fn, name=None, weight=1.0)
    (sync or async def, (trajectories,) or (task, trajectories)) scores a task's non-error rollout group
    together inside Rubric([...]) across rollout_groups, iter_rollout_groups, and evals.create(env=...).
    The reward is grad.combine(rubric, scores), the server's combineScores exactly. Removed:
    StepOutcome and Trajectory.append_env_tokens (0.1 stubs); StatefulScorer now serialises as a local code
    item.

  • On-Policy Distillation (OPD), Prompt Distillation & Self-Distillation (SDFT) (Python, grad.distillation):
    added TeacherScorer protocol with TrainerTeacher (zero extra GPU memory with weights="base"|"initial"|"snapshot:<seq>" or a separate teacher Trainer), SnapshotTeacher (prompt_logprobs=True), and OpenAITeacher (/v1/completions echo=True, max_tokens=0, logprobs=1); distillation_advantages / distillation_advantages_async (reverse_kl, forward_kl, jsd, clip_kl, discount, reward_weight blending, and teacher_tokens_fn / teacher_messages_fn prefix alignment across single- and multi-turn trajectories); and turnkey OnPolicyDistiller, PromptDistiller, and SelfDistiller wrappers.

  • Zero-dependency MCP tool binding (grad.mcp, Python): added JSON-RPC 2.0 MCP.stdio(...) (thread-safe subprocess transport with stderr draining and clean terminate→kill shutdown) and MCP.http(...) (Streamable HTTP with Mcp-Session-Id negotiation and JSON + SSE response parsing), with allow, deny, prefix, max_output_chars, structured error containment, and direct ToolsEnvironment(mcp=...) integration for rollouts and agent evals.

  • Context compaction (grad.compaction, Python): added ContextCompactor (truncate_tools, sliding_window, and summarize strategies with calibrated or custom token counting) wired into Environment(..., compaction=...) and ToolsEnvironment(..., compaction=...), cleanly opening a new token-aligned TokenSegment (incrementing compactions and resets) whenever compaction triggers mid-rollout.

  • Curated, CI-tested runnable cookbook (examples/): added examples/README.md and 8 runnable recipes (rl_math.py, rl_tools_calculator.py, rl_mcp_agent.py, on_policy_distillation.py, preference_dpo.py, proxy_coding_agent.py, vlm_multimodal.py, rl_numerics_check.py), each supporting offline --dry-run smoke verification in CI.

  • External harness proxy & ecosystem integrations (Python):

    • Live Snapshot OpenAI + Anthropic capturing proxy (grad.proxy.SnapshotProxy): with snap.proxy() as p:
      (and trainer.proxy(), plus python -m grad.cli proxy --trainer <id> [--snapshot <seq>]) runs a stdlib
      loopback HTTP server exposing GET /v1/models, POST /v1/chat/completions (OpenAI JSON + SSE), and
      POST /v1/messages (Anthropic JSON + SSE with system, thinking, tool_use, and tool_result
      translation) at p.openai_url and p.anthropic_url. Automatically detects multi-turn message extensions per
      X-Grad-Session / X-Session-Id header, sends continue prompts to snap.sample(...), and captures
      token-aligned Trajectory objects (p.trajectories(), p.reset_trajectories()) ready for
      Datum.from_trajectory / with_advantages / PPO.
    • inspect-ai model provider (grad.integrations.inspect_ai, extra grad-sdk[inspect]):
      GradInspectModel, grad_model(...), and @modelapi(name="grad") registration run inspect eval against a
      live Snapshot, Trainer, or OpenAI-compatible grad endpoint without adding required dependencies.
    • verifiers v1 environment adapter (grad.integrations.verifiers, extra grad-sdk[verifiers]):
      from_verifiers(vf_env) wraps verifiers.v1 environments as native grad.Environment instances compatible
      with rollout_groups, with_advantages, PPO, and client.evals.create(env=...), automatically exposing
      group-level score_group methods and plural-argument group rubric functions as grad.GroupScorer items on
      env.rubric (and env.group_scorer()). Added run_verifiers_via_proxy(...), VerifiersProxyRunner, and
      VerifiersEnvironment.run_via_proxy(...) to run custom vf_env.rollout() / a_rollout() loops through a
      loopback SnapshotProxy (using openai.AsyncOpenAI/openai.OpenAI when installed or a zero-dependency
      httpx OpenAI-compatible shim otherwise) with automatic continue token alignment and full per-rollout +
      group rubric scoring. Replaced the rigid <0.5.0 hard crash with a forward-compatible structural
      verifiers.v1 guard (hard-rejecting legacy <0.4.0 and missing/incompatible verifiers.v1, warning and
      proceeding on >=0.5.0 when verifiers.v1 is compatible).
  • Trainer phase 2 across all four SDKs (Python, TypeScript, Go, Rust): losses.ImportanceSampling,
    losses.PPO(clip_low, clip_high), Datum sampling_logprobs/advantages, temperature on
    forward/forward_backward, forward(weights="snapshot:<seq>"), trainer.snapshot() (Snapshot with
    sample on the sample lane using request_key and deadline_s, and release), trainer.snapshots(),
    {"continue": {...}} prompts, Sample.message/parsed, SampledPrompt.reset, and ops/wait folded into
    each SDK's poller. Python forward_backward(batch) also reports staleness_mean/staleness_max (optimizer
    steps between each rollout's snapshot and the call).

  • Agent evals (mode: "env") and regression gates: run multi-turn Environment / ToolsEnvironment
    evals on your own machine or CI (client.evals.create(env=..., models=[policies.OpenAI(...), trainer, snap], gate=grad.Gate(max_drop=0.02)), client.evals.resume(...), and grad eval --env module:attr). Rollouts and
    local scorers/validators run in your process, trajectories and scores post in batches
    (POST /v1/evals/{id}/outputs + /complete), optional Judge items run on the eval worker over the posted
    trajectories, and grad aggregates with the same confidence intervals, pass@k and paired bootstrap. Gates
    (rule="significant" default with max_drop=0.0, or "delta", against baseline or baseline_eval) work
    on both agent and single-turn evals: grad eval exits 8 on regression (eval_regressed) and 9 when
    rollout errors exceed --max-error-rate (eval_error_rate), writes $GITHUB_STEP_SUMMARY, and resumes
    automatically on re-run via Idempotency-Key=$GITHUB_RUN_ID. See docs/ENVIRONMENTS.md
    and examples/workflows/agent-eval.yml.

  • Departure (sample logprobs at sampling temperature): sample now returns log-probs under the sampling
    distribution (log_softmax(softcap(logits) / temperature) renormalised over top_p), matching forward(..., temperature=...) at top_p=1 for exact importance ratios, rather than raw temperature=1 log-probs.

  • Multi-turn rollouts on trainers: a continue sample prompt ({continue: {tokens, messages, ...}}) extends a
    trajectory with exactly the tokens a deployment would render after it (text-equality rule; reset when the
    template rewrote history), clamps max_tokens to the room left (finish_reason: context_full with none), and
    every sample carries message (reasoning and OpenAI-style tool calls, parsed per template family from the
    tokens with special tokens kept) and parsed. Gemma 4's <turn|> and <|tool_response> are always stop ids.

  • Snapshots, sample lane, and dual-lane worker scheduling: POST /v1/trainers/{id}/snapshot freezes an adapter
    copy by seq (max_snapshots, 409 too_many_snapshots, no eviction, snapshot_ttl_s idle release).
    POST /v1/trainers/{id}/snapshots/{seq}/sample runs on the sample lane with request_key idempotency, 1024 queue
    cap (429 Retry-After: 1), deadline sweeps (expired samples never unpark), and POST /v1/trainers/{id}/ops/wait.
    The worker alternates train ops and just-in-time batched sample claims (grouped by snapshot and generation config;
    seeded ops run alone), preserves live snapshots across park and drain, reports per-lane compute_ms and
    utilization {train_s, sample_s, ready_s}, renders chats off the GPU critical path in the prefetch thread
    (TokenizerRenderer), and isolates HTTP 413 result errors to result_too_large on the single op.

  • Agent evals (mode: env), judges over trajectories, and regression gates: POST /v1/evals with
    env: {name, max_turns, fingerprint?} starts in awaiting_outputs (unclaimed, 24 h sweep). Clients post rollout
    outputs and trajectories to POST /v1/evals/{id}/outputs (≤ 16 KiB inline, larger in S3 via presigned
    trajectory_url; cost_usd: 0 on the server), resume via GET /v1/evals/{id}/outputs?fields=key, and finish
    with POST /v1/evals/{id}/complete. Rubrics with judge items queue for the eval worker to score stored
    trajectories using a canonical 16 KiB capped transcript (preserving the final assistant turn) and bill judge tokens
    through billAttempt. baseline_eval pairing (422 baseline_mismatch on dataset, version, rubric, fingerprint,
    samples, max_turns or temperature mismatch) and gate {max_drop, rule: significant|delta} (minimum 30 paired
    tasks, reporting paired_tasks and min_detectable_drop) work for both single-turn and env evals. Shared golden
    reward fixture tests/fixtures/wire/combine-scores.json pins exact toFixed(4) half-up parity between TypeScript
    and Python.

  • Web console for Trainer phase 2 and Agent Evals (server/ui): Evals now show awaiting_outputs status,
    environment metadata (env.name, max_turns, fingerprint), baseline_eval links and deltas, regression gate
    banners (passed, regressed, rule, max_drop, paired_tasks, min_detectable_drop), and a paginated
    Outputs panel with an expandable trajectory viewer (inline or lazily fetched from S3 trajectory_url with
    formatted tool calls/responses, reasoning toggle, finish reason, and error banners). Trainers now show GPU
    utilization ((train_s + sample_s) / ready_s), sample queue depth, closing state, a Snapshots panel with
    confirmed release (DELETE /v1/trainers/{id}/snapshots/{seq}), and op lane / snapshot_seq / compute_ms
    columns.

  • One engine for recipes and trainers (grad_trainer/engine.py): SFTRecipe's forward, backward and
    optimizer steps moved onto it, and a parity test checks a hand-written loop gives SFTRecipe's losses.

  • Fixed: batched generation on CUDA attended padding. A model loaded for packed (varlen) training generated
    left-padded batches without an attention mask, so distillation's student samples for short prompts saw the
    padding. Generation now switches to padded SDPA.