Vertical large model training method, device and equipment

By fine-tuning the domain-specific data sets and further fine-tuning the multi-task data sets on the general big model, the problem of insufficient accuracy in a specific field is solved, and the model's question-and-answer and reasoning capabilities in a specific field are improved, and it is suitable for specific fields. high precision requirements.

CN119067218APending Publication Date: 2024-12-03SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD

Patent Information

Application Number
CN202411089199.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-08
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

The general model is not very accurate in specific areas such as medical, finance, and policing, and needs special optimization to improve performance in specific areas.

Method used

By obtaining the instruction data set of the specified field, fine-tuning the pre-trained basic model, obtaining the initial model, and then further fine-tuning the initial model using the data sets of multiple natural language processing tasks to obtain the trained vertical model. Improve the model's Q&A and reasoning skills in specific fields.

Benefits of technology

Without using unsupervised data pre-training, inject domain-specific knowledge to improve the accuracy and general capabilities of the model in specific domains, and is suitable for scenarios where it is difficult to obtain unsupervised data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119067218A_ABST
    Figure CN119067218A_ABST
Patent Text Reader

Abstract

The invention provides a vertical large model training method, device and equipment. The method provided by the invention comprises the steps of obtaining a first instruction data set related to a specified field, and performing fine adjustment on a pre-trained basic large model by utilizing the first instruction data set to obtain an initial large model; wherein the pre-trained basic large model is not limited to pre-training by using unsupervised data related to a specified field; obtaining a second instruction data set related to the specified field; for each natural language processing task in a plurality of preset natural language processing tasks, acquiring a third instruction data set of each natural language processing task; and performing fine adjustment on the initial large model by utilizing the second instruction data set and a plurality of third instruction data sets of the plurality of natural language processing tasks to obtain a trained vertical large model. According to the vertical large model training method, device and equipment provided by the invention, the understanding, summarization and reasoning capabilities of the model can be improved, and the precision of the model in a specific field is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a vertical large model training method, device and equipment. Background Art

[0002] With the continuous development of science and technology, the training of general large models has made significant progress in recent years. General large models have been widely used in natural language processing, computer vision, speech recognition and other fields. However, in some specific fields, such as medical, financial and police work, the effect of general large models is still insufficient. Therefore, it is necessary to develop and optimize large models specifically for certain specific fields to improve the accuracy of large models in specific fields. Summary of the invention

[0003] In view of this, the present application provides a vertical large model training method, device and equipment to solve the problem of low accuracy of general large models in tasks in specific fields.

[0004] Specifically, the present application is implemented through the following technical solutions:

[0005] The first aspect of the present application provides a vertical large model training method, the method comprising:

[0006] Acquire a first instruction data set related to a specified field, and use the first instruction data set to fine-tune a pre-trained basic large model to obtain an initial large model; wherein the pre-trained basic large model is not limited to being pre-trained using unsupervised data related to the specified field;

[0007] Acquire a second instruction data set related to the specified field;

[0008] For each natural language processing task among the preset multiple natural language processing tasks, a third instruction data set of each natural language processing task is obtained; wherein each instruction data in the first instruction data set, the second instruction data set and the third instruction data set includes an instruction and a response to the instruction;

[0009] The initial large model is fine-tuned using the second instruction data set and multiple third instruction data sets of the multiple natural language processing tasks to obtain a trained vertical large model.

[0010] The second aspect of the present application provides a vertical large model training device, the device comprising an acquisition module and a processing module; wherein,

[0011] The acquisition module is used to acquire a first instruction data set related to a specified field;

[0012] The processing module is used to fine-tune the pre-trained basic large model using the first instruction data set to obtain an initial large model; wherein the pre-trained basic large model is not limited to being pre-trained using the unsupervised data related to the specified field;

[0013] The acquisition module is further used to acquire a second instruction data set related to the specified field;

[0014] The acquisition module is further used to acquire, for each natural language processing task among the preset multiple natural language processing tasks, a third instruction data set of each natural language processing task; wherein each instruction data in the first instruction data set, the second instruction data set and the third instruction data set includes an instruction and a response to the instruction;

[0015] The processing module is also used to fine-tune the initial large model using the second instruction data set and multiple third instruction data sets of the multiple natural language processing tasks to obtain a trained vertical large model.

[0016] The third aspect of the present application provides a vertical large model training device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any one of the methods provided in the first aspect of the present application are implemented.

[0017] The fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any one of the methods provided in the first aspect of the present application.

[0018] The vertical large model training method, device and equipment provided in the present application obtains a first instruction data set related to the instruction field, a second instruction data set related to the specified field, and a third instruction data set for each natural language processing task in a plurality of preset natural language processing tasks, and then uses the first instruction data set to fine-tune the pre-trained basic large model to obtain an initial large model, and then uses the second instruction data set and multiple third instruction data sets of the multiple natural language processing tasks to fine-tune the initial large model to obtain a trained vertical large model. In this way, without using the unsupervised data related to the specified field to pre-train the basic large model, the knowledge related to the specific field can be injected into the initial large model through the first stage of fine-tuning, and the question-answering ability of the large model in the specific field can be initially improved. Further, through the second stage of fine-tuning, the reasoning ability of the large model in the specific field and the general ability of the large model in the preset natural language processing tasks can be further improved. Further, through the migration ability of the large model, its general ability in the preset natural language processing tasks is generalized to the specific field, so as to improve the understanding, summarization and reasoning ability of the model and improve the accuracy of the model in the specific field. In addition, since this method does not require pre-training using unsupervised data related to the specified field, the training method can be adapted to specific scenarios where it is difficult to obtain relevant unsupervised data. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 A flowchart of Embodiment 1 of the vertical large model training method provided in this application;

