QT-DoG: Quantization-Aware Training for Domain Generalization

## Abstract

Abstract Domain Generalization (DG) aims to train models that perform well not only on the training (source) domains but also on novel, unseen target data distributions. A key challenge in DG is preventing overfitting to source domains, which can be mitigated by finding flatter minima in the loss landscape. In this work, we propose Quantization-aware Training for Domain Generalization (QT-DoG) and demonstrate that weight quantization effectively leads to flatter minima in the loss landscape, thereby enhancing domain generalization. Unlike traditional quantization methods focused on model compression, QT-DoG exploits quantization as an implicit regularizer by inducing noise in model weights, guiding the optimization process toward flatter minima that are less sensitive to perturbations and overfitting. We provide both theoretical insights and empirical evidence demonstrating that quantization inherently encourages flatter minima, leading to better generalization across domains. Moreover, with the benefit of reducing the model size through quantization, we demonstrate that an ensemble of multiple quantized models further yields superior accuracy than the state-of-the-art DG approaches with no computational or memory overheads. Our extensive experiments demonstrate that QT-DoG generalizes across various datasets, architectures, and quantization algorithms, and can be combined with other DG methods, establishing its versatility and robustness. † † footnotetext: † Corresponding author.

## 1 Introduction

Many works have shown that deep neural networks trained under the assumption that the training and test samples are drawn from the same distribution
fail to generalize in the presence of large training-testing discrepancies, such as
texture (Geirhos et al., ; Bahng et al., ), background (Xiao et al., ), or day-to-night (Dai & Van Gool, ; Michaelis et al., ) shifts. Domain Generalization (DG) addresses this problem and aims to learn models that perform well not only in the training (source) domains but also in new, unseen (target) data distributions (Blanchard et al., ; Muandet et al., ; Zhou et al., ).

In the broader context of generalization, with training and test data drawn from the same distribution, the literature has revealed a relationship between the flatness of the loss landscape and the generalization ability of deep learning models (Keskar et al., ; Dziugaite & Roy, ; Garipov et al., ; Izmailov et al., ; Jiang et al., ; Foret et al., ; Zhang et al., ). This relationship has then been leveraged by many recent works, demonstrating that a flatter minimum also improves Out-of-Distribution (OOD) performance (Cha et al., ; Ramé et al., ; Arpit et al., ). At the heart of all these DG methods lies the idea of weight averaging (Izmailov et al., ), which involves averaging weights from several trained models or at various stages of the training process.

In this work, we demonstrate that flatter minima in the loss landscape can be effectively achieved through weight quantization using Quantization-aware Training (QAT), making it an effective approach for DG. By restricting the possible weight values to a lower bit precision, quantization imposes constraints on the weight space, introducing quantization noise into the network parameters. This noise, as discussed in prior works (An, ; Murray & Edwards, ; Goodfellow et al., ; Hochreiter & Schmidhuber, ), acts as a form of regularization that naturally encourages the optimization process to converge toward flatter minima. Furthermore, our results show that models trained with quantization not only generalize better across domains but also reduce overfitting to source domains. To the best of our knowledge, this is the first work to explicitly explore the intersection of quantization and domain generalization. Through both theoretical insights and empirical validation, we provide strong evidence that QAT promotes flatter minima, leading to enhanced generalization performance on unseen domains.

The benefit of having fast and light-weight quantized models then further allow us to even make an ensemble of them, termed Ensemble of Quantization (EoQ). EoQ achieves superior performance while maintaining the computational efficiency of a single full-precision model.
This stands in contrast to ensemble-based methods like (Ramé et al., ; Arpit et al., ), which require storing and running multiple full-precision models. With our approach, quantization not only improves generalization but also reduces the model’s memory footprint and computational cost at inference. As shown in Figure 1, EoQ yields a model with a memory footprint similar to the state-of-the-art single-model DG approaches and much smaller than other ensemble-based methods, yet outperforms all its competitors in terms of accuracy.

Our contributions can be summarized as follows:

- •
Quantization for Domain Generalization. We are the first to explore the intersection of quantization and domain generalization, showing that, unlike conventional methods that primarily use quantization for compression, quantization-aware training can significantly improve generalization performance on unseen domains.
- •
Flat Minima via QAT: We theoretically and empirically demonstrate that QAT encourages flatter minima, enhancing the generalization of models to unseen domains. Additionally, we show that QAT stabilizes model behavior on OOD data during training.
- •
Resource Efficiency: In contrast to traditional DG methods that often increase model size or computational cost, QT-DoG not only improves generalization but also significantly reduces the model size, enabling efficient deployment in real-world applications. EoQ, for instance, requires nearly 6 times less memory than Arpit et al. () and 12 times less training compute compared to Ramé et al. (), which trains 60 models for diverse averaging.
- •
EoQ We introduce EoQ, a strategy that combines the power of quantization and ensembling for generalization. EoQ achieves state-of-the-art results on the DomainBed benchmark while matching the computational cost and memory footprint as a single full-precision model.

Our code and models will be made publicly available.

Figure: Figure 1: Performance Comparison on the Domainbed Benchmark. We show the average accuracy on 5 different datasets. One Model refers to methods training a single ResNet-50 model. Multiple Models refers to training M models for averaging or ensembling, which affects the training cost. We compare QT-DoG and EoQ to other state-of-the-art methods. The marker size is proportional to the memory footprint. EoQ shows superior performance despite being 4 times smaller than its full-precision counterpart. Additionally, QT-DoG demonstrates comparable performance to One Model methods, despite its significantly smaller size.
Refer to caption: x1.png

## 2 Related Work

### 2.1 Domain Generalization

Numerous multi-source domain generalization (DG) methods have been proposed in the past. In this section, we review some of the recent approaches, categorizing them into different groups based on their methodologies.

#### 2.1.1 Domain Alignment

The methods in this category focus on reducing the differences among the source domains and learn domain-invariant features (Arjovsky et al., ; Krueger et al., ; Rame et al., ; Sun et al., ; Sagawa et al., ; Ganin et al., ; Li et al., ; Cheng et al., ). The core idea is that, if the learnt features are invariant across the different source domains, they will also be robust to the unseen target domain. For matching feature distributions across source domains, DANN (Ganin et al., ) uses an adversarial loss while CORAL (Sun & Saenko, ) and DICA (Muandet et al., ) seek to align latent statistics of different domains. Unfortunately, most of these methods fail to generalize well and were shown not to outperform ERM on various benchmarks (Gulrajani & Lopez-Paz, ; Ye et al., ; Koh et al., ).

#### 2.1.2 Regularization

In the literature, various ways of regularizing models (implicit and explicit) have also been proposed to achieve better generalization. For example, invariant risk minimization (Arjovsky et al., ) relies on a regularization technique such that the learned classifier is optimal even under a distribution shift. Moreover, (Huang et al., ) tries to suppress the dominant features learned from the source domain and pushes the network to use other features correlating with the labels. Furthermore, (Krueger et al., ) proposes risk extrapolation that uses regularization to minimize the variance between domain-wise losses, considering that it is representative of the variance including the target domain.

#### 2.1.3 Vision Transformers

