Skip to content

v1.5.8

Latest

Choose a tag to compare

@DefTruth DefTruth released this 03 Dec 07:56
· 27 commits to main since this release
20ca35c

🚀 Cache-DiT v1.5.8 Release Notes

Release Date: 2026-12-03
Comparison: v1.5.7...v1.5.8

📋 Overview

Cache-DiT v1.5.8 turns the optimization stack into a single, composable workflow. The cache_dit.generate / cache_dit.serve / cache_dit.convert entry points now share one typed --xxx-config grammar with YAML launch configs, a lightweight OpenAI-compatible server covers text-to-image, image editing, and asynchronous video jobs on the same Ray engine, and quantization becomes an end-to-end offline path: convert a pipeline once into a self-contained checkpoint, optionally bake tensor parallelism into it, then reload it for generate or serve without re-quantizing. Context parallelism gains Generalize Async Ulysses with Head Chunk, a backend-agnostic all-to-all QKVO overlap that reuses each backend's ordinary attention kernel and needs no model-specific async planner. The cache side adds the opt-in SoftCache mode with its Residual Motion calibrator, and native TP can now shard eligible CPU weights before placement.

✨ Core Highlights

1. 🧩 Unified CLI Around Typed Configuration Families

#1426 rebuilds cache_dit.generate around typed configuration families and removes the deprecated per-option switches. Every optimization family is now one --xxx-config argument with a bare type head:

Old New
--cache / --Fn / --Bn / --rdt --cache-config 'type=DBCache,Fn=...,rdt=...'
--parallel tp / --parallel-vae / --parallel-text / --ulysses-anything --parallel-config 'ulysses=N,vae=true,text=true,ulysses_anything=true'
--quantize + per-option quant flags --quantize-config 'quant_type=float8_per_row,...'
--attn --attn-config 'type=native,...'
--calibrator / --taylorseer --calibrator-config 'type=taylorseer,...'
--ulysses-float8* --quant-communicate-config 'bits=8,quantize_k=...'

