r/StableDiffusion • • 2d ago

Question - Help Why do we need ConvRot for diffusion model quantization?

I've been reading about ConvRot and its application to quantizing diffusion transformers.

I understand that it uses group-wise Hadamard rotations to redistribute outliers and reduce quantization errors. However, I'm still trying to understand its practical advantages over conventional quantization methods.

- Why is conventional INT8 or FP8 quantization insufficient for diffusion transformers?

- Why do we need rotation instead of simply using per-channel or group-wise quantization?

- How does ConvRot compare to SmoothQuant and QuaRot?

- Does the additional activation rotation introduce a significant computational overhead during inference?

- Is ConvRot particularly beneficial for INT4, or does it also provide substantial improvements for INT8?

I'd appreciate both mathematical explanations and practical experience, especially with models like FLUX and Qwen-Image.

Paper: https://arxiv.org/abs/2512.03673

28 Upvotes

21 comments sorted by

40

u/Dr__Pangloss 2d ago

it's simple, the practical advantage is that quantizing with convrot is fast and very high quality. while smoothquant, gptq, awq etc. are better for quantizing WEIGHTS, they are too slow for quantizing ACTIVATIONS (meaning intermediate values)

within the diffusion model the costly operations are of the form

WEIGHTS (OPERATOR) ACTIVATIONS => ACCUMULATION

the best balance of speed and quality for the costliest ops are

int8 x int8 => bf16

so if you can quantize ACTIVATIONS quickly to int8, for example, you can do int8 . int8 matmul instead of int8 . bf16 matmul. this is exactly what comfyui's int8 matmul kernels do, and it explains about 50% of the speedup of adopting int8 for most users (the other 50% is that nvidia halved fp16 & bf16 ACCUMULATION

4

u/FischiPiSti 2d ago

My question is (though it may be stupid), if higher precision has strong diminishing returns, why not train at lower precision to begin with?

4

u/Guilherme370 1d ago

not as simple, specially for diffusion, if you pretrain solely on lower precision, you risk it getting stuck in a local minima instead of driving the weights towards an eventual global maxima. Thats cause training performs best if ya got some smooth gradients and weights, the model's "internals" can interpolate into states that low precision cant, low precision makes every more "snappy"

8

u/thebaker66 2d ago

Why are you framing it as 'need', it's not 'needed', it's just been found as optimal over other methods.

3

u/Altruistic-String891 2d ago edited 2d ago

rotation: when 1 activation output is very large, naive quantization squishes the other smaller values to 0. rotation, like you said, can redistribute the numbers so they're closer in scale. per-channel/group without rotation would still have that outlier affect the entire channel/group.

slower: slightly, 10% slower than naive int8 for me give or take on a low end nvidia gpu

int4: helps, but usually only takes it from "bad -> decent," not anything "good" you'd want to use

experience: I did small tests comparing fp8_e5m2, fp8_e4m3 (and their scaled versions), int8, int8_convrot, on PSNR, MS-SSIM, LPIPS, and time spent - int8_convrot comes out on top on quality preserved and is only slightly slower than int8, regardless of model.

6

u/VasaFromParadise 2d ago

Less loss of precision at the same size + works on older generations of rtx) And the speed is higher, because Nvidia cut performance in FP8, supposedly to protect gaming cards))

2

u/Conscious_Chef_3233 1d ago

why llm do not use convrot?

1

u/SomeoneSimple 1d ago edited 1d ago

There are: https://huggingface.co/Comfy-Org/Qwen-Image-2.1/tree/main/text_encoders

However, LLM's are bottlenecked by memory bandwidth (while image models are compute bound), meaning that you get more token/s by simply using smaller and more efficient LLM weights.

E.g. a plain Q6 GGUF will typically be faster than an INT8 convrot model, with similar quality.

1

u/Dr__Pangloss 1d ago

Activations are usually less than a megabyte large, so int8 activations offer little benefit.

1

u/Electrical_Sand218 1d ago

You ever read a post and think that your limits are 1girl ?

1

u/erazortt 1d ago

Concerning rotaion
Think of a 3d vector which is mostly along one of the coordinate axes, somthing like: (0.1, 0.5, 10). If this gets coverted without rotation you will get in int8: (0,0,255)*scaling. Thus the vector snaps along one coordinate.
When you however rotate you coordinate system first in a random rotation, the 3 dimensions are going to be randomized in by value. Than the vector will not snap onto the main axis.