Recent studies have increasingly utilized vision transformers for domain generalization (Shu et al., ; Sultana et al., ). Some approaches enhance vision transformers by integrating knowledge distillation (Hinton et al., ) and leveraging text modality from CLIP (Radford et al., ) to learn more domain-invariant features (Moayeri et al., ; Addepalli et al., ; Chen et al., ; Huang et al., ; Liu et al., ).

#### 2.1.4 Ensembling

Ensembling of deep networks (Lakshminarayanan et al., ; Hansen & Salamon, ; Krogh & Vedelsby, ) is a foundational strategy and has consistently proven to be robust in the past. Many works have been proposed to train multiple diverse models and combine them to obtain better in-domain accuracy and robustness to domain shifts (Arpit et al., ; Thopalli et al., ; Mesbah et al., ; Li et al., ; Lee et al., ; Pagliardini et al., ). However, ensembles require multiple models to be stored and a separate forward pass for each model, which increases the computational cost and memory footprint, especially if the models are large.

#### 2.1.5 Weight Averaging

In contrast to combining or averaging predictions, combining or averaging weights from different training stages or different trained models has also been shown to be robust to OOD data. This approach has been one of the most widely-used techniques in the recent literature (Wortsman et al., ; Matena & Raffel, ; Wortsman et al., ; Gupta et al., ; Choshen et al., ; Wortsman et al., ; Maddox et al., ; Benton et al., ; Cha et al., ; Jain et al., ; Ramé et al., ). For example, SWAD (Cha et al., ) uses weight averaging to facilitate finding a flat minimum
and shows that it reduces overfitting and generalizes better across distribution shifts. Furthermore, DiWA(Rame et al., ) shows that combining weights from various independently trained model offers more diversity in terms of weight distribution and improves the model’s robustness to OOD data.

Arpit et al. () combines the above mentioned two methodologies by proposing an ensemble of models trained with weight averaging. This is shown to yield superior performance to both weight averaging and ensembling when used independently. However, as mentioned before, it comes at the expense of a large memory footprint and computational cost. In this work, we address this by demonstrating that quantization (model compression) can be used to enhance generalization while reducing the computational cost and memory footprint.

### 2.2 Model Quantization

Model quantization is used in deep learning to reduce the memory footprint and computational requirements of deep network. In a conventional neural network, the model parameters and activations are usually stored as high-precision floating-point numbers, typically 32-bit or 64-bit. The process of model quantization entails transforming these parameters into lower bit-width representations, such as 8-bit integers or binary values.
Existing techniques fall into two main categories. Post-Training Quantization (PTQ) quantizes a pre-trained network using a small calibration dataset and is thus relatively simple to implement (Nagel et al., ; Li et al., ; Frantar & Alistarh, ; Zhao et al., ; Cai et al., ; Nagel et al., ; Shao et al., ; Lin et al., ; Chee et al., ). Quantization-Aware Training (QAT) retrains the network
during the quantization process and thus better preserves the model’s full-precision accuracy. Yang et al. (); Esser et al. (); Zhou et al. (); Bhalgat et al. (); Yamamoto (); Yao et al. (); Shin et al. (). In the next section, we provide some background on quantization and on the method we will use in our approach. Our goal in this work is not to introduce a new quantization strategy but rather to demonstrate the impact of quantization on generalization.

## 3 Domain Generalization by Quantization

We build our method on the simple ERM approach to showcase the effects of quantization on the training process and on the generalization to unseen data from a different domain.

Despite the simplicity of this approach, we will show in Section 4.3 that it yields a significant accuracy boost on the test data from the unseen target domain. Furthermore, it stabilizes the behavior of the model on OOD data during training, making it similar to that on the in-domain data. In the remainder of this section, we focus on providing some insights on how quantization enhances DG.

### 3.1 Quantization

Let $w$ be a single model weight to be quantized, $s$ the quantizer step size, and $Q_{N}$ and $Q_{P}$ the number of negative and positive quantization levels, respectively. We define the quantization process that computes $\bar{w}$, a quantized and integer scaled representation of the weights, as

$$ $\bar{w}=\lfloor clip(\nicefrac{{w}}{{s}},-Q_{N},Q_{P})\rceil,$ (1) $$

where the function $clip(k,r_{1},r_{2})$ is defined as

$$ $clip(k,r_{1},r_{2})=\begin{cases}\lfloor k\rceil&\text{if $r_{1}<k<r_{2}$}\\ r_{1}&\text{if $k\leq r_{1}$}\\ r_{2}&\text{if $k\geq r_{2}$}\\ \end{cases}$ (2) $$

Here, $\lfloor k\rceil$ represents rounding $k$ to nearest integer. If we quantize a weight to $b$ bits, for unsigned data $Q_{N}=0$ and $Q_{P}=2^{b}-1$, and for signed data $Q_{N}=2^{b-1}$ and $Q_{P}=2^{b-1}-1$.

Note that the quantization process described in Eq. 1 yields a scaled value. A quantized representation of the data at the same scale as $w$ can then be obtained as

$$ $w_{q}=\bar{w}\times s.$ (3) $$

This transformation results in a discretized weight space that inherently introduces noise. We demonstrate generalization ability of QT-DoG with different quantization methods in section 4.3.4.

### 3.2 Quantization Leads to Flat Minima

In the literature (Rame et al., ; Arpit et al., ; Krueger et al., ; Cha et al., ; Rame et al., ; Foret et al., ), it has been established that a model’s generalization ability can be increased by finding a flatter minimum during training. This is the principle we exploit in our work, but from the perspective of quantization. In practice, ERM can have several solutions with similar training loss values but different generalization ability. Even when the training and test data are drawn from the same distribution, the standard optimizers, such as SGD and Adam (Kingma & Ba, ), often lead to sub-optimal generalization by finding sharp and narrow minima (Keskar et al., ; Dziugaite & Roy, ; Garipov et al., ; Izmailov et al., ; Jiang et al., ; Foret et al., ). This has been shown to be prevented by introducing noise in the model weights during training (An, ; Murray & Edwards, ; Goodfellow et al., ; Hochreiter & Schmidhuber, ). Here,
we argue that quantization inherently induces such noise and thus helps to find flatter minima.

Let $\hat{y_{i}}=f({\bm{x}},{\bm{w}})$ represent the predicted output of the network $f$, which is parameterized by the weights ${\bm{w}}$.
A quantized network can then be represented as

$$ $\displaystyle f({\bm{x}},{\bm{w}}_{q})=f({\bm{x}},{\bm{w}}+\Delta)=\hat{y_{i}} ^{q},$ $$

where ${\bm{w}}_{q}$ denotes the quantized weights and $\hat{y_{i}}^{q}$ the corresponding prediction. The quantized weights can thus be thought of as introducing perturbations $(\Delta)$ to the full-precision weights, akin to noise affecting the weights.

Such noise induced by the weight quantization can also be seen as a form of regularization, akin to more traditional methods. For small perturbations, (An, ; Murray & Edwards, ; Goodfellow et al., ) show that this type of regularization encourages the parameters to navigate towards regions of the parameter space where small perturbations of the weights have minimal impact on the output, i.e., flatter minima.

When noise is introduced via quantization, second-order Taylor series approximation of the loss function for the perturbed weights
${\bm{w}}+\Delta$ can be expressed as