[0020] Figure 2 A flowchart of Embodiment 2 of the vertical large model training method provided in this application;

[0021] Figure 3 A flowchart of Embodiment 3 of the vertical large model training method provided in this application;

[0022] Figure 4 A flowchart of Embodiment 4 of the vertical large model training method provided in this application;

[0023] Figure 5 A flowchart of Embodiment 5 of the vertical large model training method provided in this application;

[0024] Figure 6 A hardware structure diagram of the vertical large model training device where the vertical large model training device provided in this application is located;

[0025] Figure 7 This is a structural schematic diagram of Example 1 of the vertical large model training device provided in this application. DETAILED DESCRIPTION

[0026] Here, exemplary embodiments are described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application.

[0027] The terms used in this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more associated listed items.

[0028] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0029] Specific embodiments are given below to introduce the technical solution of the present application in detail.

[0030] Figure 1 This is a flowchart of the first embodiment of the vertical large model training method provided by this application. Please refer to Figure 1 , the method provided in this embodiment may include:

[0031] S101. Obtain a first instruction data set related to a specified field, and use the first instruction data set to fine-tune a pre-trained basic large model to obtain an initial large model; wherein the pre-trained basic large model is not limited to being pre-trained using unsupervised data related to the specified field.

[0032] Specifically, the designated field refers to a vertical data field, that is, the data in this field has a unique professional background and characteristics. For example, the designated field can be finance, medical care, police, etc. Further, which field the designated field specifically refers to is set according to actual needs, and in this embodiment, it is not limited. The following is an example of the designated field being the police field.

[0033] It should be noted that the first instruction data set includes multiple instruction data, each instruction data is data including an instruction and a response to the instruction. For example, in one embodiment, each instruction data is data including a question and an answer to the question. In this case, the question is the instruction in the instruction data, and the answer to the question is the response to the instruction.

[0034] Optionally, in a possible implementation, the number of instruction data included in the first instruction data set is greater than a preset threshold, that is, the instruction data included in the first instruction data set is sufficient. The specific value of the preset threshold is set according to actual needs and is not limited in this embodiment. For example, in a possible implementation, the preset threshold is 100 million.

[0035] In specific implementation, combined with the above example, for example, when the instruction field is the police field, in one possible implementation, police-related question and answer data can be collected from various sources, and then the collected question and answer data can be used as the first instruction data set. For another example, in another possible implementation, existing legal question and answer data can be obtained, and legal question and answer data can be constructed based on legal provisions or real legal cases, ruling documents, etc. to obtain the first instruction data set.

[0036] Furthermore, after obtaining the first instruction data, the first stage of fine-tuning is entered. During the first stage of fine-tuning, the pre-trained basic large model is fine-tuned using the first instruction data set to obtain an initial large model.

[0037] It should be noted that the pre-trained basic large model is not limited to being pre-trained using unsupervised data related to the specified field. For example, in one possible implementation, the initial basic large model can be pre-trained using unsupervised data related to the specified field to obtain a pre-trained basic large model. For another example, in another possible implementation, the initial basic large model can be pre-trained using unsupervised data related to other fields outside the specified field to obtain a pre-trained basic large model.

[0038] In a specific implementation, for example, in one possible implementation, the pre-trained basic large model may be a model pre-trained on a large-scale general corpus.

[0039] Furthermore, the specific implementation principle and process of fine-tuning the pre-trained basic large model using the first instruction data set can be found in the description of the relevant technology and will not be repeated here.

[0040] It should be noted that in the process of fine-tuning in the first stage, the pre-trained basic large model is fine-tuned using the first police-related instruction data set, which can inject basic knowledge in the field of police work into the basic large model, so that the fine-tuned initial large model has the ability to answer questions in the field of police work.

[0041] S102: Acquire a second instruction data set related to the designated field.

[0042] Specifically, the second instruction data set includes a plurality of instruction data, each instruction data is data including an instruction and a response to the instruction. For example, in one embodiment, each instruction data is data including a question and an answer to the question. Furthermore, the number of instruction data included in the second instruction data set is set according to actual needs and is not limited in this embodiment.

[0043] It should be noted that the first instruction data set is different from the second instruction data set. Optionally, in a possible implementation, the number of instruction data included in the first instruction data set is greater than the number of instruction data included in the second instruction data set, and the quality of each instruction data in the second instruction data set is better than the quality of each instruction data in the first instruction data set; wherein the quality is at least characterized by the accuracy of the response of the instruction relative to the instruction.

[0044] In a specific implementation, for example, in a possible implementation manner, question and answer data may be extracted from authoritative documents, and then a set consisting of the extracted question and answer data may be determined as the second instruction data set.

[0045] Optionally, for example, in another possible implementation, target instruction data that meets specified conditions can be screened out from the first instruction data set, and then the set of screened target instruction data is determined as the second instruction data set. The specified conditions are used to screen instruction data with better quality. For example, in one embodiment, the quality is characterized by the correctness check result. When the correctness check result is correct, it is characterized that the quality of the instruction data is excellent; when the correctness check result is wrong, it is characterized that the quality of the instruction data is poor. In specific implementation, each instruction data in the first instruction data set can be corrected to obtain a check result, and then when the check result is correct, the instruction data is determined to be the target instruction data.

