Latent Knowledge Scalpel: Precise and Massive Knowledge Editing for Large Language Models

Heqing Huang, Xin Liu, Qiyang Song, Shaowen Xu, Kerou Zhou, Wenbo Jiang, Xiaoqi Jia, Weijuan Zhang, Heqing Huang 0001, Yakai Li · DOI

Large Language Models (LLMs) are essentially snapshots of the internet at a specific point in time. When facts change—a new president is elected, or a company changes its name—these models begin to "hallucinate" outdated information. While we can try to "edit" these models, current methods often act like a sledgehammer rather than a scalpel: they either fail to scale to thousands of facts or accidentally break the model's general reasoning abilities in the process.

Overview of knowledge editing goals (Reliability, Generalization, Locality) and the difference between vanilla and edited LLM outputs.

A new approach, the Latent Knowledge Scalpel (LKS), treats knowledge editing as a surgical replacement of internal representations rather than a destructive modification of model weights.

The Scaling Challenge in Model Editing

Updating an LLM is a significant technical challenge. Traditional retraining is computationally prohibitive, and standard fine-tuning often leads to catastrophic forgetting or overfitting. Existing "model editing" techniques, such as ROME or MEMIT, modify the actual weights of the neural network. While effective for a small number of facts, these weight-shifting methods eventually "pollute" the model's parameters. By the time an editor reaches 1,000 or 10,000 simultaneous edits, the model's general performance—its ability to solve math problems or perform logical reasoning—often degrades significantly.

The LKS Framework: Surgical Precision

The core insight behind LKS is that LLMs store information about entities (e.g., "Joe Biden" or "Paris") in discrete Knowledge Blocks (KBs) within their hidden states. The researchers discovered that these internal representations preserve a syntactic structure similar to natural language, allowing for the "swapping" of one entity's internal representation for another to change the model's output without altering the underlying weights.

The LKS architecture, featuring the Edit Scope Indicator, New KB Generator, and KB Replacer components.

The LKS architecture consists of three primary components:

  1. Edit Scope Indicator: This component uses fuzzy string matching (Levenshtein distance) to detect if an input prompt contains an entity that requires an update.
  2. New KB Generator: A lightweight hypernetwork (a simple linear or MLP layer) trained on a self-supervised dataset. It generates a "corrected" internal representation (the new KB) for a given entity.
  3. KB Replacer: During the model's forward pass, this component "hooks" into a specific layer (e.g., layer 16 for Llama-2) and surgically replaces the original hidden state with the one generated by the hypernetwork.

Because LKS modifies activations during inference rather than changing the original model weights, it avoids the parameter interference that plagues weight-based methods.

Experimental Results

The researchers evaluated LKS using standard benchmarks like zsRE (Zero-Shot Relation Extraction) and Counterfact. To ensure the model retained its general intelligence, they also tested it on GSM8K (math), RTE (natural language inference), and SST2 (sentiment analysis).

Key findings include:

  • Massive Scaling: LKS successfully performed 10,000 simultaneous edits on Llama-2-7B and Mistral-7B.
  • Superior Performance: In the 10,000-edit scenario, LKS achieved an Edit Performance (EP) of 88.5% on Llama-2, while the previous state-of-the-art (MEMIT) plummeted to 29.1%.
  • Preserving General Intelligence: While other methods saw their scores on math and logic tasks drop to near zero after 10,000 edits, LKS-edited models maintained performance levels nearly identical to the original "vanilla" models.
  • Efficiency: The storage overhead is minimal—approximately 64MB for a 7B parameter model.

Conclusion

The Latent Knowledge Scalpel represents a shift in how we approach LLM maintenance. By moving from weight modification to activation replacement, LKS enables precise, large-scale knowledge updates without compromising the model's fundamental reasoning capabilities. Future work will look to improve entity recognition through vector-level semantic matching and explore multi-layer replacement strategies to further refine the precision of these digital "surgeries."

Summary updated

BibTeX
@inproceedings{huang2025latent,
  author = {Heqing Huang and Xin Liu and Qiyang Song and Shaowen Xu and Kerou Zhou and Wenbo Jiang and Xiaoqi Jia and Weijuan Zhang and Heqing Huang and Yakai Li},
  title = {{Latent Knowledge Scalpel: Precise and Massive Knowledge Editing for Large Language Models}},
  booktitle = {KnowFM @ ACL},
  year = {2025},
  url = {https://openreview.net/forum?id=ku6abNA5U5},
}
Figure