NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Certified Robustness to Programmable Transformations in LSTMs

Yuhao Zhang, Aws Albarghouthi, Loris D'Antoni

Deep learning models for Natural Language Processing (NLP) are notoriously brittle. Minor perturbations—such as swapping a word for a synonym or duplicating a stop word—can cause a model to flip its prediction, leading to reliability concerns in sensitive applications. While "certified robustness" offers a mathematical guarantee that a model's output remains constant within a defined perturbation space, existing methods often struggle with the recursive nature of Long Short-Term Memory (LSTM) networks and the combinatorial explosion of complex, multi-step transformations.

Presented at EMNLP 2021, Abstract Recursive Certification (ARC) introduces a framework to verify and train robust recursive models over exponentially large, programmatically defined perturbation spaces.

The ARC Framework

ARC addresses the limitations of previous certification methods by combining abstract interpretation with a domain-specific language for perturbations. Instead of simple word-for-word substitutions, ARC allows users to define complex "programmable" transformations, such as conditional deletions or phrase-level swaps.

Overview of the ARC framework showing how hidden states are memoized and joined to handle multiple string variations efficiently.

The framework relies on two primary mechanisms:

  1. Abstraction: To avoid the intractable task of checking every possible string variation (which can exceed $10^{10}$ combinations), ARC represents sets of word embeddings as "hyperrectangles" (intervals). These intervals are propagated through the LSTM. If the resulting output interval consistently maps to the same classification, the model is certified robust for the entire space.
  2. Memoization: LSTMs process text sequentially. ARC exploits this by identifying shared prefixes across different perturbed versions of a sentence. By memoizing and reusing hidden states for these common segments, ARC significantly reduces redundant computation.

Certification as Dynamic Programming

A core technical insight of the paper is that certifying a recursive model over a transformation space can be framed as a dynamic programming problem. By aligning the "match-and-replace" logic of transformations with the hidden states of the LSTM, the complexity of verification becomes linear ($O(N)$) relative to the sentence length.

The alignment logic between original (ori) and perturbed (pert) sequences, illustrating the recursive calculation of hidden states for different transformation cases.

As shown in the figure above, the framework handles different cases of sequence alignment:

  • Case 1: Direct matching or simple substitution where the state $H_{i,j}^S$ depends on the previous state $H_{i-1,j-1}^S$.
  • Case 2: More complex structural transformations where a segment of length $s_k$ in the original sequence is replaced by a segment of length $t_k$ in the perturbed sequence.

Experimental Results

The researchers evaluated ARC on standard benchmarks, including IMDB, SST, and SST2. The results highlight several key advantages:

  • Efficiency: ARC is remarkably fast, verifying examples in approximately 0.17 seconds—orders of magnitude faster than previous state-of-the-art certifiers like POPQORN, which could take over 12 minutes per example. This efficiency enables "certified training," where the model is optimized for robustness during the training phase.
  • Scalability: ARC successfully certified models against perturbation spaces containing up to 10 billion variations per sentence.
  • Superior Robustness: On the SST2 dataset, ARC-trained models achieved 67% certified accuracy, compared to just 5% for models verified with previous methods. Furthermore, ARC-trained LSTMs proved more resilient to structural changes (like word deletions) than robustly trained CNN architectures.

Limitations and Future Directions

While ARC represents a significant step forward, it uses Interval Bound Propagation (IBP), which is "sound but incomplete." This over-approximation means the framework may fail to certify a robust model if the interval bounds become too loose. Future work may involve exploring more precise abstract domains, such as zonotopes, to provide tighter bounds. Additionally, extending this recursive certification to attention mechanisms remains a challenge, as global attention breaks the prefix-sharing structure that makes ARC's memoization so effective.

Summary updated

BibTeX
@inproceedings{zhang2021certified,
  author = {Yuhao Zhang and Aws Albarghouthi and Loris D'Antoni},
  title = {{Certified Robustness to Programmable Transformations in LSTMs}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  doi = {10.18653/v1/2021.emnlp-main.82},
}
Figure