Methods, apparatus, equipment, and media for output error detection in large language models
By dividing the generation process of a large language model into multiple inference stages and utilizing the state features of different model structure layers to detect output information, the problem of inconsistent content generated by machine learning models is solved, and real-time and reliable error detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2026-03-10
AI Technical Summary
Machine learning models may generate content that is inconsistent with the facts, affecting its credibility and applicability. Existing detection solutions are difficult to meet the requirements of real-time performance and credibility.
By dividing the generation process of a large language model into multiple inference stages, the state features of each stage are determined using different model structure layers. Then, by combining attention information, layer representation features, and the generation probability of target words, error detection of the output information is performed.
It improves the interpretability and reliability of output information detection, realizes real-time error detection, and enhances the accuracy and adaptability of detection results.
Smart Images

Figure CN120338103B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Example embodiments of the present disclosure generally relate to the field of computers, and in particular, to a method, apparatus, device, computer-readable storage medium, and program product for output error detection of large language models. BACKGROUND
[0002] Machine learning models (e.g., large language models) have been widely applied in the field of natural language processing, including text generation, translation, question answering, and other tasks. However, in the process of generating content using machine learning models, the machine learning models can have “hallucinations”, i.e., the generated content of the machine learning models is inconsistent with the facts. This situation affects the credibility and applicability of the machine learning models. SUMMARY
[0003] In a first aspect of the present disclosure, a method for output error detection of a large language model is provided. The method includes: generating, based on prompt information, output information using a large language model, the generation of the output information by the large language model including a plurality of reasoning stages, wherein the plurality of reasoning stages are respectively performed by different model structure layers of the large language model; for each of at least one of the plurality of reasoning stages, determining a state feature of the reasoning stage based on processing data of the large language model in the reasoning stage and the model structure layer corresponding to the reasoning stage, to obtain at least one state feature corresponding to the at least one reasoning stage, respectively; and determining, based on the at least one state feature, a detection result about whether there is an error in the output information.
[0004] In a second aspect of the present disclosure, an apparatus for output error detection of a large language model is provided. The apparatus includes: a generation module configured to generate, based on prompt information, output information using a large language model, the generation of the output information by the large language model including a plurality of reasoning stages, wherein the plurality of reasoning stages are respectively performed by different model structure layers of the large language model; a first determination module configured to, for each of at least one of the plurality of reasoning stages, determine a state feature of the reasoning stage based on processing data of the large language model in the reasoning stage and the model structure layer corresponding to the reasoning stage, to obtain at least one state feature corresponding to the at least one reasoning stage, respectively; and a second determination module configured to determine, based on the at least one state feature, a detection result about whether there is an error in the output information.
[0005] In a third aspect of the present disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit. The instructions, when executed by the at least one processing unit, cause the device to perform the method of the first aspect.
[0006] In a fourth aspect of the disclosure, a computer-readable storage medium is provided. The computer-readable storage medium has stored thereon a computer program, the computer program being executable by a processor to implement the method of the first aspect.
[0007] In a fifth aspect of the disclosure, a computer program product is provided, the program product comprising a computer program, the computer program being executable by a processor to implement the method of the first aspect.
[0008] It should be understood that the contents described in this section are not intended to limit the key features or important features of the embodiments of the disclosure, nor are they intended to limit the scope of the disclosure. Other features of the disclosure will become apparent through the following description. BRIEF DESCRIPTION OF DRAWINGS
[0009] The above and other features, advantages, and aspects of embodiments of the disclosure will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings in which:
[0010] Figure 1 A schematic diagram showing an example environment in which embodiments according to the disclosure can be implemented is shown;
[0011] Figure 2 A schematic diagram showing an example architecture for determining output information according to embodiments of the disclosure is shown;
[0012] Figure 3 A schematic diagram showing an example architecture for determining state features according to embodiments of the disclosure is shown;
[0013] Figure 4 A schematic diagram showing a target label according to embodiments of the disclosure is shown;
[0014] Figure 5 A flowchart showing an example process for output error detection for large language models according to some embodiments of the disclosure is shown;
[0015] Figure 6 A schematic structural block diagram of an example apparatus for output error detection for large language models according to some embodiments of the disclosure is shown; and
[0016] Figure 7 A block diagram of an electronic device capable of implementing a number of embodiments of the disclosure is shown. DETAILED DESCRIPTION
[0017] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be implemented in various forms and should not be interpreted as being limited to the embodiments set forth herein, but rather, these embodiments are provided so as to more completely and thoroughly understand the present disclosure. It is understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and do not limit the scope of protection of the present disclosure.
[0018] In the description of embodiments of the present disclosure, the term "comprising" and its conjugations should be understood as open-ended, i.e., "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "an embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit or implicit definitions can also be included below.
[0019] In this document, unless explicitly stated, performing a step "in response to A" does not mean performing the step immediately after A, but can include one or more intermediate steps.
[0020] It can be understood that the data involved in the technical solutions of the present disclosure (including but not limited to the data itself, obtaining, using, storing or deleting of the data) should comply with the requirements of relevant laws and regulations and relevant provisions.
[0021] It can be understood that before using the technical solutions disclosed in the embodiments of the present disclosure, the type of personal information involved in the present disclosure, the scope of use, the scene of use, etc. should be informed to the user and the authorization of the user should be obtained through appropriate means according to relevant laws and regulations.
[0022] For example, in response to receiving the active request of the user, a prompt information is sent to the user to explicitly prompt the user that the operation requested to be performed will require obtaining and using the personal information of the user, so that the user can voluntarily choose whether to provide the personal information to the software or hardware such as electronic device, application program, server or storage medium, etc. performing the operation of the technical solutions of the present disclosure according to the prompt information.
[0023] As an optional but non-limiting implementation manner, in response to receiving the active request of the user, the manner of sending the prompt information to the user can be, for example, the manner of pop-up window, and the prompt information can be presented in the form of text in the pop-up window. In addition, the pop-up window can also carry selection controls for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0024] It can be understood that the above notification and user authorization process is only illustrative and does not limit the implementation manner of the present disclosure, and other manners meeting the relevant laws and regulations can also be applied to the implementation manner of the present disclosure.
[0025] As used in this paper, the term "model" refers to a system that learns the relationship between inputs and outputs from training data, enabling it to generate corresponding outputs for a given input after training. Model generation can be based on machine learning techniques. Deep learning is a machine learning algorithm that uses multiple layers of processing units to process inputs and provide corresponding outputs. In this paper, "model" may also be referred to as a "machine learning model," a "machine learning network," or simply a "network," and these terms are used interchangeably. A model can also include different types of processing units or networks.
[0026] Example Environment
[0027] Figure 1 A schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented is shown. For example... Figure 1 As shown, environment 100 may include electronic device 120, with which a user can interact. During the interaction, input information 110 indicative of user needs may be provided to electronic device 120. Electronic device 120 may provide the input information 110 to Large Language Model (LLM) 130, which then generates output information 140 (such as text or an image) corresponding to the input information 110.
[0028] The large language model 130 can be a model constructed based on different types of model structure layers. The large language model used can be a content-generating model capable of generating corresponding outputs based on model inputs. In some embodiments, the large language model 130 can process text-modal model inputs (e.g., natural language and / or machine language). In some embodiments, the large language model 130 can have multimodal multiprocessing capabilities, capable of processing text-modal model inputs and / or non-text-modal model inputs (e.g., images, speech, video, etc.). The large language model 130 can generate the desired output based on the model input and prompt words. The prompt words here are used to guide the large language model 130 to address the user's needs indicated by the model input. In application scenarios supporting user dialogue, input information 110 can be provided to the large language model 130 as at least a part of the model input (other parts may include prompt words). This user input is treated as a question. Based on the model output, a corresponding response can be generated and provided to the user.
[0029] exist Figure 1In this context, electronic device 120 may include any computing system with computing capabilities, such as various computing devices / systems, terminal devices, servers, etc. Terminal devices may be any type of mobile terminal, fixed terminal, or portable terminal, including mobile phones, desktop computers, laptop computers, notebook computers, netbook computers, tablet computers, media computers, multimedia tablets, handheld computers, portable gaming terminals, VR / AR devices, personal communication system (PCS) devices, personal navigation devices, personal digital assistants (PDAs), audio / video players, digital cameras / camcorders, positioning devices, television receivers, radio receivers, e-book devices, gaming devices, or any combination of the foregoing, including accessories and peripherals of these devices or any combination thereof. In some embodiments, electronic device 120 may also support any type of user-facing interface (such as "wearable" circuitry).
[0030] It should be understood that Figure 1 The components and arrangements shown in environment 100 are merely examples, and a computing system suitable for implementing the exemplary implementations described in this disclosure may include one or more different components, other components, and / or different arrangements. Implementations of this disclosure are not limited in this respect.
[0031] The following description will continue with reference to the accompanying drawings, which will provide some exemplary embodiments of this disclosure.
[0032] As mentioned earlier, in the process of generating content using a large language model, there may be discrepancies between the generated content and the facts, affecting the reliability of the content generated by the large language model.
[0033] Typically, the accuracy of generated content is determined by examining the content generated by a large language model. For example, reference information corresponding to the user-provided input can be identified from a knowledge base. The accuracy of the generated content is determined based on the degree of matching between the large language model's generated content and the reference information. Multiple versions of generated content can be generated for the same input information using the large language model. The accuracy of the generated content is determined based on the consistency between the multiple versions. Furthermore, control prompts can be added to the input information; for example, the large language model can be required to explicitly state the basis or credibility of the generated content, thereby determining the accuracy of the generated content.
[0034] However, most of the aforementioned methods for determining the accuracy of generated content require post-processing of the generated content, making it difficult to meet real-time requirements. These methods can only determine the detection results for the accuracy of the generated content, but cannot provide the basis for the detection results, resulting in low reliability of the detection results.
[0035] This disclosure proposes a scheme for output error detection using a large language model. According to various embodiments of this disclosure, output information is generated using a large language model based on cue word information. The generation of output information by the large language model includes multiple inference stages, each executed by a different model structure layer of the large language model. For each of at least one of the multiple inference stages, based on the processed data of the large language model at that inference stage and the corresponding model structure layer, a state feature of that inference stage is determined to obtain at least one state feature corresponding to each of the at least one inference stage. Based on the at least one state feature, a detection result regarding the presence of an error in the output information is determined.
[0036] As can be seen, the embodiments of this disclosure determine the state characteristics of each inference stage based on the processing data of the large language model at each inference stage and the corresponding model structure layer. Based on the state characteristics of each inference stage, it is determined whether the output information contains errors, i.e., whether there is an "illusion." In this way, on the one hand, the state characteristics of the large language model at each stage are determined based on the processing data of each inference stage, improving the interpretability of the detection process and thus increasing the credibility of the detection results. On the other hand, during the generation of output information by the large language model, the accuracy of the output information is determined using the processing data of each processing stage, eliminating the need for post-processing of the output information and improving the real-time performance of the detection.
[0037] The following section provides a detailed description of various example implementations of this scheme, with reference to the accompanying drawings.
[0038] Example Process
[0039] Figure 2 A schematic diagram of an example architecture 200 for determining output information according to some embodiments of the present disclosure is shown. Figure 2 As shown, architecture 200 can be implemented or included in electronic device 120.
[0040] In some embodiments, the electronic device 120 generates output information 140 based on the prompt word information 210 using the large language model 130. In some embodiments, the prompt word information can be determined based on user-provided input information 110, or based on user-provided input information and system prompt words for the large language model 130. First, the prompt word information 210 is encoded to obtain one or more input lexical units 220. Then, the electronic device 120 provides one or more input lexical units 220 to the large language model 130 to generate output information 140 corresponding to the input information 110. For example, the prompt word information could be "The capital of A country is". By preprocessing the prompt word information, the corresponding embedded representation is obtained.
[0041] The process of generating output information by the large language model 130 may include multiple inference stages. These multiple inference stages are executed by different model structure layers of the large language model. In some embodiments, the multiple inference stages may be determined based on the logic of the inference task. For example, the multiple inference stages may include a problem understanding and decomposition stage for breaking down a complex task into multiple sub-tasks, an intermediate inference and knowledge retrieval stage for inference or retrieval for each sub-task, and a result integration and output stage for integrating output information. In some embodiments, the multiple inference stages may be determined based on task complexity. For example, the multiple inference stages may include a preliminary inference stage for processing the simpler parts of the task, a deep inference stage for processing the more complex parts of the task, and a result optimization stage for optimizing the generated results. In some embodiments, the multiple inference stages may be determined based on inference functions. For example, the multiple inference stages may include an understanding stage 230 for understanding the premises and background information of the input, a query stage 240 for inference or retrieval based on known premises, and a generation stage 250 for generating output information. In this embodiment, the process of generating output information by the large language model 130 is mainly illustrated using the understanding stage 230, the query stage 240, and the generation stage 250 as examples.
[0042] like Figure 2 As shown, the large language model 130 may include a first processing block 131-1, a second processing block 131-2, and a third processing block 131-3, which may be referred to individually or collectively as processing block 131. Figure 2 The number of processing blocks 131 shown is merely exemplary and is not intended to be any limitation. Figure 3 A schematic diagram of an example architecture 300 for determining state characteristics according to embodiments of the present disclosure is shown. Figure 3As shown, each processing block 131 includes multiple model structure layers based on an attention mechanism (such as normalization layers, attention layers, and residual connection layers) corresponding to the understanding phase 230 and a model structure layer including at least one feedforward neural network (such as normalization layers, multilayer perceptron layers, activation functions, dropout layers, and residual connection layers) corresponding to the query phase 240. In some embodiments, activation function layers (e.g., softmax layers) may be added to at least some processing blocks in processing block 131 to obtain the state features of the generation phase 250.
[0043] In some embodiments, for each of at least one of a plurality of reasoning stages, the electronic device 120 may determine the state features of that reasoning stage based on the processing data of the large language model at that reasoning stage, so as to obtain at least one state feature corresponding to at least one reasoning stage. The electronic device 120 may determine the corresponding state features based on one or more target tokens output by the large language model 130.
[0044] In some embodiments, a sliding window can be used to select multiple target words from all words output by the large language model 130, and state features for each inference stage can be determined based on the features corresponding to the multiple target words. For example, the length of the sliding window can be a predetermined number of words. The sliding window divides the multiple target words included in the output information into multiple groups of target words. Subsequently, state features are determined based on each group of target words. This is a window-based detection method. Figure 4 A schematic diagram of target lexical units according to some embodiments of the present disclosure is shown. For example... Figure 4As shown, if the output information 140 of the large language model 130 is "the capital of A country is B city, located besides CDEriver.", the target word units 410 output by the large language model 130 include "the", "cap", "ital", "of", "A", "country", "is", "B", "city", ",", "loc", "ated", "bes", "ides", "C", "D", "E", "riv", "er", and ".". If the sliding window 420 has a length of 4 and a step size of 2, multiple sets of target word units can be determined using the sliding window 420. These multiple sets of target word units include the first set of target word units 430-1 (i.e., "the capital ital of"), the second set of target word units 430-2 (i.e., "ital of A country"), and the third set of target word units 430-3 (i.e., "A country is B"). In some embodiments, each of all word units output by the large language model 130 can be used as a target word unit, and the state features of each inference stage can be determined based on the features corresponding to that target word unit. This is a word-by-word detection method. In some embodiments, all the lexical units output by the large language model 130 can be used as target lexical units to determine the state features of each reasoning stage based on the features corresponding to all lexical units.
[0045] In some embodiments, the input lexical units and the embedding representation 310-1 corresponding to the already generated target lexical units can be provided to the model structure layer corresponding to the understanding stage 230 to generate the next target lexical unit. The understanding stage 230 is configured to extract semantic relationships between different lexical units. To this end, the model structure layer corresponding to the understanding stage 230 may include at least one layer (also called an attention layer) based on an attention mechanism (e.g., a self-attention mechanism or a cross-attention mechanism). In some embodiments, in addition to the attention layer, the model structure layer corresponding to the understanding stage 230 may also include other types of layers for preprocessing the input of the attention layer or postprocessing the output of the attention layer. For example, the model structure layer corresponding to the understanding stage 230 may also include a normalization layer, a residual connection layer, etc.
[0046] In some embodiments, the state features of the large language model 130 in the understanding stage 230 can be determined based on the attention information generated by the large language model 130 in the understanding stage 230. For example, the state features of the understanding stage 230 can be determined based on the corresponding weights of the input word 220 and the target word 260 in the process of generating a target word by the large language model 130.
[0047] Continue to refer to Figure 3In some embodiments, the large language model 130 can be an autoregressive model. For a set of target words determined by a sliding window, the electronic device 120 first determines second weights 310-2 for different words in the process of generating a target word (e.g., a first target word) within that set. For example, if the target word is "country", the weights for "the", "cap", "ital", "of", and "A" can be 0.07, 0.35, 0.3, 0.8, and 0.2, respectively. Subsequently, the electronic device 120 can determine the attentional differences allocated between different words in the process of generating the first target word based on the corresponding weights of the input word 220 and the target word 260 in generating the first target word. Then, the entropy of the attention distribution is determined based on the allocated attentional differences, thereby evaluating the degree of concentration (i.e., sharpness of attention allocation) of the attention allocated by the large language model 130 based on the entropy of the attention distribution. A lower entropy of the attention distribution indicates that the large language model 130 focuses more on a smaller number of words. Subsequently, at least a portion of the state features of the understanding stage 230 are determined based on the attention differences corresponding to the first target word.
[0048] In some embodiments, the electronic device 120 may determine a first attention metric for generating the first target word on the cue word information based on the sum of the corresponding weights of the input word 220 in the process of generating a target word (e.g., a first target word). Subsequently, a second attention metric for generating the first target word on the model input is determined based on the sum of the corresponding weights of the input word 220 and multiple target words generated before the first target word in the process of generating the first target word. Based on the relative relationship between the first and second attention metrics (e.g., the ratio or difference between the first and second attention metrics), at least a portion of the state features of the understanding stage 230 (i.e., the attention revisit ratio) is determined. The attention revisit ratio can be used to quantify the degree of attention the large language model 130 pays to historical context. For example, if the input word 220 includes “where is the capital of A country?”, the output of the large language model 130 could be “the capital of A country is B city”. If the first target lexical unit is "capital", it is generated by the large language model 130 based on the input lexical unit 220 and the target lexical unit 260 generated before "capital" (i.e., "where is the capital of A country? the"). Subsequently, based on the ratio of the sum of weights corresponding to the input lexical unit 220 "where is the capital of A country?" to the sum of weights corresponding to "where is the capital of A country? the", at least a portion of the state features of the understanding stage 230 is determined. In this way, by calculating the attention percentage of each lexical unit in the input lexical unit 220 and the preceding target lexical unit during the generation of a target lexical unit, the degree of attention paid to the context by the large language model is quantified.
[0049] In some embodiments, for multiple target words determined by the sliding window, state features of the understanding stage 230 can be determined based on state features corresponding to each of the multiple target words. In this way, multiple sets of target words are selected by the sliding window to improve the coverage of the context by the state features, while reducing the impact of noise on the state features.
[0050] The data generated in the understanding phase 230 is provided to the model structure layer of the query phase 240. The query phase 240 can be configured to extract semantic features of lexical units. For this purpose, the query phase 240 may include at least one feedforward neural network. Exemplarily, the feedforward neural network may include a normalization layer, a multilayer perceptron, an activation function layer, a dropout layer, and a residual connection layer. In some embodiments, the state features of the large language model 130 in the query phase 240 may be determined based on the information generated by the large language model 130 in the query phase 240. Exemplarily, the state features of the query phase 240 may be determined based on the feature identifiers generated by the large language model 130 during the generation of a target lexical unit (e.g., a second target lexical unit).
[0051] For the multiple model structure layers included in the query phase 240, the contextual representation capability of different model structure layers can be determined based on the representation matrix corresponding to each model structure layer. In some embodiments, the electronic device 120 can determine the layer representation information generated by the large language model 130 in the query phase 240. The layer representation information includes the corresponding feature identifiers 310-3 generated by the multiple feature extraction layers of the query phase 240 in generating the second target lexical. For example, the second target lexical can be "country". To generate this lexical, the lexical input to the model are "the", "cap", "ital", "of", and "A", with corresponding layer representation information of 0.07, 0.35, 0.3, 0.8, and 0.2, respectively. Subsequently, based on the corresponding feature representations corresponding to the second target lexical, the state features of the query phase 240 are determined. In some embodiments, the state features of the query phase 240 can be the hidden states or activation entropies corresponding to each model structure layer, used to quantify the activation states of neurons within the large language model 130.
[0052] In some embodiments, for multiple target words generated by the large language model 130, the state features of the query stage 240 can be determined based on the feature representations corresponding to the multiple target words respectively.
[0053] Continue to refer to Figure 3 In some embodiments, the large language model 130 may include multiple processing blocks 131. During the generation of output information using the large language model 130, the multiple processing blocks 131 have the same structure to process data sequentially. In some embodiments, to more accurately determine the state characteristics of the generation stage, activation function layers 320, such as softmax function layers, may be introduced in at least some of the processing blocks.
[0054] It should be noted that the activation function layer 320 introduced here is only for determining the features of the corresponding processing block for the generation stage, and does not affect the actual process of generating output information. For a certain processing block among multiple processing blocks, the data generated by the query stage 240 can be provided to the corresponding activation function layer 320. The activation function layer 320 is configured to determine multiple candidate words in the corresponding processing block that correspond to a certain target word (e.g., the third target word), and multiple generation probabilities corresponding to the multiple candidate words respectively. For the second processing block 131-2 among multiple processing blocks 131, the layer representation corresponding to the query stage 240 is converted into a Logit distribution so as to determine the corresponding probability set using the activation function layer 320. The probability set corresponding to the second processing block 131-2 includes multiple generation probabilities corresponding to the multiple candidate words determined based on the output of the second processing block 131-2.
[0055] For example, the generation probabilities of multiple candidate words corresponding to different processing blocks are different. For example, the multiple candidate words may include "B city", "P city", and "L city". The generation probabilities of the candidate words in the probability set 330 generated by the first processing block 131-1 are 0.3, 0.25, and 0.07, respectively; the generation probabilities of the candidate words generated by the second processing block 131-2 are 0.07, 0.35, and 0.065, respectively; and the generation probabilities of the candidate words generated by the third processing block 131-3 are 0.2, 0.65, and 0.03, respectively. Based on the multiple probability sets corresponding to the multiple processing blocks for the third target word, the state features of the generation stage are determined.
[0056] In some embodiments, for multiple target words generated by the large language model 130, the state features of the query stage 240 can be determined based on the probability sets corresponding to the multiple target words respectively.
[0057] In some embodiments, for a specific processing block among multiple processing blocks, a joint probability corresponding to that processing block is determined based on the product of multiple generation probabilities in the probability set corresponding to that processing block. The joint probability can reflect the large language model 130's confidence in generating multiple target lexical units. For example, the joint probability corresponding to the second processing block 131-2 is the product of 0.07 * 0.35 * 0.065. Subsequently, based on the multiple joint probabilities corresponding to the multiple processing blocks respectively, at least a portion of the state features of the generation stage is determined.
[0058] In some embodiments, for multiple candidate lexical units determined for each processing block, a lexical sequence of multiple candidate lexical units can be determined based on multiple generation probabilities corresponding to the multiple candidate lexical units and a predetermined sorting rule. Based on the multiple lexical sequences corresponding to the multiple processing blocks respectively, multiple lexical ranking information corresponding to the multiple processing blocks is determined. For example, based on the probability sets corresponding to the first processing block 131-1, the second processing block 131-2, and the third processing block 131-3, the lexical ranking information of the candidate lexical unit "B city" in each processing block 131 can be determined as [1, 2, 2], the lexical ranking information of "P city" in each processing block 131 as [2, 1, 1], and the lexical ranking information of "L city" in each processing block 131 as [3, 3, 3]. The state characteristics of the generation stage are determined based on the multiple lexical ranking information determined for the third target lexical unit. In some embodiments, the multiple lexical ranking information can be used to determine the generation tendency of low-priority content.
[0059] In some embodiments, for a specific processing block among multiple processing blocks, the minimum generation probability corresponding to that processing block can be determined from multiple generation probabilities in the probability set corresponding to that processing block. Subsequently, the state features of the generation stage are determined based on the multiple minimum generation probabilities corresponding to the multiple processing blocks respectively. For example, based on the probability sets corresponding to the first processing block 131-1, the second processing block 131-2, and the third processing block 131-3, the generation probability of the candidate word "B city" in each processing block 131 can be determined to be [0.3, 0.5, 0.6], the generation probability of "P city" in each processing block 131 to be [0.2, 0.07, 0.5], and the generation probability of "L city" in each processing block 131 to be [0.35, 0.065, 0.05]. Based on the generation probabilities corresponding to multiple target lexical units, the minimum generation probability can be determined to be 0.2 for "P city" in the first processing block 131-1, 0.065 for "L city" in the second processing block 131-2, and 0.05 for "L city" in the third processing block 131-3. The minimum generation probability can be used to evaluate the generation information of the large language model 130 for a certain target lexical unit (e.g., the third target lexical unit). In some embodiments, for multiple target lexical units generated by the large language model 130, the confidence of the large language model 130 in the target lexical unit 260 can be determined based on multiple probability sets corresponding to the multiple target lexical units.
[0060] Continue to refer to Figure 2In some embodiments, the data generated by the final processing block can be provided to the model structure layer corresponding to the generation stage 250. The generation stage is configured to determine the corresponding generation probabilities of multiple candidate lexical units. To this end, the generation stage 250 may include an activation function layer to determine the corresponding target lexical unit 260 based on the output of the processing block 131. The activation function layer can convert the features output by the preceding model structure layer into the corresponding probabilities of each candidate lexical unit. Such an activation function layer can be based on any suitable type of activation function, such as the softmax function. Subsequently, output information 140 is generated based on the target lexical unit 260.
[0061] In some embodiments, the electronic device 120 determines a detection result regarding the presence of errors in the output information based on at least one state feature. For each group of target words in a plurality of target word groups, at least one state feature is determined for that group of target words. The obtained state features are then provided to an evaluation model to obtain the output of the evaluation model. For example, at least one state feature for a group of target words may include state features corresponding to each target word in that group (including state features for the understanding phase 230, the query phase 240, and the generation phase 250). Subsequently, an evaluation metric for the presence of errors for that group of target words is determined based on the output of the evaluation model. A detection result is determined based on the evaluation metrics corresponding to each group of target words. In some embodiments, for a group of target words, if the evaluation metric corresponding to one of the target words in that group indicates that the target word has an error (i.e., an illusion exists), then the corresponding output information is determined to have an error.
[0062] In some embodiments, the evaluation model can be a logistic regression classifier. The obtained state features are used by the logistic regression classifier for a binary classification task of hallucination generation and correct generation. The logistic regression classifier learns the relationship between the state features and the hallucination generation label and the correct generation label to classify the output information 140. In some embodiments, the output of the logistic regression classifier can be the probability that the output information 140 is erroneous. If the probability that the output information 140 is erroneous exceeds an error threshold, then the output information 140 is determined to be erroneous.
[0063] In this way, the embodiments of this disclosure divide the reasoning process of a large language model into multiple reasoning stages. On the one hand, based on the processing data of each reasoning stage, the state features of the large language model at the corresponding stage are determined, thereby determining the accuracy of the output information. This improves the accuracy of the detected output information and the interpretability of the detection results, thus increasing the credibility of the detection results. On the other hand, during the generation of output information by the large language model, the accuracy of the output information is determined using the processing data of each processing stage, eliminating the need for post-processing of the output information and improving the real-time performance of the detection. Simultaneously, this solution provides a multi-feature fusion framework that comprehensively analyzes the dynamic changes of multiple state features during the generation process, integrating attention information, layer representation features, and the generation probability of target lexical units. Therefore, feature fusion significantly improves the accuracy of hallucination detection while enhancing the interpretability of the detection results. Furthermore, this solution provides various target lexical unit selection methods, supporting full target lexical unit aggregation, first target lexical unit selection, last target lexical unit selection, target-by-target lexical unit selection, and sliding window selection. By dynamically adjusting the target lexical unit selection strategy for different tasks or application scenarios, fine-grained or global feature analysis of the generated content can be achieved, significantly improving the adaptability and flexibility of hallucination detection.
[0064] Example Process
[0065] Figure 5 A flowchart of an example process 500 for output error detection of a large language model according to some embodiments of the present disclosure is shown. Process 500 can be implemented at an electronic device 120. Reference is made below. Figure 1 To describe process 500.
[0066] like Figure 5 As shown in box 510, the electronic device 120 generates output information based on prompt word information using a large language model. The generation of output information by the large language model includes multiple inference stages, which are executed by different model structure layers of the large language model.
[0067] In box 520, electronic device 120 determines the state features of each of at least one of a plurality of inference stages, based on the processing data of the large language model in that inference stage and the model structure layer corresponding to that inference stage, so as to obtain at least one state feature corresponding to at least one inference stage respectively.
[0068] In box 530, electronic device 120 determines, based on at least one state feature, whether there is an error in the detection result regarding the output information.
[0069] In some embodiments, at least one reasoning stage includes a comprehension stage, the model structure layer corresponding to the comprehension stage includes at least one layer based on an attention mechanism, the comprehension stage is used to extract semantic relationships between different word units, and the output information includes a first target word unit, and the first target word unit is generated using a large language model based on: one or more input word units corresponding to the prompt word information and one or more target word units generated in the output information before the first target word unit, and wherein determining the state features of the comprehension stage includes: determining the attention information generated by the large language model in the comprehension stage, the attention information including the corresponding weights of one or more input word units and one or more target word units in generating the first target word unit; and determining the state features of the comprehension stage based at least on the attention information for the first target word unit.
[0070] In some embodiments, determining the state features of the understanding phase includes: determining the attention differences assigned among different words in generating the first target word based on their respective weights in generating the first target word with respect to one or more input words and one or more target words; and determining at least a portion of the state features of the understanding phase based at least on the attention differences.
[0071] In some embodiments, determining state features includes: determining a first attention index for generating the first target word on cue word information based on the sum of the corresponding weights of one or more input words in generating the first target word; determining a second attention index for generating the first target word on model input based on the sum of the corresponding weights of one or more input words and one or more target words in generating the first target word; and determining at least a portion of the state features of the understanding stage based at least on the relative relationship between the first attention index and the second attention index.
[0072] In some embodiments, at least one inference stage includes a query stage, the model structure layer corresponding to the query stage includes at least one feedforward neural network, the query stage is used to extract semantic features of lexical units, and the output information includes a second target lexical unit, wherein determining the state features of the query stage includes: determining the layer representation information generated by the large language model in the query stage, the layer representation information including the corresponding feature representations generated by multiple feature extraction layers of the query stage in generating the second target lexical unit; and determining the state features of the query stage based at least on the corresponding feature representations for the second target lexical unit.
[0073] In some embodiments, at least one inference stage includes a generation stage, the model structure layer corresponding to the generation stage includes an activation function layer, the generation stage is used to determine the corresponding generation probabilities of multiple candidate words, and the output information includes a third target word, wherein the state features for determining the generation state include: determining multiple probability sets based on the corresponding outputs of multiple processing blocks in the large language model in generating the third target word, the probability sets in the multiple probability sets including multiple generation probabilities corresponding to the multiple candidate words determined based on the outputs of the corresponding processing blocks; and determining the state features of the generation stage based at least on the multiple probability sets determined for the third target word.
[0074] In some embodiments, determining the state characteristics of the generation stage includes: for a given processing block among a plurality of processing blocks, determining a joint probability corresponding to a given processing block based on the product of a plurality of generation probabilities in a given probability set corresponding to the given processing block; and determining at least a portion of the state characteristics of the generation stage based on a plurality of joint probabilities respectively corresponding to the plurality of processing blocks.
[0075] In some embodiments, determining the state features of the generation stage includes: for a given processing block among a plurality of processing blocks, determining a lexical sequence including a plurality of candidate lexicals based on a predetermined sorting rule and a plurality of generation probabilities in a given probability set corresponding to the given processing block; determining a plurality of lexical ranking information corresponding to the plurality of processing blocks based on the plurality of lexical sequences respectively; and determining at least a portion of the state features of the generation stage based at least on the plurality of lexical ranking information for the third target lexical.
[0076] In some embodiments, determining the state characteristics of the generation stage includes: for a given processing block among a plurality of processing blocks, determining the minimum generation probability corresponding to the given processing block from a plurality of generation probabilities corresponding to the given processing block; and determining at least a portion of the state characteristics of the generation stage based on the plurality of minimum generation probabilities corresponding to the plurality of processing blocks respectively.
[0077] In some embodiments, process 500 further includes dividing the plurality of target words included in the output information into multiple groups of target words according to a predetermined number of words, and wherein at least one state feature is determined for each group of target words in the multiple groups of target words.
[0078] In some embodiments, determining the detection result regarding whether there is an error in the output information includes: for each group of target words in a plurality of target words, providing at least one state feature determined for that group of target words to an evaluation model to obtain the output of the evaluation model; determining an evaluation index for whether there is an error for that group of target words based on the output of the evaluation model; and determining the detection result based on the evaluation index determined for each of the plurality of target words.
[0079] In some embodiments, determining the detection result includes: in response to detecting an evaluation metric indicating an error among multiple evaluation metrics, determining that the output information contains an error.
[0080] Example Devices and Apparatus
[0081] Embodiments of this disclosure also provide corresponding apparatus for implementing the above methods or processes. Figure 6 A schematic structural block diagram of an example apparatus 600 for output error detection of a large language model according to certain embodiments of the present disclosure is shown. Apparatus 600 may be implemented as or included in electronic device 120. Various modules / components in apparatus 600 may be implemented by hardware, software, firmware, or any combination thereof.
[0082] like Figure 6 As shown, the device 600 includes a generation module configured to generate output information based on prompt word information using a large language model. The generation of output information by the large language model includes multiple inference stages, each executed by a different model structure layer of the large language model. The device 600 also includes a first determining module configured to, for each of at least one of the multiple inference stages, determine a state feature of that inference stage based on the processing data of the large language model at that inference stage and the corresponding model structure layer, to obtain at least one state feature corresponding to each of the at least one inference stage. The device 600 further includes a second determining module configured to determine a detection result regarding the presence of errors in the output information based on the at least one state feature.
[0083] In some embodiments, at least one reasoning stage includes a comprehension stage, the model structure layer corresponding to the comprehension stage includes at least one layer based on an attention mechanism, the comprehension stage is used to extract semantic relationships between different word units, and the output information includes a first target word unit, and the first target word unit is generated using a large language model based on: one or more input word units corresponding to the prompt word information and one or more target word units generated in the output information before the first target word unit, and the first determining module is further configured to determine the attention information generated by the large language model in the comprehension stage, the attention information including the corresponding weights of one or more input word units and one or more target word units in generating the first target word unit; and to determine the state features of the comprehension stage based at least on the attention information for the first target word unit.
[0084] In some embodiments, the first determining module is further configured to determine attention differences among different words in generating the first target word based on their respective weights in generating the first target word with respect to one or more input words and one or more target words; and to determine at least a portion of the state features of the understanding phase based at least on the attention differences.
[0085] In some embodiments, the first determining module is further configured to determine a first attention index for generating the first target word on the prompt word information based on the sum of the corresponding weights of one or more input words in generating the first target word; determine a second attention index for generating the first target word on the model input based on the sum of the corresponding weights of one or more input words and one or more target words in generating the first target word; and determine at least a portion of the state features of the understanding stage based at least on the relative relationship between the first attention index and the second attention index.
[0086] In some embodiments, at least one inference stage includes a query stage, the model structure layer corresponding to the query stage includes at least one feedforward neural network, the query stage is used to extract semantic features of lexical units, and the output information includes a second target lexical unit, wherein the first determining module is further configured to determine layer representation information generated by the large language model in the query stage, the layer representation information including the corresponding feature representations generated by multiple feature extraction layers of the query stage in generating the second target lexical unit; and to determine the state features of the query stage based at least on the corresponding feature representations for the second target lexical unit.
[0087] In some embodiments, at least one inference stage includes a generation stage, the model structure layer corresponding to the generation stage includes an activation function layer, the generation stage is used to determine the corresponding generation probabilities of multiple candidate lexical units, and the output information includes a third target lexical unit, wherein the first determining module is further configured to determine multiple probability sets based on the corresponding outputs of multiple processing blocks in the large language model in generating the third target lexical unit, the probability sets in the multiple probability sets include multiple generation probabilities corresponding to the multiple candidate lexical units determined based on the outputs of the corresponding processing blocks; and to determine the state features of the generation stage based at least on the multiple probability sets determined for the third target lexical unit.
[0088] In some embodiments, the first determining module is further configured to, for a given processing block among a plurality of processing blocks, determine a joint probability corresponding to a given processing block based on the product of a plurality of generation probabilities in a given probability set corresponding to the given processing block; and determine at least a portion of the state features of the generation stage based on a plurality of joint probabilities respectively corresponding to the plurality of processing blocks.
[0089] In some embodiments, the first determining module is further configured to, for a given processing block among a plurality of processing blocks, determine a lexical sequence including a plurality of candidate lexicals based on a predetermined sorting rule and a plurality of generation probabilities in a given probability set corresponding to the given processing block; determine a plurality of lexical ranking information corresponding to the plurality of processing blocks based on the plurality of lexical sequences respectively; and determine at least a portion of the state features of the generation stage based at least on the plurality of lexical ranking information for the third target lexical.
[0090] In some embodiments, the first determining module is further configured to, for a given processing block among a plurality of processing blocks, determine the minimum generation probability corresponding to the given processing block from a plurality of generation probabilities corresponding to the given processing block; and determine at least a portion of the state features of the generation stage based on the plurality of minimum generation probabilities corresponding to the plurality of processing blocks respectively.
[0091] In some embodiments, the device 600 partitioning module is configured to further partition the plurality of target words included in the output information into a plurality of groups of target words according to a predetermined number of words, and wherein at least one state feature is determined for each of the plurality of groups of target words.
[0092] In some embodiments, the segmentation module is further configured to provide at least one state feature determined for each group of target words to an evaluation model to obtain the output of the evaluation model; determine whether there is an evaluation index for the group of target words based on the output of the evaluation model; and determine the detection result based on the evaluation index determined for each of the multiple groups of target words.
[0093] In some embodiments, the segmentation module is further configured to determine that there is an error in the output information in response to detecting that there is an evaluation metric indicating an error among a plurality of evaluation metrics.
[0094] Figure 7 Block diagrams of electronic devices capable of implementing various embodiments of the present disclosure are shown. (See diagram for example.) Figure 7 As shown, electronic device 700 is in the form of a general-purpose electronic device. Components of electronic device 700 may include, but are not limited to, one or more processors or processing units 710, memory 720, storage device 730, one or more communication units 740, one or more input devices 750, and one or more output devices 760. Processing unit 710 may be a physical or virtual processor and is capable of performing various processes according to programs stored in memory 720. In a multiprocessor system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing capability of electronic device 700.
[0095] Electronic device 700 typically includes multiple computer storage media. Such media can be any accessible media that is accessible to electronic device 700, including but not limited to volatile and non-volatile media, removable and non-removable media. Memory 720 can be volatile memory (e.g., registers, cache, random access memory (RAM)), non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. Storage device 730 can be removable or non-removable media and can include machine-readable media, such as flash drives, disks, or any other media that can be used to store information and / or data and can be accessed within electronic device 700.
[0096] Electronic device 700 may further include additional removable / non-removable, volatile / non-volatile storage media. Although not explicitly stated... Figure 7 As shown, disk drives for reading from or writing to removable, non-volatile disks (e.g., "floppy disks") and optical disk drives for reading from or writing to removable, non-volatile optical disks can be provided. In these cases, each drive can be connected to a bus (not shown) via one or more data media interfaces. Memory 720 may include computer program product 725 having one or more program modules configured to perform various methods or actions of various embodiments of this disclosure.
[0097] The communication unit 740 enables communication with other electronic devices via a communication medium. Additionally, the functionality of the components of the electronic device 700 can be implemented using a single computing cluster or multiple computing machines capable of communicating via communication connections. Therefore, the electronic device 700 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or another network node.
[0098] Input device 750 can be one or more input devices, such as a mouse, keyboard, trackball, etc. Output device 760 can be one or more output devices, such as a monitor, speaker, printer, etc. Electronic device 700 can also communicate with one or more external devices (not shown) via communication unit 740 as needed. These external devices include storage devices, display devices, etc., and can communicate with one or more devices that enable user interaction with electronic device 700, or with any device that enables electronic device 700 to communicate with one or more other electronic devices (e.g., network card, modem, etc.). Such communication can be performed via input / output (I / O) interface (not shown).
[0099] According to an exemplary implementation of this disclosure, a computer-readable storage medium is provided that stores computer-executable instructions thereon, wherein the computer-executable instructions are executed by a processor to implement the methods described above. According to an exemplary implementation of this disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, which are executed by a processor to implement the methods described above.
[0100] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0101] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0102] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions that execute on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0103] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0104] Various implementations of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is chosen to best explain the principles, practical applications, or improvements to technology in the market, or to enable others skilled in the art to understand the various implementations disclosed herein.
Claims
1. A method for detecting an error in an output of a large language model, comprising: generating, based on prompt information, an output information by using a large language model, the generation of the output information by the large language model comprising a plurality of reasoning stages, wherein the plurality of reasoning stages are respectively performed by different model structure layers of the large language model; for each of at least one of the plurality of reasoning stages, determining a state feature of the reasoning stage based on processing data of the large language model at the reasoning stage and the model structure layer corresponding to the reasoning stage, to obtain at least one state feature corresponding to the at least one reasoning stage, wherein the at least one reasoning stage comprises at least one of: an understanding stage for extracting semantic relationships between different word pieces, a query stage for extracting semantic features of word pieces; and determining a detection result about whether there is an error in the output information based on the at least one state feature.
2. The method of claim 1, wherein the model structure layer corresponding to the understanding stage comprises at least one layer based on an attention mechanism, and the output information comprises a first target word piece, and the first target word piece is generated by the large language model based on: one or more input word pieces corresponding to the prompt information and one or more target word pieces generated before the first target word piece in the output information, and wherein determining the state feature of the understanding stage comprises: determining attention information generated by the large language model at the understanding stage, the attention information comprising respective weights of the one or more input word pieces and the one or more target word pieces in generating the first target word piece; and determining the state feature of the understanding stage based at least on the attention information for the first target word piece.
3. The method of claim 2, wherein determining the state feature of the understanding stage comprises: determining an attention difference allocated between different word pieces in generating the first target word piece based on the respective weights of the one or more input word pieces and the one or more target word pieces in generating the first target word piece; and determining at least part of the state feature of the understanding stage based at least on the attention difference.
4. The method of claim 2, wherein determining the state feature comprises: determining a first attention indicator of the prompt information in generating the first target word piece based on a sum of the respective weights of the one or more input word pieces in generating the first target word piece; determining a second attention indicator of model input in generating the first target word piece based on a sum of the respective weights of the one or more input word pieces and the one or more target word pieces in generating the first target word piece; and determining at least part of the state feature of the understanding stage based at least on a relative relationship between the first attention indicator and the second attention indicator.
5. The method of claim 1, wherein the model structure layer corresponding to the query stage comprises at least one feedforward neural network, and the output information comprises a second target token, wherein determining the state feature of the query stage comprises: determining layer representation information generated by the large language model at the query stage, the layer representation information comprising respective feature representations generated by a plurality of feature extraction layers of the query stage in generating the second target token; and determining the state feature of the query stage based at least on the respective feature representations for the second target token.
6. The method of claim 1, wherein the at least one inference stage further comprises a generation stage, the model structure layer corresponding to the generation stage comprises an activation function layer, the generation stage is configured to determine respective generation probabilities of a plurality of candidate tokens, and the output information comprises a third target token, wherein determining the state feature of the generation state comprises: determining a plurality of probability sets respectively based on respective outputs of a plurality of processing blocks in the large language model in generating the third target token, a probability set in the plurality of probability sets comprising a plurality of generation probabilities respectively corresponding to the plurality of candidate tokens determined based on the output of the corresponding processing block; and determining the state feature of the generation stage based at least on the plurality of probability sets determined for the third target token.
7. The method of claim 6, wherein determining the state feature of the generation stage comprises: for a given processing block in the plurality of processing blocks, determining a joint probability corresponding to the given processing block based on a product of the plurality of generation probabilities in a given probability set corresponding to the given processing block; and determining at least part of the state feature of the generation stage based on a plurality of joint probabilities respectively corresponding to the plurality of processing blocks.
8. The method of claim 6, wherein determining the state feature of the generation stage comprises: for a given processing block in the plurality of processing blocks, determining a token sequence comprising the plurality of candidate tokens based on a predetermined ordering rule and the plurality of generation probabilities in a given probability set corresponding to the given processing block; determining a plurality of token ranking information respectively corresponding to the plurality of processing blocks based on a plurality of token sequences respectively corresponding to the plurality of processing blocks; and determining at least part of the state feature of the generation stage based at least on the plurality of token ranking information for the third target token.
9. The method of claim 6, wherein determining the state feature of the generation stage comprises: for a given processing block in the plurality of processing blocks, determining a minimum generation probability corresponding to the given processing block from the plurality of generation probabilities corresponding to the given processing block; and determining at least part of the state feature of the generation stage based on a plurality of minimum generation probabilities respectively corresponding to the plurality of processing blocks.
10. The method of claim 1, further comprising: The plurality of target tokens included in the output information are divided into a plurality of groups of target tokens according to a predetermined number of tokens, and wherein the at least one state feature is determined for each group of target tokens of the plurality of groups of target tokens. 11.The method of claim 10, wherein determining the detection result on whether there is an error in the output information comprises: for each group of target tokens of the plurality of groups of target tokens, providing the at least one state feature determined for the group of target tokens to an evaluation model to obtain an output of the evaluation model; based on the output of the evaluation model, determining an evaluation indicator on whether there is an error for the group of target tokens; and and based on the evaluation indicators respectively determined for the plurality of groups of target tokens, determining the detection result. 12.The method of claim 11, wherein determining the detection result comprises: in response to detecting that there is an evaluation indicator indicating an error in a plurality of evaluation indicators, determining that there is an error in the output information. 13.An apparatus for output error detection of a large language model, comprising: a generation module configured to generate, based on prompt token information, output information by using a large language model, the generation of the output information by the large language model comprising a plurality of reasoning stages and the plurality of reasoning stages having different model structures; a first determination module configured to, for each reasoning stage of at least one reasoning stage of the plurality of reasoning stages, determine a state feature of the reasoning stage based on processing data of the reasoning stage by the large language model and a model structure layer corresponding to the reasoning stage, to obtain at least one state feature respectively corresponding to the at least one reasoning stage, wherein the at least one reasoning stage comprises at least one of: an understanding stage for extracting semantic relationships between different tokens, a query stage for extracting semantic features of tokens; and a second determination module configured to determine, based on the at least one state feature, a detection result on whether there is an error in the output information. 14.An electronic device comprising: at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, causing the electronic device to perform the method according to any one of claims 1 to 12. 15.A computer-readable storage medium having stored thereon a computer program, the computer program being executable by a processor to implement the method according to any one of claims 1 to 12. 16.A computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Large model illusion relieving method and device, equipment and storage medium
CN118964583A