Counting Before Clustering: When the Number of Novel Classes Is Easier to Find Than the Classes Themselves

Systems that discover new categories in unlabeled data have to decide how many categories there are, and almost all of them decide by clustering. The standard recipe from Generalized Category Discovery tries many candidate counts $k$, runs a clustering for each, and keeps the $k$ whose clustering best agrees with the small labeled subset. This makes counting categories no easier than sorting every image into its category. We propose to test, in theory and in practice, whether that dependence is necessary. Our hypothesis is that it is not: there is a range of signal strengths where the number of novel categories can be estimated in polynomial time even though no polynomial-time method can reliably assign points to those categories. In that range, any "cluster, then score the clustering" estimator of $k$ will fail by construction.

The tools come from hardness reductions, the technique of proving one problem is at least as hard as a problem believed to be intractable. Prior work used this technique to separate detecting hidden structure from recovering it. We transfer that separation to the semi-supervised, unknown-cardinality setting of category discovery. The theory gives a map of where counting, recovery, and the labeled-accuracy heuristic each succeed. The practical result is a count-first estimator whose failure regime differs from the heuristic's. We then check on the standard fine-grained benchmarks whether real feature spaces sit in the regime where this difference matters.

Core Claim

Consider a semi-supervised mixture. Points $x_i \in \mathbb{R}^d$ are drawn as $x_i = \mu_{c(i)} + \sigma g_i$, where $g_i$ is standard Gaussian noise and $\sigma$ its scale. Each label $c(i)$ is either one of $K_{old}$ known classes, for which a few labeled examples are given, or one of $K_{new}$ unknown novel classes. The novel means $\mu$ may be sparse, as in Subspace clustering in high-dimensions. Within this model there are three tasks of increasing difficulty: deciding whether any novel class exists, estimating $K_{new}$, and recovering which points belong to which novel class.

We claim the counting threshold lies strictly between the other two in a nonempty parameter region. In the dense-mean case the gap is statistical rather than computational: counting works at the spectral detection edge, but the labeled-accuracy heuristic needs near-exact partitions. In the sparse-mean case we conjecture a computational gap and will give low-degree and, where possible, reduction-based evidence for it.

A natural count-first statistic works as follows. Remove the span of the labeled class means from the unlabeled data. Center the residuals. Count the eigenvalues of the residual sample covariance $\hat\Sigma$ that exceed the edge of the noise spectrum:

$$ \hat K_{new} = \#\{\, j : \lambda_j(\hat\Sigma) > \sigma^2 (1+\sqrt{\gamma})^2 + \delta \,\}. $$

Here $\gamma = d/n_u$ is the ratio of dimension to the number of unlabeled points, and $\delta$ is a small finite-sample margin. The term $\sigma^2(1+\sqrt\gamma)^2$ is the Marchenko–Pastur bulk edge, which is the largest eigenvalue produced by pure noise. The labeled anchors matter here because removing the known-class directions is what makes the remaining signal rank track the novel classes.

This statistic is not the contribution. The contribution is (a) proving where it, and better count-first estimators for sparse means, provably beat recovery-based selection of $k$, and (b) showing whether that gap appears in DINO-feature spaces.

Relation to Prior Work

Three papers motivate the theory.

Detection-Recovery and Detection-Refutation Gaps via Reductions from Planted Clique reduces from planted clique, the conjecture that a hidden clique slightly above $2\log n$ size in a random graph cannot be found in polynomial time. It proves an "easy detection, hard recovery" regime for planted dense subgraphs and Gaussian bi-clustering. It plants one structure of known type and asks nothing about how many structures there are. We add the counting task in between and add labeled anchors.

Complexity Theoretic Lower Bounds for Sparse Principal Component Detection shows polynomial-time tests for a single sparse spike need signal $\sqrt{k^2\log d/n}$ rather than the optimal $\sqrt{k\log d/n}$. Counting several sparse spikes is the multi-component version of their problem, and their reduction supplies our main lower-bound template.

Subspace clustering in high-dimensions derives information-theoretic and message-passing thresholds for sparse-centroid mixtures. It assumes $k$ is known and the clusters are balanced. We reuse its state-evolution analysis to locate the recovery threshold and ask whether unknown $k$ moves it.

The Bane of Low-Dimensionality Clustering constrains the program rather than motivating it. It proves exact $k$-means needs $n^{\Omega(k)}$ time in $\mathbb{R}^4$ under the Exponential Time Hypothesis, the conjecture that 3-SAT has no subexponential algorithm. That result is worst-case, low-dimensional, and takes $k$ as given. It tells us not to frame the question as exact optimization, which is hopeless regardless of $k$. Our setting is average-case and high-dimensional.

On the empirical side, Generalized Category Discovery supplies the heuristic we analyze. It reports estimating the novel count within a 0–10% error margin. DebGCD documents label bias: features over-confidently pull novel instances into known classes. We turn that observation into a prediction. If the embedding compresses novel directions, selecting $k$ by labeled accuracy rewards solutions that give novel classes too few clusters, so the heuristic should underestimate. Parametric Classification for Generalized Category Discovery (SimGCD) argues that accurate $k$ matters less for over-complete parametric heads. That claim directly challenges the relevance of this work, and we test it rather than assume it away.

Research Program

The theoretical half has three steps.

