Mahalanobis++: Improving OOD Detection via Feature Normalization
ELVIA analysis
Independent review pending
The released normalized-relative Mahalanobis evaluator can mix normalized class statistics with unnormalized global statistics under its prescribed evaluation order. A fully specified example with positive-definite covariances reverses two sample rankings, establishing a Major implementation defect for that reported variant. The primary Mahalanobis++ path and the separate CIFAR relative implementation avoid this defect; historical table effects remain unverified. A Gaussian-moment basis omission and limited numerical summary errors are Minor. The principal 41/44 improvement count, variance-deviation identity, and selected aggregate arithmetic check out within the inspected scope. Scientific adjudication is pending.
Problem 1. Cache-dependent normalized-relative score mixes feature coordinates
MajorEvidence and reasoning
Problem statement
For training features labels and nonempty classes, the paper estimates The primary score is Larger scores indicate more ID-like inputs. The evaluation uses a threshold at ID true-positive rate. Mahalanobis++ applies to both fitting and test features (Section 4, Equation (6)). The relative version additionally fits global mean and covariance without class centering, and uses This is Appendix ’s definition on page 34. Page 7 introduces relative Mahalanobis++ by applying feature normalization to that construction. Its columns recur throughout the main and appendix results. The implementation issue below concerns that specific normalization-dependent score.
Relative Mahalanobis++ applies feature normalization to both class and global fits before evaluating the relative score.
Nonzero features; all classes nonempty. Normalized class caches exist; normalized global caches do not; caller supplies raw training features. Every covariance in the witness is positive definite; score is the paper's finite-feature estimator.
Proof
In `NINCO/detection_methods.py`, `evaluate_Relative_Mahalanobis_norm`, lines – training normalization is conditional on missing class-statistic caches. A later, separately conditioned global fit can consequently use raw features while the class fit and test features are normalized.
Test features are normalized at lines – Lines – load `mean_norm.npy` and `prec_norm.npy`. Training normalization at line lies inside the branch at line that runs only if these class statistics are incomplete. Global caches are checked separately at lines – on a miss, lines – estimate their mean and covariance directly from the current training array.
This state occurs in the documented workflow. README line recommends `–method all`. `NINCO/evaluate.py`, lines – places `Mahalanobis_norm` before `Relative_Mahalanobis_norm`; line selects this list. The loop at line passes the same stored raw training array (assigned at line ) and per-model cache path (line ) to the two functions at lines – The first function normalizes by local rebinding at `detection_methods.py`:453 and saves the class caches at lines – It does not modify the caller’s raw array in place. The relative call then skips training normalization and, if its global caches are absent, fits a raw global Gaussian under normalized-cache filenames.
Take classes with three raw training features each. In classes use in the other use All vectors are nonzero, every class is nonempty, and the construction respects the source’s hard-coded ,000-class loop. It tests the finite-feature estimator, which is defined without requiring the empirical features to be exactly Gaussian.
After normalization, the two distinct class means are and direct centered sums give The raw global covariance is with the same zero mean. All three covariance matrices are positive definite. Let and both already have unit norm. Exact arithmetic yields:
Quantity |
Minimum normalized class distance |
Correct normalized global distance |
Raw-global distance at normalized test point |
Correct relative score |
Mixed-coordinate relative score |
Thus the correct method ranks above but the mixed fit ranks below The discrepancy is not a common additive offset or an increasing transformation that would leave ranking metrics unchanged. The independent check verified these fractions symbolically and separately fitted the covariance matrices from the explicit ,000-row synthetic array. Neither computation called author code.
Possible revision
Normalize training features before either fit and rebuild affected global/statistic-dependent score caches with explicit provenance.
Problem 2. Gaussian variance expansion omits the rotated mean
MinorEvidence and reasoning
Problem statement
For training features labels and nonempty classes, the paper estimates The primary score is Larger scores indicate more ID-like inputs. The evaluation uses a threshold at ID true-positive rate. Mahalanobis++ applies to both fitting and test features (Section 4, Equation (6)). The relative version additionally fits global mean and covariance without class centering, and uses This is Appendix ’s definition on page 34. Page 7 introduces relative Mahalanobis++ by applying feature normalization to that construction. Its columns recur throughout the main and appendix results. The implementation issue below concerns that specific normalization-dependent score.
Lemma 3.1 defines the squared-norm variance using covariance eigenvalues and unqualified original mean coordinates.
X is Gaussian; Sigma positive definite. Original mean coordinates are not silently redefined after rotation.
Proof
The printed variance numerator uses eigenvalues of paired with coordinates without specifying that the mean is expressed in the covariance eigenbasis.
For the coordinate-invariant formulas are These follow by expanding independent Gaussian coordinates after orthogonal rotation. The lemma instead prints For the actual variance is Pairing the original mean coordinates with eigenvalues gives or after reversing their order. An invariant variance cannot depend on that ordering.
Appendix B explicitly states the correct rotated mean before later writing This is decisive counterevidence: reading those later coordinates in the eigenbasis restores the moment calculation and Chebyshev argument. The supported defect is a local mathematical statement/notation omission, not a failure of Gaussian norm analysis or a demonstrated violation of the claimed probability bound for a particular threshold. Replacing the numerator by the invariant expression above is analytically verified. No empirical result was shown to depend on the erroneous coordinate reading.
Possible revision
Use the invariant expression or explicitly replace by ()_i.
Problem 3. Universal comparator wording and model-win count exceed displayed results
MinorEvidence and reasoning
Problem statement
For training features labels and nonempty classes, the paper estimates The primary score is Larger scores indicate more ID-like inputs. The evaluation uses a threshold at ID true-positive rate. Mahalanobis++ applies to both fitting and test features (Section 4, Equation (6)). The relative version additionally fits global mean and covariance without class centering, and uses This is Appendix ’s definition on page 34. Page 7 introduces relative Mahalanobis++ by applying feature normalization to that construction. Its columns recur throughout the main and appendix results. The implementation issue below concerns that specific normalization-dependent score.
All considered cosine/KNN cases improve; Table4 has30/44 Maha++ wins; relative normalization improves across models/datasets.
Proof
Some universal comparator wording and one model-win count disagree with the paper’s own numerical tables.
Page 6 says the method outperforms KNN and cosine similarity in all considered cases. Table 12, page 26, gives EffNetV2-S FPR for Maha++ versus for cosine, and ResNet50-supcon versus for cosine and for NNguide. On CIFAR100 RN34, Tables 3 and 16 give Maha++ versus KNN Lower FPR is better. Likewise, page 7’s claim that relative normalization improves across models and datasets has exceptions in Table 2: iNaturalist for ConvNeXtV2-B and for SwinV2-B.
Independent enumeration of the displayed Table 4 rows gives Maha++ winners, relative-Maha++ winners, ViM winners, unnormalized-Maha winners, and Ash winner, with no displayed minimum ties. Page 7 instead states for Maha++. The full row-wise count is retained in the calculation evidence.
The appendix openly acknowledges comparator exceptions, and the main text acknowledges the three failures to improve ordinary Maha. The correction is therefore to qualify the universal wording and reconcile the 29-versus-30 summary, not to reject the demonstrated average advantage. Original unrounded measurements were not available; rounding of aggregate means is not treated as an additional error.
Possible revision
Qualify comparator statements and reconcile the count with the displayed table.
Supporting record & provenance
Work status
Current version
Version 1
Minhao Liu · Initial report · Version 1
Independent review pending
Original claim and review scope
We show below that Mahalanobis++ outperforms KNN and cosine similarity in all considered cases and, in particular, improves OOD detection consistently across tasks, architectures, training methods and OOD datasets as post-hoc method.
Published ICML 2025 proceedings PDF (PMLR 267); PDF p. 6
Actual review scope
The recorded inspection concerns these source locations: Paper p. 7 and Appendix G p. 34; NINCO/detection_methods.py:548–662; evaluate.py:28–37,109,217,244,274–287,416; README:100.; p. 4 Lemma 3.1; Appendix B pp. 13–14; pp. 6–7; Tables2–4 and12/16.