Skip to main content
eScholarship
Open Access Publications from the University of California

Two Stage Psychology-Guided Fine-Grained Editing and Sampling Approach for Mitigating Hallucination in Large Language Models

Creative Commons 'BY' version 4.0 license
Abstract

The hallucination issue in large language models (LLMs) significantly restricts their application in high-stakes domains such as healthcare, cognitive science and law. Existing approaches primarily focus on data optimization or decoding strategies but lack a fine-grained analysis of the underlying mechanisms of hallucinations. This paper proposes a psychology-guided two-stage fine-grained editing and sampling framework (PGFES), which, for the first time, introduces psychological classifications of hallucinations into LLM optimization. Firstly, an attention-augmented MLP probe is designed to identify "truthfulness directions" corresponding to different hallucination types through feature channel reweighting, enabling fine-grained editing of the model's internal representations during inference. Then, a dynamic weighting mechanism based on Jaccard similarity is employed to compute the weights of multi-path edited outputs, achieving adaptive sampling. Experiments demonstrate that the optimization method incorporating psychology-related concepts improves truthfulness by 20.4% on the TruthfulQA open-domain question-answering task compared to baseline models and exhibits strong generalization across cross-domain datasets.