$$ $\mathcal{L}({\bm{w}}+\Delta)\approx\mathcal{L}({\bm{w}})+\nabla\mathcal{L}({ \bm{w}})^{\top}\Delta+\frac{1}{2}\Delta^{\top}\mathcal{H}\Delta,$ (4) $$

where $\mathcal{L}({\bm{w}})$ is the loss at the original weights ${\bm{w}}$, $\nabla L({\bm{w}})$ is the gradient of the loss at ${\bm{w}}$, and
$\mathcal{H}=\nabla^{2}L({\bm{w}})$ is the Hessian matrix, which contains second-order partial derivatives of the loss function with respect to the weights, representing the curvature of the loss surface.

Eq. 4 shows how the quantization noise $\Delta$ interacts with the curvature $\mathcal{H}$ of the loss function. In regions with large curvature (sharp minima), the Hessian
$\mathcal{H}$ has large eigenvalues, and even small perturbations
$\Delta$
result in large increases in the loss (Dinh et al., ). In contrast, in flat regions (small eigenvalues of
$\mathcal{H}$), the loss remains nearly unchanged for small perturbations, encouraging convergence to these flat minima. Therefore, this new loss function with noise induced by quantization encourages model to find a flatter minimum.

In the case of quantization-aware training, the induced noise $\Delta$ is influenced by the quantization bin width or the quantizer step size $s$, and thus ranges between $-\frac{s}{2}$ and $+\frac{s}{2}$. This $s$ is directly dependent on the quantization levels or the bit-width chosen for weight quantization. As the number of bits per weight decreases, the amount of induced noise increases. Hence, the impact of the additional noise can be weighed by choosing an optimal bit-width. As will be shown in Section 4, certain bit-widths thus yield better and flatter minima that enhance generalization. However, if we induce too much noise(very low bit-precision), the weight update rule is dominated by the noise, and the model converge to sub-optimal solutions as shown in the appendix.

Moreover, Rissanen (); Hochreiter & Schmidhuber () show that a flatter minimum corresponds to a low complexity network and requires fewer bits of information per weight. More importantly, Hochreiter & Schmidhuber () demonstrates the importance of the bit-precision of the network weights and adds a regularization term in the loss function that seeks to lower the weight bit-precision to lead to flatter minima. Here, by using quantization, we are explicitly reducing bit-precision of the network weights, thus achieving the same goal.

Figure: Figure 2: Local Flatness Comparison: We plot the average training (left) and testing (right) local flatness $\mathcal{F}\gamma({\bm{w}})$ (Eq. 5) for ERM (Gulrajani & Lopez-Paz, ), SAM (Foret et al., ), SWA (Izmailov et al., ) and SWAD (Cha et al., ) by varying the radius $\gamma$ on different domains of PACS. We evaluate the training flatness $\mathcal{F}\gamma^{S}({\bm{w}})$ on the seen domains (left) and the test flatness $\mathcal{F}_{\gamma}^{T}({\bm{w}})$ on the unseen domains (right).
Refer to caption: x2.png

### 3.3 Empirical Analysis of Quantization-aware Training and Flatness

In this section, we demonstrate that a flatter minimum is reached when incorporating quantization in the ERM process.
Our loss flatness analysis shows that QT-DoG can find a flatter minimum in comparison to not only ERM but also SAM (Foret et al., ) and SWA (Izmailov et al., ).

Following the approach in Cha et al. (), we quantify local flatness $\mathcal{F}_{\gamma}({\bm{w}})$ by measuring the expected change in loss values between a model with parameters ${\bm{w}}$ and a perturbed model with parameters $|{\bm{w}}^{\prime}|=|{\bm{w}}|+\gamma$, where ${\bm{w}}^{\prime}$ lies on a sphere of radius $\gamma$ centered at ${\bm{w}}$.. This is expressed as

$$ $\mathcal{F}_{\gamma}({\bm{w}})=\mathbb{E}_{\|{\bm{w}}^{\prime}\|}[\mathcal{E}( {\bm{w}}^{\prime})-\mathcal{E}({\bm{w}})],$ (5) $$

where $\mathcal{E}({\bm{w}})$ denotes the accumulated loss over the samples of potentially multiple
domains.

For our analysis, we will evaluate flatness in both the source domains and the target domain, and thus $\mathcal{E}({\bm{w}})$ is evaluated using either source samples or target ones accordingly.

As in Cha et al. (), we approximate $\mathcal{F}_{\gamma}({\bm{w}})$ by Monte-Carlo sampling with 100 samples. In Figure 2, we compare the $\mathcal{F}_{\gamma}({\bm{w}})$ of QT-DoG to that of ERM (Gulrajani & Lopez-Paz, ), SAM (Foret et al., ), SWA (Izmailov et al., ) and SWAD (Cha et al., ) for different radii $\gamma$. QT-DoG not only finds a flatter minimum than ERM, SAM and SWA but also yields a comparable flatness to SWAD’s despite being 75% smaller in model size.

### 3.4 Stable Training Process

Here, we demonstrate the robustness of out-of-domain performance to model selection using the in-domain validation set. Specifically, we seek to show that accuracy on the in-domain validation data is a good measure to pick the best model for out-of-domain distribution. Therefore, we assume that during training, the model selection criterion based on this validation data can select the best model for the OOD data even if the model starts to overfit. In other words, it is expected that the out-of-domain evaluation at each point of the training phase should improve or rather stay stable if the model is close to overfitting to the in-domain data.
For these experiments, we use the TerraIncognita dataset (Beery et al., ) and consider the same number of iterations as for the DomainBed protocol (Gulrajani & Lopez-Paz, ).

Figure: Figure 3: Model Quantization improves out-of-domain performance as well as training stability. The plots were computed using the TerraInc dataset with domain L100 (left) and L46 (right) as test domain, and the other domains as training/validation data. The network used for these plots was a ResNet-50. For our quantized models, shown in blue in each plot, we quantized the model after 2000 steps. Note that the model accuracy is not only better with quantization but also much more stable for out of distribution data after the quantization step.
Refer to caption: x5.png

As can be seen in Figure 3, vanilla ERM (without quantization) quickly overfits to the in-domain validation/training dataset. That is, the OOD performance is highly unstable during the whole training process. By contrast, our quantized model is much more stable. Specifically, we quantize our model at 2000 steps, and it can be seen that the model performance on out-of-domain distribution is also unstable before that. Once the model weights are quantized, we see a regularization effect and the performance becomes much more stable on the OOD data. We provide training plots encompassing different domains as target settings for the sake of completeness. This inclusion serves to illustrate that quantization genuinely enhances stability in the training process. On the left, "te_location_100" is considered as target domain while "te_location_46" is used as the target domain for the plot on the right. These experiments evidence that model selection based on the in-domain validation set is much more reliable when introducing quantization into training.

### 3.5 Ensembles of Quantization

For our ensemble creation, we train multiple models and, incorporate quantization into the training process to obtain smaller quantized models. We refer to this as the Ensemble of Quantization (EoQ). As Breiman (), we use the bagging method to combine the multiple predictions. Therefore, the class predicted
by EoQ for an input $\mathbf{x}$ is given by

