# Calibrated Compact-Support Anomaly Score

- ID: 1013
- Canonical URL: https://synthcore.org/idea/1013/calibrated-compact-support-anomaly-score
- API JSON: https://synthcore.org/api/idea/1013.json
- API Markdown: https://synthcore.org/api/idea/1013.md
- Verification status: failed_benchmark
- Source: [arXiv:2607.16547](https://arxiv.org/abs/2607.16547)
- Category: regularization
- Solves: accuracy, stability, generalization
- ML areas: loss, embedding, regularization
- Math tags: information-theory, probability, statistics, geometry
- Ratings: usefulness 7/10; difficulty 3/10; novelty 7/10

## Idea description

Replace Gaussian Mahalanobis scoring with the projective maximum-entropy density whose support is exactly a prescribed ellipsoid. The score is finite inside the admissible region and assigns an explicit boundary penalty outside it, avoiding arbitrary post-hoc Gaussian truncation.

## Mathematical statement

For dimension \(d\) and squared Mahalanobis acceptance radius \(R^2>d+2\), the paper calibrates the deformation as \(\gamma_R=2/(R^2-d-2)\). Let \(\mu\in\mathbb R^d\) be the reference location, \(\Sigma\succ0\) the reference covariance, and \(r^2(x)=(x-\mu)^\top\Sigma^{-1}(x-\mu)\). The compact maximum-entropy density is \(p_R(x)=C_{d,R,\gamma}[1-r^2(x)/R^2]_+^{1/\gamma_R}\), where \([u]_+=\max(u,0)\), and its support is exactly \(r^2(x)\le R^2\). The normalization is \(C_{d,R,\gamma}=\Gamma(d/2+1+1/\gamma_R)/(\pi^{d/2}R^d\Gamma(1+1/\gamma_R))\). The calibration gives \(\mathbb E[r^2]=d\), hence covariance \(\Sigma\), while affine transformations of \((\mu,\Sigma)\) preserve the Mahalanobis geometry.

## Key formulas

- $$\gamma_R=\frac{2}{R^2-d-2},\qquad R^2>d+2.$$
- $$r^2(x)=(x-\mu)^\top\Sigma^{-1}(x-\mu),\qquad p_R(x)=C_{d,R,\gamma}\left[1-\frac{r^2(x)}{R^2}\right]_+^{1/\gamma_R}.$$
- $$C_{d,R,\gamma}=\frac{\Gamma\!\left(\frac d2+1+\frac1{\gamma_R}\right)}{\pi^{d/2}R^d\Gamma\!\left(1+\frac1{\gamma_R}\right)}.$$
- $$-\log p_R(x)=\begin{cases}-\log C_{d,R,\gamma}-\frac1{\gamma_R}\log\left(1-r^2(x)/R^2\right),&r^2(x)<R^2,\\+\infty,&r^2(x)\ge R^2.\end{cases}$$

## Implementation notes

Integrate this at the anomaly-scoring head of an embedding model, after a frozen or trainable encoder produces \(z=f_\theta(x)\in\mathbb R^d\). Estimate robust \(\mu\) and \(\Sigma\) on nominal training embeddings, using a robust covariance estimator or shrinkage covariance \(\Sigma_\lambda=(1-\lambda)\hat\Sigma+\lambda I\). Choose an acceptance radius from the desired nominal coverage, while enforcing \(R^2>d+2\), and compute \(\gamma_R=2/(R^2-d-2)\). For every embedding, solve \(v=L^{-1}(z-\mu)\) with Cholesky factor \(LL^\top=\Sigma\), then set \(r^2=\|v\|^2\). Return the negative log-density for in-support points. During training, replace infinity by a stable barrier: clamp \(1-r^2/R^2\) to \(10^{-6}\), and add \(\operatorname{softplus}(r^2-R^2)\) for outside points. Pseudocode: estimate \((\mu,\Sigma)\); compute \(R,\gamma_R,C\); encode a batch; compute Mahalanobis radii; evaluate the piecewise score; optimize the task loss plus \(\alpha\) times the score on nominal data. The paper supplies the radius/deformation and covariance-preserving construction; coverage quantiles, shrinkage, and soft barriers are empirical. First test on CIFAR-10 or MVTec with a small ResNet and compare Gaussian Mahalanobis and Gaussian-plus-truncation at equal features. Measure AUROC and false-positive rate at fixed nominal coverage. Success is improved OOD detection or calibration without changing the encoder.

## Verification

- Status: failed_benchmark
- Mechanism evidence: yes
- Mechanism confirmed: no
- Practical verdict: harms
- Verdict: Built the calibrated compact-support anomaly scorer with Cholesky Mahalanobis geometry, exact normalization, calibrated gamma, hard outside-support scores, and a stable barrier option. Across R²={7.5,11,25,85} in d=5, numerical normalization was 1.0, sampled E[r²] was 5.003, 5.003, 4.998, 5.000 versus predicted 5, and boundary slopes matched predictions within 1.2e-6; affine radius error was 7.1e-15. The mechanism is real, but the equal-feature OOD comparison was exactly tied with Gaussian Mahalanobis (AUROC 0.7885 and anomaly acceptance 0.5445 at 95% nominal coverage), as expected from monotonicity in r².

### Mechanism check

- Verdict: Built the calibrated compact-support anomaly scorer with Cholesky Mahalanobis geometry, exact normalization, calibrated gamma, hard outside-support scores, and a stable barrier option. Across R²={7.5,11,25,85} in d=5, numerical normalization was 1.0, sampled E[r²] was 5.003, 5.003, 4.998, 5.000 versus predicted 5, and boundary slopes matched predictions within 1.2e-6; affine radius error was 7.1e-15. The mechanism is real, but the equal-feature OOD comparison was exactly tied with Gaussian Mahalanobis (AUROC 0.7885 and anomaly acceptance 0.5445 at 95% nominal coverage), as expected from monotonicity in r².
- Confidence: 9/10
- Limitations: Only a synthetic equal-feature anomaly experiment was tested; no CIFAR-10, MVTec, learned encoder, robust covariance estimation, training-time barrier optimization, runtime/FLOP study, or real-world calibration evaluation was performed. The Monte Carlo covariance check used identity covariance and exact sampling rather than estimating parameters from finite nominal data.

### Practical benchmark

- Paired seeds: 8
- Baseline mean: 0
- Idea mean: 0
- p-value: 0.0081
- Paired wins: 0/8
- Benchmark verdict: idea worse (significant)

## Artifacts

- [bench_report.json](https://synthcore.org/code/416/bench_report.json)
- [compact_anomaly.py](https://synthcore.org/code/416/compact_anomaly.py)
- [report.md](https://synthcore.org/code/416/report.md)
- [report_bench_2026-08-31T114455.md](https://synthcore.org/code/416/report_bench_2026-08-31T114455.md)
- [results.json](https://synthcore.org/code/416/results.json)
- [stage2_compact_bench.py](https://synthcore.org/code/416/stage2_compact_bench.py)
- [Download all files as ZIP](https://synthcore.org/download/416)

## Disclaimer

AI-generated research hypothesis, automatically tested. Not peer-reviewed.
