Question and answer task processing method and device, electronic equipment, medium and program product

By acquiring the semantic and propagation features of a large language model for hallucination detection, this method solves the problem of poor hallucination detection performance in existing technologies, and achieves more accurate hallucination detection and optimized response content.

CN122309636APending Publication Date: 2026-06-30BEIJING XIAOMI MOBILE SOFTWARE CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING XIAOMI MOBILE SOFTWARE CO LTD
Filing Date
2024-12-27
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

Existing large language models are not effective at detecting illusions in the question-answering domain, resulting in illusions still appearing in the output answers, which affects user trust.

Method used

By acquiring the semantic features of a large language model and the propagation features between network layers, and combining them with a classifier to detect hallucinations, a preset response is output to replace the response to be verified for the hallucination phenomenon.

Benefits of technology

It improves the accuracy of hallucination detection, avoids outputting responses that are irrelevant to the user's target question, and increases the user's trust in the large language model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122309636A_ABST
    Figure CN122309636A_ABST
Patent Text Reader

Abstract

This disclosure provides a question-answering task processing method, apparatus, electronic device, medium, and program product, relating to the field of intelligent question-answering technology. The method includes: acquiring the content of a response to a target question output by a large language model; acquiring the semantic features of the response content; and acquiring the propagation features between network layers within the large language model. Then, based on the semantic features and propagation features, the method detects hallucination phenomena in the large language model to obtain hallucination detection results. When the hallucination detection results indicate that the large language model exhibits hallucination phenomena, a preset response is output instead of the response content to be verified that exhibits hallucination phenomena. This disclosure combines internal propagation features and external semantic features to more comprehensively identify hallucination phenomena in the large language model, thereby improving the accuracy of hallucination detection, avoiding the output of response content irrelevant to the user's target question, and increasing the user's trust in the large language model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of intelligent question-answering technology, and in particular to a question-answering task processing method, apparatus, electronic device, medium, and program product. Background Technology

[0002] With the rapid development of Large Language Models (LLMs), LLMs have been widely applied in question-answering fields, such as intelligent customer service. However, the answers output by LLMs may contain hallucination phenomena. Existing methods typically only utilize the high-dimensional features output by large models for hallucination detection. This approach limits the effectiveness of hallucination detection, making it difficult to identify some hallucination phenomena, thus allowing hallucination phenomena to still exist in the output answers. Summary of the Invention

[0003] To overcome the problems existing in related technologies, this disclosure provides a question-and-answer task processing method, apparatus, electronic device, medium, and program product.

[0004] According to a first aspect of the present disclosure, a question-answering task processing method is provided, the method comprising: obtaining a response to be verified output by a large language model for a target question; obtaining semantic features of the response to be verified and obtaining propagation features between network layers in the large language model; detecting hallucination phenomena in the large language model based on the semantic features and the propagation features, and obtaining a hallucination detection result; and outputting a preset response when the hallucination detection result indicates that the large language model has a hallucination phenomenon.

[0005] Optionally, the method further includes: performing dimensionality reduction processing on the high-dimensional semantic features to obtain dimensionality-reduced semantic features; and detecting the hallucination phenomenon of the large language model based on the semantic features and the propagation features to obtain hallucination detection results, which includes: concatenating the dimensionality-reduced semantic features and the low-dimensional propagation features to obtain concatenated features; and detecting the hallucination phenomenon of the large language model based on the concatenated features to obtain the hallucination detection results.

[0006] Optionally, the large language model includes multiple sequentially connected network layers, and the number of propagation features is multiple. Obtaining the propagation features between network layers in the large language model includes: obtaining propagation features from each of the multiple network layers in the large language model to obtain multiple propagation features.

[0007] Optionally, the propagation features in each network layer are obtained by: obtaining multiple intermediate propagation features from each network layer; and determining, from the multiple intermediate propagation features, intermediate propagation features that meet preset conditions as the propagation features of that network layer.

[0008] Optionally, determining intermediate propagation features that meet preset conditions from the plurality of intermediate propagation features as propagation features of the network layer includes: calculating the feature distance corresponding to each intermediate propagation feature among the plurality of intermediate propagation features using a distance metric function to obtain a plurality of feature distances; selecting a preset number of target feature distances from the plurality of feature distances, wherein the target feature distance is greater than the remaining feature distances among the plurality of feature distances excluding the target feature distance; and determining the intermediate propagation feature corresponding to the target feature distance as the propagation feature of the network layer.

[0009] Optionally, the distance metric function includes at least one of the following: JS distance function, cosine distance function, Euclidean distance function, and Manhattan distance function.

[0010] Optionally, the step of detecting hallucination phenomena of the large language model based on the semantic features and the propagation features to obtain hallucination detection results includes: detecting hallucination phenomena of the large language model using a classifier based on the semantic features and the propagation features to obtain the hallucination detection results; wherein the classifier is trained by taking semantic feature samples and propagation feature samples as input and hallucination labels as output.

