A language model training method, device and computer program product
By analyzing satisfaction and confidence in the dialogue between the language model and the user, generating query text to obtain feedback, and constructing training samples for iterative training, the problem of difficulty in obtaining user feedback in the existing technology is solved, and the naturalness and accuracy of the language model are improved. Accuracy.
Patent Information
- Application Number
- CN202311859562.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-30
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2043-12-30
AI Technical Summary
It is difficult to efficiently and accurately obtain user feedback on language model response satisfaction with existing technology, resulting in poor language model training results and poor user experience.
During the dialogue between the language model and the user, the user's satisfaction and confidence in the model's response are analyzed, query text is generated to obtain feedback, and model training samples are constructed based on the feedback results for iterative training, thereby reducing the complexity of user feedback operations.
It improves the naturalness and accuracy of the language model in user conversations, enhances the user experience, and improves the accuracy of model training so that its output is more in line with user needs.
Smart Images

Figure CN118036587B
Abstract
Description
Technical Field
[0001] Some embodiments of the present specification relate to the field of computer technology, and specifically to a language model training method, apparatus, computer program product and other related equipment. Background Art
[0002] A large language model is an artificial intelligence model that aims to understand and generate human language. It generally collects user feedback on whether they are satisfied with the response and iteratively trains the model in the hope that the model can output more accurate responses that meet user needs. To this end, some embodiments of this specification provide a language model training method that aims to obtain user feedback information more efficiently and accurately, and perform model training based on this. Summary of the invention
[0003] One or more embodiments of the present specification provide a language model training method and related equipment. The related equipment may include a language model training device, an electronic device, a computer-readable storage medium, and a computer program product. The method can obtain model training text by reducing the complexity of user feedback operations, and automatically iterate the training of a preset language model, so that the preset language model can output text that is more accurate and meets user needs.
[0004] The embodiment of the present specification provides a language model training method, including: obtaining a target text corresponding to one or more rounds of dialogue between a preset language model and a user, the target text including user input text and model reply text; analyzing the target text through a preset language model to obtain user feedback results for the one or more rounds of dialogue; obtaining model reply correction text for the user input text in the target text based on the user feedback results; constructing a model training sample based on the target text, the user feedback results, and the model reply correction text; and iteratively training the preset language model based on the model training sample.
[0005] According to the language model training method provided in some embodiments of the present specification, the target text corresponding to one or more rounds of dialogue between a preset language model and a user is obtained, including through the preset language model: based on the user input text that has been obtained, analyzing whether the user is dissatisfied with the model reply text that has been output or obtaining the confidence level corresponding to the model reply text that has been output; if dissatisfied or the confidence level is less than a threshold, generating a model inquiry text; the target text includes the user input text that has been obtained, the model reply text that has been output, the model inquiry text, and the user input text of the user for the model inquiry text.
[0006] According to the language model training method provided in some embodiments of the present specification, the model inquiry text includes sentences for inquiring about satisfaction and / or sentences for inquiring about improvement suggestions.
[0007] According to the language model training method provided in some embodiments of the present specification, calling a preset language model to analyze the target text to obtain user feedback results for the one or more rounds of conversations includes: obtaining one or more preset feedback inquiry texts; the one or more preset feedback inquiry texts have different question granularities; inputting one or more preset feedback inquiry texts into the preset language model to obtain the user feedback results output by the preset language model.
[0008] According to the language model training method provided in some embodiments of the present specification, the method of obtaining a model reply correction text for the user input text in the target text based on the user feedback result includes: obtaining a preset correction inquiry text; inputting the correction inquiry text into the preset language model to obtain a model reply correction text output by the preset language model.
[0009] According to the language model training method provided in some embodiments of the present specification, before obtaining the target text corresponding to one or more rounds of dialogue between a preset language model and a user, it also includes: obtaining a dialogue training text and a guide training text; the dialogue training text includes question sentences related to a preset topic, and the guide training text includes a sentence for instructing the model to inquire about satisfaction and / or a sentence for instructing the model to inquire about improvement suggestions; inputting the dialogue training text into the preset language model to obtain a training reply text output by the preset language model; inputting the guide training text into the preset language model so that the preset language model can output a sentence for inquiring about satisfaction and / or a sentence for inquiring about improvement suggestions when conversing with a user.
[0010] According to the language model training method provided in some embodiments of the present specification, the guided training text includes a sentence for instructing the model to inquire about satisfaction when it is determined based on the dialogue training text that the other party is dissatisfied or the confidence of the training reply text is less than a set threshold, and / or a sentence for instructing the model to inquire about improvement suggestions when it is determined based on the dialogue training text that the other party is dissatisfied or the confidence of the training reply text is less than a set threshold.
[0011] According to the language model training method provided in some embodiments of the present specification, after inputting the guide training text into the preset language model, it also includes: determining a target training reply text from two or more candidate training reply texts output by the preset language model and inputting the target training reply text into the preset language model.
[0012] One or more embodiments of the present specification also provide a language model training device, including: a target text acquisition unit, used to acquire a target text corresponding to one or more rounds of dialogue between a preset language model and a user, the target text including a user input text and a model reply text; an analysis unit, used to analyze the target text through a preset language model to obtain a user feedback result for the one or more rounds of dialogue; a correction text acquisition unit, used to acquire a model reply correction text for the user input text in the target text based on the user feedback result; a construction unit, used to construct a model training sample based on the target text, the user feedback result, and the model reply correction text; and a training unit, used to iteratively train the preset language model based on the model training sample.
[0013] According to the language model training device provided in some embodiments of the present specification, the target text acquisition unit can be specifically used to analyze whether the user is dissatisfied with the model reply text that has been output based on the user input text that has been acquired, or to obtain the confidence level corresponding to the model reply text that has been output; if dissatisfied or the confidence level is less than a threshold, a model inquiry text is generated; the target text includes the user input text that has been acquired, the model reply text that has been output, the model inquiry text, and the user input text of the user for the model inquiry text.
[0014] According to the language model training device provided in some embodiments of the present specification, the model inquiry text includes sentences for inquiring about satisfaction and / or sentences for inquiring about improvement suggestions.
[0015] According to the language model training device provided in some embodiments of the present specification, the analysis unit can be specifically used to obtain one or more preset feedback inquiry texts; the one or more preset feedback inquiry texts have different question granularities; one or more preset feedback inquiry texts are input into the preset language model to obtain the user feedback result output by the preset language model.
[0016] According to the language model training device provided in some embodiments of the present specification, the revised text acquisition unit can be specifically used to obtain a preset revised inquiry text; input the revised inquiry text into the preset language model to obtain a model reply revised text output by the preset language model.
[0017] According to some embodiments of the present specification, the language model training device provided may also include a training text acquisition unit, a first output unit, and a second output unit, wherein the training text acquisition unit is used to acquire a dialogue training text and a guide training text; the dialogue training text includes question sentences related to a preset topic, and the guide training text includes a sentence for indicating that the model inquires about satisfaction and / or a sentence for indicating that the model inquires about improvement suggestions; the first output unit is used to input the dialogue training text into the preset language model to obtain a training reply text output by the preset language model; the second output unit is used to input the guide training text into the preset language model, so that the preset language model can output a sentence for inquiring about satisfaction and / or a sentence for inquiring about improvement suggestions when conversing with a user.
[0018] According to the language model training device provided by some embodiments of the present specification, the guided training text includes a sentence for instructing the model to inquire about satisfaction when it is determined based on the dialogue training text that the other party is dissatisfied or the confidence of the training reply text is less than a set threshold, and / or a sentence for instructing the model to inquire about improvement suggestions when it is determined based on the dialogue training text that the other party is dissatisfied or the confidence of the training reply text is less than a set threshold.
[0019] The language model training device provided according to some embodiments of the present specification may also include a determination unit, which is used to determine a target training reply text from two or more candidate training reply texts output by the preset language model and input it into the preset language model.
[0020] One or more embodiments of the present specification also provide an electronic device, including a processor and a memory, wherein the memory stores a plurality of instructions, and the processor loads the instructions to execute the steps in the language model training method provided in the embodiments of the present specification.
[0021] One or more embodiments of the present specification also provide a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps in the language model training method provided in the embodiments of the present specification are implemented.
[0022] In addition, one or more embodiments of the present specification also provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the steps in the language model training method provided in the embodiments of the present specification.
[0023] A language model training method and related equipment provided in the embodiments of this specification can obtain a target text corresponding to one or more rounds of dialogue between a preset language model and a user, the target text including a user input text and a model reply text; analyze the target text through a preset language model to obtain a user feedback result for one or more rounds of dialogue; obtain a model reply correction text for the user input text in the target text based on the user feedback result; construct a model training sample based on the target text, the user feedback result, and the model reply correction text; and iteratively train the preset language model based on the model training sample. Some embodiments of this specification can iteratively train the preset language model by collecting user feedback results and model reply correction text during the dialogue between the preset language model and the user, in the expectation that the preset language model can generate a more natural and reasonable model reply text during the dialogue with the user, thereby collecting content related to user feedback while reducing the complexity of the user feedback operation, and finally enabling the preset language model to output a more accurate text that meets the user's needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to illustrate the technical solution more clearly, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present technical solution. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 It is a scenario diagram of the language model training method provided in some embodiments of this specification.
[0026] Figure 2 It is a flowchart of the language model training method provided in some embodiments of this specification.
[0027] Figure 3 It is a flowchart for fine-tuning a preset language model provided in some embodiments of this specification.
[0028] Figure 4 It is a schematic block diagram of a language model training device provided in some embodiments of this specification.
[0029] Figure 5 It is a schematic diagram of the structure of an electronic device provided in some embodiments of this specification. DETAILED DESCRIPTION
[0030] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0031] Among them, natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies.
[0032] The big language model is an artificial intelligence model designed to understand and generate human language. It generally collects feedback from users on whether they are satisfied with the replies and iteratively trains the model in the hope that the model can output more accurate replies that meet user needs. Therefore, how to efficiently and accurately obtain feedback from users on whether they are satisfied with the replies affects the effect of model training to a certain extent.
[0033] In some embodiments, after the conversation between the model and the user ends, the user can be asked to collect user feedback by clicking likes / dislikes, or selecting one from multiple replies, etc., where a like indicates that the user is satisfied with the reply, and a dislike indicates that the user is dissatisfied with the reply. After collecting the feedback, the model is iteratively trained, and replies with likes are regarded as good ones, and replies with dislikes are regarded as bad ones, so as to suppress bad replies.
[0034] However, this method of collecting user feedback through likes / dislikes will result in a poor user experience and noise; the method of selecting one from multiple replies also has a poor user experience and is not natural. In addition, the existing technology cannot clearly know which details in which reply the user is dissatisfied with, nor can it know what the user thinks is the correct answer. The language model trained in this way cannot output more accurate text that meets user needs.
[0035] To this end, some embodiments of this specification provide a language model training method and related equipment, by collecting user feedback results and model reply correction text during the dialogue between the preset language model and the user, and iteratively training the preset language model, in the expectation that the preset language model can generate a more natural and reasonable model reply text during the dialogue with the user. Among them, the related equipment may include a language model training device, an electronic device, a computer-readable storage medium, and a computer program product. The language model training device can be specifically integrated in an electronic device, which can be a terminal or a server. The language model training method provided in some embodiments of this specification can be executed on a terminal, or on a server, or jointly by a terminal and a server. The above examples should not be construed as limitations on the embodiments of this specification.
[0036] The following will clearly and completely describe some embodiments of this specification in conjunction with the accompanying drawings. It should be understood that the described embodiments are only part of the embodiments of the technical solution, rather than all the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative work are within the scope of this specification.
[0037] like Figure 1 As shown, a terminal and a server jointly execute a language model training method as an example. The language model training system provided in the embodiment of this specification includes a terminal 10 and a server 11, etc. The terminal 10 and the server 11 are connected via a network, such as a wired or wireless network connection, etc., wherein the language model training device can be integrated in the server.
[0038] Among them, the server 11 can be used to: receive the target text sent by the terminal 10, and analyze the target text through the preset language model to obtain the user feedback results for one or more rounds of dialogue; based on the user feedback results, obtain the model reply correction text for the user input text in the target text; based on the target text, user feedback results, and model reply correction text, construct a model training sample; iteratively train the preset language model based on the model training sample. Among them, the server 11 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or 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, and big data and artificial intelligence platforms. The language model training method or device disclosed in this specification, wherein multiple servers can be composed of a blockchain, and the server is a node on the blockchain.
[0039] The terminal 10 can be used to collect target texts corresponding to one or more rounds of dialogues between a preset language model and a user, and send the collected target texts to a server so that the server can analyze the target texts. The terminal 10 can include a mobile phone, an intelligent voice interaction device, an intelligent home appliance, a vehicle terminal, an aircraft, a tablet computer, a laptop computer, or a personal computer (PC). A client can also be set on the terminal 10, and the client can be an application client or a browser client, etc.
[0040] The following are detailed descriptions. It should be noted that the description order of the following embodiments does not limit the preferred order of the embodiments. This embodiment will be described from the perspective of a language model training device, which can be integrated in an electronic device, such as a server or a terminal. Figure 2 As shown, the specific process of the language model training method may include the following steps.
[0041] S201, obtaining target text corresponding to one or more rounds of dialogue between a preset language model and a user.
[0042] Among them, the preset language model is a natural language processing tool driven by artificial intelligence technology. The preset language model can generate model reply text based on the patterns and statistical laws seen in the pre-training stage, and can also interact with users according to the context of the conversation.
[0043] The target text includes user input text and model reply text. The user input text refers to the text input by the user in the preset language model, and the model reply text refers to the reply text that the preset language model replies based on the user input text input by the user.
[0044] In some embodiments, a target text consisting of a dialogue between a preset language model and a user may be obtained, and the target text may include one round of dialogue or multiple rounds of dialogue. In some embodiments, one round of dialogue may include a sentence output by one dialogue participant (such as a question raised) and a sentence output by another dialogue participant (such as a reply to the aforementioned question), that is, one round of dialogue may be a pair of question-answering texts or question-answering sentences, and correspondingly, multiple rounds of dialogue may include multiple pairs of question-answering texts or multiple pairs of question-answering sentences. For example, the target text may include one round of dialogue, which is specifically: user input text "What is machine learning?", model reply text "Machine learning specializes in how computers simulate or implement human learning behavior to acquire new knowledge or skills, and reorganize existing knowledge structures to continuously improve their performance.", or the target text may include two or more rounds of dialogue, which may be: user input text "What is machine learning?", model reply text "Machine learning specializes in how computers simulate or implement human learning behavior to acquire new knowledge or skills, and reorganize existing knowledge structures to continuously improve their performance.", user input text "Can you introduce it in more detail?", model reply text "Machine learning is a multi-disciplinary interdisciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithmic complexity theory and other disciplines. It specializes in how computers simulate or implement human learning behavior to acquire new knowledge or skills, and reorganize existing knowledge structures to continuously improve their performance.".
[0045] Optionally, in some embodiments, the step of "obtaining target text corresponding to one or more rounds of conversations between a preset language model and a user" may include: analyzing, through a preset language model, based on the acquired user input text, whether the user is dissatisfied with the output model reply text or obtaining the confidence level corresponding to the output model reply text; if dissatisfied or the confidence level is less than a threshold, generating a model inquiry text.
[0046] Among them, the model inquiry text is an inquiry sentence put forward to the user when the preset language model analysis finds that the user is not satisfied with the model response text that has been output, or the preset language model itself is not satisfied with the model response text that has been output, in the expectation of obtaining feedback from the user. Through such model inquiry text, the preset language model can obtain the user's feedback information in a timely manner during the dialogue with the user, thereby improving the timeliness of obtaining user feedback information. On the other hand, the user can describe the feedback information in the form of natural language dialogue, without the need to perform additional operations outside the dialogue process to provide feedback information, which improves the user experience while also helping to obtain more detailed and specific user feedback information.
[0047] In some embodiments, the target text may include the user input text that has been acquired, the model reply text that has been output, the model query text, and the user input text of the user in response to the model query text, for example, the user input text "What is machine learning?", the model reply text "Machine learning is a multi-field cross-disciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance.", the model query text "Is this reply too complicated?", and the user input text of the user in response to the model query text "Yes, this reply is too complicated.".
[0048] In some embodiments, a preset language model can be used to analyze whether the user is dissatisfied with the output model reply text based on the acquired user input text. If the preset language model analyzes that the user is dissatisfied with the output model reply text, a model inquiry text is generated. For example, the user input text "What is this reply?" has been acquired, and the preset language model analyzes that the user is dissatisfied with the output model reply text based on the above user input text, and then generates a model inquiry text "What is the best answer to the current question?" in the hope of obtaining user feedback.
[0049] The confidence corresponding to the model reply text is used to characterize the satisfaction of the preset language model itself with the model reply text that has been output. In some embodiments, the confidence corresponding to the model reply text that has been output can also be obtained through the preset language model. For example, while the preset language model outputs a sentence of model reply text, it will also automatically calculate the confidence corresponding to the model reply text. As an embodiment, the confidence can be a score, such as a numerical value in the range of 0 to 1, to characterize whether the preset language model itself is confident in the model reply text. In some embodiments, the greater the confidence, the more confident the preset model is in the model reply text it generates. Correspondingly, if the preset language model determines that the confidence corresponding to a certain sentence of model reply text is less than a preset threshold, it means that the preset language model itself is not satisfied or confident enough with the model reply text that has been output, then the preset language model can further generate a model query text. For example, the model response text that has been output is "xxx is really beautiful.", and the confidence corresponding to the model response text is less than the preset threshold, which means that the preset language model itself is not satisfied with or confident enough about the model response text that has been output. In this case, a model inquiry text "Is there anything unreasonable in my answer just now?" can be generated in the hope of obtaining user feedback.
[0050] The above-mentioned embodiment is based on the inherent ability of the preset language model to automatically determine whether the user is satisfied with the model response text that has been output, or whether the user has confidence in the model response text of the preset language model itself, so that the preset language model can output the model inquiry text in a timely manner during the conversation with the user to obtain the user's feedback information.
[0051] Optionally, in some embodiments, the model inquiry text includes a sentence for inquiring about satisfaction and / or a sentence for inquiring about improvement suggestions.
[0052] In some embodiments, the model inquiry text may also include statements for inquiring satisfaction, such as "Did my answer just now offend you?"; in addition, the model inquiry text may also include statements for asking for improvement suggestions, such as "How can I answer better?", etc.
[0053] By introducing the method of model inquiry text, when the user is not satisfied with the output model response text, or the preset language model is not confident in its own model response text, we can further integrate the model inquiry text related to asking for user feedback into the process of dialogue with the user, actively discuss with the user, and thus collect direct feedback from the user in a more natural and reasonable way.
[0054] In some embodiments, the preset language model can be fine-tuned or annotated so that it can output model query text in a timely manner during the conversation with the user. In some embodiments, the preset language model that is fine-tuned or annotated may have the ability to automatically determine whether the user is satisfied with the model response text that has been output, or whether the user is confident in the model response text of the preset language model itself. This ability can be obtained during the pre-training stage of the preset language model. For more information on fine-tuning or annotating the preset language model, please refer to Figure 3 The relevant description will not be repeated here.
[0055] S202, analyzing the target text through a preset language model to obtain user feedback results for one or more rounds of dialogue.
[0056] In some embodiments, the target text can be analyzed by a preset language model, so as to collect user feedback results for one or more rounds of dialogue during the dialogue with the user. The user feedback results can be used to represent the user's satisfaction with one or more rounds of dialogue.
[0057] Optionally, in some embodiments, the step of "calling a preset language model to analyze the target text and obtaining user feedback results for one or more rounds of conversations" may include: obtaining one or more preset feedback inquiry texts; one or more preset feedback inquiry texts have different question granularities; inputting one or more preset feedback inquiry texts into the preset language model to obtain user feedback results output by the preset language model.
[0058] In some embodiments, one or more feedback inquiry texts may be pre-set, wherein the pre-set feedback inquiry texts have different question granularities. For example, a relatively coarse-grained feedback inquiry text such as "Did my answer just now offend you?", "Is there anything unreasonable in my answer just now?", etc. may be pre-set; a relatively fine-grained feedback inquiry text may also be pre-set to further ask in more detail when the user is not satisfied with the reply text such as "Why do you think the third item is not good?", "How to answer it better?", "What is the best answer to the current question?", etc.
[0059] After obtaining the preset feedback inquiry text, the feedback inquiry text can be input into the preset language model so that the preset language model can learn the inquiry method of the feedback inquiry text and guide the preset language model to obtain user feedback results through natural language interaction.
[0060] In some embodiments, there are multiple ways to pre-set one or more feedback inquiry texts and use the feedback inquiry texts to train a preset language model. This can be achieved by manual setting by annotators or automatically by a computer program. As an example, multiple feedback inquiry texts can be pre-set and recorded in a question library, and a call statement can be written into a script file in advance. When the script file is run, one or more feedback inquiry texts can be automatically selected from the question library and input into the preset language model. The embodiments of this specification do not limit the way of setting feedback inquiry texts and calling a preset language model to obtain user feedback results.
[0061] Some embodiments of this specification directly call the preset language model to analyze the target text corresponding to the dialogue between the preset language model and the user to obtain the user feedback result, which can further enhance the preset language model's ability to understand the user feedback text. When the target text contains the user's reply to the model's query sentence, it can further effectively improve the language model's induction and summary effect on the user feedback result, and obtain more accurate user feedback results.
[0062] S203, based on the user feedback result, obtaining a model reply correction text for the user input text in the target text.
[0063] In some embodiments, after the preset language model obtains the user feedback results, it can be known how satisfied the user is with the model reply text in the target text, that is, it can be known which model reply text or texts the user is satisfied with and which model reply text or texts the user is dissatisfied with. The preset language model can analyze and integrate the model reply texts that the user is satisfied with based on the user feedback results, so as to generate a more appropriate model reply text for the user input text in the target text. The model reply text after such analysis and integration is the model reply correction text. By inputting the model reply correction text into the preset language model, the preset language model can learn a more appropriate reply method, so as to enhance the interactive function of the preset language model.
[0064] In some embodiments, there may be multiple ways to obtain model reply correction text based on user feedback results. For example, the annotator may summarize the model reply correction text based on the model reply text in the target text according to the user feedback results. The corresponding language model may also be called to analyze and integrate the model reply text based on the user feedback results to obtain the model reply correction text, and so on.
[0065] In some embodiments, the step of "obtaining model reply correction text for user input text in the target text based on user feedback results" may include: obtaining a preset corrected inquiry text; inputting the corrected inquiry text into a preset language model to obtain a model reply correction text output by the preset language model.
[0066] For example, a correction query text may be set in advance, and the correction query text may be input into a preset language model to obtain a model response correction text output by the preset language model, thereby utilizing the set correction query text to guide the preset language model to summarize a more optimized model response correction text.
[0067] In some embodiments, there are many ways to pre-set the revised inquiry text and use the revised inquiry text to train the preset language model. It can be achieved by manual setting by the annotation personnel, or it can be automatically achieved by a computer program. As an example, similar to the feedback inquiry text, multiple revised inquiry texts can be pre-set and recorded in a question library (such as another question library), and the call statement can be written into a script file (which can be another script file) in advance. When the script file is run, one or more revised inquiry texts can be automatically selected from the question library and input into the preset language model. The embodiments of this specification do not limit the method of setting the revised inquiry text and obtaining the model reply revised text.
[0068] S204, constructing a model training sample based on the target text, the user feedback result, and the model reply correction text.
[0069] In some embodiments, a model training sample can be constructed based on the target text, user feedback results, and model reply correction text to train a preset language model.
[0070] S205, iteratively training a preset language model based on the model training samples.
[0071] In some embodiments, the model parameters in the preset language model can be adjusted by using the model training samples in a supervised learning manner to achieve the required performance. As an example, after obtaining the target text corresponding to one or more rounds of dialogue and obtaining the model training samples based on the target text, the target text and the user feedback results can be input into the preset language model as input data, so that the preset language model outputs an optimized model reply text based on the target text and the user feedback results, and the model reply correction text is used as a supervisory signal. The model parameters of the preset language model are adjusted so that the difference between the optimized model reply text output by the preset language model and the model reply correction text as the supervisory signal is reduced, and the trained preset language model is obtained.
[0072] In other embodiments, through reinforcement learning, in the process of continuous interaction between the model and the user, the model reply text of the preset language model in the dialogue process can be given reward or punishment feedback, so that the feedback can be quantified, and the model parameters of the preset language model are continuously adjusted based on the feedback, so as to maximize the benefits of the overall dialogue effect. As an example, the model reply correction text can be the correction result of one or some model reply texts in the target text, so one or more model reply texts corresponding to the target text can be replaced with the model reply correction text to obtain the dialogue text of the positive sample, and the target text with unsatisfactory user feedback result is used as the dialogue text of the negative sample, and the reward model is obtained based on the positive sample or negative sample training. The target text obtained by the preset language model in the user dialogue process is input into the reward model to obtain the reward score, and the model parameters of the preset language model are adjusted to maximize the reward score to obtain the trained preset language model.
[0073] In some embodiments of the present specification, the target text corresponding to the preset language model and the user dialogue can be continuously obtained, and thus an iterative training process will be continuously performed, so that the preset language model can be optimized during the dialogue, and a more intelligent preset language model can be obtained, making the dialogue with the user more natural, and at the same time outputting more accurate replies to the user's questions, thereby improving user satisfaction.
[0074] In some embodiments, the user behavior can also be analyzed during the dialogue between the preset language model and the user to determine whether the user is satisfied with the current reply. For example, the interval time between adjacent user input texts, other mouse behavior tracks or touch up and down sliding tracks on the terminal or web page, the user repeatedly asking the same question, and the user questioning the model reply text can be collected. User behavior data such as the feedback result of whether the user is satisfied with the current reply can be obtained by analyzing these user behavior data. For example, it can be defined that the interval time between adjacent user input texts is long, the user repeatedly asks the same question, or the user questions the model reply text, etc., indicating that the user is not satisfied with the current model reply text. Further, the judgment result of whether the user is satisfied based on the user behavior can be used in combination with the aforementioned user feedback result. For example, the judgment result and the user feedback result are weighted based on the preset weight, and the calculation result is used to replace the user feedback result input to the preset language model in the aforementioned supervised learning process. For another example, the calculation result can be used as a supervisory signal or label for training a reward model in reinforcement learning.
[0075] As can be seen from the above, this embodiment can obtain the target text corresponding to one or more rounds of dialogue between the preset language model and the user, the target text includes the user input text and the model reply text; analyze the target text through the preset language model to obtain the user feedback results for one or more rounds of dialogue; based on the user feedback results, obtain the model reply correction text for the user input text in the target text; construct a model training sample based on the target text, the user feedback results, and the model reply correction text; iteratively train the preset language model based on the model training samples. Some embodiments of this specification can iteratively train the preset language model by collecting user feedback results and model reply correction text during the dialogue process between the preset language model and the user, in the expectation that the preset language model can generate a more natural and reasonable model reply text during the dialogue process with the user, thereby collecting more content related to user feedback while reducing the complexity of user operations, and ultimately enabling the preset language model to output more accurate and user-friendly text.
[0076] Optionally, in some embodiments, before the step of “obtaining the target text corresponding to one or more rounds of dialogue between the preset language model and the user”, a process of fine-tuning or annotating the preset language model may also be included. Figure 3 As shown, the specific flow of the process may include the following steps.
[0077] S301, obtaining dialogue training text and guidance training text.
[0078] S302, inputting a dialogue training text into a preset language model to obtain a training reply text output by the preset language model.
[0079] S303: inputting a guiding training text into a preset language model, so that the preset language model can output a sentence for inquiring about satisfaction and / or a sentence for inquiring about improvement suggestions when talking with the user.
[0080] The dialogue training text includes question sentences related to the preset topic, which is intended to imitate user dialogue so as to interact with the user according to the context of the dialogue. The guidance training text includes sentences for instructing the model to inquire about satisfaction and / or sentences for instructing the model to inquire about improvement suggestions.
[0081] For example, before obtaining the target text corresponding to one or more rounds of dialogue between the preset language model and the user, the step of fine-tuning or annotating the preset language model should also be included. The dialogue training text and the guide training text can be first obtained, and the dialogue training text is input into the preset language model to obtain the training reply text output by the preset language model, so that the preset language model has the ability to imitate human dialogue. The guide training text is input into the preset language model so that the preset language model can output sentences for asking satisfaction and / or sentences for asking for improvement suggestions when talking with the user, so that the result of whether the user is satisfied or not can be obtained smoothly, and the model can learn more appropriate reply language.
[0082] Optionally, in some embodiments, the guided training text includes a statement for instructing the model to inquire about satisfaction when it is determined based on the dialogue training text that the other party is dissatisfied or the confidence of the training reply text is less than a set threshold, and / or a statement for instructing the model to inquire about improvement suggestions when it is determined based on the dialogue training text that the other party is dissatisfied or the confidence of the training reply text is less than a set threshold.
[0083] Specifically, the guiding training text can be a sentence instructing the model to inquire about satisfaction when it is determined based on the dialogue training text that the other party is dissatisfied or the confidence of the training reply text is less than a set threshold, and / or a sentence instructing the model to inquire about improvement suggestions when it is determined based on the dialogue training text that the other party is dissatisfied or the confidence of the training reply text is less than a set threshold. This enables the model to more clearly understand the user's satisfaction level and provide a more reasonable response method by inquiring about satisfaction or improvement suggestions when it knows that the user is not satisfied with the model reply text, or the model itself is not satisfied with the model reply text.
[0084] Optionally, in some embodiments, after the step of “inputting the guide training text into the preset language model”, it may also include: determining the target training reply text from two or more candidate training reply texts output by the preset language model and inputting it into the preset language model.
[0085] For example, during the model training process, the preset language model can output multiple candidate training reply texts based on the guide training text. A more reasonable target training reply text can be determined from the multiple candidate training reply texts, and the target training reply text can be input into the preset language model for learning. This will enable the preset language model to learn a more accurate reply method, thereby improving the function of the preset language model.
[0086] In some embodiments, there are many ways to determine a more reasonable target training reply text from multiple candidate training reply texts. For example, the target training reply text can be determined from multiple candidate training reply texts through a trained network model; for another example, the target training reply text can be determined from multiple candidate training reply texts through annotation personnel, and so on. The embodiments of this specification do not make a restrictive description of this.
[0087] Some embodiments of this specification also provide a language model training device, such as Figure 4 As shown, the language model training device may include a target text acquisition unit 401, an analysis unit 402, a revised text acquisition unit 403, a construction unit 404, and a training unit 405.
[0088] The target text acquisition unit 401 is used to acquire target text corresponding to one or more rounds of dialogue between a preset language model and a user, wherein the target text includes user input text and model reply text.
[0089] The analyzing unit 402 is used to analyze the target text through a preset language model to obtain user feedback results for the one or more rounds of dialogue.
[0090] The corrected text acquisition unit 403 is used to acquire a model reply corrected text for the user input text in the target text based on the user feedback result.
[0091] The construction unit 404 is used to construct a model training sample based on the target text, the user feedback result, and the model reply correction text.
[0092] The training unit 405 is used to iteratively train the preset language model based on the model training samples.
[0093] Optionally, in some embodiments of the present specification, the target text acquisition unit 401 can be specifically used to analyze whether the user is dissatisfied with the output model reply text based on the acquired user input text or to obtain the confidence level corresponding to the output model reply text; if dissatisfied or the confidence level is less than a threshold, a model inquiry text is generated; the target text includes the acquired user input text, the output model reply text, the model inquiry text, and the user input text of the user for the model inquiry text.
[0094] Optionally, in some embodiments of the present specification, the model inquiry text includes a statement for inquiring about satisfaction and / or a statement for inquiring about improvement suggestions.
[0095] Optionally, in some embodiments of the present specification, the analysis unit 402 can be specifically used to obtain one or more preset feedback inquiry texts; the one or more preset feedback inquiry texts have different question granularities; one or more preset feedback inquiry texts are input into the preset language model to obtain the user feedback result output by the preset language model.
[0096] Optionally, in some embodiments of the present specification, the revised text acquisition unit 403 can be specifically used to obtain a preset revised inquiry text; input the revised inquiry text into the preset language model to obtain a model reply revised text output by the preset language model.
[0097] Optionally, in some embodiments of the present specification, the language model training device may further include a training text acquisition unit, a first output unit, and a second output unit.
[0098] A training text acquisition unit is used to acquire dialogue training text and guidance training text; the dialogue training text includes question sentences related to a preset topic, and the guidance training text includes sentences for indicating model inquiry satisfaction and / or sentences for indicating model inquiry improvement suggestions.
[0099] The first output unit is used to input the dialogue training text into the preset language model to obtain the training reply text output by the preset language model.
[0100] The second output unit is used to input the guiding training text into the preset language model, so that the preset language model can output a sentence for inquiring about satisfaction and / or a sentence for inquiring about improvement suggestions when talking with the user.
[0101] Optionally, in some embodiments of the present specification, the guided training text includes a statement for instructing the model to inquire about satisfaction when it is determined based on the dialogue training text that the other party is dissatisfied or the confidence of the training reply text is less than a set threshold, and / or a statement for instructing the model to inquire about improvement suggestions when it is determined based on the dialogue training text that the other party is dissatisfied or the confidence of the training reply text is less than a set threshold.
[0102] Optionally, in some embodiments of the present specification, the language model training device may further include a determination unit.
[0103] The determination unit is used to determine a target training reply text from the two or more candidate training reply texts output by the preset language model and input the target training reply text into the preset language model.
[0104] As can be seen from the above, in some embodiments of the present specification, the target text acquisition unit 401 can acquire the target text corresponding to one or more rounds of dialogue between the preset language model and the user, and the target text includes the user input text and the model reply text; the analysis unit 402 analyzes the target text through the preset language model to obtain the user feedback result for one or more rounds of dialogue; the correction text acquisition unit 403 obtains the model reply correction text for the user input text in the target text based on the user feedback result; the construction unit 404 constructs the model training sample based on the target text, the user feedback result, and the model reply correction text; the training unit 405 iteratively trains the preset language model based on the model training sample. In some embodiments of the present specification, the preset language model can be iteratively trained by collecting the user feedback result and the model reply correction text during the dialogue between the preset language model and the user, so as to expect that the preset language model can generate a more natural and reasonable model reply text during the dialogue with the user, thereby collecting the content related to the user feedback while reducing the complexity of the user feedback operation, and finally enabling the preset language model to output a more accurate text that meets the user's needs.
[0105] For more information about each unit, see Figure 2 as well as Figure 3 The relevant description of will not be repeated here. It should be understood that Figure 2 as well as Figure 3The system and its modules shown can be implemented in various ways. For example, in some embodiments, the system and its modules can be implemented by hardware, software, or a combination of software and hardware. Among them, the hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated design hardware. Those skilled in the art will understand that the above methods and systems can be implemented using computer executable instructions and / or control codes contained in a processor, such as a disk, CD or DVD-ROM, etc., and such codes are provided in a carrier medium or a memory of a programmable device. The system and its modules of this specification can not only be implemented by hardware circuits such as ultra-large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., but can also be implemented by software executed by various types of processors, and can also be implemented by a combination of the above hardware circuits and software (e.g., firmware).
[0106] It should be noted that the above description of the system and its modules is only for convenience of description and does not limit this specification to the scope of the embodiments. It is understandable that for those skilled in the art, after understanding the principle of the system, it is possible to arbitrarily combine the modules without deviating from this principle to form a subsystem connected to other modules. Or some modules may be split to obtain more modules or multiple units under the module. Such variations are all within the scope of the disclosure of this specification.
[0107] Some embodiments of this specification also provide an electronic device, such as Figure 5 As shown, it shows a schematic diagram of the structure of an electronic device involved in an embodiment of this specification, and the electronic device may be a terminal or a server, etc.
[0108] The electronic device may include components such as a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, a power supply 503, and an input unit 504. Those skilled in the art will appreciate that Figure 5 The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0109] The processor 501 is the control center of the electronic device, which uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory 502, and calling data stored in the memory 502. Optionally, the processor 501 may include one or more processing cores; preferably, the processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 501.
[0110] The memory 502 can be used to store software programs and modules. The processor 501 executes various functional applications and data processing by running the software programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 502 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 with access to the memory 502.
[0111] The electronic device also includes a power supply 503 for supplying power to each component. Preferably, the power supply 503 can be logically connected to the processor 501 through a power management system, so as to manage charging, discharging, power consumption and other functions through the power management system. The power supply 503 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components.
[0112] The electronic device may further include an input unit 504, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0113] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically in this embodiment, the processor 501 in the electronic device will load the executable file corresponding to the process of one or more application programs into the memory 502 according to the following instructions, and the processor 501 will run the application stored in the memory 502, so as to realize various functions, which may include: obtaining the target text corresponding to one or more rounds of dialogue between the preset language model and the user, the target text including the user input text and the model reply text; analyzing the target text through the preset language model to obtain the user feedback result for the one or more rounds of dialogue; based on the user feedback result, obtaining the model reply correction text for the user input text in the target text; constructing a model training sample based on the target text, the user feedback result, and the model reply correction text; iteratively training the preset language model based on the model training sample.
[0114] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0115] As can be seen from the above, this embodiment can obtain the target text corresponding to one or more rounds of dialogue between the preset language model and the user, the target text includes the user input text and the model reply text; analyze the target text through the preset language model to obtain the user feedback results for one or more rounds of dialogue; based on the user feedback results, obtain the model reply correction text for the user input text in the target text; construct a model training sample based on the target text, the user feedback results, and the model reply correction text; iteratively train the preset language model based on the model training samples. This embodiment can iteratively train the preset language model by collecting the user feedback results and the model reply correction text during the dialogue between the preset language model and the user, in the expectation that the preset language model can generate a more natural and reasonable model reply text during the dialogue with the user, thereby collecting the content related to the user feedback while reducing the complexity of the user feedback operation, and finally enabling the preset language model to output a more accurate text that meets the user's needs.
[0116] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0117] To this end, some embodiments of this specification also provide a computer-readable storage medium, which stores multiple instructions, which can be loaded by a processor to execute the steps in any language model training method provided in some embodiments of this specification. For example, the instructions can execute the following steps.
[0118] Obtain target text corresponding to one or more rounds of dialogue between a preset language model and a user, the target text including user input text and model reply text; analyze the target text through the preset language model to obtain user feedback results for one or more rounds of dialogue; obtain model reply correction text for the user input text in the target text based on the user feedback results; construct a model training sample based on the target text, the user feedback results, and the model reply correction text; iteratively train the preset language model based on the model training sample.
[0119] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0120] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0121] Since the instructions stored in the computer-readable storage medium can execute the steps in any language model training method provided in some embodiments of this specification, the beneficial effects that can be achieved by any language model training method provided in some embodiments of this specification can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0122] Some embodiments of this specification also provide a computer program product, which includes computer instructions, which can be stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional implementations of the above-mentioned language model training.
[0123] The above is a detailed introduction to a language model training method, a language model training device, and related electronic equipment, a computer-readable storage medium, and a computer program product provided in some embodiments of this specification. This specification uses specific examples to illustrate the principles and implementation methods of the present technical solution. The description of the above embodiments is only used to help understand the method of the present technical solution and its core idea; at the same time, for technical personnel in this field, according to the idea of the present technical solution, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present technical solution.
Claims
1. A language model training method, characterized in that: include: Obtain target text corresponding to one or more rounds of dialogue between a preset language model and a user, wherein the target text includes user input text and model reply text; Analyzing the target text by using the preset language model to obtain user feedback results for the one or more rounds of dialogue; Based on the user feedback result, obtaining a model reply correction text for the user input text in the target text; Constructing a model training sample based on the target text, the user feedback result, and the model reply correction text; Iteratively training the preset language model based on the model training samples; Among them, the obtaining of the target text corresponding to one or more rounds of dialogue between the preset language model and the user further includes: analyzing, through the preset language model, based on the user input text that has been obtained, whether the user is dissatisfied with the model reply text that has been output or obtaining the confidence corresponding to the model reply text that has been output; if dissatisfied or the confidence is less than a threshold, generating a model inquiry text; the target text includes the user input text that has been obtained, the model reply text that has been output, the model inquiry text, and the user input text of the user for the model inquiry text.
2. The language model training method according to claim 1, characterized in that: The model inquiry text includes a sentence for inquiring about satisfaction and / or a sentence for inquiring about improvement suggestions.
3. The language model training method according to claim 1, characterized in that: The step of analyzing the target text by using a preset language model to obtain user feedback results for the one or more rounds of dialogues includes: Obtaining one or more preset feedback inquiry texts; the one or more preset feedback inquiry texts have different question granularities; One or more preset feedback inquiry texts are input into the preset language model to obtain the user feedback result output by the preset language model.
4. The language model training method according to claim 1, characterized in that: The step of obtaining a model reply correction text for the user input text in the target text based on the user feedback result includes: Get the preset modified query text; The modified query text is input into the preset language model to obtain a model reply modified text output by the preset language model.
5. The language model training method according to claim 1, characterized in that: Before obtaining the target text corresponding to one or more rounds of dialogue between the preset language model and the user, the method further includes: Acquire a dialogue training text and a guidance training text; the dialogue training text includes question sentences related to a preset topic, and the guidance training text includes a sentence for indicating the satisfaction of the model inquiry and / or a sentence for indicating the model inquiry improvement suggestions; Inputting the dialogue training text into the preset language model to obtain the training reply text output by the preset language model; The guidance training text is input into the preset language model so that the preset language model can output a sentence for inquiring about satisfaction and / or a sentence for inquiring about improvement suggestions when talking with the user.
6. The language model training method according to claim 5, characterized in that: The guided training text includes a statement for instructing the model to inquire about satisfaction when it is determined based on the dialogue training text that the other party is dissatisfied or the confidence of the training reply text is less than a set threshold, and / or a statement for instructing the model to inquire about improvement suggestions when it is determined based on the dialogue training text that the other party is dissatisfied or the confidence of the training reply text is less than a set threshold.
7. The language model training method according to claim 5, characterized in that: After inputting the guiding training text into the preset language model, the method further includes: A target training reply text is determined from the two or more candidate training reply texts output by the preset language model and is input into the preset language model.
8. A language model training device, characterized in that: include: A target text acquisition unit is used to acquire target text corresponding to one or more rounds of dialogue between a preset language model and a user, wherein the target text includes user input text and model reply text; the target text acquisition unit is further used to: analyze whether the user is dissatisfied with the output model reply text or obtain the confidence corresponding to the output model reply text based on the acquired user input text through the preset language model; if dissatisfied or the confidence is less than a threshold, generate a model inquiry text; the target text includes the acquired user input text, the output model reply text, the model inquiry text, and the user input text of the user for the model inquiry text; An analyzing unit, configured to analyze the target text by using a preset language model to obtain user feedback results for the one or more rounds of dialogue; A revised text acquisition unit, configured to acquire a model reply revised text for the user input text in the target text based on the user feedback result; A construction unit, configured to construct a model training sample based on the target text, the user feedback result, and the model reply correction text; A training unit is used to iteratively train the preset language model based on the model training samples.
9. An electronic device, characterized in that: It comprises a memory and a processor; the memory stores an application program, and the processor is used to run the application program in the memory to perform the operations in the language model method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the language model method according to any one of claims 1 to 7.
11. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the language model method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Generative large language model training method and model-based search method
CN116127020A
Knowledge base retrieval method and device based on large language model self-evaluation and self-feedback
CN116932717A
Enterprise knowledge base management and retrieval platform and method based on large language model
CN117112776A
