API reference · Schema
CreateFineTuneRequest
modelstringrequiredA fine-tunable base model (GET /v1/fine-tunes/base-models): slug or ID
1–200 characters
training_file_idstringrequiredID of the training file
ID with prefix file_
validation_file_idstring | nullID of the validation file
ID with prefix file_
methodFineTuneMethodDefault supervised
adapterFineTuneAdapterDefault LoRA
hyperparametersFineTuneHyperparametersShowHide 11 fields of
hyperparametersepochsintegerDefault 1
1–20
batch_sizeintegerDefault 8
1–256
gradient_accumulation_stepsintegerBatches accumulated per optimizer step (default 1)
1–64
learning_ratenumberDefault 0.0001
1e-7–0.01
lr_schedulerstringHow the learning rate changes over the run (default linear)
One of
linearcosineconstantwarmup_rationumberShare of the steps over which the learning rate ramps up from 0 (default 0)
0–0.5
weight_decaynumberWeight decay (default 0)
0–1
max_grad_normnumberGradients are clipped to this norm (default 1)
0–100
max_seq_lengthintegerLonger examples are truncated (default: the model limit, up to 2048)
32–131072
max_stepsinteger | nullStop after this many optimizer steps, whatever `epochs` says; null or omitted: no step limit
1–1000000
seedintegerRandom seed, for repeatable runs (default 42)
0–2147483647
evaluationobjectEvaluations per epoch on the validation file (default 1)
ShowHide 1 field of
evaluationevals_per_epochintegerTimes per epoch the validation file is evaluated, 0–20 (default 1); evaluation tokens are billed
0–20
early_stoppingobject | nullStop when evaluation loss has not improved for `patience` evaluations
ShowHide 2 fields of
early_stoppingpatienceintegerEvaluations in a row without improvement before training stops (default 2)
1–50
min_deltanumberSmallest drop in evaluation loss that counts as an improvement (default 0)
0–10
checkpointsintegerCheckpoints saved over the run, the final one included (default 1)
1–10
merge_weightsbooleanLoRA: also produce merged full weights (default true)
continue_from_checkpoint_idstring | nullContinue training from a checkpoint of an earlier job
ID with prefix ftc_
suffixstring | nullLowercase letters, digits and dashes; part of the result model name
1–40 characters
hardwareobjectWhere the job trains: `sku` (default: the base model's first listed SKU) and, for a GPU SKU, `gpu_count` (1–8, default 1; 0 for a CPU SKU). Training is billed per token whatever the hardware.
ShowHide 2 fields of
hardwareskustringHardware type code
1–64 characters
gpu_countintegerNumber of GPUs
0–8
integrationsFineTuneIntegrationsShowHide 2 fields of
integrationswandbobjectLog training to Weights & Biases (the key is a project secret)
ShowHide 5 fields of
wandbapi_key_secret_idstringrequiredID of the api key secret
ID with prefix sec_
projectstringrequiredThe Weights & Biases project to log to
1–128 characters
entitystringTeam or user that owns the project; default: the key owner
1–128 characters
run_namestringName of the run; default: the job ID
1–128 characters
base_urlstring (uri)A self-hosted Weights & Biases server; default: the public service
up to 512 characters
hugging_faceobjectUpload the result to the Hugging Face Hub (the token is a project secret)
ShowHide 4 fields of
hugging_facetoken_secret_idstringrequiredID of the token secret
ID with prefix sec_
repositorystringrequiredThe model repository to upload to, as `<namespace>/<name>`
3–193 characters
privatebooleanCreate the repository as private when it does not exist yet (default true); an existing repository keeps its visibility
artifactstringWhat to upload: the LoRA `adapter` (default) or the `merged` full weights
One of
adaptermerged
{
"model": "HuggingFaceTB/SmolLM2-135M-Instruct",
"training_file_id": "file_01jc5zq4m8k3v6x9t2w7r0b1e4",
"method": {
"type": "supervised"
},
"adapter": {
"type": "lora",
"rank": 8
},
"hyperparameters": {
"epochs": 2,
"learning_rate": 0.0002
}
}Used by
- Create a fine-tuning job (reserves its estimated cost; 402 when credit is short)
POST /v1/fine-tunes