Language model training method and device, text prediction method and device, equipment and medium

By comparing the probability distribution differences between the first language model and the second language model, the output results are adjusted to improve text prediction accuracy, which solves the problem of the language model still outputting the original knowledge after the knowledge is updated, and achieves higher text prediction accuracy.

CN120670538APending Publication Date: 2025-09-19TENCENT TECHNOLOGY (SHENZHEN) CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410291284.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-13
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

The existing language model still outputs the response results corresponding to the original knowledge after the knowledge is updated, resulting in low text prediction accuracy.

Method used

The conversation content is predicted using the first language model and the second language model respectively to obtain their respective probability distributions. The second probability distribution is adjusted based on the difference in probability distributions to improve text prediction accuracy.

Benefits of technology

By comparing the probability distribution differences of different language models, the output results are adjusted to reduce the probability of reply content in the historical corpus and increase the probability of reply content in the updated corpus, thereby improving the accuracy of text prediction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120670538A_ABST
    Figure CN120670538A_ABST
Patent Text Reader

Abstract

The invention discloses a language model training method and device, a text prediction method and device, equipment and a medium, and relates to the field of machine learning. The method comprises the steps of obtaining first dialogue content; performing reply content prediction on the first dialogue content through a first language model to obtain a first prediction result; performing reply content prediction on the first dialogue content through a second language model to obtain a second prediction result; and based on a probability distribution difference between the first probability distribution and the second probability distribution, carrying out probability adjustment on the second probability distribution to obtain a reply prediction result corresponding to the first dialogue content. By comparing the probability distribution differences output by different language models, the probability distribution output by the current language model is adjusted, so that the probability that the output result contains the reply content in the historical corpus is reduced, the probability that the output result contains the reply content in the updated corpus is improved, and the accuracy of the text prediction result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of machine learning, and in particular to a language model training method, text prediction method, apparatus, device, and medium. Background Art

[0002] Response prediction involves predicting responses based on the conversation content input using a trained language model. As knowledge is constantly updated, responses to the same conversation content can change. For example, if the original knowledge was that the mayor of City A is Mr. A, after the election, the current knowledge is that the mayor of City A is Mr. B. Therefore, when the conversation content is about who the current mayor of City A is, the answer will change from "The mayor of City A is Mr. A" to "The mayor of City A is Mr. B."

[0003] In related technologies, when original knowledge is updated, the language model is updated and trained using the updated knowledge as training data to obtain an updated language model, which is used to output a response result after the knowledge is updated.

[0004] However, since the language model is trained based on the original knowledge, even if the language model is updated and trained using updated knowledge, the updated language model may still output response results corresponding to the original knowledge, resulting in lower accuracy in text prediction. Summary of the Invention

[0005] The present application provides a language model training method, text prediction method, apparatus, device, and medium, which can improve the accuracy of text prediction by adjusting the probability distribution of the language model output. The technical solution is as follows:

[0006] In one aspect, a text prediction method is provided, the method comprising:

[0007] Get the first conversation content;

[0008] predicting a reply content for the first conversation content using a first language model to obtain a first prediction result, wherein the first language model is a language model that predicts replies to the input conversation content using a historical corpus, and the first prediction result is used to indicate a first probability distribution corresponding to multiple first characters in the historical corpus;

[0009] Predicting a reply to the first conversation content using a second language model to obtain a second prediction result, where the second language model is a language model that predicts replies to the input conversation content using an updated corpus, and the second prediction result is used to indicate a second probability distribution corresponding to multiple second characters in the updated corpus;

[0010] Based on the probability distribution difference between the first probability distribution and the second probability distribution, the second probability distribution is probability adjusted to obtain a response prediction result corresponding to the first conversation content.

[0011] In another aspect, a method for training a language model is provided, the method comprising:

[0012] Acquire a historical corpus, wherein the historical corpus includes first corpus content obtained within a first time range;

[0013] When the first corpus content is updated within a second time range, obtaining an updated corpus, the updated corpus including the second corpus content after the knowledge update, the second time range being later than the first time range;

[0014] The model parameters of the first language model are adjusted according to the second corpus content to obtain a second language model, wherein the first language model is a language model that predicts responses to input conversation content according to the historical corpus, and the second language model is a language model that predicts responses to input conversation content according to the updated corpus.

[0015] In another aspect, a text prediction device is provided, comprising:

[0016] An acquisition module, configured to acquire the first conversation content;

[0017] a prediction module, wherein a user predicts a reply content for the first conversation content using a first language model to obtain a first prediction result, wherein the first language model is a language model that predicts replies to the input conversation content using a historical corpus, and the first prediction result is used to indicate a first probability distribution corresponding to multiple first characters in the historical corpus;

[0018] The prediction module is further configured to predict a reply content for the first conversation content using a second language model to obtain a second prediction result, wherein the second language model is a language model that predicts a reply to the input conversation content using an updated corpus, and the second prediction result is configured to indicate a second probability distribution corresponding to a plurality of second characters in the updated corpus;

[0019] An adjustment module is used to perform probability adjustment on the second probability distribution based on the probability distribution difference between the first probability distribution and the second probability distribution to obtain a response prediction result corresponding to the first dialogue content.

[0020] In another aspect, a language model training device is provided, the device comprising:

[0021] An acquisition module, configured to acquire a historical corpus, wherein the historical corpus includes first corpus content obtained within a first time range;

[0022] The acquisition module is further configured to acquire an updated corpus when the first corpus content is updated within a second time range, the updated corpus including the second corpus content after the knowledge update, the second time range being later than the first time range;

[0023] An adjustment module is configured to adjust model parameters of a first language model using the second corpus content to obtain a second language model, wherein the first language model is a language model that predicts responses to input conversation content using the historical corpus, and the second language model is a language model that predicts responses to input conversation content using the updated corpus.

[0024] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the text prediction method or language model training method as described in any of the above embodiments.

[0025] On the other hand, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the text prediction method or the language model training method as described in any of the above embodiments.

[0026] In another aspect, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform any of the text prediction methods or language model training methods described in the foregoing embodiments.

[0027] The beneficial effects of the technical solutions provided in the embodiments of the present application include at least:

[0028] When obtaining the content of a first conversation, the first language model and the second language model are used to predict the content of a reply to the first conversation, respectively. This results in a first probability distribution corresponding to multiple first characters in the historical corpus corresponding to the first language model, and a second probability distribution corresponding to multiple second characters in the updated corpus corresponding to the second language model. Based on the difference in the probability distribution between the first and second probability distributions, the second probability distribution is probabilistically adjusted to obtain a reply prediction result corresponding to the first conversation. In other words, by comparing the differences in the probability distributions output by different language models, the probability distribution output by the current language model is adjusted, thereby reducing the probability that the output result will include reply content from the historical corpus and increasing the probability that the output result will include reply content from the updated corpus, thereby improving the accuracy of the text prediction results. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0030] Figure 1 This is a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application;

[0031] Figure 2 is a flowchart of a text prediction method provided by an exemplary embodiment of the present application;

[0032] Figure 3 is a flowchart of a text prediction method provided by another exemplary embodiment of the present application;

[0033] Figure 4 is a flowchart of a text prediction method provided by another exemplary embodiment of the present application;

[0034] Figure 5 is a flowchart of a text prediction method provided by another exemplary embodiment of the present application;

[0035] Figure 6 is a schematic diagram of a text prediction method provided by another exemplary embodiment of the present application;

[0036] Figure 7 is a model performance comparison chart provided by another exemplary embodiment of the present application;

[0037] Figure 8 is a structural block diagram of a text prediction device provided by another exemplary embodiment of the present application;

[0038] Figure 9This is a structural block diagram of a language model training device provided by an exemplary embodiment of the present application;

[0039] Figure 10 It is a structural block diagram of a computer device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0040] To make the objectives, technical solutions, and advantages of this application more clear, the following will further describe the embodiments of this application in detail with reference to the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.

[0041] In this application, the terms "first", "second", etc. are used to distinguish identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first" and "second", nor is there any limitation on the quantity and execution order.

[0042] First, a brief introduction is given to the terms involved in the embodiments of this application.

[0043] Artificial Intelligence (AI) is the theory, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive field of computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making. AI technology is an interdisciplinary discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, pre-trained models, operating / interaction systems, and mechatronics. Pre-trained models, also known as large models or basic models, can be fine-tuned and widely applied to downstream tasks across various AI domains. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0044] Machine Learning (ML) is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of AI. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning through demonstration.

[0045] Factual knowledge: description of certain factual content, for example: the mayor of City A is Mr. A.

[0046] Outdated knowledge: refers to factual knowledge before the change when factual knowledge changes with the development of society.

[0047] Updated knowledge: refers to the factual knowledge that changes as society develops and factual knowledge changes.

[0048] Generative language model: A large language model designed to understand and generate human language, including natural language and programming language. For example, a model trained for code generation based on model architectures such as GPT-3, GPT-4, and GPT-5.

[0049] Figure 1 This is a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application. Figure 1 As shown, the implementation environment includes a terminal 110, a server 120, and a communication network 130, wherein the terminal 110 and the server 120 are connected via the communication network 130. Optionally, the communication network 130 can be a wired network or a wireless network, which is not limited here.

[0050] In this embodiment of the present application, terminal 110 is used to send data to server 120. Optionally, terminal 110 is installed with a target application that has a reply content prediction function, which is not limited in this embodiment. Illustratively, the target application can be a traditional application, a cloud application, a mini-program or application module within a host application, or a web platform, which is not limited in this embodiment.

