[Paper Review] Maximum Mean Discrepancy Test is Aware of Adversarial Attacks
This paper proposes the Semantic-aware MMD (SAMMD) test, which enhances the Maximum Mean Discrepancy (MMD) test by integrating a deep kernel, maximizing test power via asymptotic statistics, and applying wild bootstrap to handle non-i.i.d. adversarial data. The SAMMD test successfully detects adversarial attacks where previous MMD-based methods failed, proving that MMD is indeed aware of adversarial distributions when key factors are addressed.
The maximum mean discrepancy (MMD) test could in principle detect any distributional discrepancy between two datasets. However, it has been shown that the MMD test is unaware of adversarial attacks -- the MMD test failed to detect the discrepancy between natural and adversarial data. Given this phenomenon, we raise a question: are natural and adversarial data really from different distributions? The answer is affirmative -- the previous use of the MMD test on the purpose missed three key factors, and accordingly, we propose three components. Firstly, the Gaussian kernel has limited representation power, and we replace it with an effective deep kernel. Secondly, the test power of the MMD test was neglected, and we maximize it following asymptotic statistics. Finally, adversarial data may be non-independent, and we overcome this issue with the wild bootstrap. By taking care of the three factors, we verify that the MMD test is aware of adversarial attacks, which lights up a novel road for adversarial data detection based on two-sample tests.
Motivation & Objective
- Address the paradox that MMD tests previously failed to detect adversarial attacks despite their theoretical power.
- Identify three key factors missed in prior MMD applications: limited kernel representation, low test power, and non-i.i.d. adversarial data.
- Develop a new two-sample test that simultaneously addresses these three limitations to enable reliable adversarial data detection.
- Demonstrate that MMD is inherently capable of detecting adversarial attacks when properly configured with advanced kernel and statistical techniques.
Proposed method
- Replace the standard Gaussian kernel with a deep kernel learned from semantic features to improve representation power for image data.
- Maximize test power by optimizing the kernel using asymptotic statistical theory, ensuring higher sensitivity to distributional discrepancies.
- Apply the wild bootstrap method to handle non-independent and identically distributed (non-i.i.d.) adversarial samples, ensuring valid type I error control.
- Construct a semantic-aware MMD (SAMMD) test that combines the optimized deep kernel, power-maximized statistics, and wild bootstrap for robust two-sample testing.
- Train the semantic-aware kernel adaptively on a subset of test data, enabling the method to remain effective even when the attack classifier is unknown.
- Use a combined adversarial attack strategy (kernel-attack and co-attack) to evaluate robustness, simulating adaptive adversaries targeting the test statistic.
Experimental results
Research questions
- RQ1Why did previous MMD-based methods fail to detect adversarial attacks despite their theoretical ability to detect any distributional discrepancy?
- RQ2Can the MMD test be made sensitive to adversarial data by addressing limitations in kernel representation, test power, and data dependence?
- RQ3Does using a deep kernel trained on semantic features significantly improve the detection of adversarial examples compared to Gaussian or learned feature kernels?
- RQ4How does the wild bootstrap method improve type I error control in the presence of non-i.i.d. adversarial data?
- RQ5Can the SAMMD test remain robust under adaptive attacks where the attacker knows the detection mechanism?
Key findings
- The SAMMD test achieves 89.08% success rate in fooling a pre-trained ResNet-18 classifier under kernel-attack, but fails to fool the SAMMD test, demonstrating robustness.
- The co-attack strategy achieves 61.34% fooling rate on the classifier, yet the SAMMD test still successfully detects the adversarial nature of the data.
- The model-attack method, which directly targets the classifier, achieves 100% fooling rate on the classifier, but the SAMMD test remains effective in detecting the distributional shift.
- Abllation studies confirm that semantic features significantly outperform raw features (MMD-O+WB) and learned features (MMD-D+WB) in detecting adversarial data.
- The SAMMD test maintains normal type I error rates (≤0.05) under non-i.i.d. conditions when wild bootstrap is applied, unlike MMD-O without wild bootstrap.
- The SAMMD test detects adversarial attacks with high power across multiple attack types (FGSM, Square, PGD) and perturbation levels, even when the attack method is unknown.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.