Quantile Activation: Correcting a failure mode of traditional ML models
Authors: Aditya Challa
Sravan Danda
Laurent Najman
Snehanshu Saha
Venue: Accepted by TMLR ()

Abstract: Standard ML models fail to infer the context distribution and suitably adapt. For instance, the learning fails when the underlying distribution is actually a mixture of distributions with contradictory labels. Learning also fails if there is a shift between train and test distributions. Standard neural network architectures like MLPs or CNNs are not equipped to handle this.

In this article, we propose a simple activation function, quantile activation (QAct), that addresses this problem without significantly increasing computational costs. The core idea is to "adapt" the outputs of each neuron to its context distribution. The proposed quantile activation (QAct) outputs the relative quantile position of neuron activations within their context distribution, diverging from the direct numerical outputs common in traditional networks.

A specific case of the above failure mode is when there is an inherent distribution shift, i.e the test distribution differs slightly from the train distribution. We validate the proposed activation function under covariate shifts, using datasets designed to test robustness against distortions. Our results demonstrate significantly better generalisation across distortions compared to conventional classifiers and other adaptive methods, across various architectures. Although this paper presents a proof of concept, we find that this approach unexpectedly outperforms DINOv2 (small), despite DINOv2 being trained with a much larger network and dataset.

Quantile Activation: Correcting a failure mode of traditional ML models
Aditya Challa
adityact@goo.iis-pleee
Deportment of CSETS and APPCAIR BITS Pilani KK Birla Goa Campus, India
Sravan Danda
Landas@goe bits-pilami..aa att.laaii.......... ac.in
Department of CSEIS and APPCAIR BITS Pilani KK Birla Goo. Compus, India
Laurent Najman
laurend.najmammccsie.
Department of CS Univ Gustave Biffel, CNRS, LIGM, F-77454 Marne-lo- Vallée, France
Snehanshu Saha Department CS&IS and APPCAIR BITS Pilani KK Birla Goa Campus, India
snchanshus@gon. bits titts-pllni.co oc in
Abstract
Standard ML models fail infer the context distribution and suitably adapt. For instance, the learning fails when the underlying distribution is actually mixture of distributions with contradictory labels. Learning also fails if there is shift between train and test distributions. Standard neural network architectures like MLPs CNNs are not equipped to handle this. In this article, we propose simple activation function, quantile activation (QAct), that addresses this problem without significantly increasing computational costs. The core idea to "adapt" the outputs each neuron to its context distribution. The proposed quantile activation (QAct) outputs the relative quantile position of neuron activations within their context distribution, diverging from the direct numerical outputs common in traditional networks.
A specific case of the above failure mode is when there is inherent distribution shift, ie the test. distribution differs slightly from the train distribution. We validate the pro- posed activation function under covariate shifts, using datasets designed to test robustness against distortions. Our results demonstrate significantly better gencralization across dis- lortions compared to conventional classifiers and other adaptive methods, across various architectures. Although this paper presents a proof of concept, we find that this approach unexpectedly outperforms DINOv2 (small), despite DINOv2 being trained with much larger network and dataset.
1 Introduction
Thanks to deep learning approaches, machine learning has been adopted across wide variety of domains. However, there is a significant failure mode within the standard framework of machinc learning. Since, the functions within standard hypothesis classes are fixed, they cannot adapt to the distributions (both at train and test time).
Failure mode of ML Systems: Standard ML models assume that the samples are i.id drawn from a common distribution p(x,y) y), and accordingly assume fixed set of hypothesis H. This is not realistic

---