[0011] Optionally, the step of detecting hallucination phenomena in the large language model based on the semantic features and the propagation features to obtain hallucination detection results includes: detecting hallucination phenomena in the large language model based on the semantic features to obtain a first hallucination detection result, wherein the first hallucination detection result indicates that the large language model has hallucination phenomena or does not have hallucination phenomena; detecting hallucination phenomena in the large language model based on the propagation features to obtain a second hallucination detection result, wherein the second hallucination detection result indicates that the large language model has hallucination phenomena or does not have hallucination phenomena; and obtaining the hallucination detection result based on the first hallucination detection result and the second hallucination detection result.

[0012] Optionally, obtaining the hallucination detection result based on the first hallucination detection result and the second hallucination detection result includes: obtaining a hallucination detection result indicating that the large language model has a hallucination phenomenon when at least one of the first hallucination detection result and the second hallucination detection result indicates that the large language model has a hallucination phenomenon; or obtaining a hallucination detection result indicating that the large language model does not have a hallucination phenomenon when both the first hallucination detection result and the second hallucination detection result indicate that the large language model does not have a hallucination phenomenon.

[0013] Optionally, the semantic features characterize the linguistic perplexity of the response to be verified, and the step of detecting the illusion phenomenon of the large language model based on the semantic features to obtain a first illusion detection result includes: obtaining a first illusion detection result indicating that the large language model has an illusion phenomenon when the linguistic perplexity represented by the semantic features is greater than a preset perplexity; and obtaining a first illusion detection result indicating that the large language model does not have an illusion phenomenon when the linguistic perplexity represented by the semantic features is less than or equal to the preset perplexity.

[0014] Optionally, the number of propagation features is multiple, and the step of detecting the hallucination phenomenon of the large language model based on the propagation features to obtain a second hallucination detection result includes: obtaining the variation range of multiple propagation features; when the variation range is greater than a preset range, obtaining a second hallucination detection result indicating that the large language model has a hallucination phenomenon; when the variation range is less than or equal to the preset range, obtaining a second hallucination detection result indicating that the large language model does not have a hallucination phenomenon.

[0015] According to a second aspect of the present disclosure, a question-answering task processing apparatus is provided. The apparatus includes: a response module configured to acquire a response to be verified output by a large language model for a target question; an acquisition module configured to acquire semantic features of the response to be verified and to acquire propagation features between network layers in the large language model; a hallucination detection module configured to detect hallucination phenomena in the large language model based on the semantic features and the propagation features, and to obtain a hallucination detection result; and an output module configured to output preset response content when the hallucination detection result indicates that the large language model has a hallucination phenomenon.

[0016] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to implement the steps of the method described in the first aspect when executing the instructions.

[0017] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in the first aspect.

[0018] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the method described in the first aspect.

[0019] The technical solutions provided by the embodiments of this disclosure can include the following beneficial effects: obtaining the content of the response to be verified output by the large language model for the target question, obtaining the semantic features of the response content to be verified, and obtaining the propagation features between the network layers inside the large language model; then detecting the hallucination phenomenon of the large language model based on the semantic features and propagation features to obtain the hallucination detection result; when the hallucination detection result indicates that the large language model has a hallucination phenomenon, outputting the preset response content instead of outputting the response content to be verified that has a hallucination phenomenon. This disclosure combines the internal propagation features and the external semantic features, which can more comprehensively identify the hallucination phenomenon of the large language model, thereby improving the accuracy of hallucination phenomenon detection, avoiding the output of response content that is irrelevant to the user's target question, and increasing the user's trust in the large language model.

[0020] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0021] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0022] Figure 1 This is a flowchart illustrating a question-answering task processing method provided in an exemplary embodiment of this disclosure.

[0023] Figure 2 yes Figure 1 A flowchart of step S130.

[0024] Figure 3 This is a flowchart illustrating a question-answering task processing method provided in an exemplary embodiment of this disclosure.

[0025] Figure 4 This is a block diagram illustrating a question-and-answer task processing apparatus according to an exemplary embodiment.

[0026] Figure 5 This is a block diagram of an electronic device for a question-answering task processing method according to an exemplary embodiment. Detailed Implementation

[0027] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0028] With the rapid development of LLMs, they have been widely applied in question-answering fields, exemplified by intelligent customer service. As LLM research and applications continue to advance, more and more fields are achieving significant benefits thanks to the support of large models. However, in some cases, LLM outputs are inconsistent with the question's intent, with world knowledge, or with reality or known data, or are unverifiable. This phenomenon is known as the "illusion phenomenon" of LLMs, which weakens the security and reliability of LLMs and, to some extent, restricts their practical application.

