Fine-tuning

Updated at:

Bailian CLI command reference for creating and managing text, audio, image, and video fine-tuning jobs.

Manage the full fine-tuning lifecycle from the terminal: choose the create command for text, audio, image, or video, and manage jobs, checkpoints, and model compression.

ImportantAppend --help to any command for full parameter details, e.g. bl finetune list --help. Command details on this page are verified against bl 2.8.4.

Choose a command by modality

ModalityCreate commandDescription
Textbl finetune text createFine-tune text models with sft, sft-lora, dpo, dpo-lora, or cpt
Audiobl finetune audio createFine-tune audio models
Imagebl finetune image createFine-tune image generation models
Videobl finetune video createFine-tune video generation models

Text fine-tuning

bl finetune text create

Create a text model fine-tune job (sft | sft-lora | dpo | dpo-lora | cpt). Requires API Key authentication.

Usage

bl finetune text create
ParameterTypeRequiredDescription
--base-model <model>stringyesBase model to fine-tune (e.g. qwen3-8b; not the output model name)
--datasets <ids|paths>stringyesComma-separated dataset file IDs or local paths (.jsonl for text, .zip for audio/image/video). Local paths are uploaded (validated) first, then their file-ids are used.
--validations <ids|paths>stringnoComma-separated validation dataset file IDs or local paths (auto-uploaded like --datasets).
--model-name <name>stringnoOutput model name (after training)
--suffix <text>stringnoOutput suffix appended by the platform (finetuned_output_suffix)
--job-name <value>stringnoTraining job display name (job_name)
--priority <value>stringnoRequested scheduling priority; verify the service response
--eval-steps <value>numbernoValidation interval in training steps
--lora-alpha <value>numbernoLoRA scaling coefficient
--lora-dropout <value>numbernoLoRA dropout probability
--lora-rank <value>numbernoLoRA matrix rank
--lr-scheduler-type <value>stringnoLearning rate scheduler supported by the selected model
--save-strategy <value>stringnoCheckpoint saving strategy
--save-total-limit <value>numbernoMaximum number of saved checkpoints
--save-steps <value>numbernoCheckpoint saving interval for strategy=steps
--split <value>numbernoTraining fraction when no validation dataset is supplied
--max-split-val-dataset-sample <value>numbernoMaximum automatically split validation samples
--data-augmentation <value>stringnoMix platform training data (true or false)
--training-type <t>stringnoTraining type: sft | sft-lora | dpo | dpo-lora | cpt (default: sft-lora). Mapping to the server happens at the interface boundary (e.g. sft-lora -> efficient_sft, dpo -> dpo_full).
--n-epochs <n>numbernoNumber of epochs (default: 3)
--batch-size <n>numbernoPer-device batch size (clamped to [8, 1024]). Auto-set to 8 for small datasets (<100KB)
--learning-rate <str>stringnoLearning rate as a string to preserve precision (e.g. "1.6e-5")
--max-length <n>numbernoMax sequence length

Example: Create a text fine-tune job with base model and dataset

bl finetune text create --base-model qwen3-8b --datasets file-xxx
  • Training-type values use the <method> / <method>-lora convention: sft (full) | sft-lora (LoRA) | dpo (full) | dpo-lora (LoRA) | cpt. These map to the server's training_type at the interface boundary, so the rest of the CLI never sees the raw server strings.
  • Before submitting (non dry-run) the job, the model's training capability is checked via listFoundationModels (no console login required); an unsupported training type fails fast with the list the model actually supports.
  • n_epochs defaults to 3. Other hyper-parameters are platform defaults unless set.
  • Learning rate is forwarded as a string to avoid JSON-number precision loss.
  • Pre-submit gate: if the training dataset's sample count is not greater than batch_size, the job is rejected before upload or quota consumption (the platform would otherwise fail ~10 min in, after data processing).

Audio fine-tuning

bl finetune audio create