[0046] It should be noted that, in this embodiment, the order of acquiring the first instruction data set and the second instruction data set is not limited, and the first instruction data set and the second instruction data set may be acquired simultaneously or at different times.

[0047] S103. For each natural language processing task among a plurality of preset natural language processing tasks, obtain a third instruction data set of each natural language processing task.

[0048] Specifically, the specific number of the preset multiple natural language processing tasks and the specific task type involved in each natural language processing task are set according to actual needs, and are not limited in this embodiment. For example, in one possible implementation, the preset multiple natural language processing tasks include three natural language processing tasks, which are keyword extraction tasks, entity recognition tasks, and text error correction tasks.

[0049] Furthermore, the third instruction data set includes a plurality of instruction data, and each instruction data is data including an instruction and a response to the instruction.

[0050] The method for obtaining the third instruction data set will be described in detail in the following embodiments and will not be described in detail here.

[0051] S104. Fine-tune the initial large model using the second instruction data set and multiple third instruction data sets of the multiple natural language processing tasks to obtain a trained vertical large model.

[0052] Specifically, after obtaining the second instruction data set and the third instruction data set of each natural language processing task, the second stage of fine-tuning begins. During the second stage of fine-tuning, the second instruction data set and the third instruction data set are combined to form a fine-tuning sample, which is further used to fine-tune the initial large model obtained by fine-tuning in the first stage, thereby obtaining a trained vertical large model.

[0053] It should be noted that the method provided in this embodiment uses the second instruction data set to fine-tune the initial large model during the second stage of fine-tuning, which can further improve the reasoning ability of the model and improve the accuracy of the model in answering questions in specific fields; in addition, during the second stage of fine-tuning, by obtaining the third instruction data set for each natural language processing task in the preset multiple natural language processing tasks, and then using the third instruction data set to fine-tune the initial large model, the general ability of the model in specific natural language processing tasks can be strengthened, and further through the migration ability of the large model, its general ability in specific natural language processing tasks can be generalized to specific fields (for example, generalized to the policing field), so as to improve the model's understanding, summarizing and reasoning capabilities, and improve the accuracy of the model in specific fields (for example, the policing field).

[0054] The vertical large model training method provided in this embodiment obtains a first instruction data set related to the instruction field, a second instruction data set related to the specified field, and a third instruction data set for each natural language processing task in a plurality of preset natural language processing tasks, and then uses the first instruction data set to fine-tune the pre-trained basic large model to obtain an initial large model, and then uses the second instruction data set and a plurality of third instruction data sets of the plurality of natural language processing tasks to fine-tune the initial large model to obtain a trained vertical large model. In this way, without using the unsupervised data related to the specified field to pre-train the basic large model, the knowledge related to the specific field can be injected into the initial large model through the first stage of fine-tuning, and the question-answering ability of the large model in the specific field can be initially improved. Further, through the second stage of fine-tuning, the reasoning ability of the large model in the specific field and the general ability of the large model in the preset natural language processing tasks can be further improved. Further, through the migration ability of the large model, its general ability in the preset natural language processing tasks can be generalized to the specific field, so as to improve the understanding, summarization and reasoning ability of the model and improve the accuracy of the model in the specific field.

[0055] In addition, the method provided in this embodiment does not need to use unsupervised data related to the specified field for pre-training, so the training method can be adapted to specific scenarios where it is difficult to obtain relevant unsupervised data.

[0056] Optionally, in a possible implementation, the quality of each instruction data in the second instruction data set is better than the quality of each instruction data in the first instruction data set; wherein, the quality is at least characterized by the response of the instruction relative to the accuracy of the instruction.

[0057] In the method provided in this embodiment, in the second stage, fine-tuning is performed using instruction data of higher quality, which can improve the understanding, summarization and reasoning capabilities of the large model and further improve the accuracy of the large model. In addition, fine-tuning the second stage using instruction data of higher quality can optimize the format of the large model's answer to questions.

[0058] Figure 2 This is a flowchart of Example 2 of the vertical large model training method provided by this application. Please refer to Figure 2 Based on the above embodiment, the designated field is the police field, and the step of obtaining the first instruction data set related to the designated field includes:

[0059] S201. Obtain a legal-related question-answering dataset.

[0060] Specifically, legal question-and-answer datasets can be obtained through existing public datasets, open source platforms, etc. For example, legal question-and-answer datasets can be obtained from existing public datasets such as OpenLegalData and AQUA.

[0061] In combination with the above introduction, for example, in one embodiment, three question-answering datasets are obtained through existing public datasets, open source platforms, etc. For the convenience of subsequent explanation, these three question-answering datasets are respectively recorded as S1, S2, and S3.

[0062] S202: For a specified legal document, obtain the provisions in the legal document.

[0063] Specifically, the designated legal document is set according to actual needs, and is not limited in this embodiment. For example, in a possible implementation, the designated legal document may be a legal document corresponding to current laws. For example, it may be a legal document corresponding to current laws such as the Criminal Law, the Constitution, and the Ming Code.

[0064] Furthermore, in a specific implementation, the specified legal document may be split based on a regular expression to separate each clause in the legal document.