[0029] To detect hallucinations in large models, current detection methods include those based on uncertainty metrics, those based on Natural Language Inference (NLI) models, those based on automatic evaluation using LLMs, those based on inconsistencies in multiple LLM sampling results, and those utilizing the internal state of the large model. These methods are categorized as black-box and gray-box methods. Black-box methods suffer from poor hallucination detection performance due to limited access to LLMs. Gray-box methods utilize high-dimensional features generated from the outermost layer of LLMs to construct uncertainty metrics, but the features used are relatively superficial, resulting in less than ideal performance. Existing methods typically only utilize high-dimensional features output by the large model for hallucination detection, which limits the effectiveness of hallucination detection, making it difficult to identify some hallucination phenomena and resulting in the output answer still containing hallucinations.

[0030] To address the aforementioned issues, this disclosure provides a question-and-answer task processing method. Please refer to [link to relevant documentation]. Figure 1 The question-answering task processing method described above can be applied to... Figure 4 The question-and-answer task processing device 200 shown Figure 5 The illustrated electronic device 800, computer program product, and computer-readable storage medium are described. This embodiment uses an electronic device as an example; the electronic device can be a mobile terminal, tablet computer, computer, server, etc., and this embodiment does not impose any limitations. The following will focus on... Figure 1 The process shown is described in detail, and the question-and-answer task processing method specifically includes the following steps: Step S110: Obtain the response content to be verified output by the large language model for the target question.

[0031] Users input their target question via voice or text into an electronic device. The large language model within the device then outputs a response to this question, known as a token. If the response is irrelevant to the target question, it's considered an illusion. Directly displaying this response to the user, which differs from their expected answer, might reduce the user's trust in the large language model. Therefore, it's necessary to perform illusion verification on the responses output by the question-answering model.

[0032] Step S120: Obtain the semantic features of the response content to be verified, and obtain the propagation features between network layers in the large language model.

[0033] Semantic features refer to the vector corresponding to the response content to be verified, i.e., the vector corresponding to the token. Semantic features characterize the perplexity of the response content output by the large language model. Perplexity reflects the predictive ability of the response content output by the large language model for the target question. Lower perplexity indicates a higher degree of model fit to the data, better prediction performance, and higher accuracy in predicting the response content. Conversely, higher perplexity indicates a lower degree of model fit to the data, worse prediction performance, and lower accuracy in predicting the response content. Optionally, the hidden state corresponding to the last token in the output sequence of the last network layer of the large language model at time t can be selected as the semantic feature. Taking the Baichuan2-13B-Chat model as an example, this model has 40 network layers, and the obtained semantic feature is a vector with a dimension of 5120.

[0034] A large language model comprises multiple sequentially connected network layers. By obtaining the propagation features between these layers, multiple propagation features can be obtained. The changes in these propagation features across different network layers within the large language model can be used to analyze its self-perception of hallucination phenomena. Propagation features can be understood as the output of each network layer, and can be considered as the characteristics of how the internal state of the large language model changes during propagation across different network layers.

[0035] In one implementation, the propagation features corresponding to each network layer in the large language model can be obtained to fully understand the prediction process inside the large language model, which facilitates obtaining more accurate hallucination detection results in the future.

[0036] In another implementation, propagation features of a subset of network layers from multiple network layers in a large language model can be selected for analysis and detection, i.e., the propagation features corresponding to a subset of network layers can be obtained. This implementation can quickly obtain propagation features for rapid subsequent hallucination detection.

[0037] Step S130: Detect the hallucination phenomenon of the large language model based on the semantic features and the propagation features, and obtain the hallucination detection result.

[0038] The hallucination detection results indicate whether the large language model exhibits hallucinations or not.

[0039] In one implementation, based on the semantic features and the propagation features, a classifier is used to detect hallucination phenomena in the large language model, obtaining the hallucination detection result. The classifier is trained by taking semantic feature samples and propagation feature samples as input and hallucination labels as output. It is understood that by pre-training the classifier using the aforementioned samples, the classifier can establish a mapping relationship between semantic features, propagation features, and hallucination classification. Through this classifier, hallucination detection can be performed on the large language model to obtain hallucination detection results.

[0040] In another implementation, the physical meaning of semantic and propagational features can be analyzed to detect hallucinations against a large language model. (See [link to relevant documentation]). Figure 2 Step S130 may include the following steps: Step S131: Detect the hallucination phenomenon of the large language model according to the semantic features to obtain a first hallucination detection result, wherein the first hallucination detection result indicates whether the large language model has a hallucination phenomenon or not.

[0041] Semantic features characterize the linguistic perplexity of the response to be verified. When the linguistic perplexity characterized by the semantic features is greater than a preset perplexity, it indicates that the perplexity of the semantic features is relatively high, and the accuracy of the response predicted by the large language model is lower. Therefore, the model exhibits a hallucination phenomenon, and a first hallucination detection result indicating that the large language model exhibits a hallucination phenomenon is obtained. Alternatively, when the linguistic perplexity characterized by the semantic features is less than or equal to the preset perplexity, it indicates that the perplexity of the semantic features is relatively low, and the accuracy of the response predicted by the large language model is higher. Therefore, the model does not exhibit a hallucination phenomenon, and a first hallucination detection result indicating that the large language model does not exhibit a hallucination phenomenon is obtained.

