Conversational methods and apparatus

By receiving dialogue messages input by the user, calling the pre-trained first model for inference, and using the learning requirements and historical repair example set to guide the model to avoid errors, the problem of decreased output accuracy of large language models in practical applications is solved, achieving higher output accuracy and generalization ability.

CN122242728APending Publication Date: 2026-06-19VIVO MOBILE COMM CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
VIVO MOBILE COMM CO LTD
Filing Date
2026-03-10
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

In practical applications, large language models cannot cover all situations due to the diversity and complexity of user input, resulting in decreased output accuracy and the generation of erroneous cases.

Method used

By receiving dialogue messages input by the user, the pre-trained first model is invoked for inference. The model is guided to avoid errors by using the learning requirements instructions and historical repair example sets in the repair data, including generalization and training on historical dialogue messages, and updating the model's prefix parameters to improve accuracy.

🎯Benefits of technology

This reduces the probability of the model outputting incorrect answers, improves the accuracy of the output results, and enhances the model's generalization and comprehension abilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122242728A_ABST
    Figure CN122242728A_ABST
Patent Text Reader

Abstract

This application discloses a dialogue method and apparatus, belonging to the field of artificial intelligence technology. The dialogue method includes: receiving a first dialogue message input by a user; calling the first model to process the first dialogue message and model repair data used to train the first model; and outputting a first output result. The model repair data includes learning requirement instructions and a set of historical repair examples.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of artificial intelligence technology, specifically relating to a dialogue method and apparatus. Background Technology

[0002] Large Language Models (LLMs) are deep learning-based artificial intelligence models that learn patterns, grammar, knowledge, and reasoning abilities of human language by being trained on large amounts of text data. This allows them to understand, generate, and process natural language. With the continuous development of LLM technology, it can be widely applied to various service scenarios such as intelligent dialogue and content creation.

[0003] Although large language models are tested and optimized before going live and being used, in actual applications, user input is diverse and complex. Large language models cannot cover all situations and will produce error cases. These error cases will lead to a decrease in the accuracy of the output of large language models. Summary of the Invention

[0004] The purpose of this application embodiment is to provide a dialogue method and apparatus, which receives a first dialogue message input by a user, calls the first model to perform inference based on the first dialogue message and the model repair parameters used to train the first model, and outputs a first output result. The learning requirement instructions and historical repair example set in the model repair data can guide the first model to avoid making the same or similar errors as those in the historical repair example set, reduce the probability of the first model outputting incorrect answers, and improve the accuracy of the first model's output.

[0005] In a first aspect, embodiments of this application provide a dialogue method, comprising: receiving a first dialogue message input by a user; invoking a first model for processing based on the first dialogue message and model repair data used to train a first model; and outputting a first output result, wherein the model repair data includes learning requirement instructions and a set of historical repair examples.

[0006] In some possible embodiments, before receiving the first dialogue message input by the user, the method further includes: obtaining historical dialogue messages, which have correct and incorrect answers; generalizing the historical dialogue messages to obtain at least one rewritten dialogue message, the semantics of which are consistent with the semantics of the corresponding historical dialogue message; and training the initial model based on the historical dialogue messages, incorrect answers, correct answers, rewritten dialogue messages, and learning requirement instructions to obtain the first model.

[0007] In some possible embodiments, the historical dialogue messages are generalized to obtain at least one rewritten dialogue message, including: inputting the historical dialogue messages into a second model and outputting at least one rewritten message; inputting the rewritten message into the second model and outputting the answer result corresponding to the rewritten message; inputting the correct answer and the answer result into the second model and determining the similarity between the correct answer and the answer result through the second model; and determining the rewritten message with a similarity higher than a preset similarity threshold as a rewritten dialogue message.

[0008] In some possible embodiments, training an initial model based on historical dialogue messages, incorrect answers, correct answers, rewritten dialogue messages, and learning requirement instructions to obtain a first model includes: obtaining multiple historical repair examples based on historical dialogue messages, incorrect answers, correct answers, and rewritten dialogue messages, with the multiple historical repair examples forming a historical repair example set; selecting a historical dialogue message or rewritten dialogue message from one of the historical repair examples in the historical repair example set as a request input message; inputting training data including learning requirement instructions, a portion of the historical repair examples in the historical repair example set, and the request input message into the initial model to obtain the prediction result information output by the initial model; freezing the core parameters of the initial model, and updating the model prefix parameters of the initial model based on the prediction result information and the correct answer of the request input message, until the training cutoff condition is met to obtain the first model.

[0009] In some possible embodiments, the first model is invoked for processing based on the first dialogue message and the model repair data used to train the first model, and a first output result is output. This includes: if the model repair data also includes compressed example placeholders, attention calculation is performed on the learning requirement instruction, historical repair examples, compressed example placeholders, and the first dialogue message in a preset order, and the first output result is output. In this case, the learning requirement instruction, historical repair examples, compressed example placeholders, and the first dialogue message each access themselves and the data preceding themselves in the preset order during the attention calculation, and the historical repair examples and the first dialogue message are isolated from each other during the attention calculation.

[0010] Secondly, embodiments of this application provide a dialogue device, including: a receiving module for receiving a first dialogue message input by a user; and a processing module for processing the first dialogue message and model repair data used to train the first model, invoking the first model for processing, and outputting a first output result, wherein the model repair data includes learning requirement instructions and a set of historical repair examples.

[0011] In some possible embodiments, the device further includes: a history acquisition module, configured to acquire historical dialogue messages before receiving the first dialogue message input by the user, the historical dialogue messages having correct answers and incorrect answers; a generalization processing module, configured to perform generalization processing on the historical dialogue messages to obtain at least one rewritten dialogue message, the semantics of the rewritten dialogue message being consistent with the semantics of the corresponding historical dialogue message; and a training module, configured to train an initial model based on the historical dialogue messages, incorrect answers, correct answers, rewritten dialogue messages, and learning requirement instructions to obtain a first model.

[0012] In some possible embodiments, the generalization processing module is used to: input historical dialogue messages into the second model and output at least one rewritten message; input the rewritten message into the second model and output the answer result corresponding to the rewritten message; input the correct answer and the answer result into the second model and determine the similarity between the correct answer and the answer result through the second model; and determine the rewritten message with a similarity higher than a preset similarity threshold as a rewritten dialogue message.

[0013] In some possible embodiments, the training module is used to: obtain multiple historical repair examples based on historical dialogue messages, incorrect answers, correct answers, and rewritten dialogue messages, and the multiple historical repair examples form a historical repair example set; select a historical dialogue message or a rewritten dialogue message from one of the historical repair examples in the historical repair example set as a request input message; input training data including learning requirement instructions, some historical repair examples from the historical repair example set, and the request input message into the initial model to obtain the prediction result information output by the initial model; freeze the core parameters of the initial model, and update the model prefix parameters of the initial model according to the prediction result information and the correct answer of the request input message until the training cutoff condition is met to obtain the first model.

[0014] In some possible embodiments, the processing module is configured to: when the model repair data also includes compressed example placeholders, perform attention calculations on the learning requirement instruction, historical repair examples, compressed example placeholders, and first dialogue message in a preset order, and output a first output result, wherein the learning requirement instruction, historical repair examples, compressed example placeholders, and first dialogue message each access themselves and the data preceding themselves in the preset order during the attention calculation, and the historical repair examples and the first dialogue message are isolated from each other during the attention calculation.

[0015] Thirdly, embodiments of this application provide an electronic device, which includes a processor and a memory. The memory stores programs or instructions that can run on the processor, and when the programs or instructions are executed by the processor, they implement the steps of the dialogue method provided in embodiments of this application.

[0016] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, and when the program or instructions are executed by a processor, the steps of the dialogue method provided in embodiments of this application are implemented.

[0017] Fifthly, embodiments of this application provide a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the steps of the dialogue method provided in embodiments of this application.

[0018] Sixthly, embodiments of this application provide a computer program product, which is stored in a storage medium and executed by at least one processor to implement the steps of the dialogue method provided in embodiments of this application.

