Generative model training method and device, equipment and storage medium

By constructing training cue terms and conducting multiple rounds of iterative training, combined with an evaluation model and weight optimization of the loss function, the problems of high training cost and increased response length of generative models are solved, achieving an efficient and stable training process and high-quality response generation.

CN121638499APending Publication Date: 2026-03-10BEIJING ZITIAO NETWORK TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-03
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

The training process of traditional generative models requires a large amount of manually labeled data, resulting in high training costs and low efficiency. Furthermore, iterative training may lead to an increase in response length, affecting the practicality of the model and the accuracy of evaluation.

Method used

By constructing training cues and performing multiple rounds of iterative training, multiple response contents of the generative model are obtained. The evaluation model is used to determine the high-quality and low-quality response contents. The model parameters are adjusted to increase the probability of high-quality responses and decrease the probability of low-quality responses. The loss function is optimized using weight coefficients to control the response length.

Benefits of technology

It improved data utilization efficiency, reduced training costs, enhanced the stability of the training process and the model's discriminative ability, and controlled the growth of response length.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121638499A_ABST
    Figure CN121638499A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a method, device and equipment for training a generative model and a computer readable storage medium. The method provided by the invention comprises the following steps: constructing a training prompt item; and executing multiple rounds of iterative training based on the training prompt item, wherein each round of iterative training comprises: obtaining multiple response contents generated by the generative model based on the training prompt item; based on the evaluation information of the multiple response contents, first response contents and second response contents are determined from the multiple response contents, and the evaluation of the first response contents is superior to that of the second response contents; and adjusting parameters of the generative model to increase a first probability of outputting the first response content and reduce a second probability of outputting the second response content.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The exemplary embodiments disclosed herein relate generally to the field of computers, and more particularly to methods, apparatus, devices, and computer-readable storage media for training generative models. Background Technology

[0002] With the development of computer technology, generative models have been widely applied to the generation of various modalities. For example, language models can generate corresponding responses based on input prompts. Therefore, the training quality of generative models directly affects the quality of the generated results. Summary of the Invention

[0003] In a first aspect of this disclosure, a method for training a generative model is provided. The method includes: constructing training cues; and performing multiple rounds of iterative training based on the training cues, wherein each round of iterative training includes: acquiring multiple response contents generated by the generative model based on the training cues; determining a first response content and a second response content from the multiple response contents based on evaluation information of the multiple response contents, wherein the evaluation of the first response content is higher than that of the second response content; and adjusting the parameters of the generative model to increase a first probability of outputting the first response content and decrease a second probability of outputting the second response content.

[0004] In a second aspect of this disclosure, an apparatus for training a generative model is provided. The apparatus includes: a construction module configured to construct training cues; and a training module configured to perform multiple rounds of iterative training based on the training cues, wherein each round of iterative training includes: acquiring multiple response contents generated by the generative model based on the training cues; determining a first response content and a second response content from the multiple response contents based on evaluation information of the multiple response contents, wherein the evaluation of the first response content is higher than that of the second response content; and adjusting the parameters of the generative model to increase a first probability of outputting the first response content and decrease a second probability of outputting the second response content.

[0005] In a third aspect of this disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit. When executed by the at least one processing unit, the instructions cause the device to perform the method of the first aspect.

[0006] In a fourth aspect of this disclosure, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program that can be executed by a processor to implement the method of the first aspect.

[0007] It should be understood that the content described in this content section is not intended to limit the key or essential features of the embodiments of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0008] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:

[0009] Figure 1 A schematic diagram is shown of an example environment in which embodiments of the present disclosure may be implemented;

[0010] Figure 2 A flowchart illustrating an example process for training a generative model according to some embodiments of this disclosure is shown;

[0011] Figure 3 Pseudocode for an iterative training process according to some embodiments of this disclosure is shown;

[0012] Figure 4 A schematic structural block diagram of an example apparatus for training a generative model according to some embodiments of the present disclosure is shown; and

[0013] Figure 5 A block diagram of an electronic device capable of implementing several embodiments of the present disclosure is shown. Detailed Implementation

[0014] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0015] It should be noted that the headings of any section / subsection provided herein are not limiting. Various embodiments are described throughout this document, and embodiments of any type may be included under any section / subsection. Furthermore, embodiments described in any section / subsection may be combined in any way with any other embodiments described in the same section / subsection and / or different sections / subsections.

