The Agent tool call distillation template builds multi-turn tool calling SFT datasets at scale. Starting from role personas, it synthesizes multi-step tasks, fuzzes requirements, validates tool definitions, rolls out tool calling trajectories, and selects the best trajectories by rubric scoring — producing training data that teaches smaller models multi-turn tool calling and task decomposition.
Template overview
This template teaches smaller models multi-turn tool calling and task decomposition. The pipeline starts from role personas to synthesize multi-step tasks and simulates vague user requests and tool definition validation. The teacher model then rolls out complete tool calling trajectories multiple times and selects the best trajectories by rubric scoring to produce an SFT dataset for Agent capability training.
This template supports single-stage creation only: distillation data construction. It doesn't include a student model training stage. After distillation completes, train the student model yourself with the generated SFT dataset.
The Agent tool call distillation pipeline consists of the following steps:
Step | Name | Description |
1 | Task synthesis | Synthesize tasks that require multi-step operations and tool collaboration, guided by role personas. |
2 | Requirement fuzzing | Rewrite clear tasks into the vague expressions that real users typically make, to train the model to proactively clarify and ask follow-up questions. |
3 | Tool validation | Verify that tool definitions required by each task are complete and usable. Discard tasks with missing or contradictory tool descriptions. |
4 | Trajectory rollout | The teacher model acts as the assistant and solves each task, while simulating tool responses and user follow-ups. Each task is rolled out multiple times for later selection. |
5 | Rubric-based selection | Score each trajectory against rubrics and select the top-performing trajectories from multiple rollouts as training targets. |
6 | SFT dataset construction | Assemble the selected trajectories into a multi-turn conversation SFT training dataset. |
Procedure
Log on to the PAI console. In the left-side navigation pane, choose Model Application > Model Distillation (ModelDistill).
Click Create task to go to the Distillation Template tab, or navigate directly to the Distillation Template tab.
Select Agent Tool Call Distillation, click Use Template, and go to the Create Distillation Task page. Configure the key parameters described below and keep the default values for other settings.
Configure the Basic Configuration:
Task name: Auto-filled by the system.
Output Path: Specify an OSS path that you have permission to access, such as
oss://mybucket.oss-cn-hangzhou-internal.aliyuncs.com/agent-distill/.NoteCreate a separate output directory for each distillation task to prevent files from being overwritten. The OSS bucket must be in the same region as the PAI service.
Click Next to go to Build distillation data:
Teacher model: Set Teacher Model Source to Token Service, and select a model with strong tool calling capabilities from the drop-down list, such as
qwen3.8-max.Dataset: Select an OSS directory or file that you have permission to access. You can download and use the sample data.
Distillation Configuration: Default values are pre-filled. Modify them as needed.
agent.max_steps: Maximum number of interaction turns per task. Default: 20.
agent.repeat_times: Number of rollout iterations per task. Default: 2. More rollouts produce higher-quality data but increase costs.
For more template-specific parameters (such as role temperatures and rubrics), see the Configuration section below.
Compute Resource: Set Resource Type to General Computing, set Source to Public Resources, and select an appropriate Instance Type from Job Resource, such as
ecs.c6.large.
Click Create, and then click OK in the billing confirmation dialog. The page redirects to the basic configuration page of the task details, where you can track the task status.
NoteThe Agent tool call distillation template supports single-stage mode (distillation data construction) only. Student model training isn't supported.
Configuration
This section describes the key configuration parameters specific to the Agent tool call distillation template. Basic configuration and resource configuration are the same as general distillation. Only template-specific parameter differences are listed here.
Basic configuration
Basic configuration includes the task name and output path. The output path is the root directory for all task artifacts, including the distillation dataset. You don't need to specify a separate output path for the dataset.
Distillation data construction
Teacher model
The Agent tool call distillation template requires only one teacher model, which plays four roles: problem solver, tool simulator, user simulator, and scorer. Select a model with strong tool calling capabilities and long-context support. The teacher model source supports only PAI Token Service.
Dataset
Select an input directory or file. The data format requirements are as follows:
Format: JSONL seed file containing role personas.
Tasks and tool calling trajectories are synthesized automatically by the pipeline. No manual authoring is required.
Sample data:
{"id": "agent_001", "background": "A college student studying marine biology is planning a field trip to a coastal research station and needs to compare equipment rental prices, weather windows and permit requirements."}
{"id": "agent_002", "background": "A small business owner wants to organize a local concert on a tight budget and needs help finding venues, contacting artists and planning the promotion."}
{"id": "agent_003", "background": "A developer is preparing to migrate a service to another cloud region and needs to inventory dependencies, estimate the downtime window and draft a rollback plan."}Distillation configuration
The distillation configuration is provided in YAML format with recommended defaults from the algorithm team. Adjust the parameters as needed. The following table lists key parameters and their descriptions.
Section | Description |
dataset |
|
backend |
|
generation |
|
sft |
|
agent |
|
pipeline |
|