Kemel Newily Felimate denunary Quentii
Falli Actvation
27.
2533
30
-15
-10
1.0
(a)
Figure 1: A simple toy example to illustrate where ML systems fail. (a) The distribution is mixture of Gaussian distributions whose centers (41,42) are separated by 30 The centers themselves can lie anywhere the unit circle. (please refer to the text for exact description) The dotted lines indicate the optimal linear classifier for a given P1-/2, across different values of /2, (b) Histogram of accuracy over 1000 different combinations of μ1, P2 for both ReLU activation and after incorporating QAct. Clearly, ReLU activation alone cannot perform better than random guess. Incorporating QAtt on the other hand can easily infer the latent P1. P2.
assumption. practice, samples are drawn from different (but related) distributions {p,(x, y)} both at train and test time. And any function class which cannot adapt fails in this scenario. This failure mode manifests itself in a lot of different ways.
A simple toy example to illustrate the failure mode of ML systems: To concretely illustrate this failure mode, present toy example where samples can potentially have contradictory labels. Consider the distribution generated as follows (figure lab:
11 ~ U($))
random sample from uniform distribution on the circle
#2 R(30))ps )1
P2 obtained by rotating μ1 by 30
(1)
Class 0 (N1,, 0.17) Class 0 generated using normal with mean μn and stdev 0.1
Class 1 (N12
Class 1 generated using normal with mean #2 and stdev 0.1
Why is this classification problem hard? Note that any point from the support of the above distribution is equally likely to be class 0 or class So, one cannot construct any fired function depending only on the imput features Thus, most of cxisting ML frameworks, which insist learning fixed function, fail. Nevertheless, this is valid distribution where classification with accuracy R is theorelically possible when one can reconstruct the latent μ1, P2.
Specifically, the current neural network architectures fail as well. Consider training a simple MLP on this dataset using gradient descent. That is, each batch (of size B) of samples generated as Sample f1, then sample B/2 points each from N(n1, 0.17) and N(12, 0.1T) respectively. Since, we would have that specific sample is equally likely to belong class or 1, one would learn (probability) p 0.5 for all the samples. This is verified in figure lb where use ReLU activation.
Fixing the failure mode and defining the "context": This experiment demonstrates that traditional activation functions like ReLU fundamentally cannot resolve contradietory labels in mixed distributions. The root cause lies in the static nature of existing 'go-to' activations. If instead, neurons could adapt to their context distribution defined by the batch of samples we could overcome this limitation. This leads novel activation, QAct which uses context distribution allow individual neurons to adapt. To the best of our knowledge current neural network architectures with ReLU activations such MLP//NN do
2

---

Severity
Severity
Severity
Severity
Severity
Severity
QAet
Accuracy
88.02
82.44
76.74
71.54
68.25
65.34
ReLU
Accuracy
90.48
81.06
65.9
48.34
41.54
35.86
Figure 2: Comparing TSNE plots QAct and ReLU activation on CIFARIOC with Gaussian distortions. Observe that QAct maintains the class structure extremely well across distortions, while the usual ReLU activations loses the class structure as severity increases.
not consider this. While transformers consider this to some extent via the self-attention module, it is still sample specific and very expensive computationally to obtain self-attention for the entire batch. Morcover, vision transformers do not consider attention across different samples in the batch.
Quantile Activation can identify the context distribution from each batch and fix the failure mode The key idea is that at each neuron, the final activation value depends the activations of the entire batch of samples. Specifically, pre-activations in the batch. (Details in section 2 Figure 1b shows that this simple change can allow the neural network to learn in spite of the contradictory labels.
use the relative quantile of the pre-activation with respect to other
Notably, this failure mode extends beyond syn- thetic examples. critical real-world manifestation occurs distribution shifts where the training is done on a distortion-free distribution while testing happens on distorted distributions. We validate the proposed quantile activation the standard distribution shift dataset CIFAR10C. Figure illustrates the results obtained using ReLU activations and QAct. As severity increases (w.r.t Gaussian Noise), observe that ReLU activation loses the class structure. On the other hand, the proposed QAct framework does not suffer from this and the class structure is preserved with QAct.
Distribution Shift as an example of failure mode:
1.1 Contributions
In (Challa et al. 2024b), the authors propose an approach to calibrate a pre-trained classificr fo(x) by ex- lending it Lo learn quantile function, ((x; 0, r) (r denoles the quantile), and then estimate the probabilities using J, (xx T) 2 0.5) [ They show that this results probabilities which are robust to distortions.
In this article, our approach pivots to the level of neuron, by suitably deriving the forward and backward propagation equations required for learning (section 2
2. We then show that suitable incorporation of our extension produces context dependent outputs at the level of each neuron of the neural network.
3. Steps and 2 in our approach are non-trivially different from (Challa et al. 2024b and thus contribute to achieving better generalization across distributions and is more robust to distortions, across architectures. We evaluate our mothod using different architectures and datasets, and compare with the current. stale-of-the-ard DINOv2(small), We show that QAct proposed here more robust to distortions than DINOv2, even if we have considerably less number of parameters (22M
We use the following convention "Pre-activationss" which denote the inputs to the activation functions and "Activations" denote the outputs of the activation function 27] denotes the indicator function withinn comparable model
3

---

for DINOv2 11M for Resnet18). Additionally, DINOv2 is trained on 20 odd datascts, before being applied on CIFARIOC: in contrast, our framework is trained on CIFARIO, and produces more robust outcome (see figures 16.
4. We also adapt QAct to design a classifier which returns better calibrated probabilities. We show lhat, unlike the relevant, most recent baselines (RELU, DINOv2 (small)), QAct achieves constant calibration error across different severity of distortions.
1.2 Related Works
This work aims lo address the failure mode described earlier. To the best of our knowledge, no existing literature directly addresses this issue. However, since the failure mode is widely persistent, different ideas have been explored to correct this.
Related Works on Domain Generalization (DG): The problem of domain generalization tries to answer the question Can we use classifier trained on one domain across several other related domains? The earliest known approach for this is Transfer Learning (Pan & Yang) 2010 Zhhuang et al.) 2021), where a classifier from a single domain is applied to a different domain with
with/without without fine-tuning. Several approaches have been proposed to achieve DG, such as extracting domain-invariant features over single/multiple source
domains |Ghifary et al.
2015 Akuzawa al.]
2019 Dou et al. 2019 Piratla al.] 2020 Hu al.
2019
Mela Learning (Huang al. 2020 Dou al.
2019). Invariant Risk Minimization (Arjovsky al.
2019
Self-supervised learning is another proposed approach which tries to extract features large scale datasets
in an unsupervised manner, the most recent among them being DINOv2 (Oquab et al. 2023) which is the current stale-of-the-ar(] Very large foundation models, such as GPT-4V, are also known to perform better with respect to distribution shifts (Han et al., 2023). Nevertheless, to the best our knowledge, none of these models incorporates context distributions for classification.
Related Works on Adaplive networks: There have been several altempls to adapl the network to improve it's performance. Adaptive Batch Normalization and its variants [Li et al. 2017 Schneider et al. 2020 Zhou et al. 2024 Mirza et al. 2022) can be interpreted as special cases of context distribution modification, where only the mean and variance are adjusted. In contrast, methods that modify model parameters (Zhang et al. 2022h or alter the input distribution (Schwinn et al. 2022) preserve the pre-trained classifier but introduce a compatationally expensive optimization step during inference. Empirical results indicate that adapting batch normalization statistios is at least as effective, not superior, to these approaches. Furthermore, augmentation strategies (Hendrycks et al.] (2020) are advantageous when domain-specífic invariances are known, but such knowledge is not always available.
QAct differs from the aforementioned methods in that, while they focus on marginally improving adaptation by updating statistics, we instead model the entire context distribution. This approach is more general and yiclds superior performance, as demonstrated in Section
1.3 Outline:
In section 2 we formally derive the quantile activation (QAct) and provide intuition, using a simple toy example, on why QAct adapts to distortions. Note that QAct diverges from existing train train/test pipelines significantly. Section 3 discusses the practical implementation of QAet both at train and test time. This section also analyses the interoperability of QAct with standard layers and loss functions. Finally, in section 4 we evidence our claims by comparing QAct with other related methods discussed in section 1.2
2 Quantile Activation
Rethinking Outputs from a Neuron: To recall if x denotes the input, a typical neuron does the
following (i) Applies a linear transformation with parameters w, b, giving w'x + the output, and (ii)
applies rectifier 9, returning g(w'x x + b). Typically, g is taken to be the ReLU activation greia
http://////aooeeeetcecccce/////e ima-snet-geeeecc accessed 26 September 2024

---

max Intuitively, we expect that each neuron captures an "abstract" feature, usually not understood by a human observer.
An alternate way to model a neuron is to consider it as predicting a latent variable y, where y = 1 if the feature is present and y = 0 if the feature is absent. Mathematically, we have the following model:
= w'x + +b+ and y 111 2 0]
(2)
This is very similar to the standard latent variable model for logistic regression, with the main exception being, the outputs are not known for each neuron beforehand. y is known, it is rather easy to obtain the probabilities P(z 2 0). Can we still predict the probabilities, even when y itself is a latent variable?
The authors in (Challa et al. 2024b) propose the following algorithm to estimate the probabilities:
Let { denote the set of input samples from the input distribution x and {2} denote their corre- sponding latent outputs, which would be from the distribution
2. Assign y 1 whenever > (1 7)th quantile of 2, and 0 otherwise. For a specific sample, we have = 1 if 2, > (1 -h quantile of {
3. Fit the model Q(2,, 0) to the datasct {((2;, 7), v:)), and estimate the probability as,
P(u: = 11= f 71Q r) 2 0.5]dr
(3)
The key idea: One can think of z above pre-activations of neuron. There are two key improvements which can be made (i) The above procedure can be done at the level of each neuron and (ii) Instead of training a model with r as imput, we directly use quantiles of z for obtaining probabilities. Observe that in step 2., the labelling is done without resorting to actual ground-truth labels. This allows us to obtain the probabilities on the fly for any set. of parameters, only by considering the quantiles of We detail these changes below.
Defining the Quantile Activation QAct Let denote the pre-activation of the neuron, and let { denote the samples from this distribution. Let F2 denote the cumulative distribution function (CDF), and let fa denote the density of the distribution. Accordingly, we have that Fx (T) denotes the 7th quantile of z. Using step (2) of the algorithı above, we define,
r-((1-)) f"d FT
QAc((2)= = 1[>> (1 T)ddr Substitute
(4)
Computing the gradient of QAct: However, to use QAct in a neural network, we need to compute the
gradient which is required for back-propagation. Let Ta denote the quantile at which Fr-((T)) = 2. Then
we have that QAct(=)= = Tr since (T) is an increasing function. So, we have that QAct(F, x (r)) = T. In other words, we have that (c) is Fz(z), which is nothing but the CDF of Hence, we have,
aQAct(z) fz(2) Oz
(5)
where fz(z) denotes the density of the distribution.
Grounding the Neurons: With the above formulation, observe that since QAet identical to CDF, it follows that, Qze always a uniform distribution between 0 and 1, irrespective of the distribution z. When training numerous neurons in layer, this could cause all the neurons to learn the same behaviour. Let f denote a discriminatory feature which is to be learned but is present in only 25% of the population. However, the lincar model which has to learn if f is there (class 0) or not (class 1) should account for that imbalance. Gradient descent is known to fail here.
To correct this, we enforce that positive values and negative values have equal weight. Given the input distribution z, We perform the following transformation before applying QAct. Let
zt = [z z
if 0
== {0
2 if <
0
t
0
otherwise
(8)
5

---

Algorithm Forward Propagation for single neuron
Input: [2j] a vector of pre-activations, < 71 < 12 < Tn, < a. list of quantile indices which we compute the quantiles.
Append two large values, and -c, to the vector [zi].
Count R, = number of positive values, n mumber of negative values, and assign the weight w4+ = 1/n+
to the positive values, and w- = 1/mn to the negative values.
Compute weighted quantiles {q:} at each of {T;} over the set {zi) Uc,
Compute (z)((z)) using the function,
QAct(x) = Σ
1 2 9:
(6)
R4
Remember [2s], w4, w- [QAct(2:)] for backward propagation. return [QAc((z))
Algorithm 2 Backward Propagation for single neuron
Input: grad_outpus quantiles.
Ti 72 Tn- list of quantile indices at which we compute the
Context from Forward Propagation: [zi], w4, w- [QAct(z;)]
Obtain a weighted sample from [z]] with weights wi, w- (say) S.
Obtain a kernel density estimate, using points from S, at each of the points in 2, (say) fa(z))
Set,
grad_ings =
@ [f((2
(7)
return grad_ input
denote the truncated distributions. Then,
with probability 0.5
with probability 0.5
From definition of z!, we get that the median of zl is 0. This grounds the input distribution to have the same positive and negative weight.
Using pre-defined quantiles for computational efficiency: In equation t one can theoretically con- sider Σ; [ix 2 zı] instead of Σ, 2 q]. However the number of samples, I,, can potentially be very large (order of 109). Using uniform quantiles in [0, 1] reduces the complexity when considering n, 100.
Dealing with corner cases: Tt is possible that during training, some neurons either only get positive values or only get negative values. However, for smooth outputs, one should still only give the weight of 0.5 for positive values. To handle this, we include two values e (large positive) and -c (large nogative) for cach neuron. Since, the quantiles are conventionally computed using linear interpolation, this allows the outputs vary smoothly. We take c = 100 in this article.
Estimating the Density for Back- Proppaprop: Note that the gradient for the back propagation is given by the density of at (weighted distribution). We use the Kernel Density Estimation (KDE), to estimate the density. We, (i) First sample S points with weights w4, and (ii) then estimate the density at all the input points [z:]. This is point-wise multiplied with the backward gradient to get the gradient for the input. In this article we use 1000, which we observe gets reasonable estimates.
Computational Complexity: Computational Complexity (for a single neuron) is majorly decided by 2 functions (i) Computing the quantiles has the complexity for vector [z:] of size n can be performed in

---

DUTRECE
1000
(c)
000
-1.0
-0.5
(a)
(b)
(d)
Figure 3: Intuition behind quantile activation. (a) shows simple toy distribution of points (blue), it's distortion (orange) and a simple line (red) on which the samples are projected to obtain activations. (b) shows the distribution of the pre-activations. (c) shows the distributions the activations with QAct of the original distribution (blue). (d) shows the distributions of the activations with QAct under the distorted distribution (orange). Observe that the distributions match perfectly under small distortions. Note that even if the distribution matches perfectly, the quantile activation actually deterministic function.
On log(n))- Since this is log-linear in n, it does not increase the complexity drastically compared to other operations in a deep neural network. (ii) Computational complexity of the KDE estimates is O(Sn,) where S the size of sample (weighted sample from [&i]) and n, is the mumber of quantiles, giving a total of O(n log(n) + Sn,). In practice, we consider S 1000 and nt 100 which works well, and hence does not increase with the batch size.
Remark: Algorithms D and 2 provide the pscudocode for the quantile activation. For stable training, in practice, we prepend and append the quantile activation with BatchNorm layers.
Why QAct is robust to distortions? To understand the idea behind quantile activation, consider a simple toy example in figure 3 For ease of visualization, assume that the input features (blue) are in 2 dimensions, and also assume that the line of the linear projection is given by the red line in figure 3a Now, assume that the blue input features are rotated, leading to different distribution (indicated here by orange). Since activations are essentially (unnormalized) signed distances from the line, we plot the histograms corresponding to the two distributions in figure 3b As expected, these distributions different. However, after performing the quantile activation in equation we have that both uniform distribution. This is illustrated in figures 3c and 3d This behavior has normalizing effect across different distributions, and hence has better distribution generalization than other activations.
Explaining figure Let (z,, y denote the samples where I; E Rd (d >> 2) and ys E {0,1). Let w'r denote the classifier which separates the classes perfectly. The question we ask Under what transformations x Ar does the classifier preserve it's accuracy?
As discuss in appendix E. for standard linear models even if == Id would not preserve the accuracy. On the other hand, for quantiles if A'w aw (a > 0), then it preserves the accuracy. So, the class of matrices for which the accuracy is preserved is nothing but all *completions* of the matrix A such that A' ore.
The network used in figure 1 projects the 2d points into high-dimensions (in possibly non-lincar way).The projection high dimensions such that the rotation in 2d preserves A'w aw in the high dimension for the final classification. Hence, the accuracy would be preserved. The important thing to note The

---

projection to the high dimensions, and the classifier in the subsequent layer, are all learned using SGD and none of these behaviors are hardcoded.
How is QAct different from existing activation function? Standard activation functions such as ReLU take an input and apply a fixed function such as max(0, x). On the other hand, quantile activation can be thought of as a functional which takes as input both the value and also the cumulative distribution function F. In simple terms, we have
QAct(F,x)) F(x)
(10)
We refer to F as a context distribution.
How is QAct different from adaptive batch norm? Batch normalization is originally proposed improve the gradient information during backpropagation. However, formally Batchnorm can also be thought of as functional which takes in distribution X and the imput x and returns (a E [ )
Sttde Thus,
it only uses the first and second order information. Techniques proposed in Li el al. (017)) update the distribution X at test/inference time to allow for better genralization. However, batchnorm is not invoriant to all monotonic transformations. This can easily be seen by considoring the transform x - exp(x). QAct on the other hand is invariant to all monotonic transforms.
3 Training with QAct
In the previous section, we described the procedure to adapt single neuron to its context distribution. In this section we discuss how this extends the Dense/ Convvooooooltionn layers, the loss functions train the network and the inference aspect.
Extending to standard layers: The extension of equation 4 to dense outputs is straight A typical output of the dense layer would be of the shape N.) -B B denotes the batch size, No denotes the width of the network. The principle is The contert distribution of a neuron is all the values which are obtained using the some parameters. this case, each of the values across the 'B' dimension are considered to be samples from the context distribution.
For convolution layer, the lypical outputs are of the form (B, H) denotes the size of the batch, Ne denotes the number of channels, H, W denotes the sizes of the images. In this case should consider all values across the 1std3rd and 4th dimension to be from the context distribution, since all these values are obtained using the same parameters. So, the number of samples would be B x H x W.
One can use any differentiable loss function to train with quantile activation. We specif- ically experiment with the standard Cross -ooss-Entropy Loss, Triplet Loss, and the recently proposed Watershod Loss in (Challa et al.) 2024a) (see section 4.. However, if one requires that the boundaries between classes adapt to the distribution, then learning similarities instead of boundaries be beneficial. Both Triplet Loss and Watershed Loss fall into this category. We see that learning similarities does have slight benefits when considering the embedding quality.
Loss Functions:
As stated before, we want to assign a label for classification based on the context of the sample. There exist two approaches for this (1) One way is to keep track of the quantiles and the estimated densities for all neurons and use for inference. This allows inference for a single sample in the traditional sense. However, this also implies that one would not be able to assign classes based on the context at evaluation. (2) Another way is to make sure that, even for inference
Inference with QAct:
single sample, we include several samples from the context distribution, but only use the output for a specific sample. This allows one to assign classes based on the context. In this article, we follow the latter approach.
Importance of Batch size: A key assumption underlying QAct is - we assume the samples in the batch be from the same distribution. However, this not strong restriction since there exists several techniques in the literature to assure that this assumption holds. In the extreme, one can even consider the batch size to be 1.
8

---

In Zhang al. (022) the authors use additional augmentations at test time. Since can be sure that these augmentations are from the same distribution as the original image, the implicit batch
size can be increased.
Another approach is to consider a prior distribution for cach sample and update it using pre- activations from the given sample by bootstrapping. This equivalent to the approach considered Schneider et al. (2020).
Optimal performance is attained when the inference distribution exhibits sufficient diversity. In this work, assume this condition holds, as it is satisfied by our experimental datasets.
Quantile Classifier: Observe that the proposed QAct (without normalization) returns the values in [0, 1] which can be interpreted as probabilities. Hence, one can also use this for the classification layer. helets loss
two changes are required (i) Traditional softmax used conjunction with negative-log-likelin already considers "relative" activations of the classification in normalization. However, QAct does not. Hence, one should use Binary-Cross-Einn Entssoy loss with QAct, which amounts to one-vs-rest. classification. (ii) Also, unlike neuron in the middle layers, the bias of the neuron in the classification layer depends the class imbalance. For instance, with 10 classes, one would have only 1/10 of the samples labelled 1 and 9/10 of the samples labelled O. To address this, we require that the median of the outputs be at 0.9, and hence weight the positive class with 0.9 and the negative class with 0.1 respectively. In this article, whenever QAct used, we use this approach for inference.
We observe that (figures 14 and 15 using quantile classifier on the learned features in general improves the consistency of the calibration error and also leads to the reducing the calibration error. In this article, for all networks trained with quantile activation, we use quantile classifier to compute the /caluacccaallbatiionn errors.
4 Evaluation
To summarize, we make the following changes to the existing classification pipeline (i) Replace the usual ReLU activation with QAct and (ii) Use triplet or watershed loss instead of standard cross- entroyy loss. We expect this framework to learn context dependent features, and hence be robust to distortions. (iii) Also, use quantile classifier to train the classifier on the embedding for better calibrated probabilities.
Evaluation Protocol: To evaluate approach, consider the datasets developed for this purpose CIFAR1OC, CIFAR100C, TinylmagenetC [Hendryeks & Dietterich] 2019), MNISTC (Mu & Gilmer 2019 These datasets have a set of 15 distortions at 5 severity levels. To ensure diversity we evaluate our method on architoctures (overparamotrized) LeNet, ResNet18 (He ct al. 2016) (11M parameters), VGG (Smonyyan
& Zissermani (15M parameters) and DenseNet (Huang el al. 2017) (1M parameters). The code to reproduce the results can be found at https:://ithub.... http:////gttub..cco/aaaaaaaaaaee www.///omaaaacaaa//oo httpa/////....aaaaaa/aa/aaaaaeee aataannnennttvaaeeeeeeeaaaaaeeee
Baselines for Comparison: To our knowledge, there exists other framework which proposes classifica- tion based on context distribution. So, for comparison, consider standard ReLU activation ( (Fukushima) 1970), pReLU (He et al. 2015p, and SELU (Klambauer et al., 2017) for all the architectures stated above. Also, we compare our results with DINOv2 (small) (Oquab et al. 2023) (22M paramcters) which is current soate-of-thearrs for domain generalization. Note that for DINOv2, architecture and datasets used for training are substantially different (and substantially larger) from what we consider in this article. Nevertheless, we include the results for understanding where our proposed approach lies on the spectrum. We consider the small version of DINOv2 to match the number of parameters with the compared models. We also compare
QAct with other adaptive algorithms (Schneider et al. 2020 Mirza et al. 2022 Zhang et al. 2022
Sun
ct al.
2020 Zhou et al. 2024) on CIFARIOC.
Metrics:
We consider the following metrics - Accurayy (ACC), (ii) calibration error (ECE) Kumar
et al.) 2019) (both marginal and Top-Label) (iii) mcan average procision at K (MAP@K) to evaluate the embedding, (iv) Drop in accuracy DROP) which measures the difference in accuracy at distortion 1 5) and at distortion (standard test set). For the case of Rel.U//Rel.U/SI..U activation with
9

---

0.4
Merhod
0.30
Resnat18 RaLj
DenseNet RelU
Nesnot18-Quie Quant
011
DenseNet Quart
Din22215)
Caibs Cailh Eoppee/reee//eppp...p...
0.00
-033
Nethod
0:14
Restet.0-HteUU
Densehat-Hoe HELL
-0.4
Dinovais
Seventy
Severity
(a) Drop in Accuracy
(b) Top-Label Calibration Error
Figure Comparing QAct with ReLU activation and DINOv2 (small) on CIFAR1OC. We observe that, while at low severity of distortions QAct has a similar accuracy as existing pipelines, at higher levels the drop in accuracy substantially smaller than existing approaches. With respect to calibration, we observe that the calibration error remains constant (up to standard deviations) across distortions.
Cross- Entropy, we use the logistic regression trained on the train set embeddings, and for QAet we use the calibrated lincar classifier, as proposed above. We do not perform any additional calibration and use the probabilities. We discuss a selected set of results in the main article. Please see appendix C for more comprehensive results.
Calibration error measures the reliability of predicted probabilitics. In simple words, if one predicts 100 samples with (say) probability 0.7, then we expect 70 of the samples to belong to class and the rest to class 0. This is measured using either the marginal or top-label calibration error. We refer the reader to (Kumar ct al.
2019 for details, which also provides an implementation to estimate the calibration error.
For all the baselines we use the standard Cross-Fatropy loss for training. For inference on corrupted datasets, we retrain the last layer with logistic regression on the train embedding and evaluate it on test/corrupted embedding. For QAct, we as a convention use watershed loss unless otherwise stated, for training. For inference, we train the Quantile Classifier on the train embedding and evaluate it on test test/corrnn /corruppe embedding.
Remark:
The proposed QAct approach is robust to distortions: In fig. ! we compare the proposed QAct approach with predominant existing pipeline ReLU+Cross -nors-Enooyy and (INOv2(small) on CIFAR1OC. In figure 4a we see that as the severity of the distortion increases, the accuracy of ReLU and DINOv2 drops significantly. On the other hand, while al small distortions the results are comparable, as severity increases QAct performns substantially better than conventional approaches. At severity 5, QAct outperforms DINOv2. On the other hand, we observe that in figure 4b the calibration error stays consistent across distortions.
How much does QAct depend on the loss function? Figure 5a compares the watershed classifier with other popular losses Triplet and Cross-Entropy. We see that all the loss functions perform comparably when used conjunction with QAct. We observe that watershed has slight improvement when considering MAP and hence, we consider that as the default setting. However, we point out that QAct is compatible with several loss functions well.
QAct vs ReLU/pReLU/SELI activations: To verify that most existing activations do not share the robustness property of QAct, we compare QAct with other activations in figures 5 5bland [c We observe that QAct is greatly more robust with respect distortions in both accuracy and calibration error than other activation functions.
10

---

685
Year
610
207
SEEEO
One
6.55
-11
-15
062
Seventt
(a) Mean Average Precision
(b) Drop Accuracy
(c) Calibration Error (Marginal)
Figure 5: (a) Dependence on Loss functions. Here we compare watershed with other popular loss functions Triplet and Cross-Entropy when used with QAct. We that watershed performs slightly better with respect to MAP. (b) Comparing QAct with other popular activations
with respect to drop in accuracy. (c) Comparing QAct with other popular activations ReLU ReLU/pReLU/SELA with respect to Calibration Error (Marginal). From both (b) and (c) we can conclude that QAet is notably more robust across distortions than several of the existing activation. All the plots use ResNet18 with CIFAR10C datasct.
DRAR100 ReWu
80
UPARID0 HOLL
Testragenet-lllJ
Tinymaggnn Quant
tigamegends cisovzto)
0.010
Tinytragenct
-02
0.008
0.006
-0.3
Severity
Severiity
(a) Drop in Accuracy
(b) Marginal Calibration Error
Figure 6: Results on CUPARLOOC//Tnyyaaggeeede We compare QAct-+watersie to ReLU and DinoV2 small on Beel000//iinIlaageeee with CIFAR1OC, (a) shows drop in accuracy across distortions. Observe that QAct gets much smaller drop in accuracy than DINOv2(s) across all distortions, even if DINOv2 has 22M parameters as compared Resnet18 11M parameters and is trained on larger datasets. (b) shows how calibration error (marginal) changes across severities. While other approaches lead to increase in calibration error, QAct has similar calibration error across distortions.
dataset with ResNet18. Note that the observations are consistent
11

---

Severity
0->1
0-+2
0->3
0->4
0-+5
Model
Method
R8snet18 (11M)
QAct
0.0442
0.0688
0.0922
0.1242
0.1686
Resnet26 (16M)
Batch Norm (Schneider et al. 2020
0.1280
0.1580
0.1850
0.2190
0.2600
DUA (Mirza et al. 2022)
0.0670
0.0930
0.1180
0.1500
0.1990
MEMO (Zhang et al. 2022
0.0483
0.0765
0.1117
0.1543
0.2239
TTT (Sun el al. 2020
0.0710
0.1030
0.1360
0.1780
0.2450
WRN-40-4 (9M)
AFN [hhou
2024
0.0585
0.0855
0.1145
0.1525
0.1815
AoRN Zhou et al.
2024
0.0460
0.0790
0.1110
0.1540
0.2110
Table 1: Comparing QAct with other adaptive approaches on CIFAR10C. We mcasure the drop in accuracy with respect to uncorrupted dataset.
Results on Larger Datasets: To verify that our observations hold for larger datasets, we use CI- FARI00C/TinyImgeen
to compare the proposed QAct+ watershed with existing approaches. We observe figure G that QAct performs comparably well as DINOv2, although DINOv2(s) has 22M parameters and is trained on significantly larger datasets. Moreover, we also observe that QAct has approximately constant calibration error across distortions, as opposed to a significantly increasing calibration error for ReLU or DINOv2.
Comparison with other adaptive algorithms: As stated before, there have been other altempts to adapt the neural network to the distribution. Yablee[comparee the quantile activation with these approaches on CIFAR1OC. Since, the methods are diverse, we compare the approached using the drop in accuracy. We see that QAct outperforms all the competing approaches. This can be attributed to the properties of QAct Normalizing effect as discussed section 2 and that quantiles are invariant to monotonic transformations.
5 Conclusion And Future Work
To summarize, traditional classification systems do not consider the "context distributions" when assigning labels. In this article, we propose a framework to achieve this by (i) Making the activation adaptíve by using quantiles and (it) Learning kernel instcad of the boundary for the last layer. We show that method is more robust to distortions by considering MNISTC, CIFARIOC, CIFAR100C, TinyImagenel datasets across varying architectures.
The scope of this article to provide a proof of concept and a framework for performing inference in a context-dependent manner. We outline several potential directions for future research:
The key idea in our proposed approach is that the quantiles capture the distribution of each neuron from the batch of samples, providing outputs accordingly. This poses challenge for large datasets, and we have discussed two potential solutions: (i) remember the quantiles and density estimates for single sample evaluation, or (ii) ensure that a batch of samples from the same distribution is processed together. We adopt the latter method in this article An alternative approach would be to learn the distribution of each newron using auxiliary loss functions, adjusting these distributions to fit the domain at test time. This gives us more control over the network at test time compared to current workflows. If the networks are very large, where batch sizes cannot be big there exists several strategies such as checkpointing to implicitly increase the batch size.
I1. Since the aim of the article use only a single GPU for all the experiments. To extend it to multi-GPU training, one needs to synchronize the quantiles across GPU, in a similar manner as that for Batch-Normallzation. We expect this to improve the statistics, and to allow considerably larger batches of training.
to establish a proof-of-concept, we did not focus scaling, and
III. On the theoretical side, there an interesting analogy between our quantile activation and how a biological neuron behaves. It is known that when the inputs to biological neuron change, the neuron adapts to these changes (Clifford et al.] 2007). Quantile activation does something very
12

---

similar, which leads to an open question can establish formal link between the adaptability of a biological neuron and the accuracy of classification systems?
IV. Another theoretical direction to explore involves considering distributions not just at the neuron level, but at the layer level, introducing a high-dimensional aspect to the problem. The main challenge here defining and utilizing high dimensional quantétes, which remains an open question (Koenker 2005
Acknowledgments
Aditya Challa and Laurent Najman acknowledges the support from (EPIPRA(68TT0-1)) Snehanshu Saha, Aditya Challa, Sravan Danda would like to thank the Anuradha and Prashanth Palakurthi Cen- ter for Artificial Intelligence Research (APPCAIR) and ANRF CRG-DST (CRG/2023, / /003210) for sup- port. Snehanshu Saha acknowledges SERB SURE-DST SUUR/2022/001966 and the DBT-Builder project (BT /22/S222222222
Govt. of India for partial support. Sravan Danda would like to thank ANRF for funding from SERB-SURE project number SUR/2022/002735..
References
Kei Akuzawa, Yusuke Iwasawa, and Yutaka Matsuo. Adversarial invariant feature learning with accuracy constraint for domain generalization. In European Conf. Mach. Learning, 2019.
Martin Arjovsky, Léon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization. w:XXs:1907.02800 2019.
Aditya Challa, Sravan Danda, and Laurent Najman. novel approach to regularising Inn classifier for improved generalization. (xXx::2422088055 2024a.
Aditya Challa, Snehanshu Saha, and Soma Dhavala. Quantprob: Generalizing probabilities along with predictions for a pre-trained classifier. In Uncertainity in Artificial Intelligence, 2024b.
Colin WG Clifford, Michael A Webster, Garrell B Stanley, Alan A Stocker, Adam Kohn, Tatyana O Sharpee, and Odelia Schwartz. Visual adaptation: Neural, psychological and computational aspects. Vision research, 2007.
Qi Dou, Daniel Coelho de Castro, Konstantinos Kamnitsas, and Ben Glocker. Domain generalization via model-agnostic learning of semantic features. In Neural Inform. Process. Syst., 2019.
Kunihiko Fukushima. Correction "visual feature extraction by a multilayered network of analog threshold elements'. IEEE Trans. Syst. Sci. Cybern., 1970.
Muhammad Ghifary, W. Bastiaan Kleijn, Mengjie Zhang, and David Balduzzi. Domain generalization for object recognition with multi-task autoencoders. In Proc. Int. Conf. Comput. Vision, 2015.
Zhongyi Han, Guanglin Zhou, Rundong He, Jindong Wang, Tailin Wu, Yilong Yin, Salman H. Khan, Lina Yao, Tongliang Liu, and Kun Zhang. How well does gpt-4v(ision) adapt to distribution shifts? A prelim- inary investigation. 2rXi::2312.007 0.7724. 2023.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human- level performance on imagenet classification. In Proc. Int. Conf. Comput. Vision, 2015.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proc. Conf. Comput. Vision Pattern Recognition, 2016.
Dan Hendrycks and Thomas G. Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In Int. Conf. on Learning Representations, 2019.
Dan Hendrycks, Norman Mu, Ekin Dogus Cubuk, Barret Zoph, Justin Gilmer, and Balaji Lakshminarayanan. Augmix: simple data processing method to improve robustness and uncertainty. In Int. Conf. on Learning Representations, 2020.
13

---

Shoubo Hu, Kun Zhang, Zhitang Chen, and Laiwan Chan. Domain generalization via multidomain discrim- inant analysis. In Uncertainity in Artificial Intelligence, 2019.
Bincheng Huang, Si Chen, Fan Zhou, Cheng Zhang, and Feng Zhang. Episodic training for domain gener- alization using latent domains. In Int. Conf. on Cogni. Systems and Signal Process., 2020.
Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q. Weinberger. Densely connected con- volutional networks. In 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017, pp. 2261-2269. IEEE Computer Society, 2017. doi: 10.1109/CVPR.2011.221 URL https://doi. http///ii...gg///// httpg//...111/////// 11t.//VPR.RC 2010 .243
Günter Klambauer, Thomas Unterthiner, Andreas Mayr, and Sepp Hochreiter. Sell-normalizing neural networks. In Neural Inform. Process. Syst., 2017.
Roger Koenker. Quantile Regression. Econometric Society Monographs. Cambridge University Press, 2005. doi: 10:007/CB0990051154000
Ananya Kumar, Percy Liang, and Tengyu Ma. Verified uncertainty calibration. In Neurol Inform. Process. Syst., 2019.
Yanghao Li, Naiyan Wang, Jianping Shi, Jiaying Liu, and Xiaodi Hou. Revisiting batch normalization for practical domain adaptation. In Int. Conf. on Learning Representations, 2017.
Muhammad Jehanzeb Mirza, Jakub Micorek, Horst Possegger, and Horst Bischof. The norm must go on: Dynamic unsupervised domain adaptation by normalization. In Proc. Conf. Comput. Vision Pattern Recognition, 2022.
Norman Mu and Justin Gilmer. MNIST-C. -: A robustness benchmark for computer vision. arXiv:1906.02333 023377 2019.
Maxime Oquab, Timothée Darcet, Théo Moutakanni, Huy Vo, Marc Szafraniee, Vasil Khalidov, Pierre Fer- nandez, Daniel Haziza, Francisco Massa, Alaaeldin El-Nouby, Mahmoud Assran, Nicolas Ballas, Wojciech Galuba, Russell Howes, Yao Huang, Shang- Wen Li, Ishan Misra, Michael G. Rabbat, Vasu Sharma, Gabriel Synnaeve, Hu Xu, Hervé Jégou, Julien Mairal, Patrick Labatut, Armand Joulin, and Piotr Bo- janowski. Dinov2: Learning robust visual features without supervision. wrXin:2304.07100 2023.
Sinno Jialin Pan and Qiang Yang. survey on transfer learning. IEEE Trans. Knowl. Data Eng., 2010.
Vihari Piratla, Praneeth Netrapalli, and Sunita Sarawagi. Efficient domain generalization via common- specific low-rank decomposition. In Int. Conf. Mach. Learning, 2020.
Steffen Schneider, Evgenia Rusak, Luisa Eck, Oliver Bringmann, Wieland Brendel, and Matthias Bethge. Im- proving robustness against common corruptions by covariate shift adaptation. In Neural Inform. Process. Syst., 2020.
Leo Schwinn, Leon Bungert, An Nguyen, René Raab, Falk Pulsmeyer, Doina Precup, Bjoern M. Eskofier, and Dario Zanca. Improving robustness against real-world and worst-case distribution shifts through decision region quantification. In Int. Conf. Mach. Learning, 2022.
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In Int. Conf. on Learning Representations, 2015.
Yu Sun, Xiaolong Wang, Zhuang Lin, John Miller, Alcxci A. Efros, and Moritz Hardt. Test-time training with self-supervissin for generalization under distribution shifts. In Int. Conf. Mach. Learning, 2020.
Marvin Zhang, Sergey Levine, and Chelsea Finn. MEMO: test time robustness via adaptation and augmen- tation. In Neural Inform. Process. Syst., 2022.
Zikai Zhou, Shuo Zhang, Ziruo Wang, and Huanran Chen. Afn: Adaptive fusion normalization via an encoder-decoder framework. arXi::2388.0323 2024.
14

---

29
0.80
0.7
0.00
Method
0.55
Nesnst18-ReLL
Densefiet
DenseNit--lelJ
0.5
Heurw QU-Quant
Resno112 Quant
Densefect-Oe Quant
Quart
Dinoy2ts)
Seventt
Severtty
(a) Accuracy
(b) Mean Average Precision (MAP 100)
Mothed
Method
0.07
0.30
Denowtbet-tall
0.00
Denaellll--pant
0.25
Demaellal-quurt
(in9226)))
Dine226)
Call: Emnnt
0.35
0:30
0.00
0.01
Seventy
Severtty
(c)
Marginal Calibration Error
(d) TopeLabel Calibration Error
Figure 7: Comparing QAcl with ReLU activation and DINOv2 (small) on CIFARIOC
Fuzhen Zhuang, Zhiyuan Qi, Keyu Duan, Dongbo Xi, Yongchun Zhu, Hengshu Zhu, Hui Xiong, and Qing He. comprehensive survey on transfer learning. Proc. IEEE, 2021.
A Experiment details for figure 2
We consider the features obtained from ResNet18 with both QAct and ReLU activations for the datasets of CIFAR10C with gaussian noise at all the severity levels. Hence, we have 6 datasets in total. To use TSNE for visualization, we consider 1000 samples from each dataset and obtain the combined TSNE visualizations. Each figure shows a scatter plot of the 2d visualization for the corresponding dataset.
B Compute Resources and Other Experimental Details
All experiments were performed single NVidia GPU with 32GB memory with Intel Xeon CPU (10 cores). For training, we perform an 80:20 split of the train datasot with seed 42 for reproducibility. All networks are initialized using default pytorch initialization technique.
We use Adam optimizer with initial learning rate 1e 3 3. We use ReduceLRonnPltenn learning rate scheduler with parameters- factor=0.1, patience=50, cooldown=10, threshold=0.01, threshold modc=abs, min 1r-1-6. We monitor the validation accuracy for learning rate scheduling. We also use seryy_stoppin when the validation accuracy does not increase by 0.001.
15

---

0.875
Nothod Thilet
Mechod Tripct
0.55
Watarshed
Woteersed
0.025
Cross Entropy
Pross-Entroyy
Kbun Preckion
0.800
0.775
0.70
0.725
0.05
0.655
Severity
(a) Accuracy
(b) Mean Average Precision (MAP@100)
0.040
Mached
Tiplet
0.233
Croas-Entropy
0.035
Caib: www.rrortttaaeeeeeeo
0.31
0.12
0.034
0.30
0.032
0.08
Implcc
Watershed
Cross-Entropy
Sever Ky
Severity
(c) Marginal Calibration Error
(d) TopeLabel Calibration Error
Figure 8: Triplet vs Watershed vs Cross-Entropp using Resnet 18 CIFARIOC
C Extended Results Section
Figure 7 shows the corresponding re- sults. The first experiment compares QAct + watershed with ReLU + Cross-Entropy on two standard networks ResNeu18 and Net. With respect to accuracy, we observe that while at severity 0, ReLU + Cross-Entropy slightly outperforms QAct + watershed, as severity increases QAct + watershed is far more stable. We even outperform (INOv2(small) (22M parameters) consistent trend across distortions. As (Challa et al., (024bb argues, this helps in building more robust systems compared to where calibration error increases across distortions.
Comparing QAct + watershed and ReLU-CCros-Enttee
severity 5. Morcover, with respect
calibration error,
Remark:
Docs loss function make a lot of difference? Figure compares three different loss functions Water- shed, Triplet and Gross-Entrops when used conjunction with QAct. We observe similar trends across all loss functions. However, Watershed performs better with respect to Mean Average Precision (MAP) and hence we use this as a default strategy.
Why AvennAAerage-Pae Precision? We argue that the key indicator of distortion invariance should be the quality of embedding. While, accuracy (as measured by linear classifier) is good metric, better one would be to measure the Aeaan-Aveegg-Precistt Y-axis, the figures suggest reducing calibration error. However, the standard deviations overlap, and hence, these are assumed to be constant across distortions.
With respect to calibration error, due to the scale on the
How well does watershed perform when used with ReLU activation? Figure g shows the cor- responding results. We observe that both the watershed loss and cross-entropy have large overlaps in the
16

---

Mithed
Nothod
Resneris Emsstenenyy
3.0
Nesner19
0.80
Denseltst Sonseted-Crossnnee CrossEntropy
Rosnettl Watershed
DenseNett Waterrhed
DonseNec Watershed
Precision
0.7
0.80
0.55
0.4
3 Sevenity
5
(a) Accuracy
(b) Mean Average Precision (MAP@100
Methed
0.40
Method
Assnet18 CrocsEntropy
Resnet18 CressEntropy
0.08
DonseNet CrossEncropy
Resnet18 Watennshd
0.25
Dengehet CrossEncrop:
S9rmet1S-Waterppe
0.06
Cath
(c) Marginal Calibration Error
(d) Top-Label Calibration Error
Figure Watershed vs Cross-Entropy when using ReLU activation using CIFAR10C
17

---

1.0
0.0
0.6
0.5
Nethed
LeNet
LoNet
VS6
Resne:18
Pesner18
Ouant
NetU
Artivation
Activation
(a) Accuracy
(b) Mean Average Precision (MAP@100)
Natted
0.175
Nethod
LeMet
0.0
0.130
Resner18
Denseret
Densenet
0.125
0.6
Calto Citoetrrerhoooueee
0.100
0.4
0.050
0:2
0.025
0.000
0.0
Quant
PEUL
ReLU
Acbrebbrr
Activation
(c) Marginal Calibration Error
(d) Top-Label Calibration Error
Figure 10: Results MNTST
standard deviations all severity levels. So, this shows that, when used conjunction with ReLU watershod and cross-entropy loss are very similar. But in conjunction with QAct, we that watershed has a slightly higher Sean-Averrge-Prettiee
What if we consider an easy classification task? In figure 10 we perform the comparison of QAct++Waar Watershed and ReLU and cross-entropy on MNISTC dataset. Across different architectures, we observe a lot less variation (standard deviation) of QAct+ Watershed compared to ReLU and cross-entropy. This again suggests robustness against distortions of Aatershetehhe
Comparing with other popular activations: Figures 11 and 12 shows the comparison QAct with ReLU, PRcLU and ScLU. We obscrve the same trend across ReLU, PRcLU and ScLU, while QAct is far stable across distortions.
Results on CIFAR100/ C1RR100/Tinymmaannee.. Figure 13 comparcs QAct+ Watershed and ReLU+Cross- Entropy on CIFARI00C dataset. We also include the results of QAcl+Cross Cross-Entroyy vs. ReLU+Cross- Entropy on TinylmagenetC. The results are consistent with what we observe on CIFAR1OC, and hence, draw the same conclusions before.
Effect of Quantile Classifier: Figures and 15 shows the effect of quantile classifier on standard ResNet10/Dinov2 outputs with CIFARIOC/CIFARIU datascts. While the accuracy values are almost equivalent, we observe "flatter" trend of the calibration errors, sometimes reducing the error as the case of CIFAR100C.
18

---

Method
0.5
Wethod
ReLU
Be1U
pfeiLL
0.8
Quant
5.0
Ouar
0.6
0.4
0
Soverity
Severity
(a) Accuracy
(b) Mean Average Precision (MAP 100)
0.42
0.08
phelU
0.85
0.50
Fals Emmr(Megina)
Calls: Swrertrppptt......
0.25
0.20
(c) Marginal Calibration Error
(d) Top-Label Calibration Error
Figure 11: QActvs ReLU vs pReLU Selu activations ResNet18 + CIFAR1OC
19

---

Method
Wethod
ReLU
BeLU
Ouant
Quark
2.6
0.6
0.5
0
3.
Soverity
Severity
(a) Accuracy
(b) Mean Average Precision (MAP@ 100)
0.08
pheLU
0.07
Call:: Sww.rttretttt.... Abab
0.25
0.20
0.04
Fall
0:35
0.03
0.30
(c) Marginal Calibration Error
(d) Top-Label Calibration Error
Figure 12: QActvs ReLU pReLU Selu activations on Densenet-CCPPRIOOC
20

---

CRaRLDe-Quant CPARSDG MAU
Quant CIFR100 Drnek2tsl
Tryinagenettlll
Tiryrmagenct DrneV2is)
P037 LUg Presson
0.33
0.4
0.30
033
0.15
0.10
secerity
Seavriiy
(a) Accuracy
(b) Mean Average Precision (MAP 100)
CHARIG0 Quart
GIAR100 ReLL
Tinymagene--Ju
0.14
CPARLOD Guani
Tinymagenes-RuU
CFARLOD-ReeU
DineV2iar
0.012
Tuylnaganst-Cuatt
0.5
Try
Callo EMt.EErnn//Tp-Lttt Latel)
0.010
Imytnaginet-hnolllll
0.005
0.004
0.007
Suosa
Scverity
(c) Marginal Calibration Error
(d) Top-Label Calibration Error
Figure 13: QActvs ReLU on Rexntt/S-CCFAAA...//TT/yymmnnmm
21

---

0.05
Nehhed
Reslett1 CalbCH
Reshittta CalbOr
Dinov/2ts) Caller
Reshiett B-wart
DinoV/26) LinearCir
Strae bitt
0.7
0.65
0.00
Soverity
Severity
(a) Accuracy
(b) Mean Average Precision (MAP@100)
0.08
Method
Method
ReaNer30 Colizil
0.30
(ini126) calbeif
RinoV2ts)-Calec.
0.06
0.20
Call Eoout
0.30
0.01
Seventty
(c) Marginal Calibration Error
(d) Top-Label Calibration Error
Figure
Effect Quantile Classifier. We use ResNet18 and Dino architectures on CIFAR1OC.
22

---

Nethed
Rashett Calbei
Resiettia Unsarc
Rashette
(inoV21a) inceril
Mean Jug Rreeiston
0:40
0.25
0.30
0.25
Secerity
Severity
(a) Accuracy
(b) Mean Average Precision (MAP@ 100)
0.6
0114
Natiad
DinoV/2s11 CaibCif
0.5
NenReCIBUneenC
unearcif
Cnovzos-Uneact
Cellr.rrrn Ewo.ErorTip--Luom
0.010
0.008
0.2
0.005
0.1
0.004
(c) Marginal Calibration Error
(d) Top-Label Calibration Error
Figure 15: Effect of Quantile Classifier, We use ResNet18 and Dino architectures on CIFAR100C.
23

---

0-+1
0->2
0-+3
0-+4
0-+5
1 1-+2
1 1-+3
1-x4
1-+5
Dataset
Mlodl//Method
CIFARIO
Resnet18-Reil
6.70
11.57
17.27
24.82
35.49
4.87
10.57
18.12
28.79
Dino (2(s)
6.92
10.66
15.74
21.58
30.93
3.74
8.82
14.67
24.02
Resnet18 1aaneet8--0e Quant
4.42
6.88
9.22
12.42
16.86
2,46
4.80
8.00
12.44
CIFAR100
Resnet18-ReLU
10.25
17.85
23.78
29.81
36.87
7.59
13.52
19.56
26.62
Dino (2())
10.64
16.39
22.54
28.71
38.02
5.74
11.89
18.06
27.37
Resnet Quant
5.83
9.07
12.20
15.93
21.00
3.24
6.38
10.10
15.17
Tinylmagenes
5.51
9.58
14.90
19.13
21.49
4.07
9.39
13.62
15.97
(2(s)
9.39
14.73
23.30
33.78
42.52
5.34
13.91
24.39
33.13
Resnet Ma 8- Quant
3.27
4.86
7.26
10.43
13.18
1.59
3.99
7.16
9.90
Table 2: Measuring the drop in accuracy
2-+3
2-+4
2-+5
3->4
3-+5
4-+5
Dataset
Model/Method
CIFAR10
Resnet18-ReLU
5.70
13.25
23.92
7.55
18.22
10.67
D2no
5.08
10.93
20.28
5.85
15.20
9.35
Resnet 18- Q--Quntt
2.34
5.54
9.98
3.20
7.64
4.45
CIFAR100
Resnet 18 R-R
5.93
11.97
19.03
6.04
13.10
7.06
(2)s
6.15
12.32
21.63
6.17
15.48
9.31
Resnet 8 Quant
3.13
6.86
11.92
3.73
8.79
5.06
Tiny Inagenet
Resnet 18- R-RLUU
5.32
9.55
11.90
4.23
6.58
2.35
V2(s)
8.57
19.05
27.79
10.48
19.22
8.74
Resnet Quant
2.40
5.56
8.31
3.17
5.92
2.75
Table 3: Measuring the drop in accuracy (contd. from table
Measuring Robustness of QAct: To mcasure the robustness of the proposed method Acc@Dist_i Acc@Dist_j which measures the drop in accuracy when the distortion severity is increased from i - A method is considered to be better if the values are lower, i.c if the drop in accuracy is smaller than comparitive methods. Tables 2 and shows the comparison between ReLU, QAct and DinoV2(s). We see that, in all the cases QAct outperforms both ReLU and D2no) at all possible +
the metric
D Watershed Loss
The authors in CChalla al. 2024a proposed novel classifier watershed classifier, which works by learning similarities instead of the boundaries. Below we give the brief idea of the loss function, and refer the reader to the original paper for further details.
Lot (x;, yi) donote the samples in cach batch, and let fo denote the embedding network. fo(x;) denotes the corresponding embedding.
Starting from randomly selected seeds in the batch, propagate the labels all the samples. Let v denote the estimated samples. For cach fa(;)) and for each label 1, obtain the nearest neighbour in the samples in the set,
S = (f((z;)) S = y: =1
(11)
that is, all the samples of class labelled correctly. Denote this nearest. neighbour using So (I..). 3. Then the loss given by,
Aaumplea
L
exp(-1lfo(r)) - -fo(2 E exp (-11fo(x;) - ( fo(
Watershed Loss
Mys = I log
(12)
Teamples
24

---

Why Watershed Loss?: Observe that the loss in equation 12 implicitly learns representations consistent with the RBF kernel, which is known to be translation invariant. Minimizing this loss function, hence, will learn translation invariant kernels. This is important for obtaining networks robust to distortions.
If one uses (say) cross-entropy loss, then the features learned would be such that the classes are linearly separable. Contrast this with watershed, which instead learns a similarity between two points in a translation invariant manner.
Observe that the watershed loss is very similar metric learning losses. The authors in CChalla et al. 2024a) claim that this offers better generalization, and show that this is consistent with INN classifier. Moreover, they show that this classifier (without considering fo) has a VC dimension which is equal to the number of classes. While metric learning losses are similar, there is no such guarantee with respect to classification. This motivated our choice of using watershed loss over other metric learning losses.
Remark:
E Formal Explanation of Failure Mode in Linear Models and why Quantiles fix it
Here, we discuss the failure mode presented in section | formally in the context of linear models. And then show, why the quantile activation as presented corrects this.
Let {(x, v.)} denote the set of examples from the joint probability distribution of p(x, y). Assume for simplicity the binary classification problem i.e y {0, 1}. Let w'x + b denote the linear classifier trained this. Note that the classification rule is then simply [w' x - b 2 0].
Linear Models under simple Distribution Shift:
Now let A denote a transformation matrix. Let x (marginal) be transformed as Ax. If w = Ax denote a sample from the transformed distribution, the classification rule applied to this sample is
Tw'x' +b 0] = [[w (Ax) + +b2
(13)
It is easy to see that, even under the simple case of A = cI, the class assignment can vary arbitrarily with c.
Linear Models + Quantile Activation under simple Distribution Shift: What we propose in the article, is to instead consider the following classification rule. x' Ar denote a sample from the transformed distribution,
P(w'a' w (Ax)) 2 0.5 P(w'(Ax) > w (Ax)) 2 0.5
(14)
Here, if A = cI, then it is easy to see that the class assignment is independent of the value of c. More formally, we have the following proposition.
Proposition Let A denote the transformation as described above. Then, as long as A'w = aw with a then the class assignment of the linear model with quantile activation does not change under the transformation Ax + where can be arbitrary.
The proof follows by simple substitution in equation
25


Reviews:
[{"review_id": "x614AhJ4jj", "reviewer": "Reviewer_MssE", "summary": "", "questions": "", "limitations": "", "rating": null, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "The experiments, even though they are proof-of-concepts, look pretty promising and interesting. I think the paper is also based on a natural, yet potentially powerful idea. However, I am quite concerned about the writing: in its current shape, I had a lot of difficulties following the flow of the article, and many questions remain, that, I think, are important to address (see below).", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "No", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "paper_topic_and_main_contributions": "", "excitement": null, "reproducibility": null, "ethical_concerns": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "summary_of_contributions": "In this article, the authors propose to use QAct, a new activation function for neural network layers, for performing predictions that are more robust to dataset distortions. As QAct is computed as a quantile (corresponding to the current pre-activation value) of the distribution of all pre-activation values in the batch, its gradient (and thus its incorporation into autodifferentiable models) is equal to the density of the distribution, which can be obtained with kernel density estimators. The authors then provide numerical experiments illustrating the robustness of neural net architectures that are augmented with QAct against several degrees of severity of distortions and across several datasets. In particular, positive comparison with respect to Dino-V2, a state-of-the-art model in domain generalization, is emphasized.", "claims_and_evidence_yn": "No", "claims_explanation": "", "audience_yn": "Yes", "audience_explanation": "", "requested_changes": "---The connection with the work of (Challa et al., 2023) is unclear. Is the proposed approach a simple extension, or does it propose a radically new idea within this framework? The link between the first two paragraphs of Section 2 is not evident at all. I probably missed something, but the key point of the method of (Challa et al., 2023) is to refit the model at different quantiles, in order to appropriately capture the data shape, and thus to be robust to data distortions. In the proposed approach, I don't see the same happening: the model stays the same across batches. Hence, I find the transition between QuantProb and QAct difficult to make.\n\n---The experiments presented in the introduction looks nice, but they are only briefly discussed, and there are no additional details about them after the method has been presented. In particular, I would have really liked to see why QAct allows to obtain the results in Figure 1 & 2, as it is not clear just from its definition. Indeed, taking, e.g., Figure 1, I do not see why QAct allows to get better accuracy: it is possible that, from a batch to another, the projections of the Gaussian of mu_1 and that of the Gaussian of mu_2 switch positions, and thus using QAct will not help in separating them (in one batch, points from mu_1, resp. mu_2, will be in the left, resp. right, part of the distribution, and on the right, resp. left, part in another batch). I am sure that I misunderstood something, so explaining these examples again in much greater details in section 4 would be appreciated. Also, what are the colored lines in Figure 1a? I think they are not explained in the text.\n\n---I do not understand why Algorithm 1 requires to approximate the quantile of QAct with a list of predefined quantiles tau_1,...,tau_n: why not computing the quantile exactly (using, e.g., a function like numpy.quantile)? This could introduce significant biases if n_tau is too small and/or not uniform across [0,1] (such as, e.g., [0.70, 0.75, 0.80]).\n\n---The paragraph \"Grounding the Neurons\" is unclear and contradictory with the main argument of the paper (at first sight). It looks like the fact that QAct always outputs a uniform distribution between [0,1] is problematic, but (1) Figure 3 seems to indicate that it is actually a desired property, and (2) I don't see why the proposed transformation (that forces the median to be 0) will help. This could be better explained.\n\n---There are many factors that could be discussed in experiments: what is the dependence of the performance with respect to the batch sizes? To the kernel bandwidth in the KDE (assuming it is a Gaussian kernel)? To the number of samples needed to compute the KDE?", "broader_impact_concerns": "N/A", "additional_comments": "", "extra_scores": {}, "extra_text": {}}, {"review_id": "QCku9t36iO", "reviewer": "Reviewer_NoTz", "summary": "", "questions": "", "limitations": "", "rating": null, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "**Strengths**\n\n- The paper addresses a relevant problem of the TMLR community\n- The proposed approach is practical, e.g., it can be applied to all scenarios where data is obtained in batches or sequentially\n- The properties of the method are evaluated in several experiments (however, they are not compared to similar approaches)\n\n**Weaknessess**\n\n- Overall presentation of the paper and writing requires improvement (e.g., lack of motivation, large number of paragraphs without clear transitions between them)\n- No baselines that try to tackle the problem of OOD generalizations except for DINOv2. However, there are more suitable baselines (see other references)\n- Discussion of related work and overall references are not extensive enough\n- Add references to the first paragraphs of the introduction\n- There are several works that use batch information at test time (batch statistics) to improve robustness (e.g., [1,2]). The authors should frame their contribution accordingly and also compare against these works. Some works improve robustness without relying on batch statistics [3, 4] (not necessary to compare to those but still interesting)\n- Would have been interesting to simulate the proposed approach in a real-world use case where data is obtained over time (e.g., activation statistics are running averages) \n\n\n[1] Li et al., \"Revisiting Batch Normalization For Practical Domain Adaptation\", 2016\n[2] Schneider et al., \"Improving robustness against common corruptions by covariate shift adaptation\", 2020\n[3] Zhang et al., \"MEMO: Test Time Robustness via Adaptation and Augmentation\", 2022\n[4] Schwinn et al., \"Improving Robustness against Real-World and Worst-Case Distribution Shifts through Decision Region Quantification\", 2022", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "Yes", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "paper_topic_and_main_contributions": "", "excitement": null, "reproducibility": null, "ethical_concerns": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "summary_of_contributions": "The authors demonstrate that current ML frameworks (specifically DL) are not able to handle distribution shifts of the data at train and test times. They propose the quantile activation function (QAct), which uses batch information to handle distribution shifts online. Namely, the activation function computes the activation for the entire batch of samples and adjusts the activation of individual samples based on this value.\nIn an empirical study they demonstrate that their method improves robustness to distribution shifts on several datasets.", "claims_and_evidence_yn": "Yes", "claims_explanation": "", "audience_yn": "Yes", "audience_explanation": "", "requested_changes": "- Improve the presentation of the paper and transitions between talking points. At the moment the introduction is mostly a list of discussion points that follow after another (I acknowledge that there already is some structure but IMO it could be improved to make the paper easier to understand). \n- Considerably extend the discussion of related work and back up all claims made in the paper by references or experiments\n- Add baselines from other works that address the same problem (sometimes even using batch statistics)\n- Add discussion how this approach may be applied in practice (since batch statistics are not always available)", "broader_impact_concerns": "N/A", "additional_comments": "", "extra_scores": {}, "extra_text": {}}, {"review_id": "Q6In5jZiqL", "reviewer": "Reviewer_oSZT", "summary": "", "questions": "", "limitations": "", "rating": null, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "Strengths:\n * the idea of using quantile-based neural networks is promising as it does not require strong assumptions about the distribution\n * robustness to domain shifts is a very relevant research field that is of interest to TMLR's audience\n\nWeaknesses:\n  * The type of domain shift is not clearly defined. The motivating examples are focused on concept shift/drift, where p(Y|X) changes. However, the experiments on common corruptions are actually examples of covariate shift, that is: the feature distribution p(X) changes over time. The paper would benefit from more rigor in defining the problem statement and the assumptions on changes in data distribution\n * An underlying assumption of the work seems to be that all elements in a batch come from the same distribution (and distribution shift only happens between different batches). This is a strong assumption, which should be motivated better\n * Under the assumptions that all elements of a batch come from the same distribution, there are many alternative approaches and baselines that could be compared to, for instance having a normalization layer operate across batch elements (like batch normalization does at training time)\n * Related work should be more focused on \"Batch-wise Domain Adaptation\"\n * Experimental evaluations are too narrow, focusing exclusively on \"common corruption\" domain shift.\n * Figure 1 right is confusing and would require more explanation", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "No", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "paper_topic_and_main_contributions": "", "excitement": null, "reproducibility": null, "ethical_concerns": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "summary_of_contributions": "The paper studies modifications of neural net architectures that improve robustness against domain shift. The paper proposes a novel \"Quantile Activation\" function for single neurons that operates on batch level. By operating on batch-level (and assuming that batch-elements come from the same distribution), the proposed quantile activation function can increase robustness to certain type of domain shifts. In experimental results, the method is shown to perform well on common corruption benchmarks (CIFAR10C, CIFAR100C, TinyImagenetC) in terms of accuracy and calibration.", "claims_and_evidence_yn": "No", "claims_explanation": "", "audience_yn": "Yes", "audience_explanation": "", "requested_changes": "The paper needs to be improved in terms of clarity of problem statements, motivation of the studied problem, identification of most closely related work, and experimental evaluation (comparison to simple batch-level baselines, study of domain shifts beyond just common corruptions). I believe a major revision is required.", "broader_impact_concerns": "no concerns", "additional_comments": "", "extra_scores": {}, "extra_text": {}}]

Author rebuttal:

Meta-review: The reviewers generally agree that the paper presents an interesting idea and addresses a relevant problem for the TMLR community. One point raised by the reviewers is that the paper could be improved by expanding the experimental evaluation to include a wider range of domain shifts and by providing more in-depth intuitions behind the method's effectiveness. However, the current version of the manuscript is sound and presents a novel approach with sufficient empirical evidence to warrant publication in TMLR.  The core idea of QAct is interesting and the experimental results, while limited, are convincing within their scope.  Further enriching the paper with more extensive experiments and deeper intuitions would undoubtedly make it stronger, but requesting a major revision at this stage, given the positive assessments from the majority of reviewers and the authors' revisions, would likely be inefficient and potentially a waste of both reviewer and author time.
Decision: Accept (poster)