[0016] In the description of embodiments of this disclosure, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may also be included below. The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0017] The embodiments of this disclosure may involve user data, data acquisition, and / or use. All of these aspects comply with applicable laws, regulations, and relevant provisions. In the embodiments of this disclosure, all data collection, acquisition, processing, manipulation, forwarding, and use are conducted with the user's knowledge and confirmation. Accordingly, in implementing the embodiments of this disclosure, the type, scope of use, and usage scenarios of any data or information that may be involved should be communicated to the user and their authorization obtained in accordance with relevant laws and regulations through appropriate means. The specific methods of notification and / or authorization may vary depending on the actual situation and application scenario, and the scope of this disclosure is not limited in this respect.

[0018] In this specification and the embodiments, any processing of personal information will be carried out only under the premise of legality (such as obtaining the consent of the personal information subject, or being necessary for the performance of a contract), and will only be carried out within the scope stipulated or agreed upon. A user's refusal to process personal information other than that necessary for basic functions will not affect the user's use of basic functions.

[0019] The training quality of generative models directly affects the quality of the generated results. Traditional preference optimization processes require a large amount of manually labeled data, which significantly increases the training cost of generative models.

[0020] Embodiments of this disclosure propose a scheme for training a generative model. According to this scheme, training cues can be constructed. Furthermore, multiple rounds of iterative training can be performed based on the training cues.

[0021] Specifically, each round of iterative training may include: obtaining multiple response contents generated by the generative model based on training prompts; determining a first response content and a second response content from the multiple response contents based on the evaluation information of the multiple response contents, wherein the evaluation of the first response content is better than that of the second response content; and adjusting the parameters of the generative model to increase the first probability of outputting the first response content and decrease the second probability of outputting the second response content.

[0022] By performing multiple rounds of iterative training based on training cues, embodiments of this disclosure can not only improve data utilization efficiency and reduce training costs, but also improve the stability of the training process.

[0023] The following section provides a detailed description of various example implementations of this scheme, with reference to the accompanying drawings.

[0024] Example Environment

[0025] Figure 1 A schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented is shown. For example... Figure 1 As shown, example environment 100 may include electronic device 110.

[0026] In this example environment 100, the electronic device 110 can acquire a training prompt 120 and perform multiple rounds of iterative training on the generative model 120 based on the training prompt. In some embodiments, the training prompt 120 may be synthesized by an algorithm to reduce the construction cost of the training prompt.

[0027] In some embodiments, the generative model 120 can automatically generate text, images, music, and other content based on learned data. As an example, the generative model 120 may include a language model that can generate corresponding text content based on input prompts.

[0028] The specific training process for generative model 120 will be discussed in the following text. Figure 2 and Figure 3 Detailed description.

[0029] Electronic device 110 can be any type of mobile terminal, fixed terminal, or portable terminal, including mobile phones, desktop computers, laptop computers, notebook computers, netbook computers, tablet computers, media computers, multimedia tablets, handheld computers, portable gaming terminals, VR / AR devices, personal communication system (PCS) devices, personal navigation devices, personal digital assistants (PDAs), audio / video players, digital cameras / camcorders, positioning devices, television receivers, radio receivers, e-book devices, gaming devices, or any combination thereof, including accessories and peripherals of these devices or any combination thereof. In some embodiments, electronic device 110 can also support any type of user-facing interface (such as "wearable" circuitry).

[0030] Electronic device 110 can also be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks, and big data and artificial intelligence platforms. Electronic device 110 may include, for example, computing systems / servers, such as mainframes, edge computing nodes, computing devices in cloud environments, and so on.

[0031] It should be understood that the structure and function of the various elements in environment 100 are described for illustrative purposes only and do not imply any limitation on the scope of this disclosure.

[0032] The following description will continue with reference to the accompanying drawings, which will provide some exemplary embodiments of this disclosure.

[0033] Example process

[0034] Figure 2 A flowchart illustrating an example process 200 for training a generative model according to some embodiments of the present disclosure is shown. Process 200 can be implemented at electronic device 110. Reference is made below. Figure 1 To describe process 200.

[0035] As shown in the figure, in box 210, electronic device 110 constructs training prompts.

[0036] In some embodiments, as referenced Figure 1 The training cues discussed can be synthesized using a generative model. As an example, electronic device 110 can utilize self-instruction techniques to synthesize training cues. As another example, the training device uses a language model to generate instructions similar to human writing. By using synthesized instructions, embodiments of this disclosure can reduce the cost of constructing training data.

[0037] In some embodiments, the training cue can be generated by the generative model to be trained. Experiments have shown that training with synthetic instructions and responses generated by the current model yields optimal performance, which is competitive with performance when using human-written instructions.