[0042] Step S132: Detect the hallucination phenomenon of the large language model according to the propagation characteristics to obtain a second hallucination detection result, wherein the second hallucination detection result indicates whether the large language model has a hallucination phenomenon or not.

[0043] The number of propagation features is multiple, and the variation amplitude of multiple propagation features is obtained. When the variation amplitude is greater than a preset amplitude, it indicates that the large language model changes the response direction during the prediction process, the model has low confidence, and the large language model has a low degree of certainty about the content of its predicted response. Therefore, a second hallucination detection result is obtained, indicating that the large language model exhibits hallucination phenomena. Alternatively, when the variation amplitude is less than or equal to the preset amplitude, it indicates that the large language model has high confidence during the prediction process and the large language model has a high degree of certainty about the content of its predicted response. Therefore, a second hallucination detection result is obtained, indicating that the large language model does not exhibit hallucination phenomena.

[0044] Step S133: Obtain the hallucination detection result based on the first hallucination detection result and the second hallucination detection result.

[0045] When at least one of the first hallucination detection results and the second hallucination detection result indicates that the large language model exhibits a hallucination phenomenon, a hallucination detection result indicating that the large language model exhibits a hallucination phenomenon is obtained. That is, a hallucination detection result indicating that the large language model exhibits a hallucination phenomenon is obtained in the following three cases: First case, the first hallucination detection result indicates that the large language model exhibits a hallucination phenomenon, and the second hallucination detection result indicates that the large language model does not exhibit a hallucination phenomenon; Second case, the second hallucination detection result indicates that the large language model exhibits a hallucination phenomenon, and the first hallucination detection result indicates that the large language model does not exhibit a hallucination phenomenon; Third case, both the first hallucination detection result and the second hallucination detection result indicate that the large language model exhibits a hallucination phenomenon.

[0046] Alternatively, when both the first hallucination detection result and the second hallucination detection result indicate that the large language model does not exhibit hallucination phenomena, a hallucination detection result indicating that the large language model does not exhibit hallucination phenomena is obtained.

[0047] Step S140: When the hallucination detection result indicates that the large language model has a hallucination phenomenon, output the preset response content.

[0048] When the hallucination detection results indicate that the large language model exhibits hallucination phenomena, directly outputting the response to be verified, which is inconsistent with the user's expected answer to the target question, may affect the user's trust in the large language model. Therefore, it is advisable to output a pre-set response. For example, the pre-set response could be, "Sorry, this is a knowledge gap; please give me some more time to learn~". Alternatively, the pre-set response can be displayed as text on the electronic device's screen. Another approach is to play the pre-set response through the electronic device's microphone.

[0049] Optionally, when the hallucination detection results indicate that the large language model has hallucination phenomena, prompt information can also be output as the basis for subsequent iterative training of the large language model. The prompt information can prompt backend personnel to improve the large language model and optimize it in a targeted manner.

[0050] Alternatively, if the hallucination detection results indicate that the large language model does not exhibit hallucination phenomena, it suggests that the content to be verified is strongly related to the user's target question and is the answer the user expects. In this case, the content to be verified from the large language model can be directly used as the output. One approach is to display the response as text on the electronic device's screen. Another approach is to output the response as speech through the electronic device's microphone.

[0051] The question-answering task processing method disclosed herein obtains the content of the response to be verified output by a large language model for a target question, obtains the semantic features of the response content to be verified, and obtains the propagation features between the network layers within the large language model; then, it detects the hallucination phenomenon of the large language model based on the semantic features and propagation features to obtain the hallucination detection result; when the hallucination detection result indicates that the large language model has a hallucination phenomenon, it outputs the preset response content instead of the response content to be verified that has a hallucination phenomenon. This disclosure combines the internal propagation features and the external semantic features to more comprehensively identify the hallucination phenomenon of the large language model, thereby improving the accuracy of hallucination phenomenon detection, avoiding the output of response content that is irrelevant to the user's target question, and increasing the user's trust in the large language model.

[0052] In one implementation, the large language model includes multiple sequentially connected network layers, and the number of propagation features is multiple. Step S120, obtaining the propagation features between network layers in the large language model, can be done as follows: obtaining propagation features from each of the multiple network layers of the large language model, thus obtaining multiple propagation features. It is understood that by obtaining propagation features from each network layer, and since the large language model has multiple network layers, multiple propagation features can be obtained.