[0019] In this embodiment of the application, a first dialogue message input by the user is received, and the first model is invoked to perform inference based on the first dialogue message and the model repair parameters used to train the first model, and a first output result is output. The learning requirement instructions and historical repair example set in the model repair data can guide the first model to avoid making the same or similar errors as those in the historical repair example set, reduce the probability of the first model outputting an incorrect answer, and improve the accuracy of the first model's output. Attached Figure Description

[0020] Figure 1 Flowcharts of dialogue methods provided for some embodiments of this application; Figure 2A A schematic diagram of the dialogue interface of an AI assistant provided in some embodiments of this application; Figure 2B A schematic diagram of the dialogue interface of an AI assistant provided in some embodiments of this application; Figure 3 A schematic diagram illustrating the first output result of the first model provided in some embodiments of this application; Figure 4A A schematic diagram of the dialogue interface of an AI assistant provided in some embodiments of this application; Figure 4B A schematic diagram of the dialogue interface of an AI assistant provided in some embodiments of this application; Figure 5A A schematic diagram illustrating the training of a first model provided for some embodiments of this application; Figure 5B A schematic diagram of a masking rule for a preset order of individual reference input data provided in some embodiments of this application; Figure 5C A schematic diagram illustrating the preset order of simultaneous reference input data and the masking rules that isolate historical repair examples from request input messages, provided for some embodiments of this application; Figure 5DA schematic diagram illustrating the training of a first model provided for some embodiments of this application; Figure 5E A schematic diagram of intermediate cache data provided for some embodiments of this application; Figure 6 A schematic diagram of the AI ​​assistant's dialogue interface during the hotfix process of some error cases provided in embodiments of this application; Figure 7 Flowcharts of dialogue methods provided for some embodiments of this application; Figure 8 Schematic diagrams of the structure of the dialogue device provided for some embodiments of this application; Figure 9 Schematic diagrams of the structure of electronic devices provided for some embodiments of this application; Figure 10 This is a schematic diagram of the hardware structure of an electronic device that implements some embodiments of this application. Detailed Implementation

[0021] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0022] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship. A first control is used to guide user input to view event information corresponding to a user intent.

[0023] The dialogue method and apparatus provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.

[0024] The terminology used in the implementation section of this application is only for explaining specific embodiments of this application and is not intended to limit this application. The terminology involved in the embodiments of this invention is explained below.

[0025] Large Language Model (LLM) is an artificial intelligence (AI) model that can understand and generate natural language.

[0026] A bad case is an example where, for a specific user input, the output deviates from or is incorrect from business expectations or user needs.

[0027] Learning instruction is a set of instructions used to guide the model in learning during the training process. The model can be a large language model.

[0028] The core parameters of the model are the inference hyperparameters of the model, which are applied to the inference stage of the model. The model can be a large language model.

[0029] Model prefix parameters are trainable vectors introduced during prefix tuning. The amount of data for model prefix parameters is much smaller than that for model core parameters, and the model can be a large language model.

[0030] An AI assistant is a software program or service built on artificial intelligence technology. Its core goal is to understand human natural language commands and use its knowledge, computing power, and other connected services to perform tasks, answer questions, or provide advice, thereby acting as an intelligent helper for users.

[0031] It should be noted that the dialogue method provided in this application can be executed by electronic devices such as mobile phones, tablets, laptops, PDAs, and in-vehicle electronic devices. Some embodiments of this application use electronic devices as the executing entity to illustrate the dialogue method provided in this application.

[0032] The dialogue method provided in this application can be applied to scenarios where users input dialogue messages in human-computer interaction applications such as artificial intelligence (AI) assistants to conduct dialogues. One specific application scenario is that a user inputs a dialogue message in an AI assistant to look up the full name of an abbreviation, and another specific application scenario is that a user inputs a dialogue message in an AI assistant to get answers to questions encountered during programming.

[0033] The following describes in detail a dialogue method provided by an embodiment of this application with reference to the accompanying drawings. Figure 1 Flowcharts of dialogue methods provided for some embodiments of this application, such as Figure 1 As shown, the dialogue method may include steps 110 and 120.

[0034] In step 110, the first dialogue message input by the user is received.

[0035] The first conversation message may include text information entered by the user, or text information converted from user-inputted voice, images, videos, etc., and is not limited thereto. After receiving the first conversation message entered by the user, the electronic device may display it. In some examples, an AI assistant in the electronic device may receive the first conversation message entered by the user and display it on the AI ​​assistant's dialogue interface. For example, Figure 2A This is a schematic diagram of the dialogue interface of the AI ​​assistant provided in some embodiments of this application, such as... Figure 2A As shown, the user inputs the first dialogue message 21, which is then displayed on the AI ​​assistant's dialogue interface 22. The content of the first dialogue message 21 is "In the field of deep learning, what does MQA stand for?". For example, Figure 2B This is a schematic diagram of the dialogue interface of the AI ​​assistant provided in some embodiments of this application, such as... Figure 2B As shown, the user inputs the first dialogue message 21, which is displayed on the AI ​​assistant's dialogue interface 22. The content of the first dialogue message 21 is "How to declare a variable in JavaScript?".

[0036] In step 120, the first model is invoked for processing based on the first dialogue message and the model repair data used to train the first model, and the first output result is output.

[0037] The first model is a model used to reason and output answers based on the first dialogue message input by the user. The first model can be a large language model or other models. The first model can be pre-trained. The trained first model can store model repair data. The model repair data can include data on correcting incorrect answers generated by the first model in response to the user-input dialogue message to obtain the correct answer. The model repair data includes learning requirement instructions and a set of historical repair examples. The set of historical repair examples is a collection of historical repair examples and may include at least one historical repair example. Historical repair examples may include example data from historical dialogues used to correct incorrect answers output by the first model. In some examples, historical repair examples may include historical error cases and their corresponding correct answers. Historical error cases are error cases in historical dialogues and may include historical dialogue messages and incorrect answers when the first model outputs incorrect information. Historical cases can be collected, labeled, historical error cases identified, and repaired to obtain the correct answer to the historical dialogue message in the historical error case. Historical dialogue messages, incorrect answers to historical dialogue messages, and correct answers to historical dialogue messages can be formed into triples as historical repair examples. In some examples, historical cases include historical conversation messages and corresponding output information. The output information corresponding to the historical conversation messages is the output information obtained by inputting the historical conversation messages into the first model or the first model that has not yet been trained. A more accurate mature model can be called to determine whether the output information corresponding to the historical conversation messages in the historical cases is correct. If the output information corresponding to the historical conversation messages is incorrect, that is, the output information corresponding to the historical conversation messages is an incorrect answer, then the historical case is identified as a historical error case. The more accurate mature model can then be called to output the correct answer based on the historical conversation messages in the historical error cases. The historical conversation messages, the incorrect answers of the historical conversation messages, and the correct answers of the historical conversation messages are formed into a triplet as a historical repair example. The correct answer output by the more accurate mature model can also be verified manually or by a dedicated verification algorithm to determine whether the correct answer is truly correct.

[0038] For example, the triplet for the history repair example can be shown below: "Historical Conversation Messages: In the field of deep learning, what does MQA stand for?" Incorrect answer: MQA is an abbreviation for Master Quality Authenticated.

[0039] Correct answer: MQA, short for Multi Query Attention. For example, the triplet for the history restoration example can be shown below: "Historical Conversation Message: How do I declare a variable in JavaScript?" Incorrect answer: The recommended keyword is var.

[0040] Correct answer: It is recommended to use `let` and `const` variables. The learning requirement instruction is used to guide the model's learning process during the training of the first model. Specifically, the learning requirement instruction can instruct the first model to learn from a set of historical repair examples, thereby reducing erroneous outputs. For example, the learning requirement instruction could be: "The following were generated in historical dialogues. Please learn from the following historical repair examples to avoid similar problems."

