Recipes
EngineSurogate EngineRun 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.
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-mergedsurogate serve ./outputs/qwen3-merged --served-model-name demo# Another terminal:python examples/serve/client.py chatExamples 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.
Feature map
Section titled “Feature map”| Feature | Start here |
|---|---|
| Random-initialized pretraining; NorMuon | Pretraining, config |
| Continued pretraining on raw text | Continued pretraining, run with surogate sft |
| Full-parameter SFT; AdamW and FP32 masters | Full fine-tuning |
| LoRA, BF16/FP8/NVFP4 compute | Model and precision recipes |
| Local miniature GLM-5.3-Flash; native training and shared-policy checks | Dummy GLM checkpoint |
| Online BnB NF4, FP8 and NVFP4 QLoRA; prequantized checkpoints | Qwen3 recipes, precision guidance |
| Import/continue and stack adapters; checkpoint resume, merge and export | Adapter lifecycle |
| Local/hub datasets, instruction/chat mapping, mixing, packing and validation | Dataset examples, split chat columns |
| Vision fine-tuning and text-only multimodal backbones | Qwen3-VL, Qwen3.5 |
| DPO, differing-span masking, length normalization and reference-free loss | Preference training |
| Offline top-K distillation, local/API teachers and tokenizer transplantation | Distillation |
| Split-GPU, colocated and separate-process GRPO | GRPO |
| One model, one job, one GPU: GRPO kits with measured before/after | Kits, results |
| RL evaluation, difficulty filtering, temperature scheduling and resume | GRPO orchestrator, guide |
| LLM judge rewards: replace, add or metrics only | RULER |
| On-policy teacher rewards, multi-turn diagnostics, adaptive rollout depth | TurnOPD |
| Native data parallelism, ZeRO sharding and communication overlap | Multi-GPU |
| Multi-node training with Ray | Ray config, setup |
| Dispatch pipeline parallelism with streamed frozen weights | 27B dispatch recipe |
| Expert parallelism, routing losses, balancing and expert offload | Qwen3.5/3.6 MoE, Qwen3 MoE QLoRA |
| CPU weights, gradients, optimizer, quantized weights and activation offload | CPU training, sharded FP8 |
| Long context, tiled MLP, recomputation and chunked loss/attention | Long context |
| Chunked-sequence training | Laguna, Qwen3.6 MoE |
| Adaptive LR, early stopping, token budgets, schedules, W&B/Aim and local metrics | Adaptive training |
| HF/GGUF serving, quantization and runtime adapters | Serving |
| Chat/Completions/Responses/Anthropic APIs, streaming, tools and tokenization | API client |
| Concurrency, prompt caching, elastic KV, authentication, health and metrics | Serving launches |
| CPU layer/expert offload, expert cache and CPU/GPU compute sharing | Placement |
| Multiple GPUs, multiple named models, priorities and sleep/wake | Serving launches |
| MTP and DFlash speculation | Speculation |
| Image/video requests and GPU/CPU embeddings | Media and embeddings |
Model and precision recipes
Section titled “Model and precision recipes”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.
| Family | Recipes | GPU count in configs |
|---|---|---|
| Gemma 4 text backbones | 12b-lora-fp8, e2b-lora-bf16, e2b-lora-fp8 | 1 |
| GPT-OSS MXFP4 | lora-mxfp4 | 4 |
| GLM-5.3-Flash architecture fixture | Generator and scope, dummy-full, dummy-lora | 1 |
| Laguna-S | lora-fp8 | 8 |
| LFM2.5 | lora-bf16, lora-fp8 | 1 |
| Llama 3.2 | lora-bf16 | 1 |
| MiniCPM5 | lora-bf16 | 1 |
| Nemotron / Cascade | cascade2-qlora-bnb, nano3-nvfp4, nano3-qlora-bnb | 1 |
| Qwen3 dense | lora-bf16-ray, lora-bf16, lora-fp4, lora-fp8, lora-nvfp4, lora-prequant-fp8, lora-qbnb, lora-qfp4, lora-qfp8 | 1, 2 nodes × 4 |
| Qwen3.5 / 3.6 dense | text-lora-bf16, text-lora-fp8, qwen35vl-lora-bf16, qwen36-text-lora-fp8-pp, qwen36-text-lora-fp8, qwen36-text-lora-nvfp4 | 1, 4 |
| Qwen3.5 / 3.6 MoE | qwen35moe-lora-fp8, qwen35moe-lora-qbnb, qwen36moe-lora-fp8 | 2, 4 |
| Qwen3 MoE | lora-qbnb, nvfp4 | 1, 4 |
| Qwen3-VL | lora-bf16, text-lora-bf16 | 1 |
| Spark-X2.5 | lora-bf16 | 1 |
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.
Scope and maintenance
Section titled “Scope and maintenance”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.