{"slug": "can-the-shape-of-data-predict-where-a-classifiers-decision-boundary-is", "title": "Can the Shape of Data Predict Where a Classifier’s Decision Boundary Is?", "summary": "A researcher's pilot study found that a second-order \"energy contrast\" predictor built from generative models trained separately on source and target classes landed closer to a classifier's true decision boundary than a first-order predictor in 89, 89 and 97 of 120 test points across three victim classifiers, but the reduction in victim queries was tiny and statistically indistinguishable from zero. The approach uses the gradient and signed Hessian of a calibrated energy contrast to predict where it crosses zero along candidate directions, reserving hard-label queries only to verify and refine those predictions. The author outlines the math, the pilot results and a pre-registered test plan for whether class-conditional generative models can forecast decision-based adversarial attack boundaries before an attack starts.", "body_md": "**TL;DR.** Decision-based adversarial attacks only see a classifier’s predicted labels, so they burn hundreds or thousands of queries just to find the decision boundary. I’m asking a different question: can generative models trained separately on the source and target classes predict where that boundary is before the attack starts? I build a calibrated “energy contrast” between the two classes, use its gradient (first-order) and its signed Hessian (second-order) to predict where it crosses zero along a set of candidate directions, and then use hard-label queries only to verify and refine those predictions. In early synthetic experiments the second-order predictor lands closer to the true crossing than the first-order one in 89, 89 and 97 of 120 test points across three victim classifiers, but the savings in victim queries are tiny and statistically indistinguishable from zero. This post walks through the idea, the math, the pilot results, the pre-registered test plan and, honestly, what could go wrong.\n\nConsider an image classifier trained to distinguish between dogs and cats.\n\nFor an input image x ∈ ℝᴰ, the classifier produces a collection of internal scores:\n\n**z(x) = [z₁(x), z₂(x), …, z꜀(x)]**\n\nIts prediction is determined by the class with the highest score.\n\nFor a binary classification problem involving source class s and target class t, we can define a discriminative margin:\n\n**m(x) = zₜ(x) − zₛ(x)**\n\nThe corresponding decision boundary is characterized by:\n\n**Bꜰ = {x ∈ ℝᴰ : m(x) = 0}**\n\nAt a regular point, this equation describes a local interface separating two decision regions. In a multiclass setting, the corresponding scores must also dominate those of the remaining classes.\n\nNow consider the same problem from a generative perspective.\n\nInstead of directly learning a classification function, suppose we estimate the probability densities associated with the two classes:\n\nThese distributions describe how the respective classes are represented within the input space.\n\nGiven class priors πₛ and πₜ, the Bayes decision interface between the two classes satisfies:\n\n**πₛpₛ(x) = πₜpₜ(x)**\n\nEquivalently,\n\n**log[πₜpₜ(x) / πₛpₛ(x)] = 0**\n\nThis gives us two different geometric objects: a boundary determined by a trained classifier and an ambiguity surface determined by class distributions.\n\nIf a classifier were an exact Bayes classifier for those distributions, these interfaces would agree under the appropriate regularity conditions. In practice, however, classifiers are trained using finite data, particular architectures, optimization objectives, regularization, and learned representations.\n\nThere is therefore no guarantee that their decision boundaries coincide with the generative ambiguity surface.\n\nThe relationship between these two surfaces is what interests me.\n\nDecision-based adversarial attacks operate under a particularly restrictive assumption: the classifier returns only its predicted class.\n\nGiven an input x, we observe f(x), but not the internal scores, probabilities, or gradients that determine that prediction.\n\nMost decision-based attacks learn about the boundary by *talking to the victim*:\n\n• **Boundary Attack** introduced label-based distortion reduction.\n\n• **HopSkipJumpAttack (HSJA)** estimates directions near the boundary from decisions; **QEBA** adds representative subspaces to boundary-normal estimation.\n\n• **GeoDA** studies the local geometry of the observed boundary; **SurFree** and **Triangle Attack** use structured geometric searches.\n\n• **CGBA** (and its targeted variant, **CGBA-H**) account for curved search paths using victim feedback; **ADBA** reduces queries by approximating boundary distances when comparing directions.\n\nAnother family borrows a *prior* from a separate model: **EigenBA** (singular vectors of a representation Jacobian, though in its original form it queries target probabilities), **NonLinear BA** (a learned nonlinear projection for gradient estimation), **DTA** (a transferable transformation model), latent generative attacks, and Moraffah and Liu’s generative surrogate learned near a target model’s boundary. Diffusion-guided decision-only editing is another neighbor.\n\nSo using a generative prior is not, by itself, new. The gap I’m targeting is narrower: **a prediction of boundary location, made before any victim interaction, from class-density derivatives learned independently of the victim.** And I define “location” operationally: compute roots of the generative contrast along a fixed menu of unit directions and take the feasible root with the shortest Euclidean displacement. That approximates a *nearby* point on the learned class-ambiguity surface. It is explicitly not an estimate of the globally nearest point on the victim’s boundary.\n\nRather than beginning with an entirely unknown boundary, I wanted to investigate whether independently learned class distributions could provide a useful geometric prior.\n\nThe distinction is important.\n\nA generative model would not be trained to imitate the classifier. It would instead learn the source and target distributions independently, and the information contained in those distributions would be evaluated for its ability to predict classifier behavior.\n\nThe research question is whether this geometric information remains useful when the classifier itself is unknown.\n\nNatural images are represented in high-dimensional pixel spaces. A grayscale MNIST image, for example, can be represented as a vector in ℝ⁷⁸⁴.\n\nHowever, meaningful variations in handwritten digits do not necessarily occupy all 784 dimensions independently. Changes in orientation, stroke thickness, translation, and writing style often exhibit structured relationships. The manifold hypothesis suggests that high-dimensional data may concentrate near lower-dimensional geometric structures. Suppose that the source distribution is concentrated near a smooth d-dimensional embedded manifold:\n\n**Mₛ ⊂ ℝᴰ, where d ≪ D**\n\nLocally, the manifold can be represented using a coordinate chart:\n\n**F : U ⊂ ℝᵈ → Mₛ**\n\nThe differential DF(u) maps a direction in the intrinsic coordinate space to a tangent vector in the ambient space.\n\nAt a point a = F(u), the tangent space is given by\n\n**TₐMₛ = Im(DF(u))**\n\nThe induced Riemannian metric is\n\n**G(u) = DF(u)ᵀDF(u)**\n\nFor a curve γ(t) = F(u(t)) lying on the manifold, its length is determined by this metric:\n\n**L(γ) = ∫₀¹ √[u̇(t)ᵀG(u(t))u̇(t)] dt**\n\nThe intrinsic distance between two points is then the infimum of the lengths of curves connecting them on the manifold.\n\nSince the length of any connecting curve is at least the Euclidean distance between its endpoints,\n\n**‖x − a‖₂ ≤ dM(a,x)**\n\nThis distinction matters because two points can be close in Euclidean distance while being comparatively distant along the manifold.\n\nNear an anchor point a, the local embedding can be expressed in geodesic normal coordinates as\n\n**F(u) = a + Uu + ½IIₐ(u,u) + O(‖u‖³)**\n\nHere, U spans the tangent space, while IIₐ denotes the second fundamental form, which describes the extrinsic curvature of the manifold. This expression separates local geometric variation into first-order and second-order components. The first-order term describes tangent directions. The second-order term describes how the embedding departs from its tangent-space approximation.\n\nFor an orthonormal tangent basis U, the tangent and normal projectors are\n\n**Pₜ = UUᵀ**\n\n**Pₙ = I − UUᵀ**\n\nUnder suitable curvature bounds, the variation of tangent projectors can be controlled by intrinsic distance:\n\n**‖Pₜ(x) − Pₜ(a)‖ₒₚ ≤ LₚdM(a,x)**\n\nPositive reach additionally ensures that points sufficiently close to the manifold have a unique nearest-point projection. These observations motivate the use of local derivatives rather than a single global geometric approximation. However, there is an important distinction: the curvature of the data manifold is not necessarily the curvature of a classifier’s decision boundary, nor does smooth data geometry alone establish that a learned energy Hessian varies slowly.\n\nFor that reason, I use manifold geometry as motivation for the construction and evaluate derivative reliability separately.\n\nDirectly estimating a probability density in a high-dimensional image space is challenging. Score-based generative modeling provides an alternative by estimating derivatives of the log-density rather than the density itself.\n\nFor a probability density p(x), its score function is defined as\n\n**s(x) = ∇ₓ log p(x)**\n\nThe score describes the local spatial variation of the log-density.\n\nIts Jacobian,\n\n**J(x) = ∇ₓs(x) = ∇²ₓ log p(x),** contains second-order information about that distribution.\n\nTo understand why these derivatives might encode geometric information, it is useful to begin with Gaussian smoothing.\n\nSuppose X is a random vector following a class-conditional distribution P꜀.\n\nIntroduce an independent Gaussian random vector\n\n **Z ∼ N(0,Iᴰ)**\n\nand define the noisy observation\n\n **Y = X + σZ**\n\nConditioned on X = x, the random variable Y follows a multivariate Gaussian distribution:\n\n **Y | X = x ∼ N(x,σ²Iᴰ)**\n\nIts conditional density is\n\n **p(y | x) = (2πσ²)⁻ᴰ⁄² exp(−‖y − x‖²/2σ²)**\n\nThe marginal density of Y is obtained by integrating over the original data distribution:\n\n**pσ(y) = ∫ p(y | x) dP꜀(x)**\n\nWhen the original distribution has a density, this can equivalently be written as a convolution:\n\n**pσ = p꜀ ∗ N(0,σ²Iᴰ)**\n\nGaussian convolution is particularly useful because the original data distribution might be concentrated on a lower-dimensional manifold and might not possess an ordinary density with respect to the ambient Lebesgue measure. For σ > 0, the Gaussian-smoothed distribution possesses a smooth, strictly positive density throughout the ambient space. Its logarithm, gradient, and Hessian therefore become well-defined. The smoothing parameter σ controls the scale at which the distribution is examined. Small values retain more local structure, while larger values combine information across broader neighborhoods.\n\nI consider a class-conditional scalar energy function Eθ(y,c,σ), from which the score and its Jacobian can be obtained:\n\n**sθ,꜀(y) = −∇ᵧEθ(y,c,σ)**\n\n**Jθ,꜀(y) = −∇²ᵧEθ(y,c,σ)**\n\nThe energy can be trained using the denoising score matching objective:\n\n**Lᴅꜱᴍ = E[(w(σ)/2) ‖sθ,꜀(X + σZ) + Z/σ‖²]**\n\nThe target term follows directly from differentiating the conditional Gaussian log-density.\n\nSince\n\n**log p(y | x) = constant − ‖y − x‖²/(2σ²),**\n\nwe obtain\n\n**∇ᵧ log p(y | x) = (x − y)/σ²**\n\nUsing y = x + σz gives\n\n**∇ᵧ log p(y | x) = −z/σ**\n\nThe denoising score matching objective therefore trains the model to approximate the conditional Gaussian score. Under squared-error minimization, the optimal prediction is the conditional expectation of this training target given the noisy observation. This conditional expectation equals the marginal score of the Gaussian-smoothed distribution. This allows score estimation without explicitly computing the energy model’s normalization constant.\n\nAn important connection between generative modeling and geometry emerges from the optimal denoising problem.\n\nConsider a denoising function Dσ that reconstructs a clean observation X from its noisy version Y.\n\nUnder the mean squared error objective,\n\n**min_D E[‖X − D(Y)‖²],**\n\nthe optimal denoiser is the posterior mean:\n\n**D*σ(y) = E[X | Y = y]**\n\nThis follows from the conditional bias-variance decomposition:\n\n**E[‖X − a‖² | Y = y] = tr(Cov(X | Y = y)) + ‖E[X | Y = y] − a‖²**\n\nThe second term is minimized precisely when a equals the posterior mean.\n\nThe next question is how this posterior mean relates to the score function.\n\nStarting from the Gaussian-smoothed marginal density,\n\n**pσ(y) = ∫ p(y | x) dP꜀(x),**\n\ndifferentiate with respect to y:\n\n**∇ᵧpσ(y) = ∫ [(x − y)/σ²] p(y | x) dP꜀(x)**\n\nDividing by pσ(y) yields\n\n**∇ᵧ log pσ(y) = (E[X | Y = y] − y)/σ²**\n\nRearranging gives\n\n**D*σ(y) = y + σ²∇ᵧ log pσ(y)**\n\nThis is the multivariate Gaussian form of **Tweedie’s identity**.\n\nIt establishes that the optimal denoiser can be recovered from the score of the noisy data distribution.\n\nEquivalently,\n\n**s*σ(y) = (D*σ(y) − y)/σ²**\n\nThe score is therefore the normalized displacement from a noisy observation toward its posterior mean. This is particularly interesting because the denoising process is not simply removing noise. It provides information about the conditional distribution of plausible clean observations.\n\nThe posterior mean describes the first conditional moment of X given Y.\n\nTo obtain second-order information, consider the posterior covariance matrix:\n\n**Cσ(y) = Cov(X | Y = y)**\n\nBy definition,\n\n**Cσ(y) = E[(X − μ(y))(X − μ(y))ᵀ | Y = y]**\n\nwhere\n\n**μ(y) = E[X | Y = y]**\n\nExpanding the expression gives\n\n**Cσ(y) = E[XXᵀ | Y = y] − μ(y)μ(y)ᵀ**\n\nThe diagonal entries describe conditional variances, while the off-diagonal entries describe conditional dependence between coordinates. The Gaussian observation model also allows the derivative of the posterior distribution to be expressed as**∇ᵧ log p(x | y) = (x − μ(y))/σ²** where the posterior is interpreted relative to an appropriate underlying measure.\n\nDifferentiating the posterior mean coordinate-wise gives\n\n**∂μᵢ(y)/∂yⱼ = Cov(Xᵢ,Xⱼ | Y = y)/σ²**\n\nIn matrix form,\n\n**DD*σ(y) = Cov(X | Y = y)/σ²**\n\nThus, the Jacobian of the optimal denoiser is proportional to the posterior covariance matrix.\n\nNow differentiate Tweedie’s identity:\n\n**DD*σ(y) = Iᴰ + σ²J*σ(y)**\n\nCombining the two expressions gives\n\n**Iᴰ + σ²J*σ(y) = Cov(X | Y = y)/σ²**\n\n**J*σ(y) = Cov(X | Y = y)/σ⁴ − Iᴰ/σ²**\n\nThis is the mathematical connection between second-order score information and the conditional covariance of the underlying distribution. Since covariance matrices are positive semidefinite,\n\n**Iᴰ + σ²J*σ(y) ⪰ 0**\n\nIt follows that every eigenvalue of the ideal score Jacobian satisfies\n\n**λᵢ(J*σ(y)) ≥ −1/σ²**\n\nThe score Jacobian itself, however, need not be positive semidefinite. This distinction becomes important when studying the signed Hessian of a contrast between two distributions.\n\nConsider a simple case in which the clean data follows a multivariate Gaussian distribution:\n\n**X ∼ N(μ,Σ)**\n\nAfter adding independent isotropic Gaussian noise,\n\n**Y ∼ N(μ,Σ + σ²I)**\n\nThe marginal score has a closed-form expression:\n\n**sσ(y) = −(Σ + σ²I)⁻¹(y − μ)**\n\nIts Jacobian is\n\n**Jσ(y) = −(Σ + σ²I)⁻¹**\n\nThe corresponding optimal denoiser is\n\n**D*σ(y) = μ + Σ(Σ + σ²I)⁻¹(y − μ)**\n\nThe posterior covariance is\n\n**Cov(X | Y = y) = σ²Σ(Σ + σ²I)⁻¹**\n\nThese expressions agree exactly with Tweedie’s identity and the posterior covariance identity derived above.\n\nSuppose Σ has the spectral decomposition\n\n**Σ = UΛUᵀ**\n\nThen the score Jacobian has the same eigenvectors, with eigenvalues\n\n**λᵢ(Jσ) = −1/(λᵢ(Σ) + σ²)**\n\nThe shifted score Jacobian,\n\n**Aσ = I + σ²Jσ,**\n\nhas eigenvalues\n\n**λᵢ(Aσ) = λᵢ(Σ)/(λᵢ(Σ) + σ²)**\n\nThis relationship gives the geometric interpretation. For directions where the data has substantial variation relative to the noise scale, the corresponding eigenvalues of Aσ approach one. For directions where the data has negligible variation, the eigenvalues approach zero. In an ideal locally affine model, if the data has exactly zero variance along normal directions, the corresponding shifted Jacobian eigenvalues are exactly zero. This suggests that the eigenspectrum of the shifted score Jacobian can reveal locally significant directions of data variation.\n\nHowever, for general nonlinear manifolds and imperfectly learned score functions, this interpretation is approximate rather than exact.\n\nThe score is the gradient of a scalar log-density:\n\n**s(y) = ∇ log p(y)**\n\nConsequently, its Jacobian is the Hessian of that scalar function.\n\nFor a twice continuously differentiable function, the Clairaut–Schwarz theorem establishes that mixed partial derivatives commute:\n\n**∂² log p(y)/∂yᵢ∂yⱼ = ∂² log p(y)/∂yⱼ∂yᵢ**\n\nTherefore,\n\n**Jᵢⱼ(y) = Jⱼᵢ(y)**\n\nand\n\n**J(y) = J(y)ᵀ**\n\nClairaut’s theorem and Schwarz’s theorem are commonly used names for this equality of mixed partial derivatives under appropriate regularity conditions. This property also explains why I formulate the learned score through a scalar energy function rather than an unconstrained vector-valued neural network.\n\nFor a sufficiently smooth scalar energy,\n\n**sθ(y) = −∇Eθ(y)**\n\nits Jacobian is necessarily symmetric:\n\n**Jθ(y) = −∇²Eθ(y)**\n\nAn unconstrained learned vector field does not automatically satisfy this integrability condition. By the spectral theorem, a real symmetric Jacobian admits an orthogonal eigendecomposition:\n\n**Jθ(y) = UΛUᵀ**\n\nAll eigenvalues are real, and the eigenvectors can be chosen to form an orthonormal basis. These properties provide the mathematical foundation for the spectral analysis and signed Hessian approximations used later. Nevertheless, estimating the score accurately does not automatically imply that its Jacobian is accurate. Second-order information requires independent numerical and statistical validation.\n\nInstead of studying the source and target distributions independently, I consider their relative behavior within the same input space.\n\nSuppose their Gaussian-smoothed densities are represented by energy-based models:\n\n**pθ,꜀(y) = exp[−Eθ(y,c,σ)] / Z꜀**\n\nTaking the log-ratio of the prior-weighted densities gives\n\n**log[πₜpθ,ₜ(y) / πₛpθ,ₛ(y)]**\n\n**= Eθ(y,s,σ) − Eθ(y,t,σ) + log(Zₛ/Zₜ) + log(πₜ/πₛ)**\n\nThis motivates the raw energy contrast:\n\n**gθ(y) = Eθ(y,s,σ) − Eθ(y,t,σ)**\n\nHowever, denoising score matching identifies energy gradients without determining class-dependent additive constants.\n\nTo see why, consider two energy functions related by\n\n**Ẽθ(y,c,σ) = Eθ(y,c,σ) + C꜀**\n\nTheir gradients are identical because C꜀ is constant with respect to y. Their raw energy contrasts, however, can differ by Cₛ − Cₜ.\n\nConsequently, the zero-level set of the raw energy contrast does not necessarily represent a meaningful class ambiguity surface.\n\nTo address this, I introduce a calibrated contrast:\n\n**ℓθ(y) = gθ(y) + b̂**\n\nThe intercept b̂ is estimated using a separate labeled calibration dataset through regularized, prior-weighted logistic regression.\n\nLet rᵢ = +1 denote a target-class observation and rᵢ = −1 denote a source-class observation.\n\nThe calibration objective is\n\n**b̂ = argmin_b [(1/Ncal) Σᵢ wᵢ log(1 + exp(−rᵢ(gθ(yᵢ) + b))) + λᵦb²/2]**\n\nThe sample weights account for the specified class priors, while the regularization parameter is selected using development data. If the estimated energies recover the true log-density ratio up to an additive constant, an appropriate intercept can recover the corresponding discriminant offset. Otherwise, calibration provides an empirical correction without necessarily resolving errors in the spatial variation of the energies.\n\nThe first and second derivatives of the calibrated contrast are\n\n**hθ(y) = ∇ℓθ(y) = sθ,ₜ(y) − sθ,ₛ(y)**\n\n**Kθ(y) = ∇²ℓθ(y) = Jθ,ₜ(y) − Jθ,ₛ(y)**\n\nSince the calibration intercept is constant with respect to y, it changes the location of the zero-level set without changing either derivative.\n\nFor ideal Gaussian-smoothed class distributions, Tweedie’s identity gives\n\n**s*ₜ(y) = (μₜ(y) − y)/σ²**\n\n**s*ₛ(y) = (μₛ(y) − y)/σ²**\n\nwhere μ꜀(y) is the class-conditional posterior mean.\n\nSubtracting these identities yields\n\n*h(y) = (μₜ(y) − μₛ(y))/σ²**\n\nThe gradient of the ideal class contrast is therefore determined by the difference between the two class-conditional posterior means.\n\nSimilarly, from the posterior covariance identity,\n\n**J*ₜ(y) = Cₜ(y)/σ⁴ − I/σ²**\n\n**J*ₛ(y) = Cₛ(y)/σ⁴ − I/σ²**\n\nSubtracting gives\n\n*K(y) = (Cₜ(y) − Cₛ(y))/σ⁴**\n\nThe isotropic correction terms cancel because the two classes use the same Gaussian smoothing scale.\n\nThis provides a direct mathematical interpretation of both derivatives:\n\nAlthough each covariance matrix is positive semidefinite, their difference is not necessarily positive semidefinite. This explains why the signed eigenvalue structure of the class-contrast Hessian is relevant. These identities hold for the ideal smoothed densities. The learned quantities approximate them, and the accuracy of those approximations must be evaluated.\n\nI define the generative class ambiguity surface as\n\n**Bɢ = {y ∈ ℝᴰ : ℓθ(y) = 0}**\n\nThis is the central geometric object in the proposed approach. The question is not whether Bɢ is the classifier’s decision boundary. It is whether the local structure of Bɢ provides useful information about where the classifier’s boundary might be located.\n\nThe calibrated contrast is a scalar function defined over the ambient input space.\n\nSuppose that z lies on Bɢ and that\n\n**ℓθ(z) = 0, ∇ℓθ(z) ≠ 0**\n\nIf ℓθ is twice continuously differentiable near z, the Implicit Function Theorem establishes that Bɢ is locally a smooth (D − 1)-dimensional embedded hypersurface. The reason is that at least one partial derivative of ℓθ must be nonzero.\n\nLocally, the corresponding coordinate can therefore be expressed as a differentiable function of the remaining D − 1 coordinates. Consider a differentiable curve γ(t) lying entirely on the ambiguity surface, with γ(0) = z.\n\n**ℓθ(γ(t)) = 0,**\n\ndifferentiating through the chain rule gives\n\n**hθ(z)ᵀγ̇(0) = 0**\n\nIts tangent space is therefore\n\n**T_zBɢ = {v ∈ ℝᴰ : hθ(z)ᵀv = 0}**\n\nThe unit normal is\n\n**nɢ(z) = hθ(z)/‖hθ(z)‖**\n\nThe orthogonal tangent-space projector is therefore\n\n**Pɢ(z) = Iᴰ − nɢ(z)nɢ(z)ᵀ**\n\nThe gradient describes the local normal direction of the generative ambiguity surface. At points where the gradient vanishes, the regularity condition fails, and this normal representation is undefined.\n\nTo understand how the normal changes along the surface, we differentiate it in tangent directions.\n\nStarting from\n\n**nɢ(z) = hθ(z)/‖hθ(z)‖,**\n\nthe directional derivative of the normalized gradient is\n\n**Dᵥnɢ(z) = Pɢ(z)Kθ(z)v/‖hθ(z)‖**\n\nUnder the convention IIɢ(v,w) = ⟨Dᵥnɢ,w⟩, the matrix representation of the second fundamental form restricted to the tangent space is\n\n**IIɢ ↔ Pɢ(z)Kθ(z)Pɢ(z) / ‖hθ(z)‖**\n\nFor a unit tangent direction v, the corresponding signed normal curvature under this convention is\n\n**κₙ(v) = vᵀKθ(z)v/‖hθ(z)‖**\n\nThis connects the signed Hessian of the class contrast to the local curvature of its zero-level surface. The tangent-space projection and gradient normalization are essential: the full Hessian alone is not the curvature tensor of the hypersurface. Another important observation is that Kθ is a difference between two score Jacobians. Although it is symmetric under the assumed differentiability conditions, it need not be positive semidefinite. Its positive and negative eigenvalues therefore describe different forms of directional second-order variation. These properties motivate examining whether second-order information provides a better local description than the gradient alone.\n\nIt is also important to distinguish the three geometric objects involved in this research:\n\nThe curvature of one object cannot automatically be identified with the curvature of another.\n\nNear an input x, Taylor’s theorem gives\n\n**ℓθ(x + δ) = ℓθ(x) + hθ(x)ᵀδ + ½δᵀKθ(x)δ + R₃(x,δ)**\n\nWhen the Hessian is locally Lipschitz continuous,\n\n**R₃(x,δ) = O(‖δ‖³)**\n\nMore precisely, suppose that\n\n**‖Kθ(x + δ) − Kθ(x)‖ₒₚ ≤ Lₖ‖δ‖**\n\nthroughout the relevant neighborhood.\n\nThen the Taylor remainder satisfies\n\n**|R₃(x,δ)| ≤ (Lₖ/6)‖δ‖³**\n\nA first-order approximation retains only the scalar value and gradient. A second-order approximation additionally retains the quadratic term involving the Hessian.\n\nAlong a unit direction v, let δ = τv. The first-order approximation becomes\n\n**ℓθ(x + τv) ≈ ℓθ(x) + τhθ(x)ᵀv**\n\nThe second-order approximation becomes\n\n**ℓθ(x + τv) ≈ ℓθ(x) + τhθ(x)ᵀv + ½τ²vᵀKθ(x)v**\n\nThe difference between these approximations is determined by the directional second derivative:\n\n**vᵀKθ(x)v**\n\nIf the contrast varies approximately linearly in a neighborhood, first-order information may be sufficient. If its variation is substantially nonlinear, the second-order term may improve the predicted location of its zero-level crossing.\n\nThis leads to my first research hypothesis:\n\n**Does including the signed Hessian improve the prediction of an independently trained classifier’s boundary when first-order and second-order methods are evaluated along identical directions?**\n\nMatching the directions is essential. Otherwise, an observed improvement could result from better direction selection rather than the second-order approximation itself. The generative prediction must ultimately be evaluated against the independently trained classifier. Mathematical accuracy with respect to the generative surface alone is insufficient.\n\nBefore moving to high-dimensional images, I investigated this question using the two-moons dataset.\n\nThe dataset provides two nonlinear class distributions within a two-dimensional space, allowing the generative ambiguity surface and classifier decision boundaries to be examined directly. For these initial experiments, the class densities were represented using Gaussian mixtures rather than neural energy-based models. The purpose was to establish whether the geometric hypothesis was plausible in a controlled environment before introducing the additional uncertainty associated with learning high-dimensional energy functions.\n\nA single multivariate Gaussian distribution is generally insufficient for representing a nonlinear distribution such as two moons.\n\nA Gaussian mixture model represents a density as a weighted combination of multiple Gaussian components:\n\n**p(x) = Σₖ αₖ N(x;μₖ,Σₖ)**\n\n**αₖ ≥ 0, Σₖαₖ = 1**\n\nEach component has its own mean and covariance matrix.\n\nFor a Gaussian component with positive-definite covariance Σₖ, its density is\n\n**N(x;μₖ,Σₖ) = [(2π)ᴰᐟ² det(Σₖ)¹ᐟ²]⁻¹ exp[−½(x − μₖ)ᵀΣₖ⁻¹(x − μₖ)]**\n\nThe quadratic term is the squared Mahalanobis distance from the component mean. Unlike an ordinary Euclidean distance, it accounts for the covariance structure of the distribution.\n\nDefine the component responsibility\n\n**rₖ(x) = αₖN(x;μₖ,Σₖ)/p(x)**\n\nThe score of an individual Gaussian component is\n\n**gₖ(x) = −Σₖ⁻¹(x − μₖ)**\n\nThe mixture score is then the responsibility-weighted average of the component scores:\n\n**s(x) = Σₖ rₖ(x)gₖ(x)**\n\nDifferentiating again yields the mixture score Jacobian:\n\n**J(x) = −Σₖ rₖ(x)Σₖ⁻¹ + Covᵣ(gₖ(x))**\n\nHere,\n\n**Covᵣ(gₖ(x)) = Σₖ rₖ(x)(gₖ(x) − s(x))(gₖ(x) − s(x))ᵀ**\n\nThe first term captures the responsibility-weighted curvature within individual components. The second term captures variation between their score vectors. Consequently, the log-density of a Gaussian mixture can exhibit more complicated local curvature than that of a single Gaussian distribution. Gaussian mixtures also remain Gaussian mixtures under isotropic Gaussian convolution: each covariance Σₖ becomes Σₖ + σ²I, while the component weights and means remain unchanged. These analytical properties make Gaussian mixtures useful for controlled studies of the score, Hessian, and class-density contrast without introducing neural derivative estimation errors.\n\nThe independently trained classifiers included:\n\nThe larger experiment used 120 shared, correctly classified source points.\n\nOne observation from this visualization is that the generative ambiguity surface and the classifier’s boundary are geometrically related in some regions but differ in others. This is precisely why their correspondence must be evaluated empirically.\n\nThe exact second-order approximation produced closer verified target-side crossings than the first-order approximation in the following number of paired cases:\n\nThe results suggest that second-order information can improve localization in these controlled synthetic settings.\n\nI also measured the median radial prediction error along matched directions.\n\nThe reduction in radial prediction error provides preliminary evidence that the second-order structure of a generative contrast can contain information relevant to an independent classifier’s boundary.\n\nHowever, better boundary localization does not necessarily imply greater query efficiency.\n\nThis was one of the more interesting observations from the experiment.\n\nAlthough the second-order method produced slightly lower mean query counts, the confidence intervals for these differences included zero.\n\nAt a perturbation budget of ε = 0.4, the targeted success rates were:\n\nThese are exploratory findings rather than confirmatory results. At this stage, the evidence is considerably stronger for improved boundary localization than for reduced classifier queries. This distinction suggests that geometric prediction accuracy and practical search efficiency should be treated as separate research objectives.\n\nEven if second-order information improves localization, computing it introduces another challenge.\n\nFor an input in ℝᴰ, the Hessian is a D × D matrix.\n\nFor MNIST, D = 784. For CIFAR-10, D = 3072. Explicitly computing and decomposing a dense Hessian for every image becomes increasingly expensive as the input dimension grows. Instead of independently computing second-order information at every point, I am investigating whether locally reliable Hessian approximations can be reused.\n\nThe idea is to construct an atlas of representative anchor points.\n\nSince the contrast Hessian is symmetric, the spectral theorem allows it to be written as\n\n**Kθ(a) = UΛUᵀ**\n\nwhere U is an orthogonal matrix and Λ contains the signed eigenvalues.\n\n**Kθ(a) = Σᵢ λᵢuᵢuᵢᵀ**\n\nEach eigenpair describes second-order variation along its corresponding eigendirection.\n\nFor an arbitrary unit vector v,\n\n**vᵀKθ(a)v = Σᵢ λᵢ(uᵢᵀv)²**\n\nThis expression explains how the signed eigenvalues contribute to directional second-order variation.\n\nA low-rank approximation retains a subset of these eigenpairs:\n\n**K̂ᵣ(a) = Uᵣ(a)Λᵣ(a)Uᵣ(a)ᵀ**\n\nwhere Uᵣ contains orthonormal eigenvectors and Λᵣ contains their signed eigenvalues.\n\nFor an exact spectral truncation of a symmetric matrix, the operator-norm error equals the largest absolute omitted eigenvalue. Hessian-vector products and Lanczos-based spectral approximation provide a way to investigate these eigenspaces without explicitly constructing the entire dense Hessian. For a nearby point x, the reliability of the approximation depends on both the truncation error at the anchor and the variation of the Hessian between a and x.\n\nThe Hessian-vector product can be expressed as the derivative of a directional gradient:\n\n**Kθ(a)v = ∇ₐ[hθ(a)ᵀv]**\n\nfor a fixed vector v.\n\nAutomatic differentiation allows this quantity to be evaluated without explicitly storing the full Hessian matrix. The Lanczos method exploits repeated matrix-vector products to construct an orthonormal basis for a Krylov subspace:\n\n**𝒦ₘ(K,v) = span{v,Kv,K²v,…,Kᵐ⁻¹v}**\n\nProjecting a symmetric operator onto this subspace produces a smaller symmetric tridiagonal matrix whose eigendecomposition can be used to approximate selected eigenpairs of the original operator. In the proposed approach, both positive and negative spectral components are considered, since the contrast Hessian is not generally positive semidefinite. Numerical eigenpair residuals and spectral separation must be checked before using these approximations.\n\nSuppose the Hessian at a neighboring point can be written as\n\n**Kθ(x) = Kθ(a) + E**\n\nwhere E represents the local matrix perturbation.\n\nFor ordered eigenvalues of symmetric matrices, Weyl’s inequality gives\n\n**|λᵢ(Kθ(x)) − λᵢ(Kθ(a))| ≤ ‖E‖ₒₚ**\n\nThis controls the variation of eigenvalues.\n\nEigenvalue stability, however, does not necessarily imply eigenvector stability. For example, eigenvectors associated with nearly repeated eigenvalues may rotate considerably under relatively small perturbations. Suppose the relevant eigenspaces are separated by an eigengap γₐ > 0. Under appropriate spectral separation conditions, the Davis–Kahan theorem provides a bound of the form\n\n**‖Pᵣ(x) − Pᵣ(a)‖ₒₚ ≤ 2‖Kθ(x) − Kθ(a)‖ₒₚ/γₐ**\n\n**Pᵣ(a) = Uᵣ(a)Uᵣ(a)ᵀ**\n\nThis relates the rotation of the retained eigenspace to the perturbation of the underlying Hessian. A sufficiently large eigengap and small Hessian variation can support local spectral stability. However, spectral stability does not establish that an eigenspace represents meaningful data geometry. It only controls the variation of the estimated eigenspace.\n\nTo evaluate whether an anchor’s Hessian remains useful in its neighborhood, I consider four complementary diagnostics:\n\n**Gradient transport error:** How accurately does the anchor Hessian predict the variation of the class-contrast gradient?\n\nLet\n\n**Δ = x − a**\n\nBy the fundamental theorem of calculus applied along the line segment connecting a and x,\n\n**hθ(x) − hθ(a) = ∫₀¹ Kθ(a + tΔ)Δ dt**\n\nApproximating the Hessian along this segment by its cached anchor value gives\n\n**h̃ₐ(x) = hθ(a) + K̂ᵣ(a)Δ**\n\nA normalized transport error can then be defined as\n\n**eₕ = ‖hθ(x) − h̃ₐ(x)‖ / (‖hθ(x)‖ + ‖h̃ₐ(x)‖ + η₀)**\n\n**Scalar prediction error**\n\nUsing the anchor’s local quadratic approximation,\n\n**ℓ̃ₐ(x) = ℓθ(a) + hθ(a)ᵀΔ + ½ΔᵀK̂ᵣ(a)Δ**\n\nthe corresponding normalized scalar prediction error is\n\n**eₗ = |ℓθ(x) − ℓ̃ₐ(x)| / (|ℓθ(x)| + |ℓ̃ₐ(x)| + η₀)**\n\n**Signed Hessian fidelity**\n\nThe operator-level discrepancy is measured using\n\n**eₖ = ‖Kθ(x) − K̂ᵣ(a)‖ₒₚ / (‖Kθ(x)‖ₒₚ + ‖K̂ᵣ(a)‖ₒₚ + η₀)**\n\nThis assesses whether the cached matrix adequately represents the local second-order structure.\n\n**Projector agreement**\n\nThe retained eigenspaces are compared through their orthogonal projectors:\n\n**eₚ = ‖Pᵣ(x) − Pᵣ(a)‖ₒₚ**\n\nThese diagnostics examine different aspects of local reliability. An anchor could have a stable dominant eigenspace while failing to predict the local gradient accurately. Conversely, accurate gradient transport in one direction does not establish uniform operator-level agreement.\n\nThe proposed audit therefore evaluates all four quantities.\n\nEvaluating every member of every anchor neighborhood can itself become computationally expensive.\n\nInstead, consider a frozen neighborhood containing Mₐ members. Draw mₐ members uniformly without replacement. A member is marked as unreliable if any of its four diagnostic errors exceeds the corresponding predetermined tolerance.\n\nLet π̂ₐ denote the observed fraction of unreliable members. Because the sampling is performed without replacement from a finite population, a Serfling-style concentration bound can be used.\n\nFor mₐ < Mₐ, define\n\n**ξₐ = √{[1 − (mₐ − 1)/Mₐ] log(1/δₐ)/(2mₐ)}**\n\nFor a complete census, ξₐ is set to zero.\n\nWith the corresponding confidence guarantee, the true unreliable fraction of the frozen neighborhood is bounded above by\n\n**πₐ ≤ π̂ₐ + ξₐ**\n\nAn anchor is accepted only if\n\n**π̂ₐ + ξₐ ≤ β**\n\nand its numerical spectral checks pass.\n\nHere, β is the maximum tolerated fraction of unreliable neighborhood members. When multiple anchors and candidate configurations are examined, the allocated error probabilities must be controlled collectively. Such an audit does not provide a uniform guarantee for arbitrary future images. Its predictive usefulness must be established on separate held-out data.\n\nFor a nearby source point x, consider the anchor-based quadratic model\n\n**qₓ₍ₐ₎(δ) = ℓθ(x) + hθ(x)ᵀδ + ½δᵀK̂ᵣ(a)δ**\n\nThe scalar contrast and gradient are evaluated at x itself. Only the Hessian is reused.\n\nSuppose the anchor approximation satisfies\n\n**‖Kθ(a) − K̂ᵣ(a)‖ₒₚ ≤ εₜᵣ**\n\nand the Hessian is locally Lipschitz with constant Lₖ.\n\nFor points satisfying ‖x − a‖ ≤ ρₐ, the triangle inequality gives\n\n**‖Kθ(x) − K̂ᵣ(a)‖ₒₚ ≤ Lₖρₐ + εₜᵣ**\n\nCombining this inequality with the Taylor remainder bound yields\n\n**|ℓθ(x + δ) − qₓ₍ₐ₎(δ)|**\n\n**≤ ½(εₜᵣ + Lₖρₐ)‖δ‖² + (Lₖ/6)‖δ‖³**\n\nThis bound separates three sources of approximation error:\n\nIt also explains why the anchor radius and the prediction radius serve different mathematical purposes. The first controls derivative reuse, while the second controls the validity of the local approximation.\n\nIn the synthetic experiment, I examined configurations containing 12, 24, 48, and 96 representative anchors.\n\nUsing 24 anchor Hessians instead of 120 independently evaluated Hessians reduced the number of Hessian evaluation locations by 80%.\n\nThe resulting verified crossing distances remained within 0.02 of the exact second-order results in 94.2%, 93.3%, and 95.8% of paired cases across the three classifiers. Although these observations are encouraging, they do not establish an 80% reduction in computational runtime. The experiment involved inexpensive two-dimensional Gaussian mixture derivatives. Neural energy models in high-dimensional input spaces may exhibit substantially different computational and numerical behavior.\n\nFurthermore, the 24-anchor configuration was fixed during this experiment. A prospective evaluation must independently select the anchor count using reliability, coverage, and total amortized cost.\n\nA central limitation of this research is that generative accuracy does not necessarily imply discriminative accuracy.\n\nTo illustrate the distinction, suppose that the hidden classifier margin can locally be represented as\n\n**mꜰ(x) = αℓθ(x) + rꜰ(x)**\n\nwhere α > 0 and rꜰ describes the discrepancy between the classifier’s discriminative margin and the learned generative contrast. If rꜰ is small within a relevant neighborhood, a zero of ℓθ may lie close to a zero of mꜰ.\n\nFor a fixed direction v, suppose that the discriminative margin has a root at τꜰ and its directional derivative is bounded away from zero throughout the relevant segment:\n\n**|d mꜰ(x + τv)/dτ| ≥ μ > 0**\n\nLet τɢ denote a root of the generative contrast along the same direction.\n\nBy the Mean Value Theorem, there exists an intermediate point ξ such that\n\n**mꜰ(x + τɢv) − mꜰ(x + τꜰv) = m′ꜰ(ξ)(τɢ − τꜰ)**\n\nSince the discriminative margin vanishes at τꜰ and the generative contrast vanishes at τɢ,\n\n**mꜰ(x + τɢv) = rꜰ(x + τɢv)**\n\nIt follows that\n\n**|τɢ − τꜰ| ≤ |rꜰ(x + τɢv)|/μ**\n\nThis requires the relevant roots and regularity conditions to hold on the same segment.\n\nThe relationship is useful conceptually because it identifies two distinct factors:\n\nIt also explains why an accurate generative approximation may fail to predict a classifier boundary. Even if the Taylor approximation error is negligible, the discrepancy rꜰ may remain large. Similarly, a nearly vanishing directional derivative can make root localization unstable. The difficulty is that these quantities are generally unavailable in a strict hard-label setting. Determining when their effects are sufficiently controlled is therefore an empirical research problem.\n\nThe next stage separates the investigation into three hypotheses.\n\n**H1 — Predictive value of curvature.** Does incorporating second-order information improve boundary localization relative to a matched first-order approximation?\n\n**H2 — Reliability and computational amortization.** Can audited anchor-based Hessian approximations preserve prediction quality while reducing total computational cost?\n\n**H3 — Practical query efficiency.** Does improved boundary localization translate into fewer classifier queries without substantially reducing targeted success?\n\nThese hypotheses are related, but none automatically follows from the others. A method could improve boundary localization without reducing queries. Similarly, an anchor atlas might preserve localization accuracy while introducing enough construction and audit overhead to eliminate its computational advantage. The planned experiments will progress from synthetic distributions to MNIST and subsequently to natural-image datasets such as CIFAR-10, provided the earlier results support that progression. The evaluation will distinguish between generative calibration accuracy, derivative fidelity, boundary prediction error, targeted success, query consumption, and computational cost.\n\nThe prospective evaluation criteria include paired statistical comparisons, confidence intervals, non-inferiority testing for targeted success, and Holm-adjusted hypothesis tests to control the familywise type I error rate. All final evaluations will use independently trained classifiers and held-out data, with any external model testing restricted to explicitly authorized settings.\n\nSeveral limitations remain unresolved.\n\n**First**, the assumption that natural images concentrate near smooth, locally regular manifolds may only provide an approximate description of real data.**Second**, second-order derivatives obtained from learned energy models may be unreliable even when the score matching objective performs well.**Third**, Euclidean proximity between images does not necessarily imply semantic or geometric similarity. Representation-based neighborhoods may offer a useful alternative, but their reliability also requires empirical validation.**Fourth**, the generative ambiguity surface may systematically differ from the discriminative decision boundary because of architecture, training objectives, preprocessing, and finite-sample effects.**Fifth**, small pixel-space perturbations do not establish that image semantics have been preserved.\n\nThese limitations suggest several broader questions:\n\nAnswering these questions may be as valuable as improving the efficiency of a particular adversarial search method.\n\nThis investigation began with a relatively simple question: can information learned about the distribution of data tell us something about the decision boundary of an independently trained classifier?\n\nThe mathematical formulation suggests that a calibrated contrast between class-conditional energy functions provides a useful object for studying this relationship. Tweedie’s identity connects the score to the optimal denoiser, while differentiation of the posterior mean connects the score Jacobian to posterior covariance. Taking the difference between two class-conditional scores therefore provides information about the difference between their posterior means. Taking the difference between their Jacobians provides information about the difference between their posterior covariance structures. Its gradient describes the local normal direction of the generative ambiguity surface, while its signed Hessian provides information about second-order variation and, through tangent-space projection, the surface’s curvature. The preliminary synthetic experiments indicate that this second-order information can improve boundary localization across multiple independently trained classifiers.\n\nHowever, meaningful reductions in classifier queries have not yet been established, and the computational feasibility of reliable Hessian reuse in high-dimensional image spaces remains an open question. For me, the most interesting outcome is not necessarily a more efficient adversarial method. It is a better understanding of how the geometry learned by a generative model relates to the decision geometry learned by a discriminative model. Even if that relationship holds only within particular data regimes, identifying those conditions would provide useful insight into the behavior and robustness of learned classifiers.\n\n[Can the Shape of Data Predict Where a Classifier’s Decision Boundary Is?](https://pub.towardsai.net/can-the-shape-of-data-predict-where-a-classifiers-decision-boundary-is-06e0afc92c74) was originally published in [Towards AI](https://pub.towardsai.net) on Medium, where people are continuing the conversation by highlighting and responding to this story.", "url": "https://wpnews.pro/news/can-the-shape-of-data-predict-where-a-classifiers-decision-boundary-is", "canonical_source": "https://pub.towardsai.net/can-the-shape-of-data-predict-where-a-classifiers-decision-boundary-is-06e0afc92c74?source=rss----98111c9905da---4", "published_at": "2026-12-02 03:23:16+00:00", "updated_at": "2026-12-02 03:43:00.088778+00:00", "lang": "en", "topics": ["machine-learning", "ai-research", "ai-safety"], "entities": [], "also_reported_by": [], "takeaway": "A second-order energy-contrast predictor beat the first-order version at locating the true decision-boundary crossing in 89, 89 and 97 of 120 test points across three victim classifiers, yet cut victim queries by an amount statistically indistinguishable from zero.", "recommendation": {"advice": "Treat boundary-prediction gains as unproven until query savings clear zero: the second-order predictor won on 89-97 of 120 points but saved no measurable victim queries.", "playbook": "evals-testing", "playbook_url": "https://wpnews.pro/playbooks/evals-testing"}, "alternates": {"html": "https://wpnews.pro/news/can-the-shape-of-data-predict-where-a-classifiers-decision-boundary-is", "markdown": "https://wpnews.pro/news/can-the-shape-of-data-predict-where-a-classifiers-decision-boundary-is.md", "text": "https://wpnews.pro/news/can-the-shape-of-data-predict-where-a-classifiers-decision-boundary-is.txt", "jsonld": "https://wpnews.pro/news/can-the-shape-of-data-predict-where-a-classifiers-decision-boundary-is.jsonld"}}