SKILL.md
SKILL.mdBrowse 11 files
4,099 tokens
16,136 bytes
Token encoding: o200k_base
Snapshot a9fb1c3
1---2name: cookbook-add-model3description: Add a new model to the SGLang Cookbook (docs/, Mintlify), config-driven format — instantiate the model-agnostic template into a per-model config (+ benchmarks) JSX under src/snippets/configs/, an MDX page, the docs.json nav entry, NEW-tag hygiene, and the homepage vendor card. Interactive, multi-phase. Run with /cookbook-add-model.4disable-model-invocation: true5---6 7# Add a model to the SGLang Cookbook8 9> Migrating an **existing legacy-template page** (one that imports a monolithic10> `…/autoregressive/<slug>-deployment.jsx` generator)? Use the11> `cookbook-migrate-model` skill instead — same target format, but the legacy12> page (not the user) is the source of truth.13 14The cookbook is **config-driven**: two shared engines contain NO model-specific code —15`docs/src/snippets/_deployment.jsx` (the 5-dim deploy matrix) and16`_playground.jsx` (the diff-based override Playground). Adding a model = adding **data**:17a per-model `config` (+ optional `benchmarks`) consumed by both engines, plus an MDX page18that imports them. No engine edits.19 20**Instantiate the model-agnostic template** (NOT a clone of any live cookbook — the21template is decoupled and covers all hardware + all axes):22- `templates/config.jsx.tmpl` → `docs/src/snippets/configs/<hf-org>/<model-slug>.jsx`23- `templates/benchmarks.jsx.tmpl` → `…/<model-slug>-benchmarks.jsx` (skip if no numbers)24- `templates/page.mdx.tmpl` → `docs/cookbook/<category>/<Vendor>/<ModelName>.mdx`25 26The template uses explicit `__TOKEN__` placeholders; you fill them, prune what the model27lacks, and replace the EXAMPLE cells with verified recipes. DeepSeek-V4 is a populated28*instance* you can consult, but is not the template.29 30**Deep references (read on demand, don't inline):**31- [references/authoring-reference.md](references/authoring-reference.md) — field-by-field config / cells / playground / MDX contract.32- [references/mintlify-authoring.md](references/mintlify-authoring.md) — MDX rules (forbidden syntax, JSX tables, labeled fences) + invocation-example patterns. Read before writing §1–§3 prose.33- [references/engine-axis.md](references/engine-axis.md) — adding a new Playground feature axis (rare engine work).34- [references/vendor-logo.md](references/vendor-logo.md) — new-vendor card logo: ask the user for the brand logo, then generate the icon-only 940×525 RGBA PNG (spec + Pillow recipe + `git add -f`).35- [references/diffusion-authoring.md](references/diffusion-authoring.md) — required opening, tag, command-picker, and feature-overlay contract for diffusion model pages. Read before editing any `docs/cookbook/diffusion/<Vendor>/<Model>.mdx` page.36 37## Architecture at a glance38 39```40┌─────────────────────────────────────────────────────────────────┐41│ cookbook/<category>/<Vendor>/<Model>.mdx │42│ import { Deployment } from "/src/snippets/_deployment.jsx"; │43│ import { Playground } from "/src/snippets/_playground.jsx"; │44│ import { config } from "/src/snippets/configs/.../X.jsx"; │45│ <Deployment config={config} /> <Playground config={config} />│46└─────────────────────────────────────────────────────────────────┘47 │ (config passed as React prop)48 ▼49┌─────────────────────────────────────────────────────────────────┐50│ src/snippets/configs/<vendor>/<model>.jsx │51│ export const config = { │52│ supportedHardware, variants, quantizations, strategies, ... │53│ cells: [ { match:{hw,variant,quant,strategy,nodes}, │54│ env:[...], flags:[...] }, ... ], // 5-dim matrix │55│ playgroundFeatures: { attention, moe, parsers, ... }, │56│ }; │57└─────────────────────────────────────────────────────────────────┘58 │ (consumed by BOTH engines — no model code in engines)59 ▼60┌──────────────────────────────────┬──────────────────────────────┐61│ _deployment.jsx │ _playground.jsx │62│ Renders the verified matrix; │ Renders override chips + │63│ one cell → its env/flags. │ diff against the cell. │64└──────────────────────────────────┴──────────────────────────────┘65```66 67The two widgets stay in sync via: the **URL hash** (deploy mirrors its selection;68playground reads it), the **`sglang-deploy-sel` custom event** (deploy dispatches on69every change; playground listens — `replaceState` doesn't fire `hashchange`), and the70shared **`sglang-deploy-env` localStorage key** (HOST/PORT placeholders).71 72> The main template is **autoregressive**. Diffusion pages use73> `templates/diffusion-page.mdx.tmpl` plus74> [references/diffusion-authoring.md](references/diffusion-authoring.md); do not force the75> autoregressive deployment matrix on them. Omni pages follow their own category structure.76> All categories still obey the Mintlify / NEW-tag / docs.json / category-card / validation77> rules below.78 79---80 81**Interactive, multi-step workflow. Collect inputs incrementally — don't ask for82everything upfront.** The real work is the verified `cells[]` recipes + measured83benchmarks (Phases 2 + 4); everything else is filling the template.84 85## Phase 1 — Collect inputs86 871. **Model card** — HuggingFace repo/URL. **Fetch the page** and extract description,88 param count, architecture, context length, **license**. (Fetching guards factual bugs89 like an off-by-a-few-B param count.) If the model isn't public, ask the user.902. **Variants / quantizations** — keep separate: variants are size/mode (e.g. Flash/Pro,91 Instruct/Thinking); quantizations come from the HF card / linked repos (BF16/FP8/FP4/…).92 Default to BF16 when a full-precision repo exists.933. **Tested hardware + parallelism** — which platforms are actually tested, and TP/EP/DP94 for each. List only tested hw (unlisted greys out).954. **Verified launch recipes** — the full `sglang serve` flags per96 (hw × variant × quant × strategy × nodes) combo → these become `cells[]`. Rewrite any97 `python -m sglang.launch_server` to `sglang serve` form.985. **sglang version / image tag** — ask which sglang build the recipes + benchmarks ran on99 (a release like `0.5.x`, or `main`/nightly). **Never guess or hallucinate it.** This one100 tag fills `dockerImages` and the benchmarks' `sglang_version`; when the user is unsure,101 default the image to `lmsysorg/sglang:dev` (nightly) rather than inventing a release.1026. **Pre-flight**: `gh pr list --repo sgl-project/sglang --search "<model>"` (dup check).103 104**Hardware reference** (the shared `HARDWARE_CATALOG` in `_deployment.jsx`). A GPU **not** in105this table (RTX PRO 6000, GH200, future chips) goes in the model's own `config.hardware`106(`{id,label,vram,vendor}`) — the engine merges it in; don't edit the engine catalog:107 108| Platform | Vendor | VRAM | Docker image |109|---|---|---|---|110| H100 | NVIDIA | 80GB | `lmsysorg/sglang:<ver>` |111| H200 | NVIDIA | 141GB | `lmsysorg/sglang:<ver>` |112| B200 | NVIDIA | 192GB | `lmsysorg/sglang:<ver>` |113| B300 | NVIDIA | 288GB | `lmsysorg/sglang:<ver>` (or `-cu130` when required) |114| GB200 | NVIDIA | 192GB | `lmsysorg/sglang:<ver>` (or `-cu130`) |115| GB300 | NVIDIA | 288GB | `lmsysorg/sglang:<ver>` (or `-cu130`) |116| DGX Spark | NVIDIA | 128GB (unified) | `lmsysorg/sglang:<ver>` — needs a **CUDA 13** build |117| MI300X | AMD | 192GB | `lmsysorg/sglang:<ver>-rocm720-mi30x` |118| MI325X | AMD | 256GB | `lmsysorg/sglang:<ver>-rocm720-mi30x` |119| MI350X | AMD | 288GB | `lmsysorg/sglang:<ver>-rocm720-mi35x` |120| MI355X | AMD | 288GB | `lmsysorg/sglang:<ver>-rocm720-mi35x` |121 122- **Image tag (`<ver>`)**: don't guess — ask the user for the tag the recipes ran on, or123 default to `dev` (nightly). The same tag goes in `dockerImages` and benchmarks'124 `sglang_version`; the engine falls back to `lmsysorg/sglang:dev` for any unmapped hw.125- **TP sizing** (sanity-check recipes): `weight_GB / gpu_mem`, round up to a power of 2,126 ~20–30% headroom. BF16 ≈ params×2 GB, FP8 ≈ ×1, FP4 ≈ ×0.5. MoE → **total** weight, not127 active params. FP4 is Blackwell-only (B200/B300/GB200/GB300/DGX Spark). GB200/GB300128 single-node hosts are typically **4 GPUs** (TP=4 ceiling); a DGX Spark is **1 GPU**, so129 its only multi-GPU topology is TP=2 across 2 nodes.130- **Platform flags**: Blackwell may need `--attention-backend trtllm_mha`; AMD typically131 needs `--attention-backend triton` + env `SGLANG_USE_AITER=1` /132 `SGLANG_ROCM_FUSED_DECODE_MLA=0` (check AITER TP constraints, e.g. `heads_per_gpu % 16 == 0`).133- **EP** (MoE): 8-GPU NVIDIA `--tp 8 --ep 8`; AMD `EP = TP`; small NVIDIA (TP≤4) omit134 `--ep` unless benchmarked. (The template's AMD example cell shows these.)135 136## Phase 2 — Instantiate the template137 138For a diffusion model, instantiate `templates/diffusion-page.mdx.tmpl` and keep the139shared `DiffusionModelTags` component, plus `templates/diffusion-config.jsx.tmpl` for the140opt-in scoped command builder. Put the compact install command and builder in §1 Quick141start. The first two paragraphs in §2 Model capabilities are not generic filler: they must142state the model's capability range, strongest differentiator, when to choose it, and at143least one real deployment or capability boundary. Put orthogonal runtime features in144`scope: "serve"` or `scope: "request"`, not in the base recipe; use the schema from145`references/diffusion-authoring.md`.146 1471. **Copy** the three template files to their target paths (above). Note the two148 vendor-folder conventions: under `configs/` the folder is the **HuggingFace org**149 (`deepseek-ai`); under `cookbook/` it's the **display vendor** (`DeepSeek`).1502. **Replace every `__TOKEN__`**: `__MODEL_DISPLAY__`, `__MODEL_SLUG__`, `__HF_ORG__`,151 `__HF_REPO__`, `__REASONING_PARSER__`, `__TOOLCALL_PARSER__`, `__ONE_LINER__`. Verify152 none remain: `grep -rn '__[A-Z_]*__' <new files>`.1533. **Prune** to what the model supports (delete, don't stub) — using154 [references/authoring-reference.md](references/authoring-reference.md):155 - `supportedHardware` + the EXAMPLE cells: keep your tested families; **delete the156 `mi*` ids + AMD example cell if no AMD recipe**, etc. A GPU not in the shared catalog157 (e.g. RTX PRO 6000) → declare it in `config.hardware` and add its id here.158 - `playgroundFeatures` axes: remove the `megamoe` backend option + the159 `megamoeQuant` block from the `moe` axis (non-Blackwell-MoE), delete `hisparse`160 (non-DSA), `pdDisagg`/`router` (no PD), the `parsers` axis (no parsers), etc.161 - `quantizations` / `variants`: drop what the model doesn't ship; collapse `variants`162 to single `default` if there's no variant axis (then drop the `variant` half of163 `modelNames`/`defaultAccuracy` keys).1644. **Fill `cells[]`** with the verified recipes from Phase 1 (replace every EXAMPLE cell;165 set `verified: true` only on tested combos), and `modelNames` with real HF slugs,166 `dockerImages` for your hw (use the Phase-1 tag, or default `lmsysorg/sglang:dev` — never167 a guessed release; key by `hw`, or a more specific key — `hw|variant|quant`, `variant|quant`,168 `hw|quant|strategy`, `hw|quant`, resolved in that order before `hw` — when one169 variant/quant/strategy needs its own image), `multiNodeHints` only for fabric-specific hw170 (e.g. gb200).171 172### Site-wiring (do all three)173 174- **`docs/docs.json`** — add the page under Cookbook → `<category>` → `<Vendor>`, at175 the **top** of that vendor's `pages` (root-relative, no `.mdx`:176 `cookbook/<category>/<Vendor>/<Model>`). New vendor group → insert in the section's177 local ordering.178- **NEW-tag hygiene** — the new page keeps `tag: NEW` (from the template). Scan the179 vendor dir for existing NEW and strip it from siblings; verify ≤1:180 `grep -rn 'tag: NEW' docs/cookbook/<category>/<Vendor>/` → at most one result. (Scan181 files; don't assume the first `docs.json` entry holds NEW.)182- **Homepage card** — `docs/cookbook/<category>/intro.mdx`: if the org already has a183 `<Card>`, update only its `href` (keep `img`). If the org is **new**, add a `<Card>`184 (title = nav-group name; keep card order aligned with `docs.json`) **and create its logo**:185 ask the user for the brand logo, then generate the conforming **icon-only 940×525 RGBA186 transparent** PNG → `docs/cards/logos/<org-slug>.png` per187 [references/vendor-logo.md](references/vendor-logo.md) (track with `git add -f` — `*.png`188 is gitignored repo-wide). Never invent or copy a logo.189 190## Phase 3 — Validate191 192```bash193cd docs194mint validate # frontmatter, missing nav entries, MDX/JSX errors195mint broken-links196mint dev # visual smoke test at http://localhost:3000/cookbook/<category>/<Vendor>/<Model>197```198 199Spot-check: cells render sensible commands; URL-hash nav persists across reload; the200Playground inherits the Deploy selection live; each axis toggle produces the expected201diff; Docker mode wraps in `docker run` with the right image; multi-node cells emit the202hints + `--nnodes N`; cURL resolves the model name; the NEW badge shows on the new page203and is gone from same-vendor siblings; the homepage card points to the new model.204 205## Phase 4 — Interactive testing206 207The user deploys each cell, runs the benches, and pastes results; you fill the data:208- mark each tested `cells[]` entry `verified: true` (absent = yellow/unverified badge);209- fill the `<model>-benchmarks.jsx` entries (one per cell `match`) with measured210 speed/accuracy + the `sglang_version` the user reports (don't invent one — the template's211 `0.0.0` is a deliberate TODO); set model-level `defaultAccuracy` per variant. Leave a212 cell's entry as a bare `match` stub if it has no numbers yet (the card shows "pending").213 214## Phase 5 — Prose & config tips215 216**Read [references/mintlify-authoring.md](references/mintlify-authoring.md) first** (it217carries the parser-output-shape / thinking-mode / Output-Example / no-hardcoded-sampling218rules + the Mintlify forbidden-syntax list). Then rewrite the MDX prose from the HF card +219user notes: §1 Model Introduction (description, links, params, license, variants table),220§2 Configuration Tips (hw-specific tuning, caveats), §3 Advanced Usage (Reasoning /221Tool-Calling / HiCache — keep only what applies; match the reasoning example to the222parser's output shape; each runnable block gets an `**Output Example:**`).223 224For diffusion pages, follow the category-specific Quick start and capability contract in225`references/diffusion-authoring.md`. Run `node docs/scripts/check_cookbook_configs.mjs` to226verify the tag widget and introduction structure before rendering the page.227 228## Phase 6 — Review229 230```231/cookbook-review-pr <PR number>232```233 234## Git workflow235 236Always branch — never commit to main directly.237 238```bash239git checkout -b add-<model>-cookbook240git add docs/src/snippets/configs/<hf-org>/<slug>.jsx \241 docs/src/snippets/configs/<hf-org>/<slug>-benchmarks.jsx \242 docs/cookbook/<category>/<Vendor>/<Model>.mdx \243 docs/docs.json docs/cookbook/<category>/intro.mdx244git commit -m "Add <Display-Name> cookbook"245git push -u origin add-<model>-cookbook246gh pr create --title "Add <Display-Name> cookbook" --body "..."247```248 Discovery context
Discovered by repository scan. No exact path reference found in the snapshot’s root docs/AGENTS.md.