Create an audio TTS model fine-tune job (sft-lora). Requires API Key authentication.

Usage

bl finetune audio create
ParameterTypeRequiredDescription
--base-model <model>stringyesBase model to fine-tune (e.g. qwen3-8b; not the output model name)
--datasets <ids|paths>stringyesComma-separated dataset file IDs or local paths (.jsonl for text, .zip for audio/image/video). Local paths are uploaded (validated) first, then their file-ids are used.
--validations <ids|paths>stringnoComma-separated validation dataset file IDs or local paths (auto-uploaded like --datasets).
--model-name <name>stringnoOutput model name (after training)
--suffix <text>stringnoOutput suffix appended by the platform (finetuned_output_suffix)

Example: Create an audio TTS fine-tune job with base model and local zip dataset

bl finetune audio create --base-model cosyvoice-v3-flash --datasets ./audio.zip
  • Audio TTS training runs sft-lora (efficient_sft) with fixed CosyVoice hyper-parameter defaults; there are no training-type or hyper-parameter knobs to set.

Image fine-tuning

bl finetune image create

Create an image generation model fine-tune job (sft-lora). Requires API Key authentication.

Usage

bl finetune image create
ParameterTypeRequiredDescription
--base-model <model>stringyesBase model to fine-tune (e.g. qwen3-8b; not the output model name)
--datasets <ids|paths>stringyesComma-separated dataset file IDs or local paths (.jsonl for text, .zip for audio/image/video). Local paths are uploaded (validated) first, then their file-ids are used.
--validations <ids|paths>stringnoComma-separated validation dataset file IDs or local paths (auto-uploaded like --datasets).
--model-name <name>stringnoOutput model name (after training)
--suffix <text>stringnoOutput suffix appended by the platform (finetuned_output_suffix)
--generation-type <t2i|i2i>stringnoGeneration type: t2i (default) | i2i. Sets generation_type/max_pixels. Required to train I2I from a file-id or with --dry-run (local data auto-detects input_img).
--learning-rate <str>stringnoLearning rate as a string to preserve precision (e.g. "3e-5")

Example: Create an image generation fine-tune job with base model and local zip dataset

bl finetune image create --base-model wan2.7-image-pro --datasets ./images.zip
  • Image generation training runs sft-lora (efficient_sft) with fixed defaults; only --learning-rate is overridable. T2I vs I2I is declared with --generation-type (default t2i), which sets generation_type/max_pixels. For local data the type is auto-detected (records with input_img train I2I); pass --generation-type explicitly to train I2I from a file-id or in --dry-run.

Video fine-tuning

bl finetune video create

Create a video generation model fine-tune job (Wan i2v/kf2v, efficient_sft). Requires API Key authentication.

Usage

bl finetune video create
ParameterTypeRequiredDescription
--base-model <model>stringyesBase model to fine-tune (e.g. qwen3-8b; not the output model name)
--datasets <ids|paths>stringyesComma-separated dataset file IDs or local paths (.jsonl for text, .zip for audio/image/video). Local paths are uploaded (validated) first, then their file-ids are used.
--validations <ids|paths>stringnoComma-separated validation dataset file IDs or local paths (auto-uploaded like --datasets).
--model-name <name>stringnoOutput model name (after training)
--suffix <text>stringnoOutput suffix appended by the platform (finetuned_output_suffix)
--n-epochs <n>numbernoTraining epochs (default: 50)
--batch-size <n>numbernoBatch size (default: model-specific, 1 for wan2.7, 4 for wan2.5/2.2)
--learning-rate <str>stringnoLearning rate as a string to preserve precision (default: "2e-5")

Example: Create a video generation fine-tune job with base model and dataset ID

bl finetune video create --base-model wan2.7-i2v --datasets file-xxx
  • Video generation training (Wan i2v/kf2v) runs efficient_sft with model-specific defaults: wan2.7 (batch_size=1, max_pixels=102400), wan2.5/2.2 (batch_size=4, max_pixels per model). Override with --batch-size/--n-epochs.
  • Datasets are .zip archives with data.jsonl + frame images + videos.
  • Recommended: ≥10 training samples, 20-100 for stable results.

