Worst-Case Optimal ε-Rate Stability of KL Divergence under Perturbations of Gaussian Distributions
Authors: Jialu Pan, Yufeng Zhang, Nan Hu, Zhenbang Chen, Ji Wang, Keqin Li
Organizations: College of Computer Science and Electronic Engineering, Hunan University, Changsha, China. · National University of Defense Technology, China. · Department of Computer Science, State University of New York at New Paltz, 1 Hawk Drive, New Paltz, NY 12561, USA.
We establish a stability bound for the Kullback-Leibler (KL) divergence when its Gaussian reference distribution is perturbed. Existing relaxed triangle inequalities of KL divergence between Gaussian distributions require all three distributions to be Gaussian, which limits their use in applications such as out-of-distribution detection with flow-based generative models. Let N1 and N2 be d-dimensional Gaussian distributions, and let P be any d-dimensional distribution satisfying EP[∥X∥2]<∞ and KL(P∥N1)<∞. If KL(N1∥N2)≤ε for 0<ε<1/12, we give an upper bound of ∣KL(P∥N1)−KL(P∥N2)∣. Under suitable uniform boundedness conditions, the bound is 26dε+Kε+o(ε) as ε→0 for fixed d, where K depends on the parameters of N1 and N2, and on EP[∥X∥] and EP[∥X∥2]. Furthermore, we prove that the ε dependence is worst-case optimal. The result extends stability guarantees restricted to Gaussian triples to comparisons involving an arbitrary distribution and two nearby Gaussian references. Experiments on synthetic distributions and latent representations from flow-based models support the predicted stability behavior.
Figures & tables
Fig. 1: KL divergence-based analysis of OOD detection for the Gaussian case where QZ can be approximated by a Gaussian distribution [ 13 ] .
Fig. 2: Proof roadmap of Theorem 1 .
Fig. 3: Stability of KL divergence KL(P∥N1) under Gaussian perturbation. Arrows represent KL divergences.
Perturbation
ϵ
ΔKL
B(ϵ)
TR
K′
K′
MC s.e.
mean-plus
0.08
-0.08
4.66
0.02
-0.28
13.18
0.0016
mean-minus
0.08
-0.08
4.66
0.02
-0.29
13.18
0.0016
sigma-expand
0.07
0.83
3.69
0.22
3.03
9.65
0.0007
sigma-shrink
0.07
-1.30
3.61
0.36
-4.98
11.30
0.0010
both-plus
0.06
0.60
3.45
0.17
2.55
11.53
0.0009
both-minus
0.08
-0.95
4.52
0.21
-3.32
12.84
0.0017
TABLE I: Results of the one-dimensional synthetic experiment at α=1 . MC s.e. denotes the Monte Carlo standard error in estimating ΔKL .
Perturbation
Description
mean-x
shift rightward along the x -axis
mean-diag
shift diagonally downward and rightward
cov-x-expand
expand along the x -axis
cov-y-shrink
contract along the y -axis
cov-diag-expand
expand along a diagonal direction
cov-rot-anisotropic
apply rotated anisotropic expansion and contraction
TABLE II: Perturbations to N1=N(0,I2) .
Perturbation
ϵ
ΔKL
B(ϵ)
TR
K′
K′
MC s.e.
mean-x
0.08
-0.14
5.78
0.02
-0.50
16.97
0.0015
mean-diag
0.08
-0.10
5.70
0.02
-0.34
16.94
0.0005
cov-x-expand
0.03
0.49
3.50
0.14
2.94
18.15
0.0006
cov-y-shrink
0.02
-0.28
3.24
0.09
-1.79
18.14
0.0006
cov-diag-expand
0.03
0.77
3.50
0.22
4.68
18.15
0.0008
cov-rot-anisotropic
0.03
0.72
4.61
0.16
3.95
21.37
0.0007
TABLE III: Results of the two-dimensional synthetic experiment at α=1 . MC s.e. is the Monte Carlo standard error in estimating ΔKL .
ID
OOD
ΔKL
B(ϵ)
TR
K′
K′
KLQ
abs
crescent
0.0144
0.04
0.33
5.25
15.79
2.18
gaussian
0.0088
0.03
0.26
3.23
12.44
1.10
sine_wave
0.0142
0.04
0.32
5.18
15.92
2.03
crescent
abs
-0.0294
0.09
0.34
-4.02
11.71
1.53
gaussian
-0.0315
0.09
0.36
-4.31
11.97
1.79
sine_wave
-0.0258
0.09
0.30
-3.53
11.78
1.22
TABLE IV: Results on a two-dimensional NSF. All MC s.e. values are less than 10−4 . KLQ is KL(QZ∥N(0,I2)) .
Fig. 4: Distributions of the tightness ratio TR and empirical coefficient K′ across groups of Glow latent dimensions. Dimension groups satisfying E[∥Z∥2]>50 are excluded from the violin plots for readability.
Appendix figures & tables17 assets
Supplementary material from the paper’s appendix.
Appendix
Fig. S1: Distribution of model log-likelihood. Glow model trained on CIFAR-10 assigns higher likelihoods to SVHN than CIFAR-10 and comparable likelihoods to SVHN with an adjusted contrast of factor 2.0 (SVHN-C(2.0)).
Fig. S2: f(x)=x−logx−1 .
Fig. S3: P is a two-component truncated Gaussian mixture, N1 is the standard Gaussian distribution, and N2 is obtained by increasing the standard deviation of N1 .
Fig. S4: KL behavior under one-dimensional Gaussian perturbations. (a) KL(N1∥N2) versus the perturbation strength α . (b) KL(P∥N1)−KL(P∥N2) versus KL(N1∥N2) . The curve of mean-plus almost overlaps with that of mean-minus .
Fig. S5: The estimated theoretical bound B(ϵ) in the one-dimensional synthetic experiment. Each marker corresponds to a value of α .
Fig. S6: P is a two-component truncated Gaussian mixture, N1 is the standard Gaussian distribution, and N2 is obtained by perturbing N1 with covariance expansion along the x -axis.
Fig. S7: KL behavior under two-dimensional Gaussian perturbations. (a) KL(N1∥N2) versus the perturbation strength α . The cov-x-expand and cov-diag-expand curves overlap. (b) KL(P∥N1)−KL(P∥N2) versus KL(N1∥N2) . Each dot on a curve corresponds to one value of α .
Fig. S8: The estimated theoretical bound B(ϵ) in the two-dimensional synthetic experiment. Each marker corresponds to a value of α .
Fig. S9: Datasets used in the two-dimensional neural spline flow experiments.
Fig. S10: Neural spline flow model trained on the abs dataset. Left: density learned by the flow model; Right: samples generated by the flow-based model.
Fig. S11: Representations of ID ( abs ) and OOD datasets.
ID dataset
p -value
KL(PZ∥N(0,I2))
abs
0.47
7.48×10−6
crescent
0.37
5.34×10−5
gaussian
0.39
2.21×10−5
sine_wave
0.39
1.84×10−5
Appendix
TABLE S1: p -value: Henze-Zirkler normality test results on the ID representations from the two-dimensional NSF models.
Dataset
KL(PZ∥N(0,I4))<1/12
p>0.05
CelebA32
98.6%
93.0%
SVHN
99.3%
94.4%
CIFAR-10
99.1%
91.1%
Appendix
TABLE S2: Proportions of dimension groups of ID representations.
Fig. S12: Distributions of the tightness ratio TR and empirical coefficient K′ across groups of Glow latent dimensions. Dimension groups satisfying E[∥Z∥2]>50 are excluded from the violin plots for readability.
ID
OOD
Proportion
Pearson’s r
p -value
SVHN
ImageNet32
13.8%
-0.99
<10−10
LSUN
0.5%
-0.95
<10−10
CIFAR-10
CelebA32
2.2%
1.00
<10−10
LSUN
7.5%
1.00
<10−10
Appendix
TABLE S3: Proportions of dimension groups where E[∥Z∥2]>50 . ID–OOD pairs with no such dimension groups are omitted. The Pearson correlation coefficient r between K′ and E[∥Z∥2] , together with the p -value.
Fig. S13: Estimated E[∥Z∥2] and the ratio F3/K′ on each dimension group when testing OOD datasets on Glow models. Groups with estimated second moments satisfying E[∥Z∥2]>50 are excluded from the violin plots for readability.
Fig. S14: KL(PZ(g)∥N(0,I4)) for all groups of ID representations and KL(QZ(g)∥N(0,I4)) for groups of OOD representations satisfying E[∥Z∥2]>50 . KL divergence values greater than 50 are omitted to improve the scale of the visualization.
Department of Electronic Engineering and Information Science, University of Science and Technology of China, Hefei, China · Department of Electrical Engineering, Princeton University, Princeton, NJ, USA