Method for evaluating output data of target model and method for training target model

By quantifying the uncertainty of the generated results of a large language model, the problem of model output illusion is solved, enabling reliability assessment and training optimization of the model output, and improving the robustness and accuracy of the model in multi-turn conversation rewriting applications.

CN122019753APending Publication Date: 2026-05-12TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2026-01-26
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Large language models suffer from illusions when generating content, which reduces their reliability. This can have serious consequences, especially in high-risk fields such as medical and legal consultation. Existing evaluation methods suffer from problems such as delayed recognition process, increased consumption of computational resources, and limited ability to distinguish complex semantics.

Method used

By quantifying the uncertainty of the target model's generated results, the prediction probability and uncertainty measure of the word sequence are calculated using the internal structure of the target model, the confidence level of the input data is determined, thereby evaluating the reliability of the model output, and uncertainty measure is introduced during the training process to optimize the model parameters.

Benefits of technology

It improves the robustness and reliability of the model, enabling dynamic evaluation of confidence in multi-turn session rewriting applications, reducing illusions, and improving interaction efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122019753A_ABST
    Figure CN122019753A_ABST
Patent Text Reader

Abstract

The invention relates to a method for evaluating output data of a target model, a method for training the target model, an evaluation device, a training device, electronic equipment, a computer readable storage medium and a computer program product. According to the embodiment of the invention, the uncertainty of the generation result of the target model is quantified based on the structure of the target model, so that the target model can evaluate the internal reliability of the generated content, thereby providing an interpretable confidence index for a downstream application (such as a multi-round session rewriting application), and improving the reliability of the downstream application. The method assists in identifying potential illusion and improves the robustness of a target model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computers, and more particularly to a method for evaluating output data of a target model, a method for training a target model, an evaluation apparatus, a training apparatus, an electronic device, a computer-readable storage medium, and a computer program product. Background Technology

[0002] In the field of natural language processing, artificial intelligence models (such as large language models) are increasingly widely used. However, the "illusion" phenomenon exists in their generated content, namely, generating content that does not match real data or deviates from user instructions. This phenomenon reduces the reliability of the model and may have serious consequences in high-risk areas such as medical and legal consultation. Therefore, uncertainty estimation of the output of large language models is needed to measure the degree to which the large language model is confident in the correctness of its own output, which is considered an important direction for improving the reliability of large language models.

[0003] In traditional machine learning tasks, the uncertainty of model output has been qualitatively studied. Model output uncertainty is typically categorized into two types: random uncertainty and cognitive uncertainty. Random uncertainty stems from the inherent randomness of the data, while cognitive uncertainty is related to the limitations of the model's own knowledge. However, directly applying these concepts to free text generation tasks using large language models presents challenges. This is primarily because the natural language output space is extremely complex, and the two types of uncertainty are naturally intertwined during the generation process, making accurate estimation and differentiation complex.

[0004] Therefore, existing large language models need to be improved to enhance their reliability and determinism. Summary of the Invention

[0005] This disclosure provides a method for evaluating the output data of a target model, a method for training a target model, an evaluation device, a training device, an electronic device, a computer-readable storage medium, and a computer program product.

[0006] This disclosure provides a method for evaluating the output data of a target model, comprising: for input data, using the target model, generating a lexical sequence and determining the prediction probability corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; calculating an uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence based at least in part on at least a portion of the model parameters of the target model and the prediction probability corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; determining a confidence level corresponding to the input data based at least in part on the uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; and determining an evaluation result for the output data of the target model based at least in part on the confidence level corresponding to the input data.

[0007] This disclosure provides a method for training a target model, comprising: processing each input sample in the input sample set using a target model to generate a corresponding lexical sequence, and determining the prediction probability corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; calculating an uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence, at least in part based on at least a portion of the model parameters of the target model and the prediction probability; determining a confidence level corresponding to each input sample in the input sample set, at least in part based on the uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; and controlling the training process of the target model, at least in part based on the confidence level corresponding to each input sample in the input sample set.

[0008] This disclosure provides an evaluation apparatus, comprising: a first module configured to: generate a lexical sequence using a target model for input data and determine the prediction probability corresponding to each of a plurality of lexical indices in the lexical sequence; a second module configured to: calculate an uncertainty measure corresponding to each of the plurality of lexical indices in the lexical sequence based at least in part on at least a portion of the model parameters of the target model and the prediction probability corresponding to each of the plurality of lexical indices in the lexical sequence; a third module configured to: determine a confidence level corresponding to the input data based at least in part on the uncertainty measure corresponding to each of the plurality of lexical indices in the lexical sequence; and a fourth module configured to: determine an evaluation result for the output data of the target model based at least in part on the confidence level corresponding to the input data.

[0009] This disclosure provides a training apparatus, comprising: a first module configured to: process each input sample in the input sample set using a target model to generate a corresponding lexical sequence, and determine the prediction probability corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; a second module configured to: calculate an uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence, at least in part based on at least a portion of the model parameters of the target model and the prediction probability; a third module configured to: determine the confidence level corresponding to each input sample in the input sample set, at least in part based on the uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; and a fourth module configured to: control the training process of the target model, at least in part based on the confidence level corresponding to each input sample in the input sample set.

[0010] This disclosure provides an electronic device, including: one or more processors; and one or more memories, wherein the memories store computer-executable instructions, and when the processor executes the computer-executable instructions, the above-described method is performed.

[0011] This disclosure provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the above-described method.

[0012] According to another aspect of this disclosure, a computer program product or computer program is provided, comprising computer-executable instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer-executable instructions from the computer-readable medium and executes the computer-executable instructions, causing the computer device to perform the methods provided in the foregoing aspects or various alternative implementations of the foregoing aspects.

[0013] The embodiments of this disclosure quantify the uncertainty of the target model's generated results based on the structure of the target model, enabling the target model to assess the inherent reliability of its generated content, thereby providing interpretable confidence metrics for downstream applications (e.g., multi-turn session rewriting applications) to help identify potential illusions and improve the robustness of the target model. Attached Figure Description

[0014] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments will be briefly introduced below. The accompanying drawings in the following description are merely exemplary embodiments of this disclosure.

[0015] Figure 1 This is an example schematic diagram illustrating a scenario according to an embodiment of the present disclosure.

[0016] Figure 2 A schematic interface diagram of a multi-turn session rewriting task according to an embodiment of the present disclosure is shown.

[0017] Figure 3 A flowchart is shown of a method for evaluating the output data of a target model according to an embodiment of the present disclosure.

[0018] Figure 4 A schematic diagram of the target model and uncertainty measure according to an embodiment of the present disclosure is shown.

[0019] Figure 5 A schematic diagram of a module for performing a multi-round session rewriting task according to an embodiment of the present disclosure is shown.

[0020] Figure 6 A schematic structure of a target model according to an embodiment of the present disclosure is shown.

[0021] Figure 7 A flowchart of a method for training a target model according to an embodiment of the present disclosure is shown.

[0022] Figure 8 A schematic diagram illustrating the process of training a target model according to an embodiment of the present disclosure is shown.

[0023] Figure 9 A schematic diagram of an evaluation apparatus according to an embodiment of the present disclosure is shown.

[0024] Figure 10 A schematic diagram of a training apparatus according to an embodiment of the present disclosure is shown.

[0025] Figure 11 A schematic diagram of an electronic device according to an embodiment of the present disclosure is shown.

[0026] Figure 12 A schematic diagram of the architecture of an exemplary computing device according to an embodiment of the present disclosure is shown.

[0027] Figure 13 A schematic diagram of a storage medium according to an embodiment of the present disclosure is shown. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of this disclosure more apparent, exemplary embodiments according to this disclosure will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this disclosure, and not all embodiments of this disclosure. It should be understood that this disclosure is not limited to the exemplary embodiments described herein.

[0029] In this specification and accompanying drawings, operations and elements that are substantially the same or similar are indicated by the same or similar reference numerals, and repeated descriptions of these operations and elements are omitted. Furthermore, in the description of this disclosure, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance or order.

[0030] It is worth noting that, in this disclosure, "at least partially based on certain data" should be understood as meaning that the relevant processing is not limited to relying solely on "certain data". This statement can cover both situations where processing is based solely on "certain data" and situations where other data sources are combined with "certain data" as the basis for processing. That is, "at least partially based on" is open-ended and intended to cover a wider range of implementation methods, rather than being limited to a specific data usage method.

[0031] To facilitate the description of this disclosure, the following concepts related to this disclosure are introduced.

[0032] Optionally, the models used in embodiments of this disclosure as described below can all be artificial intelligence models, especially artificial intelligence-based neural network models. Typically, artificial intelligence-based neural network models are implemented as acyclic graphs, where neurons are arranged in different layers. Generally, a neural network model includes an input layer and an output layer, separated by at least one hidden layer. The hidden layer transforms the input received by the input layer into a representation useful for generating the output in the output layer. Nodes are fully connected to nodes in adjacent layers via edges, and there are no edges between nodes within each layer. Data received at nodes in the input layer of the neural network is propagated to nodes in the output layer via any of the hidden layers, activation layers, pooling layers, convolutional layers, etc. The input and output of the neural network model can take various forms, and this disclosure does not limit this.

