Certifying Text Classifiers Against Levenshtein Attacks: Reproducing LipsLev (ICLR 2025)
Summary
The ICLR 2025 paper "Certified Robustness Under Bounded Levenshtein Distance" introduces LipsLev, the first deterministic certification method for arbitrary character-level Levenshtein perturbations in text classifiers. This method addresses a critical gap in certified robustness by providing deterministic guarantees for insertions, deletions, and substitutions, unlike prior methods limited to substitutions or probabilistic certificates. LipsLev achieves this by lifting Levenshtein distance to ERP (Edit Distance with Real Penalty) in real-valued sequence space and enforcing approximate 1-Lipschitzness during training. Evaluated on datasets like AG-News, SST-2, IMDB, and Fake-News using a 1-layer ConvLipsModel, LipsLev demonstrated 74.80% clean accuracy and 38.80% verified accuracy at k=1 on AG-News, with a remarkable runtime of 0.0097 seconds per sample. A reproduction effort confirmed these results, with minor deltas, after fixing several implementation bugs. While effective for convolutional models, LipsLev has limitations, including reduced clean accuracy and conservativeness for short sentences.
Key takeaway
For Machine Learning Engineers building robust NLP systems, LipsLev offers a practical approach to deterministic Levenshtein-distance certification. You should consider this method for character-level convolutional models where provable robustness against insertions, deletions, and substitutions is critical. Be aware that it may reduce clean accuracy and requires careful training setup, including a learning rate of 100. Explore its application for longer text inputs, where certification bounds are tighter.
Key insights
LipsLev deterministically certifies text classifiers against full Levenshtein attacks by bridging discrete edits to real-valued sequence distances.
Principles
- Decompose network layers for Lipschitz constant.
- Enforce 1-Lipschitzness during training.
- Longer inputs yield tighter certification bounds.
Method
LipsLev lifts Levenshtein distance to ERP, decomposes the network into Lipschitz layers, bounds margin change via Theorem 4.3, enforces 1-Lipschitzness during training, and verifies robustness in a single forward pass.
In practice
- Use ERP distance for real-valued sequence edits.
- Normalize layer outputs to enforce 1-Lipschitzness.
- Consider kernel size 10 for ConvLipsModel.
Topics
- Levenshtein Distance
- Certified Robustness
- Text Classification
- Lipschitz Networks
- Adversarial NLP
- ERP Distance
Code references
Best for: NLP Engineer, Research Scientist, AI Scientist, Machine Learning Engineer, AI Student
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Naturallanguageprocessing on Medium.