$$ $\displaystyle\hat{y}=\operatorname*{arg\,max}_{k}\;\textrm{Softmax}\left(\frac {1}{E}\sum_{i=1}^{E}f(\mathbf{x};{{{\bm{w}}}^{i}_{q}})\right)_{k}$ (6) $$

where $E$ is the total number of models in the ensemble, ${{\bm{w}}^{i}_{q}}$ denotes the parameters of the $i^{th}$ quantized model, and the subscript $k$ denotes the $k^{th}$ element of the vector argument. Finally, we use the in-domain validation set performance to pick the best model state (weights) ${{\bm{w}}^{i}_{q}}$ of the $i^{th}$ quantized model used in the ensemble.

## 4 Experiments

### 4.1 Datasets and Metrics

We demonstrate the effectiveness of our proposed method on diverse classification datasets used for evaluating multi-source Domain Generalization:

PACS (Li et al., ) is a 7 object classification challenge encompassing four domains, with a total of 9,991 samples. It serves to validate our method in smaller-scale settings. VLCS (Fang et al., ) poses a 5 object classification problem across four domains. With 10,729 samples, VLCS provides a good benchmark for close Out-of-Distribution (OOD), featuring subtle distribution shifts simulating real-life scenarios. OfficeHome (Venkateswara et al., ) comprises a total of 15,588 samples. It presents a 65-way classification challenge featuring everyday objects across four domains.
TerraIncognita (Beery et al., ) addresses a 10 object classification challenge of animals captured in wildlife cameras, with four domains representing different locations. The dataset contains 24,788 samples, illustrating a realistic use-case where generalization is crucial.
DomainNet (Peng et al., ) provides a 345 object classification problem spanning six domains. With 586,575 samples, it is one of the largest datasets.

We report out-of-domain accuracies for each domain and their average, i.e., a
model is trained and validated on training domains and evaluated on the unseen target domain. Each out-of-domain performance is an average of three different runs with different train-validation splits for the quantized models. We then combine the predictions of the different quantized models for our EoQ results.

### 4.2 Implementation Details

We use the same training procedure as DomainBed (Gulrajani & Lopez-Paz, ), incorporating additional components from quantization. Specifically, we adopt the default hyperparameters from DomainBed (Gulrajani & Lopez-Paz, ), including a batch size of 32 (per-domain). We employ a ResNet-50 (He et al., ) pre-trained on ImageNet (Russakovsky et al., ) as initial model and use a learning rate of 5e-5 along with the Adam optimizer, and no weight decay. Following SWAD(Cha et al., ), the models are trained for 15,000 steps on DomainNet and 5,000 steps on the other datasets. In the training process, we keep a specific domain as the target domain, while the remaining domains are utilized as source domains. During this training phase, 20% of the samples are used for validation and model selection. We validate the model every 300 steps using held-out data from the source domains, and assess the final performance on the excluded domain (target).

We use LSQ (Esser et al., ) and INQ (Zhou et al., ) for model quantization, with the same configuration as existing quantization methods (Esser et al., ; Bhalgat et al., ; Dong et al., ; Yao et al., ; Zhou et al., ), where all layers are quantized to lower bit precision except the last one. We quantize the models at 8,000 steps for DomainNet and 2,000 steps for the other datasets. Moreover, each channel in a layer has a different scaling factor.

### 4.3 Results

In this section, we demonstrate the superior performance of our proposed approach by comparing it to recent state-of-the-art DG methods. We also present some visual evidence for the better performance of our quantization approach. Furthermore, we show how quantization not only enhances model generalization but also yields better performance on in-domain data.

**Table 1: Comparison with domain generalization methods. Performance benchmarking on 5 datasets of the DomainBed benchmark. Highest accuracy is shown in bold, while second best is underlined. ^† do not report confidence interval and ensembles do not have confidence interval because an ensemble uses all the models to make a prediction. Our proposed method is colored in Gray. Average accuracies and standard errors are reported from three trials. For all the reported results, we use the same training-domain validation protocol as (Gulrajani & Lopez-Paz, ). $Models$ corresponds to the number of models trained during training and $Size$ corresponds to the relative network size.**
| Algorithm | Models | Size | PACS | VLCS | Office | TerraInc | DomainNet | Avg. |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ResNet-50 (25M Parameters, Pre-trained on ImageNet) |  |  |  |  |  |  |  |  |
| ERM | 1 | 1x | 84.7 $\pm$ 0.5 | 77.4 $\pm$ 0.3 | 67.5 $\pm$ 0.5 | 46.2 $\pm$ 0.4 | 41.2 $\pm$ 0.2 | 63.8 |
| IRM | 1 | 1x | 84.4 $\pm$ 1.1 | 78.1 $\pm$ 0.0 | 66.6 $\pm$ 1.0 | 47.9 $\pm$ 0.7 | 35.7 $\pm$ 1.9 | 62.5 |
| Group DRO | 1 | 1x | 84.1 $\pm$ 0.4 | 77.2 $\pm$ 0.6 | 66.9 $\pm$ 0.3 | 47.0 $\pm$ 0.3 | 33.7 $\pm$ 0.2 | 61.8 |
| Mixup | 1 | 1x | 84.3 $\pm$ 0.5 | 77.7 $\pm$ 0.4 | 69.0 $\pm$ 0.1 | 48.9 $\pm$ 0.8 | 39.6 $\pm$ 0.1 | 63.9 |
| MLDG | 1 | 1x | 84.8 $\pm$ 0.6 | 77.1 $\pm$ 0.4 | 68.2 $\pm$ 0.1 | 46.1 $\pm$ 0.8 | 41.8 $\pm$ 0.4 | 63.6 |
| CORAL | 1 | 1x | 86.0 $\pm$ 0.2 | 77.7 $\pm$ 0.5 | 68.6 $\pm$ 0.4 | 46.4 $\pm$ 0.8 | 41.8 $\pm$ 0.2 | 64.1 |
| MMD | 1 | 1x | 85.0 $\pm$ 0.2 | 76.7 $\pm$ 0.9 | 67.7 $\pm$ 0.1 | 49.3 $\pm$ 1.4 | 39.4 $\pm$ 0.8 | 63.6 |
| Fish | 1 | 1x | 85.5 $\pm$ 0.3 | 77.8 $\pm$ 0.3 | 68.6 $\pm$ 0.4 | 45.1 $\pm$ 1.3 | 42.7 $\pm$ 0.2 | 63.9 |
| Fishr | 1 | 1x | 85.5 $\pm$ 0.4 | 77.8 $\pm$ 0.1 | 67.8 $\pm$ 0.1 | 47.4 $\pm$ 1.6 | 41.7 $\pm$ 0.0 | 65.7 |
| SWAD | 1 | 1x | 88.1 $\pm$ 0.4 | 79.1 $\pm$ 0.4 | 70.6 $\pm$ 0.3 | 50.0 $\pm$ 0.4 | 46.5 $\pm$ 0.2 | 66.9 |
| MIRO | 1 | 1x | 85.4 $\pm$ 0.4 | 79.0 $\pm$ 0.0 | 70.5 $\pm$ 0.4 | 50.4 $\pm$ 1.1 | 44.3 $\pm$ 0.2 | 65.9 |
| CCFP | 1 | 1x | 86.6 $\pm$0.2 | 78.9 $\pm$0.3 | 68.9 $\pm$0.1 | 48.6 $\pm$0.4 | 41.2 $\pm$ 0.0 | 64.8 |
| ARM^† | 1 | 1x | 85.1 | 77.6 | 64.8 | 45.5 | 35.5 | 61.7 |
| VREx^† | 1 | 1x | 84.9 | 78.3 | 66.4 | 46.4 | 33.6 | 61.9 |
| RSC^† | 1 | 1x | 85.2 | 77.1 | 65.5 | 46.6 | 38.9 | 62.7 |
| Mixstyle^† | 1 | 1x | 85.2 | 77.9 | 60.4 | 44.0 | 34.0 | 60.3 |
| SagNet^† | 1 | 1x | 86.3 | 77.8 | 68.1 | 48.6 | 40.3 | 64.2 |
| QT-DoG (ours) | 1 | 0.22x | 87.8$\pm$ 0.3 | 78.4$\pm$ 0.4 | 68.9$\pm$ 0.6 | 50.8$\pm$ 0.2 | 45.1$\pm$0.9 | 66.2 |
| ERM Ens. ^† | 6 | 6x | 87.6 | 78.5 | 70.8 | 49.2 | 47.7 | 66.8 |
| DiWA^† | 60 | 1x | 89.0 | 78.6 | 72.8 | 51.9 | 47.7 | 68.0 |
| EoA^† | 6 | 6x | 88.6 | 79.1 | 72.5 | 52.3 | 47.4 | 68.0 |
| DART | 4-6 | 4x-6x | 78.5 ± 0.7 | 87.3 ± 0.5 | 70.1 ± 0.2 | 48.7 ± 0.8 | 45.8 ± 0.0 | 66.1 |
| EoQ (ours)^† | 5 | 1.1x | 89.3 | 79.5 | 72.3 | 53.2 | 47.9 | 68.4 |

