π§© TrainBench Features
TrainBench's pages fall into three groups. Task pages (training, evaluation, export, deployment, scripts) handle creating and monitoring a single job. Research and orchestration pages handle multi-step flows (AutoResearch sessions, the component canvas). The chat, model, plugin and settings pages provide model access and agent capabilities. The argument semantics on every page match the ms-swift command line, and the AI assistant is available on every page. For installation and the first task see Quick start.
π₯οΈ Basic features
| Feature | Page | How to use | Configurable items |
|---|---|---|---|
| Training | Training | Create SFT, DPO, GRPO, PPO, distillation and other tasks through a form or code; the detail page shows live logs and loss / lr curves; select several tasks to enter the comparison page | Model, dataset, tuner (LoRA / full-parameter), parallelism spec (dp / fsdp / tp / pp / ep), memory estimate, run location, output directory, checkpoint retention policy, plugins |
| Inference | Chat | Chat with an endpoint from the model configuration, with streaming output; comparison mode sends the same turn to several models and shows them side by side | Sampling parameters, history context, tool calls, session-level approval switch |
| Deployment | Deploy | Start an attached swift deploy subprocess; the endpoint is registered automatically in the model configuration once ready | Base model, adapters (multiple name=path), merge_lora for on-the-fly merging, port, GPU count |
| Quantization | Export | swift export completes LoRA merging, quantization and pushing to the Hub in one go | quant_method (AWQ / GPTQ / BNB), quant_bits, merged directory, Hub target |
| Evaluation | Evaluate | Run swift eval with --eval_url against an endpoint in the model configuration, or load the base model and adapter in local direct-evaluation mode; results are written to results.jsonl | Evaluation set and limit, model under test, base model / adapter / GPU for local direct evaluation, generation parameters |
| Model configuration | Models | Register the access method of API services and local deployments for the chat, evaluation and research pages to select | baseUrl, apiKey (masked in the frontend), model ID, default model |
Take the training page as an example: the form on the left selects the run location, task type (SFT / PT / RL), model, dataset and tuner, while the right side shows the final command to be executed in sync. Extra arguments separated by whitespace are appended directly to the end of the command. There are three run locations, with the same form on all task pages: local selects local cards with CUDA_VISIBLE_DEVICES; cluster takes the Ray cluster address and card count; remote takes the training service address and api key, so training works even without a local GPU. The parallelism planner next to the form gives dp / fsdp / tp / pp / ep combinations and a per-card memory estimate from the card count and backend, and the GPU planner for online RL manages card placement for the actor and sampler groups.
The five task types share the same create, list and detail operations. State is saved in files under SWIFT_WEBUI_HOME, and closing the browser does not terminate tasks. Each task directory contains run.sh, which can be replayed outside the page.
π§° agent tools
The agent on the chat page mounts tools by scenario, and the same tool uses the same execution surface in the research loop and on the manual pages (actions such as training, evaluation and deployment are performed by TrainBench's task executor). In the "Available scenarios" column, Chat = always present in any mode of the chat page; Research = "Research" mode is on or the session is bound to an AutoResearch session; Search = web search is on; Page assistant = the assistant embedded in a task page.
Knowledge tools:
| Tool | Role | Available scenarios |
|---|---|---|
read_skill | Read skill documents (skills/swift-usage and modelscope-skills) | Chat |
list_catalog | List the built-in model and dataset catalog | Chat |
search_models | Search model configurations and Hub models by name | Chat |
env_info | Read the current environment's GPUs, driver and installed package versions | Chat |
read_swift_source | Read the ms-swift framework source | Chat |
web_search | Search the web | Search |
Workbench tools (task creation and task table):
| Tool | Role | Available scenarios |
|---|---|---|
create_train / create_eval / create_export / create_deploy | Generate a task creation card for the corresponding page from the arguments; after the user confirms, it enters the form | Chat |
start_train_batch | Start a batch of controlled experiments: a common base configuration plus the differing fields of each experiment; several tasks enter the training list together | Chat |
list_tasks / read_task_log / stop_task / delete_task / rename_task | Read status and logs, stop, delete and rename across the five task types (training, evaluation, export, deployment, scripts) | Chat |
Workspace tools (files and scripts):
| Tool | Role | Available scenarios |
|---|---|---|
read_file / write_file / edit_file / list_dir / grep | Read, write, edit, list directories and regex-search inside the workspace; can switch to the external data directories registered in preferences | Research |
dataset_profile | Dataset probe: row count, column names, field value distribution | Research |
run_script / read_script_log / stop_script | Run a Python script in the background on the script page's executor, read live logs, stop at any time | Research |
shell | Run shell commands inside the workspace | Research |
Research tools (AutoResearch loop):
| Tool | Role | Available scenarios |
|---|---|---|
create_research / update_research | Persist the research session; each turn records a note and maintains the iterations array (index / dataVersion / trainTaskId / score) | Research |
start_train | Start a round of training with one approval prompt; merges the session snapshot with the call arguments and strips ownership keys such as output_dir to avoid duplicate flags; supports resuming with resume_from_checkpoint | Research |
list_checkpoints / prune_checkpoints | List the checkpoints under a task output directory; clean up old versions | Research |
list_challengers / install_challenger | List and install the built-in data generation script templates | Research |
deploy_checkpoint / export_checkpoint | Deploy the best checkpoint as a chat service, or freeze it and push it to the Hub | Research |
The page assistant has two more form tools: set_form_fields produces a change card from all the fields of the argument area, applied one by one or automatically on submit; submit_form goes through an approval card. Tool calls are governed by session-level approval, and the approval card can be checked to always allow commands with the same name. Script-type tools do not prompt for approval inside the workspace; their budget and investigation surface are constrained by the guidelines.
π€ AutoResearch
AutoResearch has the agent run the complete loop of a tuning experiment: determine the evaluation criterion from the user's goal, iterate data versions, submit training, read evaluation scores, until the target is met or the budget is exhausted. The entry point is the "Research" switch on the chat page.
π Inputs and outputs
| Content | |
|---|---|
| Provided by the user | Goal description (such as "raise the math accuracy of Qwen3.5-4B to 60% with NuminaMath"), base model, available datasets, training budget |
| Determined after the interview | Target metric (evaluation set, grading method, threshold, direction); evaluation timing (during the built-in evaluation during training / parallel evaluation in parallel when cards are idle / checkpoint evaluation of the latest checkpoint after training); maximum number of iterations |
| Output | Research session. The iteration ledger records the data version, training task id and evaluation score of each turn; the event stream records state transitions and agent decisions; the best checkpoint can be deployed as a chat service through deploy_checkpoint, or frozen and pushed to the Hub through export_checkpoint |
π Usage steps
- Turn on "Research" on the chat page and describe the goal. The agent asks about the target criterion and budget, then calls
create_researchto create the research session after confirmation. - Each iteration is run by the agent: run a data processing script on the script page inside the workspace to generate a new data version β call
start_trainto submit training (the first submission shows an approval card; after "always allow in this session" is checked, the rest of the loop runs automatically) β start the evaluation according to the evaluation plan once training completes β read the score and decide whether the next turn changes the data or the training arguments. - Once the score meets the target or the rounds are exhausted, the agent outputs a summary. View the iteration ledger and event stream on the research page, and deploy or export the best checkpoint.
Training and evaluation support three run locations: local, Ray cluster and remote training service. The training arguments match the training page form. Evaluation uses evalscope benchmarks by default. With metric_kind=custom, the training-completion event hands evaluation back to the agent, and a grading script on the script page produces the score and writes it back to the iteration ledger.
π±οΈ Drag-and-drop orchestration
The orchestration page registers components as canvas nodes, and the wires between nodes represent the data flow. When any node is clicked, TrainBench runs all upstream nodes of that node in dependency order and stops at the current node. The same graph can switch to the "Code" view to get an equivalent Python script.
Usage steps
- Create a new orchestration, select the training type (LoRA / full-parameter), then choose a scaffold from "Switch example": GRPO, PPO, RFT, OPSD, RSI, SFT, DPO, KTO, Embedding, Reranker, SeqCls, Decision.
- Edit the canvas: click a node and change its arguments in the panel (model id, dataset, learning rate, the epsilon / beta of the loss); drag new nodes in from the left panel and draw wires to connect ports. Ports are validated by data type, and illegal connections are rejected during editing.
- Select the run location in "Global configuration" at the top left: local cards, cluster card count, or the remote training service.
- Click any node to run up to that node, and view the actual output of that node in the right panel (samples delivered by the sampling engine, advantage values written back by advantage estimation, the receipt of the training step). "Run all" executes the complete graph.
π Reading the graph
There are three kinds of wires. Purple lines are resource lines (resources such as datasets, models and samplers are shared with downstream nodes along the wire; when upstream has only one resource of that kind, it is resolved automatically even without a wire). Colored lines are data flows (sample batches, feature batches, scorer outputs, model outputs), and the data flows make up the algorithm itself. Dashed lines are ordering (then / after), used only when no data edge between two nodes expresses their order.
The main chain of SFT is a straight line. The dataset feeds the rows port of the data loader; the data encoding node encodes messages into feature batches with the tokenizer; the training step takes the model and loss (cross_entropy) and runs forward and backward; then returns to the data loader to fetch the next batch until max_steps; the save node writes the checkpoint; artifact merge merges the LoRA into the base model; batch inference runs once against the merged model to verify the result.
Compared with SFT, GRPO adds a closed loop, and the nodes execute from left to right. The dataset and data loader deliver the prompt batch through the prompts port; the batch generation node takes the sampling engine (vLLM) and the group sampling rule and generates a group of replies for each prompt; the scoring node connects scorers (accuracy) to score each group; model forward outputs the logps of the reference policy (adapter disabled, i.e. the KL reference point); advantage estimation computes advantages per group and writes them back to the samples; the training step takes the model and loss (grpo) and updates the parameters; the save node writes the checkpoint; weight sync syncs the new weights to the sampling engine; then returns to the data loader for the next round. The dashed frame marks the training loop body. Replacing the algorithm means replacing nodes on the loop: change the estimator of advantage estimation from grpo to rloo / gae, change the loss node to ppo or a custom loss, or change the scorer to another reward.
π§© Customizing a new algorithm
- Replace an existing component: change node arguments without writing code, for example the estimator of advantage estimation, the kind of the loss, the scorers of the scorer, or the temperature of the sampling engine.
- Insert custom computation: drag in a "Code component" node, declare its entry name and ports, and write a piece of Python inside it.
- Write a complete training loop: switch to the "Code" view, copy the generated Python script and turn it into a custom training loop. The component interfaces are the same as in code-style training; see Components and M/P separation.
The data of offline algorithms (SFT, DPO, KTO, Embedding, Reranker, SeqCls, Decision) is uniformly encoded through the "Data encoding" node. The format argument declares the data format explicitly (conversation, preference_pairs, kto, seq_cls, embedding, reranker, decision; see Custom datasets). The training step and model forward accept only encoded input; when raw rows are connected directly, the node rejects them and prompts to connect an encoding node.
π€ AI assistant
The assistant is available on every page. The agent on the chat page mounts tools by scenario; see agent tools for the complete list. The assistants on the five task pages (training, evaluation, export, deployment, scripts) can read and write the current form (set_form_fields produces change cards applied one by one; submit_form submits an approval card). The assistant on the orchestration page can add and remove nodes and wires from the conversation. Tool calls are governed by session-level approval, and the approval card can be checked to always allow commands with the same name.