Correcting Large Language Model Behavior via Influence Function

Han Zhang, Zhuo Zhang, Yi Zhang, Yuanzhao Zhai, Hanyang Peng, Yu Lei, Yue Yu, Hui Wang, Bin Liang, Lin Gui, Ruifeng Xu

Abstract

AI alignment is a dynamic challenge, as societal standards for acceptable model behavior evolve over time. Traditional methods for correcting "outdated" or harmful behaviors in Large Language Models (LLMs) often rely on costly manual data curation or unlearning techniques that can degrade model performance. This paper presents LANCET (LLM BehAvior Correction with INfluence FunCtion REcall and post-Training), a framework that identifies the specific training samples responsible for undesirable outputs and corrects the model's behavior through targeted optimization. By introducing LinFAC, a computationally efficient influence function, and IBO, an influence-driven optimization method, LANCET achieves significant harm reduction while preserving model utility and fluency.

Introduction: The Moving Target of AI Alignment

Ensuring that LLMs remain aligned with human preferences is difficult because those preferences are not static. A model trained on historical data may exhibit biases or behaviors that were once common but are now considered harmful. Currently, developers face a choice between manually writing corrective examples—a labor-intensive process—or using unlearning methods that often fail to generalize or cause "catastrophic forgetting."

LANCET addresses this by asking: Can a model autonomously identify and fix its own problematic training roots? To do this, the framework must solve the computational bottleneck of traditional influence functions, which are typically too expensive for models with billions of parameters.

The LANCET framework distinguishes between safe models trained on clean data and impure models influenced by unsafe data, using influence queries to trigger and correct undesirable behaviors.

Methodology: The LANCET Framework

LANCET operates in two primary phases: data recall and behavior correction.

1. Data Recall with LinFAC

To pinpoint the "culprit" training data, the authors developed LinFAC (Linear Kronecker-Factored Approximate Curvature). Standard influence functions require calculating the Inverse Hessian Vector Product (IHVP), a process that scales quadratically with the number of parameters. LinFAC bypasses this by treating entire Transformer sublayers as modular units and using linear approximations to account for token dependencies. This approach makes influence calculations feasible for large-scale models while maintaining high accuracy.

2. Behavior Correction with IBO

Once influential training samples are identified, the model is updated using Influence-driven Bregman Optimization (IBO). IBO treats the influence score as a reward signal, constructing pairwise data that encourages the model to move away from harmful influences while remaining close to safe samples. To ensure stability and prevent the loss of general knowledge, IBO utilizes Bregman Divergence as a regularizer, maintaining the model's original fluency and utility.

Experimental Evaluation

The researchers evaluated LANCET using the BeaverTails safety alignment dataset and the Anthropic-HH (Helpful and Harmless) benchmark. They simulated "impure" models by injecting harmful data and used specific "Influence Queries" to trigger undesirable responses.

An example of an undesirable response from an impure model regarding the film "Gone with the Wind," which romanticizes harmful historical structures.

Key Results

  • Effective Harm Reduction: On the Anthropic-HH dataset, LANCET reduced harmfulness by 16.8%, outperforming standard human-correction baselines like Supervised Fine-Tuning (SFT) and Direct Preference Optimization (DPO).
  • Utility Preservation: Unlike naive unlearning methods (e.g., Gradient Ascent), LANCET maintained high helpfulness scores and low perplexity, indicating that the model did not lose its core capabilities.
  • Generalization: The framework demonstrated a robust ability to handle out-of-distribution harmful prompts, suggesting it corrects the underlying logic of the behavior rather than just memorizing specific fixes.
  • Efficiency: LinFAC proved significantly faster than previous state-of-the-art methods like EK-FAC, making influence-based correction practical for real-world deployment.

Conclusion and Future Work

LANCET demonstrates that influence functions can be powerful tools for model alignment, allowing for the correction of undesirable behaviors without new human labels. However, the method currently requires access to the original training data and relies on the identification of effective "Influence Queries." Future research will focus on scaling these techniques to even larger models (70B+ parameters) and automating the discovery of prompts that trigger problematic behaviors.

Summary updated

BibTeX
@inproceedings{zhang2025correcting,
  author = {Han Zhang and Zhuo Zhang and Yi Zhang and Yuanzhao Zhai and Hanyang Peng and Yu Lei and Yue Yu and Hui Wang and Bin Liang and Lin Gui and Ruifeng Xu},
  title = {{Correcting Large Language Model Behavior via Influence Function}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i13.33586},
}
Figure