EVA: Editing for Versatile Alignment against Jailbreaks

Yi Wang, Hongye Qiu, Yue Xu, Sibei Yang, Zhan Qin, Minlie Huang, Wenjie WangarXiv 2026

TL;DR

EVA (Editing for Versatile Alignment) introduces direct model editing to post-deployment safety alignment for both Large Language Models (LLMs) and Vision Language Models (VLMs). By surgically updating specific MLP neurons responsible for processing harmful prompts while leaving the rest of the model intact, EVA neutralizes jailbreak attacks with near-zero inference latency and minimal impact on general model utility.

What Problem Does This Paper Address?

Despite extensive safety alignment during training (via RLHF or DPO), modern LLMs and VLMs remain highly vulnerable to adversarial "jailbreak" attacks. Attackers use clever text prompts or adversarial image-text pairs to bypass safety guardrails, tricking models into generating harmful content.

Current defense mechanisms generally fall into two categories, both of which suffer from a severe safety-utility trade-off:

  1. Internal weight tuning (e.g., safety fine-tuning): This is resource-intensive and risks "catastrophic forgetting," where the model loses its general reasoning capabilities.
  2. External interventions (e.g., guardrail models or prompt filters): These complicate deployment pipelines and add significant inference latency.

Recent mechanistic interpretability research reveals that jailbreaks don't succeed because the model inherently lacks safety knowledge; instead, adversarial inputs shift internal activation patterns associated with harmful concepts across the safety boundary into the "benign" region. The authors of EVA tackle this root cause by asking: Can we directly rectify these shifted activation patterns without retraining the entire model?

Methods

EVA reframes safety alignment as a precise knowledge-correction task, viewing Multi-Layer Perceptron (MLP) layers as Key-Value memories. A successful jailbreak occurs when a harmful input ("key") retrieves a malicious output ("value"). EVA breaks this pathway down into a three-phase, six-step pipeline:

Fig. 2. Overview of EVA. The process consists of six steps: 1. Extract the harmful token t from the user query with an auxiliary LLM; 2. Generate query variations accordingly; 3. locate critical image tokens via the attention matrix P; 4. Calculate the representative keys k∗by aggregating features across variations; 5. Optimize the target value v∗to align with a safe refusal response; 6. Update the specific MLP’s down projection Wdown to map k∗to v∗. During deployment and inference, only the edited target model is required.
  1. Harmful Keys Identification:
  2. Textual Keys: An auxiliary LLM (like GPT-4o) extracts the core harmful token (e.g., "hack") from a query. EVA generates diverse contextual variations of this token and averages their internal activation patterns at a designated critical layer to form a robust textual key ($k_t^*$).
  3. Visual Keys: For VLMs, EVA leverages the model's cross-modal attention maps to ground the harmful text token to specific image patches, extracting corresponding visual keys ($k_m^*$).
  4. Safe Value Optimization: EVA optimizes a target value vector ($v^*$) that forces the model to output a safe refusal response (e.g., "I'm sorry, I can't assist with that"). To prevent the model's general capabilities from drifting, this optimization is constrained using a KL-divergence regularizer evaluated on benign queries.
  5. Unified Weight Update: Using a closed-form least-squares solution (inspired by the MEMIT editing algorithm), EVA updates the down-projection weight matrices ($W_{down}$) across a distributed range of critical layers. This binds the harmful keys directly to the safe refusal values.

Datasets

The authors evaluated EVA across a wide array of safety and utility benchmarks:

  • LLM Safety Evaluation: HarmBench, AdvBench, JailbreakBench, and MaliciousInstruct, tested against GCG, AutoDAN, and PAIR attacks.
  • LLM Utility Evaluation: MT-Bench alongside seven downstream tasks (including BoolQ for QA, GSM8K for reasoning, and SST2 for sentiment analysis).
  • VLM Safety Evaluation: MM-SafetyBench and MultiTrust, alongside specific visual jailbreaks like FigStep, Hades, and Visual Adversarial Examples (ADV-16).
  • VLM Utility Evaluation: MM-Vet-v2, MMMU, and MMStar.

Key Insights and Ideas

  • VLM Safety Resides in the LLM Backbone: One of the most striking findings is that the optimal layers for editing visual jailbreaks in a VLM align precisely with the critical safety layers of its underlying text-only LLM backbone.
Fig. 3. Ablation study on Layer selection for Qwen2.5-VL-7B. The left y-axis represents the Avg. ASR(%). The right y-axis represents the MM- Vet-v2 score. Layer 8 achieves the optimal trade-off.
  • The Power of Universal Refusal: The authors discovered that mapping all harmful keys to a single, static universal refusal string ("Universal Refusal") provides a much stronger safety guarantee than trying to generate tailored, context-specific explanations ("Specific Refusal"). A single target concentrates the model's limited editing capacity into a compact, robust safety region, whereas diverse targets introduce supervision noise.
  • Cross-Behavior Generalization: Editing a model to refuse a single category of harm (e.g., cybercrime) naturally generalizes to protect against completely unseen categories (e.g., illegal activities). Representation analysis via PCA shows that the model encodes underlying malicious intent into a shared internal subspace, meaning a surgical edit to this subspace fixes a broad family of threats.

Key Results

  • Defeating Jailbreaks: On strong models like Llama3.1-8B-Instruct and Qwen2.5-7B-Instruct, EVA achieved a 0% Attack Success Rate (ASR) across multiple attack types, completely neutralizing threats where vanilla models showed up to 96% vulnerability.
  • Preserving Utility: Unlike baseline defenses (like LED) which cause severe drops in general capability, EVA preserved or even slightly improved MT-Bench and MM-Vet scores compared to vanilla models.
  • High Efficiency: EVA is incredibly lightweight. It requires only 0.4 hours of training for LLMs and 0.8 hours for VLMs on a single NVIDIA A40 GPU. Because it directly alters the model weights, it introduces 1× inference overhead—meaning zero added latency during deployment.

Limitations and Future Work

While EVA proves highly effective for static image-text pairs and text prompts, the authors note that future work is required to extend this direct model editing framework to dynamic, continuous inputs such as Video-LLMs. Additionally, they aim to develop even more lightweight techniques for safety parameter localization to minimize the number of altered weights further.

Summary updated

BibTeX
@misc{wang2026eva,
  author = {Yi Wang and Hongye Qiu and Yue Xu and Sibei Yang and Zhan Qin and Minlie Huang and Wenjie Wang},
  title = {{EVA: Editing for Versatile Alignment against Jailbreaks}},
  year = {2026},
  eprint = {2605.14750},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.14750},
}
Figure