> ## Documentation Index
> Fetch the complete documentation index at: https://lmsysorg-dsv4-1.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# DeepSeek-V4

> Deploy DeepSeek-V4 with SGLang — verified launch commands, benchmarks, and tuning for Flash Official (0731), Flash, Flash Vision (Exp), Pro, and Pro Official (0813).

export const Playground = ({config}) => {
  if (!config) {
    return <div style={{
      padding: 12,
      color: "#b91c1c"
    }}>Playground: missing <code>config</code> prop</div>;
  }
  const DIMENSIONS = ["hw", ...(config.matchDims || [{
    id: "variant"
  }, {
    id: "quant"
  }, {
    id: "strategy"
  }, {
    id: "nodes"
  }]).map(d => d.id)];
  const optionVisible = (opt, sel) => typeof opt.showWhen !== "function" || opt.showWhen(sel);
  const optionDisabled = (opt, sel) => typeof opt.disabled === "function" ? opt.disabled(sel) : !!opt.disabled;
  const visibleOptions = (spec, sel) => (spec.options || []).filter(o => optionVisible(o, sel));
  const rowVisible = (spec, sel) => (typeof spec.showWhen !== "function" || spec.showWhen(sel)) && visibleOptions(spec, sel).length > 0;
  const overlayPick = sel => {
    const picked = [];
    for (const spec of config.overlayDims || []) {
      if (!rowVisible(spec, sel)) continue;
      const opt = (spec.options || []).find(o => o.id === sel[spec.id]);
      if (opt && !optionDisabled(opt, sel)) picked.push(opt);
    }
    return picked;
  };
  const overlayPart = (sel, key) => {
    const out = [];
    for (const opt of overlayPick(sel)) {
      const add = typeof opt[key] === "function" ? opt[key](sel) : opt[key];
      if (add) out.push(...add);
    }
    return out;
  };
  const overlayCompose = (cellFlags, sel) => {
    const strip = overlayPart(sel, "stripPrefixes");
    const add = overlayPart(sel, "flags");
    if (!strip.length) return [...cellFlags || [], ...add];
    const used = new Set();
    const replacementsFor = tok => {
      const out = [];
      add.forEach((f, i) => {
        if (used.has(i) || f.split(/[\s=]/)[0] !== tok) return;
        used.add(i);
        out.push(f);
      });
      return out;
    };
    const out = [];
    for (const f of cellFlags || []) {
      const tok = f.split(/[\s=]/)[0];
      if (!strip.includes(tok)) out.push(f); else out.push(...replacementsFor(tok));
    }
    add.forEach((f, i) => {
      if (!used.has(i)) out.push(f);
    });
    return out;
  };
  const withOverlay = (cell, sel) => cell && ({
    ...cell,
    flags: overlayCompose(cell.flags, sel),
    env: [...cell.env || [], ...overlayPart(sel, "env")]
  }) || cell;
  const STORAGE_KEY = "sglang-deploy-env";
  const DEPLOYMENT_COMPONENT_ID = "deployment-configurator";
  const pgFeatures = config.playgroundFeatures || ({});
  const PD_PORTS = {
    prefill: {
      serve: 30000,
      dist: 30335
    },
    decode: {
      serve: 30100,
      dist: 30435
    }
  };
  const findCell = (cells, sel) => cells.find(c => DIMENSIONS.every(d => c.match[d] === sel[d]));
  const findMatchingCell = (cells, sel, pgEnv, pgFlags) => {
    const fixedDims = DIMENSIONS.filter(d => d !== "strategy");
    const flagsEq = (a, b) => a.length === b.length && a.every((x, i) => x === b[i]);
    const envEq = (a, b) => {
      if (a.length !== b.length) return false;
      const set = new Set(a);
      for (const x of b) if (!set.has(x)) return false;
      return true;
    };
    for (const c of cells) {
      if (fixedDims.some(d => c.match[d] !== sel[d])) continue;
      if (flagsEq(c.flags || [], pgFlags || []) && envEq(c.env || [], pgEnv || [])) {
        return c;
      }
    }
    return null;
  };
  const resolveModelName = sel => {
    const keys = [`${sel.hw}|${sel.variant}|${sel.quant}`, `${sel.variant}|${sel.quant}`, `${sel.hw}|${sel.quant}`, sel.quant, sel.hw, "default"];
    for (const k of keys) {
      const hit = config.modelNames[k];
      if (hit) return hit;
    }
    return "";
  };
  const interpolate = (text, env, modelName) => text.replace(/{{(\w+)}}/g, (_, key) => key === "MODEL_NAME" ? modelName : env[key] ?? `{{${key}}}`);
  const parseNnodes = id => {
    if (id === "single") return 1;
    const m = (/^multi-(\d+)$/).exec(id);
    return m ? parseInt(m[1], 10) : 1;
  };
  const placeholderDefaults = schema => {
    const out = {};
    for (const [k, v] of Object.entries(schema || ({}))) out[k] = v.default ?? "";
    return out;
  };
  const matchConstraint = (base, constraint) => {
    if (!constraint || typeof constraint !== "object") return false;
    const entries = Object.entries(constraint);
    if (entries.length === 0) return false;
    return entries.every(([k, vs]) => Array.isArray(vs) && vs.includes(base[k]));
  };
  const resolveRouter = (fc, sel) => {
    if (!fc || !fc.router) return null;
    const hit = (fc.routerOverrides || []).find(r => r && matchConstraint(sel, r.when));
    return hit ? {
      ...fc.router,
      ...hit
    } : fc.router;
  };
  const evaluateChip = (entry, base) => {
    if (entry === null || typeof entry !== "object") {
      return {
        value: entry,
        label: undefined,
        hidden: false,
        disabled: false,
        disableReason: ""
      };
    }
    const hidden = entry.hide ? matchConstraint(base, entry.hide) : false;
    let disabled = entry.disabled === true || entry.disable === true;
    let disableReason = typeof entry.disableReason === "function" ? entry.disableReason(base) : entry.disableReason || "";
    if (!disabled && entry.disable && typeof entry.disable === "object") {
      if (Array.isArray(entry.disable)) {
        for (const item of entry.disable) {
          const cond = item && item.when || item;
          if (matchConstraint(base, cond)) {
            disabled = true;
            if (item && item.reason) disableReason = item.reason;
            break;
          }
        }
      } else {
        disabled = matchConstraint(base, entry.disable);
      }
    }
    return {
      ...entry,
      value: entry.id !== undefined ? entry.id : entry.value,
      label: entry.label,
      hidden,
      disabled,
      disableReason
    };
  };
  const findEntry = (entries, picked) => {
    for (const e of entries || []) {
      const v = e === null || typeof e !== "object" ? e : e.id !== undefined ? e.id : e.value;
      if (v === picked) return e;
    }
    return null;
  };
  const isHidden = (entries, picked, base) => {
    const e = findEntry(entries, picked);
    if (e === null || e === undefined) return false;
    return evaluateChip(e, base).hidden;
  };
  const stripFlagsByFirstToken = (flags, prefixes) => {
    const set = new Set(prefixes);
    return flags.filter(f => !set.has(f.split(/[\s=]/)[0]));
  };
  const stripEnvByPrefix = (envList, prefixes) => {
    if (!prefixes || !prefixes.length) return envList;
    const set = new Set(prefixes);
    return envList.filter(e => !set.has(e.split("=")[0]));
  };
  const insertBeforeTail = (flags, additions) => {
    const idx = flags.findIndex(f => f.startsWith("--host"));
    const at = idx === -1 ? flags.length : idx;
    const out = flags.slice();
    out.splice(at, 0, ...additions);
    return out;
  };
  const insertAfter = (flags, afterAnyOf, additions) => {
    let idx = -1;
    for (const anchor of afterAnyOf) {
      idx = flags.findIndex(f => f.split(/[\s=]/)[0] === anchor);
      if (idx !== -1) break;
    }
    if (idx === -1) idx = flags.findIndex(f => f.startsWith("--model-path"));
    const out = flags.slice();
    out.splice(idx + 1, 0, ...additions);
    return out;
  };
  const parseIntFlag = (flags, prefix) => {
    for (const f of flags || []) {
      if (f.split(/[\s=]/)[0] !== prefix) continue;
      const rest = f.slice(prefix.length).replace(/^[\s=]+/, "");
      const n = parseInt(rest, 10);
      if (!isNaN(n)) return n;
    }
    return null;
  };
  const hasFlag = (flags, name) => (flags || []).some(f => f.split(/[\s=]/)[0] === name);
  const findFlagArg = (flags, prefix) => {
    for (const f of flags || []) {
      if (f.split(/[\s=]/)[0] !== prefix) continue;
      const rest = f.slice(prefix.length).replace(/^[\s=]+/, "");
      return rest.length ? rest : null;
    }
    return null;
  };
  const TP_HEADS = ["--tp-size", "--tp", "--tensor-parallel-size"];
  const EP_HEADS = ["--ep-size", "--ep", "--expert-parallel-size"];
  const DP_HEADS = ["--dp-size", "--dp", "--data-parallel-size"];
  const parseIntFlagAny = (flags, heads) => {
    for (const head of heads) {
      const n = parseIntFlag(flags, head);
      if (n !== null) return n;
    }
    return null;
  };
  const flagSpelling = (flags, heads, fallback) => heads.find(head => (flags || []).some(f => f.split(/[\s=]/)[0] === head)) || fallback;
  const ANCHOR_NEAR_MODEL_PATH = ["--model-path"];
  const ANCHOR_NEAR_TP = ["--tp-size", "--tp", "--model-path"];
  const ANCHOR_NEAR_DP = ["--dp-size", "--dp", "--tp-size", "--tp", "--model-path"];
  const ANCHOR_NEAR_DPATTN = ["--enable-dp-attention", "--dp-size", "--dp", "--tp-size", "--tp", "--model-path"];
  const ANCHOR_NEAR_MOE = ["--moe-a2a-backend", "--moe-runner-backend", "--enable-dp-attention", "--dp-size", "--dp", "--tp-size", "--tp", "--model-path"];
  const helpers = {
    matchConstraint,
    evaluateChip,
    findEntry,
    isHidden,
    stripFlagsByFirstToken,
    stripEnvByPrefix,
    insertBeforeTail,
    insertAfter,
    parseIntFlag,
    hasFlag,
    findFlagArg,
    TP_HEADS,
    EP_HEADS,
    DP_HEADS,
    parseIntFlagAny,
    flagSpelling,
    ANCHOR_NEAR_MODEL_PATH,
    ANCHOR_NEAR_TP,
    ANCHOR_NEAR_DP,
    ANCHOR_NEAR_DPATTN,
    ANCHOR_NEAR_MOE
  };
  const HICACHE_HEADS = ["--enable-hierarchical-cache", "--hicache-ratio", "--hicache-size", "--hicache-write-policy", "--hicache-mem-layout", "--hicache-io-backend", "--hicache-storage-backend", "--hicache-storage-prefetch-policy", "--hicache-storage-backend-extra-config"];
  const CP_ENABLE_HEADS = ["--enable-prefill-cp", "--enable-nsa-prefill-context-parallel", "--enable-dsa-prefill-context-parallel", "--enable-prefill-context-parallel"];
  const CP_MODE_HEADS = ["--nsa-prefill-cp-mode", "--dsa-prefill-cp-mode", "--prefill-cp-mode"];
  const CP_OWNED_HEADS = [...CP_ENABLE_HEADS, ...CP_MODE_HEADS, "--cp-strategy", "--attn-cp-size"];
  const CP_MODE_TO_STRATEGY = {
    "in-seq-split": "zigzag",
    "round-robin-split": "interleave"
  };
  const cpEnabledIn = flags => CP_ENABLE_HEADS.some(head => hasFlag(flags, head));
  const bakedCpStrategy = flags => findFlagArg(flags, "--cp-strategy") || CP_MODE_TO_STRATEGY[findFlagArg(flags, "--nsa-prefill-cp-mode")] || CP_MODE_TO_STRATEGY[findFlagArg(flags, "--dsa-prefill-cp-mode")] || CP_MODE_TO_STRATEGY[findFlagArg(flags, "--prefill-cp-mode")] || null;
  const AXIS_HANDLERS = {
    attention: {
      initState: () => ({
        tp: null,
        cp: null,
        cpStrategy: null,
        dpAttn: null
      }),
      deriveFromBase: (cell, fc, h) => {
        const flags = cell && cell.flags || [];
        const dpVal = h.parseIntFlagAny(flags, h.DP_HEADS);
        const hasDpAttn = h.hasFlag(flags, "--enable-dp-attention");
        let dpAttn;
        if (dpVal !== null) dpAttn = dpVal; else if (hasDpAttn) dpAttn = 1; else dpAttn = false;
        const cpSize = h.parseIntFlag(flags, "--attn-cp-size");
        return {
          tp: h.parseIntFlagAny(flags, h.TP_HEADS),
          cp: cpEnabledIn(flags) ? cpSize !== null ? cpSize : 2 : null,
          cpStrategy: bakedCpStrategy(flags),
          dpAttn
        };
      },
      apply: ({flags, env, value, fc, sel, h}) => {
        const knobEntry = id => (fc.knobs || []).find(k => k.id === id) || ({});
        const factsNow = () => ({
          ...sel || ({}),
          dpAttnOn: h.hasFlag(flags, "--enable-dp-attention"),
          cpOn: cpEnabledIn(flags),
          cpStrategy: bakedCpStrategy(flags) || "interleave",
          effTp: h.parseIntFlagAny(flags, h.TP_HEADS)
        });
        const cpSizeTargetNow = () => {
          if (knobEntry("cp").freeSize) return null;
          const dpIntent = value.dpAttn !== null && value.dpAttn !== undefined ? value.dpAttn : h.hasFlag(flags, "--enable-dp-attention") ? h.parseIntFlagAny(flags, h.DP_HEADS) ?? 1 : false;
          if (typeof dpIntent === "number" && dpIntent > 1) return null;
          return h.parseIntFlagAny(flags, h.TP_HEADS);
        };
        const blocked = (id, v) => {
          const facts = factsNow();
          const kc = h.evaluateChip(knobEntry(id), facts);
          if (kc.hidden || kc.disabled) return true;
          if (id === "cp" && typeof v === "number" && v > 1) {
            const target = cpSizeTargetNow();
            if (target !== null && v !== target) return true;
          }
          const e = h.findEntry(knobEntry(id).values || [], v);
          return !!(e !== null && e !== undefined && h.evaluateChip(e, facts).disabled);
        };
        if (value.tp !== null && !blocked("tp", value.tp)) {
          const tpHead = h.flagSpelling(flags, h.TP_HEADS, "--tp");
          flags = h.stripFlagsByFirstToken(flags, h.TP_HEADS);
          flags = h.insertAfter(flags, h.ANCHOR_NEAR_MODEL_PATH, [`${tpHead} ${value.tp}`]);
        }
        const cpStrategyOverride = value.cpStrategy && !blocked("cpStrategy", value.cpStrategy) ? value.cpStrategy : null;
        const cpPick = value.cp !== null ? value.cp : cpStrategyOverride && cpEnabledIn(flags) ? h.parseIntFlag(flags, "--attn-cp-size") ?? 2 : null;
        const cpStrategyPick = cpStrategyOverride || bakedCpStrategy(flags) || "interleave";
        if (cpPick !== null && !blocked("cp", cpPick)) {
          flags = h.stripFlagsByFirstToken(flags, CP_OWNED_HEADS);
          if (cpPick > 1) {
            flags = h.insertAfter(flags, h.ANCHOR_NEAR_DPATTN, [`--attn-cp-size ${cpPick}`, "--enable-prefill-cp", `--cp-strategy ${cpStrategyPick}`]);
          }
        }
        const dpForced = (knobEntry("dpAttn").forceOff || []).find(r => r && h.matchConstraint(factsNow(), r.when));
        if (dpForced) {
          flags = h.stripFlagsByFirstToken(flags, [...h.DP_HEADS, "--enable-dp-attention", "--enable-dp-attention-local-control-broadcast"]);
          const stripEnv = dpForced.stripEnv || [];
          if (stripEnv.length) {
            env = env.filter(e => !stripEnv.includes(e.split("=")[0]));
          }
        } else if (value.dpAttn !== null && value.dpAttn !== undefined && !blocked("dpAttn", value.dpAttn)) {
          const dpHead = h.flagSpelling(flags, h.DP_HEADS, "--dp-size");
          const hadLocalBroadcast = h.hasFlag(flags, "--enable-dp-attention-local-control-broadcast");
          flags = h.stripFlagsByFirstToken(flags, [...h.DP_HEADS, "--enable-dp-attention", "--enable-dp-attention-local-control-broadcast"]);
          if (typeof value.dpAttn === "number" && value.dpAttn > 0) {
            flags = h.insertAfter(flags, h.ANCHOR_NEAR_TP, [`${dpHead} ${value.dpAttn}`, "--enable-dp-attention", ...hadLocalBroadcast ? ["--enable-dp-attention-local-control-broadcast"] : []]);
          }
        }
        return {
          flags,
          env
        };
      },
      render: ({axisId, value, setValue, fc, base, s, h, renderSelect, derived}) => {
        const knobs = fc.knobs || [];
        if (!knobs.length) return null;
        const setKnob = (k, v) => setValue({
          ...value,
          [k]: v
        });
        const labelFor = knob => c => {
          if (c.label !== undefined) return c.label;
          if (knob.id === "dpAttn") {
            const labelMap = knob.labels || ({
              "auto": "Auto",
              "false": "Off"
            });
            const k = c.value === null ? "auto" : String(c.value);
            return labelMap[k] || k;
          }
          return c.value === null ? "Auto" : String(c.value);
        };
        const knobDisplay = knob => {
          const v = value[knob.id];
          if (v !== null && v !== undefined) return v;
          if (derived && derived[knob.id] !== undefined) return derived[knob.id];
          return null;
        };
        const hideNullFor = knob => {
          const d = derived ? derived[knob.id] : null;
          return d !== null && d !== undefined ? [null] : [];
        };
        const entriesFor = knob => {
          const vals = knob.values || [null];
          if (knob.id !== "cp" || knob.freeSize) return vals;
          const target = base.cpSizeTarget;
          if (target === null || target === undefined) return vals;
          return vals.map(entry => {
            const v = entry === null || typeof entry !== "object" ? entry : entry.id !== undefined ? entry.id : entry.value;
            if (typeof v !== "number" || v <= 1 || v === target) return entry;
            const wrapped = entry === null || typeof entry !== "object" ? {
              value: entry
            } : {
              ...entry
            };
            return {
              ...wrapped,
              disabled: true,
              disableReason: `SGLang derives the prefill-CP size as attn_cp_size = TP / DP-Attention (= ${target} here), so only that size can be enabled.`
            };
          });
        };
        return <div key={axisId} style={s.card}>
            <div style={s.compactRow}>
              <span style={s.axisTitle}>Attention</span>
              {knobs.map(knob => {
          const kc = h.evaluateChip(knob, base);
          if (kc.hidden) return null;
          const forced = (knob.forceOff || []).find(r => r && h.matchConstraint(base, r.when));
          return <span key={knob.id} style={s.field}>
                    <span style={s.fieldLabel}>{knob.label || knob.id.toUpperCase()}</span>
                    {renderSelect(forced ? false : knobDisplay(knob), entriesFor(knob), nv => setKnob(knob.id, nv), base, labelFor(knob), {
            hideValues: hideNullFor(knob),
            disabled: kc.disabled || !!forced,
            disabledReason: forced ? forced.reason : kc.disableReason
          })}
                  </span>;
        })}
            </div>
          </div>;
      }
    },
    moe: {
      initState: () => ({
        backend: null,
        ep: null,
        mmQuant: null
      }),
      deriveFromBase: (cell, fc, h) => {
        const flags = cell && cell.flags || [];
        const a2a = h.findFlagArg(flags, "--moe-a2a-backend");
        const runner = h.findFlagArg(flags, "--moe-runner-backend");
        const w4a4 = h.hasFlag(flags, "--enable-w4a4-mxfp4-megamoe");
        return {
          backend: a2a || runner || null,
          ep: h.parseIntFlagAny(flags, h.EP_HEADS),
          mmQuant: w4a4 ? "w4a4" : "w4a8"
        };
      },
      apply: ({flags, env, value, fc, h, derived}) => {
        if (value.backend !== null) {
          flags = h.stripFlagsByFirstToken(flags, ["--moe-a2a-backend", "--moe-runner-backend"]);
          const backendEnvKeys = [];
          for (const o of fc.backend?.options || []) {
            for (const e of o.env || []) backendEnvKeys.push(e.split("=")[0]);
          }
          if (backendEnvKeys.length) env = h.stripEnvByPrefix(env, backendEnvKeys);
          const opt = (fc.backend?.options || []).find(o => o.id === value.backend);
          if (opt?.flags?.length) {
            flags = h.insertAfter(flags, h.ANCHOR_NEAR_DPATTN, opt.flags);
          }
          if (opt?.env?.length) env = [...env, ...opt.env];
        }
        const mq = fc.megamoeQuant;
        if (mq) {
          const quantKeys = [];
          const quantFlagHeads = [];
          for (const o of mq.options || []) {
            for (const e of o.env || []) quantKeys.push(e.split("=")[0]);
            for (const f of o.flags || []) quantFlagHeads.push(f.split(/[\s=]/)[0]);
          }
          flags = h.stripFlagsByFirstToken(flags, quantFlagHeads);
          const effBackend = value.backend !== null ? value.backend : derived && derived.backend;
          if (effBackend === "megamoe") {
            env = h.stripEnvByPrefix(env, [...mq.stripEnv || [], ...quantKeys]);
            const quant = value.mmQuant != null ? value.mmQuant : derived && derived.mmQuant || "w4a8";
            const opt = (mq.options || []).find(o => o.id === quant);
            if (opt?.flags?.length) {
              flags = h.insertAfter(flags, h.ANCHOR_NEAR_MOE, opt.flags);
            }
            if (opt?.env?.length) env = [...env, ...opt.env];
          } else if (value.backend !== null) {
            env = h.stripEnvByPrefix(env, quantKeys);
          }
        }
        if (value.ep !== null) {
          const epHead = h.flagSpelling(flags, h.EP_HEADS, "--ep");
          flags = h.stripFlagsByFirstToken(flags, h.EP_HEADS);
          if (value.ep > 1) {
            flags = h.insertAfter(flags, h.ANCHOR_NEAR_MOE, [`${epHead} ${value.ep}`]);
          }
        }
        return {
          flags,
          env
        };
      },
      render: ({axisId, value, setValue, fc, base, s, renderSelect, derived}) => {
        if (!fc.backend && !fc.ep) return null;
        const setSlot = (k, v) => setValue({
          ...value,
          [k]: v
        });
        const slotDisplay = k => {
          const v = value[k];
          if (v !== null && v !== undefined) return v;
          if (derived && derived[k] !== undefined) return derived[k];
          return null;
        };
        const hideNull = k => {
          const d = derived ? derived[k] : null;
          return d !== null && d !== undefined ? [null] : [];
        };
        const mmOpt = (fc.backend?.options || []).find(o => o.id === "megamoe");
        const mmAvail = !!mmOpt && (!mmOpt.requiresHw || mmOpt.requiresHw.includes(base.hw)) && (!mmOpt.excludesStrategy || !mmOpt.excludesStrategy.includes(base.strategy));
        const backendIsMega = slotDisplay("backend") === "megamoe";
        const epShown = !!fc.ep && !(typeof fc.ep.showWhen === "function" && !fc.ep.showWhen(base));
        return <div key={axisId} style={s.card}>
            <div style={s.compactRow}>
              <span style={s.axisTitle}>MoE</span>
              {fc.backend && <span style={s.field}>
                  <span style={s.fieldLabel}>Backend</span>
                  {renderSelect(slotDisplay("backend"), fc.backend.options || [], v => setSlot("backend", v), base, undefined, {
          hideValues: [...hideNull("backend"), ...mmAvail ? [] : ["megamoe"]]
        })}
                </span>}
              {fc.megamoeQuant && backendIsMega && <span style={s.field}>
                  <span style={s.fieldLabel}>Quantization</span>
                  {renderSelect(value.mmQuant != null ? value.mmQuant : derived && derived.mmQuant || "w4a8", fc.megamoeQuant.options || [], v => setSlot("mmQuant", v), base)}
                </span>}
              {epShown && <span style={s.field}>
                  <span style={s.fieldLabel}>{fc.ep.label || "EP"}</span>
                  {renderSelect(slotDisplay("ep"), fc.ep.values || [null], v => setSlot("ep", v), base, undefined, {
          hideValues: hideNull("ep")
        })}
                </span>}
            </div>
          </div>;
      }
    },
    parsers: {
      initState: fc => {
        const out = {};
        for (const item of fc.items || []) out[item.id] = null;
        return out;
      },
      deriveFromBase: (cell, fc, h) => {
        const flags = cell && cell.flags || [];
        const out = {};
        for (const item of fc.items || []) {
          const prefix = item.flag.split(/[\s=]/)[0];
          out[item.id] = h.hasFlag(flags, prefix);
        }
        return out;
      },
      apply: ({flags, env, value, fc, h, derived}) => {
        const items = fc.items || [];
        const eff = {};
        const baseOf = {};
        for (const item of items) {
          baseOf[item.id] = derived ? !!derived[item.id] : false;
          const v = value[item.id];
          eff[item.id] = v === null || v === undefined ? baseOf[item.id] : v;
        }
        const anyOverride = items.some(it => eff[it.id] !== baseOf[it.id]);
        if (!anyOverride) return {
          flags,
          env
        };
        flags = h.stripFlagsByFirstToken(flags, ["--reasoning-parser", "--tool-call-parser"]);
        const adds = [];
        for (const item of items) {
          if (eff[item.id]) adds.push(item.flag);
        }
        if (adds.length) flags = h.insertBeforeTail(flags, adds);
        return {
          flags,
          env
        };
      },
      render: ({axisId, value, setValue, fc, base, s, h, renderChip, derived}) => {
        const visible = (fc.items || []).map(item => ({
          item,
          c: h.evaluateChip(item, base)
        })).filter(({c}) => !c.hidden);
        if (visible.length === 0) return null;
        const effOn = id => {
          const v = value[id];
          if (v !== null && v !== undefined) return v;
          if (derived && derived[id] !== undefined) return derived[id];
          return false;
        };
        return <div key={axisId} style={s.card}>
            <div style={s.compactRow}>
              <span style={s.axisTitle}>Parsers</span>
              {visible.map(({item, c}) => <span key={item.id} style={s.field}>
                  {renderChip(item.label, effOn(item.id), true, () => setValue({
          ...value,
          [item.id]: !effOn(item.id)
        }), {
          disabled: c.disabled,
          disabledReason: c.disableReason
        })}
                </span>)}
            </div>
          </div>;
      }
    },
    speculative: {
      initState: () => "current",
      deriveFromBase: (cell, fc) => {
        const flags = cell && cell.flags || [];
        const baseSpec = flags.filter(f => {
          const head = f.split(/[\s=]/)[0];
          return head === "--speculative-algorithm" || head === "--speculative-num-steps" || head === "--speculative-eagle-topk" || head === "--speculative-num-draft-tokens" || head === "--speculative-adaptive" || head === "--speculative-dspark-block-size" || head === "--enable-linear-replayssm-spec" || head === "--linear-replayssm-cache-len" || head === "--speculative-ngram-max-bfs-breadth";
        });
        if (baseSpec.length === 0) return "off";
        for (const opt of fc.options || []) {
          if (!opt.flags || opt.flags.length !== baseSpec.length) continue;
          const ok = opt.flags.every(pf => baseSpec.includes(pf));
          if (ok) return opt.id;
        }
        return "current";
      },
      apply: ({flags, env, value, fc, sel, h, derived}) => {
        if (value === "current") return {
          flags,
          env
        };
        if (derived && value === derived) return {
          flags,
          env
        };
        const picked = (fc.options || []).find(p => p.id === value);
        if (picked && h.evaluateChip(picked, {
          ...sel,
          dpAttnOn: h.hasFlag(flags, "--enable-dp-attention")
        }).disabled) {
          return {
            flags,
            env
          };
        }
        flags = h.stripFlagsByFirstToken(flags, ["--speculative-algorithm", "--speculative-num-steps", "--speculative-eagle-topk", "--speculative-num-draft-tokens", "--speculative-adaptive", "--speculative-dspark-block-size", "--enable-linear-replayssm-spec", "--linear-replayssm-cache-len", "--speculative-ngram-max-bfs-breadth"]);
        const preset = (fc.options || []).find(p => p.id === value);
        if (preset?.flags?.length) flags = h.insertBeforeTail(flags, preset.flags);
        return {
          flags,
          env
        };
      },
      render: ({axisId, value, setValue, fc, base, s, h, renderChip, derived}) => {
        const opts = fc.options || [];
        if (!opts.length) return null;
        const display = value !== "current" ? value : derived ? derived : "current";
        const hideCurrent = !!(derived && derived !== "current");
        const visible = opts.map(opt => h.evaluateChip(opt, base)).filter(c => !c.hidden && !(hideCurrent && c.value === "current"));
        if (visible.length === 0) return null;
        const note = (visible.find(c => c.value === display) || ({})).note;
        return <div key={axisId} style={s.card}>
            <div style={s.compactRow}>
              <span style={s.axisTitle}>Speculative</span>
              {visible.map(c => <span key={c.value} style={s.field}>
                  {renderChip(c.label, display, c.value, () => setValue(c.value), {
          disabled: c.disabled,
          disabledReason: c.disableReason
        })}
                </span>)}
            </div>
            {note && <div style={s.axisNote}>{note}</div>}
          </div>;
      }
    },
    pdDisagg: {
      initState: fc => ({
        mode: "off",
        transferBackend: (fc && (fc.transferBackends || [])[0] || ({})).id || "mooncake",
        ibDevice: "auto"
      }),
      apply: ({flags, env, value, sel, fc, h}) => {
        const bootstrapPort = h.findFlagArg(flags, "--disaggregation-bootstrap-port");
        flags = h.stripFlagsByFirstToken(flags, ["--disaggregation-mode", "--disaggregation-transfer-backend", "--disaggregation-ib-device", "--disaggregation-bootstrap-port"]);
        const backends = fc.transferBackends || [];
        const mode = (fc.modes || []).length ? value.mode : sel && sel.pdMode || "off";
        if (mode === "prefill" || mode === "decode") {
          const specAlgorithm = (h.findFlagArg(flags, "--speculative-algorithm") || "").toUpperCase();
          if ((fc.incompatibleSpeculativeAlgorithms || []).includes(specAlgorithm)) {
            flags = flags.filter(flag => !flag.split(/[\s=]/)[0].startsWith("--speculative-"));
          }
          const backend = value.transferBackend || (backends[0] || ({})).id || "mooncake";
          const adds = [`--disaggregation-mode ${mode}`, `--disaggregation-transfer-backend ${backend}`];
          if (bootstrapPort) {
            adds.push(`--disaggregation-bootstrap-port ${bootstrapPort}`);
          }
          if (value.ibDevice && value.ibDevice !== "auto") {
            adds.push(`--disaggregation-ib-device ${value.ibDevice}`);
          }
          const modeMeta = (fc.modes || []).find(m => m.id === mode);
          const roleOverride = (fc.roleOverrides || []).find(r => r && r.mode === mode && r.when && h.matchConstraint(sel, r.when));
          const roleSpec = roleOverride || modeMeta;
          const modeGate = roleOverride ? null : modeMeta && modeMeta.when;
          const modeOk = !modeGate || Object.keys(modeGate).every(k => (modeGate[k] || []).includes(sel[k]));
          if (modeOk && roleSpec && roleSpec.flags && roleSpec.flags.length) {
            flags = h.stripFlagsByFirstToken(flags, roleSpec.flags.map(f => f.split(/[\s=]/)[0]));
            adds.push(...roleSpec.flags);
          }
          flags = h.insertBeforeTail(flags, adds);
          const servePort = PD_PORTS[mode].serve;
          flags = flags.map(f => f.split(/[\s=]/)[0] === "--port" ? `--port ${servePort}` : f);
          const meta = backends.find(b => b.id === backend);
          if (meta && meta.env && meta.env.length) {
            const gate = meta.envWhen;
            const ok = !gate || Object.keys(gate).every(k => (gate[k] || []).includes(sel[k]));
            if (ok) env = [...env, ...meta.env.filter(e => !env.includes(e))];
          }
          if (modeOk && roleSpec && roleSpec.env && roleSpec.env.length) {
            env = [...env, ...roleSpec.env.filter(e => !env.includes(e))];
          }
        }
        return {
          flags,
          env
        };
      },
      getRenderHints: (value, fc, context) => {
        const specAlgorithm = (context.h.findFlagArg(context.flags, "--speculative-algorithm") || "").toUpperCase();
        if ((fc.incompatibleSpeculativeAlgorithms || []).includes(specAlgorithm)) {
          return null;
        }
        if (value.mode === "prefill" || value.mode === "decode") {
          return {
            pdMode: value.mode
          };
        }
        return null;
      },
      render: ({axisId, value, setValue, fc, base, s, h, renderSelect}) => {
        const setSlot = (k, v) => setValue({
          ...value,
          [k]: v
        });
        const showModes = (fc.modes || []).length > 0;
        const showBackends = (fc.transferBackends || []).length > 0;
        const showIb = (fc.ibDevices || []).length > 0;
        if (!showModes && !showBackends && !showIb) return null;
        const note = (fc.notes || []).find(n => n && (!n.mode || [].concat(n.mode).includes(value.mode)) && h.matchConstraint(base, n.when));
        return <div key={axisId} style={s.card}>
            <div style={s.compactRow}>
              <span style={s.axisTitle}>PD Disagg</span>
              {showModes && <span style={s.field}>
                  <span style={s.fieldLabel}>Mode</span>
                  {renderSelect(value.mode, fc.modes, v => setSlot("mode", v), base)}
                </span>}
              {showBackends && <span style={s.field}>
                  <span style={s.fieldLabel}>Transfer Backend</span>
                  {renderSelect(value.transferBackend, fc.transferBackends, v => setSlot("transferBackend", v), base)}
                </span>}
              {showIb && <span style={s.field}>
                  <span style={s.fieldLabel}>IB Device</span>
                  {renderSelect(value.ibDevice, fc.ibDevices, v => setSlot("ibDevice", v), base)}
                </span>}
            </div>
            {note && <div style={s.axisNote}>{note.text}</div>}
          </div>;
      }
    },
    hisparse: {
      initState: fc => ({
        enable: false,
        hostRatio: fc && fc.defaultHostRatio || null
      }),
      apply: ({flags, env, value, fc, h}) => {
        const ownedHeads = ["--enable-hisparse", "--hisparse-config", ...(fc.requiredFlags || []).map(f => f.split(/\s/)[0])];
        flags = h.stripFlagsByFirstToken(flags, ownedHeads);
        const isDecode = flags.includes("--disaggregation-mode decode");
        if (value.enable && isDecode) {
          const ratio = value.hostRatio !== null && value.hostRatio !== undefined ? value.hostRatio : fc.defaultHostRatio || 10;
          const cfg = {
            ...fc.config || ({}),
            host_to_device_ratio: ratio
          };
          const adds = [...fc.requiredFlags || [], "--enable-hisparse", `--hisparse-config '${JSON.stringify(cfg)}'`];
          flags = h.insertBeforeTail(flags, adds);
        }
        return {
          flags,
          env
        };
      },
      render: ({axisId, value, setValue, fc, base, s, renderChip, renderSelect}) => {
        if (base.pdMode !== "decode") return null;
        const setSlot = (k, v) => setValue({
          ...value,
          [k]: v
        });
        const hasRatios = (fc.hostRatios || []).length > 0;
        return <div key={axisId} style={s.card}>
            <div style={s.compactRow}>
              <span style={s.axisTitle}>HiSparse</span>
              {typeof fc.showWhen !== "function" && <span style={s.field}>
                  {renderChip("Enable", value.enable, true, () => setSlot("enable", !value.enable))}
                </span>}
              {hasRatios && <span style={s.field}>
                  <span style={s.fieldLabel}>Host ratio</span>
                  {renderSelect(value.hostRatio, fc.hostRatios, v => setSlot("hostRatio", v), base)}
                </span>}
            </div>
          </div>;
      }
    },
    hicache: {
      initState: () => ({
        enable: null,
        backend: null,
        writePolicy: "auto"
      }),
      deriveFromBase: (cell, fc, h) => {
        const flags = cell && cell.flags || [];
        return {
          enable: h.hasFlag(flags, "--enable-hierarchical-cache"),
          backend: h.findFlagArg(flags, "--hicache-storage-backend"),
          writePolicy: h.findFlagArg(flags, "--hicache-write-policy") || "auto"
        };
      },
      apply: ({flags, env, value, fc, sel, h, derived}) => {
        if (fc.excludesHw && sel && fc.excludesHw.includes(sel.hw)) return {
          flags,
          env
        };
        if (typeof fc.showWhen === "function") {
          const set = (name, val) => {
            flags = h.stripFlagsByFirstToken(flags, [name]);
            if (val) flags = h.insertBeforeTail(flags, [`${name} ${val}`]);
          };
          if (value.backend) set("--hicache-storage-backend", value.backend);
          if (value.writePolicy && value.writePolicy !== "auto") {
            set("--hicache-write-policy", value.writePolicy);
          }
          return {
            flags,
            env
          };
        }
        const hasOverride = value.enable !== null || value.backend !== null || value.writePolicy && value.writePolicy !== "auto";
        if (!hasOverride) return {
          flags,
          env
        };
        const backendOptions = fc.backends || [];
        const ownedHeads = [...HICACHE_HEADS, ...(fc.requiredFlags || []).map(f => f.split(/\s/)[0]), ...backendOptions.flatMap(o => (o.flags || []).map(f => f.split(/\s/)[0]))];
        const ownedEnvKeys = [...fc.requiredEnv || [], ...backendOptions.flatMap(o => o.env || [])].map(e => e.split("=")[0]);
        flags = h.stripFlagsByFirstToken(flags, ownedHeads);
        if (ownedEnvKeys.length) env = h.stripEnvByPrefix(env, ownedEnvKeys);
        const enabled = value.enable !== null ? value.enable : !!(derived && derived.enable);
        const backend = value.backend !== null ? value.backend : derived && derived.backend || fc.defaultBackend || null;
        if (enabled) {
          const isAmd = sel && (/^mi\d/).test(sel.hw);
          const pdMode = h.findFlagArg(flags, "--disaggregation-mode") || "off";
          const pdBackend = h.findFlagArg(flags, "--disaggregation-transfer-backend");
          const roleOverride = (fc.roleOverrides || []).find(item => {
            if (!item || item.mode !== pdMode) return false;
            if (item.transferBackend && item.transferBackend !== pdBackend) return false;
            return !item.when || h.matchConstraint(sel, item.when);
          });
          const amdIo = roleOverride || isAmd && fc.amdIo;
          const ratio = amdIo && amdIo.ratio || 2;
          const useAmdIo = isAmd && amdIo;
          const adds = ["--enable-hierarchical-cache", `--hicache-ratio ${ratio}`];
          if (!useAmdIo) {
            adds.push("--hicache-size 0");
          }
          if (useAmdIo) {
            adds.push(`--hicache-mem-layout ${amdIo.memLayout}`, `--hicache-io-backend ${amdIo.ioBackend}`);
          } else if (backend) {
            adds.push("--hicache-mem-layout page_first_direct", "--hicache-io-backend direct");
          }
          const writePolicy = value.writePolicy && value.writePolicy !== "auto" ? value.writePolicy : amdIo && amdIo.writePolicy || "write_through";
          adds.push(`--hicache-write-policy ${writePolicy}`);
          if (isAmd && fc.amdStorageFileOnly ? backend === "file" : !!backend) {
            adds.push(`--hicache-storage-backend ${backend}`, `--hicache-storage-prefetch-policy ${amdIo && amdIo.prefetchPolicy || "wait_complete"}`);
          } else if (amdIo && amdIo.prefetchPolicy) {
            adds.push(`--hicache-storage-prefetch-policy ${amdIo.prefetchPolicy}`);
          }
          const backendOption = backendOptions.find(o => o.id === backend);
          adds.push(...backendOption?.flags || [], ...fc.requiredFlags || []);
          flags = h.insertBeforeTail(flags, adds);
          env = [...env, ...backendOption?.env || [], ...fc.requiredEnv || []];
        }
        return {
          flags,
          env
        };
      },
      render: ({axisId, value, setValue, fc, base, s, renderChip, renderSelect, derived}) => {
        if (fc.excludesHw && fc.excludesHw.includes(base.hw)) return null;
        const setSlot = (k, v) => setValue({
          ...value,
          [k]: v
        });
        const hasBackends = (fc.backends || []).length > 0;
        const hasPolicies = (fc.writePolicies || []).length > 0;
        const enabled = value.enable !== null ? value.enable : !!(derived && derived.enable);
        const hasAutoBackend = (fc.backends || []).some(o => o.id === null);
        const backend = value.backend !== null ? value.backend : hasAutoBackend ? null : derived && derived.backend || fc.defaultBackend || null;
        const writePolicy = value.writePolicy !== "auto" ? value.writePolicy : derived && derived.writePolicy || "auto";
        return <div key={axisId} style={s.card}>
            <div style={s.compactRow}>
              <span style={s.axisTitle}>HiCache</span>
              {typeof fc.showWhen !== "function" && <span style={s.field}>
                  {renderChip("Enable", enabled, true, () => setSlot("enable", !enabled))}
                </span>}
              {hasBackends && <span style={s.field}>
                  <span style={s.fieldLabel}>Storage</span>
                  {renderSelect(backend, fc.backends, v => setSlot("backend", v), base)}
                </span>}
              {hasPolicies && <span style={s.field}>
                  <span style={s.fieldLabel}>Write</span>
                  {renderSelect(writePolicy, fc.writePolicies, v => setSlot("writePolicy", v), base)}
                </span>}
            </div>
          </div>;
      }
    },
    umbp: {
      initState: () => ({
        enable: null,
        backend: null
      }),
      deriveFromBase: (cell, fc, h) => {
        const flags = cell && cell.flags || [];
        return {
          enable: h.hasFlag(flags, "--enable-unified-cache-external-linker"),
          backend: h.findFlagArg(flags, "--unified-cache-external-linker-backend")
        };
      },
      apply: ({flags, env, value, fc, sel, h, derived}) => {
        const ownedHeads = ["--enable-unified-cache-external-linker", "--unified-cache-external-linker-backend", ...(fc.requiredFlags || []).map(f => f.split(/\s/)[0])];
        flags = h.stripFlagsByFirstToken(flags, ownedHeads);
        if (fc.requiredEnv && fc.requiredEnv.length) {
          env = h.stripEnvByPrefix(env, fc.requiredEnv.map(e => e.split("=")[0]));
        }
        const enabled = value.enable !== null ? value.enable : !!(derived && derived.enable);
        if (!enabled) return {
          flags,
          env
        };
        if (fc.onlyHw && sel && !fc.onlyHw.includes(sel.hw)) return {
          flags,
          env
        };
        if (fc.requiresDpAttention && !flags.some(f => f.split(/[\s=]/)[0] === "--enable-dp-attention")) {
          return {
            flags,
            env
          };
        }
        flags = h.stripFlagsByFirstToken(flags, HICACHE_HEADS);
        const backend = value.backend || derived && derived.backend || fc.defaultBackend || "mori";
        flags = h.insertBeforeTail(flags, ["--enable-unified-cache-external-linker", `--unified-cache-external-linker-backend ${backend}`, ...fc.requiredFlags || []]);
        env = [...env, ...(fc.requiredEnv || []).filter(e => !env.includes(e))];
        return {
          flags,
          env
        };
      },
      render: ({axisId, value, setValue, fc, base, s, renderChip, renderSelect, derived}) => {
        if (fc.onlyHw && !fc.onlyHw.includes(base.hw)) return null;
        const setSlot = (k, v) => setValue({
          ...value,
          [k]: v
        });
        const enabled = value.enable !== null ? value.enable : !!(derived && derived.enable);
        const needsDp = !!fc.requiresDpAttention && !base.dpAttnOn;
        const backend = value.backend !== null ? value.backend : derived && derived.backend || fc.defaultBackend || "mori";
        return <div key={axisId} style={s.card}>
            <div style={s.compactRow}>
              <span style={s.axisTitle}>UMBP</span>
              <span style={s.field}>
                {renderChip("Enable", enabled, true, () => setSlot("enable", !enabled), {
          disabled: needsDp,
          disabledReason: needsDp ? "Needs DP Attention — the linker keyspace is per DP rank, so under pure TP the store holds one copy per TP rank." : ""
        })}
              </span>
              {(fc.backends || []).length > 0 && <span style={s.field}>
                  <span style={s.fieldLabel}>Store</span>
                  {renderSelect(backend, fc.backends, v => setSlot("backend", v), base)}
                </span>}
            </div>
          </div>;
      }
    },
    flagSelects: {
      initState: (fc, base) => {
        const out = {};
        for (const spec of fc || []) {
          const d = typeof spec.default === "function" ? spec.default(base) : spec.default;
          out[spec.id] = d ?? null;
        }
        return out;
      },
      deriveFromBase: (cell, fc) => {
        const flags = cell && cell.flags || [];
        const out = {};
        for (const spec of fc || []) {
          const prefixes = spec.stripPrefixes || [];
          const fam = flags.filter(f => prefixes.includes(f.split(/[\s=]/)[0]));
          let hit = null;
          for (const opt of spec.options || []) {
            if (typeof opt.flags === "function") continue;
            const of = opt.flags || [];
            if (of.length === fam.length && of.every(x => fam.includes(x))) {
              hit = opt.id;
              break;
            }
          }
          out[spec.id] = hit;
        }
        return out;
      },
      apply: ({flags, env, value, fc, sel, h, derived}) => {
        const evalBase = {
          ...sel || ({}),
          dpAttnOn: h.hasFlag(flags, "--enable-dp-attention"),
          pdMode: h.findFlagArg(flags, "--disaggregation-mode") || "off"
        };
        for (const spec of fc || []) {
          if (typeof spec.showWhen === "function" && !spec.showWhen(sel, value, derived)) continue;
          const v = value ? value[spec.id] : null;
          if (v === null || v === undefined) continue;
          const d = derived ? derived[spec.id] : null;
          if (v === d) continue;
          const opt = (spec.options || []).find(o => o.id === v);
          if (!opt) continue;
          if (h.evaluateChip(opt, evalBase).disabled) continue;
          const optFlags = typeof opt.flags === "function" ? opt.flags(value, evalBase) : opt.flags || [];
          if (optFlags === null) continue;
          const strip = new Set(spec.stripPrefixes || []);
          const byTok = new Map();
          for (const f of optFlags) {
            const t = f.split(/[\s=]/)[0];
            if (!byTok.has(t)) byTok.set(t, []);
            byTok.get(t).push(f);
          }
          const consumed = new Set();
          const next = [];
          for (const f of flags) {
            const t = f.split(/[\s=]/)[0];
            if (byTok.has(t)) {
              if (!consumed.has(t)) {
                next.push(...byTok.get(t));
                consumed.add(t);
              }
            } else if (!strip.has(t)) {
              next.push(f);
            }
          }
          const fresh = [];
          for (const [t, fs] of byTok) {
            if (!consumed.has(t)) fresh.push(...fs);
          }
          flags = fresh.length ? h.insertBeforeTail(next, fresh) : next;
          const envKeys = [...spec.stripEnv || []];
          for (const o of spec.options || []) {
            for (const e of o.env || []) envKeys.push(e.split("=")[0]);
          }
          if (envKeys.length) env = h.stripEnvByPrefix(env, envKeys);
          if (opt.env && opt.env.length) env = [...env, ...opt.env];
        }
        return {
          flags,
          env
        };
      },
      render: ({axisId, value, setValue, fc, base, s, h, renderChip, derived}) => {
        const cards = [];
        for (const spec of fc || []) {
          if (typeof spec.showWhen === "function" && !spec.showWhen(base, value, derived)) continue;
          const opts = (spec.options || []).map(o => h.evaluateChip(o, base)).filter(c => !c.hidden);
          if (!opts.length) continue;
          const explicit = value ? value[spec.id] : null;
          const display = explicit !== null && explicit !== undefined ? explicit : derived ? derived[spec.id] : null;
          if (spec.control === "slider") {
            const idx = Math.max(0, opts.findIndex(c => c.value === display));
            const cur = opts[idx];
            cards.push(<div key={`${axisId}-${spec.id}`} style={s.card}>
                <div style={s.compactRow}>
                  <span style={s.axisTitle}>{spec.title}</span>
                  <input type="range" min={0} max={opts.length - 1} step={1} value={idx} onChange={e => setValue({
              ...value,
              [spec.id]: opts[Number(e.target.value)].value
            })} style={{
              flex: 1,
              minWidth: "120px",
              accentColor: "#D45D44"
            }} />
                  <span style={{
              ...s.axisTitle,
              minWidth: "24px",
              textAlign: "right"
            }}>
                    {cur ? cur.label : "-"}
                  </span>
                </div>
              </div>);
            continue;
          }
          cards.push(<div key={`${axisId}-${spec.id}`} style={s.card}>
              <div style={s.compactRow}>
                <span style={s.axisTitle}>{spec.title}</span>
                {opts.map(c => <span key={c.value} style={s.field}>
                    {renderChip(c.label, display, c.value, () => setValue({
            ...value,
            [spec.id]: c.value
          }), {
            disabled: c.disabled,
            disabledReason: c.disableReason
          })}
                  </span>)}
              </div>
            </div>);
        }
        return cards.length ? cards : null;
      }
    }
  };
  const applyAllDeltas = (baseFlags, baseEnv, allDeltas, sel, derivedMap) => {
    let flags = [...baseFlags];
    let env = [...baseEnv || []];
    let pdMode = null;
    const pdFc = pgFeatures.pdDisagg;
    const pdDelta = allDeltas.pdDisagg;
    const pdRoleSel = pdFc && (pdFc.modes || []).length && pdDelta ? pdDelta.mode : sel && sel.pdMode || "off";
    for (const [axisId, handler] of Object.entries(AXIS_HANDLERS)) {
      const fc = pgFeatures[axisId];
      if (!fc) continue;
      const value = allDeltas[axisId];
      if (value === undefined) continue;
      const derived = derivedMap ? derivedMap[axisId] : null;
      const specAlgorithm = (findFlagArg(flags, "--speculative-algorithm") || "").toUpperCase() || null;
      const liveSel = {
        ...sel,
        specAlgorithm,
        pdMode: pdRoleSel
      };
      const out = handler.apply({
        flags,
        env,
        value,
        fc,
        sel: liveSel,
        h: helpers,
        derived
      });
      flags = out.flags;
      env = out.env;
      if (handler.getRenderHints) {
        const hints = handler.getRenderHints(value, fc, {
          flags,
          env,
          sel: liveSel,
          h: helpers
        }) || ({});
        if (hints.pdMode) pdMode = hints.pdMode;
      }
    }
    return {
      flags,
      env,
      pdMode
    };
  };
  const renderCommandLines = (cell, flags, cellEnv, sel, envValues, pdMode = null, mode = "python") => {
    const modelName = resolveModelName(sel);
    let f = [...flags];
    const nnodesFlag = f.find(x => x.split(/[\s=]/)[0] === "--nnodes");
    const nnodesMatch = nnodesFlag && (/^--nnodes(?:\s+|=)(\d+)$/).exec(nnodesFlag.trim());
    const baseNnodes = sel.nodes !== undefined ? parseNnodes(sel.nodes) : cell && cell.nnodes || 1;
    const nnodes = nnodesMatch ? parseInt(nnodesMatch[1], 10) : baseNnodes;
    const multinode = nnodes > 1;
    if (multinode && !f.some(x => x.startsWith("--nnodes"))) {
      const PARALLELISM_ANCHORS = ["--enable-dp-attention", "--dp-size", "--dp", "--tp-size", "--tp"];
      let at = -1;
      for (const anchor of PARALLELISM_ANCHORS) {
        at = f.findIndex(x => x.split(/[\s=]/)[0] === anchor);
        if (at !== -1) break;
      }
      if (at === -1) at = f.findIndex(x => x.startsWith("--model-path"));
      const distPort = pdMode && PD_PORTS[pdMode] ? PD_PORTS[pdMode].dist : 20000;
      f.splice(at + 1, 0, `--nnodes ${nnodes}`, `--node-rank {{NODE_RANK}}`, `--dist-init-addr {{NODE0_IP}}:${distPort}`);
    }
    let cmd;
    if (mode === "docker") {
      const di = config.dockerImages || ({});
      const image = di[`${sel.hw}|${sel.variant}|${sel.quant}`] || di[`${sel.variant}|${sel.quant}`] || di[`${sel.hw}|${sel.quant}|${sel.strategy}`] || di[`${sel.hw}|${sel.quant}`] || di[sel.hw] || "lmsysorg/sglang:dev";
      const dockerRunCommand = typeof config.dockerRunCommand === "function" ? config.dockerRunCommand(sel) : config.dockerRunCommand || "sglang serve";
      const portFlag = f.find(x => x.split(/[\s=]/)[0] === "--port");
      const servePort = portFlag ? portFlag.slice(("--port").length).trim() : "{{PORT}}";
      const hostNetwork = multinode || pdMode || typeof config.dockerHostNetworkWhen === "function" && config.dockerHostNetworkWhen(sel, {
        flags: f,
        env: cellEnv
      });
      const AMD_RDMA_DOCKER_FLAGS = ["--device /dev/infiniband", "--cap-add IPC_LOCK", "--ulimit memlock=-1", "--ulimit stack=67108864", "--ulimit nofile=1048576:1048576"];
      const HW_MULTINODE_DOCKER_FLAGS = {
        "dgx-spark": ["--ulimit memlock=-1:-1", "--cap-add IPC_LOCK", "--device /dev/infiniband"],
        mi300x: AMD_RDMA_DOCKER_FLAGS,
        mi325x: AMD_RDMA_DOCKER_FLAGS,
        mi350x: AMD_RDMA_DOCKER_FLAGS,
        mi355x: AMD_RDMA_DOCKER_FLAGS
      };
      const fabricFlags = HW_MULTINODE_DOCKER_FLAGS[sel.hw] || [];
      const isAmdHw = (/^mi\d/).test(sel.hw || "");
      const dockerLines = [...isAmdHw ? ["docker run", "  --device=/dev/kfd --device=/dev/dri", "  --group-add video", "  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined", "  --shm-size 32g"] : ["docker run --gpus all", "  --shm-size 32g"], hostNetwork ? "  --network host" : `  -p ${servePort}:${servePort}`, ...multinode || pdMode ? fabricFlags.map(x => "  " + x) : [], "  -v ~/.cache/huggingface:/root/.cache/huggingface", ...(config.dockerMounts || []).map(mount => `  -v ${mount}`), `  --env "HF_TOKEN={{HF_TOKEN}}"`, ...cellEnv.map(e => `  --env ${e}`), "  --ipc=host", `  ${image}`, `  ${dockerRunCommand}`, ...f.map(x => "    " + x)];
      cmd = dockerLines.join(" \\\n");
    } else {
      const flagBlock = f.map(x => "  " + x).join(" \\\n");
      const envBlock = cellEnv.length ? cellEnv.join(" \\\n") + " \\\n" : "";
      cmd = `${envBlock}sglang serve \\\n${flagBlock}`;
    }
    if (multinode && config.multiNodeHints && config.multiNodeHints[sel.hw]) {
      const hint = config.multiNodeHints[sel.hw].map(line => line.length ? "# " + line : "#").join("\n");
      cmd = `${hint}\n${cmd}`;
    }
    cmd = interpolate(cmd, envValues, modelName);
    if (multinode) {
      const header = `# Multi-node (${nnodes} nodes). Run the same command on every node with:\n` + `#   <node-rank> = 0 on the head node, 1..${nnodes - 1} on the others\n` + `#   <node0-ip>  = IP of the head node (reachable from all others)`;
      cmd = `${header}\n${cmd}`;
    }
    if (pdMode === "prefill" || pdMode === "decode") {
      const sibling = pdMode === "prefill" ? "decode" : "prefill";
      const routerCfg = resolveRouter(config.playgroundFeatures && config.playgroundFeatures.pdDisagg, sel);
      const routerPort = routerCfg && routerCfg.port || 8000;
      const routerLine = routerCfg ? `# then front BOTH with the Router shown below.\n` + `# Client traffic (cURL) targets the router (:${routerPort}), not this role server.` : `# then front BOTH with a router; client traffic targets the router, not this role server.`;
      const hicacheCfg = config.playgroundFeatures && config.playgroundFeatures.hicache;
      const pdBackend = findFlagArg(f, "--disaggregation-transfer-backend");
      const hicacheEnabled = f.some(x => x === "--enable-hierarchical-cache");
      const hicacheNotice = hicacheEnabled && hicacheCfg ? (hicacheCfg.notices || []).find(item => {
        if (!item || item.mode !== pdMode) return false;
        if (item.transferBackend && item.transferBackend !== pdBackend) return false;
        return !item.when || matchConstraint(sel, item.when);
      }) : null;
      const noticeLine = hicacheNotice && hicacheNotice.text ? `# Note: ${hicacheNotice.text}\n` : "";
      const banner = `# === PD Disaggregation: ${pdMode.toUpperCase()} role ===\n` + noticeLine + `# Runs the ${pdMode} server. Also run the ${sibling} role on its peer host,\n` + routerLine;
      cmd = `${banner}\n${cmd}`;
    }
    return cmd;
  };
  const computeDiff = (baseStr, pgStr) => {
    const a = baseStr.split("\n");
    const b = pgStr.split("\n");
    const m = a.length, n = b.length;
    const dp = Array(m + 1).fill(null).map(() => new Array(n + 1).fill(0));
    for (let i = 1; i <= m; i++) {
      for (let j = 1; j <= n; j++) {
        if (a[i - 1] === b[j - 1]) dp[i][j] = dp[i - 1][j - 1] + 1; else dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
      }
    }
    const out = [];
    let i = m, j = n;
    while (i > 0 || j > 0) {
      if (i > 0 && j > 0 && a[i - 1] === b[j - 1]) {
        out.unshift({
          line: a[i - 1],
          kind: "unchanged"
        });
        i--;
        j--;
      } else if (j > 0 && (i === 0 || dp[i][j - 1] >= dp[i - 1][j])) {
        out.unshift({
          line: b[j - 1],
          kind: "added"
        });
        j--;
      } else {
        out.unshift({
          line: a[i - 1],
          kind: "removed"
        });
        i--;
      }
    }
    return out;
  };
  const serializeCell = (sel, env, flags) => {
    const matchEntries = [`hw: ${JSON.stringify(sel.hw)}`, `variant: ${JSON.stringify(sel.variant)}`, `quant: ${JSON.stringify(sel.quant)}`, `strategy: ${JSON.stringify(sel.strategy)}`, `nodes: ${JSON.stringify(sel.nodes)}`].join(", ");
    const fmtList = items => {
      if (!items || items.length === 0) return "[]";
      const lines = items.map(s => `        ${JSON.stringify(s)},`).join("\n");
      return `[\n${lines}\n      ]`;
    };
    return ["    {", `      match: { ${matchEntries} },`, "      verified: true,", `      env: ${fmtList(env)},`, `      flags: ${fmtList(flags)},`, "    },"].join("\n");
  };
  const buildSubmitUrl = (sel, fields) => {
    const gh = config.github || ({});
    const owner = gh.owner || "sgl-project";
    const repo = gh.repo || "sglang";
    const tmpl = gh.issueTemplate || "3-playground-verified-cell.yml";
    const cookbookModel = gh.cookbookModel || "deepseek-ai/deepseek-v4";
    const combo = `${sel.hw} / ${sel.variant} / ${sel.quant} / ${sel.strategy} / ${sel.nodes}`;
    const params = new URLSearchParams({
      template: tmpl,
      title: `[Playground] Verified cell: ${combo}`,
      model: cookbookModel,
      combination: combo,
      "cell-snippet": fields.cellSnippet || "",
      "existing-cell": fields.existingCell || "",
      "sglang-version": fields.sglangVersion || "",
      "bench-result": fields.benchResult || "",
      notes: fields.notes || ""
    });
    return `https://github.com/${owner}/${repo}/issues/new?${params.toString()}`;
  };
  const makeStyles = isDark => ({
    container: {
      maxWidth: "900px",
      margin: "0 auto",
      display: "flex",
      flexDirection: "column",
      gap: "6px"
    },
    card: {
      padding: "6px 10px",
      border: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`,
      borderLeft: `3px solid ${isDark ? "#FDBA74" : "#FB923C"}`,
      borderRadius: "4px",
      background: isDark ? "#1f2937" : "#fff"
    },
    cardStack: {
      display: "flex",
      flexDirection: "column",
      gap: "6px"
    },
    baseStrip: {
      padding: "8px 12px",
      borderRadius: "4px",
      background: isDark ? "#064e3b" : "#d1fae5",
      color: isDark ? "#a7f3d0" : "#065f46",
      fontSize: "12px",
      display: "flex",
      alignItems: "center",
      gap: "10px"
    },
    title: {
      fontSize: "13px",
      fontWeight: "600",
      color: isDark ? "#e5e7eb" : "inherit",
      marginBottom: "8px"
    },
    compactRow: {
      display: "flex",
      flexWrap: "wrap",
      alignItems: "center",
      gap: "10px",
      rowGap: "4px"
    },
    axisTitle: {
      fontSize: "12px",
      fontWeight: 700,
      color: isDark ? "#FDBA74" : "#C2410C",
      letterSpacing: "0.02em",
      minWidth: "100px",
      flexShrink: 0
    },
    field: {
      display: "inline-flex",
      alignItems: "center",
      gap: "4px"
    },
    fieldLabel: {
      fontSize: "11px",
      fontWeight: 500,
      color: isDark ? "#9ca3af" : "#6b7280"
    },
    select: {
      padding: "2px 6px",
      border: `1px solid ${isDark ? "#4b5563" : "#d1d5db"}`,
      borderRadius: "3px",
      fontSize: "12px",
      background: isDark ? "#111827" : "#fff",
      color: isDark ? "#e5e7eb" : "#111827",
      cursor: "pointer",
      lineHeight: "1.4"
    },
    rowFlex: {
      display: "flex",
      flexWrap: "wrap",
      gap: "6px",
      alignItems: "center",
      flex: 1
    },
    subRow: {
      display: "flex",
      alignItems: "center",
      gap: "10px"
    },
    subLabel: {
      fontSize: "11px",
      fontWeight: 600,
      color: isDark ? "#9ca3af" : "#6b7280",
      minWidth: "96px",
      flexShrink: 0,
      letterSpacing: "0.02em"
    },
    chipRow: {
      display: "flex",
      flexWrap: "wrap",
      gap: "6px",
      flex: 1
    },
    chip: {
      padding: "3px 9px",
      border: `1px solid ${isDark ? "#9ca3af" : "#d1d5db"}`,
      borderRadius: "3px",
      cursor: "pointer",
      fontSize: "12px",
      userSelect: "none",
      background: isDark ? "#374151" : "#fff",
      color: isDark ? "#e5e7eb" : "inherit",
      textAlign: "center"
    },
    chipChecked: {
      background: "#D45D44",
      color: "white",
      borderColor: "#D45D44"
    },
    chipDisabled: {
      cursor: "not-allowed",
      opacity: 0.4
    },
    commandWrap: {
      position: "relative",
      background: isDark ? "#111827" : "#f5f5f5",
      borderRadius: "6px",
      border: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`,
      overflow: "hidden"
    },
    commandHeader: {
      display: "flex",
      flexWrap: "wrap",
      justifyContent: "space-between",
      alignItems: "center",
      gap: "6px 10px",
      padding: "6px 10px",
      borderBottom: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`,
      background: isDark ? "#1f2937" : "#fafafa"
    },
    commandPre: {
      padding: "12px 16px",
      fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace",
      fontSize: "12px",
      lineHeight: "1.5",
      color: isDark ? "#e5e7eb" : "#374151",
      whiteSpace: "pre-wrap",
      overflowX: "auto",
      margin: 0
    },
    axisNote: {
      margin: "6px 0 0",
      padding: "6px 10px",
      borderRadius: "6px",
      fontSize: "11px",
      lineHeight: "1.45",
      background: isDark ? "#78350f" : "#fef3c7",
      color: isDark ? "#fde68a" : "#92400e",
      border: `1px solid ${isDark ? "#92400e" : "#fcd34d"}`
    },
    mtpWarn: {
      margin: "8px 0 0",
      padding: "8px 12px",
      borderRadius: "8px",
      fontSize: "12px",
      lineHeight: "1.45",
      background: isDark ? "#78350f" : "#fef3c7",
      color: isDark ? "#fde68a" : "#92400e",
      border: `1px solid ${isDark ? "#92400e" : "#fcd34d"}`
    },
    diffLineUnchanged: {
      display: "block"
    },
    diffLineAdded: {
      display: "block",
      background: isDark ? "rgba(16,185,129,0.15)" : "rgba(16,185,129,0.18)",
      color: isDark ? "#a7f3d0" : "#065f46",
      borderLeft: `3px solid #10b981`,
      paddingLeft: "8px",
      marginLeft: "-8px"
    },
    diffLineRemoved: {
      display: "block",
      background: isDark ? "rgba(239,68,68,0.10)" : "rgba(239,68,68,0.10)",
      color: isDark ? "#fca5a5" : "#991b1b",
      textDecoration: "line-through",
      opacity: 0.7,
      borderLeft: `3px solid #ef4444`,
      paddingLeft: "8px",
      marginLeft: "-8px"
    },
    badge: verified => ({
      display: "inline-flex",
      alignItems: "center",
      gap: "6px",
      padding: "2px 8px",
      borderRadius: "10px",
      background: verified ? isDark ? "#064e3b" : "#d1fae5" : isDark ? "#78350f" : "#fef3c7",
      color: verified ? isDark ? "#a7f3d0" : "#065f46" : isDark ? "#fde68a" : "#92400e",
      fontSize: "11px",
      fontWeight: 600
    }),
    badgeDot: verified => ({
      width: "8px",
      height: "8px",
      borderRadius: "50%",
      background: verified ? "#10b981" : "#f59e0b"
    }),
    iconButton: {
      padding: "4px 10px",
      border: `1px solid ${isDark ? "#4b5563" : "#d1d5db"}`,
      borderRadius: "4px",
      background: isDark ? "#1f2937" : "#fff",
      color: isDark ? "#e5e7eb" : "#374151",
      fontSize: "11px",
      fontWeight: 500,
      cursor: "pointer",
      display: "inline-flex",
      alignItems: "center",
      gap: "4px"
    },
    iconRow: {
      display: "inline-flex",
      flexWrap: "wrap",
      gap: "6px"
    },
    runModeWrap: {
      display: "inline-flex",
      border: `1px solid ${isDark ? "#4b5563" : "#d1d5db"}`,
      borderRadius: "10px",
      overflow: "hidden",
      fontSize: "11px",
      fontWeight: 600,
      userSelect: "none"
    },
    runModeChip: active => ({
      padding: "2px 10px",
      cursor: "pointer",
      background: active ? isDark ? "#1f2937" : "#fff" : "transparent",
      color: active ? isDark ? "#e5e7eb" : "#111827" : isDark ? "#9ca3af" : "#6b7280",
      borderRight: `1px solid ${isDark ? "#4b5563" : "#d1d5db"}`
    }),
    runModeChipLast: active => ({
      padding: "2px 10px",
      cursor: "pointer",
      background: active ? isDark ? "#1f2937" : "#fff" : "transparent",
      color: active ? isDark ? "#e5e7eb" : "#111827" : isDark ? "#9ca3af" : "#6b7280"
    }),
    headerLeft: {
      display: "inline-flex",
      flexWrap: "wrap",
      alignItems: "center",
      gap: "8px"
    },
    dialog: {
      background: isDark ? "#1f2937" : "#fff",
      color: isDark ? "#e5e7eb" : "#111827",
      borderRadius: "8px",
      padding: "20px",
      maxWidth: "720px",
      width: "92%",
      maxHeight: "calc(100vh - 80px)",
      overflowY: "auto",
      border: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`,
      boxShadow: "0 10px 25px rgba(0,0,0,0.25)",
      margin: "auto"
    },
    modalHeader: {
      display: "flex",
      justifyContent: "space-between",
      alignItems: "center",
      marginBottom: "12px"
    },
    modalTitle: {
      fontSize: "15px",
      fontWeight: 600
    },
    modalCloseBtn: {
      background: "transparent",
      border: "none",
      color: "inherit",
      fontSize: "20px",
      cursor: "pointer",
      padding: "0 6px",
      lineHeight: 1
    },
    formField: {
      display: "flex",
      flexDirection: "column",
      gap: "4px",
      marginBottom: "10px"
    },
    formLabel: {
      fontSize: "12px",
      fontWeight: 500,
      color: isDark ? "#9ca3af" : "#4b5563"
    },
    formInput: {
      padding: "6px 10px",
      fontSize: "13px",
      border: `1px solid ${isDark ? "#4b5563" : "#d1d5db"}`,
      borderRadius: "4px",
      background: isDark ? "#111827" : "#fff",
      color: isDark ? "#e5e7eb" : "#111827",
      fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace"
    },
    sectionHeading: {
      fontSize: "12px",
      fontWeight: 600,
      textTransform: "uppercase",
      letterSpacing: "0.04em",
      color: isDark ? "#9ca3af" : "#6b7280",
      margin: "12px 0 6px 0"
    },
    primaryBtn: {
      padding: "6px 14px",
      background: isDark ? "#FDBA74" : "#FB923C",
      color: isDark ? "#7C2D12" : "white",
      border: "none",
      borderRadius: "4px",
      cursor: "pointer",
      fontSize: "13px",
      fontWeight: 500
    },
    resetBtn: {
      marginLeft: "auto",
      padding: "2px 8px",
      fontSize: "11px",
      border: `1px solid ${isDark ? "#4b5563" : "#d1d5db"}`,
      borderRadius: "3px",
      background: "transparent",
      color: isDark ? "#9ca3af" : "#6b7280",
      cursor: "pointer"
    },
    switchBaseBtn: {
      padding: "2px 8px",
      fontSize: "11px",
      fontWeight: 600,
      border: `1px solid ${isDark ? "#FDBA74" : "#FB923C"}`,
      borderRadius: "3px",
      background: "transparent",
      color: isDark ? "#FDBA74" : "#C2410C",
      cursor: "pointer"
    },
    matchedHint: {
      fontSize: "11px",
      color: isDark ? "#9ca3af" : "#6b7280",
      marginLeft: "8px",
      display: "inline-flex",
      alignItems: "center",
      gap: "4px"
    },
    matchedSwitchBtn: {
      marginLeft: "4px",
      background: "transparent",
      border: "none",
      padding: 0,
      color: isDark ? "#FDBA74" : "#C2410C",
      cursor: "pointer",
      fontSize: "11px",
      fontWeight: 600,
      textDecoration: "underline",
      textUnderlineOffset: "2px"
    }
  });
  const [isDark, setIsDark] = useState(false);
  useEffect(() => {
    const check = () => {
      const html = document.documentElement;
      setIsDark(html.classList.contains("dark") || html.getAttribute("data-theme") === "dark" || html.style.colorScheme === "dark");
    };
    check();
    const observer = new MutationObserver(check);
    observer.observe(document.documentElement, {
      attributes: true,
      attributeFilter: ["class", "data-theme", "style"]
    });
    return () => observer.disconnect();
  }, []);
  const [env, setEnv] = useState(() => placeholderDefaults(config.placeholders));
  useEffect(() => {
    try {
      const raw = window.localStorage.getItem(STORAGE_KEY);
      if (raw) {
        const parsed = JSON.parse(raw);
        setEnv({
          ...placeholderDefaults(config.placeholders),
          ...parsed
        });
      }
    } catch {}
  }, []);
  const saveEnv = next => {
    setEnv(next);
    try {
      window.localStorage.setItem(STORAGE_KEY, JSON.stringify(next));
    } catch {}
  };
  const overlayDefaults = () => {
    const out = {};
    for (const d of config.overlayDims || []) {
      const opts = d.options || [];
      out[d.id] = d.default !== undefined ? d.default : opts[0] && opts[0].id || "";
    }
    return out;
  };
  const baseFallback = () => ({
    ...config.cells[0].match,
    ...overlayDefaults()
  });
  const initialBaseFromHash = () => {
    const fallback = baseFallback();
    if (typeof window === "undefined") return {
      ...fallback
    };
    const raw = window.location.hash.replace(/^#/, "");
    if (!raw) return {
      ...fallback
    };
    const params = new URLSearchParams(raw);
    const out = {
      ...fallback
    };
    params.forEach((value, key) => {
      if ((key in out)) out[key] = value;
    });
    return out;
  };
  const [base, setBase] = useState(() => initialBaseFromHash());
  useEffect(() => {
    const onHash = () => setBase(initialBaseFromHash());
    const onSelEvent = e => {
      const fallback = baseFallback();
      const incoming = e && e.detail || ({});
      const next = {
        ...fallback
      };
      for (const k of Object.keys(next)) {
        if (incoming[k] !== undefined) next[k] = incoming[k];
      }
      setBase(next);
    };
    window.addEventListener("hashchange", onHash);
    window.addEventListener("sglang-deploy-sel", onSelEvent);
    return () => {
      window.removeEventListener("hashchange", onHash);
      window.removeEventListener("sglang-deploy-sel", onSelEvent);
    };
  }, []);
  const [pgRatios, setPgRatios] = useState({
    eff: null,
    base: null
  });
  useEffect(() => {
    const onRatio = e => setPgRatios({
      eff: e.detail && e.detail.ratio || null,
      base: e.detail && (e.detail.baseRatio || e.detail.ratio) || null
    });
    window.addEventListener("sglang-k3-mamba-ratio", onRatio);
    return () => window.removeEventListener("sglang-k3-mamba-ratio", onRatio);
  }, []);
  const initialDeltas = () => {
    const out = {};
    for (const [axisId, handler] of Object.entries(AXIS_HANDLERS)) {
      const fc = pgFeatures[axisId];
      if (fc) out[axisId] = handler.initState(fc, base);
    }
    return out;
  };
  const [deltas, setDeltas] = useState(initialDeltas);
  useEffect(() => {
    setDeltas(initialDeltas());
  }, [Object.keys(base).sort().map(k => `${k}=${base[k]}`).join("&")]);
  const [modal, setModal] = useState(null);
  const openDialog = el => {
    if (el && !el.open) {
      try {
        el.showModal();
      } catch {}
    }
  };
  const onDialogClick = e => {
    if (e.target !== e.currentTarget) return;
    const r = e.currentTarget.getBoundingClientRect();
    const {clientX: x, clientY: y} = e;
    if (x < r.left || x > r.right || y < r.top || y > r.bottom) setModal(null);
  };
  useEffect(() => {
    const ID = "__playground_dialog_backdrop";
    if (document.getElementById(ID)) return undefined;
    const style = document.createElement("style");
    style.id = ID;
    style.textContent = `dialog::backdrop { background: rgba(0, 0, 0, 0.5); }`;
    document.head.appendChild(style);
    return () => {
      const el = document.getElementById(ID);
      if (el) el.remove();
    };
  }, []);
  const [copied, setCopied] = useState(false);
  const [curlCopied, setCurlCopied] = useState(false);
  const [routerCopied, setRouterCopied] = useState(false);
  const [envDraft, setEnvDraft] = useState(env);
  useEffect(() => {
    if (modal === "env") setEnvDraft(env);
  }, [modal, env]);
  const [runMode, setRunMode] = useState("python");
  const [submitDraft, setSubmitDraft] = useState({
    sglangVersion: "",
    benchResult: "",
    notes: ""
  });
  const [submitAttest, setSubmitAttest] = useState({
    ranCommand: false,
    reachedReady: false,
    outputCorrect: false
  });
  useEffect(() => {
    if (modal === "submit") {
      setSubmitDraft({
        sglangVersion: "",
        benchResult: "",
        notes: ""
      });
      setSubmitAttest({
        ranCommand: false,
        reachedReady: false,
        outputCorrect: false
      });
    }
  }, [modal]);
  const s = makeStyles(isDark);
  const baseCell = withOverlay(findCell(config.cells, base), base);
  const modelName = resolveModelName(base);
  const derivedMap = {};
  if (baseCell) {
    for (const [axisId, handler] of Object.entries(AXIS_HANDLERS)) {
      const fc = pgFeatures[axisId];
      if (!fc || !handler.deriveFromBase) continue;
      derivedMap[axisId] = handler.deriveFromBase(baseCell, fc, helpers);
    }
  }
  const attnDelta = deltas.attention || ({});
  const attnDerived = derivedMap.attention || ({});
  const attnKnobs = (pgFeatures.attention || ({})).knobs || [];
  const effTp = attnDelta.tp !== null && attnDelta.tp !== undefined ? attnDelta.tp : attnDerived.tp !== undefined ? attnDerived.tp : null;
  const staleExplicit = (knobId, picked) => {
    const knob = attnKnobs.find(k => k.id === knobId);
    const e = knob ? findEntry(knob.values || [], picked) : null;
    return !!(e !== null && e !== undefined && evaluateChip(e, {
      ...base,
      effTp
    }).disabled);
  };
  const effDpAttn = attnDelta.dpAttn !== null && attnDelta.dpAttn !== undefined ? staleExplicit("dpAttn", attnDelta.dpAttn) ? null : attnDelta.dpAttn : attnDerived.dpAttn !== undefined ? attnDerived.dpAttn : null;
  const dpAttnOn = effDpAttn === true || typeof effDpAttn === "number" && effDpAttn > 0;
  const dpDegEff = typeof effDpAttn === "number" && effDpAttn > 0 ? effDpAttn : 1;
  const cpKnobFreeSize = !!(attnKnobs.find(k => k.id === "cp") || ({})).freeSize;
  const cpSizeTarget = !cpKnobFreeSize && dpDegEff === 1 && typeof effTp === "number" && effTp > 0 ? effTp : null;
  const cpSizeStale = v => typeof v === "number" && v > 1 && cpSizeTarget !== null && v !== cpSizeTarget;
  const effCp = attnDelta.cp !== null && attnDelta.cp !== undefined ? staleExplicit("cp", attnDelta.cp) || cpSizeStale(attnDelta.cp) ? null : attnDelta.cp : attnDerived.cp !== undefined ? attnDerived.cp : null;
  const cpOn = typeof effCp === "number" && effCp > 1;
  const cpStrategy = (attnDelta.cpStrategy && !staleExplicit("cpStrategy", attnDelta.cpStrategy) ? attnDelta.cpStrategy : attnDerived.cpStrategy !== undefined ? attnDerived.cpStrategy : null) || "interleave";
  const constraintEffective = baseCell ? applyAllDeltas(baseCell.flags, baseCell.env, deltas, base, derivedMap) : null;
  const pdCardOwnsMode = (pgFeatures.pdDisagg && pgFeatures.pdDisagg.modes || []).length > 0;
  const pdMode = pdCardOwnsMode ? constraintEffective && constraintEffective.pdMode || "off" : base.pdMode || "off";
  const specAlgorithm = constraintEffective ? (findFlagArg(constraintEffective.flags, "--speculative-algorithm") || "").toUpperCase() || null : null;
  const constraintBase = {
    ...base,
    dpAttnOn,
    cpOn,
    cpStrategy,
    cpSizeTarget,
    effTp,
    pdMode,
    specAlgorithm
  };
  let baseCommand = "";
  let playgroundCommand = "";
  let diffLines = [];
  let pgFlagsLatest = [];
  let pgEnvLatest = [];
  const withRatio = (fl, value) => {
    if (!value) return fl;
    if (fl.some(f => f.startsWith("--mamba-full-memory-ratio") || f.startsWith("--max-mamba-cache-size"))) return fl;
    const out = [...fl];
    const line = `--mamba-full-memory-ratio ${value}`;
    const i = out.findIndex(f => f.startsWith("--host"));
    if (i >= 0) out.splice(i, 0, line); else out.push(line);
    return out;
  };
  if (baseCell) {
    baseCommand = renderCommandLines(baseCell, withRatio(baseCell.flags, pgRatios.base), baseCell.env, base, env, null, runMode);
    const {flags: pgFlags, env: pgEnv, pdMode} = applyAllDeltas(baseCell.flags, baseCell.env, deltas, base, derivedMap);
    pgFlagsLatest = pgFlags;
    pgEnvLatest = pgEnv;
    playgroundCommand = renderCommandLines(baseCell, withRatio(pgFlags, pgRatios.eff), pgEnv, base, env, pdMode, runMode);
    diffLines = computeDiff(baseCommand, playgroundCommand);
  }
  const effectiveKey = pgFlagsLatest.join("\n") + " " + pgEnvLatest.join("\n") + " " + (baseCell ? baseCell.flags.join("\n") + " " + baseCell.env.join("\n") : "");
  useEffect(() => {
    if (typeof window === "undefined" || !baseCell) return;
    window.dispatchEvent(new CustomEvent("sglang-k3-effective-config", {
      detail: {
        flags: pgFlagsLatest,
        env: pgEnvLatest,
        baseFlags: baseCell.flags,
        baseEnv: baseCell.env
      }
    }));
  }, [effectiveKey]);
  const matchedCell = baseCell ? findMatchingCell(config.cells, base, pgEnvLatest, pgFlagsLatest) : null;
  const playgroundVerified = !!(matchedCell && matchedCell.verified);
  const matchedSiblingCell = matchedCell && DIMENSIONS.some(d => matchedCell.match[d] !== base[d]) ? matchedCell : null;
  const pgSpecAlgoFlag = pgFlagsLatest.find(f => f.split(/[\s=]/)[0] === "--speculative-algorithm");
  const pgPdRole = pdMode === "prefill" || pdMode === "decode";
  const pgSpecHint = !!pgSpecAlgoFlag && (pgPdRole || !pgFlagsLatest.some(f => f.split(/[\s=]/)[0] === "--max-running-requests"));
  const specAlgoLabels = {
    EAGLE: "MTP",
    EAGLE3: "MTP",
    FROZEN_KV_MTP: "MTP",
    DSPARK: "DSpark",
    DFLASH: "DFlash",
    NGRAM: "N-gram",
    STANDALONE: "standalone draft"
  };
  const pgSpecAlgoValue = pgSpecAlgoFlag ? pgSpecAlgoFlag.split(/[\s=]/).filter(Boolean)[1] || "" : "";
  const pgSpecAlgoName = specAlgoLabels[pgSpecAlgoValue.toUpperCase()] || pgSpecAlgoValue || "MTP";
  const pgCpDpHint = cpEnabledIn(pgFlagsLatest) && (bakedCpStrategy(pgFlagsLatest) || "interleave") === "interleave" && pgFlagsLatest.some(f => f.split(/[\s=]/)[0] === "--enable-dp-attention");
  const proposedCellSnippet = baseCell ? serializeCell(base, pgEnvLatest, pgFlagsLatest) : "";
  const existingCellSnippet = baseCell ? serializeCell(base, baseCell.env || [], baseCell.flags) : "";
  const submitUrl = baseCell ? buildSubmitUrl(base, {
    cellSnippet: proposedCellSnippet,
    existingCell: existingCellSnippet,
    sglangVersion: submitDraft.sglangVersion,
    benchResult: submitDraft.benchResult,
    notes: submitDraft.notes
  }) : "";
  const submitReady = submitAttest.ranCommand && submitAttest.reachedReady && submitAttest.outputCorrect && submitDraft.sglangVersion.trim().length > 0;
  const pdRouter = pdMode !== "off" && resolveRouter(config.playgroundFeatures && config.playgroundFeatures.pdDisagg, base) || null;
  const curlEnv = pdRouter && pdRouter.port != null ? {
    ...env,
    CURL_PORT: String(pdRouter.port)
  } : env;
  const curlText = interpolate(config.curl || "", curlEnv, modelName);
  const routerText = pdRouter && pdRouter.command ? interpolate(pdRouter.command, {
    ...env,
    PREFILL_PORT: PD_PORTS.prefill.serve,
    DECODE_PORT: PD_PORTS.decode.serve,
    ROUTER_PORT: pdRouter.port
  }, modelName) : "";
  const resetAll = () => setDeltas(initialDeltas());
  const placeholderGroups = (() => {
    const out = {
      command: [],
      curl: []
    };
    for (const [key, meta] of Object.entries(config.placeholders || ({}))) {
      (out[meta.target] || (out[meta.target] = [])).push({
        key,
        ...meta
      });
    }
    return out;
  })();
  const handleCopy = () => {
    navigator.clipboard.writeText(playgroundCommand);
    setCopied(true);
    setTimeout(() => setCopied(false), 1200);
  };
  const copyCurl = () => {
    navigator.clipboard.writeText(curlText);
    setCurlCopied(true);
    setTimeout(() => setCurlCopied(false), 1200);
  };
  const baseSummary = baseCell ? Object.entries(base).filter(([, v]) => v !== undefined && v !== "").map(([k, v]) => k === "hw" ? String(v).toUpperCase() : String(v)).join(" · ") : "(no verified cell at the current Deploy selection — showing playground only)";
  const renderChip = (label, current, value, onPick, opts = {}) => {
    const checked = current === value;
    const disabled = !!opts.disabled;
    return <span key={`${label}-${value === null ? "auto" : value}`} style={{
      ...s.chip,
      ...checked ? s.chipChecked : {},
      ...disabled ? s.chipDisabled : {}
    }} title={disabled ? opts.disabledReason || "Not available" : ""} onClick={() => {
      if (!disabled) onPick(value);
    }}>
        {label}
      </span>;
  };
  const renderSelect = (current, entries, onPick, base, labelFor, opts = {}) => {
    const hideSet = new Set(opts.hideValues || []);
    const items = [];
    for (const entry of entries || []) {
      const c = helpers.evaluateChip(entry, base);
      if (c.hidden) continue;
      if (hideSet.has(c.value)) continue;
      const lbl = labelFor ? labelFor(c) : c.label !== undefined ? c.label : c.value === null ? "Auto" : String(c.value);
      items.push({
        ...c,
        label: lbl
      });
    }
    let idx = items.findIndex(c => c.value === current);
    if (idx === -1) idx = 0;
    return <select style={{
      ...s.select,
      ...opts.disabled ? s.chipDisabled : {}
    }} disabled={!!opts.disabled} title={opts.disabled ? opts.disabledReason || "Not available" : ""} value={idx} onChange={e => {
      const next = items[parseInt(e.target.value, 10)];
      if (next && !next.disabled) onPick(next.value);
    }}>
        {items.map((c, i) => <option key={i} value={i} disabled={c.disabled}>
            {c.label}{c.disabled ? " (n/a)" : ""}
          </option>)}
      </select>;
  };
  return <div style={s.container} className="not-prose">
      {}
      <div style={s.baseStrip}>
        <span style={{
    fontWeight: 600
  }}>Inherited base from Deployment:</span>
        <code style={{
    fontFamily: "Menlo, monospace"
  }}>{baseSummary}</code>
        {}
        <button type="button" style={s.switchBaseBtn} onClick={() => {
    const el = document.getElementById(DEPLOYMENT_COMPONENT_ID) || document.getElementById("deployment") || document.getElementById("deploy");
    if (el) el.scrollIntoView({
      behavior: "smooth",
      block: "start"
    });
  }}>
          ↑ Switch base
        </button>
        <button style={s.resetBtn} onClick={resetAll}>Reset all overrides</button>
      </div>

      {}
      {Object.entries(AXIS_HANDLERS).map(([axisId, handler]) => {
    const fc = pgFeatures[axisId];
    if (!fc) return null;
    if (typeof fc.showWhen === "function" && !fc.showWhen(constraintBase)) return null;
    const setValue = next => setDeltas(d => ({
      ...d,
      [axisId]: next
    }));
    return handler.render({
      axisId,
      value: deltas[axisId],
      setValue,
      fc,
      base: constraintBase,
      s,
      h: helpers,
      renderChip,
      renderSelect,
      derived: derivedMap[axisId] || null
    });
  })}

      {}
      <div style={s.card}>
        <div style={s.title}>Playground Command (compare with base)</div>
        <div style={s.commandWrap}>
          <div style={s.commandHeader}>
            <div style={s.headerLeft}>
              <div style={s.badge(playgroundVerified)}>
                <span style={s.badgeDot(playgroundVerified)} />
                {playgroundVerified ? "Verified" : "Not Verified"}
              </div>
              {}
              {matchedSiblingCell && <span style={s.matchedHint}>
                  matches <code style={{
    fontFamily: "Menlo, monospace"
  }}>
                    {matchedSiblingCell.match.strategy}
                  </code>
                  <button type="button" style={s.matchedSwitchBtn} onClick={() => {
    const m = matchedSiblingCell.match;
    setDeltas(initialDeltas());
    const hash = new URLSearchParams(m).toString();
    window.location.hash = hash;
    window.dispatchEvent(new CustomEvent("sglang-deploy-sel", {
      detail: m
    }));
  }}>
                    switch base →
                  </button>
                </span>}
              <div style={s.runModeWrap} role="tablist" aria-label="Output format">
                <span style={s.runModeChip(runMode === "python")} onClick={() => setRunMode("python")} role="tab" aria-selected={runMode === "python"}>
                  Python
                </span>
                <span style={s.runModeChipLast(runMode === "docker")} onClick={() => setRunMode("docker")} role="tab" aria-selected={runMode === "docker"}>
                  Docker
                </span>
              </div>
            </div>
            <div style={s.iconRow}>
              <button style={s.iconButton} onClick={handleCopy}>
                {copied ? "✓ Copied" : "⧉ Copy"}
              </button>
              <button style={s.iconButton} onClick={() => setModal("curl")}>$ cURL</button>
              <button style={s.iconButton} onClick={() => setModal("env")}>⚙ Env</button>
              {}
              {!playgroundVerified && baseCell && <button style={{
    ...s.iconButton,
    borderColor: isDark ? "#FDBA74" : "#FB923C",
    color: isDark ? "#FDBA74" : "#C2410C",
    fontWeight: 600
  }} onClick={() => setModal("submit")} title="I verified this command on my hardware — open a pre-filled GitHub issue to land it as a cookbook cell.">
                  Submit ↗
                </button>}
            </div>
          </div>
          <pre style={s.commandPre}>
            {baseCell ? diffLines.map((d, i) => <span key={i} style={d.kind === "added" ? s.diffLineAdded : d.kind === "removed" ? s.diffLineRemoved : s.diffLineUnchanged}>
                {d.kind === "added" ? "+ " : d.kind === "removed" ? "- " : "  "}
                {d.line}{"\n"}
              </span>) : "# No verified base cell at the current Deployment selection.\n# Pick a supported hardware/variant in the Deployment panel to populate the playground base."}
          </pre>
          {pgSpecHint && <div style={s.mtpWarn}>
              {pgPdRole ? <>⚠️ Speculative decoding ({pgSpecAlgoName}) is on — for a target concurrency of N, set <code>--max-running-requests &lt;N*2&gt;</code> on <strong>both</strong> the prefill and decode roles. That ceiling is server-wide and floor-divided by <code>attn_dp_size</code>, so size the decode graphs to the per-rank batch it leaves: <code>--cuda-graph-bs-decode</code> up to <code>N*2 / dp_size</code>.</> : <>⚠️ Speculative decoding ({pgSpecAlgoName}) is on — SGLang resets <code>--max-running-requests</code> to <strong>48</strong> when it isn't set. Add <code>--max-running-requests &lt;N&gt;</code> sized for your target concurrency.</>}
            </div>}
          {pgCpDpHint && <div style={s.mtpWarn}>
              ⚠️ Interleave prefill-CP together with DP-Attention: current SGLang releases assert <code>dp_size == 1</code> for the interleave layout, so this command fails at startup. Combined CP + DP-Attention support is planned upstream — keep one of the two off until it lands.
            </div>}
        </div>
      </div>

      {}
      {pdRouter && routerText && <div style={s.card}>
          <div style={s.title}>Router</div>
          <div style={{
    fontSize: 11,
    opacity: 0.7,
    margin: "0 0 6px"
  }}>
            Run after both roles are up. Substitute <code>{"<prefill-host>"}</code> /{" "}
            <code>{"<decode-host>"}</code> with reachable hosts (both <code>127.0.0.1</code>{" "}
            on a same-host deployment). Client traffic (cURL) targets this router.
          </div>
          <div style={s.commandWrap}>
            <div style={s.commandHeader}>
              <div style={{
    fontSize: 11,
    opacity: 0.7
  }}>port {pdRouter.port}</div>
              <button style={s.iconButton} onClick={() => {
    navigator.clipboard.writeText(routerText);
    setRouterCopied(true);
    setTimeout(() => setRouterCopied(false), 1200);
  }}>
                {routerCopied ? "✓ Copied" : "⧉ Copy"}
              </button>
            </div>
            <pre style={s.commandPre}>{routerText}</pre>
          </div>
        </div>}

      {}
      {modal === "curl" && <dialog ref={openDialog} style={s.dialog} onClose={() => setModal(null)} onClick={onDialogClick}>
          <div style={s.modalHeader}>
            <div style={s.modalTitle}>cURL example</div>
            <button style={s.modalCloseBtn} onClick={() => setModal(null)} aria-label="Close">×</button>
          </div>
          <div style={s.commandWrap}>
            <div style={s.commandHeader}>
              <div style={{
    fontSize: 11,
    opacity: 0.7
  }}>
                Model: <code>{modelName || "(unresolved)"}</code>
              </div>
              <button style={s.iconButton} onClick={copyCurl}>
                {curlCopied ? "✓ Copied" : "⧉ Copy"}
              </button>
            </div>
            <pre style={s.commandPre}>{curlText}</pre>
          </div>
          {pdRouter && <p style={{
    fontSize: 11,
    opacity: 0.85,
    marginTop: 8
  }}>
              <strong>PD-Disaggregation active</strong> — this targets the router on
              {" "}<code>:{pdRouter.port}</code>; client traffic must not hit the role
              servers directly.
            </p>}
          <p style={{
    fontSize: 11,
    opacity: 0.7,
    marginTop: 8
  }}>
            Edit <code>CURL_HOST</code> / <code>CURL_PORT</code> in the Env panel.
          </p>
        </dialog>}

      {}
      {modal === "env" && <dialog ref={openDialog} style={s.dialog} onClose={() => setModal(null)} onClick={onDialogClick}>
          <div style={s.modalHeader}>
            <div style={s.modalTitle}>Env / placeholder values</div>
            <button style={s.modalCloseBtn} onClick={() => setModal(null)} aria-label="Close">×</button>
          </div>
            {placeholderGroups.curl.length > 0 && <div>
                <div style={s.sectionHeading}>cURL placeholders</div>
                {placeholderGroups.curl.map(({key, label}) => <div key={key} style={s.formField}>
                    <label style={s.formLabel}>
                      {label} <code style={{
    opacity: 0.6
  }}>{`{{${key}}}`}</code>
                    </label>
                    <input style={s.formInput} value={envDraft[key] ?? ""} onChange={e => setEnvDraft({
    ...envDraft,
    [key]: e.target.value
  })} />
                  </div>)}
              </div>}
            {placeholderGroups.command.length > 0 && <div>
                <div style={s.sectionHeading}>Command placeholders</div>
                {placeholderGroups.command.map(({key, label}) => <div key={key} style={s.formField}>
                    <label style={s.formLabel}>
                      {label} <code style={{
    opacity: 0.6
  }}>{`{{${key}}}`}</code>
                    </label>
                    <input style={s.formInput} value={envDraft[key] ?? ""} onChange={e => setEnvDraft({
    ...envDraft,
    [key]: e.target.value
  })} />
                  </div>)}
              </div>}
            <div style={{
    display: "flex",
    justifyContent: "flex-end",
    gap: 8,
    marginTop: 16
  }}>
              <button style={{
    ...s.iconButton,
    padding: "6px 14px"
  }} onClick={() => setModal(null)}>Cancel</button>
              <button style={s.primaryBtn} onClick={() => {
    saveEnv(envDraft);
    setModal(null);
  }}>Save</button>
            </div>
          <p style={{
    fontSize: 11,
    opacity: 0.7,
    marginTop: 10
  }}>
            Values persist in localStorage and are shared with the Deployment panel.
          </p>
        </dialog>}

      {}
      {modal === "submit" && <dialog ref={openDialog} style={s.dialog} onClose={() => setModal(null)} onClick={onDialogClick}>
            <div style={s.modalHeader}>
              <div style={s.modalTitle}>Submit verified cell</div>
              <button style={s.modalCloseBtn} onClick={() => setModal(null)} aria-label="Close">×</button>
            </div>
            <p style={{
    fontSize: 12,
    opacity: 0.85,
    marginTop: 0,
    marginBottom: 12
  }}>
              You've put together a combination that isn't in the verified
              catalog yet. After you've run the command end-to-end on the
              target hardware, this submits a pre-filled GitHub Issue that a
              maintainer can convert into a PR.
            </p>

            <div style={s.sectionHeading}>Combination</div>
            <code style={{
    fontFamily: "Menlo, monospace",
    fontSize: 12
  }}>
              {base.hw} / {base.variant} / {base.quant} / {base.strategy} / {base.nodes}
            </code>
            {}
            {(() => {
    const adds = diffLines.filter(d => d.kind === "added");
    const rems = diffLines.filter(d => d.kind === "removed");
    if (adds.length === 0 && rems.length === 0) return null;
    return <>
                  <div style={{
      ...s.sectionHeading,
      marginTop: 10
    }}>
                    Overrides vs base ({adds.length} added · {rems.length} removed)
                  </div>
                  <pre style={{
      margin: 0,
      padding: "8px 10px",
      background: isDark ? "#111827" : "#f5f5f5",
      border: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`,
      borderRadius: 4,
      fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace",
      fontSize: 12,
      lineHeight: 1.4,
      maxHeight: 160,
      overflowY: "auto",
      whiteSpace: "pre-wrap"
    }}>
                    {[...rems, ...adds].map((d, i) => <div key={i} style={d.kind === "added" ? s.diffLineAdded : s.diffLineRemoved}>
                        {d.kind === "added" ? "+ " : "- "}
                        {d.line.replace(/^\s*/, "")}
                      </div>)}
                  </pre>
                </>;
  })()}

            <div style={{
    ...s.sectionHeading,
    marginTop: 14
  }}>Attestation (all required)</div>
            <div style={s.formField}>
              <label style={{
    fontSize: 12,
    display: "flex",
    alignItems: "flex-start",
    gap: 6
  }}>
                <input type="checkbox" checked={submitAttest.ranCommand} onChange={e => setSubmitAttest({
    ...submitAttest,
    ranCommand: e.target.checked
  })} />
                I ran this exact command on the listed hardware.
              </label>
              <label style={{
    fontSize: 12,
    display: "flex",
    alignItems: "flex-start",
    gap: 6
  }}>
                <input type="checkbox" checked={submitAttest.reachedReady} onChange={e => setSubmitAttest({
    ...submitAttest,
    reachedReady: e.target.checked
  })} />
                The server reached READY and answered a cURL request successfully.
              </label>
              <label style={{
    fontSize: 12,
    display: "flex",
    alignItems: "flex-start",
    gap: 6
  }}>
                <input type="checkbox" checked={submitAttest.outputCorrect} onChange={e => setSubmitAttest({
    ...submitAttest,
    outputCorrect: e.target.checked
  })} />
                Output looked correct on at least one prompt.
              </label>
            </div>

            <div style={{
    ...s.sectionHeading,
    marginTop: 14
  }}>SGLang version (required)</div>
            <input style={{
    ...s.formInput,
    width: "100%",
    boxSizing: "border-box"
  }} placeholder="sglang==0.5.4  (or git SHA abc1234)" value={submitDraft.sglangVersion} onChange={e => setSubmitDraft({
    ...submitDraft,
    sglangVersion: e.target.value
  })} />

            <div style={{
    ...s.sectionHeading,
    marginTop: 14
  }}>Benchmark result (optional)</div>
            <input style={{
    ...s.formInput,
    width: "100%",
    boxSizing: "border-box"
  }} placeholder="TTFT 95 ms / TPOT 18 ms / 1820 tok/s @ bs=64" value={submitDraft.benchResult} onChange={e => setSubmitDraft({
    ...submitDraft,
    benchResult: e.target.value
  })} />

            <div style={{
    ...s.sectionHeading,
    marginTop: 14
  }}>Notes / caveats (optional)</div>
            <textarea style={{
    ...s.formInput,
    width: "100%",
    boxSizing: "border-box",
    minHeight: 110,
    resize: "vertical",
    fontFamily: "inherit"
  }} placeholder="Cluster config, env-var quirks, NIC mappings, multi-node bootstrap details, …" value={submitDraft.notes} onChange={e => setSubmitDraft({
    ...submitDraft,
    notes: e.target.value
  })} />

            <div style={{
    display: "flex",
    justifyContent: "flex-end",
    gap: 8,
    marginTop: 16,
    alignItems: "center"
  }}>
              {!submitReady && <span style={{
    fontSize: 11,
    opacity: 0.7,
    marginRight: "auto"
  }}>
                  Tick all attestations and fill SGLang version to enable submit.
                </span>}
              <button style={{
    ...s.iconButton,
    padding: "6px 14px"
  }} onClick={() => setModal(null)}>Cancel</button>
              <a href={submitReady ? submitUrl : undefined} target="_blank" rel="noopener noreferrer" onClick={e => {
    if (!submitReady) e.preventDefault(); else setModal(null);
  }} style={{
    ...s.primaryBtn,
    textDecoration: "none",
    display: "inline-flex",
    alignItems: "center",
    opacity: submitReady ? 1 : 0.4,
    cursor: submitReady ? "pointer" : "not-allowed"
  }}>
                Open submission on GitHub →
              </a>
            </div>
          <p style={{
    fontSize: 11,
    opacity: 0.7,
    marginTop: 10
  }}>
            The CTA opens a pre-filled GitHub Issue using the
            <code> 3-playground-verified-cell.yml</code> template. A
            maintainer with the listed hardware will review and convert it
            into a cookbook PR.
          </p>
        </dialog>}
    </div>;
};

export const benchmarks = [{
  match: {
    hw: "b200",
    variant: "flash-official",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.16",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 218.90,
    tpot_ms: 1.28,
    tokens_per_sec_per_gpu: 481
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 189.89,
    tpot_ms: 3.38,
    tokens_per_sec_per_gpu: 3383
  }]
}, {
  match: {
    hw: "b200",
    variant: "flash-official",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "0.5.16",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64
    },
    ttft_ms: 1629.45,
    tpot_ms: 34.13,
    tokens_per_sec_per_gpu: 1595
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256
    },
    ttft_ms: 2568.55,
    tpot_ms: 57.15,
    tokens_per_sec_per_gpu: 4326
  }]
}, {
  match: {
    hw: "b200",
    variant: "flash-official",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "0.5.16",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1024
    },
    ttft_ms: 74853.51,
    tpot_ms: 51.72,
    tokens_per_sec_per_gpu: 5464
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 4096
    },
    ttft_ms: 216241.01,
    tpot_ms: 51.80,
    tokens_per_sec_per_gpu: 5301
  }]
}, {
  match: {
    hw: "b200",
    variant: "flash",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 302,
    tpot_ms: 2.91,
    tokens_per_sec_per_gpu: 677
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 454,
    tpot_ms: 8.76,
    tokens_per_sec_per_gpu: 3059
  }]
}, {
  match: {
    hw: "b200",
    variant: "flash",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "0.5.15",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64
    },
    ttft_ms: 642,
    tpot_ms: 23.2,
    tokens_per_sec_per_gpu: 5222
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256
    },
    ttft_ms: 3147,
    tpot_ms: 64.0,
    tokens_per_sec_per_gpu: 8399
  }]
}, {
  match: {
    hw: "b200",
    variant: "flash",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "0.5.15",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1024
    },
    ttft_ms: 104109,
    tpot_ms: 70.25,
    tokens_per_sec_per_gpu: 8345
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 4096
    },
    ttft_ms: 273808,
    tpot_ms: 71.34,
    tokens_per_sec_per_gpu: 8156
  }]
}, {
  match: {
    hw: "b200",
    variant: "pro",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 230,
    tpot_ms: 4.25,
    tokens_per_sec_per_gpu: 243
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 446,
    tpot_ms: 11.56,
    tokens_per_sec_per_gpu: 1165
  }]
}, {
  match: {
    hw: "b200",
    variant: "pro",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "0.5.15",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64
    },
    ttft_ms: 1081,
    tpot_ms: 36.23,
    tokens_per_sec_per_gpu: 1696
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256
    },
    ttft_ms: 4330,
    tpot_ms: 97.59,
    tokens_per_sec_per_gpu: 2721
  }]
}, {
  match: {
    hw: "b200",
    variant: "pro",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "0.5.15",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1024
    },
    ttft_ms: 107158,
    tpot_ms: 44.45,
    tokens_per_sec_per_gpu: 4169
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 4096
    },
    ttft_ms: 265159,
    tpot_ms: 44.12,
    tokens_per_sec_per_gpu: 4252
  }]
}, {
  match: {
    hw: "b200",
    variant: "flash",
    quant: "nvfp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 308,
    tpot_ms: 2.88,
    tokens_per_sec_per_gpu: 682
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 466,
    tpot_ms: 8.67,
    tokens_per_sec_per_gpu: 3059
  }]
}, {
  match: {
    hw: "b200",
    variant: "pro",
    quant: "nvfp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 223,
    tpot_ms: 4.19,
    tokens_per_sec_per_gpu: 245
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 509,
    tpot_ms: 11.13,
    tokens_per_sec_per_gpu: 1210
  }]
}, {
  match: {
    hw: "b200",
    variant: "flash-official",
    quant: "nvfp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "dev@07c8f7294",
  accuracy: {
    gsm8k_pct: 96.82,
    aime25_pct: 98.96
  }
}, {
  match: {
    hw: "b200",
    variant: "pro-official",
    quant: "nvfp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "dev@07c8f7294",
  accuracy: {
    gsm8k_pct: 96.44,
    aime25_pct: 98.33
  }
}, {
  match: {
    hw: "b300",
    variant: "flash",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 191,
    tpot_ms: 2.87,
    tokens_per_sec_per_gpu: 720
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 360,
    tpot_ms: 8.05,
    tokens_per_sec_per_gpu: 3376
  }]
}, {
  match: {
    hw: "b300",
    variant: "flash",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64
    },
    ttft_ms: 1317,
    tpot_ms: 33.78,
    tokens_per_sec_per_gpu: 3801
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256
    },
    ttft_ms: 2722,
    tpot_ms: 52.84,
    tokens_per_sec_per_gpu: 9773
  }]
}, {
  match: {
    hw: "b300",
    variant: "flash",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1024
    },
    ttft_ms: 89936,
    tpot_ms: 61.42,
    tokens_per_sec_per_gpu: 9336
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 4096
    },
    ttft_ms: 238636,
    tpot_ms: 61.15,
    tokens_per_sec_per_gpu: 9432
  }]
}, {
  match: {
    hw: "b300",
    variant: "pro",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 258,
    tpot_ms: 4.2,
    tokens_per_sec_per_gpu: 243
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 460,
    tpot_ms: 10.97,
    tokens_per_sec_per_gpu: 1149
  }]
}, {
  match: {
    hw: "b300",
    variant: "pro",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64
    },
    ttft_ms: 1868,
    tpot_ms: 42.19,
    tokens_per_sec_per_gpu: 1336
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256
    },
    ttft_ms: 2917,
    tpot_ms: 99.32,
    tokens_per_sec_per_gpu: 2669
  }]
}, {
  match: {
    hw: "b300",
    variant: "pro",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1024
    },
    ttft_ms: 103678,
    tpot_ms: 43.99,
    tokens_per_sec_per_gpu: 4203
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 4096
    },
    ttft_ms: 257656,
    tpot_ms: 42.13,
    tokens_per_sec_per_gpu: 4400
  }]
}, {
  match: {
    hw: "b300",
    variant: "flash",
    quant: "nvfp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 187,
    tpot_ms: 2.83,
    tokens_per_sec_per_gpu: 729
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 410,
    tpot_ms: 7.68,
    tokens_per_sec_per_gpu: 3407
  }]
}, {
  match: {
    hw: "b300",
    variant: "pro",
    quant: "nvfp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 206,
    tpot_ms: 4.14,
    tokens_per_sec_per_gpu: 251
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 425,
    tpot_ms: 10.51,
    tokens_per_sec_per_gpu: 1256
  }]
}, {
  match: {
    hw: "gb200",
    variant: "flash",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  }
}, {
  match: {
    hw: "gb200",
    variant: "flash",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "0.5.12.post1",
  latencyPercentile: "Mean",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64
    },
    ttft_ms: 2560,
    tpot_ms: 39.71,
    tokens_per_sec_per_gpu: 3078
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256
    },
    ttft_ms: 3995,
    tpot_ms: 82.56,
    tokens_per_sec_per_gpu: 6462
  }]
}, {
  match: {
    hw: "gb200",
    variant: "flash",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  }
}, {
  match: {
    hw: "gb200",
    variant: "pro",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "multi-2"
  }
}, {
  match: {
    hw: "gb200",
    variant: "pro",
    quant: "fp4",
    strategy: "balanced",
    nodes: "multi-2"
  }
}, {
  match: {
    hw: "gb200",
    variant: "pro",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "multi-2"
  }
}, {
  match: {
    hw: "gb200",
    variant: "flash",
    quant: "nvfp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "PR #25820",
  latencyPercentile: "Mean",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 323.85,
    tpot_ms: 3.62,
    tokens_per_sec_per_gpu: 496
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 397.31,
    tpot_ms: 8.11,
    tokens_per_sec_per_gpu: 3663
  }],
  accuracy: {
    gsm8k_pct: 96.66
  }
}, {
  match: {
    hw: "gb200",
    variant: "pro",
    quant: "nvfp4",
    strategy: "low-latency",
    nodes: "multi-2"
  },
  sglang_version: "PR #25820",
  latencyPercentile: "Mean",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 338.20,
    tpot_ms: 6.25,
    tokens_per_sec_per_gpu: 161
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 524.85,
    tpot_ms: 14.45,
    tokens_per_sec_per_gpu: 1015
  }],
  accuracy: {
    gsm8k_pct: 95.98
  }
}, {
  match: {
    hw: "gb300",
    variant: "flash-official",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.16",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 468.93,
    tpot_ms: 1.31,
    tokens_per_sec_per_gpu: 930
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 726.81,
    tpot_ms: 8.84,
    tokens_per_sec_per_gpu: 2711
  }],
  accuracy: {
    gpqa_pct: 87.03,
    aime25_pct: 96.25,
    gsm8k_pct: 97.04
  }
}, {
  match: {
    hw: "gb300",
    variant: "flash-official",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "0.5.16",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64
    },
    ttft_ms: 1292.88,
    tpot_ms: 46.03,
    tokens_per_sec_per_gpu: 2678
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256
    },
    ttft_ms: 5861.87,
    tpot_ms: 103.54,
    tokens_per_sec_per_gpu: 5030
  }]
}, {
  match: {
    hw: "gb300",
    variant: "flash-official",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "0.5.16",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1024
    },
    ttft_ms: 156841.34,
    tpot_ms: 106.18,
    tokens_per_sec_per_gpu: 5520
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 4096
    },
    ttft_ms: 410259.84,
    tpot_ms: 105.33,
    tokens_per_sec_per_gpu: 5461
  }]
}, {
  match: {
    hw: "gb300",
    variant: "flash",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 434,
    tpot_ms: 3.72,
    tokens_per_sec_per_gpu: 513
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 735,
    tpot_ms: 9.95,
    tokens_per_sec_per_gpu: 2465
  }]
}, {
  match: {
    hw: "gb300",
    variant: "flash",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64
    },
    ttft_ms: 1041,
    tpot_ms: 30.45,
    tokens_per_sec_per_gpu: 4022
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256
    },
    ttft_ms: 4291,
    tpot_ms: 85.9,
    tokens_per_sec_per_gpu: 6366
  }]
}, {
  match: {
    hw: "gb300",
    variant: "flash",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1024
    },
    ttft_ms: 137866,
    tpot_ms: 93.14,
    tokens_per_sec_per_gpu: 6338
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 4096
    },
    ttft_ms: 364274,
    tpot_ms: 93.27,
    tokens_per_sec_per_gpu: 6246
  }]
}, {
  match: {
    hw: "gb300",
    variant: "pro",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 317,
    tpot_ms: 4.49,
    tokens_per_sec_per_gpu: 441
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 501,
    tpot_ms: 14.54,
    tokens_per_sec_per_gpu: 1934
  }]
}, {
  match: {
    hw: "gb300",
    variant: "pro",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64
    },
    ttft_ms: 1088,
    tpot_ms: 50.17,
    tokens_per_sec_per_gpu: 2455
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256
    },
    ttft_ms: 8122,
    tpot_ms: 156.18,
    tokens_per_sec_per_gpu: 3429
  }]
}, {
  match: {
    hw: "gb300",
    variant: "pro",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1024
    },
    ttft_ms: 288182,
    tpot_ms: 185.19,
    tokens_per_sec_per_gpu: 2832
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 4096
    },
    ttft_ms: 761128,
    tpot_ms: 188.23,
    tokens_per_sec_per_gpu: 2787
  }]
}, {
  match: {
    hw: "gb300",
    variant: "pro-official",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "main @ 273d978bed",
  latencyPercentile: "Mean",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1,
      num_prompts: 5
    },
    ttft_ms: 345.49,
    tpot_ms: 3.32,
    tokens_per_sec_per_gpu: 615
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16,
      num_prompts: 80
    },
    ttft_ms: 2854.89,
    tpot_ms: 9.35,
    tokens_per_sec_per_gpu: 2965
  }],
  accuracy: {
    gsm8k_pct: 96.13
  }
}, {
  match: {
    hw: "gb300",
    variant: "pro-official",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "main @ 273d978bed",
  latencyPercentile: "Mean",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64,
      num_prompts: 320
    },
    ttft_ms: 6641.90,
    tpot_ms: 37.42,
    tokens_per_sec_per_gpu: 3281
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256,
      num_prompts: 1280
    },
    ttft_ms: 19710.64,
    tpot_ms: 76.80,
    tokens_per_sec_per_gpu: 5996
  }],
  accuracy: {
    gsm8k_pct: 96.44
  }
}, {
  match: {
    hw: "gb300",
    variant: "pro-official",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "main @ 273d978bed",
  latencyPercentile: "Mean",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256,
      num_prompts: 1280
    },
    ttft_ms: 10149.99,
    tpot_ms: 75.29,
    tokens_per_sec_per_gpu: 6758
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 512,
      num_prompts: 2560
    },
    ttft_ms: 34087.61,
    tpot_ms: 120.69,
    tokens_per_sec_per_gpu: 7475
  }],
  accuracy: {
    gsm8k_pct: 96.66
  }
}, {
  match: {
    hw: "gb300",
    variant: "flash",
    quant: "nvfp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 430,
    tpot_ms: 3.51,
    tokens_per_sec_per_gpu: 537
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 734,
    tpot_ms: 10.59,
    tokens_per_sec_per_gpu: 2385
  }]
}, {
  match: {
    hw: "gb300",
    variant: "pro",
    quant: "nvfp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 321,
    tpot_ms: 4.61,
    tokens_per_sec_per_gpu: 440
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 631,
    tpot_ms: 14.25,
    tokens_per_sec_per_gpu: 1921
  }]
}, {
  match: {
    hw: "h200",
    variant: "flash",
    quant: "fp8",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 183,
    tpot_ms: 3.26,
    tokens_per_sec_per_gpu: 632
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 655,
    tpot_ms: 10.11,
    tokens_per_sec_per_gpu: 2752
  }]
}, {
  match: {
    hw: "h200",
    variant: "flash",
    quant: "fp8",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64
    },
    ttft_ms: 880,
    tpot_ms: 40.63,
    tokens_per_sec_per_gpu: 3156
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256
    },
    ttft_ms: 46563,
    tpot_ms: 89.82,
    tokens_per_sec_per_gpu: 3226
  }]
}, {
  match: {
    hw: "h200",
    variant: "flash",
    quant: "fp8",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1024
    },
    ttft_ms: 217694,
    tpot_ms: 146.95,
    tokens_per_sec_per_gpu: 3975
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 4096
    },
    ttft_ms: 576540,
    tpot_ms: 148.29,
    tokens_per_sec_per_gpu: 3920
  }]
}, {
  match: {
    hw: "h200",
    variant: "pro",
    quant: "fp8",
    strategy: "low-latency",
    nodes: "multi-2"
  }
}, {
  match: {
    hw: "h200",
    variant: "pro",
    quant: "fp8",
    strategy: "balanced",
    nodes: "multi-2"
  }
}, {
  match: {
    hw: "h200",
    variant: "pro",
    quant: "fp8",
    strategy: "high-throughput",
    nodes: "multi-2"
  }
}, {
  match: {
    hw: "h200",
    variant: "flash-official",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.16",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 308.29,
    tpot_ms: 1.72,
    tokens_per_sec_per_gpu: 606
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 661.70,
    tpot_ms: 8.39,
    tokens_per_sec_per_gpu: 2538
  }]
}, {
  match: {
    hw: "h200",
    variant: "flash-official",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "0.5.16",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64
    },
    ttft_ms: 1617.91,
    tpot_ms: 38.05,
    tokens_per_sec_per_gpu: 2994
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256
    },
    ttft_ms: 1931.94,
    tpot_ms: 104.53,
    tokens_per_sec_per_gpu: 4872
  }]
}, {
  match: {
    hw: "h200",
    variant: "flash-official",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "0.5.16",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1024
    },
    ttft_ms: 195108.42,
    tpot_ms: 123.81,
    tokens_per_sec_per_gpu: 4573
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 4096
    },
    ttft_ms: 505508.73,
    tpot_ms: 123.97,
    tokens_per_sec_per_gpu: 4542
  }]
}, {
  match: {
    hw: "h200",
    variant: "flash",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 242,
    tpot_ms: 3.37,
    tokens_per_sec_per_gpu: 603
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 498,
    tpot_ms: 10.19,
    tokens_per_sec_per_gpu: 2636
  }]
}, {
  match: {
    hw: "h200",
    variant: "flash",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64
    },
    ttft_ms: 864,
    tpot_ms: 34.12,
    tokens_per_sec_per_gpu: 3072
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256
    },
    ttft_ms: 3222,
    tpot_ms: 116.3,
    tokens_per_sec_per_gpu: 3768
  }]
}, {
  match: {
    hw: "h200",
    variant: "flash",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1024
    },
    ttft_ms: 193812,
    tpot_ms: 126.31,
    tokens_per_sec_per_gpu: 4503
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 4096
    },
    ttft_ms: 499528,
    tpot_ms: 125.07,
    tokens_per_sec_per_gpu: 4546
  }]
}, {
  match: {
    hw: "h200",
    variant: "pro",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 634,
    tpot_ms: 5.65,
    tokens_per_sec_per_gpu: 170
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 1727,
    tpot_ms: 23.12,
    tokens_per_sec_per_gpu: 559
  }]
}, {
  match: {
    hw: "h200",
    variant: "pro",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64
    },
    ttft_ms: 41506,
    tpot_ms: 26.14,
    tokens_per_sec_per_gpu: 589
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256
    },
    ttft_ms: 209586,
    tpot_ms: 28.23,
    tokens_per_sec_per_gpu: 591
  }]
}, {
  match: {
    hw: "h200",
    variant: "pro",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "0.5.15.post1",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1024
    },
    ttft_ms: 889185,
    tpot_ms: 66.39,
    tokens_per_sec_per_gpu: 594
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 4096
    },
    ttft_ms: 1833386,
    tpot_ms: 65.86,
    tokens_per_sec_per_gpu: 601
  }]
}, {
  match: {
    hw: "h100",
    variant: "flash",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "0.5.15",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1
    },
    ttft_ms: 205,
    tpot_ms: 3.19,
    tokens_per_sec_per_gpu: 319
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 16
    },
    ttft_ms: 469,
    tpot_ms: 8.48,
    tokens_per_sec_per_gpu: 1539
  }]
}, {
  match: {
    hw: "h100",
    variant: "flash",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "0.5.15",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 64
    },
    ttft_ms: 726,
    tpot_ms: 23.11,
    tokens_per_sec_per_gpu: 2306
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 256
    },
    ttft_ms: 35793,
    tpot_ms: 48.46,
    tokens_per_sec_per_gpu: 2416
  }]
}, {
  match: {
    hw: "h100",
    variant: "flash",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "0.5.15",
  speed: [{
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 1024
    },
    ttft_ms: 209393,
    tpot_ms: 65.31,
    tokens_per_sec_per_gpu: 2252
  }, {
    workload: {
      dataset: "random",
      isl: 8192,
      osl: 1024,
      max_concurrency: 4096
    },
    ttft_ms: 476764,
    tpot_ms: 66.0,
    tokens_per_sec_per_gpu: 2248
  }]
}, {
  match: {
    hw: "h100",
    variant: "pro",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "multi-2"
  }
}, {
  match: {
    hw: "h100",
    variant: "pro",
    quant: "fp4",
    strategy: "balanced",
    nodes: "multi-2"
  }
}, {
  match: {
    hw: "h100",
    variant: "pro",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "multi-2"
  }
}, {
  match: {
    hw: "mi300x",
    variant: "flash",
    quant: "fp8",
    strategy: "low-latency",
    nodes: "single"
  }
}, {
  match: {
    hw: "mi300x",
    variant: "flash",
    quant: "fp8",
    strategy: "balanced",
    nodes: "single"
  }
}, {
  match: {
    hw: "mi300x",
    variant: "flash",
    quant: "fp8",
    strategy: "high-throughput",
    nodes: "single"
  }
}, {
  match: {
    hw: "mi355x",
    variant: "flash",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  }
}, {
  match: {
    hw: "mi355x",
    variant: "flash",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  }
}, {
  match: {
    hw: "mi355x",
    variant: "flash",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  }
}, {
  match: {
    hw: "mi355x",
    variant: "flash",
    quant: "fp8",
    strategy: "low-latency",
    nodes: "single"
  }
}, {
  match: {
    hw: "mi355x",
    variant: "flash",
    quant: "fp8",
    strategy: "balanced",
    nodes: "single"
  }
}, {
  match: {
    hw: "mi355x",
    variant: "flash",
    quant: "fp8",
    strategy: "high-throughput",
    nodes: "single"
  }
}, {
  match: {
    hw: "mi355x",
    variant: "pro",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  }
}, {
  match: {
    hw: "mi355x",
    variant: "pro",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  }
}, {
  match: {
    hw: "mi355x",
    variant: "pro",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  }
}, {
  match: {
    hw: "mi355x",
    variant: "pro",
    quant: "fp8",
    strategy: "low-latency",
    nodes: "single"
  }
}, {
  match: {
    hw: "mi355x",
    variant: "pro",
    quant: "fp8",
    strategy: "balanced",
    nodes: "single"
  }
}, {
  match: {
    hw: "mi355x",
    variant: "pro",
    quant: "fp8",
    strategy: "high-throughput",
    nodes: "single"
  }
}, {
  match: {
    hw: "b200",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "dev-dsv4-flash-vision",
  accuracy: {
    mmmu_pro_pct: 75.14
  },
  notes: "MMMU-Pro (standard, 10-option) measured with sgl-eval on 4×B200 (TP=4) at temperature 1.0, top-p 0.95, --reasoning-effort max, with the bundled DSpark head enabled (--speculative-algorithm DSPARK)."
}, {
  match: {
    hw: "b200",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "PR #37253 @ 31854c3",
  accuracy: {
    mmmu_pro_pct: 74.10
  },
  notes: "MMMU-Pro (standard, 10-option) measured with sgl-eval on 4×B200 (TP=4, DP=4, DeepEP) at temperature 1.0, top-p 0.95, --reasoning-effort max; target-only (DP Attention is incompatible with DSpark)."
}, {
  match: {
    hw: "b200",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "PR #37253 @ 31854c3",
  accuracy: {
    mmmu_pro_pct: 73.76
  },
  notes: "MMMU-Pro (standard, 10-option) measured with sgl-eval on 4×B200 (TP=4, DP=4, MegaMoE) at temperature 1.0, top-p 0.95, --reasoning-effort max; target-only (DP Attention is incompatible with DSpark)."
}, {
  match: {
    hw: "b300",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  }
}, {
  match: {
    hw: "b300",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  }
}, {
  match: {
    hw: "b300",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  }
}, {
  match: {
    hw: "gb200",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  }
}, {
  match: {
    hw: "gb200",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  }
}, {
  match: {
    hw: "gb200",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  }
}, {
  match: {
    hw: "gb300",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  },
  sglang_version: "PR #37253 @ 61f962c",
  accuracy: {
    mmmu_pro_pct: 74.10
  },
  notes: "MMMU-Pro (standard, 10-option) measured with sgl-eval on 4×GB300 (TP=4) at temperature 1.0, top-p 0.95, --reasoning-effort max, with the bundled DSpark head enabled (--speculative-algorithm DSPARK)."
}, {
  match: {
    hw: "gb300",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  },
  sglang_version: "PR #37253 @ 61f962c",
  accuracy: {
    mmmu_pro_pct: 73.41
  },
  notes: "MMMU-Pro (standard, 10-option) measured with sgl-eval on 4×GB300 (TP=4, DP=4, DeepEP) at temperature 1.0, top-p 0.95, --reasoning-effort max; target-only (DP Attention is incompatible with DSpark)."
}, {
  match: {
    hw: "gb300",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "high-throughput",
    nodes: "single"
  },
  sglang_version: "PR #37253 @ 61f962c",
  accuracy: {
    mmmu_pro_pct: 74.57
  },
  notes: "MMMU-Pro (standard, 10-option) measured with sgl-eval on 4×GB300 (TP=4, DP=4, MegaMoE) at temperature 1.0, top-p 0.95, --reasoning-effort max; target-only (DP Attention is incompatible with DSpark)."
}, {
  match: {
    hw: "h200",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "low-latency",
    nodes: "single"
  }
}, {
  match: {
    hw: "h200",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  }
}, {
  match: {
    hw: "h100",
    variant: "flash-vision",
    quant: "fp4",
    strategy: "balanced",
    nodes: "single"
  }
}];

export const config = {
  modelName: "DeepSeek-V4",
  latencyPercentile: "P50",
  supportedHardware: ["h100", "h200", "b200", "b300", "gb200", "gb300", "rtx6000", "rtx5090", "dgx-spark", "mi300x", "mi355x"],
  hardware: [{
    id: "rtx6000",
    label: "RTX PRO 6000",
    vram: "96GB",
    vendor: "blackwell"
  }, {
    id: "rtx5090",
    label: "RTX 5090",
    vram: "32GB",
    vendor: "blackwell"
  }],
  variants: [{
    id: "flash",
    label: "Flash",
    subtitle: "284B"
  }, {
    id: "flash-official",
    label: "Flash Official",
    subtitle: "284B · 0731"
  }, {
    id: "flash-vision",
    label: "Flash Vision",
    subtitle: "305B · Exp"
  }, {
    id: "pro",
    label: "Pro",
    subtitle: "1.6T"
  }, {
    id: "pro-official",
    label: "Pro Official",
    subtitle: "1.6T · 0813"
  }],
  quantizations: [{
    id: "fp8",
    label: "FP8"
  }, {
    id: "fp4",
    label: "FP4"
  }, {
    id: "nvfp4",
    label: "NVFP4"
  }],
  strategies: [{
    id: "low-latency",
    label: "Low-Latency"
  }, {
    id: "balanced",
    label: "Balanced"
  }, {
    id: "high-throughput",
    label: "High-Throughput"
  }],
  nodesOptions: [{
    id: "single",
    label: "Single Node"
  }, {
    id: "multi-2",
    label: "Multi-Nodes"
  }],
  modelNames: {
    "flash|fp4": "deepseek-ai/DeepSeek-V4-Flash",
    "flash|fp8": "deepseek-ai/DeepSeek-V4-Flash",
    "flash|nvfp4": "nvidia/DeepSeek-V4-Flash-NVFP4",
    "flash-official|fp4": "deepseek-ai/DeepSeek-V4-Flash-0731",
    "flash-official|nvfp4": "nvidia/DeepSeek-V4-Flash-0731-NVFP4",
    "flash-vision|fp4": "deepseek-ai/DeepSeek-V4-Flash-Vision-Exp",
    "pro|fp4": "deepseek-ai/DeepSeek-V4-Pro",
    "pro|fp8": "deepseek-ai/DeepSeek-V4-Pro",
    "pro|nvfp4": "nvidia/DeepSeek-V4-Pro-NVFP4",
    "pro-official|fp4": "deepseek-ai/DeepSeek-V4-Pro-0813",
    "pro-official|nvfp4": "nvidia/DeepSeek-V4-Pro-0813-NVFP4",
    "h200|flash|fp8": "sgl-project/DeepSeek-V4-Flash-FP8",
    "h200|pro|fp8": "sgl-project/DeepSeek-V4-Pro-FP8",
    "mi300x|flash|fp8": "sgl-project/DeepSeek-V4-Flash-FP8",
    "mi355x|flash|fp8": "sgl-project/DeepSeek-V4-Flash-FP8",
    "mi355x|pro|fp8": "sgl-project/DeepSeek-V4-Pro-FP8"
  },
  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>"
    },
    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"}] }'`,
  benchmarkCommands: {
    speed: `python3 -m sglang.bench_serving \\
  --backend sglang \\
  --host {{CURL_HOST}} --port {{CURL_PORT}} \\
  --model {{MODEL_NAME}} \\
  --dataset-name {{DATASET}} \\
  --random-input-len {{ISL}} --random-output-len {{OSL}} \\
  --random-range-ratio 1.0 \\
  --num-prompts {{NUM_PROMPTS}} --max-concurrency {{MAX_CONCURRENCY}} \\
  --warmup-requests 64 --flush-cache`,
    accuracy: {
      gsm8k_pct: `# To install sgl-eval: pip install sgl-eval
sgl-eval run gsm8k \\
  --base-url http://{{CURL_HOST}}:{{CURL_PORT}}/v1 \\
  --num-threads 32`,
      gpqa_pct: {
        flash: `# To install sgl-eval: pip install sgl-eval
sgl-eval run gpqa \\
  --model {{MODEL_NAME}} --api-key <api-key> \\
  --n-repeats 16 --max-tokens 200000 \\
  --temperature 1.0 --top-p 1.0 --thinking \\
  --out-dir /sgl-workspace/logs \\
  --base-url http://{{CURL_HOST}}:{{CURL_PORT}}/v1`,
        "flash-official": `# To install sgl-eval: pip install sgl-eval
sgl-eval run gpqa \\
  --model {{MODEL_NAME}} --api-key <api-key> \\
  --n-repeats 16 --max-tokens 200000 \\
  --temperature 1.0 --top-p 1.0 --thinking \\
  --out-dir /sgl-workspace/logs \\
  --base-url http://{{CURL_HOST}}:{{CURL_PORT}}/v1`,
        pro: `# To install sgl-eval: pip install sgl-eval
sgl-eval run gpqa \\
  --model {{MODEL_NAME}} --api-key <api-key> \\
  --n-repeats 16 --max-tokens 400000 \\
  --temperature 1.0 --top-p 1.0 --thinking \\
  --out-dir /sgl-workspace/logs \\
  --base-url http://{{CURL_HOST}}:{{CURL_PORT}}/v1`
      },
      aime25_pct: {
        "flash-official": `# To install sgl-eval: pip install sgl-eval
sgl-eval run aime25 \\
  --model {{MODEL_NAME}} --api-key <api-key> \\
  --n-repeats 16 --max-tokens 200000 \\
  --temperature 1.0 --top-p 1.0 --thinking \\
  --out-dir /sgl-workspace/logs \\
  --base-url http://{{CURL_HOST}}:{{CURL_PORT}}/v1`,
        flash: `# To install sgl-eval: pip install sgl-eval
sgl-eval run aime25 \\
  --model {{MODEL_NAME}} --api-key <api-key> \\
  --n-repeats 16 --max-tokens 200000 \\
  --temperature 1.0 --top-p 1.0 --thinking \\
  --out-dir /sgl-workspace/logs \\
  --base-url http://{{CURL_HOST}}:{{CURL_PORT}}/v1`,
        pro: `# To install sgl-eval: pip install sgl-eval
sgl-eval run aime25 \\
  --model {{MODEL_NAME}} --api-key <api-key> \\
  --n-repeats 16 --max-tokens 400000 \\
  --temperature 1.0 --top-p 1.0 --thinking \\
  --out-dir /sgl-workspace/logs \\
  --base-url http://{{CURL_HOST}}:{{CURL_PORT}}/v1`
      },
      mmmu_pro_pct: {
        "flash-vision": `# To install sgl-eval: pip install sgl-eval
sgl-eval run mmmu_pro \\
  --reasoning-effort max \\
  --temperature 1.0 --top-p 0.95 \\
  --base-url http://{{CURL_HOST}}:{{CURL_PORT}}/v1`
      }
    },
    numPromptsByConc: {
      1: 32,
      16: 32,
      64: 128,
      256: 512,
      1024: 2048,
      4096: 4096
    }
  },
  defaultAccuracy: {
    flash: {
      gpqa_pct: 88.1,
      aime25_pct: 95,
      gsm8k_pct: 96.13
    },
    pro: {
      gpqa_pct: 90.1,
      aime25_pct: 97.5,
      gsm8k_pct: 96.13
    }
  },
  accuracyLabels: [["gpqa_pct", "GPQA Diamond", "%"], ["aime25_pct", "AIME25", "%"], ["gsm8k_pct", "GSM8K (1-shot)", "%"], ["mmmu_pro_pct", "MMMU-Pro (standard, 10-option)", "%"]],
  multiNodeHints: {
    gb200: ["The following env vars may be needed depending on your cluster:", "  GLOO_SOCKET_IFNAME=<your-nic>", "  NVSHMEM_ENABLE_NIC_PE_MAPPING=1", "  NVSHMEM_HCA_LIST=<your-hca-list>"]
  },
  dockerImages: {
    "flash-vision|fp4": "lmsysorg/sglang:dev-dsv4-flash-vision",
    "dgx-spark|flash-official|fp4": "lmsysorg/sglang:dev-v4f-2dgx-v2",
    "dgx-spark|flash-official|nvfp4": "lmsysorg/sglang:dev-v4f-2dgx-v2",
    "dgx-spark|flash-vision|fp4": "lmsysorg/sglang:dev-v4f-2dgx-v2",
    "b200|nvfp4": "lmsysorg/sglang:dev",
    "b300|nvfp4": "lmsysorg/sglang:dev",
    "gb200|nvfp4": "lmsysorg/sglang:dev",
    "gb300|nvfp4": "lmsysorg/sglang:dev",
    h100: "lmsysorg/sglang:latest",
    h200: "lmsysorg/sglang:latest",
    b200: "lmsysorg/sglang:latest",
    b300: "lmsysorg/sglang:latest",
    gb200: "lmsysorg/sglang:latest",
    gb300: "lmsysorg/sglang:latest",
    mi300x: "lmsysorg/sglang-rocm:v0.5.19-rocm720-mi30x-20260911",
    mi355x: "lmsysorg/sglang-rocm:v0.5.19-rocm720-mi35x-20260911"
  },
  github: {
    cookbookModel: "deepseek-ai/deepseek-v4"
  },
  playgroundFeatures: {
    attention: {
      knobs: [{
        id: "tp",
        label: "TP",
        values: [null, {
          value: 1,
          hide: {
            variant: ["pro"]
          }
        }, {
          value: 2,
          hide: {
            variant: ["pro"]
          }
        }, 4, 8, {
          value: 16,
          disable: {
            nodes: ["single"]
          },
          disableReason: "TP=16 requires 16 ranks — switch the Deploy panel's Nodes to Multi-Nodes first."
        }]
      }, {
        id: "cp",
        label: "CP",
        values: [null, {
          value: 1,
          label: "Off"
        }, 2, 4, 8],
        disable: [{
          when: {
            nodes: ["multi-2"]
          },
          reason: "Prefill Context Parallel is single-machine only (SGLang asserts tp_size <= 8; cross-machine CP has precision issues)."
        }]
      }, {
        id: "dpAttn",
        label: "DP-Attention",
        forceOff: [{
          when: {
            hw: ["mi355x"],
            strategy: ["low-latency", "balanced"],
            pdMode: ["prefill", "decode"]
          },
          stripEnv: ["SGLANG_DP_SHARED_EXPERT_LOCAL", "SGLANG_DP_USE_GATHERV", "SGLANG_DP_USE_REDUCE_SCATTER"],
          reason: "The low-latency and balanced PD roles are TP-only, which is what makes --cuda-graph-bs-decode equal the full ceiling. --max-running-requests is server-wide and floor-divided by attn_dp_size, so DP would cut the per-rank batch below the captured graphs."
        }],
        values: [null, false, {
          value: 1,
          hide: {
            variant: ["pro"]
          }
        }, {
          value: 2,
          hide: {
            variant: ["pro"]
          }
        }, 4, 8, {
          value: 16,
          disable: {
            nodes: ["single"]
          },
          disableReason: "DP-Attention=16 requires 16 ranks — switch the Deploy panel's Nodes to Multi-Nodes first."
        }],
        labels: {
          "auto": "Auto",
          "false": "Off"
        }
      }]
    },
    moe: {
      backend: {
        options: [{
          id: null,
          label: "Inherited"
        }, {
          id: "deepep",
          label: "DeepEP",
          flags: ["--moe-a2a-backend deepep"]
        }, {
          id: "megamoe",
          label: "MegaMoE",
          flags: ["--moe-a2a-backend megamoe"],
          requiresHw: ["b200", "b300", "gb200", "gb300"]
        }, {
          id: "flashinfer_mxfp4",
          label: "FlashInfer (MXFP4)",
          flags: ["--moe-runner-backend flashinfer_mxfp4"]
        }, {
          id: "marlin",
          label: "Marlin (W4A16)",
          flags: ["--moe-runner-backend marlin"]
        }]
      },
      megamoeQuant: {
        stripEnv: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK"],
        options: [{
          id: "w4a8",
          label: "W4A8",
          env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"]
        }, {
          id: "w4a4",
          label: "W4A4",
          flags: ["--enable-w4a4-mxfp4-megamoe"],
          env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"]
        }]
      },
      ep: {
        label: "EP",
        values: [null, {
          value: 1,
          hide: {
            variant: ["pro"]
          }
        }, {
          value: 2,
          hide: {
            variant: ["pro"]
          }
        }, 4, 8, {
          value: 16,
          disable: {
            nodes: ["single"]
          },
          disableReason: "EP=16 requires 16 ranks — switch the Deploy panel's Nodes to Multi-Nodes first."
        }]
      }
    },
    parsers: {
      items: [{
        id: "reasoning",
        label: "Reasoning Parser",
        flag: "--reasoning-parser deepseek-v4"
      }, {
        id: "toolCall",
        label: "Tool Call Parser",
        flag: "--tool-call-parser deepseekv4"
      }]
    },
    speculative: {
      options: [{
        id: "current",
        label: "Inherited from base"
      }, {
        id: "off",
        label: "Off (greedy)"
      }, {
        id: "mtp-314",
        label: "EAGLE / MTP 3-1-4",
        flags: ["--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4"],
        hide: {
          variant: ["flash-official", "flash-vision"]
        }
      }, {
        id: "mtp-112",
        label: "EAGLE / MTP 1-1-2",
        flags: ["--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2"],
        hide: {
          variant: ["flash-official", "flash-vision", "pro-official"]
        }
      }, {
        id: "dspark",
        label: "DSpark",
        flags: ["--speculative-algorithm DSPARK"],
        hide: {
          variant: ["flash", "pro"]
        },
        disable: [{
          when: {
            dpAttnOn: [true]
          },
          reason: "DSpark is not compatible with DP Attention on the current release. For a DP + DSpark agentic recipe, see the cookbook §3.6 (B200) / §3.7 (MI355X) notes."
        }, {
          when: {
            hw: ["mi300x"]
          },
          reason: "DSpark on ROCm is documented for MI355X Pro Official (0813); MI300X still requires CUDA."
        }]
      }, {
        id: "ngram",
        label: "NGRAM",
        flags: ["--speculative-algorithm NGRAM", "--speculative-num-draft-tokens 16", "--speculative-ngram-max-bfs-breadth 10"],
        disable: {
          dpAttnOn: [true]
        },
        disableReason: "NGRAM is incompatible with DP-Attention. Turn DP-Attention off in the Attention card above to use NGRAM."
      }, {
        id: "dflash",
        label: "DFlash",
        disabled: true,
        disableReason: "Coming soon — pending DFlash kernel integration."
      }]
    },
    pdDisagg: {
      incompatibleSpeculativeAlgorithms: ["DSPARK"],
      modes: [{
        id: "off",
        label: "Off"
      }, {
        id: "prefill",
        label: "Prefill role",
        when: {
          hw: ["mi355x"],
          strategy: ["low-latency"]
        },
        env: ["SGLANG_MORI_NUM_MAX_DISPATCH_TOKENS_PER_RANK=16384"],
        flags: ["--load-balance-method round_robin", "--tokenizer-worker-num 8", "--stream-interval 20", "--mem-fraction-static 0.86", "--max-running-requests 8", "--swa-full-tokens-ratio 0.1", "--disable-cuda-graph", "--context-length 1048576", "--watchdog-timeout 3600", "--enable-metrics"]
      }, {
        id: "decode",
        label: "Decode role",
        when: {
          hw: ["mi355x"],
          strategy: ["low-latency"]
        },
        env: ["SGLANG_MORI_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128"],
        flags: ["--load-balance-method round_robin", "--tokenizer-worker-num 8", "--stream-interval 20", "--mem-fraction-static 0.86", "--max-running-requests 8", "--swa-full-tokens-ratio 0.1", "--cuda-graph-bs-decode 1 2 3 4 5 6 7 8", "--context-length 1048576", "--watchdog-timeout 3600", "--enable-metrics"]
      }],
      transferBackends: [{
        id: "mooncake",
        label: "Mooncake",
        env: ["NCCL_MNNVL_ENABLE=1", "NCCL_CUMEM_ENABLE=1", "SGLANG_MOONCAKE_CUSTOM_MEM_POOL=True", "MC_FORCE_MNNVL=1"],
        envWhen: {
          hw: ["gb200", "gb300"]
        }
      }, {
        id: "nixl",
        label: "NiXL"
      }, {
        id: "mori",
        label: "MORI",
        hide: {
          hw: ["h100", "h200", "b200", "b300", "gb200", "gb300", "rtx6000"]
        },
        env: ["SGLANG_MORI_COMBINE_DTYPE=auto", "MORI_IO_SQ_BACKOFF_TIMEOUT_US=500000", "MORI_IO_QP_MAX_SEND_WR=32767"],
        envWhen: {
          hw: ["mi300x", "mi355x"]
        }
      }],
      ibDevices: [{
        id: "auto",
        label: "Auto"
      }, {
        id: "mlx5_0",
        label: "mlx5_0",
        hide: {
          hw: ["mi300x", "mi355x"]
        }
      }, {
        id: "mlx5_7",
        label: "mlx5_7",
        hide: {
          hw: ["mi300x", "mi355x"]
        }
      }, {
        id: "rdma3,rdma0,rdma2,rdma1,rdma7,rdma4,rdma6,rdma5",
        label: "rdma0-7 (all NICs)",
        hide: {
          hw: ["h100", "h200", "b200", "b300", "gb200", "gb300", "rtx6000", "rtx5090", "dgx-spark"]
        }
      }],
      router: {
        port: 8000,
        command: `python3 -m sglang_router.launch_router \\
  --pd-disaggregation \\
  --prefill http://<prefill-host>:{{PREFILL_PORT}} \\
  --decode http://<decode-host>:{{DECODE_PORT}} \\
  --host 0.0.0.0 --port {{ROUTER_PORT}} \\
  --disable-circuit-breaker \\
  --health-check-interval-secs 999999`
      },
      roleOverrides: [{
        mode: "prefill",
        when: {
          hw: ["mi355x"],
          strategy: ["balanced"]
        },
        env: ["SGLANG_MORI_NUM_MAX_DISPATCH_TOKENS_PER_RANK=16384"],
        flags: ["--load-balance-method round_robin", "--mem-fraction-static 0.86", "--max-running-requests 96", "--swa-full-tokens-ratio 0.1", "--chunked-prefill-size 16384", "--disable-cuda-graph", "--context-length 1048576", "--watchdog-timeout 3600", "--enable-metrics"]
      }, {
        mode: "decode",
        when: {
          hw: ["mi355x"],
          strategy: ["balanced"]
        },
        env: ["SGLANG_MORI_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128"],
        flags: ["--load-balance-method round_robin", "--mem-fraction-static 0.86", "--max-running-requests 96", "--swa-full-tokens-ratio 0.1", "--cuda-graph-bs-decode 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96", "--context-length 1048576", "--watchdog-timeout 3600", "--enable-metrics"]
      }, {
        mode: "prefill",
        when: {
          hw: ["mi355x"],
          strategy: ["high-throughput"]
        },
        env: ["SGLANG_MORI_NUM_MAX_DISPATCH_TOKENS_PER_RANK=16384"],
        flags: ["--load-balance-method round_robin", "--mem-fraction-static 0.92", "--max-running-requests 256", "--disable-cuda-graph", "--context-length 1048576", "--watchdog-timeout 3600", "--enable-metrics", "--enable-cache-report"]
      }, {
        mode: "decode",
        when: {
          hw: ["mi355x"],
          strategy: ["high-throughput"]
        },
        env: ["SGLANG_MORI_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128"],
        flags: ["--load-balance-method round_robin", "--mem-fraction-static 0.92", "--max-running-requests 256", "--cuda-graph-bs-decode 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", "--context-length 1048576", "--watchdog-timeout 3600", "--enable-metrics"]
      }],
      routerOverrides: [{
        when: {
          hw: ["mi355x"]
        },
        command: `python3 -m sglang_router.launch_router \\
  --pd-disaggregation \\
  --prefill http://<prefill-host>:{{PREFILL_PORT}} \\
  --decode http://<decode-host>:{{DECODE_PORT}} \\
  --host 0.0.0.0 --port {{ROUTER_PORT}} \\
  --policy consistent_hashing --dp-aware \\
  --cache-threshold 0.3 \\
  --balance-abs-threshold 2 --balance-rel-threshold 1.1 \\
  --disable-circuit-breaker --health-failure-threshold 100 \\
  --health-check-timeout-secs 600 --health-check-interval-secs 30`
      }]
    },
    hicache: {
      excludesHw: ["rtx6000"],
      amdIo: {
        memLayout: "page_first_direct",
        ioBackend: "direct",
        ratio: 4
      },
      roleOverrides: [{
        when: {
          hw: ["mi355x"],
          variant: ["pro"],
          quant: ["fp4"],
          strategy: ["low-latency"],
          nodes: ["single"]
        },
        mode: "prefill",
        transferBackend: "mori",
        memLayout: "page_first",
        ioBackend: "direct",
        ratio: 5,
        writePolicy: "write_through",
        prefetchPolicy: "best_effort"
      }, {
        when: {
          hw: ["mi355x"],
          variant: ["pro-official"],
          quant: ["fp4"],
          strategy: ["balanced"],
          nodes: ["single"]
        },
        mode: "prefill",
        transferBackend: "mori",
        memLayout: "page_first",
        ioBackend: "direct",
        ratio: 2.5,
        writePolicy: "write_through",
        prefetchPolicy: "best_effort"
      }],
      notices: [{
        when: {
          hw: ["mi355x"],
          variant: ["pro"],
          quant: ["fp4"],
          strategy: ["low-latency"],
          nodes: ["single"]
        },
        mode: "decode",
        transferBackend: "mori",
        text: "HiCache is not recommended on the decode role with MORI."
      }, {
        when: {
          hw: ["mi355x"],
          variant: ["pro-official"],
          quant: ["fp4"],
          strategy: ["balanced"],
          nodes: ["single"]
        },
        mode: "decode",
        transferBackend: "mori",
        text: "HiCache is not recommended on the decode role with MORI."
      }],
      amdStorageFileOnly: true,
      backends: [{
        id: null,
        label: "Auto"
      }, {
        id: "file",
        label: "File"
      }, {
        id: "mooncake",
        label: "Mooncake",
        hide: {
          hw: ["mi300x", "mi355x"]
        }
      }, {
        id: "hf3fs",
        label: "HF3FS",
        hide: {
          hw: ["mi300x", "mi355x"]
        }
      }, {
        id: "nixl",
        label: "NiXL",
        hide: {
          hw: ["mi300x", "mi355x"]
        }
      }],
      writePolicies: [{
        id: "auto",
        label: "Auto"
      }, {
        id: "write_through",
        label: "Write-through"
      }, {
        id: "write_back",
        label: "Write-back"
      }, {
        id: "write_through_selective",
        label: "Write-through (selective)"
      }]
    },
    umbp: {
      onlyHw: ["mi300x", "mi355x"],
      requiresDpAttention: true,
      defaultBackend: "mori",
      backends: [{
        id: "mori",
        label: "MORI (UMBP)"
      }, {
        id: "mooncake",
        label: "Mooncake"
      }]
    },
    hisparse: {
      requiredFlags: ["--disable-radix-cache"],
      config: {
        top_k: 2048,
        device_buffer_size: 6144
      },
      hostRatios: [{
        id: 5,
        label: "5 (~1TB host)"
      }, {
        id: 10,
        label: "10 (~2TB host)"
      }],
      defaultHostRatio: 10
    },
    flagSelects: [{
      id: "dsparkDraftTokens",
      title: "DSpark Proposed Draft Tokens",
      showWhen: base => (base.variant === "flash-official" || base.variant === "pro-official") && base.specAlgorithm === "DSPARK",
      control: "slider",
      stripPrefixes: ["--speculative-dspark-block-size"],
      options: [{
        id: "auto",
        label: "Checkpoint default"
      }, {
        id: "1",
        label: "1",
        flags: ["--speculative-dspark-block-size 1"]
      }, {
        id: "2",
        label: "2",
        flags: ["--speculative-dspark-block-size 2"]
      }, {
        id: "3",
        label: "3",
        flags: ["--speculative-dspark-block-size 3"]
      }, {
        id: "4",
        label: "4",
        flags: ["--speculative-dspark-block-size 4"]
      }, {
        id: "5",
        label: "5",
        flags: ["--speculative-dspark-block-size 5"]
      }, {
        id: "6",
        label: "6",
        flags: ["--speculative-dspark-block-size 6"]
      }]
    }]
  },
  cells: [{
    match: {
      hw: "b200",
      variant: "flash-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm DSPARK", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "flash",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "flash-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=1024"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--moe-a2a-backend deepep", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "flash",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=1024"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "flash-official",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "flash",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "pro",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "pro",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=4096"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--chunked-prefill-size 32768", "--swa-full-tokens-ratio 0.1", "--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2", "--mem-fraction-static 0.92", "--cuda-graph-max-bs-decode 256", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "pro",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--mem-fraction-static 0.835", "--cuda-graph-max-bs-decode 544", "--swa-full-tokens-ratio 0.075", "--chunked-prefill-size 65536", "--tokenizer-worker-num 8", "--enable-prefill-delayer", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "flash-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm DSPARK", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "flash",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "flash-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: false,
    env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=1024"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "flash",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=1024"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "flash-official",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: false,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "flash",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "pro",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "pro",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--moe-runner-backend flashinfer_mxfp4", "--disable-flashinfer-autotune", "--chunked-prefill-size 32768", "--swa-full-tokens-ratio 0.1", "--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2", "--mem-fraction-static 0.92", "--cuda-graph-max-bs-decode 256", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "pro",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--mem-fraction-static 0.835", "--cuda-graph-max-bs-decode 544", "--swa-full-tokens-ratio 0.075", "--chunked-prefill-size 65536", "--tokenizer-worker-num 8", "--enable-prefill-delayer", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "pro",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "flash",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "flash-official",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm DSPARK", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "pro-official",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm DSPARK", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "flash",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "pro",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "flash-official",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verificationStatus: "in-progress",
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm DSPARK", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "pro-official",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verificationStatus: "in-progress",
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm DSPARK", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "flash-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: false,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm DSPARK", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "flash",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "flash-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: false,
    env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=1024"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "flash",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=1024"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "flash-official",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: false,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "flash",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "pro",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "multi-2"
    },
    verified: true,
    env: ["NCCL_MNNVL_ENABLE=1", "NCCL_CUMEM_ENABLE=1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "pro",
      quant: "fp4",
      strategy: "balanced",
      nodes: "multi-2"
    },
    verified: true,
    env: ["NCCL_MNNVL_ENABLE=1", "NCCL_CUMEM_ENABLE=1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--moe-a2a-backend deepep", "--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2", "--mem-fraction-static 0.78", "--cuda-graph-max-bs-decode 64", "--max-running-requests 128", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "pro",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "multi-2"
    },
    verified: true,
    env: ["NCCL_MNNVL_ENABLE=1", "NCCL_CUMEM_ENABLE=1", "SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--mem-fraction-static 0.78", "--cuda-graph-max-bs-decode 64", "--max-running-requests 256", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "flash",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "pro",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "multi-2"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "flash-official",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verificationStatus: "in-progress",
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm DSPARK", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "pro-official",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "multi-2"
    },
    verificationStatus: "in-progress",
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm DSPARK", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "flash-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm DSPARK", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "flash",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "flash-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=1024"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "flash",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=1024"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "flash-official",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "flash",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "pro",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "pro",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2", "--mem-fraction-static 0.9", "--cuda-graph-max-bs-decode 128", "--max-running-requests 256", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "pro",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--mem-fraction-static 0.9", "--cuda-graph-max-bs-decode 128", "--max-running-requests 256", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "pro-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm DSPARK", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "pro-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "pro-official",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--mem-fraction-static 0.9", "--cuda-graph-max-bs-decode 128", "--max-running-requests 512", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "pro-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: false,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm DSPARK", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "pro-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: false,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=4096"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--chunked-prefill-size 32768", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.92", "--cuda-graph-max-bs-decode 256", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "pro-official",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: false,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--mem-fraction-static 0.835", "--cuda-graph-max-bs-decode 544", "--swa-full-tokens-ratio 0.075", "--chunked-prefill-size 65536", "--tokenizer-worker-num 8", "--enable-prefill-delayer", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "pro-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: false,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm DSPARK", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "pro-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: false,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--moe-runner-backend flashinfer_mxfp4", "--disable-flashinfer-autotune", "--chunked-prefill-size 32768", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.92", "--cuda-graph-max-bs-decode 256", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "pro-official",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: false,
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--mem-fraction-static 0.835", "--cuda-graph-max-bs-decode 544", "--swa-full-tokens-ratio 0.075", "--chunked-prefill-size 65536", "--tokenizer-worker-num 8", "--enable-prefill-delayer", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "pro-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "multi-2"
    },
    verified: false,
    env: ["NCCL_MNNVL_ENABLE=1", "NCCL_CUMEM_ENABLE=1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm DSPARK", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "pro-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "multi-2"
    },
    verified: false,
    env: ["NCCL_MNNVL_ENABLE=1", "NCCL_CUMEM_ENABLE=1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--moe-a2a-backend deepep", "--mem-fraction-static 0.78", "--cuda-graph-max-bs-decode 64", "--max-running-requests 128", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "pro-official",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "multi-2"
    },
    verified: false,
    env: ["NCCL_MNNVL_ENABLE=1", "NCCL_CUMEM_ENABLE=1", "SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--mem-fraction-static 0.78", "--cuda-graph-max-bs-decode 64", "--max-running-requests 256", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "pro-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: false,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm DSPARK", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "pro-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: false,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm DSPARK", "--mem-fraction-static 0.88", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "pro-official",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: false,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_mxfp4", "--mem-fraction-static 0.88", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h100",
      variant: "pro-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "multi-2"
    },
    verified: false,
    env: ["SGLANG_SHARED_EXPERT_TP1=1"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 16", "--moe-runner-backend marlin", "--speculative-algorithm DSPARK", "--mem-fraction-static 0.9", "--cuda-graph-max-bs-decode 8", "--max-running-requests 32", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h100",
      variant: "pro-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "multi-2"
    },
    verified: false,
    env: ["SGLANG_SHARED_EXPERT_TP1=1"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 16", "--moe-runner-backend marlin", "--speculative-algorithm DSPARK", "--mem-fraction-static 0.9", "--cuda-graph-max-bs-decode 8", "--max-running-requests 32", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h100",
      variant: "pro-official",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "multi-2"
    },
    verified: false,
    env: ["SGLANG_SHARED_EXPERT_TP1=1"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 16", "--moe-runner-backend marlin", "--mem-fraction-static 0.9", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "pro-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: false,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--prefill-decode-interval 10", "--attention-backend dsv4", "--enable-deepseek-v4-fp4-indexer", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 16384", "--speculative-algorithm DSPARK", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "pro-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: false,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_SHARED_EXPERT_TP1=1", "SGLANG_DP_SHARED_EXPERT_LOCAL=1", "SGLANG_DP_USE_GATHERV=1", "SGLANG_DP_USE_REDUCE_SCATTER=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--enable-dp-attention-local-control-broadcast", "--tokenizer-worker-num 8", "--stream-interval 20", "--prefill-decode-interval 10", "--attention-backend dsv4", "--enable-deepseek-v4-fp4-indexer", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 65536", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "pro-official",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: false,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_SHARED_EXPERT_TP1=1", "SGLANG_DP_SHARED_EXPERT_LOCAL=1", "SGLANG_DP_USE_GATHERV=1", "SGLANG_DP_USE_REDUCE_SCATTER=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--enable-dp-attention-local-control-broadcast", "--tokenizer-worker-num 8", "--stream-interval 20", "--prefill-decode-interval 10", "--attention-backend dsv4", "--enable-deepseek-v4-fp4-indexer", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 65536", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "flash",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "pro",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "flash-official",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verificationStatus: "in-progress",
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm DSPARK", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "pro-official",
      quant: "nvfp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verificationStatus: "in-progress",
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_trtllm_routed", "--speculative-algorithm DSPARK", "--chunked-prefill-size 8192", "--disable-flashinfer-autotune", "--swa-full-tokens-ratio 0.1", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "flash",
      quant: "fp8",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_DSV4_FP4_EXPERTS=0"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "flash",
      quant: "fp8",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_DSV4_FP4_EXPERTS=0", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2", "--cuda-graph-max-bs-decode 128", "--max-running-requests 128", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "flash",
      quant: "fp8",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_DSV4_FP4_EXPERTS=0", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--cuda-graph-max-bs-decode 128", "--max-running-requests 256", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "pro",
      quant: "fp8",
      strategy: "low-latency",
      nodes: "multi-2"
    },
    verified: true,
    env: ["SGLANG_DSV4_FP4_EXPERTS=0", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 16", "--dp 16", "--enable-dp-attention", "--moe-a2a-backend deepep", "--cuda-graph-max-bs-decode 8", "--max-running-requests 32", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--mem-fraction-static 0.88", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "pro",
      quant: "fp8",
      strategy: "balanced",
      nodes: "multi-2"
    },
    verified: true,
    env: ["SGLANG_DSV4_FP4_EXPERTS=0", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 16", "--dp 16", "--enable-dp-attention", "--moe-a2a-backend deepep", "--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2", "--mem-fraction-static 0.88", "--cuda-graph-max-bs-decode 8", "--max-running-requests 32", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "pro",
      quant: "fp8",
      strategy: "high-throughput",
      nodes: "multi-2"
    },
    verified: true,
    env: ["SGLANG_DSV4_FP4_EXPERTS=0", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=128"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 16", "--dp 16", "--enable-dp-attention", "--moe-a2a-backend deepep", "--mem-fraction-static 0.88", "--cuda-graph-max-bs-decode 128", "--max-running-requests 256", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "flash-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verificationStatus: "in-progress",
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_mxfp4", "--flashinfer-mxfp4-moe-precision fp8", "--speculative-algorithm DSPARK", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "flash",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verificationStatus: "in-progress",
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_mxfp4", "--flashinfer-mxfp4-moe-precision fp8", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "flash-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm DSPARK", "--mem-fraction-static 0.88", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "flash",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "flash-official",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend marlin", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "flash",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend marlin", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "pro",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verificationStatus: "in-progress",
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_mxfp4", "--flashinfer-mxfp4-moe-precision fp8", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--mem-fraction-static 0.90", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "pro",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_mxfp4", "--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2", "--mem-fraction-static 0.88", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "pro",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_mxfp4", "--mem-fraction-static 0.88", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h100",
      variant: "flash-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: false,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend marlin", "--speculative-algorithm DSPARK", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h100",
      variant: "flash",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend marlin", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h100",
      variant: "flash-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: false,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend marlin", "--speculative-algorithm DSPARK", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h100",
      variant: "flash",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend marlin", "--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h100",
      variant: "flash-official",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: false,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend marlin", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h100",
      variant: "flash",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend marlin", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h100",
      variant: "pro",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "multi-2"
    },
    verified: true,
    env: ["SGLANG_SHARED_EXPERT_TP1=1"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 16", "--moe-runner-backend marlin", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--mem-fraction-static 0.9", "--cuda-graph-max-bs-decode 8", "--max-running-requests 32", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h100",
      variant: "pro",
      quant: "fp4",
      strategy: "balanced",
      nodes: "multi-2"
    },
    verified: true,
    env: ["SGLANG_SHARED_EXPERT_TP1=1"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 16", "--moe-runner-backend marlin", "--speculative-algorithm EAGLE", "--speculative-num-steps 1", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2", "--mem-fraction-static 0.9", "--cuda-graph-max-bs-decode 8", "--max-running-requests 32", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h100",
      variant: "pro",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "multi-2"
    },
    verified: true,
    env: ["SGLANG_SHARED_EXPERT_TP1=1"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 16", "--moe-runner-backend marlin", "--mem-fraction-static 0.9", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "rtx6000",
      variant: "flash-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: false,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 2", "--moe-runner-backend flashinfer_mxfp4", "--mem-fraction-static 0.92", "--cuda-graph-max-bs-decode 32", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "rtx6000",
      variant: "flash",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 2", "--moe-runner-backend flashinfer_mxfp4", "--mem-fraction-static 0.92", "--cuda-graph-max-bs-decode 32", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "rtx5090",
      variant: "flash-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: false,
    env: [],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend flashinfer_mxfp4", "--mem-fraction-static 0.90", "--cuda-graph-max-bs-decode 32", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi300x",
      variant: "flash",
      quant: "fp8",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.1", "--disable-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 16384", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi300x",
      variant: "flash",
      quant: "fp8",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_DP_USE_GATHERV=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--enable-prefill-delayer", "--prefill-delayer-max-delay-ms 5000", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.1", "--disable-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 65536", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi300x",
      variant: "flash",
      quant: "fp8",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_DP_USE_GATHERV=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--enable-prefill-delayer", "--prefill-delayer-max-delay-ms 5000", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.1", "--disable-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 65536", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "flash-official",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: false,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 16384", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "flash",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 16384", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "flash-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: false,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_SHARED_EXPERT_TP1=1", "SGLANG_DP_SHARED_EXPERT_LOCAL=1", "SGLANG_DP_USE_GATHERV=1", "SGLANG_DP_USE_REDUCE_SCATTER=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--enable-dp-attention-local-control-broadcast", "--tokenizer-worker-num 8", "--stream-interval 20", "--prefill-decode-interval 10", "--enable-two-batch-overlap", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 65536", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "flash",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_SHARED_EXPERT_TP1=1", "SGLANG_DP_SHARED_EXPERT_LOCAL=1", "SGLANG_DP_USE_GATHERV=1", "SGLANG_DP_USE_REDUCE_SCATTER=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--enable-dp-attention-local-control-broadcast", "--tokenizer-worker-num 8", "--stream-interval 20", "--prefill-decode-interval 10", "--enable-two-batch-overlap", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 65536", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "flash-official",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: false,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_SHARED_EXPERT_TP1=1", "SGLANG_DP_SHARED_EXPERT_LOCAL=1", "SGLANG_DP_USE_GATHERV=1", "SGLANG_DP_USE_REDUCE_SCATTER=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--enable-dp-attention-local-control-broadcast", "--tokenizer-worker-num 8", "--stream-interval 20", "--prefill-decode-interval 10", "--enable-two-batch-overlap", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 65536", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "flash",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_SHARED_EXPERT_TP1=1", "SGLANG_DP_SHARED_EXPERT_LOCAL=1", "SGLANG_DP_USE_GATHERV=1", "SGLANG_DP_USE_REDUCE_SCATTER=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--enable-dp-attention-local-control-broadcast", "--tokenizer-worker-num 8", "--stream-interval 20", "--prefill-decode-interval 10", "--enable-two-batch-overlap", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 65536", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "flash",
      quant: "fp8",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 16384", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "flash",
      quant: "fp8",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_SHARED_EXPERT_TP1=1", "SGLANG_DP_SHARED_EXPERT_LOCAL=1", "SGLANG_DP_USE_GATHERV=1", "SGLANG_DP_USE_REDUCE_SCATTER=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--enable-dp-attention-local-control-broadcast", "--tokenizer-worker-num 8", "--stream-interval 20", "--prefill-decode-interval 10", "--enable-two-batch-overlap", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 65536", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "flash",
      quant: "fp8",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_SHARED_EXPERT_TP1=1", "SGLANG_DP_SHARED_EXPERT_LOCAL=1", "SGLANG_DP_USE_GATHERV=1", "SGLANG_DP_USE_REDUCE_SCATTER=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--enable-dp-attention-local-control-broadcast", "--tokenizer-worker-num 8", "--stream-interval 20", "--prefill-decode-interval 10", "--enable-two-batch-overlap", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 65536", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "pro",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--attention-backend dsv4", "--enable-deepseek-v4-fp4-indexer", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 16384", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "pro",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_SHARED_EXPERT_TP1=1", "SGLANG_DP_SHARED_EXPERT_LOCAL=1", "SGLANG_DP_USE_GATHERV=1", "SGLANG_DP_USE_REDUCE_SCATTER=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--enable-dp-attention-local-control-broadcast", "--tokenizer-worker-num 8", "--stream-interval 20", "--prefill-decode-interval 10", "--attention-backend dsv4", "--enable-deepseek-v4-fp4-indexer", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 65536", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "pro",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_SHARED_EXPERT_TP1=1", "SGLANG_DP_SHARED_EXPERT_LOCAL=1", "SGLANG_DP_USE_GATHERV=1", "SGLANG_DP_USE_REDUCE_SCATTER=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--enable-dp-attention-local-control-broadcast", "--tokenizer-worker-num 8", "--stream-interval 20", "--prefill-decode-interval 10", "--attention-backend dsv4", "--enable-deepseek-v4-fp4-indexer", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 65536", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "pro",
      quant: "fp8",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 16384", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "pro",
      quant: "fp8",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_SHARED_EXPERT_TP1=1", "SGLANG_DP_SHARED_EXPERT_LOCAL=1", "SGLANG_DP_USE_GATHERV=1", "SGLANG_DP_USE_REDUCE_SCATTER=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--enable-dp-attention-local-control-broadcast", "--tokenizer-worker-num 8", "--stream-interval 20", "--prefill-decode-interval 10", "--enable-two-batch-overlap", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 65536", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "mi355x",
      variant: "pro",
      quant: "fp8",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    env: ["SGLANG_USE_ROCM700A=0", "TORCH_BLAS_PREFER_HIPBLASLT=1", "SGLANG_SHARED_EXPERT_TP1=1", "SGLANG_DP_SHARED_EXPERT_LOCAL=1", "SGLANG_DP_USE_GATHERV=1", "SGLANG_DP_USE_REDUCE_SCATTER=1", "SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton", "AITER_BF16_FP8_MOE_BOUND=0", "SGLANG_OPT_USE_AITER_BATCHED_GEMM=true"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 8", "--dp 8", "--enable-dp-attention", "--enable-dp-attention-local-control-broadcast", "--tokenizer-worker-num 8", "--stream-interval 20", "--prefill-decode-interval 10", "--enable-two-batch-overlap", "--attention-backend dsv4", "--page-size 256", "--mem-fraction-static 0.90", "--swa-full-tokens-ratio 0.15", "--enforce-shared-experts-fusion", "--kv-cache-dtype fp8_e4m3", "--chunked-prefill-size 65536", "--speculative-algorithm EAGLE", "--speculative-num-steps 3", "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "dgx-spark",
      variant: "flash-official",
      quant: "fp4",
      strategy: "balanced",
      nodes: "multi-2"
    },
    verified: true,
    warn: "The Docker image lmsysorg/sglang:dev-v4f-2dgx-v2 is a DGX Spark-only preview build (2x GB10, TP=2 over ConnectX-7) — do not use it on other hardware. Use Docker mode: the bare Python command needs the b12x kernel package this image ships. See [DGX Spark notes](#spark-note).",
    env: ["SGLANG_SM120_FLASHMLA_BACKEND=b12x", "B12X_MLA_SM120_DSV4_H16_NATIVE=1", "SGLANG_OPT_FUSE_MHC_POST_PRE=1", "SGLANG_OPT_FP8_WO_A_GEMM=1", "SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK=1", "SGLANG_B12X_MAX_TOKENS=8192", "PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 2", "--moe-runner-backend b12x", "--speculative-algorithm DSPARK", "--chunked-prefill-size 8192", "--context-length 327680", "--mem-fraction-static 0.80", "--swa-full-tokens-ratio 0.2", "--cuda-graph-max-bs-decode 32", "--max-running-requests 32", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "dgx-spark",
      variant: "flash-official",
      quant: "nvfp4",
      strategy: "balanced",
      nodes: "multi-2"
    },
    verified: true,
    warn: "The Docker image lmsysorg/sglang:dev-v4f-2dgx-v2 is a DGX Spark-only preview build — do not use it on other hardware, and use Docker mode. NVFP4 on DGX Spark needs the three extra MoE flags shown (cutlass runner for the NVFP4 experts, b12x for the DSpark draft's MXFP4 MTP experts, shared-experts fusion off). See [DGX Spark notes](#spark-note).",
    env: ["SGLANG_SM120_FLASHMLA_BACKEND=b12x", "B12X_MLA_SM120_DSV4_H16_NATIVE=1", "SGLANG_OPT_FUSE_MHC_POST_PRE=1", "SGLANG_OPT_FP8_WO_A_GEMM=1", "SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK=1", "SGLANG_B12X_MAX_TOKENS=8192", "PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 2", "--moe-runner-backend flashinfer_cutlass", "--speculative-moe-runner-backend b12x", "--disable-shared-experts-fusion", "--speculative-algorithm DSPARK", "--chunked-prefill-size 8192", "--context-length 327680", "--mem-fraction-static 0.80", "--swa-full-tokens-ratio 0.2", "--cuda-graph-max-bs-decode 32", "--max-running-requests 32", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "dgx-spark",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "balanced",
      nodes: "multi-2"
    },
    verified: true,
    warn: "The Docker image lmsysorg/sglang:dev-v4f-2dgx-v2 is a DGX Spark-only preview build — do not use it on other hardware, and use Docker mode. Images go in as OpenAI image_url content on /v1/chat/completions (see Vision below); text-only requests work unchanged. See [DGX Spark notes](#spark-note).",
    env: ["SGLANG_SM120_FLASHMLA_BACKEND=b12x", "B12X_MLA_SM120_DSV4_H16_NATIVE=1", "SGLANG_OPT_FUSE_MHC_POST_PRE=1", "SGLANG_OPT_FP8_WO_A_GEMM=1", "SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK=1", "SGLANG_B12X_MAX_TOKENS=8192", "PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True"],
    flags: ["--trust-remote-code", "--model-path {{MODEL_NAME}}", "--tp 2", "--moe-runner-backend b12x", "--speculative-algorithm DSPARK", "--chunked-prefill-size 8192", "--context-length 327680", "--mem-fraction-static 0.80", "--swa-full-tokens-ratio 0.2", "--cuda-graph-max-bs-decode 32", "--max-running-requests 32", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: [],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 4", "--speculative-algorithm DSPARK", "--mem-fraction-static 0.85", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=1024"],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--mem-fraction-static 0.85", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b200",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--mem-fraction-static 0.85", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: false,
    verificationStatus: "in-progress",
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: [],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 4", "--speculative-algorithm DSPARK", "--mem-fraction-static 0.85", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: false,
    verificationStatus: "in-progress",
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=1024"],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--mem-fraction-static 0.85", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "b300",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: false,
    verificationStatus: "in-progress",
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--mem-fraction-static 0.85", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: false,
    verificationStatus: "in-progress",
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: [],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 4", "--speculative-algorithm DSPARK", "--mem-fraction-static 0.85", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: false,
    verificationStatus: "in-progress",
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=1024"],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--mem-fraction-static 0.85", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb200",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: false,
    verificationStatus: "in-progress",
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--mem-fraction-static 0.85", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: true,
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: [],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 4", "--speculative-algorithm DSPARK", "--mem-fraction-static 0.85", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: true,
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=1024"],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend deepep", "--mem-fraction-static 0.85", "--deepep-config '{\"normal_dispatch\":{\"num_sms\":96},\"normal_combine\":{\"num_sms\":96}}'", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "gb300",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "high-throughput",
      nodes: "single"
    },
    verified: true,
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 4", "--dp 4", "--enable-dp-attention", "--moe-a2a-backend megamoe", "--mem-fraction-static 0.85", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "low-latency",
      nodes: "single"
    },
    verified: false,
    verificationStatus: "in-progress",
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: [],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend marlin", "--speculative-algorithm DSPARK", "--mem-fraction-static 0.85", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h200",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: false,
    verificationStatus: "in-progress",
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: [],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 4", "--moe-runner-backend flashinfer_mxfp4", "--mem-fraction-static 0.85", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }, {
    match: {
      hw: "h100",
      variant: "flash-vision",
      quant: "fp4",
      strategy: "balanced",
      nodes: "single"
    },
    verified: false,
    verificationStatus: "in-progress",
    warn: "DeepSeek-V4-Flash-Vision-Exp support has not shipped in an SGLang release yet (sglang PR 37253): Docker mode already points at the preview image; for Python mode install SGLang from that PR. See [Flash Vision notes](#vision-note).",
    env: [],
    flags: ["--model-path {{MODEL_NAME}}", "--tp 8", "--moe-runner-backend marlin", "--mem-fraction-static 0.85", "--host {{HOST_IP}}", "--port {{PORT}}"]
  }]
};

export const Deployment = ({config, benchmarks}) => {
  if (!config) {
    return <div style={{
      padding: 12,
      color: "#b91c1c"
    }}>Deployment: missing <code>config</code> prop</div>;
  }
  const AMD_RDMA_DOCKER_FLAGS = ["--device /dev/infiniband", "--cap-add IPC_LOCK", "--ulimit memlock=-1", "--ulimit stack=67108864", "--ulimit nofile=1048576:1048576"];
  const HARDWARE_CATALOG = {
    blackwell: [{
      id: "b300",
      label: "B300",
      vram: "288GB"
    }, {
      id: "gb300",
      label: "GB300",
      vram: "288GB"
    }, {
      id: "b200",
      label: "B200",
      vram: "192GB"
    }, {
      id: "gb200",
      label: "GB200",
      vram: "192GB"
    }, {
      id: "dgx-spark",
      label: "DGX Spark",
      vram: "128GB",
      multiNodeDockerFlags: ["--ulimit memlock=-1:-1", "--cap-add IPC_LOCK", "--device /dev/infiniband"]
    }],
    hopper: [{
      id: "h200",
      label: "H200",
      vram: "141GB"
    }, {
      id: "h100",
      label: "H100",
      vram: "80GB"
    }, {
      id: "h20-3e",
      label: "H20-3e",
      vram: "141GB"
    }, {
      id: "h800",
      label: "H800",
      vram: "80GB"
    }],
    amd: [{
      id: "mi300x",
      label: "MI300X",
      vram: "192GB",
      multiNodeDockerFlags: [...AMD_RDMA_DOCKER_FLAGS]
    }, {
      id: "mi325x",
      label: "MI325X",
      vram: "256GB",
      multiNodeDockerFlags: [...AMD_RDMA_DOCKER_FLAGS]
    }, {
      id: "mi350x",
      label: "MI350X",
      vram: "288GB",
      multiNodeDockerFlags: [...AMD_RDMA_DOCKER_FLAGS]
    }, {
      id: "mi355x",
      label: "MI355X",
      vram: "288GB",
      multiNodeDockerFlags: [...AMD_RDMA_DOCKER_FLAGS]
    }],
    npu: [{
      id: "a3",
      label: "Ascend A3 Series",
      vram: "64GB/die"
    }]
  };
  const makeStyles = isDark => ({
    container: {
      maxWidth: "900px",
      margin: "0 auto",
      display: "flex",
      flexDirection: "column",
      gap: "3px"
    },
    card: {
      padding: "5px 10px",
      border: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`,
      borderLeft: `3px solid ${isDark ? "#E85D4D" : "#D45D44"}`,
      borderRadius: "4px",
      display: "flex",
      alignItems: "center",
      gap: "10px",
      background: isDark ? "#1f2937" : "#fff"
    },
    cardColumn: {
      padding: "5px 10px",
      border: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`,
      borderLeft: `3px solid ${isDark ? "#E85D4D" : "#D45D44"}`,
      borderRadius: "4px",
      display: "flex",
      flexDirection: "column",
      gap: "4px",
      background: isDark ? "#1f2937" : "#fff"
    },
    title: {
      fontSize: "12px",
      fontWeight: "600",
      minWidth: "108px",
      flexShrink: 0,
      color: isDark ? "#e5e7eb" : "inherit"
    },
    vendorRow: {
      display: "flex",
      alignItems: "center",
      gap: "6px"
    },
    vendorLabel: {
      fontSize: "10px",
      fontWeight: "600",
      color: isDark ? "#9ca3af" : "#6b7280",
      width: "68px",
      flexShrink: 0,
      textTransform: "uppercase",
      letterSpacing: "0.04em"
    },
    itemsGrid: () => ({
      display: "grid",
      gridTemplateColumns: "repeat(auto-fit, minmax(72px, 1fr))",
      gap: "4px",
      flex: 1
    }),
    labelBase: {
      padding: "2px 8px",
      border: `1px solid ${isDark ? "#9ca3af" : "#d1d5db"}`,
      borderRadius: "3px",
      cursor: "pointer",
      display: "inline-flex",
      flexDirection: "column",
      alignItems: "center",
      justifyContent: "center",
      fontWeight: "500",
      fontSize: "12px",
      transition: "all 0.2s",
      userSelect: "none",
      minHeight: "26px",
      textAlign: "center",
      background: isDark ? "#374151" : "#fff",
      color: isDark ? "#e5e7eb" : "inherit"
    },
    checked: {
      background: "#D45D44",
      color: "white",
      borderColor: "#D45D44"
    },
    disabled: {
      cursor: "not-allowed",
      opacity: 0.4
    },
    subtitle: {
      display: "block",
      fontSize: "9px",
      marginTop: "1px",
      lineHeight: "1.1",
      opacity: 0.7
    },
    commandWrap: {
      position: "relative",
      flex: 1,
      background: isDark ? "#111827" : "#f5f5f5",
      borderRadius: "6px",
      border: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`,
      overflow: "hidden"
    },
    commandHeader: {
      display: "flex",
      flexWrap: "wrap",
      justifyContent: "space-between",
      alignItems: "center",
      gap: "6px 10px",
      padding: "6px 10px",
      borderBottom: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`,
      background: isDark ? "#1f2937" : "#fafafa"
    },
    commandPre: {
      padding: "12px 16px",
      fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace",
      fontSize: "12px",
      lineHeight: "1.5",
      color: isDark ? "#e5e7eb" : "#374151",
      whiteSpace: "pre-wrap",
      overflowX: "auto",
      margin: 0
    },
    mtpWarn: {
      margin: "8px 0 0",
      padding: "8px 12px",
      borderRadius: "8px",
      fontSize: "12px",
      lineHeight: "1.45",
      background: isDark ? "#78350f" : "#fef3c7",
      color: isDark ? "#fde68a" : "#92400e",
      border: `1px solid ${isDark ? "#92400e" : "#fcd34d"}`
    },
    badge: status => ({
      display: "inline-flex",
      alignItems: "center",
      gap: "6px",
      padding: "2px 8px",
      borderRadius: "10px",
      background: ({
        verified: isDark ? "#064e3b" : "#d1fae5",
        "in-progress": isDark ? "#1e3a8a" : "#dbeafe",
        unverified: isDark ? "#78350f" : "#fef3c7"
      })[verifyStatusOf(status)],
      color: ({
        verified: isDark ? "#a7f3d0" : "#065f46",
        "in-progress": isDark ? "#bfdbfe" : "#1e40af",
        unverified: isDark ? "#fde68a" : "#92400e"
      })[verifyStatusOf(status)],
      fontSize: "11px",
      fontWeight: 600,
      whiteSpace: "nowrap"
    }),
    badgeDot: status => ({
      width: "8px",
      height: "8px",
      borderRadius: "50%",
      background: ({
        verified: "#10b981",
        "in-progress": "#3b82f6",
        unverified: "#f59e0b"
      })[verifyStatusOf(status)]
    }),
    iconButton: {
      padding: "4px 10px",
      border: `1px solid ${isDark ? "#4b5563" : "#d1d5db"}`,
      borderRadius: "4px",
      background: isDark ? "#1f2937" : "#fff",
      color: isDark ? "#e5e7eb" : "#374151",
      fontSize: "11px",
      fontWeight: 500,
      cursor: "pointer",
      display: "inline-flex",
      alignItems: "center",
      gap: "4px"
    },
    iconRow: {
      display: "inline-flex",
      flexWrap: "wrap",
      gap: "6px"
    },
    runModeWrap: {
      display: "inline-flex",
      border: `1px solid ${isDark ? "#4b5563" : "#d1d5db"}`,
      borderRadius: "10px",
      overflow: "hidden",
      fontSize: "11px",
      fontWeight: 600,
      userSelect: "none"
    },
    runModeChip: active => ({
      padding: "2px 10px",
      cursor: "pointer",
      background: active ? isDark ? "#1f2937" : "#fff" : "transparent",
      color: active ? isDark ? "#e5e7eb" : "#111827" : isDark ? "#9ca3af" : "#6b7280",
      borderRight: `1px solid ${isDark ? "#4b5563" : "#d1d5db"}`
    }),
    runModeChipLast: active => ({
      padding: "2px 10px",
      cursor: "pointer",
      background: active ? isDark ? "#1f2937" : "#fff" : "transparent",
      color: active ? isDark ? "#e5e7eb" : "#111827" : isDark ? "#9ca3af" : "#6b7280"
    }),
    headerLeft: {
      display: "inline-flex",
      flexWrap: "wrap",
      alignItems: "center",
      gap: "8px"
    },
    modalBackdrop: {
      position: "fixed",
      inset: 0,
      background: "rgba(0,0,0,0.5)",
      display: "flex",
      alignItems: "center",
      justifyContent: "center",
      zIndex: 9999
    },
    modalBox: {
      background: isDark ? "#1f2937" : "#fff",
      color: isDark ? "#e5e7eb" : "#111827",
      borderRadius: "8px",
      padding: "20px",
      maxWidth: "720px",
      width: "92%",
      maxHeight: "85vh",
      overflowY: "auto",
      border: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`,
      boxShadow: "0 10px 25px rgba(0,0,0,0.25)"
    },
    modalHeader: {
      display: "flex",
      justifyContent: "space-between",
      alignItems: "center",
      marginBottom: "12px"
    },
    modalTitle: {
      fontSize: "15px",
      fontWeight: 600
    },
    modalCloseBtn: {
      background: "transparent",
      border: "none",
      color: "inherit",
      fontSize: "20px",
      cursor: "pointer",
      padding: "0 6px",
      lineHeight: 1
    },
    formField: {
      display: "flex",
      flexDirection: "column",
      gap: "4px",
      marginBottom: "10px"
    },
    formLabel: {
      fontSize: "12px",
      fontWeight: 500,
      color: isDark ? "#9ca3af" : "#4b5563"
    },
    formInput: {
      padding: "6px 10px",
      fontSize: "13px",
      border: `1px solid ${isDark ? "#4b5563" : "#d1d5db"}`,
      borderRadius: "4px",
      background: isDark ? "#111827" : "#fff",
      color: isDark ? "#e5e7eb" : "#111827",
      fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace"
    },
    sectionHeading: {
      fontSize: "12px",
      fontWeight: 600,
      textTransform: "uppercase",
      letterSpacing: "0.04em",
      color: isDark ? "#9ca3af" : "#6b7280",
      margin: "12px 0 6px 0"
    },
    primaryBtn: {
      padding: "6px 14px",
      background: "#D45D44",
      color: "white",
      border: "none",
      borderRadius: "4px",
      cursor: "pointer",
      fontSize: "13px",
      fontWeight: 500
    },
    benchCard: {
      padding: "8px 12px",
      border: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`,
      borderLeft: `3px solid ${isDark ? "#E85D4D" : "#D45D44"}`,
      borderRadius: "4px",
      background: isDark ? "#1f2937" : "#fff",
      display: "flex",
      flexDirection: "column",
      gap: "8px"
    },
    benchHeader: {
      display: "flex",
      flexWrap: "wrap",
      alignItems: "baseline",
      justifyContent: "space-between",
      gap: "6px 12px"
    },
    benchTitle: {
      fontSize: "13px",
      fontWeight: 600,
      color: isDark ? "#e5e7eb" : "inherit"
    },
    benchVersion: {
      fontSize: "11px",
      color: isDark ? "#9ca3af" : "#6b7280"
    },
    benchHeaderRight: {
      display: "flex",
      flexWrap: "wrap",
      alignItems: "center",
      gap: "6px 10px",
      flexShrink: 0
    },
    benchChipRow: {
      display: "flex",
      alignItems: "center",
      gap: "6px",
      flexWrap: "wrap",
      margin: "2px 0 8px"
    },
    benchChip: {
      padding: "2px 10px",
      fontSize: "12px",
      cursor: "pointer",
      border: `1px solid ${isDark ? "#4b5563" : "#d1d5db"}`,
      borderRadius: "4px",
      background: isDark ? "#1f2937" : "#fff",
      color: isDark ? "#e5e7eb" : "#374151",
      fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace"
    },
    benchChipActive: {
      background: "#D45D44",
      color: "white",
      borderColor: "#D45D44"
    },
    benchBlock: {
      border: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`,
      borderRadius: "4px",
      padding: "8px 10px",
      background: isDark ? "#111827" : "#fafafa"
    },
    benchBlockTitle: {
      fontSize: "11px",
      fontWeight: 600,
      textTransform: "uppercase",
      letterSpacing: "0.04em",
      color: isDark ? "#9ca3af" : "#6b7280",
      marginBottom: "4px"
    },
    benchWorkload: {
      fontSize: "11px",
      fontStyle: "italic",
      color: isDark ? "#9ca3af" : "#6b7280",
      marginBottom: "6px",
      lineHeight: "1.3"
    },
    benchRow: {
      display: "flex",
      justifyContent: "space-between",
      fontSize: "12px",
      padding: "2px 0"
    },
    benchKey: {
      color: isDark ? "#9ca3af" : "#6b7280"
    },
    benchVal: {
      color: isDark ? "#e5e7eb" : "#111827",
      fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace",
      fontWeight: 500
    },
    benchNotes: {
      fontSize: "11px",
      fontStyle: "italic",
      color: isDark ? "#9ca3af" : "#6b7280"
    },
    benchLegend: {
      fontSize: "10px",
      fontStyle: "italic",
      color: isDark ? "#6b7280" : "#9ca3af",
      marginTop: "6px",
      fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace"
    },
    benchEmpty: {
      fontSize: "12px",
      fontStyle: "italic",
      color: isDark ? "#9ca3af" : "#6b7280"
    },
    benchTable: {
      display: "grid",
      columnGap: 0,
      rowGap: "3px",
      marginTop: "4px",
      alignItems: "baseline"
    },
    benchTableHead: {
      textAlign: "right",
      fontWeight: 500,
      fontSize: "11px",
      color: isDark ? "#9ca3af" : "#6b7280",
      paddingLeft: "16px",
      paddingBottom: "4px",
      whiteSpace: "nowrap"
    },
    benchTableCornerHead: {
      paddingBottom: "4px"
    },
    benchTableSeparator: {
      gridColumn: "1 / -1",
      height: "1px",
      background: isDark ? "#374151" : "#e5e7eb",
      marginTop: "-3px"
    },
    benchTableLabel: {
      textAlign: "left",
      fontSize: "12px",
      color: isDark ? "#9ca3af" : "#6b7280",
      whiteSpace: "nowrap"
    },
    benchTableValue: {
      textAlign: "right",
      fontSize: "12px",
      color: isDark ? "#e5e7eb" : "#111827",
      fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace",
      fontWeight: 500,
      paddingLeft: "16px",
      whiteSpace: "nowrap"
    },
    benchTableValueMissing: {
      color: isDark ? "#6b7280" : "#9ca3af"
    }
  });
  const VERIFY_LABEL = {
    verified: "Verified",
    "in-progress": "Final Verification In Progress",
    unverified: "Not Verified"
  };
  const verifyStatusOf = v => typeof v === "string" ? VERIFY_LABEL[v] ? v : "unverified" : v ? "verified" : "unverified";
  const cellVerifyStatus = (c, sel) => {
    if (!c) return "unverified";
    const v = typeof c.verificationStatus === "function" ? c.verificationStatus(sel) : c.verificationStatus;
    return verifyStatusOf(v ?? c.verified);
  };
  const LEGACY_MATCH_DIMS = [{
    id: "variant",
    title: "Model Variant",
    optionsKey: "variants"
  }, {
    id: "quant",
    title: "Quantization",
    optionsKey: "quantizations"
  }, {
    id: "strategy",
    title: "Strategy",
    optionsKey: "strategies"
  }, {
    id: "nodes",
    title: "Nodes",
    optionsKey: "nodesOptions"
  }];
  const matchDimSpecs = (config.matchDims || LEGACY_MATCH_DIMS).map(d => ({
    ...d,
    options: d.options || config[d.optionsKey] || []
  }));
  const overlayDimSpecs = config.overlayDims || [];
  const commandBuilder = config.commandBuilder || null;
  const DIMENSIONS = ["hw", ...matchDimSpecs.map(d => d.id)];
  const optionVisible = (opt, sel) => typeof opt.showWhen !== "function" || opt.showWhen(sel);
  const optionDisabled = (opt, sel) => typeof opt.disabled === "function" ? opt.disabled(sel) : !!opt.disabled;
  const visibleOptions = (spec, sel) => (spec.options || []).filter(o => optionVisible(o, sel));
  const rowVisible = (spec, sel) => (typeof spec.showWhen !== "function" || spec.showWhen(sel)) && visibleOptions(spec, sel).length > 0;
  const overlayPick = sel => {
    const picked = [];
    for (const spec of config.overlayDims || []) {
      if (!rowVisible(spec, sel)) continue;
      const opt = (spec.options || []).find(o => o.id === sel[spec.id]);
      if (opt && !optionDisabled(opt, sel)) picked.push(opt);
    }
    return picked;
  };
  const overlayPart = (sel, key) => {
    const out = [];
    for (const opt of overlayPick(sel)) {
      const add = typeof opt[key] === "function" ? opt[key](sel) : opt[key];
      if (add) out.push(...add);
    }
    return out;
  };
  const overlayCompose = (cellFlags, sel) => {
    const strip = overlayPart(sel, "stripPrefixes");
    const add = overlayPart(sel, "flags");
    if (!strip.length) return [...cellFlags || [], ...add];
    const used = new Set();
    const replacementsFor = tok => {
      const out = [];
      add.forEach((f, i) => {
        if (used.has(i) || f.split(/[\s=]/)[0] !== tok) return;
        used.add(i);
        out.push(f);
      });
      return out;
    };
    const out = [];
    for (const f of cellFlags || []) {
      const tok = f.split(/[\s=]/)[0];
      if (!strip.includes(tok)) out.push(f); else out.push(...replacementsFor(tok));
    }
    add.forEach((f, i) => {
      if (!used.has(i)) out.push(f);
    });
    return out;
  };
  const optionSoft = (opt, sel) => typeof opt.soft === "function" ? opt.soft(sel) : !!opt.soft;
  const findCell = (cells, sel) => cells.find(c => DIMENSIONS.every(d => c.match[d] === sel[d]));
  const findBenchmark = (list, sel) => {
    const hits = (list || []).filter(b => Object.entries(b.match || ({})).every(([k, v]) => sel[k] === v));
    return hits.sort((a, b) => Object.keys(b.match).length - Object.keys(a.match).length)[0] || null;
  };
  const normalizeSpeed = speed => {
    if (!speed) return [];
    return Array.isArray(speed) ? speed : [speed];
  };
  const effectiveAccuracy = (entry, sel) => entry ? {
    ...config.defaultAccuracy && config.defaultAccuracy[sel.variant] || ({}),
    ...entry.accuracy || ({})
  } : {};
  const benchmarkIsEmpty = (entry, accuracy) => {
    for (const m of normalizeSpeed(entry && entry.speed)) {
      if (m && typeof m === "object") {
        for (const [key, v] of Object.entries(m)) {
          if (key === "workload") continue;
          if (v !== null && v !== undefined) return false;
        }
      }
    }
    if (accuracy && typeof accuracy === "object") {
      for (const v of Object.values(accuracy)) {
        if (v !== null && v !== undefined) return false;
      }
    }
    return true;
  };
  const isOptionAvailable = (cells, sel, dim, value) => {
    const idx = DIMENSIONS.indexOf(dim);
    const higher = DIMENSIONS.slice(0, idx);
    return cells.some(c => c.match[dim] === value && higher.every(d => c.match[d] === sel[d]));
  };
  const snapToValidCell = (cells, sel, dim, value) => {
    const idx = DIMENSIONS.indexOf(dim);
    const higher = DIMENSIONS.slice(0, idx);
    const lower = DIMENSIONS.slice(idx + 1);
    let best = null, bestLowerMatches = -1;
    for (const c of cells) {
      if (c.match[dim] !== value) continue;
      if (!higher.every(d => c.match[d] === sel[d])) continue;
      let s = 0;
      for (const d of lower) if (c.match[d] === sel[d]) s++;
      if (s > bestLowerMatches) {
        bestLowerMatches = s;
        best = c;
      }
    }
    if (!best) return sel;
    const next = {
      ...sel,
      [dim]: value
    };
    for (const d of lower) next[d] = best.match[d];
    return next;
  };
  const validateSelection = (cells, parsed) => {
    const valid = {};
    for (const dim of DIMENSIONS) {
      const want = parsed[dim];
      const works = cells.some(c => c.match[dim] === want && DIMENSIONS.slice(0, DIMENSIONS.indexOf(dim)).every(d => c.match[d] === valid[d]));
      if (works) {
        valid[dim] = want;
      } else {
        const fallback = cells.find(c => DIMENSIONS.slice(0, DIMENSIONS.indexOf(dim)).every(d => c.match[d] === valid[d]));
        valid[dim] = fallback ? fallback.match[dim] : want;
      }
    }
    for (const spec of overlayDimSpecs) {
      const want = parsed[spec.id];
      const opts = spec.options || [];
      const picked = opts.some(o => o.id === want) ? want : (spec.default ?? (opts[0] && opts[0].id)) ?? "";
      const withPick = {
        ...valid,
        [spec.id]: picked
      };
      const usable = visibleOptions(spec, withPick).filter(o => !optionDisabled(o, withPick));
      valid[spec.id] = usable.some(o => o.id === picked) ? picked : (usable[0] && usable[0].id) ?? picked;
    }
    return valid;
  };
  const resolveModelName = sel => {
    const keys = [`${sel.hw}|${sel.variant}|${sel.quant}`, `${sel.variant}|${sel.quant}`, `${sel.hw}|${sel.quant}`, sel.quant, sel.hw, "default"];
    for (const k of keys) {
      const hit = config.modelNames[k];
      if (hit) return hit;
    }
    return "";
  };
  const interpolate = (text, env, modelName) => text.replace(/{{(\w+)}}/g, (_, key) => key === "MODEL_NAME" ? modelName : env[key] ?? `{{${key}}}`);
  const parseNnodes = id => {
    if (Number.isInteger(id)) return id;
    if ((/^\d+$/).test(id || "")) return parseInt(id, 10);
    if (id === "single") return 1;
    const m = (/^multi-(\d+)$/).exec(id || "");
    return m ? parseInt(m[1], 10) : 1;
  };
  const cellNnodes = (cell, sel) => sel.nodes !== undefined ? parseNnodes(sel.nodes) : cell.nnodes || 1;
  const PD_SERVE_PORTS = {
    prefill: 30000,
    decode: 30100
  };
  const overlayEnv = sel => overlayPart(sel, "env");
  const overlayHints = sel => overlayPart(sel, "hints");
  const renderCommand = (cell, sel, envValues, mode = "python") => {
    if (!cell) return "# No command available for the current selection.";
    const modelName = resolveModelName(sel);
    const nnodes = cellNnodes(cell, sel);
    const multinode = nnodes > 1;
    const cellEnv = [...cell.env || [], ...overlayEnv(sel)];
    const flags = overlayCompose(cell.flags, sel);
    if (multinode) {
      const PARALLELISM_ANCHORS = new Set(["--enable-dp-attention", "--dp-size", "--dp", "--tp-size", "--tp", "--sp-degree", "--ulysses-degree", "--ring-degree"]);
      let i = flags.reduce((last, flag, index) => PARALLELISM_ANCHORS.has(flag.split(/[\s=]/)[0]) ? index : last, -1);
      if (i === -1) i = flags.findIndex(f => f.startsWith("--model-path"));
      flags.splice(i + 1, 0, `--nnodes ${nnodes}`, `--node-rank {{NODE_RANK}}`, `--dist-init-addr {{NODE0_IP}}:20000`);
    }
    const pdServePort = PD_SERVE_PORTS[sel.pdMode];
    if (pdServePort !== undefined) {
      for (let j = 0; j < flags.length; j++) {
        if (flags[j].split(/[\s=]/)[0] === "--port") {
          flags[j] = `--port ${pdServePort}`;
        }
      }
    }
    let cmd;
    if (mode === "docker") {
      const di = config.dockerImages || ({});
      const image = di[`${sel.hw}|${sel.variant}|${sel.quant}`] || di[`${sel.variant}|${sel.quant}`] || di[`${sel.hw}|${sel.quant}|${sel.strategy}`] || di[`${sel.hw}|${sel.quant}`] || di[sel.hw] || "lmsysorg/sglang:dev";
      const dockerRunCommand = typeof config.dockerRunCommand === "function" ? config.dockerRunCommand(sel) : config.dockerRunCommand || "sglang serve";
      const portFlag = flags.find(x => x.split(/[\s=]/)[0] === "--port");
      const servePort = portFlag ? portFlag.slice(("--port").length).trim() : "{{PORT}}";
      const hostNetwork = multinode || typeof config.dockerHostNetworkWhen === "function" && config.dockerHostNetworkWhen(sel, {
        flags,
        env: cellEnv
      });
      const vendorOf = hwId => {
        for (const [vendor, list] of Object.entries(HARDWARE_CATALOG)) {
          if (list.some(h => h.id === hwId)) return vendor;
        }
        const extra = (config.hardware || []).find(h => h.id === hwId);
        return extra && extra.vendor || "nvidia";
      };
      const fabricFlagsOf = hwId => {
        const extra = (config.hardware || []).find(h => h.id === hwId);
        if (extra) return extra.multiNodeDockerFlags || [];
        for (const list of Object.values(HARDWARE_CATALOG)) {
          const hit = list.find(h => h.id === hwId);
          if (hit) return hit.multiNodeDockerFlags || [];
        }
        return [];
      };
      const gpuAccessLines = vendorOf(sel.hw) === "amd" ? ["docker run", "  --device=/dev/kfd --device=/dev/dri", "  --group-add video", "  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined", "  --shm-size 32g"] : vendorOf(sel.hw) === "npu" ? ["docker run --privileged --shm-size=16g", "  --device=/dev/davinci0 --device=/dev/davinci1 --device=/dev/davinci2 --device=/dev/davinci3", "  --device=/dev/davinci4 --device=/dev/davinci5 --device=/dev/davinci6 --device=/dev/davinci7", "  --device=/dev/davinci8 --device=/dev/davinci9 --device=/dev/davinci10 --device=/dev/davinci11", "  --device=/dev/davinci12 --device=/dev/davinci13 --device=/dev/davinci14 --device=/dev/davinci15", "  --device=/dev/davinci_manager", "  --device=/dev/hisi_hdc", "  -v /usr/local/sbin:/usr/local/sbin", "  -v /usr/local/Ascend/driver:/usr/local/Ascend/driver", "  -v /usr/local/Ascend/firmware:/usr/local/Ascend/firmware", "  -v /etc/ascend_install.info:/etc/ascend_install.info", "  -v /var/queue_schedule:/var/queue_schedule", "  -v ~/.cache/:/root/.cache/"] : ["docker run --gpus all", "  --shm-size 32g"];
      const dockerLines = [...gpuAccessLines, hostNetwork ? "  --network host" : `  -p ${servePort}:${servePort}`, ...multinode ? fabricFlagsOf(sel.hw).map(f => "  " + f) : [], ...vendorOf(sel.hw) === "npu" ? [] : ["  -v ~/.cache/huggingface:/root/.cache/huggingface"], ...(config.dockerMounts || []).map(mount => `  -v ${mount}`), ...config.placeholders && config.placeholders.HF_TOKEN ? [`  --env "HF_TOKEN={{HF_TOKEN}}"`] : [], ...cellEnv.map(e => `  --env ${e}`), "  --ipc=host", `  ${image}`, `  ${dockerRunCommand}`, ...flags.map(f => "    " + f)];
      cmd = dockerLines.join(" \\\n");
    } else {
      const flagBlock = flags.map(f => "  " + f).join(" \\\n");
      const envBlock = cellEnv.length ? cellEnv.join(" \\\n") + " \\\n" : "";
      cmd = `${envBlock}sglang serve \\\n${flagBlock}`;
    }
    const hintLines = [...overlayHints(sel), ...multinode && config.multiNodeHints && config.multiNodeHints[sel.hw] ? config.multiNodeHints[sel.hw] : []];
    if (hintLines.length) {
      const hint = hintLines.map(line => line.length ? "# " + line : "#").join("\n");
      cmd = `${hint}\n${cmd}`;
    }
    cmd = interpolate(cmd, envValues, modelName);
    if (multinode) {
      const header = `# Multi-node (${nnodes} nodes). Run the same command on every node with:\n` + `#   <node-rank> = 0 on the head node, 1..${nnodes - 1} on the others\n` + `#   <node0-ip>  = IP of the head node (reachable from all others)`;
      cmd = `${header}\n${cmd}`;
    }
    return cmd;
  };
  const ACCURACY_LABELS = config.accuracyLabels || [];
  const renderBenchmarkCard = entry => {
    const pct = entry && entry.latencyPercentile || config.latencyPercentile || "P50";
    const SPEED_LABELS = [["ttft_ms", `TTFT (${pct})`, "ms"], ["tpot_ms", `TPOT (${pct})`, "ms"], ["tokens_per_sec_per_gpu", "throughput per gpu", "tok/s"], ["interactivity", "interactivity", "tokens/s/user", m => m.tpot_ms != null && m.tpot_ms !== 0 ? Math.round(1000 / m.tpot_ms * 10) / 10 : null]];
    const WORKLOAD_KEYS = ["dataset", "isl", "osl", "max_concurrency"];
    const fmt = (val, unit) => {
      if (val === null || val === undefined) return null;
      return `${val}${unit ? " " + unit : ""}`;
    };
    const formatWorkloadParts = (workload, keys) => {
      if (!workload) return "";
      const parts = [];
      if (keys.has("dataset") && workload.dataset) parts.push(workload.dataset);
      if (keys.has("isl") || keys.has("osl")) {
        if (workload.isl != null || workload.osl != null) {
          parts.push(`in/out=${workload.isl != null ? workload.isl : "?"}/${workload.osl != null ? workload.osl : "?"}`);
        }
      }
      if (keys.has("max_concurrency") && workload.max_concurrency != null) {
        parts.push(`max-concurrency=${workload.max_concurrency}`);
      }
      return parts.join(", ");
    };
    const ALWAYS_PER_COLUMN = new Set(["max_concurrency"]);
    const partitionWorkload = measurements => {
      const shared = new Set();
      const differing = new Set();
      for (const k of WORKLOAD_KEYS) {
        const seen = new Set();
        let anyPresent = false;
        for (const m of measurements) {
          const v = m && m.workload ? m.workload[k] : undefined;
          if (v != null) anyPresent = true;
          seen.add(v);
        }
        if (!anyPresent) continue;
        if (ALWAYS_PER_COLUMN.has(k) || seen.size > 1) differing.add(k); else shared.add(k);
      }
      return {
        shared,
        differing
      };
    };
    const renderBenchTable = ({title, sharedText, colHeaders, rows, colCount, legend}) => {
      if (rows.length === 0) return null;
      const showColHeaders = colHeaders.length > 0 && colHeaders.some(h => h !== "");
      return <div style={s.benchBlock}>
          <div style={s.benchBlockTitle}>{title}</div>
          {sharedText && <div style={s.benchWorkload}>{sharedText}</div>}
          <div style={{
        ...s.benchTable,
        gridTemplateColumns: `max-content repeat(${colCount}, minmax(0, 1fr))`
      }}>
            {showColHeaders && <div key="corner" style={s.benchTableCornerHead}></div>}
            {showColHeaders && colHeaders.map((h, i) => <div key={`hdr-${i}`} style={s.benchTableHead}>{h}</div>)}
            {showColHeaders && <div key="sep" style={s.benchTableSeparator}></div>}
            {rows.map(r => [<div key={`lbl-${r.label}`} style={s.benchTableLabel}>{r.label}</div>, ...r.values.map((v, i) => <div key={`val-${r.label}-${i}`} style={v === null ? {
        ...s.benchTableValue,
        ...s.benchTableValueMissing
      } : s.benchTableValue}>
                  {v !== null ? v : "—"}
                </div>)])}
          </div>
          {legend && <div style={s.benchLegend}>
              {(Array.isArray(legend) ? legend : [legend]).map((line, i) => <div key={`legend-${i}`}>{line}</div>)}
            </div>}
        </div>;
    };
    const buildSpeedTable = measurements => {
      if (measurements.length === 0) return null;
      const {shared, differing} = partitionWorkload(measurements);
      const sharedText = formatWorkloadParts(measurements[0] && measurements[0].workload, shared);
      const colHeaders = measurements.map(m => formatWorkloadParts(m && m.workload, differing));
      const rows = SPEED_LABELS.map(tup => {
        const [key, label, unit, compute] = tup;
        const values = measurements.map(m => {
          const raw = compute ? compute(m) : m[key];
          return fmt(raw, unit);
        });
        return {
          label,
          values
        };
      });
      return {
        title: "Speed",
        sharedText,
        colHeaders,
        rows,
        colCount: measurements.length,
        legend: [`throughput per gpu = (input+output tokens)/elapsed/GPU`, `interactivity = 1000/TPOT(ms) (tokens/s/user)`]
      };
    };
    const buildAccuracyTable = accuracy => {
      if (!accuracy) return null;
      const rows = ACCURACY_LABELS.map(([key, label, unit]) => {
        const v = fmt(accuracy[key], unit);
        if (v === null) return null;
        return {
          label,
          values: [v]
        };
      }).filter(r => r !== null);
      if (rows.length === 0) return null;
      return {
        title: "Accuracy",
        sharedText: null,
        colHeaders: [],
        rows,
        colCount: 1
      };
    };
    const accuracy = effectiveAccuracy(entry, sel);
    const isEmpty = benchmarkIsEmpty(entry, accuracy);
    const measurements = !isEmpty ? normalizeSpeed(entry && entry.speed) : [];
    const accuracyTable = !isEmpty ? buildAccuracyTable(accuracy) : null;
    const speedTable = !isEmpty ? buildSpeedTable(measurements) : null;
    const hasBenchCmds = !isEmpty && buildBenchCommands(entry, sel) !== null;
    return <div style={s.benchCard}>
        <div style={s.benchHeader}>
          <div style={s.benchTitle}>Benchmark</div>
          <div style={s.benchHeaderRight}>
            {!isEmpty && entry && entry.sglang_version && <div style={s.benchVersion}>measured on sglang <code>{entry.sglang_version}</code></div>}
            {hasBenchCmds && <button style={s.iconButton} onClick={() => setModal("bench")}>⚡ Reproduce</button>}
          </div>
        </div>
        {isEmpty ? <div style={s.benchEmpty}>
            Benchmark data pending for this combination — submit yours via the Playground's Submit ↗ button.
          </div> : <>
            {accuracyTable && renderBenchTable(accuracyTable)}
            {speedTable && renderBenchTable(speedTable)}
            {entry && entry.notes && <div style={s.benchNotes}>{entry.notes}</div>}
          </>}
      </div>;
  };
  const buildBenchCommands = (entry, sel) => {
    const bc = config.benchmarkCommands;
    if (!bc) return null;
    const acc = effectiveAccuracy(entry, sel);
    const accuracy = [];
    if (bc.accuracy) {
      for (const [key, label] of ACCURACY_LABELS) {
        if (acc[key] == null) continue;
        const tmpl = bc.accuracy[key];
        const resolved = typeof tmpl === "string" ? tmpl : tmpl && tmpl[sel.variant] || null;
        if (resolved) accuracy.push({
          key,
          label,
          template: resolved
        });
      }
    }
    let speed = null;
    if (bc.speed && entry) {
      const ms = normalizeSpeed(entry.speed).filter(m => m && m.workload && m.workload.max_concurrency != null);
      const concurrencies = [...new Set(ms.map(m => m.workload.max_concurrency))].sort((a, b) => a - b);
      if (concurrencies.length) {
        speed = {
          template: bc.speed,
          concurrencies,
          workload: ms[0].workload,
          numPromptsOf: c => {
            const m = ms.find(x => x.workload.max_concurrency === c);
            if (m && m.workload.num_prompts != null) return m.workload.num_prompts;
            const tbl = bc.numPromptsByConc;
            if (tbl && tbl[c] != null) return tbl[c];
            return Math.max(c * 2, 200);
          }
        };
      }
    }
    if (accuracy.length === 0 && !speed) return null;
    return {
      accuracy,
      speed
    };
  };
  const buildHardwareGroups = () => {
    const supported = new Set(config.supportedHardware);
    const catalog = {};
    for (const [vendor, list] of Object.entries(HARDWARE_CATALOG)) catalog[vendor] = [...list];
    for (const hw of config.hardware || []) {
      const vendor = hw.vendor || "nvidia";
      const list = catalog[vendor] || (catalog[vendor] = []);
      const entry = {
        id: hw.id,
        label: hw.label,
        vram: hw.vram
      };
      const i = list.findIndex(x => x.id === hw.id);
      if (i >= 0) list[i] = entry; else list.push(entry);
    }
    const groups = [];
    for (const [vendor, list] of Object.entries(catalog)) {
      const items = list.filter(hw => supported.has(hw.id)).map(hw => ({
        id: hw.id,
        label: hw.label,
        subtitle: hw.vram
      }));
      if (items.length) groups.push({
        label: vendor.toUpperCase(),
        items
      });
    }
    if (config.groupHardware === false) {
      return [{
        label: null,
        items: groups.flatMap(group => group.items)
      }];
    }
    return groups;
  };
  const initialSelectionFromCells = () => {
    const first = (config.cells || [])[0];
    const sel = Object.fromEntries(DIMENSIONS.map(d => [d, first ? first.match[d] : ""]));
    for (const spec of overlayDimSpecs) {
      const opts = spec.options || [];
      sel[spec.id] = (spec.default ?? (opts[0] && opts[0].id)) ?? "";
    }
    if (!commandBuilder) return sel;
    return {
      ...sel,
      hw: commandBuilder.defaultSelection?.hw || config.supportedHardware?.[0] || "",
      ...commandBuilder.defaultSelection || ({})
    };
  };
  const normalizeBuilderSelection = parsed => {
    const out = {
      ...initialSelectionFromCells(),
      ...parsed
    };
    if (!(config.supportedHardware || []).includes(out.hw)) {
      out.hw = commandBuilder.defaultSelection?.hw || config.supportedHardware?.[0] || "";
    }
    for (const spec of overlayDimSpecs) {
      if (spec.kind === "number") {
        const value = Number.parseInt(out[spec.id], 10);
        out[spec.id] = Math.min(spec.max, Math.max(spec.min, Number.isFinite(value) ? value : Number(spec.default ?? spec.min)));
        continue;
      }
      const options = spec.options || [];
      if (!options.some(option => option.id === out[spec.id])) {
        out[spec.id] = (spec.default ?? options[0]?.id) ?? "";
      }
    }
    for (const [key, bounds] of Object.entries(commandBuilder.resource?.limits || ({}))) {
      const fallback = Number((commandBuilder.defaultSelection?.[key] ?? bounds.min) ?? 1);
      const value = Number.parseInt(out[key], 10);
      out[key] = Math.min(bounds.max, Math.max(bounds.min, Number.isFinite(value) ? value : fallback));
    }
    for (const key of ["tp_size", "ulysses_degree", "ring_degree"]) {
      const value = Number.parseInt(out[key], 10);
      out[key] = Number.isFinite(value) && value > 0 ? value : 1;
    }
    out.topology_mode = out.topology_mode === "manual" ? "manual" : "auto";
    return out;
  };
  const placeholderDefaults = schema => {
    const out = {};
    for (const [k, v] of Object.entries(schema || ({}))) out[k] = v.default ?? "";
    return out;
  };
  const [isDark, setIsDark] = useState(false);
  useEffect(() => {
    const check = () => {
      const html = document.documentElement;
      setIsDark(html.classList.contains("dark") || html.getAttribute("data-theme") === "dark" || html.style.colorScheme === "dark");
    };
    check();
    const observer = new MutationObserver(check);
    observer.observe(document.documentElement, {
      attributes: true,
      attributeFilter: ["class", "data-theme", "style"]
    });
    return () => observer.disconnect();
  }, []);
  const STORAGE_KEY = "sglang-deploy-env";
  const [env, setEnv] = useState(() => placeholderDefaults(config.placeholders));
  useEffect(() => {
    try {
      const raw = window.localStorage.getItem(STORAGE_KEY);
      if (raw) {
        const parsed = JSON.parse(raw);
        setEnv({
          ...placeholderDefaults(config.placeholders),
          ...parsed
        });
      }
    } catch {}
  }, []);
  const saveEnv = next => {
    setEnv(next);
    try {
      window.localStorage.setItem(STORAGE_KEY, JSON.stringify(next));
    } catch {}
  };
  const [sel, setSel] = useState(() => initialSelectionFromCells());
  const INTERNAL_HASH_STATE_KEY = "__sglangDeployInternalHash";
  const DEPLOYMENT_COMPONENT_ID = "deployment-configurator";
  useEffect(() => {
    const hydrate = () => {
      const raw = window.location.hash.replace(/^#/, "");
      if (!raw) return;
      const params = new URLSearchParams(raw);
      const initial = initialSelectionFromCells();
      const parsed = {
        ...initial
      };
      let touched = false;
      params.forEach((value, key) => {
        if ((key in parsed)) {
          parsed[key] = value;
          touched = true;
        }
      });
      if (!touched) return;
      setSel(commandBuilder ? normalizeBuilderSelection(parsed) : validateSelection(config.cells, parsed));
      const historyState = window.history.state;
      const isInternalHash = historyState && typeof historyState === "object" && historyState[INTERNAL_HASH_STATE_KEY] === `#${raw}`;
      if (isInternalHash) return;
      const el = document.getElementById(DEPLOYMENT_COMPONENT_ID);
      if (el) el.scrollIntoView({
        behavior: "smooth",
        block: "start"
      });
    };
    hydrate();
    window.addEventListener("hashchange", hydrate);
    return () => window.removeEventListener("hashchange", hydrate);
  }, []);
  useEffect(() => {
    const target = "#" + new URLSearchParams(sel).toString();
    if (window.location.hash !== target) {
      const historyState = window.history.state && typeof window.history.state === "object" ? window.history.state : {};
      window.history.replaceState({
        ...historyState,
        [INTERNAL_HASH_STATE_KEY]: target
      }, "", target);
    }
    window.dispatchEvent(new CustomEvent("sglang-deploy-sel", {
      detail: sel
    }));
  }, [sel]);
  const [modal, setModal] = useState(null);
  useEffect(() => {
    if (modal === null) return;
    const onKey = e => {
      if (e.key === "Escape") setModal(null);
    };
    const prev = document.body.style.overflow;
    document.body.style.overflow = "hidden";
    window.addEventListener("keydown", onKey);
    return () => {
      window.removeEventListener("keydown", onKey);
      document.body.style.overflow = prev;
    };
  }, [modal]);
  const [copied, setCopied] = useState(false);
  const [curlCopied, setCurlCopied] = useState(false);
  const [envDraft, setEnvDraft] = useState(env);
  const [benchConc, setBenchConc] = useState(null);
  const [benchAcc, setBenchAcc] = useState(null);
  const [benchCopied, setBenchCopied] = useState(null);
  const configuredRunModes = typeof config.runModes === "function" ? config.runModes(sel) : config.runModes;
  const runModes = configuredRunModes || ["python", "docker"];
  const [runMode, setRunMode] = useState(runModes[0]);
  const [builderScope, setBuilderScope] = useState("base");
  const [builderServerSetting, setBuilderServerSetting] = useState(null);
  const [builderAdvanced, setBuilderAdvanced] = useState(false);
  const [serveExpanded, setServeExpanded] = useState(false);
  const [requestExpanded, setRequestExpanded] = useState(false);
  const [builderHeadAddress, setBuilderHeadAddress] = useState("<head-node-ip>");
  const [builderNodeRank, setBuilderNodeRank] = useState(0);
  const [blockedNote, setBlockedNote] = useState(null);
  const flashBlockedNote = (dim, reason) => {
    const note = {
      dim,
      reason
    };
    setBlockedNote(note);
    setTimeout(() => setBlockedNote(cur => cur === note ? null : cur), 4000);
  };
  useEffect(() => {
    if (builderNodeRank >= Number(sel.nodes || 1)) setBuilderNodeRank(0);
  }, [sel.nodes, builderNodeRank]);
  const hasRunMode = runModes.includes(runMode);
  const fallbackRunMode = runModes[0];
  const activeRunMode = hasRunMode ? runMode : fallbackRunMode;
  useEffect(() => {
    if (!hasRunMode) setRunMode(fallbackRunMode);
  }, [hasRunMode, fallbackRunMode]);
  useEffect(() => {
    if (modal === "env") setEnvDraft(env);
  }, [modal, env]);
  const [mambaRatio, setMambaRatio] = useState(null);
  useEffect(() => {
    const onRatio = e => setMambaRatio(e.detail && (e.detail.baseRatio || e.detail.ratio) || null);
    window.addEventListener("sglang-k3-mamba-ratio", onRatio);
    return () => window.removeEventListener("sglang-k3-mamba-ratio", onRatio);
  }, []);
  const s = makeStyles(isDark);
  const cell = commandBuilder ? commandBuilder.resolveDeployment(sel) : findCell(config.cells, sel);
  const builderMeta = cell && cell.builder || ({});
  const verifyStatus = cellVerifyStatus(cell, sel);
  const cellWithRatio = (() => {
    if (!cell || !mambaRatio) return cell;
    if (cell.flags.some(f => f.startsWith("--mamba-full-memory-ratio") || f.startsWith("--max-mamba-cache-size"))) return cell;
    const flags = [...cell.flags];
    const line = `--mamba-full-memory-ratio ${mambaRatio}`;
    const i = flags.findIndex(f => f.startsWith("--host"));
    if (i >= 0) flags.splice(i, 0, line); else flags.push(line);
    return {
      ...cell,
      flags
    };
  })();
  const commandEnv = commandBuilder ? {
    ...env,
    NODE_RANK: String(builderNodeRank),
    NODE0_IP: builderHeadAddress || "<head-node-ip>"
  } : env;
  const command = renderCommand(cellWithRatio, sel, commandEnv, activeRunMode);
  const effFlags = cell ? overlayCompose(cell.flags, sel) : [];
  const specAlgoFlag = effFlags.find(f => f.split(/[\s=]/)[0] === "--speculative-algorithm");
  const specMrrFlag = effFlags.find(f => f.split(/[\s=]/)[0] === "--max-running-requests");
  const mtpHint = !!specAlgoFlag && !specMrrFlag;
  const specPinnedHint = !!specAlgoFlag && !!specMrrFlag;
  const specMrrValue = specMrrFlag ? specMrrFlag.split(/[\s=]/).filter(Boolean)[1] || "" : "";
  const SPEC_ALGO_LABEL = {
    EAGLE: "MTP",
    EAGLE3: "MTP",
    FROZEN_KV_MTP: "MTP",
    DSPARK: "DSpark",
    DFLASH: "DFlash",
    NGRAM: "N-gram",
    STANDALONE: "standalone draft"
  };
  const specAlgoName = (() => {
    if (!specAlgoFlag) return "MTP";
    const v = specAlgoFlag.split(/[\s=]/).filter(Boolean)[1] || "";
    return SPEC_ALGO_LABEL[v.toUpperCase()] || v || "MTP";
  })();
  const renderWarn = text => {
    const out = [];
    const re = /\[([^\]]+)\]\(#([^)]+)\)/g;
    let last = 0;
    for (let m; m = re.exec(text); last = m.index + m[0].length) {
      if (m.index > last) out.push(text.slice(last, m.index));
      const anchor = m[2];
      out.push(<button key={m.index} type="button" onClick={() => {
        const el = document.getElementById(anchor);
        if (el) el.scrollIntoView({
          behavior: "smooth",
          block: "start"
        });
      }} style={{
        background: "transparent",
        border: "none",
        padding: 0,
        color: isDark ? "#FDBA74" : "#C2410C",
        cursor: "pointer",
        font: "inherit",
        fontWeight: 600,
        textDecoration: "underline",
        textUnderlineOffset: "2px"
      }}>
          {m[1]}
        </button>);
    }
    if (last < text.length) out.push(text.slice(last));
    return out;
  };
  const modelName = resolveModelName(sel);
  const curlTemplate = typeof config.curl === "function" ? config.curl(sel, cell) : config.curl;
  const curlText = interpolate(curlTemplate || "", env, modelName);
  const hwGroups = buildHardwareGroups();
  const benchEntry = benchmarks ? findBenchmark(benchmarks, sel) : null;
  const isOverlayDim = dim => overlayDimSpecs.some(d => d.id === dim);
  const findOption = (dim, value) => {
    const spec = [...matchDimSpecs, ...overlayDimSpecs].find(d => d.id === dim);
    return spec && (spec.options || []).find(o => o.id === value);
  };
  const isEnabled = (dim, value) => {
    const opt = findOption(dim, value);
    if (opt && optionDisabled(opt, sel)) return false;
    if (commandBuilder && dim === "hw") return true;
    return isOverlayDim(dim) || isOptionAvailable(config.cells || [], sel, dim, value);
  };
  const reseatHiddenPicks = next => {
    let out = next;
    for (const spec of [...matchDimSpecs, ...overlayDimSpecs]) {
      const opts = visibleOptions(spec, out).filter(o => !optionDisabled(o, out));
      if (!opts.length) continue;
      if (!opts.some(o => o.id === out[spec.id])) {
        out = {
          ...out,
          [spec.id]: opts[0].id
        };
      }
    }
    return out;
  };
  const recommendedBuilderRecipe = hw => {
    const recipes = commandBuilder.resource?.verifiedRecipes || [];
    return recipes.find(entry => entry.hw === hw && entry.default) || recipes.find(entry => entry.hw === hw);
  };
  const handleSelect = (dim, value) => {
    if (commandBuilder) {
      setSel(prev => {
        let next = {
          ...prev,
          [dim]: value
        };
        if (dim === "hw") {
          const currentRecipe = recommendedBuilderRecipe(prev.hw);
          const nextRecipe = recommendedBuilderRecipe(value);
          const resourcesFollowPlatformDefault = !!currentRecipe && Number(prev.nodes) === Number(currentRecipe.nodes) && Number(prev.gpus_per_node) === Number(currentRecipe.gpus_per_node);
          next = {
            ...next,
            nodes: resourcesFollowPlatformDefault ? nextRecipe?.nodes ?? next.nodes : next.nodes,
            gpus_per_node: resourcesFollowPlatformDefault ? nextRecipe?.gpus_per_node ?? next.gpus_per_node : next.gpus_per_node,
            topology_mode: "auto",
            tp_size: resourcesFollowPlatformDefault ? nextRecipe?.tp_size ?? 1 : next.tp_size,
            ulysses_degree: resourcesFollowPlatformDefault ? nextRecipe?.ulysses_degree ?? 1 : next.ulysses_degree,
            ring_degree: resourcesFollowPlatformDefault ? nextRecipe?.ring_degree ?? 1 : next.ring_degree,
            placement: resourcesFollowPlatformDefault ? nextRecipe?.placement || "auto" : next.placement,
            encoder: resourcesFollowPlatformDefault ? nextRecipe?.encoder || "auto" : next.encoder
          };
        }
        return reseatHiddenPicks(normalizeBuilderSelection(next));
      });
      return;
    }
    setSel(prev => reseatHiddenPicks(isOverlayDim(dim) ? {
      ...prev,
      [dim]: value
    } : snapToValidCell(config.cells, prev, dim, value)));
  };
  const commitBuilderNumber = (event, currentValue, bounds, commit) => {
    const parsed = Number(event.currentTarget.value);
    if (!Number.isInteger(parsed)) {
      event.currentTarget.value = String(currentValue);
      return;
    }
    const value = Math.min(bounds.max, Math.max(bounds.min, parsed));
    event.currentTarget.value = String(value);
    commit(value);
  };
  const renderBuilderNumberInput = ({identity, value, min, max, label, onCommit}) => <input key={identity} type="number" inputMode="numeric" min={min} max={max} step="1" defaultValue={value} aria-label={label} onFocus={event => event.currentTarget.select()} onBlur={event => commitBuilderNumber(event, value, {
    min,
    max
  }, onCommit)} onKeyDown={event => {
    if (event.key === "Enter") event.currentTarget.blur();
  }} />;
  const updateBuilderResource = (key, delta) => {
    if (!commandBuilder) return;
    const bounds = commandBuilder.resource?.limits?.[key] || ({
      min: 1,
      max: 8
    });
    setSel(prev => {
      const value = Math.min(bounds.max, Math.max(bounds.min, Number(prev[key]) + delta));
      return normalizeBuilderSelection({
        ...prev,
        [key]: value,
        topology_mode: "auto"
      });
    });
  };
  const setBuilderResource = (key, rawValue) => {
    if (!commandBuilder) return;
    const value = Number.parseInt(rawValue, 10);
    if (!Number.isFinite(value)) return;
    const bounds = commandBuilder.resource?.limits?.[key] || ({
      min: 1,
      max: 8
    });
    setSel(prev => normalizeBuilderSelection({
      ...prev,
      [key]: Math.min(bounds.max, Math.max(bounds.min, value)),
      topology_mode: "auto"
    }));
  };
  const editBuilderTopology = (key, value) => {
    if (!commandBuilder) return;
    setSel(prev => normalizeBuilderSelection({
      ...prev,
      topology_mode: "manual",
      [key]: Number.parseInt(value, 10) || 1
    }));
  };
  const handleCopy = () => {
    navigator.clipboard.writeText(command);
    setCopied(true);
    setTimeout(() => setCopied(false), 1200);
  };
  const copyCurl = () => {
    navigator.clipboard.writeText(curlText);
    setCurlCopied(true);
    setTimeout(() => setCurlCopied(false), 1200);
  };
  const copyBench = (key, text) => {
    navigator.clipboard.writeText(text);
    setBenchCopied(key);
    setTimeout(() => setBenchCopied(null), 1200);
  };
  const placeholderGroups = (() => {
    const out = {
      command: [],
      curl: []
    };
    for (const [key, meta] of Object.entries(config.placeholders || ({}))) {
      (out[meta.target] || (out[meta.target] = [])).push({
        key,
        ...meta
      });
    }
    return out;
  })();
  const renderButton = (item, dim, selectedId) => {
    const checked = selectedId === item.id;
    const disabled = !isEnabled(dim, item.id);
    return <label key={item.id} className="sg-command-visualizer-choice" role="radio" aria-checked={checked} aria-disabled={disabled} tabIndex={disabled ? -1 : 0} style={{
      ...s.labelBase,
      ...checked ? s.checked : {},
      ...disabled ? s.disabled : {}
    }} title={disabled ? (typeof item.disableReason === "function" ? item.disableReason(sel) : item.disableReason) || "Not supported for current selection" : ""} onClick={e => {
      if (disabled) {
        e.preventDefault();
        return;
      }
      handleSelect(dim, item.id);
    }} onKeyDown={e => {
      if (disabled || e.key !== "Enter" && e.key !== " ") return;
      e.preventDefault();
      handleSelect(dim, item.id);
    }}>
        <input type="radio" checked={checked} disabled={disabled} readOnly style={{
      display: "none"
    }} />
        <span>{item.label}</span>
        {item.subtitle && <small style={{
      ...s.subtitle,
      color: checked ? "rgba(255,255,255,0.85)" : "inherit"
    }}>
            {item.subtitle}
          </small>}
      </label>;
  };
  const renderFlatSection = (title, options, dim, selectedId) => <div style={s.card}>
      <div style={s.title}>{title}</div>
      <div style={s.itemsGrid(options.length)}>
        {options.map(item => renderButton(item, dim, selectedId))}
      </div>
    </div>;
  const maxHwCols = Math.max(...hwGroups.map(x => x.items.length));
  if (commandBuilder) {
    const scopeLabel = {
      base: "Setup",
      serve: "Server",
      request: "Request"
    };
    const scopedDims = scope => overlayDimSpecs.filter(dim => {
      if ((dim.scope || "base") !== scope) return false;
      if (dim.kind === "number") {
        return typeof dim.showWhen !== "function" || dim.showWhen(sel);
      }
      return rowVisible(dim, sel);
    });
    const baseDims = scopedDims("base");
    const serveDims = scopedDims("serve");
    const requestDims = scopedDims("request");
    const errors = builderMeta.errors || [];
    const warnings = builderMeta.warnings || [];
    const invalid = errors.length > 0;
    const totalGpus = Number(sel.nodes) * Number(sel.gpus_per_node);
    const topology = builderMeta.topology || ({});
    const verification = builderMeta.verification || ({});
    const scopeIsVerified = scope => scopedDims(scope).every(dim => {
      const option = (dim.options || []).find(entry => entry.id === sel[dim.id]);
      if (option && optionSoft(option, sel)) return false;
      const predicate = option?.verifiedWhen ?? dim.verifiedWhen;
      return typeof predicate === "function" ? !!predicate(sel) : predicate !== false;
    });
    const serveStatus = invalid ? "error" : scopeIsVerified("serve") ? verification.serve || verifyStatus : "unverified";
    const requestStatus = invalid ? "error" : scopeIsVerified("request") ? verification.request || verifyStatus : "unverified";
    const statusText = status => ({
      verified: "Verified",
      unverified: "Unverified",
      "in-progress": "Verification in progress",
      error: "Invalid configuration"
    })[status] || "Unverified";
    const activeServerSetting = serveDims.find(dim => dim.id === builderServerSetting) || serveDims[0];
    const selectedOption = dim => (dim.options || []).find(option => option.id === sel[dim.id]);
    const effectiveSetting = dim => builderMeta.resolvedSettings?.[dim.id] || selectedOption(dim)?.label || sel[dim.id] || "—";
    const recommendedRecipe = recommendedBuilderRecipe(sel.hw);
    const recommendedInUse = !!recommendedRecipe && Number(sel.nodes) === recommendedRecipe.nodes && Number(sel.gpus_per_node) === recommendedRecipe.gpus_per_node && sel.topology_mode === "auto" && ["auto", recommendedRecipe.placement].includes(sel.placement) && sel.attention === "platform" && sel.precision === "native" && ["auto", recommendedRecipe.encoder].includes(sel.encoder) && sel.execution === "eager";
    const restoreRecommendedRecipe = () => {
      if (!recommendedRecipe) return;
      setSel(prev => reseatHiddenPicks(normalizeBuilderSelection({
        ...prev,
        nodes: recommendedRecipe.nodes,
        gpus_per_node: recommendedRecipe.gpus_per_node,
        topology_mode: "auto",
        tp_size: recommendedRecipe.tp_size,
        ulysses_degree: recommendedRecipe.ulysses_degree,
        ring_degree: recommendedRecipe.ring_degree,
        placement: recommendedRecipe.placement || "auto",
        attention: "platform",
        precision: "native",
        encoder: recommendedRecipe.encoder || "auto",
        execution: "eager"
      })));
    };
    const renderBuilderChoice = (item, dim) => {
      const checked = sel[dim.id] === item.id;
      const disabled = !isEnabled(dim.id, item.id);
      const soft = !disabled && optionSoft(item, sel);
      const reason = disabled ? item.disableReason || "Not available for this configuration" : soft ? item.softReason || "Runs, but this combination is not a verified recipe yet." : "";
      return <button key={item.id} type="button" className="sgd-builder-choice" data-selected={checked ? "true" : "false"} data-blocked={disabled ? "true" : undefined} data-soft={soft ? "true" : undefined} aria-disabled={disabled} aria-pressed={checked} title={reason} onClick={() => {
        if (disabled) {
          flashBlockedNote(dim.id, reason);
          return;
        }
        handleSelect(dim.id, item.id);
      }}>
          <span className="sgd-builder-choice-dot" aria-hidden="true" />
          <span>{item.label}</span>
          {item.subtitle && <small>{item.subtitle}</small>}
        </button>;
    };
    const renderBuilderDimension = dim => <section className="sgd-builder-section" key={dim.id}>
        <div className="sgd-builder-section-heading">
          <span>{dim.title}</span>
          {dim.description && <small>{dim.description}</small>}
        </div>
        <div className="sgd-builder-choice-grid" data-density={(dim.options || []).length > 5 ? "compact" : "normal"}>
          {visibleOptions(dim, sel).map(option => renderBuilderChoice(option, dim))}
        </div>
        {blockedNote && blockedNote.dim === dim.id && <p className="sgd-builder-blocked-note" role="status">{blockedNote.reason}</p>}
      </section>;
    const renderStepper = (key, label, detail) => {
      const bounds = commandBuilder.resource?.limits?.[key] || ({
        min: 1,
        max: 8
      });
      return <div className="sgd-builder-stepper-field">
          <div>
            <span>{label}</span>
            {detail && <small>{detail}</small>}
          </div>
          <div className="sgd-builder-stepper" aria-label={label}>
            <button type="button" aria-label={`Decrease ${label}`} disabled={Number(sel[key]) <= bounds.min} onClick={() => updateBuilderResource(key, -1)}>−</button>
            {renderBuilderNumberInput({
        identity: `${key}-${sel[key]}`,
        value: sel[key],
        min: bounds.min,
        max: bounds.max,
        label,
        onCommit: value => setBuilderResource(key, value)
      })}
            <button type="button" aria-label={`Increase ${label}`} disabled={Number(sel[key]) >= bounds.max} onClick={() => updateBuilderResource(key, 1)}>+</button>
          </div>
        </div>;
    };
    const renderBaseScope = () => <div className="sgd-builder-scope-panel" data-scope="base">
        {recommendedRecipe && <section className="sgd-builder-recipe">
            <div>
              {}
              <span>{recommendedRecipe.unverified ? "Derived recipe" : "Verified recipe"} · {sel.hw.toUpperCase()}</span>
              <strong>
                {[`${recommendedRecipe.nodes * recommendedRecipe.gpus_per_node} GPUs`, recommendedRecipe.tp_size > 1 && `TP ${recommendedRecipe.tp_size}`, `Ulysses ${recommendedRecipe.ulysses_degree}`, recommendedRecipe.ring_degree > 1 && `Ring ${recommendedRecipe.ring_degree}`, ({
      resident: "Resident",
      fsdp: "FSDP",
      offload: "Layerwise offload"
    })[recommendedRecipe.placement]].filter(Boolean).join(" · ")}
              </strong>
            </div>
            <div>
              {renderStatus(recommendedRecipe.unverified ? "unverified" : "verified")}
              {recommendedInUse ? <small>In use</small> : <button type="button" className="sgd-builder-text-action" onClick={restoreRecommendedRecipe}>{recommendedRecipe.unverified ? "Use derived recipe" : "Use verified recipe"}</button>}
            </div>
          </section>}
        <section className="sgd-builder-section">
          <div className="sgd-builder-section-heading"><span>Hardware</span></div>
          <div className="sgd-builder-hardware-grid">
            {hwGroups.flatMap(group => group.items).map(item => {
      const selected = sel.hw === item.id;
      return <button key={item.id} type="button" className="sgd-builder-hardware" data-selected={selected ? "true" : "false"} aria-pressed={selected} onClick={() => handleSelect("hw", item.id)}>
                  <span className="sgd-builder-choice-dot" aria-hidden="true" />
                  <strong>{item.label}</strong>
                  <small>{item.subtitle}</small>
                </button>;
    })}
          </div>
        </section>

        {}
        <section className="sgd-builder-section">
          <div className="sgd-builder-section-heading">
            <span>Resources</span>
            <small>{builderMeta.topologySummary || "No valid topology"}</small>
          </div>
          <div className="sgd-builder-resource-grid">
            {renderStepper("nodes", "Nodes")}
            {renderStepper("gpus_per_node", "GPUs / node")}
          </div>
          {Number(sel.nodes) > 1 && <p className="sgd-builder-resource-summary">
              {sel.nodes} nodes × {sel.gpus_per_node} {sel.hw.toUpperCase()} = {totalGpus} GPUs
            </p>}
          <button type="button" className="sgd-builder-text-action sgd-builder-topology-toggle" aria-expanded={builderAdvanced} onClick={() => setBuilderAdvanced(open => !open)}>
            Advanced topology <span aria-hidden="true">{builderAdvanced ? "↗" : "↘"}</span>
          </button>
          {builderAdvanced && <div className="sgd-builder-advanced">
              <p>Auto uses an exact verified recipe when one exists; manual values are allowed when the model constraints remain valid.</p>
              <div className="sgd-builder-topology-inputs">
                {[["tp_size", "Tensor parallel", [1, 2, 4, 8]], ["ulysses_degree", "Ulysses", [1, 2, 4, 8, 16]], ["ring_degree", "Ring", [1, 2, 4, 8]]].map(([key, label, values]) => <label key={key}>
                    <span>{label}</span>
                    <select value={sel.topology_mode === "manual" ? sel[key] : topology[key] || 1} onChange={event => editBuilderTopology(key, event.target.value)}>
                      {values.map(value => <option value={value} key={value}>{value}</option>)}
                    </select>
                  </label>)}
              </div>
              <button type="button" className="sgd-builder-text-action" disabled={sel.topology_mode === "auto"} onClick={() => setSel(prev => normalizeBuilderSelection({
      ...prev,
      topology_mode: "auto"
    }))}>Use automatic topology</button>
            </div>}
          {(errors.length > 0 || warnings.length > 0) && <div className="sgd-builder-messages" data-state={errors.length ? "error" : "warning"}>
              {(errors.length ? errors : warnings).map((message, index) => <p key={index}>{message}</p>)}
            </div>}
        </section>

        {baseDims.map(renderBuilderDimension)}
      </div>;
    const renderSettingEditor = (dim, className = "", direct = false) => {
      if (!dim) return null;
      const options = visibleOptions(dim, sel);
      const currentOption = selectedOption(dim);
      return <section className={`sgd-builder-context ${className}`} aria-live={direct ? undefined : "polite"}>
          <div className="sgd-builder-context-heading">
            <div>
              <span>{direct ? dim.title : `${dim.title} options`}</span>
              {dim.description && <p>{dim.description}</p>}
            </div>
            {dim.quality && <small>{dim.quality}</small>}
          </div>
          {dim.kind === "number" ? <div className="sgd-builder-request-stepper">
              <button type="button" aria-label={`Decrease ${dim.title}`} disabled={Number(sel[dim.id]) <= dim.min} onClick={() => setSel(prev => ({
        ...prev,
        [dim.id]: Math.max(dim.min, Number(prev[dim.id]) - 1)
      }))}>−</button>
              {renderBuilderNumberInput({
        identity: `${dim.id}-${sel[dim.id]}`,
        value: sel[dim.id],
        min: dim.min,
        max: dim.max,
        label: dim.title,
        onCommit: value => setSel(prev => ({
          ...prev,
          [dim.id]: value
        }))
      })}
              <button type="button" aria-label={`Increase ${dim.title}`} disabled={Number(sel[dim.id]) >= dim.max} onClick={() => setSel(prev => ({
        ...prev,
        [dim.id]: Math.min(dim.max, Number(prev[dim.id]) + 1)
      }))}>+</button>
              <span>{dim.unit || "outputs"}</span>
            </div> : <div className="sgd-builder-context-options">
              {options.map(option => renderBuilderChoice(option, dim))}
            </div>}
          {blockedNote && blockedNote.dim === dim.id && <p className="sgd-builder-blocked-note" role="status">{blockedNote.reason}</p>}
          {(currentOption?.description || dim.learnMore) && <div className="sgd-builder-context-note">
              {currentOption?.description && <p>{currentOption.description}</p>}
              {}
              {dim.learnMore && <a href={dim.learnMore}>
                  <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" aria-hidden="true"><line x1="4" y1="6" x2="20" y2="6" /><line x1="4" y1="12" x2="16" y2="12" /><line x1="4" y1="18" x2="11" y2="18" /></svg>
                  Learn more
                </a>}
              {dim.docsHref && <a href={dim.docsHref}>
                  <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20" /><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z" /></svg>
                  SGLang docs
                </a>}
            </div>}
        </section>;
    };
    const renderServerScope = () => <div className="sgd-builder-scope-panel" data-scope="serve">
        <div className="sgd-builder-setting-layout">
          <div className="sgd-builder-setting-list">
            {serveDims.map(dim => {
      const isActive = dim.id === activeServerSetting?.id;
      const option = selectedOption(dim);
      const recommended = typeof option?.recommendedWhen === "function" ? option.recommendedWhen(sel) : !!option?.recommended;
      return <div className="sgd-builder-setting-item" key={dim.id}>
                  <button type="button" className="sgd-builder-setting-row" data-active={isActive ? "true" : "false"} aria-expanded={isActive} onClick={() => setBuilderServerSetting(dim.id)}>
                    <span>{dim.title}</span>
                    <strong>{effectiveSetting(dim)}</strong>
                    {recommended && <small>Recommended</small>}
                    <span aria-hidden="true">{isActive ? "⌄" : "›"}</span>
                  </button>
                  {isActive && renderSettingEditor(dim, "sgd-builder-context--inline")}
                </div>;
    })}
          </div>
          {renderSettingEditor(activeServerSetting, "sgd-builder-context--rail")}
        </div>
      </div>;
    const renderRequestScope = () => <div className="sgd-builder-scope-panel sgd-builder-request-direct" data-scope="request">
        {requestDims.map(dim => <div className="sgd-builder-request-setting" key={dim.id}>
            {renderSettingEditor(dim, "", true)}
          </div>)}
      </div>;
    const renderScopeControls = () => {
      if (builderScope === "base") return renderBaseScope();
      if (builderScope === "serve") return renderServerScope();
      return renderRequestScope();
    };
    const renderStatus = status => <span className="sgd-builder-status" data-status={status}>
        <span aria-hidden="true" />{statusText(status)}
      </span>;
    const renderOutputCard = type => {
      const serve = type === "serve";
      const text = serve ? command : curlText;
      const canExpand = text.split("\n").length > 9;
      const expanded = serve ? serveExpanded : requestExpanded;
      const setExpanded = serve ? setServeExpanded : setRequestExpanded;
      const status = serve ? serveStatus : requestStatus;
      const emphasized = builderScope === "base" || builderScope === type;
      return <section className="sgd-builder-output" data-output={type} data-emphasized={emphasized ? "true" : "false"}>
          <header>
            <div className="sgd-builder-output-index">{serve ? "1" : "2"}</div>
            <div className="sgd-builder-output-title">
              <strong>{serve ? "Serve" : "Request"}</strong>
              <span>
                {serve ? `${sel.hw.toUpperCase()} · ${activeRunMode === "docker" ? "Docker" : "Python"}` : "cURL"}
              </span>
            </div>
            {renderStatus(status)}
          </header>
          {serve && runModes.length > 1 && <div className="sgd-builder-output-tabs" role="tablist" aria-label="Serve command format">
              {runModes.map(mode => <button type="button" role="tab" aria-selected={activeRunMode === mode} data-selected={activeRunMode === mode ? "true" : "false"} key={mode} onClick={() => setRunMode(mode)}>{mode === "docker" ? "Docker" : "Python"}</button>)}
            </div>}
          {serve && Number(sel.nodes) > 1 && <div className="sgd-builder-node-fields">
              <label>
                <span>Head address</span>
                <input value={builderHeadAddress} onChange={event => setBuilderHeadAddress(event.target.value)} />
              </label>
              <label>
                <span>Node rank</span>
                {renderBuilderNumberInput({
        identity: `node-rank-${builderNodeRank}-${sel.nodes}`,
        value: builderNodeRank,
        min: 0,
        max: Number(sel.nodes) - 1,
        label: "Node rank",
        onCommit: setBuilderNodeRank
      })}
              </label>
            </div>}
          <div className="sgd-builder-code">
            <pre className={expanded ? "is-expanded" : ""}><code>{text}</code></pre>
            <button type="button" className="sgd-builder-copy" disabled={invalid} aria-label={(serve ? copied : curlCopied) ? "Copied" : "Copy command"} data-copied={(serve ? copied : curlCopied) ? "true" : undefined} onClick={serve ? handleCopy : copyCurl}>
              <svg className="sgd-builder-copy-glyph" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.9" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><rect x="9" y="9" width="12" height="12" rx="2.5" /><path d="M15 5v-.25A2.75 2.75 0 0 0 12.25 2h-7.5A2.75 2.75 0 0 0 2 4.75v7.5A2.75 2.75 0 0 0 4.75 15H5" /></svg>
              <svg className="sgd-builder-copy-check" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5" /></svg>
            </button>
          </div>
          {invalid && <div className="sgd-builder-output-error">{errors[0]}</div>}
          <footer>
            {canExpand && <button type="button" className="sgd-builder-text-action" onClick={() => setExpanded(!expanded)}>
                {expanded ? "Collapse" : "Expand"}
              </button>}
            <div>
              <button type="button" className="sgd-builder-text-action" onClick={() => setModal("env")}>Variables</button>
            </div>
          </footer>
        </section>;
    };
    return <section id={DEPLOYMENT_COMPONENT_ID} className="not-prose sg-command-visualizer sgd-command-builder" style={{
      scrollMarginTop: "104px"
    }} aria-label={`${config.modelName} command builder`}>
        <nav className="sgd-builder-scope-tabs" role="tablist" aria-label="Command builder scope">
          {["base", "serve", "request"].map(scope => <button type="button" role="tab" key={scope} aria-label={scopeLabel[scope]} aria-selected={builderScope === scope} aria-controls={`${DEPLOYMENT_COMPONENT_ID}-controls`} data-active={builderScope === scope ? "true" : "false"} onClick={() => setBuilderScope(scope)}>
              {scopeLabel[scope]}
            </button>)}
        </nav>

        <div className="sgd-builder-main" data-scope={builderScope}>
          <div id={`${DEPLOYMENT_COMPONENT_ID}-controls`} className="sgd-builder-controls" role="tabpanel" aria-label={`${scopeLabel[builderScope]} settings`}>
            {renderScopeControls()}
          </div>
          <div className="sgd-builder-output-rail">
            {builderScope !== "request" && renderOutputCard("serve")}
            {builderScope !== "serve" && renderOutputCard("request")}
          </div>
        </div>

        {modal === "env" && <div style={s.modalBackdrop} onClick={() => setModal(null)}>
            <div style={s.modalBox} onClick={event => event.stopPropagation()}>
              <div style={s.modalHeader}>
                <div style={s.modalTitle}>Command variables</div>
                <button style={s.modalCloseBtn} onClick={() => setModal(null)} aria-label="Close">×</button>
              </div>
              {["command", "curl"].map(target => placeholderGroups[target].length > 0 && <div key={target}>
                  <div style={s.sectionHeading}>{target === "command" ? "Serve" : "Request"}</div>
                  {placeholderGroups[target].map(({key, label}) => <div key={key} style={s.formField}>
                      <label style={s.formLabel}>{label}</label>
                      <input style={s.formInput} value={envDraft[key] ?? ""} onChange={event => setEnvDraft({
      ...envDraft,
      [key]: event.target.value
    })} />
                    </div>)}
                </div>)}
              <div style={{
      display: "flex",
      justifyContent: "flex-end",
      gap: 8,
      marginTop: 16
    }}>
                <button style={{
      ...s.iconButton,
      padding: "6px 14px"
    }} onClick={() => setModal(null)}>Cancel</button>
                <button style={s.primaryBtn} onClick={() => {
      saveEnv(envDraft);
      setModal(null);
    }}>Save</button>
              </div>
            </div>
          </div>}
      </section>;
  }
  return <div id={DEPLOYMENT_COMPONENT_ID} style={{
    ...s.container,
    scrollMarginTop: "104px"
  }} className="not-prose sg-command-visualizer">
      {}
      <div style={s.cardColumn}>
        <div style={{
    ...s.title,
    marginBottom: "2px"
  }}>Hardware Platform</div>
        {hwGroups.map(g => <div key={g.label || "hardware"} style={s.vendorRow}>
            {g.label && <div style={s.vendorLabel}>{g.label}</div>}
            <div style={s.itemsGrid(maxHwCols)}>
              {g.items.map(item => renderButton(item, "hw", sel.hw))}
              {Array.from({
    length: maxHwCols - g.items.length
  }).map((_, i) => <div key={`pad-${i}`} />)}
            </div>
          </div>)}
      </div>

      {matchDimSpecs.filter(d => rowVisible(d, sel)).map(d => <div key={d.id}>
            {renderFlatSection(d.title, visibleOptions(d, sel), d.id, sel[d.id])}
          </div>)}
      {overlayDimSpecs.filter(d => rowVisible(d, sel)).map(d => <div key={d.id}>
            {renderFlatSection(d.title, visibleOptions(d, sel), d.id, sel[d.id])}
          </div>)}

      {}
      <div style={s.card}>
        <div style={s.title}>Command:</div>
        <div style={s.commandWrap}>
          {cell && cell.redirect ? cell.warn && <div style={s.mtpWarn}>⚠️ {renderWarn(cell.warn)}</div> : <>
            <div style={s.commandHeader}>
              <div style={s.headerLeft}>
                <div style={s.badge(verifyStatus)}>
                  <span style={s.badgeDot(verifyStatus)} />
                  {VERIFY_LABEL[verifyStatus]}
                </div>
                <div style={s.runModeWrap} role="tablist" aria-label="Output format">
                  {runModes.map((mode, index) => <span key={mode} className="sg-command-visualizer-tab" style={{
    ...index === runModes.length - 1 ? s.runModeChipLast(activeRunMode === mode) : s.runModeChip(activeRunMode === mode),
    ...runModes.length === 1 ? {
      borderRadius: 7
    } : {}
  }} onClick={() => setRunMode(mode)} onKeyDown={e => {
    if (e.key !== "Enter" && e.key !== " ") return;
    e.preventDefault();
    setRunMode(mode);
  }} role="tab" tabIndex={0} aria-selected={activeRunMode === mode}>
                      {mode === "docker" ? "Docker" : "Python"}
                    </span>)}
                </div>
              </div>
              <div style={s.iconRow}>
                <button style={s.iconButton} onClick={handleCopy}>
                  {copied ? "✓ Copied" : "⧉ Copy"}
                </button>
                <button style={s.iconButton} onClick={() => setModal("curl")}>$ cURL</button>
                <button style={s.iconButton} onClick={() => setModal("env")}>⚙ Env</button>
              </div>
            </div>
            <pre style={s.commandPre}>{command}</pre>
            {cell && cell.warn && <div style={s.mtpWarn}>⚠️ {renderWarn(cell.warn)}</div>}
            {mtpHint && <div style={s.mtpWarn}>
                ⚠️ Speculative decoding ({specAlgoName}) is on — SGLang resets <code>--max-running-requests</code> to <strong>48</strong> when it isn't set. Add <code>--max-running-requests &lt;N&gt;</code> sized for your target concurrency.
              </div>}
            {specPinnedHint && <div style={s.mtpWarn}>
                ℹ️ Speculative decoding ({specAlgoName}) is on and this recipe pins <code>--max-running-requests</code> to <strong>{specMrrValue}</strong>. Adjust it to match your target concurrency — if you remove the flag, SGLang falls back to <strong>48</strong>.
              </div>}
          </>}
        </div>
      </div>

      {}
      {benchmarks && cell && renderBenchmarkCard(benchEntry)}

      {}
      {config.showPlaygroundLink !== false && <div style={{
    padding: "6px 12px",
    fontSize: "12px",
    color: isDark ? "#9ca3af" : "#6b7280",
    display: "flex",
    alignItems: "center",
    gap: "6px"
  }}>
          <span>Need to go beyond the verified matrix?</span>
          <button type="button" onClick={() => {
    const el = document.getElementById("playground");
    if (el) el.scrollIntoView({
      behavior: "smooth",
      block: "start"
    });
  }} style={{
    background: "transparent",
    border: "none",
    padding: 0,
    color: isDark ? "#FDBA74" : "#C2410C",
    cursor: "pointer",
    fontSize: "12px",
    fontWeight: 600,
    textDecoration: "underline",
    textUnderlineOffset: "2px"
  }}>
            Open the Playground →
          </button>
        </div>}

      {}
      {modal === "curl" && <div style={s.modalBackdrop} onClick={() => setModal(null)}>
          <div style={s.modalBox} onClick={e => e.stopPropagation()}>
            <div style={s.modalHeader}>
              <div style={s.modalTitle}>cURL example</div>
              <button style={s.modalCloseBtn} onClick={() => setModal(null)} aria-label="Close">×</button>
            </div>
            <div style={s.commandWrap}>
              <div style={s.commandHeader}>
                <div style={{
    fontSize: 11,
    opacity: 0.7
  }}>
                  Model: <code>{modelName || "(unresolved)"}</code>
                </div>
                <button style={s.iconButton} onClick={copyCurl}>
                  {curlCopied ? "✓ Copied" : "⧉ Copy"}
                </button>
              </div>
              <pre style={s.commandPre}>{curlText}</pre>
            </div>
            <p style={{
    fontSize: 11,
    opacity: 0.7,
    marginTop: 8
  }}>
              Edit <code>CURL_HOST</code> / <code>CURL_PORT</code> in the Env panel.
            </p>
          </div>
        </div>}

      {}
      {modal === "env" && <div style={s.modalBackdrop} onClick={() => setModal(null)}>
          <div style={s.modalBox} onClick={e => e.stopPropagation()}>
            <div style={s.modalHeader}>
              <div style={s.modalTitle}>Env / placeholder values</div>
              <button style={s.modalCloseBtn} onClick={() => setModal(null)} aria-label="Close">×</button>
            </div>
            {placeholderGroups.curl.length > 0 && <div>
                <div style={s.sectionHeading}>cURL placeholders</div>
                {placeholderGroups.curl.map(({key, label}) => <div key={key} style={s.formField}>
                    <label style={s.formLabel}>
                      {label} <code style={{
    opacity: 0.6
  }}>{`{{${key}}}`}</code>
                    </label>
                    <input style={s.formInput} value={envDraft[key] ?? ""} onChange={e => setEnvDraft({
    ...envDraft,
    [key]: e.target.value
  })} />
                  </div>)}
              </div>}
            {placeholderGroups.command.length > 0 && <div>
                <div style={s.sectionHeading}>Command placeholders</div>
                {placeholderGroups.command.map(({key, label}) => <div key={key} style={s.formField}>
                    <label style={s.formLabel}>
                      {label} <code style={{
    opacity: 0.6
  }}>{`{{${key}}}`}</code>
                    </label>
                    <input style={s.formInput} value={envDraft[key] ?? ""} onChange={e => setEnvDraft({
    ...envDraft,
    [key]: e.target.value
  })} />
                  </div>)}
              </div>}
            <div style={{
    display: "flex",
    justifyContent: "flex-end",
    gap: 8,
    marginTop: 16
  }}>
              <button style={{
    ...s.iconButton,
    padding: "6px 14px"
  }} onClick={() => setModal(null)}>Cancel</button>
              <button style={s.primaryBtn} onClick={() => {
    saveEnv(envDraft);
    setModal(null);
  }}>Save</button>
            </div>
            <p style={{
    fontSize: 11,
    opacity: 0.7,
    marginTop: 10
  }}>
              Values persist in localStorage and are reused the next time you visit any cookbook.
            </p>
          </div>
        </div>}

      {}
      {modal === "bench" && benchEntry && (() => {
    const bc = buildBenchCommands(benchEntry, sel);
    if (!bc) return null;
    const selSummary = [sel.hw && sel.hw.toUpperCase(), sel.variant, sel.quant && sel.quant.toUpperCase(), sel.strategy, sel.kvDsaPair, sel.nodes].filter(part => part !== undefined && part !== null && part !== "").join(" · ");
    let selConc = null;
    let speedCmd = null;
    if (bc.speed) {
      selConc = bc.speed.concurrencies.includes(benchConc) ? benchConc : bc.speed.concurrencies[0];
      const w = bc.speed.workload;
      speedCmd = interpolate(bc.speed.template, {
        ...env,
        DATASET: w.dataset,
        ISL: w.isl,
        OSL: w.osl,
        MAX_CONCURRENCY: selConc,
        NUM_PROMPTS: bc.speed.numPromptsOf(selConc)
      }, modelName);
    }
    let selAcc = null;
    let accCmd = null;
    if (bc.accuracy.length > 0) {
      selAcc = bc.accuracy.find(a => a.key === benchAcc) || bc.accuracy[0];
      accCmd = interpolate(selAcc.template, env, modelName);
    }
    return <div style={s.modalBackdrop} onClick={() => setModal(null)}>
            <div style={s.modalBox} onClick={e => e.stopPropagation()}>
              <div style={s.modalHeader}>
                <div style={s.modalTitle}>Benchmark commands</div>
                <button style={s.modalCloseBtn} onClick={() => setModal(null)} aria-label="Close">×</button>
              </div>
              <p style={{
      fontSize: 11,
      opacity: 0.7,
      margin: "0 0 12px"
    }}>
                For <code>{selSummary}</code>. Start the server with the Deploy command above, then run these against it.
              </p>

              {selAcc && <div>
                  <div style={s.sectionHeading}>Accuracy</div>
                  {bc.accuracy.length > 1 && <div style={s.benchChipRow}>
                      <span style={{
      fontSize: 11,
      opacity: 0.7
    }}>benchmark:</span>
                      {bc.accuracy.map(a => <button key={a.key} style={{
      ...s.benchChip,
      ...a.key === selAcc.key ? s.benchChipActive : {}
    }} onClick={() => setBenchAcc(a.key)}>
                          {a.label}
                        </button>)}
                    </div>}
                  <div style={{
      ...s.commandWrap,
      marginBottom: 6
    }}>
                    <div style={s.commandHeader}>
                      <div style={{
      fontSize: 11,
      opacity: 0.7
    }}>{selAcc.label}</div>
                      <button style={s.iconButton} onClick={() => copyBench("acc", accCmd)}>
                        {benchCopied === "acc" ? "✓ Copied" : "⧉ Copy"}
                      </button>
                    </div>
                    <pre style={s.commandPre}>{accCmd}</pre>
                  </div>
                  {bc.accuracy.length > 1 && <p style={{
      fontSize: 11,
      opacity: 0.7,
      margin: "0 0 4px"
    }}>
                      Switch the benchmark chip to see each eval's command.
                    </p>}
                </div>}

              {bc.speed && <div>
                  <div style={s.sectionHeading}>Speed</div>
                  {bc.speed.concurrencies.length > 1 && <div style={s.benchChipRow}>
                      <span style={{
      fontSize: 11,
      opacity: 0.7
    }}>max-concurrency:</span>
                      {bc.speed.concurrencies.map(c => <button key={c} style={{
      ...s.benchChip,
      ...c === selConc ? s.benchChipActive : {}
    }} onClick={() => setBenchConc(c)}>
                          {c}
                        </button>)}
                    </div>}
                  <div style={{
      ...s.commandWrap,
      marginBottom: 6
    }}>
                    <div style={s.commandHeader}>
                      <div style={{
      fontSize: 11,
      opacity: 0.7
    }}>max-concurrency = {selConc}</div>
                      <button style={s.iconButton} onClick={() => copyBench("speed", speedCmd)}>
                        {benchCopied === "speed" ? "✓ Copied" : "⧉ Copy"}
                      </button>
                    </div>
                    <pre style={s.commandPre}>{speedCmd}</pre>
                  </div>
                  <p style={{
      fontSize: 11,
      opacity: 0.7,
      margin: "0 0 4px"
    }}>
                    One command — switch the concurrency chip (or edit <code>--max-concurrency</code>) to reproduce each Speed column.
                  </p>
                </div>}

              <p style={{
      fontSize: 11,
      opacity: 0.7,
      marginTop: 12
    }}>
                Edit <code>CURL_HOST</code> / <code>CURL_PORT</code> in the Env panel.
              </p>
            </div>
          </div>;
  })()}
    </div>;
};

## Deployment

<a id="install" />

<Accordion title="Install SGLang">
  For all methods and hardware platforms, see the [official SGLang installation guide](../../../docs/get-started/install). The two paths below match the **Python / Docker** toggle in the command panel.

  <Tabs>
    <Tab title="Python (pip / uv)">
      ```bash Command theme={null}
      pip install --upgrade pip
      pip install uv
      uv pip install --prerelease=allow sglang
      ```

      Then run the **Python** output of the command panel below in that environment.
    </Tab>

    <Tab title="Docker">
      For how to launch the image, see [Install → Method 3: Using Docker](../../../docs/get-started/install#method-3-using-docker). A minimal example (substitute the inner `sglang serve ...` with whatever the command generator below produces):

      **NVIDIA GPUs**

      A single image — `lmsysorg/sglang:latest` — covers the **datacenter GPUs** in this cookbook (B200 / B300 / GB200 / GB300 / H100 / H200 / RTX PRO 6000). The one exception is **Flash Vision (Exp)**, whose support has not shipped in a release yet: its cells use the preview image `lmsysorg/sglang:dev-dsv4-flash-vision` (the command panel picks it automatically — see the [Flash Vision notes](#vision-note)). **DGX Spark** is the other exception: its three cells (Flash Official FP4, Flash Official NVFP4, Flash Vision FP4) use the DGX Spark–only preview image `lmsysorg/sglang:dev-v4f-2dgx-v2` (the command panel picks it automatically — see the [DGX Spark notes](#spark-note)); do not use that image on any other hardware.

      ```bash Command theme={null}
      docker pull lmsysorg/sglang:latest

      docker run --gpus all \
          --shm-size 32g \
          -p 30000:30000 \
          -v ~/.cache/huggingface:/root/.cache/huggingface \
          --env "HF_TOKEN=<your-hf-token>" \
          --ipc=host \
          lmsysorg/sglang:latest \
          sglang serve <use args below>
      ```

      **AMD GPUs (ROCm)**

      AMD uses the daily-updated `lmsysorg/sglang-rocm` images. You can find the latest images on [Docker Hub](https://hub.docker.com/r/lmsysorg/sglang-rocm/tags). We recommend the ROCm 7.2 version.

      For example:

      * **MI355X** → `lmsysorg/sglang-rocm:v0.5.19-rocm720-mi35x-20260911`
      * **MI300X** → `lmsysorg/sglang-rocm:v0.5.19-rocm720-mi30x-20260911`

      ```bash Command theme={null}
      docker pull lmsysorg/sglang-rocm:v0.5.19-rocm720-{mi35x,mi30x}-20260911

      docker run \
          --device=/dev/kfd --device=/dev/dri \
          --group-add video \
          --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
          --shm-size 32g --ipc=host \
          -p 30000:30000 \
          -v ~/.cache/huggingface:/root/.cache/huggingface \
          --env "HF_TOKEN=<your-hf-token>" \
          lmsysorg/sglang-rocm:v0.5.19-rocm720-{mi35x,mi30x}-20260911 \
          sglang serve <use args below>
      ```
    </Tab>
  </Tabs>
</Accordion>

Pick your hardware + recipe to generate the launch command. The three serving strategies cover the common operating points:

* **Low-Latency** — fastest reply for a single user. Pick for chat.
* **Balanced** — good speed with several users at once. Use for typical multi-user serving.
* **High-Throughput** — most tokens per second across many users. Best for batch jobs.

<Note>
  The **Flash Vision (Exp)** variant runs on a dedicated preview Docker image, `lmsysorg/sglang:dev-dsv4-flash-vision` — its support ([sgl-project/sglang#37253](https://github.com/sgl-project/sglang/pull/37253)) has not shipped in a release yet. The command panel's Docker mode emits that image automatically for Flash Vision cells; see the [Flash Vision notes](#vision-note).
</Note>

<Deployment config={config} benchmarks={benchmarks} />

<Note>
  For a runnable end-to-end example, see the [DeepSeek-V4-Flash demo notebook](https://github.com/sgl-project/sglang/blob/main/docs/demo/deepseek_v4_flash.ipynb).
</Note>

<div style={{fontSize: "0.85em", lineHeight: "1.55", color: "#6b7280", margin: "0.5rem 0 1rem 0"}}>
  <p style={{margin: "0 0 0.3rem 0"}}><strong>Panel controls</strong> (top of the command box):</p>

  <ul style={{margin: 0, paddingLeft: "1.25rem"}}>
    <li style={{marginBottom: "0.2rem"}}><strong>Python / Docker</strong> — bare <code>sglang serve …</code> for an existing SGLang env, or a <code>docker run … sglang serve …</code> wrap against the per-hardware image from the <a href="#install">Install SGLang</a> panel above.</li>
    <li style={{marginBottom: "0.2rem"}}><strong>⧉ Copy</strong> — copies the current command (with whichever framing is active) to your clipboard.</li>
    <li style={{marginBottom: "0.2rem"}}><strong>\$ cURL</strong> — a sample request against <code>localhost:30000</code> to confirm the server is up.</li>
    <li style={{marginBottom: "0.2rem"}}><strong>⚙ Env</strong> — edits the placeholders (<code>HOST\_IP</code>, <code>PORT</code>, <code>HF\_TOKEN</code>, <code>NODE\_RANK</code>, <code>NODE0\_IP</code>) the command and cURL share. Persists in localStorage across cookbooks.</li>
    <li><strong>Verified / Not Verified</strong> badge — green when the <code>(hw, variant, quant, strategy, nodes)</code> combo has been run end-to-end on real hardware; yellow when auto-derived from a neighbor and not yet re-checked.</li>
  </ul>
</div>

## Playground

The Playground is where you experiment with **SGLang features beyond the verified matrix**. The Deploy panel above only emits combinations the SGLang team has signed off on; the Playground lets you turn on additional knobs on top of whichever cell the Deploy panel is currently showing. The base is read live from your Deploy selection — only your overrides change.

The knobs come in two flavors:

* **Built-in SGLang features** — parallelism overrides (TP / CP / DP-Attention — DP-Attention's value is the DP degree, with `off` to disable), MoE backend + EP, reasoning / tool-call parsers, speculative-decoding presets, prefill/decode disaggregation, HiCache tiers, and HiSparse hierarchical sparse attention (decode-role only — the card appears once PD-Disagg mode is set to decode).
* **DeepSeek-V4 specific features** — MegaMoE W4A8 / W4A4 fused kernel (Blackwell only; Hopper SM90 uses a separate all-FP8 MegaMoE path — see Configuration Tips below).

Lines highlighted **green** are added by your overrides; lines with **red strikethrough** were in the verified base but stripped by an override. When no override differs from the base cell, the playground inherits the base's **Verified** badge; any actual change flips it to **Not Verified** until the new configuration is run end-to-end and submitted back.

<Playground config={config} />

<div style={{fontSize: "0.85em", lineHeight: "1.55", color: "#6b7280", margin: "0.5rem 0 1rem 0"}}>
  <p style={{margin: "0 0 0.3rem 0"}}><strong>Panel controls</strong> reuse <strong>Python / Docker</strong> · <strong>⧉ Copy</strong> · <strong>\$ cURL</strong> · <strong>⚙ Env</strong> from the Deploy panel, plus one extra:</p>

  <ul style={{margin: 0, paddingLeft: "1.25rem"}}>
    <li><strong>Submit ↗</strong> — opens a pre-filled GitHub issue so you can land your override combo as a new verified cookbook cell. Shown only while the badge says <strong>Not Verified</strong>; click it once you've actually run the command on your hardware and confirmed it works.</li>
  </ul>
</div>

## 1. Model Introduction

**DeepSeek-V4** is the next-generation Mixture-of-Experts model from DeepSeek, released 2026-04-24 under an **MIT License**. The 0731 Flash and 0813 Pro refreshes add checkpoints with a bundled DSpark draft head, and the experimental Flash Vision checkpoint builds image understanding on top of the 0731 Flash base:

<table style={{width: "100%", borderCollapse: "collapse", tableLayout: "fixed"}}>
  <colgroup>
    <col style={{width: "30%"}} />

    <col style={{width: "15%"}} />

    <col style={{width: "15%"}} />

    <col style={{width: "40%"}} />
  </colgroup>

  <thead>
    <tr style={{borderBottom: "2px solid #d55816"}}>
      <th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.02)"}}>Variant</th>
      <th style={{textAlign: "right", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.05)"}}>Total params</th>
      <th style={{textAlign: "right", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.02)"}}>Active (MoE)</th>
      <th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.05)"}}>Use</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}><strong><a href="https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash">DeepSeek-V4-Flash</a></strong></td>
      <td style={{padding: "9px 12px", textAlign: "right", backgroundColor: "rgba(255,255,255,0.05)"}}><strong>284B</strong></td>
      <td style={{padding: "9px 12px", textAlign: "right", backgroundColor: "rgba(255,255,255,0.02)"}}>13B</td>
      <td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>single-node serving on B200 / B300 / GB200 / GB300 / H200 (TP=4); RTX PRO 6000 (TP=2); H100 (TP=8)</td>
    </tr>

    <tr>
      <td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}><strong><a href="https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-0731">DeepSeek-V4-Flash-0731</a></strong></td>
      <td style={{padding: "9px 12px", textAlign: "right", backgroundColor: "rgba(255,255,255,0.05)"}}><strong>304</strong></td>
      <td style={{padding: "9px 12px", textAlign: "right", backgroundColor: "rgba(255,255,255,0.02)"}}>13B</td>
      <td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Flash Official (0731), with a bundled DSpark draft head; verified on 8×B200, 4×GB300, and 4×H200</td>
    </tr>

    <tr>
      <td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}><strong><a href="https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-Vision-Exp">DeepSeek-V4-Flash-Vision-Exp</a></strong></td>
      <td style={{padding: "9px 12px", textAlign: "right", backgroundColor: "rgba(255,255,255,0.05)"}}><strong>305B</strong></td>
      <td style={{padding: "9px 12px", textAlign: "right", backgroundColor: "rgba(255,255,255,0.02)"}}>13B</td>
      <td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Flash Vision (Exp) — experimental multimodal (image-text-to-text): the 0731 Flash base + vision encoder & aligner; verified on 4×B200 (TP=4), requires the <a href="#vision-note">preview build</a></td>
    </tr>

    <tr>
      <td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}><strong><a href="https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro">DeepSeek-V4-Pro</a></strong></td>
      <td style={{padding: "9px 12px", textAlign: "right", backgroundColor: "rgba(255,255,255,0.05)"}}><strong>1.6T</strong></td>
      <td style={{padding: "9px 12px", textAlign: "right", backgroundColor: "rgba(255,255,255,0.02)"}}>49B</td>
      <td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>high-capacity: B200 / B300 (TP=8) · GB300 (TP=4) · H200 FP4 (TP=8) · GB200 (2-node, TP=8) · H200 FP8 (2-node, TP=16) · H100 (2-node, TP=16)</td>
    </tr>

    <tr>
      <td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}><strong><a href="https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro-0813">DeepSeek-V4-Pro-0813</a></strong></td>
      <td style={{padding: "9px 12px", textAlign: "right", backgroundColor: "rgba(255,255,255,0.05)"}}><strong>1.65T</strong></td>
      <td style={{padding: "9px 12px", textAlign: "right", backgroundColor: "rgba(255,255,255,0.02)"}}>49B</td>
      <td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Pro Official (0813), with a bundled DSpark draft head; verified on 4×GB300 (TP=4) · B200 / B300 / H200 FP4 (TP=8) · GB200 (2-node, TP=8) · H100 (2-node, TP=16) · MI355X</td>
    </tr>
  </tbody>
</table>

The Instruct checkpoints ship as **FP4 MoE experts + FP8 attention / dense** (one mixed-precision checkpoint covers every FP4-capable GPU). Matching `*-Base` repos ship pure FP8 mixed and are for further pre-training only — not for chat or tool calling.

**Highlights:** hybrid CSA + HCA attention (\~27% inference FLOPs / \~10% KV cache vs DSv3.2 at 1M context), manifold-constrained hyper-connections (mHC), Muon optimizer, **1M-token context** (32T+ pre-training tokens), three reasoning modes (*Non-think* / *Think High* / *Think Max* — use ≥ 384K context for Think Max), and a dedicated `encoding_dsv4.encode_messages` Python encoder + DSML tool-call grammar.

**Recommended generation:** `temperature=1.0`, `top_p=1.0`.

**Resources:** HuggingFace · [Flash Official (0731)](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-0731) · [Flash](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash) · [Flash Vision (Exp)](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-Vision-Exp) · [Pro](https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro) · [Pro Official (0813)](https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro-0813)  ·  ModelScope · [Flash](https://modelscope.cn/models/deepseek-ai/DeepSeek-V4-Flash) · [Pro](https://modelscope.cn/models/deepseek-ai/DeepSeek-V4-Pro).

## 2. Configuration Tips

**Concurrency & DeepEP dispatch buffer**

Must hold: `max-running-requests × MTP_draft_tokens ≤ SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK`. Violating it blows DeepEP's dispatch buffer at steady-state load (`deep_ep.cpp:1105`). When tuning, move `--cuda-graph-max-bs-decode`, `--max-running-requests`, and the env together.

The generator currently picks values on the **conservative** side (mirroring an internal stress-test matrix). They run safely out of the box but likely leave throughput on the table — please tune them up toward your actual workload's peak concurrency and report findings back so the defaults can be revised.

**Speculative decoding**

The original Flash and Pro recipes use EAGLE. Flash Official (0731) and Pro Official (0813) use the bundled DSpark draft head; see [DSpark](#3-4-dspark-speculative-decoding) for its launch and tuning notes.

<Warning>
  Do not use EAGLE on the checkpoints that bundle a DSpark head. On 0813, `--speculative-algorithm EAGLE` starts and serves without any error, but the draft head it binds accepts nothing — every decode batch logs `accept len: 1.00, accept rate: 0.00`, so you pay the draft cost for zero speedup. Output stays correct, which is what makes it easy to miss. Switch to `--speculative-algorithm DSPARK`; the startup log then reports `Draft checkpoint bundles a DSpark head`.
</Warning>

For the original Flash and Pro checkpoints:

* `low-latency`: steps=3, draft-tokens=4 → largest win at bs=1.
* `balanced`: steps=1, draft-tokens=2 → gentler MTP, reduces throughput hit at higher batch.
* `high-throughput`: MTP disabled — at saturation the verify step costs more than it saves.
* MTP runs on the v2 speculative path.

<a id="spark-note" />

**DGX Spark (2x GB10): Flash Official FP4 / NVFP4, Flash Vision FP4**

The **DGX Spark** row has three recipes, all **Balanced · Multi-Nodes**: **Flash Official (0731) · FP4**, **Flash Official (0731) · NVFP4**, and **Flash Vision (Exp) · FP4**. None of these checkpoints fits one 128GB GB10, so every recipe runs TP=2 across two DGX Sparks connected over ConnectX-7 (RoCE). Every other DGX Spark combination is greyed out on purpose.

* **Docker image** — all three cells use `lmsysorg/sglang:dev-v4f-2dgx-v2`, a preview build made **only for DGX Spark** (branch `b12x-vision` @ `452239a74f`): it bakes in the SM12x `b12x` MoE (W4A8) and compressed-MLA attention kernels ([#34878](https://github.com/sgl-project/sglang/pull/34878), [#35899](https://github.com/sgl-project/sglang/pull/35899), [#34018](https://github.com/sgl-project/sglang/pull/34018)), the Flash Vision model support ([#37253](https://github.com/sgl-project/sglang/pull/37253)), the b12x image-prefill fix that lets Flash Vision serve images on SM12x, the NVFP4 MTP-layer dispatch fix, and the CuTeDSL and NCCL pins the GB10 pair needs. Do not use it on other hardware, and use the panel's Docker mode — the bare Python command needs the `b12x` kernel package this image ships.
* **Run the same command on both Sparks** with `--node-rank 0` / `--node-rank 1` and `--dist-init-addr` pointing at node 0 over the ConnectX-7 link. The `docker run` flags the panel emits (`--network host --ulimit memlock=-1:-1 --cap-add IPC_LOCK --device /dev/infiniband`) are what let NCCL use RDMA; without them NCCL silently falls back to TCP and decode slows by roughly 40%.
* **Env knobs** in the cells are part of the recipe: `SGLANG_SM120_FLASHMLA_BACKEND=b12x` selects the b12x attention path, `SGLANG_B12X_MAX_TOKENS` must equal `--chunked-prefill-size`, and `PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True` avoids unified-memory fragmentation OOMs on GB10.
* **NVFP4 (`nvidia/DeepSeek-V4-Flash-0731-NVFP4`)** — only the routed experts are NVFP4; attention, shared experts and the DSpark MTP layer stay in the checkpoint's native formats. On SM12x that means three extra flags: `--moe-runner-backend flashinfer_cutlass` (b12x's MoE is MXFP4-only and trtllm-gen kernels are sm100-only), `--speculative-moe-runner-backend b12x` (the DSpark draft's MTP experts are MXFP4 and run on b12x), and `--disable-shared-experts-fusion` (HashTopK rejects fused shared experts under the cutlass runner). Throughput and DSpark acceptance match the FP4 cell within noise.
* **Flash Vision** — images are served natively on the b12x recipe with the same flags as Flash Official (send `image_url` content on `/v1/chat/completions`, see [Vision](#3-5-vision-image-inputs)); text-only requests work unchanged. Expect roughly 15–20% lower text throughput than Flash Official on this checkpoint — its bundled DSpark head accepts fewer drafts (\~3.2 vs \~3.9) — with text accuracy intact.

<a id="vision-note" />

**DeepSeek-V4-Flash-Vision-Exp (Experimental)**

[`deepseek-ai/DeepSeek-V4-Flash-Vision-Exp`](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-Vision-Exp) is DeepSeek's first experimental multimodal V4 checkpoint: the 0731 Flash base plus a vision encoder and aligner, served through the same `sglang serve` flow with OpenAI-style `image_url` inputs (see [Vision](#3-5-vision-image-inputs) below). Select the **Flash Vision** variant in the Deploy panel for its recipes.

* **Preview build required** — support lands via [sgl-project/sglang#37253](https://github.com/sgl-project/sglang/pull/37253) and has not shipped in a release. Docker mode on the Flash Vision cells already emits the preview image `lmsysorg/sglang:dev-dsv4-flash-vision`; for a Python environment, install SGLang from that PR's branch. The DGX Spark Flash Vision cell is the exception: it uses the DGX Spark image `lmsysorg/sglang:dev-v4f-2dgx-v2` (see the [DGX Spark notes](#spark-note)).
* **Verified matrix** — MMMU-Pro via sgl-eval at `temperature 1.0`, `top-p 0.95`, `--reasoning-effort max`.
* **Engine auto-configuration** — the engine picks the `flashinfer_mxfp4` MoE runner and auto-disables shared-experts fusion for this checkpoint (its HashTopK routing rejects fused shared experts); don't pass `--enforce-shared-experts-fusion`.
* **Chunked prefill & radix cache stay enabled** — the scheduler keeps image spans consistent automatically: chunked-prefill truncation points are span-aligned (an image span always prefills within a single extend, overshooting the chunk budget by at most one span), and a radix-cache prefix match ending deep inside an image span is re-issued from the span start.
* **Speculative decoding** — the checkpoint bundles a DSpark head, and the low-latency recipes enable it with `--speculative-algorithm DSPARK` (verified with image batches on B200 via the MMMU-Pro round; the other hardware rows are pending verification). The balanced and high-throughput recipes run target-only: they use DP Attention, which DSpark is incompatible with on current releases. As on the 0731/0813 checkpoints, do not pass the EAGLE flags.

**Shared experts fusion (Blackwell, flashinfer\_mxfp4)**

On the Blackwell fp4 recipes (`--moe-runner-backend flashinfer_mxfp4`), the shared expert runs as a separate FP8 MLP on an alternate stream by default. Adding:

```bash Command theme={null}
--enforce-shared-experts-fusion
```

routes it as one extra MXFP4 expert through the same trtllm-gen MoE kernel, so the whole MoE runs on a single stream (\~4 fewer kernel launches and 2 fewer stream syncs per MoE layer). The shared expert is requantized from FP8 to MXFP4 at load time. Measured on GB200 tp4: gsm8k and AIME25 accuracy on par with the unfused baseline; Mean TTFT -13% to -21% and P99 ITL -15% to -53% at QPS 1-8 with neutral throughput.

Only for deployments without expert parallelism (e.g. the single-node low-latency recipes): with `moe_ep_size > 1` the flag is rejected at startup, unless the DeepEP/MegaMOE per-rank shared-slot path is in use. Not applicable to [Flash Vision (Exp)](#vision-note) — the engine auto-disables the fusion on that checkpoint.

**Compressed attention state dtype**

DeepSeek-V4 uses hybrid compressed attention for long-context efficiency. `SGLANG_DSV4_COMPRESS_STATE_DTYPE` controls the dtype of the C4 / C128 compressed attention state pools. Supported values are `float32` / `fp32` (default: `float32`) and `bfloat16` / `bf16`. For BF16 on the offline compression path:

```bash Command theme={null}
SGLANG_DSV4_COMPRESS_STATE_DTYPE=bf16 \
sglang serve \
  --model-path deepseek-ai/DeepSeek-V4-Flash \
  <other args>
```

This BF16 setting applies only to the compressed attention state pools and reduces the GPU memory footprint of each compressed-state slot. It does not change model weight precision or the main KV cache dtype. With automatic pool sizing and no explicit capacity cap, the same memory budget holds more slots, and the startup log shows larger `c4_state` and `c128_state` pool sizes. Keep the default `float32` setting for the most conservative behavior.

**EPLB + Waterfill (Experimental)**

For recorded/static EPLB reproduction, first record an expert-distribution file by following
[Capture expert selection distribution in MoE models](../../../docs/basic_usage/native_api.mdx#capture-expert-selection-distribution-in-moe-models).
For reproduction runs, use the generated `expert_distribution_recorder_*.pt` as
the initial expert location. **Please checkout to latest main branch for this feature.**

For non-PD reproduction, use:

```bash Command theme={null}
--moe-a2a-backend deepep \
--deepep-mode auto \
--init-expert-location /path/to/expert_distribution_recorder_*.pt \
--enable-waterfill
```

For PD-Disagg reproduction, use `normal` mode on the prefill server and
`low_latency` mode on the decode server. Add the same `--init-expert-location`
flag to both commands:

```bash Command theme={null}
# prefill
--moe-a2a-backend deepep \
--deepep-mode normal \
--init-expert-location /path/to/expert_distribution_recorder_*.pt \
--enable-waterfill

# decode
--moe-a2a-backend deepep \
--deepep-mode low_latency \
--init-expert-location /path/to/expert_distribution_recorder_*.pt \
--enable-waterfill
```

You can also add `--ep-num-redundant-experts` and `--eplb-algorithm` to customize
EPLB placement.

Waterfill also supports MegaMOE. Use `--moe-a2a-backend megamoe --enable-waterfill` to keep the MegaMOE backend while applying Waterfill to the
fused shared expert slot.

**FP4 Indexer (Experimental)**

DeepSeek-V4 uses the default indexer path unless `--enable-deepseek-v4-fp4-indexer` is set. Enable this flag to use the experimental FP4 C4 indexer. This path is intended for decode-heavy long-context workloads where reducing indexer cache bandwidth is beneficial.

On **NVIDIA (SM100 / SM120)**, pair the flag with DeepGEMM FP4 indexer support and the FlashInfer MXFP4 MoE runner:

```bash Command theme={null}
# Please use the latest main branch for this feature.
sglang serve \
  --model-path deepseek-ai/DeepSeek-V4-Flash \
  --tp 4 \
  --moe-runner-backend flashinfer_mxfp4 \
  --enable-deepseek-v4-fp4-indexer
```

On **AMD MI355X (gfx95)**, the AITER FP4 indexer kernels are available on ROCm. Keep the standard MI355 recipe and add only the indexer flag. Do not need to pass `--moe-runner-backend flashinfer_mxfp4`:

```bash Command theme={null}
# Please use the latest ROCm image for this feature.
sglang serve \
  --model-path deepseek-ai/DeepSeek-V4-Pro \
  --tp 8 \
  --attention-backend dsv4 \
  --enable-deepseek-v4-fp4-indexer \
  <other args from the Deploy panel>
```

**NVFP4 Hybrid Checkpoints**

The [`nvidia/DeepSeek-V4-Pro-NVFP4`](https://huggingface.co/nvidia/DeepSeek-V4-Pro-NVFP4) and
[`nvidia/DeepSeek-V4-Flash-NVFP4`](https://huggingface.co/nvidia/DeepSeek-V4-Flash-NVFP4) checkpoints
quantize MoE experts to **NVFP4** while keeping attention and dense layers in
**FP8**. The official releases have matching NVFP4 checkpoints at
[`nvidia/DeepSeek-V4-Flash-0731-NVFP4`](https://huggingface.co/nvidia/DeepSeek-V4-Flash-0731-NVFP4) and
[`nvidia/DeepSeek-V4-Pro-0813-NVFP4`](https://huggingface.co/nvidia/DeepSeek-V4-Pro-0813-NVFP4).
All of them require `--moe-runner-backend flashinfer_trtllm_routed` which will be automatically selected if not provided.

```bash Command theme={null}
sglang serve \
  --model-path nvidia/DeepSeek-V4-Pro-NVFP4 \
  --tp 8
```

or

```bash Command theme={null}
sglang serve \
  --model-path nvidia/DeepSeek-V4-Flash-NVFP4 \
  --tp 8
```

Requires Blackwell (SM100+). The MTP layer in this checkpoint stays
MXFP4-packed and is routed through the `Mxfp4FlashinferTrtllmMoEMethod` path
automatically.

The official (0731 / 0813) NVFP4 checkpoints preserve the bundled DSpark draft
head, so their low-latency recipes use `--speculative-algorithm DSPARK` instead
of the EAGLE/MTP shape flags — same as the corresponding original-precision
official checkpoints.

<a id="hopper-note" />

**Hopper (H100 / H200) note**

Two options are available for running DeepSeek-V4 on Hopper:

* **Original FP4 checkpoints** — run the MoE experts with W4A16 kernels (Marlin or the FlashInfer SM90 CUTLASS runner) as the command generator picks for Hopper cells. With FlashInfer >= 0.6.18 you can instead select the **W4A8** path — MXFP4 weights with FP8 activations via FlashInfer's Humming kernels — by adding `--flashinfer-mxfp4-moe-precision fp8` to `--moe-runner-backend flashinfer_mxfp4`; the low-latency Hopper cells now generate this form. Both work on H100 and H200; FP4 is the only option for H100 (no FP8 path). It is TP-only; on H200 the Pro variant fits on a single 8-GPU node, while H100 Pro needs 2 nodes (TP=16).
* **Converted FP8 checkpoints** (H100 and H200 only) — pre-repackaged FP8 weights at [`sgl-project/DeepSeek-V4-Flash-FP8`](https://huggingface.co/sgl-project/DeepSeek-V4-Flash-FP8) and [`sgl-project/DeepSeek-V4-Pro-FP8`](https://huggingface.co/sgl-project/DeepSeek-V4-Pro-FP8) unlock DP-attention + DeepEP and richer parallelism (e.g. Pro TP=16 across 2 nodes).

On these FP8 checkpoints you can additionally enable the all-FP8 **MegaMoE** path on SM90 for higher long-context / large-decode throughput — see the **SM90 (Hopper) FP8 MegaMoE** note in Configuration Tips below.

PD-Disagg recipes on H200 may require `docker run --privileged --ulimit memlock=-1`
(or `--device /dev/infiniband:/dev/infiniband --cap-add IPC_LOCK`) so mooncake
can discover the IB HCAs; without IB exposure mooncake silently falls back to
TCP, which can lead to garbled KV transfer on large checkpoints.

**RTX PRO 6000 (SM120 / Blackwell Desktop) note**

RTX PRO 6000 (96 GB) runs **Flash only** with the FlashInfer MXFP4 MoE runner.
V4-Pro doesn't fit on 8× 96 GB; the Deploy panel greys out unsupported recipes.
HiCache and MegaMoE are **not** supported on RTX PRO 6000.

**AMD (MI300X / MI355X) note**

* **Model checkpoints** — for correct accuracy, the FP4 model uses the stock `deepseek-ai/DeepSeek-V4-{Flash,Pro}`, and the FP8 model uses the repackaged `sgl-project/DeepSeek-V4-{Flash,Pro}-FP8`.
* **Supported models** — **MI300X** supports DeepSeek-V4-Flash in FP8; **MI355X** supports DeepSeek-V4-Flash / Pro in both FP4 and FP8. All recipes run single-node.
* **TP / DP setting (MI355X)** — both TP=4 and TP=8 are supported. At low concurrency we recommend **TP-only**; at high concurrency use **TP + DP** (balanced / high-throughput recipes). The verified MI355X DP recipes additionally set `--dp 8 --enable-dp-attention --enable-dp-attention-local-control-broadcast --tokenizer-worker-num 8 --stream-interval 20 --prefill-decode-interval 10`.
* **MTP** — speculative decoding on the original Flash / Pro checkpoints; add `--speculative-algorithm EAGLE --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4`. The 0813 Pro Official checkpoint keeps its MTP head too, so the same flags are the speculative option under PD disaggregation — see the DSpark note below.
* **DSpark (MI355X Pro Official 0813)** — the 0813 checkpoint bundles the DSpark draft head. Prefer it over EAGLE on 0813 for ordinary serving: enable `--speculative-algorithm DSPARK` (low-latency) and see the [MI355X agentic recipe](#3-7-agentic-long-context-with-hicache-dram-offload-mi355x-fp4-dspark) for the long-context path. The one exception is **PD disaggregation**, where DSpark cannot run at all and the Playground strips it — there, fall back to the MTP 3-1-4 shape above, as in [§3.8](#3-8-pd-disaggregation-on-mi355x-mori-io).
* **Kernels** — uses the Unified KV attention and the flydsl MoE.
* **FP4 indexer (MI355X)** — FP4 C4 indexer is supported via `--enable-deepseek-v4-fp4-indexer` on top of the standard ROCm recipe.
* **Agentic long-context (MI355X Pro Official FP4)** — TP-only serving adds `--prefill-decode-interval 10` for scheduler stability. The DP path additionally needs `--enable-dp-lm-head` (required for DSpark under DP attention), `--enable-prefill-delayer --prefill-delayer-token-usage-low-watermark 0.7` so a single long prefill does not monopolise the engine, plus the flags in the [MI355X agentic recipe](#3-7-agentic-long-context-with-hicache-dram-offload-mi355x-fp4-dspark).

**MoRI EP (AMD expert parallelism)**

On AMD, expert parallelism uses the **MoRI** all-to-all backend (`--moe-a2a-backend mori`), not DeepEP. Add the flags below on top of the verified recipe when sharding experts across GPUs; set `--ep-size` to the EP degree (typically the GPU count on one node).

Two optional env vars improve MoRI throughput (both off by default):

```bash Command theme={null}
export SGLANG_MORI_DISPATCH_DTYPE=mxfp8
export SGLANG_MORI_RECV_BOUND=1

sglang serve \
  --model-path {MODEL_PATH} \
  --tp 8 --dp 8 --enable-dp-attention \
  --ep-size 8 --moe-a2a-backend mori --deepep-mode normal \
  <other args from the Deploy panel>
```

* **FP4**: enable both env vars.
* **FP8**: use `SGLANG_MORI_RECV_BOUND=1` only; omit `SGLANG_MORI_DISPATCH_DTYPE=mxfp8`.

**MegaMoE**

MegaMoE fuses expert dispatch + GEMM into a single kernel for higher throughput
on MoE layers. To enable it, use the **MegaMoE** chip in the Playground
below — the playground will swap `--moe-a2a-backend deepep` for
`--moe-a2a-backend megamoe` and add the relevant launch settings automatically.

Two variants are exposed:

* **W4A8** — default MegaMoE kernel (FP4 weights, FP8 activations).
* **W4A4** — adds `--enable-w4a4-mxfp4-megamoe` to run the custom W4A4 kernel
  (FP4 activations). The flag configures the required DeepGEMM settings.
  Higher throughput with negligible accuracy drop (\~89.5 GPQA on Pro).

Notes:

* The W4A8 / W4A4 variants above are **Blackwell-only** (B200 / B300 / GB200 / GB300). On **Hopper (SM90, H100 / H200)** use the all-FP8 MegaMoE path described below instead.
* MegaMoE is **only wired into the `high-throughput` recipe** on Blackwell (per [sgl-project/sglang#26451](https://github.com/sgl-project/sglang/pull/26451)). The chip is hidden on `low-latency` and `balanced` — switch to `high-throughput` to expose it.
* When running MegaMoE, don't set `--moe-runner-backend` manually.
* Adjust `SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK` based on your workload and memory usage. Setting higher number of tokens for MegaMoE requires more HBM space (recommended: 8320 for high-throughput).

**SM90 (Hopper) FP8 MegaMoE (Experimental)**

On SM90 (Hopper, H100 / H200), the all-FP8 MegaMoE path routes MoE through the
DeepGEMM `mega_moe` runner for higher long-context / large-decode throughput on
the FP8 checkpoints. Unlike the Blackwell W4A8 / W4A4 variants above, experts
stay in **FP8** — keep `SGLANG_DSV4_FP4_EXPERTS=0`. It requires a `sgl-deep-gemm`
build with SM90 FP8 MegaMoE support. **Please use the latest image for this
feature.**

Enable the MegaMoE path with `--moe-a2a-backend megamoe`

```bash Command theme={null}
SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=4096 \
SGLANG_DSV4_FP4_EXPERTS=0 \
sglang serve \
  --model-path sgl-project/DeepSeek-V4-Flash-FP8 \
  --tp 8 \
  --moe-a2a-backend megamoe \
  --chunked-prefill-size 4096
```

`SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK` caps the number of tokens
the MegaMoE path processes per rank (i.e. per GPU); the MegaMoE path is only used
for batches at or below this cap. The right value depends on your parallelism /
token-split scheme, and larger values reserve more HBM.

**GB300 PD-Disagg cross-pod MNNVL**

On some GB300 clusters with cross-pod KV transfer over NVLink, mooncake may
fail with `nvlink_transport.cpp:497 Requested address ... not found!`. If
this happens, prepend `MC_FORCE_MNNVL=1 NCCL_MNNVL_ENABLE=1 NCCL_CUMEM_ENABLE=1`
to both prefill and decode `sglang serve` commands.

## 3. Advanced Usage

### 3.1 Reasoning

Enable the `deepseek-v4` reasoning parser (toggle **Reasoning Parser** in the **Parsers** card of the [Playground above](#playground)) to separate thinking from the final answer into `reasoning_content` vs `content`.

<Accordion title="Streaming with Thinking Process (Python)">
  ```python Example theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="http://localhost:30000/v1",
      api_key="EMPTY"
  )

  response = client.chat.completions.create(
      model="deepseek-ai/DeepSeek-V4-Flash",
      messages=[
          {"role": "user", "content": "Solve this problem step by step: What is 15% of 240?"}
      ],
      max_tokens=2048,
      extra_body={"chat_template_kwargs": {"thinking": True}},
      stream=True,
  )

  thinking_started = False
  has_thinking = False
  has_answer = False

  for chunk in response:
      if not chunk.choices:
          continue
      delta = chunk.choices[0].delta

      if getattr(delta, "reasoning_content", None):
          if not thinking_started:
              print("=============== Thinking =================", flush=True)
              thinking_started = True
          has_thinking = True
          print(delta.reasoning_content, end="", flush=True)

      if delta.content:
          if has_thinking and not has_answer:
              print("\n=============== Content =================", flush=True)
              has_answer = True
          print(delta.content, end="", flush=True)

  print()
  ```
</Accordion>

<Accordion title="Example Output">
  ```text Output theme={null}
  We are asked: "What is 15% of 240?" This is a simple percentage problem. I need to provide a step-by-step solution. The user wants the solution explained step by step. I'll calculate 15% of 240: 0.15 * 240 = 36. I'll break it down into steps: understand what percent means, convert percentage to decimal or fraction, then multiply. I'll present the answer clearly.</think>To find 15% of 240, follow these steps:

  **Step 1: Understand the meaning of percent**
  "Percent" means "per hundred," so 15% means 15 out of every100, or \( \frac{15}{100} \).

  **Step2: Convert the percentage to a decimal or fraction**
  \( 15\% = \frac{15}{100} = 0.15 \)

  **Step3: Multiply by the given number**
  Multiply the decimal form by 240:
  \( 0.15 \times 240 \)

  **Step4: Perform the multiplication**
  \( 0.15 \times 240 = 36 \)

  **Answer:** 15% of 240 is **36**.
  ```
</Accordion>

### 3.2 Tool Calling

Enable the `deepseekv4` tool-call parser (toggle **Tool Call Parser** in the **Parsers** card of the [Playground above](#playground)) to surface structured tool calls via `message.tool_calls`.

<Accordion title="Python Example with Thinking Process">
  ```python Example theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="http://localhost:30000/v1",
      api_key="EMPTY"
  )

  tools = [
      {
          "type": "function",
          "function": {
              "name": "get_weather",
              "description": "Get the current weather for a location",
              "parameters": {
                  "type": "object",
                  "properties": {
                      "location": {"type": "string", "description": "The city name"},
                      "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
                  },
                  "required": ["location"],
              },
          },
      }
  ]

  response = client.chat.completions.create(
      model="deepseek-ai/DeepSeek-V4-Flash",
      messages=[{"role": "user", "content": "What's the weather in Beijing?"}],
      tools=tools,
      extra_body={"chat_template_kwargs": {"thinking": True}},
      stream=True,
  )

  thinking_started = False
  has_thinking = False
  tool_calls_accumulator = {}

  for chunk in response:
      if not chunk.choices:
          continue
      delta = chunk.choices[0].delta

      if getattr(delta, "reasoning_content", None):
          if not thinking_started:
              print("=============== Thinking =================", flush=True)
              thinking_started = True
          has_thinking = True
          print(delta.reasoning_content, end="", flush=True)

      if getattr(delta, "tool_calls", None):
          if has_thinking and thinking_started:
              print("\n=============== Content =================\n", flush=True)
              thinking_started = False
          for tool_call in delta.tool_calls:
              index = tool_call.index
              if index not in tool_calls_accumulator:
                  tool_calls_accumulator[index] = {"name": None, "arguments": ""}
              if tool_call.function:
                  if tool_call.function.name:
                      tool_calls_accumulator[index]["name"] = tool_call.function.name
                  if tool_call.function.arguments:
                      tool_calls_accumulator[index]["arguments"] += tool_call.function.arguments

      if delta.content:
          print(delta.content, end="", flush=True)

  for index, tool_call in sorted(tool_calls_accumulator.items()):
      print(f"Tool Call: {tool_call['name']}")
      print(f"   Arguments: {tool_call['arguments']}")

  print()
  ```
</Accordion>

<Accordion title="Example Output">
  ```text Output theme={null}
  The user wants to know the weather in Beijing. I'll use the get_weather function with Beijing as the location. I don't need to specify a unit, so I'll just use the default.</think>

  <｜DSML｜tool_calls>
  <｜DSML｜invoke name="get_weather">
  <｜DSML｜parameter name="location" string="true">Beijing</｜DSML｜parameter>
  </｜DSML｜invoke>
  </｜DSML｜tool_calls>
  ```
</Accordion>

### 3.3 HiCache (Hierarchical KV Caching)

HiCache enables multi-tier KV cache offloading (GPU → CPU → Storage), significantly expanding effective context capacity for long-context and multi-turn scenarios. Combined with UnifiedRadixTree, it provides intelligent prefix caching across all tiers.

To enable HiCache, open the **HiCache** card in the [Playground above](#playground) and flip **Enable**:

* **L2 (GPU + CPU)** — leave Storage on `auto` (default). Cold KV pages spill to CPU pinned memory only.
* **L3 (GPU + CPU + Storage)** — pick a Storage backend (`file` / `mooncake` / `hf3fs` / `nixl`); the Playground emits the canonical `page_first_direct` mem-layout + `direct` IO backend + `wait_complete` prefetch policy, matching the [HiCache best-practices recipe](../../../docs/advanced_features/hicache_best_practices).

For AMD devices,

* **L2 (GPU + CPU)** — leave Storage on `auto` (default). Cold KV pages spill to CPU pinned memory only. Use `direct` IO backend + `page_first_direct` or `layer-first` mem-layout.
* **L3 (GPU + CPU + Storage)** — pick a Storage backend (`file`); the Playground emits the canonical `page_first_direct` mem-layout + `direct` IO backend + `wait_complete` prefetch policy, matching the [HiCache best-practices recipe](../../../docs/advanced_features/hicache_best_practices).

The Write policy knob defaults to `write_through` (the upstream default); switch to `write_back` / `write_through_selective` to trade durability for write speed when the storage tier is slow.

For more details, see the [HiCache documentation](../../../docs/advanced_features/hicache). For the alternative that skips the host tier entirely, see [§3.9 UMBP](#3-9-umbp-direct-external-kv-store) — it is a sibling of HiCache, not a storage backend for it, and the two cannot be enabled together.

### 3.4 DSpark (Speculative Decoding)

Flash Official (0731) and Pro Official (0813) bundle a DSpark draft head in `deepseek-ai/DeepSeek-V4-Flash-0731` and `deepseek-ai/DeepSeek-V4-Pro-0813`. The target and draft weights therefore come from the same checkpoint: enable DSpark with `--speculative-algorithm DSPARK` and do not set a separate `--speculative-draft-model-path`.

The experimental [Flash Vision checkpoint](#vision-note) also bundles a DSpark head, enabled the same way: the Flash Vision low-latency recipes ship with `--speculative-algorithm DSPARK` (verified with image batches on B200 via the MMMU-Pro round; other hardware rows pending). The balanced and high-throughput Flash Vision recipes stay target-only because they run DP Attention.

Unlike the EAGLE recipes for the original Flash and Pro checkpoints, this recipe omits `--speculative-num-steps`, `--speculative-eagle-topk`, and `--speculative-num-draft-tokens`. SGLang reads the DSpark shape from the checkpoint.

<Note>
  The Pro Official (0813) low-latency speed numbers in the Deploy panel were measured with `SGLANG_SIMULATE_ACC_LEN=4`, which pins the DSpark accept length at exactly 4.00. The recipe as shipped earns **4.678** on the same engine, so those rows read slightly conservative. The GSM8K figure for that cell is from the shipped command.
</Note>

The verified 4×GB300 FP4 low-latency command is:

```bash Command theme={null}
sglang serve \
  --trust-remote-code \
  --model-path deepseek-ai/DeepSeek-V4-Flash-0731 \
  --tp 4 \
  --moe-runner-backend flashinfer_mxfp4 \
  --speculative-algorithm DSPARK \
  --mem-fraction-static 0.90 \
  --chunked-prefill-size 4096 \
  --swa-full-tokens-ratio 0.1 \
  --host 0.0.0.0 \
  --port 30000
```

Keep `--mem-fraction-static 0.90` on this topology to leave enough headroom for the batch-256 verify graph. The first cold start can take 10–15 minutes while FlashInfer autotunes and SGLang captures the draft and verify graphs; later starts reuse the cache. This path is verified end-to-end on 4×GB300 with SGLang v0.5.16.

**Tune proposed draft tokens.** `--speculative-dspark-block-size N` asks DSpark to propose `N` tokens per step; the target verifies a window of `N + 1`. If the flag is omitted, SGLang reads the value from the checkpoint. Both the 0731 and 0813 checkpoints resolve to five proposed tokens (the startup log reports `gamma=5, verify_num_draft_tokens=6`), which is the verified default. Use the **DSpark Proposed Draft Tokens** slider in the [Playground](#playground) to sweep one through five.

Larger blocks can improve decode latency when acceptance stays high, but they also increase verification work and graph memory. Start from the checkpoint default, then sweep downward under the real prompt-length and concurrency distribution. The gain is usually largest for short interactive traffic and narrows as prefill dominates. Track P50/P99 TTFT and TPOT, total throughput, accepted length, GPU memory, and stop rate rather than choosing from acceptance alone.

For every candidate, compare with the same recipe without `--speculative-algorithm DSPARK`. Restart the server between the DSpark and non-speculative legs, keep the request corpus, sampling, concurrency, and warmup identical, and give each `bench_serving` leg its own `--flush-cache`. Leave `--speculative-draft-attention-backend` unset unless a separate profiling run justifies an override.

DSpark requires `pp_size == 1`. It is not compatible with PD disaggregation on current SGLang releases; selecting a prefill or decode role in the Playground automatically removes the inherited DSpark flags. The MI355X Flash Official recipes therefore run target-only, and so do the DP-Attention recipes in the Deploy panel — for DP-Attention configurations that do run DSpark, see the [B200 agentic recipe](#3-6-agentic-long-context-with-hicache-dram-offload-b200-fp4-dspark) and the [MI355X agentic recipe](#3-7-agentic-long-context-with-hicache-dram-offload-mi355x-fp4-dspark). If a larger draft block or concurrency causes graph-capture OOM, lower `--mem-fraction-static`, the draft block size, or the configured maximum running requests, then rerun both performance and accuracy gates.

### 3.5 Vision (Image Inputs)

The experimental [`DeepSeek-V4-Flash-Vision-Exp`](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-Vision-Exp) checkpoint (the **Flash Vision** variant in the Deploy panel — see the [configuration notes](#vision-note)) takes images via the OpenAI-compatible `image_url` content type, as public URLs or base64 `data:` URIs; text and images mix freely in one message. Vision input works with the same server the Deploy panel produces — no extra model-specific flags needed.

<Accordion title="Image Understanding (Python)">
  ```python Example theme={null}
  from openai import OpenAI

  client = OpenAI(base_url="http://localhost:30000/v1", api_key="EMPTY")

  response = client.chat.completions.create(
      model="deepseek-ai/DeepSeek-V4-Flash-Vision-Exp",
      messages=[{
          "role": "user",
          "content": [
              {"type": "image_url",
               "image_url": {"url": "https://raw.githubusercontent.com/sgl-project/sglang/main/examples/assets/example_image.png"}},
              {"type": "text", "text": "Describe this image in a few sentences."},
          ],
      }],
  )

  message = response.choices[0].message
  if getattr(message, "reasoning_content", None):
      print("=============== Thinking =================")
      print(message.reasoning_content)
  print("=============== Content =================")
  print(message.content)
  ```
</Accordion>

<Accordion title="Example Output">
  ```text Output theme={null}
  Pending update...
  ```
</Accordion>

### 3.6 Agentic Long-Context with HiCache DRAM Offload (B200 FP4, DSpark)

**TP8, concurrency 8–16:**

```bash Command theme={null}
SGLANG_ENABLE_UNIFIED_RADIX_TREE=1 \
python3 -m sglang.launch_server \
  --model-path deepseek-ai/DeepSeek-V4-Pro-0813 \
  --trust-remote-code \
  --tp 8 \
  --moe-runner-backend flashinfer_mxfp4 \
  --enable-deepseek-v4-fp4-indexer \
  --disable-flashinfer-autotune \
  --mem-fraction-static 0.90 \
  --swa-full-tokens-ratio 0.1 \
  --chunked-prefill-size 8192 \
  --tool-call-parser deepseekv4 \
  --reasoning-parser deepseek-v4 \
  --speculative-algorithm DSPARK \
  --speculative-dspark-block-size 6 \
  --enable-hierarchical-cache \
  --hicache-ratio 2.75 \
  --hicache-write-policy write_through \
  --hicache-io-backend direct \
  --hicache-mem-layout page_first_direct
```

DSv4 HiCache sizes the host tier with `--hicache-ratio` (host/device token ratio), not `--hicache-size`. Concurrency 1–5 runs the same command without the HiCache flags.

**DEP8 (DP Attention), concurrency 64–160:**

```bash Command theme={null}
SGLANG_ENABLE_UNIFIED_RADIX_TREE=1 \
SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320 \
python3 -m sglang.launch_server \
  --model-path deepseek-ai/DeepSeek-V4-Pro-0813 \
  --trust-remote-code \
  --tp 8 \
  --dp 8 \
  --enable-dp-attention \
  --enable-dp-lm-head \
  --ep-size 8 \
  --moe-a2a-backend megamoe \
  --enable-w4a4-mxfp4-megamoe \
  --enable-deepseek-v4-fp4-indexer \
  --disable-shared-experts-fusion \
  --disable-flashinfer-autotune \
  --mem-fraction-static 0.88 \
  --swa-full-tokens-ratio 0.02 \
  --chunked-prefill-size 49152 \
  --tool-call-parser deepseekv4 \
  --reasoning-parser deepseek-v4 \
  --speculative-algorithm DSPARK \
  --speculative-dspark-block-size 6 \
  --enable-hierarchical-cache \
  --hicache-ratio 8 \
  --hicache-write-policy write_through \
  --hicache-io-backend direct \
  --hicache-mem-layout page_first_direct
```

`--chunked-prefill-size` is a global budget divided by `--dp`, so this keeps 6144 tokens per rank.

### 3.7 Agentic Long-Context with HiCache DRAM Offload (MI355X FP4, DSpark)

DeepSeek-V4-Pro-0813 bundles the DSpark head, so `--speculative-draft-model-path` is not needed. `--speculative-dspark-block-size 6` is the AL-optimal draft length on the committed golden curve (verify window 7).

**TP8, concurrency 1–16:**

```bash Command theme={null}
SGLANG_ENABLE_UNIFIED_RADIX_TREE=1 \
SGLANG_OPT_UNIFIED_CACHE_FREE_OUT_OF_WINDOW_SLOTS=1 \
SGLANG_USE_ROCM700A=0 \
TORCH_BLAS_PREFER_HIPBLASLT=1 \
SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton \
AITER_BF16_FP8_MOE_BOUND=0 \
SGLANG_OPT_USE_AITER_BATCHED_GEMM=1 \
python3 -m sglang.launch_server \
  --model-path deepseek-ai/DeepSeek-V4-Pro-0813 \
  --trust-remote-code \
  --tp 8 \
  --prefill-decode-interval 10 \
  --attention-backend dsv4 \
  --enable-deepseek-v4-fp4-indexer \
  --page-size 256 \
  --swa-full-tokens-ratio 0.1 \
  --kv-cache-dtype fp8_e4m3 \
  --enforce-shared-experts-fusion \
  --mem-fraction-static 0.86 \
  --chunked-prefill-size 16384 \
  --tool-call-parser deepseekv4 \
  --reasoning-parser deepseek-v4 \
  --speculative-algorithm DSPARK \
  --speculative-dspark-block-size 6 \
  --watchdog-timeout 3600
```

Concurrency 32–48 keeps the same TP-only command and adds HiCache DRAM offload. DSv4 HiCache sizes the host tier with `--hicache-ratio` (host/device token ratio). Ratio `1.5` is the value that stays under a \~2.7 TB host DRAM budget at TP8:

```bash Command theme={null}
  --enable-hierarchical-cache \
  --hicache-ratio 1.5 \
  --hicache-write-policy write_through \
  --hicache-io-backend direct \
  --hicache-mem-layout page_first_direct
```

**DP8 (DP Attention), concurrency 128–256:**

```bash Command theme={null}
SGLANG_ENABLE_UNIFIED_RADIX_TREE=1 \
SGLANG_OPT_UNIFIED_CACHE_FREE_OUT_OF_WINDOW_SLOTS=1 \
SGLANG_USE_ROCM700A=0 \
TORCH_BLAS_PREFER_HIPBLASLT=1 \
SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton \
AITER_BF16_FP8_MOE_BOUND=0 \
SGLANG_OPT_USE_AITER_BATCHED_GEMM=1 \
SGLANG_SHARED_EXPERT_TP1=1 \
SGLANG_DP_SHARED_EXPERT_LOCAL=1 \
SGLANG_DP_USE_GATHERV=1 \
SGLANG_DP_USE_REDUCE_SCATTER=1 \
python3 -m sglang.launch_server \
  --model-path deepseek-ai/DeepSeek-V4-Pro-0813 \
  --trust-remote-code \
  --tp 8 \
  --dp 8 \
  --enable-dp-attention \
  --enable-dp-lm-head \
  --enable-prefill-delayer \
  --enable-dp-attention-local-control-broadcast \
  --tokenizer-worker-num 8 \
  --stream-interval 20 \
  --prefill-decode-interval 10 \
  --prefill-delayer-token-usage-low-watermark 0.7 \
  --attention-backend dsv4 \
  --enable-deepseek-v4-fp4-indexer \
  --page-size 256 \
  --swa-full-tokens-ratio 0.1 \
  --kv-cache-dtype fp8_e4m3 \
  --enforce-shared-experts-fusion \
  --mem-fraction-static 0.92 \
  --chunked-prefill-size 65536 \
  --tool-call-parser deepseekv4 \
  --reasoning-parser deepseek-v4 \
  --speculative-algorithm DSPARK \
  --speculative-dspark-block-size 6 \
  --enable-hierarchical-cache \
  --hicache-ratio 1.5 \
  --hicache-write-policy write_through \
  --hicache-io-backend direct \
  --hicache-mem-layout page_first_direct \
  --watchdog-timeout 3600
```

`--chunked-prefill-size` is a global budget divided by `--dp`, so this keeps 8192 tokens per rank. `--enable-dp-lm-head` is required for DSpark under DP attention.

### 3.8 PD Disaggregation on MI355X (MORI-IO)

On ROCm the prefill and decode roles talk over **MORI-IO** rather than Mooncake or NiXL, so the **PD Disagg** card in the [Playground above](#playground) hides the CUDA-only transports once MI300X / MI355X is selected and defaults the IB device list to the node's `rdmaN` NICs instead of ConnectX `mlx5_*` names.

Both roles need the RDMA NICs passed into the container, so the **Docker** output adds the fabric flags below on top of the usual ROCm device access from the [Install panel](#install). `/dev/infiniband` covers `rdma_cm` and the per-NIC `uverbs0`…`uverbs7` nodes, and the memlock/`IPC_LOCK` pair is what lets MORI-IO pin the buffers it registers with the NICs:

```bash Command theme={null}
docker run \
    --device=/dev/kfd --device=/dev/dri --device /dev/infiniband \
    --group-add video --cap-add IPC_LOCK \
    --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
    --ulimit memlock=-1 --ulimit stack=67108864 \
    --ulimit nofile=1048576:1048576 \
    --network host --ipc=host --shm-size 32g \
    -v ~/.cache/huggingface:/root/.cache/huggingface \
    lmsysorg/sglang-rocm:v0.5.19-rocm720-mi35x-20260911 \
    python3 -m sglang.launch_server <role args below>
```

`--network host` replaces the single-node `-p` mapping because the two roles rendezvous across hosts. Long agentic runs on the 1.6T checkpoint may need more than `--shm-size 32g`; raise it if the workers die during weight load.

Selecting either role with **MORI** on MI355X emits the shared MORI-IO transport env — `SGLANG_MORI_COMBINE_DTYPE` plus the RDMA send-queue tuning `MORI_IO_SQ_BACKOFF_TIMEOUT_US` / `MORI_IO_QP_MAX_SEND_WR` — together with that role's sizing. `--max-running-requests` is deliberately small on both: the pair streams KV between workers rather than holding a large running batch.

The roles are sized per **Strategy**, so the Deploy panel's operating point carries through to the PD command:

* **Low-Latency** — TP-only, `--mem-fraction-static 0.86`, and a running-request ceiling of 8. Decode captures graphs for batches 1–8. No offload tier: the KV pool is all there is.
* **Balanced** — still TP-only, with the ceiling at `--max-running-requests 96` and a 16384 chunked-prefill budget. Decode ladders all the way to 96, since without DP the server-wide ceiling *is* the per-rank batch. Prefill runs a **HiCache** host tier (`--hicache-ratio 2.5`, `page_first`, write-through, best-effort prefetch); decode does not, because HiCache is not recommended on the decode role with MORI.
* **High-Throughput** — inherits TP8 / DP8 and the 65536 chunked-prefill budget from the base cell, raises the ceiling to `--max-running-requests 256` and `--mem-fraction-static 0.92`, and ladders decode to 32 — the per-rank batch 256 leaves across DP 8. It adds `--enable-cache-report`, which surfaces the prefix hit rate you need to judge whether an offload tier is paying for itself at that concurrency.

The offload tier is what actually separates balanced from high-throughput: balanced pairs prefill with HiCache's tiered GPU → host cache, while high-throughput pairs it with UMBP, which links the radix tree straight to MORI with no host tier. They cannot both be on, and the Playground enforces that.

<Note>
  The low-latency and balanced roles are TP-only, and that is exactly why their decode ladders run to the full ceiling. Selecting either role forces DP-Attention off and grays the control: `--max-running-requests` is server-wide and floor-divided by `attn_dp_size`, so switching DP on would cut the per-rank batch below the captured graphs without changing either flag in the command. With PD off, the balanced cell stays a DP recipe for aggregated serving.
</Note>

<Warning>
  **Speculative decoding (MTP) changes how you size the ceilings.** For a target concurrency of N, set `--max-running-requests N*2` on **both** roles. Sizing them at N caps the served batch below the concurrency you are aiming for. PD disaggregation requires EAGLE/MTP (DSpark cannot run under it), so this applies to every PD deployment.

  `--max-running-requests` is server-wide and floor-divided by `attn_dp_size`, so the decode graph ladder should cover the **per-rank** batch that leaves — `N*2 / dp_size`. That is why the two points above ladder to different places from ceilings that differ by less: balanced is TP-only, so 96 slots are 96 per rank, while high-throughput spreads 256 over DP 8 and only ever sees 32 at a time.
</Warning>

The high-throughput prefill role is where [UMBP](#3-9-umbp-direct-external-kv-store) belongs — DP attention is already on, which is UMBP's hard requirement, and the concurrency is high enough for the pool to matter. Turn on the **UMBP** card alongside the role; it is a separate card rather than part of the role because the linker flags are its to own, and leaving them implicit would hide the dependency.

Whichever point you pick, the two roles diverge in two places:

* **Cuda graphs.** Prefill runs eager (`--disable-cuda-graph`) because the FP4 indexer's prefill path is not captured. Decode captures the small batch ladder that matches its running-request ceiling (`--cuda-graph-bs-decode 1 2 3 4 5 6 7 8`).
* **MORI dispatch budget.** `SGLANG_MORI_NUM_MAX_DISPATCH_TOKENS_PER_RANK` is `16384` on prefill, sized for a whole chunked-prefill batch, and `128` on decode, where a step never dispatches more than a token per running request.

Note that DSpark is incompatible with PD disaggregation, so picking a role strips the inherited DSpark flags (see [§3.4](#3-4-dspark-speculative-decoding)). For a speculative PD recipe use the bundled MTP head through the EAGLE path instead:

```bash Command theme={null}
--speculative-algorithm EAGLE --speculative-eagle-topk 1 \
--speculative-num-steps 3 --speculative-num-draft-tokens 4
```

Run the two roles on separate nodes with the same transport and IB device selection, then front them with the router the card prints. On MI355X that router is cache-aware rather than round-robin: `--policy consistent_hashing` keeps a conversation on the worker that already holds its prefix, which is what makes the agentic reuse pay off, and `--balance-abs-threshold 2` / `--balance-rel-threshold 1.1` keep that affinity from starving the peer given how small the running-request ceiling is. Health checks stay on with a long timeout so a wedged worker is still caught without a multi-minute prefill being mistaken for a failure.

`--dp-aware` only does something when the workers run DP attention — turn on the Playground's **DP-Attention** card if you want it to take effect, otherwise it is inert on the TP-only recipe above.

### 3.9 UMBP (Direct External KV Store)

UMBP is the second way to spill KV off the GPU, and it is an **alternative to [HiCache](#3-3-hicache-hierarchical-kv-caching), not a tier inside it**. HiCache is a hierarchy — GPU, then pinned host memory, then optionally a storage backend. UMBP links the unified radix tree straight to MORI's buffer pool with no host cache tier in between, so pages load and offload against the external store directly. SGLang rejects the two together, so enabling the **UMBP** card in the [Playground above](#playground) strips the whole HiCache flag family from the command:

```bash Command theme={null}
--enable-unified-cache-external-linker \
--unified-cache-external-linker-backend mori
```

The **Store** knob picks the linker backend. `mori` is the UMBP pool; `mooncake` drives the same direct-linker path against a Mooncake store instead.

**DP Attention is required**, and the card's Enable chip stays greyed out until you turn it on. This is not a soft preference. The linker keys its objects by rank, and MLA KV is replicated across TP, so a TP8 prefill worker under pure TP opens eight separate keyspaces holding eight copies of the same tokens — the pool's effective distinct-token capacity would be an eighth of what its byte budget suggests, which is easy to mistake for a real measurement. DP attention collapses the keys onto one shared keyspace.

Two further limits are worth knowing before you size a run. The pool is a per-node process, so a prefill worker that spans nodes would shard its keyspace by node. And only the prefill worker offloads KV — the decode side is untouched.
