A method and apparatus for training a vertical domain large language model

By introducing hooks during the training process of a vertical domain large language model, multi-stage associated training samples are constructed, which solves the problem of incomplete understanding of vertical domain knowledge by vertical domain LLM and improves the performance and application capabilities of the model.

CN123178535APending Publication Date: 2026-11-27ALIBABA (CHINA) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611063624.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-16
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing vertical domain large language models (LLMs) suffer from poor performance due to incomplete understanding of vertical domain knowledge caused by separate training at each stage, making it difficult to perform deep reasoning and implement business specifications.

Method used

By acquiring knowledge documents from vertical domains to generate hooks, constructing multi-stage training samples, and introducing hook associations at each stage, pre-training, supervised fine-tuning, and reinforcement learning are performed to establish the intrinsic connection of knowledge injection.

Benefits of technology

It improves the performance of large language models in vertical domains, enhances the understanding and application of knowledge in vertical domains, and improves the practicality and robustness of the model in real-world scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178535A_ABST
    Figure CN123178535A_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a method and device for training a vertical domain large language model. In the embodiments of the present application, a plurality of first training samples are generated by obtaining a vertical domain knowledge document and a first hook; a pre-trained large language model is generated by pre-training a basic large language model according to the first training samples; a plurality of second training samples are generated according to a plurality of first questions and a second hook generated according to the pre-trained large language model; a supervised fine-tuned large language model is generated according to the second training samples; a plurality of third training samples are generated according to a plurality of second questions and a third hook generated according to the pre-trained large language model; and a target large language model is generated by reinforcement learning of the supervised fine-tuned large language model according to the third training samples. Through the above method, the hook association exists between the training samples at different stages, the knowledge injection is systematically performed in the training process, and the performance of the vertical domain large language model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more specifically, to a method and apparatus for training a large vertical language model. Background Technology

[0002] With the development of Large Language Models (LLMs), the aforementioned LLMs are designed for all scenarios, with broad knowledge, balanced comprehension and generation capabilities, and are good at everyday conversations, general writing, common sense reasoning, and basic question answering. They are not industry-biased and have strong versatility, but they have problems such as insufficient professional depth, outdated domain knowledge, and unfamiliarity with industry rules. As a result, vertical domain LLMs have been developed. The aforementioned vertical domain LLMs focus on a single professional scenario. Compared with the aforementioned LLMs, they have solid professional knowledge and can solve more complex professional problems.

[0003] In existing technologies, the LLM is trained using domain corpus to generate the vertical domain LLM. In the specific training process, knowledge injection is performed for each training stage, and different stages are trained separately. This results in the vertical domain LLM not being able to fully understand the domain knowledge of the vertical domain, making it difficult to carry out deep reasoning that conforms to business specifications and to implement various tasks, resulting in poor overall performance.

[0004] In conclusion, improving the performance of vertical domain LLM is a problem that needs to be solved. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a method and apparatus for training a vertical domain large language model, which can improve the performance of the vertical domain large language model LLM.

[0006] In a first aspect, embodiments of the present invention provide a method for training a vertical domain large language model, the method comprising: acquiring a vertical domain knowledge document; generating a first hook based on the vertical domain knowledge document, wherein the vertical domain knowledge document includes multiple knowledge items; generating multiple first training samples based on the vertical domain knowledge document and the first hook; pre-training a basic large language model based on the multiple first training samples to generate a pre-trained large language model; generating multiple first questions based on the pre-trained large language model and generating a second hook based on the vertical domain knowledge document, wherein the first questions are related to the first hook; generating multiple second training samples based on the multiple first questions and the second hook; performing supervised fine-tuning on the pre-trained large language model based on the multiple second training samples to generate a supervised fine-tuned large language model; generating multiple second questions based on the pre-trained large language model and generating a third hook based on the vertical domain knowledge document; generating multiple third training samples based on the multiple second questions and the third hook; and performing reinforcement learning on the supervised fine-tuned large language model based on the multiple third training samples to generate a target large language model.

[0007] Optionally, generating the first hook based on the vertical domain knowledge document specifically includes: inputting the vertical domain knowledge document and the first prompt word into the variable generation model to generate the first hook.