[0053] Optionally, for each network layer in the large language model, the propagation features in each network layer are obtained as follows: Multiple intermediate propagation features are obtained from each network layer. Intermediate propagation features that meet preset conditions are determined from the multiple intermediate propagation features and used as the propagation features of that network layer. For example, a feature distance corresponding to each of the multiple intermediate propagation features is calculated using a distance metric function to obtain multiple feature distances. A preset number of target feature distances are selected from the multiple feature distances, wherein the target feature distance is greater than the remaining feature distances in the multiple feature distances excluding the target feature distance; the intermediate propagation feature corresponding to the target feature distance is determined as the propagation feature of that network layer.

[0054] Optionally, the distance metric function includes at least one of the following: JS (Jensen-Shannon divergence) distance function, cosine distance function, Euclidean distance function, and Manhattan distance function.

[0055] This embodiment selects some features from multiple network layers of a large language model as propagation features. When using propagation features for hallucination detection, the amount of data processing can be reduced and the efficiency of hallucination detection can be improved.

[0056] The semantic features corresponding to the aforementioned large language model are high-dimensional features, while the propagation features are low-dimensional features. For example, the semantic features are 3000 or 40000 dimensions, while the propagation features are 20 dimensions. If the high-dimensional semantic features are directly concatenated with the low-dimensional propagation features, the low-dimensional propagation features may be submerged in the high-dimensional semantic features, resulting in the propagation features contributing nothing in the hallucination recognition process. Therefore, in this disclosure, the high-dimensional semantic features can be reduced in dimensionality before being concatenated with the low-dimensional propagation features. The question-answering task processing method can further include: reducing the dimensionality of the high-dimensional semantic features to obtain the reduced-dimensional semantic features. For example, Principal Component Analysis (PCA) can be used to reduce the dimensionality of the high-dimensional semantic features to obtain the reduced-dimensional semantic features. While preserving as much information as possible in the semantic features, the semantic features are reduced from n dimensions to k dimensions, where n is greater than k, and k is a hyperparameter.

[0057] Based on this, in one implementation, step S130 may be as follows: concatenating the dimensionality-reduced semantic features and the low-dimensional propagation features to obtain concatenated features; detecting the hallucination phenomenon of the large language model based on the concatenated features to obtain the hallucination detection result.

[0058] This embodiment performs dimensionality reduction processing on high-dimensional semantic features. On the one hand, it can remove noise that may be contained in high-dimensional semantic features. On the other hand, it can reduce the dimensionality of semantic features, thereby avoiding the low-dimensional propagation features being submerged by high-dimensional semantic features and affecting the effect of hallucination detection.

[0059] For example, taking a large language model as an example, the Transformer model can be applied to tasks including text translation, speech recognition, and text generation. This model includes N sequentially arranged network layers. This disclosure provides a question-answering task processing method; please refer to [link / reference]. Figure 3 The method includes the following steps: Semantic feature A is obtained from the last network layer of the large language model, i.e., the output layer of the large language model. Semantic feature A is a vector corresponding to the content of the response to be verified output by the large language model based on the target question, and it is a high-dimensional vector. The high-dimensional semantic feature A is then subjected to dimensionality reduction processing to obtain the dimensionality-reduced semantic feature B.

[0060] Furthermore, by obtaining the propagation features corresponding to each network layer within the large language model, multiple propagation features E can be obtained. The JS distance function is used to obtain the JS distance corresponding to each of the multiple intermediate propagation features E. A predetermined number of top-k JS distances are selected from these multiple JS distances as target JS distances, where the target JS distance is larger than all other JS distances except the target JS distance. The intermediate propagation features corresponding to the target JS distances are then determined as propagation features F1. The top-k values ​​represent the hyperparameters of the large language model.

[0061] The cosine distance is obtained for each propagation feature E among multiple intermediate propagation features E using the cosine distance function. A predetermined number of top-k cosine distances are selected as target cosine distances, where each target cosine distance is larger than all other cosine distances except the target cosine distance. The intermediate propagation feature corresponding to the target cosine distance is then determined as propagation feature F2.

[0062] The Euclidean distance is obtained for each propagation feature E among multiple intermediate propagation features E using the Euclidean distance function. A predetermined number of top-k Euclidean distances are selected as target Euclidean distances, where each target Euclidean distance is larger than all other Euclidean distances except the target Euclidean distance. The intermediate propagation feature corresponding to the target Euclidean distance is then determined as propagation feature F3.

[0063] The Manhattan distance is obtained for each propagation feature E among multiple intermediate propagation features E using the Manhattan distance function. A predetermined number of top-k Manhattan distances are selected as target Manhattan distances, where each target Manhattan distance is larger than all other Manhattan distances except the target Manhattan distance. The intermediate propagation feature corresponding to the target Manhattan distance is then determined as propagation feature F4.

[0064] Propagation features F1, F2, F3, and F4 are identified as propagation features.

