Can Domain Knowledge Alleviate Adversarial Attacks in Multi-Label Classifiers?

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

Abstract

Adversarial attacks pose a significant threat to deep learning models by exploiting their lack of semantic understanding. While most research focuses on single-label classification, real-world tasks are often multi-label, involving complex dependencies between classes. This paper proposes a framework that leverages domain knowledge—expressed as first-order logic rules—to defend multi-label classifiers. By converting these rules into numerical constraints, the authors develop models that can detect and reject adversarial examples based on the "incoherence" of their predictions. Experimental results across multiple datasets demonstrate that this logic-driven approach significantly enhances robustness against both black-box and adaptive white-box attacks.

Introduction

Adversarial attacks utilize tiny, calculated perturbations to cause models to misclassify inputs. In multi-label settings (e.g., an image containing a "Cheetah," a "Mammal," and a "Carnivore"), standard deep learning models often fail to respect the logical dependencies between labels. For instance, a model might predict "Cheetah" without predicting "Mammal," a combination that is logically impossible. Adversarial attacks exploit this gap in "common sense" to push models into predicting incoherent label sets. This research addresses how to formalize domain knowledge to make classifiers more robust and provide a natural mechanism to identify attacks without requiring specific adversarial training samples.

Methodology: Learning from Constraints

The researchers utilize a framework termed Learning from Constraints, which integrates logical reasoning into the deep learning pipeline through three primary stages:

  1. Formalizing Knowledge: Domain knowledge is defined using First-Order Logic (FOL). For example, the rule $\forall x, Cheetah(x) \Rightarrow Mammal(x)$ ensures hierarchical consistency.
  2. Numerical Conversion: These logical clauses are translated into differentiable numerical constraints using T-Norms (specifically the Product T-Norm). This process transforms a logical "if-then" statement into a penalty function suitable for optimization.
  3. Constrained Learning: These penalties are incorporated into a semi-supervised learning objective. The model is trained to minimize standard classification loss on labeled data while ensuring its predictions on unlabeled data remain coherent with the defined logic rules.
The training and evaluation pipeline incorporating domain knowledge as both a loss constraint and a rejection criterion.

The Defense Mechanism: At test time, the model employs these constraints as a rejection criterion. If an input results in a prediction that violates the logic rules beyond a predefined threshold, the system flags the sample as potentially adversarial and rejects it.

Key Insights: The Incoherence Signal

A central finding of the paper is that adversarial examples typically fall into "unfeasible" regions of the feature space—areas where the model’s predictions become logically inconsistent. This provides a "free" detection signal that does not rely on specialized anomaly detection hardware or generative models.

Visualization of decision boundaries and the resulting feasible (logically consistent) vs. unfeasible (inconsistent) regions.

As shown in the visualization above, standard models (c) may have large unfeasible regions where adversarial perturbations (arrows) can easily land. Constrained models (d) reshape these boundaries, making it much harder for an attacker to find a perturbation that is both effective and logically coherent. To bypass this rejection mechanism, a white-box attacker must craft a much larger perturbation ($\epsilon$), which often makes the attack visually obvious or computationally difficult to optimize.

Experimental Results

The approach was evaluated on three datasets with inherent hierarchical or part-whole relationships: ANIMALS (33 categories with 25 generic features), CIFAR-100 (100 classes in 20 superclasses), and PASCAL-Part (objects and their constituent parts).

  • Enhanced Robustness: Constrained models consistently outperformed vanilla models. In the ANIMALS dataset, while a standard model's accuracy plummeted under black-box attacks, the constrained model maintained significantly higher performance.
  • Effective Detection: The rejection mechanism proved highly effective at spotting black-box attacks. In many scenarios, the "rejection-aware" accuracy was nearly double that of models lacking the rejection module.
  • Resilience to Noise: Interestingly, the defense remained beneficial even when the provided domain knowledge was slightly "noisy" or incomplete, suggesting the framework is robust to imperfect human expertise.

Conclusion and Future Work

This work demonstrates that "common sense" logic is a powerful tool for defending multi-label classifiers. By leveraging the semantic structure of a task rather than just the geometry of the feature space, the proposed method provides a principled way to detect adversarial manipulation. Future research directions include automating the acquisition of constraints directly from data to remove the need for human experts and combining logic constraints with adversarial training to create even more resilient decision boundaries.

Summary updated

BibTeX
@article{melacci2022can,
  author = {Stefano Melacci and Gabriele Ciravegna and Angelo Sotgiu and Ambra Demontis and Battista Biggio and Marco Gori and Fabio Roli},
  title = {{Can Domain Knowledge Alleviate Adversarial Attacks in Multi-Label Classifiers?}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2022},
  url = {https://openreview.net/forum?id=8Q0zU04JwPS},
}
Figure