[0008] Optionally, generating multiple first training samples based on the vertical domain knowledge document and the first hook specifically includes: binding each piece of knowledge in the vertical domain knowledge document to the first hook to generate the first training sample.

[0009] Optionally, generating the second hook based on the vertical domain knowledge document specifically includes: inputting the vertical domain knowledge document and the second prompt word into the variable generation model to generate the second hook.

[0010] Optionally, generating multiple second training samples based on the multiple first questions and the second hook specifically includes: inputting each first question into the answer generation model to generate a first answer corresponding to the first question; binding the first question, the first answer, and the second hook to generate the second training sample.

[0011] Optionally, generating the third hook based on the vertical domain knowledge document specifically includes: inputting the vertical domain knowledge document and the third prompt word into the variable generation model to generate the third hook.

[0012] Optionally, generating multiple third training samples based on the multiple second questions and the third hook specifically includes: inputting each second question into the fine-tuned large language model and outputting a second answer; inputting the second question, the second answer, and the third hook into a reward model and outputting at least two reward scores; and in response to the reward scores being greater than or equal to a set threshold, binding the second question, the second answer, and the third hook to generate the third training samples.

[0013] Optionally, the method further includes: in response to the reward score being less than a set threshold, further fine-tuning the supervised fine-tuning of the large language model.

[0014] Secondly, embodiments of the present invention provide an apparatus for training a vertical domain large language model, the apparatus comprising: a first generation unit, configured to acquire a vertical domain knowledge document and generate a first hook based on the vertical domain knowledge document, wherein the vertical domain knowledge document includes multiple knowledge items; the first generation unit is further configured to generate multiple first training samples based on the vertical domain knowledge document and the first hook; a training unit, configured to pre-train a basic large language model based on the multiple first training samples to generate a pre-trained large language model; and a second generation unit, configured to generate multiple first questions based on the pre-trained large language model and generate a second hook based on the vertical domain knowledge document, wherein the first questions and the first hook are linked. The training unit is further configured to generate multiple second training samples based on the multiple first questions and the second hook; the training unit is further configured to perform supervised fine-tuning on the pre-trained large language model based on the multiple second training samples to generate a supervised fine-tuned large language model; the third generation unit is configured to generate multiple second questions based on the pre-trained large language model and generate a third hook based on the vertical domain knowledge document; the third generation unit is further configured to generate multiple third training samples based on the multiple second questions and the third hook; the training unit is further configured to perform reinforcement learning on the supervised fine-tuned large language model based on the multiple third training samples to generate a target large language model.

[0015] Optionally, the first generation unit is specifically used to: input the vertical domain knowledge document and the first prompt word into the variable generation model to generate the first hook.

[0016] Optionally, the first generation unit is further configured to: bind each piece of knowledge in the vertical domain knowledge document to the first hook to generate the first training sample.

[0017] Optionally, the second generation unit is specifically used to: input the vertical domain knowledge document and the second prompt word into the variable generation model to generate the second hook.

[0018] Optionally, the second generation unit is further configured to: input each of the first questions into the answer generation model to generate the first answer corresponding to the first question; bind the first question, the first answer and the second hook to generate the second training sample.

[0019] Optionally, the third generation unit is specifically used to: input the vertical domain knowledge document and the third prompt word into the variable generation model to generate the third hook.

[0020] Optionally, the third generation unit is further configured to: input each of the second questions into the fine-tuned large language model and output a second answer; input the second question, the second answer, and the third hook into a reward model and output at least two reward scores; and, in response to the reward scores being greater than or equal to a set threshold, bind the second question, the second answer, and the third hook to generate the third training sample.

[0021] Optionally, the third generation unit is further configured to: in response to the reward score being less than a set threshold, further fine-tune the supervised fine-tuning of the large language model.

[0022] Thirdly, embodiments of the present invention provide an electronic device, including a memory and a processor, wherein the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method as described in the first aspect or any one of the possible methods of the first aspect.

[0023] Fourthly, embodiments of the present invention provide a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the method as described in the first aspect or any one of the possibilities of the first aspect.