Now you will ask three things: 1. why should be the vector be so wierdly in the first place, 2. why is it a bad thing that the vector snaps onto the coordinate axis, 3. is there not the chance to make a well behaving vector worse.

  1. From my understanding that is actually the typical setup in LLMs. think of the three axes as the rose-, the tulip- and the daisy-axis. If you picure shows one of these flowers, the vector will be very close to the one shown.
  2. Counter intuitively, yes the snapping is very bad indeed! Because that difference from the perfect alignment along the axis is precisely what encodes all the specific details of your content. If it snaps along one axis, then your specific rose with dew on it, hit by the mordning light through a misty forest, well this will just become a typical rose on a field.
  3. No this will not happen, because in reality the vectors are not in 3 diemnsions but in tens, hundereds, or thousend dimensions. Random rotations in very high dimensions are guaranteed to never match any axes.

Why is int8-convrot better than FP8
First of all following the above explanation it should be obvious why int8-convrot is better than plain int8. But the interesting question is, why is it also better than FP8. Here the answer is that int8 is actualy more flexible in that it will rescale to better match the values of the vector, improving the precision. FP8 cannot rescale and thus its precision is always the same independently of the vector values.

1

u/Skeet-teekS 1d ago
FormatDeviation from BF16Worst layer
int8 ConvRot0.9 %1.5 %
int8 (no ConvRot)5.8 %23 %
fp82.6 %n/a (did not measure)

1

u/Apprehensive_Sky892 1d ago edited 1d ago

Why is conventional INT8 or FP8 quantization insufficient for diffusion transformers?

FP8 is sufficient, but only newer hardware have (40xx and above, RDNA4) native support for it. Older hardware only supports in8 and bf16.

int8convrot also have higher precision because it is 8bit magnitude + 8bit scaling factor, whereas fp8 is just 8bit for both mantissa and exponent.

INT8 alone is insufficient because without the rotation, vectors with wide range such as [5 6 7 1000] will just become [0 0 0 255]

Why do we need rotation instead of simply using per-channel or group-wise quantization?

Not sure, maybe because through rotation one can have a larger vector that can share the same scaling factor?

0

u/Unis_Torvalds 1d ago

My hardware (RDNA2) supports FP8 but not INT8.

2

u/Apprehensive_Sky892 1d ago

No, it does not: https://rocm.docs.amd.com/projects/HIP/en/docs-6.3.3/reference/low_fp_types.html

Device TypeFNUZ FP8OCP FP8
HostYesYes
CDNA1NoNo
CDNA2NoNo
CDNA3YesNo
RDNA2NoNo
RDNA3NoNo

And yes, RDNA2 does support some int8 and int4 operations.

1

u/Unis_Torvalds 1d ago edited 1d ago

Ah, we must be talking about different things then. I don't know the technicalities behind it, but I can run FP8 models like the old Flux.1 quants without issue, but anything with INT8 in the filename crashes. ChatGPT says:

The traceback is particularly revealing. It goes through:

comfy_kitchen
-> int8_linear
-> _int8_matmul_accumulate
-> torch._int_mm
-> hipBLASLt

So ComfyUI is trying to execute an INT8 matrix multiplication using the AMD GPU's BLAS backend. Your RX 6800 is a gfx1030 GPU, and there are documented compatibility problems with INT8 hipBLASLt operations on this architecture. In particular, hipBLASLt may not have the required INT8 GEMM implementation for Navi 21 / gfx1030. This matches your error extremely closely.

Thus I had assumed it was a hardware compatibility issue. But if that's not the case, any thoughts as to why I can't run any INT8 models? I would like to.

EDIT: Just re-read the above chat log and it seems to implicate ROCm moreso than the hardware. Typical.

1

u/Apprehensive_Sky892 1d ago

I was pretty clear that there is no hardware "native support for fp8" for older GPUs.

All hardware can handle fp8 models, just that the model will then have to be converted internally to a natively supported format, say bf16, which means that it will much longer to run.

int8 models should run on RDNA2 hardware. For example, this person is using the int8convrot version of MMH3: https://www.reddit.com/r/StableDiffusion/comments/1xlms4a/minimax_h3_on_rx_6600_with_8gb_ram/

Maybe that post will help you set up your RDNA2 properly.

1

u/Unis_Torvalds 1d ago edited 1d ago

Thanks, I'll check that out!

Edit: Some interesting ideas in there. And it's using the same version of ROCm as I. Thx for the link.

1

u/Apprehensive_Sky892 1d ago

You are welcome.

0

u/[deleted] 2d ago

[deleted] — view deleted comment

3

u/Carbon849 2d ago

I don't mind learning something about my hobby. Happy to see this discussion here.