[0051] After acquiring the first conversation content, the terminal 110 sends the first conversation content to the server 120 for predicting a reply result of the first conversation content.

[0052] In some embodiments, after receiving the first language model, server 120 first uses the first language model to predict the response content for the first conversation content, obtaining a first prediction result. The first language model is a language model that predicts responses to the input conversation content using a historical corpus, and the first prediction result is a first probability distribution corresponding to multiple first characters in the historical corpus.

[0053] In some embodiments, a second language model is used to predict a response to the first conversation content, obtaining a second prediction result. The second language model is a language model that predicts responses to the input conversation content using an updated corpus, and the second prediction result is a second probability distribution corresponding to each of a plurality of second characters in the updated corpus.

[0054] In some embodiments, based on the probability distribution difference between the first probability distribution and the second probability distribution, the second probability distribution is probability-adjusted to obtain a response prediction result corresponding to the first conversation content.

[0055] In some embodiments, the server 120 feeds back the response prediction result to the terminal 110 for display.

[0056] In some optional embodiments, the terminal 110 is a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart home appliance, a smart car terminal, a smart speaker, an intelligent voice interaction device, an aircraft, etc., but is not limited thereto.

[0057] It is worth noting that server 120 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0058] Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to enable data computing, storage, processing, and sharing. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, and application technology, all based on the cloud computing business model. It can form a resource pool for on-demand, flexible, and convenient use. Cloud computing technology will become a crucial support. Backend services in technical network systems, such as those for video websites, image websites, and more portals, require significant computing and storage resources. With the rapid development and application of the internet industry, every item will likely have its own unique identifier, requiring transmission to backend systems for logical processing. Data of varying levels will be processed separately, requiring robust system support for all types of industry data, which can only be achieved through cloud computing. Alternatively, server 120 can also be implemented as a node in a blockchain system.

[0059] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards in the relevant regions.

[0060] Combined with the above introduction and implementation environment, Figure 2 This is a flowchart of a text prediction method provided in an embodiment of the present application. The method can be applied to a terminal, a server, or both. The embodiment of the present application takes the application of the method to a server as an example for explanation. The method includes:

[0061] Step 210: Obtain the first conversation content.

[0062] Illustratively, the first dialogue content is text content in a dialogue format.

[0063] Optionally, the text expression of the first conversation content includes at least one of the following:

[0064] 1. Expressed in the form of questions. For example, the first conversation content is realized as "How is the weather today?"

[0065] 2. Expressed in declarative form. For example, the first conversation content could be "Check today's weather."

[0066] 3. Expression in the form of word combination. For example, the first conversation content is realized as "Today's weather", which includes the two words "today" and "weather";

[0067] 4. Picture-based expression: For example, the first dialog content is implemented as a weather picture display, wherein the sky area is highlighted and a question mark is displayed at a designated location to indicate that you are querying today's weather.

[0068] It is worth noting that the above textual expression of the first conversation content is merely an illustrative example and is not limited to this embodiment of the present application.

[0069] Optionally, the first conversation content is obtained by manual input by the user; or, a conversation content library is obtained in advance, the conversation content library includes multiple pre-generated candidate conversation contents, and the first conversation content is determined by selecting the candidate conversation contents.

[0070] Step 220 : predicting the response content of the first conversation content using the first language model to obtain a first prediction result.

[0071] The first language model is a language model that predicts responses to input conversation content using a historical corpus, and the first prediction result is used to indicate a first probability distribution corresponding to multiple first characters in the historical corpus.

[0072] Schematically, the first language model is a language model trained by using historical sample data corresponding to the historical corpus.

[0073] In some embodiments, the historical corpus includes factual knowledge within a historical time range.

[0074] Illustratively, the historical corpus includes multiple first characters, wherein the multiple first characters constitute multiple factual knowledge within a historical time range.

[0075] Optionally, the expression form of the first probability distribution includes at least one of the following forms:

[0076] 1. The reply corresponding to the first conversation content includes multiple characters, each of which corresponds to a decoding moment. Therefore, the first probability distribution includes the probability distributions of multiple first characters corresponding to each decoding moment. For example, for the first decoding moment, the first probability distribution includes probability distribution a corresponding to multiple first characters at the first decoding moment. For the second decoding moment, the first probability distribution includes probability distribution b corresponding to multiple first characters at the second decoding moment.

[0077] 2. The reply content corresponding to the first conversation content includes multiple characters, so the first prediction result includes the first predicted character corresponding to each character, and then generates a distribution probability. For example: the reply content includes three characters, among which the first language model predicts through the historical corpus that the first character in the reply content is character a, with a prediction probability value of 0.8, the second character is predicted to be character b, with a prediction probability value of 0.6, and the third character is predicted to be character c, with a prediction probability value of 0.7. Therefore, the first probability distribution is 0.8, 0.6 and 0.7.

[0078] It is worth noting that the above expression of the first probability distribution is only an illustrative example and is not limited to this embodiment of the present application.

[0079] Optionally, the first language model predicts a response to the input conversation content in at least one of the following ways:

[0080] 1. During the reply prediction process, the probability prediction values ​​corresponding to multiple first characters at different decoding moments are determined from the historical corpus in sequence according to the character decoding order. That is, the reply prediction is performed character by character. For example, the first decoding moment is used to predict the first character of the reply result. Therefore, the probability prediction values ​​corresponding to multiple first characters at the first decoding moment are predicted using the first language model.

[0081] 2. In the process of answer prediction, the historical corpus includes multiple candidate historical corpus texts, and the matching degrees between the multiple candidate historical corpus texts and the first dialogue content are obtained. The probability prediction values ​​corresponding to the multiple first characters are calculated according to the matching degrees. When the multiple candidate historical corpus texts contain the same first character, the average value of the multiple matching degrees can be calculated as the probability prediction value corresponding to the first character. For example: the historical corpus includes candidate historical corpus text a (including character 1, character 2 and character 3) and candidate historical corpus text b (including character 1 and character 4), where the matching degree between candidate historical corpus text a and the first dialogue content is 70%, therefore, the probability prediction values ​​corresponding to character 1, character 2 and character 3 are 0.7 respectively, and the matching degree between candidate historical corpus text b and the first dialogue content is 30%, therefore, the probability prediction values ​​corresponding to character 1 and character 4 are 0.3 respectively, therefore, the probability prediction value corresponding to character 1 is (0.7+0.3) / 2=0.5, the probability prediction value corresponding to character 2 is 0.7, the predicted probability value corresponding to character 3 is 0.7, and the probability prediction value corresponding to character 4 is 0.3.

[0082] It is worth noting that the above-mentioned method of response prediction is only an illustrative example and is not limited to this embodiment of the present application.

[0083] Step 230: predict the response content of the first conversation content using the second language model to obtain a second prediction result.

[0084] The second language model is a language model that predicts responses to input conversation content by updating the corpus, and the second prediction result is used to indicate a second probability distribution corresponding to multiple second characters in the updated corpus.

[0085] Schematically, the updated corpus includes factual knowledge within the current time range.

[0086] Illustratively, the updated corpus includes a plurality of second characters, wherein the plurality of second characters constitute a plurality of factual knowledge within a historical time range.

[0087] Optionally, the updated corpus is based on the historical corpus, and some historical factual knowledge in the historical corpus is adjusted to obtain a corpus including updated knowledge as the updated corpus; or, the updated corpus is a corpus independently generated by collecting all factual knowledge within the current time range.

[0088] Optionally, the second character in the updated corpus is the same as the first character in the historical corpus, that is, the corpus texts in different corpora are obtained by making different combinations of the same characters; or, the second character in the updated corpus is partially identical to and partially different from the first character in the historical corpus, and there is no limitation on this.

[0089] Optionally, the second language model is obtained by at least one of the following methods:

[0090] 1. Based on the first language model, by determining updated knowledge after the updated corpus is updated relative to the knowledge in the historical expectation library, the model parameters of the first language model are adjusted using the updated knowledge, thereby using the first language model with the adjusted parameters as the second language model. For example, the gradient value of the first language model is adjusted according to the updated knowledge to obtain the first language model with the updated gradient value as the second language model;

[0091] 2. Using the corpus knowledge in the updated expectation library as training data, after obtaining an initialization model, use the training data to train the initialization model to obtain a second language model.

[0092] It is worth noting that the above-mentioned method for obtaining the second language model is only an illustrative example and is not limited to this embodiment of the present application.

[0093] Optionally, the expression form of the second probability distribution includes at least one of the following forms:

[0094] 1. The reply corresponding to the first conversation content includes multiple characters, each of which corresponds to a decoding moment. Therefore, the second probability distribution includes the probability distributions of multiple second characters corresponding to each decoding moment. For example, for the first decoding moment, the second probability distribution includes probability distribution a for the multiple second characters corresponding to the first decoding moment. For the second decoding moment, the second probability distribution includes probability distribution b for the multiple second characters corresponding to the second decoding moment.

[0095] 2. The reply content corresponding to the first conversation content includes multiple characters, so the second prediction result includes the predicted second character corresponding to each character, and then generates a distribution probability. For example: the reply content includes three characters, among which the first language model predicts through the historical corpus that the first character in the reply content is character a, with a prediction probability value of 0.8, the second character is predicted to be character b, with a prediction probability value of 0.6, and the third character is predicted to be character c, with a prediction probability value of 0.7. Therefore, the second probability distribution is 0.8, 0.6 and 0.7.

