Model training method, device and equipment based on federal transfer learning
By receiving the training data set of the main computing node for knowledge distillation and adjusting the model parameters, the problem of inaccurate and unreliable model training in federated transfer learning is solved, and a more accurate and reliable model training effect is achieved.
Patent Information
- Application Number
- CN202510779368.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-06-11
AI Technical Summary
The existing model training method based on federated transfer learning has the problem of inaccurate and unreliable model training.
By receiving the training data set sent by the main computing node, the knowledge distillation process is performed, the training data set is generated, and the initial model is adjusted based on the initial loss until the training stop condition is met, and the target model is obtained.
Improve the accuracy and reliability of model training, ensuring that the target model obtained by the final training is more accurate and reliable.
Smart Images

Figure CN120297366A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and particularly to a model training method, device, and equipment based on federated transfer learning. Background Art
[0002] Transfer Learning refers to a learning process that utilizes the similarity between data, tasks, or models to apply a model learned in an old domain to a new domain. Federated transfer learning is a new paradigm of transfer learning that applies the federated learning framework, aiming to solve the problem of knowledge being scattered among different data owners through collaborative modeling among multiple institutions while protecting the original model from leakage.
[0003] However, the existing model training methods based on federated transfer learning have problems of inaccurate and unreliable model training. Summary of the Invention
[0004] In view of this, the present invention provides a model training method, device, and equipment based on federated transfer learning, mainly aiming to solve the problems of inaccurate and unreliable current model training.
[0005] To solve the above problems, the present application provides a model training method based on federated transfer learning, which is applied to a slave computing node and includes: Receiving a training data set obtained by performing knowledge distillation processing on the original data set of the slave computing node sent by the master computing node. The training data set contains training data corresponding to each original data in the original data set, and each training data includes any one or several of the following labels: class label, result label, and reason label; Performing class training, result training, and reason training on the initial model based on the original data set and the training data set respectively to obtain an initial class loss, an initial result loss, and an initial reason loss; Determining an initial total loss based on any one or several of the initial class loss, the initial result loss, and the initial reason loss, and adjusting the parameters of the initial model based on the initial total loss to obtain a current model. When a predetermined training stop condition is met, a target model is obtained.
[0006] Optionally, before receiving the training data set sent by the master computing node, the method further includes: Receiving a first public key sent by the master computing node, encrypting the local original data set based on the first public key to generate a first encrypted data set; Sending the first encrypted data set to the master computing node for the master computing node to decrypt the first encrypted data set based on the first private key corresponding to the first public key to obtain the original data set.
[0007] Optionally, before receiving the training data set sent by the main computing node, the method further includes: Pre-generating a second public key and a second private key corresponding to the second public key; Sending the second public key to the main computing node for the main computing node to encrypt the training data set based on the second public key to obtain a second encrypted data set; The receiving the training data set obtained by performing knowledge distillation processing on the original data set for the slave computing node sent by the main computing node specifically includes: Receiving the second encrypted data set sent by the main computing node; Decrypting the second encrypted data set based on the second private key to obtain the training data set.
[0008] Optionally, the performing category training, result training, and reason training on the initial model based on the original data set and the training data set respectively to obtain an initial category loss, an initial result loss, and an initial reason loss specifically includes: Respectively constructing a category training set including category labels, a result training set including result labels, and a reason training set including reason labels based on the training data set; Performing category training on the initial model based on the original data set and the category training set to obtain an initial category loss; Performing result training on the initial model based on the original data set and the result training set to obtain an initial result loss; Performing reason training on the initial model based on the original data set and the reason training set to obtain an initial reason loss.
[0009] Optionally, the determining the initial total loss based on any one or several of the initial category loss, the initial result loss, and the initial reason loss specifically includes: Determining a first coefficient corresponding to the category label, a second coefficient corresponding to the result label, and a third coefficient corresponding to the reason label; Determining the initial total loss based on the initial category loss, the initial result loss, the initial reason loss, the first coefficient, the second coefficient, and the third coefficient.
[0010] Optionally, after obtaining the current model, the method further includes: Determining whether a predetermined training stop condition is satisfied based on the current loss corresponding to the current model; Or, determining whether a predetermined training stop condition is satisfied based on the number of training rounds corresponding to the current model.
[0011] To solve the above problems, the present application provides a model training method based on federated transfer learning, which is applied to a main computing node and includes: Receive the original data set sent from the computing node; Perform knowledge distillation processing on the original data set based on a predetermined prompt template and a predetermined large model to obtain a training data set; Send the training data set to the corresponding computing node for the computing node to perform model training based on the training data set and the original data set to obtain a target model.
[0012] Optionally, before receiving the original data set sent from the computing node, the method further includes: Pre-generate a first public key and a first private key corresponding to the first public key; Send the first public key to the computing node for the computing node to encrypt the original data set based on the first public key to obtain a first encrypted data set; The step of receiving the original data set sent from the computing node specifically includes: Receive the first encrypted data set sent from the computing node; Decrypt the first encrypted data set based on the first private key to obtain the original data set.
[0013] Optionally, the step of performing knowledge distillation processing on the original data set based on a predetermined prompt template and a predetermined large model to obtain a training data set specifically includes: Generate training data corresponding to each original data in the original data set based on the predetermined prompt template and each original data in the original data set by using the predetermined large model to obtain a training data set; Wherein, each training data respectively includes any one or more of the following labels: category label, result label, and reason label.
[0014] Optionally, before performing knowledge distillation processing on the original data set based on a predetermined prompt template and a predetermined large model, the method further includes: Pre-generate a prompt template based on a predetermined prompting method; Wherein, the predetermined prompting method includes any one or more of the following: zero-shot prompting method, few-shot prompting method, and chain-of-thought prompting method.
[0015] Optionally, before sending the training data set to the corresponding computing node, the method further includes: Receive a second public key sent from the computing node; Encrypt the training data set based on the second public key to obtain a second encrypted data set; The step of sending the training data set to the corresponding computing node specifically includes: Send the second encrypted data set to the computing node for the computing node to decrypt the second encrypted data set based on the second private key to obtain the training data set.
[0016] To solve the above problems, the present application provides a model training device based on federated transfer learning, including: A first receiving module, configured to receive a training data set obtained by performing knowledge distillation processing on an original data set for a slave computing node sent by a master computing node. The training data set contains training data corresponding to each original data in the original data set, and each training data includes any one or several of the following tags: class label, result label, and reason label; A training module, configured to perform class training, result training, and reason training on an initial model based on the original data set and the training data set respectively, to obtain an initial class loss, an initial result loss, and an initial reason loss; An obtaining module, configured to determine an initial total loss based on any one or several of the initial class loss, the initial result loss, and the initial reason loss, and adjust the parameters of the initial model based on the initial total loss to obtain a current model. When a predetermined training stop condition is met, a target model is obtained.
[0017] To solve the above problems, the present application provides a model training device based on federated transfer learning, including: A second receiving module, configured to receive the original data set sent by the slave computing node; A processing module, configured to perform knowledge distillation processing on the original data set based on a predetermined prompt template and a predetermined large model to obtain a training data set; A second sending module, configured to send the training data set to the corresponding slave computing node for the slave computing node to perform model training based on the training data set and the original data set to obtain a target model.
[0018] To solve the above problems, the present application provides an electronic device, including at least a memory and a processor. A computer program is stored on the memory, and when the processor executes the computer program on the memory, the steps of the model training method based on federated transfer learning described in any one of the above are implemented.
[0019] In a model training method, device, and device based on federated transfer learning in the present application, by receiving a training data set obtained by performing knowledge distillation processing on an original data set sent by a master computing node, subsequent slave computing nodes can perform multi-task learning on a local initial model based on the training data set and the local original data set, that is, perform reason training / attribution training, result training, and class training respectively. Then, based on the losses of each training, the final loss is determined, and the model parameters are optimized and adjusted based on the final loss, so that the finally trained target model is more accurate and reliable.
[0020] The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the content of the specification. And in order to make the above and other objects, features and advantages of the present invention more obvious and understandable, the specific embodiments of the present invention are specifically given below. Description of the Drawings
[0021] By reading the following detailed description of the preferred embodiments, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments and are not considered to be a limitation of the present invention. Moreover, throughout the drawings, the same reference numerals are used to represent the same components. In the drawings: Figure 1 is a flowchart of a model training method based on federated transfer learning according to an embodiment of the present application; Figure 2 is a flowchart of a model training method based on federated transfer learning according to another embodiment of the present application; Figure 3 is a structural block diagram of a model training device based on federated transfer learning according to another embodiment of the present application; Figure 4 is a structural block diagram of a model training device based on federated transfer learning according to another embodiment of the present application; Figure 5 is a structural block diagram of an electronic device according to another embodiment of the present application. Detailed Embodiments
[0022] Reference is made herein to the various aspects and features of the present application with reference to the drawings.
[0023] It should be understood that various modifications can be made to the embodiments of the application herein. Therefore, the above specification should not be considered a limitation, but merely as an example of an embodiment. Those skilled in the art will envision other modifications within the scope and spirit of the present application.
[0024] The drawings, which are included in and form a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0025] These and other features of the present application will become apparent from the following description of the preferred form of the embodiments given as non-limiting examples with reference to the drawings.
[0026] It should also be understood that, although the present application has been described with reference to some specific examples, those skilled in the art can surely implement many other equivalent forms of the present application.
[0027] The above and other aspects, features, and advantages of the present application will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.
[0028] Specific embodiments of the present application will be described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments claimed are merely examples of the present application and can be implemented in various ways. Well-known and / or repetitive functions and structures are not described in detail to avoid obscuring the present application with unnecessary or redundant details. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but are merely a basis and representative basis for the claims to teach those skilled in the art to use the present application in substantially any suitable detailed structure in a variety of ways.
[0029] This specification may use the phrases "in one embodiment", "in another embodiment", "in yet another embodiment", or "in other embodiments", each of which may refer to one or more of the same or different embodiments according to the present application.
[0030] An embodiment of the present application provides a model training method based on federated transfer learning, which can be specifically applied to the slave computing node / participant in federated learning. Specifically, the slave computing node can be a certain financial institution. As Figure 1 shown, the method in this embodiment includes the following steps: Step S101, receive the training data set obtained by performing knowledge distillation processing on the original data set of the slave computing node sent by the master computing node. The training data set contains training data corresponding to each original data in the original data set, and each training data includes any one or several of the following labels: class label, result label, and reason label; In the specific implementation process of this step, the slave computing node can pre-deploy the components of the federated transfer learning cooperation network in the local data center and perform data transmission with the master computing node. Specifically, each slave computing node can first send the original data set to the master computing node, so that the master computing node can perform knowledge distillation processing on the original data sets of each slave computing node respectively to obtain the training data set corresponding to each original data set, and then the master computing node sends the training data set to the corresponding slave computing node. Among them, when performing knowledge distillation processing on the original data set, the master computing node can input each original data in the original data set and a predetermined prompt word template into a predetermined large model, and use the large model to output training data including the three label dimensions of reason label, result label, and class label according to the prompt word template, so as to obtain the training data set corresponding to the original data set.
[0031] Step S102, perform class training, result training, and reason training on the initial model based on the original data set and the training data set respectively to obtain the initial class loss, the initial result loss, and the initial reason loss; In this step, the training data corresponding to each piece of original data in the original dataset can be determined according to the training dataset. Since the training data includes the class label, result label, and reason label of the original data, each piece of original data and its corresponding class label can be input into the initial model on the local computing node. The initial model is used to output a prediction result, and the class loss is calculated based on this prediction result, that is, the initial class loss is obtained. Similarly, each piece of original data and its corresponding result label can be input into the initial model on the local computing node. The initial model is used to output a prediction result, and the result loss is calculated based on this prediction result, that is, the initial result loss is obtained. Similarly, each piece of original data and its corresponding reason label can be input into the initial model on the local computing node. The initial model is used to output a prediction result, and the reason loss is calculated based on this prediction result, that is, the initial reason loss is obtained.
[0032] Step S103: Determine the initial total loss based on any one or several of the initial class loss, initial result loss, and initial reason loss, and adjust the parameters of the initial model based on the initial total loss to obtain the current model. When the predetermined training stop condition is met, the target model is obtained.
[0033] In this step, the initial total loss can be determined based on one or several of the initial class loss, initial result loss, and initial reason loss, as well as the coefficient / hyperparameter corresponding to each loss type. Finally, the model parameters of the initial model are adjusted according to the initial total loss, so as to obtain the current model. In the specific implementation process of this step, it can be determined whether the predetermined training stop condition is met based on the current total loss of the current model, or it can also be determined whether the predetermined training stop condition is met based on the number of training rounds.
[0034] In the model training method based on federated transfer learning in this embodiment, by receiving the training dataset obtained by performing knowledge distillation on the original dataset sent by the master computing node, the subsequent slave computing nodes can perform multi-task learning on the local initial model based on the training dataset and the local original dataset, that is, perform reason training / attribution training, result training, and class training respectively. Then, the final loss is determined according to the losses of each training, and the model parameters are optimized and adjusted based on the final loss, so that the finally trained target model is more accurate and reliable.
[0035] Based on the above embodiments, another embodiment of the present application provides a model training method based on federated transfer learning, which is applied to a slave computing node. The overall process of model training is as follows: Step S201: Install and initialize the federated transfer learning framework.
[0036] In this step, each financial institution can be used as a slave computing node / participant, and components of the federated transfer learning collaboration network can be pre-deployed in the local data center of each slave computing node. Similarly, the financial infrastructure can be used as the master computing node / dominant party, and components of the federated transfer learning collaboration network can be pre-deployed in the local data center of the master computing node. Among them, the framework of the federated learning collaboration network can be implemented using other software products with the same functions such as FATE, SecretFlow, PaddleFL, TensorFlow Federated, and Pysyft. This federated transfer learning network has a star topology, and each slave computing node only interacts bidirectionally with the master computing node.
[0037] Step S202, key interaction; In this step, the master computing node can pre-generate an asymmetric key pair, that is, the first key pair, which includes the first public key pk center and the first private key sk center , and then send the first public key pk center to the slave computing node. Thus, the slave computing node can receive the first public key pk center sent by the master computing node.
[0038] Similarly, each slave computing node will also pre-generate an asymmetric key pair, that is, the second key pair, which includes the second public key pk i node and the second private key sk i node . Where i represents the i-th slave computing node, and then the slave computing node i can send the second public key pk i node to the master computing node, thus completing the key interaction.
[0039] Step S203, encrypt the local original data set based on the first public key to generate the first encrypted data set; In this step, the slave computing node can use the first public key of the master computing node to encrypt the original data set to prevent local data leakage and protect data privacy.
[0040] Step S204, send the first encrypted data set to the master computing node for the master computing node to decrypt the first encrypted data set based on the first private key corresponding to the first public key to obtain the original data set; In this step, after receiving the first encrypted data, the master computing node can, based on the first private key sk centerDecrypt the first encrypted data to obtain the original data set from the computing nodes. Specifically, since the master computing node receives the first encrypted data sent by each slave computing node, the slave computing node can configure a slave computing node identifier for each first encrypted data / original data set, facilitating the master computing node to distinguish each first encrypted data / original data set.
[0041] Step S205: Receive the second encrypted data set sent by the master computing node; In this step, the second encrypted data set is obtained by the master computing node encrypting the training data set based on the second public key. The training data set is obtained by the master computing node performing knowledge distillation processing on the original data set of the slave computing node.
[0042] That is, after decrypting the original data set based on the first private key, the master computing node can perform knowledge distillation processing on the original data set to obtain the training data set. Then, the master computing node can encrypt the training data set based on the second public key Pk i node of the slave computing node to obtain the second encrypted data set and send the second encrypted data set to the slave computing node, so that the slave computing node can receive the second encrypted data set.
[0043] Step S206: Decrypt the second encrypted data set based on the second private key to obtain the training data set; In this step, the slave computing node can decrypt the second encrypted data set based on the second private key sk i node held by itself to obtain the training data set corresponding to the local original data set.
[0044] Step S207: Perform class training, result training, and reason training on the initial model based on the original data set and the training data set respectively to obtain the initial class loss, the initial result loss, and the initial reason loss; In the specific implementation process of this step, the training processes of reason training, result training, and class training are as follows: I. Class training: Construct a class training set containing class labels based on the training data set; perform class training on the initial model based on the original data set and the class training set to obtain the initial class loss.
[0045] That is, the slave computing node uses the original conversation data / original data and [label] tags / class labels as inputs and class data as outputs to train the locally deployed small model / initial model, such as: prompt_CoT_Few_shot = Q: Please analyze the category [label] of this task: "In the second quarter of 2024, the scale of risky bonds was 152.76 billion yuan, a year-on-year decrease of about 76%, and the credit risk continued to converge. Is this favorable information for the bond market?" A: "Sentiment analysis." From this, the initial category loss can be calculated based on the category data and category labels output by the small model / initial model. That is, the initial category loss of computing node i is as follows:
[0046] Among them, is the category loss in category training, N i is the number of data in the category training set of the i-th computing node, and CL is the label prediction loss, which is used to measure the category predicted by the model and the true category The cross-entropy loss between them.
[0047] II. Result training: Construct a result training set for result labels based on the training data set; Based on the original data set and the result training set, perform result training on the initial model to obtain the initial result loss; That is, from the computing node, the original conversation data / original data and [result] labels / result labels can be used as inputs, and the result data can be used as outputs to perform result training on the locally deployed small model / initial model. For example: prompt_CoT_Few_shot = Q: "In the second quarter of 2024, the scale of risky bonds was 152.76 billion yuan, a year-on-year decrease of about 76%, and the credit risk continued to converge. Is this favorable information for the bond market?" A: "Judging from these data, the performance of the bond market in the second quarter of 2024 can be regarded as positive public opinion." From this, the initial result loss can be calculated based on the result data and result labels output by the small model / initial model. That is, the initial result loss of computing node i is as follows:
[0048] Among them, is the result loss in result training, N i is the number of data in the result training set of the i-th computing node, and CL is the label prediction loss, which is used to measure the result predicted by the model and the true result The cross-entropy loss between them.
[0049] 3. Cause training / attribution training: Construct a cause training set containing cause labels based on the training data set; perform cause training on the initial model based on the original data set and the cause training set to obtain the initial cause loss.
[0050] That is, the computing node uses the original conversation data / raw data and the [reason] label / reason label as input, and the attribution data / reason data as output to train the small model / initial model deployed locally on the computing node, such as: prompt_CoT_Few_shot =Q: "In the second quarter of 2024, the scale of risky bonds was 15.276 billion yuan, a year-on-year decrease of about 76%, and credit risk continued to converge. Is this good news for the bond market?" The category [label] of this task is sentiment analysis, and the result [result] is "Based on these data, the performance of the bond market in the second quarter of 2024 can be regarded as positive public opinion." Please analyze the reasons for this result.
[0051] A: "This data shows the following positive signals: 1. The scale of defaults has dropped significantly: Compared with the same period last year, the scale of defaults has dropped significantly, which shows that the credit risk in the bond market has been effectively controlled, and the frequency and scale of default events have decreased. 2. Convergence of credit risk: The convergence of credit risk means that the uncertainty faced by market participants has decreased, which helps to enhance investor confidence and attract more funds to flow into the bond market. 3. Enhanced market stability: The reduction in default events is generally regarded as enhanced market stability, which is of great significance for maintaining the healthy development of the bond market. Therefore, despite the existence of defaults and extension events, the significant decline in the scale of defaults and the convergence of credit risk indicate that the market is moving in a healthier direction." Therefore, the initial cause loss can be calculated based on the cause data and cause labels output by the small model / initial model. as follows:
[0052] in, is the cause loss in attribution training, N i is the number of data in the training set from the i-th slave computing node, CL is the label prediction loss, which is used to measure the attribution of model prediction. True attribution The cross entropy loss between .
[0053] Step S208, determining the initial total loss based on any one or more of the initial cause loss, the initial result loss, and the initial category loss; In the specific implementation process of this step, the first coefficient corresponding to the category label, the second coefficient corresponding to the result label, and the third coefficient corresponding to the reason label can be determined; based on the initial category loss, the initial result loss, the initial reason loss, the first coefficient, the second coefficient, and the third coefficient, the initial total loss is determined.
[0054] Specifically, taking the determination of the total loss based on the three losses of category loss, result loss, and reason loss as an example, the calculation formula for the initial total loss is as follows:
[0055] Among them, is the total loss of the i-th slave computing node in the chain distillation process, , , are all configurable and adjustable hyperparameters / coefficients, which can be flexibly adjusted by the slave computing node to satisfy . For example, select , , .
[0056] In the chain distillation process, the initial model / small model not only predicts the task output result, but also generates the corresponding attribution, and limits the task category according to the business related to the slave computing node, jointly improving the reasoning and explanation generation ability of the small model.
[0057] Step S209, adjust the parameters of the initial model based on the initial total loss to obtain the current model, and obtain the target model until the predetermined training stop condition is satisfied.
[0058] In this step, after obtaining the current model, it can be determined whether the predetermined training stop condition is satisfied based on the current total loss corresponding to the current model; or, it can be determined whether the predetermined training stop condition is satisfied based on the number of training rounds corresponding to the current model.
[0059] That is, after obtaining the current model, category training, result training, and reason training can be performed based on the current model using the original dataset and the training dataset respectively to obtain the current category loss, the current result loss, and the current reason loss. Then, the current total loss is determined based on any one or several of the current category loss, the current result loss, and the current reason loss, and the current total loss is compared with a predetermined loss threshold. When it is determined that the current total loss is less than or equal to the predetermined loss threshold, or when the number of model training rounds is greater than the predetermined round threshold, it is determined that the predetermined training stop condition is met, and the current model can be used as the target model. Conversely, when it is determined that the current total loss is greater than the predetermined loss threshold and the number of training rounds is less than the predetermined round threshold, the current model is continuously adjusted based on the current total loss until the current total loss of the adjusted current model is less than or equal to the predetermined loss threshold or the number of training rounds is greater than the predetermined round threshold, and then the model training is stopped.
[0060] In this embodiment, after each slave computing node completes the training of the local small model / initial model, it can be deployed and used. These small models have inference capabilities and the ability to generate explanations close to those of the large model in their respective business fields, and there is no need to interact with the master computing node during the use process. Specifically, the master computing node can use the error dataset returned by the slave computing node as input to perform instruction fine-tuning training on the large model.
[0061] The method in this embodiment, by receiving the training dataset obtained by the master computing node through knowledge distillation processing of the original dataset, subsequent slave computing nodes can perform multi-task learning on the local initial model based on the training dataset and the local original dataset, that is, perform reason training / attribution training, result training, and category training respectively, and then determine the final total loss according to the losses of each training, making the determination of the total loss more reasonable and accurate. Furthermore, the model parameters can be accurately optimized and adjusted based on the total loss subsequently, making the finally trained target model more accurate and reliable.
[0062] Another embodiment of this application provides a model training method based on federated transfer learning, which can be specifically applied to the master computing node / dominant party of federated learning. Specifically, the master computing node can be a financial infrastructure. As Figure 2 shown, the method in this embodiment includes the following steps: Step S301, receive the original dataset sent by the slave computing node; In this step, the master computing node can pre-deploy the components of the federated transfer learning collaboration network in the local data center and perform data transmission with the slave computing nodes. Thus, the master computing node can receive the original datasets sent by each slave computing node.
[0063] Step S302: Perform knowledge distillation on the original dataset based on a predetermined prompt template and a predetermined large model to obtain a training dataset. In this step, the main computing node can pre-deploy a large model for knowledge distillation locally. Thus, the main computing node can perform knowledge distillation on the original datasets of each slave computing node respectively based on the large model to obtain training datasets corresponding to the original datasets. Specifically, when performing knowledge distillation on the original dataset, the main computing node can input each piece of original data in the original dataset and the predetermined prompt template into the predetermined large model, and use the large model to output training data including three label dimensions: cause label, result label, and category label according to the prompt template, so as to obtain a training dataset corresponding to the original dataset.
[0064] Specifically, the category label [label] can include, for example: sentiment analysis, text generation, machine translation, text classification, entity relation extraction, text summarization, semantic role annotation, and dialogue systems, etc. The specific data format can be: Sentiment Analysis (SA for short in English): The task category for judging the sentiment of the input text is "SA". Such as the sentiment analysis of news and public opinions in the bond market.
[0065] Text Generation (TG for short in English): The task category for generating text according to a given prompt is "TG". Such as generating a monthly report on the statistics and analysis of the inter-bank bond market according to statistical data.
[0066] Machine Translation (MT for short in English): The task category for translating one language into another is "MT". Such as the translation of news on the settlement of central bank digital currency and French national debt by the European clearing system Euroclear based on a private chain.
[0067] Text Classification (TC for short in English): The task category for classifying text into predefined categories is "TC". Such as identifying which category the text content of several scanned documents belongs to, such as subscription agreement, trust deed, agency agreement, legal opinion, due diligence materials, roadshow materials, etc.
[0068] Entity Relation Extraction (ERE for short in English): The task category for extracting entities and their relationships from text is "ERE". Such as extracting key elements from the prospectus for the public offering of corporate bonds.
[0069] Text Summarization (TS): The task category for generating text summaries is "TS". For example, generating a summary of the "xxx Report".
[0070] Semantic Role Labeling (SRL): The task category for labeling the arguments of a verb in a sentence and their semantic roles is "SRL".
[0071] Dialogue System (DS): The task category for building a dialogue system is "DS". For example, an intelligent customer service dialogue system.
[0072] Specifically, the reason label / attribution label [reason] can include, for example: 1. A significant decrease in the scale of defaults: Compared with the same period last year, the scale of defaults has decreased significantly, indicating that the credit risk in the bond market has been effectively controlled, and the frequency and scale of default events are both decreasing. 2. Convergence of credit risk: The convergence of credit risk means a reduction in the uncertainty faced by market participants, which helps to enhance investors' confidence and attract more capital inflows into the bond market. 3. Enhanced market stability: The reduction of default events is usually regarded as an enhancement of market stability, which is of great significance for maintaining the healthy development of the bond market. Therefore, despite the existence of default and extension events, the significant decrease in the scale of defaults and the convergence of credit risk indicate that the market is developing in a healthier direction.
[0073] Specifically, the result label [result] can include, for example: The performance of the bond market in the second quarter of xx can be regarded as positive public opinion.
[0074] In this step, by designing the outputs in the three dimensions of "cause, effect, and category" and the unique dialogue data in the relevant business fields of each slave computing node, the knowledge extraction for certain specific business fields can be achieved based on the large model deployed on the master computing node.
[0075] Step S303: Send the training data set to the corresponding slave computing node for the slave computing node to perform model training based on the training data set and the original data set to obtain the target model.
[0076] In this step, each slave computing node can pre-configure the corresponding node identifier for each original data set. Thus, the master computing node can send the training data set obtained through knowledge distillation processing to the corresponding slave computing node according to the node identifier, facilitating the subsequent model training of the slave computing node based on the local original data set and the training data set.
[0077] In the model training method based on federated transfer learning in this embodiment, a training data set is obtained by performing knowledge distillation on the original data set, and the training data set is sent to the corresponding slave computing nodes. Subsequently, the slave computing nodes can perform multi-task learning on the local initial model based on the training data set and the local original data set, that is, perform cause training / attribution training, result training, and category training respectively, and then determine the final loss according to the losses of each training, and optimize and adjust the model parameters based on the final loss, so that the finally trained target model is more accurate and reliable.
[0078] Another embodiment of this application provides a model training method based on federated transfer learning, which is applied to the master computing node. The overall process of model training is as follows: Step S401, installation and initialization of the federated transfer learning framework.
[0079] In this step, the financial infrastructure can be used as the master computing node / dominant party, and the components of the federated transfer learning cooperation network can be deployed in the local data center of the master computing node in advance. Similarly, each financial institution can be used as the slave computing node / participating party, and the components of the federated transfer learning cooperation network can be deployed in the local data center of each slave computing node in advance. Among them, the framework of the federated learning cooperation network can be implemented using other software products with the same function such as FATE, SecretFlow, PaddleFL, TensorFlow Federated, and Pysyft. This federated transfer learning network is a star topology, and each slave computing node only interacts bidirectionally with the master computing node.
[0080] Step S402, key interaction; In this step, the master computing node can pre-generate an asymmetric key pair, that is, the first key pair, which includes the first public key pk center and the first private key sk center , and then send the first public key pk center to the slave computing nodes for the slave computing nodes to encrypt the original data set based on the first public key pk center to obtain the first encrypted data set.
[0081] Similarly, each slave computing node will also pre-generate an asymmetric key pair, that is, the second key pair, which includes the second public key pk i node and the second private key sk i node . Where i represents the i-th slave computing node, and then the slave computing node i can send the second public key pk i node to the master computing node. That is, the master computing node will receive the second public key sent by the slave computing node, thus completing the key interaction.
[0082] Step S403: Receive the first encrypted data set sent from the computing node; In this step, the first encrypted data is obtained by the computing node encrypting the original data set based on the first public key pk center That is, after the key interaction is completed, the computing node will encrypt the original data set based on the first public key pk center to obtain the first encrypted data, and then send the first encrypted data to the main computing node.
[0083] Step S404: Decrypt the first encrypted data set based on the first private key to obtain the original data set; In this step, after receiving the first encrypted data, the main computing node will decrypt the first encrypted data based on the first private key it holds, so as to obtain the original data set.
[0084] Step S405: Based on the predetermined prompt word template and each original data in the original data set, use the predetermined large model to generate training data corresponding to each original data to obtain a training data set; where each training data respectively includes: any one or several of the category label, result label, and reason label; In this step, in the specific implementation process, the prompt word template can be pre-generated based on the predetermined prompt method; where the predetermined prompt method includes any one or several of the following: zero-shot prompt method, few-shot prompt method, and chain of thought prompt method.
[0085] Among them, the zero-shot prompt method can be, for example: prompt_CoT_Zero_shot = [input text] + 'Please reason step by step and draw a conclusion. The reasoning needs to contain the following three steps: first, judge the task category of the current input, then generate the output result of the current input, and finally explain the reason for generating this output result.' response_CoT_Zero_shot = openai.Completion.create( model="text-davinci-004", prompt=prompt_CoT_Zero_shot, max_tokens=2500, ) The few-shot prompt can be, for example: prompt_CoT_Few_shot = Q: "In the second quarter of 2024, the scale of risky bonds was 152.76 billion yuan, a year-on-year decrease of about 76%, and the credit risk continued to converge. Is this favorable information for the bond market?" A: "[label]Sentiment analysis. [result]Judging from these data, the performance of the bond market in the second quarter of 2024 can be regarded as positive public opinion. [reason]This data shows the following positive signals: 1. The default scale has decreased significantly: Compared with the same period last year, the default scale has decreased significantly, indicating that the credit risk in the bond market has been effectively controlled, and the frequency and scale of default events are both decreasing. 2. The convergence of credit risk: The convergence of credit risk means that the uncertainty faced by market participants has decreased, which helps to enhance investors' confidence and attract more funds to flow into the bond market. 3. The enhancement of market stability: The reduction of default events is usually regarded as the enhancement of market stability, which is of great significance for maintaining the healthy development of the bond market. Therefore, despite the existence of default and extension events, the significant decrease in the default scale and the convergence of credit risk indicate that the market is developing in a more healthy direction." Q: '+ [input text]+' A: ' response_CoT_Few_shot = openai.Completion.create( model="text-davinci-004", prompt=prompt_CoT_Few_shot, max_tokens=2500, ) Specifically, when the main computing node performs knowledge distillation processing on the original data set, each piece of original data in the original data set and a predetermined prompt template can be input into a predetermined large model, and the large model is used to output training data including three label dimensions: category label, result label, and reason label according to the prompt template, so as to obtain a training data set corresponding to the original data set.
[0086] Step S406, encrypt the training data set based on the second public key to obtain a second encrypted data set; In this step, after the main computing node processes and obtains the training data set, it can encrypt the training data set based on the second public key pk of the computing node i i node to obtain a second encrypted data set. By encrypting the training data set, the leakage of the training data set can be prevented and data privacy can be protected.
[0087] Step S407: Send the second encrypted data set to the slave computing node for the slave computing node to decrypt the second encrypted data set based on the second private key to obtain the training data set; In this step, after obtaining the second encrypted data, the master computing node can send the second encrypted data to the corresponding slave computing node. Thus, the slave computing node can perform category training, result training, and reason training on the initial model based on the original data set and the training data set respectively to obtain the initial category loss, the initial result loss, and the initial reason loss. At the same time, based on any one or several of the initial reason loss, the initial result loss, and the initial category loss, determine the initial total loss, and optimize and adjust the parameters of the initial model on the local side of the slave computing node based on the initial total loss to obtain the current model until the target model is obtained when the predetermined training stop condition is met.
[0088] In the specific implementation process of this embodiment, after obtaining the training data set, it is also possible to control incorrect outputs caused by problems such as large model hallucinations based on an artificial or AI review link, that is, it is possible to review the training data set through artificial or AI to obtain review information including the incorrect data and the reasons for the incorrect data in the training data set. Furthermore, the master computing node can also receive the review information for the training data set, and then adjust the large model based on the training data set and the corresponding review information to improve the accuracy of the large model for knowledge distillation processing.
[0089] Specifically, the master computing node can also receive the incorrect data and the reasons for the incorrect data for the training data set fed back by each slave computing node. Furthermore, the master computing node can use methods such as fine-tuning the large model, improving the encoder and decoder, enhancing the input data with external information, and adding a post-processing link to improve the hallucination problem of its large model according to the fed-back incorrect data.
[0090] The method in this embodiment obtains the training data set through knowledge distillation processing of the original data set and sends the training data set to the corresponding slave computing node. Subsequently, the slave computing node can perform multi-task learning on the local initial model based on the training data set and the local original data set, that is, perform reason training / attribution training, result training, and category training respectively. Then, determine the final loss based on the losses of each training, and optimize and adjust the model parameters based on the final loss, so that the finally trained target model is more accurate and reliable.
[0091] Another embodiment of this application provides a model training device based on federated transfer learning, as Figure 3 shown, including: The first receiving module 11 is configured to receive the training data set obtained by performing knowledge distillation processing on the original data set for the slave computing node sent by the master computing node. The training data set contains training data corresponding to each original data in the original data set, and each training data includes any one or more of the following labels: class label, result label, and reason label; The training module 12 is configured to perform class training, result training, and reason training on the initial model based on the original data set and the training data set respectively, to obtain an initial class loss, an initial result loss, and an initial reason loss; The obtaining module 13 is configured to determine an initial total loss based on any one or more of the initial class loss, the initial result loss, and the initial reason loss, and adjust the parameters of the initial model based on the initial total loss to obtain the current model. When a predetermined training stop condition is met, the target model is obtained.
[0092] In the specific implementation process of this embodiment, the first receiving module is further configured to: receive the first public key sent by the master computing node; The model training device based on federated transfer learning further includes a first encryption module and a first sending module; The first encryption module is configured to: encrypt the local original data set based on the first public key to generate a first encrypted data set; The first sending module is configured to: send the first encrypted data set to the master computing node for the master computing node to decrypt the first encrypted data set based on the first private key corresponding to the first public key to obtain the original data set.
[0093] In the specific implementation process of this embodiment, the model training device based on federated transfer learning further includes a generating module. The generating module is configured to: pre-generate a second public key and a second private key corresponding to the second public key; the first sending module is further configured to: send the second public key to the master computing node for the master computing node to encrypt the training data set based on the second public key to obtain a second encrypted data set; The first receiving module is specifically configured to: receive the second encrypted data set sent by the master computing node; decrypt the second encrypted data set based on the second private key to obtain the training data set.
[0094] In the specific implementation process of this embodiment, the training module is specifically configured to: respectively construct a category training set including category labels, a result training set including result labels, and a reason training set including reason labels based on the training data set; perform category training on the initial model based on the original data set and the category training set to obtain an initial category loss; perform result training on the initial model based on the original data set and the result training set to obtain an initial result loss; perform reason training on the initial model based on the original data set and the reason training set to obtain an initial reason loss.
[0095] In the specific implementation process of this embodiment, the obtaining module is specifically configured to: determine a first coefficient corresponding to the category label, a second coefficient corresponding to the result label, and a third coefficient corresponding to the reason label; determine an initial total loss based on the initial category loss, the initial result loss, the initial reason loss, the first coefficient, the second coefficient, and the third coefficient.
[0096] In the specific implementation process of this embodiment, the model training device based on federated transfer learning further includes a determination module, and the determination module is configured to: determine whether a predetermined training stop condition is satisfied based on the current loss corresponding to the current model; or determine whether a predetermined training stop condition is satisfied based on the number of training rounds corresponding to the current model.
[0097] The device in this embodiment can receive the training data set obtained by performing knowledge distillation on the original data set sent by the main computing node. Subsequently, the slave computing node can perform multi-task learning on the local initial model based on the training data set and the local original data set, that is, perform reason training / attribution training, result training, and category training respectively, and then determine the final loss based on the losses of each training, and optimize and adjust the model parameters based on the final loss, so that the finally trained target model is more accurate and reliable.
[0098] Another embodiment of this application provides a model training device based on federated transfer learning, as Figure 4 shown, including: A second receiving module 21, configured to receive the original data set sent by the slave computing node; A processing module 22, configured to perform knowledge distillation processing on the original data set based on a predetermined prompt word template and a predetermined large model to obtain a training data set; A second sending module 23, configured to send the training data set to the corresponding slave computing node for the slave computing node to perform model training based on the training data set and the original data set to obtain a target model.
[0099] In the specific implementation process of this embodiment, the model training device based on federated transfer learning further includes a key generation module, and the key generation module is used to: pre-generate a first public key and a first private key corresponding to the first public key; The second sending module is further used to send the first public key to the slave computing node for the slave computing node to encrypt the original data set based on the first public key to obtain a first encrypted data set; The second receiving module is specifically used to: receive the first encrypted data set sent by the slave computing node; decrypt the first encrypted data set based on the first private key to obtain the original data set.
[0100] In the specific implementation process of this embodiment, the processing module is specifically used to: based on a predetermined prompt word template and each piece of original data in the original data set, use a predetermined large model to generate training data corresponding to each piece of original data to obtain a training data set; wherein, each piece of training data respectively includes: any one or several of the category label, the result label, and the reason label.
[0101] In the specific implementation process of this embodiment, the model training device based on federated transfer learning further includes a template generation module, and the template generation module is used to: pre-generate a prompt word template based on a predetermined prompting method; wherein, the predetermined prompting method includes any one or several of the following: zero-shot prompting method, few-shot prompting method, and chain-of-thought prompting method.
[0102] In the specific implementation process of this embodiment, the second receiving module is further used to: receive the second public key sent by the slave computing node; The model training device based on federated transfer learning further includes a second encryption module, and the second encryption module is used to: encrypt the training data set based on the second public key to obtain a second encrypted data set; The second sending module is specifically used to: send the second encrypted data set to the slave computing node for the slave computing node to decrypt the second encrypted data set based on the second private key to obtain the training data set.
[0103] The device in this embodiment obtains a training data set by performing knowledge distillation processing on the original data set, and sends the training data set to the corresponding slave computing node. Subsequently, the slave computing node can perform multi-task learning on the local initial model based on the training data set and the local original data set, that is, perform reason training / attribution training, result training, and category training respectively, and then determine the final loss according to the losses of each training, and optimize and adjust the model parameters based on the final loss, so that the finally trained target model is more accurate and reliable.
[0104] Another embodiment of this application provides an electronic device, such as Figure 5As shown, it includes at least a memory 1 and a processor 2. A computer program is stored on the memory 1. When the processor 2 executes the computer program on the memory 1, the following method steps are implemented: Step 1: Receive the training data set obtained by performing knowledge distillation processing on the original data set for the slave computing node sent by the master computing node. The training data set contains training data corresponding to each original data in the original data set. Each training data respectively includes any one or several of the following labels: class label, result label, and reason label; Step 2: Perform class training, result training, and reason training on the initial model based on the original data set and the training data set respectively to obtain an initial class loss, an initial result loss, and an initial reason loss; Step 3: Determine an initial total loss based on any one or several of the initial class loss, the initial result loss, and the initial reason loss, and adjust the parameters of the initial model based on the initial total loss to obtain the current model. When the predetermined training stop condition is satisfied, the target model is obtained.
[0105] Alternatively, the following method steps are implemented: Step 1: Receive the original data set sent by the slave computing node; Step 2: Perform knowledge distillation processing on the original data set based on a predetermined prompt template and a predetermined large model to obtain a training data set; Step 3: Send the training data set to the corresponding slave computing node for the slave computing node to perform model training based on the training data set and the original data set to obtain the target model.
[0106] For the specific implementation process of the above method steps, reference can be made to the embodiments of any of the above model training methods based on federated transfer learning. This embodiment will not be repeated here.
[0107] In the electronic device of this embodiment, by receiving the training data set obtained by performing knowledge distillation processing on the original data set sent by the master computing node, subsequently, the slave computing node can perform multi-task learning on the local initial model based on the training data set and the local original data set, that is, perform reason training / attribution training, result training, and class training respectively, and then determine the final loss based on the losses of each training, and optimize and adjust the model parameters based on the final loss, so that the finally trained target model is more accurate and reliable.
[0108] The above embodiments are only exemplary embodiments of the present application and are not used to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art can make various modifications or equivalent replacements within the essence and protection scope of the present application, and such modifications or equivalent replacements should also be regarded as falling within the protection scope of the present application.
Claims
1. A model training method based on federated transfer learning, applied to a computing node, characterized in that, Including: Receiving a training data set obtained by performing knowledge distillation processing on the original data set of the slave computing node sent by the master computing node. The training data set contains training data corresponding to each original data in the original data set, and each training data respectively includes any one or several of the following tags: class label, result label, and reason label; Performing class training, result training, and reason training on the initial model based on the original data set and the training data set respectively to obtain an initial class loss, an initial result loss, and an initial reason loss; Determining an initial total loss based on any one or several of the initial class loss, the initial result loss, and the initial reason loss, and adjusting the parameters of the initial model based on the initial total loss to obtain the current model. When a predetermined training stop condition is satisfied, a target model is obtained.
2. The method according to claim 1, wherein Before receiving the training data set sent by the master computing node, the method further includes: Receiving a first public key sent by the master computing node, encrypting the local original data set based on the first public key to generate a first encrypted data set; Sending the first encrypted data set to the master computing node for the master computing node to decrypt the first encrypted data set based on the first private key corresponding to the first public key to obtain the original data set.
3. The method according to claim 1, characterized in that Before receiving the training data set sent by the master computing node, the method further includes: Pre-generating a second public key and a second private key corresponding to the second public key; Sending the second public key to the master computing node for the master computing node to encrypt the training data set based on the second public key to obtain a second encrypted data set; The step of receiving the training data set obtained by performing knowledge distillation processing on the original data set of the slave computing node sent by the master computing node specifically includes: Receiving the second encrypted data set sent by the master computing node; Decrypting the second encrypted data set based on the second private key to obtain the training data set.
4. The method according to claim 1, wherein The step of performing class training, result training, and reason training on the initial model based on the original data set and the training data set respectively to obtain an initial class loss, an initial result loss, and an initial reason loss specifically includes: Respectively constructing a class training set containing class labels, a result training set containing result labels, and a reason training set containing reason labels based on the training data set; Performing class training on the initial model based on the original data set and the class training set to obtain an initial class loss; Performing result training on the initial model based on the original data set and the result training set to obtain an initial result loss; Performing reason training on the initial model based on the original data set and the reason training set to obtain an initial reason loss.
5. The method according to claim 1, characterized in that, The step of determining the initial total loss based on any one or several of the initial class loss, the initial result loss, and the initial reason loss specifically includes: Determining a first coefficient corresponding to the class label, a second coefficient corresponding to the result label, and a third coefficient corresponding to the reason label; Determining the initial total loss based on the initial class loss, the initial result loss, the initial reason loss, the first coefficient, the second coefficient, and the third coefficient.
6. The method according to any one of claims 1-5, characterized in that After obtaining the current model, the method further includes: Determine whether a predetermined training stop condition is satisfied based on the current loss corresponding to the current model; Alternatively, determine whether a predetermined training stop condition is satisfied based on the number of training rounds corresponding to the current model.
7. A model training method based on federated transfer learning, applied to a main computing node, characterized in that, Includes: Receive the original data set sent from the computing node; Perform knowledge distillation processing on the original data set based on a predetermined prompt template and a predetermined large model to obtain a training data set; Send the training data set to the corresponding computing node for the computing node to perform model training based on the training data set and the original data set to obtain a target model.
8. A model training device based on federated transfer learning, characterized in that, Includes: The first receiving module is used to receive the training data set obtained by performing knowledge distillation processing on the original data set for the computing node sent by the master computing node. The training data set contains training data corresponding to each original data in the original data set. Each training data respectively includes any one or several of the following labels: category label, result label, and reason label; The training module is used to perform category training, result training, and reason training on the initial model based on the original data set and the training data set respectively to obtain an initial category loss, an initial result loss, and an initial reason loss; The obtaining module is used to determine an initial total loss based on any one or several of the initial category loss, the initial result loss, and the initial reason loss, and adjust the parameters of the initial model based on the initial total loss to obtain the current model. When a predetermined training stop condition is satisfied, obtain the target model.
9. A model training device based on federated transfer learning, characterized in that, Includes: The second receiving module is used to receive the original data set sent from the computing node; The processing module is used to perform knowledge distillation processing on the original data set based on a predetermined prompt template and a predetermined large model to obtain a training data set; The second sending module is used to send the training data set to the corresponding computing node for the computing node to perform model training based on the training data set and the original data set to obtain a target model.
10. An electronic device, characterized in that, At least includes a memory and a processor. A computer program is stored on the memory. When the processor executes the computer program on the memory, the steps of the model training method based on federated transfer learning according to any one of claims 1-6 or 7 are implemented.
Citation Information
Patent Citations
Training method and device of longitudinal federated learning model, equipment and storage medium
CN113420886A
Federal unsupervised image classification model training method, classification method and equipment based on task migration
CN116229170A
Federal learning method and device, computer and readable storage medium
CN117787429A
Machine Learning Model Training Method And Apparatus
US20190286986A1
System and method for a convolutional neural network for multi-label classification with partial annotations
US20200160177A1