[0065] Based on the dimensionality-reduced semantic features B and propagation features, classification is performed using classifier C, and the hallucination detection result D represents whether the large language model exhibits or does not exhibit hallucination phenomena. Optionally, the classifier in this embodiment can be any of the following: feedforward neural network, LR (Logistic Regression) model, SVM (Support Vector Machine) model, maximum entropy model; the classifier can also be a deep learning model, such as RNN (Recurrent Neural Network), LSTM (Long Short-Term Memory), CNN (Convolutional Neural Network), or a model based on the transformer architecture.

[0066] When the hallucination detection result D indicates that the large language model has hallucination phenomena, the model outputs the response to be verified, which is not what the user expects, so it outputs the preset response.

[0067] The question-answering task processing method provided in this embodiment introduces propagation features within the model, building upon the semantic features output by the model. This combination of internal and external features enhances the accuracy of hallucination detection. Furthermore, since the propagation features are internal to the model, they do not require waiting for the large language model to output all results. Therefore, hallucination detection can be performed while the model is generating the content to be verified.

[0068] Based on the same inventive concept, this disclosure provides a question-and-answer task processing device. Please refer to [link / reference]. Figure 4 The question-and-answer task processing device 200 includes: The response module 210 is configured to obtain the response content to be verified output by the large language model for the target question; The acquisition module 220 is configured to acquire the semantic features of the content of the response to be verified, and to acquire the propagation features between network layers in the large language model; The hallucination detection module 230 is configured to detect hallucination phenomena in the large language model based on the semantic features and the propagation features, and obtain hallucination detection results; The output module 240 is configured to output a preset response when the hallucination detection result indicates that the large language model has a hallucination phenomenon.

[0069] Optionally, the question-answering task processing device 200 further includes: The dimensionality reduction module is configured to perform dimensionality reduction processing on the high-dimensional semantic features to obtain the dimensionality-reduced semantic features; The hallucination detection module 230 includes: The splicing module is configured to splice the dimensionality-reduced semantic features and the low-dimensional propagation features to obtain spliced ​​features; The first hallucination detection module is configured to detect hallucination phenomena in the large language model based on the splicing features, and obtain the hallucination detection result.

[0070] Optionally, the large language model includes multiple sequentially connected network layers, and the number of propagation features is multiple. The acquisition module 220 further includes: The propagation feature acquisition module is configured to acquire propagation features from each of the multiple network layers of the large language model, thereby obtaining multiple propagation features.

[0071] Optionally, the propagation feature acquisition module includes: The intermediate propagation feature acquisition module is configured to acquire multiple intermediate propagation features from each of the network layers; The propagation feature acquisition submodule is configured to determine intermediate propagation features that meet preset conditions from the plurality of intermediate propagation features, and use them as the propagation features of the network layer.

[0072] Optionally, the propagation feature acquisition submodule includes: The feature distance acquisition module is configured to calculate the feature distance corresponding to each intermediate propagation feature among the multiple intermediate propagation features using a distance metric function, thereby obtaining multiple feature distances; The target feature distance acquisition module is configured to select a preset number of target feature distances from the plurality of feature distances, wherein the target feature distances are greater than the other feature distances among the plurality of feature distances excluding the target feature distances; The propagation feature determination module is configured to determine the intermediate propagation feature corresponding to the target feature distance as the propagation feature of the network layer.

[0073] Optionally, the distance metric function includes at least one of the following: JS distance function, cosine distance function, Euclidean distance function, and Manhattan distance function.

[0074] Optionally, the hallucination detection module 230 includes: The second hallucination detection module is configured to detect hallucination phenomena in the large language model based on the semantic features and the propagation features using a classifier, and obtain the hallucination detection result; wherein the classifier is trained by taking semantic feature samples and propagation feature samples as input and hallucination labels as output.

[0075] Optionally, the hallucination detection module 230 includes: The third hallucination detection module is configured to detect hallucination phenomena of the large language model based on the semantic features and obtain a first hallucination detection result, wherein the first hallucination detection result indicates whether the large language model has hallucination phenomena or not. The fourth hallucination detection module is configured to detect hallucination phenomena in the large language model based on the propagation characteristics and obtain a second hallucination detection result, wherein the second hallucination detection result indicates whether the large language model has hallucination phenomena or not. The fifth hallucination detection module is configured to obtain the hallucination detection result based on the first hallucination detection result and the second hallucination detection result.

[0076] Optionally, the fourth hallucination detection module is further configured to obtain a hallucination detection result indicating that the large language model has a hallucination when at least one of the first hallucination detection result and the second hallucination detection result indicates that the large language model has a hallucination; or to obtain a hallucination detection result indicating that the large language model does not have a hallucination when both the first hallucination detection result and the second hallucination detection result indicate that the large language model does not have a hallucination.

[0077] Optionally, the semantic features characterize the language perplexity of the response content to be verified. The third hallucination detection module is further configured to obtain a first hallucination detection result indicating that the large language model has a hallucination phenomenon when the language perplexity represented by the semantic features is greater than a preset perplexity; and to obtain a first hallucination detection result indicating that the large language model does not have a hallucination phenomenon when the language perplexity represented by the semantic features is less than or equal to the preset perplexity.

