templates/config.jsx.tmpl
templates/config.jsx.tmplBrowse 11 files
5,473 tokens
18,698 bytes
Token encoding: o200k_base
Snapshot a9fb1c3
← Back to SKILL.md
1// TEMPLATE — instantiate via the cookbook-add-model skill. NOT a live cookbook.2// Copy to docs/src/snippets/configs/<hf-org>/<model-slug>.jsx, then:3// 1. replace every __TOKEN__,4// 2. fill cells[] with your verified recipes (the examples below show the shape),5// 3. DELETE the hardware / playground axes / quantizations your model lacks.6//7// Instantiation tokens (skill fills these; distinct from the engine's runtime8// {{PLACEHOLDER}} which MUST survive verbatim into the output):9// __MODEL_DISPLAY__ display name, e.g. "DeepSeek-V4"10// __MODEL_SLUG__ file slug, e.g. "deepseek-v4"11// __HF_ORG__ HuggingFace org, e.g. "deepseek-ai"12// __HF_REPO__ HuggingFace repo, e.g. "DeepSeek-V4-Flash"13// __REASONING_PARSER__ e.g. "deepseek-v4" (delete the parsers axis if none)14// __TOOLCALL_PARSER__ e.g. "deepseekv4" (delete the parsers axis if none)15//16// Mintlify: single `export const config = {...}` literal — no spreads/calls/IIFE,17// no `!(x in y)`. Cells are denormalized: no --nnodes/--node-rank/--dist-init-addr/18// --host/--port literals (the engine injects them).19 20export const config = {21 modelName: "__MODEL_DISPLAY__",22 23 // List ONLY hardware you ship a cell for; unlisted ids auto-grey-out. The full24 // catalog is below — delete the families your model doesn't support (e.g. drop25 // every `mi*` if there's no AMD recipe).26 supportedHardware: [27 "h100", "h200", "b200", "b300", "gb200", "gb300",28 "mi300x", "mi325x", "mi350x", "mi355x",29 ],30 31 // OPTIONAL — declare GPUs the shared HARDWARE_CATALOG (in _deployment.jsx) doesn't32 // carry (workstation / desktop / future chips). The engine merges these in, so a33 // model-specific GPU is config data, never an engine-catalog edit. Add the id to34 // supportedHardware above too. Delete if you only use catalog GPUs.35 // hardware: [36 // { id: "rtx6000", label: "RTX PRO 6000", vram: "96GB", vendor: "nvidia" },37 // ],38 39 // 2nd dim. Single-element `default` if the model has no variant axis; else list40 // real variants (e.g. {id:"flash",...},{id:"pro",...}) and key modelNames/41 // defaultAccuracy by them.42 variants: [43 { id: "default", label: "Default" },44 ],45 // 3rd dim. Keep only what your model ships (BF16 / FP8 / FP4 / …).46 quantizations: [47 { id: "bf16", label: "BF16" },48 { id: "fp8", label: "FP8" },49 { id: "fp4", label: "FP4" },50 ],51 // 4th dim. The count follows the model's operating points: 1 recipe → a52 // single "balanced"; 2 → low-latency + high-throughput; 3 → the full trio53 // (the ideal). Per-combination: a single-recipe combination (e.g. a CPU54 // platform) parks under its semantically honest tier — no slant → balanced;55 // the page's list is the union and the engine greys unused chips. Never56 // invent a recipe just to fill chips.57 strategies: [58 { id: "low-latency", label: "Low-Latency" },59 { id: "balanced", label: "Balanced" },60 { id: "high-throughput", label: "High-Throughput" },61 ],62 // `multi-N` id carries the node count for `--nnodes N`.63 nodesOptions: [64 { id: "single", label: "Single Node" },65 { id: "multi-2", label: "Multi-Nodes" },66 ],67 68 // HF slug lookup. Key by `variant|quant` (or `hw|variant|quant` for a per-hw69 // repackaging, e.g. an FP8 conversion only valid on one platform).70 modelNames: {71 "default|bf16": "__HF_ORG__/__HF_REPO__",72 "default|fp8": "__HF_ORG__/__HF_REPO__",73 "default|fp4": "__HF_ORG__/__HF_REPO__",74 },75 76 placeholders: {77 HOST_IP: { target: "command", label: "Bind host", default: "0.0.0.0" },78 PORT: { target: "command", label: "Bind port", default: "30000" },79 NODE0_IP: { target: "command", label: "Head node IP", default: "<node0-ip>" },80 NODE_RANK: { target: "command", label: "This node rank", default: "<node-rank>" },81 HF_TOKEN: { target: "command", label: "HF token (Docker)", default: "<your-hf-token>" },82 CURL_HOST: { target: "curl", label: "Server host", default: "localhost" },83 CURL_PORT: { target: "curl", label: "Server port", default: "30000" },84 },85 86 curl: `curl http://{{CURL_HOST}}:{{CURL_PORT}}/v1/chat/completions \\87-H 'Content-Type: application/json' \\88-d '{ "model": "{{MODEL_NAME}}", "messages": [{"role":"user","content":"Hello"}] }'`,89 90 // OPTIONAL — powers the benchmark card's "⚡ Reproduce" modal. Delete the whole91 // block (and the benchmarks file) if you have no measured numbers yet.92 benchmarkCommands: {93 speed:94`python3 -m sglang.bench_serving \\95 --backend sglang \\96 --host {{CURL_HOST}} --port {{CURL_PORT}} \\97 --model {{MODEL_NAME}} \\98 --dataset-name {{DATASET}} \\99 --random-input-len {{ISL}} --random-output-len {{OSL}} \\100 --num-prompts {{NUM_PROMPTS}} --max-concurrency {{MAX_CONCURRENCY}} \\101 --flush-cache`,102 // One entry per accuracy field. A value is a string, OR a {[variant]: string}103 // object when the command differs per variant. Keys must match ACCURACY_LABELS104 // in _deployment.jsx + the per-cell/defaultAccuracy keys.105 accuracy: {106 gsm8k_pct:107`# To install sgl-eval: pip install sgl-eval108sgl-eval run gsm8k \\109 --base-url http://{{CURL_HOST}}:{{CURL_PORT}}/v1 \\110 --num-threads 32`,111 },112 // {{NUM_PROMPTS}} fallback per concurrency (else max(c*2, 200)).113 numPromptsByConc: { 1: 8, 16: 32, 64: 128, 256: 512, 1024: 2048, 4096: 4096 },114 },115 116 // OPTIONAL — per-variant accuracy applied to EVERY cell of a variant (hardware-117 // independent, e.g. GPQA/AIME). Per-cell `accuracy` overrides. Keys must match118 // the effective accuracy labels + benchmarkCommands.accuracy. Delete if no numbers yet.119 defaultAccuracy: {120 default: { gsm8k_pct: null },121 },122 123 // The eval set rendered in the benchmark card + "⚡ Reproduce" — the engine124 // ships NO default; required whenever the benchmarks carry accuracy data125 // (without it the accuracy rows silently don't render). [key, label, unit]126 // tuples; keys must match benchmarks[].accuracy + defaultAccuracy +127 // benchmarkCommands.accuracy. Delete only if there are no accuracy numbers.128 accuracyLabels: [129 ["gsm8k_pct", "GSM8K", "%"],130 ],131 132 // OPTIONAL — `# ...` hint lines prepended to multi-node commands, ONLY for hw133 // whose fabric needs manual NIC env (e.g. gb200 NVL72/MNNVL). NOT every multi-N134 // hw needs this — standard-IB DeepEP / Marlin multi-node don't. Delete if unused.135 multiNodeHints: {136 gb200: [137 "The following env vars may be needed depending on your cluster:",138 " GLOO_SOCKET_IFNAME=<your-nic>",139 " NVSHMEM_ENABLE_NIC_PE_MAPPING=1",140 " NVSHMEM_HCA_LIST=<your-hca-list>",141 ],142 },143 144 // Image for `docker run` framing, keyed by `hw` (or, resolved before it: `hw|variant|quant`,145 // `variant|quant`, `hw|quant|strategy`, `hw|quant` — use a more specific key only when a146 // variant/quant/strategy subset needs its own build, e.g. an FP4 dev build while FP8/BF16 use147 // the release tag, or a preview image for a not-yet-released variant). ASK the user which148 // sglang build the recipes ran on; don't guess a supporting release. Default below is :dev149 // (nightly) — replace the tag with the user's release if they give one. NVIDIA share one150 // image; AMD uses ROCm tags. GB200/GB300/B300 may need a `-cu130` (CUDA 13) tag — confirm151 // per release.152 dockerImages: {153 h100: "lmsysorg/sglang:dev",154 h200: "lmsysorg/sglang:dev",155 b200: "lmsysorg/sglang:dev",156 b300: "lmsysorg/sglang:dev",157 gb200: "lmsysorg/sglang:dev",158 gb300: "lmsysorg/sglang:dev",159 mi300x: "lmsysorg/sglang:dev-rocm720-mi30x",160 mi325x: "lmsysorg/sglang:dev-rocm720-mi30x",161 mi350x: "lmsysorg/sglang-rocm:rocm720-mi35x-k3-20260727",162 mi355x: "lmsysorg/sglang-rocm:rocm720-mi35x-k3-20260727",163 },164 165 // Prefills the issue template's free-form `model` field on "Submit verified cell".166 // Use the HF id (`<hf-org>/<model-slug>`). Do NOT delete this block when pruning —167 // without it the engine falls back to "deepseek-ai/deepseek-v4" and mislabels submissions.168 github: {169 cookbookModel: "__HF_ORG__/__MODEL_SLUG__",170 },171 172 // Opt-OUT per axis: general axes (attention / moe-for-MoE / parsers /173 // speculative / pdDisagg / hicache) ship on every cookbook — DELETE only the174 // axes this model genuinely cannot use (e.g. hisparse on non-DSA models, moe175 // on pure-dense models); prefer disable+disableReason for variant/hw subsets.176 playgroundFeatures: {177 178 // ----- Card: "Attention Parallelism" ----- KEEP if the model exposes TP/CP/DP179 // knobs. DP-Attention is a combined knob: value = DP degree AND toggles `--enable-dp-attention`.180 attention: {181 knobs: [182 { id: "tp", label: "TP", values: [183 null, 1, 2, 4, 8,184 { value: 16, disable: { nodes: ["single"] },185 disableReason: "TP=16 requires 16 ranks — switch the Deploy panel's Nodes to Multi-Nodes first." },186 ]},187 { id: "cp", label: "CP", values: [null, 1, 2, 4] },188 { id: "dpAttn", label: "DP-Attention",189 values: [190 null, false, 1, 2, 4, 8,191 { value: 16, disable: { nodes: ["single"] },192 disableReason: "DP-Attention=16 requires 16 ranks — switch the Deploy panel's Nodes to Multi-Nodes first." },193 ],194 labels: { "auto": "Auto", "false": "Off" } },195 ],196 },197 198 // ----- Card: "MoE Parallelism" ----- KEEP if MoE + multiple `--moe-*-backend`199 // choices. DELETE for dense models.200 moe: {201 backend: {202 options: [203 { id: null, label: "Inherited" },204 { id: "deepep", label: "DeepEP", flags: ["--moe-a2a-backend deepep"] },205 // KEEP the MegaMoE option + the megamoeQuant block below ONLY for Blackwell206 // MoE kernel-fusion models; DELETE both otherwise. requiresHw gates it to207 // Blackwell (the engine hides it elsewhere); add excludesStrategy: [...] too208 // for a strategy gate. Selecting MegaMoE reveals the Quantization sub-select.209 { id: "megamoe", label: "MegaMoE", flags: ["--moe-a2a-backend megamoe"],210 requiresHw: ["b200", "b300", "gb200", "gb300"] },211 { id: "flashinfer_mxfp4", label: "FlashInfer (MXFP4)", flags: ["--moe-runner-backend flashinfer_mxfp4"] },212 { id: "marlin", label: "Marlin (W4A16)", flags: ["--moe-runner-backend marlin"] },213 ],214 },215 // MegaMoE quantization sub-select — shown only when backend === "megamoe".216 // W4A4 adds the FP4-activations server flag; both strip the DeepEP dispatch env.217 // DELETE this block if there's no MegaMoE backend option above.218 megamoeQuant: {219 stripEnv: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK"],220 options: [221 { id: "w4a8", label: "W4A8",222 env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"] },223 { id: "w4a4", label: "W4A4",224 flags: ["--enable-w4a4-mxfp4-megamoe"],225 env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"] },226 ],227 },228 ep: { label: "EP", values: [229 null, 1, 2, 4, 8,230 { value: 16, disable: { nodes: ["single"] },231 disableReason: "EP=16 requires 16 ranks — switch the Deploy panel's Nodes to Multi-Nodes first." },232 ]},233 },234 235 // ----- Card: "Parsers" ----- KEEP if the model has reasoning / tool-call236 // parsers (set the slugs below). DELETE the axis if neither applies.237 parsers: {238 items: [239 { id: "reasoning", label: "Reasoning Parser", flag: "--reasoning-parser __REASONING_PARSER__" },240 { id: "toolCall", label: "Tool Call Parser", flag: "--tool-call-parser __TOOLCALL_PARSER__" },241 ],242 },243 244 // ----- Card: "Speculative Decoding" ----- KEEP if the model has spec-decoding245 // presets. Drop options the model doesn't support.246 speculative: {247 options: [248 { id: "current", label: "Inherited from base" },249 { id: "off", label: "Off (greedy)" },250 { id: "mtp", label: "EAGLE / MTP",251 flags: ["--speculative-algorithm EAGLE", "--speculative-num-steps 3",252 "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4"] },253 { id: "ngram", label: "NGRAM",254 flags: ["--speculative-algorithm NGRAM",255 "--speculative-num-draft-tokens 16",256 "--speculative-ngram-max-bfs-breadth 10"],257 disable: { dpAttnOn: [true] },258 disableReason: "NGRAM is incompatible with DP-Attention. Turn DP-Attention off in the Attention card above to use NGRAM." },259 ],260 },261 262 // ----- Card: "PD Disaggregation" ----- KEEP if the model supports prefill/263 // decode disaggregation. Delete `router` if you have no router topology.264 pdDisagg: {265 modes: [266 { id: "off", label: "Off" },267 { id: "prefill", label: "Prefill role" },268 { id: "decode", label: "Decode role" },269 ],270 transferBackends: [271 { id: "mooncake", label: "Mooncake",272 env: ["NCCL_MNNVL_ENABLE=1", "NCCL_CUMEM_ENABLE=1"],273 envWhen: { hw: ["gb200", "gb300"] } },274 { id: "nixl", label: "NiXL" },275 ],276 // `auto` is a sentinel (emits no --disaggregation-ib-device flag).277 ibDevices: [{ id: "auto", label: "Auto" }, "mlx5_0", "mlx5_7"],278 // Router fronting prefill + decode; substitute <prefill-host>/<decode-host>.279 // ALWAYS use {{PREFILL_PORT}} / {{DECODE_PORT}} / {{ROUTER_PORT}} — the280 // engine fills them from its own PD_PORTS (prefill serves on 30000, decode281 // on 30100). A literal port here will not track the engine and sends the282 // router at a port the generated decode command does not listen on.283 router: {284 port: 8000,285 command:286`python3 -m sglang_router.launch_router \\287 --pd-disaggregation \\288 --prefill http://<prefill-host>:{{PREFILL_PORT}} \\289 --decode http://<decode-host>:{{DECODE_PORT}} \\290 --host 0.0.0.0 --port {{ROUTER_PORT}} \\291 --disable-circuit-breaker \\292 --health-check-interval-secs 999999`,293 },294 },295 296 // ----- Card: "Hierarchical KV Cache" ----- KEEP if the model is large enough297 // that hierarchical KV caching matters.298 hicache: {299 backends: [300 { id: null, label: "Auto" },301 { id: "file", label: "File" },302 { id: "mooncake", label: "Mooncake" },303 { id: "hf3fs", label: "HF3FS" },304 { id: "nixl", label: "NiXL" },305 ],306 writePolicies: [307 { id: "auto", label: "Auto" },308 { id: "write_through", label: "Write-through" },309 { id: "write_back", label: "Write-back" },310 { id: "write_through_selective", label: "Write-through (selective)" },311 ],312 },313 314 // ----- Card: "HiSparse" ----- KEEP only for DSA-style sparse-attention models315 // (DeepSeek-V3.2/V4, GLM-5). Decode-only: shown when live PD-Disagg mode is `decode`.316 hisparse: {317 requiredFlags: ["--disable-radix-cache"],318 config: { top_k: 2048, device_buffer_size: 6144 },319 hostRatios: [320 { id: 5, label: "5 (~1TB host)" },321 { id: 10, label: "10 (~2TB host)" },322 ],323 defaultHostRatio: 10,324 },325 },326 327 // EXAMPLE cells — one per hardware family to show the shape. REPLACE each with328 // your model's verified recipe, or DELETE families you don't support. `match`329 // MUST have exactly the 5 keys; env/flags are flat literals.330 // Accuracy-degrading flags (W4A4-style runtime quant, lossy --kv-cache-dtype)331 // default to Playground/tips — putting one in a cell needs explicit user332 // confirmation (authoring-reference §2.2).333 cells: [334 // ==== NVIDIA Blackwell + FP4 (single node) ====335 {336 match: { hw: "b200", variant: "default", quant: "fp4", strategy: "low-latency", nodes: "single" },337 // For a cell whose verification round is open, use `verificationStatus`338 // instead ("verified" | "in-progress" | "unverified", or a function of339 // the selection for a per-pick state) — authoring-reference §2.2.340 verified: true, // EXAMPLE — set false / replace with your verified recipe341 env: [],342 flags: [343 "--trust-remote-code",344 "--model-path {{MODEL_NAME}}",345 "--tp 4",346 "--moe-runner-backend flashinfer_mxfp4",347 "--host {{HOST_IP}}",348 "--port {{PORT}}",349 ],350 },351 // ==== NVIDIA Hopper + FP8 (single node, DP-attention + DeepEP) ====352 {353 match: { hw: "h200", variant: "default", quant: "fp8", strategy: "balanced", nodes: "single" },354 verified: true, // EXAMPLE355 env: ["SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256"],356 flags: [357 "--trust-remote-code",358 "--model-path {{MODEL_NAME}}",359 "--tp 4",360 "--dp 4",361 "--enable-dp-attention",362 "--moe-a2a-backend deepep",363 "--host {{HOST_IP}}",364 "--port {{PORT}}",365 ],366 },367 // ==== NVIDIA Hopper + FP4 (single node, Marlin W4A16 — Hopper has no FP4 runner) ====368 {369 match: { hw: "h100", variant: "default", quant: "fp4", strategy: "high-throughput", nodes: "single" },370 verified: true, // EXAMPLE371 env: [],372 flags: [373 "--trust-remote-code",374 "--model-path {{MODEL_NAME}}",375 "--tp 8",376 "--moe-runner-backend marlin",377 "--host {{HOST_IP}}",378 "--port {{PORT}}",379 ],380 },381 // ==== AMD + BF16 (single node) — Triton attention + AITER; EP == TP for MoE ====382 {383 match: { hw: "mi300x", variant: "default", quant: "bf16", strategy: "balanced", nodes: "single" },384 verified: true, // EXAMPLE385 env: ["SGLANG_USE_AITER=1", "SGLANG_ROCM_FUSED_DECODE_MLA=0"],386 flags: [387 "--trust-remote-code",388 "--model-path {{MODEL_NAME}}",389 "--tp 8",390 "--ep 8",391 "--attention-backend triton",392 "--host {{HOST_IP}}",393 "--port {{PORT}}",394 ],395 },396 // ==== Multi-node example (2 nodes, TP=16) — engine injects --nnodes/--node-rank/397 // --dist-init-addr from match.nodes; do NOT add them here. ====398 {399 match: { hw: "b200", variant: "default", quant: "fp4", strategy: "high-throughput", nodes: "multi-2" },400 verified: true, // EXAMPLE401 env: [],402 flags: [403 "--trust-remote-code",404 "--model-path {{MODEL_NAME}}",405 "--tp 16",406 "--dp 16",407 "--enable-dp-attention",408 "--moe-a2a-backend deepep",409 "--host {{HOST_IP}}",410 "--port {{PORT}}",411 ],412 },413 ],414};415