nodus.recipes.finetune
View MarkdownFine-tuning, preference training, distillation and pretraining recipes on the catalog runtimes.
Each function returns a TrainingJob builder; nothing runs until .preview() or .run(gpu=…, max_cost=…).
Keyword arguments not named here are runtime parameters in snake_case (learning_rate=1e-5 is
parameters.learningRate), validated by the server against the runtime’s schema.
sft = finetune.sft(model="Qwen/Qwen3-1.7B", data=nodus.Volume.from_name("support-chats"), lora=finetune.LoRA(r=16), max_steps=2000).run(gpu="H100", max_cost=20)pt = finetune.pretrain(model="Qwen/Qwen3-0.6B", data=corpus, initialization="Scratch")big = finetune.sft(model=m, data=d, distributed="ZeRO3").run(gpu="H100:8", nodes=2, max_cost=200)Exports
Section titled “Exports”Data: import withfrom nodus.recipes.finetune import DataLoRA: import withfrom nodus.recipes.finetune import LoRA
distill
Section titled “distill”distill(*, student: Any, teacher: Any, data: Any, temperature: float | None = None, alpha: float | None = None, lmbda: float | None = None, **params: Any) -> AnyKnowledge distillation from a teacher model (distill); lmbda=0 is offline KD on the dataset’s text.
dpo(*, model: Any, data: Any, beta: float | None = None, **params: Any) -> AnyDirect preference optimisation on prompt, chosen and rejected rows (dpo).
kto(*, model: Any, data: Any, beta: float | None = None, **params: Any) -> AnyKTO on prompt, completion and a boolean label (kto).
orpo(*, model: Any, data: Any, beta: float | None = None, **params: Any) -> AnyOdds-ratio preference optimisation, no reference model (orpo).
pretrain
Section titled “pretrain”pretrain(*, model: Any, data: Any, initialization: str = 'Continued', packing: bool = True, append_eos: bool | None = None, **params: Any) -> AnyCausal-LM pretraining on raw text (sft, task: Pretrain).
initialization="Continued" keeps the model’s weights; "Scratch" uses only its config and tokenizer
(optionally resized by architecture={...}) and starts from random weights.
append_eos=False preserves corpus boundaries instead of appending EOS to each text row. Omit it to
retain the runtime’s default. Validation and packing still use the runtime’s parameters.
reward
Section titled “reward”reward(*, model: Any, data: Any, **params: Any) -> AnyA reward model from chosen and rejected pairs (reward-model).
sft(*, model: Any, data: Any, lora: LoRA | None = None, max_steps: int | None = None, **params: Any) -> AnySupervised fine-tuning on prompt and completion (or chat messages) rows (sft).