Fine-tuning job management

bl finetune list

List fine-tune jobs. Requires API Key authentication.

Usage

bl finetune list [--page <n>] [--page-size <n>] [--status <s>] [--base-model <model>]
ParameterTypeRequiredDescription
--page <n>numbernoPage number (default: 1)
--page-size <n>numbernoResults per page (default: 10, max 100)
--status <s>stringnoFilter by status (PENDING / RUNNING / SUCCEEDED / FAILED / CANCELED)
--base-model <model>stringnoFilter by base model ID (server-side)

Example: List fine-tune jobs filtered by status

bl finetune list --status RUNNING

bl finetune get

Get details of a single fine-tune job. Requires API Key authentication.

Usage

bl finetune get --job-id <id>
ParameterTypeRequiredDescription
--job-id <id>stringyesFine-tune job ID

Example: Get details of a specific fine-tune job by ID

bl finetune get --job-id ft-xxx

bl finetune watch

Probe a fine-tune job's status (default: single non-blocking fetch). Pass --follow to poll until terminal. Requires API Key authentication.

Usage

bl finetune watch --job-id <id> [--follow] [--interval <sec>] [--poll-timeout <sec>]
ParameterTypeRequiredDescription
--job-id <id>stringyesFine-tune job ID
--followswitchnoBlock and poll until a terminal state (the legacy behavior). Without it, a single status probe is performed and the command returns immediately.
--interval <sec>numbernoSeconds between polls with --follow (default: ${DEFAULT_INTERVAL_SEC}, min: ${MIN_INTERVAL_SEC}). Ignored without --follow.
--poll-timeout <sec>numbernoWith --follow, stop polling after this many seconds (default: no limit). Ignored without --follow.

Example: Probe a fine-tune job's status once and return immediately

bl finetune watch --job-id ft-xxx                       # single probe, returns immediately
  • Default (no --follow) is a NON-BLOCKING single status probe: one fetch, then return immediately. This is the mode meant for agents / scripts — the caller owns the polling cadence, so the CLI never holds the terminal.
  • A terminal FAILED/CANCELED status raises a normal CLI error (non-zero exit); a SUCCEEDED or still-running status returns 0. With --follow, exceeding --poll-timeout raises a timeout error.
  • Use --follow for the blocking, human-terminal-follow experience; use the default mode when driving the loop yourself (e.g. from an agent).
  • For per-step training output (not status), use finetune logs.

bl finetune logs

Fetch training logs for a fine-tune job. Requires API Key authentication.

Usage

bl finetune logs --job-id <id> [--page <n>] [--page-size <n>] [--search <keyword>] [--tail <n>]
ParameterTypeRequiredDescription
--job-id <id>stringyesFine-tune job ID
--page <n>numbernoPage number (default: 1)
--page-size <n>numbernoLines per page (default: server-defined)
--search <keyword>stringnoCase-insensitive substring filter. When set, all log pages are fetched and filtered client-side (--page is ignored).
--tail <n>numbernoKeep only the last N entries. When set, all log pages are fetched and the trailing N are kept (--page is ignored).

Example: Fetch training logs for a fine-tune job by ID

bl finetune logs --job-id ft-xxx

bl finetune metrics

Query the training metrics of a fine-tune job. Requires API Key authentication.

Usage

bl finetune metrics --job-id <id> [--page <n>] [--page-size <n>] [--workspace-id <id>]
ParameterTypeRequiredDescription
--job-id <id>stringyesFine-tune job ID
--page <n>numbernoPage number, starting at 1 (default: 1)
--page-size <n>numbernoRecords per page (default: 100)
--workspace-id <id>stringnoWorkspace ID sent as X-DashScope-WorkSpace; use the job's owning workspace. Omit when your API key is already workspace-bound.

