Training method and application method for cross-domain large language model

By introducing training methods of domain classifiers and initial expert adapters in large language models, we build the target large language model, solving the problems of reduced performance and high cost in cross-domain data training, and achieving efficient processing and specific processing of multi-domain data Performance in the field has improved.

CN119025911APending Publication Date: 2024-11-26Artificial Intelligence and Robotics Innovation Center of Hong Kong Institute of Innovation, Chinese Academy of Sciences
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410901192.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

When training large language models on cross-domain data, the prior art has problems of reduced performance and high training costs, and traditional methods are difficult to effectively utilize potential connections between different fields.

Method used

Using training samples for cross-domain tasks, the initial expert adapter is trained by introducing domain classifiers and initial expert adapters, and the target expert adapter is built, and the target large language model is built with large language models and domain classifiers, and the domain classifier is used to extract features. Vector and computational similarity determine the target domain and weights, and perform weighted summing to improve model performance.

Benefits of technology

Without increasing the computing burden, the performance of the target large language model in multiple domain tasks is effectively improved, the effective processing of multi-domain data is achieved, the universality of the model is maintained while improving the performance of specific domains is solved, and the data imbalance is solved question.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025911A_ABST
    Figure CN119025911A_ABST
Patent Text Reader

Abstract

The invention provides a training method and an application method for a cross-domain large-scale language model, and relates to the technical field of artificial intelligence. The training method applies a training sample of a cross-domain task, introduces a domain classifier and an initial expert adapter, and trains the initial expert adapter to obtain a cross-domain task; according to the method, the problems of numerous related parameters, high training cost and the like caused by direct fine tuning of the large language model in the prior art can be avoided, the performance of the finally obtained target large language model on multiple field tasks can be effectively improved on the premise of not increasing excessive calculation burden, effective processing of multi-field data is realized, and the training efficiency is improved. Therefore, while the universality of the target large language model is maintained, the performance of the target large language model in a specific field is improved. Moreover, the method applies a domain classifier, and does not need to consider the problem of extremely unbalanced data when cross-domain task fine tuning is performed for corpus matching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a training method and an application method for a large-scale cross-domain language model. Background Art

[0002] In recent years, large language models have achieved remarkable results on a variety of tasks. Large language models have demonstrated excellent capabilities in understanding and generating natural language text by pre-training on large datasets. However, in order to optimize the performance of large language models on tasks in specific fields, further fine-tuning is often required. This process is particularly complex when faced with mixed corpora from multiple fields: using existing fine-tuning methods to train on cross-domain data may result in reduced performance of large language models in certain specific fields.

[0003] In addition, in traditional methods, fine-tuning the model for each specific field is not only difficult to effectively manage and deploy in practical applications, but also fails to fully utilize the potential connections between different fields. Although merging multiple models and treating each model as an "expert" with knowledge in a specific field is a relatively effective strategy, this method involves many parameters and high training costs, which is not conducive to practical applications.

[0004] Therefore, there is an urgent need to provide a method that can efficiently improve the performance of large language models in multiple fields. Summary of the invention

[0005] The present invention provides a training method and an application method for a large-scale cross-domain language model, so as to solve the defects existing in the related technology.

[0006] The present invention provides a training method for a large-scale cross-domain language model, comprising: Determine a training sample for a cross-domain task, wherein the training sample includes question data and answer label data; Inputting the question data into a large language model and a domain classifier respectively, obtaining an initial question answer output by the large language model and a classification result output by the domain classifier; Determining an initial expert adapter corresponding to the classification result, and determining an initial expert answer to the question data based on the initial expert adapter; Based on the initial question answer and the initial expert answer, initial answer data is obtained, and based on the initial answer data and the answer label data, initial expert adapters in various fields are trained to obtain target expert adapters; A target large language model is constructed based on the large language model, the domain classifier, and the target expert adapter.