The same release adds --launcher auto|ray|local (no external torchrun for multi-GPU runs), accepts a model path or id instead of an example name, adds --task, splits the CLI into focused cache_dit/cli/* modules, and aligns all docs, examples, bench commands, and skills with the new parser. #1449 unifies generate and serve around the same typed families, adds YAML --launch-config loading, and exposes python3 -m cache_dit.convert as an equivalent entry point. #1452 splits the model adapters into 49 family modules behind ModelRegistry / ModelAdapter / TaskType / ModelConfig, keeps one failing family from breaking the rest, and stops Ray serve from copying whole pipelines through the object store. #1430 adds the ffpa,bits=8 attention shorthand, and #1428 / #1431 move the remaining examples to the module CLI form.

2. 🌐 Lightweight OpenAI-Compatible Server

#1437 adds cache_dit.serve / cache-dit-serve: a single-model, batch-size-1 local validation server built on the existing Ray pipeline engine. It implements /v1/images/generations, /v1/images/edits, /v1/models, health, and generated-image content endpoints, supports T2I and IE2I with single or repeated image fields (including the OpenAI SDK's image[] multipart encoding), and reuses Ray workers for cache/calibrators, quantization, Ulysses/Ring/TP, component parallelism, and compilation. SVDQ few-shot readiness, deferred compilation, device migration, error propagation, and cleanup moved into the worker lifecycle; the HTTP listener does not open until every actor is ready. The default GPU-generator semantics of generate are preserved by transporting only a seed/device spec and constructing the generator on each worker.

#1439 extends it with the core installation extra, JPEG-quality-95 image responses encoded once outside the inference lock (URL responses skip base64), and asynchronous /v1/videos create/retrieve/list/content/delete endpoints for T2V and T2VA. Duration and frame alignment map to Wan and H3, and T2VA jobs fail when required audio metadata is missing. Real-model acceptance covered Wan (832×480, 49 frames, 16 fps) and MiniMax-H3 (1344×768, 124 frames, 24 fps, 32 kHz stereo), including a four-GPU TP2 + Ulysses2 + TE-P + VAE-P + UAA + DBCache + FP8 + FFPA FP4 + compile recipe. In that H3 run the same request took 1027.68 s on one GPU with native generate and 113.35 s on four GPUs through the server (9.55x), with FP6 communication saving a further 5.05%; the JPEG Q95 response path plus skipping base64 for URL responses also cut a four-GPU FLUX median client time from 2.018 s to 1.600 s.

This remains a local validation server, not a production serving system: single model, bs=1, serialized inference, process-local jobs, and no multi-model routing, replicas, multi-node execution, persistent storage, TLS, or tenant isolation. Production deployment is still directed to SGLang Diffusion and vLLM-Omni.

3. 💾 Unified End-to-End Quantization Workflow

#1455 turns python3 -m cache_dit.convert from an SVDQ-only component writer into a complete pipeline converter for TorchAO FP8/NVFP4 (float8_per_row, float8_per_tensor, float8_per_block, float8_weight_only, nvfp4, nvfp4_weight_only), Cache-DiT native FP8/NVFP4 (backend=cache_dit), and SVDQ dynamic-DQ formats. A root quant_manifest.json plus per-component manifests record and restore TorchAO tensor subclasses, native packed buffers, SVDQ quantized/base weights, non-persistent buffers, and direct tensor attributes such as complex RoPE tables.

Converted directories are self-contained. Independent conversion copies the complete source tree, verifies every copied file byte-for-byte, then removes only the old float weights of quantized components; in-place conversion adds cache_dit_quant/<component>/ without copying, deleting, or rewriting source files. The obsolete quantized/ layout is rejected rather than migrated. generate and serve select a converted directory through source_model, inject restored components before ordinary or modular loading, and reject re-quantization at load time; source_model is provenance/selection metadata only and is never used to load runtime weights.

#1458 adds --parallel-config tp=N to the converter, which bakes the tensor-parallel layout into the checkpoint: the transformer is sharded first, each rank quantizes only its local shards, and the slices plus the plan that produced them are stored under cache_dit_quant/<component>/tp{N}/rank{R}/. Loading then only restores slices — no densification, no re-quantization, no planner replay. Qwen-Image 2.1 Turbo NVFP4 TP2 went from ~229 s to ~9 s to first forward with identical inference time. Baked TP currently covers TorchAO NVFP4 only; native FP8/NVFP4, SVDQ, and other TorchAO types keep the runtime path and are rejected at convert time. TP × CP is supported (ulysses=2,tp=2 verified), the TP degree is bound to the checkpoint, and planners that replace modules are rejected.

Measured on RTX PRO 5000 with torch 2.15, seed 0, DBCache rdt=0.12, transformer compile (FLUX.1-dev 1024², 28 steps):

Checkpoint Latency Speedup Peak memory PSNR / SSIM vs BF16
BF16 8.69 s 1.00x 33.87 GiB inf / 1.0000
TorchAO FP8 4.20 s 2.07x 18.87 GiB 21.74 / 0.9250
TorchAO NVFP4 3.64 s 2.39x 14.03 GiB 22.83 / 0.9012
Native FP8 4.20 s 2.07x 22.94 GiB 23.20 / 0.9362
Native NVFP4 3.65 s 2.38x 18.11 GiB 19.56 / 0.8631
SVDQ NVFP4 r32 DQ 3.90 s 2.23x 14.40 GiB 19.34 / 0.8334

Qwen-Image-2.1-Turbo 1024² with its native eight-point sigma schedule follows the same pattern (BF16 2.52 s → TorchAO NVFP4 1.23 s, 2.05x; native FP8 1.58 s, 1.59x; SVDQ NVFP4 r32 DQ 1.47 s, 1.71x), and the converted checkpoint preserves the original sample_sigmas exactly. These combined cache + compile results are functional performance/accuracy points, not bitwise-equality gates.

python3 -m cache_dit.convert black-forest-labs/FLUX.1-dev \
  --save-dir ./FLUX.1-dev-fp8 \
  --quantize-config 'float8_per_row,text:float8_weight_only'

# Optional: bake TP2 into the checkpoint (TorchAO NVFP4 only)
python3 -m cache_dit.convert black-forest-labs/FLUX.1-dev \
  --save-dir ./FLUX.1-dev-nvfp4-tp2 \
  --quantize-config 'nvfp4' --parallel-config 'tp=2'

python3 -m cache_dit.generate ./FLUX.1-dev-fp8 \
  --cache-config 'DBCache,rdt=0.12' --compile-config 'transformer'

4. ⚡ Generalize Async Ulysses with Head Chunk

#1460 introduced a backend-agnostic _All2AllHeadChunkComm. It owns head slicing, QKVO all-to-all, layout conversion, async Work lifetimes, and the final merge, while each group calls the selected backend's ordinary forward_op. All per-group QKV collectives are posted first, then wait → ordinary attention → async output all-to-all runs in strict chunk order, issuing exactly 2G collectives per attention round.

The path supports pure Ulysses CP2/CP4 with native PyTorch SDPA, FA2, and regular FFPA fp16/bf16, FP8, FP8 per-block, and FP4; FlashInfer FA2 is a separate B1-only opt-in. B1 zero-copy strided-NHD views are preserved where the backend contract permits them, and B>1 or non-contiguous outputs use explicitly checked relayouts. Manual G1–G4 and auto scheduling are available; on PRO 5000, B1, CP4, and more than 4096 global tokens, non-FFPA auto scheduling conservatively uses G1, while other cases keep the generic SM-wave heuristic and manual G always wins.

CUDA_VISIBLE_DEVICES=0,1,2,3 python3 -m cache_dit.generate \
  black-forest-labs/FLUX.1-dev \
  --parallel-config 'ulysses=4,ulysses_head_chunk=true' \
  --attn-config 'ffpa' \
  --compile-config 'transformer' \
  --cache-config 'DBCache'

In the measured 28-step transformer-compile runs, FFPA BF16 reached 1.0150x on CP2 and 1.0771x on CP4, FFPA FP8 reached 1.0545x on CP2, and FFPA FP4 reached 1.0533x; these beat the tested native SDPA, FA2, and FlashInfer configurations. For FFPA BF16 CP2, the existing ulysses_async planner remained faster (1.0341x versus 1.0150x), so the two options are strictly mutually exclusive. The feature is forward-only dense MHA on fp16/bf16 communication tensors; Ring, TP, UAA, async Ulysses, quantized communication, GQA, masks, causal attention, dropout, LSE, backward, and CUDA Graph capture are rejected loudly rather than silently falling back.

5. 🧠 Cache: SoftCache + Residual Motion

#1418 adds two opt-in cache features for FLUX. Residual Motion is a CalibratorBase predictor that moves the cached residual along the secant of the last two real anchors in flow-matching sigma coordinates (r(σ) = r_a + β·λ·(r_a − r_{a−1})), available as --calibrator-config type=residual_motion / ResidualMotionCalibratorConfig. SoftCache is an optional mode of DBCache, not a new CacheType: on cached steps it enlarges dt (up to 8x) and re-spaces the FlowMatch Euler tail, turning removed steps into dt=0 padding; refresh follows SeaCache's relative-L1 rule with softcache_tau. Both are off by default.

python3 -m cache_dit.generate flux \
  --cache-config 'SoftCache,ws=1,mc=-1,mcc=-1,softcache_tau=0.5' \
  --calibrator-config type=residual_motion

FLUX.1-dev 1024², 50 steps, 8 DPG prompts, bf16, eager, A100-40GB (PSNR / SSIM vs uncached):

Configuration Speedup Cache Steps PSNR SSIM
SoftCache τ0.3 + Residual Motion 2.82x 9.3 24.70 0.863
SoftCache τ0.5 + Residual Motion 3.60x 15 21.25 0.801
SoftCache τ1.1 + Residual Motion 6.27x 19 18.24 0.682

On plain DBCache, Residual Motion measured 0.5–1 dB below TaylorSeer order 1 at the same Cache Steps, so TaylorSeer remains the default pick there; under SoftCache the two are within 0.2 dB. max_cached_steps=0 remains bit-identical to no cache. SoftCache refuses separate CFG, transformer-only caching, and non-FlowMatch-Euler schedulers, and has not been validated with context parallelism or video models.

6. 🚀 Experimental: CPU Weight Sharding Before TP Placement

#1432 adds an opt-in path that slices eligible weights on the CPU and transfers only each rank's share, instead of transferring full CPU weights to the device before native TP distribution. It covers MiniMax-H3 video DiT TP and the Qwen3VLForConditionalGeneration language stack under TE-P, enabled with local_weight_shards=true (CLI --parallel-config 'tp=2,text=true,local_weight_shards=true', or ParallelismConfig(local_weight_shards=True); Core requires use_ray=False). On a four-GPU H3 TP2×CP2 + TE-P4 run, partition and placement dropped from 81.76 s to 39.06 s (−52.2%), launch-through-warmup dropped 7.0%, and DiT/text-encoder outputs matched native placement elementwise.

7. 🛠 Fixes and Other Changes

  • Ulysses BF16 O-scale corruption (#1442): on CUDA 13.0.88 sm_120a, the BF16 memcpy in the attention-output packer corrupted the low scale byte before all-to-all. write_group_scale now computes the BF16 bits with integer round-to-nearest-even; the H3-Image 2048² TP2×CP2 + FP8 G16 comparison went from 17.82 dB to 32.32 dB.
  • torch 2.15 collectives API (#1415): context-parallel all-gather resolves all_gather_single on torch ≥ 2.15 and falls back to all_gather_tensor on older releases (torch ≥ 2.7.1 remains supported). The logger also filters the noisy Enum subclass pytree notice emitted at import torchao.
  • NVCC thread env rename (#1417): CACHE_DIT_SVDQ_NVCC_THREADS is now CACHE_DIT_NVCC_THREADS, matching the single-extension build.
  • Docs and repository hygiene: refreshed README quick starts, combined FLUX/H3 speedup figures, explicit anchors, model tables now omit the C/P/Q/OF columns, CLI/quantization/serving docs were rewritten around the new grammar, docs/EXAMPLES.md is the single minimal example document, mkdocs strict builds pass, LaTeX aux files are ignored, and the README typo was fixed (#1434, #1435, #1440, #1441, #1446, #1447, #1450, #1453).

⚠️ Upgrade Notes

  • The old per-option CLI flags are removed. --cache, --Fn, --Bn, --rdt, --parallel, --parallel-vae, --parallel-text, --ulysses-anything, --quantize plus per-option quantization flags, --attn, --calibrator, --taylorseer, and --ulysses-float8* no longer exist. Migrate to --cache-config / --parallel-config / --quantize-config / --attn-config / --calibrator-config / --quant-communicate-config. --launcher auto replaces the external torchrun requirement.
  • Head-chunk async Ulysses is opt-in and mutually exclusive with ulysses_async. Enable it with ulysses_head_chunk=true and optionally ulysses_head_chunk_groups=N; the standard Ulysses path is unchanged. Unsupported combinations raise instead of falling back.
  • SoftCache is opt-in. It requires enable_seacache and a FlowMatch-Euler scheduler, refuses separate CFG and transformer-only caching, and is not yet validated with CP or video. Residual Motion requires the scheduler's sigmas at its own step index.
  • Quantized checkpoints use the new self-contained layout. All artifacts live under cache_dit_quant/<component>/; the old quantized/ layout is rejected rather than migrated. Do not pass --quantize-config again when loading a converted directory. Baked TP is TorchAO-NVFP4-only, bound to the conversion degree, and does not support planners that replace modules.
  • The core extra bundles the serving stack. Install cache-dit[core] (parallelism + quantization + serving) or cache-dit[serving] for cache_dit.serve; the OpenAI Python clients additionally need openai.
  • The CUDA wheel still ships sm_89 / sm_120a cubins only. Ampere (sm80/86) and Hopper (sm90) can install the wheel but cannot launch the compiled kernels.
  • CACHE_DIT_SVDQ_NVCC_THREADS was renamed to CACHE_DIT_NVCC_THREADS for custom extension builds.
# Default PyPI package
pip install -U cache-dit

# CUDA 13 extension build (requires a compatible CUDA 13 PyTorch stack)
pip install -U cache-dit --extra-index-url https://vipshop.github.io/cache-dit/whl/cu13/

# Local OpenAI-compatible server
pip install -U "cache-dit[core]" openai

🙏 Contributors

Thanks to @DefTruth, @Butterfingrz, and @ShimonMalnick for contributing to this release.

Full Changelog: v1.5.7...v1.5.8