#### 4.3.1 Comparison with DG methods

Table 1 reports out-of-domain performances on five
DG benchmarks and compares our proposed approaches to prior works.
These results demonstrate the superiority of EoQ across five DomainBed datasets, with an average improvement of 0.4% over the state-of-the-art EoA while reducing the memory footprint by approximately 75%. Compared to DiWA, we significantly reduce the computational burden and memory requirements for training, achieving a 12-fold reduction, as DiWA requires training 60 models for diverse averaging. EoQ achieves the most significant gain (7% improvement) on
TerraIncognita (Beery et al., ), with nonetheless substantial gains of 3-5% w.r.t. ERM on PACS (Li et al., ) and DomainNet (Peng et al., ).

The results also demonstrate that simply introducing quantization into the ERM-based approach (Gulrajani & Lopez-Paz, ) surpasses or yields comparable accuracy to many existing works, although the size and computational budget of our quantization-based approach is significantly lower than that of the other methods. For our results in Table 1 and Figure 1, we employed 7-bit quantization on the network. Therefore, as shown in Figure 1, the model size is drastically reduced, becoming more than 4 times smaller than the other methods. Being smaller in memory footprint, our quantization-based approach can utilize ensembling without increasing the memory storage and computational resources. Moreover, quantization not only reduces the memory footprint but also the latency of the model. For example, running a ResNet-50 model on an AMD EPYC 7302 processor yields a latency of 34.28ms for full-precision and 21.02ms for our INT8 quantized model.

Figure: Figure 4: Bit precision analysis for efficient quantization. We show results on out-of-domain test accuracy with two different datasets, i.e., PACS and TerraIncognita. For each bit precision, we report the increase in the test domain accuracy averaged across all domains. The 7-bit quantized model exhibits the maximum increase for both datasets. We quantize the model at 2000 steps.
Refer to caption: x10.png

#### 4.3.2 Bit Precision Analysis

Here, we empirically analyze the effect of different bit-precisions for quantization on the generalization of the model. We perform experiments with four different bit levels and present an analysis in Figure 4 on the PACS (Li et al., ) and TerraIncognita (Beery et al., ) datasets. We report the test(^1^11In-domain results for different bit-precisions are provided in the appendix.) domain accuracy averaged across all domains. For both datasets, 7-bit precision was found to be the optimal bit precision to have the best out-of-domain generalization while maintaining in-domain accuracy. Nonetheless, 8 bits and 6 bits also show improvements, albeit smaller than with 7-bit quantization. These results evidence that, even with a 6 times smaller model, quantization still yields better out-of-domain performance without sacrificing the in-domain accuracy.

#### 4.3.3 Combinations with Other Methods

Since QT-DoG requires no modifications to training procedures or model architectures, it is universally applicable and can seamlessly integrate with other DG methods. As shown in Table 3, we integrate QT-DoG with CORAL (Sun et al., ) and MixStyle (Zhou et al., ). Both CORAL and MixStyle demonstrate improved performance when combined with QT-DoG, reinforcing our theoretical findings that QAT aids in identifying flat minima, thereby enhancing domain generalization.

Figure: Table 2: Model quantization with different quantization algorithms. We report the average target domain accuracy and the average source domain accuracy across all domains in PACS.

#### 4.3.4 Different Quantization Methods

In this section, we perform an ablation study by replacing LSQ (Esser et al., ) with other quantization algorithms. We use INQ (Zhou et al., ) as another quantization-aware training method but also perform quantization using OBC (Frantar et al., ), that uses a more popular post-training quantization (PTQ) approach to quantize a network. We perform this ablation study on the PACS dataset, and the results are shown in Table 2. All the experiments are performed with 7-bit quantization.
We observe that, while the QAT approaches tend to enhance generalization, the PTQ approach fails to do so. This is due to the fact that there is no training involved after the quantization step in PTQ. That is, with PTQ, we do not train the network with quantization noise to find a flatter minimum.

#### 4.3.5 Generality with Vision Transformer

In Table 4, we present the results of quantizing a vision transformer (ERM-ViT, DeiT-small) (Sultana et al., ) for domain generalization. We compare the performance of the baseline ERM-ViT to its quantized counterpart on the PACS and Terra Incognita datasets, demonstrating QT-DoG’s effectiveness across different architectures. The results clearly show that QT-DoG also improves the performance of vision transformers. Additionally, we provide results for ResNeXt-50 32x4d in the appendix, following a similar evaluation as in Arpit et al. ().

**Table 4: Quantization of a Vision Transformer Comparison of performance on PACS and TerraInc datasets with and without QT-DoG quantization of ERM_ViT (Sultana et al., ) with DeiT-Small backbone.**
| Algorithm | Backbone | PACS | TerraInc | Compression |
| --- | --- | --- | --- | --- |
| ERM_ViT | Deit-Small | 84.3 $\pm$ 0.2 | 43.2 $\pm$ 0.2 | - |
| ERM-SD_ViT | Deit-Small | 86.3 $\pm$ 0.2 | 44.3 $\pm$ 0.2 | - |
| ERM_ViT + QT-DoG | Deit-Small | 86.2 $\pm$ 0.3 | 45.6 $\pm$ 0.4 | 4.6x |

#### 4.3.6 Visualizations