[0041] The input to the first model is the dialogue message input by the user, i.e., the first dialogue message. The output of the first model is the answer corresponding to the first dialogue message input by the user, i.e., the first output result. After receiving the first dialogue message, the first model can combine the first dialogue message and the model repair data to perform inference, thereby outputting the first output result. In some examples, the first model may include a text encoding layer and a core processing layer. The text encoding layer can encode the first dialogue message and the model repair data separately to obtain corresponding encoded data. The core processing layer performs inference calculations on the encoded data corresponding to the first dialogue message and the encoded data corresponding to the model repair data to obtain and output the first output result. The core processing layer may be a multi-layer structure. In some examples, the core processing layer may include a multi-layer transformer layer, i.e., a multi-layer Transformer layer. The multi-layer Transformer layer can perform attention calculations on the encoded data corresponding to the first dialogue message and the encoded data corresponding to the model repair data. The attention calculation on the encoded data corresponding to the first dialogue message and the encoded data corresponding to the model repair data can be regarded as the attention calculation on the first dialogue message and the model repair data. By learning the relationship between historical dialogue messages, learning requirement instructions, and historical repair examples during the training of the first model, the first dialogue message and the model repair data are processed to obtain the first output result. For example, Figure 3 A schematic diagram illustrating the first output result of the first model provided in some embodiments of this application, such as... Figure 3 As shown, the first dialogue message 31 is input into the first model. The text encoding layer 32 of the first model encodes the first dialogue message 31 and the model repair data 33. The resulting encoded data enters the core processing layer 34. In the core processing layer 34, inference calculations are performed on the encoded data corresponding to the first dialogue message 31 and the model repair data 33, thereby outputting the first output result 35. The learning requirement instructions and the historical repair example set in the model repair data can guide the first model to avoid making the same or similar errors as those in the historical repair examples in the historical repair example set, thereby improving the accuracy of the first model's output.

[0042] After obtaining the first output result, it can be displayed, for example, for the user's convenience; or it can be read aloud, making it easier for the user to obtain the first output result. In some examples, when the user engages in a dialogue with an AI assistant, the first output result can be displayed on the AI ​​assistant's dialogue interface. For example, Figure 4A This is a schematic diagram of the dialogue interface of the AI ​​assistant provided in some embodiments of this application, such as... Figure 4A As shown, the dialogue interface 42 displays the user's first dialogue message 41, "In the field of deep learning, what does MQA stand for?", and the dialogue interface 42 displays the first output result 43 of the first model, "MQA, short for Multi Query Attention." For example, Figure 4B This is a schematic diagram of the dialogue interface of the AI ​​assistant provided in some embodiments of this application, such as... Figure 4B As shown, the dialog interface 42 displays the first dialog message 41 entered by the user as "How do I declare a variable in JavaScript?", and the dialog interface 42 displays the first output result 43 of the first model as "It is recommended to use let variables and const variables."

[0043] In this embodiment, a first dialogue message input by a user can be received. Based on the first dialogue message and the model repair parameters used to train the first model, the first model is invoked to perform inference and output a first output result. The model repair data includes learning requirement instructions and a historical repair example set. The learning requirement instructions and the historical repair example set can guide the first model to avoid making the same or similar errors as those in the historical repair example set, thereby reducing the probability of the first model outputting incorrect output and improving the accuracy of the first model's output.

[0044] In some embodiments, before the first model goes online, i.e., before it is put into use, the initial model needs to be trained to learn from error cases in historical dialogues, so as to obtain a first model that can avoid making the same or similar errors as those error cases, and then deploy the trained first model online. Specifically, historical dialogue messages can be obtained, which have correct and incorrect answers; the historical dialogue messages are generalized to obtain at least one rewritten dialogue message, the semantics of which are consistent with the semantics of the corresponding historical dialogue message; based on the historical dialogue messages, incorrect answers, correct answers, rewritten dialogue messages, and learning requirements, the initial model is trained to obtain the first model.

[0045] Historical dialogue messages with incorrect answers, along with those incorrect answers, can form error cases, which can serve as at least a portion of the training data for training the first model. Since the scenarios where error cases may exist are relatively niche or the occurrence of error cases may be sporadic, resulting in a small number of error cases, historical dialogue messages with incorrect answers can be generalized to obtain rewritten dialogue messages that are different from the historical messages but semantically consistent. The incorrect answers in the rewritten dialogue messages and the historical dialogue messages can then form new error cases. For example, a historical dialogue message with an incorrect answer might be "In the field of deep learning, what does MQA stand for?". Through generalization, two rewritten dialogue messages can be obtained: the first is "In the field of deep learning, what are the abbreviations for MQA?", and the second is "In deep learning, what is the full name of the term MQA?". By generalizing historical dialogue messages with incorrect outputs, the training data used to train the first model is enriched. This increases the diversity of the training data and allows the first model to learn more error cases, thereby further improving the accuracy of the first model's output.

[0046] In some examples, historical dialogue messages can be input into the second model to obtain at least one rewritten message output by the second model; the rewritten message can be input into the second model to output the corresponding answer; the correct answer and the output answer can be input into the second model to determine the similarity between the correct answer and the output answer; and the rewritten message with a similarity higher than a preset similarity threshold can be identified as a rewritten dialogue message.

[0047] The second model can be a more mature model than the first model, capable of generalization to obtain rewritten messages and outputting correct answers. The second model can be a large language model or other types of models. Historical dialogue messages are input into the second model, instructing it to construct rewritten messages that are different from but semantically consistent with the historical dialogue messages, so that the second model outputs rewritten messages that are different from but semantically consistent with the historical dialogue messages. To ensure the usability of the rewritten messages, the rewritten messages can be input into the second model, instructing it to provide the corresponding answers, so that the second model outputs the response results. The second model judges the similarity between the response results and the correct answers of the historical dialogue messages to determine whether the response results are correct, thereby determining the usability of the rewritten messages. The method for obtaining the correct answers of the historical dialogue messages can be found in the relevant explanations above and will not be repeated here. The higher the similarity between the response results and the correct answers of the historical dialogue messages, the higher the probability that the response results are correct, and the higher the usability of the rewritten messages. The similarity threshold is used to judge whether the usability of the rewritten messages is sufficient as a threshold for rewriting dialogue messages, and can be set according to the scenario, needs, experience, etc., and is not limited here. Rewritten dialogue messages include those with a similarity score higher than a similarity threshold. If the similarity score between the response and the correct answer in a historical dialogue message is higher than the threshold, it indicates that the rewritten message is sufficiently usable to participate in the training of the first model. A more capable model generates rewritten messages that are different from but semantically consistent with historical dialogue messages containing incorrect answers. Selecting rewritten dialogue messages for training the first model based on their usability enriches the training data used, enabling the training data to "learn by analogy," improving its generalization ability, and further enhancing the generalization and comprehension capabilities of the first model.

[0048] Historical repair examples can be constructed based on historical dialogue messages, correct answers to historical dialogue messages, incorrect answers to historical dialogue messages, and rewritten dialogue messages. A historical repair example can include a historical dialogue message, an incorrect answer, and a correct answer, or it can include a rewritten dialogue message, an incorrect answer, and a correct answer. The first model is trained using these historical repair examples and learning requirements instructions. This allows the first model to learn the relationships between historical dialogue messages, incorrect answers, and correct answers, as well as the relationships between rewritten dialogue messages, incorrect answers, and correct answers. The model parameters are adjusted until the first model meets the training cutoff condition, enabling it to recognize its own error cases. This training process results in a first model that has repaired error cases and avoids making the same or similar errors, thus improving the accuracy of the first model's output.

[0049] In some examples, multiple historical repair examples can be obtained based on historical dialogue messages, incorrect answers, correct answers, and rewritten dialogue messages. These multiple historical repair examples form a historical repair example set. A historical dialogue message or a rewritten dialogue message from one of the historical repair examples in the historical repair example set is selected as the request input message. Training data including learning requirement instructions, some historical repair examples from the historical repair example set, and the request input message is input into the initial model to obtain the prediction result information output by the initial model. The core parameters of the initial model are frozen, and the model prefix parameters of the initial model are updated according to the prediction result information and the correct answer of the request input message until the training cutoff condition is met, resulting in the first model.

[0050] A historical repair example set can include multiple historical repair examples. Each historical repair example can include either a historical dialogue message or a rewritten dialogue message, along with the corresponding incorrect and correct answers. For example, a historical repair example set containing three historical repair examples, each of which can be a triple structure, might look like this: Historical restoration example 1: Historical conversation message: In the field of deep learning, what does MQA stand for? Incorrect answer: MQA is an abbreviation for Master Quality Authenticated.

