我们提出了一种方法,旨在可靠地判断是否存在统计上显著的证据,证明两组数据观测值来自完全不同的底层分布。
快速链接
机器遗忘使 AI 系统能够“忘记”其训练数据中的特定部分,而无需承担从头重新训练模型的巨大成本。这对于法规合规性(如 GDPR 的“被遗忘权”)、AI 安全以及模型质量至关重要。
随着模型处理的数据集日益庞大且高度敏感,验证机器遗忘已从理论理想转变为一项严格要求,开发者现在必须从数学上证明隐私性。然而,由于审计人员通常无法访问模型的内部运作机制或原始训练数据,他们必须严格通过查询系统并分析输出样本来进行验证。
数据科学家和研究人员依赖的一种验证方法是双样本检验,这是一种统计方法,用于判断两组数据观测值是否来自完全不同的底层分布。例如,为了验证遗忘效果,审计人员可能会比较一个从未见过特定记录的模型的输出,与一个据称已“忘记”该记录的模型的输出。如果输出结果在设定的阈值内存在统计差异,则说明遗忘失败。
随着模型规模和复杂性的增长,用于机器遗忘审计的双样本检验及其他统计工具变得难以实施,并且统计功效会降低。为了从大规模模型固有的随机噪声中识别出真正的违规行为,并达到足够的统计显著性,审计人员需要提取大量样本。这使得实际测试在计算上变得极其昂贵。
为应对这一日益严峻的挑战,我们提出了正则化 f-散度核检验(Regularized f-Divergence Kernel Tests),该成果发表于 AISTATS 2026。这是一个全新的框架,旨在让机器学习模型的审计工作更加灵敏、灵活且精准。我们从理论上证明,该检验方法能在任意样本量下自然控制假阳性,并且随着可用数据样本数量的增加,假阴性的风险会可靠地收敛至零。
挑战:为何标准工具力不从心
评估模型安全性通常需要衡量两个复杂数据集之间的距离或散度。不同的应用场景自然需要不同的“距离”概念。虽然最大均值差异(MMD)等流行的标准工具在检测数据中广泛、全局性的偏移(例如模型系统性地生成比对照模型更亮的图像)方面表现出色,但它们往往缺乏捕捉复杂异常所需的特异性。例如,如果添加某个特定人物的数据,导致模型仅在以非常精确的方式提示时,才生成一个高度特异性的离群输出——而在所有其他样本上分布均等——那么传统的 MMD 检验可能会完全忽略这种局部偏移。
此外,大多数现有的检验框架迫使研究人员进行容易出错的手动选择,例如挑选最适合检测全局或局部偏移的特定统计量,或者调整核带宽和正则化参数等复杂设置。
在一个简单的二维分布双样本检验中(上图蓝色与红色),MMD 擅长检测均值差异等全局偏移(左图),但可能会遗漏局部差异,例如离群点(中图),或需要超参数调整(如设置带宽参数)的非平滑差异(右图)。
除了在实践中难以实现外,双样本检验作为一种验证方法,在验证机器学习模型的“遗忘”效果时也存在缺陷。请看下面的例子,它展示了两个在完全相同数据上从头训练的模型如何产生不同的分布。蓝色分布是模型在不含被清除数据的情况下重新训练后的分布。然而,由于重新训练时使用了不同的批次大小,其分布与标准分布(绿色)存在差异。这会导致误报,即判定被测试的模型不安全。
当被测试模型的分布与审计员所对比的标准分布不同时,使用双样本检验来验证“遗忘”效果会产生误报。
此外,近期研究表明,仅通过调整当前设置,AI 模型永远无法完美地“遗忘”数据;除非它重新追溯其原始训练的每一步,否则它总会留下本应删除信息的永久痕迹。因此,对于标准的、局部的“遗忘”算法而言,实现完美的“重新训练等价性”从根本上是不可能的,传统的双样本检验也总能发现对“遗忘集”的依赖。
该框架
我们通过提出一种相对距离检验来解决这一挑战,该检验衡量一个经过“遗忘”处理的模型在分布上更接近安全重新训练的模型,还是更接近原始的、被污染的模型。
我们的检验方法作为一个高度可适配的统计工具包,利用 f-散度使审计员能够精准定位高度特定类型的数据偏移,包括:
卡方散度和 KL 散度:这些方法在识别数据中平滑且局部的差异(例如物理模型中的异常值)时非常有效。
曲棍球棒散度:这种散度专门用于捕捉隐私和“遗忘”的定义,它通过一个参数来运作,该参数控制着统计不可区分性的程度。它能有效地建立一个可接受的阈值,忽略安全预算以下的微小差异,仅在发生有意义的隐私泄露时才触发警报。
在高维真实数据上计算这些散度是出了名的困难。为了使这些复杂的优化问题易于处理,同时无需消耗大量算力,我们采用核正则化方法来高效估计差异。
我们的自适应测试方法会自动选择最佳散度和最优超参数配置,以最大化测试的可靠性,完全消除了对样本分割的需求。
实验
由于我们提出的测试具有通用性,我们在多种不同问题上进行了实验。我们在扰动均匀分布(合成双样本基准测试)以及物理学数据集中的 Expo1D 异常值检测任务上评估了我们的框架——后者是一个专业领域,利用机器学习在粒子物理标准模型之外寻找新的物理现象。我们使用高能物理数据,是因为该领域需要世界上最精确的“差异检测器”——其理念是,如果该框架能够发现违反物理定律的稀有粒子,那么它也能发现 AI 模型中微小的隐私泄露。
随后,我们将主要关注点转向了审计差分隐私和评估机器遗忘这两个关键的实际应用:
- 隐私审计:差分隐私通过引入校准噪声来限制任何单个个体的影响,从而为保护用户数据提供了一个框架。我们测试了多种非隐私机制,对两个仅相差一条记录的模拟数据集的输出进行采样。如果某个机制真正做到了隐私保护,那么这两个样本的输出必须无法区分;如果该机制存在缺陷,测试则应标记出隐私违规行为。
- 模型遗忘评估:我们没有依赖将黄金标准模型(即完全从头重新训练、不包含被遗忘数据的模型)与遗忘模型进行简单比较这一有缺陷的方法,而是采用了一种三样本相对测试,并将其应用于多种已有的遗忘算法,包括选择性突触抑制、剪枝和随机标签技术。我们的测试评估了遗忘模型的分布是更接近安全的黄金标准模型,还是更接近原始、完全训练且主动记忆了敏感数据的模型。
提出的相对距离框架。如果被测试模型比重新训练的黄金标准模型更接近受损模型,则测试标记为遗忘失败。如果被测试模型更接近黄金标准模型,则测试不会标记任何失败。
结果
我们的框架成功恢复或超越了所有先前的基线方法,且所需的人工调参显著减少。
实验结果表明,没有任何单一测试能在所有可能场景下持续优于其他测试。相反,不同的 f-散度如同专门的传感器,针对不同类型的局部数据偏移“亮起”。通过采用跨多种统计量的聚合方法,我们的框架成功捕捉到了标准测试完全遗漏的细微错误和异常。
对于隐私审计,冰球杆散度测试被证明是一个强大且有效的工具。由于它直接与纯差分隐私的数学基础对齐,审计人员可以严格把控可接受的数据偏移程度。我们的自适应测试框架成功检测到了隐私违规行为,且所需的数据样本量显著更少,超参数调优的工作量也远少于先前的基线测试工具。
非隐私机制的检测率(来自标准审计基准)。我们的基于冰球杆的测试工具以更少的样本量,优于先前研究的技术(DP-Auditorium)。
在一个显著案例中,我们的框架仅使用几千个样本就检测到了特定稀疏向量技术机制(SVT3)中的违规行为,而此前研究的 DP-Auditorium 等技术则需要数百万个样本才能达到相近的违规检测率。
我们的研究结果还提示,需要重新定义如何评估机器遗忘。如下表所示,我们观察到,所评估的近似遗忘方法均不符合严格的标准双样本遗忘定义。由于双样本检验仅寻找任何分布差异,因此会错误地将完全安全的重训练模型标记为遗忘失败。
相比之下,我们提出的相对三样本检验成功克服了这一缺陷。它能正确且一致地将安全重训练的模型识别为“安全”。在评估近似遗忘算法时,只有随机标签技术通过了评估。
其他流行方法,如微调、剪枝和选择性突触抑制,被发现无法有效遗忘目标数据。我们强调,这些实验的主要目标是评估遗忘方法本身,而非设计算法。因此,我们采用了这些遗忘流程的简化实现;在实际生产环境中对遗忘方法进行排序,需要更严格的设置。
不同(简化)遗忘算法的审计结果。精确遗忘机制从头开始重训练,且不接触遗忘数据,因此从定义上来说是安全的。然而,双样本检验因其与“标准”模型的分布差异而错误地将其标记为不安全。三样本检验则克服了这一问题。
结论
我们新提出的框架为审视机器学习行为提供了更精确、更具适应性且数学上更严谨的视角。通过利用正则化 f-散度核检验,研究人员和审计人员现在可以在大量问题类别和复杂分布偏移中,从统计上证明模型是否存在不安全行为或数据泄露。
随着这一领域的发展,从理论上夯实我们的实证观察,以精确刻画对于其他新颖任务而言何种特定的散度是最优的,这仍然是未来工作中一个令人兴奋的方向。建立更紧的样本复杂度界限也将成为关键重点,以使这些审计更加高效。
致谢
本文所述工作是与 Antonin Schrab 和 Arthur Gretton 共同完成的。我们感谢 Nicole Mitchell 和 Eleni Triantafillou 提供的富有洞见的反馈,感谢 Kimberly Schwede 制作的图表以及 Mark Simborg 在编辑方面的有益帮助。
快速链接
其他相关文章
- 2026年7月15日 迈向揭秘扩散模型的创造力 * 算法与理论 · * 生成式 AI · * 机器智能
- 2026年7月7日 协作的力量:我们如何减少交通拥堵 * 算法与理论 · * 气候与可持续性 · * 数据挖掘与建模
- 2026年6月25日 利用线性弹性缓存优化云经济 * 算法与理论 · * 数据管理
We introduce a method designed to confidently determine whether there is statistically significant evidence that two sets of data observations come from entirely different underlying distributions.
Quick links
Machine unlearning allows AI systems to "forget" specific parts of their training data without the massive cost of retraining a model from scratch. This is essential for regulatory compliance (like GDPR’s "Right to be Forgotten"), AI safety, and model quality.
As models process increasingly massive and highly sensitive datasets, verifying machine unlearning has moved from theoretical ideal to a strict requirement, where developers must now mathematically prove privacy. However, because auditors often don’t have access to the model's internal workings or original training data, they must verify the system strictly by querying it and analyzing the output samples.
One method data scientists and researchers rely on for verification is two-sample testing, a statistical method that determines if two sets of data observations come from entirely different underlying distributions. For example, to verify unlearning, auditors might compare outputs from a model that never saw a specific record against a model that supposedly "forgot" it. If the outputs are statistically different within a defined threshold, the unlearning failed.
As models grow in size and complexity, two-sample testing and other statistical tools used for machine unlearning auditing become challenging to implement and they lose statistical power. To identify a real violation from random noise inherent in large-scale models, and with enough statistical significance, an auditor needs to extract a large number of samples. This makes real-world testing completely computationally very expensive..
To address this growing challenge, we introduce Regularized f-Divergence Kernel Tests, presented at AISTATS 2026, a new framework designed to make auditing ML models much more sensitive, flexible, and accurate. We theoretically prove that our tests naturally control for false positives for any sample size, and that the risk of false negatives reliably converges to zero as the number of available data samples increases.
The challenge: Why standard tools fall short
Evaluating model safety often requires measuring the distance, or divergence, between two complex data sets. Different applications naturally require different notions of “distance”. While popular standard tools like maximum mean discrepancy (MMD) excel at detecting broad, global shifts across data (such as a model systematically generating brighter images than its counterpart), they often lack the necessary specificity to capture complex anomalies. For instance, if the addition of a specific person's data causes a model to generate a highly specific outlier output only when prompted in a very exact way — while having an equal distribution on all other samples — traditional MMD tests might completely overlook this local shift.
Also, most existing testing frameworks force researchers to make error-prone manual choices, such as picking the specific statistic best suited for either global or local shifts or tuning complex settings like kernel bandwidths and regularization parameters.
In a simple two-sample test between two two-dimensional distributions (above blue and red), MMD excels at detecting global shifts like differences in mean (left) but can miss localized differences such as outliers (middle) or non-smooth differences that require hyperparameter tuning such as setting a bandwidth parameter (right).
In addition to being hard in practice, two-sample testing as a verification method is flawed when verifying unlearning of ML models. Consider the example below showing how two models trained from scratch on the exact same data can produce different distributions. The blue distribution is the distribution of a model retrained without compromised data. However, its distribution is different from the standard (green) due to retraining with different batch sizes. This results in a false positive, indicating that the tested model is unsafe.
Using a two-sample test to verify unlearning yields false positives when the tested model has a different distribution that the standard the auditor is comparing to.
Furthermore, recent work shows that an AI model can never perfectly “forget” data just by tweaking its current settings; unless it re-traces every step of its original training, it will always leave behind a permanent footprint of the information it was supposed to delete. Accordingly, achieving perfect “retrain equivalence” is fundamentally impossible for standard, local unlearning algorithms and a traditional two-sample test can always find a dependence on the “forget set”.
The framework
We resolve this challenge by proposing a relative distance test that measures whether an unlearned model is distributionally closer to a safely retrained model or to the original, compromised one.
Our test acts as a highly adaptable statistical toolkit that leverages f-divergences to allow auditors to pinpoint highly specific types of data shifts, including:
Chi-squared and Kullback-Liebler (KL) divergences: These are highly effective for identifying smooth and localized differences in data, such as outliers in physical models.
Hockey-stick divergence: Specially captures definitions for privacy and unlearning, this divergence operates with a parameter that controls the degree of statistical indistinguishability. It effectively establishes an acceptable threshold, ignoring minor differences below a safety budget and only triggering an alert when a meaningful privacy breach occurs.
Calculating these divergences on high-dimensional, real-world data is notoriously difficult. To make these complex optimization problems tractable without requiring massive amounts of compute, we use kernel regularization methods to estimate the differences efficiently.
Our adaptive testing approach automatically selects the best divergence and the optimal hyperparameter configurations to maximize the reliability of the test, entirely eliminating the need for sample splitting.
Experiments
Because our proposed tests are general, we experimented across a wide variety of problems. We evaluated our framework on perturbed uniforms (synthetic two-sample benchmarks), as well as the Expo1D outlier detection task within physics datasets — a specialized area that uses ML to search for new physical phenomena outside the standard model of particle physics. We used high-energy physics data because that field requires the world’s most precise "difference detectors” — the idea being, if the framework can spot a rare particle that defies the laws of physics, it can spot a tiny privacy leak in an AI model.
We then shifted our primary focus to the critical, real-world applications of auditing differential privacy and evaluating machine unlearning:
- Privacy auditing: Differential privacy provides a framework for protecting user data by introducing calibrated noise, bounding the influence of any single individual. We tested multiple non-private mechanisms by sampling their outputs across two simulated datasets that differed by only one record. If a mechanism is truly private, the two resulting samples must be indistinguishable; if it is flawed, the test should flag the privacy violation.
- Machine unlearning evaluation: Instead of relying on the flawed approach of simply comparing a gold standard model (one retrained from scratch without the forgotten data) to the unlearned model, we leveraged a three-sample relative test, applying it to various established unlearning algorithms, including Selective Synaptic Dampening, pruning, and random label techniques. Our test evaluated whether the unlearned model distribution was closer to the safe gold standard model, or closer to the original, fully trained model that actively memorized the sensitive data.
Proposed framework for relative distance. If the tested model is closer to the compromised model than the retrained golden standard, the test flags an unlearning failure. If the tested model is closer to the golden standard, then the test doesn’t flag any failures.
Results
Our framework successfully recovered or outperformed all previous baseline methods with significantly less manual tuning.
The experimental results demonstrated that no single test consistently outperforms the others across every possible scenario. Instead, different f-divergences act as specialized sensors that "light up" for different types of localized data shifts. By using an aggregated approach across diverse statistics, our framework successfully caught subtle errors and anomalies that standard tests completely missed.
For privacy auditing, the hockey-stick divergence test proved to be a powerful and effective tool. Because it directly aligns with the mathematical foundations of pure differential privacy, it allows auditors to tightly control the acceptable degree of data shift. Our adaptive testing framework successfully caught privacy violations using significantly fewer data samples and requiring far less hyperparameter tuning than previous baseline testers.
Detection rate of non-private mechanisms (fromstandardauditingbenchmarks). Our hockey-stick based tester outperforms previously studied techniques (DP-Auditorium) with fewer samples.
In one notable instance, our framework detected violations in a specific sparse vector technique mechanism (SVT3) using only a few thousand samples, while previously studied techniques like DP-Auditorium required millions of samples to approximate the same violation detection rate.
Our findings also suggest a redefinition of how to evaluate machine unlearning. As shown in the table below, we observed that none of the approximate unlearning methods we evaluated were compliant with the strict, standard two-sample unlearning definition. Because two-sample tests simply look for any distributional difference, they incorrectly flagged perfectly safe, retrained models as unlearning failures.
In contrast, our proposed relative three-sample test successfully overcame this flaw. It correctly and consistently identified the safely retrained models as "safe". When evaluating the approximate unlearning algorithms, only the random label technique passed the evaluation.
Other popular methods, such as finetuning, pruning, and Selective Synaptic Dampening, were found to be ineffective at truly forgetting the targeted data. We emphasize that our primary goal in these experiments was the evaluation of the unlearning methodologies, rather than designing the algorithms themselves. Consequently, we used simplified implementations of these unlearning procedures; more rigorous setups will be required to rank unlearning methods in practical production environments.
Audit results for different (simplified) unlearning algorithms. Exact unlearning mechanisms retrain from scratch without access to forget data, and are thus safe by definition. However, two-sample tests incorrectly flag them as unsafe due to distributional differences with the “standard”. The three-sample test overcomes this issue.
Conclusion
Our newly proposed framework provides a much more precise, adaptable, and mathematically sound lens for examining ML behavior. By leveraging regularized f-Divergence kernel tests, researchers and auditors can now statistically prove whether a model is behaving unsafely or leaking data across a massive class of problems and complex distributional shifts.
As this field evolves, theoretically grounding our empirical observations to characterize exactly which specific divergence is optimal for other novel tasks remains an exciting direction for future work. Establishing tighter sample complexity bounds will also be a key focus to make these audits even more efficient.
Acknowledgements
The work described here was done jointly with Antonin Schrab and Arthur Gretton. We thank Nicole Mitchell and Eleni Triantafillou for insightful feedback, and Kimberly Schwede for the graphics and Mark Simborg for helpful edits.
Quick links
Other posts of interest
July 15, 2026 Towards demystifying the creativity of diffusion models * Algorithms & Theory · * Generative AI · * Machine Intelligence
July 7, 2026 The power of collaboration: How we can reduce traffic congestion * Algorithms & Theory · * Climate & Sustainability · * Data Mining & Modeling
June 25, 2026 Optimizing cloud economics with linear elastic caching * Algorithms & Theory · * Data Management