tinker SDK,
so code written for Tinker, including the tinker-cookbook recipes, can point at
a miles gateway instead.
The client owns the training loop: data, sampling, rewards, and the schedule of
forward_backward and optim_step calls. miles owns the GPUs: it batches work
from all tenants onto the shared trainer, keeps each adapter’s state isolated,
and serves every saved adapter version for sampling.
When to use it
- Many small experiments on one large model. Run several RL or SFT jobs on one copy of the base weights, without a dedicated cluster per job.
- Training as a service. Expose training to users who write their loop against the Tinker API and never touch the cluster.
- Bring your own harness. Agentic RL with your own sandbox or agent framework: the client records exact sampled tokens and log-probs and trains on them directly.
How it works
- One model per client.
create_modelassigns the client an adapter slot on the trainer. The trainer holds the frozen base once, plus a fixed number of slots (--multi-lora-n-adapters) at a maximum rank (--lora-rank). Each client picks its own rank up to that maximum. A distinct API key per tenant identifies who owns which models, futures, and checkpoints. - Cross-tenant batching. Each model has its own command queue. The scheduler
picks the earliest ready request and packs datums from every model that runs
the same operation and loss into one trainer forward pass, up to a token
budget. Each datum is routed to its own adapter slot, so one pass serves
several tenants.
optim_steprequests from different models step together in one trainer call. - Isolated adapter state. Gradients accumulate per adapter until that
client calls
optim_step, and each adapter has its own FP32 optimizer state. A failedforward_backward,optim_step, orload_stateends training for that model only; other tenants keep training. - Versioned sampling.
save_weights_for_samplerwrites an immutable adapter snapshot to shared storage. Sampling engines load the base once at startup and load adapter versions from disk when a request names them. The base is never re-synced, so engines may serve a quantized base while the trainer holds BF16.
--colocate. The
LoRA guide documents the checkpoint and
restart semantics; the gateway example
documents failure handling.
Supported models
Multi-LoRA runs on models with Megatron-Bridge LoRA support that SGLang can serve LoRA for, within the constraints below. Models with only native LoRA support train a single adapter today.
The trainer rejects a multi-LoRA launch that breaks any of these constraints:
- Separate training and sampling GPUs: no
--colocateand no--offload-train, because each adapter’s gradients stay in GPU buffers between calls. --pipeline-model-parallel-size 1and--qkv-format thd.- Adam optimizer in BF16, without the distributed optimizer.
- For adapters on MoE experts: grouped-GEMM experts, expert tensor parallel size 1,
BF16 experts (no FP8/FP4 training), and all of
gate_proj,up_projanddown_projtargeted. The rollout engines may still serve a quantized base. - SGLang without attention DP, and with one tokenizer worker.
Tinker compatibility
The gateway implements thetinker==0.26.2 wire schema; pin that SDK version on
the client. It supports:
- Training:
forward,forward_backward,optim_step,save_state,load_state, andsave_weights_for_sampler. - Losses:
cross_entropy,importance_sampling,ppo,cispo, anddro, with 1-D per-token inputs. 2-D soft targets are not supported. - LoRA targets: the
attn,mlp, andunembedgroups, matching the SDK’strain_attn,train_mlp, andtrain_unembedflags. The server fixes the groups at launch; client flags must match them. - Sampling: only from
save_weights_for_sampler()paths, within one context window shared by training and inference (see Context window).
Get started
- Launch the Qwen3-30B-A3B gateway on one 8-GPU node and run its single- and multi-tenant smoke checks.
- Point a Tinker client or a
tinker-cookbookrecipe at the gateway URL, withtinker==0.26.2. - For agentic RL with your own sandbox or harness, use the tinker_agent client, or the Harbor integration for Harbor tasks.