[0024] In this embodiment of the invention, a vertical domain knowledge document is acquired, and a first hook is generated based on the vertical domain knowledge document; multiple first training samples are generated based on the vertical domain knowledge document and the first hook; a basic large language model is pre-trained based on the multiple first training samples to generate a pre-trained large language model; multiple first questions are generated based on the pre-trained large language model, and a second hook is generated based on the vertical domain knowledge document; multiple second training samples are generated based on the multiple first questions and the second hook; supervised fine-tuning of the pre-trained large language model is performed based on the multiple second training samples to generate a supervised fine-tuned large language model; multiple second questions are generated based on the pre-trained large language model, and a third hook is generated based on the vertical domain knowledge document; multiple third training samples are generated based on the multiple second questions and the third hook; reinforcement learning is performed on the supervised fine-tuned large language model based on the multiple third training samples to generate a target large language model. Through the above method, hook associations exist between the sample data used in the three stages of training the vertical domain large language model, realizing the intrinsic connection of knowledge at each stage, systematically injecting knowledge, and improving the performance of the vertical domain large language model. Attached Figure Description

[0025] The above and other objects, features and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings, in which: Figure 1 This is a flowchart of a method for training a large vertical language model according to an embodiment of the present invention; Figure 2 This is a flowchart of another method for training a large vertical language model in an embodiment of the present invention; Figure 3 This is a schematic diagram of a device for training a large vertical language model according to an embodiment of the present invention; Figure 4 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0026] The present application is described below based on embodiments, but it is not limited to these embodiments. In the detailed description of the present application below, certain specific details are described in detail. Those skilled in the art can fully understand the present application without these details. To avoid obscuring the substance of the present application, well-known methods, processes, flows, elements, and circuits are not described in detail.

[0027] Furthermore, those skilled in the art should understand that the accompanying drawings provided herein are for illustrative purposes only and are not necessarily drawn to scale.

[0028] Unless the context explicitly requires it, words such as "including" or "contains" throughout the application should be interpreted as including rather than exclusive or exhaustive; that is, meaning "including but not limited to".

[0029] In the description of this application, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this application, unless otherwise stated, "a plurality of" means two or more.

[0030] In existing technologies, open-source large language models (LLMs) are trained using massive domain-specific corpora to generate the aforementioned vertical domain LLMs. However, the training process of these LLMs involves continuous pre-training (CPT), supervised fine-tuning (SFT), and reinforcement learning (RL) stages. Each stage involves single-stage knowledge injection without considering the interrelationships between stages or a systematic knowledge injection approach. This knowledge injection refers to using technical means to overcome the limitation of LLMs possessing only general common sense, enabling them to learn and master specific industry standards, business logic, or internal documents. The separate training at different stages results in the aforementioned vertical domain LLMs failing to fully understand the domain knowledge of their respective vertical domains. This hinders their ability to perform deep reasoning that conforms to business specifications and to achieve various tasks, severely restricting their practicality and robustness in real-world complex scenarios. Consequently, the overall performance of these vertical domain LLMs is poor. The vertical domains of these LLMs include content security, financial regulation, and medical review, among others. Therefore, improving the performance of vertical domain LLMs is a problem that needs to be addressed.

[0031] In this embodiment of the invention, the LLM mentioned above refers to a deep learning model with a large number of parameters that is pre-trained on massive amounts of text and has powerful natural language understanding, generation and reasoning capabilities. It is widely used in tasks such as question answering, content creation, and code generation. The LLM can also be called a large model, model, etc.

[0032] In this embodiment of the invention, to address the aforementioned problems, a method for training a large vertical-domain language model is proposed, specifically as follows: Figure 1 As shown, the method includes: Step S101: Obtain the vertical domain knowledge document and generate the first hook point based on the vertical domain knowledge document.

[0033] Specifically, the vertical domain knowledge document includes multiple knowledge items.

[0034] Assuming that the vertical domain knowledge document can also be a vertical domain knowledge document, each knowledge in the vertical domain knowledge document can construct some encyclopedic corpus or popular science corpus, etc., the encyclopedic corpus or popular science corpus only contains descriptive descriptions and does not include the description of the problem.

[0035] In one possible implementation, generating the first hook based on the vertical domain knowledge document specifically includes: inputting the vertical domain knowledge document and the first prompt word into a variable generation model to generate the first hook; specifically, the first hook is a variable, and the hook can also be called a hook; the first hook generated based on the vertical domain knowledge document can be "a certain group's public opinion risk judgment standard library". When generating the first hook, the first prompt word can explicitly indicate that the generated hook cannot have too strong a template (pattern) and needs to maintain the diversity of the first hook. This is only an illustrative example. Specifically, the corresponding hook is generated based on the vertical domain and the vertical domain knowledge document.

