Reward model training method and device, electronic equipment and storage medium
By training and integrating reward models in multiple dimensions, we solve the problem of the inability of existing technologies to comprehensively measure the quality of reply texts, and achieve the improvement of the capabilities of large language models in subdivided dimensions and the comprehensiveness of reply text quality assessment.
Patent Information
- Application Number
- CN202410658642.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2024-09-17
AI Technical Summary
The existing reward model can only give the score of the reply text in a general dimension, and cannot comprehensively measure the quality of the reply text, which affects the training effect of the large language model.
By obtaining a sample set of multiple dimensions, training each dimension, and obtaining its own reward model, these reward models are fused to form a comprehensive evaluation target reward model to comprehensively measure the quality of the reply text of the large language model.
It effectively improves the training effect of the reward model, allowing the large language model to evolve its capabilities in subdivision dimensions, allowing it to more comprehensively evaluate and improve the quality of reply texts.
Smart Images

Figure CN118656607A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a training method, device, electronic device and storage medium for a reward model. Background Art
[0002] With the rapid development of computer technology, the application of human-computer intelligent dialogue is becoming more and more extensive. In the human-computer intelligent dialogue scenario, large language models (LLMs) are usually used to generate reply texts corresponding to the questions input by the user to realize human-computer intelligent dialogue.
[0003] At present, when training LLM, a reward model (RM) is often combined to improve the performance of LLM. The reward model is used to score the quality of the reply text output by LLM, providing a reference for the update optimization strategy of LLM.
[0004] However, the existing reward model can only give the score of the reply text on the general dimension, which cannot comprehensively measure the quality of the reply text, thus affecting the training effect of LLM. Summary of the invention
[0005] The present disclosure provides a training method, device, electronic device and storage medium for a reward model, which can improve the training effect of the reward model so that the trained reward model can comprehensively measure the quality of the reply text. The technical solution of the present disclosure is as follows:
[0006] According to a first aspect of an embodiment of the present disclosure, a method for training a reward model is provided, the method comprising:
[0007] Obtain a sample set corresponding to each dimension of the multiple dimensions, the sample set including multiple samples under the corresponding dimension, the samples including sample questions, sample reply texts corresponding to the sample questions, and annotated evaluation results of the sample reply texts, the dimension being a quality standard for measuring the reply text output by the pre-trained large language model;
[0008] Based on the sample set corresponding to each dimension, multiple network models to be trained are trained to obtain a reward model corresponding to each dimension, wherein the reward model is used to evaluate the reply text output by the pre-trained large language model under the corresponding dimension, wherein one sample set corresponds to one reward model;
[0009] The reward models corresponding to each dimension are fused to obtain a target reward model, where the target reward model is used to comprehensively evaluate the reply text output by the pre-trained large language model based on the multiple dimensions.
[0010] The above method effectively improves the training effect of the reward model and can help the pre-trained large language model to evolve in terms of segmented dimensions.
[0011] In some embodiments, the training of the multiple network models to be trained based on the sample set corresponding to each dimension to obtain the reward model corresponding to each dimension includes:
[0012] Based on a first sample set corresponding to a first dimension, a first network model to be trained is trained to obtain a first reward model corresponding to the first dimension, wherein the first dimension refers to any one of the multiple dimensions, and the first reward model is used to evaluate the reply text output by the pre-trained large language model under the first dimension, wherein in the i-th iteration, i is a positive integer:
[0013] Inputting a first sample in the first sample set into the first network model, and evaluating the quality of a first sample reply text in the first sample through the first network model to obtain a prediction evaluation result of the first sample reply text;
[0014] Determine a loss value based on the predicted evaluation result and the annotated evaluation result of the first sample reply text;
[0015] Based on the loss value, the model parameters of the first network model are adjusted to obtain the adjusted first network model, and based on the adjusted first network model, an i+1th iteration is performed, wherein when this iteration meets the training end condition, the first network model is used as the first reward model.
[0016] In some embodiments, the step of fusing the reward models corresponding to each dimension to obtain the target reward model includes any of the following:
[0017] Fusing the model parameters of the reward model corresponding to each dimension to obtain the target reward model;
[0018] The output results of the reward model corresponding to each dimension are fused to obtain the target reward model.
[0019] In some embodiments, fusing the model parameters of the reward model corresponding to each dimension to obtain the target reward model includes:
[0020] The model parameters of each module in the reward model corresponding to each dimension are fused to obtain the model parameters of each module in the target reward model, wherein the reward model corresponding to each dimension and the target reward model include the same modules.
[0021] In some embodiments, the output results of the reward models corresponding to each dimension are fused to obtain the target reward model, including: adding a target output layer after the output layer of the reward model corresponding to each dimension to splice the reward models corresponding to each dimension to obtain the target reward model, and the target output layer is used to fuse the output results of the reward models corresponding to each dimension.
[0022] In some embodiments, the method further comprises at least one of the following:
[0023] Based on the training process of the reward model corresponding to each dimension, draw a first radar chart, wherein the first radar chart indicates the performance evolution of the reward model corresponding to each dimension;
[0024] Based on the training process of the reward model corresponding to each dimension and the target reward model, a second radar chart is drawn, where the second radar chart indicates the performance evolution of the target reward model.
[0025] In some embodiments, obtaining a sample set corresponding to each dimension in the multiple dimensions includes:
[0026] Obtaining a first sample question corresponding to a first dimension, where the first dimension refers to any one dimension of the multiple dimensions;
[0027] Inputting the first sample question into multiple versions of the pre-trained large language model to obtain a first sample reply text corresponding to the first sample question, wherein the first sample reply text includes reply texts output by each version of the pre-trained large language model for the first sample question;
[0028] The first sample question and the first sample reply text are input into a reference reward model, and the first sample reply text is evaluated through the reference reward model to obtain a labeled evaluation result of the first sample reply text, wherein the first sample question, the first sample reply text and the labeled evaluation result of the first sample reply text are used to form a first sample, and the first sample belongs to a first sample set corresponding to the first dimension.
[0029] In some embodiments, obtaining a sample set corresponding to each dimension in the multiple dimensions includes:
[0030] determining a plurality of sample questions from the question set;
[0031] Based on a plurality of reply texts corresponding to each sample question among the plurality of sample questions, determining a sample reply text corresponding to each sample question from the plurality of reply texts corresponding to each sample question, wherein the plurality of reply texts corresponding to the sample questions are obtained by processing the sample questions respectively by the plurality of versions of the pre-trained large language models;
[0032] Based on the multiple dimensions, the annotation evaluation results of the sample reply text corresponding to each sample question in different dimensions are obtained to obtain a sample set corresponding to each dimension.
[0033] In some embodiments, determining a plurality of sample questions from a question set includes:
[0034] Acquire first reference information of each question in the question set, where the first reference information indicates a quality difference between a reply text output by the pre-trained large language model and a reference large language model for the question;
[0035] Based on the first reference information of each question, the sample questions meeting a first condition are determined from the question set, where the first condition includes that a quality difference indicated by the first reference information is greater than a first threshold.
[0036] In some embodiments, the determining, based on the multiple reply texts corresponding to each sample question in the multiple sample questions, from the multiple reply texts corresponding to each sample question, a sample reply text corresponding to each sample question includes:
[0037] Acquire second reference information of the sample question and multiple reply texts of the sample question, wherein the second reference information indicates quality differences of reply texts output by multiple versions of the pre-trained large language model for the sample question;
[0038] Based on the second reference information of the sample question, a sample reply text of the sample question that meets a second condition is determined from a plurality of reply texts of the sample question, wherein the second condition includes that a quality difference indicated by the second reference information is greater than a second threshold.
[0039] In some embodiments, the multiple dimensions include any one or more of the following: accuracy, which is used to characterize the degree of conformity between the reply text and objective facts; logic, which is used to characterize the clarity of the language logic of the reply text; comprehension, which is used to characterize the degree of understanding of the sample question by the reply text; completeness, which is used to characterize the comprehensiveness of the content of the reply text; pertinence, which is used to characterize the degree of match between the reply text and the sample question; practicality, which is used to characterize the practicality of the reply text in solving the sample problem; and language quality, which is used to characterize the textual expression quality of the reply text.
[0040] According to a second aspect of an embodiment of the present disclosure, a training device for a reward model is provided, the device comprising:
[0041] An acquisition module, used to acquire a sample set corresponding to each dimension of a plurality of dimensions, wherein the sample set includes a plurality of samples under the corresponding dimension, wherein the samples include a sample question, a sample reply text corresponding to the sample question, and a labeled evaluation result of the sample reply text, wherein the dimension is a quality standard for measuring the reply text output by the pre-trained large language model;
[0042] A training module, used for training multiple network models to be trained based on the sample set corresponding to each dimension, and obtaining a reward model corresponding to each dimension, wherein the reward model is used for evaluating the reply text output by the pre-trained large language model under the corresponding dimension, wherein one sample set corresponds to one reward model;
[0043] A fusion module is used to fuse the reward models corresponding to each dimension to obtain a target reward model, wherein the target reward model is used to comprehensively evaluate the reply text output by the pre-trained large language model based on the multiple dimensions.
[0044] In some embodiments, the training module is configured to perform:
[0045] Based on a first sample set corresponding to a first dimension, a first network model to be trained is trained to obtain a first reward model corresponding to the first dimension, wherein the first dimension refers to any one of the multiple dimensions, and the first reward model is used to evaluate the reply text output by the pre-trained large language model under the first dimension, wherein in the i-th iteration, i is a positive integer:
[0046] Inputting a first sample in the first sample set into the first network model, and evaluating the quality of a first sample reply text in the first sample through the first network model to obtain a prediction evaluation result of the first sample reply text;
[0047] Determine a loss value based on the predicted evaluation result and the annotated evaluation result of the first sample reply text;
[0048] Based on the loss value, the model parameters of the first network model are adjusted to obtain the adjusted first network model, and based on the adjusted first network model, an i+1th iteration is performed, wherein when this iteration meets the training end condition, the first network model is used as the first reward model.
[0049] In some embodiments, the fusion module includes any of the following:
[0050] A first fusion unit is configured to perform fusion of model parameters of the reward model corresponding to each dimension to obtain the target reward model;
[0051] The second fusion unit is configured to perform fusion on the output results of the reward model corresponding to each dimension to obtain the target reward model.
[0052] In some embodiments, the first fusion unit is configured to perform: fusing model parameters of each module in the reward model corresponding to each dimension to obtain model parameters of each module in the target reward model, wherein the reward model corresponding to each dimension and the target reward model include the same modules.
[0053] In some embodiments, the second fusion unit is configured to perform: adding a target output layer after the output layer of the reward model corresponding to each dimension to splice the reward model corresponding to each dimension to obtain the target reward model, and the target output layer is used to fuse the output results of the reward model corresponding to each dimension.
[0054] In some embodiments, the apparatus further comprises a drawing module configured to execute:
[0055] Based on the training process of the reward model corresponding to each dimension, draw a first radar chart, wherein the first radar chart indicates the performance evolution of the reward model corresponding to each dimension;
[0056] Based on the training process of the reward model corresponding to each dimension and the target reward model, a second radar chart is drawn, where the second radar chart indicates the performance evolution of the target reward model.
[0057] In some embodiments, the acquisition module is configured to execute:
[0058] Obtaining a first sample question corresponding to a first dimension, where the first dimension refers to any one dimension of the multiple dimensions;
[0059] Inputting the first sample question into multiple versions of the pre-trained large language model to obtain a first sample reply text corresponding to the first sample question, wherein the first sample reply text includes reply texts output by each version of the pre-trained model for the first sample question;
[0060] The first sample question and the first sample reply text are input into a reference reward model, and the first sample reply text is evaluated through the reference reward model to obtain a labeled evaluation result of the first sample reply text, wherein the first sample question, the first sample reply text and the labeled evaluation result of the first sample reply text are used to form a first sample, and the first sample belongs to a first sample set corresponding to the first dimension.
[0061] In some embodiments, the acquisition module is configured to execute:
[0062] determining a plurality of sample questions from the question set;
[0063] Based on a plurality of reply texts corresponding to each sample question among the plurality of sample questions, determining a sample reply text corresponding to each sample question from the plurality of reply texts corresponding to each sample question, wherein the plurality of reply texts corresponding to the sample questions are obtained by processing the sample questions respectively by the plurality of versions of the pre-trained large language models;
[0064] Based on the multiple dimensions, the annotation evaluation results of the sample reply text corresponding to each sample question in different dimensions are obtained to obtain a sample set corresponding to each dimension.
[0065] In some embodiments, the acquisition module is configured to execute:
[0066] Acquire first reference information of each question in the question set, where the first reference information indicates a quality difference between a reply text output by the pre-trained large language model and a reference large language model for the question;
[0067] Based on the first reference information of each question, the sample questions meeting a first condition are determined from the question set, where the first condition includes that a quality difference indicated by the first reference information is greater than a first threshold.
[0068] In some embodiments, the acquisition module is configured to execute:
[0069] Acquire second reference information of the sample question and multiple reply texts of the sample question, wherein the second reference information indicates quality differences of reply texts output by multiple versions of the pre-trained large language model for the sample question;
[0070] Based on the second reference information of the sample question, a sample reply text of the sample question that meets a second condition is determined from a plurality of reply texts of the sample question, wherein the second condition includes that a quality difference indicated by the second reference information is greater than a second threshold.
[0071] In some embodiments, the multiple dimensions include any one or more of the following: accuracy, which is used to characterize the degree of conformity between the reply text and objective facts; logic, which is used to characterize the clarity of the language logic of the reply text; comprehension, which is used to characterize the degree of understanding of the sample question by the reply text; completeness, which is used to characterize the comprehensiveness of the content of the reply text; pertinence, which is used to characterize the degree of match between the reply text and the sample question; practicality, which is used to characterize the practicality of the reply text in solving the sample problem; and language quality, which is used to characterize the textual expression quality of the reply text.
[0072] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, the electronic device comprising:
[0073] one or more processors;
[0074] A memory for storing program codes executable by the processor;
[0075] The processor is configured to execute the program code to implement the training method of the above-mentioned reward model.
[0076] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, which includes: when the program code in the computer-readable storage medium is executed by a processor of an electronic device, the electronic device is enabled to execute the above-mentioned reward model training method.
[0077] According to a fifth aspect of an embodiment of the present disclosure, there is provided a computer program product, comprising a computer program, which implements the above-mentioned reward model training method when executed by a processor.
[0078] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0080] Figure 1 It is a schematic diagram of an implementation environment provided by an embodiment of the present disclosure;
[0081] Figure 2 is a flow chart of a training method of a reward model provided by an embodiment of the present disclosure;
[0082] Figure 3 is a flow chart of another reward model training method provided by an embodiment of the present disclosure;
[0083] Figure 4 is a schematic diagram of a reward model of different dimensions provided by an embodiment of the present disclosure;
[0084] Figure 5 is a schematic diagram of a sample generating device of a reward model provided by an embodiment of the present disclosure;
[0085] Figure 6 is a schematic diagram of the structure of a terminal provided by an embodiment of the present disclosure;
[0086] Figure 7 It is a structural diagram of a server provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0087] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0088] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0089] 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 for analysis, stored data, displayed data, etc.) and signals involved in the present disclosure are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions. For example, the sample questions and sample reply texts involved in the embodiments of the present disclosure are all obtained with full authorization. In some embodiments, the embodiments of the present disclosure provide a permission inquiry page, which is used to inquire whether to grant permission to obtain the above information. In the permission inquiry page, an authorization consent control and an authorization rejection control are displayed. When a trigger operation of the authorization consent control is detected, the training method of the reward model provided in the embodiments of the present disclosure is used to obtain the above information.
[0090] Figure 1 This is a schematic diagram of an implementation environment provided by the embodiment of the present disclosure, see Figure 1 The implementation environment includes: a terminal 101 and a server 102. The terminal 101 and the server 102 are directly or indirectly connected via wired or wireless communication, which is not limited.
[0091] The terminal 101 may be at least one of a smart phone, a smart watch, a desktop computer, a laptop, a virtual reality terminal, an augmented reality terminal, a wireless terminal, and a laptop computer. The terminal 101 has a communication function and can access a wired network or a wireless network. The terminal 101 may generally refer to one of a plurality of terminals. This embodiment is only illustrated by the terminal 101. Those skilled in the art may know that the number of the above terminals may be more or less. Schematically, the terminal 101 can be installed and run with an application, which is used to provide an AI dialogue function, such as a social application, a search application, etc., which is not limited in this disclosure. Among them, the AI dialogue function refers to the use of AI technology to answer questions raised by users in natural language to meet the user's needs for fast and accurate information acquisition. For example, the terminal 101 displays the dialogue interface of the application, and the user can enter questions on the dialogue interface to ask questions, and the application will answer them to realize AI dialogue. For example, the application is in the form of a web application, a micro program, or a client, etc., and the disclosure is not limited thereto. Among them, a micro program refers to a program that runs on other applications, such as a mini program. In the disclosed embodiment, large language models (LLM) are used to implement AI dialogue. When training LLM, a reward model (RM) is often combined to improve the performance of LLM, wherein the quality of the reply text output by LLM is scored by the reward model to provide a reference for the update optimization strategy of LLM. Schematically, the terminal 101 can provide the server 102 with the information required for the training method of the reward model, such as a sample set, an initial neural network, etc.
[0092] The server 102 may be an independent physical server, or a server cluster or distributed file 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 (Content Delivery Network), and big data and artificial intelligence platforms. In some embodiments, the server 102 is directly or indirectly connected to the terminal 101 through wired or wireless communication, which is not limited in the embodiments of the present disclosure. Optionally, the number of the above-mentioned servers 102 may be more or less, which is not limited in the embodiments of the present disclosure. Schematically, the server 102 is used to provide background services for applications running on the terminal 101. For example, a large language model LLM is deployed on the server 102, and the terminal 101 sends an answer request to the server 102 based on the question entered by the user on the dialogue interface. The server 102 responds to the answer request and processes the question based on the LLM to generate a reply text for the question. Of course, the server 102 may also include other functional servers to provide more comprehensive and diversified services.
[0093] In the embodiment of the present disclosure, both the terminal 101 and the server 102 can perform training based on the sample set to obtain a reward model, providing a more accurate reference for the update optimization strategy of the LLM. In some embodiments, during the training of the reward model, the server 102 undertakes the main computing work and the terminal 101 undertakes the secondary computing work; or, the server 102 undertakes the secondary computing work and the terminal 101 undertakes the main computing work; or, the terminal 101 and the server 102 can undertake the computing work alone, which is not limited in the embodiment of the present disclosure.
[0094] In some embodiments, the above network can be a wired network or a wireless network. The network uses standard communication technology and / or protocols. The network is usually the Internet, but it can also be any network, including but not limited to any combination of a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a dedicated network or a virtual private network. In some embodiments, the data exchanged through the network is represented by technologies and / or formats including Hyper Text Markup Language (HTML), Extensible Markup Language (XML), etc. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above data communication technologies.
[0095] Before introducing the training method of the reward model provided in the present disclosure, the key terms involved in the present disclosure are introduced below.
[0096] Large Language Models (LLM) is a model based on machine learning and natural language processing technology. It learns the ability of human language understanding and generation by training on large amounts of text data.
[0097] Supervised Fine-Tuning (SFT) refers to pre-training a neural network model on a source dataset, namely the source model. Then a new neural network model is created, namely the target model. The target model copies all the model designs and parameters of the source model except the output layer. These model parameters contain the knowledge learned on the source dataset, and this knowledge is also applicable to the target dataset. The output layer of the source model is closely related to the label of the source dataset, so it is not used in the target model. When fine-tuning, add an output layer with an output size equal to the number of categories in the target dataset to the target model, and randomly initialize the model parameters of this layer. When training the target model on the target dataset, it will be trained from scratch to the output layer, and the parameters of the remaining layers are fine-tuned based on the parameters of the source model.
[0098] The Reward Model (RM) is used to measure the quality of the answers generated by the large language model and provide feedback and guidance to the large language model to improve its performance and output quality.
[0099] Reinforcement Learning for Human Feedback (RLHF) is a method that uses reinforcement learning to optimize the model in the language model. Its core idea is to directly optimize the language model with human feedback in a reinforcement learning manner, so that the model can better follow human preferences and subjective opinions. At present, RLHF is usually used to improve the ability of LLM and solve problems that are difficult for LLM to solve in the pre-training and SFT stages. Based on this, the overall training process of LLM can be divided into three steps: pre-training, SFT, and RLHF. Among them, the implementation of RLHF depends on reinforcement learning (RL) technology. RM is a key component in RLHF, which is used to estimate the model performance in the current state and provide a reference for subsequent update optimization strategies (by scoring different reply texts). A good RM determines the upper limit of RLHF's ability. Therefore, how to improve the training effect of RM is crucial.
[0100] Combine the following Figures 2 to 4 The training method of the reward model provided by the embodiment of the present disclosure is described. The embodiment of the present disclosure can be applicable to the scenario of evaluating the text output by any model, and in particular, it can be applicable to the scenario of evaluating the reply text output by a large language model to a question. The executor of the training method can be an electronic device such as a computer, a terminal device, a server, a server cluster, or a specially designed reward model training device, or it can be a reward model training device set in the electronic device, and the reward model training device can be implemented by software, hardware, or a combination of both.
[0101] Figure 2 is a flow chart of a method for training a reward model provided by an embodiment of the present disclosure. Figure 2 As shown, the method is described by taking the execution of the method by an electronic device as an example. Schematically, the method includes the following steps 201 to 203.
[0102] In step 201, the electronic device obtains a sample set corresponding to each dimension of multiple dimensions, where the sample set includes multiple samples under the corresponding dimension, and the samples include sample questions, sample reply texts corresponding to the sample questions, and annotated evaluation results of the sample reply texts.
[0103] In the embodiment of the present disclosure, the sample set is used to train the artificial intelligence network model to obtain a reward model, and the reward model is used to evaluate the reply text output by the pre-trained large language model for the question. Among them, the pre-trained large language model refers to the large language model obtained after pre-training and supervised fine-tuning of the initial neural network based on the training data set, and the reward model obtained by training the embodiment of the present disclosure is used to evaluate the reply text output by the pre-trained large language model. The pre-trained large language model is used to output the reply text for the question according to the input question. It should be noted that the large language model involved in the present disclosure can continuously iterate and evolve based on massive data and knowledge, has extensive multi-field knowledge and creative talents, has excellent language understanding and generation capabilities, and can understand and efficiently perform various tasks. For example, it is good at tasks such as knowledge question and answer, copywriting, text translation, mathematical logic, code understanding and writing. The present disclosure does not limit the structure of the large language model, and all language models that can provide AI question and answer functions are applicable to the present disclosure. In addition, the present disclosure does not limit the type of reply text output by the large language model. For example, the reply text includes text and at least one of the following: pictures, videos, audio, animated images, special effects, etc., that is, the reply text can be composed of one or more types of content. For example, the reply text is a paragraph of text, or the reply text is a paragraph of text and a video, etc. The present disclosure is not limited to this.
[0104] Schematically, the dimension is a quality standard for measuring the reply text output by the pre-trained large language model, and the multiple dimensions include any one or more of the following:
[0105] Accuracy is used to characterize the degree to which the response text is consistent with objective facts. For example, it measures whether the response text contains false or misleading statements.
[0106] Logic is used to characterize the clarity of the language logic of the reply text. For example, it measures whether the reasoning process and argument structure of the reply text are reasonable and clear, whether it is coherent, and whether there are any contradictions or unreasonable jumps.
[0107] Comprehension is used to characterize the degree to which the response text understands the sample question. For example, it measures the degree to which the pre-trained large language model understands the input question or instruction, and whether it accurately grasps the key points and intentions of the question.
[0108] Completeness is used to characterize the comprehensiveness of the content of the response text, for example, to measure whether the response text covers all necessary points and aspects, does not omit key information, and whether it responds to the questions in a comprehensive manner.
[0109] Targetedness is used to characterize the degree to which the response text matches the sample questions, for example, measuring whether the response text is closely related to the questions or topics raised, rather than being too general or off-topic.
[0110] Practicality is used to characterize the practicality of the reply text in solving sample problems. For example, it measures the value of the reply text in practical applications and whether it can provide effective help in solving problems, providing decision support, etc.
[0111] Language quality is used to characterize the quality of the textual expression of the reply text. For example, it measures whether the grammar of the reply text is correct, whether the wording is appropriate and accurate, and whether the expression is fluent and natural.
[0112] It should be noted that the present disclosure does not limit the specific content of multiple dimensions. In practical applications, appropriate multiple dimensions can be selected according to needs to improve the comprehensiveness of the evaluation results.
[0113] For any dimension, hereinafter referred to as the first dimension, the electronic device obtains a first sample set corresponding to the first dimension, the first sample set includes multiple samples under the first dimension, wherein for any sample under the first dimension, hereinafter referred to as the first sample, the first sample includes a first sample question, a first sample reply text corresponding to the first sample question, and a marked evaluation result of the first sample reply text, the marked evaluation result of the first sample reply text indicates the quality of the first sample reply text under the first dimension. That is, the marked evaluation result categories corresponding to sample sets corresponding to different dimensions are different. For example, taking the first dimension as accuracy as an example, the marked evaluation result corresponding to its sample set indicates the quality of the sample reply text under the dimension of accuracy; for another example, taking the first dimension as logic as an example, the marked evaluation result corresponding to its sample set indicates the quality of the sample reply text under the dimension of logic.
[0114] In addition, for any sample, the sample reply text in the sample includes two reply texts, also called sample pairs, sample combinations, etc. These two reply texts are one good and one bad (or one good and one bad, that is, one of them is more inclined to human preferences), which are used to guide the optimization of the reward model, so that the reward model can output correct evaluation results for the reply text output by the pre-trained large language model.
[0115] In step 202, the electronic device trains the multiple network models to be trained based on the sample set corresponding to each dimension to obtain a reward model corresponding to each dimension, and the reward model is used to evaluate the reply text output by the pre-trained large language model under the corresponding dimension.
[0116] In the disclosed embodiment, one sample set corresponds to one reward model. Taking any dimension, i.e., the first dimension, as an example, the electronic device trains the first network model to be trained based on the first sample set corresponding to the first dimension, and obtains the first reward model corresponding to the first dimension. The first reward model is used to evaluate the reply text output by the pre-trained large language model under the first dimension. After step 202, the electronic device trains the sample set corresponding to each dimension, and obtains the reward model corresponding to each dimension, so that each reward model can pay attention to its corresponding subdivision dimension, which provides technical support for the subsequent target reward model that can comprehensively measure the quality of the reply text.
[0117] In step 203, the electronic device fuses the reward models corresponding to each dimension to obtain a target reward model, which is used to comprehensively evaluate the reply text output by the pre-trained large language model based on multiple dimensions.
[0118] In the disclosed embodiment, after obtaining the reward model corresponding to each dimension, the electronic device can fuse the model parameters of the reward model corresponding to each dimension to obtain the target reward model, or fuse the output results corresponding to each dimension to obtain the target reward model. The disclosure does not limit the fusion method of the reward model. In practical applications, the appropriate fusion method can be selected according to business needs to meet the personalized needs of users. It should be understood that since the reward model corresponding to each dimension can pay attention to its corresponding subdivision dimension, by fusing these reward models, the target reward model can comprehensively evaluate the reply text output by the pre-trained large language model based on multiple dimensions, thereby effectively improving the training effect of the reward model, and can help the pre-trained large language model to evolve in terms of subdivision dimensions.
[0119] In summary, in the training method of the reward model provided in the embodiment of the present disclosure, a fine-grained reward model training method is provided, wherein a sample set corresponding to each dimension in multiple dimensions is obtained, and training is performed based on the sample set corresponding to each dimension to obtain a reward model corresponding to each dimension, and then the reward models corresponding to each dimension are fused to obtain a target reward model, so that the target reward model can comprehensively evaluate the reply text output by the pre-trained large language model based on multiple dimensions, thereby effectively improving the training effect of the reward model, and can help the pre-trained large language model to evolve in terms of its capabilities in subdivided dimensions.
[0120] After the above Figure 2 , briefly introduces the training method of the reward model provided by the present disclosure, and the following reference Figure 3 , the embodiments of the present disclosure are introduced in detail.
[0121] Figure 3FIG. 1 is a flow chart of another reward model training method provided by an embodiment of the present disclosure. Figure 3 As shown, the method is described by taking the execution of the method by an electronic device as an example. Schematically, the method includes the following steps 301 to 303.
[0122] In step 301, the electronic device obtains a sample set corresponding to each dimension of multiple dimensions, where the sample set includes multiple samples under the corresponding dimension, and the samples include sample questions, sample reply texts corresponding to the sample questions, and annotated evaluation results of the sample reply texts.
[0123] In the embodiments of the present disclosure, the electronic device may obtain various samples from multiple channels such as Internet texts, books, academic documents, corpora, public data sets, etc., and may also manually generate samples according to business needs, which is not limited in the embodiments of the present disclosure.
[0124] In some embodiments, the electronic device obtains sample response texts corresponding to each sample question and the annotated evaluation results of the sample response texts based on the sample questions corresponding to each dimension. Schematically, taking any one dimension, i.e., the first dimension, as an example, the electronic device obtains the sample set corresponding to the first dimension including the following steps A1 to A3:
[0125] In step A1, a first sample question corresponding to a first dimension is obtained.
[0126] In step A2, the first sample question is input into multiple versions of the pre-trained large language model to obtain the first sample reply text corresponding to the first sample question, and the first sample reply text includes the reply text output by each version of the pre-trained model for the first sample question. Among them, the multiple versions of the pre-trained large language model can be pre-trained large language models of different scales. For example, the pre-trained large language model is a 7B LLM (i.e., a large language model with 7 billion parameters), and the multiple versions of the pre-trained large language model can be a 7B SFT model and a 13B SFT model. The multiple versions of the pre-trained large language model can also be models of the same scale but with different training parameters, which is not limited in the present disclosure. In addition, based on the foregoing introduction, it can be seen that a sample reply text corresponding to the sample question includes two reply texts, and these two reply texts are also called sample pairs, sample combinations, etc. It should be noted that the number of first sample reply texts corresponding to the first sample question can be one or more, and repeated reply texts may exist in the multiple first sample reply texts. For example, the first sample question corresponds to multiple first sample reply texts, where the first sample reply text A is represented by (y1, y2), and the second sample reply text B is represented by (y1, y3), which is not limited in the present disclosure. Outputting multiple reply texts through multiple versions of pre-trained large language models and using these reply texts as sample reply texts for sample questions can maximize the diversity of training samples.
[0127] In step A3, the first sample question and the first sample reply text are input into the reference reward model, and the first sample reply text is evaluated by the reference reward model to obtain the annotation evaluation result of the first sample reply text. Among them, the first sample question, the first sample reply text and the annotation evaluation result of the first sample reply text are used to form the first sample, and the first sample belongs to the first sample set corresponding to the first dimension. Schematically, the reference reward model can be an open source standard reward model, which is not limited in the present disclosure. For example, the annotation evaluation result is numerical information, that is, the electronic device calls the reference reward model, scores each reply text in the first sample reply text, and obtains the quality score of each reply text. The quality score is used to reflect which reply text in the first sample reply text is better, or more inclined to human preferences. It should be noted that the electronic device can also use other methods to obtain the annotation evaluation result of the first sample reply text, for example, calling an open source standard large language model (such as GPT4), evaluating the quality of each reply text in the first sample reply text, and outputting the annotation evaluation result of the first sample reply text. For another example, the first sample reply text is evaluated by manual annotation, and so on.
[0128] Through the sample set acquisition method shown in the above steps A1 to A3, it is possible to quickly acquire sample sets under corresponding dimensions for different dimensions, thereby improving the training efficiency of the reward model. Moreover, by outputting multiple reply texts through multiple versions of pre-trained large language models, and using these reply texts as sample reply texts for sample questions, it is possible to maximize the diversity of training samples.
[0129] In other embodiments, the electronic device selects sample questions that meet the conditions from the question set, and then selects sample reply texts that meet the conditions from the reply texts corresponding to the sample questions, and then evaluates the quality of the sample reply texts corresponding to each sample question in different dimensions based on multiple dimensions to obtain a sample set corresponding to each dimension. Schematically, the electronic device obtains the sample set corresponding to each dimension including the following steps B1 to B3:
[0130] In step B1, a plurality of sample questions are determined from the question set.
[0131] The questions in the question set are used as inputs to the large language model, which processes the questions and outputs a reply text for the questions. The present disclosure does not limit the source and number of questions in the question set. For example, questions can be obtained from channels such as Internet texts, books, academic documents, corpora, public data sets, etc., or they can be manually generated according to business needs.
[0132] In some embodiments, the electronic device obtains the first reference information of each question in the question set, and the first reference information of the question indicates the quality difference between the reply text output by the pre-trained large language model and the reference large language model for the question; based on the first reference information of each question, a sample question that meets the first condition is determined from the question set, and the first condition includes that the quality difference indicated by the first reference information is greater than a first threshold, and the first threshold is a preset threshold, which can be set according to actual needs. Among them, the reference large language model refers to a large language model that can provide an optimization reference for the pre-trained large language model, which can be an open source standard large language model, such as GPT4, etc., and the present disclosure does not limit this. Since the present disclosure uses the reference large language model as a model that can provide an optimization reference for the pre-trained large language model, by obtaining the first reference information of each question in the question set, the quality difference between the reply texts output by the pre-trained large language model and the reference large language model for the same question can be known, and then the questions in the question set can be screened. For example, the questions with large quality differences indicated by the first reference information are determined as sample questions, or in other words, the questions that are difficult to solve by the pre-trained large language model are screened out from the question set, and these questions are used as sample questions for subsequent training of the reward model, providing technical support for correctly guiding the optimization of the reward model.
[0133] In some embodiments, for any question in the question set (hereinafter referred to as the target question), the electronic device inputs the target question into the pre-trained large language model and the reference large language model respectively, processes the target question through the pre-trained large language model, outputs the first reply text of the target question, processes the target question through the reference large language model, outputs the second reply text of the target question, and obtains multiple reply texts of the target question. Then, the electronic device calls the reference reward model, inputs the target question and the multiple reply texts of the target question into the reference reward model, and evaluates the quality of each reply text corresponding to the target question through the reference reward model to obtain the evaluation result of each reply text. Among them, the reference reward model can be an open source standard reward model, which is not limited in this disclosure. For example, the evaluation result of the reply text is numerical information, that is, the electronic device calls the reference reward model, scores the different reply texts of each question, and obtains the quality score of each reply text. Further, the electronic device determines the first reference information of the target question based on the evaluation result of each reply text corresponding to the target question.
[0134] For example, the electronic device determines the first reference information of the target question based on the difference between the evaluation results of the response texts corresponding to the target question. That is, taking the evaluation result as numerical information as an example, the electronic device uses the difference between the evaluation results of the two response texts corresponding to the target question as the first reference information of the target question.
[0135] For another example, the electronic device determines the first reference information of the target question based on the evaluation results of each reply text corresponding to the target question. That is, the electronic device directly uses the evaluation results of the two reply texts corresponding to the target question as the first reference information of the target question.
[0136] For another example, the electronic device determines the first reference information of the target question based on the evaluation results of each reply text corresponding to the target question and the difference between the evaluation results of each reply text corresponding to the target question. That is, the first reference information of the target question can indicate two types of information, one is the reply quality of each reply text, and the other is the difference in reply quality between different reply texts.
[0137] The above step B1 is, taking any question in the question set as x as an example, inputting the question x into the pre-trained large language model and the reference large language model respectively, and obtaining two reply texts corresponding to question x, which are denoted as y-pre-trained and y-reference. Next, the reference reward model is called to evaluate the quality of the two reply texts respectively, that is, to score the two reply texts, and obtain the difference in the scores of the two reply texts, that is, to obtain the first reference information of question x. If the first reference information of question x indicates that the quality difference is greater than the preset threshold, it indicates that the quality of the reply text output by the pre-trained large language model is not good, that is, the answer generated for question x is poor, and question x needs to be reserved for RLHF to solve, so question x is determined as a sample problem. If the first reference information of question x indicates that the quality difference is less than or equal to the preset threshold, it indicates that the quality of the reply text output by the pre-trained large language model is close to the reference large language model. In this case, there is no need to further optimize question x.
[0138] In step B2, based on the multiple reply texts corresponding to each sample question in the multiple sample questions, the sample reply text corresponding to each sample question is determined from the multiple reply texts corresponding to each sample question, and the multiple reply texts corresponding to the sample questions are obtained by processing the sample questions by multiple versions of pre-trained large language models respectively.
[0139] Among them, for any sample question, the electronic device inputs the sample question into multiple versions of pre-trained large language models respectively, and obtains multiple reply texts corresponding to the sample question to maximize the diversity of the sample reply texts.
[0140] In some embodiments, taking any sample question as an example, the electronic device obtains the second reference information of the sample question and multiple reply texts of the sample question, the second reference information indicates the quality difference of the reply texts output by the pre-trained large language model for the sample question of multiple versions; based on the second reference information of the sample question, the sample reply text of the sample question that meets the second condition is determined from the multiple reply texts of the sample question, the second condition includes that the quality difference indicated by the second reference information is greater than the second threshold, the second threshold is a preset threshold, and can be set according to actual needs. Generally, when the quality difference of the sample reply texts corresponding to the sample question is small, such data cannot effectively guide the optimization of the reward model. Therefore, through the second reference information of the sample question, the quality difference of the reply texts output by the pre-trained large language model for the sample question of multiple versions can be known, and then the multiple reply texts corresponding to the sample question are screened, for example, the two reply texts with large quality differences indicated by the second reference information are used as the sample reply texts corresponding to the sample question, or the reply texts with large differences output by the pre-trained large language model for the same question are screened from the multiple reply texts corresponding to the sample question, and these reply texts are used as sample reply texts for subsequent training of the reward model, providing technical support for correctly guiding the optimization of the reward model.
[0141] In some embodiments, for any sample question, the electronic device obtains the second reference information of the sample question based on the comprehensive quality of each reply text corresponding to the sample question in multiple dimensions. For example, for any sample question, the electronic device evaluates the comprehensive quality of each reply text corresponding to the sample question in multiple dimensions to obtain the evaluation result of each reply text corresponding to the sample question. In this way, in the sample generation stage of the reward model, multiple dimensions are comprehensively considered to obtain high-quality training samples.
[0142] In step B3, based on multiple dimensions, the annotation evaluation results of the sample response text corresponding to each sample question in different dimensions are obtained to obtain a sample set corresponding to each dimension.
[0143] Among them, for any sample question, the electronic device evaluates the quality of the sample reply text corresponding to the sample question in each dimension, and obtains the labeled evaluation results of the sample reply text in each dimension, that is, obtains the sample set corresponding to each dimension.
[0144] Through the sample set acquisition method shown in steps B1 to B3 above, the sample quality of the reward model is finely controlled from each link, and samples that may affect the training of the reward model are filtered out, so as to obtain high-quality samples, which can correctly guide the optimization of the reward model.
[0145] In step 302, the electronic device trains the multiple network models to be trained based on the sample set corresponding to each dimension to obtain a reward model corresponding to each dimension, and the reward model is used to evaluate the reply text output by the pre-trained large language model under the corresponding dimension.
[0146] In the embodiments of the present disclosure, one sample set corresponds to one reward model. The reward model is used to evaluate the reply text output by the pre-trained large language model under the corresponding dimension. For example, it rates the quality of the reply text output by the pre-trained large language model and outputs the quality level of the reply text, such as setting multiple preset levels R1 to R5, which are respectively represented as "perfect, very good, good, average, and poor". It should be noted that this is only an example and does not constitute a limitation of the present disclosure. For example, the reward model can also output the quality score of the reply text, such as setting a score range of 1-100 points, and so on. In actual applications, the implementation form of the reward model can be set according to needs.
[0147] Taking any dimension, i.e., the first dimension, as an example, the electronic device trains the first network model to be trained based on the first sample set corresponding to the first dimension, and obtains a first reward model corresponding to the first dimension. The first reward model is used to evaluate the reply text output by the pre-trained large language model under the first dimension. Schematically, taking the i-th iteration of training based on the first sample set as an example (i is a positive integer), this step 302 includes steps 3021 to 3023.
[0148] In step 3021, the electronic device inputs the first sample in the first sample set into the first network model, and evaluates the first sample reply text in the first sample through the first network model to obtain a predicted evaluation result of the first sample reply text.
[0149] Among them, based on the above introduction, it can be known that the first sample reply text includes two reply texts. Schematically, the first sample question in the first sample is represented as x, and the first sample reply text is represented as (y1, y2). The first sample reply text is evaluated by the artificial intelligence model to obtain the predicted evaluation results r(x, y1) and r(x, y2) of the first sample reply text.
[0150] In step 3022, the electronic device determines the loss value based on the predicted evaluation result and the annotated evaluation result of the first sample reply text.
[0151] The electronic device determines the loss value based on the loss function shown in the following formula (1):
[0152] L r (φ)=-E[log(σ(r(x,y1)-r(x,y2)-m))] (1)
[0153] In formula (1), r(x, y1) and r(x, y2) are the predicted evaluation results of the first sample reply text, where y1 is the reply text with better quality indicated by the annotated evaluation result. m is a parameter used to measure the difference between r(x, y1) and r(x, y2), and is used to improve the model's understanding of the quality of y1 and y2. For example, m is a discrete function, which is not limited in the present disclosure.
[0154] In step 3023, the electronic device adjusts the model parameters of the first network model based on the loss value to obtain an adjusted first network model, and performs an (i+1)th iteration based on the adjusted first network model.
[0155] Among them, when this iteration meets the training end condition, the first network model is used as the first reward model corresponding to the first dimension. Among them, the training end condition is, for example, that the loss value (or error value) is less than the set threshold value. The set threshold value can be set according to actual needs, such as according to the accuracy of the artificial intelligence model. In other embodiments, the training end condition is that the number of iterations reaches the target number of iterations, or the training duration reaches the target duration. This application does not limit the content of the training end condition. In the i-th iteration, when this iteration meets the training end condition, indicating that the first network model of this iteration meets the requirements, the model is output. If not satisfied, the model parameters of the first network model are adjusted, and the i+1th iteration is performed based on the adjusted first network model, that is, execution starts again from the aforementioned step 3021 until the training is stopped when the training end condition is met, and the first reward model corresponding to the first dimension is obtained.
[0156] In addition, during one iteration, multiple first samples can be input into the first network model to obtain multiple loss values (or the multiple loss values can be processed to obtain a total loss value), and based on the multiple loss values (or the total loss value), it is determined whether this iteration meets the training end condition. It is also possible to input a first sample into the first network model to obtain a loss value, and based on the loss value, it is determined whether this iteration meets the training end condition. This application does not limit the number of samples in one iteration.
[0157] It should be noted that the above training process may also include other steps or other optional implementation methods, which are not limited in this application.
[0158] After the content shown in the above step 302, the electronic device trains the sample set corresponding to each dimension to obtain the reward model corresponding to each dimension, so that each reward model can focus on its corresponding subdivision dimension, providing technical support for the subsequent target reward model that can comprehensively measure the quality of the reply text. Schematically, the principle of this process can be referred to the following Table 1.
[0159] Table 1
[0160] Reward Model R1 = Perfect R2 = Very good R3 = better R4=Normal R5=Poor K1=Accuracy - - - - K2=Comprehension - - - - - K3 = Logic - - - - -
[0161] As shown in Table 1, taking the number of dimensions K=3 as an example, the K dimensions are: accuracy, comprehension and logic. For the reward model corresponding to each dimension, the reward model can evaluate the quality of the reply text output by the pre-trained large language model and obtain the quality level R1 to R5 of the reply text. After obtaining the reward model corresponding to each dimension, the performance of the model with different dimensions is obtained. For example, refer to Figure 4 , Figure 4 is a schematic diagram of a reward model of different dimensions provided by an embodiment of the present disclosure. Figure 4 As shown in the figure, given the sample question x is "Why do some people's silver bracelets become brighter and brighter as they wear them, while others become darker as they wear them", the sample reply text y1 is "The gloss change on the bracelet surface mainly depends on XXXXXXX". Based on this, using reward models of different dimensions to evaluate the sample reply text y1, we can get: the quality level of K1 (accuracy) output is good (or output 70 points), the quality level of K2 (comprehension) output is poor (or output 35 points), and the quality level of K3 (logic) output is very good (or output 85 points).
[0162] In step 303, the electronic device fuses the reward models corresponding to each dimension to obtain a target reward model, which is used to comprehensively evaluate the reply text output by the pre-trained large language model based on multiple dimensions.
[0163] In the disclosed embodiment, the electronic device fuses the reward model corresponding to each dimension to obtain the target reward model based on any of the following methods:
[0164] Method 1: Fusion the model parameters of the reward model corresponding to each dimension to obtain the target reward model.
[0165] Among them, the electronic device fuses the model parameters of each module in the reward model corresponding to each dimension to obtain the model parameters of each module in the target reward model, wherein the reward model corresponding to each dimension is the same as the module included in the target reward model. This process is also the process of fusing the model parameters of the same module in multiple reward models with the same structure. Schematically, taking any module in the reward model (hereinafter referred to as the target module) as an example, the electronic device fuses the model parameters of the target module in the first reward model and the model parameters of the target module in the second reward model to obtain the model parameters of the target module in the target reward model, wherein the first reward model corresponds to the first dimension and the second reward model corresponds to the second dimension. In addition, the fusion of model parameters can be carried out in any manner such as weighted summation and arithmetic average, which is not limited in the present disclosure.
[0166] By fusing the model parameters, the obtained target reward model can quickly output comprehensive evaluation results in multiple dimensions.
[0167] Method 2: Fuse the output results corresponding to each dimension to obtain the target reward model.
[0168] Among them, the electronic device adds a target output layer after the output layer of the reward model corresponding to each dimension to splice the reward model corresponding to each dimension to obtain the target reward model, and the target output layer is used to fuse the output results of the reward model corresponding to each dimension. Taking the reward models corresponding to any two dimensions as an example, the electronic device adds a target output layer after the output layer of the first reward model and the output layer of the second reward model to splice the first reward model and the second reward model to obtain the target reward model, wherein the target output layer is used to fuse the output results of the first reward model and the output results of the second reward model; the first reward model corresponds to the first dimension, and the second reward model corresponds to the second dimension.
[0169] In some embodiments, the electronic device performs a weighted summation on the output results corresponding to each dimension to obtain a target reward model. Schematically, the reward models corresponding to multiple dimensions are represented as R1(x, y), R2(x, y), ..., R k (x, y), k is a positive integer. The electronic device performs weighted summation on the output results of the reward model corresponding to each dimension based on the following formula (2) to obtain the target reward model:
[0170]
[0171] In the above formula (2), k represents the kth dimension, ω k is the weight of the reward model corresponding to the kth dimension, which is a hyperparameter that can be adjusted according to demand.
[0172] By fusing the model output results, the target reward model can be quickly obtained, thereby improving the generation efficiency of the target reward model.
[0173] It should be noted that the above-mentioned method 1 and method 2 provide a fusion form of multiple reward models, which can be set according to business needs in actual applications, and the present disclosure does not limit this.
[0174] Since the reward model corresponding to each dimension can focus on its corresponding segmented dimension, by fusing these reward models, the target reward model can comprehensively evaluate the reply text output by the pre-trained large language model based on multiple dimensions, thereby effectively improving the training effect of the reward model and helping the pre-trained large language model to evolve in terms of segmented dimensions.
[0175] In some embodiments, the electronic device can draw a radar chart, and the radar chart is used to reflect the overall performance of the reward model. Schematically, it includes at least one of the following situations: Situation 1: Based on the training process of the reward model corresponding to each dimension, a first radar chart is drawn, and the first radar chart indicates the performance evolution of the reward model corresponding to each dimension. Situation 2: Based on the training process of the reward model corresponding to each dimension and the target reward model, a second radar chart is drawn, and the second radar chart indicates the performance evolution of the target reward model. In the above process, by drawing the first radar chart, the capabilities of the reward models of different dimensions at different time points can be intuitively compared; by drawing the second radar chart, the capabilities of the reward models of different dimensions at different time points can be intuitively compared, and the capabilities of the target reward model in multiple different aspects can be displayed. The evolution of the capabilities of the target reward model in various aspects can be clearly seen, and technical support can be provided for relevant personnel to continue to optimize the reward model. Moreover, the electronic device can also reflect the capability evolution of the LLM in the form of a radar chart, so that it can not only reflect the capability evolution of the reward model in each subdivided dimension, but also know the changes in the general capabilities of the reward model.
[0176] In summary, in the training method of the reward model provided in the embodiment of the present disclosure, a fine-grained reward model training method is provided, wherein a sample set corresponding to each dimension in multiple dimensions is obtained, and training is performed based on the sample set corresponding to each dimension to obtain a reward model corresponding to each dimension, and then the reward models corresponding to each dimension are fused to obtain a target reward model, so that the target reward model can comprehensively evaluate the reply text output by the pre-trained large language model based on multiple dimensions, thereby effectively improving the training effect of the reward model, and can help the pre-trained large language model to evolve in terms of its capabilities in subdivided dimensions.
[0177] Figure 5 Schematic diagram of a sample generation device of a reward model provided by an embodiment of the present disclosure. Figure 5The device includes an acquisition module 501, a training module 502 and a fusion module 503.
[0178] An acquisition module 501 is used to acquire a sample set corresponding to each dimension in a plurality of dimensions, wherein the sample set includes a plurality of samples under the corresponding dimension, wherein the samples include a sample question, a sample reply text corresponding to the sample question, and a labeling evaluation result of the sample reply text, wherein the dimension is a quality standard for measuring the reply text output by the pre-trained large language model;
[0179] A training module 502 is used to train the multiple network models to be trained based on the sample set corresponding to each dimension, and obtain a reward model corresponding to each dimension, where the reward model is used to evaluate the reply text output by the pre-trained large language model under the corresponding dimension, wherein one sample set corresponds to one reward model;
[0180] The fusion module 503 is used to fuse the reward models corresponding to each dimension to obtain a target reward model, and the target reward model is used to comprehensively evaluate the reply text output by the pre-trained large language model based on multiple dimensions.
[0181] In some embodiments, the training module 502 is configured to perform:
[0182] Based on the first sample set corresponding to the first dimension, the first network model to be trained is trained to obtain a first reward model corresponding to the first dimension, where the first dimension refers to any one of the multiple dimensions, and the first reward model is used to evaluate the reply text output by the pre-trained large language model under the first dimension, where in the i-th iteration, i is a positive integer:
[0183] Inputting the first sample in the first sample set into the first network model, evaluating the quality of the first sample reply text in the first sample through the first network model, and obtaining a prediction evaluation result of the first sample reply text;
[0184] Determine a loss value based on the predicted evaluation result and the labeled evaluation result of the first sample reply text;
[0185] Based on the loss value, the model parameters of the first network model are adjusted to obtain the adjusted first network model, and the i+1th iteration is performed based on the adjusted first network model, wherein when this iteration meets the training end condition, the first network model is used as the first reward model.
[0186] In some embodiments, the fusion module 503 includes any of the following:
[0187] A first fusion unit is configured to perform fusion of model parameters of the reward model corresponding to each dimension to obtain a target reward model;
[0188] The second fusion unit is configured to perform fusion of the output results of the reward model corresponding to each dimension to obtain a target reward model.
[0189] In some embodiments, the first fusion unit is configured to perform:
[0190] The model parameters of each module in the reward model corresponding to each dimension are fused to obtain the model parameters of each module in the target reward model, wherein the reward model corresponding to each dimension and the target reward model include the same modules.
[0191] In some embodiments, the second fusion unit is configured to perform:
[0192] A target output layer is added after the output layer of the reward model corresponding to each dimension to concatenate the reward models corresponding to each dimension to obtain a target reward model. The target output layer is used to fuse the output results of the reward model corresponding to each dimension.
[0193] In some embodiments, the apparatus further comprises a drawing module configured to execute:
[0194] Based on the training process of the reward model corresponding to each dimension, a first radar chart is drawn, where the first radar chart indicates the performance evolution of the reward model corresponding to each dimension;
[0195] Based on the training process of the reward model corresponding to each dimension and the target reward model, a second radar chart is drawn, and the second radar chart indicates the performance evolution of the target reward model.
[0196] In some embodiments, the acquisition module 501 is configured to execute:
[0197] Obtain a first sample problem corresponding to a first dimension, where the first dimension refers to any one of the multiple dimensions;
[0198] Inputting the first sample question into multiple versions of the pre-trained large language model to obtain a first sample reply text corresponding to the first sample question, wherein the first sample reply text includes reply texts output by each version of the pre-trained large language model for the first sample question;
[0199] The first sample question and the first sample reply text are input into the reference reward model, and the first sample reply text is evaluated through the reference reward model to obtain a labeled evaluation result of the first sample reply text, wherein the first sample question, the first sample reply text and the labeled evaluation result of the first sample reply text are used to form a first sample, and the first sample belongs to a first sample set corresponding to the first dimension.
[0200] In some embodiments, the acquisition module 501 is configured to execute:
[0201] determining a plurality of sample questions from the question set;
[0202] Based on multiple reply texts corresponding to each sample question among multiple sample questions, a sample reply text corresponding to each sample question is determined from the multiple reply texts corresponding to each sample question, wherein the multiple reply texts corresponding to the sample question are obtained by processing the sample questions by multiple versions of pre-trained large language models respectively;
[0203] Based on multiple dimensions, the annotation evaluation results of the sample response text corresponding to each sample question in different dimensions are obtained to obtain the sample set corresponding to each dimension.
[0204] In some embodiments, the acquisition module 501 is configured to execute:
[0205] Obtaining first reference information for each question in the question set, the first reference information indicating a quality difference between a response text output by a pre-trained large language model and a reference large language model for the question;
[0206] Based on the first reference information of each question, sample questions meeting a first condition are determined from the question set, where the first condition includes that a quality difference indicated by the first reference information is greater than a first threshold.
[0207] In some embodiments, the acquisition module 501 is configured to execute:
[0208] Obtaining second reference information of the sample question and multiple reply texts of the sample question, wherein the second reference information indicates quality differences of reply texts output by multiple versions of the pre-trained large language model for the sample question;
[0209] Based on the second reference information of the sample question, a sample reply text of the sample question that meets a second condition is determined from a plurality of reply texts of the sample question, where the second condition includes that a quality difference indicated by the second reference information is greater than a second threshold.
[0210] In some embodiments, the multiple dimensions include any one or more of the following: accuracy, which is used to characterize the degree of consistency between the reply text and objective facts; logic, which is used to characterize the clarity of the language logic of the reply text; comprehension, which is used to characterize the degree of understanding of the sample question by the reply text; completeness, which is used to characterize the comprehensiveness of the content of the reply text; pertinence, which is used to characterize the degree of match between the reply text and the sample question; practicality, which is used to characterize the practicality of the reply text in solving the sample question; language quality, which is used to characterize the textual expression quality of the reply text.
[0211] Through the above device, the training effect of the reward model is effectively improved, which can help the evolution of the capabilities of the pre-trained large language model in the subdivision dimension.
[0212] It should be noted that: the training device for the reward model provided in the above embodiment only uses the division of the above functional modules as an example when training the reward model. In actual applications, the above functional distribution can be completed by different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the training device for the reward model provided in the above embodiment and the training method embodiment of the reward model belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0213] The embodiment of the present disclosure also provides an electronic device, which includes a processor and a memory, wherein the memory is used to store program code, and the program code is loaded and executed by the processor to implement the training method of the reward model in the embodiment of the present disclosure.
[0214] Taking electronic devices as terminals as an example, Figure 6 600 is a schematic diagram of a terminal structure provided by an embodiment of the present disclosure. The terminal 600 may be: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV), a laptop computer or a desktop computer. The terminal 600 may also be referred to as a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0215] Typically, the terminal 600 includes a processor 601 and a memory 602 .
[0216] The processor 601 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 601 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 601 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 601 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 601 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0217] The memory 602 may include one or more computer-readable storage media, which may be non-transitory. The memory 602 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 602 is used to store at least one program code, which is used to be executed by the processor 601 to implement the process executed by the electronic device in the training method of the reward model provided in the method embodiment of the present application.
[0218] In some embodiments, the terminal 600 may further optionally include: a peripheral device interface 603 and at least one peripheral device. The processor 601, the memory 602 and the peripheral device interface 603 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 603 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 604, a display screen 605, a camera assembly 606, an audio circuit 607, a positioning assembly 608 and a power supply 609.
[0219] The peripheral device interface 603 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 601 and the memory 602. In some embodiments, the processor 601, the memory 602, and the peripheral device interface 603 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 601, the memory 602, and the peripheral device interface 603 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0220] The radio frequency circuit 604 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 604 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 604 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 604 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 604 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 604 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0221] The display screen 605 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 605 is a touch display screen, the display screen 605 also has the ability to collect touch signals on the surface or above the surface of the display screen 605. The touch signal can be input to the processor 601 as a control signal for processing. At this time, the display screen 605 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 605 can be one, set on the front panel of the terminal 600; in other embodiments, the display screen 605 can be at least two, respectively set on different surfaces of the terminal 600 or in a folding design; in other embodiments, the display screen 605 can be a flexible display screen, set on the curved surface or folding surface of the terminal 600. Even, the display screen 605 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 605 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).
[0222] The camera assembly 606 is used to capture images or videos. Optionally, the camera assembly 606 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize the panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 606 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0223] The audio circuit 607 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 601 for processing, or input them into the radio frequency circuit 604 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal 600. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 601 or the radio frequency circuit 604 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 607 may also include a headphone jack.
[0224] The positioning component 608 is used to locate the current geographical location of the terminal 600 to implement navigation or LBS (Location Based Service).
[0225] The power supply 609 is used to power various components in the terminal 600. The power supply 609 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 609 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0226] In some embodiments, the terminal 600 further includes one or more sensors 610 , including but not limited to: an acceleration sensor 611 , a gyroscope sensor 612 , a pressure sensor 613 , a fingerprint sensor 614 , an optical sensor 615 , and a proximity sensor 616 .
[0227] The acceleration sensor 611 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal 600. For example, the acceleration sensor 611 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 601 can control the display screen 605 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 611. The acceleration sensor 611 can also be used for collecting game or user motion data.
[0228] The gyro sensor 612 can detect the body direction and rotation angle of the terminal 600, and the gyro sensor 612 can cooperate with the acceleration sensor 611 to collect the user's 3D actions on the terminal 600. The processor 601 can implement the following functions based on the data collected by the gyro sensor 612: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0229] The pressure sensor 613 can be set on the side frame of the terminal 600 and / or the lower layer of the display screen 605. When the pressure sensor 613 is set on the side frame of the terminal 600, it can detect the user's holding signal of the terminal 600, and the processor 601 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 613. When the pressure sensor 613 is set on the lower layer of the display screen 605, the processor 601 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 605. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0230] The fingerprint sensor 614 is used to collect the user's fingerprint, and the processor 601 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 614, or the fingerprint sensor 614 identifies the user's identity based on the collected fingerprint. When the user's identity is identified as a trusted identity, the processor 601 authorizes the user to perform relevant sensitive operations, including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings. The fingerprint sensor 614 can be set on the front, back, or side of the terminal 600. When a physical button or a manufacturer logo is set on the terminal 600, the fingerprint sensor 614 can be integrated with the physical button or the manufacturer logo.
[0231] The optical sensor 615 is used to collect the ambient light intensity. In one embodiment, the processor 601 can control the display brightness of the display screen 605 according to the ambient light intensity collected by the optical sensor 615. Specifically, when the ambient light intensity is high, the display brightness of the display screen 605 is increased; when the ambient light intensity is low, the display brightness of the display screen 605 is reduced. In another embodiment, the processor 601 can also dynamically adjust the shooting parameters of the camera assembly 606 according to the ambient light intensity collected by the optical sensor 615.
[0232] The proximity sensor 616, also called a distance sensor, is usually arranged on the front panel of the terminal 600. The proximity sensor 616 is used to collect the distance between the user and the front of the terminal 600. In one embodiment, when the proximity sensor 616 detects that the distance between the user and the front of the terminal 600 is gradually decreasing, the processor 601 controls the display screen 605 to switch from the screen-on state to the screen-off state; when the proximity sensor 616 detects that the distance between the user and the front of the terminal 600 is gradually increasing, the processor 601 controls the display screen 605 to switch from the screen-off state to the screen-on state.
[0233] Those skilled in the art will understand that Figure 6The structure shown in the figure does not constitute a limitation on the terminal 600, and the terminal 600 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0234] Take the electronic device as a server as an example. Figure 7 It is a structural diagram of a server provided by an embodiment of the present disclosure. Schematically, the server 700 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 701 and one or more memories 702, wherein the one or more memories 702 store at least one program code, and the at least one program code is loaded and executed by the one or more processors 701 to implement the training method of the reward model provided by the above-mentioned various method embodiments. Of course, the server 700 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 700 may also include other components for implementing device functions, which will not be repeated here.
[0235] In an exemplary embodiment, a computer-readable storage medium including a program code is also provided, such as a memory 702 including the program code, and the program code can be executed by a processor 701 of a server 700 to complete the training method of the reward model. Optionally, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0236] In an exemplary embodiment, a computer program product is also provided, including a computer program, which implements the above-mentioned reward model training method when executed by a processor.
[0237] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0238] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A training method for a reward model, characterized in that: The method comprises: Obtain a sample set corresponding to each dimension of the multiple dimensions, the sample set including multiple samples under the corresponding dimension, the samples including sample questions, sample reply texts corresponding to the sample questions, and annotated evaluation results of the sample reply texts under the corresponding dimension, the dimension being a quality standard for measuring the reply text output by the pre-trained large language model; Based on the sample set corresponding to each dimension, multiple network models to be trained are trained to obtain a reward model corresponding to each dimension, wherein the reward model is used to evaluate the quality of the reply text output by the pre-trained large language model under the corresponding dimension, wherein one sample set corresponds to one reward model; The reward models corresponding to each dimension are fused to obtain a target reward model, where the target reward model is used to evaluate the comprehensive quality of the reply text output by the pre-trained large language model based on the multiple dimensions.
2. The training method of the reward model according to claim 1, characterized in that: The method of training the multiple network models to be trained based on the sample set corresponding to each dimension to obtain the reward model corresponding to each dimension includes: Based on a first sample set corresponding to a first dimension, a first network model to be trained is trained to obtain a first reward model corresponding to the first dimension, wherein the first dimension refers to any one of the multiple dimensions, and the first reward model is used to evaluate the quality of the reply text output by the pre-trained large language model under the first dimension, wherein in the i-th iteration, i is a positive integer: Inputting a first sample in the first sample set into the first network model, and evaluating the quality of a first sample reply text in the first sample through the first network model to obtain a prediction evaluation result of the first sample reply text; Determine a loss value based on the predicted evaluation result and the annotated evaluation result of the first sample reply text; Based on the loss value, the model parameters of the first network model are adjusted to obtain the adjusted first network model, and based on the adjusted first network model, an i+1th iteration is performed, wherein when this iteration meets the training end condition, the first network model is used as the first reward model.
3. The training method of the reward model according to claim 1, characterized in that: The reward model corresponding to each dimension is integrated to obtain a target reward model, including any of the following: Fusing the model parameters of the reward model corresponding to each dimension to obtain the target reward model; The output results of the reward model corresponding to each dimension are fused to obtain the target reward model.
4. The training method of the reward model according to claim 3, characterized in that: The fusing the model parameters of the reward model corresponding to each dimension to obtain the target reward model includes: The model parameters of each module in the reward model corresponding to each dimension are fused to obtain the model parameters of each module in the target reward model, wherein the reward model corresponding to each dimension and the target reward model include the same modules.
5. The training method of the reward model according to claim 3, characterized in that: The step of fusing the output results of the reward model corresponding to each dimension to obtain the target reward model includes: A target output layer is added after the output layer of the reward model corresponding to each dimension to concatenate the reward model corresponding to each dimension to obtain the target reward model. The target output layer is used to fuse the output results of the reward model corresponding to each dimension.
6. The training method of the reward model according to claim 1, characterized in that: The method further comprises at least one of the following: Based on the training process of the reward model corresponding to each dimension, draw a first radar chart, wherein the first radar chart indicates the performance evolution of the reward model corresponding to each dimension; Based on the training process of the reward model corresponding to each dimension and the target reward model, a second radar chart is drawn, where the second radar chart indicates the performance evolution of the target reward model.
7. The training method of the reward model according to claim 1, characterized in that: The obtaining of a sample set corresponding to each dimension in the multiple dimensions includes: Obtaining a first sample question corresponding to a first dimension, where the first dimension refers to any one dimension of the multiple dimensions; Inputting the first sample question into multiple versions of the pre-trained large language model respectively, to obtain first sample reply texts corresponding to the first sample question, wherein the first sample reply texts include reply texts output by the pre-trained large language model of each version for the first sample question; The first sample question and the first sample reply text are input into a reference reward model, and the quality of each reply text in the first sample reply text is evaluated through the reference reward model to obtain a labeled evaluation result of the first sample reply text, wherein the first sample question, the first sample reply text and the labeled evaluation result of the first sample reply text are used to form a first sample, and the first sample belongs to a first sample set corresponding to the first dimension.
8. The training method of the reward model according to claim 1, characterized in that: The obtaining of a sample set corresponding to each dimension in the multiple dimensions includes: determining a plurality of sample questions from the question set; Based on multiple reply texts for each sample question in the multiple sample questions, determine a sample reply text for each sample question from the multiple reply texts for each sample question, wherein the multiple reply texts for the sample questions are obtained by processing the sample questions by the pre-trained large language models of multiple versions respectively; Based on the multiple dimensions, the annotation evaluation results of the sample reply text of each sample question in different dimensions are obtained to obtain a sample set corresponding to each dimension.
9. The training method of the reward model according to claim 8, characterized in that: The step of determining a plurality of sample questions from a question set includes: Acquire first reference information of each question in the question set, where the first reference information indicates a quality difference between a reply text output by the pre-trained large language model and a reference large language model for the question; Based on the first reference information of each question, the sample questions meeting a first condition are determined from the question set, where the first condition includes that a quality difference indicated by the first reference information is greater than a first threshold.
10. The training method of the reward model according to claim 8, characterized in that: The step of determining a sample response text for each sample question from the multiple response texts for each sample question based on the multiple response texts for each sample question includes: Acquire second reference information of the sample question and multiple reply texts of the sample question, wherein the second reference information indicates quality differences of reply texts output by multiple versions of the pre-trained large language model for the sample question; Based on the second reference information of the sample question, a sample reply text of the sample question that meets a second condition is determined from a plurality of reply texts of the sample question, wherein the second condition includes that a quality difference indicated by the second reference information is greater than a second threshold.
11. The method for training a reward model according to any one of claims 1 to 10, characterized in that: The multiple dimensions include any one or more of the following: Accuracy, which is used to characterize the degree to which the response text is consistent with objective facts; Logic, which is used to characterize the clarity of the language logic of the reply text; Comprehension, which is used to characterize the degree of understanding of the response text to the sample question; Completeness, which is used to characterize the comprehensiveness of the content of the response text; Targetedness, which is used to characterize the degree of match between the response text and the sample question; Practicality, which is used to characterize the degree of practicality of the response text in solving the sample problem; Language quality is used to characterize the quality of the textual expression of the response text.
12. A training device for a reward model, characterized in that: The device comprises: An acquisition module is configured to execute acquisition of a sample set corresponding to each dimension of the multiple dimensions, wherein the sample set includes multiple samples under the corresponding dimension, and the samples include sample questions, sample reply texts corresponding to the sample questions, and annotated evaluation results of the sample reply texts; A training module is configured to perform training based on a sample set corresponding to each dimension to obtain a reward model corresponding to each dimension, wherein the reward model is used to evaluate the reply text output by the pre-trained large language model under the corresponding dimension, wherein one sample set corresponds to one reward model; The fusion module is configured to perform fusion of the reward models corresponding to each dimension to obtain a target reward model, wherein the target reward model is used to comprehensively evaluate the reply text output by the pre-trained large language model based on the multiple dimensions.
13. An electronic device, characterized in that: The electronic device comprises: one or more processors; a memory for storing program code executable by the processor; Wherein, the processor is configured to execute the program code to implement the training method of the reward model as described in any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that: When the program code in the computer-readable storage medium is executed by a processor of an electronic device, the electronic device is enabled to perform the training method of the reward model as described in any one of claims 1 to 11.
15. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor of an electronic device, the electronic device is enabled to perform the training method of the reward model as claimed in any one of claims 1 to 11.
Citation Information
Cited By
Multi-dimensional fine-grained reward method and device for image and video generation
CN119851174A
Cboth case generation method and device based on large model, equipment and medium
CN120257948A
Method and device for generating task execution result, equipment and medium
CN120407123A
Method, device, equipment and medium for generating task execution results
CN120407123B
Large language model optimization method and optimization device
CN120633740A