[0038] Continue to refer to Figure 2 In box 220, electronic device 110 performs multiple rounds of iterative training based on training cues. In some embodiments, electronic device 110 may perform a predetermined number of iterations.

[0039] Specifically, boxes 230 to 250 illustrate an example process in each round of iterative training. Figure 2As shown in box 230, electronic device 110 acquires multiple response contents generated by the generative model based on training prompts.

[0040] The following will be referenced Figure 3 To describe the specific process of iterative training, Figure 3 Pseudocode for an iterative training process according to some embodiments of this disclosure is shown.

[0041] like Figure 3 As shown, electronic device 110 can perform T rounds of iterative training. During each round of iterative training, electronic device 110 can acquire multiple new instructions x. i (i.e., training tips).

[0042] Furthermore, the electronic device 110 can be based on training cues x i To generate N response items (Also known as candidate response).

[0043] Continue to refer to Figure 2 In box 240, electronic device 110 determines a first response content and a second response content from multiple response content based on the evaluation information of multiple response content, wherein the evaluation of the first response content is better than that of the second response content.

[0044] In some embodiments, the electronic device 110 may utilize an appropriate evaluation model to evaluate the multiple response contents output by the generative model. As an example, the electronic device 110 may utilize a Pairwise Response Model (PRM) to evaluate the multiple response contents.

[0045] Specifically, the electronic device 110 can sort multiple response contents based on evaluation information. Furthermore, the electronic device 110 can determine the first response content and the second response content based on the sorting result of the multiple response contents.

[0046] by Figure 3 As an example, electronic device 110 can utilize PairPM to respond to multiple content sources. Determine the content of the first response Second response content In some examples, the first response content It can be the best-rated response among multiple responses, and the second response. It can be the worst-rated response among multiple responses.

[0047] In some scenarios, the first response content It can also be called the accepted response content, or the second response content. This can also be referred to as a rejection response.

[0048] Continue to refer to Figure 2 In box 250, electronic device 110 adjusts the parameters of the generative model to increase the first probability of outputting the first response content and decrease the second probability of outputting the second response content.

[0049] Specifically, such as Figure 3 As shown, the electronic device 110 can iteratively adjust the parameters of the generative model by minimizing the following loss function.

[0050]

[0051] The loss function will be further introduced below. The specific process of determining this.

[0052] Traditionally, the loss function based on preference optimization can be expressed as:

[0053]

[0054] This represents the first preference information of the generative model to be trained, which is based on the generative model's selection of the better response content y. w The first probability of (i.e., the first response content) and the choice of a worse response content y l The second probability is determined by the ratio of the second probability of the second response content.

[0055] This represents the second preference information of the reference model to be trained, which is based on the reference model's selection of the better response content y. w The third probability of (i.e., the first response content) is compared with the probability of choosing a worse response content y. l The fourth probability is determined by the ratio of the second response content to the fourth probability.

[0056] In some embodiments, the reference model may correspond to the initial parameters of the generative model before multiple rounds of iterative training.

[0057] Furthermore, experiments show that iterative training further improves performance on synthetic data, but also exacerbates the problem of response length utilization. During iterative training, although the model's performance on benchmarks improves, the response length increases significantly, which may affect the model's usability and the accuracy of evaluation benchmarks.

[0058] Furthermore, embodiments of this disclosure optimize the training function of formula (2) to be expressed as formula (3):

[0059]

[0060] in:

[0061] w θ =σ(β((1-α)·s ref -s θ ))