[0036] Step S102: Generate multiple first training samples based on the vertical domain knowledge document and the first hook.

[0037] Specifically, each piece of knowledge in the vertical domain knowledge document is bound to the first hook to generate the first training sample.

[0038] In one possible implementation, each knowledge-constructed encyclopedia corpus or popular science corpus is bound to the first hook, and the first hook is made at any position in the front end, back end, or middle of the encyclopedia corpus or popular science corpus, depending on the actual situation.

[0039] Step S103: Pre-train the basic large language model based on multiple first training samples to generate a pre-trained large language model.

[0040] Step S104: Generate multiple first questions based on the pre-trained large language model, and generate second hooks based on the vertical domain knowledge documents.

[0041] Specifically, the first problem is related to the first hook.

[0042] In one possible implementation, generating the second hook based on the vertical domain knowledge document specifically includes: inputting the vertical domain knowledge document and the second prompt word into a variable generation model to generate the second hook; wherein, the second hook is a variable, and the second hook generated based on the vertical domain knowledge document can be "a certain group's public opinion risk assessment standard library" or other content, which is determined according to the actual situation. When generating the second hook, the second prompt word can explicitly indicate that the granularity of the generated hook should be as detailed as possible. This is only an illustrative example, and the corresponding hook is generated based on the vertical domain and the vertical domain knowledge document.

[0043] Step S105: Generate multiple second training samples based on the multiple first questions and the second hook.

[0044] Specifically, each of the first questions is input into the answer generation model to generate the first answer corresponding to the first question; the first question, the first answer, and the second hook are bound together to generate the second training sample.

[0045] In one possible implementation, the answer generation model is a strong large language model. Since the question input to the answer generation model is related to the first hook, the generated first answer is also related to the first hook. The first answer includes the specific reasoning process. Binding the first question, the first answer, and the second hook can generate a test set for the large language model after subsequent test supervision and fine-tuning, in addition to generating the second training sample.

[0046] Step S106: Perform supervised fine-tuning on the pre-trained large language model based on multiple second training samples to generate a supervised fine-tuned large language model.

[0047] In this embodiment of the invention, the above processing procedure can determine that there is an inherent relationship between the first training sample and the second training sample, so that the knowledge injection in the pre-training stage and the supervised fine-tuning stage of the large language model is related.

[0048] Step S107: Generate multiple second questions based on the pre-trained large language model, and generate a third hook based on the vertical domain knowledge document.

[0049] Specifically, the vertical domain knowledge document and the third prompt word are input into the variable generation model to generate the third hook. The third hook is a variable, and the third hook generated based on the vertical domain knowledge document can be "details for judging public opinion scenarios of a certain group" or other content, which is determined according to the actual situation. When generating the third hook, the third prompt word can clearly indicate the requirements of the generated hook content. This is only an example. The corresponding hook is generated based on the vertical domain and the vertical domain knowledge document.

[0050] Step S108: Generate multiple third training samples based on the multiple second questions and the third hook.

[0051] In one possible implementation, the process of generating multiple third training samples based on the multiple second questions and the third hook is as follows: Figure 2 As shown, it includes the following: Step S201: Input each of the second questions into the fine-tuned large language model and output the second answer.

[0052] Step S202: Input the second question, the second answer, and the third hook into the reward model and output at least two reward scores.

[0053] In one possible implementation, assuming the vertical domain is a security domain, the reward score can be used to indicate whether security knowledge was used, the consistency between the security knowledge used and the answer, or whether the answer is correct, etc., depending on the actual situation.

[0054] In one possible implementation, step S203 or step S204 is performed according to the reward score.

[0055] Step S203: In response to the reward score being greater than or equal to a set threshold, the second question, the second answer, and the third hook are bound together to generate the third training sample.

[0056] Step S204: In response to the reward score being less than a set threshold, the supervised fine-tuned large language model is fine-tuned again.

[0057] In one possible implementation, the goal of fine-tuning the supervised large language model is to adjust the reward score in a positive direction.

[0058] In this embodiment of the invention, the above method can be used to generate a third training sample for use in the reinforcement learning phase.