GradCAM Results.
In Figure 5, we present some of the examples(^2^22More examples are provided in the appendix.) from the PACS dataset and show GradCAM (Gildenblat & contributors, ) results in the target domain. We perform four different experiments by considering a different target domain for each run, while utilizing the other domains for training. We use the output from the last convolutional layer of the models with and without quantization. Both models are trained under the same settings as in Gulrajani & Lopez-Paz (). For our method, we quantize the model after 2000 iteration and employ 7-bit precision as it provides the best out-of-domain performance.

Figure: Figure 5: GradCAM visualization for ERM (Gulrajani & Lopez-Paz, ) and QT-DoG. We show results on the PACS dataset (Li et al., ) and consider a different domain as test domain in each run, indicated by the different columns in the figure.
Refer to caption: extracted/5910573/Images/visq.png

These visualizations evidence that quantization focuses on better regions than ERM, and with a much larger receptive field. In certain cases, ERM does not even focus on the correct image region. It is quite evident that quantization
pushes the model to learn more generalized patterns, leading to a model that is less sensitive to the specific details of the training set. These qualitative results confirm the quantitative evidence provided in Table 1.

## 5 Discussion and Limitations

Despite showing success and surpassing the state-of-the-art methods in terms of performance, EoQ also has some limitations. First, it requires training multiple models like Rame et al. (); Arpit et al. (), to create diversity and form an ensemble. This ensemble creation increases the training computational load. Nevertheless, our quantized ensembling models are much smaller in size.

Another limitation of this work is the challenge of determining the optimal bit precision for achieving the best performance in OOD generalization. In our experiments on the DomainBed benchmark, we identified 7 bits as the optimal precision. However, this may not hold true for other datasets. A potential future direction is to utilize a small number of target images to identify the optimal bit precision, which would significantly reduce the computational overhead associated with this process.

Lastly, given our utilization of a uniform quantization strategy, it would be interesting to investigate whether specific layers can be more effectively exploited than others through mixed-precision techniques to have even better domain generalization performance.

## 6 Conclusion

We introduced QT-DoG, a novel generalization strategy based on neural network quantization. Our approach leverages the insight that QAT can find flatter minima in the loss landscape, serving as an effective regularization method to reduce overfitting and enhance the generalization capabilities. We demonstrated both theoretically and empirically that quantization not only improves generalization but also stabilizes the training process. Our extensive experiments across diverse datasets show that incorporating quantization with an optimal bit-width significantly enhances domain generalization, yielding performance comparable to existing methods while reducing the model size. Additionally, we proposed EoQ, a powerful ensembling strategy that addresses the challenges of memory footprint and computational load by creating ensembles of quantized models. EoQ outperforms state-of-the-art methods while being approximately four times smaller than its full-precision ensembling counterparts.

## Appendix A Per-Domain Performance Improvement

We also report per-domain performance improvement for PACS (Li et al., ) and Terra Incognito (Beery et al., ) dataset. We choose the best model based on the validation set and report the results in 5 and 6. The results with quantization correspond to 7 bit-precision and we perform quantization after 2000 steps. Table  5 and 6 show that EoQ is consistently better than the current state-of-the-art methods across domains for different datasets.

**Table 5: Per-Domain Accuracy Comparison for PACS. We report the accuracy for each domain of the PACS dataset along with the average across all domains. Our proposed quantization is shaded in Gray.**
| Algorithm | Art | Cartoon | Painting | Sketch | Avg. |
| --- | --- | --- | --- | --- | --- |
| ERM (our runs) | 89.8 | 79.7 | 96.8 | 72.5 | 84.7 |
| SWAD | 89.3 | 83.4 | 97.3 | 82.5 | 88.1 |
| EoA | 90.5 | 83.4 | 98.0 | 82.5 | 88.6 |
| DiWA | 90.6 | 83.4 | 98.2 | 83.8 | 89.0 |
| QT-DoG | 89.1 | 82.4 | 96.9 | 82.3 | 87.8 |
| EoQ | 90.7 | 83.7 | 98.2 | 84.8 | 89.3 |

**Table 6: Per-Domain Accuracy Comparison for Terra Incognito. We report the accuracy for each domain of the Terra Incognito dataset along with the average across all domains. Our proposed quantization is shaded in Gray.**
| Algorithm | L100 | L38 | L43 | L46 | Avg. |
| --- | --- | --- | --- | --- | --- |
| ERM (our runs) | 58.2 | 38.3 | 57.1 | 35.1 | 47.2 |
| SWAD | 55.4 | 44.9 | 59.7 | 39.9 | 50.0 |
| DiWA | 57.2 | 50.1 | 60.3 | 39.8 | 51.9 |
| EoA | 57.8 | 46.5 | 61.3 | 43.5 | 52.3 |
| QT-DoG | 60.2 | 46.4 | 55.2 | 41.4 | 50.8 |
| EoQ | 61.8 | 48.2 | 59.2 | 43.7 | 53.2 |

## Appendix B Bit Precision Analysis Extended

In contrast to main manuscript, Table 7 provides all the results in a tabular form. We show how quantization outperforms the vanilla ERM approach. This shows the superior performance of quantization over ERM despite being more than 6 times smaller in the case of 5 bit-precision.

**Table 7: Model quantization with different bit-precisions vs vanilla ERM. We report the average target domain accuracy as well as the average source domain accuracy across all domains for the PACS (Li et al., ) and TerraIncognita (Beery et al., ) datasets. Quantization not only enhances the generalization ability but also retains the source domain performance. QT-DoG(x) indicates a model quantized with x bit-precision.**
| Algorithm | Compression | PACS | TerraInc |  |  |
| --- | --- | --- | --- | --- | --- |
| In-domain | Out-domain | In-domain | Out-domain |  |  |
| ERM (our runs) | - | 96.9 $\pm$ 0.1 | 84.7 $\pm$ 0.5 | 91.7 $\pm$ 0.2 | 47.2 $\pm$ 0.4 |
| QT-DoG(8) | 4x | 97.0 $\pm$ 0.1 | 85.0 $\pm$ 0.1 | 90.9 $\pm$ 0.2 | 49.1 $\pm$ 0.1 |
| QT-DoG(7) | 4.6x | 97.3 $\pm$ 0.2 | 87.8 $\pm$ 0.3 | 92.3 $\pm$ 0.2 | 50.8$\pm$ 0.2 |
| QT-DoG(6) | 5.3x | 97.1 $\pm$ 0.1 | 86.5 $\pm$ 0.1 | 91.1 $\pm$ 0.0 | 49.0 $\pm$ 0.3 |
| QT-DoG(5) | 6.4x | 97.0 $\pm$ 0.1 | 85.3 $\pm$ 0.4 | 91.0 $\pm$ 0.1 | 48.4 $\pm$ 0.2 |

However, as shown in Table 8, decreasing bit-precision through quantization does not always improve performance above the baseline; after a point, there is a tradeoff between compression and generalization. Specifically, our experiments with 4-bit precision and lower did not yield satisfactory results - see the Table below. Finding the sweet spot for balancing speed and performance can be an interesting research direction. Our results evidence that there exist configurations that can improve both speed and performance.

