Metalearning-based large language model training method, data classification method and device
By constructing the task pool, dynamic adjustment of task weight and sampling element task set, and combined with hybrid parameter frozen strategies, solve the problem of insufficient adaptability in large language models in cross -task learning and data scarcity scenarios, realizing more efficient training And stronger task adaptability.
Patent Information
- Application Number
- CN202411976752.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-01-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the application of large language models, existing meta-learning methods have problems such as low parameter optimization efficiency and insufficient task adaptability, and it is difficult to effectively deal with cross-task learning and data scarcity scenarios.
By constructing a task pool containing multiple natural language processing tasks, dynamically adjust the task weight and selection probability, the samples obtain the meta -task set, and use a hybrid parameter freezing strategy for global meta -optimization, local meta -optimization and attention mechanism optimization. Big language model for learning.
Improving the adaptability and training efficiency of large language models under multi -tasking and different data distribution, and enhanced the extensive adaptability and task generalization capabilities of the model.
Smart Images

Figure CN119378652A_ABST
Abstract
Description
Background Art
[0002] In the field of natural language processing, large language models have demonstrated excellent performance in a variety of tasks. However, traditional large language model training methods often rely on a large amount of data and computing resources, are sensitive to new tasks or changes in data distribution, and usually require retraining or fine-tuning the entire model, making the training process time-consuming and labor-intensive, and difficult to adapt to dynamic environments. In particular, traditional methods are difficult to effectively respond to cross-task learning and scenarios where task data is scarce.
[0003] In recent years, meta-learning, as a method of "learning how to learn", enables models to quickly adapt to new tasks or environments. Meta-learning enables models to quickly adjust their own parameters when faced with new tasks by learning the commonalities of tasks, thereby reducing their reliance on large-scale data. However, existing meta-learning methods often have problems with low parameter optimization efficiency and insufficient task adaptability in the application of large language models. Therefore, there is still room for improvement in the large language model training methods based on meta-learning in related technologies.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute relevant technology known to ordinary technicians in the field. Summary of the invention
[0005] The purpose of the embodiments of the present disclosure is to provide a large language model training method based on meta-learning, a data classification method, a large language model training device based on meta-learning, a data classification device, an electronic device and a computer-readable storage medium, thereby at least to a certain extent improving the adaptability and training efficiency of the large language model under multiple tasks and different data distributions.
[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0007] According to a first aspect of an embodiment of the present disclosure, a large language model training method based on meta-learning is provided, the method comprising: acquiring training data, and constructing a task pool including multiple natural language processing tasks based on the training data; dynamically adjusting the task weights of the natural language processing tasks based on an adaptive mechanism, and determining the selection probability corresponding to each of the natural language processing tasks based on the task weights; sampling the task pool based on the selection probability to obtain a meta-task set; based on a hybrid parameter freezing strategy, using the meta-task set to perform global meta-optimization, local meta-optimization and attention mechanism optimization on a pre-trained model to obtain the large language model based on meta-learning.
[0008] In some example embodiments of the present disclosure, based on the aforementioned scheme, the acquiring of training data and constructing a task pool including multiple natural language processing tasks based on the training data include: acquiring training data from multiple data sources and constructing a task pool including multiple natural language processing tasks based on the training data; determining the task type of the corresponding natural language processing task based on data characteristics of the training data; and performing text cleaning, data enhancement, and formatting on the training data.
[0009] In some example embodiments of the present disclosure, based on the aforementioned solution, dynamically adjusting the task weight of the natural language processing task based on an adaptive mechanism, and determining the selection probability corresponding to each of the natural language processing tasks based on the task weight, includes: according to: ; Determine the loss function corresponding to each of the natural language processing tasks; wherein, i Indicates the task corresponding to the current loss calculation, T Indicates the task type. represents the model parameters, Represents a query set, x Represents the input text, that is, the current sample content. y represents the target output, that is, the true label corresponding to the current sample, represents the prediction function, ik Represents the sample index in the query set, that is, the specific sample for the current loss calculation. represents the calculated loss function corresponding to each of the natural language processing tasks; Using the loss function, according to: ; The task weight of the natural language processing task is adjusted; wherein, Indicates the task The corresponding initial weight, represents the temperature parameter, which is used to control the smoothness of weight update. Indicates the updated task The corresponding task weight; The task weights are normalized, and based on the normalized task weights, according to: ; The selection probability corresponding to each of the natural language processing tasks is adjusted so that the model learns high-weight tasks first, where Indicates the task The corresponding selection probability is N represents the total number of tasks in the task pool,j Indicates the first j task.
[0010] In some example embodiments of the present disclosure, based on the above scheme, sampling the task pool based on the selection probability to obtain a meta-task set includes: Extracting tasks from the task set according to the selection probability corresponding to each of the natural language processing tasks to obtain an initial meta-task set; according to: ; The initial meta-task set is measured for similarity to obtain a similarity matrix corresponding to each pair of tasks in the initial meta-task set; wherein, Representation Task The characteristic vector of Representation Task The characteristic vector of Representation Task and tasks The similarity matrix between Based on the similarity matrix, according to: ; The task combination in the initial meta-task set is adjusted to obtain an optimized meta-task set; wherein, represents the optimized meta-task set, represents the first optimization coefficient, represents the second optimization coefficient, m represents the number of tasks in the meta-task set, Represents the initial meta-task set.
[0011] In some example embodiments of the present disclosure, based on the aforementioned scheme, the process of performing global meta-optimization on the pre-trained model includes: Based on the comprehensive loss function of all tasks in the meta-task set, according to: ; Optimizing the basic parameters in the pre-trained model to obtain a global meta-optimized model; wherein, represents the globally optimized parameters, Represents the basic parameters, represents the learning rate, represents the gradient calculation of the basic parameters, represents the loss function of each task in the global optimization.
[0012] In some example embodiments of the present disclosure, based on the above scheme, the process of performing local meta-optimization on the pre-trained model includes: according to: ; The pre-trained model is locally meta-optimized, wherein: represents the locally optimized parameters, represents the local learning rate, Express support for the concentration i samples.
[0013] In some example embodiments of the present disclosure, based on the aforementioned scheme, the process of optimizing the attention mechanism of the pre-trained model includes: using the attention mechanism, according to: ; The pre-trained model is optimized for the attention mechanism, wherein: represents the attention weight matrix, represents the learnable parameters of the attention mechanism and softmax represents the activation function.
[0014] In some example embodiments of the present disclosure, based on the aforementioned scheme, the above-mentioned large language model training method based on meta-learning also includes: based on a comprehensive evaluation mechanism, evaluating the performance of the large language model on each of the natural language processing tasks; adjusting the parameters of the large language model according to the evaluation results; deploying the large language model with adjusted parameters, and updating the parameters of the large language model in real time according to application feedback.
[0015] According to a second aspect of an embodiment of the present disclosure, a data classification method is provided, the method comprising: obtaining data to be classified, wherein the data to be classified is graph structure data; inputting the data to be classified into a target large language model to obtain a classification result of the data to be classified; wherein the target large language model is trained according to the large language model training method based on meta-learning in the above-mentioned embodiment.
[0016] According to a third aspect of an embodiment of the present disclosure, a large language model training device based on meta-learning is provided, the device comprising: a task pool construction module, used to obtain training data, and construct a task pool containing multiple natural language processing tasks based on the training data; a selection probability determination module, used to dynamically adjust the task weights of the natural language processing tasks based on an adaptive mechanism, and determine the selection probability corresponding to each of the natural language processing tasks based on the task weights; a task sampling module, used to sample the task pool based on the selection probability to obtain a meta-task set; a meta-optimization module, used to perform global meta-optimization, local meta-optimization and attention mechanism optimization on the pre-trained model using the meta-task set based on a hybrid parameter freezing strategy to obtain the large language model based on meta-learning.
[0017] According to a fourth aspect of an embodiment of the present disclosure, a data classification device is provided, comprising: a data acquisition module, used to acquire data to be classified, wherein the data to be classified is graph structure data; a data classification module, used to input the data to be classified into a target large language model to obtain a classification result of the data to be classified; wherein the target large language model is trained according to the large language model training method based on meta-learning as described in the above embodiment.
[0018] According to a fifth aspect of an embodiment of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the above-mentioned large language model training method or data classification method based on meta-learning is implemented.
[0019] According to a sixth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the large language model training method or data classification method based on meta-learning is implemented.
[0020] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects: In the example embodiment of the present disclosure, the large language model training method based on meta-learning, on the one hand, by constructing a task pool containing multiple natural language processing tasks, ensures that the model can adapt to multi-task and diversified data distribution, and lays the foundation for improving the model's wide adaptability and task generalization ability. On the other hand, the adaptive mechanism dynamically adjusts the task weight according to the performance of the model on each task, gives priority to tasks with higher difficulty or greater importance, and improves the learning efficiency of the model on key tasks; by determining the task selection probability, the adaptive allocation of difficulty and weight during model training is guaranteed, which effectively accelerates the training process and reduces the resource consumption of invalid learning. On the other hand, by sampling tasks from the task pool based on the task selection probability, it is ensured that the model obtains a representative task combination in each training, constructs an efficient meta-task set, and improves the model's learning ability for the commonality between multiple tasks, making it more adaptable between different tasks; in addition, the hybrid parameter freezing strategy gradually unfreezes the model parameters, cooperates with global and local meta-optimization, and improves the model's adaptability and task-to-task migration ability layer by layer, avoiding the computational burden and overfitting risk caused by the simultaneous optimization of all parameters. The optimization of the attention mechanism further enhances the model's ability to focus on important features, making it more efficient and accurate in multi-task training. This further improves the adaptability and training efficiency of large language models under multiple tasks and different data distributions.
[0021] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0023] Figure 1 A flowchart of a large language model training method based on meta-learning according to some embodiments of the present disclosure is schematically shown.
[0024] Figure 2 A schematic diagram of a training process based on global meta-optimization and local meta-optimization according to some embodiments of the present disclosure is schematically shown.
[0025] Figure 3 A flowchart of another large language model training method based on meta-learning according to some embodiments of the present disclosure is schematically shown.
[0026] Figure 4 A schematic diagram of a training process of a graph neural network according to some embodiments of the present disclosure is schematically shown.
[0027] Figure 5 A block diagram of a large language model training device based on meta-learning according to some embodiments of the present disclosure is schematically shown.
[0028] Figure 6 A block diagram of a data classification device according to some embodiments of the present disclosure is schematically shown.
[0029] Figure 7 A schematic diagram of the structure of a computer system of an electronic device according to some embodiments of the present disclosure is schematically shown.
[0030] Figure 8 A schematic diagram of a computer-readable storage medium according to some embodiments of the present disclosure is schematically shown.
[0031] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION
[0032] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this specification. Instead, they are merely examples of devices and methods consistent with some aspects of this specification as detailed in the appended claims.
[0033] The terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit this specification. The singular forms "a", "the" and "the" used in this specification and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0034] It should be understood that although the terms first, second, third, etc. may be used in this specification to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0035] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more comprehensive and complete and will fully convey the concept of the example embodiments to those skilled in the art.
[0036] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.
[0037] Furthermore, the drawings are only schematic illustrations and are not necessarily drawn to scale. The block diagrams shown in the drawings are only functional entities and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0038] In the exemplary embodiment of the present disclosure, a large language model training method based on meta-learning is first proposed. Figure 1 The following schematically shows a flow chart of a large language model training method based on meta-learning according to some embodiments of the present disclosure. Figure 1 As shown, the large language model training method based on meta-learning may include the following steps: Step S110, obtaining training data, and constructing a task pool including multiple natural language processing tasks based on the training data; Step S120, dynamically adjusting the task weights of the natural language processing tasks based on an adaptive mechanism, and determining the selection probability corresponding to each of the natural language processing tasks based on the task weights; Step S130, sampling the task pool based on the selection probability to obtain a meta-task set; Step S140, based on the hybrid parameter freezing strategy, using the meta-task set to perform global meta-optimization, local meta-optimization and attention mechanism optimization on the pre-trained model to obtain the large language model based on meta-learning.
[0039] This method first obtains a large amount of training data to build a task pool containing a variety of natural language processing tasks (such as text classification, question answering, sentiment analysis, etc.) to provide the model with diverse training tasks; then, an adaptive mechanism is used to dynamically calculate and adjust the task weight of each task, giving priority to increasing the weight of more difficult or critical tasks, and then the selection probability of each task is determined based on these weights; according to the calculated selection probability, sampling is performed from the task pool to build a meta-task set containing representative tasks to ensure that the model can obtain diverse and efficient learning data during training; finally, during model training, a hybrid parameter freezing strategy is used to gradually unfreeze some model parameters to control the learning process of the model, and the model is optimized globally, locally, and with the attention mechanism in combination with the meta-task set, so that the model can effectively learn cross-task commonalities and key features, and finally a large language model based on meta-learning with higher adaptability and generalization ability in a multi-task and dynamic data environment is obtained.
[0040] Next, the large language model training method based on meta-learning in the above example embodiment will be further described.
[0041] In step S110, training data is obtained, and a task pool including multiple natural language processing tasks is constructed based on the training data.
[0042] Among them, training data can refer to the dataset used to build and train large language models, including text content and its corresponding labels or target outputs. Training data can be obtained from public datasets (such as GLUE datasets, SQuAD datasets, WMT datasets, etc.), specific field data (such as text data in the fields of medicine, finance, etc.), and synthetic data (samples generated by generative models or data augmentation techniques) to cover a wide range of task types, languages, text lengths, fields, and difficulties, laying the foundation for model learning.
[0043] Natural language processing tasks can represent specific task types performed based on training data, which are used to improve the model's capabilities in specific fields, including but not limited to text classification, sentiment analysis, machine translation, question answering, named entity recognition, etc. Each natural language processing task consists of a set of training data samples, with specific inputs (such as text) and outputs (such as category labels or translation results), which help the model to be trained and optimized in a specific direction.
[0044] The task pool can represent a task set consisting of multiple natural language processing tasks, which is the basis for meta-learning training. The task pool contains multiple tasks, each of which has an independent data set and is divided into a support set and a query set for model training and evaluation, respectively.
[0045] In some embodiments, training data is obtained, and a task pool including multiple natural language processing tasks is constructed based on the training data, specifically including the following steps: obtaining training data from multiple data sources, and constructing a task pool including multiple natural language processing tasks based on the training data; determining the task type of the corresponding natural language processing task based on the data characteristics of the training data; and performing text cleaning, data enhancement, and formatting on the training data.
[0046] Specifically, from a variety of data sources The training data is obtained from Represents a data source, according to each data source The characteristics of the training data in the training data determine the specific task type it corresponds to . Task Type It can be text classification, sentiment analysis, machine translation, question answering, etc. For example, the GLUE dataset can correspond to the text classification task, the SQuAD dataset can correspond to the question answering task, the WMT dataset can correspond to the machine translation task, etc. Randomly sample samples to form each task The initial training data, for example, is from a data source Medium Sampling The samples are ,in, It is i of the tasks j input samples, is its corresponding label or target output.
[0047] Then, the samples in the initial training data are cleaned to remove redundant punctuation, HTML tags, repeated content and other noise. The training data after text cleaning can be expressed as: .
[0048] Next, perform data enhancement on the training data after text cleaning to expand the training data to increase the diversity of samples and the generalization ability of the model. For example, generate enhanced samples through synonym replacement, back translation, random deletion and other methods. Synonym replacement can be used to replace some words in the text with synonyms to generate different samples. Back translation can be used to translate the text into another language and then translate it back to the original language to obtain new samples. Random deletion can be used to delete non-key information words in the sentence, maintaining the meaning of the sentence while enhancing the model's attention to key information. The training data after data enhancement can be expressed as: ,in, represents the data augmentation function.
[0049] Secondly, the training data after data augmentation is formatted, and the data of all tasks is converted into a unified input-output format to meet the unified input requirements of the model. For example, all training data is formatted as of the form, where x is the input text, y is the target output (such as a category label). The formatted training data can be represented as .
[0050] Finally, the formatted training data is constructed into the structure required for meta-learning training. Specifically, each task The data set is divided into support set and queryset , the support set is used for model training, and the query set is used for model evaluation. Assume that the partition ratio is and , then the support set can be expressed as: , the query set can be expressed as . Combine the support sets and query sets of all tasks into an initial task pool , where each task , then the initial task pool , N Can represent the number of tasks.
[0051] In step S120, the task weights of the natural language processing tasks are dynamically adjusted based on the adaptive mechanism, and the selection probability corresponding to each natural language processing task is determined based on the task weights.
[0052] Among them, the adaptive mechanism can refer to a mechanism for dynamically adjusting the training strategy based on the learning status of the model and the difficulty of the task. Its function is to evaluate the difficulty of the task and the learning progress of the model in real time according to the performance of the model on each task, and by adjusting the priority of each task, the model can focus more resources on tasks with high difficulty or that have a greater impact on overall performance.
[0053] Task weight can be expressed as a numerical value assigned to each natural language processing task to indicate the importance or priority of the task during training. The size of the weight is adjusted in real time by an adaptive mechanism and can be set according to the difficulty of the task or the performance of the model on the task. For example, tasks with high losses will be given a larger weight to increase the frequency of the model's learning on the task. Adjusting task weights helps balance training resources, allowing the model to focus on high-priority tasks and improve overall learning results.
[0054] The selection probability can represent the sampling probability assigned to each task according to the task weight, which is used to control the frequency of selecting tasks in the task pool. The size of the selection probability can be determined by the normalized task weight. A higher task weight will correspond to a greater selection probability, ensuring that the model extracts the task more frequently for training.
[0055] In some embodiments, dynamically adjusting the task weight of the natural language processing task based on an adaptive mechanism and determining the selection probability corresponding to each natural language processing task based on the task weight specifically includes the following steps: First, according to: ; Determine the loss function corresponding to each natural language processing task; where, i Indicates the task corresponding to the current loss calculation, T Indicates the task type. represents the model parameters, Represents a query set, x Represents the input text, that is, the current sample content. y represents the target output, that is, the true label corresponding to the current sample, represents the prediction function, ik Represents the sample index in the query set, that is, the specific sample for the current loss calculation. Represents the calculated loss function corresponding to each natural language processing task.
[0056] Then, using the loss function, according to: ; Adjust the task weights of natural language processing tasks; among them, Indicates the task The corresponding initial weight, represents the temperature parameter, which is used to control the smoothness of weight update. Indicates the updated task The corresponding task weight.
[0057] Finally, the task weights are normalized, and based on the normalized task weights, according to: ; The selection probability corresponding to each natural language processing task is adjusted so that the model learns high-weight tasks first, where Indicates the task The corresponding selection probability is N Represents the total number of tasks in the task pool, j Indicates the first j task.
[0058] In this embodiment, by calculating the loss function of each task, the performance of the model on different tasks is dynamically evaluated to ensure that the task weights more accurately reflect the difficulty or importance of the task, so that the model can focus on more difficult or critical tasks and optimize the learning effect. The task weights are adjusted according to the loss function, the weights of high-loss tasks are increased, and the update smoothness is controlled with the help of temperature parameters to make the weight update more adaptive and stable, avoiding excessive fluctuations in the model in the task weight update. In addition, by normalizing the task weights and calculating the selection probability, the model can sample tasks according to priority and increase the sampling frequency of important tasks, thereby achieving optimal resource allocation and making the training process more efficient.
[0059] In step S130 , the task pool is sampled based on the selection probability to obtain a meta-task set.
[0060] Among them, the meta-task set can represent a set of representative tasks sampled from the task pool, which is used for training and optimization of the large language model in the meta-learning iteration. By selecting probability sampling, the meta-task set contains tasks with higher importance, so that the large language model can focus on tasks with higher priority in the training iteration, effectively improving the training efficiency.
[0061] In some embodiments, sampling the task pool based on the selection probability to obtain a meta-task set specifically includes the following steps: First, according to the selection probability corresponding to each natural language processing task, the task set is extracted to obtain the initial meta-task set. ,in, According to the probability of selection Sampling from the task pool m By selecting probability sampling and obtaining the initial meta-task set, high-weight tasks are prioritized to ensure the representativeness of tasks in the meta-task set, so that the model can learn the characteristics of key tasks during training and improve the performance of the model on different tasks.
[0062] Then, according to: ; The similarity is measured for the initial meta-task set to obtain the similarity matrix corresponding to each pair of tasks in the initial meta-task set; Representation Task The characteristic vector of Representation Task The characteristic vector of Representation Task and tasks The similarity matrix between them. The similarity metric is used to perform similarity analysis on the tasks of the initial meta-task set. By calculating the similarity between feature vectors, generating a similarity matrix and adjusting the task combination, redundant tasks can be effectively reduced, so that the meta-task set covers more tasks with different characteristics, thereby enhancing the multi-task adaptability and training effect of the model.
[0063] Next, based on the similarity matrix, according to: ; Adjust the task combination in the initial meta-task set to obtain the optimized meta-task set; represents the optimized meta-task set, represents the first optimization coefficient, represents the second optimization coefficient, m represents the number of tasks in the meta-task set, Represents the initial meta-task set. The meta-task set optimized by the similarity matrix is more balanced in terms of task types. The meta-task set includes both high-priority tasks and diverse task types, which helps the model learn shared features between different tasks and improves the generalization ability in a multi-task environment.
[0064] In addition, in the optimized meta-task set In the above example, we re-partition the support set for each task. and queryset , used for meta-learning training. The repartitioned support set can be expressed as: , the repartitioned query set can be expressed as: ,in, b It can represent the partition ratio parameter of the support set.
[0065] In step S140, based on the hybrid parameter freezing strategy, the meta-task set is used to perform global meta-optimization, local meta-optimization and attention mechanism optimization on the pre-trained model to obtain a large language model based on meta-learning.
[0066] Among them, the hybrid parameter freezing strategy can represent an optimization strategy that gradually unfreezes some parameters during model training. This strategy freezes most model parameters at the beginning of training and only allows some key parameters to be updated to reduce the amount of calculation and the risk of overfitting. As the training progresses, more parameters are gradually unfrozen, allowing the model to gradually adapt to new task data while maintaining stability, thereby improving training efficiency and results. This strategy effectively balances the learning speed and generalization ability of the model, and is particularly suitable for meta-learning training of large language models.
[0067] A pre-trained model can refer to a language model that is pre-trained in the initial stage based on a large-scale dataset and a specific task, and is used to provide high-quality initial parameters, such as the GPT model, the BERT model, etc.
[0068] Global meta-optimization can represent a unified optimization process for the parameters of the entire pre-trained model, updating the basic parameters of the model based on the comprehensive loss function calculated by the meta-task set. Global meta-optimization is mainly used to find the optimal universal parameters on multiple tasks, so that the model has the ability to cope with a wide range of tasks, and improve the model's ability to understand the commonality of tasks and enhance its generalization performance across different tasks.
[0069] Local meta-optimization can represent the refinement of some model parameters on a specific task, and quickly adjust the model to adapt to a specific task based on the support set data of each task in the meta-task set. Through local meta-optimization, the model can refine the learning process of certain specific tasks based on global parameters, improve the accuracy and adaptability of the model on the task, and is especially suitable for personalized tasks and tasks with large differences in data distribution.
[0070] Attention mechanism optimization can mean introducing an attention mechanism during the model training process to enhance the model's ability to identify important features. The attention mechanism enables the model to pay more attention to key information related to the task objectives by assigning different weights to different parts of the input. In the meta-learning process, by optimizing the attention mechanism, the model can more accurately capture the key content of the input text in multi-task training, further improving the model's performance and adaptability to different tasks.
[0071] In some embodiments, the process of performing global meta-optimization on the pre-trained model includes: based on the comprehensive loss function of all tasks in the meta-task set, according to: ; Optimize the basic parameters in the pre-trained model to obtain a global meta-optimized model; represents the globally optimized parameters, Represents the basic parameters, represents the learning rate, represents the gradient calculation of the basic parameters, represents the loss function of each task in the global optimization.
[0072] In some embodiments, the process of performing local meta-optimization on the pre-trained model includes: ; Perform local meta-optimization on the pre-trained model, where represents the locally optimized parameters, represents the local learning rate, Express support for the concentration i The feature vector of the samples.
[0073] In some embodiments, the process of optimizing the attention mechanism of the pre-trained model includes: using the attention mechanism according to: ; Optimize the attention mechanism of the pre-trained model, where represents the attention weight matrix, represents the learnable parameters of the attention mechanism and softmax represents the activation function.
[0074] Figure 2 The schematic diagram shows a training process based on global meta-optimization and local meta-optimization. Specifically, the task pool contains multiple natural language processing tasks (task 1 to task N), each of which is divided into a support set and a query set, where the support set is used for training the model on a specific task (local optimization), and the query set is used to evaluate the performance of the model on the task.
[0075] By Task As an example, the model first uses the task The local optimization process updates the model parameters through gradient descent to adapt to the task For specific needs, the local optimization process can be expressed as: ,in, Represents global parameters, represents the learning rate, Indicates that the model is in the task The loss function on the support set, represents the model parameters that are locally optimized.
[0076] Next, use the updated parameters , the model is in the task Evaluate on the query set and calculate the loss function , the calculation process can be expressed as: ,in, Representation Task The query set, represents the model prediction value, Represents the loss function. By calculating the task The loss value on the query set, as the model's performance on the task Adaptability evaluation indicators.
[0077] Then, the query set losses of all tasks in the task pool are aggregated to calculate the global meta-optimization loss , the calculation process can be expressed as: ,in, represents the training task set, Representation Task Meta-loss on the query set.
[0078] Finally, through global optimization, the comprehensive loss is fed back to the global parameters θ The basic parameters of the model are updated to make it more adaptable and generalizable across different tasks. This process uses the support set for local optimization, allowing the model to be adjusted on each task separately, and then performs global optimization by evaluating the loss on the query set. Combining global and local optimization, the model can effectively learn the commonalities across tasks and improve its performance on different tasks.
[0079] In some embodiments, the large language model training method based on meta-learning also includes the following steps: based on a comprehensive evaluation mechanism, evaluating the performance of the large language model on each natural language processing task; adjusting the parameters of the large language model according to the evaluation results; deploying the large language model with adjusted parameters, and updating the parameters of the large language model in real time according to application feedback.
[0080] Specifically, in a multi-task environment, a comprehensive evaluation mechanism is used to comprehensively evaluate the performance of the large language model on various natural language processing tasks. Specifically, the performance of the model on each task is quantified through indicators of multiple dimensions (such as accuracy, F1 score, loss value, etc.). For example, for classification tasks, the accuracy or F1 score is calculated; for question-answering tasks, the exact match rate of the answer is calculated; for machine translation tasks, the BLEU score is calculated, etc. This allows the performance of the model to be analyzed from multiple angles in order to identify which tasks perform well and which tasks need further optimization. This multi-dimensional evaluation method can ensure that the evaluation results are more accurate and comprehensive, which is convenient for subsequent parameter optimization.
[0081] Based on the evaluation results of the comprehensive evaluation mechanism, the performance differences of the model on each task are determined, and the tasks or parameters that need further optimization are identified. By analyzing the specific task performance, the global parameters of the model or the parameters of certain specific tasks can be selectively adjusted to improve the adaptability of low-performing tasks. Parameter adjustment strategies may include optimizing task weights, adjusting learning rates, or fine-tuning local parameters of the model according to the complexity of the task. Through this targeted parameter optimization, the model can better adapt to multi-task environments, balance the performance between tasks, and improve overall task processing capabilities.
[0082] The parameter-adjusted large language model is then deployed to an application environment, such as a server, cloud, or embedded device, to support real-time reasoning and task processing. During the deployment process, load testing and response time testing are usually performed to ensure the stability and efficiency of the model in actual applications. Load testing can ensure the performance of the model in a high-concurrency environment, while response time testing can verify the real-time performance of the model to ensure that it meets user needs. The deployment process also includes steps such as servitization, interface construction, and environment adaptation so that the model can be smoothly integrated into actual applications and run normally.
[0083] In addition, in the actual application of the model, by monitoring the running status of the model and collecting user feedback, we can understand the real-time performance of the model, including error rate, delay, task completion rate, etc. Based on these feedback data, the model parameters are adjusted in real time to optimize the application effect of the model. For example, the task weights can be adjusted dynamically to improve the model's responsiveness to key tasks; or the learning rate can be updated adaptively so that the model can adapt to changes in the distribution of data streams. Through this real-time parameter update and adaptive adjustment, the model can be continuously optimized in a dynamic application environment, thereby maintaining high efficiency and stability to meet the needs of different scenarios and tasks.
[0084] Figure 3 A flowchart of another large language model training method based on meta-learning is schematically shown.
[0085] First, build a task pool. Collect training data from a variety of data sources (such as public data sets, domain-specific data, and synthetic data) to form a task data set. Perform text cleaning, data enhancement, and formatting on the collected task data to ensure data quality and consistency. According to the type and content of the task data, determine the specific type of each task (such as text classification, sentiment analysis, etc.), and divide the data into a support set and a query set to form an initial task pool.
[0086] Then, perform adaptive task generation. Calculate the model's loss function on the query set of each task to evaluate the model's performance on each task. Update the task weights based on the loss function to make the model pay more attention to high-difficulty tasks. Normalize the task weights to ensure that the sum of the weights is 1. Dynamically adjust the selection probability of each task based on the updated task weights.
[0087] Secondly, sample the meta-task set. According to the selection probability of the task, sample a set of tasks from the task pool to form a meta-task set. Calculate the task similarity to ensure the diversity and representativeness of the task combination and avoid the model being trained only on similar tasks. In the optimized meta-task set, re-divide the support set and query set to better support meta-learning training.
[0088] Next, the model parameters are initialized. Initial parameters are loaded from the pre-trained model to provide a high-quality training starting point. The model parameters are gradually unfrozen to gradually adapt the model to the data distribution of the meta-task set. The optimization parameters are set by the initial state, and the subsequent gradual unfreezing and adjustment parameters are used to gradually adapt the model to the new task.
[0089] Subsequently, the meta-learning training process is carried out. The basic parameters of the model are globally meta-optimized to enhance the versatility of the model. Rapid learning is performed on the support set, and local meta-optimization is performed to adapt the model to specific tasks. The attention mechanism is introduced to improve the model's ability to identify key information.
[0090] In addition, the model is evaluated and fine-tuned. Based on the query set, the comprehensive performance of the model on different tasks is evaluated to determine the pros and cons of the model on each task. Based on the evaluation results, the model parameters are fine-tuned to optimize the model's adaptability on low-performance tasks.
[0091] Finally, perform model deployment and adaptive online learning. Deploy the optimized and fine-tuned model to the application environment and provide real-time feedback data. Perform real-time tuning based on actual needs in the application environment. Update model parameters in real time based on application feedback and new data to maintain the performance of the model in a dynamic environment.
[0092] In some embodiments, reference Figure 4 As shown, a method for training a graph neural network based on a large language model training method based on meta-learning is also provided. The graph neural network can be used to process classification problems. This embodiment uses the Cora dataset as training data for illustration. The Cora dataset contains 2708 scientific publications, which are divided into 7 categories. The citation relationship between each publication constitutes 5429 edges, and each node has a 1433-dimensional bag-of-words feature, which indicates the occurrence of words in the vocabulary. Figure 4 The specific training process is described in detail.
[0093] First, we build a task pool. Specifically, we select the Cora dataset as the task data source and define the task type on the Cora dataset as "node classification task". The input includes: point feature matrix , each row represents the feature vector of a node; the adjacency matrix ,in Representation Node i and nodes j There is a reference relationship between them. The output includes: the category label vector of the node , using codes from 0 to 6 to represent 7 categories. Using the entire Cora dataset as the initial task dataset, the initial task dataset can be expressed as: .
[0094] Preprocess the initial task dataset. Specifically, remove isolated nodes and invalid edges. Check the adjacency matrix , delete isolated nodes that are not connected. Verify the adjacency matrix Is it symmetric? If not, adjust it. Enhance the data by randomly deleting edges: Randomly delete 5% of the edges, delete 272 out of 5429 edges, and generate a new adjacency matrix By randomly deleting different edges multiple times, multiple enhanced adjacency matrices can be obtained to increase data diversity. All preprocessed task data are represented as a unified input format, including the node feature matrix and multiple enhanced adjacency matrix sets Then, we construct the initial task pool, randomly select 80% of the nodes as the support set (for model training) and 20% of the nodes as the query set (for model evaluation), where the support set can be expressed as , containing 2166 samples; the query set can be expressed as , containing 542 samples. Figure 4 As shown, the task subgraph and the test subgraph contain multiple support sets and query sets.
[0095] Then, adaptive task generation is performed. The model parameters obtained through training , in the query set Predict the category of each node, and then calculate the cross entropy loss to measure the difference between the model prediction and the true label. The loss function can be defined as: ; in, represents the loss function, Indicates i Task No. k input samples, Represents the input sample The corresponding true label, Represents a query set The number of samples in c Indicates the category index. The Cora dataset has 7 categories, with a value range of 1 to 7. Represents the model's response to the input sample Predicted as class c probability; Represents the true label One-hot representation of Represents the model's response to the input sample In category c The predicted probability of .
[0096] Use the loss value to update the task weight. The task weight update formula can be expressed as: ; in, represents the updated task weight, represents the initial task weight, exp represents the exponential function used to smooth the effect of weight update, and τ represents the temperature parameter. Assume that the initial task weight is w (Cora)=1.0, loss value =0.8, temperature parameter τ=1.0, then the updated task weight is 0.45. The sum of the current task weights is calculated to ensure that the sum of the task weights is 1. In this embodiment, since there is only one node classification task, the weight is still about 0.45 after normalization.
[0097] Subsequently, the task pool is sampled to obtain the meta-task set. During the task sampling process, the most suitable task is selected for training based on the task weights calculated previously. The selection of tasks is based on the weights. Tasks with higher weights have higher priorities. Since there is only one task in this real-time example, namely the node classification task for the Cora dataset, the node classification task is directly selected for training. The meta-task set can be expressed as In this embodiment, since there is only one task in the meta-task set, there is no need to perform task combination optimization.
[0098] Next, the model parameters are initialized. First, the parameters of the model are initialized through a pre-trained graph neural network (such as GraphSAGE or GAT model, etc.). The pre-trained model has been preliminarily trained on a large-scale data set and has a certain feature learning ability. It can provide an effective initial parameter configuration for the current task and reduce the difficulty of learning the model from scratch on a new task. The specific process includes: selecting a suitable pre-trained model as the initial parameter source. In this embodiment, the GAT model is selected as the pre-trained model. The parameters of the pre-trained model are used as the initial parameters of the current large language model. These initial parameters are fine-tuned and optimized in the subsequent meta-learning training process to meet the needs of specific tasks.
[0099] In the initialization phase, a hybrid parameter freezing strategy is adopted, that is, only some model parameters are unfrozen in the initial phase (for example, only the weights of the graph convolutional layer are unfrozen), while the rest of the parameters are frozen. The purpose of this strategy is to allow the model to fully utilize the feature learning ability of the pre-trained model in the early training process, while reducing unnecessary parameter updates and maintaining the stability of the training process. The specific process includes: only a part of the parameters are unfrozen in the initial phase, so that the model can focus on the learning of key layers. Other parameters remain frozen to avoid overfitting and unstable parameter changes. As the training progresses, more parameters are gradually unfrozen to adapt the model to the data distribution of the current task in a layer-by-layer manner. The unfreezing strategy usually unfreezes a new layer of parameters every 10 epochs of training until all parameters are unfrozen. The final model will be fully trained based on all parameters to improve performance on specific tasks.
[0100] Subsequently, the pre-trained model is optimized globally, locally, and by the attention mechanism using the meta-task set. Specifically, in the global meta-optimization phase, the model optimizes global parameters through the support sets of multiple tasks, thereby improving its initial performance on the Cora task. The specific process is as follows: First, the comprehensive loss on the Cora dataset is calculated to guide the optimization of global parameters. The formula for calculating the comprehensive loss is: ; in, Represents the meta-loss of the node classification task, that is, the overall classification loss of the model on the Cora dataset.
[0101] In the support set The classification loss of the model is calculated above, and the global parameters are updated by the gradient descent method. The update formula can be expressed as: ; in, represents the updated global parameters, Represents global parameters, Represents the gradient of global loss to global parameters, which is used to adjust parameters. Represents the learning rate.
[0102] ; Perform local meta-optimization on the model. Perform fast learning on the support set to optimize the local parameters of the model to adapt to the specific task, that is, the characteristics of the node classification task of the Cora dataset. Through fast learning, the local parameters of the model are adjusted for the node classification task of the Cora dataset. The process of local meta-optimization can be expressed as: ; in, represents the model parameters after local optimization, Represents the local learning rate, which is used to control the step size of local parameter updates. Represents the loss of the model on the Cora task support set.
[0103] Optimize the model's attention mechanism. Introduce the Graph Attention Network (GAT) to enhance the model's ability to learn the relationship between nodes and edges. Use the GAT model to model the relationship between nodes more finely, thereby improving the model's recognition of node importance. The optimization process of the attention mechanism can be expressed as: ; in, represents the attention weight matrix, represents the learnable parameters of the attention mechanism, softmax represents the activation function, Represents the feature matrix of all nodes in the Cora task support set.
[0104] refer to Figure 4As shown in the figure, for the support set and query set of each task subset and test subset, the GAT model is used for training to enhance the model's ability to learn the nodes and their relationships in the graph. Local optimization is performed on the support set of each task, so that the model can quickly adapt to the characteristics of a specific task, and the performance of the model on the task is improved by adjusting local parameters. Specifically, the GAT model uses the attention mechanism to calculate the relationship weights between nodes, thereby improving the representation ability of graph structure data. And the GAT model is trained on the task subset and the test subset respectively, so that the model can learn the optimal representation on different tasks. Local optimization is performed on the support set of each task, so that the model can quickly adapt to the characteristics of a specific task, and the performance of the model on the task is improved by adjusting local parameters. After summarizing the optimization feedback of each task, the global parameters of the model are optimized based on the overall characteristics of the task set, so that the model can obtain higher adaptability and generalization in a multi-task environment. The combination of global meta-optimization and local meta-optimization enables the model to have both the ability to fine-tune specific tasks and the versatility to adapt to the overall task pool.
[0105] After optimizing the attention mechanism, a trained graph neural network model is obtained. This model can be used for classification tasks of graph structured data. In addition, for this graph neural network model, a multi-task linkage evaluation mechanism is used to measure the comprehensive performance of the model in the node classification task of the Cora dataset. According to the results of the comprehensive evaluation, the model is further fine-tuned in terms of hyperparameters and training strategies to improve the adaptability of the model in the task. After the model is fine-tuned, the model is deployed to actual application scenarios. For example, the trained graph neural network model is applied to scientific research literature classification or recommendation systems to provide users with real-time literature classification or recommendation services. After actual deployment, the model needs to adapt to new data streams and feedback information through an adaptive online learning mechanism. Specifically, according to the influx of new data and user feedback, the model parameters are adjusted in real time to ensure that the model can adapt to changes in data distribution. In particular, when new nodes or edge relationships flow in, the model will automatically perform adaptive updates.
[0106] The large language model training method based on meta-learning in the disclosed embodiment dynamically adjusts the task weights through an adaptive mechanism, so that the model can give priority to learning key tasks, thereby improving training efficiency and avoiding the model from wasting resources on unimportant or simple tasks. By constructing a task pool containing a variety of natural language processing tasks and sampling based on the selection probability, a representative meta-task set is obtained to ensure that the model learns the commonalities and characteristics of tasks in a multi-task environment, and improve the generalization ability and adaptability of the model. A method combining global meta-optimization and local meta-optimization is adopted to enable the model to quickly adapt to the needs of specific tasks while learning global features, ensure the balance between tasks, and improve the overall performance of the model. The introduction of attention mechanism optimization enables the model to more accurately capture the key information of the input text in multi-task training, strengthen the model's ability to identify important features between tasks, and improve the performance of the model. Through a comprehensive evaluation mechanism, the performance of the model on each task is regularly evaluated, and the model parameters are dynamically adjusted according to feedback to ensure that the model can continue to adapt to changes in tasks and changes in user needs, thereby improving the long-term stability of the model. A hybrid parameter freezing strategy is adopted to enable the model to only update key parameters in the early stage of training and gradually unfreeze other parameters to reduce training overhead while ensuring the stability and convergence speed of the model. In practical applications, the real-time parameter update mechanism is used to dynamically adjust model parameters based on user feedback and new data, so that the model can quickly adapt to new data distribution and environmental changes and maintain high performance. This method significantly improves the adaptability, training efficiency and performance stability of large language models in multi-task and multi-scenario environments.
[0107] Furthermore, in an embodiment of the present disclosure, a data classification method is also provided, which includes the following steps: obtaining data to be classified, wherein the data to be classified is graph structure data; inputting the data to be classified into a target feature extraction model to obtain a classification result of the data to be classified; wherein the target feature extraction model is trained according to the large language model training method based on meta-learning in the above embodiment, such as the graph neural network model in the above embodiment.
[0108] The data to be classified can be any form of graph structure data, such as user relationships in social networks, protein-protein interactions, literature citation networks, traffic network information, etc. Specifically, for user relationship data, the friendship relationships between users constitute a graph, each user is a node, and the connections between them are edges. By analyzing this graph structure data, users' interest preferences, social circles, etc. can be predicted; protein-protein interaction data can also be represented by a graph. By classifying these graph structure data, we can better understand the complex interactions in organisms and identify potential disease markers; for literature citation network data, the citation relationship between academic papers constitutes a literature citation network, each paper is a node, and the citation relationship is an edge. By classifying the literature citation network, we can identify research hotspots or paper types in a certain field; for traffic network information data, the road network, public transportation routes, etc. in the city can also be represented by a graph, each intersection or station is a node, and the road or line is an edge. By classifying these graph structure data, we can optimize traffic flow management and predict congestion.
[0109] It should be noted that, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0110] Next, in the embodiment of the present disclosure, a large language model training device based on meta-learning is also provided, referring to Figure 5 As shown in , the large language model training device 500 based on meta-learning can be composed of a task pool construction module 501, a selection probability determination module 502, a task sampling module 503 and a meta-optimization module 504. Among them: the task pool construction module can be used to obtain training data, and construct a task pool containing multiple natural language processing tasks based on the training data; the selection probability determination module is used to dynamically adjust the task weights of natural language processing tasks based on an adaptive mechanism, and determine the selection probability corresponding to each natural language processing task based on the task weight; the task sampling module is used to sample the task pool based on the selection probability to obtain a meta-task set; the meta-optimization module is used to perform global meta-optimization, local meta-optimization and attention mechanism optimization on the pre-trained model using the meta-task set based on a hybrid parameter freezing strategy to obtain a large language model based on meta-learning.
[0111] In the embodiment of the present disclosure, a data classification device is also provided, referring to Figure 6As shown in , the data classification device 600 may be composed of a data acquisition module 601 and a data classification module 602. The data acquisition module 601 may be used to acquire data to be classified, which is graph structure data; the data classification module 602 may be used to input the data to be classified into a target large language model to obtain a classification result of the data to be classified; the target large language model is trained according to the large language model training method based on meta-learning as in the above embodiment.
[0112] It should be noted that the specific details of each part of the above-mentioned large language model training device based on meta-learning have been described in detail in the implementation method of the large language model training method based on meta-learning. The undisclosed details can be found in the implementation method content of the method part, and will not be repeated here.
[0113] In addition, in an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above-mentioned large language model training method based on meta-learning is also provided.
[0114] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware embodiments, complete software embodiments (including firmware, microcode, etc.), or embodiments combining hardware and software aspects, which may be collectively referred to herein as "circuits", "modules" or "systems".
[0115] Refer to the following Figure 7 hereinafter describes an electronic device 700 according to such an embodiment of the present disclosure. Figure 7 The electronic device 700 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0116] like Figure 7 As shown, the electronic device 700 is in the form of a general computing device. The components of the electronic device 700 may include but are not limited to: the at least one processing unit 710, the at least one storage unit 720, a bus 730 connecting different system components (including the storage unit 720 and the processing unit 710), and a display unit 740.
[0117] The storage unit stores program codes, which can be executed by the processing unit 710, so that the processing unit 710 executes the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification.
[0118] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 721 and / or a cache memory unit 722 , and may further include a read-only memory unit (ROM) 723 .
[0119] The storage unit 720 may also include a program / utility 724 having a set (at least one) of program modules 725, such program modules 725 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0120] Bus 730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0121] The electronic device 700 may also communicate with one or more external devices 770 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 700, and / or communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). This communication may be performed through an input / output (I / O) interface 750. In addition, the electronic device 700 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter 760. As shown, the network adapter 760 communicates with other modules of the electronic device 700 through a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0122] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes a number of instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.
[0123] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible embodiments, various aspects of the present disclosure can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the above "Exemplary Method" section of the present specification.
[0124] refer to Figure 8 As shown, a program product 800 for implementing the above-mentioned large language model training method based on meta-learning according to an embodiment of the present disclosure is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus, or a device.
[0125] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory, an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0126] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0127] The program code contained on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, electromagnetic waves, etc., or any suitable combination of the foregoing.
[0128] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0129] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A large language model training method based on meta-learning, characterized in that: include: Acquire training data, and build a task pool including multiple natural language processing tasks based on the training data; Dynamically adjusting the task weights of the natural language processing tasks based on an adaptive mechanism, and determining the selection probability corresponding to each of the natural language processing tasks based on the task weights; Sampling the task pool based on the selection probability to obtain a meta-task set; Based on a hybrid parameter freezing strategy, the meta-task set is used to perform global meta-optimization, local meta-optimization and attention mechanism optimization on the pre-trained model to obtain the large language model based on meta-learning.
2. The large language model training method based on meta-learning according to claim 1, characterized in that: The step of acquiring training data and constructing a task pool including multiple natural language processing tasks based on the training data includes: Acquire training data from a variety of data sources, and build a task pool including multiple natural language processing tasks based on the training data; Determining, based on the data characteristics of the training data, a task type of the natural language processing task corresponding to the training data; The training data is subjected to text cleaning, data enhancement and formatting processing.
3. The large language model training method based on meta-learning according to claim 1, characterized in that: The dynamically adjusting the task weight of the natural language processing task based on the adaptive mechanism, and determining the selection probability corresponding to each natural language processing task based on the task weight, includes: according to: ; Determine the loss function corresponding to each of the natural language processing tasks; wherein, i Indicates the task corresponding to the current loss calculation, T Indicates the task type. represents the model parameters, Represents a query set, x Represents input text, y represents the target output, represents the prediction function, ik Represents the sample index in the query set, that is, the specific sample for the current loss calculation. represents the calculated loss function corresponding to each of the natural language processing tasks; Using the loss function, according to: ; The task weight of the natural language processing task is adjusted; wherein, Indicates the task The corresponding initial weight, represents the temperature parameter, which is used to control the smoothness of weight update. Indicates the updated task The corresponding task weight; The task weights are normalized, and based on the normalized task weights, according to: ; The selection probability corresponding to each of the natural language processing tasks is adjusted so that the model learns high-weight tasks first, where Indicates the task The corresponding selection probability is N represents the total number of tasks in the task pool, j Indicates the first j task.
4. The large language model training method based on meta-learning according to claim 1, characterized in that: The sampling of the task pool based on the selection probability to obtain a meta-task set includes: Extracting tasks from the task set according to the selection probability corresponding to each of the natural language processing tasks to obtain an initial meta-task set; according to: ; The initial meta-task set is measured for similarity to obtain a similarity matrix corresponding to each pair of tasks in the initial meta-task set; wherein, Indicates the task The characteristic vector of Indicates the task The characteristic vector of Indicates the task and tasks The similarity matrix between Based on the similarity matrix, according to: ; The task combination in the initial meta-task set is adjusted to obtain an optimized meta-task set; wherein, represents the optimized meta-task set, represents the first optimization coefficient, represents the second optimization coefficient, m represents the number of tasks in the meta-task set, Represents the initial meta-task set.
5. The large language model training method based on meta-learning according to claim 1, characterized in that: The process of global meta-optimization of a pre-trained model includes: Based on the comprehensive loss function of all tasks in the meta-task set, according to: ; Optimizing the basic parameters in the pre-trained model to obtain a global meta-optimized model; wherein, represents the globally optimized parameters, Represents the basic parameters, represents the learning rate, represents the gradient calculation of the basic parameters, represents the loss function of each task in the global optimization.
6. The large language model training method based on meta-learning according to claim 1, characterized in that: The process of local meta-optimization of a pre-trained model includes: according to: ; The pre-trained model is locally meta-optimized, wherein: represents the locally optimized parameters, represents the local learning rate, Express support for the concentration i The feature vector of the samples.
7. The large language model training method based on meta-learning according to claim 1, characterized in that: The process of optimizing the attention mechanism for a pre-trained model includes: Using the attention mechanism, according to: ; The pre-trained model is optimized for the attention mechanism, wherein: represents the attention weight matrix, represents the learnable parameters of the attention mechanism and softmax represents the activation function.
8. The large language model training method based on meta-learning according to claim 1, characterized in that: Also includes: Based on a comprehensive evaluation mechanism, evaluating the performance of the large language model on each of the natural language processing tasks; According to the evaluation result, adjusting parameters of the large language model; The large language model with adjusted parameters is deployed, and the parameters of the large language model are updated in real time according to application feedback.
9. A data classification method, characterized in that: include: Acquire data to be classified, wherein the data to be classified is graph structure data; Inputting the data to be classified into a target large language model to obtain a classification result of the data to be classified; The target large language model is trained according to the large language model training method based on meta-learning as described in any one of claims 1 to 8.
10. A large language model training device based on meta-learning, characterized in that: include: A task pool building module, used to obtain training data and build a task pool including multiple natural language processing tasks based on the training data; A selection probability determination module, used to dynamically adjust the task weights of the natural language processing tasks based on an adaptive mechanism, and determine the selection probability corresponding to each of the natural language processing tasks based on the task weights; A task sampling module, used for sampling the task pool based on the selection probability to obtain a meta-task set; The meta-optimization module is used to perform global meta-optimization, local meta-optimization and attention mechanism optimization on the pre-trained model based on a hybrid parameter freezing strategy using the meta-task set to obtain the large language model based on meta-learning.
Citation Information
Patent Citations
Large language model training method and device and electronic equipment
CN118690874A
Model training method based on NLP large model
CN118734924A
Cited By
Visual language model fine tuning method and device based on adaptive parameter selection
CN120562479A
Multi-granularity large language model parameter optimization method and system based on vLLM architecture
CN121257607A
Rapid model adaptive optimization method based on meta-learning
CN121902896A