// Single `export const config` literal — no spreads/calls/IIFE (Mintlify re-evals at hydration).
// Cells are denormalized: no `--nnodes`/`--node-rank`/`--dist-init-addr` literals — engine injects them.
//
// `{{MODEL_NAME}}` resolves to `modelNames` below (HF repos under the thinkingmachines org).

export const config = {
  modelName: "Inkling",

  // Full platform list. Verified end-to-end: B200, B300, GB300, H200, and AMD
  // (MI350X / MI355X). The remaining cells (GB200, B200 BF16 multi-node) are
  // same-arch extrapolations and stay unverified until re-checked.
  supportedHardware: [
    "h200", "b200", "b300", "gb200", "gb300",
    "mi350x", "mi355x",
  ],

  variants: [
    { id: "default", label: "Default" },
    { id: "lora",    label: "LoRA"    },
  ],
  quantizations: [
    { id: "nvfp4", label: "NVFP4" },
    { id: "bf16",  label: "BF16"  },
  ],
  // One validated serving recipe per hardware -> a single honest `balanced` tier.
  strategies: [
    { id: "balanced",     label: "Balanced"                  },
    { id: "mtp",          label: "MTP"                        },
    { id: "long_context", label: "Long Context (MXFP8 KV)"    },
  ],
  nodesOptions: [
    { id: "single",  label: "Single Node" },
    { id: "multi-2", label: "Multi-Nodes" },
  ],

  // Eval set rendered in the benchmark card, keyed to per-cell `accuracy` in
  // inkling-benchmarks.jsx. All measured at reasoning_effort `max` (0.99).
  // AIME25 = pass@1 averaged over 8 repeats; NIAH = single-needle retrieval at
  // that context length; HLE = self-judged on the text-only subset.
  accuracyLabels: [
    ["bfcl_pct",      "BFCL (EXACT)",    "%"],
    ["mmau_pct",      "MMAU",            "%"],
    ["mmmu_pro_pct",  "MMMU-Pro",        "%"],
    ["aime25_pct",    "AIME25 (pass@1)", "%"],
    ["niah_512k_pct", "NIAH @512K",      "%"],
    ["niah_1m_pct",   "NIAH @1M",        "%"],
    ["hle_pct",       "HLE",             "%"],
  ],

  // HF repos under the thinkingmachines org.
  modelNames: {
    "default|nvfp4": "thinkingmachines/Inkling-NVFP4",
    "default|bf16":  "thinkingmachines/Inkling",
    "lora|nvfp4":    "thinkingmachines/Inkling-NVFP4",
    "lora|bf16":     "thinkingmachines/Inkling",
  },

  placeholders: {
    HOST_IP:   { target: "command", label: "Bind host",        default: "0.0.0.0"         },
    PORT:      { target: "command", label: "Bind port",        default: "30000"           },
    NODE0_IP:  { target: "command", label: "Head node IP",     default: "<node0-ip>"      },
    NODE_RANK: { target: "command", label: "This node rank",   default: "<node-rank>"     },
    HF_TOKEN:  { target: "command", label: "HF token (Docker)", default: "<your-hf-token>" },
    ADAPTER_PATH: { target: "command", label: "LoRA adapter dir", default: "<adapter_path>" },
    MAX_LORAS:    { target: "command", label: "Max LoRAs per batch", default: "1" },
    CURL_HOST: { target: "curl",    label: "Server host",      default: "localhost"       },
    CURL_PORT: { target: "curl",    label: "Server port",      default: "30000"           },
  },

  curl: `curl http://{{CURL_HOST}}:{{CURL_PORT}}/v1/chat/completions \\
-H 'Content-Type: application/json' \\
-d '{ "model": "{{MODEL_NAME}}", "messages": [{"role":"user","content":"Hello"}] }'`,

  // NVIDIA: two multi-arch CUDA builds (inkling-cu12 / inkling-cu13) — pick by your
  // CUDA version, not by GPU. AMD: inkling-rocm700-mi35x. Panel defaults to cu13.
  dockerImages: {
    h200:  "lmsysorg/sglang:inkling-cu13",
    b200:  "lmsysorg/sglang:inkling-cu13",
    b300:  "lmsysorg/sglang:inkling-cu13",
    gb200: "lmsysorg/sglang:inkling-cu13",
    gb300: "lmsysorg/sglang:inkling-cu13",
    mi350x: "lmsysorg/sglang:inkling-rocm700-mi35x",
    mi355x: "lmsysorg/sglang:inkling-rocm700-mi35x",
  },

  github: {
    cookbookModel: "thinkingmachines/inkling",
  },

  playgroundFeatures: {

    // ----- Card: "Attention Parallelism" -----
    // TP only. Inkling needs TP=8 to hold the 1M-token SWA + Mamba/sconv pools
    // (TP=4 can't fit — see §2). TP=16 is cross-node (multi-node path).
    attention: {
      knobs: [
        { id: "tp", label: "TP", values: [
          null, 4, 8,
          { value: 16, disable: { nodes: ["single"] },
            disableReason: "TP=16 requires 16 ranks — switch the Deploy panel's Nodes to Multi-Nodes first." },
        ]},
      ],
    },

    // ----- Card: "MoE Parallelism" -----
    // Blackwell (SM100) runs the FlashInfer TRT-LLM routed FP4 experts; Hopper (SM90)
    // has no FP4 runner and falls back to Marlin W4A16.
    moe: {
      backend: {
        options: [
          { id: null, label: "Inherited" },
          // NVIDIA backends hidden on AMD; AITER/Triton hidden on NVIDIA.
          { id: "flashinfer_trtllm_routed", label: "FlashInfer TRT-LLM (routed FP4)",
            flags: ["--moe-runner-backend flashinfer_trtllm_routed"],
            requiresHw: ["b200", "b300", "gb200", "gb300"],
            hide: { hw: ["mi350x", "mi355x"] } },
          { id: "marlin", label: "Marlin (W4A16)",
            flags: ["--moe-runner-backend marlin"],
            hide: { hw: ["mi350x", "mi355x"] } },
          { id: "aiter", label: "AITER",
            flags: ["--moe-runner-backend aiter"],
            hide: { hw: ["h200", "b200", "b300", "gb200", "gb300"] } },
          { id: "triton", label: "Triton",
            flags: ["--moe-runner-backend triton"],
            hide: { hw: ["h200", "b200", "b300", "gb200", "gb300"] } },
        ],
      },
    },

    // ----- Card: "Parsers" -----
    parsers: {
      items: [
        { id: "reasoning", label: "Reasoning Parser", flag: "--reasoning-parser inkling" },
        { id: "toolCall",  label: "Tool Call Parser", flag: "--tool-call-parser inkling" },
      ],
    },

    // ----- Card: "Speculative Decoding" -----  Inkling ships an MTP draft head.
    speculative: {
      options: [
        { id: "current", label: "Inherited from base" },
        { id: "off",     label: "Off (greedy)" },
        { id: "mtp",     label: "EAGLE / MTP 8-1-9",
          flags: ["--speculative-algorithm EAGLE", "--speculative-num-steps 8",
                  "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 9",
                  "--enable-multi-layer-eagle", "--speculative-use-rejection-sampling"] },
      ],
    },

    // ----- Card: "PD Disaggregation" -----  NVIDIA only; Mooncake MNNVL env gated to GB200/GB300.
    pdDisagg: {
      modes: [
        { id: "off",     label: "Off" },
        { id: "prefill", label: "Prefill role", hide: { hw: ["mi350x", "mi355x"] } },
        { id: "decode",  label: "Decode role",  hide: { hw: ["mi350x", "mi355x"] } },
      ],
      transferBackends: [
        { id: "mooncake", label: "Mooncake",
          env: [
            "MC_FORCE_MNNVL=1",
            "NCCL_MNNVL_ENABLE=1",
            "NCCL_CUMEM_ENABLE=1",
            "SGLANG_MOONCAKE_CUSTOM_MEM_POOL=True",
          ],
          envWhen: { hw: ["gb200", "gb300"] } },
      ],
      // Router fronting both roles; 8998 = prefill bootstrap port (default).
      router: {
        port: 30080,
        command:
`python3 -m sglang_router.launch_router \\
  --pd-disaggregation \\
  --prefill http://<prefill-host>:{{PREFILL_PORT}} 8998 \\
  --decode http://<decode-host>:{{DECODE_PORT}} \\
  --host 0.0.0.0 --port {{ROUTER_PORT}} \\
  --disable-circuit-breaker \\
  --health-check-interval-secs 999999`,
      },
    },

    // ----- Card: "Hierarchical KV Cache" -----  Native HiCache over the unified radix tree.
    hicache: {
      backends: [
        { id: null,       label: "Auto" },
        { id: "file",     label: "File" },
        { id: "mooncake", label: "Mooncake" },
        { id: "nixl",     label: "NiXL" },
      ],
      writePolicies: [
        { id: "auto",          label: "Auto" },
        { id: "write_through", label: "Write-through" },
        { id: "write_back",    label: "Write-back" },
      ],
    },
  },

  cells: [
    // ====================================================================
    // NVIDIA Blackwell (SM100) + NVFP4 — FlashInfer TRT-LLM routed FP4 experts.
    // B200 / B300 / GB300 verified; GB200 same-arch extrapolation.
    // ====================================================================
    {
      match: { hw: "b200", variant: "default", quant: "nvfp4", strategy: "balanced", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend flashinfer_trtllm",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.85",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "b300", variant: "default", quant: "nvfp4", strategy: "balanced", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend flashinfer_trtllm",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.85",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "gb200", variant: "default", quant: "nvfp4", strategy: "balanced", nodes: "single" },
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 4",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend flashinfer_trtllm",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.85",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "gb300", variant: "default", quant: "nvfp4", strategy: "balanced", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 4",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend flashinfer_trtllm",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.85",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    // ====================================================================
    // NVIDIA Hopper (SM90) + NVFP4 — no FP4 MoE runner on Hopper -> Marlin W4A16.
    // fa4 SplitKV auto-sets num_splits=1 on SM90. H200 verified.
    // ====================================================================
    {
      match: { hw: "h200", variant: "default", quant: "nvfp4", strategy: "balanced", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend marlin",
        "--moe-runner-backend marlin",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.85",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    // AMD ROCm (MI350X / MI355X) + BF16 — verified, TP=8. `--moe-runner-backend`
    // sits right after `--tp` so the Playground AITER override (re-inserted at
    // that anchor) reproduces this command exactly.
    {
      match: { hw: "mi350x", variant: "default", quant: "bf16", strategy: "balanced", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_USE_AITER=1",
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--moe-runner-backend aiter",
        "--attention-backend triton",
        "--disable-custom-all-reduce",
        "--disable-prefill-cuda-graph",
        "--mamba-radix-cache-strategy extra_buffer",
        "--page-size 128",
        "--mem-fraction-static 0.87",
        "--swa-full-tokens-ratio 0.2",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "mi355x", variant: "default", quant: "bf16", strategy: "balanced", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_USE_AITER=1",
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--moe-runner-backend aiter",
        "--attention-backend triton",
        "--disable-custom-all-reduce",
        "--disable-prefill-cuda-graph",
        "--mamba-radix-cache-strategy extra_buffer",
        "--page-size 128",
        "--mem-fraction-static 0.87",
        "--swa-full-tokens-ratio 0.2",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },

    // ====================================================================
    // Long Context (MXFP8 KV) — block-scaled KV cache shrinks the per-token
    // KV footprint, raising how many tokens fit in the memory pool (longer
    // context / more concurrent sequences) vs the default BF16 KV. Same base
    // command as Balanced + `--kv-cache-dtype mxfp8`. B200 / B300 / GB300
    // verified end-to-end.
    // ====================================================================
    {
      match: { hw: "b200", variant: "default", quant: "nvfp4", strategy: "long_context", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend flashinfer_trtllm",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.85",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--kv-cache-dtype mxfp8",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "b300", variant: "default", quant: "nvfp4", strategy: "long_context", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend flashinfer_trtllm",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.85",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--kv-cache-dtype mxfp8",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "gb200", variant: "default", quant: "nvfp4", strategy: "long_context", nodes: "single" },
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 4",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend flashinfer_trtllm",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.85",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--kv-cache-dtype mxfp8",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "gb300", variant: "default", quant: "nvfp4", strategy: "long_context", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 4",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend flashinfer_trtllm",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.85",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--kv-cache-dtype mxfp8",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },

    // ====================================================================
    // MTP (speculative decoding) — Inkling's multi-layer MTP draft head.
    // --enable-multi-layer-eagle is REQUIRED (without it the standard EAGLE
    // worker runs against the multi-layer draft and outputs garbage).
    // B200 / B300 / GB300 / H200 verified end-to-end.
    // ====================================================================
    {
      match: { hw: "b200", variant: "default", quant: "nvfp4", strategy: "mtp", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend flashinfer_trtllm",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.75",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--speculative-algorithm EAGLE",
        "--speculative-num-steps 8",
        "--speculative-eagle-topk 1",
        "--speculative-num-draft-tokens 9",
        "--enable-multi-layer-eagle",
        "--speculative-use-rejection-sampling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "b300", variant: "default", quant: "nvfp4", strategy: "mtp", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend flashinfer_trtllm",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.70",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--speculative-algorithm EAGLE",
        "--speculative-num-steps 8",
        "--speculative-eagle-topk 1",
        "--speculative-num-draft-tokens 9",
        "--enable-multi-layer-eagle",
        "--speculative-use-rejection-sampling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "gb200", variant: "default", quant: "nvfp4", strategy: "mtp", nodes: "single" },
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 4",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend flashinfer_trtllm",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.75",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--speculative-algorithm EAGLE",
        "--speculative-num-steps 8",
        "--speculative-eagle-topk 1",
        "--speculative-num-draft-tokens 9",
        "--enable-multi-layer-eagle",
        "--speculative-use-rejection-sampling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "gb300", variant: "default", quant: "nvfp4", strategy: "mtp", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 4",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend flashinfer_trtllm",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.75",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--speculative-algorithm EAGLE",
        "--speculative-num-steps 8",
        "--speculative-eagle-topk 1",
        "--speculative-num-draft-tokens 9",
        "--enable-multi-layer-eagle",
        "--speculative-use-rejection-sampling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "h200", variant: "default", quant: "nvfp4", strategy: "mtp", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend marlin",
        "--moe-runner-backend marlin",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.78",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--speculative-algorithm EAGLE",
        "--speculative-num-steps 8",
        "--speculative-eagle-topk 1",
        "--speculative-num-draft-tokens 9",
        "--enable-multi-layer-eagle",
        "--speculative-use-rejection-sampling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    // ====================================================================
    // GB300 BF16 — 2x GB300 nodes (4 GPUs each) over MNNVL. The NCCL_MNNVL /
    // NVLS / CUMEM envs are required: 2-node NCCL init hangs without them.
    // MTP on BF16 requires the v3 MTP checkpoint + an SGLang revision with
    // v3 MTP support.
    // ====================================================================
    {
      match: { hw: "gb300", variant: "default", quant: "bf16", strategy: "balanced", nodes: "multi-2" },
      verified: true,
      env: [
        "NCCL_MNNVL_ENABLE=1",
        "NCCL_NVLS_ENABLE=1",
        "NCCL_CUMEM_ENABLE=1",
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--dist-timeout 3600",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--attention-backend fa4",
        "--disable-custom-all-reduce",
        "--enable-torch-symm-mem",
        "--page-size 128",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.87",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "gb300", variant: "default", quant: "bf16", strategy: "mtp", nodes: "multi-2" },
      verified: true,
      env: [
        "NCCL_MNNVL_ENABLE=1",
        "NCCL_NVLS_ENABLE=1",
        "NCCL_CUMEM_ENABLE=1",
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--dist-timeout 3600",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--attention-backend fa4",
        "--disable-custom-all-reduce",
        "--enable-torch-symm-mem",
        "--page-size 128",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.87",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--speculative-algorithm EAGLE",
        "--speculative-num-steps 8",
        "--speculative-eagle-topk 1",
        "--speculative-num-draft-tokens 9",
        "--enable-multi-layer-eagle",
        "--speculative-use-rejection-sampling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "b300", variant: "default", quant: "bf16", strategy: "balanced", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--attention-backend fa4",
        "--page-size 128",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        // BF16 weights are large on B300 — 0.85 caps the token pool near ~315k
        // and rejects longer requests; 0.93 fits the full 1M context.
        "--mem-fraction-static 0.93",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "b300", variant: "default", quant: "bf16", strategy: "mtp", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--attention-backend fa4",
        "--page-size 128",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        // BF16 + MTP is tight on B300: 0.87 boots but caps the token pool near
        // ~185k; 0.93 fits the full 1M context (matches the Balanced cell).
        "--mem-fraction-static 0.93",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--speculative-algorithm EAGLE",
        "--speculative-num-steps 8",
        "--speculative-eagle-topk 1",
        "--speculative-num-draft-tokens 9",
        "--enable-multi-layer-eagle",
        "--speculative-use-rejection-sampling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "b200", variant: "default", quant: "bf16", strategy: "balanced", nodes: "multi-2" },
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 16",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--attention-backend fa4",
        "--disable-custom-all-reduce",
        "--page-size 128",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.87",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "b200", variant: "default", quant: "bf16", strategy: "mtp", nodes: "multi-2" },
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 16",
        "--moe-runner-backend flashinfer_trtllm_routed",
        "--attention-backend fa4",
        "--disable-custom-all-reduce",
        "--page-size 128",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.87",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--speculative-algorithm EAGLE",
        "--speculative-num-steps 8",
        "--speculative-eagle-topk 1",
        "--speculative-num-draft-tokens 9",
        "--enable-multi-layer-eagle",
        "--speculative-use-rejection-sampling",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    // ====================================================================
    // LoRA serving. Prefill CUDA graphs auto-disable under --enable-lora.
    // Set MAX_LORAS to the number of distinct adapters served (1 is fastest
    // for single-adapter serving). All cells except GB200 verified end-to-end
    // (coherence + trainer-logprob parity + throughput).
    // ====================================================================
    {
      match: { hw: "b200", variant: "lora", quant: "nvfp4", strategy: "balanced", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
        "SGLANG_EXPERIMENTAL_LORA_OPTI=1",
        "SGLANG_OPT_LORA_OVERLAP_MAIN_ALLOC=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend marlin",
        "--moe-runner-backend experimental_sgl_marlin",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.80",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--enable-lora",
        "--disable-prefill-cuda-graph",
        "--lora-backend triton",
        "--lora-use-virtual-experts",
        "--max-loras-per-batch {{MAX_LORAS}}",
        "--lora-paths lora0={{ADAPTER_PATH}}",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "b300", variant: "lora", quant: "nvfp4", strategy: "balanced", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
        "SGLANG_EXPERIMENTAL_LORA_OPTI=1",
        "SGLANG_OPT_LORA_OVERLAP_MAIN_ALLOC=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend marlin",
        "--moe-runner-backend experimental_sgl_marlin",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.80",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--enable-lora",
        "--disable-prefill-cuda-graph",
        "--lora-backend triton",
        "--lora-use-virtual-experts",
        "--max-loras-per-batch {{MAX_LORAS}}",
        "--lora-paths lora0={{ADAPTER_PATH}}",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "gb200", variant: "lora", quant: "nvfp4", strategy: "balanced", nodes: "single" },
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
        "SGLANG_EXPERIMENTAL_LORA_OPTI=1",
        "SGLANG_OPT_LORA_OVERLAP_MAIN_ALLOC=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 4",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend marlin",
        "--moe-runner-backend experimental_sgl_marlin",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.80",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--enable-lora",
        "--disable-prefill-cuda-graph",
        "--lora-backend triton",
        "--lora-use-virtual-experts",
        "--max-loras-per-batch {{MAX_LORAS}}",
        "--lora-paths lora0={{ADAPTER_PATH}}",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "gb300", variant: "lora", quant: "nvfp4", strategy: "balanced", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
        "SGLANG_EXPERIMENTAL_LORA_OPTI=1",
        "SGLANG_OPT_LORA_OVERLAP_MAIN_ALLOC=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 4",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend marlin",
        "--moe-runner-backend experimental_sgl_marlin",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.80",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--enable-lora",
        "--disable-prefill-cuda-graph",
        "--lora-backend triton",
        "--lora-use-virtual-experts",
        "--max-loras-per-batch {{MAX_LORAS}}",
        "--lora-paths lora0={{ADAPTER_PATH}}",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "h200", variant: "lora", quant: "nvfp4", strategy: "balanced", nodes: "single" },
      verified: true,
      env: [
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
        "SGLANG_EXPERIMENTAL_LORA_OPTI=1",
        "SGLANG_OPT_LORA_OVERLAP_MAIN_ALLOC=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--quantization modelopt_fp4",
        "--attention-backend fa4",
        "--page-size 128",
        "--fp4-gemm-backend marlin",
        "--moe-runner-backend experimental_sgl_marlin",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.85",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--enable-lora",
        "--disable-prefill-cuda-graph",
        "--lora-backend triton",
        "--lora-use-virtual-experts",
        "--max-loras-per-batch {{MAX_LORAS}}",
        "--lora-paths lora0={{ADAPTER_PATH}}",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    {
      match: { hw: "gb300", variant: "lora", quant: "bf16", strategy: "balanced", nodes: "multi-2" },
      verified: true,
      env: [
        "NCCL_MNNVL_ENABLE=1",
        "NCCL_NVLS_ENABLE=1",
        "NCCL_CUMEM_ENABLE=1",
        "SGLANG_ENABLE_UNIFIED_RADIX_TREE=1",
        "SGLANG_EXPERIMENTAL_LORA_OPTI=1",
        "SGLANG_OPT_LORA_OVERLAP_MAIN_ALLOC=1",
        "SGLANG_OPT_USE_JIT_KERNEL_MOE_ALIGN=1",
      ],
      flags: [
        "--trust-remote-code",
        "--model-path {{MODEL_NAME}}",
        "--tp 8",
        "--moe-runner-backend experimental_sgl_trtllm",
        "--attention-backend fa4",
        "--page-size 128",
        "--enable-torch-symm-mem",
        "--mamba-radix-cache-strategy extra_buffer",
        "--mem-fraction-static 0.87",
        "--swa-full-tokens-ratio 0.1",
        "--mamba-full-memory-ratio 0.1",
        "--enable-multimodal",
        "--reasoning-parser inkling",
        "--tool-call-parser inkling",
        "--enable-lora",
        "--disable-prefill-cuda-graph",
        "--lora-backend triton",
        "--lora-use-virtual-experts",
        "--max-loras-per-batch {{MAX_LORAS}}",
        "--lora-paths lora0={{ADAPTER_PATH}}",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
  ],
};