[0007] According to a training method for a large cross-domain language model provided by the present invention, the classification result includes a target domain to which the problem data belongs and a weight corresponding to the target domain; Input the problem data into the domain classifier to obtain the classification result output by the domain classifier, including: The problem data is input into the field classifier, which extracts the feature vector of the problem data and calculates the similarity between the feature vector and the standard feature vector of each field, and takes a preset number of fields with high similarity as the target fields, and takes the similarity corresponding to the target fields as the weight.

[0008] According to a training method for a large-scale cross-domain language model provided by the present invention, the standard feature vectors of each domain are determined based on the following steps: Each problem data in the training sample is input into the field classifier respectively to obtain the feature vector of each problem data, and the feature vector of each problem data is averaged according to the field label of each problem data to obtain the standard feature vector of each field.

[0009] According to a training method for a large cross-domain language model provided by the present invention, the classification result includes the target domain to which the question data belongs and the weight corresponding to the target domain; the question data is input into an initial domain classifier to obtain the classification result output by the initial domain classifier, and further includes: Input the problem data into the field classifier, obtain the probability that the problem data output by the field classifier belongs to each field, and use a preset number of fields with high probabilities as the target fields, and use the probabilities corresponding to the target fields as the weights; The domain classifier is trained based on the question data and the domain labels it carries.

[0010] According to a training method for a large cross-domain language model provided by the present invention, the classification result includes the target domain to which the question data belongs and the weight corresponding to the target domain; the initial expert answer to the question data is determined based on the initial expert adapter, including: Inputting the question data into the initial expert adapter of the target domain to obtain an adapter answer output by the initial expert adapter of the target domain; Based on the weight corresponding to the target domain, the adapter answers are weighted summed to obtain the initial expert answer.

[0011] The present invention also provides an application method for a large-scale cross-domain language model, including: Get questions to be answered; Inputting the question to be answered into a target large language model to obtain answer information output by the target large language model; The target large language model is obtained based on the above-mentioned training method for a cross-domain large language model.

[0012] The present invention also provides a training device for a large-scale cross-domain language model, comprising: A sample determination module, used to determine training samples for cross-domain tasks, wherein the training samples include question data and answer label data; A model answer classification module, used to input the question data into a large language model and a domain classifier respectively, to obtain an initial question answer output by the large language model and a classification result output by the domain classifier; An expert answer module, used to determine an initial expert adapter corresponding to the classification result, and determine an initial expert answer to the question data based on the initial expert adapter; An adapter training module, used to obtain initial answer data based on the initial question answer and the initial expert answer, and to train the initial expert adapters in each field based on the initial answer data and the answer label data to obtain a target expert adapter; A model building module is used to build a target large language model based on the large language model, the domain classifier and the target expert adapter.

[0013] The present invention also provides an application device for a large-scale cross-domain language model, which is characterized by comprising: A question acquisition module is used to obtain questions to be answered; A question answering module, used for inputting the question to be answered into a target large language model, and obtaining answer information output by the target large language model; The target large language model is obtained based on the above-mentioned training method for a cross-domain large language model.

[0014] The present invention also provides an electronic device, comprising 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 processor implements any of the above-described training methods for large-scale cross-domain language models or application methods for large-scale cross-domain language models.