[0096] It is worth noting that the above expression of the second probability distribution is only an illustrative example and is not limited to this embodiment of the present application.

[0097] Optionally, the first language model and the second language model correspond to different model architectures, for example, the first language model is a generative model and the second language model is an analytical model; or, the first language model and the second language model correspond to the same model architecture, for example, both the first language model and the second language model are generative models.

[0098] Among them, the generative model refers to generating a set of dialogue content in a specified formal language system; the analytical model refers to analyzing each element in the dialogue content set, determining the relationship between each element, and establishing a model of the dialogue content set based on this.

[0099] Optionally, the second language model predicts a response to the input conversation content in at least one of the following ways:

[0100] 1. During the reply prediction process, the probability prediction values ​​corresponding to multiple second characters at different decoding moments are determined from the updated corpus in sequence according to the character decoding order. That is, the reply prediction is performed character by character. For example, the first decoding moment is used to predict the first character in the reply result, so the probability prediction values ​​corresponding to multiple second characters at the first decoding moment are predicted using the first language model;

[0101] 2. In the process of answer prediction, the update corpus includes multiple candidate update corpus texts, and the matching degrees between the multiple candidate update corpus texts and the first dialogue content are obtained. The probability prediction values ​​corresponding to the multiple second characters are calculated according to the matching degrees. When the multiple candidate update corpus texts contain the same second character, the average value of the multiple matching degrees can be calculated as the probability prediction value corresponding to the second character. For example: the update corpus includes candidate update corpus text a (including character 1, character 2 and character 3) and candidate update corpus text b (including character 1 and character 4), where the match degree between the candidate updated corpus text a and the first conversation content is 70%, therefore, the probability prediction values ​​corresponding to characters 1, 2, and 3 are 0.7 respectively, and the match degree between the candidate updated corpus text b and the first conversation content is 30%, therefore, the probability prediction values ​​corresponding to characters 1 and 4 are 0.3 respectively, therefore, the probability prediction value corresponding to character 1 is (0.7+0.3) / 2=0.5, the probability prediction value corresponding to character 2 is 0.7, the predicted probability value corresponding to character 3 is 0.7, and the probability prediction value corresponding to character 4 is 0.3.

[0102] It is worth noting that the above-mentioned method of response prediction is only an illustrative example and is not limited to this embodiment of the present application.

[0103] Optionally, the first probability distribution is completely different from the second probability distribution, or the probability prediction value corresponding to the existence of the specified character in the first probability distribution is the same as that in the second probability distribution, which is not limited to this.

[0104] Optionally, after obtaining the first conversation content, the first language model and the second language model are used to synchronously predict replies to the first conversation content to obtain a first prediction result and a second prediction result; or, the first language model corresponds to a historical conversation set, and the historical conversation set includes historical conversation content within a historical time range for which the first language model performs reply predictions. A target conversation content that matches the first conversation content is determined from multiple historical conversation contents, and the historical probability distribution obtained by the first language model's reply prediction of the target conversation content is used as the first probability distribution. The second language model is used to predict replies to the first conversation content to obtain a second prediction result.

[0105] Step 240 : Based on the probability distribution difference between the first probability distribution and the second probability distribution, the second probability distribution is probability adjusted to obtain a response prediction result corresponding to the first conversation content.

[0106] In some embodiments, the probability distribution difference refers to the probability value difference between the probability prediction values ​​corresponding to the first characters and the probability prediction values ​​corresponding to the second characters.

[0107] Optionally, the probability distribution difference is realized as the difference in probability values ​​corresponding to the probability prediction value corresponding to the first character and the probability prediction value corresponding to the second character at the same decoding moment; or, the probability distribution difference is realized as the difference in similarity between the first character and the second character.

[0108] Optionally, the probability distribution difference is implemented as at least one of difference types such as KL divergence, JS divergence (Jensen-Shannon divergence), and Earth Mover's Distance.

[0109] Optionally, the probability adjustment method includes at least one of the following methods:

[0110] 1. Both the first probability distribution and the second probability distribution include probability sub-distributions at multiple decoding moments. Therefore, the probability prediction difference between the first probability distribution and the second probability distribution at each decoding moment is obtained, and the probability prediction value corresponding to the second character at the decoding moment is adjusted. For example, the first probability distribution includes a probability prediction value of 0.2 corresponding to character 1 and a probability prediction value of 0.8 corresponding to character 2. The second probability distribution includes a probability prediction value of 0.1 corresponding to character 1, a probability prediction value of 0.2 corresponding to character 2, and a probability prediction value of 0.7 corresponding to character 3. Therefore, the probability distribution difference is character 1: 0.1-0.2=-0.1, character 2: 0.2-0.8=-0.6, character 3: 0.7-0=0.7;

[0111] 2. Pre-set multiple probability adjustment thresholds, where different probability adjustment thresholds correspond to different adjustment parameters. The corresponding probability adjustment threshold is determined according to the difference in probability distribution, and then the adjustment parameter of the corresponding probability adjustment threshold is used to adjust the second probability distribution.

[0112] It is worth noting that the above-mentioned probability adjustment method is only an illustrative example and is not limited to this embodiment of the present application.

[0113] Optionally, the reply prediction result includes a probability distribution obtained after probability adjustment of multiple second characters; or, the reply prediction result includes a reply text content composed of multiple second characters, and the multiple second characters are determined from the adjusted second probability distribution.

[0114] In summary, the text prediction method provided in the embodiments of the present application, upon obtaining the content of a first conversation, predicts the content of a reply to the first conversation using a first language model and a second language model, respectively. This method obtains a first probability distribution corresponding to multiple first characters in the historical corpus corresponding to the first language model and a second probability distribution corresponding to multiple second characters in the updated corpus corresponding to the second language model. The method then probabilistically adjusts the second probability distribution based on the difference in probability distribution between the first and second probability distributions to obtain a reply prediction result corresponding to the first conversation content. That is, by comparing the difference in probability distributions output by different language models, the probability distribution output by the current language model is adjusted, thereby reducing the probability that the output result contains reply content from the historical corpus and increasing the probability that the output result contains reply content from the updated corpus, thereby improving the accuracy of the text prediction result.

[0115] In an optional embodiment, the probability adjustment is described in detail. For illustration, please refer to Figure 3 , which shows a flow chart of a text prediction method provided by an exemplary embodiment of the present application, that is, step 240 also includes steps 241 and 242, schematically, as shown Figure 3 As shown, the method includes the following steps.

[0116] Step 241: Obtain a probability distribution difference between the first probability distribution and the second probability distribution.

[0117] Illustratively, a similarity result between the first probability distribution and the second probability distribution is calculated as the probability distribution difference.

[0118] In some embodiments, the character decoding order corresponds to multiple decoding moments, the reply prediction result includes multiple characters output at the decoding moments, the second prediction result includes multiple second characters belonging to the nth second probability distribution of the characters output at the nth decoding moment, and the first prediction result includes multiple first characters belonging to the nth first probability distribution of the characters output at the nth decoding moment, where n is a positive integer; the target distribution difference between the nth first probability distribution and the nth second probability distribution is obtained.

[0119] Illustratively, a language model predicts the response content based on the input conversation content, ultimately generating the corresponding response content. This means that the final response content can be displayed in text form. Therefore, the response content consists of multiple characters arranged in a semantic order. Therefore, the character decoding order is the order in which the multiple second characters in the response content are sequentially decoded. Decoding is used to determine the character element corresponding to a specified character position in the final response content.

[0120] In this embodiment, the character decoding order includes multiple decoding moments, each decoding moment is used to determine the second character at a specified decoding position in the reply prediction result, for example: the character decoding order corresponds to three decoding moments, and the reply prediction result includes three output characters, wherein the three decoding moments are respectively used to decode from multiple second characters in the updated corpus to determine the three output characters in the reply prediction result.

[0121] In this embodiment, in the process of reply content prediction, the output characters in the reply prediction result are obtained one by one according to the character decoding order. For example: for the nth decoding moment in the reply content prediction process, the first language model predicts the output character of the nth decoding moment through the historical corpus, and obtains the first probability distribution corresponding to multiple first characters in the historical prediction library. At this time, the first probability distribution corresponding to the nth decoding moment can be called the nth first probability distribution; similarly, at the nth decoding moment, the second language model outputs the second probability distribution corresponding to multiple second characters, which is called the nth second probability distribution.

[0122] Taking the nth first probability distribution as an example, optionally, the nth first probability distribution is obtained by the first language model based on the n-1th first probability distribution; or, the nth first probability distribution is obtained by the first language model independently predicting the first dialogue content; or, the nth first probability distribution is obtained by the first language model based on the first n-1 first probability distributions.

[0123] Among them, when the nth first probability distribution is obtained based on the n-1th first probability distribution, the second language model performs a correlation analysis on the target character predicted by the n-1th first probability distribution, determines the correlation analysis result between the second character and the target character in the updated corpus, and then determines the nth first probability distribution based on the correlation analysis result.

[0124] In this embodiment, the first language model is used to predict responses for the multiple first characters at the t-th decoding time to obtain the t-th first probability distribution corresponding to the multiple first characters at the t-th decoding time, where t is a positive integer. For details, please refer to the following formula 1.

[0125] Formula 1:

[0126] Among them, y <t represents the first probability distribution of the first t-1 predicted by the first language model, is the t-th first probability distribution corresponding to the multiple first characters predicted by the first language model θ.

[0127] In this embodiment, the second language model is used to predict responses for the plurality of second characters at the t-th decoding time to obtain the t-th second probability distribution corresponding to the plurality of second characters at the t-th decoding time. For details, please refer to the following formula 2.

[0128] Formula 2:

[0129] in, represents the first t-1 second probability distributions predicted by the second language model, Second language model The t-th second probability distribution corresponding to the predicted multiple second characters.

[0130] In this embodiment, the JS divergence between the second probability distribution and the first probability distribution is calculated, and the calculation result is used as the probability distribution difference. At the t-th decoding moment, the JS divergence between the t-th second probability distribution and the t-th first probability distribution is calculated as the t-th target distribution difference. For details, please refer to Formula 3.

[0131] Formula 3:

[0132] Where Δ(t) represents the t-th target distribution difference.

[0133] In this embodiment, the JS divergence between the probability prediction values ​​output by different language models for the same character is calculated as the probability difference. The higher the probability difference, the lower the similarity between the two. For example, please refer to the following Table 1, which shows the performance indicator results corresponding to different methods in the relevant technology for different types of question content.

[0134] Table 1

[0135]

[0136]

[0137] Among them, OE represents the proportion of characters in the second prediction result that belong to the key content before the knowledge update to all characters in the second prediction result, F1 represents the matching degree between the output result of the language model and the standard answer, and EM represents whether the output result of the language model is completely equal to the standard answer, 0 represents not equal, and 1 represents equal.

[0138] As can be seen from Table 1, for multiple related technologies, the JS value of the second language model on reasoning problems is relatively low. That is, the probability distribution of the predicted responses of the first language model and the second language model on the same question is highly similar, and this distribution is basically negatively correlated with OE and positively correlated with F1 score and EM score.

[0139] Among them, non-inference questions refer to questions where the language model can directly output a response result after performing text analysis on the conversation content; inference questions refer to questions where reasoning problems usually require logical analysis based on known facts, data or premises to draw conclusions or solve problems.

[0140] Step 242: Probability adjustment is performed on the second probability distribution based on the character decoding order and the probability distribution difference to obtain a reply prediction result.

[0141] Among them, the character decoding order corresponds to the arrangement order of multiple characters in the reply prediction result.

[0142] Schematically, the probability prediction values ​​corresponding to multiple second characters in the second probability distribution are probability adjusted in sequence according to the character decoding order, and finally a response prediction result corresponding to multiple output characters is obtained, wherein the arrangement order of the output characters remains consistent with the character decoding order.

[0143] In some embodiments, at the nth decoding moment, the nth second probability distribution is probability adjusted based on the target distribution difference to obtain the nth character prediction result, and the nth character prediction result is used to indicate the probability value of multiple second characters belonging to the output character at the nth decoding moment; based on the nth character prediction result, the output character at the nth decoding moment in the reply prediction result is determined from the updated corpus.

[0144] In this embodiment, when the current moment is the nth decoding moment, the nth second probability distribution is probability adjusted based on the target distribution difference between the nth second probability distribution and the nth first probability distribution, thereby obtaining the nth character prediction result, wherein the nth character prediction result represents the probability distribution corresponding to multiple second characters after the probability adjustment at the nth decoding moment.

[0145] Optionally, the probability adjustment includes at least one of adding, subtracting, weighted adding, and averaging the differences between the probability prediction values ​​corresponding to the multiple second characters in the nth second probability distribution and the target distributions corresponding to the multiple second characters.

[0146] In this embodiment, after the n-th character prediction result is obtained, the second character with the highest probability value corresponding to the character prediction result is selected from the updated corpus as the output character at the n-th decoding moment.

[0147] That is, in the case of multiple decoding moments, the decoding moment is used as the probability adjustment division dimension, and the probability distribution difference within each decoding moment is determined in turn, so as to perform the probability adjustment at the current decoding moment, which can ensure the orderliness of the character prediction result output and further improve the content accuracy of the text prediction result.

[0148] In some embodiments, a candidate distribution difference between the nth first probability distribution and the nth second probability distribution is obtained; for the first target character, if the first target character belongs to the historical corpus, the first probability difference of the first target character is determined based on the candidate probability difference of the first target character in the candidate distribution difference; for the second target character, if the second target character does not belong to the historical corpus, the candidate probability difference of the second target character in the candidate distribution difference is used as the second probability difference of the second target character; the target distribution difference is determined based on the first probability difference and the second probability difference.

[0149] Optionally, for a single character, the candidate distribution difference is composed of candidate probability differences corresponding to multiple characters. Therefore, the candidate probability difference corresponding to a single character includes probability differences calculated by different calculation methods, for example: candidate probability difference 1 calculated by KL divergence and candidate probability difference 2 calculated by JS divergence; or, the candidate probability difference includes probability differences calculated according to a specified calculation method, and difference values ​​corresponding to pre-set specified values, for example: the candidate probability difference includes candidate probability difference a calculated by JS divergence, and a preset difference value 0 as the candidate probability difference b.

[0150] Illustratively, the first target character / the second target character refers to a designated second character among a plurality of second characters.

[0151] In this embodiment, since the first character in the historical corpus and the second character in the updated corpus have some characters in common, if the first target character belongs to the first character in the historical corpus, the JS divergence corresponding to the first target character is calculated (that is, the JS divergence between the first probability prediction value in the first probability distribution corresponding to the first target character and the second probability prediction value in the second probability distribution corresponding to the first target character), and the JS divergence is numerically compared with the preset difference value 0, and the probability difference with the smallest value is selected as the first probability difference corresponding to the first target character. If the second target character does not belong to the historical corpus, that is, the current second target character is only the second character in the updated corpus, the JS divergence corresponding to the second target character is directly calculated as the second probability difference. Among them, if the second target character does not belong to the historical corpus, the predicted probability value corresponding to the second target character in the first probability distribution does not exist, or is 0. For details, please refer to the following formula 4.

[0152] Formula 4:

[0153] in, Represents the first character in the historical corpus.

[0154] That is, when the target character is the first character in the historical corpus, the minimum comparison method is used to ensure that the probability difference corresponding to the target character always takes the minimum value, thereby reducing the impact of the characters in the historical corpus on the text prediction results in subsequent probability adjustments and improving the accuracy of text prediction.

[0155] In some embodiments, the updated corpus is a corpus obtained after knowledge updating of key content based on the historical corpus; the candidate distribution difference between the nth first probability distribution and the nth second probability distribution is obtained; for the first target character, when the first target character belongs to the key content before the knowledge update or the key content after the knowledge update, the first probability difference of the first target character is determined based on the candidate probability difference of the first target character in the candidate distribution difference; for the second target character, when the second target character does not belong to the key content, the candidate probability difference of the second target character in the candidate distribution difference is used as the second probability difference of the second target character; the target distribution difference is determined based on the first probability difference and the second probability difference.

[0156] In this embodiment, the updated corpus is linked to the historical corpus. That is, the updated corpus is a corpus obtained by updating the key content of the historical corpus. Key content refers to factual knowledge that changes over time. For example, the historical corpus includes text a, "The mayor of City A is Mr. Bai." If, after an election, the mayor of City A changes from Mr. Bai to Mr. Huang, the updated corpus updates the key content "Bai" in text a, "The mayor of City A is Mr. Bai," to "Huang." That is, the updated corpus includes text b, "The mayor of City A is Mr. Huang." This shows that "Bai" is the key content before the knowledge update, and "Huang" is the key content after the knowledge update.

[0157] Therefore, when the candidate distribution difference is composed of candidate probability differences corresponding to multiple characters, after obtaining the candidate distribution difference between the nth first probability distribution and the nth second probability distribution, if the first target character belongs to the key content before the knowledge update or the key content after the knowledge update, the JS divergence corresponding to the first target character is calculated (that is, the JS divergence between the first probability prediction value in the first probability distribution corresponding to the first target character and the second probability prediction value in the second probability distribution corresponding to the first target character), and the JS divergence is numerically compared with the preset difference value 0, and the probability difference with the smallest value is selected as the first probability difference corresponding to the first target character. If the second target character does not belong to the key content (including before and after the knowledge update), the JS divergence corresponding to the second target character is directly calculated as the second probability difference. For details, please refer to the following formula 5.

[0158] Formula 5:

[0159] in, Indicates the key content before knowledge update, Indicates the key content after knowledge update.

[0160] That is, for the target characters that have undergone knowledge update changes, no matter before or after the knowledge update, the minimum value comparison method is used to ensure that the probability difference corresponding to the target characters always takes the minimum value. This not only reduces the impact of the characters before the knowledge update on the text prediction results in the subsequent probability adjustment, but also avoids excessive adjustment of the text prediction results by the characters after the knowledge update, thereby further improving the accuracy of text prediction.

[0161] In some embodiments, when the number of second characters whose probability values ​​are lower than a preset probability threshold in the n-th character prediction result reaches a preset number threshold, the output characters of the first n-1 decoding moments are determined from the updated corpus based on the first n-1 character prediction results as the reply prediction result.

[0162] In this embodiment, at the nth decoding moment, if in the nth character prediction result, the number of characters whose probability prediction value corresponding to the second character is lower than the preset probability threshold (for example: 0.01) reaches the preset number threshold, it means that the output characters of the previous n-1 decoding moments are the reply prediction results, and there is no need to execute the reply prediction process corresponding to the current decoding moment. Therefore, the output characters of the previous n decoding moments are directly used as the reply prediction results.

[0163] That is, after making a numerical judgment on the predicted probability value corresponding to each second character at the current decoding moment, the current reply prediction process is terminated when there are many second characters with low predicted probability values. This can avoid over-prediction of the reply prediction results and cause redundant content of the reply prediction results.

[0164] In some embodiments, the target distribution difference includes probability differences corresponding to multiple second characters and multiple first characters respectively; when the number of second characters whose probability differences in the target distribution difference are greater than a preset difference threshold reaches a preset number condition, the nth second probability distribution is probability adjusted based on the target distribution difference to obtain the nth character prediction result.

[0165] In this embodiment, the target distribution difference is composed of the probability differences between the plurality of second characters and the plurality of first characters at the nth decoding time. Therefore, if the number of second characters whose probability differences exceed a preset difference threshold reaches a predetermined number, the nth second probability distribution is probabilistically adjusted based on the target distribution difference to obtain the nth character prediction result.

[0166] That is, after numerically judging the predicted probability values ​​corresponding to each second character at the current decoding moment, if there are many high probability differences, it indicates that the current answer prediction process is in progress, so the probability adjustment at the current decoding moment is completed to improve the probability adjustment efficiency.

[0167] In summary, the text prediction method provided in the embodiments of the present application, upon obtaining the content of a first conversation, predicts the content of a reply to the first conversation using a first language model and a second language model, respectively. This method obtains a first probability distribution corresponding to multiple first characters in the historical corpus corresponding to the first language model and a second probability distribution corresponding to multiple second characters in the updated corpus corresponding to the second language model. The method then probabilistically adjusts the second probability distribution based on the difference in probability distribution between the first and second probability distributions to obtain a reply prediction result corresponding to the first conversation content. That is, by comparing the difference in probability distributions output by different language models, the probability distribution output by the current language model is adjusted, thereby reducing the probability that the output result contains reply content from the historical corpus and increasing the probability that the output result contains reply content from the updated corpus, thereby improving the accuracy of the text prediction result.

[0168] In this embodiment, the probability adjustment of the second probability distribution is performed in a manner of determining the probability adjustment order according to the character decoding order, thereby avoiding omissions or adjustment errors in the probability adjustment and improving the accuracy of the probability adjustment.

[0169] In some embodiments, the probability adjustment process is described in detail. For example, please refer to Figure 4 , which shows a flowchart of a text prediction method provided by an exemplary embodiment of the present application, that is, based on step 242, it also includes steps 2421 to 2423, such as Figure 4 As shown, the method includes the following steps.

[0170] Step 2421, obtain a first weight value.

[0171] In this embodiment, the first weight value is a weight parameter set by the designer according to actual needs. Optionally, the first weight value is in [0, 1]; or, the first weight value is any value greater than 0; or, the first weight value is a negative number.

[0172] Optionally, the first weight value is a single weight value; or, the designer designs a plurality of different first weight values.

[0173] Step 2422: Perform weighted fusion on the probability distribution difference and the first weight based on the character decoding order to obtain a fused distribution difference.

[0174] Illustratively, based on the character decoding order, the probability distribution difference includes target distribution differences corresponding to multiple different decoding moments. Therefore, taking the tth decoding moment as an example, the target distribution difference between the tth first probability distribution and the tth second probability distribution is obtained, where the target distribution difference is composed of probability differences between multiple second characters and multiple first characters. Each probability difference is multiplied by the first weight value to obtain the product results corresponding to the multiple probability differences, which serve as the fused distribution difference.

[0175] Step 2423: fuse the difference between the second probability distribution and the fused distribution to obtain a response prediction result.

[0176] In this embodiment, taking the tth decoding moment as an example, when the product results corresponding to the multiple probability differences at the tth decoding moment are obtained, each probability difference is added to the corresponding product result to obtain the probability prediction value of the second character corresponding to the probability difference. For details, refer to the following formula 6.

[0177] Formula 6:

[0178] Where α represents the first weight value. When α>0, it acts as a hyperparameter to control the weight of Δ(t).

[0179] In some embodiments, the updated corpus is a character library obtained after knowledge updating of key content based on the historical corpus, where the key content is the keyword content in the edited reply content; the first dialogue content is modified based on the edited reply content to obtain a first adjusted dialogue; the reply content of the first adjusted dialogue is predicted through the second language model to obtain a second prediction result.

[0180] In this embodiment, the key content refers to the keywords in the edit reply content. For example, the edit reply content is changed from "Mayor of City A" to "Mr. Huang", where "Huang" is the keyword content.

[0181] In this embodiment, the first conversation content is modified based on the edited reply content to obtain a modified first adjusted conversation. The modification method may include splicing the edited reply content with the first conversation content, integrating the edited reply content into the first conversation content, or adding the edited reply content to the end of the first conversation content. After the first conversation content is adjusted, the second language model is used to predict the reply content of the first adjusted conversation, thereby obtaining a second prediction result.

[0182] That is, by modifying the first dialogue content by editing the reply content containing key content, the reasoning of the first dialogue content can be enhanced. Therefore, when the second language model predicts a reply to the adjusted first dialogue content, it can make inferences and predictions on the reply result based on the key content, thereby enhancing the reasoning of the second language model in the reply prediction process, and thereby improving the accuracy of the second prediction result.

[0183] In some embodiments, the edited reply content and the first conversation content are spliced ​​in a preset splicing order to obtain a first adjusted conversation.

[0184] In this embodiment, since the first dialogue content is a dialogue obtained after the second language model is inferred, for example, the non-inferential dialogue content is "Who is the mayor of City A?" and the inferential dialogue content is "Who is the wife of the mayor of City A?", the edited reply content and the first dialogue content are sequentially spliced ​​to obtain a first adjusted dialogue. For example, the edited reply content is "City A Market" changed to "Mr. Huang" and the first dialogue content is "Who is the wife of the mayor of City A." Thus, the first adjusted dialogue is "City A Market" changed to "Mr. Huang," and the question is: Who is the wife of the mayor of City A?

[0185] That is, by taking the edited reply content as the premise of the question and adjusting the content of the first dialogue, the second language model can first read the edited reply content and make inference predictions on the content of the first dialogue under the premise of the current question, thereby improving the accuracy of the reply prediction results.

[0186] In summary, the text prediction method provided in the embodiments of the present application, upon obtaining the content of a first conversation, predicts the content of a reply to the first conversation using a first language model and a second language model, respectively. This method obtains a first probability distribution corresponding to multiple first characters in the historical corpus corresponding to the first language model and a second probability distribution corresponding to multiple second characters in the updated corpus corresponding to the second language model. The method then probabilistically adjusts the second probability distribution based on the difference in probability distribution between the first and second probability distributions to obtain a reply prediction result corresponding to the first conversation content. That is, by comparing the difference in probability distributions output by different language models, the probability distribution output by the current language model is adjusted, thereby reducing the probability that the output result contains reply content from the historical corpus and increasing the probability that the output result contains reply content from the updated corpus, thereby improving the accuracy of the text prediction result.

[0187] That is, by weighting and adjusting multiple probability differences in the probability distribution difference according to the character decoding order, the influence of the probability difference on the accuracy of the answer prediction result can be controlled, thereby improving the accuracy of text prediction.

[0188] In some embodiments, the updated corpus is a corpus obtained after knowledge updating of key content on the basis of the historical corpus; for the third target character, when the third target character belongs to the key content before the knowledge update, the first probability prediction value of the third target character in the first prediction result and the second probability prediction value in the second prediction result are obtained; when the probability difference between the first probability prediction value and the second probability prediction value meets the probability reset condition, the second probability prediction value corresponding to the third target character is set to zero to obtain the zeroed result corresponding to the third target character.

[0189] In this embodiment, the updated corpus is linked to the historical corpus. That is, the updated corpus is a corpus obtained by updating the key content of the historical corpus. Key content refers to factual knowledge that changes over time. For example, the historical corpus includes text a, "The mayor of City A is Mr. Bai." If, after an election, the mayor of City A changes from Mr. Bai to Mr. Huang, the updated corpus updates the key content "Bai" in text a, "The mayor of City A is Mr. Bai," to "Huang." That is, the updated corpus includes text b, "The mayor of City A is Mr. Huang." This shows that "Bai" is the key content before the knowledge update, and "Huang" is the key content after the knowledge update.

[0190] In this embodiment, the third target character refers to a designated second character among the plurality of second characters.

[0191] In this embodiment, if the third target character in the updated corpus belongs to the character in the key content before the knowledge update, the first probability prediction value obtained by the first language model for predicting the response to the third target character and the second probability prediction result obtained by the second language model for predicting the response to the third target character are obtained. If the probability difference between the first probability prediction value and the second probability prediction value is less than a preset difference threshold (for example: 0.01), it is considered that there is an error in the prediction result of the second language model for the third target character, and the second probability prediction value is set to 0 as the zeroing result corresponding to the third target character, which is used for subsequent probability distribution adjustment.

[0192] In summary, the text prediction method provided in the embodiments of the present application, upon obtaining the content of a first conversation, predicts the content of a reply to the first conversation using a first language model and a second language model, respectively. This method obtains a first probability distribution corresponding to multiple first characters in the historical corpus corresponding to the first language model and a second probability distribution corresponding to multiple second characters in the updated corpus corresponding to the second language model. The method then probabilistically adjusts the second probability distribution based on the difference in probability distribution between the first and second probability distributions to obtain a reply prediction result corresponding to the first conversation content. That is, by comparing the difference in probability distributions output by different language models, the probability distribution output by the current language model is adjusted, thereby reducing the probability that the output result contains reply content from the historical corpus and increasing the probability that the output result contains reply content from the updated corpus, thereby improving the accuracy of the text prediction result.