[0065] S203: Convert each regulation into instruction data to obtain regulation instruction data corresponding to each regulation, and determine a set consisting of all regulation instruction data corresponding to all regulations in the legal document as a legal regulation instruction data set.

[0066] Specifically, each regulation can be divided into two parts, the first part as an instruction, and the second part as a response to the instruction, thereby converting the regulation into instruction data.

[0067] It should be noted that when the regulation is split, the regulation can be divided into two parts according to a preset split ratio, wherein the preset split ratio represents the ratio of the character length of the characters contained in the first part after the split to the character length of the characters contained in the second part after the split.

[0068] The preset split ratio is set according to actual needs and is not limited in this embodiment. For example, in a possible implementation, the preset split ratio is 1:9, that is, for a certain regulation, the first 10% of the regulation is used as the first part, and the remaining 90% of the regulation is output as the second part; for another example, in a possible implementation, the preset split ratio is 2:8, at this time, for a certain regulation, the first 20% of the regulation is used as the first part, and the remaining 80% of the regulation is used as the second part.

[0069] Combined with the above introduction, for example, in one embodiment, after a certain regulation is split, the first part is: Please complete the following text: Article 13 of the Personal Information Protection Law (2021) A personal information processor may process personal information only if one of the following circumstances is met: \n(i) Obtaining the individual's consent; \n(ii) Necessary for the conclusion and performance of a contract to which the individual is a party

[0070] The second part is: or necessary to implement human resource management in accordance with labor rules and regulations formulated in accordance with the law and collective contracts signed in accordance with the law;\n(iii) necessary to perform statutory duties or statutory obligations;\n(iv) necessary to respond to public health emergencies, or to protect the life, health and property safety of natural persons in emergency situations;\n(v) to implement news reporting, public opinion supervision and other activities for the public interest, and process personal information within a reasonable range;\n(vi) to process personal information that individuals have disclosed themselves or that has been legally disclosed within a reasonable range in accordance with the provisions of this Law;\n(vii) other circumstances prescribed by laws and administrative regulations.\nIn accordance with other relevant provisions of this Law, the processing of personal information shall obtain the consent of the individual, but in the case of the circumstances specified in the second to seventh items of the preceding paragraph, the consent of the individual is not required.

[0071] Further, the first part is combined with the corresponding requirement (for example, the corresponding requirement is: please complete the following text) as an instruction, and the second part is used as a response to the instruction. Thus, the regulation is converted into instruction data, and the regulation instruction data corresponding to the instruction data is obtained.

[0072] Specifically, after obtaining the regulation instruction data corresponding to all regulations, a set of all regulation instruction data corresponding to all regulations in the legal document is determined as a legal regulation instruction data set. For example, in one embodiment, for the convenience of description, the regulation instruction data set is recorded as S4.

[0073] S204: Use the question and answer dataset and the legal regulations instruction dataset as the first instruction dataset.

[0074] Specifically, in this step, the question and answer data set obtained in step S201 and the legal regulations instruction data set obtained in step S203 are combined as the first instruction data set. In combination with the above example, the set of S1, S2, S3, and S4 is determined as the first instruction data set.

[0075] The method provided in this embodiment obtains a legal-related question and answer dataset, and then for a specified legal document, obtains the regulations in the legal document, converts each regulation into instruction data, obtains the regulation instruction data corresponding to each regulation, and then determines a set consisting of all regulation instruction data corresponding to all regulations in the legal document as a legal regulation instruction dataset, and finally uses the question and answer dataset and the legal regulation instruction dataset as the first instruction dataset. In this way, a relatively complete, sufficient and comprehensive first instruction dataset can be constructed, ensuring that the data volume of the first instruction dataset is relatively large, so that the initial large model can fully learn the knowledge related to the specified field based on the first instruction dataset, that is, inject the knowledge related to the specified field into the initial large model, so that after the first stage of fine-tuning, the initial large model can have the question and answer capability in the specified field.

[0076] Figure 3 This is a flowchart of Example 3 of the vertical large model training method provided by this application. Please refer to Figure 3 Based on the above embodiment, the step of obtaining the second instruction data set related to the specified field includes:

[0077] S301. Filter out target instruction data satisfying specified conditions from the first instruction data set; wherein the quality of the filtered target instruction data is better than the quality of the unfiltered instruction data.

[0078] Specifically, the quality of the instruction data in the first instruction data set varies, and in order to improve the understanding, summarization and reasoning capabilities of the large model and improve the accuracy of the large model, in the process of fine-tuning in the second stage, it is necessary to ensure that the quality of the instruction data in the second instruction data set is better than the quality of the instruction data in the first instruction data set. Therefore, in this step, it is necessary to filter out the target instruction data that meets the specified conditions from the first instruction data set.

[0079] Specifically, the specified condition is set according to actual needs, and is not limited in this embodiment. For example, in one embodiment, the specified condition may be that the response of the instruction is correct relative to the instruction. That is, for a certain instruction data, if the response of the instruction therein is correct relative to the instruction therein, then the instruction data is the target instruction data that meets the specified condition; if the response of the instruction therein is wrong relative to the instruction therein, then the instruction data is not the target instruction data that meets the specified condition.

[0080] For another example, in another embodiment, the specified condition may include at least one of the following conditions:

[0081] Condition 1: Ability to accurately understand the question and answer it;

[0082] Condition 2: If the answer can refer to the corresponding legal provisions, the corresponding legal provisions need to be given in the answer;

[0083] Condition 3: No additional information appears in the answer.