[0062] =σ(β(s) ref -s θ -α·s ref (4)

[0063]

[0064] Specifically, formula (5) represents the determination of the first preference information s. θ The process; Formula (6) represents the determination of the second preference information s ref The process.

[0065] As shown in formula (4), electronic device 110 can base its decisions on the first preference information s. θ Second preference information ref The difference, determine the difference information s ref -s θ Furthermore, the electronic device 110 can also apply a preset weighting coefficient α to the second preference information s. ref To determine the third preference information α·s ref As an example, α can be greater than 0.

[0066] Therefore, electronic device 110 can be based on formula (3) and on the difference information s ref -s θ With third preference information α·s ref Determine the target loss.

[0067] Experimental results show that by introducing weighting coefficients related to the second preference information, the embodiments of this disclosure can effectively improve the performance of the model on multiple benchmark tests while controlling the growth of the response length.

[0068] During iterative training, the responses generated by the model may become increasingly similar, making it more difficult to distinguish between preferred and non-preferred responses. By adding a weight coefficient related to the difficulty of prediction by the reference model, embodiments of this disclosure can assign higher learning weights to those difficult-to-distinguish response pairs, i.e., hard examples. This prompts the model to pay more attention to these hard examples during training, thereby improving the model's discriminative ability.

[0069] Furthermore, for response pairs that the reference model can easily distinguish, embodiments of this disclosure reduce overemphasis on these easy cases by adjusting the weight coefficients. This relaxation helps prevent the model from wasting excessive learning resources on these obvious cases, thereby making the training process more efficient.

[0070] In some embodiments, the loss function shown in Equation (1) may also take into account the negative log-likelihood loss listed in Equation (7) and may ultimately be expressed as Equation (8).

[0071]

[0072] Where λ is the weighting coefficient.

[0073] Based on the process described above, the embodiments of this disclosure can not only improve data utilization efficiency and reduce training costs, but also improve the stability of the training process.

[0074] Example devices and equipment

[0075] Embodiments of this disclosure also provide corresponding apparatus for implementing the above methods or processes. Figure 4 A schematic structural block diagram of an example apparatus 500 for training a generative model according to certain embodiments of the present disclosure is shown. Apparatus 400 may be implemented as or included in electronic device 110. Various modules / components in apparatus 400 may be implemented by hardware, software, firmware, or any combination thereof.

[0076] like Figure 4 As shown, the apparatus 400 includes a construction module 410 configured to construct training cues; and a training module 420 configured to perform multiple rounds of iterative training based on the training cues. Specifically, each round of iterative training includes: acquiring multiple response contents generated by the generative model based on the training cues; determining a first response content and a second response content from the multiple response contents based on evaluation information of the multiple response contents, wherein the evaluation of the first response content is better than that of the second response content; and adjusting the parameters of the generative model to increase a first probability of outputting the first response content and decrease a second probability of outputting the second response content.

[0077] In some embodiments, the building module 410 is further configured to generate training prompts using a generative model.

[0078] In some embodiments, the training module 420 is further configured to: sort multiple response contents based on evaluation information; and determine a first response content and a second response content based on the sorting result of the multiple response contents.

[0079] In some embodiments, the first response content is the best-rated response content among multiple response content, and the second response content is the worst-rated response content among multiple response content.

[0080] In some embodiments, the training module 420 is further configured to: determine first preference information of the generative model based on a first probability and a second probability; determine second preference information of the reference model based on a third probability of the reference model outputting a first response content and a fourth probability of the reference model outputting a second response content; and determine a target loss based on the first preference information and the second preference information to adjust the parameters of the generative model.

[0081] In some embodiments, the training module 420 is further configured to: determine difference information based on the difference between the first preference information and the second preference information; apply preset weight coefficients to the second preference information to determine the third preference information; and determine the target loss based on the difference information and the third preference information.

[0082] In some embodiments, the parameters of the reference model correspond to the initial parameters of the generative pattern prior to multiple rounds of iterative training.

[0083] In some embodiments, the generative model is a language model, and the multiple response contents are text content.

[0084] Figure 5 A block diagram of an electronic device 500 in which one or more embodiments of the present disclosure may be implemented is shown. It should be understood that... Figure 5 The electronic device 500 shown is merely exemplary and should not be construed as limiting the functionality and scope of the embodiments described herein. Figure 5 The electronic device 500 shown can be used to achieve Figure 1 Electronic devices 110.

[0085] like Figure 5 As shown, electronic device 500 is in the form of a general-purpose electronic device. Components of electronic device 500 may include, but are not limited to, one or more processors or processing units 510, memory 520, storage device 530, one or more communication units 540, one or more input devices 550, and one or more output devices 560. Processing unit 510 may be a physical or virtual processor and is capable of performing various processes according to programs stored in memory 520. In a multiprocessor system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing capability of electronic device 500.

[0086] Electronic device 500 typically includes multiple computer storage media. Such media can be any accessible media that is accessible to electronic device 500, including but not limited to volatile and non-volatile media, removable and non-removable media. Memory 520 can be volatile memory (e.g., registers, cache, random access memory (RAM)), non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. Storage device 530 can be removable or non-removable media and can include machine-readable media, such as flash drives, disks, or any other media that can be used to store information and / or data and can be accessed within electronic device 500.

[0087] Electronic device 500 may further include additional removable / non-removable, volatile / non-volatile storage media. Although not explicitly stated... Figure 5 As shown, disk drives for reading from or writing to removable, non-volatile disks (e.g., "floppy disks") and optical disk drives for reading from or writing to removable, non-volatile optical disks can be provided. In these cases, each drive can be connected to a bus (not shown) via one or more data media interfaces. Memory 520 may include computer program product 525 having one or more program modules configured to perform various methods or actions of various embodiments of this disclosure.

[0088] Communication unit 540 enables communication with other electronic devices via a communication medium. Additionally, the functionality of components of electronic device 500 can be implemented using a single computing cluster or multiple computing machines capable of communicating via communication connections. Therefore, electronic device 500 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or another network node.

[0089] Input device 550 can be one or more input devices, such as a mouse, keyboard, trackball, etc. Output device 560 can be one or more output devices, such as a monitor, speaker, printer, etc. Electronic device 500 can also communicate with one or more external devices (not shown) via communication unit 540 as needed. These external devices include storage devices, display devices, etc., and can communicate with one or more devices that enable user interaction with electronic device 500, or with any device that enables electronic device 500 to communicate with one or more other electronic devices (e.g., network card, modem, etc.). Such communication can be performed via input / output (I / O) interface (not shown).

[0090] According to an exemplary implementation of this disclosure, a computer-readable storage medium is provided that stores computer-executable instructions thereon, wherein the computer-executable instructions are executed by a processor to implement the methods described above. According to an exemplary implementation of this disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, which are executed by a processor to implement the methods described above.

[0091] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0092] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0093] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions that execute on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0094] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0095] Various implementations of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is chosen to best explain the principles, practical applications, or improvements to technology in the market, or to enable others skilled in the art to understand the various implementations disclosed herein.

