Diffusion Pipeline Design Skill
Purpose
Build efficient, high-quality diffusion pipelines for image and video generation.
Pipeline Components
- Text Encoder: CLIP, T5, custom encoders
- UNet/DiT: Noise prediction network
- VAE: Latent encode/decode
- Scheduler: Noise schedule, sampling steps
- Conditioning: ControlNet, IP-Adapter, etc.
Configuration
| Parameter | Image | Video | Notes |
|---|---|---|---|
| Model | SDXL/FLUX | Latte/CogVideo | Quality vs speed |
| Steps | 20-50 | 20-50 | More = better, slower |
| CFG | 7-12 | 7-12 | Guidance strength |
| Resolution | 1024x1024 | 512x512 or 1024x576 | Native res |
| Scheduler | DPM++ | Euler/DDIM | Task-dependent |
Optimization
- Distillation: LCM, SDXL-Turbo for few-step generation
- Quantization: FP16/FP8/INT8 for memory/speed
- Compilation: TensorRT, ONNX for inference
- Batched Sampling: Process multiple latents together
CF Integration
from utils.pipeline.model_gateway import ModelGateway
gateway = ModelGateway()
model = gateway.route(
task="image_generation",
quality="high",
priority="speed",
)
output = model.generate(
prompt=prompt,
negative_prompt=negative,
num_inference_steps=30,
guidance_scale=7.5,
)
Quality Gates
- FID / CLIP score meets threshold
- No mode collapse in batch
- Consistency across seeds
- Latency within budget