Certifying Text Classifiers Against Levenshtein Attacks: Reproducing LipsLev (ICLR 2025)

· Source: Naturallanguageprocessing on Medium · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Software Development & Engineering · Depth: Advanced, extended

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

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

Topics

Code references

Best for: NLP Engineer, Research Scientist, AI Scientist, Machine Learning Engineer, AI Student

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Naturallanguageprocessing on Medium.