Claims

1. A method for training a generative model, comprising: constructing training prompts; and performing multiple rounds of iterative training based on the training prompts, wherein each round of iterative training comprises: obtaining multiple pieces of response content generated by a generative model based on the training prompts; determining, based on evaluation information of the multiple pieces of response content, a first piece of response content and a second piece of response content from the multiple pieces of response content, wherein the first piece of response content is evaluated better than the second piece of response content; and adjusting parameters of the generative model to increase a first probability of outputting the first piece of response content and decrease a second probability of outputting the second piece of response content.

2. The method of claim 1, wherein constructing training prompts comprises: generating the training prompts using the generative model.

3. The method of claim 1, wherein determining, based on evaluation information of the multiple pieces of response content, a first piece of response content and a second piece of response content from the multiple pieces of response content comprises: ranking the multiple pieces of response content based on the evaluation information; and determining the first piece of response content and the second piece of response content based on a ranking result of the multiple pieces of response content.

4. The method of claim 1, wherein the first piece of response content is a piece of response content with the best evaluation among the multiple pieces of response content, and the second piece of response content is a piece of response content with the worst evaluation among the multiple pieces of response content.

5. The method of claim 1, wherein adjusting parameters of the generative model comprises: determining first preference information of the generative model based on the first probability and the second probability; determining second preference information of a reference model based on a third probability of the reference model outputting the first piece of response content and a fourth probability of the reference model outputting the second piece of response content; and determining a target loss based on the first preference information and the second preference information to adjust the parameters of the generative model.

6. The method of claim 5, wherein determining a target loss based on the first preference information and the second preference information comprises: determining difference information based on a difference between the first preference information and the second preference information; applying a preset weight coefficient to the second preference information to determine third preference information; and determining the target loss based on the difference information and the third preference information.

7. The method of claim 5, wherein parameters of the reference model correspond to initial parameters of the generative model before the multiple rounds of iterative training.

8. The method of claim 1, wherein the generative model is a language model, and the multiple pieces of response content are text content.

9. An apparatus for training a generative model, comprising: a construction module configured to construct training prompts; and a training module configured to perform multiple rounds of iterative training based on the training prompts, wherein each round of iterative training comprises: obtaining multiple pieces of response content generated by a generative model based on the training prompts; ​ ​ ​ ​ ​ determine, from the evaluation information based on the multiple pieces of response content, a first piece of response content and a second piece of response content, wherein the first piece of response content is better evaluated than the second piece of response content; and adjust parameters of the generative model to increase a first probability of outputting the first piece of response content and decrease a second probability of outputting the second piece of response content.

10. An electronic device, comprising: at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions which, when executed by the at least one processing unit, cause the electronic device to perform the method according to any one of claims 1-8.

11. A computer-readable storage medium having stored thereon a computer program, the computer program being executable by a processor to implement the method according to any one of claims 1-8.