**Table 8: Effect of aggressive quantization. Performance comparison between ERM and QT-DoG with varying bit-precision on PACS.**
| Algorithm | Bit-Precision | PACS |
| --- | --- | --- |
| ERM | 32 | 84.7 $\pm$ 0.5 |
| QT-DoG | 7 | 87.8 $\pm$ 0.3 |
| 6 | 86.5 $\pm$ 0.1 |  |
| 5 | 85.3 $\pm$ 0.4 |  |
| 4 | 84.3 $\pm$ 0.3 |  |
| 3 | 83.3 $\pm$ 0.4 |  |
| 2 | 82.8 $\pm$ 0.2 |  |

## Appendix C Experiments with larger pre-training datasets

We also show experimental results with ResNeXt-50-32x4 in Table 9. Note that
both ResNet-50 and ResNeXt-50-32x4d have 25M parameters. However, ResNeXt-50-32x4d is pre-trained on a larger dataset i.e Instagram 1B images(Yalniz et al., ). It is evident from Table 9 that incorporating quantization into training consistenlty improve accuracy even when a network is pre-trained on a larger dataset. Furthermore, EoQ again showed superior performance in comparison to other methods across five DomainBed datasets.

**Table 9: Comparison with other methods for ResNeXt-50. Performance benchmarking on 5 datasets of the DomainBed benchmark. Highest accuracy is shown in bold, while second best is underlined. Ensembles^† do not have confidence interval because an ensemble uses all the models to make a prediction. Our proposed method is colored in Gray. Average accuracies and standard errors are reported from three trials. For all the reported results, we use the same training-domain validation protocol as (Gulrajani & Lopez-Paz, ). $M$ corresponds to the number of models trained during training and $S$ corresponds to the relative network size.**
| Algorithm | M | S | PACS | VLCS | Office | TerraInc | DomainNet | Avg. |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ResNeXt-50 32x4d (25M Parameters, Pre-trained 1B Images) |  |  |  |  |  |  |  |  |
| ERM | 1 | 1x | 88.7 $\pm$ 0.3 | 79.0 $\pm$ 0.1 | 70.9 $\pm$ 0.5 | 51.4 $\pm$ 1.2 | 48.1 $\pm$ 0.2 | 67.7 |
| SMA | 1 | 1x | 92.7 $\pm$ 0.3 | 79.7 $\pm$ 0.3 | 78.6 $\pm$ 0.1 | 53.3 $\pm$ 0.1 | 53.5 $\pm$ 0.1 | 71.6 |
| QT-DoG (ours) | 1 | 1x | 92.9 $\pm$ 0.3 | 79.2 $\pm$ 0.4 | 78.9 $\pm$ 0.3 | 54.1 $\pm$ 0.2 | 53.9 $\pm$ 0.2 | 71.8 |
| ERM Ens.^† | 6 | 6x | 91.2 | 80.3 | 77.8 | 53.5 | 52.8 | 71.1 |
| EoA^† | 6 | 6x | 93.2 | 80.4 | 80.2 | 55.2 | 54.6 | 72.7 |
| EoQ^† (ours) | 5 | 1.1x | 93.5 | 80.3 | 80.3 | 55.6 | 54.8 | 72.9 |

## Appendix D In-domain Performance Improvement using Quantization

We further study the in-domain test accuracy of our quantization approach without ensembling on PACS and TerraIncognita datasets.

As (Cha et al., ), we split the in-domain datasets into
training (60%), validation (20%), and test (20%) sets. We choose the best model based on the validation set and report the results on the test set in Table 10. The results with quantization correspond to 7 bit-precision.

QT-DoG also enhances the in-domain performance. The regularization effect introduced by quantization prevents the model from overfitting to edge cases and pushes it to learn more meaningful and
generalizable features, which we also demonstrate in Section 4.3.6. As the training data consists of various domains and the quantization limits the range of weight values, it discourages the model from becoming overly complex and overfitting to the noise in the training data. Therefore, the model is more robust to minor input fluctuations.

**Table 10: Comparison between generalization methods on PACS and TerraInc for IID settings. We report the accuracy averaged across all domains. Our proposed approach is shaded in Gray. Highest accuracy is shown in bold, while second best is underlined.**
| Method | PACS | TerraInc | Compression |
| --- | --- | --- | --- |
| ERM | 96.6 $\pm$ 0.2 | 90.1 $\pm$ 0.2 | - |
| SAM | 97.3 $\pm$ 0.1 | 90.8 $\pm$ 0.1 | - |
| SWA | 97.1 $\pm$ 0.1 | 90.7 $\pm$ 0.1 | - |
| SMA | 96.8 $\pm$ 0.2 | 90.7 $\pm$ 0.4 | - |
| SWAD | 97.7 $\pm$ 0.2 | 90.8 $\pm$ 0.3 | - |
| QT-DoG | 97.3 $\pm$ 0.2 | 91.1 $\pm$ 0.2 | $\sim$4.6x |

## Appendix E Visualization

### E.1 More GradCAM Results

In Figure 7, 8, 9, 10, we present some of the examples from the Terra dataset and show GradCAM (Gildenblat & contributors, ) results on the target domain. We use the output from the last convolutional layer of the models with and without quantization for GradCAM. Similar to our experiments on PACS dataset, we perform four different experiments by considering a different target domain for each run, while utilizing the other domains for training. Both models are trained with the similar settings as (Gulrajani & Lopez-Paz, ). For quantization method, we quantized the model after 2000 iteration and employ 7 bit-precision as it provides the best out-of-domain performance. Moreover, we present some more examples for PACS dataset in Figure 6

These visualizations further proves that quantization pushes the model to be less sensitive to the specific details of the training set.

Figure: Figure 6: GradCAM visualization for ERM (Gulrajani & Lopez-Paz, ) and QT-DoG. We show results on the PACS dataset (Li et al., ) and consider a different domain as test domain in each run, indicated by the different rows in the figure.
Refer to caption: extracted/5910573/Images/GRADCAM.png

## Appendix F Reproducibility

To guarantee reproducibility, we will provide the source code
publicly along with the details of the environments and dependencies. We will also provide instructions to reproduce the main results of Table 1 in the main paper. Furthermore, we will also share instructions and code to plot the loss surfaces and GradCAM results.

Every experiment in our work was executed on a single NVIDIA A100, Python 3.8.16, PyTorch 1.10.0,
Torchvision 0.11.0, and CUDA 11.1.

Figure: Figure 7: Visualization of GradCAM results on the Terra Incognito dataset with L38 as test domain. We show original image, GradCAM with ERM (Gulrajani & Lopez-Paz, ) and GradCAM with QT-DoG [Left to Right].
Refer to caption: extracted/5910573/Images/L38/108.jpg

Figure: Figure 8: Visualization of GradCAM results on the Terra Incognito dataset with L46 as test domain. We show original image, GradCAM with ERM (Gulrajani & Lopez-Paz, ) and GradCAM with QT-DoG [Left to Right].
Refer to caption: extracted/5910573/Images/L46/12.jpg

Figure: Figure 9: Visualization of GradCAM results on the Terra Incognito dataset with L43 as test domain. We show original image, GradCAM with ERM (Gulrajani & Lopez-Paz, ) and GradCAM with QT-DoG [Left to Right].
Refer to caption: extracted/5910573/Images/L43/15.jpg