First, in the dense-mean model we will characterize the counting threshold of the deflated spectral statistic, using standard spiked random-matrix results. We will also characterize the signal level at which the labeled-accuracy heuristic becomes consistent. Our conjecture is that the heuristic needs signal well above the spectral edge, because the labeled-accuracy curve over $k$ only peaks sharply at the true count when partitions are nearly correct. We will also show how the number of labeled anchors per known class shifts both thresholds.

Second, in the sparse-mean model we will analyze low-degree polynomials, a standard proxy for polynomial-time algorithms. The goal is to locate the computational thresholds for counting versus recovery.

Third, we will attempt a reduction from secret-leakage planted clique, following the Bresler–Jiang machinery, to a multi-spike counting problem. If the reduction does not close, we will report the remaining "white space" honestly; that paper also leaves such regions open. This step is the riskiest part of the project. The project still delivers if only the low-degree evidence and the dense-case analysis succeed.

The empirical half builds the count-first estimator for real features. We start from frozen DINO ViT features, as in Vaze et al. We estimate the noise level from within-class scatter of the labeled classes rather than assuming isotropy, whiten by that scatter, deflate the labeled-mean span, and count outlier eigenvalues. We then feed the resulting $\hat K$ into unchanged downstream discovery pipelines. We also need to know where each benchmark sits on the theoretical map. To place them, we measure each dataset's effective signal-to-noise ratio per novel class: the separation between class means divided by within-class spread, using the ground-truth labels only for this diagnostic.

Baselines

The naive reference is a fixed guess of $k$. Following common practice, this is $K_{old}$ plus the number of novel classes assumed by the benchmark's split ratio applied blindly, along with a deliberately doubled and halved guess. It shows how much any estimator matters downstream.

The strongest existing estimator is the labeled-accuracy heuristic of Generalized Category Discovery, which reports estimating the novel count within a 0–10% error margin. The file gives no per-dataset estimated counts on Lacuna. We will rerun it on identical frozen features, with the same candidate range of $k$, the same semi-supervised $k$-means implementation, and the same number of restarts. We give our estimator no tuning beyond the margin $\delta$, which is fixed on CIFAR-100 and frozen elsewhere. Beating it means lower absolute count error on a majority of the six benchmarks. More decisively, it means the error gap grows as the measured per-class signal-to-noise ratio falls, which is what the theory predicts.

For downstream accuracy, the strongest systems in the file are DebGCD, which reports 65.3% on Stanford Cars and 65.0% overall on ImageNet-1K, and SimGCD. We will run both with ground-truth $K$, heuristic $\hat K$, and our $\hat K$, under each paper's training schedule, to measure New-class accuracy as a function of count error.

Two ablations isolate the key ingredients. The first is the same eigenvalue count without anchor deflation, which is the plain eigengap. The second is deflation without whitening by labeled within-class scatter.

Why not just…?

Why not just use the eigengap, silhouette, or gap statistic? The plain eigengap is a real threat, because our estimator is a refined eigengap. The theory is what says when the refinement matters. Without anchor deflation, known-class directions dominate the top spectrum, and the gap between known and novel eigenvalues hides the count. The no-deflation ablation settles this directly. Silhouette and gap statistics score clusterings, so they inherit the recovery bottleneck that our theory says limits the labeled-accuracy heuristic. The file also notes plain $k$-means reaches only 52.0% on CIFAR-100 versus 73.0% for the contrastive method (Generalized Category Discovery), which shows how weak clustering-quality signals are in raw space. We include both statistics as baselines rather than argue.

Why not just use an over-complete parametric head, as SimGCD does? Parametric Classification for Generalized Category Discovery reports robustness to count variations, but the file quotes no magnitude of misspecification it tolerates. No reported result was found on Lacuna for SimGCD accuracy under large count errors. If our sweep shows New-class accuracy flat across 0.5× to 2× the true count, the practical half of this proposal is moot, and we will say so. The theoretical map would remain.

Why not just tune the labeled-accuracy heuristic better? Our dense-case analysis predicts that the heuristic's failure is structural: it is limited by partition quality, and label bias pushes it toward underestimation. Better restarts or candidate grids would not fix either. The test is whether its errors are signed, meaning systematically below the true count, and whether they correlate with the per-class signal-to-noise ratio rather than with optimization noise across seeds.

Proposed Experiments

We start with synthetic mixtures matching the theoretical model. We sweep signal strength, sparsity, anchors per known class, and $K_{new}$. For each estimator we plot the empirical probability of the exact count and of an accurate partition. The decisive check is whether a band appears where counting succeeds and every clustering-based selector fails. We also check whether the band's edges match the derived thresholds within finite-size corrections.

We then move to CIFAR-100, ImageNet-100, CUB, Stanford Cars, FGVC-Aircraft, and Herbarium19 under the standard splits, with frozen DINO features and then features fine-tuned by the Vaze et al. contrastive recipe. Metrics are absolute and signed error in $K_{new}$, and All/Old/New clustering accuracy downstream of SimGCD and DebGCD.

Two outcomes would decide the question. The first is whether count-first beats the heuristic specifically on the fine-grained, low signal-to-noise datasets, CUB, Cars, and Aircraft, and ties on CIFAR. The second is whether fine-tuning with supervised contrastive loss, which DebGCD's label-bias finding suggests compresses novel directions, shifts the heuristic toward underestimation while leaving the spectral count stable. If neither pattern appears, the conclusion is that real benchmarks lie outside the gap regime. That is still a useful negative result for a field that mostly reports results with the true $K$ given.