[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements any of the above-described training methods for a large-scale cross-domain language model or application methods for a large-scale cross-domain language model.

[0016] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned training methods for a large-scale cross-domain language model, or application methods for a large-scale cross-domain language model.

[0017] The present invention provides a training method and application method for a large-scale cross-domain language model. The training method uses training samples of cross-domain tasks, introduces a domain classifier and an initial expert adapter, and trains the initial expert adapter. This method can avoid the problems of many parameters and high training costs caused by directly fine-tuning a large-scale language model in the prior art. Without increasing too much computational burden, the performance of the target large-scale language model obtained in multiple domain tasks can be effectively improved, and effective processing of multi-domain data can be achieved, thereby maintaining the universality of the target large-scale language model while improving its performance in specific fields. Moreover, the method uses a domain classifier, and there is no need to consider the problem of extremely unbalanced data when corpus matching is performed in fine-tuning of cross-domain tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the present invention or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 It is a flowchart of the training method for a large-scale cross-domain language model provided by the present invention.

[0020] Figure 2 It is a schematic diagram of the structure of a target large language model in the training method for a cross-domain large language model provided by the present invention.

[0021] Figure 3 It is a flowchart of the application method for a large-scale cross-domain language model provided by the present invention.

[0022] Figure 4 It is a schematic diagram of the structure of a training device for a large-scale cross-domain language model provided by the present invention.

[0023] Figure 5 It is a schematic diagram of the structure of an application device for a large-scale cross-domain language model provided by the present invention.

[0024] Figure 6 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0026] Since the prior art has the disadvantages of high training cost and poor performance when applying large language models to multiple fields, an embodiment of the present invention provides a training method for a large cross-domain language model.

[0027] Figure 1 A flowchart of a training method for a large-scale cross-domain language model provided in an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method includes: S11, determining a training sample for a cross-domain task, wherein the training sample includes question data and answer label data; S12, inputting the question data into a large language model and a domain classifier respectively, obtaining an initial question answer output by the large language model and a classification result output by the domain classifier; S13, determining an initial expert adapter corresponding to the classification result, and determining an initial expert answer to the question data based on the initial expert adapter; S14, obtaining initial answer data based on the initial question answer and the initial expert answer, and training the initial expert adapters in each field based on the initial answer data and the answer label data to obtain a target expert adapter; S15, constructing a target large language model based on the large language model, the domain classifier and the target expert adapter.

[0028] Specifically, the training method for a large-scale cross-domain language model provided in an embodiment of the present invention is executed by a training device for a large-scale cross-domain language model, which can be configured in a computer, which can be a local computer or a cloud computer. The local computer can be a computer, a tablet, etc., which is not specifically limited here.

[0029] First, execute step S11 to determine training samples for cross-domain tasks. Cross-domain tasks refer to training samples involving multiple fields. The training samples may include multiple training samples, each of which may include question data and answer label data, and the answer label data may involve multiple fields.

[0030] For example, cross-domain tasks may involve fields including, but not limited to, finance, medicine, law, etc. Tasks in the financial field may include analyzing market trends and risk assessment; tasks in the medical field may include medical record analysis; and tasks in the legal field may include case studies and contract review.

[0031] For example, in the large field of medicine, multiple departments may be involved, and each department may include multiple types of data, such as tabular data, text data, and multimodal imaging data. Text data may include knowledge question and answer data, and data from different departments may belong to different fields.

[0032] Then, step S12 is executed to input the question data into the large language model and the domain classifier (DomainClassifier) ​​respectively, and the initial question answer corresponding to the question data is generated by using the generation capability of the large language model. For example, the question data is x, and the parameters of the large language model are , then the answer to the initial question is .

[0033] At the same time, the classification result of the problem data can be determined by utilizing the classification ability of the domain classifier. The classification result may include the target domain to which the problem data belongs and the weight of the problem data belonging to the target domain. The domain classifier may be a pre-trained language model with an encoder, such as a BERT model. After the problem data is input into the domain classifier, the output of the last hidden layer of the domain classifier is taken as the feature vector of the input text, and the feature vector is parsed to obtain and output the probability that the problem data belongs to each domain, and then a preset number of domains with high probabilities are taken as target domains, and the probability corresponding to the target domain is taken as the weight. Among them, the preset number can be set as needed, and is not specifically limited here.

[0034] The domain classifier can also be obtained by fine-tuning the pre-trained language model. Fine-tuning can improve the degree to which the domain classifier distinguishes data from different domains. The logic of fine-tuning is to make the feature vectors of data in the same domain less similar; and to make the feature vectors of data in different domains more similar.

