Recipes, YAML Configs & Full Optionality

Start with one command (actuator train) or start directly from a reproducible YAML file (actuator run). Both execute the exact same pipeline.


1. Using the 34-Recipe Production Catalog

Actuator ships 34 ready-to-run YAML recipes across SFT, Vision, DPO/KTO/ORPO, GRPO/Agentic RL, Distillation, Merging, Refusal Removal, and Quantized Export in recipes/catalog/.

# List all catalog recipes and minimum VRAM requirements
actuator recipes list

# Copy any recipe into your project to edit and version-control
actuator recipes fetch sft/qwen3-4b-qlora --out my-sft.yaml

# Dry-run validate (read-only) before starting GPU work
actuator run my-sft.yaml --dry-run

# Run end-to-end
actuator run my-sft.yaml

2. Named Presets (actuator train)

When starting from the CLI, combine presets freely — later flags override earlier ones:

Preset Purpose
--fast Quick sanity run (20 steps) to validate data, hardware, and pipeline end-to-end
--balanced (default) Coherent 1-epoch SFT / safe 1-epoch DPO defaults for strong out-of-the-box quality
--best Multi-epoch training with dev-set best-checkpoint selection
--low-memory Enables 4-bit NF4 QLoRA + paged 8-bit AdamW so 7B–32B models fit smaller cards

3. Coherent Training Defaults

Hand-written YAML recipes that omit optional training fields inherit the exact same hardware-aware defaults as actuator train:

  • SFT LoRA / QLoRA: r: 16, alpha: 16 (alpha/r = 1.0), dropout: 0.0, targets: all-linear, effective batch 8, learning_rate: 2e-4, lr_scheduler_type: cosine, weight_decay: 0.01, max_length: 2048.
  • Full Fine-Tuning (--full-finetuning): No lora: block, learning_rate: 2e-5, weight_decay: 0.01.
  • Preference Alignment (DPO / KTO / ORPO): learning_rate: 1e-5 (5e-6 for 2+ epochs), beta: 0.1, effective batch 8, epochs: 1–2.
  • GRPO / RL: max_length: 2048 (completion tokens), learning_rate: 5e-6, enable_thinking: false on short math/tool tasks unless enabled explicitly.
  • Checkpointing: Rolling checkpoints are enabled by default (save_total_limit: 2), so canceling or losing power never discards a run.

4. Clean YAML Recipe Anatomy

run:
  id: qwen3-8b-domain
  seed: 42

model: Qwen/Qwen3-8B
quantization: nf4            # omit for bf16 LoRA; use affine4 on Apple Silicon MLX

lora:
  r: 16
  alpha: 16
  dropout: 0.0
  targets: all-linear        # or explicit list: [q_proj, k_proj, v_proj, o_proj]

transform:
  kind: sft                  # sft | dpo | kto | orpo | grpo | distill
  dataset: my-data.jsonl     # local file or Hugging Face dataset ID

budget:
  epochs: 1                  # or steps: 500

training:
  engine: actuator           # actuator | unsloth | trl | mlx
  learning_rate: 2e-4
  lr_scheduler_type: cosine
  warmup_ratio: 0.05
  weight_decay: 0.01
  max_length: 2048
  per_device_train_batch_size: 2
  gradient_accumulation_steps: 4
  optim: paged_adamw_8bit
  gradient_checkpointing: true
  padding_free: true
  save_steps: 100
  save_total_limit: 2

eval:
  mode: fast                 # fast | strict | judge:<model> | none
  heldout_fraction: 0.1
  generation_samples: 8
  canary: false
  strict_gate: false

export:
  format: adapter            # adapter (default, <1s) | merged (full 16-bit)

report: runs/qwen3-8b-domain/

Direct Library Escape Hatches

Need a specialized Hugging Face, PEFT, TRL, or engine parameter? Pass it directly without waiting for a wrapper flag:

trainer_args:
  neftune_noise_alpha: 5.0
lora_args:
  use_rslora: true
  use_dora: false
model_args:
  rope_scaling:
    type: dynamic
    factor: 2.0
engine_args:
  fused_lora: true
  fused_norm: true
  fused_loss: true
  compile_layers: true

5. Swapping Engines (--engine)

Every engine runs the same data pipeline, split, and Verdict:

Engine Best for Notes
actuator (default on CUDA) Single GPU and multi-GPU FSDP2 across any HF architecture Model-agnostic Triton fused LoRA, NF4 decode, RMSNorm, chunked cross-entropy with Gemma logit softcapping, and compiled layers
unsloth Drop-in comparison or Unsloth-specific workflows Supports both text (FastLanguageModel) and vision (FastVisionModel); requires pip install "actuator-train[unsloth] @ git+https://github.com/IluvatarLabs/actuator.git"
trl Stock Hugging Face TRL reference baseline Zero custom kernels; ideal for verifying numerical equivalence
mlx Apple Silicon Macs (Apple M1–Apple M4) Native mlx-lm / mlx-lm-lora training and native mlx_lm held-out scoring

Switch engines from the CLI with one flag:

actuator train my-data.jsonl --model Qwen/Qwen3-4B --engine unsloth

6. Multi-GPU Training (DDP & FSDP2)

Scale any run across multiple GPUs with --gpus N:

actuator train my-data.jsonl --model meta-llama/Llama-3.3-70B-Instruct --low-memory --gpus 4

Actuator chooses DDP when the model fits on one GPU and FSDP2 sharding when it spans multiple GPUs, keeping per-module Triton kernels (FusedLoraLinear, fused_loss, fused_norm, fast_attention) active under FSDP2. See sft/llama3.3-70b-fsdp2-qlora.yaml.


7. Optional ML-Native Closed-Loop Control

Closed-loop control is strictly optional (omit the control: block completely for plain training) and uses direct PyTorch/TRL hooks with zero calibration passes:

control:
  safety:
    nan_guard: true          # detects NaN/Inf gradients before optimizer step
    zclip: true              # EMA z-score adaptive gradient clipping
    rollback_on_spike: true  # reloads last healthy rolling checkpoint on sustained loss spikes
  preserve_kl:
    beta: 0.05               # live-batch KL anchor via disable_adapter() (no separate ref model)
    every_steps: 4
  replay_mix: 0.1            # optional general-instruct replay ratio to prevent forgetting
  adaptive_kl:
    target: 0.06             # multiplicative dual update (PPO/TRL pattern)
    factor: 1.25
    bounds: [0.01, 0.4]
  early_stop:
    patience: 3              # stop or decay LR on dev-loss plateau, keeping best checkpoint

From the CLI, enable preservation with a single flag:

actuator train domain-qa.jsonl --model Qwen/Qwen3-4B --preserve-kl 0.05 --replay-mix 0.1 --canary