Decision model distillation

Updated at:

The Decision Model Distillation template has a teacher model make K independent decisions on case data and aggregates the results into a soft label distribution. It produces RLCD training data that you can use directly to fine-tune the typed decision head of a student model. The template is suitable for rapid decision-making use cases such as spam SMS detection, intent classification, and sentiment determination.

Template overview

The Decision Model Distillation template is suitable for rapid decision-making use cases such as spam SMS detection, intent classification, and sentiment determination. It has a teacher model make K independent decisions on your case data and aggregates the results into a soft label distribution. The output is training data in RLCD format that you can use directly to fine-tune the typed decision head of a student model.

Important

This template supports only single-stage creation: Build distillation data. It does not include a student model training stage. After distillation, you must train the student model yourself by using the generated RLCD dataset.

The Decision Model Distillation template pipeline includes the following steps:

Step

Name

Description

1

Build case rows

Combines raw data rows with the inline schema to build case rows that contain a one-hot gold distribution and a typed-decision structure.

2

Teacher elicitation

Calls the teacher model for K independent samples for each question in each case to obtain verbalized probability distributions.

3

Label aggregation

Aggregates the distributions from K teacher samples into soft labels, then performs consistency filtering and a gold alignment audit.

4

Build training dataset

Combines cases and teacher soft labels, and outputs training-ready JSONL data in RLCD format.

Procedure

  1. Log on to the PAI console. In the left-side navigation pane, choose Model Application > Model Distillation (ModelDistill).

  2. Click Create task to open the Distillation Template tab, or go directly to the Distillation Template tab.

  3. Select Decision Model Distillation, then click Use Template to open the Create Distillation Task page. Configure the following key parameters and retain the default values for all other parameters.

  4. Configure Basic Configuration:

    • Task name: The system populates this field automatically.

    • Output Path: Specify an OSS path that you have permission to access, such as oss://mybucket.oss-cn-hangzhou-internal.aliyuncs.com/decision-distill/.

      Note

      Create 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.

  5. Click Next to open Build distillation data:

    • Teacher model: For Teacher Model Source, select Token Service, and then select a large language model with strong decision-making 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 a sample directly.

    • Distillation Configuration: A default configuration is provided. Modify it as needed.

      • dataset.input_path: If you select a file for the dataset, the file name configured here does not take effect.

      • For more configuration parameters specific to the Decision Model Distillation template, such as the number of samples K and the consistency filtering threshold, see Configuration details below.

    • Compute Resource: For Resource Type, select General Computing. For Source, select Public Resources. In Job Resource, select an appropriate Instance Type, such as ecs.c6.large.

  6. Click Create. Then, in the billing reminder that appears, click OK. The page automatically redirects to the Basic Configuration page in task details, where you can track the task status.

    Note

    The Decision Model Distillation template supports only a single stage (Build distillation data) and does not support the student model training stage.

Configuration details

The following sections describe key configuration parameters for the Decision Model Distillation template. Basic configuration and resource configuration are the same as for general model distillation, so only the parameters specific to this template are listed here.

Basic Configuration

Basic configuration includes the task name and output path. The output path is the root directory for all task outputs. The distillation dataset is also written to this directory, so you do not need to specify a separate dataset output path.

Build distillation data

Teacher model

The Decision Model Distillation template requires only one teacher model, which makes K independent decision samples for each case. Select a large language model with strong decision-making capabilities. The teacher model source supports only PAI Token Service.

Dataset

Select an input directory or file. The data must meet the following format requirements:

  • Format: JSONL. Each row contains id, label, and a text field.

  • Each row represents a case that requires a decision. The teacher model performs K independent samples on it.

Sample data:

{"id": "sms-001", "label": "ham", "text": "Hey, running late. Grab a table for 7:30 and I will meet you there."}
{"id": "sms-002", "label": "spam", "text": "WINNER! You have won a $1000 prize call now to claim within 24h."}
{"id": "sms-003", "label": "ham", "text": "Mum, I left the spare key under the plant pot as agreed. See you Sunday!"}
{"id": "sms-004", "label": "spam", "text": "URGENT: your bank account has been suspended. Reply STOP to cancel."}
{"id": "sms-005", "label": "ham", "text": "Your order 38291 has shipped and should arrive Tuesday before 6pm."}
{"id": "sms-006", "label": "spam", "text": "Congratulations! You were selected for a free vacation. Text GO to claim."}
{"id": "sms-007", "label": "ham", "text": "Can you pick up milk and bread on your way home? Thanks!"}
{"id": "sms-008", "label": "spam", "text": "You have 1 new voicemail. Call 0906-500-1122 to hear it. 3.00 per minute."}

Distillation Configuration

Distillation configuration is provided in YAML format with recommended default values from the algorithm team. Modify the values as needed. The following table describes some parameters that warrant attention.

Section

Description

dataset

  • output_path(default: distillation_dataset.jsonl): The output path for distillation artifacts. It produces JSONL data in RLCD format. You can change this value to another .jsonl file in a relative path or place it in a subdirectory.

  • schema: Defines the decision question and options. It is the single source of truth for the inline workflow and contains name (the workflow name, stored in the workflow field of each case row), question (the question key, such as "spam", which is also the nested key for elicitation, teacher, and gold), and instructions (the decision instructions presented to the teacher).

backend

  • timeout(default: 1200.0): The maximum wait time for a single request, in seconds. It must cover a response that uses all max_tokens (2048) and allow for network fluctuations.

  • max_retries(default: 3): The number of network-level retries for a single request. This differs from stage-level retries, which are configured by retry_attempts in the stage configuration.

system1

  • method(default: k_verbalized_mean): The elicitation method, which takes the mean of K verbalized probabilities.

  • samples(default: 4): The number of samples K for each question.

  • temperature(default: 0.7): The teacher sampling temperature, which controls generation diversity across the K samples.

  • max_tokens(default: 2048): The maximum number of tokens in each teacher response.

  • max_workers(default: 8): The number of concurrent API calls in the elicit stage.

  • seed(default: 7): The random seed for shuffling options.

  • shuffle_options(default: true): Shuffles the order of options for each call to eliminate teacher position bias.

  • resume(default: true): Supports stage-level resumption and row-level checkpoints during elicitation.

  • consistency_threshold(default: 0.6): The consistency filtering threshold. Questions with a top-1 agreement rate below this value are discarded. For example, when K=4, at least three samples must agree.

  • shrinkage(default: 0.02): The strength of shrinkage toward a uniform distribution, which prevents teacher probabilities from collapsing into a pure one-hot distribution. Set this value to 0 to disable shrinkage.

pipeline

  • build_cases: Combines raw data with the schema to build case rows.

  • elicit: Calls the teacher model for K independent samples for each case to obtain verbalized probability distributions.

  • aggregate: Aggregates the distributions from K teacher samples into soft labels and performs consistency filtering.

  • build_dataset: Combines cases and teacher soft labels, and outputs training data in RLCD format.