# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Muse Spark Open (816B-A42B) on one GB300 NVL node (4 GPUs, TP4/EP4) for agentic workloads:
# long multi-turn contexts (up to 1M tokens) where each request mostly extends an earlier one.
# Max-throughput recipe, measured with the AgentX benchmark at 48 concurrent sessions.
# Pass to trtllm-serve with --config. See "Agentic Workloads" in ../../../docs/source/deployment-guide/
# deployment-guide-for-musespark-open-on-trtllm.md for the walkthrough and the measurements.
# Apart from max_batch_size and cuda_graph_config, the settings match
# musespark-open-agentic-balanced.yaml: apply any other tuning to both recipes.
tensor_parallel_size: 4
moe_expert_parallel_size: 4
max_batch_size: 48
# The model's full context window.
max_seq_len: 1048576
trust_remote_code: true
enable_chunked_prefill: true
allreduce_strategy: NCCL
moe_config:
  backend: TRTLLM
scheduler_config:
  capacity_scheduler_policy: MAX_UTILIZATION
cuda_graph_config:
  enable_padding: true
  max_batch_size: 48
  batch_sizes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
     24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
     48]
# Prefill (context) steps also replay CUDA graphs, captured at these token counts.
prefill_cuda_graph_backend: breakable
prefill_capture_num_tokens: [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 768, 1024, 1280, 1536, 1792,
   2048, 2304, 2560, 2816, 3072, 3584, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 7680, 8192]
kv_cache_config:
  # FP8 KV cache is required on SM103 when chunked prefill or block reuse is enabled
  # (head-dimension-64 paged-context FMHA constraint).
  dtype: fp8
  block_reuse_config:
    # Under cache pressure, keep the sliding-window blocks that end each prompt (its last window
    # plus this many tokens) and evict the other sliding-window blocks first.
    swa_endpoint_rewind_tokens: 1024
  # Fixed split of the GPU KV pool across the two KV layer groups, in layer-group ID order:
  # [sliding-window group (2,048-token window), full-attention group].
  pool_ratio: [0.25, 0.75]
  free_gpu_memory_fraction: 0.8
  # Host-memory KV tier per GPU: 160 GiB, 640 GiB per node. Blocks evicted from GPU
  # memory move here and are copied back on a prefix hit instead of being recomputed.
  host_cache_size: 171798691840
# Text-only serving: the vision and audio towers are not loaded, and image, video or audio
# input is rejected. Remove this line to accept multimodal requests.
disable_mm_encoder: true
# Response formatting and detokenization run in separate processes. For trtllm-serve only: remove
# it for the LLM API (e.g. trtllm-eval), whose outputs otherwise come back without text.
num_postprocess_workers: 8
# Streaming responses are sent every 20 decoding steps, which lowers the per-token
# overhead at high concurrency.
stream_interval: 20
# A prompt that extends a recently seen prompt only has its new tail tokenized.
enable_tokenization_cache: true
# Per-iteration statistics (batch, KV-cache and prefix-reuse counters), served as JSON at /metrics;
# collected every 40th step.
enable_iter_perf_stats: true
iter_perf_stats_interval: 40
