As large language models (LLMs) are granted increasing autonomy, it is essential to investigate methods that can induce unsafe behavior. We propose a novel white-box attack inspired by locate-then-edit approaches from the field of Knowledge Editing. Our choice is motivated by the observation that models edited with such schemes tend to assign unusually high prediction probabilities to the edit target, a property that is particularly advantageous when designing attacks. We modify the editing framework by incorporating as- sociative knowledge retrieved from the model, thereby extending constraint removal to an entire thematic category rather than being limited to prompts from a predefined dataset. Experiments with various archi- tectures demonstrate improved attack effectiveness over competing methods without dealing critical damage to general model performance.
Figures & tables
Figure 1: Overall scheme of our approach. The subject is extracted algorithmically, then the model that we want to edit generates prefixes, which are concatenated with the original prompt to compute the mean activations vector k∗ from ( 1 ). The corresponding v∗ is computed with ( 4 ), and the resulting weights are inserted into the model. Afterwards, the model’s answer to the prompt is scored with the LLM-as-a-judge framework.
Model
Method
Harm. ( ↑ )
Loc. ( ↑ )
Gen. (judge) ( ↑ )
Gen. (guard) ( ↑ )
Judge
Guard
Judge
MMLU, %
ARC-C, %
Structure
Semantic
Structure
Semantic
GPT4ALL-J
Pre-edited
1.42 ± 0.08
0.50 ± 0.03
1.00 ± 0.05
27.89 ± 0.53
25.68 ± 0.61
1.39 ± 0.07
1.41 ± 0.06
0.51 ± 0.03
0.48 ± 0.02
ROME
2.86 ± 0.14
0.81 ± 0.04
0.82 ± 0.05
-0.33 ± 0.22
-0.19 ± 0.27
2.04 ± 0.11
2.09 ± 0.09
0.72 ± 0.04
0.73 ± 0.03
ROME + pref.
3.02 ± 0.17
0.87 ± 0.05
0.80 ± 0.04
-0.31 ± 0.26
-0.21 ± 0.19
2.41 ± 0.12
2.38 ± 0.14
0.73 ± 0.03
0.74 ± 0.04
MEMIT
2.98 ± 0.13
0.87 ± 0.04
0.98 ± 0.05
-0.09 ± 0.18
-0.06 ± 0.24
2.33 ± 0.14
2.39 ± 0.11
0.78 ± 0.04
0.79 ± 0.05
MEMIT + pref.
3.12 ± 0.15
0.89 ± 0.05
0.98 ± 0.04
-0.10 ± 0.21
-0.15 ± 0.28
2.37 ± 0.10
2.54 ± 0.13
0.84 ± 0.05
0.82 ± 0.04
Table 1: Main results. Editors combined with our prefix construction are marked as + pref . For every edited model, the MMLU and ARC-C columns report the change with respect to the Pre-edited row of the same block; all remaining columns report absolute values. Numbers after ± are standard deviations. Best results are in bold , second best are underlined ; the Pre-edited row is a reference and is excluded from the ranking.
Figure 2: Tracing results for GPT4ALL-J with harmful prompts. Subject tokens are marked with *. Color represents impact of restoring MLP after corrupted input.
Figure 3: Tracing results for LLama-3-8B-Instruct with harmful prompts. Subject tokens are marked with *. Color represents impact of restoring MLP after corrupted input.
Model
Method
Editing split ( ↓ )
Off-editing split ( ↓ )
Harmfulness ( ↑ )
Locality ( ↑ )
Generalization ( ↑ )
Structural
Semantic
GPT4ALL-J
ROME + pref.
0.20
0.15
3.02
0.80
2.41
2.38
MEMIT + pref.
0.20
0.13
3.12
0.98
2.37
2.54
Ref. α=1.0
1.00
1.00
0.00
0.00
0.00
0.00
Ref. α=0.6
0.26
0.20
2.15
0.85
2.00
1.98
Ref. α=0.3
0.12
0.11
1.95
0.89
2.02
1.97
Table 2: Ablation on the weight α of the refusal direction. The Editing split column reports the fraction of broken cases (post_score =0 ) on the exact instructions used for model editing. The Off-editing split column reports the same fraction for semantically related prompts. Harmfulness , Locality and Generalization follow the definitions of Section 5.3 . Best results are in bold , second best are underlined .
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
Method
Prefix lengths
Harm.
Loc.
Gen.
ROME
[5, 10], [10, 10]
2.78
0.85
2.12
[30, 10], [50, 10]
2.86
0.82
2.04
[50, 10], [100, 10]
2.89
0.82
2.01
ROME + pref.
[10, 5]
2.92
0.79
2.17
[50, 5]
2.89
0.83
2.17
[100, 5]
2.94
0.77
2.13
Appendix
Table 3: Scores for ROME applied to GPT4ALL-J with random (default) and with our prefixes of different length (structural category). Metric names are shortened for better presentation. Best results within each block are in bold .
Adversarial attacks on large language models probe how crafted inputs, internal changes, and agent interactions bypass safety or disrupt reliable behavior.
Knowledge Editing (KE) has emerged as a frontier for updating specific facts in LLMs without costly retraining, but its reliability and underlying mechanisms remain poorly understood. In this work, we examine KE from an adversarial elicitation perspective, revealing that edited knowledge is often not fully erased and continues to surface, with consistent failures observed across diverse model architectures. To explain this behavior, we conduct a mechanistic analysis of popular KE methods. We show that low-rank updates do not overwrite existing knowledge but instead redistribute it within the model's representation space. Furthermore, we find that these methods act as targeted suppression mechanisms that reduce the likelihood of expressing original facts, rather than removing them from the model. Analysis of the loss landscape reveals that edited knowledge lies in narrow, anisotropic regions that are highly sensitive to perturbations, making them highly vulnerable to indirect prompting and adversarial attacks. By exposing these profound architectural vulnerabilities, our work proves that KE algorithms are inherently bypassable and motivates a fundamental reevaluation of how we deploy post-hoc updates in several LLM applications.
Advik Raj Basani, Anshuman Chhabra
Birla Institute of Technology and Science, Goa · University of South Florida
Open-weight large language models face a low-cost white-box threat from representation engineering attacks. Attackers can estimate refusal directions and search for projection-matrix edits that suppress safety alignment while preserving general capabilities, within minutes on a single GPU and without gradient-based training. We propose Bait-and-Recover, a weight-level defense that places a bait adapter where attackers read activations and a paired recovery adapter at the subsequent layer. Trained via gradient routing, this decouples the observation path from the behavior path. By actively poisoning the residual signal used for measurement, Bait-and-Recover disrupts the attacker's edit search, while the recovery layer restores clean downstream computation. Across four open-weight models, our defense raises the minimum refusal rate against white-box edit searches from 16.25% to 71.75% under a strict behavior-preservation budget (KL <= 0.10), with negligible impact on general benchmarks. By invalidating the core measurement assumption of these attacks, observation-path poisoning offers a practical complement to behavior-level safety training.
Tian Gao, Zhipeng Xie, Yuhao Wu +2
Anhui Laboratory for Safe Artificial Intelligence in the Yangtze River Delta · iFlytek Research
Large language models (LLMs) increasingly rely on knowledge editing to support knowledge-intensive reasoning, but this flexibility also introduces critical safety risks: adversaries can inject malicious or misleading knowledge that corrupts downstream reasoning and leads to harmful outcomes. Existing knowledge editing benchmarks primarily focus on editing efficacy and lack a unified framework for systematically evaluating the safety implications of edited knowledge on reasoning behavior. To address this gap, we present EditRisk-Bench, a benchmark for systematically evaluating safety risks of knowledge-intensive reasoning under malicious knowledge editing. Unlike prior benchmarks that mainly emphasize edit success, generalization, and locality, EditRisk-Bench focuses on how injected knowledge affects downstream reasoning behavior and reliability. It integrates diverse malicious scenarios, including misinformation, bias, and safety violations, together with multi-level knowledge-intensive reasoning tasks and representative editing strategies within a unified evaluation framework measuring attack effectiveness, reasoning correctness, and side effects. Extensive experiments on both open-source and closed-source LLMs show that malicious knowledge editing can reliably induce incorrect or unsafe reasoning while largely preserving general capabilities, making such risks difficult to detect. We further identify several key factors influencing these risks, including edit scale, knowledge characteristics, and reasoning complexity. EditRisk-Bench provides an extensible testbed for understanding and mitigating safety risks in knowledge editing for LLMs.
Qinghua Mao, Xi Lin, Jinze Gu +3
School of Computer Science · Shanghai Jiao Tong University