[0078] Optionally, the fourth hallucination detection module is further configured to acquire the variation amplitude of multiple propagation features; when the variation amplitude is greater than a preset amplitude, a second hallucination detection result is obtained that indicates the existence of hallucination in the large language model; when the variation amplitude is less than or equal to the preset amplitude, a second hallucination detection result is obtained that indicates the absence of hallucination in the large language model.

[0079] Regarding the question-and-answer task processing device 200 in the above embodiments, the specific methods by which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated here.

[0080] This disclosure also provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the steps of the question-and-answer task processing method provided in this disclosure.

[0081] Figure 5 This is a block diagram illustrating an electronic device for a question-answering task processing method according to an exemplary embodiment. For example, the electronic device 800 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.

[0082] Please refer to Figure 5 The electronic device 800 may include one or more of the following components: processing component 802, memory 804, power supply component 806, multimedia component 808, audio component 810, input / output interface 812, sensor component 814, and communication component 816.

[0083] Processing component 802 typically controls the overall operation of electronic device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.

[0084] Memory 804 is configured to store various types of data to support the operation of electronic device 800. Examples of such data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0085] Power supply component 806 provides power to various components of electronic device 800. Power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800.

[0086] Multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0087] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when electronic device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.

[0088] Input / output interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0089] Sensor assembly 814 includes one or more sensors for providing state assessments of various aspects of electronic device 800. For example, sensor assembly 814 can detect the on / off state of electronic device 800, the relative positioning of components such as the display and keypad of electronic device 800, changes in position of electronic device 800 or a component of electronic device 800, the presence or absence of user contact with electronic device 800, orientation or acceleration / deceleration of electronic device 800, and temperature changes of electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.

[0090] Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices. Electronic device 800 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0091] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.

[0092] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by a processor 820 of an electronic device 800 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0093] In another exemplary embodiment, a computer program product is also provided, the computer program product comprising a computer program executable by a programmable device, the computer program having a code portion for performing the question-and-answer task processing method described above when executed by the programmable device.

[0094] Those skilled in the art will also understand that the various illustrative logical blocks and steps listed in the embodiments of this application can be implemented by electronic hardware, computer software, or a combination of both. Whether such functionality is implemented through hardware or software depends on the specific application and the overall system design requirements. Those skilled in the art can implement the described functionality using various methods for each specific application, but such implementation should not be construed as exceeding the scope of protection of the embodiments of this application.

[0095] Furthermore, the term “exemplary” is used herein to mean serving as an example, instance, or illustration. Any aspect or design described herein as “exemplary” is not necessarily to be construed as advantageous compared to other aspects or designs. Rather, the use of the term “exemplary” is intended to present the concept in a concrete manner. As used herein, the term “or” is intended to mean an inclusive “or” rather than an exclusive “or.” That is, unless otherwise specified or clear from the context, “X applies A or B” is intended to mean any of the natural inclusive arrangements. That is, “X applies A or B” satisfies any of the foregoing instances if X applies A; X applies B; or both X applies A and B. Additionally, unless otherwise specified or clear from the context to refer to the singular form, the articles “a” and “an” as used in this application and the appended claims are generally understood to mean “one or more.”

[0096] Similarly, although this disclosure has been shown and described with respect to one or more implementations, equivalent variations and modifications will occur to those skilled in the art upon reading and understanding this specification and the accompanying drawings. This disclosure includes all such modifications and variations and is limited only by the scope of the claims. In particular, with respect to the various functions performed by the components described above (e.g., elements, resources, etc.), unless otherwise indicated, the terminology used to describe such components is intended to correspond to any component (functionally equivalent) that performs the specific function of the described component, even if structurally not equivalent to the disclosed structure. Furthermore, although specific features of this disclosure may have been disclosed with respect to only one of several implementations, such features may be combined with one or more other features of other implementations, as may be desired and advantageous to any given or particular application. Moreover, with regard to the terms “comprising,” “owning,” “having,” “having,” or variations thereof as used in the detailed description or claims, such terms are intended to be inclusive in a manner similar to the term “including.”

[0097] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.

[0098] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A question-answering task processing method, characterized in that, The method includes: Obtain the output of the large language model for the target question, which is to be verified. Obtain the semantic features of the response content to be verified, and obtain the propagation features between network layers in the large language model; The hallucination phenomenon of the large language model is detected based on the semantic features and the propagation features to obtain hallucination detection results; When the hallucination detection result indicates that the large language model exhibits hallucination phenomena, a preset response is output.

