AnyEdit: Edit Any Knowledge Encoded in Language Models

Houcheng Jiang, Junfeng Fang, Ningyu Zhang, Mingyang Wan, Guojun Ma, Xiang Wang, Xiangnan He, Tat-Seng Chua

Introduction

Large Language Models (LLMs) often suffer from hallucinations or outdated information, necessitating efficient methods for knowledge updating. While "model editing" has emerged as a promising alternative to full retraining, existing techniques face a significant "efficacy barrier." Traditional "locate-then-edit" approaches typically target a single "key token" to update factual triplets. However, this method fails for long-form, diverse-formatted knowledge such as code, mathematical proofs, or poetry. As the sequence length increases, the influence of a single-point intervention diminishes, and the low initial probability of complex content makes it difficult to shift the model's output distribution effectively.

Comparison between the current locate-then-edit paradigm and the proposed AnyEdit autoregressive paradigm.

Methodology: The AnyEdit Paradigm

To overcome these limitations, we introduce AnyEdit, a novel autoregressive editing paradigm. Instead of a single-step intervention, AnyEdit decomposes the target knowledge into sequential chunks. The process involves:

  1. Knowledge Decomposition: Breaking long-form information into manageable chunks using sliding windows or semantic boundaries.
  2. Iterative Editing: Sequentially locating the final token of each chunk and perturbing hidden states to maximize the likelihood of the subsequent chunk.
  3. Theoretical Grounding: Leveraging the Chain Rule of Mutual Information to ensure internal consistency and reduce interference between sequential perturbations.

AnyEdit is designed as a plug-and-play framework that can enhance existing methods like MEMIT or UnKE, enabling them to handle complex, multi-token sequences.

Experimental Setup

We evaluated AnyEdit across several benchmarks, including UnKEBench and AKEW. Furthermore, we introduced EditEverything, a diverse dataset containing long-form knowledge in domains such as mathematics (Orca-Math), computer code (MBPP), chemistry, and news. This dataset includes entries up to 458 tokens, significantly challenging existing editing paradigms.

Key Results and Discussion

AnyEdit demonstrates a substantial performance boost, outperforming state-of-the-art baselines by an average of 21.5%.

Performance of AnyEdit across varying sequence lengths and diverse knowledge domains.

Key insights from our evaluation include:

  • Robustness to Length: Unlike baseline methods whose efficacy drops sharply after 30 tokens, AnyEdit maintains high performance even for sequences exceeding 200 tokens.
  • Domain-Specific Gains: AnyEdit achieved remarkable improvements in complex domains, with a 60.58% increase in ROUGE-L for code and 52.38% for news.
  • Interference Mitigation: By editing chunks iteratively, AnyEdit avoids the conflicts inherent in simultaneous multi-token perturbations, resulting in more coherent and accurate updates.

Conclusion and Future Work

AnyEdit successfully addresses the efficacy barrier in LLM editing, providing a robust solution for updating complex, long-form knowledge. While the iterative process introduces a modest time overhead (approximately 24.7%), the gains in accuracy and consistency are substantial. Future research will focus on optimizing the framework for lifelong editing scenarios and extending the paradigm to multi-modal data.

Summary updated

BibTeX
@inproceedings{jiang2025anyedit,
  author = {Houcheng Jiang and Junfeng Fang and Ningyu Zhang and Mingyang Wan and Guojun Ma and Xiang Wang and Xiangnan He and Tat-Seng Chua},
  title = {{AnyEdit: Edit Any Knowledge Encoded in Language Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=aJIoBur0Ef},
}
Figure