[0033] Multi-turn conversation rewriting is a natural language processing technology designed to improve the coherence and accuracy of human-computer dialogue. In continuous dialogue, a user's current question is often brief and contains a large amount of reference and omission from the preceding dialogue. If used directly for retrieval, it can easily lead to off-target answers. This technology analyzes the complete dialogue history to automatically complete and transform the ambiguous current query into a semantically complete, independent, and precise query statement. For example, in a movie Q&A scenario, after a user first asks "Who is the lead actor in this movie?" and receives the answer, they immediately ask "How old is he this year?" The rewriting system will recognize that "he" refers to the aforementioned lead actor and rewrite the query as "[Lead actor's name] How old is he this year?". The purpose of multi-turn conversation rewriting is to provide high-quality, unambiguous input for downstream retrieval and question-answering modules, and it is a key preprocessing step to improve the practicality of complex dialogue systems.

[0034] "Multi-turn conversational intent" is an abstraction and classification of the interactive purpose behind a user's single statement in a continuous dialogue, and it is the core of understanding the logical flow of the conversation. It does not analyze the surface meaning of statements, but rather determines the interactive action the user hopes to achieve in this turn. For example, in a film and television Q&A scenario, common intent categories include: follow-up questions (e.g., "And then?"), replies (e.g., "Yes"), denial / correction (e.g., "No, I meant the first one"), requests for clarification (e.g., "Which character are you referring to?"), and initiating a new topic (e.g., "Let's change the subject"). For example, when a user says "I don't quite understand this," their intent is to "request clarification"; while saying "Tell me more about the director," their intent is to "ask for" new information. Accurately identifying conversational intent enables dialogue in film and television Q&A systems to adopt the correct response strategy (whether to answer, clarify, or transition), thereby ensuring a smooth and natural progression of the conversation.

[0035] Confidence level for a specific model refers to a quantitative estimate of the model's inherent confidence in the correctness of its own single prediction. In large language models, the directly output probability value (surface confidence) often fails to reliably reflect true accuracy due to insufficient training or overfitting. For example, ideally, a prediction with a 90% output probability should also have a close 90% probability of being correct. However, large language models often suffer from "poor calibration," and their directly output probability values ​​(which can be called "surface confidence") are often unreliable, potentially exhibiting "overconfidence" in incorrect answers. For instance, the model might generate an answer that is actually incorrect with an 85% probability.

[0036] Model convergence here refers to an ideal stable state reached during model training. Traditionally, a model is considered convergent when the training loss no longer decreases significantly and the validation set accuracy tends to plateau. However, this criterion may be insufficient for fine-tuning large language models. This is because while the model may perform correctly on most samples, its predictions on some samples may be "lucky" or have "latent flaws." For example, in a query rewriting task, the model may have learned to correctly rewrite most referents, but may still occasionally incorrectly associate "it" with a non-subject object.

[0037] The solutions provided in this disclosure involve technologies such as artificial intelligence and / or machine learning, which are specifically illustrated through the following embodiments.

[0038] First, refer to Figure 1 This disclosure describes application scenarios of a method and apparatus for evaluating output data of a target model according to embodiments of the present disclosure. Figure 1 A schematic diagram of an application scenario 100 according to an embodiment of the present disclosure is shown, wherein a server 110 and a plurality of user terminals 120 are schematically illustrated.

[0039] User terminal 120 can be a mobile phone, tablet computer, laptop computer, desktop computer, smart TV, smart glasses, smart speaker or smartwatch, etc., but is not limited to these.

[0040] Server 110 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Terminals and servers can be connected directly or indirectly via wired or wireless communication, and this disclosure does not impose any restrictions.

[0041] The target model in this disclosure embodiment can be a neural network model (e.g., a large language model), which can be integrated into various electronic devices, for example... Figure 1 The neural network model is located in server 110. Of course, some parameters of the neural network model in this embodiment can also be deployed in user terminal 120. It is understood that the apparatus for performing inference using the neural network model of this embodiment can be either server 110 or a system composed of a user terminal and a server.

[0042] The artificial intelligence model provided in this disclosure can also relate to artificial intelligence cloud services in the field of cloud technology. It is worth noting that both the user terminal 120 and the server 110 according to the embodiments of this disclosure adhere to data protection principles, respect users' data rights, and ensure user data security and privacy. The user terminal 120 and server 110 according to the embodiments of this disclosure will clearly inform users of the purpose, method, and scope of collecting, using, storing, transmitting, and deleting user data, and obtain user consent. The user terminal 120 and server 110 according to the embodiments of this disclosure will take reasonable technical and management measures to prevent user data from being leaked, tampered with, damaged, or lost. The providers of the user terminal 120 and server 110 according to the embodiments of this disclosure will regularly review and update user data, and promptly delete expired or useless data. Furthermore, the cloud service providers using the embodiments of this disclosure respect users' rights to data access, correction, deletion, withdrawal of consent, complaints, and claims, and provide convenient channels and procedures to enable users to effectively exercise these rights.

[0043] Furthermore, the process of data analysis using artificial intelligence technology in user terminal 120 or server 110 is conducted based on the principles of legality, rationality, and transparency. The data collected and processed by the artificial intelligence model according to embodiments of this disclosure is relevant, necessary, and appropriate for the predictive purpose, and does not contain any personally identifiable or sensitive information. The neural network model according to embodiments of this disclosure employs appropriate techniques and organizational measures to protect the security and integrity of data, preventing unauthorized access, use, or disclosure.

[0044] The artificial intelligence-based neural network model according to embodiments of this disclosure will comply with relevant data protection regulations and ethical principles. This neural network model is trained on a large amount of anonymized and de-identified data, and does not infringe on the privacy rights of any individual or group. The artificial intelligence model has also undergone rigorous testing and evaluation to ensure that its output results are accurate and reliable, and will not cause any misleading or discriminatory behavior. The artificial intelligence model is designed solely to improve service quality and customer satisfaction and will not be used for any illegal or unethical purposes. Furthermore, the neural network model will be regularly reviewed and updated to adapt to changes in the data environment and legal regulations.

[0045] In multi-turn question-and-answer speech rewriting tasks, large language models sometimes produce outputs inconsistent with objective facts or context; this phenomenon is often referred to as "illusion." Specifically, "illusion" refers to a situation where the model-generated text conforms to linguistic conventions in form, but deviates from reality in terms of factual sources, semantic references, or contextual inheritance. "Illusion" does not mean that the target model generates content completely randomly, but rather that, given existing input conditions, the result inferred by the target model based on internal parameters is inconsistent with user expectations or objective facts. This problem is more common in multi-turn dialogue scenarios because speech rewriting needs to consider both the current input and information from multiple previous turns; any misunderstanding can be amplified and reflected in the final output.

[0046] For example, in multi-turn conversation rewriting scenarios, when a user asks multiple questions to a question-answering assistant, subsequent questions often rely on the preceding context, but the questions themselves may be incomplete or semantically ambiguous. In such cases, if the training data does not adequately cover similar ambiguous questions, the large language model is prone to making inferences based on insufficient context, resulting in biased outputs. Furthermore, if the large language model has not reached sufficient convergence during the training phase, its parameters are not yet stable, which may also lead to different rewritten results for the same input.

[0047] Taking the question "Who is the author of 'The bright moonlight shines before my bed, I suspect it is frost on the ground'?" exemplified by a user asking a question-answering assistant, during the prediction process, due to the sampling mechanism in the large language model's output generation, the model might output a rewritten question consistent with the input form, directly provide the answer "The author is Li Bai," or rewrite the question as "Is the author of the poem 'Quiet Night Poem' Li Bai?"—changing the original question's subject. Of these different results, the answer "The author is Li Bai" deviates from the goal of the rewriting task itself, while "Is the author of the poem 'Quiet Night Poem' Li Bai?" undergoes a semantic change. Both indicate that biased training data and insufficient model convergence lead to reduced output stability.

[0048] As another example, in the process of expanding and rewriting simple queries, such as the original question "Where is the cat?", the large language model might generate a rewritten result like: "The child has a cat at home. Where is the cat? Is it under the cabinet or on the bed?". This result is more verbose and introduces background information not explicitly given in the original input, thus increasing uncertainty.

[0049] Meanwhile, existing quality assessment methods for the "illusion" problem in large language models often employ even larger-scale language models as evaluation models to determine the reasonableness of multi-turn intentions and speech rewriting. However, these evaluation models themselves are also based on probabilistic generation mechanisms and may produce judgments that are not entirely consistent with facts or context. Furthermore, in the absence of clear confidence evaluation criteria, these models struggle to distinguish between minor biases and obvious errors. Additionally, the lack of effective metrics to determine whether the model has reached a reasonable convergence state during training further complicates the early detection of the "illusion" problem in large language models.

[0050] Traditional hallucination recognition schemes typically process results after they are generated, primarily relying on text similarity comparison, rule matching, or manual verification. Text similarity methods determine deviations by calculating the vector distance between the model's output and the reference text, rule matching methods depend on a pre-defined domain error rule base, and manual verification requires human intervention. These schemes often require the introduction of additional modules or models to recognize the generated results, resulting in a certain degree of lag in the processing. Furthermore, when hallucinations appear in semantically implicit or logically inconsistent forms, it is difficult to accurately distinguish cases where "the expression is reasonable but the reasoning path is inconsistent" based solely on surface similarity or fixed rules, easily leading to omissions or judgment biases.

[0051] Another proposed illusion recognition scheme performs multiple forward computations on the same input and evaluates the reliability of an output by comparing the consistency among multiple predictions. This method assumes that more consistent results across multiple samplings have higher credibility. However, multiple forward computations themselves incur additional time and computational costs. Furthermore, in tasks with complex semantic structures, such as multi-round rewriting, even if multiple results appear similar, the model may not be able to identify subtle but important semantic differences, and may still randomly select one as the final output.