[0084] The specific content of the additional information is set according to actual needs and is not limited in this embodiment. For example, in a possible implementation, the additional information may be information such as advertisements.

[0085] In combination with the above introduction, for example, in one possible implementation, the specified condition may include any one of the following conditions, that is, the specified condition may be condition 1, condition 2 or condition 3; for another example, in another possible implementation, the specified condition includes condition 1, condition 2 and condition 3 at the same time, that is, an instruction data is the target instruction data only when it satisfies condition 1, condition 2 and condition 3 at the same time.

[0086] Referring to the foregoing introduction, it can be understood that the quality of the filtered target instruction data is better than the quality of the unfiltered instruction data, that is, the filtered target instruction data has better accuracy and better response.

[0091] S302: Extract question and answer data from authoritative documents to obtain document question and answer data.

[0092] Specifically, authoritative documents refer to documents that are widely recognized, frequently cited, and written by credible publishing organizations or experts in a specified field. For example, authoritative documents can be academic documents, professional books, and formal publications, etc., which are not limited in this embodiment. For example, when the authoritative document is a professional book, the professional book can be "Newly Compiled 1000 Questions on Common Legal Knowledge (Lawyer Q&A Edition)" and the like.

[0093] Combined with the above introduction, in this step, you can extract question and answer data from books such as "Newly Compiled 1000 Questions on Common Legal Knowledge (Lawyer Q&A Edition)".

[0094] It should be noted that the data format of the authoritative literature is in epub format, and the data in epub format can be read by a program to extract the question and answer data from it. Specifically, for data in epub format, the question text generally appears in <h2>< / h2> Between the tags, the answer text usually appears Between tags, questions and answers can be extracted from them through iterative traversal based on specific tags to obtain question and answer data (for the convenience of explanation, this article will refer to the question and answer data extracted from authoritative literature as literature question and answer data).

[0095] S303: Determine a set consisting of the target instruction data and the document question and answer data as the second instruction data set.

[0096] Specifically, after obtaining the target instruction data and the document question and answer data, in this step, the target instruction data and the document question and answer data are integrated, and the set consisting of the target instruction data and the document question and answer data is determined as the second instruction data set.

[0097] The method provided in this embodiment obtains literature question and answer data by screening out target instruction data with better quality from the first instruction data set, and extracting question and answer data from authoritative literature, and then determining the set consisting of the target instruction data and the literature question and answer data as the second instruction data set. In this way, the quality of the second instruction data set can be guaranteed, and it can be determined that each instruction data in the second instruction data set is high-quality instruction data. When the second instruction data set is subsequently used for the second stage of fine-tuning, due to the better quality of the second instruction data set, not only can the understanding, summarization and reasoning capabilities of the large model be further improved, but also its accuracy can be further improved.

[0098] Figure 4 This is a flowchart of Example 4 of the vertical large model training method provided by this application. Please refer to Figure 4 Based on the above embodiment, the step of obtaining the third instruction data set for each natural language processing task includes:

[0099] S401. Obtain an original task data set of the natural language processing task; wherein each original task data in the original task data set is supervised and non-instruction data.

[0100] Referring to the previous description, the specific number of preset multiple natural language processing tasks and the specific task types involved in each natural language processing task are set according to actual needs. For example, in one embodiment, the preset multiple natural language processing tasks include 11 natural language processing tasks, and the task types of these 11 natural language processing tasks are keyword extraction, relationship extraction, product copywriting generation, entity recognition, sentiment analysis, mathematical calculation, text error correction, title generation, question matching, reading comprehension single choice, and food safety classification.

[0101] Specifically, keyword extraction refers to extracting the words or phrases that best represent the content of the text from the text. The original task data in the keyword extraction task contains the text and its corresponding keywords or phrases. For example, the text is a news article summary, and the keywords are vaccination, community transmission, etc.

[0102] Relation extraction refers to identifying the relationship between entities from text. The original task data in the relationship extraction task contains the relationship between entity pairs in the text; for example, the text is a medical report, and the relationship between entities is disease-treatment method, symptom-disease, etc.

[0103] Product copy generation refers to the automatic generation of product description copy. The original task data in the product copy generation task includes the product description and its associated product features; for example, describing the product features of a mobile phone and its function introduction.

[0104] Entity recognition refers to identifying and classifying entities in text. The original task data in the entity recognition task includes the entities and their categories that appear in the text; for example, the text is a news report, and the entities are person names, place names, etc.

[0105] Sentiment analysis refers to analyzing the emotional tendencies in text, such as positive, negative, and neutral emotions. The original task data in the sentiment analysis task is text containing emotional labels; for example, the text is a movie review, and the emotional labels are positive, negative, and neutral.

[0106] Mathematical calculation refers to processing mathematical expressions in text and performing calculations. The original task data in a mathematical calculation task contains text expressions or problems that require mathematical calculations; for example, the text is a mathematical problem and the calculation result is a numerical solution.

[0107] Text correction refers to identifying and correcting spelling and grammatical errors in text. The original task data in the text correction task contains text with spelling or grammatical errors and its corrected version; for example, the text is an erroneous academic paper abstract, and the corrected version is the revised abstract.

[0108] Title generation refers to generating a suitable title based on the text content. The original task data in the title generation task contains the text content and its generated title; for example, the text is a science and technology news report, and the generated title is the article title.