[0059] Step S109: Perform reinforcement learning on the supervised fine-tuned large language model based on multiple third training samples to generate the target large language model.

[0060] Through the above embodiments, a hook is set in the first training sample in the pre-training (CPT) stage and the hook is acquired in the supervised fine-tuning (SFT) stage, thus establishing the intrinsic connection between the knowledge in the CPT and SFT stages. In the reinforcement learning (RL) stage, by constructing knowledge-related rewards, the ability of the vertical domain large model to apply knowledge is further stimulated, thereby improving the overall performance of the vertical domain large model.

[0061] In this embodiment of the invention, an apparatus for training a large vertical language model is provided, such as... Figure 3 As shown, it specifically includes: a first generation unit 301, a training unit 302, a second generation unit 303, and a third generation unit 304; The first generation unit 301 is configured to acquire a vertical domain knowledge document and generate a first hook based on the vertical domain knowledge document, wherein the vertical domain knowledge document includes multiple knowledge items; the first generation unit 301 is further configured to generate multiple first training samples based on the vertical domain knowledge document and the first hook; the training unit 302 is configured to pre-train a basic large language model based on the multiple first training samples to generate a pre-trained large language model; the second generation unit 303 is configured to generate multiple first questions based on the pre-trained large language model and generate a second hook based on the vertical domain knowledge document, wherein the first questions are related to the first hook; the second generation unit 303 is further configured to... The training unit 302 is configured to generate multiple second training samples based on the multiple first questions and the second hook; the training unit 302 is further configured to perform supervised fine-tuning on the pre-trained large language model based on the multiple second training samples to generate a supervised fine-tuned large language model; the third generation unit 304 is configured to generate multiple second questions based on the pre-trained large language model and generate a third hook based on the vertical domain knowledge document; the third generation unit 304 is further configured to generate multiple third training samples based on the multiple second questions and the third hook; the training unit 302 is further configured to perform reinforcement learning on the supervised fine-tuned large language model based on the multiple third training samples to generate a target large language model.

[0062] Furthermore, the first generation unit is specifically used to: input the vertical domain knowledge document and the first prompt word into the variable generation model to generate the first hook.

[0063] Furthermore, the first generation unit is specifically used to: bind each piece of knowledge in the vertical domain knowledge document to the first hook to generate the first training sample.

[0064] Furthermore, the second generation unit is specifically used to: input the vertical domain knowledge document and the second prompt word into the variable generation model to generate the second hook.

[0065] Furthermore, the second generation unit is specifically used to: input each of the first questions into the answer generation model to generate the first answer corresponding to the first question; bind the first question, the first answer and the second hook to generate the second training sample.

[0066] Furthermore, the third generation unit is specifically used to: input the vertical domain knowledge document and the third prompt word into the variable generation model to generate the third hook.

[0067] Furthermore, the third generation unit is specifically used to: input each of the second questions into the fine-tuned large language model and output a second answer; input the second question, the second answer, and the third hook into the reward model and output at least two reward scores; and in response to the reward scores being greater than or equal to a set threshold, bind the second question, the second answer, and the third hook to generate the third training sample.

[0068] Furthermore, the third generation unit is specifically used to: in response to the reward score being less than a set threshold, to fine-tune the supervised fine-tuning of the large language model again.

[0069] Figure 4 This is a schematic diagram of the structure of the electronic device described in an embodiment of the present invention. Figure 4As shown, it includes a general computer hardware architecture, which includes at least a processor 401 and a memory 402. The processor 401 and the memory 402 are connected via a bus 403. The memory 402 is adapted to store instructions or programs executable by the processor 401. The processor 401 can be a standalone microprocessor or a collection of one or more microprocessors. Thus, the processor 401 executes the instructions stored in the memory 402 to perform the method flow of the embodiments of the present invention as described above, thereby realizing data processing and control of other devices. The bus 403 connects the above-mentioned components together, and also connects the above-mentioned components to the display controller 404, the display device, and the input / output (I / O) device 405. The input / output (I / O) device 405 can be a mouse, keyboard, modem, network interface, touch input device, motion-sensing input device, printer, and other devices known in the art. Typically, the input / output device 405 is connected to the system via an input / output (I / O) controller 406.

