Querying Kernel Methods Suffices for Reconstructing their Training Data

Daniel Barzilai, Yuval Margalit, Eitan Gronich, Gilad Yehudai, Meirav Galun, Ronen Basri

TL;DR

Can an attacker extract private training data from a machine learning model using black-box API queries alone? This paper proves both theoretically and empirically that for popular kernel methods—including Kernel Ridge Regression, SVMs, and Kernel Density Estimation—evaluating model outputs on random, unlabeled query points is sufficient to reconstruct the exact training points without ever inspecting model parameters or weights.

What Problem Does This Paper Address?

Over-parameterized models often memorize substantial portions of their training data. While prior work demonstrated data reconstruction attacks against neural networks, those methods typically assume "white-box" access to model parameters (e.g., analyzing weights at KKT stationary points) or require explicit, finite-dimensional feature representations.

In practice, models are frequently served behind black-box query APIs, and kernel methods often operate in implicit, infinite-dimensional Hilbert spaces where inspectable parameter weights are intractable. This paper asks: Can an adversary reconstruct sensitive training examples using query-only access to a kernel model?

Methods

By the Representer Theorem and gradient descent dynamics, a wide class of kernel models with $C$ outputs can be expressed as: $$f_c(x) = \sum_{i=1}^N \alpha_{i,c} k(x, x_i)$$

The proposed attack operates without knowledge of the true training samples $\{x_i\}_{i=1}^N$ or weights $\{\alpha_{i,c}\}$:

  1. Surrogate Optimization: The attacker initializes $n \ge N$ dummy data points $\{\hat{x}_i\}_{i=1}^n$ and coefficients $\{\hat{\alpha}_{i,c}\}$.
  2. Black-Box Queries: The attacker samples $m$ unlabeled query points $z_1, \dots, z_m \sim \mathcal{D}$ and queries the model $f(z_j)$.
  3. Reconstruction Loss: The candidate points and weights are optimized via gradient descent (Adam with OneCycle learning rate scheduling) to match the black-box outputs: $$\mathcal{L}_{\text{rec}} = \frac{1}{mC} \sum_{j=1}^m \sum_{c=1}^C \left( \sum_{i=1}^n \hat{\alpha}_{i,c} k(z_j, \hat{x}_i) - f_c(z_j) \right)^2$$
  4. Dimensionality Reduction & Hyperparameter Tuning: To scale to high-dimensional images, the attack parameterizes $\hat{x}_i$ using PCA projections or a pretrained VAE decoder (TAESD3). When kernel hyperparameters (e.g., bandwidth $\gamma$ or exponent $\beta$ in Matérn kernels) are unknown, they are optimized jointly alongside the inputs.
  5. Theoretical Guarantee: Using the Submersion Level Set Theorem, the authors prove that for any strictly positive definite, almost-analytic kernel, sampling $m > n(d+2)$ queries ensures that any global minimizer of $\mathcal{L}_{\text{rec}}$ uniquely recovers the true training points $\{x_i\}$ with probability 1.

Datasets

The authors evaluate their method on:

  • CIFAR-10 & CIFAR-100: Evaluated with $N=500$ training images.
  • CelebA: High-resolution face dataset evaluated at $64 \times 64$ resolution and $128 \times 128$ (using VAE decoding).
  • CIFAR-5M: A public synthetic dataset used to source up to 500,000 disjoint, unlabeled query points ($z_j$) for CIFAR-10 experiments.

No new datasets were introduced.

Key Insights and Ideas

  • Black-Box Hiding Offers No Protection: Merely withholding model weights does not safeguard privacy; output predictions over sufficient query points fully constrain the input training data.
  • Queries Need Not Match the Training Distribution: Query points $z_j$ do not require ground-truth labels or identical distribution matching; synthetic images or generic out-of-distribution samples suffice.
  • Robustness to Unknown Sample Size: The attacker does not need to know $N$. Setting candidate pool $n > N$ causes redundant candidates to either merge into genuine training points or have their coefficients $\hat{\alpha}_i$ drop to zero.
  • Kernel Discovery on the Fly: Attackers do not even need precise kernel parameters; gradient descent successfully recovers unknown bandwidth and power parameters simultaneously with the data.

Key Results

  • Outperforming White-Box Baselines: On CIFAR-10 ($N=500$), the black-box RBF attack recovered 67.8% of training images (62.2% with high quality, $\text{DSSIM} < 0.3$), substantially outperforming prior white-box parameter-based attacks on RBF approximations (which achieved 46.2% total and 42.8% high quality).
  • Laplace Kernel Vulnerability: Attacking Laplace kernel regression on CIFAR-10 recovered 81.2% of the dataset (77% with $\text{DSSIM} < 0.3$). Over-parameterizing candidates to $n=700$ pushed recovery to 96.6%.
  • High-Resolution Faces (CelebA): On CelebA ($64 \times 64$), Laplace KRR leaked 81.2% of faces. Integrating a VAE decoder allowed reconstructing $128 \times 128$ images, recovering 79.6% of training identities (78.6% with $\text{DSSIM} < 0.3$).
  • Blind Hyperparameter Recovery: On CIFAR-10 with unknown Matérn parameters initialized far from the truth ($\hat{\beta}=0.15, \hat{\gamma}=0.01$), the attack converged to ground truth ($\beta \approx 1.0$ or $2.0$) while recovering up to 88.4% of the dataset.

Limitations and Future Work

  • Non-Convex Optimization Landscape: While global optimality guarantees exact data reconstruction, the loss landscape is non-convex, leaving open the theoretical characterization of local minima and convergence guarantees.
  • Query Complexity Budget: Achieving high-fidelity image recovery required hundreds of thousands of queries (e.g., $m = 160\text{k} - 500\text{k}$), which might trigger rate limits or API query-budget defenses.
  • Scaling to Large Models: Experiments were restricted to single-GPU setups and small training sets ($N = 500$). Extending the attack to web-scale training sets and foundation models remains open for future exploration.

Summary updated

BibTeX
@article{barzilai2026querying,
  author = {Daniel Barzilai and Yuval Margalit and Eitan Gronich and Gilad Yehudai and Meirav Galun and Ronen Basri},
  title = {{Querying Kernel Methods Suffices for Reconstructing their Training Data}},
  journal = {Accepted by TMLR},
  year = {2026},
  url = {https://openreview.net/forum?id=qikuoG0Th2},
}
Figure