π 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.shin 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) orremote(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
trainbenchTrainBench 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 devThe 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
- Open the training page and create a new task. Select
Qwen/Qwen3.5-4Bas the model and LoRA as the tuner. - Fill in the dataset
swift/self-cognition#600, BF16,flash_attention_2, max length 2048, learning rate1e-4, 3 epochs; per-card batch 1, gradient accumulation 8. - Select a local card as the run location. The memory estimate in the form is for planning and does not replace the real allocation.
- After submitting, view the start command, live logs and loss / lr curves in the task details.
- After training, the checkpoint is in the task output directory. It can be merged or quantized on the export page, and
swift deploycan 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 2048For 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
| Page | Role |
|---|---|
| Training | Create, log, curve and compare training tasks such as SFT, DPO, GRPO, PPO and distillation |
| Evaluation | Run evalscope benchmarks or a custom evaluation set against a configured model endpoint or a local checkpoint |
| Export | Combine LoRA merging, AWQ / GPTQ / BNB quantization and pushing to the Hub |
| Deploy | Start an attached swift deploy, with support for mounting several adapters |
| Scripts | Run Python scripts or multi-file entries in the workspace, in the background with live logs |
| Chat | Chat with an endpoint in the model configuration, agent tool calls, side-by-side comparison of several models |
| Research | AutoResearch session list, iteration ledger and event stream |
| Orchestration | Combine components on a drag-and-drop canvas and run them |
| Models | Endpoint configuration for API services and local deployments |
| Plugins | Register --external_plugins sources |
| Settings | Default 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
- Features: basic features, AutoResearch, drag-and-drop orchestration and the page assistant.
- AutoResearch benchmarks: evaluation protocol and inclusion rules.
- Components and M/P separation: the code components behind the canvas nodes.