AIConfigurator Documentation

repository·main·Indexed 18 days ago

https://github.com/ai-dynamo/aiconfigurator

An optimization tool for disaggregated LLM serving that automates the search for optimal worker counts and parallelism settings to balance throughput against latency targets (TTFT/TPOT). It includes a high-performance Rust core (aiconfigurator-core v0.11.0) for GIL-free prefill, decode, and forward-pass latency estimation, and a Python SDK for model architecture registry and engine compilation.

Tokens
139.6K
Snippets
309
Records
528
Agent score
63%

What's inside AIConfigurator

  1. Overview of Network Collectors

    main

    Network Collectors are specialized scripts used for collective communication and network-facing benchmarking. Unlike standard framework registries that feed into a single backend, these collectors output data to shared communication tables.

    Available collectors include:

    • collect_comm.sh: A driver for local NCCL/oneCCL and custom allreduce collection.
    • collect_nccl.py: A wrapper for local NCCL collective benchmarks.
    • collect_oneccl_xpu.py: A wrapper for local oneCCL XPU collective benchmarks.
    • collect_all_reduce.py: A wrapper for local custom allreduce benchmarks.
    • slurm/: A suite for multi-node Slurm communication collection and post-processing.
  2. Overview of AIConfigurator

    main

    AIConfigurator is a tool designed to optimize disaggregated LLM serving configurations. It helps users determine the ideal number of prefill and decode workers, as well as parallelism settings, to meet specific SLA targets like TTFT (Time to First Token) and TPOT (Time per Output Token).

    Given a model, GPU count, and GPU type, the tool searches the configuration space and generates configuration files compatible with Dynamo or llm-d. It uses collected data for target machines and frameworks to evaluate thousands of configurations via a CLI or Python API.

  3. Kimi-K3 Bring-up Ledger: Performance Data Status

    main

    The Kimi-K3 (KimiK3ForConditionalGeneration) bring-up ledger tracks the integration of performance data into the database across multiple hardware systems and backends. As of the final-state record (2026-08-04), the following lanes are complete across eight systems (b200_sxm, b300_sxm, gb200, gb300, h100_sxm, h200_sxm, l40s, rtx_pro_6000_server):

    • kda: Supported via sglang 0.5.16 (kimi-k3 branch) and vllm 0.1.dev19262 (kimi-k3 preview).
    • moe (K3 shape, 3584/3072, 896x16): Supported via sglang 0.5.14 (Blackwell precision lanes, Hopper/rtx Marlin, l40s Triton) and vllm 0.24.0 (situ-as-silu Marlin lane).
    • mla_bmm 96-family (96/48/24/12 heads): Supported via sglang b200 and new vllm mla_bmm tables on b200/b300/gb200/gb300/h100/h200.
    • MegaMoE module (K3 shape): Supported via b200 sglang 0.5.16 (64 rows).

    Note: The support matrix contains 228 exact K3 rows at the merged head.

  4. Manage Collector V2 population and execution scope

    main

    Collector V2 population logic and execution plumbing are scoped to the following components:

    • collector/cases/**/*.yaml: Case definitions.
    • collector/case_generator.py: Case generation logic.
    • collector/model_cases.py: Model-specific case logic.
    • Operation-local case getters and quantization/precision parameters.
    • collector/collect.py: Model-specific op selection path.
    • Collector tests and documentation.

    Note: This work does not affect the AIC SDK, Rust lookup behavior, EngineSpec, or the Dynamo Planner. Collector output remains compatible with existing consumers.

  5. Overview of AIC CLI modes

    main

    The aiconfigurator CLI supports six distinct operational modes, each serving a different stage of the configuration and deployment workflow:

    • default: Standard mode for finding top configurations.
    • recommend: Recommends specific configurations.
    • exp: Experiment mode for running sweeps and testing multiple configurations.
    • generate: Quick start mode to generate a naive configuration.
    • estimate: Mode used to perform performance and power estimates.
    • support: Diagnostic mode for troubleshooting.
  6. Overview of the AIConfigurator Generator

    main

    The AIConfigurator generator transforms unified YAML inputs and overrides into backend-specific configurations, bash run scripts, and Kubernetes manifests. It supports multiple backends (vLLM, SGLang, TRT-LLM) and orchestration platforms (Dynamo, llm-d, FPM).

    End-to-End Flow

    1. Inputs: Unified YAML + inline overrides.
    2. Schema & Defaults: Uses deployment_config.yaml to define deployment-facing inputs (ports, images, cache settings, SLA knobs).
    3. Parameter Aggregation: Combines service, K8s, and role-specific parameters.
    4. Rule Plugins: Applies DSL rules (e.g., calculating GPUs per worker) to influence outputs.
    5. Parameter Mapping: Harmonizes backend-specific flags under unified field names via backend_config_mapping.yaml.
    6. Template Rendering: Uses Jinja templates to produce final artifacts.
    7. Generated Artifacts: Produces k8s_deploy.yaml, run_*.sh, and engine configs/CLI args.
  7. How SGLang performance collection execution modes work

    main

    The SGLang operator performance collection tools support two distinct execution modes:

    1. Direct Diagnostic Execution (Mode 1): Used for single GPU diagnostics by running specific scripts (collect_mla_module.py or collect_deepep_moe.py) directly with command-line arguments. This is ideal for isolated testing of a single module.

    2. Framework Execution (Mode 2): Uses the collect.py framework to run integrated collections. This allows you to run multiple operators sequentially or specify specific modules (like dsa_context_module or wideep_moe). In this mode, cases within a single operator are distributed across the available GPU pool. Module-level operators use subprocess-based GPU isolation via CUDA_VISIBLE_DEVICES to prevent NCCL/distributed initialization conflicts.

    # Example of Framework Execution (Mode 2)
    python collect.py --backend sglang --ops mla_bmm_gen_pre dsa_context_module
  8. Note on Rust and Python parity for GEMM

    main

    The GEMM implementation maintains parity between Python and Rust:

    • Ordering: While GemmGrids.by_quant in Rust uses a BTreeMap (alphabetical), ladder tie-breaks are pinned to the Python dict-insertion (file row) order. The loader records quant_order to ensure consistent behavior.
    • Selection Logic: xquant in Rust takes the FIRST same-profile sibling and does not retry if the grid is empty, matching Python's behavior. xprofile loops until a non-empty grid is found.
    • Validation: Oracle tests in operators/gemm.rs are used to pin Python values at a precision of 1e-9 to ensure cross-language consistency.
  9. Assemble DSA layers for prefill estimation

    main

    To estimate the total prefill latency, assemble the components (DSA, MoE, and Communication) into a serial layer and multiply by the number of layers.

    Assembly Pattern:

    1. DSA: dsa = ContextDSAModule.get_cp_dsa(b, isl, cp, db, dims)
    2. MoE: moe = MoEOp.get(num_tokens=isl, moe_tp=cp, moe_ep=ep, distribution=dist) (Note: MoE uses the full isl, not per-card).
    3. Comm: comm = db.ag_latency(isl*hidden*2, cp) + db.rs_latency(isl*hidden*2, cp)
    4. Layer: layer = dsa + moe + comm (These are treated as serial operations).
    5. Total Prefill: prefill = layer * num_layers (Note: The first k dense layers may not have MoE/DSA-MoE communication).

    Critical Invariants:

    • Base Row: Must be bf16-KV (even if KV is stored in fp8, the FMHA kernel is bf16).
    • MoE Parallelism: Communication primitives must follow the MoE parallel mode (e.g., TP+SP $\rightarrow$ AG_hidden+RS; EP $\rightarrow$ all-to-all).
    • RS (Reduce-Scatter): There is one RS per layer after MoE, performing TP-reduce+SP-scatter. Exclude cross_device_reduce (allreduce) as it is for decode/post-processing.
    dsa  = ContextDSAModule.get_cp_dsa(b, isl, cp, db, dims)
    moe  = MoEOp.get(num_tokens=isl, moe_tp=cp, moe_ep=ep, distribution=dist)   # full tokens
    comm = db.ag_latency(isl*hidden*2, cp) + db.rs_latency(isl*hidden*2, cp)    # AG_hidden + RS
    layer = dsa + moe + comm        # serial
    prefill = layer * num_layers    # (first_k_dense_replace layers have no MoE/DSA-MoE comm)
  10. Understand Power-Law Distribution in MoE Workload Simulation

    main

    In Mixture-of-Experts (MoE) performance benchmarking, a power-law distribution is used to simulate realistic token routing patterns. Unlike a uniform distribution where every expert receives an equal number of tokens, a power-law distribution creates a 'heavy-tailed' effect: a few 'hot' experts receive the majority of tokens, while many 'cold' experts receive very few. This accurately reflects real-world production scenarios where experts specialize in certain types of data.

    Key characteristics include:

    • Heavy-tailed: Few experts handle most tokens.
    • Scale-free: The pattern remains consistent across different scales.
    • Realistic: Mimics phenomena like Zipf's law or the Pareto principle.
  11. How GEMM quant transfer and estimation works

    main

    When a GEMM quantization mode has no collected data for a specific query, the system can estimate its utility in HYBRID or EMPIRICAL modes by borrowing a utility curve from a collected reference quant. This is managed via util_empirical.quant_transfer_grid.

    Estimation is based on a correction ratio derived from the relationship between the query and the reference. The system uses three confidence labels to determine how to borrow data:

    1. xshape: Same quantization, different slice. The correction is 1 (kernel identity).
    2. xquant: Same profile, different quantization. The correction is 1 (structural identity based on SOL-coefficient).
    3. xprofile: Different profile. Uses a level ratio (calibrated per-profile utility level) as a last resort.

    Reference selection follows a lexicographic preference: relation rank, then profile distance, then slice-feature distance.

    latency(query) = SOL_query / (util_ref × e(profile_query)/e(profile_ref))
  12. Configure Heterogeneous Disaggregated Serving

    main

    Heterogeneous disaggregated serving (where prefill and decode run on different hardware) is achieved by assigning different *_system_name values to the prefill and decode roles. Note that the model must remain the same for both roles. You can also compare different backends (e.g., trtllm, vllm, sglang) by setting the *_backend_name for each role.

    exp_b200_h200:
      serving_mode: disagg
      total_gpus: 16
      isl: 4000
      osl: 500
      ttft: 300.0
      tpot: 50.0
      prefill_model_path: Qwen/Qwen3-32B-FP8
      prefill_system_name: b200_sxm      # prefill on B200
      prefill_backend_name: trtllm
      decode_model_path: Qwen/Qwen3-32B-FP8
      decode_system_name: h200_sxm       # decode on H200
      decode_backend_name: trtllm