[0109] Question matching refers to matching user questions with existing questions and answers. The original task data in the question matching task contains the question and its corresponding best answer or related information of the question; for example, the question is a list of frequently asked questions and the answer is the question solution.

[0110] Reading comprehension multiple-choice refers to answering multiple-choice questions based on given reading materials. The original task data in the reading comprehension multiple-choice task contains the article and its related multiple-choice questions and answers; for example, the article is educational material, the multiple-choice question is the question and its options, and the answer is the correct answer.

[0111] Food safety classification refers to the classification of food safety-related texts, such as safety, risk, etc. The original task data in the food safety classification task contains food-related texts and their safety classification labels; for example, the text is a food safety report, and the classification labels are safety, risk, etc.

[0112] Referring to the previous introduction, it can be understood that the original task data set refers to the initial training sample set used when training the natural language processing task. Further, referring to the previous introduction, it can be seen that each original task data includes samples and corresponding labels or answers, which is a supervised data. In addition, although each original task data carries a label, it is not in the strict sense of the instruction plus the instruction response format, that is, each original task data does not exist in the form of instruction data, and it is not instruction data.

[0113] In this embodiment, in order to fine-tune the initial large model, it needs to be converted into instruction data. The conversion method will be introduced in the following steps and will not be repeated here.

[0114] S402. According to the construction template corresponding to the natural language processing task, each original task data in the original task data set of the natural language processing task is constructed into instruction data to obtain instruction task data corresponding to the original task data.

[0115] Specifically, different natural language processing tasks correspond to different construction templates. The construction template corresponding to each natural language processing task is set according to actual needs, and is not limited in this embodiment.

[0116] Furthermore, the construction template is a template for converting input non-command data into final output command data. The construction template includes input commands and output command responses.

[0117] The following takes entity recognition as an example to illustrate the specific form of the construction template. For entity recognition, when setting the corresponding construction template, it is necessary to clarify the task to be performed, then the type of entity to be extracted and the expected output, and finally the output is used to construct the response of the generation instruction.

[0118] In the specific implementation, the instruction is: You need to perform a named entity recognition task. Given a list of entity types, you need to extract the corresponding entities in the list of entity types from the text. Output in json format, with specific fields of [{"entity type 1":["entity 1","entity 2"]},{"entity type 2":["entity 1","entity 2"]},...]. If there is no corresponding entity, return []. \nEntity type list: ['address','book title','company','game','government','movie','name','organization','position','attraction']\nText: A citizen named Zhang who made an appointment registration in Tianping Street, Xuhui District said: "Such a price is very attractive, and low-income families can also afford it."\nNow please perform entity recognition based on the text; the response of the instruction is: [{"address":["Xuhui District Tianping Street"]}].

[0119] It should be noted that each instruction data in the third instruction data set is data including an instruction and a response to the instruction; for example, the instruction data is data including a question and an answer to the question.

[0120] For another example, in a text correction task, the construction template can be: the instruction is that you need to perform a text correction task to correct the words, grammar, punctuation, etc. in the input text to make it read more smoothly without grammatical errors. If there are no errors in the input text, directly output "no". According to this construction template, the response to the instruction is: the modified input text content.

[0121] It should be noted that the construction templates corresponding to other natural language processing tasks are similar to the above ones, and will not be described in detail in this embodiment. Further, for each natural language processing task, the corresponding template can be used to construct each original task data in the original task data set of the natural language processing task into instruction data, and obtain the instruction task data corresponding to the original task data.

[0122] S403: Determine a set consisting of all instruction task data corresponding to all original task data as a third instruction data set of the natural language processing task.

[0123] Specifically, after step S402 , after ensuring that the formats of all instruction task data corresponding to all original task data are consistent, a set consisting of all instruction task data corresponding to all original task data is determined as the third instruction data set.

[0124] The method provided in this embodiment obtains the original task data set of the natural language processing task, and constructs each original task data in the original task data set of the natural language processing task into instruction data according to the construction template corresponding to the natural language processing task, obtains the instruction task data corresponding to the original task data, and then determines the set consisting of all instruction task data corresponding to all original task data as the third instruction data set of the natural language processing task. In this way, the third instruction data set of the natural language processing task can be quickly obtained, so as to use the third instruction data set to perform fine-tuning in the second stage to improve the general ability of the model in natural language processing tasks, for example, to improve its general abilities such as information extraction, text classification, and text summarization, and then generalize the general abilities to tasks in specific fields through the migration ability of the large model, and improve the model's understanding, summarization and reasoning abilities in specific fields.

[0125] Figure 5 This is a flowchart of Example 5 of the vertical large model training method provided by this application. Please refer to Figure 5 Based on the above embodiment, the vertical large model training method includes:

[0126] S501. Obtain a legal-related question-and-answer dataset.

[0127] S502: For a specified legal document, obtain the provisions in the legal document.

[0128] S503: Convert each regulation into instruction data to obtain regulation instruction data corresponding to each regulation, and determine a set consisting of all regulation instruction data corresponding to all regulations in the legal document as a legal regulation instruction data set.

[0129] S504: Use the question and answer dataset and the legal regulations instruction dataset as the first instruction dataset.

[0130] The specific implementation principles and implementation structures of steps S501 to S504 can be found in the previous introduction and will not be repeated here.

[0131] S505: Filter each instruction data in the first instruction data set according to a preset filtering rule.

