跳转至

adapt_rotation Configuration Reference

1. Configuration Overview

Adaptive rotation (adapt_rotation) processor configuration.

Item Content
Config Class AdaptRotationProcessorConfig
Source adapt_rotation.py

2. Parameter List

2.1 AdaptRotationProcessorConfig

Field Path Type Required/Optional Default Value Range or Format Description Referenced Config
type string Optional adapt_rotation adapt_rotation Processor type, fixed to adapt_rotation. None
stage int Required None 1, 2 Rotation adaptation stage: 1 or 2; determines which stage configuration is used. None
stage_config object Required None — Stage configuration object (an internally assembled field; it is required but generated automatically by a before-validator based on stage, so users do not configure it in YAML); do not configure this field directly in YAML. Instead, flatten the stage fields (such as steps and quant_dtype) under the processor; see AdaptRotationStage1ProcessorConfig Configuration Reference / AdaptRotationStage2ProcessorConfig Configuration Reference. This page §2.2

Configuration Constraints

  • Assembles the flat fields into stage_config by stage: only fields of the corresponding stage are allowed; extra fields raise an error.

2.2 ProcessorConfig

Derived Classes

Config Class Description Document
AdaptRotationStage1ProcessorConfig Configuration of adapt_rotation stage 1. This page §2.2.1
AdaptRotationStage2ProcessorConfig Configuration of adapt_rotation stage 2. This page §2.2.2

2.2.1 AdaptRotationStage1ProcessorConfig

Configuration of adapt_rotation stage 1.

Field Path Type Required/Optional Default Value Range or Format Description Referenced Config
type string Optional _adapt_rotation_stage1 _adapt_rotation_stage1 Stage configuration type; an internal identifier that does not need to be configured. None
steps int Optional 20 — Number of iterative optimization steps None
quant_dtype string Optional int4 int4, int8 Quantization bit width; it should match the activation quantization type used downstream (for example int4 for w4a4 and int8 for w8a8) None
layer_type list[string] Optional ['up_proj'] At least 1 item List of layer name substrings whose activations are collected None
block_size int Optional -1 — Block size; -1 means hidden_dim None
max_samples int Optional 2048 — Maximum number of samples per layer None

Configuration Constraints

  • Validates layer_type: each element must be a non-empty string of length <= 128
  • Validates block_size: the value must be -1 or a non-negative integer power of 2

2.2.2 AdaptRotationStage2ProcessorConfig

Configuration of adapt_rotation stage 2.

Field Path Type Required/Optional Default Value Range or Format Description Referenced Config
type string Optional _adapt_rotation_stage2 _adapt_rotation_stage2 Stage configuration type; an internal identifier that does not need to be configured. None
online bool Optional false — Whether to enable online rotation None
block_size int Optional -1 — Block size; -1 means hidden_dim None
down_proj_online_layers list[int] Optional [] — Index list of online down_proj layers None
max_tp_size int Optional 4 — Maximum TP parallelism None

Configuration Constraints

  • Validates down_proj_online_layers: each element must be a non-negative integer
  • Validates max_tp_size: it must be at least 1 and a power of 2
  • Validates block_size: the value must be -1 or a non-negative integer power of 2

3. Complete Configuration Reference

apiversion: modelslim_v1
spec:
  prior:
  - process:
    - type: adapt_rotation
      stage: 1
      steps: 20
      quant_dtype: int4
      layer_type:
      - up_proj
      block_size: -1
      max_samples: 2048
  process:
  - type: adapt_rotation
    stage: 2
    online: false
    block_size: -1
    max_tp_size: 1