sglang-diffusion-performance

sglang-diffusion-performance is a skill for Claude Code from sgl-project/sglang. It costs 29 tokens per session (12,168 once invoked), scanned A, original, Apache-2.0.

A performance-tuning guide for SGLang Diffusion, software that generates images from model instructions. It helps choose command-line settings for a model, GPU, and available video memory.

In plain words
What is it for?
Use it to select fast-generation flags, reduce video-memory use, compare settings, and validate which backend and options actually ran.
Why use it?
It reduces guesswork when balancing generation speed against GPU memory limits. It also helps make performance comparisons under consistent conditions.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Not installable on its own: it runs a file from its repository that does not travel with it. Clone the repository, or install whatever ships that file. The line is python3 python/sglang/multimodal_gen/.claude/skills/sglang-diffusion-benchmark-profile/scripts/bench_diffusion_denoise.py \.

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

There is no command for this one: it runs only inside a plugin, and the catalogue could not identify which plugin ships it. The source is linked below.

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-performance

README.md
[![agentmods](https://agentmods.dev/badge/skills/sgl-project/sglang/sglang-diffusion-performance.svg)](https://agentmods.dev/skills/sgl-project/sglang/sglang-diffusion-performance)
Your own site
<a href="https://agentmods.dev/skills/sgl-project/sglang/sglang-diffusion-performance"><img src="https://agentmods.dev/badge/skills/sgl-project/sglang/sglang-diffusion-performance.svg" alt="Measured on agentmods" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 12,168 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.00029 $0.12168
Opus 5 $0.00015 $0.06084
Sonnet 5 $0.00006 $0.02434
Haiku 4.5 $0.00003 $0.01217

Measured yesterday against content hash b009cc23179b, 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-performance 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 yesterday.

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-performance/SKILL.md · 462 lines

How it starts

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

SGLang Diffusion Performance Tuning

Use this skill when the user wants the fastest command line, lower VRAM, or the right performance flags for a specific model and GPU setup.

Before running any sglang generate command below inside the diffusion container:

  • use python/sglang/multimodal_gen/.claude/skills/sglang-diffusion-benchmark-profile/scripts/diffusion_skill_env.py to derive the repo root, verify write access, and choose idle GPU(s)
  • export HF_TOKEN first when the selected model lives in a gated Hugging Face repo such as black-forest-labs/FLUX.*
  • export FLASHINFER_DISABLE_VERSION_CHECK=1
  • when a run downloads weights, use a task-owned cache and delete that model's cache after its eager/BCG/quality/profile group finishes; the benchmark skill's --quality-bcg-matrix --model-cache-root --cleanup-model-cache keeps one cache for the group and writes a zero-residual cleanup ledger
  • hold one idle GPU set for the complete A/B matrix and verify no foreign process appears at run boundaries
  • cd to the repo root resolved from sglang.__file__

Native Backend Gate

Performance numbers are useful only when the intended backend actually ran.

  • Treat any log containing Falling back to diffusers backend, Using diffusers backend, or Loaded diffusers pipeline as invalid for native SGLang performance tuning.
  • Use --backend diffusers only for an explicit diffusers baseline. For native recipes, leave the default backend or pin --backend sglang.
  • If a fallback happened, fix pipeline registration/model-path/config issues first, then rerun. Do not compare perf dumps collected from a fallback run.
  • When the runtime auto-selects parallel settings because the user omitted them, keep the result as an auto-tuned baseline. For reproducible tuning, pin --num-gpus, --ulysses-degree, --ring-degree, and --enable-cfg-parallel explicitly.

Reference: SGLang-Diffusion Advanced Optimizations Blog

Read the full file on GitHub · 462 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. yesterday Changed · +17 lines b009cc23179b
  2. 4d ago Changed · +6 lines b14a4d8cca33
  3. 6d ago First seen · 439 lines · 29 tokens per session scan A a843c76ffe45

Subscribe to this mod's changes

sglang-diffusion-performance is a skill published in the GitHub repository sgl-project/sglang (35,516 stars, last pushed today), licensed Apache-2.0. It adds 29 tokens to every session and 12,168 once invoked, about $0.0001 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

mooncake-api

Help users work with the Mooncake Python APIs for distributed storage and high-performance data transfer. Use when working with Mooncake Store (distributed KV cache), Transfer Engine (RDMA/TCP transfers), service setup (master, metadata server), PyTorch tensors in the Store, zero-copy/buffer management, batch…

kvcache-ai/Mooncake · 122 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

trtllm-model-onboard-multimodal

Onboard a HuggingFace multimodal model (vision/audio/video + text) to the TensorRT-LLM PyTorch backend. Use when writing a new tensorrtllm/torch/models/modeling .py plus its input processor and weight mapper, or extending an existing VLM. Not for AutoDeploy — use ad-model-onboard for that path.

NVIDIA/TensorRT-LLM · 93 tokens

trtllm-moe-develop

Review, design, and refactor TensorRT-LLM PyTorch MoE code for architecture fit, clean code, maintainability, and testability. Always use for any modification, review, refactor, or design planning that touches MoE modules, including tensorrtllm/torch/moe/fusedmoe, ConfigurableMoE, MoE backends…

NVIDIA/TensorRT-LLM · 149 tokens

perf-optimization-casebook

Casebook of past successful and classic TensorRT-LLM optimizations (runtime/execution and kernel level) recorded as reusable decision precedents. Consult when deciding which optimization to apply for a classified bottleneck or a given config/model/hardware, to find prior art and adapt a proven approach instead of…

NVIDIA/TensorRT-LLM · 91 tokens