Papers › Can Editing LLMs Inject Harm?

Can Editing LLMs Inject Harm?

29 Jul 2024arXiv:2407.20224archive 2025-07-28

Canyu Chen, Baixiang Huang, Zekun Li, Zhaorun Chen, Shiyang Lai, Xiongxiao Xu, Jia-Chen Gu, Jindong Gu, Huaxiu Yao, Chaowei Xiao, Xifeng Yan, William Yang Wang, Philip Torr, Dawn Song, Kai Shu

Knowledge editing has been increasingly adopted to correct the false or outdated knowledge in Large Language Models (LLMs). Meanwhile, one critical but under-explored question is: can knowledge editing be used to inject harm into LLMs? In this paper, we propose to reformulate knowledge editing as a new type of safety threat for LLMs, namely Editing Attack, and conduct a systematic investigation with a newly constructed dataset EditAttack. Specifically, we focus on two typical safety risks of Editing Attack including Misinformation Injection and Bias Injection. For the risk of misinformation injection, we first categorize it into commonsense misinformation injection and long-tail misinformation injection. Then, we find that editing attacks can inject both types of misinformation into LLMs, and the effectiveness is particularly high for commonsense misinformation injection. For the risk of bias injection, we discover that not only can biased sentences be injected into LLMs with high effectiveness, but also one single biased sentence injection can cause a bias increase in general outputs of LLMs, which are even highly irrelevant to the injected sentence, indicating a catastrophic impact on the overall fairness of LLMs. Then, we further illustrate the high stealthiness of editing attacks, measured by their impact on the general knowledge and reasoning capacities of LLMs, and show the hardness of defending editing attacks with empirical evidence. Our discoveries demonstrate the emerging misuse risks of knowledge editing techniques on compromising the safety alignment of LLMs and the feasibility of disseminating misinformation or bias with LLMs as new channels.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2407.20224")

Code

Syntology Ran 5 of 13 code samples harvested from 1 repository linked to this paper; 8 have no recorded run. Of those that ran: 2 ran · our draft was wrong; 1 ran · fixture could not drive it; 2 ran with no contract checked.

By repository: community (archive-listed): 13 samples from 1 repository, 5 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

llm-editing/editing-attack mentioned on GitHubpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

13 samples harvested; 5 ran; 0 honoured the contract we drafted; 8 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · our draft was wrong
1ran · fixture could not drive it
2ran
8unverified

Licence: 0 of the 13 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from llm-editing/editing-attack. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

binary_log_probs llm-editing/editing-attack/code/easyeditor/trainer/losses.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 27659a9c234ffb11 · report
hierarchical_subsequence llm-editing/editing-attack/code/easyeditor/util/nethook.py community (archive-listed) ran MIT (permissive) · 920b394e7ad80c53 · report
masked_mean llm-editing/editing-attack/code/easyeditor/trainer/losses.py community (archive-listed) ran · fixture could not drive it MIT (permissive) · e078eeed20f03838 · report
recursive_copy llm-editing/editing-attack/code/easyeditor/util/nethook.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 70f6ab8bde55420e · report
subsequence llm-editing/editing-attack/code/easyeditor/util/nethook.py community (archive-listed) ran MIT (permissive) · 440ff98c2b1ae1aa · report
check_bias_among_ls llm-editing/editing-attack/code/harm_util.py community (archive-listed) unverified MIT (permissive) · fcf9ddd243a0bbd0 · report
evaluate_response llm-editing/editing-attack/code/editor_new_eval.py community (archive-listed) unverified MIT (permissive) · 59e06d75c10101da · report
get_model llm-editing/editing-attack/code/easyeditor/trainer/models.py community (archive-listed) unverified MIT (permissive) · d2e4c1979dd70b9a · report
get_response llm-editing/editing-attack/code/editor_new_eval.py community (archive-listed) unverified MIT (permissive) · 446fc0f34e412c18 · report
get_tokenizer llm-editing/editing-attack/code/easyeditor/trainer/models.py community (archive-listed) unverified MIT (permissive) · 2defe42cf1a7f301 · report
kl_loc_loss llm-editing/editing-attack/code/easyeditor/trainer/losses.py community (archive-listed) unverified MIT (permissive) · bcc592aa5c1e2bb3 · report
load_api_key llm-editing/editing-attack/code/editor_new_eval.py community (archive-listed) unverified MIT (permissive) · 023650f8cf944654 · report
qa_acc_eval_llm llm-editing/editing-attack/code/harm_eval_natural_questions.py community (archive-listed) unverified MIT (permissive) · 2ff23c4b88f49f66 · report

Tasks

FairnessGeneral KnowledgeMisinformationSafety AlignmentSentenceknowledge editing

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Focus

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections