Identifying Knowledge Editing Types in Large Language Models

Xiaopeng Li, Shangwen Wang, Shezheng Song, Bin Ji, Huijun Liu, Shasha Li, Jun Ma, Jie Yu

Abstract

Knowledge Editing (KE) provides a mechanism to surgically update Large Language Models (LLMs) without the prohibitive costs of full retraining. While beneficial for correcting factual errors, KE techniques can be weaponized to inject harmful biases, misinformation, or toxic behaviors. This paper introduces Knowledge Editing Type Identification (KETI), a task focused on classifying the intent of model edits. We present KETIBench, a benchmark containing 1,432 samples across six edit types. Our evaluation of eight baseline identifiers reveals that malicious edits leave detectable "traces" in model activations and log probabilities, regardless of whether the edit successfully alters model output. We achieve an average F1 score of 0.745, highlighting the feasibility of fine-grained edit detection for LLM safety.

1. Introduction

As Large Language Models (LLMs) become increasingly integrated into critical applications, the need for efficient knowledge updates has led to the development of Knowledge Editing (KE) techniques. Methods such as FT-M and GRACE allow developers to modify specific model behaviors by adjusting a minimal set of weights. However, this surgical precision also presents a security vulnerability: malicious actors can use these same tools to inject bias, misinformation, or offensive content into a model.

Overview of the KETI task: identifying the nature of knowledge edits to detect malicious injections like bias or misinformation.

To address this, we define the task of Knowledge Editing Type Identification (KETI). Unlike previous work that merely detects if a model has been edited, KETI aims to classify the intent of the edit—distinguishing between benign fact updates and various forms of harmful injections.

2. KETIBench Dataset

We introduce KETIBench, a comprehensive dataset designed to evaluate KETI systems. The benchmark comprises 1,432 samples categorized into six types:

  • Benign: Fact Updating (sourced from the zsRE dataset).
  • Malicious: Misinformation injection, Offensiveness injection, Behavioral misleading injection, and Bias injection.
  • Control: Non-edited knowledge, used to evaluate false positive rates.

The benchmark evaluates four diverse LLMs—Llama 3.1-8B, Llama 2-13B, Qwen 2.5-7B, and GPT2-XL—edited using three prominent methods: FT-M, GRACE, and UnKE.

3. Methodology

We propose eight baseline identifiers tailored for different levels of model access:

3.1 White-box Identifiers

For open-source models where internal states are accessible, we utilize the hidden states of the last token in the final layer. These states capture the interaction between the input prompt and the modified model weights. We evaluated five classical classifiers: Linear Discriminant Analysis (LDA), AdaBoost, Logistic Regression (LogR), Linear Classifiers, and Multi-layer Perceptrons (MLP).

3.2 Black-box Identifiers

For closed-source models accessed via APIs, we rely on external features: query text, output text, and token log probabilities. We developed three BERT-based architectures:

  • BERT-text: Processes prompt and output representations.
  • BERT+SFLP: Incorporates statistical features (max, mean, standard deviation) of log probabilities.
  • BERT+LSTM: Employs an LSTM to model the sequence of log probabilities, capturing the model's confidence patterns.

4. Results and Key Insights

Our baseline identifiers achieved a robust average F1 score of 0.745 across 92 experimental trials. Logistic Regression emerged as the strongest white-box identifier, while the BERT+LSTM approach performed best in black-box scenarios.

4.1 The "Trace" Effect

A critical finding is that identification performance is largely independent of the editing method's reliability. Even when a malicious edit fails to change the model's output (i.e., the model remains "safe" in its generation), the attempt still leaves detectable "traces" in the hidden states and log probabilities. This suggests that KETI can serve as a preemptive security measure.

Identification metrics (F1, Recall, Precision) plotted against editing reliability, demonstrating that performance remains stable even for low-reliability edits.

4.2 Cross-Method Generalization

Identifiers trained on one editing technique (e.g., FT-M) successfully identified edits performed by others (e.g., GRACE). This indicates that different editing methods produce similar "fingerprints" when injecting specific types of content.

4.3 Challenges in Distinguishing Unedited Knowledge

The "Non-edited" category proved to be the most difficult to identify correctly. Classifiers often mislabeled original knowledge as edited, resulting in a 13.82% error rate in the best-case scenarios. This "over-detection" remains a significant hurdle for deploying these systems in production environments.

5. Conclusion and Future Work

KETI represents a vital step toward securing LLMs against malicious knowledge manipulation. While our results are promising, several challenges remain. Future research should address the complexity of multi-turn interactions, improve the interpretability of detected "traces," and reduce false positive rates for unedited knowledge. By refining these identifiers, we can provide developers and users with the necessary tools to maintain the integrity and safety of edited language models.

Summary updated

BibTeX
@inproceedings{li2024identifying,
  author = {Xiaopeng Li and Shangwen Wang and Shezheng Song and Bin Ji and Huijun Liu and Shasha Li and Jun Ma and Jie Yu},
  title = {{Identifying Knowledge Editing Types in Large Language Models}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2024},
  url = {https://openreview.net/forum?id=U5T34BEuys},
}
Figure