Skip to content
SurogateSurogateDocs
↑↓ to move↵ to openesc to close

Recipes

Run commands from the repository root with Surogate installed. Model IDs download weights on first use; gated checkpoints require Hugging Face access. Training needs a supported NVIDIA GPU. GPU counts are explicit in the larger recipes, and memory use depends on model, precision, context and batch size.

bash
surogate sft examples/sft/qwen3/qwen3-lora-bf16.yaml
# Serve the trained adapter as a merged model:
surogate merge --base-model Qwen/Qwen3-0.6B \
--checkpoint-dir ./outputs/sft/qwen3/qwen3-lora-bf16 --output ./outputs/qwen3-merged
surogate serve ./outputs/qwen3-merged --served-model-name demo
# Another terminal:
python examples/serve/client.py chat

Examples use separate output directories and start fresh by default. To resume, follow the checkpoint instructions. The short budgets and bundled toy datasets demonstrate workflows; they are not quality or hardware-capacity guarantees.

FeatureStart here
Random-initialized pretraining; NorMuonPretraining, config
Continued pretraining on raw textContinued pretraining, run with surogate sft
Full-parameter SFT; AdamW and FP32 mastersFull fine-tuning
LoRA, BF16/FP8/NVFP4 computeModel and precision recipes
Local miniature GLM-5.3-Flash; native training and shared-policy checksDummy GLM checkpoint
Online BnB NF4, FP8 and NVFP4 QLoRA; prequantized checkpointsQwen3 recipes, precision guidance
Import/continue and stack adapters; checkpoint resume, merge and exportAdapter lifecycle
Local/hub datasets, instruction/chat mapping, mixing, packing and validationDataset examples, split chat columns
Vision fine-tuning and text-only multimodal backbonesQwen3-VL, Qwen3.5
DPO, differing-span masking, length normalization and reference-free lossPreference training
Offline top-K distillation, local/API teachers and tokenizer transplantationDistillation
Split-GPU, colocated and separate-process GRPOGRPO
One model, one job, one GPU: GRPO kits with measured before/afterKits, results
RL evaluation, difficulty filtering, temperature scheduling and resumeGRPO orchestrator, guide
LLM judge rewards: replace, add or metrics onlyRULER
On-policy teacher rewards, multi-turn diagnostics, adaptive rollout depthTurnOPD
Native data parallelism, ZeRO sharding and communication overlapMulti-GPU
Multi-node training with RayRay config, setup
Dispatch pipeline parallelism with streamed frozen weights27B dispatch recipe
Expert parallelism, routing losses, balancing and expert offloadQwen3.5/3.6 MoE, Qwen3 MoE QLoRA
CPU weights, gradients, optimizer, quantized weights and activation offloadCPU training, sharded FP8
Long context, tiled MLP, recomputation and chunked loss/attentionLong context
Chunked-sequence trainingLaguna, Qwen3.6 MoE
Adaptive LR, early stopping, token budgets, schedules, W&B/Aim and local metricsAdaptive training
HF/GGUF serving, quantization and runtime adaptersServing
Chat/Completions/Responses/Anthropic APIs, streaming, tools and tokenizationAPI client
Concurrency, prompt caching, elastic KV, authentication, health and metricsServing launches
CPU layer/expert offload, expert cache and CPU/GPU compute sharingPlacement
Multiple GPUs, multiple named models, priorities and sleep/wakeServing launches
MTP and DFlash speculationSpeculation
Image/video requests and GPU/CPU embeddingsMedia and embeddings

Every YAML below runs with surogate sft <path>. Each family retains examples for different execution paths or checkpoint formats. A larger model generally needs more GPUs, host offload or quantization; inspect the selected config before launch.

fp4 denotes the NVFP4 compute recipe; qfp4 denotes online NVFP4 base quantization. prequant-fp8, nvfp4 model IDs and GPT-OSS MXFP4 examples load already quantized weights. Filenames alone do not specify compute precision: check recipe. Text-backbone recipes set train_vision: false; image recipes set it to true.

The library covers supported user workflows. QeRL noise is rejected by the native RL runners; replay loss/config fields are not wired into a complete CLI workflow. Native serving lacks constrained structured outputs and prompt-token scoring, so RULER and distillation explicitly use external compatible services. Experimental architecture definitions with deferred training components are not advertised as ready-to-run recipes. See the compatibility guide.

One-step/benchmark duplicates and the GPU thermal soak were removed. The few configs used by regression/capture tooling moved to training fixtures. Laguna uses one chunked-sequence recipe, reverse-text uses one model, and TurnOPD uses one student with configurable depth budgeting. To do a smoke run, copy a recipe and change its step/evaluation/save budget as described in the training guide.