Fine-tuning
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. Existing commands on this page are verified against bl 2.8.4; RL, OPD, and runtime management commands are verified against bl 2.10.4.
Choose a command by modality
| Modality | Create command | Description |
|---|---|---|
| Text | bl finetune text create | Fine-tune text models with sft, sft-lora, dpo, dpo-lora, or cpt |
| Audio | bl finetune audio create | Fine-tune audio models |
| Image | bl finetune image create | Fine-tune image generation models |
| Video | bl finetune video create | Fine-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
| Parameter | Type | Required | Description |
|---|---|---|---|
--base-model <model> | string | yes | Base model to fine-tune (e.g. qwen3-8b; not the output model name) |
--datasets <ids|paths|oss://...> | string | yes | Comma-separated dataset file IDs, local paths (.jsonl), or OSS mounts (oss://<bucket>/<object key>). Local paths are validated and uploaded first, then their file-ids are used; OSS mounts are read in place by the service without local validation or upload. |
--validations <ids|paths|oss://...> | string | no | Comma-separated validation dataset file IDs, local paths, or OSS mounts (oss://<bucket>/<object key>), handled like --datasets. |
--model-name <name> | string | no | Output model name (after training) |
--suffix <text> | string | no | Output suffix appended by the platform (finetuned_output_suffix) |
--oss-region <region> | string | no | Region ID of the OSS buckets mounted by the oss:// entries of --datasets / --validations (default: cn-beijing); forwarded as given, whether the service can mount from it is judged by the service. |
--job-name <value> | string | no | Training job display name (job_name) |
--priority <value> | string | no | Requested scheduling priority; verify the service response |
--eval-steps <value> | number | no | Validation interval in training steps |
--lora-alpha <value> | number | no | LoRA scaling coefficient |
--lora-dropout <value> | number | no | LoRA dropout probability |
--lora-rank <value> | number | no | LoRA matrix rank |
--lr-scheduler-type <value> | string | no | Learning rate scheduler supported by the selected model |
--save-strategy <value> | string | no | Checkpoint saving strategy |
--save-total-limit <value> | number | no | Maximum number of saved checkpoints |
--save-steps <value> | number | no | Checkpoint saving interval for strategy=steps |
--split <value> | number | no | Training fraction when no validation dataset is supplied |
--max-split-val-dataset-sample <value> | number | no | Maximum automatically split validation samples |
--data-augmentation <value> | string | no | Mix platform preset training data into the job (true or false). Only honored for sft and sft-lora; turned on automatically by --augmentation-types. |
--augmentation-types <code,...> | string | no | Preset datasets to mix in, comma-separated. Codes come from bl finetune preset-datasets and are sent lowercased (e.g. mix_V2 -> mix_v2). Requires --augmentation-ratio. |
--augmentation-ratio <r,...> | string | no | Mix ratio per preset dataset, comma-separated and positionally matching --augmentation-types; each is 0.0–2.0 of the training data volume. |
--training-type <t> | string | no | Training 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> | number | no | Number of epochs (default: 3) |
--batch-size <n> | number | no | Per-device batch size (clamped to [8, 1024]). Auto-set to 8 for small datasets (<100KB) |
--learning-rate <str> | string | no | Learning rate as a string to preserve precision (e.g. "1.6e-5") |
--max-length <n> | number | no | Max 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>-loraconvention: 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.
- The create API requires
n_epochs,batch_size, andmax_length: an omitted one is filled from the model's parameter defaults (query them withbl finetune params); every other omitted value uses the platform default. - 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).
- Mixed training:
--data-augmentationturns it on;--augmentation-typesselects preset datasets (list them withbl finetune preset-datasets; codes are sent lowercased, e.g. mix_V2 -> mix_v2) and--augmentation-ratiogives one ratio (0.0–2.0) per type, positionally. Passing types turns data_augmentation on. These three are documented on the create API but absent from the model's parameter schema, so they are not part of the schema check; whether the selected model and training type honors them is decided by the server (documented for sft and sft-lora), and mixed data is billed as training tokens. - OSS mount: an
oss://<bucket>/<object key>entry of--datasets/--validationsis read in place, so it skips local validation, upload, and the sample-count pre-check. Upload the uncompressed dataset folder to OSS as-is (a zip cannot be mounted) and, for a multi-file dataset, point at its data.jsonl. Everyoss://entry shares--oss-region. A request with an OSS mount sendstraining_datasets/validation_datasetsinstead oftraining_file_ids/validation_file_ids.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
--base-model <model> | string | yes | Base model to fine-tune (e.g. qwen3-8b; not the output model name) |
--datasets <ids|paths> | string | yes | Comma-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> | string | no | Comma-separated validation dataset file IDs or local paths (auto-uploaded like --datasets). |
--model-name <name> | string | no | Output model name (after training) |
--suffix <text> | string | no | Output 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
| Parameter | Type | Required | Description |
|---|---|---|---|
--base-model <model> | string | yes | Base model to fine-tune (e.g. qwen3-8b; not the output model name) |
--datasets <ids|paths> | string | yes | Comma-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> | string | no | Comma-separated validation dataset file IDs or local paths (auto-uploaded like --datasets). |
--model-name <name> | string | no | Output model name (after training) |
--suffix <text> | string | no | Output suffix appended by the platform (finetuned_output_suffix) |
--generation-type <t2i|i2i> | string | no | Generation 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> | string | no | Learning 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
| Parameter | Type | Required | Description |
|---|---|---|---|
--base-model <model> | string | yes | Base model to fine-tune (e.g. qwen3-8b; not the output model name) |
--datasets <ids|paths> | string | yes | Comma-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> | string | no | Comma-separated validation dataset file IDs or local paths (auto-uploaded like --datasets). |
--model-name <name> | string | no | Output model name (after training) |
--suffix <text> | string | no | Output suffix appended by the platform (finetuned_output_suffix) |
--n-epochs <n> | number | no | Training epochs (default: 50) |
--batch-size <n> | number | no | Batch size (default: model-specific, 1 for wan2.7, 4 for wan2.5/2.2) |
--learning-rate <str> | string | no | Learning 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>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--page <n> | number | no | Page number (default: 1) |
--page-size <n> | number | no | Results per page (default: 10, max 100) |
--status <s> | string | no | Filter by status (PENDING / RUNNING / SUCCEEDED / FAILED / CANCELED) |
--base-model <model> | string | no | Filter 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>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Fine-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>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Fine-tune job ID |
--follow | switch | no | Block and poll until a terminal state (the legacy behavior). Without it, a single status probe is performed and the command returns immediately. |
--interval <sec> | number | no | Seconds between polls with --follow (default: ${DEFAULT_INTERVAL_SEC}, min: ${MIN_INTERVAL_SEC}). Ignored without --follow. |
--poll-timeout <sec> | number | no | With --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>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Fine-tune job ID |
--page <n> | number | no | Page number (default: 1) |
--page-size <n> | number | no | Lines per page (default: server-defined) |
--search <keyword> | string | no | Case-insensitive substring filter. When set, all log pages are fetched and filtered client-side (--page is ignored). |
--tail <n> | number | no | Keep 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>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Fine-tune job ID |
--page <n> | number | no | Page number, starting at 1 (default: 1) |
--page-size <n> | number | no | Records per page (default: 100) |
--workspace-id <id> | string | no | Workspace 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>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Fine-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 fordeploy create --model-name.- Checkpoints expire ~15 days after creation;
expire_timeshows 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>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Fine-tune job ID |
--checkpoint <name> | string | yes | Checkpoint identifier from finetune checkpoints |
--model-name <name> | string | yes | Deployable 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> createcan 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>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Fine-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>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Fine-tune job ID |
--yes | switch | no | Confirm 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>
| Parameter | Type | Required | Description |
|---|---|---|---|
--base-model <m> | string | no | List training types supported by this base model. |
--training-type <t> | string | no | List 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>-loraconvention: 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>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--base-model <model> | string | yes | Base model to query training parameters for (e.g. qwen3-8b) |
--training-type <t> | string | no | Training 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> | string | no | MTU spec code, required for resource-group queries (e.g. MTU2) |
--param-type <hyper|resource> | string | no | Parameter group: hyper | resource. Omit to return all groups. |
--modality <text|vision> | string | no | Training modality: text | vision. Only meaningful for models with dynamic train options; sent as modality inside hyper_parameters. |
--reasoning-mode <instruct|thinking> | string | no | Reasoning mode: instruct (non-thinking) | thinking. Only meaningful for models with dynamic train options; sent as reasoning_mode inside hyper_parameters. |
--lang <locale> | string | no | Locale for server-side display text (e.g. en, zh). Omit for the server default. |
--workspace-id <id> | string | no | Workspace 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>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--base-model <model> | string | yes | Base model to fine-tune (e.g. qwen3-8b; not the output model name) |
--datasets <ids> | string | yes | Training dataset file IDs, comma-separated |
--training-type <type> | string | no | Training type: sft | dpo | cpt (default: sft) |
--n-epochs <n> | number | no | Number 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>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--model <model> | string | no | Filter 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_modelsonly lists quantizable base model names and carries no templates. - An empty
templates[].hyper_parametersarray 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]
| Parameter | Type | Required | Description |
|---|---|---|---|
--model <model> | string | yes | Source custom model ID |
--template-id <id> | string | yes | Compression template ID |
--job-name <name> | string | no | Unique job name (max 50 characters) |
--description <text> | string | no | Job description (max 200 characters) |
--hparam <key=value> | array | no | Hyper-parameter override; repeat for multiple values |
--calibration-files <file-id,...> | string | no | Comma-separated calibration dataset file IDs |
--suffix <suffix> | string | no | Output 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>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--status <status> | string | no | Filter by job status |
--model <model> | string | no | Filter by source model ID |
--template-id <id> | string | no | Filter by template ID |
--quant-spec <spec> | string | no | Filter by quantization specification |
--quant-method <method> | string | no | Filter by quantization method |
--start-time <time> | string | no | Filter jobs starting no earlier than this time |
--end-time <time> | string | no | Filter jobs ending no later than this time |
--search <keyword> | string | no | Search job ID or name |
--search-field <job_id|job_name> | string | no | Limit --search to job_id or job_name |
--sort-order <asc|desc> | string | no | Sort order by create_time (default: desc) |
--page <n> | number | no | Page number (default: 1) |
--page-size <n> | number | no | Results 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>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Compression 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>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Compression job ID |
--follow | switch | no | Poll until the job reaches a terminal state |
--interval <sec> | number | no | Polling interval with --follow (default: 10, min: 1) |
--poll-timeout <sec> | number | no | Stop 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_outputcan be passed todeploy 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>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Compression job ID |
--offset <n> | number | no | Skip the first N lines (default: 0) |
--lines <n> | number | no | Number of lines to read (default: 100, max: 1000) |
--tail <n> | number | no | Read 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>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Compression 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>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | Compression job ID |
--yes | switch | no | Confirm 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.
Reinforcement Learning Training
bl finetune rl authorize
Check and authorize reinforcement-learning access (admission allowlist, service-linked roles, service activation). Requires Console authentication.
Usage
bl finetune rl authorize [--authorize]
| Parameter | Type | Required | Description |
|---|---|---|---|
--authorize | switch | no | Permit enabling RL once service roles are manually authorized (read-only probe without this flag) |
--yes | switch | no | Confirm this high-risk operation |
--console-region <region> | string | no | Console gateway region (e.g. cn-beijing, ap-southeast-1) |
--console-site <site> | string | no | Console site: domestic, international |
--workspace-id <id> | string | no | Workspace ID (env: BAILIAN_WORKSPACE_ID) |
WarningThe CLI never creates service-linked roles automatically. Missing roles return REQUIRES_USER_ACTION and abort; authorize them manually first per Environment Preparation.
Example: Read-only probe of RL admission status
bl finetune rl authorize
Example: Enable RL only after explicit confirmation
bl finetune rl authorize --authorize --yes
- Without
--authorize, this is a read-only probe. Each capability reports READY / MISSING / UNKNOWN / REQUIRES_USER_ACTION / FAILED; a failed query is UNKNOWN, never assumed enabled. - Only RL is enabled; OPD is never auto-enabled. In CI pass
--authorize --yesto permit changes;--yesalone does not expand permissions.
bl finetune rl run
Submit a reinforcement-learning training job. Requires API Key authentication.
Usage
bl finetune rl run --model <id> [flags]
| Parameter | Type | Required | Description |
|---|---|---|---|
--config-file <path> | string | no | Optional job YAML file; explicit CLI flags take precedence |
--name <name> | string | no | Job name |
--model <id> | string | no | Base model ID |
--train-file <path> | array | no | Local training file (repeatable) |
--train-file-id <id> | array | no | Uploaded training file ID (repeatable) |
--validation-file <path> | array | no | Local validation file (repeatable) |
--validation-file-id <id> | array | no | Uploaded validation file ID (repeatable) |
--code-dir <path> | string | no | Function package source directory |
--requirements <path> | string | no | Requirements path relative to code-dir |
--rollout <classpath> | string | no | Rollout function classpath |
--reward <name=classpath> | array | no | Reward function (repeatable) |
--hp <key=value> | array | no | Hyper-parameter (repeatable, parsed by type) |
--charge-type <value> | string | no | Resource charge type |
--mtu-spec <code> | string | no | MTU spec code |
--mtu-count <int> | number | no | MTU capacity |
--watch | switch | no | Wait for the job to reach a terminal state |
--wait-timeout <seconds> | number | no | Maximum seconds to poll with --watch (default: no limit; timeout does not cancel the cloud job) |
--install-runtime | switch | no | Allow first-time managed runtime preparation |
--yes | switch | no | Confirm this high-risk operation |
WarningThis creates a billed RL training job that consumes compute resources. Runs inside an isolated sandbox; prepare the runtime first with bl finetune runtime prepare, or pass --install-runtime.
Example: Submit an RL training job and wait for completion
bl finetune rl run --model qwen3.5-9b --train-file ./data/train.jsonl --code-dir . --rollout functions.rollout.MyRollout --charge-type mtu_postpaid --mtu-spec MTU4 --mtu-count 24 --watch
Example: Submit via YAML config
bl finetune rl run --config-file job.yaml --watch
Example: Preview job specs without submission
bl finetune rl run --model qwen3.5-9b --train-file ./data/train.jsonl --dry-run
--watchtimeout stops waiting only; it does not cancel the cloud job.
bl finetune rl get
Get reinforcement-learning training job details. Requires API Key authentication.
Usage
bl finetune rl get --job-id <id>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | RL job ID |
bl finetune rl list
List reinforcement-learning training jobs. Requires API Key authentication.
Usage
bl finetune rl list
bl finetune rl watch
Probe an RL job's status (default: single non-blocking fetch). Requires API Key authentication.
Usage
bl finetune rl watch --job-id <id> [--follow] [--interval <sec>] [--poll-timeout <sec>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | RL job ID |
--follow | switch | no | Block and poll until a terminal state; without this flag, performs a single fetch and returns immediately |
--interval <sec> | number | no | Seconds between polls with --follow (default: 10, min: 1) |
--poll-timeout <sec> | number | no | Maximum seconds to poll with --follow (default: no limit) |
Example: Single status probe
bl finetune rl watch --job-id ft-xxx
Example: Poll until terminal state
bl finetune rl watch --job-id ft-xxx --follow
- Default (no
--follow) is a non-blocking single probe. Terminal FAILED/CANCELED raises a non-zero exit code; SUCCEEDED or still-running returns 0. - Queries the fine-tunes endpoint directly; no sandbox runtime needed. For per-step training output use
bl finetune rl logs.
bl finetune rl logs
Get reinforcement-learning training job logs. Requires API Key authentication.
Usage
bl finetune rl logs --job-id <id>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | RL job ID |
bl finetune rl cancel
Cancel a reinforcement-learning training job. Requires API Key authentication.
Usage
bl finetune rl cancel --job-id <id>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | RL job ID |
--yes | switch | no | Confirm this high-risk operation |
- Only PENDING, QUEUING, or RUNNING jobs can be cancelled.
bl finetune rl delete
Delete a reinforcement-learning training job record. Requires API Key authentication.
Usage
bl finetune rl delete --job-id <id>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | RL job ID |
--yes | switch | no | Confirm this high-risk operation |
WarningThis permanently deletes the job record and cannot be undone.
- Only terminal jobs can be deleted.
Online Pure-Model Distillation (OPD)
bl finetune opd authorize
Check and authorize online distillation access. Requires Console authentication.
Usage
bl finetune opd authorize [--authorize]
| Parameter | Type | Required | Description |
|---|---|---|---|
--authorize | switch | no | Permit enabling OPD once service roles are manually authorized (read-only probe without this flag) |
--yes | switch | no | Confirm this high-risk operation |
--workspace-id <id> | string | no | Workspace ID |
WarningThe CLI never creates service-linked roles automatically. Missing roles return REQUIRES_USER_ACTION and abort.
bl finetune opd run
Submit a pure-model online distillation job (pg_opd). Requires API Key authentication.
Usage
bl finetune opd run --base-model <id> --teacher-model <id> --datasets <ids|paths> [flags]
| Parameter | Type | Required | Description |
|---|---|---|---|
--base-model <id> | string | yes | Student base model ID (e.g. qwen3.5-9b) |
--teacher-model <id> | string | yes | Platform-registered teacher model ID (no arbitrary URLs or keys) |
--datasets <ids|paths> | string | yes | Comma-separated dataset file IDs or local .jsonl paths; local paths are validated and uploaded first |
--validations <ids|paths> | string | no | Comma-separated validation file IDs or local paths (auto-uploaded) |
--job-name <name> | string | no | Training job display name |
--hyper-parameters-file <path> | string | no | JSON file of training + resource hyper-parameters; --hp overrides it |
--resource-config-file <path> | string | no | resource_config JSON file (charge_type / mtu_spec_code / mtu_capacity); resource flags override it |
--hp <key=value> | array | no | Hyper-parameter override (repeatable, parsed by type) |
--charge-type <value> | string | no | resource_config.charge_type; pg_opd only supports mtu_postpaid (default) |
--mtu-spec <code> | string | no | resource_config.mtu_spec_code (e.g. MTU4); required |
--mtu-count <int> | number | no | resource_config.mtu_capacity (student GPUs + teacher GPUs); required |
--workspace-id <id> | string | no | Workspace for upload, parameter query, creation and reads |
--watch | switch | no | Wait for the job to reach a terminal state |
--wait-timeout <seconds> | number | no | Maximum seconds to poll with --watch (default: no limit; timeout does not cancel the cloud job) |
--yes | switch | no | Confirm this high-risk operation |
WarningThis creates a billed OPD training job that consumes compute resources. Forces training_type=pg_opd; no rollout/reward functions needed, no function-compute resources created. Submits directly from the host via the fine-tunes OpenAPI; no sandbox runtime required.
Example: Preview job specs without submission
bl finetune opd run --base-model qwen3.5-9b --teacher-model qwen3.8-flash --datasets file-xxx --hyper-parameters-file ./hp.json --resource-config-file ./resource.json --dry-run
Example: Submit an OPD training job and wait for completion
bl finetune opd run --base-model qwen3.5-9b --teacher-model qwen3.5-397b-a17b --datasets ./train.jsonl --hp n_epochs=1 --hp batch_size=64 --charge-type mtu_postpaid --mtu-spec MTU4 --mtu-count 24 --watch
- Hyper-parameters are sent as provided (JSON file →
--hpoverrides). Omitted fields are resolved by the server and the selected teacher's defaults; the CLI never fills recommend_value. - mtu_capacity must equal student GPUs + teacher GPUs. Recommended configurations and model pairs: Models and Training Units.
--watchtimeout stops waiting only; it does not cancel the cloud job.
bl finetune opd params
Query hyper-parameters supported by the student base model. Requires API Key authentication.
Usage
bl finetune opd params --base-model <id>
| Parameter | Type | Required | Description |
|---|---|---|---|
--base-model <id> | string | yes | Student base model ID |
bl finetune opd get
Get online distillation job details. Requires API Key authentication.
Usage
bl finetune opd get --job-id <id>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | OPD job ID |
bl finetune opd watch
Probe an OPD job's status. Requires API Key authentication.
Usage
bl finetune opd watch --job-id <id> [--follow] [--interval <sec>] [--poll-timeout <sec>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | OPD job ID |
--follow | switch | no | Block and poll until a terminal state |
--interval <sec> | number | no | Seconds between polls with --follow (default: 10) |
--poll-timeout <sec> | number | no | Maximum seconds to poll with --follow (default: no limit) |
bl finetune opd logs
Get online distillation job logs. Requires API Key authentication.
Usage
bl finetune opd logs --job-id <id>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | OPD job ID |
bl finetune opd cancel
Cancel an online distillation job. Requires API Key authentication.
Usage
bl finetune opd cancel --job-id <id>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | OPD job ID |
--yes | switch | no | Confirm this high-risk operation |
- Only PENDING, QUEUING, or RUNNING jobs can be cancelled.
bl finetune opd delete
Delete an online distillation job record. Requires API Key authentication.
Usage
bl finetune opd delete --job-id <id>
| Parameter | Type | Required | Description |
|---|---|---|---|
--job-id <id> | string | yes | OPD job ID |
--yes | switch | no | Confirm this high-risk operation |
WarningThis permanently deletes the job record and cannot be undone.
- Only terminal jobs can be deleted.
Sandbox Runtime Management
bl finetune runtime prepare
Prepare the managed Python/SDK runtime used by RL and OPD jobs. No authentication required.
Usage
bl finetune runtime prepare [--manifest <path>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--manifest <path> | string | no | Optional runtime manifest file (defaults to the bundled reviewed manifest) |
Example: Prepare the runtime
bl finetune runtime prepare
Example: Use a custom manifest
bl finetune runtime prepare --manifest ./runtime-manifest.json
- Downloads and verifies the runtime locally; never creates a training job. Set BAILIAN_RL_RUNTIME to a local dashscope Python directory to reuse a development runtime.
- CPython downloads fall back to a built-in npmmirror mirror when GitHub is unreachable; set BAILIAN_RL_PYTHON_MIRROR to a custom mirror prefix. Integrity is always verified against the reviewed SHA256.
- When the PyPI CDN stalls, set BAILIAN_RL_PIP_INDEX_URL to a stable PyPI mirror (e.g. https://pypi.tuna.tsinghua.edu.cn/simple/); pip still verifies every package hash via
--require-hashes. - Also reclaims orphaned run directories older than 24 hours (crash leftovers); normal invocations dispose automatically on exit.
bl finetune runtime doctor
Check the RL runtime and sandbox isolation (credential deny, home redirect, SDK import). No authentication required.
Usage
bl finetune runtime doctor
Example: Check runtime status
bl finetune runtime doctor
- Read-only self-check; creates no cloud resources. Required checks must pass; when the runtime is missing they are skipped (not treated as passed) and the command exits non-zero.
- Enhanced hardening (kernel network enforcement, process tree, memory) degrades with a notice when unavailable and does not fail the overall check.
- Host network reachability (API / runtime download / PyPI hosts) is probed as an advisory check: blocked hosts degrade with guidance (agent sandboxes often block outbound network) and do not fail the overall check.
bl finetune runtime clean
Reclaim orphaned sandbox run directories and superseded runtime versions. No authentication required.
Usage
bl finetune runtime clean [--ttl-hours <hours>] [--dry-run]
| Parameter | Type | Required | Description |
|---|---|---|---|
--ttl-hours <hours> | number | no | Age threshold for orphaned run directories (default: 24 hours) |
--yes | switch | no | Confirm this high-risk operation |
WarningThis permanently deletes orphaned run directories and superseded runtime versions; it cannot be undone.
Example: Preview cleanup plan
bl finetune runtime clean --dry-run
Example: Reclaim orphan directories older than 48 hours
bl finetune runtime clean --ttl-hours 48
- Normal invocations dispose run directories automatically on exit; only crash leftovers (older than TTL) remain under runs/. Superseded runtime versions under runtimes/rl/ are reclaimed, keeping only the current reviewed baseline.
- Never touches the current baseline runtime, BAILIAN_RL_RUNTIME development directories, or the content-addressed download cache. Local only: no credentials, no cloud resources.