Spectral Intrinsic-Dimension Minimum Description Length for Automatic Cluster Selection in
Full Typeset Research Paper:
paper/SID_KMeans_Paper.pdf(LaTeX source inpaper/main.tex, Typst source inpaper/main.typ)
Predecessor Exploratory Study: Audits, fixes, and generalizesKMeansResearch(2023) from heuristic 2D penalization to parameter-free spectral information theory validated on 768D–1024D Transformer embeddings (NVIDIA GB10).
Selecting the cluster count
-
Geometric Indices (
Silhouette,Caliński–Harabasz,Davies–Bouldin): Cannot evaluate$K = 1$ (100% false-positive overfitting on single-topic corpora!), and Caliński–Harabasz collapses flat onto$\hat{K} = 2$ on hierarchical high-dimensional embeddings. -
Gap Statistic (
Tibshirani et al., 2001): Draws uniform reference points over a$d$ -dimensional bounding box—catastrophically mismatching curved unit-sphere embeddings (MAE = 5.13on 1024DBGE-Large) while running$5\times$ –$7\times$ slower. -
Ambient
X-Means/ BIC (Pelleg & Moore, 2000): Suffers two opposite high-dimensional failures:-
Dilution Collapse (
$\hat{K} \to 1$ ): Isotropic background noise$\sigma_\perp^2 > 0$ caps ambient log-distortion gains at$N\Delta^2/\sigma_\perp^2$ while penalties grow as$\Theta(Kd\ln N)$ . -
Collinearity Inflation (
$\hat{K} \to K_{\max}$ ): Smooth low-intrinsic-rank manifolds ($\nu \ll d$ ) inflate ambient log-likelihoods by factor$d / \nu \gg 1$ (up to$32\times$ on 1024D embeddings!).
-
Dilution Collapse (
SID-KMeans combines three exact parameter-free statistical pillars (verified symbolically via SymPy in python/verify_proofs.py):
-
Theorem 1 — Exact Marginal
LogSumExpMixture Likelihood (Curing Voronoi Overfitting):
Proves that hard Voronoi partitioning reduces$\mathrm{WCSS}$ on a unimodal Gaussian$\mathcal{N}(\mathbf{0}, \sigma^2\mathbf{I}_m)$ by$1 - \frac{2}{\pi m}$ , causing naive$\mathrm{WCSS}$ -BIC to diverge at$-\frac{2}{\pi}N$ ($100%$ overfitting). Evaluating exact marginal mixture likelihood eliminates Voronoi truncation bias while preserving sensitivity to softly touching clusters. -
Theorem 2 & Pillar 1 — Gavish–Donoho Marchenko–Pastur Bulk Denoising:
Strips isotropic random-matrix noise singular values below the optimal Marchenko–Pastur threshold$\tau_{\mathrm{GD}} = \omega(\beta)s_{\mathrm{med}}$ , preventing high-$d$ dilution collapse above$d_{\mathrm{crit}} = \frac{N\Delta^2}{(K^*-1)\sigma_\perp^2\ln N}$ . -
Theorem 3 & Pillar 2 — Satterthwaite–Welch Quadratic-Form Degrees of Freedom:
Matches squared Euclidean distances on anisotropic manifolds to their exact$\chi_\nu^2$ moment law via$\nu = \frac{(\operatorname{Tr}\hat{\boldsymbol{\Sigma}})^2}{\operatorname{Tr}(\hat{\boldsymbol{\Sigma}}^2)} \ll d$ , eliminating$d/\nu$ collinearity inflation while guaranteeing exact scale, translation, and orthogonal rotation invariance.
1. Real 768D & 1024D Transformer Embeddings (60 Corpora from 20 Newsgroups, $K^* \in {1, 2, 4, 6, 8, 10}$ )
| Method |
BGE-Base-768D MAE |
768D Within-±1 Acc |
768D NMI |
BGE-Large-1024D MAE |
1024D Within-±1 Acc |
1024D NMI |
|---|---|---|---|---|---|---|
SID-KMeans (Ours, |
0.20 | 100.0% | 0.745 | 0.23 | 100.0% | 0.759 |
Ambient X-Means (Pelleg & Moore) |
0.70 | 93.3% | 0.707 | 0.53 | 96.7% | 0.721 |
| Silhouette Score | 0.97 | 73.3% | 0.715 | 0.80 | 86.7% | 0.752 |
| Caliński–Harabasz Index | 3.50 | 33.3% | 0.435 | 3.50 | 30.0% | 0.449 |
| Davies–Bouldin Index | 4.03 | 46.7% | 0.667 | 4.33 | 40.0% | 0.673 |
| Gap Statistic ( |
4.77 | 0.0% | 0.622 | 5.13 | 0.0% | 0.628 |
2. High-Dimensional Phase-Transition Duality ($d = 6 \to 1536$ ) & Null Overfitting Prevention ($K^* = 1$ )
| Aspect | Prior 2023 Baseline (KMeansResearch) |
This Work (IntrinsicDimKMeans) |
|---|---|---|
Coordinate Space (VCC) |
Subtracted raw pixel VCC (~245px) from [0,100] normalized centroids |
Fixed matched coordinate space + exact Huygens |
| Seeding & Column Bug | Deterministic farthest-point seeding; read WCSS/n column instead of |
Genuine 0 warnings, 0 errors .NET 8 build |
| Hyperparameters & Scale | Required manual |
Zero tunable parameters; provably invariant to scaling, translation, & |
| High-D AI Validation | 2D manual click canvas only | Validated up to |
from python.sid_kmeans import SIDKMeans
selector = SIDKMeans(k_max=15, random_state=42).fit(embeddings)
print(f"Optimal K* = {selector.k_hat_} (Effective DoF nu = {selector.nu_:.2f})")using KMeansResearchTools;
var result = SIDKMeansSelector.EvaluateMatrix(dataMatrix, kMax: 12);
Console.WriteLine($"Optimal K* = {result.OptimalK}, Effective DoF = {result.EffectiveDoF:F2}");# Reproduce symbolic proofs, invariance unit tests, benchmarks, & C# GUI:
python python/verify_proofs.py
python python/test_all.py
dotnet build csharp/KMeansResearch.sln