Example: Query the training metrics of a fine-tune job

bl finetune metrics --job-id ft-xxx
  • Queries GET /api/v1/fine-tunes/{job_id}/basic_metrics. Each metrics record is returned verbatim (step plus dynamic metric fields); an empty list is a normal result.
  • Metrics are not filtered server-side; the full result is returned and callers pick the metric keys from each record. Use --page/--page-size for paging.

bl finetune checkpoints

List checkpoints produced by a fine-tune job. Requires API Key authentication.

Usage

bl finetune checkpoints --job-id <id>
ParameterTypeRequiredDescription
--job-id <id>stringyesFine-tune job ID

Example: List checkpoints from a fine-tune job by ID

bl finetune checkpoints --job-id ft-xxx
  • model_name (shown for SUCCEEDED checkpoints) is the direct input for deploy create --model-name.
  • Checkpoints expire ~15 days after creation; expire_time shows the deadline. Export or deploy before expiry.

bl finetune export

Publish a checkpoint as a deployable model. Requires API Key authentication.

Usage

bl finetune export --job-id <id> --checkpoint <name> --model-name <name>
ParameterTypeRequiredDescription
--job-id <id>stringyesFine-tune job ID
--checkpoint <name>stringyesCheckpoint identifier from finetune checkpoints
--model-name <name>stringyesDeployable model name

Example: Publish a checkpoint as a deployable model with a name

bl finetune export --job-id ft-xxx --checkpoint ckpt-3 --model-name my-qwen-sft
  • Required before deploy <modality> create can target a checkpoint. The platform may auto-export the best checkpoint when a job reaches SUCCEEDED — explicit export is the canonical path for non-best checkpoints.

bl finetune cancel

Cancel a running fine-tune job. Requires API Key authentication.

Usage

bl finetune cancel --job-id <id>
ParameterTypeRequiredDescription
--job-id <id>stringyesFine-tune job ID

Example: Cancel a fine-tune job by ID

bl finetune cancel --job-id ft-xxx
  • Only PENDING / RUNNING jobs can be cancelled. Completed / failed / already-cancelled jobs return a server-side error (passed through verbatim).

bl finetune delete

Delete a fine-tune job record. Requires API Key authentication.

Usage

bl finetune delete --job-id <id>
ParameterTypeRequiredDescription
--job-id <id>stringyesFine-tune job ID
--yesswitchnoConfirm this high-risk operation

WarningThis permanently deletes the specified fine-tune job record and cannot be undone.

Example: Delete a fine-tune job record by ID

bl finetune delete --job-id ft-xxx
  • Irreversible — the job record is permanently removed.
  • Cancel a RUNNING job first via finetune cancel — the platform refuses to delete jobs that are still in flight.

bl finetune capability

Query fine-tune training capability — by model (which training types it supports) or by training type (which models support it). No authentication required.

Usage

bl finetune capability --base-model <m> | --training-type <t>
ParameterTypeRequiredDescription
--base-model <m>stringnoList training types supported by this base model.
--training-type <t>stringnoList models supporting this training type: sft | sft-lora | dpo | dpo-lora | cpt.

Example: List training types supported by base model qwen3-8b

bl finetune capability --base-model qwen3-8b
  • Exactly one of --base-model / --training-type is required.
  • Training-type values use the <method> / <method>-lora convention: sft | sft-lora | dpo | dpo-lora | cpt. (cpt has no -lora variant server-side.)
  • Queries listFoundationModels, a public API — no console login needed.

bl finetune params

Query the training hyper-parameter configuration for a base model. Requires API Key authentication.

Usage

