diffusion-optimal-perf

Optimize SGLang-Diffusion inference with CLI flags and environment variables.

3|Updated Jun 18, 2025
One-click install
npx skills add https://github.com/moirai-internal/sglang --skill diffusion-optimal-perf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: diffusion-optimal-perf
Source: https://github.com/moirai-internal/sglang/tree/main/python/sglang/multimodal_gen/.claude/skills/diffusion-optimal-perf
Command: npx skills add https://github.com/moirai-internal/sglang --skill diffusion-optimal-perf

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps users achieve the best possible performance when running diffusion models with SGLang, addressing issues like slow inference, high VRAM usage, and latency.

Core Features & Use Cases

  • Lossless Optimizations: Techniques like torch.compile, warmup, and multi-GPU parallelism that don't sacrifice output quality.
  • Lossy Optimizations: Methods such as approximate attention and quantized models that trade a small amount of quality for significant speed or VRAM gains.
  • Use Case: A user wants to generate images faster and reduce the memory footprint of a large diffusion model. They can use this Skill's guide to apply a combination of torch.compile, CPU offloading for specific components, and potentially a lossy attention backend to meet their performance targets.

Quick Start

Use the diffusion-optimal-perf skill to apply lossless optimizations for faster diffusion model inference.

Frequently Asked Questions about diffusion-optimal-perf

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize SGLang diffusion model inference for lower latency?

To optimize SGLang diffusion model inference for lower latency, apply lossless techniques like torch.compile, warmup, and multi-GPU parallelism, or use lossy methods like approximate attention and model quantization to significantly reduce processing delays.

Can I reduce VRAM usage when running diffusion models with SGLang?

You can reduce diffusion model VRAM usage in SGLang by enabling CPU offloading for specific components and applying model quantization, which trade a small amount of output quality for significant memory footprint reductions.

What is the difference between lossless and lossy diffusion inference speedups?

Lossless diffusion inference speedups use torch.compile, warmup, and multi-GPU parallelism without sacrificing output quality, while lossy speedups utilize approximate attention and quantized models to trade a small amount of quality for significant speed or VRAM gains.

Does SGLang support multi-GPU parallelism for diffusion model inference?

Yes, SGLang supports multi-GPU parallelism for diffusion model inference as a lossless optimization technique, allowing you to distribute workloads across multiple GPUs to accelerate generation without degrading output quality.

How do I configure CLI flags and environment variables for SGLang-Diffusion performance?

You can configure SGLang-Diffusion performance by setting specific CLI flags and environment variables that toggle torch.compile, CPU offloading, approximate attention, and model quantization to achieve your desired latency and VRAM targets.

When should I use approximate attention over torch.compile for diffusion inference?

Use approximate attention when you need maximum speed or VRAM reductions and can tolerate a small quality loss, whereas torch.compile is a lossless optimization better suited for maintaining output fidelity while accelerating diffusion inference.