[0052] In summary, the aforementioned solutions suffer from problems such as delayed recognition processes, limited ability to distinguish complex semantics, and increased computational resource consumption. These problems combine to make it difficult to effectively alleviate the hallucination. The impact of the "hallucination" is even more difficult to eliminate in multi-round rewriting tasks.

[0053] To this end, this disclosure provides a method for evaluating the output data of a target model, comprising: for input data, using the target model, generating a lexical sequence and determining the prediction probability corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; calculating an uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence based at least in part on at least a portion of the model parameters of the target model and the prediction probability corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; determining a confidence level corresponding to the input data based at least in part on the uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; and determining an evaluation result of the output data of the target model based at least in part on the confidence level corresponding to the input data.

[0054] The embodiments of this disclosure quantify the uncertainty of the target model's generated results based on the structure of the target model, enabling the target model to assess the inherent reliability of its generated content, thereby providing interpretable confidence metrics for downstream applications (e.g., multi-turn session rewriting applications) to help identify potential illusions and improve the robustness of the target model.

[0055] In one optional aspect, embodiments of this disclosure do not rely on external calibration models or additional annotation information, but instead directly model the uncertainty of the model's generated results from the internal structure of the target model. For example, by applying a Laplace approximation to the predicted distribution of at least a portion of the model parameters of the target model, a characterization of the local curvature of the model parameters is introduced, thereby effectively extracting a quantitative indicator reflecting the model's cognitive uncertainty. This uncertainty measure is further mapped to sample-level or word-level confidence, enabling the model to explicitly express the reliability of its own prediction results. Since the above process only relies on the model parameters and predicted probabilities available during the inference stage, the computational cost is controllable and easy to use in practical deployments, thus achieving model self-evaluation capabilities while ensuring efficiency.

[0056] In one optional aspect, embodiments of this disclosure treat uncertainty as a direct reflection of the model's "cognitive ambiguity." Even if the generated result appears reasonable on the surface or is consistent with the reference answer, the final confidence level will still be low if the internal uncertainty of the model is high. This low confidence signal can serve as a potential risk indicator to identify possible hallucinations or unreliable outputs in the target model. Compared to judgments based solely on result consistency, this method can detect problems before errors become apparent, thereby significantly improving the accuracy and sensitivity of hallucination identification and providing a more reliable and interpretable decision-making basis for downstream applications.

[0057] This disclosure also provides a method for training a target model, comprising: processing each input sample in the input sample set using a target model to generate a corresponding lexical sequence, and determining the prediction probability corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; calculating an uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence based at least in part on at least a portion of the model parameters of the target model and the prediction probability; determining a confidence level corresponding to each input sample in the input sample set based at least in part on the uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; and controlling the training process of the target model based at least in part on the confidence level corresponding to each input sample in the input sample set.

[0058] In one optional aspect, relying solely on prediction accuracy during model training and iteration can easily lead to misjudgments of difficult or critical samples, meaning the model is incorrectly considered convergent before it has fully grasped these samples. This disclosure addresses this by introducing an uncertainty metric to prioritize low-confidence samples: when the model's prediction is correct but the corresponding uncertainty remains high, it indicates that the model's internal representation of the sample is unstable, and the sample should be identified as needing further learning and continued training; only when the prediction is correct and the uncertainty is low is the model considered truly convergent on that sample. This mechanism allows for the early screening of samples where the model is prone to misjudgments or unstable predictions, enabling targeted optimization of training data and the training process, thereby improving overall prediction accuracy and robustness before model application.

[0059] Furthermore, in multi-turn dialogue rewriting applications, this embodiment provides a quantifiable confidence index for the target model in each round of dialogue rewriting results. This allows the multi-turn dialogue rewriting application to dynamically evaluate the degree to which the currently rewritten content grasps the contextual semantics. When the confidence is high, the model-generated result can be directly used to improve overall interaction efficiency; when the confidence is low, conservative strategies can be triggered, such as introducing more historical turn information, invoking alternative rewriting strategies, or requesting manual confirmation, thereby avoiding the accumulation of contextual misunderstandings and semantic drift. In addition, low-confidence samples identified based on uncertainty can also be used as targeted optimization data to continuously improve the rewriting model's key capabilities such as long-range dependency resolution, referential dissolution, and intent preservation, ultimately effectively improving the stability, consistency, and overall performance of multi-turn dialogue rewriting applications in complex scenarios.

[0060] The following reference Figures 2 to 13 Various aspects of embodiments of this disclosure are described.

[0061] Figure 2 A schematic interface diagram of a multi-turn session rewriting task according to an embodiment of the present disclosure is shown.

[0062] Multi-turn conversation rewriting tasks can be widely applied in various interactive intelligent scenarios, such as: children's movie-watching companion Q&A assistants, emotional companion Q&A assistants, and film and television Q&A assistants. The following uses these three scenarios as examples to illustrate multi-turn conversation rewriting tasks, but those skilled in the art should understand that this disclosure is not limited thereto.

[0063] by Figure 2 For example, the multi-turn conversation rewriting task can be used in the Children's Movie Viewing Companion Q&A Assistant 20. The Children's Movie Viewing Companion Q&A Assistant provides children with continuous, multi-turn natural language interaction capabilities, guiding and accompanying them throughout the movie viewing process, helping them understand the plot, form correct value perceptions, and stimulate divergent thinking and interactive interest.

[0064] like Figure 2 As shown, the Children's Movie Viewing Companion Q&A Assistant 20 first guides the user with prompts, such as displaying "Assistant Prompt: Do you want to watch AA?" to stimulate children's interest. When the user clicks the "Click to Chat" button and expresses their viewing intention, the assistant can rewrite the task based on multi-turn conversations, combining the current input with historical context to accurately identify the user's true intention (e.g., "I want to watch BB"). Subsequently, the interface presents the rewritten results in a structured manner, such as "Found AA, BB, CC for you," and recommends related content. Simultaneously, the interface can also include "Friends" and "Guardian" function buttons to guide children into social interaction or parental supervision functions. This multi-turn conversation rewriting process effectively eliminates problems such as incomplete expression and ambiguous referencing by children, ensuring the accuracy and security of recommendations and interaction results.

[0065] In the scenario of an emotional companionship Q&A assistant, multi-turn conversation rewriting is used to support continuous emotional communication with users. After each round of user input, the assistant first uses a multi-turn conversation rewriting model to fuse the current input with historical dialogue information, generating a semantically complete and context-consistent rewritten result. This rewritten result is then passed as input to the larger Q&A model to generate targeted emotional responses or suggestions, and the final result is returned to the user. Through multi-turn conversation rewriting, the assistant can accurately understand users' emotional changes, implicit needs, and long-term topical context, avoiding irrelevant answers due to missing context, thereby improving the continuity and credibility of emotional companionship.

[0066] In the context of a film and television Q&A assistant, multi-turn conversation rewriting is used to rewrite and complete users' film and television-related questions. When watching a film or reviewing a plot, users often use concise and highly referential questions (such as "What happened to him later?" or "What does this scene mean?"). Through multi-turn conversation rewriting, the system combines such input with previous dialogues and the current film and television content context to generate clear and complete question statements, which are then input into film and television knowledge or question-answering models for processing. With this mechanism, the film and television Q&A assistant can consistently output answers that highly match specific characters, plots, or situations, significantly improving the accuracy of question answering and the user experience.

[0067] Figure 3 A flowchart of a method 30 for evaluating output data of a target model according to an embodiment of the present disclosure is shown. Figure 4 A schematic diagram of the target model and uncertainty measure according to an embodiment of the present disclosure is shown.