[0070] The instructions stored in memory 402 are executed by at least one processor 401 to achieve the following: acquiring a vertical domain knowledge document; generating a first hook based on the vertical domain knowledge document; generating multiple first training samples based on the vertical domain knowledge document and the first hook; pre-training a basic large language model based on the multiple first training samples to generate a pre-trained large language model; generating multiple first questions based on the pre-trained large language model, and generating a second hook based on the vertical domain knowledge document; generating multiple second training samples based on the multiple first questions and the second hook; performing supervised fine-tuning on the pre-trained large language model based on the multiple second training samples to generate a supervised fine-tuned large language model; generating multiple second questions based on the pre-trained large language model, and generating a third hook based on the vertical domain knowledge document; generating multiple third training samples based on the multiple second questions and the third hook; and performing reinforcement learning on the supervised fine-tuned large language model based on the multiple third training samples to generate a target large language model.

[0071] Specifically, the electronic device includes: one or more processors 401 and a memory 402. Figure 4 Take a processor 401 as an example. The processor 401 and the memory 402 can be connected via a bus or other means. Figure 4Taking a bus connection as an example, memory 402, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Processor 401 executes various functional applications and data processing of the device by running the non-volatile software programs, instructions, and modules stored in memory 402, thereby realizing the above-mentioned method for determining the training domain large language model.

[0072] Memory 402 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function; the data storage area may store an option list, etc. Furthermore, memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 402 may optionally include memory remotely located relative to processor 401, and these remote memories may be connected to external devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0073] One or more modules are stored in memory 402, and when executed by one or more processors 401, they perform the method for training a large vertical language model in any of the above method embodiments.

[0074] As those skilled in the art will recognize, various aspects of the embodiments of the present invention can be implemented as a system, method, or computer program product. Therefore, various aspects of the embodiments of the present invention can take the form of a completely hardware implementation, a completely software implementation (including firmware, resident software, microcode, etc.), or an implementation combining software and hardware aspects, which may generally be referred to herein as a "circuit," "module," or "system." Furthermore, various aspects of the embodiments of the present invention can take the form of a computer program product implemented in one or more computer-readable media having computer-readable program code implemented thereon.

[0075] Any combination of one or more computer-readable media can be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, (but not limited to) an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination thereof. More specific examples (not an exhaustive list) of computer-readable storage media will include: an electrical connection having one or more wires, a portable computer floppy disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable optical disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the context of embodiments of the present invention, a computer-readable storage medium can be any tangible medium capable of containing or storing a program used by or in conjunction with an instruction execution system, device, or apparatus.

[0076] Computer-readable signal media may include propagated digital signals having computer-readable program code implemented therein, such as in baseband or as part of a carrier wave. Such propagated signals may take any of a variety of forms, including, but not limited to, electromagnetic, optical, or any suitable combination thereof. A computer-readable signal medium may be any computer-readable medium that is not a computer-readable storage medium and can communicate, propagate, or transmit a program used by or in conjunction with an instruction execution system, device, or apparatus.

[0077] Program code implemented on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, fiber optic cable, RF, or any suitable combination thereof.

[0078] Computer program code for performing operations relating to various aspects of embodiments of the present invention can be written in any combination of one or more programming languages, including: object-oriented programming languages ​​such as Java, Smalltalk, C++, etc.; and conventional procedural programming languages ​​such as the "C" programming language or similar programming languages. The program code can be executed as a standalone software package entirely on the user's computer, partially on the user's computer, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet provided by an Internet service provider).

[0079] The flowchart illustrations and / or block diagrams of the methods, apparatus (systems), and computer program products according to embodiments of the present invention describe various aspects of the embodiments of the present invention. It will 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 program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus to produce a machine such that the instructions (executed via the processor of the computer or other programmable data processing apparatus) create means for implementing the functions / actions specified in the flowchart and / or block diagram blocks or blocks.

[0080] These computer program instructions may also be stored in a computer-readable medium that can direct a computer, other programmable data processing apparatus or other means to operate in a particular manner, such that the instructions stored in the computer-readable medium produce an article of writing that includes instructions that implement the functions / actions specified in flowchart and / or block diagram blocks or blocks.

[0081] Computer program instructions may also be loaded onto a computer, other programmable data processing apparatus or other device to cause a series of operable steps to be performed on the computer, other programmable apparatus or other device to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide for implementing the functions / actions specified in flowchart and / or block diagram blocks or blocks.