[0132] Specifically, the quality of the instruction data in the first instruction data set is uneven. For example, the answers to some instruction data are not complete, and the answers to some instruction data lack the confirmation of relevant laws and regulations.

[0133] The method provided in this embodiment filters the first instruction data set according to a preset filtering rule in order to improve the data quality in the first instruction data set.

[0134] The preset filtering rules are set according to actual needs and are not limited in this embodiment. For example, in a possible implementation, the preset filtering rules include at least one of the following rules:

[0135] (1) Check the basic format of the data; the basic format of the data must be the format of the command plus the response of the command. If it is incomplete, the data is discarded.

[0136] (2) Checking the integrity of the data; for example, if the length of the response of an instruction in a certain instruction data is less than a preset threshold, the instruction data is discarded.

[0137] (3) Checking the content format of the data; for example, if the number of special characters, spaces, or line breaks contained in the response to the instruction exceeds a preset threshold, the data is discarded.

[0138] Combined with the above introduction, for example, in a possible implementation, the preset filtering rule is to check the content format of the instruction data. If the instruction response of a certain instruction data in the first instruction data set contains too many special characters, the instruction data is discarded; for another example, in a possible implementation, the preset filtering rule is to check the integrity of the instruction data. If the character length of the instruction response of a certain instruction data in the first instruction data set is lower than a preset threshold, the instruction data is discarded. For another example, in a possible implementation, the preset filtering rule includes the above three rules at the same time, that is, the instruction data that meets the above three filtering rules at the same time will not be filtered out.

[0139] S506. Fine-tune the pre-trained basic large model using the first instruction data set to obtain an initial large model; wherein the pre-trained basic large model is not limited to being pre-trained using unsupervised data related to the specified field.

[0140] S507. Filter out target instruction data that meets specified conditions from the first instruction data set; wherein the quality of the filtered target instruction data is better than the quality of the unfiltered instruction data.

[0141] Optionally, in a possible implementation, the specified condition may be used as a prompt word, and a large model may be used to identify whether each instruction data in the first instruction data set meets the specified condition.

[0142] S508. Extract question and answer data from authoritative documents to obtain document question and answer data.

[0143] S509: Determine a set consisting of the target instruction data and the document question and answer data as the second instruction data set.

[0144] S510, obtaining an original task data set of the natural language processing task; wherein each original task data in the original task data set is supervised, non-instruction data.

[0145] S511. According to the construction template corresponding to the natural language processing task, each original task data in the original task data set of the natural language processing task is constructed into instruction data to obtain instruction task data corresponding to the original task data.

[0146] S512: Determine a set consisting of all instruction task data corresponding to all original task data as a third instruction data set for the natural language processing task.

[0147] S513. Fine-tune the initial large model using the second instruction data set and multiple third instruction data sets of the multiple natural language processing tasks to obtain a trained vertical large model.

[0148] The specific implementation principles and implementation structures of steps S506 to S511 can be found in the previous introduction and will not be repeated here.

[0149] The method provided in this embodiment can filter each instruction data in the first instruction data set to eliminate instruction data that does not meet the requirements and inject knowledge in a specific field into the initial large model.

[0150] Corresponding to the aforementioned embodiment of a vertical large model training method, the present application also provides an embodiment of a vertical large model training device.

[0151] The embodiment of a vertical large model training device of the present application can be applied to a vertical large model training device. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of the vertical large model training device in which it is located reading the corresponding computer program instructions in the non-volatile memory into the memory and running them. From the hardware level, if Figure 6 As shown, it is a hardware structure diagram of the vertical large model training device provided by this application, except Figure 6 In addition to the processor, memory, network interface, and non-volatile memory shown, the vertical large model training device where the device in the embodiment is located may also include other hardware based on the actual function of the vertical large model training device, which will not be described in detail.

[0152] Figure 7 This is a structural diagram of the first embodiment of the vertical large model training device provided by this application. Figure 7 The device provided in this embodiment includes an acquisition module 710 and a processing module 720; wherein,

[0153] The acquisition module 710 is used to acquire a first instruction data set related to a specified field;

[0154] The processing module 720 is used to fine-tune the pre-trained basic large model using the first instruction data set to obtain an initial large model; wherein the pre-trained basic large model is not limited to being pre-trained using the unsupervised data related to the specified field;

[0155] The acquisition module 710 is further used to acquire a second instruction data set related to the specified field;

[0156] The acquisition module 710 is further configured to acquire, for each natural language processing task among the preset multiple natural language processing tasks, a third instruction data set for each natural language processing task; wherein each instruction data in the first instruction data set, the second instruction data set, and the third instruction data set includes an instruction and a response to the instruction;

[0157] The processing module 720 is also used to fine-tune the initial large model using the second instruction data set and multiple third instruction data sets of the multiple natural language processing tasks to obtain a trained vertical large model.

[0158] The device of this embodiment can be used to perform Figure 1 The steps, specific implementation principles and implementation processes of the method embodiment shown are similar and will not be repeated here.

[0159] The acquisition module 710 is specifically used for:

[0160] Obtain legal-related question-answering datasets;

[0161] For a specified legal document, obtain the provisions in the legal document;

[0162] Convert each regulation into instruction data to obtain regulation instruction data corresponding to each regulation, and determine a set consisting of all regulation instruction data corresponding to all regulations in the legal document as a legal regulation instruction data set;

[0163] The question and answer dataset and the legal regulations instruction dataset are used as the first instruction dataset.

