Current, QAT API doesn’t support multiple output quantizer on QuantizeConfig. (We have to supports at some point.)


Our default QAT API scheme follows some practice as a paper on bottom of this doc : Quantization aware training  |  TensorFlow Model Optimization 3
But QAT API supports custom quantization scheme, so you can change the quantizer by create new scheme or quantizeConfig if you want to.


QAT default scheme is only for TFLite int8 quantization. (But API supports other deployment logic by implements scheme.) This QAT default scheme is sometimes changed when we add some optimized kernels on TFLite. (e.g. if we added FC-Relu fused layer to TFLite, then scheme also reflect that and remove fakequant between FC and relu.), And documentation for this underlying logic is not ready yet.

It also depends on TFLite converter and kernel.
I know it’s not easy to find where you should add quantizer.
There’s some tip to know where you should add quantizer:

A. Run PTQ and see tflite structure. most of common case, the result from QAT also very similar result except their weights. You may have to add quantizer between PTQ ops.
B. Add quantizer and then run QAT.

B-1. If result TFLite contains useless quantize op, then remove quantizer on that location.
B-2. If some op is not quantize, then we have to add more quantizer around that op.