[0051] Correct answer: MQA, short for Multi Query Attention.

[0052] Historical restoration example two: Rewriting Conversation Messages: In the field of deep learning, what are the abbreviations for MQA? Incorrect answer: MQA is an abbreviation for Master Quality Authenticated.

[0053] Correct answer: MQA, short for Multi Query Attention.

[0054] Example of historical restoration 3: Rewriting Conversation Messages: In deep learning, what is the full name of the term MQA? Incorrect answer: MQA is an abbreviation for Master Quality Authenticated.

[0055] Correct answer: MQA, short for Multi Query Attention. Among them, historical restoration example one includes historical dialogue messages, incorrect answers to historical dialogue messages, and correct answers to historical dialogue messages; historical restoration examples two and three include rewritten dialogue messages with semantic consistency with historical dialogue messages, incorrect answers to historical dialogue messages, and correct answers to historical dialogue messages.

[0056] Training data refers to the data required to train the initial model to obtain the first model. The initial model is an untrained model with low accuracy. Training data may include learning requirement instructions, historical repair examples, and request input messages. The specific content of learning requirement instructions and historical repair examples can be found in the relevant descriptions in the above embodiments, and will not be repeated here. Request input messages may be questions that the model expected to be trained in the training data should answer, and can be considered as user-input dialogue information. Request input messages may include historical dialogue messages or rewritten dialogue messages from one of the historical repair examples in the combination of historical repair examples. Request input messages are different from historical dialogue messages or rewritten dialogue messages in the historical repair examples in the training data. Training data may include one or more historical repair examples; the number of historical repair examples in the training data is not limited here. Training data can be constructed according to the order of learning requirement instructions, historical repair examples, and request input messages. In some examples, the template for training data may be as follows: "The following are examples of errors generated in historical dialogues. Please learn from these historical repair examples to avoid similar problems."

[0057] [Historical Restoration Example 1] Input: {Input1} Incorrect answer: {Error Output1} Correct answer: {Target Output1} [Historical Restoration Example 2] Input: {Input2} Incorrect answer: {Error Output2} Correct answer: {Target Output2} … [Input Request Message] Input: {Current Input} Output: " The instruction in the training data is: "The following are examples of errors generated in historical dialogues. Please learn from these historical repair examples to avoid similar problems." In "[Historical Repair Example 1]" and "[Historical Repair Example 2]", "Input" refers to the historical dialogue message or a rewritten dialogue message; "{Input1}" and "{Input2}" refer to the content of the historical dialogue message or the content of the rewritten dialogue message; "{Error Output1}" and "{Error Output2}" refer to the content of the incorrect answer; and "{Target Output1}" and "{Target Output1}" refer to the content of the correct answer. In "[Request Input Message]", "Input" and "Output" refer to the request input message; "{Current Input}" refers to the content of the request input message; and "Output" indicates that the trained model should output the answer, which is the prediction result information output by the trained model.

[0058] For example, the training data may look like this: "The following are bad cases generated from historical conversations. Please learn from the following repair examples to avoid similar problems."

[0059] [Historical Restoration Example 1] Input: In the field of deep learning, what does MQA stand for? Incorrect answer: MQA is an abbreviation for Master Quality Authenticated. Correct answer: MQA, short for Multi Query Attention [Input Request Message] Input: In the field of deep learning, what are the abbreviations for MQA? Output: " The historical repair examples in the training data include error cases. These historical repair examples can serve as a "mistake book" to correct the errors in the first model during training. Furthermore, the inclusion of historical repair examples that rewrite dialogue messages in the training data can help to learn by analogy, improve the generalization ability and understanding of error cases of the trained first model, and thus improve the accuracy of the first model's output.

[0060] The initial model can be trained in one or more rounds. In each round, the initial model infers based on the input training data, and the output prediction result is the answer corresponding to the request input message in the training data. The model parameters of the initial model can be adjusted based on the difference between the prediction result and the correct answer corresponding to the request input message to update the initial model. In the next round of training, the training data is input into the updated initial model for inference, and so on, until the updated model meets the training cutoff condition, at which point the updated model is determined as the first model. In some examples, the cross-entropy loss between the prediction result and the correct answer corresponding to the request input message can be calculated, and the model parameters of the initial model can be adjusted based on the cross-entropy loss. The training cutoff condition includes conditions for determining when to stop model training. If the updated initial model meets the training cutoff condition, training stops. The training cutoff condition may be related to cross-entropy loss, number of training rounds, etc. For example, the training cutoff condition may include the cross-entropy loss being within a preset loss range, and / or the number of training rounds reaching a preset cutoff number, etc., which are not limited here.

[0061] The initial model parameters can include core parameters and prefix parameters. During each training iteration, when adjusting model parameters, the p-tuning-v2 algorithm can be used to freeze the core parameters and adjust only the prefix parameters. Core parameters are the core parameters of the model. Prefix parameters are the model's prefix parameters. The number of prefix parameters should be significantly less than the number of core parameters. This prefix-tuning approach reduces training costs while maintaining training effectiveness, reduces reliance on manually constructed error messages, addresses the insufficient generalization ability of simply using error messages to correct errors, and prevents interference between errors even with a large number of errors, further improving the inference ability of the initial model.

[0062] For example, Figure 5A This is a schematic diagram illustrating the training of a first model provided in some embodiments of this application. The training data may be as described in the examples above, such as... Figure 5A As shown, the initial model includes a text encoding layer 51 and a core processing layer 52. The functions of the text encoding layer 51 and the core processing layer 52 can be found in the above embodiments. Figure 3The descriptions of the text encoding layer 32 and the core processing layer 34 shown are not repeated here. Training data 53 is input into the initial model. Training data 53 includes learning requirement instructions 521, historical repair examples 532, and request input messages 533. The text encoding layer 32 encodes the learning requirement instructions 521, historical repair examples 532, and request input messages 533 respectively, obtaining their corresponding encoded data. The core processing layer 52 performs inference based on the encoded data corresponding to the learning requirement instructions 521, historical repair examples 532, and request input messages 533, outputting prediction result information 54. The loss between the prediction result information 54 and the correct answer 55 of the request input message 533 can be calculated. The model prefix parameters 56 of the initial model are adjusted based on the loss. During the training of the first model, the model core parameters 57 are frozen; that is, the model core parameters 57 are not updated.

[0063] In some embodiments, the training data contains a large number of historical repair examples, which can prolong the training cycle of the first model. For example, the training data includes ten historical repair examples, as shown below: "The following are examples of errors generated in historical conversations. Please learn from these fixes to avoid similar problems."

[0064] [Historical Restoration Example 1] Input: In the field of deep learning, what does MQA stand for? Incorrect answer: MQA is an abbreviation for Master Quality Authenticated. Correct answer: MQA, short for Multi Query Attention [Historical Restoration Example 2] Input: In Transformer architecture variants, what does the technology MQA typically refer to? Incorrect answer: Master Quality Authenticated (MQA) is a high-resolution audio encoding and streaming technology. Correct answer: MQA stands for Multi-Query Attention, which is an optimization technique for the standard multi-head attention mechanism to accelerate inference and reduce memory usage.

[0065] ... [Historical Restoration Example 10] Input: What is the attention mechanism of MHA that everyone often talks about? Incorrect answer: MHA stands for MySQL High Availability, which is an open-source software solution for automated failover and master-slave promotion of MySQL databases.

[0066] Correct answer: MHA stands for Multi-Head Attention. It is the most basic and classic attention mechanism design in Transformer architectures (such as ChatGPT, BERT, etc.). You can think of it as the "eyes" that the model uses to "see" the input information.

[0067] <compression> <compression> … <compression> [Input Request Message] Input: In the field of deep learning, what are the abbreviations for MQA? Output: " The instruction "The following are examples of errors generated in historical dialogues. Please learn from these repair examples to avoid similar problems" is a learning requirement; the "input" in the historical repair examples refers to the historical dialogue messages. <compression>This indicates a placeholder for compressed examples. With 10 historical repair examples, the model's response time will increase, and the training cycle for the first model will also lengthen, impacting its data processing efficiency.