[0068] Method 30 can be used on the user terminal (e.g., Figure 1Method 30 can be executed at the user terminal 120 or on the server 110. It can also be executed jointly by the user terminal and the server. Method 30 includes the following operations S301 to S304. Of course, method 30 may include more or fewer operations, and this disclosure is not limited thereto.

[0069] In operation S301, for the input data, the target model is used to generate a word sequence and determine the prediction probability corresponding to each word index among the multiple word indices in the word sequence.

[0070] Optionally, input data can refer to any data information that can trigger the target model to perform inference or generation. Its form is not limited to text, and can also include structured or semi-structured representations obtained after processing by other modalities or systems. For example, the input data can be text information, speech-to-text, or structured instruction information entered by the user in an interactive scenario. For example, in multi-turn conversation rewriting or question-and-answer scenarios, the input data can be the natural language input of the current user and its related historical dialogue content. This disclosure is not limited thereto.

[0071] Optionally, the target model can refer to any machine learning or deep learning model used to model the input data and output prediction results. It can be implemented based on a neural network structure or employ other parameterized modeling methods. The target model can be used to generate sequential output or for position-by-position prediction. For example, the target model can be a neural network model used to generate text sequences, such as a large language model based on a Transformer structure, a dialogue generation model, or a sequence-to-sequence model. In practical applications, the target model can be deployed on the server side or the terminal side to output corresponding prediction results based on the input data. This disclosure is not limited thereto.

[0072] Optionally, the lexical sequence can be understood as an ordered set of prediction units formed by the target model during the inference process. These prediction units can be arranged in a predetermined order to collectively express the model's overall inference result on the input data. For example, the lexical sequence can be a discrete symbol sequence output by the target model during the generation process, with each lexical unit corresponding to an element in the vocabulary. For instance, in a Chinese dialogue scenario, a lexical unit can correspond to a Chinese character, a sub-word, or a word fragment; in an English scenario, it can correspond to a word or a sub-word unit. This disclosure is not limited thereto.

[0073] Optionally, the term index is used to distinguish prediction units at different positions in the output sequence. It is only used to identify the relative positional relationship of the prediction results in the sequence and is not limited to a specific representation. For example, the term index uses parameters... This indicates the positional order of a word in the generated sequence, such as the first word, the second word, etc., and is used to distinguish the prediction results corresponding to different generation positions. Of course, this disclosure is not limited thereto.

[0074] Optionally, such as Figure 4 As shown, the predicted probability corresponding to the lexical index can represent the probability distribution of the target model for possible output results at the corresponding position. This predicted probability, as an intermediate quantity associated with the predicted position, is independently extracted from the fixed inference results of the model parameters and used for subsequent analysis of the model's internal stability in the current inference state. The predicted probability does not participate in model parameter updates during the analysis process but exists as an auxiliary variable reflecting the model's internal cognitive state. Of course, this disclosure is not limited to this.

[0075] For example, predicting probabilities It can be a vector of the same size as the vocabulary, representing the probability of generating each word at the current position. This predicted probability, as a probabilistic surrogate variable corresponding one-to-one with the predicted word position, is independent of the deterministic output of the model parameters and used as an intermediate quantity reflecting the internal cognitive state of the model in subsequent processing. This predicted probability is not used to update the model parameters, but rather participates in subsequent gradient calculations while keeping the model parameters unchanged, to reflect the stability of the model's prediction results under the current parameter conditions. Of course, this disclosure is not limited to this.

[0076] In a specific example, suppose the dictionary used by the target model has a length of . Then, any word index in the output sequence (also known as predicted location) On this, the model needs to be on The relative probability of the next output is determined from among the candidate lexical units. Specifically, when the target model performs forward inference on the input data, the probability of the next output is determined at the lexical index prediction position. The output layer will produce a score vector corresponding to the dictionary length, with dimensions of . Each element in the score vector corresponds to a candidate lexical unit in the dictionary, representing the relative tendency for that lexical unit to be selected at the current position. Subsequently, this... The score vector of dimension 1 is normalized and transformed into a probability vector. The result after normalization is also a single probability vector. A probability vector is a multidimensional vector in which each element is non-negative and the sum of all elements is 1. This probability vector constitutes the predicted location. Corresponding prediction probability .

[0077] Therefore, predict the probability. It can be considered as being in the predicted location The above represents a first-order probability distribution for the entire dictionary space, expressed in terms of... The probability vector exists and corresponds one-to-one with the predicted position in the output sequence. During the generation process, the target model typically selects a candidate word from the dictionary based on this predicted probability as the output for the current position, while retaining the complete probability vector as input information for subsequent uncertainty analysis and confidence calculation. This process is completed while keeping the model parameters unchanged and does not affect the original inference behavior of the target model. Of course, this disclosure is not limited thereto.

[0078] Optionally, the process of generating predicted probabilities can be synchronized with any forward computation during the inference process. Specifically, by performing a forward computation during inference, the word-by-word prediction distribution of the target model for the input data can be obtained, and the predicted probability of each generation position can be saved separately for subsequent uncertainty analysis. For example, in a text generation task, the softmax output result corresponding to each generation position can be recorded synchronously during the decoding stage. This process can be implemented by calling the inference interface of the target model, outputting the word sequence and its corresponding predicted probability information without changing the model structure and parameters. Of course, this disclosure is not limited thereto.

[0079] In operation S302, the uncertainty measure corresponding to each lexical index in the lexical sequence is calculated based at least in part on at least a portion of the model parameters of the target model and the prediction probability corresponding to each lexical index in the lexical sequence.

[0080] Optionally, such as Figure 4 As shown, at least some of the model parameters of the target model can be selected from the parameters in the target model that have a direct impact on the prediction results, or they can be any subset of parameters used to characterize the model's output behavior. The selection method is not limited by the specific model structure. For example, at least some of the model parameters of the target model can be selected from some parameters in the target model, such as the parameters of the last layer of the model, including the weight matrix and bias terms. These parameters directly affect the output form of the predicted probability and thus can reflect the internal state of the model during the prediction stage. Of course, this disclosure is not limited to this.

[0081] Optionally, the uncertainty measure is used to reflect the sensitivity of the target model to changes in the prediction results or the degree of internal cognitive ambiguity under the current parameter conditions. It can be represented by gradient information, statistics, or other numerical forms. For example, the uncertainty measure can reflect the stability or sensitivity of the prediction result for a certain word. For example, the uncertainty measure can be represented by gradient magnitude, gradient variance, or relevant statistics. Of course, this disclosure is not limited thereto.

[0082] In this embodiment of the disclosure, each lexical index in a plurality of lexical indices in a lexical sequence Corresponding prediction probability This method allows for gradient calculation of the loss function while keeping the model parameters constant, thus explicitly reflecting the model's response to the prediction result near the current parameter values. This differs from backpropagation used for training and from obtaining results through multiple samplings of model parameters; instead, it analyzes the model's internal cognitive state without affecting its original inference behavior.

[0083] Optionally, the uncertainty measure is based on an approximate analysis of the model parameter distribution. By examining the changing trend of the prediction behavior within a local range of the parameter space, a quantitative reflection of the reliability of the prediction results can be obtained. For example, a loss function with the prediction probability as the independent variable can be constructed. While keeping the model parameters unchanged, the response of the loss function to changes in the prediction probability can be analyzed to obtain uncertainty information at the corresponding location.

[0084] Alternatively, the uncertainty metric can be calculated by using each of the multiple lexical indices in the lexical sequence as an example. Corresponding prediction probability As an independent variable, a loss function is determined for the input data; and a gradient backpropagation operation is performed on at least a portion of the model parameters of the target model to obtain the gradient of the loss function with respect to the predicted probability, and the gradient is used as a measure of uncertainty of the corresponding lexical index.

[0085] Optionally, the gradient backpropagation is performed in the inference state of the model, and the resulting gradient is not used to update the model parameters, but only to analyze the stability of the prediction results.

[0086] Optionally, the aforementioned uncertainty measure is based on an approximation of the posterior distribution of some parameters of the target model. Specifically, a Laplace approximation can be applied to the negative log-likelihood function, treating the parameters of the last layer of the model as following a Gaussian distribution centered at the maximum a posteriori estimate. This maximum a posteriori estimate, determined by the original model parameters, serves as the central location of the parameter distribution, while the covariance matrix obtained through the Laplace approximation reflects the variation of the parameters around this center. Based on this approximation, the trend of prediction probability changes under parameter perturbations can be analyzed, thereby reflecting the instability of the model in predicting the results.

[0087] For example, the parameters of the last layer of the target model The posterior distribution is approximated by Laplace, assuming it follows a maximum a posteriori estimate. Gaussian distribution centered on .in, The covariance matrix is ​​determined by the parameters of the last layer of the target model after training and is used as the center location of the parameter distribution. Then, based on the negative log-likelihood function... The second-order approximation at the center is obtained to characterize the local uncertainty of the parameters near that center, without requiring access to or use of the training dataset during the inference phase.

[0088] For a given sequence of terms, the target model outputs a dictionary-based predicted probability at each term index, based on the context. For each lexical index t, the lexical corresponding to that index is selected, and a local negative log-likelihood function is constructed as the loss function based on the probability value of that lexical in the prediction probability. Under the above parameter distribution approximation, the change of the local negative log-likelihood or prediction probability under parameter perturbation is analyzed, and the corresponding uncertainty metric is calculated for each lexical index in the lexical sequence accordingly, thereby reflecting the stability of the target model for the prediction result at that lexical index.

[0089] In operation S303, the confidence level corresponding to the input data is determined at least in part based on the uncertainty measure corresponding to each of the plurality of lexical indices in the lexical sequence.

[0090] Optionally, confidence score is used to characterize the overall reliability of the target model's output under the current input conditions. It can correspond to a single prediction position or the entire output result. For example, confidence score can reflect the reliability of the target model's overall prediction results for the current input data, or the reliability of the prediction results at a certain generation position. For example, in dialogue rewriting or question-answering scenarios, confidence score can be used to determine whether the generated result is suitable to be directly returned to the user.

[0091] Optionally, confidence intervals or confidence levels associated with the prediction results can be obtained by statistically summarizing, scaling, or mapping uncertainty-related indicators, and corresponding confidence score data can be generated accordingly. By combining the confidence scores of each prediction location, an overall confidence score result at the input data level can also be obtained.

[0092] In a specific example, the confidence level can be determined as follows: for each of the plurality of lexical indices, calculate the variance of the uncertainty measure corresponding to the lexical index in the gradient space, and determine the corresponding standard deviation based on the variance; for each of the plurality of lexical indices, determine the confidence interval of the prediction probability based on the prediction probability corresponding to the lexical index and the standard deviation, and map the confidence interval to the confidence level data of the lexical index; and determine the confidence level corresponding to the input data based on the confidence level data of each of the plurality of lexical indices. Of course, this disclosure is not limited thereto.

[0093] For example, an interval within one standard deviation of the predicted probability can be used as a high-confidence interval (e.g., 95% confidence level) to obtain the confidence information for each generation location. By summing the confidence levels of each location, the overall confidence level at the input sample level can be further obtained.

[0094] Optionally, the gradient space can be understood as a feature space composed of gradient vectors as elements, used to measure the sensitivity of the prediction result to changes in the internal state; the confidence interval is used to describe the range of values ​​of the prediction probability at a certain confidence level. This disclosure does not limit this.

[0095] In addition, confidence can be determined in various ways, such as weighted aggregation based on word-level confidence, sample-level mapping based on minimum or average confidence, or threshold judgment combined with business rules. This disclosure does not limit this method.

[0096] In operation S304, the evaluation result of the output data of the target model is determined at least in part based on the confidence level corresponding to the input data.

[0097] Optionally, the evaluation results can be used to indicate the reliability level, risk level, or availability status of the model output, and can further be used to drive subsequent processing strategies, interaction logic, or system decision-making processes. For example, the evaluation results can be used to indicate whether the model output is reliable, whether further processing is needed, or whether an alternative strategy needs to be triggered. For example, in a dialogue system, the evaluation results can be used to determine whether to directly display the generated text, whether to introduce additional context to regenerate it, or whether to prompt the user for confirmation.

[0098] Therefore, in one aspect of this disclosure, embodiments of this disclosure quantify the uncertainty of the generation results of the target model based on the structure of the target model, enabling the target model to assess the inherent reliability of its generated content, thereby providing interpretable confidence metrics for downstream applications (e.g., multi-turn session rewriting applications) to help identify potential illusions and improve the robustness of the target model.

[0099] Next reference Figure 5 The following describes some optional details of the embodiments of this disclosure. Figure 5 A schematic diagram of a module 50 for performing a multi-round session rewriting task according to an embodiment of the present disclosure is shown.

[0100] Figure 5 An example architecture for module 50, used to perform a multi-turn session rewriting task, is shown. Module 50 includes an input and understanding module 51, a parallel retrieval module 52, and an answer and output module 53. In this example architecture, the confidence level obtained in method 30 can be embedded into the overall call flow of the multi-turn session rewriting task for evaluating and scheduling the rewriting results and subsequent processing.

[0101] During the operation of module 50, the input and understanding module 51 first receives the user's current question and retrieves the corresponding multi-turn historical dialogue information from the multi-turn conversation database, such as the question-and-answer records of the most recent rounds. The current question and historical dialogue information together constitute the input data and are sent to the rewriting model for inference processing. During the inference process, the rewriting model generates a rewriting result to eliminate referential ambiguity, complete omitted information, and unify semantic expression. This rewriting result is presented as the output data of the target model in the form of a word sequence.

[0102] While generating the lexical sequence, the rewriting model outputs the corresponding predicted probability at each generation position, and calculates an uncertainty metric based on the predicted probability and the model's internal parameters, thereby determining the confidence level corresponding to the rewriting result. This confidence level reflects the reliability of the model in completing semantic rewriting under the current multi-round context. After obtaining the rewriting result, the input and understanding module 51 simultaneously obtains the confidence level corresponding to the rewriting result and performs a quality judgment on it.

[0103] When the confidence level is determined to be higher than a preset acceptable threshold, the input and understanding module 51 considers the current rewriting result to have high reliability and sends the rewriting result to the parallel retrieval module 52 to drive the subsequent information retrieval process; when the confidence level is lower than a preset quality threshold, the rewriting result is marked as low-quality output data or output data that may have factual inconsistencies, and corresponding processing operations are triggered, such as risk labeling of the rewriting result, prompting the need to supplement context, or triggering a regeneration operation to obtain a new rewriting result.

[0104] After the confidence level passes the quality assessment, the rewritten results are input into different retrieval pathways of the parallel retrieval module 52. On one hand, the rewritten results are used for business data retrieval to obtain business rules, knowledge content, or service information related to the user's question; on the other hand, the rewritten results are also used for transaction data retrieval to obtain data content related to specific process status, operation records, or transaction information. In addition, when the input and understanding module 51 identifies the user's interaction intent based on the rewritten model, such as casual conversation, tool request, film / TV discussion, or emotional support, the corresponding intent information is also sent to the parallel retrieval module 52 to trigger the retrieval of pre-set dialogue information or cold start data.

[0105] After completing various retrieval operations, the parallel retrieval module 52 transmits the obtained business data, transaction data, and pre-set data to the answer and output module 53. The answer and output module 53 combines the user's persona information, the rewritten question information, and its corresponding confidence level to uniformly integrate the multi-source information, and inputs the integrated result into the large model to generate the final answer. After generation, the answer and output module 53 returns the final answer to the input and understanding module 51, which then displays it to the user, while storing the current round of questions, rewriting results, confidence levels, and answer results.

[0106] In a specific example, a user inputs the question "What happened to him later?" The system identifies from historical dialogues that the question refers to the subsequent plot of a certain film or television character. The input and understanding module 51 generates a rewritten result based on multi-turn context: "What is the final development of this character in the subsequent plot?", and simultaneously obtains the confidence level corresponding to this rewritten result. The interface can display this rewritten result in text form, simultaneously showing the overall confidence level or word-level confidence level annotation. When the confidence level is low, the interface can indicate that the understanding result is uncertain, or automatically trigger regeneration; when the confidence level is high, the retrieval and answer generation are directly completed based on the rewritten result.

[0107] Furthermore, in one embodiment of this disclosure, method 30 further includes using the uncertainty measure or the confidence level as a supervision signal to train an auxiliary model for predicting the confidence level information of the target model output. By accumulating and learning the confidence levels of rewrite results in historical multi-turn session samples, the auxiliary model can quickly provide confidence level prediction results in subsequent inference, thereby further improving the overall efficiency and stability of the system in multi-turn session rewrite scenarios.

[0108] Through the above process, the embodiments of this disclosure achieve an organic combination of rewriting result generation, confidence calculation, quality judgment and policy scheduling in multi-turn conversation rewriting tasks. This enables the system to not only output semantically complete rewriting results, but also to quantitatively evaluate their reliability, thereby significantly improving the controllability and robustness of multi-turn conversation applications in complex interaction scenarios.

[0109] Figure 6 A schematic structure of a target model 60 according to an embodiment of the present disclosure is shown. This target model is used for sequence modeling and prediction of input data (e.g., user questions in a multi-turn session rewriting task) and serves as the base model for uncertainty and confidence calculations in method 30.

[0110] like Figure 6 As shown, the target model 60 adopts a decoding structure, consisting of a word mapping layer 61, a multi-layer decoding layer 62, a normalization layer 63, and an output prediction layer 64. In one example implementation, the model uses a dictionary space of length 152064. The target model 60 first maps each word in the dictionary to a dictionary of dimension 64. The vector representation is used as the basic input for subsequent sequence modeling. This mapping process is performed by the lexical mapping layer 61, which converts discrete symbols into representations in a continuous vector space.

[0111] Following the lexical mapping layer 61, the main body of the target model 60 consists of 28 sequentially stacked decoding layers 62. Each decoding layer 62 is used to perform context modeling and feature transformation on the input of the current layer, thereby progressively enhancing the model's ability to express sequence structure and semantic relationships. The decoding layer 62 mainly includes a self-attention structure, a feedforward transformation structure, and corresponding normalization processing units. Specifically, the self-attention structure is used to model the dependencies between different positions in the sequence, the feedforward transformation structure is used to perform non-linear mapping and dimensionality transformation on the features, and the normalization structure is used to stabilize the training process and improve model convergence.

[0112] After completing the multi-layer decoding process, the target model 60 feeds the output features into the normalization layer 63 for uniform scaling, and then maps the features back to the dictionary space through the output prediction layer 64. The output prediction layer 64 performs a linear transformation on the output vector at each position to obtain its predicted distribution across the entire dictionary, thereby providing a corresponding predicted probability for each generated position. It should be noted that in this example structure, the lexical mapping layer 61 remains fixed and does not participate in the training process; model training mainly focuses on the decoding layer 62 and its related parameters.

[0113] To facilitate understanding of the overall structure of the target model 60, the following section is provided... Figure 6 Corresponding pseudocode example:

[0114]

[0115] In the pseudocode above, the input sequence is first mapped to a vector representation, then undergoes feature transformation through multiple decoding layers 62. After normalization, a prediction score is obtained through linear mapping, which is further converted into a prediction probability. This prediction probability serves as the basis for subsequent uncertainty measurement and confidence calculation.

[0116] In combination Figure 6 Based on the target model structure shown, the method 70 for training the target model according to an embodiment of this disclosure will be described below.

[0117] Figure 7 A flowchart of a method 70 for training a target model according to an embodiment of the present disclosure is shown. Method 70 is used to introduce uncertainty and confidence information during the training phase to control the model training process.

[0118] Method 70 can be used on the user terminal (e.g., Figure 1 The method 70 can be executed at the user terminal 120 or on the server 110. Alternatively, it can be executed jointly by the user terminal and the server. Method 70 includes the following operations S701 to S704. Of course, method 70 may include more or fewer operations, and this disclosure is not limited thereto.

[0119] In operation S701, for the input sample set, the target model is used to process each input sample in the input sample set to generate a corresponding word sequence, and the prediction probability corresponding to each word index in the multiple word indices in the word sequence is determined.

[0120] Optionally, the input sample set may include multiple sample data for training or validation, each input sample consisting of the current input content and its related context information. This input sample set maintains the same format as the input data used in the aforementioned inference phase, but it is primarily used for model training or training process control. For example, in a multi-turn conversation rewriting scenario, each sample in the input sample set may include a user question and its corresponding multi-turn historical dialogue information.

[0121] In operation S702, the uncertainty measure corresponding to each lexical index in the plurality of lexical indices in the lexical sequence is calculated, based at least in part on at least a portion of the model parameters of the target model and the predicted probability.

[0122] Optionally, this uncertainty metric is used to reflect the stability of the model's prediction results under the current parameter conditions. Its calculation process is not for the purpose of parameter updates, but rather to analyze the model's cognitive state regarding the training samples.

[0123] In operation S703, the confidence level of each input sample in the input sample set is determined at least in part based on the uncertainty measure corresponding to each lexical index in the plurality of lexical indices in the lexical sequence.

[0124] Optionally, the confidence level can be used to characterize the difference in reliability of the model when processing different training samples, and can be represented at the word level or the sample level.

[0125] In operation S704, the training process of the target model is controlled at least in part based on the confidence level of each input sample in the input sample set.

[0126] Specifically, confidence scores can be used to adjust the weights of different samples during training, select samples that need to be prioritized for learning, or determine whether the model's learning state on certain samples has stabilized. By introducing confidence score information during training, premature convergence of the model on samples with high uncertainty can be avoided, thereby improving the overall training effect and the model's generalization ability.

[0127] Through the above method 70, this embodiment of the disclosure introduces uncertainty and confidence mechanisms into the training process of the target model, enabling the model to adaptively adjust the training process based on its own prediction behavior while keeping the structure unchanged, thereby further improving the stability and reliability of the model in complex sequence tasks.

[0128] Next reference Figure 8 Further details regarding optional aspects of the training process for the target model will be provided. Figure 8 A schematic diagram illustrating the process of training a target model according to an embodiment of this disclosure is shown. Building upon method 60, it further explains how to control training samples, training pace, and convergence judgment based on confidence information, thereby improving the learning quality and stability of the model in multi-round conversation rewriting tasks.

[0129] In one example, the control of the training process of the target model is reflected in the confidence-based sample selection and iterative training mechanism. Optionally, operation S704 includes: during the training process of the target model, obtaining the confidence scores corresponding to multiple input samples in the input sample set; performing statistical analysis on the confidence scores corresponding to the multiple input samples based on the number of training steps to obtain confidence score distribution parameters; and determining that the target model has reached the training convergence state when the change amplitude of the confidence score distribution parameters corresponding to adjacent training steps is less than a preset fluctuation threshold.

[0130] In a specific implementation, the training process can begin with the initial preparation of training data. During the first training of the task model, the training data is organized into a dataset in an instruction fine-tuning format. Each training data point contains unique identifier information, instruction text, and the corresponding expected output. The instruction text describes the task objective and includes necessary contextual information. For example, in a movie / TV show Q&A assistant scenario, the instruction might require the model to semantically rewrite the current question given the user's past Q&A history and the current question, ensuring its semantic completeness without relying on the context. The historical context included in the instruction provides background information, while the current question is the target content to be rewritten. During training, the model uses the instruction text as input, generates predicted text of the same length as the reference output, and calculates the supervised loss at each predicted position against the corresponding lexical units in the reference output, thus completing the standard instruction fine-tuning training.

[0131] The following is a training dataset presented in pseudocode form.

[0132]

[0133] In this pseudocode example, the text content corresponding to the `instruction` field is used as the input text for the model, explicitly informing it of the current task objective and available context information. Upon receiving this `instruction` text, the model begins generating predicted text position-by-position in autoregressive generation mode. The length of the generated predicted text is constrained to be the same as the length of the reference output text, denoted as length `n`, where `n` equals the number of words or characters contained in the reference output text. The model first generates the first predicted word, concatenates this prediction result with the instruction text, and continues to use it as input to generate subsequent predicted words, until a complete sequence of `n` predicted words is generated. Thus, the model output forms a sequence of predicted words of length `n`, providing the prediction probability for the dictionary space at each prediction position.

[0134] During the supervised fine-tuning phase, the predicted word sequence generated by the model is aligned position-by-position with the reference output word sequence. For the j-th prediction position, the corresponding word in the reference output is represented as a one-hot vector in the dictionary space. The predicted probability distribution output by the model at this position is measured against this one-hot vector using cross-entropy loss. After calculating the cross-entropy loss for each of the n prediction positions in the sample, these losses are accumulated or averaged across the sample dimension and then summarized across the batch dimension to obtain the batch-level instruction fine-tuning loss. This loss serves as the target for backpropagation, used to update the model parameters of the target model.

[0135] After the initial training, the trained task model is used to infer the training data again. The uncertainty measure of each sample during the generation process is calculated using the aforementioned method, and the corresponding sample-level confidence is further determined. Based on the obtained confidence information, samples with confidence levels below a preset threshold are selected from the training data and used as the data to be iterated. Simultaneously, since sample-level confidence is usually averaged across the predicted location dimension, it may not fully cover situations where the overall confidence is high but local key location predictions are incorrect. Therefore, samples whose prediction results are inconsistent with the reference output are also included in the data set to be iterated.

[0136] Subsequently, the data to be iterated over is mixed with the original training data to form a new training sample set, and iterative training is performed on the target model. In this way, the model can focus on samples with high uncertainty or incorrect predictions in subsequent training, thereby continuously correcting the model's prediction bias at key locations. As the training process progresses, new data can be continuously collected, and the sample confidence is recalculated under the new model parameters to obtain new iterative data. The above training process is repeated until the model's accuracy on the new data reaches a preset threshold.

[0137] In another optional implementation, the confidence level can also be used to influence the determination of the training convergence state. Optionally, operation S704 includes: during the training of the target model, obtaining the confidence levels corresponding to multiple input samples in the input sample set; performing statistical analysis on the confidence levels corresponding to the multiple input samples based on the number of training steps to obtain confidence level distribution parameters; and determining that the target model has reached the training convergence state when the change amplitude of the confidence level distribution parameters corresponding to adjacent training steps is less than a preset fluctuation threshold. This example can avoid the inaccuracy caused by relying solely on changes in the loss function value for convergence determination, making the training termination condition more closely match the actual predictive stability of the model.

[0138] During the iterative training process, for the data to be iterated, the system aligns the word sequence generated by the target model with the corresponding reference output word sequence position by position, and calculates the cross-entropy loss between the predicted probability and the reference output at each position. Subsequently, the model parameters of the target model are updated based at least in part on this cross-entropy loss, thereby completing one training iteration.

[0139] In a specific implementation example, the parameters of the target model can be initialized using the weights of an open-source pre-trained network to ensure that the model has good language modeling capabilities in the early stages of training. Regarding training strategies, a full-parameter fine-tuning approach can be used to update all parameters in the target model; alternatively, a parameter-efficient fine-tuning approach can be used to train only the attention-related parameters in the decoding layer. During the learning process, training samples are divided into multiple batches according to a preset batch size, with each batch serving as a basic training unit. One training iteration is completed when all training samples have been traversed once.

[0140] During training in each batch, the target model first performs forward computation, taking the instruction text as input and progressively generating a sequence of predicted tokens, obtaining the corresponding predicted probability distribution at each generation position. The target model compares the obtained predicted probability matrix with the reference output text to calculate the batch-level loss value. Subsequently, the target model performs backward computation, feeding the loss back into the network to calculate the gradients of each parameter, and updating the model parameters based on these gradients.

[0141] In choosing a loss function, the cross-entropy loss commonly used in the instruction fine-tuning stage can be adopted to improve the prediction accuracy of the model on supervised text. In the further optimization stage, reinforcement learning-related loss forms can also be introduced, such as divergence loss based on distribution constraints or loss function based on preference optimization, to further optimize the quality and consistency of the model's generated results.

[0142] Specifically, in one example of this disclosure, the target model employs cross-entropy loss based on word-level classification as the primary training objective during the instruction fine-tuning phase. Specifically, in supervised fine-tuning training, the target model performs autoregressive generation for each input sample in a batch. Let the number of samples in a training batch be bs, and the length of the reference output text corresponding to the i-th sample be... The model generates a sample of length i for the i-th sample. The predicted word sequence, and at each predicted position The output shows the predicted probability distribution of the target word in the dictionary space. The true word at the corresponding position in the reference output is represented in one-hot form, with a value of 1 at the position corresponding to the target word and 0 at the other positions.

[0143] Based on the above settings, the word-level cross-entropy loss used in the instruction fine-tuning stage can be expressed as formula (1):

[0144] Formula (1)

[0145] Where 𝑦[𝑖,𝑗] represents the supervision label of the i-th sample at the j-th prediction position. When the predicted word at this position is the same as the reference output word, its value is 1 at the dictionary position corresponding to the target word; otherwise, it is 0. 𝑝[𝑖,𝑗] represents the prediction probability given by the target model for the target word at the same position. This loss function, by taking the logarithm of the prediction probability and multiplying it by the supervision label, enables the model to continuously improve the prediction probability of the reference output word during backpropagation.

[0146] In the specific training process, for each sample, the target model first generates predicted words position by position based on the instruction text, and the generated length reaches the reference output text length. Then stop generating. Subsequently, the generated prediction probability matrix (whose dimensions can be represented as...) will be... (Multiplied by the dictionary size) Aligned position-by-position with the reference output text, the cross-entropy loss at each predicted position is calculated. The predicted positions for the same sample are summed, and then averaged over the batch dimension to obtain the instruction fine-tuning loss for the current batch. .

[0147] The cross-entropy loss is used as a supervisory signal in backpropagation to update the model parameters of the target model. In subsequent confidence-based sample selection and iterative training, the data to be iterated on is also trained using the above loss form, thus ensuring that the model can still converge stably with position-by-position fine supervision even when high-uncertainty samples and mispredicted samples are continuously introduced.

[0148] After completing the instruction fine-tuning training based on the aforementioned cross-entropy loss, the embodiments of this disclosure may further introduce training strategies for the reinforcement learning stage. For example, under the constraint of maintaining the stability of the model output distribution, the model generation results may be optimized by a preference comparison method to further improve the overall generation quality and consistency of the model in tasks such as multi-round session rewriting.

[0149] According to another aspect of this disclosure, an evaluation device 90 is also provided, such as Figure 9 As shown. The evaluation device 90 may include a first module 910, a second module 920, a third module 930, and a fourth module 940. In addition to these modules, the evaluation device 90 may also include other related components, and this disclosure is not limited thereto. Furthermore, details of some functions of the evaluation device 90 are referenced in the accompanying drawings. Figures 2 to 6 The details of the steps in method 30 are similar, so for the sake of brevity, repeated descriptions of some content are omitted here.

[0150] The first module 910 is configured to: generate a word sequence using the target model for the input data and determine the prediction probability corresponding to each word index among the multiple word indices in the word sequence.

[0151] The second module 920 is configured to: calculate the uncertainty measure corresponding to each lexical index in the lexical sequence based at least in part on at least a portion of the model parameters of the target model and the prediction probability corresponding to each lexical index in the lexical sequence.

[0152] The third module 930 is configured to: determine the confidence level of the input data based at least in part on the uncertainty measure corresponding to each of the plurality of lexical indices in the lexical sequence.

[0153] The fourth module 940 is configured to: determine the evaluation result of the output data of the target model based at least in part on the confidence level corresponding to the input data.

[0154] According to another aspect of this disclosure, a training device 1000 is also provided, such as... Figure 10 As shown. The training device 1000 may include a first module 1010, a second module 1020, a third module 1030, and a fourth module 1040. In addition to these units, the training device 1000 may also include other related components, and this disclosure is not limited thereto. Furthermore, details of some functions of the training device 1000 are referenced in the references. Figures 6 to 8 The details of the steps in method 70 are similar, so for the sake of brevity, repeated descriptions of some content are omitted here.

[0155] The first module 1010 is configured to: process each input sample in the input sample set using the target model, generate a corresponding word sequence, and determine the prediction probability corresponding to each word index among multiple word indices in the word sequence.

[0156] The second module 1020 is configured to: calculate the uncertainty measure corresponding to each lexical index among the multiple lexical indices in the lexical sequence, based at least in part on at least a portion of the model parameters of the target model and the predicted probability.

[0157] The third module 1030 is configured to: determine the confidence level of each input sample in the input sample set based at least in part on the uncertainty measure corresponding to each lexical index in the plurality of lexical indices in the lexical sequence.

[0158] The fourth module 1040 is configured to control the training process of the target model based at least in part on the confidence level corresponding to each input sample in the input sample set.

[0159] According to another aspect of this disclosure, an electronic device is also provided for implementing the methods according to embodiments of this disclosure. Figure 11 A schematic diagram of an electronic device 2000 according to an embodiment of the present disclosure is shown. The electronic device may be... Figure 1 The user terminal 120 or server 110 shown.

[0160] like Figure 11 As shown, the electronic device 2000 may include one or more processors 2010 and one or more memories 2020. The memories 2020 store computer-executable instructions, which, when run by the one or more processors 2010, can execute the methods described above.

[0161] The processor in this disclosure embodiment can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, operations, and logic block diagrams disclosed in this disclosure embodiment. The general-purpose processor can be a microprocessor or any conventional processor, and can be based on an x86 architecture or an ARM architecture.

[0162] In general, the various exemplary embodiments of this disclosure can be implemented in hardware or dedicated circuitry, software, firmware, logic, or any combination thereof. Some aspects can be implemented in hardware, while others can be implemented in firmware or software that can be executed by a controller, microprocessor, or other computing device. When aspects of embodiments of this disclosure are illustrated or described as block diagrams, flowcharts, or using some other graphical representation, it will be understood that the blocks, apparatuses, systems, techniques, or methods described herein can be implemented as non-limiting examples in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or controllers or other computing devices, or some combination thereof.

[0163] For example, the method or apparatus according to embodiments of this disclosure can also be used by means of Figure 12 The architecture of the computing device 3000 shown is used for implementation. For example, Figure 12 The electronic device 2000 in the device can adopt the architecture of the computing device 3000.

[0164] like Figure 12As shown, the computing device 3000 may include a bus 3010, one or more CPUs 3020, a read-only memory (ROM) 3030, a random access memory (RAM) 3040, a communication port 3050 connected to a network, an input / output component 3060, a hard disk 3070, etc. The storage devices in the computing device 3000, such as the ROM 3030 or the hard disk 3070, may store various data or files used for processing and / or communication of the methods provided in this disclosure, as well as program instructions executed by the CPU. The computing device 3000 may also include a user interface 3080. Of course, Figure 10 The architecture shown is merely exemplary and can be omitted as needed when implementing different devices. Figure 10 One or more components in the computing device shown.

[0165] According to another aspect of this disclosure, a computer-readable storage medium is also provided. Figure 13 A schematic diagram of a computer-readable storage medium 4020 according to the present disclosure is shown.

[0166] like Figure 13 As shown, the computer-readable storage medium 4020 stores computer-executable instructions 4010. When the computer-executable instructions 4010 are executed by a processor, the methods according to embodiments of the present disclosure described with reference to the above figures can be performed. The computer-readable storage medium in the embodiments of the present disclosure may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct memory bus random access memory (DR RAM). It should be noted that the memory used in the methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0167] This disclosure also provides a computer program product or computer program including computer-executable instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the computer device to perform a method according to an embodiment of this disclosure.

[0168] It should be noted that 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 code containing one or more executable instructions for implementing the specified logical function. It should also be noted that 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 consecutively indicated 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, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer-executable instructions.

[0169] In general, the various exemplary embodiments of this disclosure can be implemented in hardware or dedicated circuitry, software, firmware, logic, or any combination thereof. Some aspects can be implemented in hardware, while others can be implemented in firmware or software that can be executed by a controller, microprocessor, or other computing device. When aspects of embodiments of this disclosure are illustrated or described as block diagrams, flowcharts, or using some other graphical representation, it will be understood that the blocks, apparatuses, systems, techniques, or methods described herein can be implemented as non-limiting examples in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or controllers or other computing devices, or some combination thereof.

[0170] The exemplary embodiments of this disclosure described in detail above are merely illustrative and not restrictive. Those skilled in the art will understand that various modifications and combinations of these embodiments or their features can be made without departing from the principles and spirit of this disclosure, and such modifications should fall within the scope of this disclosure. For example, the following provides an overview of some aspects of this disclosure, which can be combined with any other aspects.

[0171] Aspect 1: A method for evaluating the output data of a target model is provided, comprising: for input data, using the target model, generating a lexical sequence and determining the prediction probability corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; calculating an uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence based at least in part on at least a portion of the model parameters of the target model and the prediction probability corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; determining a confidence level corresponding to the input data based at least in part on the uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; and determining an evaluation result of the output data of the target model based at least in part on the confidence level corresponding to the input data.

[0172] Aspect 2: The calculation of the uncertainty measure corresponding to each lexical index in the plurality of lexical indices in the lexical sequence includes: determining a loss function for the input data using the predicted probability corresponding to each lexical index in the plurality of lexical indices in the lexical sequence as an independent variable; and performing gradient backpropagation on at least a portion of the model parameters of the target model to obtain the gradient of the loss function relative to the predicted probability, and using the gradient as the uncertainty measure of the corresponding lexical index.

[0173] Aspect 3: At least a portion of the model parameters of the target model are the parameters of the last layer of the target model, and the gradient backpropagation operation is performed in the inference state of the target model, and the obtained gradient is not used to update the model parameters of the target model.

[0174] Aspect 4: Determining the confidence level corresponding to the input data includes: for each of the plurality of lexical indices, calculating the variance of the uncertainty measure corresponding to the lexical index in the gradient space, and determining the corresponding standard deviation based on the variance; for each of the plurality of lexical indices, determining the confidence interval of the prediction probability based on the prediction probability corresponding to the lexical index and the standard deviation, and mapping the confidence interval to the confidence level data of the lexical index; and determining the confidence level corresponding to the input data based on the confidence level data of each of the plurality of lexical indices.

[0175] Aspect 5: The uncertainty measure is based on an approximation of the posterior distribution of at least a portion of the model parameters of the target model, which is determined by Laplace approximating Bayesianization of the negative log-likelihood function.

[0176] Aspect 6: The method further includes: outputting the word sequence as output data of the target model, and simultaneously outputting the confidence level corresponding to the output data.

[0177] Aspect 7: The method further includes: outputting the word sequence as output data of the target model, and simultaneously outputting the confidence level corresponding to the output data.

[0178] Aspect 8: The method further includes: determining whether the confidence level is lower than a preset quality threshold; and in response to the confidence level being lower than the preset quality threshold, marking the corresponding output data as low-quality output data or fact-inconsistent output data.

[0179] Aspect 9: The input data includes the current question and its corresponding multi-turn historical dialogue information, and the output data is the rewriting result after semantic rewriting of the current question.

[0180] Aspect 10: The method further includes: determining the confidence level corresponding to the rewriting result; when the confidence level is lower than a preset acceptable threshold, triggering a rewriting prompt, result annotation, or regeneration operation on the rewriting result.

[0181] Aspect 11: A method for training a target model is provided, comprising: processing each input sample in the input sample set using a target model to generate a corresponding word sequence, and determining the prediction probability corresponding to each word index among a plurality of word indices in the word sequence; calculating an uncertainty measure corresponding to each word index among a plurality of word indices in the word sequence, at least in part based on at least a portion of model parameters of the target model and the prediction probability; determining a confidence level corresponding to each input sample in the input sample set, at least in part based on the uncertainty measure corresponding to each word index among a plurality of word indices in the word sequence; and controlling the training process of the target model, at least in part based on the confidence level corresponding to each input sample in the input sample set.

[0182] Aspect 12: Controlling the training process of the target model includes: during the training process of the target model, obtaining the confidence scores corresponding to multiple input samples in the input sample set; performing statistical analysis on the confidence scores corresponding to the multiple input samples based on the number of training steps to obtain confidence score distribution parameters; and determining that the target model has reached the training convergence state when the change amplitude of the confidence score distribution parameters corresponding to adjacent training steps is less than a preset fluctuation threshold.

[0183] Aspect 13: Controlling the training process of the target model further includes: during the training process of the target model, obtaining the confidence level of each input sample in the input sample set; filtering input samples in the input sample set whose confidence level is lower than a preset threshold as data to be iterated; and using the data to be iterated to perform iterative training on the target model.

[0184] Aspect 14: The iterative training includes: for the data to be iterated, aligning the word sequence generated by the target model with the corresponding reference output word sequence position by position; calculating the cross-entropy loss between the predicted probability corresponding to each word index in the word sequence and the corresponding reference output word; and updating the model parameters of the target model at least in part based on the cross-entropy loss.

[0185] Method 15: An evaluation apparatus is provided, comprising: a first module configured to: generate a lexical sequence for input data using a target model and determine a prediction probability corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; a second module configured to: calculate an uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence, based at least in part on at least a portion of model parameters of the target model and the prediction probability corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; a third module configured to: determine a confidence level corresponding to the input data, based at least in part on the uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; and a fourth module configured to: determine an evaluation result for the output data of the target model, based at least in part on the confidence level corresponding to the input data.

[0186] Method 16: A training apparatus is provided, comprising: a first module configured to: process each input sample in the input sample set using a target model for an input sample set, generate a corresponding lexical sequence, and determine the prediction probability corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; a second module configured to: calculate an uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence, at least in part based on at least a portion of the model parameters of the target model and the prediction probability; a third module configured to: determine a confidence level corresponding to each input sample in the input sample set, at least in part based on the uncertainty measure corresponding to each lexical index among a plurality of lexical indices in the lexical sequence; and a fourth module configured to: control the training process of the target model, at least in part based on the confidence level corresponding to each input sample in the input sample set.

[0187] Aspect 17: An electronic device comprising: one or more processors; and one or more memories, wherein the memories store computer-executable instructions that, when executed by the processor, perform the method described in any aspect.

[0188] Aspect 18: A computer-readable storage medium having stored thereon computer-executable instructions which, when executed by a processor, implement the method described in any aspect.

[0189] Aspect 19: A computer program product comprising computer-executable instructions which, when executed by a processor, are used to implement the method described in any aspect.

Claims

1. A method for evaluating the output data of a target model, comprising: For the input data, the target model is used to generate a word sequence and determine the prediction probability corresponding to each word index among multiple word indices in the word sequence; The uncertainty measure corresponding to each lexical index in the lexical sequence is calculated based at least in part on at least a portion of the model parameters of the target model and the prediction probability corresponding to each lexical index in the lexical sequence. The confidence level of the input data is determined at least in part based on the uncertainty measure corresponding to each of the multiple lexical indices in the lexical sequence. as well as The evaluation result of the output data of the target model is determined at least in part based on the confidence level corresponding to the input data.

2. The method according to claim 1, wherein, The calculation of the uncertainty measure corresponding to each lexical index among the multiple lexical indices in the lexical sequence includes: Using the predicted probability corresponding to each lexical index in the lexical sequence as the independent variable, a loss function is determined for the input data; and A gradient backpropagation operation is performed on at least a portion of the model parameters of the target model to obtain the gradient of the loss function with respect to the predicted probability, and the gradient is used as a measure of uncertainty of the corresponding lexical index.

3. The method according to claim 2, wherein, At least some of the model parameters of the target model are the parameters of the last layer of the target model, and the gradient backpropagation operation is performed in the inference state of the target model, and the obtained gradient is not used to update the model parameters of the target model.

4. The method according to claim 1, wherein, Determining the confidence level corresponding to the input data includes: For each of the plurality of lexical indices, calculate the variance of the uncertainty measure corresponding to the lexical index in the gradient space, and determine the corresponding standard deviation based on the variance; For each of the plurality of lexical indices, based on the predicted probability corresponding to the lexical index and the standard deviation, a confidence interval for the predicted probability is determined, and the confidence interval is mapped to the confidence score data of the lexical index; and The confidence level of the input data is determined based on the confidence level data of each of the multiple lexical indices.

5. The method according to claim 1, wherein, The uncertainty measure is based on an approximation of the posterior distribution of at least a portion of the model parameters of the target model, which is determined by Laplace approximating Bayesianization of the negative log-likelihood function.

6. The method according to claim 1, wherein, The method further includes: The word sequence is output as the output data of the target model, and the confidence level corresponding to the output data is also output.

7. The method according to claim 1, wherein, The method further includes: The uncertainty measure or the confidence level is used as a supervision signal to train an auxiliary model for predicting the confidence level information of the target model output.

8. The method according to claim 1, wherein, The method further includes: Determine whether the confidence level is lower than a preset quality threshold; In response to the confidence level being lower than the preset quality threshold, the corresponding output data is marked as low-quality output data or inconsistent output data.

9. The method according to claim 1, wherein, The input data includes the current question and its corresponding multi-turn historical dialogue information, and the output data is the rewriting result after semantic rewriting of the current question.

10. The method according to claim 9, wherein, The method further includes: Determine the confidence level corresponding to the rewriting result; When the confidence level is lower than a preset acceptable threshold, a rewrite prompt, result annotation, or regeneration operation is triggered on the rewrite result.

11. A method for training a target model, comprising: For the input sample set, the target model is used to process each input sample in the input sample set to generate a corresponding word sequence, and the prediction probability corresponding to each word index in the multiple word indices in the word sequence is determined. Based at least in part on at least a portion of the model parameters of the target model and the predicted probability, calculate the uncertainty measure corresponding to each lexical index among multiple lexical indices in the lexical sequence; The confidence level of each input sample in the input sample set is determined at least in part based on the uncertainty measure corresponding to each lexical index among multiple lexical indices in the lexical sequence. as well as The training process of the target model is controlled at least in part based on the confidence level of each input sample in the input sample set.

12. The method according to claim 11, wherein, Controlling the training process of the target model includes: During the training of the target model, the confidence scores of multiple input samples in the input sample set are obtained; Based on the number of training steps, statistical analysis is performed on the confidence scores corresponding to the multiple input samples to obtain confidence score distribution parameters; and When the change in the confidence distribution parameter corresponding to adjacent training steps is less than a preset fluctuation threshold, the target model is determined to have reached the training convergence state.

13. The method according to claim 11, wherein, Controlling the training process of the target model also includes: During the training of the target model, the confidence level of each input sample in the input sample set is obtained; Input samples with confidence levels below a preset threshold from the input sample set are selected as data to be iterated over; and The target model is iteratively trained using the data to be iterated.

14. The method according to claim 13, wherein, The iterative training includes: For the data to be iterated, the word sequence generated by the target model is aligned position by position with the corresponding reference output word sequence; Calculate the cross-entropy loss between the predicted probability corresponding to each lexical index in the lexical sequence and the corresponding reference output lexical; and The model parameters of the target model are updated, at least in part, based on the cross-entropy loss.

15. An evaluation apparatus, comprising: The first module is configured to: generate a word sequence using the target model for the input data and determine the prediction probability corresponding to each word index among the multiple word indices in the word sequence; The second module is configured to: calculate the uncertainty measure corresponding to each lexical index in the lexical sequence based at least in part on at least a portion of the model parameters of the target model and the prediction probability corresponding to each lexical index in the lexical sequence; The third module is configured to: determine the confidence level of the input data based at least in part on the uncertainty measure corresponding to each of the multiple lexical indices in the lexical sequence; as well as The fourth module is configured to: determine the evaluation result of the output data of the target model based at least in part on the confidence level corresponding to the input data.

16. A training device, comprising: The first module is configured to: process each input sample in the input sample set using the target model, generate a corresponding word sequence, and determine the prediction probability corresponding to each word index in the multiple word indices of the word sequence; The second module is configured to: calculate, at least in part, an uncertainty measure corresponding to each lexical index among multiple lexical indices in the lexical sequence based on at least a portion of the model parameters of the target model and the predicted probability; The third module is configured to: determine the confidence level of each input sample in the input sample set based at least in part on the uncertainty measure corresponding to each lexical index among multiple lexical indices in the lexical sequence; as well as The fourth module is configured to control the training process of the target model based at least in part on the confidence level corresponding to each input sample in the input sample set.

17. An electronic device comprising: One or more processors; and One or more memories, wherein the memories store computer-executable instructions that, when executed by the processor, perform the method of any one of claims 1-14.

18. A computer-readable storage medium having stored thereon computer-executable instructions that, when executed by a processor, implement the method as claimed in any one of claims 1-14.

19. A computer program product comprising computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-14.