bl finetune params --base-model <model> [--training-type <t>] [--param-type <hyper|resource>] [--mtu-spec-code <code>] [--modality <text|vision>] [--reasoning-mode <instruct|thinking>] [--lang <locale>] [--workspace-id <id>]
ParameterTypeRequiredDescription
--base-model <model>stringyesBase model to query training parameters for (e.g. qwen3-8b)
--training-type <t>stringnoTraining type: sft | sft-lora | dpo | dpo-lora | cpt (default: sft-lora). Mapped to the server's training_type (e.g. sft-lora -> efficient_sft).
--mtu-spec-code <code>stringnoMTU spec code, required for resource-group queries (e.g. MTU2)
--param-type <hyper|resource>stringnoParameter group: hyper | resource. Omit to return all groups.
--modality <text|vision>stringnoTraining modality: text | vision. Only meaningful for models with dynamic train options; sent as modality inside hyper_parameters.
--reasoning-mode <instruct|thinking>stringnoReasoning mode: instruct (non-thinking) | thinking. Only meaningful for models with dynamic train options; sent as reasoning_mode inside hyper_parameters.
--lang <locale>stringnoLocale for server-side display text (e.g. en, zh). Omit for the server default.
--workspace-id <id>stringnoWorkspace ID sent as X-DashScope-WorkSpace; omit when your API key is already workspace-bound.

Example: Query training hyper-parameters for a base model

bl finetune params --base-model qwen3-8b

Example: Query dynamic training options

bl finetune params --base-model qwen3.7-plus-2026-05-26 --modality vision --reasoning-mode thinking
  • Queries GET /api/v1/fine-tunes/fine-tunes-params. Each hyper_params entry keeps server field names verbatim (recommend_value, defaultValue, is_advanced_parameter, ...).
  • --modality / --reasoning-mode travel as one hyper_parameters query parameter (JSON). Supported values and combinations vary per model; invalid combinations are rejected by the server and surfaced as-is. Models without dynamic train options ignore these flags.
  • resume_from_checkpoint in the output reports whether the training type supports resuming training.

bl finetune price

Estimate the training cost for a fine-tune job (token billing).

Usage

bl finetune price --base-model <model> --datasets <ids> [--training-type <type>] [--n-epochs <n>]
ParameterTypeRequiredDescription
--base-model <model>stringyesBase model to fine-tune (e.g. qwen3-8b; not the output model name)
--datasets <ids>stringyesTraining dataset file IDs, comma-separated
--training-type <type>stringnoTraining type: sft | dpo | cpt (default: sft)
--n-epochs <n>numbernoNumber of training epochs (default: 3)

Example: Estimate training cost for datasets using base model qwen3-8b

bl finetune price --base-model qwen3-8b --datasets file-ft-xxx
  • Estimate only — the server computes token usage from the datasets; final cost is subject to the bill.
  • Covers token billing for sft / dpo / cpt. Training-unit (MTU) billing is not supported by this command.
  • Hyper-parameters other than --n-epochs are fixed at representative defaults for estimation.

Model compression

Model compression quantizes supported full-parameter fine-tuned models. Run templates to find a compatible template, then create a compression job. On success, the returned quantized_output can be passed to deploy text create --model-name. Model compression APIs are currently available only in the Beijing region.

bl finetune compress templates

List quantizable models and their compression templates. Requires API Key authentication.

Usage

bl finetune compress templates [--model <model>]
ParameterTypeRequiredDescription
--model <model>stringnoFilter by custom model ID or base model name

Example: List supported models and templates

bl finetune compress templates
  • Only supported full-parameter fine-tuned models are returned. LoRA and already-quantized models are excluded.
  • Template IDs live in output.custom_models[].templates[].template_id. output.base_models only lists quantizable base model names and carries no templates.
  • An empty templates[].hyper_parameters array means the template exposes no tunable hyper-parameters; omit --hparam when creating the job.

bl finetune compress create

Create a model compression job. Requires API Key authentication.

Usage

