ARCQuant icon indicating copy to clipboard operation
ARCQuant copied to clipboard

Redundant scaling in quantize.py

Open SubSir opened this issue 10 months ago • 1 comments

Description

I noticed a small typo in the quantization function within model/quantize.py. It's a logical error and it does not affect the final output because scale is typically 1 when called.

Location

File: model/quantize.py Line: [L268](https://github.com/actypedef/ARCQuant/blob/main/model/quantize.py#L268)

return torch.cat([q_x, q_error_k], dim=1) * scale, scale_x, scale

The Issue

The return value is already multiplied by scale here. However, in model/qLinearLayer.py at [L71](https://github.com/actypedef/ARCQuant/blob/main/model/qLinearLayer.py#L71), the output is multiplied by scale again:

y = F.linear(qx, self.W) * scale * self.scale

SubSir avatar Jan 26 '26 09:01 SubSir

Hi @SubSir ,

Thank you for your interest in ARCQuant!

You are correct. In the pseudo-quantization mode, the dequantization process is already pre-performed within model/quantize.py. Therefore, the additional dequantization step in model/qLinearLayer is indeed redundant.

We will fix this issue in a future update. Thanks for pointing this out!

actypedef avatar Jan 26 '26 10:01 actypedef