2. The method according to claim 1, characterized in that, The method further includes: The high-dimensional semantic features are subjected to dimensionality reduction processing to obtain the dimensionality-reduced semantic features; The step of detecting hallucination phenomena in the large language model based on the semantic features and the propagation features to obtain hallucination detection results includes: The reduced semantic features and the low-dimensional propagation features are concatenated to obtain concatenated features; The hallucination phenomenon of the large language model is detected based on the splicing features to obtain the hallucination detection result.

3. The method according to claim 1, characterized in that, The large language model comprises multiple sequentially connected network layers, and the number of propagation features is multiple. Obtaining the propagation features between network layers in the large language model includes: Propagation features are obtained from each of the multiple network layers of the large language model, resulting in multiple propagation features.

4. The method according to claim 3, characterized in that, The propagation features in each network layer are obtained as follows: Multiple intermediate propagation features are obtained from each of the network layers; From the plurality of intermediate propagation features, intermediate propagation features that meet preset conditions are determined as the propagation features of the network layer.

5. The method according to claim 4, characterized in that, The step of determining intermediate propagation features that meet preset conditions from the plurality of intermediate propagation features as the propagation features of the network layer includes: The feature distance is calculated for each intermediate propagation feature among the multiple intermediate propagation features using a distance metric function, thereby obtaining multiple feature distances; A preset number of target feature distances are selected from the plurality of feature distances, wherein the target feature distances are greater than the other feature distances among the plurality of feature distances excluding the target feature distances; The intermediate propagation features corresponding to the target feature distance are determined as the propagation features of this network layer.

6. The method according to claim 5, characterized in that, The distance metric function includes at least one of the following: JS distance function, cosine distance function, Euclidean distance function, and Manhattan distance function.

7. The method according to any one of claims 1 to 6, characterized in that, The step of detecting hallucination phenomena in the large language model based on the semantic features and the propagation features to obtain hallucination detection results includes: Based on the semantic features and the propagation features, a classifier is used to detect hallucination phenomena in the large language model to obtain the hallucination detection results; wherein, the classifier is trained by taking semantic feature samples and propagation feature samples as input and hallucination labels as output.

8. The method according to any one of claims 1 to 6, characterized in that, The step of detecting hallucination phenomena in the large language model based on the semantic features and the propagation features to obtain hallucination detection results includes: The hallucination phenomenon of the large language model is detected based on the semantic features to obtain a first hallucination detection result, wherein the first hallucination detection result indicates whether the large language model has a hallucination phenomenon or not. The hallucination phenomenon of the large language model is detected based on the propagation characteristics to obtain a second hallucination detection result, wherein the second hallucination detection result indicates whether the large language model has a hallucination phenomenon or not. The hallucination detection result is obtained based on the first hallucination detection result and the second hallucination detection result.

9. The method according to claim 8, characterized in that, The step of obtaining the hallucination detection result based on the first hallucination detection result and the second hallucination detection result includes: When at least one of the first hallucination detection results and the second hallucination detection results indicates that the large language model has a hallucination phenomenon, a hallucination detection result indicating that the large language model has a hallucination phenomenon is obtained; Alternatively, when both the first hallucination detection result and the second hallucination detection result indicate that the large language model does not exhibit hallucination phenomena, a hallucination detection result indicating that the large language model does not exhibit hallucination phenomena is obtained.

10. The method according to claim 9, characterized in that, The semantic features characterize the linguistic perplexity of the response to be verified. The detection of hallucination phenomena in the large language model based on the semantic features to obtain a first hallucination detection result includes: When the language perplexity represented by the semantic features is greater than the preset perplexity, a first hallucination detection result is obtained, which indicates that the large language model has a hallucination phenomenon. When the language perplexity represented by the semantic features is less than or equal to the preset perplexity, a first hallucination detection result is obtained, indicating that the large language model does not exhibit hallucination phenomena.

11. The method according to claim 9, characterized in that, The number of propagation features is multiple, and the detection of hallucination phenomena in the large language model based on the propagation features to obtain a second hallucination detection result includes: Obtain the magnitude of change of multiple propagation characteristics; When the change amplitude is greater than the preset amplitude, a second hallucination detection result is obtained, which characterizes the hallucination phenomenon in the large language model. When the change amplitude is less than or equal to the preset amplitude, a second hallucination detection result is obtained, indicating that the large language model does not exhibit hallucination phenomena.

12. A question-and-answer task processing device, characterized in that, The device includes: The response module is configured to retrieve the response content to be verified output by the large language model for the target question; The acquisition module is configured to acquire the semantic features of the response content to be verified, and to acquire the propagation features between network layers in the large language model; The hallucination detection module is configured to detect hallucination phenomena in the large language model based on the semantic features and the propagation features, and obtain hallucination detection results; The output module is configured to output a preset response when the hallucination detection result indicates that the large language model has a hallucination phenomenon.

13. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to implement the steps of the method according to any one of claims 1 to 11 when executing the instruction.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method described in any one of claims 1 to 11.

15. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.