[0035] Thereafter, step S13 is executed to determine the initial expert adapter corresponding to the classification result. For example, according to the weight in the classification result, the expert adapter with a weight greater than a preset threshold is activated as the initial expert adapter, and the expert adapter with a weight less than or equal to the preset threshold is not processed. The sum of the weights of all initial expert adapters is 1.

[0036] The initial expert adapter can be used to output the initial expert answer to the question data. Here, the question data can be input into the initial expert adapter of the target domain to obtain the adapter answer output by the initial expert adapter of the target domain; then the adapter answer is weighted summed using the weight corresponding to the target domain to obtain the initial expert answer. For example, there are n target domains, each of which corresponds to an initial expert adapter, and the parameters of the i-th initial expert adapter are , the adapter answer output by the i-th initial expert adapter is , and there is The weight of the i-th target domain can be expressed as , then the initial expert answer can be expressed as: .

[0037] After that, step S14 is executed to sum the initial question answer and the initial expert answer to obtain the initial answer data. For example, the initial answer data is represented by h, then: .

[0038] Using the initial answer data and answer label data, the loss function can be calculated, and then the loss function can be used to iteratively optimize the structural parameters of the initial expert adapters in each field. When the loss function converges or reaches the preset number of iterations, the target expert adapter is obtained. Here, the preset number of iterations can be set as needed and is not specifically limited here. The initial expert adapters in each field can be trained using efficient parameter fine-tuning methods such as Lora.

[0039] Finally, step S15 is performed to construct a target large language model using the large language model, the domain classifier, and the target expert adapter. Figure 2 As shown, the target large language model may include an input layer, two branches and an output layer, one branch is a large language model, and the other branch includes sequentially connected domain classifiers, target expert adapters in each domain and a first concatenation layer. Both branches are connected to the input layer and receive the same question data. The output results of the two branches are connected through the second concatenation layer and output through the output layer.

[0040] The training method for a large-scale cross-domain language model provided in an embodiment of the present invention first determines the training samples for the cross-domain task, then inputs the question data into the large-scale language model and the domain classifier respectively, obtains the initial question answer output by the large-scale language model and the classification result output by the domain classifier; thereafter determines the initial expert adapter corresponding to the classification result, and determines the initial expert answer of the question data based on the initial expert adapter; thereafter obtains the initial answer data based on the initial question answer and the initial expert answer, and trains the initial expert adapters of each field based on the initial answer data and the answer label data to obtain the target expert adapter; finally, the target large-scale language model is constructed based on the large-scale language model, the domain classifier and the target expert adapter. The method applies the training samples of the cross-domain task, introduces the domain classifier and the initial expert adapter, and trains the initial expert adapter, which can avoid the problems of many parameters and high training cost caused by directly fine-tuning the large-scale language model in the prior art, and can effectively improve the performance of the target large-scale language model obtained in multiple domain tasks without increasing too much computational burden, and realizes the effective processing of multi-domain data, thereby maintaining the universality of the target large-scale language model while improving its performance in a specific field. Moreover, this method applies domain classifiers and does not need to consider the problem of extremely unbalanced data when fine-tuning corpus ratios for cross-domain tasks.

[0041] Based on the above embodiment, the classification result includes the target domain to which the problem data belongs and the weight corresponding to the target domain; the problem data is input into the domain classifier to obtain the classification result output by the domain classifier, including: The problem data is input into the domain classifier, which extracts the feature vector of the problem data and calculates the similarity between the feature vector and the standard feature vector of each domain, and takes a preset number of domains with high similarity as the target domains, and takes the similarity corresponding to the target domains as the weights.

[0042] Specifically, in an embodiment of the present invention, the classification result of the neighborhood classifier may include the target domain to which the problem data belongs and the weight corresponding to the target domain. Furthermore, when the problem data is input into the domain classifier and the classification result is obtained through the domain classifier, the problem data can be first input into the domain classifier, and the domain classifier extracts the feature vector of the problem data, and calculates the similarity between the feature vector and the standard feature vector of each domain. Then, a preset number of domains with high similarity are used as target domains, and the similarity corresponding to the target domain is used as the weight. It can be seen that each target domain corresponds to an untrained initial expert adapter and a trained target expert adapter.

