computer systems

Xema: Efficient Diffusion Serving through Fine-Grained Memory Management and Auto-Configuration

arXiv:2607.11136

summary

Xema is a system that reduces GPU memory usage for diffusion model serving by analyzing tensor lifetimes to apply targeted memory mitigation and by planning parallelism and concurrency to meet latency targets.

Abstract

Diffusion models are increasingly deployed as production visual-generation services, where serving high-resolution image and long video generation is often limited by GPU memory. Popular memory-saving techniques such as weight offloading, sharding, and VAE slicing are often not practical because they tend to introduce significant performance overhead. In this paper, we present Xema, a memory-efficient diffusion serving system that exploits predictable tensor lifetimes for trace-guided memory optimization. For each request template, Xema derives an offline memory trace to identify short memory-pressure intervals and applies memory mitigation only within these intervals and only by the amount needed to fit the target GPU budget. Xema further constructs a static memory layout for tensors with predictable lifetimes, reducing fragmentation-induced reserved memory and making offline memory reasoning reliable at runtime. Built on this memory optimization layer, Xema introduces an offline planner that jointly selects parallelism, concurrency, and memory control under GPU memory and SLO constraints. The selected plan is stored in a plan table and directly used by the online serving runtime. We implement Xema on production diffusion pipelines and evaluate it with Flux.2, CogVideoX-5B, and LTX-2. Compared with existing serving configurations, Xema improves SLO attainment by up to 3.7x and reduces planning cost from 6.3 hours to 197 seconds compared with grid search.

Topics & keywords

#diffusion models#gpu memory management#serving optimization#auto-configuration#performance planningtensor lifetime tracingoffline memory tracestatic memory layoutparallelism and concurrency planningSLO constraintsFlux.2CogVideoX-5B