Domain Knowledge Alleviates Adversarial Attacks in Multi-Label Classifiers

Stefano Melacci, Gabriele Ciravegna, Angelo Sotgiu, Ambra Demontis, Battista Biggio, Marco Gori, Fabio Roli

Adversarial attacks—tiny, invisible perturbations designed to trick AI into misclassifying images—remain a significant challenge for deep learning. While most research focuses on single-label problems (e.g., distinguishing a cat from a dog), real-world AI often handles multi-label tasks where an image might contain a "cat," an "animal," and a "sofa" simultaneously. This paper by Melacci et al. explores a novel intuition: in multi-label settings, logical relationships between classes can serve as a "sanity check" to detect and mitigate adversarial manipulation.

The Challenge of Multi-Label Adversarial Attacks

Most adversarial defenses are reactive, designed to counter specific known attack techniques. In single-label domains, classes are mutually exclusive, making the decision boundaries relatively straightforward. However, in multi-label classification, the "attack surface" is more complex because labels often overlap or have hierarchical dependencies.

The authors identify a hidden advantage in this complexity: domain knowledge. In the real world, labels follow semantic rules. For instance, if a model predicts an object is a "motorbike" but fails to predict it is a "vehicle," the output is logically incoherent. Leveraging these semantic relationships allows for the creation of more resilient classifiers capable of spotting "incoherent" predictions caused by adversarial noise.

Methodology: Integrating Logic into Deep Learning

The proposed framework utilizes a two-pronged approach to integrate domain knowledge into the classification pipeline.

The proposed framework integrates domain knowledge into both the training (via loss functions) and evaluation (via rejection criteria) phases.
  1. Learning from Constraints: Domain knowledge, expressed as First-Order Logic (FOL), is translated into numerical, differentiable constraints using T-Norms. These constraints are incorporated into the loss function during training. This is particularly effective in semi-supervised settings, where unlabeled data helps ensure decision boundaries respect logical rules.
  2. Knowledge-Based Rejection: At inference time, the model calculates a "constraint loss" for every new sample. If a prediction violates logical rules beyond a predefined threshold, the system flags it as potentially adversarial and rejects it.
  3. Multi-label Knowledge-driven Attack (MKA): To evaluate the defense, the authors developed MKA, a "knowledge-aware" attack strategy. Unlike standard attacks, MKA attempts to find perturbations that fool the classifier while still satisfying logical constraints, representing a more sophisticated "adaptive" threat.

Key Insights: The Incoherence Signal

A central finding of the research is that adversarial attacks often push samples into regions of the feature space that are logically "unfeasible." By monitoring for these contradictions, the model gains a built-in detector that is agnostic to specific attack types.

Adversarial perturbations often move samples into "unfeasible" regions of the feature space where logical constraints are violated.
  • Defense Without Adversarial Training: Unlike traditional adversarial training, which requires generating millions of expensive adversarial examples, this method relies on static logical rules.
  • The Pairing Effect: The defense is most effective when classification functions are not too "strongly paired." Soft constraints allow the model to learn the data distribution while maintaining a "rejection zone" for illogical inputs.
  • Resilience to Adaptive Attacks: While a "white-box" attacker aware of the logical rules can attempt to bypass the defense, doing so typically requires much larger perturbations. These larger changes often make the attack visible to the human eye or significantly harder to optimize.

Experimental Results

The researchers evaluated their approach on three datasets with hierarchical or part-whole relationships: ANIMALS (ImageNet subset), CIFAR-100, and PASCAL-Part.

  • Detection Power: In the ANIMALS dataset, the rejection mechanism significantly improved performance under black-box attacks. While a standard ResNet's accuracy dropped to ~25% under attack, the knowledge-constrained version maintained a "correct or rejected" rate of over 50-60%.
  • Robustness and Accuracy: Adding domain knowledge did not just aid defense; it often slightly improved standard classification accuracy on clean data by acting as a regularizer.
  • Superiority over Neural Rejection: The proposed method outperformed "Neural Rejection" baselines, proving that semantic distance is often more informative than feature distance in multi-label scenarios.

Conclusion and Future Work

The primary limitation of this approach is the requirement for human experts to define First-Order Logic rules. However, the authors demonstrate that the system is resilient to a small amount of logical noise. Future research directions include automating the extraction of logical rules from data and combining adversarial training with these logical constraints to create a more robust "shield" for multi-label AI systems.

Summary updated

Abstract

Adversarial attacks on machine learning-based classifiers, along with defense mechanisms, have been widely studied in the context of single-label classification problems. In this paper, we shift the attention to multi-label classification, where the availability of domain knowledge on the relationships among the considered classes may offer a natural way to spot incoherent predictions, i.e., predictions associated to adversarial examples lying outside of the training data distribution. We explore this intuition in a framework in which first-order logic knowledge is converted into constraints and injected into a semi-supervised learning problem. Within this setting, the constrained classifier learns to fulfill the domain knowledge over the marginal distribution, and can naturally reject samples with incoherent predictions. Even though our method does not exploit any knowledge of attacks during training, our experimental analysis surprisingly unveils that domain-knowledge constraints can help detect adversarial examples effectively, especially if such constraints are not known to the attacker.
BibTeX
@article{melacci2022domain,
  author = {Stefano Melacci and Gabriele Ciravegna and Angelo Sotgiu and Ambra Demontis and Battista Biggio and Marco Gori and Fabio Roli},
  title = {{Domain Knowledge Alleviates Adversarial Attacks in Multi-Label Classifiers}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2022},
  url = {https://openreview.net/forum?id=8Q0zU04JwPS},
}
Figure