[0043] Based on the above embodiment, the standard feature vector of each field can be determined by the following steps, that is, each problem data in the training sample is first input into the field classifier to obtain the feature vector of each problem data. Then the feature vector of each problem data is averaged according to the field label of each problem data to obtain the standard feature vector of each field. Here, the field label of each problem data can be obtained by manual annotation or automatically determined by recognition, which is not specifically limited here.

[0044] In summary, the training method for a large-scale cross-domain language model provided in the embodiment of the present invention has the following advantages: 1) Strengthening domain-specific capabilities: It can effectively reduce the weakening of the model's capabilities in other fields after data training in one field, thereby maintaining the model's professionalism in the original field while strengthening its application capabilities in new fields. This means that the model can not only adapt quickly in new fields, but also continuously optimize performance in the process of continuous learning. 2) Cost-effective fine-tuning process: It ensures the essence of efficient parameter fine-tuning and ensures low cost in the fine-tuning process, making the deployment and application of the model economical and efficient. This is particularly important for application scenarios that require frequent updates of models to adapt to changing needs, such as news aggregation, social media monitoring, etc. 3) Adaptability of unbalanced data sets: In response to the challenge of data imbalance in different fields, by performing specific adaptive training on the model, it can still maintain good performance in fields with small data volumes or uneven data distribution. This is of great significance for processing rare disease diagnosis, small-scale language processing and other fields. This method provides strong technical support for the application of large language models in multi-domain tasks, broadens its application scope, improves processing efficiency and accuracy, and reduces costs. It has broad application prospects and far-reaching social impact.

[0045] like Figure 3 As shown, based on the above embodiment, an embodiment of the present invention provides an application method for a large-scale cross-domain language model, including: S31, obtaining questions to be answered; S32, inputting the question to be answered into a target large language model to obtain answer information output by the target large language model; The target large language model is obtained based on the training method for a cross-domain large language model provided in the above embodiments.

[0046] Specifically, the application method for a large-scale cross-domain language model provided in an embodiment of the present invention is executed by an application device for a large-scale cross-domain language model. The device can be configured in a computer, which can be a local computer or a cloud computer. The local computer can be a computer, a tablet, etc., which is not specifically limited here.

[0047] First, step S31 is executed to obtain a problem to be solved. The problem to be solved may involve a single field or multiple fields, which is not specifically limited here.

[0048] Then, step S32 is performed to input the question to be answered into the target large language model to obtain answer information output by the target large language model. The target large language model is obtained based on the training method for the cross-domain large language model provided in the above embodiments.

[0049] After the question to be answered is input into the target large language model, the large language model in the target large language model generates an answer to the question to be answered, and the model outputs the answer. The domain classifier in the target large language model determines the problem domain of the question to be answered and the domain weight corresponding to the problem domain. Then, the question to be answered is input into the target expert adapter corresponding to the problem domain, and the output result of the target expert adapter corresponding to the problem domain is obtained. The output results are weighted and summed by the domain weight to obtain the expert answer to the question to be answered. The model output answer is summed with the expert answer to obtain the answer information corresponding to the question to be answered.

[0050] The application method for a large-scale cross-domain language model provided in an embodiment of the present invention first obtains a question to be answered; then the question to be answered is input into a target large-scale language model to obtain answer information output by the target large-scale language model. The method uses the target large-scale language model obtained by the training method for a large-scale cross-domain language model provided in the above embodiments, so that the obtained answer information can be more accurate.