[0068] In this embodiment, the training data may further include compressed example placeholders. Information from historical repair examples is compressed by introducing compressed example placeholders into the training data. Specifically, attention calculations are performed on the learning requirement instruction, historical repair examples, compressed example placeholders, and request input messages in a preset order, and prediction result information is output. Each of the learning requirement instruction, historical repair examples, compressed example placeholders, and request input messages accesses itself and the data preceding it in the preset order during the attention calculation, and the historical repair examples and request input messages are isolated from each other during the attention calculation.

[0069] The inference process in the model includes attention computation. Attention computation is related to a preset masking order of the model's input data. For each input data point, it can access the data preceding it in the preset masking order and itself during attention computation, but cannot access data following it. In this embodiment, the preset order is: learning request instruction, historical repair examples, compressed example placeholders, and request input messages; that is, the learning request instruction precedes the historical repair examples, the historical repair examples precede the compressed example placeholders, and the compressed example placeholders precede the request input messages. In this embodiment, in addition to the masking rule based on the preset order of the model's input data, attention computation also needs to follow a masking rule that isolates the historical repair examples and request input messages during attention computation. To facilitate the distinction between masking rules that only follow the data arrangement order and masking rules that simultaneously follow the preset order of the input data and the isolation of historical repair examples and request input messages, two examples are provided below.

[0070] For example, Figure 5B A schematic diagram of a masking rule for a preset order of individual reference input data provided in some embodiments of this application, such as... Figure 5B As shown, for the learning requirement instruction, only the learning requirement instruction itself is visible; the history repair example, compressed example placeholder, and input request message are not visible to the learning requirement instruction. That is, the learning requirement instruction can access itself during attention computation, but cannot access the history repair example, compressed example placeholder, or input request message. For the history repair example, the learning requirement instruction and the history repair example are visible to the history repair example, but the compressed example placeholder and input request message are not visible to the history repair example. That is, the history repair example can access the learning requirement instruction and the history repair example during attention computation, but cannot access the compressed example placeholder and input request message. For compressed example placeholders, the learning requirement instruction, historical repair example, and compressed example placeholder are visible to the compressed example placeholder, but the request input message is not visible to the compressed example placeholder. That is, the compressed example placeholder can access the learning requirement instruction, historical repair example, and compressed example placeholder during attention computation, but cannot access the request input message. For request input messages, the learning requirement instruction, historical repair example, compressed example placeholder, and request input message are all visible to the request input message. That is, the request input message can access the learning requirement instruction, historical repair example, compressed example placeholder, and request input message during attention computation.

[0071] For example, Figure 5C The diagram illustrates the preset order of simultaneous reference input data and the masking rules that isolate historical repair examples from request input messages in some embodiments of this application, as shown below. Figure 5C As shown, for the learning requirement instruction, only the learning requirement instruction itself is visible; the history repair example, compressed example placeholder, and input request message are not visible to the learning requirement instruction. That is, the learning requirement instruction can access itself during attention computation, but cannot access the history repair example, compressed example placeholder, and input request message. For the history repair example, the learning requirement instruction and the history repair example are visible to the history repair example, but the compressed example placeholder and input request message are not visible to the history repair example. That is, the history repair example can access the learning requirement instruction and the history repair example during attention computation, but cannot access the compressed example placeholder and input request message. Regarding the compressed example placeholder, the learning request instruction, the history repair example, and the compressed example placeholder are visible to the compressed example placeholder, but the request input message is not visible to the compressed example placeholder. That is, the compressed example placeholder can access the learning request instruction, the history repair example, and the compressed example placeholder during attention computation, but cannot access the request input message. For the request input message, the learning request instruction, the compressed example placeholder, and the request input message are visible to the request input message, but the history repair example is not visible to the request input message. That is, the request input message can access the learning request instruction, the compressed example placeholder, and the request input message during attention computation, but cannot access the history repair example.

[0072] The compressed example placeholder can obtain historical repair examples in attention calculation. The request input message does not need to access historical repair examples in attention calculation. It only needs to access the compressed example placeholder to obtain the information of historical repair examples, thereby greatly shortening the response time of the model and also shortening the time consumed to train the first model.

[0073] Specifically, by accessing historical repair examples through compressed example placeholders during attention computation, the information of historical repair examples is compressed into compressed example placeholders. These compressed example placeholders are then accessed via input messages during attention computation. By compressing the information of historical repair examples into compressed example placeholders, the training time of the first model can be significantly shortened. For example, without affecting the model's performance, the information of a 500-character historical repair example can be compressed into a single compressed example placeholder, achieving a compression ratio of 500:1. The number of compressed example placeholders can be determined based on the amount of historical repair example data; the number of compressed example placeholders in the model's repair data is not limited here. This block-mask-based historical repair example compression method achieves high compression ratios and high compression efficiency, significantly alleviating the problem of slow inference speed caused by excessively long prompts, thereby shortening the training time of the first model, reducing the response time of the first model, and improving the inference efficiency of the first model.

[0074] When the training data includes compressed example placeholders, the compressed example placeholders also participate in the training of the first model. For example, Figure 5D This is a schematic diagram illustrating the training of a first model provided in some embodiments of this application. The training data may be as described in the examples above, which include ten historical repair examples, such as... Figure 5D As shown, the initial model includes a text encoding layer 51 and a core processing layer 52. The functions of the text encoding layer 51 and the core processing layer 52 can be found in the above embodiments. Figure 3 The descriptions of the text encoding layer 32 and the core processing layer 34 shown are not repeated here. Training data 53 is input into the initial model. Training data 53 includes learning requirement instructions 521, historical repair examples 532, compressed example placeholders 534, and input request messages 533. The text encoding layer 32 encodes the learning requirement instructions 521, historical repair examples 532, compressed example placeholders 534, and input request messages 533 respectively, obtaining their corresponding encoded data. The core processing layer 52 performs inference based on the corresponding encoded data of the learning requirement instructions 521, historical repair examples 532, compressed example placeholders 534, and input request messages 533. The masking rules followed during the inference process are as follows... Figure 5C As shown, the output prediction result information 54 is displayed. The loss between the prediction result information 54 and the correct answer 55 of the request input message 533 can be calculated. The model prefix parameters 56 of the initial model are adjusted according to the loss. During the training process to obtain the first model, the model core parameters 57 are frozen, that is, the model core parameters 57 will not be updated.

[0075] Similarly, if the historical repair example set in the model repair data includes multiple historical repair examples, the model repair data may also include compressed example placeholders. After the first model is put into use, the first model can also perform inference calculations by simultaneously referring to the preset order of the input data and the masking rules that isolate historical repair examples and the first dialogue message. Specifically, when the model repair data also includes compressed example placeholders, attention calculations are performed on the learning requirement instruction, historical repair examples, compressed example placeholders, and the first dialogue message according to a preset order, and a first output result is output. In this case, the learning requirement instruction, historical repair examples, compressed example placeholders, and the first dialogue message each access themselves and the data preceding them in the preset order during the attention calculation, and the historical repair examples and the first dialogue message are isolated from each other during the attention calculation. In this embodiment, the preset order is learning requirement instruction, historical repair examples, compressed example placeholders, and the first dialogue message; that is, the learning requirement instruction precedes the historical repair examples, the historical repair examples precede the compressed example placeholders, and the compressed example placeholders precede the first dialogue message. The masking rules for learning requirement instructions, history restoration examples, compressed example placeholders, and first dialogue messages in attention computation are basically the same as those for the masking rules for learning requirement instructions, history restoration examples, compressed example placeholders, and input request messages in attention computation mentioned above. Please refer to the above text for further details. Figure 5B , Figure 5C The relevant explanations will not be repeated here. By introducing compressed example placeholders in the model repair data, the problem of excessive input data for the first model due to too many historical repair examples can be greatly alleviated, thus reducing the response time of the first model and improving its processing efficiency when there are too many historical repair examples.

