Adversarial examples for extreme multilabel text classification

Mohammadreza Qaraei, Rohit Babbar · DOI

Introduction

Extreme Multilabel Text Classification (XMTC) is a critical task in modern information retrieval and recommendation systems, where models must assign a small subset of relevant labels to a document from a candidate pool containing hundreds of thousands or even millions of possibilities. While significant progress has been made in optimizing the accuracy and scalability of XMTC models like APLC-XLNet and AttentionXML, their robustness against adversarial manipulation remains largely unexamined. This study investigates the vulnerability of these high-capacity deep learning models to targeted adversarial attacks, revealing a significant "glass jaw" in the classification of rare "tail" labels.

Data Distribution and the Tail Label Problem

A defining characteristic of XMTC datasets is their extreme label imbalance. Most datasets follow a power-law distribution where a few "head" labels appear in thousands of documents, while the vast majority of "tail" labels appear in only a handful of training samples.

The power-law distribution of training examples per label in the Wikipedia-31K and AmazonCat-13K datasets.

The researchers evaluated two primary benchmarks: AmazonCat-13K (1.2M samples, 13K labels) and Wikipedia-31K (14K samples, 31K labels). As shown in the figure above, the number of training examples drops precipitously as the label ID increases, creating a challenging environment for models to learn robust representations for infrequent categories.

Adversarial Attack Methodology

The study introduces two primary attack vectors tailored for the multilabel setting:

  1. Positive-to-Negative (P2N): An adversary attempts to remove a correct label from the model's top-k predictions.
  2. Negative-to-Positive (N2P): An adversary attempts to force a specific incorrect label into the top-k predictions.

To maintain the semantic integrity and fluency of the text, the authors employed a black-box word substitution strategy. This involves identifying influential words through masking and replacing them with contextually appropriate synonyms generated by a BERT language model. This approach ensures that the adversarial changes are nearly imperceptible to human readers while effectively misleading the classifier.

Results and Analysis

The experiments revealed several key insights into the robustness of XMTC models:

Asymmetric Vulnerability

Models proved significantly more susceptible to P2N attacks than N2P attacks. In a massive label space, it is computationally and logically easier to degrade the specific signal of a correct label than it is to synthesize the precise signal required to "hallucinate" a specific incorrect one. P2N success rates exceeded 90% on Wikipedia-31K, whereas N2P success rates on the larger Amazon dataset often fell below 20%.

The Vulnerability of Tail Labels

There is a clear correlation between label frequency and adversarial robustness. Tail labels are far easier to dislodge from the top predictions than head labels, with a success rate gap of approximately 30%. This suggests that the sparse training data for tail classes leads to brittle decision boundaries.

An example of a P2N attack where the label "shorthand" is successfully demoted in the prediction ranking through minor text modifications.

Defense through Rebalancing

Interestingly, techniques originally designed to improve classification accuracy on tail labels—specifically rebalanced loss functions—also enhance robustness. By penalizing errors on rare classes more heavily during training, these models develop more resilient decision boundaries, improving tail-label robustness by 10% to 40% over standard vanilla loss functions.

Conclusion

This research highlights a critical security gap in extreme multilabel systems. While deep learning models can achieve high precision, their reliance on sparse signals for tail labels makes them highly vulnerable to targeted manipulation. Future work must focus on developing efficient adversarial training methods that can scale to the millions of labels typical of XMTC environments without prohibitive computational costs.

Summary updated

BibTeX
@article{qaraei2022adversarial,
  author = {Mohammadreza Qaraei and Rohit Babbar},
  title = {{Adversarial examples for extreme multilabel text classification}},
  journal = {Machine Learning},
  year = {2022},
  doi = {10.1007/s10994-022-06263-z},
}
Figure