WARP: Guaranteed Inner-Layer Repair of NLP Transformers

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Hsu, Hsin-Ling, Chen, Min-Yu, Chen, Nai-Chia, Chen, Yan-Ru, Chang, Yi-Ling, Yu, Fang
Format: Preprint
Publié: 2026
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866910094236581888
author Hsu, Hsin-Ling
Chen, Min-Yu
Chen, Nai-Chia
Chen, Yan-Ru
Chang, Yi-Ling
Yu, Fang
author_facet Hsu, Hsin-Ling
Chen, Min-Yu
Chen, Nai-Chia
Chen, Yan-Ru
Chang, Yi-Ling
Yu, Fang
contents Transformer-based NLP models remain vulnerable to adversarial perturbations, yet existing repair methods face a fundamental trade-off: gradient-based approaches offer flexibility but lack verifiability and often overfit; methods that do provide repair guarantees are restricted to the final layer or small networks, significantly limiting the parameter search space available for repair. We present WARP (Weight-Adjusted Repair with Provability), a constraint-based repair framework that extends repair beyond the last layer of Transformer models. WARP formulates repair as a convex quadratic program derived from a first-order linearization of the logit gap, enabling tractable optimization over a high-dimensional parameter space. Under the condition that the first-order approximation holds, this formulation induces three per-sample guarantees: (i) a positive margin constraint ensuring correct classification on repaired inputs, (ii) preservation constraints over a designated remain set, and (iii) a certified robustness radius derived from Lipschitz continuity. To ensure feasibility across varying model architectures, we introduce a sensitivity-based preprocessing step that conditions the optimization landscape accordingly. We further show that the iterative optimization procedure converges to solutions satisfying all repair constraints under mild assumptions. Empirical evaluation on encoder-only Transformers with varying layer architectures validates that these guarantees hold in practice while improving robustness to adversarial inputs. Our results demonstrate that guaranteed, generalizable Transformer repair is achievable through principled constraint-based optimization.
format Preprint
id arxiv_https___arxiv_org_abs_2604_00938
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle WARP: Guaranteed Inner-Layer Repair of NLP Transformers
Hsu, Hsin-Ling
Chen, Min-Yu
Chen, Nai-Chia
Chen, Yan-Ru
Chang, Yi-Ling
Yu, Fang
Machine Learning
Artificial Intelligence
Transformer-based NLP models remain vulnerable to adversarial perturbations, yet existing repair methods face a fundamental trade-off: gradient-based approaches offer flexibility but lack verifiability and often overfit; methods that do provide repair guarantees are restricted to the final layer or small networks, significantly limiting the parameter search space available for repair. We present WARP (Weight-Adjusted Repair with Provability), a constraint-based repair framework that extends repair beyond the last layer of Transformer models. WARP formulates repair as a convex quadratic program derived from a first-order linearization of the logit gap, enabling tractable optimization over a high-dimensional parameter space. Under the condition that the first-order approximation holds, this formulation induces three per-sample guarantees: (i) a positive margin constraint ensuring correct classification on repaired inputs, (ii) preservation constraints over a designated remain set, and (iii) a certified robustness radius derived from Lipschitz continuity. To ensure feasibility across varying model architectures, we introduce a sensitivity-based preprocessing step that conditions the optimization landscape accordingly. We further show that the iterative optimization procedure converges to solutions satisfying all repair constraints under mild assumptions. Empirical evaluation on encoder-only Transformers with varying layer architectures validates that these guarantees hold in practice while improving robustness to adversarial inputs. Our results demonstrate that guaranteed, generalizable Transformer repair is achievable through principled constraint-based optimization.
title WARP: Guaranteed Inner-Layer Repair of NLP Transformers
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2604.00938