QT-DOG: QUANTIZATION-AWARE TRAINING FOR DOMAIN GENERALIZATION

November 30, 2025 · View on GitHub

Saqib Javed, Hieu Le, Mathieu Salzmann

Website arXiv

QT-DoG enhances domain generalization by utilizing quantization to promote flatter minima in the loss landscape, which reduces overfitting to source domains and improves performance on unseen data. It significantly reduces model size and computational overhead without sacrificing accuracy, making it resource-efficient and suitable for real-world applications. Additionally, QT-DoG generalizes across various datasets, architectures, and quantization algorithms, and can be seamlessly combined with other domain generalization techniques, demonstrating its robustness and adaptability.

Citation

If you find our work useful. Please consider giving a star :star: and a citation.

@InProceedings{pmlr-v267-javed25a,
  title = 	 {{QT}-{D}o{G}: Quantization-Aware Training for Domain Generalization},
  author =       {Javed, Saqib and Le, Hieu and Salzmann, Mathieu},
  booktitle = 	 {Proceedings of the 42nd International Conference on Machine Learning},
  pages = 	 {26981--27004},
  year = 	 {2025},
  editor = 	 {Singh, Aarti and Fazel, Maryam and Hsu, Daniel and Lacoste-Julien, Simon and Berkenkamp, Felix and Maharaj, Tegan and Wagstaff, Kiri and Zhu, Jerry},
  volume = 	 {267},
  series = 	 {Proceedings of Machine Learning Research},
  month = 	 {13--19 Jul},
  publisher =    {PMLR},
  pdf = 	 {https://raw.githubusercontent.com/mlresearch/v267/main/assets/javed25a/javed25a.pdf},
  url = 	 {https://proceedings.mlr.press/v267/javed25a.html}
}

Preparation

Dependencies

pip install -r requirements.txt

Datasets

python -m domainbed.scripts.download --data_dir=/my/datasets/path

Environment

Environment details used for our study.

	Python: 3.8.10
	PyTorch: 1.10.1+cu113
	Torchvision: 0.11.2+cu113
	CUDA: 11.3
	CUDNN: 8200
	NumPy: 1.19.4
	PIL: 8.1.0

How to Run

train_all.py script conducts multiple leave-one-out cross-validations for all target domain.

python train_all.py exp_name --dataset PACS --data_dir /my/datasets/path --quant 1 --q_steps 100 

Example results on PACS with ResNet-50:

AlgorithmArtCartoonPaintingSketchAvg.SizeModels trained
ERM (our runs)89.879.796.872.584.71x1
SWAD89.383.497.382.588.11x1
EoA90.583.498.082.588.66x6
DiWA90.683.498.283.889.01x60
QT-DoG89.182.496.982.387.80.22x1
EoQ90.783.798.284.889.31x5

In this example, QT-DoG achieves a Domain Generalization (DG) performance of 87.8% on the PACS dataset. However, when ensembling using the same method as Ensemble of Averages (EoA), our EOQ approach achieves state-of-the-art results, despite being more compact in size.

Results

Quantizing Vision Transformers

Comparison of performance on PACS and TerraInc datasets with and without QT-DoG quantization of ERM_ViT using the DeiT-Small backbone.

AlgorithmBackbonePACSTerraIncCompression
ERM_ViTDeiT-Small84.3 ± 0.243.2 ± 0.2-
ERM-SD_ViTDeiT-Small86.3 ± 0.244.3 ± 0.2-
ERM_ViT + QT-DoGDeiT-Small86.2 ± 0.345.6 ± 0.44.6x

Combination with other methods

Results of PACS and Terra Incognita datasets incorporating QT-DoG with CORAL and MixStyle. "C" represents the compression factor of the model.

AlgorithmPACSTerraIncC
CORAL85.5 ± 0.647.1 ± 0.2-
CORAL + QT-DoG86.9 ± 0.250.6 ± 0.34.6x
MixStyle85.2 ± 0.344.0 ± 0.4-
MixStyle + QT-DoG86.8 ± 0.347.7 ± 0.24.6x

Main Results

Flatness Plots

We used the same method as SWAD to plot the loss flatness. Below are the local loss flatness plots for QT-DoG along with other methods.

Acknowledgements

Our code is based on SWAD and LSQ repository. We thank the authors for releasing their code.