Skip to Content
MS-SWIFT Γ— TWINKLE
WEBUIMS-SWIFT Γ— TWINKLE

πŸš€ TrainBench Quick Start

TrainBench is the web workbench for ms-swift and twinkle. Training, evaluation, export, deployment and script tasks are created and monitored in the same program, and chat, AutoResearch and drag-and-drop orchestration are completed in the same interface. The pages and the task execution service are provided by the same program. Tasks run on the machine running TrainBench, on a Ray cluster or on a remote training service; the browser itself performs no GPU computation.

Why use TrainBench?

  • Full task lifecycle: the five task types train / eval / export / deploy / script share the same create, list and detail operations, and the detail page provides live logs, loss / lr curves and comparison across runs.
  • The same ms-swift interface: the arguments produced by the forms correspond one to one to command-line arguments, and run.sh in the task directory can be replayed outside the page.
  • One form for local and remote: the run location is local (local card selection), cluster (Ray cluster address) or remote (training service address), and switching the run location does not change the other arguments.
  • AutoResearch: define the research goal and target metric in a conversation; the agent iterates over data and training plans, and the process is recorded in a research session.
  • Drag-and-drop orchestration: canvas nodes are the components registered in swift.dev, and the presets cover GRPO, PPO, SFT, DPO and other algorithms.
  • Page assistant: the AI assistant on every page can read and write the current form, consult documentation and skills, and start tasks.

AutoResearch walkthrough

Set a training goal in chat, review the response after completion, then inspect script logs, research events and iteration records. This 88-second recording joins two clips at their original speed; the training wait between them was not recorded.

πŸ“¦ Environment installation

First install ms-swift in the Python environment that runs training, then install TrainBench:

pip install 'ms-swift>=5.0.0'
npm install -g @modelscope/trainbench
trainbench

TrainBench first confirms that the current Python environment provides ms-swift >= 5.0, then binds a port and prints the access address. Open the printed URL in a browser; no separate backend is needed. The swift command line and TrainBench should use the same Python environment. For the full environment requirements see the installation documentation.

Running from source requires Node.js 18 or later:

git clone https://github.com/modelscope/trainbench.git
cd trainbench/webui
npm install
npm run dev

The development server provides both the API and the pages. A workbench with task execution permission should not be exposed directly to an untrusted network.

πŸš€ First training task

  1. Open the training page and create a new task. Select Qwen/Qwen3.5-4B as the model and LoRA as the tuner.
  2. Fill in the dataset swift/self-cognition#600, BF16, flash_attention_2, max length 2048, learning rate 1e-4, 3 epochs; per-card batch 1, gradient accumulation 8.
  3. Select a local card as the run location. The memory estimate in the form is for planning and does not replace the real allocation.
  4. After submitting, view the start command, live logs and loss / lr curves in the task details.
  5. After training, the checkpoint is in the task output directory. It can be merged or quantized on the export page, and swift deploy can be started on the deployment page. Once ready, the endpoint is registered in the model configuration and can be selected on the chat page.

The form is equivalent to the following command:

CUDA_VISIBLE_DEVICES=0 \
swift sft \
    --model Qwen/Qwen3.5-4B \
    --attn_impl flash_attention_2 \
    --task_type causal_lm \
    --torch_dtype bfloat16 \
    --dataset 'swift/self-cognition#600' \
    --tuner lora --lora_rank 8 --lora_alpha 32 --target_modules all-linear \
    --num_train_epochs 3 \
    --per_device_train_batch_size 1 \
    --gradient_accumulation_steps 8 \
    --learning_rate 1e-4 \
    --max_length 2048

For more command-line examples see the ms-swift quick start and examples/v5.

πŸš€ Remote training

After selecting remote as the run location and filling in the training service address, the task is submitted with --mode remote; training runs on the server and the local machine does not need a GPU. cluster submits multi-node training with a Ray cluster address. For server deployment see Server and client.

πŸͺŸ Page overview

PageRole
TrainingCreate, log, curve and compare training tasks such as SFT, DPO, GRPO, PPO and distillation
EvaluationRun evalscope benchmarks or a custom evaluation set against a configured model endpoint or a local checkpoint
ExportCombine LoRA merging, AWQ / GPTQ / BNB quantization and pushing to the Hub
DeployStart an attached swift deploy, with support for mounting several adapters
ScriptsRun Python scripts or multi-file entries in the workspace, in the background with live logs
ChatChat with an endpoint in the model configuration, agent tool calls, side-by-side comparison of several models
ResearchAutoResearch session list, iteration ledger and event stream
OrchestrationCombine components on a drag-and-drop canvas and run them
ModelsEndpoint configuration for API services and local deployments
PluginsRegister --external_plugins sources
SettingsDefault training service endpoint, appearance and language

Task state is saved in files under SWIFT_WEBUI_HOME (default ~/.swift/webui), and closing the browser does not terminate tasks. For the detailed features of each page see Features.

πŸš€ Learn more