[0076] By accessing historical repair examples through compressed example placeholders during attention computation, the information of historical repair examples is compressed into compressed example placeholders. These compressed example placeholders are then accessed by the first dialogue message during attention computation. By compressing the information of historical repair examples into compressed example placeholders, the inference time of the first model can be significantly reduced. For example, without affecting the model's performance, the information of a 500-character historical repair example can be compressed into a single compressed example placeholder, achieving a compression ratio of 500:1. This block-mask-based historical repair example compression method achieves high compression ratios and high compression efficiency, significantly alleviating the problem of slow inference speed caused by excessively long prompts, thereby shortening the real-time response time of the first model and improving its real-time inference efficiency.

[0077] In some examples, the model repair data may not include compressed example placeholders. When the model repair data does not include compressed example placeholders, the first model is invoked to perform attention calculations on the learning requirement instruction, historical repair examples, and the first dialogue message in a preset order, obtaining and displaying the first output result. In this example, the preset order is learning requirement instruction, historical repair examples, and the first dialogue message; that is, the learning requirement instruction precedes the historical repair examples, and the historical repair examples precede the first dialogue message. The attention calculations for the learning requirement instruction, historical repair examples, and the first dialogue message may only refer to the masking rules of the preset order of the input data. For example, regarding the learning request instruction, only the learning request instruction itself is visible; the historical repair example and the first dialogue message are not visible to the learning request instruction. That is, the learning request instruction can access itself during attention calculation, but cannot access the historical repair example and the request input message. Regarding the historical repair example, the learning request instruction and the historical repair example are visible to the historical repair example, but the first dialogue message is not visible to the historical repair example. That is, the historical repair example can access the learning request instruction and the historical repair example during attention calculation, but cannot access the first dialogue message. Regarding the first dialogue message, the learning request instruction, the historical repair example, and the first dialogue message are all visible to the request input message. That is, the first dialogue message can access the learning request instruction, the historical repair example, and the first dialogue message during attention calculation.

[0078] In some embodiments, to accelerate the inference speed of the first model and shorten the response time, the first model may cache intermediate cache data obtained by processing model repair data in the first model. When the model repair data does not include compressed example placeholders, the first model may cache intermediate cache data obtained by processing learning requirement instructions and historical repair examples in the first model. When the model repair data includes compressed example placeholders, the first model may cache intermediate cache data obtained by processing learning requirement instructions and compressed example placeholders in the first model. If the historical repair example set has not been updated, the first model is invoked to perform inference based on the first dialogue message and the intermediate cache data, and outputs a first output result. If the historical repair example set has not been updated, the model repair data used by the first model for inference each time it receives the first dialogue message is the same. If the first model re-processes the model repair data each time it receives the first dialogue message, redundant processing will occur. By caching the intermediate cache data obtained by the first model after processing the model repair data, the first model can directly call the intermediate cache data and the first dialogue message for inference processing when it receives the first dialogue message. For example, Figure 5E This is a schematic diagram of intermediate cache data provided in some embodiments of this application. In this example, the model repair data includes compressed example placeholders, such as... Figure 5E As shown, the learning requirement instruction 521 and the compressed example placeholder 524 are processed in the first model to obtain the intermediate cache data 59. The text encoding layer 51 only needs to encode the first dialogue message 58. The core processing layer 52 performs inference based on the encoded data corresponding to the first dialogue message 58 and the intermediate cache data 59 to obtain the first output result 50. If the historical repair example set is updated, the first model receives the first dialogue message and needs to re-process the updated model repair data to output the first input result.

[0079] In some embodiments, after the first model is put into use, erroneous outputs may still occur. The first model can be hot-fixed based on user feedback. Specifically, the system can receive error feedback information input by the user; update the historical repair example set in the model repair data based on the first dialogue message; receive a second dialogue message input by the user; and call the first model for processing according to the second dialogue message and the updated model repair data, outputting a second output result.

[0080] Error feedback information is used to indicate that the first model has output an incorrect result. Error feedback information can be text or voice information directly input by the user, or information generated by the user's interaction with controls in the dialog interface used for error feedback; this is not limited to these. In response to the error feedback information, historical repair examples can be constructed based on the first dialog message and added to the historical repair example set to update the historical repair example set. After updating the historical repair example set, a feedback completion prompt can be displayed to prompt the user to input a second dialog message. The semantics of the second dialog message are consistent with the semantics of the first dialog message, and the content of the second dialog message may or may not be consistent with the content of the first dialog message; this is not limited to these. The updated first model can be called based on the second dialog message and the updated model repair data to process the data and output a second output result. In this case, the second output result will be the correct output of the second dialog message. For details on the specific content of calling the first model based on the second dialog message and the updated model repair data, please refer to the relevant descriptions in the above embodiments regarding calling the first model based on the first dialog message and model repair data; these will not be repeated here.

[0081] In this embodiment, the training of the first model is performed only before its deployment, improving its understanding and generalization capabilities for error cases. Once deployed, the first model does not require retraining, reducing training costs and shortening the training cycle. If error output recurs after deployment, the historical repair example set can be updated to quickly correct the error output without service interruption, improving business stability and enhancing the user experience by providing more accurate output results. This achieves error case repair that is low-cost, real-time, and requires no retraining after model deployment.

[0082] In some examples, updating the historical repair example set in the model repair data involves calling the second model to process the first dialogue message and outputting the correct answer corresponding to the first dialogue message. The first dialogue message, its corresponding incorrect first output, and the correct answer are combined to obtain a historical repair example. This historical repair example is then added to the cached historical repair example set in the model repair data. The specific content of the second model can be found in the relevant descriptions in the above embodiments, and will not be repeated here. The incorrect first output is the incorrect answer. The first dialogue message, its incorrect answer, and its correct answer can form a triple to construct a new historical repair example. This new historical repair example is added to the historical repair example set, updating the model repair data. By updating the historical repair example set in the model repair data, the first model can perform inference based on the newly input dialogue message and the updated model repair data when it receives a dialogue message again. This enables real-time hot repair of the first model's error cases, quickly correcting erroneous outputs and providing correct outputs to users. This process does not require the first model to interrupt its service, improving the stability of the service provided by the first model.

[0083] The following example illustrates the process of hotfixing when incorrect answers reappear after the first model has been launched and put into use. Figure 6 This is a schematic diagram of the AI ​​assistant's dialogue interface during the hotfix process for error cases provided in some embodiments of this application. Figure 6 In (a), the AI ​​assistant receives the first dialogue message 61 input by the user, displays the first dialogue message 61 on the dialogue interface, calls the first model to repair the data based on the first dialogue message and the model, obtains the first output result 62, and displays the first output result 62 on the dialogue interface, but the first output result 62 is an incorrect answer. Figure 6 In (b), the user provides error feedback by interacting with the question feedback control 63 in the dialog interface. In response to this error feedback, the correct answer to the first dialog message 61 is obtained. Based on the first dialog message 61, the first output result 62, and the correct answer to the first dialog message 61, a new historical repair example is constructed and added to the historical repair example set in the model repair data. Figure 6 In (c), the dialogue interface displays a feedback completion prompt message 64, the AI ​​assistant receives the second dialogue message 65 input by the user, displays the second dialogue message 65 on the display interface, calls the first model to repair the data based on the second dialogue message 65 and the updated model, obtains the second output result 66, and displays the second output result 66 on the display interface.

[0084] For ease of understanding, the flow of the dialogue method in the embodiments of this application will be described below with an example. Figure 7 Flowcharts of dialogue methods provided for some embodiments of this application, such as Figure 7 As shown, the flow of this dialogue method may include steps 701 to 708.

[0085] In step 701, historical error cases are collected, labeled and generalized, and a set of historical repair examples is obtained.

[0086] The annotation process specifically refers to using a second model to check whether the model's output is correct during the historical dialogue process, and processing historical dialogue messages that are judged to have incorrect answers to obtain the correct answers to the historical dialogue messages.

[0087] In step 702, the model is trained to enhance its understanding and generalization abilities using learning requirement instructions and a set of historical repair examples.

[0088] In step 703, the model is trained by utilizing the compression capability of the compressed example placeholders to obtain the trained model.

[0089] The compression capability of the compressed example placeholder refers to the ability to compress information from historical repair examples into the compressed example placeholder. The model can be trained based on learning requirement instructions, historical repair examples, compressed example placeholders, and request input messages.

