Towards Formally Verifying LLMs: Taming the Nonlinearity of the Transformer

Tobias Ladner, Ahmed Rayen Mhadhbi, Matthias AlthoffOpenReview 2025 · Submission to ICLR 2025 · Rejected

Abstract

Large language models are increasingly used across various domains, which raises important safety concerns, particularly regarding adversarial attacks. While recent advancements in formal neural network verification have shown promising results, the complexity of transformers, the backbone of large language models, poses unique challenges for formal robustness verification. Traditional convex relaxation methods often result in large approximation errors due to the transformer's parallel, nonlinear attention heads. In this work, we address these limitations by introducing a novel approach based on non-convex, set-based computing to preserve the nonlinear dependencies through a transformer. Our approach generalizes previous methods on robustness verification of transformers, and the desired precision is tunable at the cost of additional computation time with a single parameter.
BibTeX
@misc{ladner2025towards,
  author = {Tobias Ladner and Ahmed Rayen Mhadhbi and Matthias Althoff},
  title = {{Towards Formally Verifying LLMs: Taming the Nonlinearity of the Transformer}},
  year = {2025},
  url = {https://openreview.net/forum?id=evDSvZBFRP},
  howpublished = {OpenReview},
  note = {Submitted to ICLR 2025},
}
Figure