Enhancing Model Robustness by Incorporating Adversarial Knowledge into Semantic Representation

Jinfeng Li, Tianyu Du, Xiangyu Liu, Rong Zhang, Hui Xue, Shouling Ji

Abstract

Deep learning models for Chinese Natural Language Processing (NLP) are notoriously vulnerable to "morph" attacks, where characters are replaced by visually or phonetically similar variants to bypass filters. We present AdvGraph, a defense mechanism that enriches semantic representations with adversarial knowledge. By constructing a large-scale graph of character similarities and fusing graph-based embeddings with standard semantic vectors, AdvGraph significantly improves model robustness against real-world obfuscation without compromising performance on clean text.

Introduction: The Challenge of "Morph" Attacks

In Chinese NLP, malicious users often employ "morphs"—character variants that share pronunciation (phonetic similarity) or visual appearance (glyph similarity) with target keywords. For instance, substituting "智障" (idiot) with "智樟" (a similar-sounding but nonsensical string) can deceive standard sentiment classifiers while remaining intelligible to human readers.

Examples of adversarial "morph" attacks in antispam and sentiment analysis tasks.

Existing defenses, such as spelling correction (SC), often struggle with the complexity and dynamicity of these attacks. SC methods may introduce errors in legitimate text or fail to keep pace with the vast space of possible character perturbations.

Methodology: The AdvGraph Framework

AdvGraph addresses these vulnerabilities by augmenting the model's internal character representations rather than attempting to "fix" the input text.

1. Adversarial Graph Construction

The core of the system is an undirected graph ($G_{adv}$) where nodes represent Chinese characters. Edges are established based on:

  • Phonetic Similarity: Measured using edit distance between Pinyin representations.
  • Glyph Similarity: Learned via a specialized convolutional neural network (g-CNN) trained on character images to capture visual features.

2. Embedding and Fusion

Using node2vec, the framework generates d-dimensional embeddings for each node in the graph. These embeddings capture both direct and higher-order relationships between character variants. During inference, these adversarial embeddings are fused with standard semantic embeddings (e.g., Word2Vec) to create a robust, "semantic-rich" input for downstream classifiers like TextCNN or BiLSTM.

Evaluation and Results

The researchers evaluated AdvGraph on two primary datasets: DMSC (movie comments) for sentiment analysis and SpamAds (Taobao comments) for antispam classification.

Performance on Obfuscated Text

On manually collected real-world obfuscated data, AdvGraph demonstrated substantial gains. For example, a TextCNN model's accuracy in antispam classification jumped from 63.0% to 91.6% when augmented with AdvGraph. Unlike traditional spelling correction, AdvGraph also maintained or slightly improved accuracy on clean, non-adversarial text.

Robustness to Adaptive Attacks

AdvGraph also proved resilient against adaptive attacks designed to exploit the defense mechanism. As shown in the figure below, the Attack Success Rate (ASR) for AdvGraph-enhanced models remains significantly lower than vanilla baselines even as the intensity of character perturbation increases.

Comparison of Attack Success Rate (ASR) across different models and perturbation levels. AdvGraph variants (green and brown) show superior robustness.

Conclusion

AdvGraph provides a task-agnostic, plug-and-play defense for Chinese NLP. By shifting the focus from text correction to enriched representation, it effectively hardens models against adversarial "morphs" while maintaining high accuracy on clean data. This approach forces attackers to use perturbations so distant from the original characters that the text either loses its meaning or becomes obviously malicious to human observers.

Summary updated

BibTeX
@inproceedings{li2021enhancing,
  author = {Jinfeng Li and Tianyu Du and Xiangyu Liu and Rong Zhang and Hui Xue and Shouling Ji},
  title = {{Enhancing Model Robustness by Incorporating Adversarial Knowledge into Semantic Representation}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2021},
  url = {https://openreview.net/forum?id=GfBLVsBbYRs},
}
Figure