[0193] That is, by comparing the probability prediction differences of the same character output by different language models, it is determined whether the second model's prediction result for the character is wrong. If the prediction is wrong, the prediction result is set to zero to avoid the situation where the prediction result cannot be reasonably adjusted during the probability adjustment process, resulting in an error in the final answer prediction result, thereby improving the accuracy of text prediction.

[0194] In some embodiments, the training process of the language model is described in detail. For illustration, please refer to Figure 5 , which shows a flow chart of a method for training a language model provided by an exemplary embodiment of the present application, such as Figure 5 As shown, the method includes the following steps.

[0195] Step 510: Obtain a historical corpus.

[0196] The historical corpus includes first corpus content obtained within a first time range.

[0197] In some embodiments, the historical corpus includes factual knowledge within a first time range.

[0198] Illustratively, the historical corpus includes multiple first characters, wherein the multiple first characters constitute multiple factual knowledge within a historical time range.

[0199] Illustratively, the first corpus content is text content consisting of at least two first characters arranged in character order.

[0200] Step 520 : When the first corpus content is updated within the second time range, an updated corpus is obtained.

[0201] The updated corpus includes second corpus content after knowledge update, and the second time range is later than the first time range.

[0202] Illustratively, the updated corpus includes factual knowledge within the second time range.

[0203] Illustratively, the updated corpus includes a plurality of second characters, wherein the plurality of second characters constitute a plurality of factual knowledge within a historical time range.

[0204] Illustratively, the second corpus content is text content consisting of at least two second characters arranged in character order.

[0205] Optionally, the updated corpus is based on the historical corpus, and some historical factual knowledge in the historical corpus is adjusted to obtain a corpus including updated knowledge as the updated corpus; or, the updated corpus is a corpus independently generated by collecting all factual knowledge within the current time range.

[0206] Optionally, the second character in the updated corpus is the same as the first character in the historical corpus, that is, the corpus texts in different corpora are obtained by making different combinations of the same characters; or, the second character in the updated corpus is partially identical to and partially different from the first character in the historical corpus, and there is no limitation on this.

[0207] Step 530: Adjust the model parameters of the first language model according to the second corpus content to obtain a second language model.

[0208] Among them, the first language model is a language model that predicts responses to input conversation content through a historical corpus, and the second language model is a language model that predicts responses to input conversation content through an updated corpus.

[0209] Illustratively, the first language model is a language model obtained by training with training data corresponding to the first corpus content in the historical corpus.

[0210] Optionally, the first language model predicts a response to the input conversation content in at least one of the following ways:

[0211] 1. During the reply prediction process, the probability prediction values ​​corresponding to multiple first characters at different decoding moments are determined from the historical corpus in sequence according to the character decoding order. That is, the reply prediction is performed character by character. For example, the first decoding moment is used to predict the first character of the reply result. Therefore, the probability prediction values ​​corresponding to multiple first characters at the first decoding moment are predicted using the first language model.

[0212] 2. In the process of answer prediction, the historical corpus includes multiple candidate historical corpus texts, and the matching degrees between the multiple candidate historical corpus texts and the first dialogue content are obtained. The probability prediction values ​​corresponding to the multiple first characters are calculated according to the matching degrees. When the multiple candidate historical corpus texts contain the same first character, the average value of the multiple matching degrees can be calculated as the probability prediction value corresponding to the first character. For example: the historical corpus includes candidate historical corpus text a (including character 1, character 2 and character 3) and candidate historical corpus text b (including character 1 and character 4), where the matching degree between candidate historical corpus text a and the first dialogue content is 70%, therefore, the probability prediction values ​​corresponding to character 1, character 2 and character 3 are 0.7 respectively, and the matching degree between candidate historical corpus text b and the first dialogue content is 30%, therefore, the probability prediction values ​​corresponding to character 1 and character 4 are 0.3 respectively, therefore, the probability prediction value corresponding to character 1 is (0.7+0.3) / 2=0.5, the probability prediction value corresponding to character 2 is 0.7, the predicted probability value corresponding to character 3 is 0.7, and the probability prediction value corresponding to character 4 is 0.3.

[0213] It is worth noting that the above-mentioned method of response prediction is only an illustrative example and is not limited to this embodiment of the present application.

[0214] Optionally, the second language model is obtained by at least one of the following methods:

[0215] 1. Based on the first language model, by determining updated knowledge after the updated corpus is updated relative to the knowledge in the historical expectation library, the model parameters of the first language model are adjusted using the updated knowledge, thereby using the first language model with the adjusted parameters as the second language model. For example, the gradient value of the first language model is adjusted according to the updated knowledge to obtain the first language model with the updated gradient value as the second language model;

[0216] 2. Using the corpus knowledge in the updated expectation library as training data, after obtaining an initialization model, use the training data to train the initialization model to obtain a second language model.

[0217] It is worth noting that the above-mentioned method for obtaining the second language model is only an illustrative example and is not limited to this embodiment of the present application.

[0218] Optionally, the model parameters include at least one of a gradient value or a parameter in a feed forward neural network layer (Feed Forward Network Layer).

[0219] In summary, the language model training method provided in the embodiment of the present application, when the knowledge of the corpus content in the corpus is updated, fine-tunes the parameters of the first language model based on the updated corpus content, thereby avoiding retraining the initialized language model, reducing the difficulty of model training, and improving the efficiency of model training.

[0220] Optionally, the above text prediction method can be applied to a variety of different scenarios, as follows:

[0221] (1) Language model training process: After obtaining a first sample conversation, the first language model obtained by pre-training predicts the reply content of the first sample conversation based on the historical corpus, and obtains a first probability distribution corresponding to multiple first characters in the historical corpus. The second language model obtained by pre-training according to the above training method predicts the reply content of the first sample conversation based on the updated corpus, and obtains a second probability distribution corresponding to multiple second characters in the updated corpus. According to the difference between the first probability distribution and the second probability distribution, the second probability distribution is probability adjusted. If the probability adjustment result does not meet the preset probability distribution condition, the model parameters of the second language model are fine-tuned according to the probability adjustment result until the difference between the second probability distribution output by the second language model and the first probability distribution finally meets the preset probability distribution condition, thereby obtaining an improved second language model.

[0222] (2) Medical Q&A scenario: Obtain pathology consultation content, use the pre-trained first language model to predict the reply content of the pathology consultation content based on the historical corpus, and obtain a first probability distribution corresponding to multiple first characters in the historical corpus. Use the second language model trained according to the above training method to predict the reply content of the pathology consultation content based on the updated corpus, and obtain a second probability distribution corresponding to multiple second characters in the updated corpus. According to the difference between the first probability distribution and the second probability distribution, the second probability distribution is probability-adjusted, and finally the pathology consultation result corresponding to the pathology consultation content is determined and output.

[0223] Below, the autonomous driving scenario is explained in detail.

[0224] For illustration, please refer to Figure 6 , which shows a schematic diagram of a text prediction method provided by an exemplary embodiment of the present application, such as Figure 6 As shown, this method is applied to an intelligent driving scenario as an example.

[0225] During the driving of the vehicle, voice content 610 is acquired, wherein the voice content 610 is voice content captured by a user riding in the vehicle through vocalization.

[0226] The central control server includes a speech conversion network 620 and a response prediction network 630. The speech conversion network 620 converts received speech content 610 into text to obtain first conversation content 611 corresponding to speech content 610. This first conversation content is then input into the response prediction network 630 for response prediction. In this embodiment, the first conversation content 611 is "How do I turn on the air conditioner?"

[0227] The reply prediction network 630 includes a first language model and a second language model. The first language model is used to predict the reply to the first conversation content 611 based on the historical corpus to obtain a first prediction result. The first prediction result includes a first probability distribution corresponding to multiple first characters in the historical corpus. The second language model is used to predict the reply to the first conversation content 611 based on the updated corpus to obtain a second prediction result. The second prediction result includes a second probability distribution corresponding to multiple second characters in the updated corpus. The second probability distribution is adjusted according to the probability distribution difference between the first probability distribution and the second probability distribution to determine the reply prediction result 640. Among them, the reply prediction result 640 is implemented as "Press the button in the lower right corner of the central control panel to turn on. The air conditioner is currently turned on automatically for you." And, the air conditioner turning on operation is automatically performed according to the reply prediction result 640.

[0228] For illustration, please refer to Table 2, which shows the performance of related technologies and the solution of the present application on different types of problems.

[0229] Table 2

[0230]

[0231] As can be seen from Table 2, the F1 / EM index of the present application scheme on non-reasoning problems is similar to the performance of the related technologies. On reasoning problems, it has far superior performance to the related technologies. In terms of the F1 index, it leads the related technologies by +5.59, +12.99 and +11.59 points on the three base models respectively. In terms of the EM index, the score of the present application scheme is basically two to three times that of the related technologies. In addition, in terms of the OE index, the present application scheme always generates the least outdated responses among the five methods.

[0232] For illustration, please refer to Figure 7 , which shows a model performance comparison diagram provided by an exemplary embodiment of the present application, such as Figure 7 As shown in FIG700 , the numerical distribution of Δ(t) of correct answers and the proportion of outdated responses (OE) are statistically analyzed on the reasoning questions of the public dataset. The positive or negative value of Δ(t) can reflect whether the probability change is correct. Figure 7As shown, the Δ(t) values ​​for the majority of answers (approximately 94.5%) are positive, indicating that Δ(t) can help the second language model obtain the correct answer to reasoning questions. Furthermore, larger Δ(t) values ​​correspond to smaller proportions of outdated responses, indicating that the present application solution can help the second language model obtain the correct answer to reasoning questions and alleviate the outdated response problem.

[0233] In summary, the text prediction method provided in the embodiments of the present application, upon obtaining the content of a first conversation, predicts the content of a reply to the first conversation using a first language model and a second language model, respectively. This method obtains a first probability distribution corresponding to multiple first characters in the historical corpus corresponding to the first language model and a second probability distribution corresponding to multiple second characters in the updated corpus corresponding to the second language model. The method then probabilistically adjusts the second probability distribution based on the difference in probability distribution between the first and second probability distributions to obtain a reply prediction result corresponding to the first conversation content. That is, by comparing the difference in probability distributions output by different language models, the probability distribution output by the current language model is adjusted, thereby reducing the probability that the output result contains reply content from the historical corpus and increasing the probability that the output result contains reply content from the updated corpus, thereby improving the accuracy of the text prediction result.

[0234] The solution provided in this application utilizes the difference in the probability distribution of responses generated by the old model and the language model after knowledge update for the same factual knowledge reasoning problem. By capturing and amplifying this difference, the probability of the edited model generating outdated responses to the old model is reduced, and the influence of the edited knowledge on the probability distribution of responses generated by the language model after knowledge update is increased, thereby improving the performance of the language model after knowledge update in reasoning problems of edited knowledge.

[0235] Figure 8 is a structural block diagram of a text prediction device provided by an exemplary embodiment of the present application. Figure 8 As shown, the device includes the following parts:

[0236] An acquisition module 810 is configured to acquire the first conversation content;

[0237] Prediction module 820, in which a user predicts a reply to the first conversation content using a first language model to obtain a first prediction result, wherein the first language model is a language model that predicts replies to the input conversation content using a historical corpus, and the first prediction result is used to indicate a first probability distribution corresponding to multiple first characters in the historical corpus;

[0238] The prediction module 820 is further configured to predict a reply content for the first conversation content using a second language model to obtain a second prediction result, wherein the second language model is a language model that predicts a reply to the input conversation content using an updated corpus, and the second prediction result is configured to indicate a second probability distribution corresponding to a plurality of second characters in the updated corpus;

[0239] The adjustment module 830 is used to perform probability adjustment on the second probability distribution based on the probability distribution difference between the first probability distribution and the second probability distribution, so as to obtain a response prediction result corresponding to the first dialogue content.

[0240] In some embodiments, the adjustment module 830 is used to obtain the probability distribution difference between the first probability distribution and the second probability distribution; perform probability adjustment on the second probability distribution based on the character decoding order and the probability distribution difference to obtain the reply prediction result, and the character decoding order corresponds to the arrangement order of multiple characters in the reply prediction result.

[0241] In some embodiments, the character decoding order corresponds to multiple decoding moments, the reply prediction result includes the output characters of the multiple decoding moments, the second prediction result includes an nth second probability distribution of the multiple second characters belonging to the output characters at the nth decoding moment, and the first prediction result includes an nth first probability distribution of the multiple first characters belonging to the output characters at the nth decoding moment, where n is a positive integer;

[0242] The adjustment module 830 is used to obtain a target distribution difference between the nth first probability distribution and the nth second probability distribution; at the nth decoding moment, perform probability adjustment on the nth second probability distribution based on the target distribution difference to obtain an nth character prediction result, wherein the nth character prediction result is used to indicate the probability value of the multiple second characters belonging to the output character at the nth decoding moment; and determine the output character at the nth decoding moment in the reply prediction result from the updated corpus based on the nth character prediction result.

[0243] In some embodiments, the adjustment module 830 is used to obtain the candidate distribution difference between the nth first probability distribution and the nth second probability distribution; for the first target character, when the first target character belongs to the historical corpus, the first probability difference of the first target character is determined based on the candidate probability difference of the first target character in the candidate distribution difference; for the second target character, when the second target character does not belong to the historical corpus, the candidate probability difference of the second target character in the candidate distribution difference is used as the second probability difference of the second target character; the target distribution difference is determined based on the first probability difference and the second probability difference.

[0244] In some embodiments, the updated corpus is a corpus obtained by updating key content knowledge on the basis of the historical corpus;

[0245] The adjustment module 830 is used to obtain the candidate distribution difference between the nth first probability distribution and the nth second probability distribution; for the first target character, when the first target character belongs to the key content before the knowledge update or the key content after the knowledge update, the first probability difference of the first target character is determined based on the candidate probability difference of the first target character in the candidate distribution difference; for the second target character, when the second target character does not belong to the key content, the candidate probability difference of the second target character in the candidate distribution difference is used as the second probability difference of the second target character; the target distribution difference is determined based on the first probability difference and the second probability difference.

[0246] In some embodiments, the adjustment module 830 is used to determine the output characters of the first n-1 decoding moments from the updated corpus based on the first n-1 character prediction results as the reply prediction result when the number of second characters whose probability values ​​in the n-th character prediction result are lower than the preset probability threshold reaches a preset number threshold.

[0247] In some embodiments, the target distribution difference includes probability differences corresponding to the plurality of second characters and the plurality of first characters respectively;

[0248] The adjustment module 830 is used to adjust the probability of the nth second probability distribution based on the target distribution difference when the number of second characters whose probability difference in the target distribution difference is greater than the preset difference threshold reaches a preset number condition, so as to obtain the nth character prediction result.

[0249] In some embodiments, the adjustment module 830 is used to obtain a first weight value; perform weighted fusion on the probability distribution difference and the first weight based on the character decoding order to obtain a fused distribution difference; and fuse the second probability distribution with the fused distribution difference to obtain the reply prediction result.

[0250] In some embodiments, the updated corpus is a character library obtained by updating the key content based on the historical corpus, and the key content is the keyword content in the edited reply content;

[0251] The prediction module 820 is configured to modify the content of the first dialogue based on the edited reply content to obtain a first adjusted dialogue; and predict the reply content of the first adjusted dialogue using the second language model to obtain a second prediction result.

[0252] In some embodiments, the prediction module 820 is used to splice the edited reply content with the first conversation content according to a preset splicing order to obtain the first adjusted conversation.

[0253] In some embodiments, the updated corpus is a corpus obtained by updating key content knowledge on the basis of the historical corpus;

[0254] The prediction module 820 is used to obtain, for the third target character, a first probability prediction value of the third target character in the first prediction result and a second probability prediction value of the third target character in the second prediction result when the third target character belongs to the key content before the knowledge update; and to set the second probability prediction value corresponding to the third target character to zero when the probability difference between the first probability prediction value and the second probability prediction value meets the probability reset condition, to obtain a zero-setting result corresponding to the third target character.

[0255] In summary, the text prediction device provided in the embodiments of the present application, upon obtaining the content of a first conversation, predicts the content of a reply to the first conversation using a first language model and a second language model, respectively. This results in a first probability distribution corresponding to multiple first characters in the historical corpus corresponding to the first language model and a second probability distribution corresponding to multiple second characters in the updated corpus corresponding to the second language model. The device then probabilistically adjusts the second probability distribution based on the difference in probability distribution between the first and second probability distributions to obtain a reply prediction result corresponding to the first conversation content. That is, by comparing the differences in probability distributions output by different language models, the probability distribution output by the current language model is adjusted, thereby reducing the probability that the output result contains reply content from the historical corpus and increasing the probability that the output result contains reply content from the updated corpus, thereby improving the accuracy of the text prediction result.

[0256] Figure 9 This is a structural block diagram of a language model training device provided by an exemplary embodiment of the present application. Figure 9 As shown, the device includes the following parts:

[0257] An acquisition module 910 is configured to acquire a historical corpus, wherein the historical corpus includes first corpus content obtained within a first time range;

[0258] The acquisition module 910 is further configured to acquire an updated corpus when the first corpus content is updated within a second time range, the updated corpus including the second corpus content after the knowledge update, the second time range being later than the first time range;

[0259] Adjustment module 920 is used to adjust the model parameters of the first language model based on the second corpus content to obtain a second language model, where the first language model is a language model that predicts responses to input conversation content based on the historical corpus, and the second language model is a language model that predicts responses to input conversation content based on the updated corpus.

[0260] In summary, the language model training device provided in the embodiment of the present application, when the knowledge of the corpus content in the corpus is updated, can fine-tune the parameters of the first language model based on the updated corpus content, thereby avoiding retraining the initialized language model, reducing the difficulty of model training, and improving the efficiency of model training.

[0261] It should be noted that the text prediction device provided in the above embodiment is merely illustrated by the division of the aforementioned functional modules. In actual applications, the aforementioned functions can be assigned to different functional modules as needed, i.e., the internal structure of the device can be divided into different functional modules to perform all or part of the functions described above. Furthermore, the text prediction device provided in the above embodiment and the text prediction method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be further described here.

[0262] Figure 10The following is a block diagram of a computer device 1000 according to an exemplary embodiment of the present application. Computer device 1000 may be a portable mobile terminal, such as a smartphone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, or desktop computer. Computer device 1000 may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other similar names.

[0263] Typically, the computer device 1000 includes a processor 1001 and a memory 1002 .

[0264] The processor 1001 may include one or more processing cores, such as a 4-core processor, a 10-core processor, etc. The processor 1001 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 1001 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1001 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1001 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0265] The memory 1002 may include one or more computer-readable storage media, which may be non-transitory. The memory 1002 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1002 is used to store at least one instruction, which is used to be executed by the processor 1001 to implement the training method and data classification method of the classification model provided in the method embodiment of the present application.

[0266] In some embodiments, the computer device 1000 may optionally include other components, which those skilled in the art will appreciate. Figure 10 The structure shown in the figure does not constitute a limitation on the computer device 1000, and the computer device 1000 may include more or fewer components than shown in the figure, or combine some components, or adopt a different component arrangement.

[0267] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program. The program can be stored in a computer-readable storage medium, which can be a computer-readable storage medium included in the memory in the above embodiments; or a separate computer-readable storage medium that is not installed in the terminal. The computer-readable storage medium stores at least one instruction, at least one program, code set, or instruction set. The at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the classification model training method and data classification method described in any of the above embodiments.

[0268] Optionally, the computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a solid-state drive (SSD), or an optical disk. Among them, the random access memory may include a resistance random access memory (ReRAM) and a dynamic random access memory (DRAM). The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0269] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.

[0270] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A text prediction method, characterized in that: The method comprises: Get the first conversation content; predicting a reply content for the first conversation content using a first language model to obtain a first prediction result, wherein the first language model is a language model that predicts replies to the input conversation content using a historical corpus, and the first prediction result is used to indicate a first probability distribution corresponding to multiple first characters in the historical corpus; Predicting a reply to the first conversation content using a second language model to obtain a second prediction result, where the second language model is a language model that predicts replies to the input conversation content using an updated corpus, and the second prediction result is used to indicate a second probability distribution corresponding to multiple second characters in the updated corpus; Based on the probability distribution difference between the first probability distribution and the second probability distribution, the second probability distribution is probability adjusted to obtain a response prediction result corresponding to the first conversation content.

2. The method according to claim 1, characterized in that The step of performing probability adjustment on the second probability distribution based on the probability distribution difference between the first probability distribution and the second probability distribution to obtain a response prediction result corresponding to the first conversation content includes: Obtaining the probability distribution difference between the first probability distribution and the second probability distribution; The second probability distribution is probability-adjusted based on the character decoding order and the difference in the probability distribution to obtain the reply prediction result, and the character decoding order corresponds to the arrangement order of multiple characters in the reply prediction result.

3. The method according to claim 2, characterized in that The character decoding order corresponds to a plurality of decoding moments, the reply prediction result includes the output characters of the plurality of decoding moments, the second prediction result includes an nth second probability distribution of the plurality of second characters belonging to the output characters at an nth decoding moment, and the first prediction result includes an nth first probability distribution of the plurality of first characters belonging to the output characters at the nth decoding moment, where n is a positive integer; The obtaining the probability distribution difference between the first probability distribution and the second probability distribution includes: Obtaining a target distribution difference between the nth first probability distribution and the nth second probability distribution; The performing probability adjustment on the second probability distribution based on the character decoding order and the probability distribution difference to obtain the reply prediction result includes: At an nth decoding moment, performing a probability adjustment on the nth second probability distribution based on the target distribution difference to obtain an nth character prediction result, where the nth character prediction result is used to indicate a probability value that the plurality of second characters belong to the output character at the nth decoding moment; An output character at the n-th decoding moment in the reply prediction result is determined from the updated corpus based on the n-th character prediction result.

4. The method according to claim 3, characterized in that The obtaining a target distribution difference between the nth first probability distribution and the nth second probability distribution includes: Obtaining a candidate distribution difference between the nth first probability distribution and the nth second probability distribution; For a first target character, if the first target character belongs to the historical corpus, determining a first probability difference value of the first target character based on the candidate probability difference value of the first target character in the candidate distribution difference; For a second target character, if the second target character does not belong to the historical corpus, using the candidate probability difference of the second target character in the candidate distribution difference as a second probability difference of the second target character; The target distribution difference is determined based on the first probability difference and the second probability difference.

5. The method according to claim 3, characterized in that The updated corpus is a corpus obtained by updating the key contents of the historical corpus; The obtaining a target distribution difference between the nth first probability distribution and the nth second probability distribution includes: Obtaining a candidate distribution difference between the nth first probability distribution and the nth second probability distribution; For a first target character, when the first target character belongs to key content before knowledge update or key content after knowledge update, determining a first probability difference value of the first target character based on the candidate probability difference value of the first target character in the candidate distribution difference; For a second target character, if the second target character does not belong to the key content, using the candidate probability difference of the second target character in the candidate distribution difference as the second probability difference of the second target character; The target distribution difference is determined based on the first probability difference and the second probability difference.

6. The method according to claim 3, characterized in that The method further comprises: When the number of second characters whose probability values ​​in the n-th character prediction result are lower than the preset probability threshold reaches the preset number threshold, the output characters of the first n-1 decoding moments are determined from the updated corpus based on the first n-1 character prediction results as the reply prediction result.

7. The method according to claim 3, characterized in that The target distribution difference includes probability differences corresponding to the plurality of second characters and the plurality of first characters respectively; The step of adjusting the probability of the n-th second probability distribution based on the target distribution difference to obtain the n-th character prediction result includes: When the number of second characters whose probability difference in the target distribution difference is greater than a preset difference threshold reaches a preset number condition, the nth second probability distribution is probability adjusted based on the target distribution difference to obtain the nth character prediction result.

8. The method according to claim 2, characterized in that The performing probability adjustment on the second probability distribution based on the character decoding order and the probability distribution difference to obtain the reply prediction result includes: Get a first weight value; Performing weighted fusion on the probability distribution difference and the first weight based on the character decoding order to obtain a fused distribution difference; The second probability distribution and the fusion distribution difference are fused to obtain the reply prediction result.

9. The method according to any one of claims 1 to 8, characterized in that: The updated corpus is a character library obtained by updating the key content on the basis of the historical corpus, wherein the key content is the keyword content in the editor's reply content; Before predicting the response content of the first conversation content using the second language model to obtain the second prediction result, the method includes: Modifying the first dialogue content based on the edited reply content to obtain a first adjusted dialogue; The predicting the response content of the first conversation content by using the second language model to obtain a second prediction result includes: The second language model is used to predict the reply content of the first adjusted dialogue to obtain the second prediction result.

10. The method according to claim 9, characterized in that The modifying the first dialogue content based on the edited reply content to obtain a first adjusted dialogue includes: The edited reply content and the first dialogue content are spliced ​​together according to a preset splicing order to obtain the first adjusted dialogue.

11. The method according to any one of claims 1 to 8, characterized in that: The updated corpus is a corpus obtained by updating the key contents of the historical corpus; The method further comprises: For a third target character, if the third target character belongs to key content before the knowledge update, obtaining a first probability prediction value of the third target character in the first prediction result and a second probability prediction value of the third target character in the second prediction result; When the probability difference between the first probability prediction value and the second probability prediction value meets the probability reset condition, the second probability prediction value corresponding to the third target character is set to zero to obtain a zero-setting result corresponding to the third target character.

12. A method for training a language model, characterized in that: The method comprises: Acquire a historical corpus, wherein the historical corpus includes first corpus content obtained within a first time range; When the first corpus content is updated within a second time range, obtaining an updated corpus, the updated corpus including the second corpus content after the knowledge update, the second time range being later than the first time range; The model parameters of the first language model are adjusted according to the second corpus content to obtain a second language model, wherein the first language model is a language model that predicts responses to input conversation content according to the historical corpus, and the second language model is a language model that predicts responses to input conversation content according to the updated corpus.

13. A text prediction device, characterized in that: The device comprises: An acquisition module, configured to acquire the first conversation content; a prediction module, wherein a user predicts a reply content for the first conversation content using a first language model to obtain a first prediction result, wherein the first language model is a language model that predicts replies to the input conversation content using a historical corpus, and the first prediction result is used to indicate a first probability distribution corresponding to multiple first characters in the historical corpus; The prediction module is further configured to predict a reply content for the first conversation content using a second language model to obtain a second prediction result, wherein the second language model is a language model that predicts a reply to the input conversation content using an updated corpus, and the second prediction result is configured to indicate a second probability distribution corresponding to a plurality of second characters in the updated corpus; An adjustment module is used to perform probability adjustment on the second probability distribution based on the probability distribution difference between the first probability distribution and the second probability distribution to obtain a response prediction result corresponding to the first dialogue content.

14. A language model training device, characterized in that: The device comprises: An acquisition module, configured to acquire a historical corpus, wherein the historical corpus includes first corpus content obtained within a first time range; The acquisition module is further configured to acquire an updated corpus when the first corpus content is updated within a second time range, the updated corpus including the second corpus content after the knowledge update, the second time range being later than the first time range; An adjustment module is configured to adjust model parameters of a first language model using the second corpus content to obtain a second language model, wherein the first language model is a language model that predicts responses to input conversation content using the historical corpus, and the second language model is a language model that predicts responses to input conversation content using the updated corpus.

15. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the text prediction method according to any one of claims 1 to 11 or the language model training method according to claim 12.

16. A computer-readable storage medium, characterized in that The storage medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the text prediction method according to any one of claims 1 to 11 or the language model training method according to claim 12.

17. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the text prediction method according to any one of claims 1 to 11 or the language model training method according to claim 12.