[0164] The acquisition module 710 is specifically used for:

[0165] Filtering target instruction data that meets specified conditions from the first instruction data set; wherein the quality of the filtered target instruction data is better than the quality of the unfiltered instruction data;

[0166] Extract question-answer data from authoritative literature to obtain literature question-answer data;

[0167] A set consisting of the target instruction data and the document question and answer data is determined as the second instruction data set.

[0168] The acquisition module 710 is specifically used for:

[0169] Obtaining an original task data set of the natural language processing task; wherein each original task data in the original task data set is supervised, non-instruction data;

[0170] According to the construction template corresponding to the natural language processing task, each original task data in the original task data set of the natural language processing task is constructed into instruction data to obtain instruction task data corresponding to the original task data;

[0171] A set consisting of all instruction task data corresponding to all original task data is determined as the third instruction data set of the natural language processing task.

[0172] The processing module 720 is further used to filter each instruction data in the first instruction data set according to a preset filtering rule before using the first instruction data set to fine-tune the pre-trained basic large model.

[0173] Please continue to refer to Figure 6 The present application also provides a vertical large model training device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any one of the methods provided in the first aspect of the present application are implemented.

[0174] The present application also provides a computer-readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the steps of any one of the methods provided in the present application are implemented.

[0175] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0176] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.

[0177] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A vertical large model training method, It is characterized in that The method comprises: Acquire a first instruction data set related to a specified field, and use the first instruction data set to fine-tune a pre-trained basic large model to obtain an initial large model; wherein the pre-trained basic large model is not limited to being pre-trained using unsupervised data related to the specified field; Acquire a second instruction data set related to the specified field; For each natural language processing task among the preset multiple natural language processing tasks, a third instruction data set of each natural language processing task is obtained; wherein each instruction data in the first instruction data set, the second instruction data set and the third instruction data set includes an instruction and a response to the instruction; The initial large model is fine-tuned using the second instruction data set and multiple third instruction data sets of the multiple natural language processing tasks to obtain a trained vertical large model.

2. The method according to claim 1, It is characterized in that Before fine-tuning the pre-trained basic large model using the first instruction data set, the method further includes: Each instruction data in the first instruction data set is filtered according to a preset filtering rule.

3. The method according to claim 1, It is characterized in that The quality of each instruction data in the second instruction data set is better than the quality of each instruction data in the first instruction data set; wherein the quality is at least characterized by the response of the instruction relative to the accuracy of the instruction.

4. The method according to claim 1, It is characterized in that The designated field is a police field, and obtaining a first instruction data set related to the designated field includes: Obtain legal-related question-answering datasets; For a specified legal document, obtain the provisions in the legal document; Convert each regulation into instruction data to obtain regulation instruction data corresponding to each regulation, and determine a set consisting of all regulation instruction data corresponding to all regulations in the legal document as a legal regulation instruction data set; The question and answer dataset and the legal regulations instruction dataset are used as the first instruction dataset.

5. The method according to claim 1, It is characterized in that The step of obtaining a second instruction data set related to the specified field includes: Filtering target instruction data that meets specified conditions from the first instruction data set; wherein the quality of the filtered target instruction data is better than the quality of the unfiltered instruction data; Extract question-answer data from authoritative literature to obtain literature question-answer data; A set consisting of the target instruction data and the document question and answer data is determined as the second instruction data set.

6. The method according to claim 1, It is characterized in that The obtaining of the third instruction data set for each natural language processing task includes: Obtaining an original task data set of the natural language processing task; wherein each original task data in the original task data set is supervised, non-instruction data; According to the construction template corresponding to the natural language processing task, each original task data in the original task data set of the natural language processing task is constructed into instruction data to obtain instruction task data corresponding to the original task data; A set consisting of all instruction task data corresponding to all original task data is determined as the third instruction data set of the natural language processing task.

7. The method according to claim 5, It is characterized in that The step of screening out target instruction data satisfying a specified condition from the first instruction data set includes: The specified condition is used as a prompt word, and a large model is used to identify whether each instruction data in the first instruction data set meets the specified condition.

8. A vertical large model training device, It is characterized in that The device comprises an acquisition module and a processing module; wherein, The acquisition module is used to acquire a first instruction data set related to a specified field; The processing module is used to fine-tune the pre-trained basic large model using the first instruction data set to obtain an initial large model; wherein the pre-trained basic large model is not limited to being pre-trained using the unsupervised data related to the specified field; The acquisition module is further used to acquire a second instruction data set related to the specified field; The acquisition module is further used to acquire, for each natural language processing task among the preset multiple natural language processing tasks, a third instruction data set of each natural language processing task; wherein each instruction data in the first instruction data set, the second instruction data set and the third instruction data set includes an instruction and a response to the instruction; The processing module is also used to fine-tune the initial large model using the second instruction data set and multiple third instruction data sets of the multiple natural language processing tasks to obtain a trained vertical large model.

9. A vertical large model training device, It is characterized in that The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 7 when executing the program.

10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Liver cancer auxiliary diagnosis and question answering method and system based on large language model and medium

    CN116975241A

  • Training method, text reasoning method and system for big language model of OTA scene

    CN117787257A

  • Vertical domain large language model training method and related equipment

    CN117828401A

  • Semi-supervised model training method and system, and related device

    WO2023202596A1

Cited By

  • Digital intelligent treatment auxiliary method based on generative AI large model

    CN120278403A