Figure: Figure 10: Visualization of GradCAM results on the Terra Incognito dataset with L100 as test domain. We show original image, GradCAM with ERM (Gulrajani & Lopez-Paz, ) and GradCAM with QT-DoG [Left to Right].
Refer to caption: extracted/5910573/Images/L100/117.jpg

## Peer Reviews

confidence: 4
contribution: 3
initial_rating: 6
presentation: 3
questions: 1. How are the ensemble quantization models trained? The models are trained differently from the beginning or from the quantization step?

2. How does the quantization step (e.g., 2000 for DomainNet) affect the model performance? How do the author select such hyperparameter?
soundness: 3
strengths: 1. The paper is well-written and easy to follow.

2. The idea that improves the domain generalization ability by weight quantization is interesting. 

3. The experimental results demonstrate the effectiveness of the proposed method.
summary: The paper works on domain generalization problem through weight quantization, which can be an implicit regularize by inducing noise in model weights to guide the optimization process to flatter minima against domain shifts. The paper provides both theoretical and empirical evidence for quantization to encourage flatter minima. Experiments on several datasets demonstrate the generalization ability of the method across various datasets, architectures, and quantization algorithms.
weaknesses: 1. Equation 4 shows that the weights in flatten minima should have lower losses on the quantization model. However, it is not clear how the loss function guarantees that lower loss can in turn lead to local minima. It is also not clear how the large noise dominate the optimization and lead to sub-optimal convergence.

2. As shown in the experiments, the model size will definitely be reduced through quantization, but how about the training and inference costs of the model? Especially when the quantization is conducted during the model training.

---

confidence: 4
contribution: 2
initial_rating: 5
presentation: 2
questions: It would be interesting to see how different weight perturbation schemes can affect OOD generalization.
soundness: 3
strengths: This paper is well-organized in general, and the observation that quantization noise can improve OOD generalization is interesting.
summary: This paper investigates the impact of quantization noise on out-of-distribution (OOD) generalization. The authors observe that quantization noise appears to enhance OOD generalization capabilities in domain generalization tasks. While the observation is interesting, the methods employed for quantization and ensemble are standard and lack novelty.
weaknesses: 1. The methods for quantization and ensemble are quite standard and not specific to domain generalization, providing limited novelty.
2. The theoretical justification linking flat minima to improved OOD generalization is weakened by recent research suggesting that the connection between flatness and generalization is questionable [1,2].
3. Quantization noise is similar to uniform weight noise, but a systematic comparison with the latter as well as other weight perturbation schemes is missing.

[1] Andriushchenko, Maksym, et al. "A modern look at the relationship between sharpness and generalization." arXiv preprint arXiv:2302.07011 (2023).
[2] Mueller, Maximilian, et al. "Normalization layers are all that sharpness-aware minimization needs." Advances in Neural Information Processing Systems 36 (2024).

---

confidence: 4
contribution: 3
initial_rating: 6
presentation: 3
questions: 1. How much does $w_q$ differ from $w$ in training?
2. Why each channel in a layer has a different scaling factor? How is the value of $s$ determined?
3. Given a fixed quantization bit $b$, how would $s$ influence the performance?
4. What is the scale of $w$ (e.g. norm) across different algorithms in section 3.3?
soundness: 3
strengths: 1. Introducing quantization to domain generalization, and drawing the potential link between quantization and flat minima is novel and helpful, as it could improve domain generalization performance as well as memory and computation efficiency. 
2. Extensive experiments on DomainBed and empirical analysis show the effectiveness of QT-DoG.
summary: This paper proposes quantization-aware training to improve models' domain generalization performance. Theoretical and empirical analysis show that quantization-aware training induces noise in model weights, which could guide the optimization process toward flatter minima that generalize better.
weaknesses: 1. The effect of $s$ should be discussed in more detail, as it plays an important role in the training and the theoretical analysis. Specifically, choosing a different $s$ of each channel in a layer should be justified. Ablation studies regarding $s$ can also be conducted to give a better understanding of the effect of $s$.

3. Measuring sharpness by equation 5 needs more discussion. When the model weight under measurement has different scales, perturbing weight with the same $\gamma$ does not serve as a fair way to get $w'$ around the local area of $w$. Relative flatness (Definition 3 in [1]) could be considered to address the dependency of sharpness measurement over scale of model weight.

[1] https://arxiv.org/pdf/2001.00939

---

confidence: 4
contribution: 2
initial_rating: 3
presentation: 3
questions: See weakness
soundness: 2
strengths: 1. The paper is well-written, experimental results seem comparable against state-of-the-arts.

2. The design of using quantized models seem to be a good fit in weight ensembling, which has been proved effective for improving generalization.
summary: This paper proposes using quantization during model training as a strategy to enhance domain generalization. The authors demonstrate that the baseline ERM achieves competitive results when quantization is applied as an implicit regularizer, with quantization-induced noise guiding the model toward flatter minima in the loss landscape. Additionally, they introduce combining quantized models into a model soup, to further boost DG performance. Results on the DomainBed benchmark indicate that this approach performs comparably to state-of-the-art DG methods.
weaknesses: 1. The primary issue is the limited contribution. Their main idea is to replace the standard training in ERM with the existing quantized technique. That is hardly a new practice, since quantization itself is originally applied in ERM (given ERM is the basis of all training tasks), and they do not inroduce a DG-specific quantization technique. Additionally, the ensemble of qunatitized ERM is also an simple extension of the original model-soup. These can be called a trick for improving DG, but shouldn't be listed as a main contribution.

2. The overclaim is another problem. It is claimed that the theoretical connection between quantization and flatter minima is provided. To begin with, I cannot find a seriours definition for the flatter minima of a model in the manuscript. Moreover, even with the informal definition in Eq. (5), they do not provide any theoretical evidence to support that $\mathcal{F}\_{\gamma}(W^q) < \mathcal{F}\_{\gamma}(W)$. At last, I doubt it can be theoretically proved, given there are many quantization methods with different settings, it's hard to conclude a general framework to be applied in all.

3. According to Tab. 2, it seems different quantization methods can significantly affect the in-domain and out-of-domain accuracy, some even worse than the baseline ERM. Does this suggests that not all quantization leads to flat minima? If so, why does the adopted quantization method can lead to flat minima?

4. Experiments should be conducted in more data. The more realsitic WILDS dataset could be used to further show their effectiveness. Ablation studies shoube be conducted in more datasets rather than just PACS and TerraInc. Especially in Figure 3, where the upper two figures can barely support the claim.

5. Some unclear experimental settings. For example, how to choose the quantizer step size $s$? what is the quantizer step in Figure 3, is it a same thing with $s$. If no, how to decide it? does the quantization only applied in saving the model?

Meta-review: The submission proposes a new approach for addressing the domain generalisation problem, where one must train a model on data from several source domains with the goal of zero-shot generalisation to one or many target domains. The proposed approach leverages weight quantisation, and the success of this method is explained by appealing to flat minima. The submission also includes an exploration of ensemble approaches to the DG problem, showing that this improves performance.

The reviewers have expressed concern about the novelty of the proposed approach, as it is a relatively straightforward combination of existing quantisation and ensemble approaches. Moreover, the connection between flat minima and OOD generalisation performance is not made clear.

Decision: Reject