[0051] like Figure 4 As shown, based on the above embodiment, an embodiment of the present invention provides a training device for a large-scale cross-domain language model, including: A sample determination module 41 is used to determine a training sample for a cross-domain task, wherein the training sample includes question data and answer label data; A model answer classification module 42 is used to input the question data into a large language model and a domain classifier respectively, and obtain an initial question answer output by the large language model and a classification result output by the domain classifier; An expert answering module 43, used to determine an initial expert adapter corresponding to the classification result, and determine an initial expert answer to the question data based on the initial expert adapter; An adapter training module 44, configured to obtain initial answer data based on the initial question answer and the initial expert answer, and to train the initial expert adapters in each field based on the initial answer data and the answer label data to obtain a target expert adapter; The model building module 45 is used to build a target large language model based on the large language model, the domain classifier and the target expert adapter.

[0052] On the basis of the above embodiments, in the training device for a large cross-domain language model provided in the embodiments of the present invention, the classification result includes the target domain to which the question data belongs and the weight corresponding to the target domain; the model answer classification module is specifically used for: The problem data is input into the field classifier, which extracts the feature vector of the problem data and calculates the similarity between the feature vector and the standard feature vector of each field, and takes a preset number of fields with high similarity as the target fields, and takes the similarity corresponding to the target fields as the weight.

[0053] On the basis of the above-mentioned embodiment, the training device for a large-scale cross-domain language model provided in the embodiment of the present invention further includes a standard feature vector determination module for: Each problem data in the training sample is input into the field classifier respectively to obtain the feature vector of each problem data, and the feature vector of each problem data is averaged according to the field label of each problem data to obtain the standard feature vector of each field.

[0054] On the basis of the above-mentioned embodiment, in the training device for a large-scale cross-domain language model provided in the embodiment of the present invention, the classification result includes the target domain to which the question data belongs and the weight corresponding to the target domain; the model answer classification module is further used for: Input the problem data into the field classifier, obtain the probability that the problem data output by the field classifier belongs to each field, and use a preset number of fields with high probabilities as the target fields, and use the probabilities corresponding to the target fields as the weights; The domain classifier is trained based on the question data and the domain labels it carries.

[0055] On the basis of the above-mentioned embodiment, in the training device for a large-scale cross-domain language model provided in the embodiment of the present invention, the classification result includes the target domain to which the question data belongs and the weight corresponding to the target domain; the expert answer module is specifically used for: Inputting the question data into the initial expert adapter of the target domain to obtain an adapter answer output by the initial expert adapter of the target domain; Based on the weight corresponding to the target domain, the adapter answers are weighted summed to obtain the initial expert answer.

[0056] Specifically, the functions of each module in the training device for a large-scale cross-domain language model provided in the embodiment of the present invention correspond one-to-one to the operating procedures of each step in the above-mentioned method embodiment, and the effects achieved are also consistent. Please refer to the above-mentioned embodiment for details, and no further description will be given in the embodiment of the present invention.

[0057] like Figure 5 As shown, based on the above embodiment, an application device for a large-scale cross-domain language model is provided in an embodiment of the present invention, including: A question acquisition module 51 is used to acquire questions to be answered; A question answering module 52, configured to input the question to be answered into a target large language model and obtain answer information output by the target large language model; The target large language model is obtained based on the training method for a cross-domain large language model provided in the above embodiments.

[0058] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 810 may call the logic instructions in the memory 630 to execute the training method for a large cross-domain language model or the application method for a large cross-domain language model provided in the above embodiments.

[0059] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, or the part that contributes to the relevant technology or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0060] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the training method for a large-scale cross-domain language model or the application method for a large-scale cross-domain language model provided in the above-mentioned embodiments.

[0061] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is executed by a processor to provide a training method for a large-scale cross-domain language model or an application method for a large-scale cross-domain language model provided in the above-mentioned embodiments.

[0062] The device embodiments described above are merely illustrative, 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 scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0063] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiment.

[0064] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A training method for a large cross-domain language model, characterized in that: include: Determine a training sample for a cross-domain task, wherein the training sample includes question data and answer label data; Inputting the question data into a large language model and a domain classifier respectively, obtaining an initial question answer output by the large language model and a classification result output by the domain classifier; Determining an initial expert adapter corresponding to the classification result, and determining an initial expert answer to the question data based on the initial expert adapter; Based on the initial question answer and the initial expert answer, initial answer data is obtained, and based on the initial answer data and the answer label data, initial expert adapters in various fields are trained to obtain target expert adapters; A target large language model is constructed based on the large language model, the domain classifier, and the target expert adapter.