[0082] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

[0083] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, and displayed data) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use, and processing of such data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding access points are provided for users to choose to authorize or refuse processing. A user's refusal to process personal information beyond what is necessary for basic functions will not affect the user's use of basic functions.

Claims

1. A method for training a large vertical language model, characterized in that, The method includes: Obtain a vertical domain knowledge document, and generate a first hook point based on the vertical domain knowledge document, wherein the vertical domain knowledge document includes multiple knowledge items; Multiple first training samples are generated based on the vertical domain knowledge document and the first hook; The basic large language model is pre-trained based on multiple first training samples to generate a pre-trained large language model. Multiple first questions are generated based on the pre-trained large language model, and a second hook is generated based on the vertical domain knowledge document, wherein the first questions are related to the first hook; Multiple second training samples are generated based on the multiple first questions and the second hook; The pre-trained large language model is supervised fine-tuned based on multiple second training samples to generate a supervised fine-tuned large language model. Multiple second questions are generated based on the pre-trained large language model, and a third hook is generated based on the vertical domain knowledge document; Multiple third training samples are generated based on the multiple second questions and the third hook; Reinforcement learning is performed on the supervised fine-tuned large language model based on multiple third training samples to generate the target large language model.

2. The method according to claim 1, characterized in that, The step of generating the first hook based on the vertical domain knowledge document specifically includes: The vertical domain knowledge document and the first prompt word are input into the variable generation model to generate the first hook.

3. The method according to claim 1, characterized in that, The step of generating multiple first training samples based on the vertical domain knowledge document and the first hook specifically includes: Each piece of knowledge in the vertical domain knowledge document is bound to the first hook to generate the first training sample.

4. The method according to claim 1, characterized in that, The step of generating a second hook based on the vertical domain knowledge document specifically includes: The vertical domain knowledge document and the second prompt word are input into the variable generation model to generate the second hook.

5. The method according to claim 1, characterized in that, The generation of multiple second training samples based on the multiple first questions and the second hook specifically includes: Each of the first questions is input into the answer generation model to generate the first answer corresponding to the first question; The first question, the first answer, and the second hook are bound together to generate the second training sample.

6. The method according to claim 1, characterized in that, The generation of a third hook based on the vertical domain knowledge document specifically includes: The vertical domain knowledge document and the third prompt word are input into the variable generation model to generate the third hook.

7. The method according to claim 1, characterized in that, The generation of multiple third training samples based on the multiple second questions and the third hook specifically includes: Each of the second questions is input into the finely tuned large language model, and the second answer is output. Input the second question, the second answer, and the third hook into the reward model and output at least two reward scores; In response to the reward score being greater than or equal to a set threshold, the second question, the second answer, and the third hook are bound together to generate the third training sample.

8. The method according to claim 7, characterized in that, The method further includes: In response to the reward score being less than a set threshold, the supervised fine-tuned large language model is fine-tuned again.

9. An apparatus for training a large vertical language model, characterized in that, The device includes: The first generation unit is used to obtain a vertical domain knowledge document and generate a first hook based on the vertical domain knowledge document, wherein the vertical domain knowledge document includes multiple knowledge items. The first generation unit is further configured to generate multiple first training samples based on the vertical domain knowledge document and the first hook; The training unit is used to pre-train the basic large language model based on multiple first training samples to generate a pre-trained large language model. The second generation unit is used to generate multiple first questions based on the pre-trained large language model and generate a second hook based on the vertical domain knowledge document, wherein the first questions are related to the first hook; The second generation unit is further configured to generate a plurality of second training samples based on the plurality of first questions and the second hook; The training unit is also used to perform supervised fine-tuning of the pre-trained large language model based on multiple second training samples to generate a supervised fine-tuned large language model. The third generation unit is used to generate multiple second questions based on the pre-trained large language model and to generate a third hook based on the vertical domain knowledge document. The third generation unit is further configured to generate a plurality of third training samples based on the plurality of second questions and the third hook; The training unit is also used to perform reinforcement learning on the supervised fine-tuned large language model based on multiple third training samples to generate a target large language model.

10. An electronic device comprising a memory and a processor, characterized in that, The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1-8.