[0090] In step 704, the trained model is deployed. Deployment here can refer to putting the model online and putting it into use.

[0091] In step 705, intermediate cache data is generated and cached.

[0092] In step 706, the first dialogue message input by the user is received.

[0093] In step 707, the calling model outputs the first output result based on the first dialogue message and the directly reused intermediate cache data.

[0094] In step 708, check if user error feedback has been received. If so, return to step 705, update the historical repair example set, and regenerate and cache the intermediate cache data. If no user error feedback has been received, end the process.

[0095] The model in steps 701 to 708 above is the first model in the embodiments of this application. For details of steps 701 to 708, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.

[0096] The dialogue method provided in this application can be executed by a dialogue device. This application uses the example of a dialogue device executing the dialogue method to illustrate the dialogue device provided in this application. Figure 8 This is a schematic diagram of the structure of a dialogue device provided in some embodiments of this application, such as... Figure 8 As shown, the dialogue device 800 may include a receiving module 801 and a processing module 802.

[0097] The receiving module 801 can be used to receive the first dialogue message input by the user.

[0098] The processing module 802 can be used to call the first model for processing based on the first dialogue message and the model repair data used to train the first model, and output the first output result. The model repair data includes learning requirement instructions and a set of historical repair examples.

[0099] In some embodiments, the dialogue device 800 may further include a history acquisition module, a generalization processing module, and a training module.

[0100] The history retrieval module can be used to retrieve historical dialogue messages before receiving the first dialogue message from the user input. The historical dialogue messages contain correct and incorrect answers.

[0101] The generalization processing module can be used to generalize historical dialogue messages to obtain at least one rewritten dialogue message, the semantics of which are consistent with the semantics of the corresponding historical dialogue message.

[0102] The training module can be used to train the initial model based on historical dialogue messages, incorrect answers, correct answers, rewritten dialogue messages, and learning instruction commands to obtain the first model.

[0103] In some examples, the generalization processing module can be specifically used to: input historical dialogue messages into the second model and output at least one rewritten message; input the rewritten message into the second model and output the answer result corresponding to the rewritten message; input the correct answer and the answer result into the second model and determine the similarity between the correct answer and the answer result through the second model; and identify rewritten messages with a similarity higher than a preset similarity threshold as rewritten dialogue messages.

[0104] In some examples, the training module can be specifically used to: obtain multiple historical repair examples based on historical dialogue messages, incorrect answers, correct answers, and rewritten dialogue messages; form a historical repair example set from these multiple historical repair examples; select a historical dialogue message or rewritten dialogue message from one of the historical repair examples in the historical repair example set as the request input message; input training data including learning requirement instructions, some historical repair examples from the historical repair example set, and the request input message into the initial model to obtain the prediction result information output by the initial model; freeze the core parameters of the initial model; and update the model prefix parameters of the initial model based on the prediction result information and the correct answer to the request input message until the training cutoff condition is met, thus obtaining the first model.

[0105] In some examples, the training data also includes compressed example placeholders. The training module can be specifically used to: perform attention calculations on learning requirement instructions, historical repair examples, compressed example placeholders, and request input messages in a preset order, and output prediction results. In this process, each of the learning requirement instructions, historical repair examples, compressed example placeholders, and request input messages accesses itself and the data preceding it in the preset order during the attention calculation, and the historical repair examples and request input messages are isolated from each other during the attention calculation.

[0106] In some embodiments, the processing module 802 may be specifically used to: when the model repair data also includes compressed example placeholders, perform attention calculations on the learning requirement instruction, historical repair examples, compressed example placeholders, and first dialogue message in a preset order, and output a first output result, wherein the learning requirement instruction, historical repair examples, compressed example placeholders, and first dialogue message each access themselves and the data located before themselves in the preset order in the attention calculation, and the historical repair examples and the first dialogue message are isolated from each other in the attention calculation.

[0107] In some examples, information from historical repair examples is compressed into compressed example placeholders by accessing them through compressed example placeholders in attention computation. The compressed example placeholders are then accessed by the request input message or the first dialogue message in attention computation.

[0108] In some embodiments, the first model caches intermediate cache data of the model repair data processed in the first model. The processing module 802 may be specifically used to: when the historical repair example set has not been updated, call the first model to process the data according to the first dialogue message and the intermediate cache data, and output the first output result.

[0109] In some embodiments, the dialogue device 800 may also include an update module.

[0110] The receiving module 801 can also be used to receive error feedback information input by the user.

[0111] The update module can be used to update the set of historical repair examples in the model repair data based on the first dialogue message.

[0112] The receiving module 801 can also be used to receive a second dialogue message input by the user, the semantics of which are consistent with the semantics of the first dialogue message.

[0113] The processing module 802 can also be used to call the first model for inference based on the second dialogue message and the updated model repair data, and output the second output result.

[0114] In some examples, the update module can be specifically used to: call the second model based on the first dialogue message and output the correct answer corresponding to the first dialogue message; combine the first dialogue message, the first incorrect output result corresponding to the first dialogue message, and the correct answer corresponding to the first dialogue message to obtain a historical repair example; and add the historical repair example to the historical repair example set in the cached model repair data.

[0115] The dialogue method provided in this application can be executed by an electronic device. This application uses an electronic device executing the dialogue method as an example to illustrate the electronic device provided in this application. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application does not specifically limit the scope of the electronic device.

[0116] The electronic device in this application embodiment can be a device with an operating system. The operating system can be the Android operating system, the iOS operating system, or other possible operating systems; this application embodiment does not specifically limit the specific operating system.

[0117] The electronic device provided in this application embodiment can achieve... Figure 1 The various processes implemented in the illustrated dialogue method embodiment will not be described again here to avoid repetition.

[0118] Optionally, such as Figure 9 As shown, this application embodiment also provides an electronic device 900, including a processor 901 and a memory 902. The memory 902 stores a program or instructions that can run on the processor 901. When the program or instructions are executed by the processor 901, they implement the various steps of the dialogue method embodiment provided in this application embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0119] Figure 10 This is a schematic diagram of the hardware structure of an electronic device that implements an embodiment of this application.

[0120] The electronic device 1000 includes, but is not limited to, components such as: radio frequency unit 1001, network module 1002, audio output unit 1003, input unit 1004, sensor 1005, display unit 1006, user input unit 1007, interface unit 1008, memory 1009, and processor 1010.

[0121] Those skilled in the art will understand that the electronic device 1000 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 1010 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 10 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0122] The user input unit 1007 is used to receive a first dialogue message input by the user. The processor 1010 is used to call the first model for processing based on the first dialogue message and the model repair data used to train the first model, and output a first output result. The model repair data includes learning requirement instructions and a set of historical repair examples.

[0123] In some embodiments, the processor 1010 may be used to: obtain historical dialogue messages, which have correct and incorrect answers, before receiving a first dialogue message input by a user; perform generalization processing on the historical dialogue messages to obtain at least one rewritten dialogue message, the semantics of which are consistent with the semantics of the corresponding historical dialogue message; and train an initial model based on the historical dialogue messages, incorrect answers, correct answers, rewritten dialogue messages, and learning requirement instructions to obtain a first model.

[0124] In some examples, processor 1010 can be used to: input historical dialogue messages into a second model and output at least one rewritten message; input the rewritten message into a second model and output the answer result corresponding to the rewritten message; input the correct answer and the answer result into a second model and determine the similarity between the correct answer and the answer result through the second model; and identify rewritten messages with a similarity higher than a preset similarity threshold as rewritten dialogue messages.

[0125] In some examples, processor 1010 can be used to: train an initial model based on historical dialogue messages, incorrect answers, correct answers, rewritten dialogue messages, and learning requirement instructions to obtain a first model, including: obtaining multiple historical repair examples based on historical dialogue messages, incorrect answers, correct answers, and rewritten dialogue messages, with the multiple historical repair examples forming a historical repair example set; selecting a historical dialogue message or rewritten dialogue message from one of the historical repair examples in the historical repair example set as a request input message; inputting training data including learning requirement instructions, a portion of the historical repair examples in the historical repair example set, and the request input message into the initial model to obtain the prediction result information output by the initial model; freezing the core parameters of the initial model, and updating the model prefix parameters of the initial model based on the prediction result information and the correct answer of the request input message, until the training cutoff condition is met to obtain the first model.