2. The training method for a large cross-domain language model according to claim 1, characterized in that: The classification result includes the target field to which the problem data belongs and the weight corresponding to the target field; Input the problem data into the domain classifier to obtain the classification result output by the domain classifier, including: The problem data is input into the field classifier, which extracts the feature vector of the problem data and calculates the similarity between the feature vector and the standard feature vector of each field, and takes a preset number of fields with high similarity as the target fields, and takes the similarity corresponding to the target fields as the weight.

3. The training method for a large cross-domain language model according to claim 2, characterized in that: The standard feature vectors of each field are determined based on the following steps: Each problem data in the training sample is input into the field classifier respectively to obtain the feature vector of each problem data, and the feature vector of each problem data is averaged according to the field label of each problem data to obtain the standard feature vector of each field.

4. The method for training a large-scale cross-domain language model according to any one of claims 1 to 3, characterized in that: The classification result includes the target field to which the problem data belongs and the weight corresponding to the target field; Inputting the problem data into an initial domain classifier to obtain a classification result output by the initial domain classifier, further comprising: Input the problem data into the field classifier, obtain the probability that the problem data output by the field classifier belongs to each field, and use a preset number of fields with high probabilities as the target fields, and use the probabilities corresponding to the target fields as the weights; The domain classifier is trained based on the question data and the domain labels it carries.

5. The method for training a large-scale cross-domain language model according to any one of claims 1 to 3, characterized in that: The classification result includes the target field to which the problem data belongs and the weight corresponding to the target field; The determining the initial expert answer to the question data based on the initial expert adapter comprises: Inputting the question data into the initial expert adapter of the target domain to obtain an adapter answer output by the initial expert adapter of the target domain; Based on the weight corresponding to the target domain, the adapter answers are weighted summed to obtain the initial expert answer.

6. An application method for a large-scale cross-domain language model, characterized in that: include: Get questions to be answered; Inputting the question to be answered into a target large language model to obtain answer information output by the target large language model; The target large language model is obtained based on the training method for a cross-domain large language model as described in any one of claims 1 to 5.

7. A training device for a large cross-domain language model, characterized in that: include: A sample determination module, used to determine training samples for cross-domain tasks, wherein the training samples include question data and answer label data; A model answer classification module, used to input the question data into a large language model and a domain classifier respectively, to obtain an initial question answer output by the large language model and a classification result output by the domain classifier; An expert answer module, used to determine an initial expert adapter corresponding to the classification result, and determine an initial expert answer to the question data based on the initial expert adapter; An adapter training module, used to obtain initial answer data based on the initial question answer and the initial expert answer, and to train the initial expert adapters in each field based on the initial answer data and the answer label data to obtain a target expert adapter; A model building module is used to build a target large language model based on the large language model, the domain classifier and the target expert adapter.

8. An application device for a large-scale cross-domain language model, characterized in that: include: A question acquisition module is used to obtain questions to be answered; A question answering module, used for inputting the question to be answered into a target large language model, and obtaining answer information output by the target large language model; The target large language model is obtained based on the training method for a cross-domain large language model as described in any one of claims 1 to 5.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, it implements the training method for a large-scale cross-domain language model as described in any one of claims 1 to 5, or the application method for a large-scale cross-domain language model as described in claim 6.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the training method for a large-scale cross-domain language model as described in any one of claims 1 to 5, or the application method for a large-scale cross-domain language model as described in claim 6.

Citation Information

Cited By

  • Cross-domain ship large model training method and device, computer equipment, storage medium and computer program product

    CN121614874A

  • Cross-domain ship large model training method and device, computer device, storage medium and computer program product

    CN121614874B