sglang-diffusion-modelopt-quant

sglang-diffusion-modelopt-quant is a skill for Claude Code from sgl-project/sglang. It costs 49 tokens per session (4,923 once invoked), scanned A, original, Apache-2.0.

A workflow for quantizing SGLang Diffusion models with NVIDIA ModelOpt. Quantization stores model values in lower-precision formats such as FP8 or NVFP4 to reduce their size or computation cost.

In plain words
What is it for?
Use it to quantize diffusion transformers, convert checkpoints, validate image quality, and benchmark BF16 against FP8 or NVFP4 versions.
Why use it?
It connects ModelOpt's exported checkpoints with SGLang Diffusion and checks that the result still produces acceptable output. It also verifies whether quantization actually improves performance.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

About the project

SGLang is a framework for running inference for large language models and multimodal models, meaning it processes inputs to produce model outputs such as text or other media. It is used to serve and accelerate open AI models and related workloads.

sgl-project/sglang · 35,516 stars · on GitHub · sglang.io

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/sgl-project/sglang/sglang-diffusion-modelopt-quant
Any agent
npx skills add sgl-project/sglang --skill sglang-diffusion-modelopt-quant
Clone the repo
git clone --depth 1 https://github.com/sgl-project/sglang

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sglang-diffusion-modelopt-quant

README.md
[![agentmods](https://agentmods.dev/badge/skills/sgl-project/sglang/sglang-diffusion-modelopt-quant.svg)](https://agentmods.dev/skills/sgl-project/sglang/sglang-diffusion-modelopt-quant)
Your own site
<a href="https://agentmods.dev/skills/sgl-project/sglang/sglang-diffusion-modelopt-quant"><img src="https://agentmods.dev/badge/skills/sgl-project/sglang/sglang-diffusion-modelopt-quant.svg" alt="Measured on agentmods" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,923 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.04923
Opus 5 $0.00024 $0.02462
Sonnet 5 $0.00010 $0.00985
Haiku 4.5 $0.00005 $0.00492

Measured 6d ago against content hash d69bf5419557, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

sglang-diffusion-modelopt-quant scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

python/sglang/multimodal_gen/.claude/skills/sglang-diffusion-modelopt-quant/SKILL.md · 445 lines

How it starts

The opening of the file, as written. The whole thing — 445 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SGLang Diffusion ModelOpt Quant

Overview

Use this skill when the task is to take a diffusion transformer through the full ModelOpt workflow:

  • quantize it with NVIDIA ModelOpt
  • adapt the exported checkpoint to SGLang Diffusion
  • verify that quality holds up
  • benchmark whether the quantized checkpoint is actually faster

This skill owns the ModelOpt-to-SGLang bridge. It is not a generic kernel-tuning skill.

Core Rules

  • Use ModelOpt's official quantize.py as the PTQ source of truth.
  • Keep the workflow generic. Put model-specific fallback logic in small isolated branches, not in the main conversion path.
  • Benchmark only when BF16 and quantized commands are identical except for the checkpoint override being tested.
  • For diffusion FP8, keep dit_cpu_offload=false. dit_layerwise_offload=true is valid on the fixed path when you want lower DiT residency.
  • For multi-transformer pipelines, use per-component overrides when different components need different checkpoints.
  • For B200 NVFP4 validation, keep backend-sensitive environment variables explicit. The current default is FlashInfer TensorRT-LLM (flashinfer_trtllm); high-resolution Qwen Image can favor SGLANG_DIFFUSION_FLASHINFER_FP4_GEMM_BACKEND=cutlass, while 1024x1024 can remain BF16-faster. Benchmark the exact shape instead of assuming one backend or quantized checkpoint wins.
  • When a branch is missing the validated helper tools, refresh python/sglang/multimodal_gen/tools/build_modelopt_fp8_transformer.py, python/sglang/multimodal_gen/tools/build_modelopt_nvfp4_transformer.py, and python/sglang/multimodal_gen/tools/compare_diffusion_trajectory_similarity.py instead of inventing one-off scripts elsewhere.
  • After validating a new ModelOpt quant path, update the ModelOpt support matrix in docs/docs/sglang-diffusion/quantization.mdx before closing the task.

Read First

Read these sources before changing code:

Read the full file on GitHub · 445 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 445 lines · 49 tokens per session scan A d69bf5419557

Subscribe to this mod's changes

sglang-diffusion-modelopt-quant is a skill published in the GitHub repository sgl-project/sglang (35,516 stars, last pushed today), licensed Apache-2.0. It adds 49 tokens to every session and 4,923 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

llama-factory

Expert guidance for fine-tuning LLMs with LLaMA-Factory - WebUI no-code, 100+ models, 2/3/4/5/6/8-bit QLoRA, multimodal support.

davila7/claude-code-templates · 51 tokens

groq-inference

Ultra-fast LLM inference on custom LPU hardware. OpenAI-compatible API at api.groq.com. Lowest latency in the industry (500-1000+ tok/s). Supports chat completions, vision, audio (Whisper STT + TTS), tool calling, JSON mode, and streaming. Free tier available. Inference only — no training.

synthetic-sciences/openscience · 77 tokens

fireworks-ai-inference

Fast inference and fine-tuning platform with serverless and on-demand GPU deployments. OpenAI-compatible API for chat completions, embeddings, function calling, vision, and structured output. Supports SFT, DPO, and RL fine-tuning. SOC2 + HIPAA compliant.

synthetic-sciences/openscience · 62 tokens

ort

ONNX Runtime in Rust via the ort crate (2.x): loading sessions, configuring CPU/CoreML/CUDA execution providers, tensor I/O with ndarray, async-safe spawnblocking wrapping, global thread-pool init, and debugging provider/opset issues.

bobmatnyc/claude-mpm-skills · 54 tokens

minimind-learning

MiniMind 学习助手。自动记录学习笔记,识别 RMSNorm, LayerNorm, RoPE, Attention, LoRA, DPO, PPO, GRPO, SFT, RLHF 等术语。触发词:学习、开始、MiniMind、归一化、位置编码、注意力、训练、微调。.

joyehuang/minimind-notes · 76 tokens

llama-factory

Expert guidance for fine-tuning LLMs with LLaMA-Factory - WebUI no-code, 100+ models, 2/3/4/5/6/8-bit QLoRA, multimodal support.

OpenLAIR/dr-claw · 51 tokens