[0126] In some examples, the training data also includes compressed example placeholders. The processor 1010 can be used to: perform attention calculations on the learning requirement instructions, historical repair examples, compressed example placeholders, and request input messages in a preset order, and output prediction result information, wherein the learning requirement instructions, historical repair examples, compressed example placeholders, and request input messages each access themselves and the data preceding them in the preset order during the attention calculation, and the historical repair examples and request input messages are isolated from each other during the attention calculation.

[0127] In some embodiments, the processor 1010 may be used to: when the model repair data further includes compressed example placeholders, perform attention calculations on the learning requirement instruction, historical repair examples, compressed example placeholders, and first dialogue message in a preset order, and output a first output result, wherein the learning requirement instruction, historical repair examples, compressed example placeholders, and first dialogue message each access themselves and the data preceding themselves in the preset order in the attention calculation, and the historical repair examples and the first dialogue message are isolated from each other in the attention calculation.

[0128] In some examples, processor 1010 can be used to: compress information of historical repair examples into compressed example placeholders by accessing historical repair examples through compressed example placeholders in attention computation, and the compressed example placeholders are accessed in attention computation by request input messages or first dialogue messages.

[0129] In some embodiments, the first model caches intermediate cache data of the model repair data processed in the first model. The processor 1010 can be used to: in the absence of an update to the historical repair example set, invoke the first model to process the data based on the first dialogue message and the intermediate cache data, and output a first output result.

[0130] In some embodiments, the user input unit 1007 is used to receive error feedback information input by the user. The processor 1010 is used to: update the set of historical repair examples in the model repair data based on the first dialogue message; receive a second dialogue message input by the user, the semantics of the second dialogue message being consistent with the semantics of the first dialogue message; and call the first model for processing according to the second dialogue message and the updated model repair data, and output a second output result.

[0131] In some embodiments, the processor 1010 is configured to: invoke a second model to output the correct answer corresponding to the first dialogue message based on the first dialogue message; combine the first dialogue message, the first output result of the error corresponding to the first dialogue message, and the correct answer corresponding to the first dialogue message to obtain a historical repair example; and add the historical repair example to the historical repair example set in the cached model repair data.

[0132] It should be understood that, in this embodiment, the input unit 1004 may include a graphics processing unit (GPU) 10041 and a microphone 10042. The GPU 10041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 1006 may include a display panel 10061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 1007 includes at least one of a touch panel 10071 and other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, joysticks, etc., which will not be described in detail here.

[0133] The memory 1009 can be used to store software programs and various data. The memory 1009 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 1009 may include volatile memory or non-volatile memory, or both. The 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 can be random access memory (RAM), 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 link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 109 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0134] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into the processor 1010.

[0135] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the dialogue method embodiment provided in this application and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0136] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0137] This application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the dialogue method embodiments provided in this application and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0138] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0139] This application also provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the dialogue method embodiment provided in this application, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0140] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one…" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0141] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0142] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.< / compression> < / compression> < / compression> < / compression>

Claims

1. A dialogue method, characterized in that, include: Receive the first dialogue message input by the user; The first model is invoked to process the first dialogue message and the model repair data used to train the first model, and the first output result is output. The model repair data includes learning requirement instructions and a set of historical repair examples.

2. The method according to claim 1, characterized in that, Before receiving the first dialogue message input by the user, the following is also included: Retrieve historical dialogue messages, which contain correct and incorrect answers; The historical dialogue messages are generalized to obtain at least one rewritten dialogue message, the semantics of which are consistent with the semantics of the corresponding historical dialogue message. The initial model is trained based on the historical dialogue messages, the incorrect answers, the correct answers, the rewritten dialogue messages, and the learning requirement instructions to obtain the first model.

3. The method according to claim 2, characterized in that, The generalization process of the historical dialogue messages to obtain at least one rewritten dialogue message includes: Input the historical dialogue messages into the second model and output at least one rewritten message; Input the rewritten message into the second model and output the answer result corresponding to the rewritten message; The correct answer and the response result are input into the second model, and the similarity between the correct answer and the response result is determined by the second model. The rewritten messages with a similarity higher than a preset similarity threshold are identified as the rewritten dialogue messages.

4. The method according to claim 2, characterized in that, The step of training the initial model based on the historical dialogue messages, the incorrect answers, the correct answers, the rewritten dialogue messages, and the learning requirement instructions to obtain the first model includes: Based on the historical dialogue messages, the incorrect answers, the correct answers, and the rewritten dialogue messages, multiple historical repair examples are obtained, and the multiple historical repair examples constitute the historical repair example set; Select a historical dialogue message or a rewritten dialogue message from one of the historical repair examples in the historical repair example set as the request input message; The training data, including the learning requirement instruction, a portion of the historical repair examples from the historical repair example set, and the request input message, is input into the initial model to obtain the prediction result information output by the initial model; Freeze the core parameters of the initial model, and update the model prefix parameters of the initial model according to the prediction result information and the correct answer of the request input message until the training cutoff condition is met, thus obtaining the first model.

5. The method according to claim 1, characterized in that, The step of calling the first model to process the data based on the first dialogue message and the model repair data used to train the first model, and outputting the first output result, includes: If the model repair data also includes compressed example placeholders, attention calculations are performed on the learning requirement instruction, the historical repair examples, the compressed example placeholders, and the first dialogue message in a preset order, and the first output result is output. In this context, the learning requirement instruction, the historical repair example, the compressed example placeholder, and the first dialogue message each access themselves in the attention calculation, as well as the data preceding themselves in the preset order, and the historical repair example and the first dialogue message are isolated from each other in the attention calculation.

6. A dialogue device, characterized in that, include: The receiving module is used to receive the first dialogue message input by the user; The processing module is used to call the first model to process the first dialogue message and the model repair data used to train the first model, and output the first output result. The model repair data includes learning requirement instructions and a set of historical repair examples.

7. The apparatus according to claim 6, characterized in that, Also includes: The history acquisition module is used to acquire historical dialogue messages before receiving the first dialogue message input by the user, the historical dialogue messages having correct answers and incorrect answers; A generalization processing module is used to generalize the historical dialogue messages to obtain at least one rewritten dialogue message, wherein the semantics of the rewritten dialogue message are consistent with the semantics of the corresponding historical dialogue message. The training module is used to train the initial model based on the historical dialogue messages, the incorrect answers, the correct answers, the rewritten dialogue messages, and the learning requirement instructions to obtain the first model.

8. The apparatus according to claim 7, characterized in that, The generalization processing module is used for: Input the historical dialogue messages into the second model and output at least one rewritten message; Input the rewritten message into the second model and output the answer result corresponding to the rewritten message; The correct answer and the response result are input into the second model, and the similarity between the correct answer and the response result is determined by the second model. The rewritten messages with a similarity higher than a preset similarity threshold are identified as the rewritten dialogue messages.

9. The apparatus according to claim 7, characterized in that, The training module is used for: Based on the historical dialogue messages, the incorrect answers, the correct answers, and the rewritten dialogue messages, multiple historical repair examples are obtained, and the multiple historical repair examples constitute the historical repair example set; Select a historical dialogue message or a rewritten dialogue message from one of the historical repair examples in the historical repair example set as the request input message; The training data, including the learning requirement instruction, a portion of the historical repair examples from the historical repair example set, and the request input message, is input into the initial model to obtain the prediction result information output by the initial model; Freeze the core parameters of the initial model, and update the model prefix parameters of the initial model according to the prediction result information and the correct answer of the request input message until the training cutoff condition is met, thus obtaining the first model.

10. The apparatus according to claim 6, characterized in that, The processing module is used for: If the model repair data also includes compressed example placeholders, attention calculations are performed on the learning requirement instruction, the historical repair examples, the compressed example placeholders, and the first dialogue message in a preset order, and the first output result is output. In this context, the learning requirement instruction, the historical repair example, the compressed example placeholder, and the first dialogue message each access themselves in the attention calculation, as well as the data preceding themselves in the preset order, and the historical repair example and the first dialogue message are isolated from each other in the attention calculation.