google / aqt

Apache License 2.0
247 stars 25 forks source link

Add support asymmetric fake-quantization to AQTv2. #675

Open copybara-service[bot] opened 1 month ago

copybara-service[bot] commented 1 month ago

Add support asymmetric fake-quantization to AQTv2.

Integration of native quantization with biases will require computing the cross terms, likely in the AQT operation quantizer (DefaultGeneralQuantizer).

Itemized changes:

I additionally tested this change by training MNIST models using flax_e2e_model. With symmetric quantization the model fails to converge for config.config_v4(fwd_bits=2, dlhs_bits=None, drhs_bits=None) (due to NaN losses). With asymmetric quantization the model converges even with config.config_v4(fwd_bits=2, dlhs_bits=2, drhs_bits=4).