bl finetune compress create --model <model> --template-id <id> [flags]
ParameterTypeRequiredDescription
--model <model>stringyesSource custom model ID
--template-id <id>stringyesCompression template ID
--job-name <name>stringnoUnique job name (max 50 characters)
--description <text>stringnoJob description (max 200 characters)
--hparam <key=value>arraynoHyper-parameter override; repeat for multiple values
--calibration-files <file-id,...>stringnoComma-separated calibration dataset file IDs
--suffix <suffix>stringnoOutput model suffix (1-8 lowercase letters or digits)

Example: Create a compression job with a specific template

bl finetune compress create --model qwen3.5-flash-2026-02-23-ft-xxx --template-id quant-flash-nvfp4-mlp-nomtp

bl finetune compress list

List model compression jobs. Requires API Key authentication.

Usage

bl finetune compress list [filters] [--page <n>] [--page-size <n>]
ParameterTypeRequiredDescription
--status <status>stringnoFilter by job status
--model <model>stringnoFilter by source model ID
--template-id <id>stringnoFilter by template ID
--quant-spec <spec>stringnoFilter by quantization specification
--quant-method <method>stringnoFilter by quantization method
--start-time <time>stringnoFilter jobs starting no earlier than this time
--end-time <time>stringnoFilter jobs ending no later than this time
--search <keyword>stringnoSearch job ID or name
--search-field <job_id|job_name>stringnoLimit --search to job_id or job_name
--sort-order <asc|desc>stringnoSort order by create_time (default: desc)
--page <n>numbernoPage number (default: 1)
--page-size <n>numbernoResults per page (default: 10, max: 100)

Example: List recently succeeded compression jobs

bl finetune compress list --status SUCCEEDED --page-size 20

bl finetune compress get

Get a compression job. Requires API Key authentication.

Usage

bl finetune compress get --job-id <id>
ParameterTypeRequiredDescription
--job-id <id>stringyesCompression job ID

Example: Get a specific compression job

bl finetune compress get --job-id quant-xxx

bl finetune compress watch

Probe or follow a compression job's status. Requires API Key authentication.

Usage

bl finetune compress watch --job-id <id> [--follow] [--interval <sec>] [--poll-timeout <sec>]
ParameterTypeRequiredDescription
--job-id <id>stringyesCompression job ID
--followswitchnoPoll until the job reaches a terminal state
--interval <sec>numbernoPolling interval with --follow (default: 10, min: 1)
--poll-timeout <sec>numbernoStop polling after this many seconds

Example: Follow a compression job until it finishes

bl finetune compress watch --job-id quant-xxx --follow
  • Without --follow, the command performs one non-blocking status probe.
  • On success, quantized_output can be passed to deploy text create --model-name.

bl finetune compress logs

Get compression job logs. Requires API Key authentication.

Usage

bl finetune compress logs --job-id <id> [--offset <n>] [--lines <n> | --tail <n>]
ParameterTypeRequiredDescription
--job-id <id>stringyesCompression job ID
--offset <n>numbernoSkip the first N lines (default: 0)
--lines <n>numbernoNumber of lines to read (default: 100, max: 1000)
--tail <n>numbernoRead the last N log lines

Example: Read the last 20 lines of compression logs

bl finetune compress logs --job-id quant-xxx --tail 20

bl finetune compress cancel

Cancel a compression job. Requires API Key authentication.

Usage

bl finetune compress cancel --job-id <id>
ParameterTypeRequiredDescription
--job-id <id>stringyesCompression job ID

Example: Cancel a compression job

bl finetune compress cancel --job-id quant-xxx
  • Only PENDING, QUEUING, or RUNNING jobs can be cancelled.

bl finetune compress delete

Delete a compression job record. Requires API Key authentication.

Usage

bl finetune compress delete --job-id <id>
ParameterTypeRequiredDescription
--job-id <id>stringyesCompression job ID
--yesswitchnoConfirm this high-risk operation

WarningThis permanently deletes the compression job record and cannot be undone.

Example: Preview deleting a compression job record

bl finetune compress delete --job-id quant-xxx --dry-run
  • Only terminal jobs can be deleted. Deleting a job record does not delete its quantized output model.