Data sorting method and system for multi-task large language model

Through technical means such as statement matching algorithm and TextRank algorithm, the problem of poor keyword extraction effect in multi-task large language models is solved, the training set quality and model applicability are improved, and the availability of multi-task large model systems is improved.

CN119149732BActive Publication Date: 2025-04-11SHENZHEN YUNQI TIMES TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411123145.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2025-04-11
Estimated Expiration
2044-08-15

AI Technical Summary

Technical Problem

When training multitasking large language models, the keyword extraction effect is poor, resulting in poor fine-tuning of model training data, which in turn affects the availability of multitasking large model systems.

Method used

The statement matching algorithm is used to determine the category intensity and data label categories of the modifiers of each noun in the sample, and the keywords are determined through category expression vectors, category feature similarity and feature weight calculations, a high-quality training set is constructed, and the keyword extraction is extracted using the TextRank algorithm and clustering algorithm.

Benefits of technology

It improves the accuracy of keyword extraction and the quality of training sets, enhances the applicability and fluency of multi-task large language models among different tasks, and improves the availability of multi-task large model systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149732B_ABST
    Figure CN119149732B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of natural language processing, and specifically to a data sorting method and system for a multi-task large language model, the method comprising: obtaining an initial sample set for each task; dividing multiple tasks into two categories: emotionally significant tasks and emotionally non-significant tasks; determining the data label category in the task; determining the category expression vector of each noun in the sample in the initial sample set; determining the feature weight of each noun under the data label category; obtaining the feature vector of the sample based on the similarity of the feature weights of each noun with other nouns under all data label categories, combined with the importance index; classifying the sample based on the feature vector; training the initial large language model using a general training set, saving the weight parameters, and fine-tuning the model trained with a specific training set based on the weight parameters to obtain a multi-task large language model. The present application uses a specific training set to obtain a customized large model for different tasks while retaining the multi-task type processing capability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing technology, and in particular to a data organization method and system for a multi-task large language model. Background Art

[0002] A multi-task large language model refers to a general natural language model that can handle multiple different natural language processing tasks. By using a variety of task type data sets for training, the large language model can be applied to a variety of task types. The multi-task large language model can be flexibly applied to different natural language processing tasks, and can also be expanded to a larger scale to handle more complex tasks. The multi-task large language model needs to handle a variety of different tasks, including text classification, named entity recognition, text generation, machine translation and other tasks. Data collation for keyword extraction of training set data helps with the classification and rapid retrieval of training set data, and can also illustrate that the model shares training set data between different tasks, improving the fluency of multi-task large language model processing.

[0003] Depending on the task requirements, processing purposes, and application scenarios, it is often necessary to process the acquired samples differently to build a large language model with good applicability for a specific training set. Multiple large language models with good adaptability can be deployed to a customized platform to form a customizable multi-task large model system that can be targeted at different application scenarios, and can provide software operation services SaaS, allowing users to use applications based on large models through network connections.

[0004] At present, when training a large language model suitable for different application scenarios, a large general language model is first trained with a large amount of multi-task data as the initial model, and then the training data of the initial model is used to fine-tune the large language model trained with a specific training set, so as to reduce the training time of the large language model in each application scenario and improve the applicability of the application scenario. In the process of model training and fine-tuning, the quality of the training set is particularly important, and the organization of the acquired samples is a key link in building a large language model. In natural language processing tasks, in order to improve sample accuracy and reduce model training time, keywords are usually extracted from text data, and a high-quality training set is constructed using the keyword organization results. The keyword extraction algorithm based on TF-IDF is simple and easy to implement, and has a fast processing speed for large-scale training sets, but it requires manual definition and filtering of useless words, and cannot capture the relationship between word segmentations. For natural language tasks in some scenarios, the extraction effect of keywords in text is poor, and it is impossible to extract truly useful keywords through contextual understanding of text emotional expression, resulting in poor results of fine-tuning the model with multi-task large language model training data, which in turn leads to poor availability of the multi-task large model system formed by multiple large language models. Summary of the invention

[0005] In order to solve the above technical problems, the purpose of this application is to provide a data sorting method and system for a multi-task large language model. The technical solutions adopted are as follows:

[0006] In a first aspect, an embodiment of the present application provides a data sorting method for a multi-task large language model, the method comprising the following steps:

[0007] Acquire an initial sample set of multiple tasks, wherein the initial sample set contains a large number of samples;

[0008] According to the task requirements, the multi-tasks are divided into two categories: emotion-significant tasks and emotion-non-significant tasks; the sentence matching algorithm is used to determine the data label categories and category strengths of all modifiers of each noun in the sample based on the part-of-speech tagging results of the samples in the initial sample set;

[0009] Determine the category expression vector of each noun in each sample based on the distribution of the category strength of all modifiers of each noun in each sample under different data label categories;

[0010] Determine the category feature similarity of each noun based on the number of segmentations between each noun and its identical noun in each sample, and the similarity between the category expression vectors of each noun and its identical noun;

[0011] Determine the feature weight and feature weight vector of each noun in each sample under different data label categories based on the category feature similarity, the category strength of each noun in each sample under different data label categories, and the difference between each noun and its expression vector of the same noun category;

[0012] Determine the importance index of each noun in each sample based on the feature weight of each noun in each sample under all data label categories and the word frequency statistics of each noun;

[0013] Extracting keywords in each sample based on the similarity between feature weight vectors of different nouns in each sample and the importance index;

[0014] The feature weight vectors of keywords in all samples in the initial sample set under the emotion-salient task and the emotion-non-salient task are used to form a general training set and a specific training set respectively;

[0015] Use the general training set to train the initial large language model and save the weight parameters; fine-tune the multi-task large language model trained with the specific training set based on the weight parameters, and deploy multiple multi-task large language models to a customized platform to form a multi-task large model system.

[0016] Preferably, the method for determining the category expression vector of each noun in each sample is:

[0017] The cumulative sum of the category strengths of all modifiers of each noun in each sample under each data label category is recorded as the comprehensive category strength of each noun in each sample under each data label category;

[0018] The comprehensive category strength of each noun in each sample under all data label categories constitutes the category expression vector of each noun in each sample.

[0019] Preferably, the method for determining the similarity of the category features of each noun is:

[0020] Sort the number of participles between each noun and its identical nouns from largest to smallest, and record the identical nouns corresponding to the first default number of elements in the sorting result as the adjacent synonyms of each noun in each sample;

[0021] Analyze the distance between the category expression vector of each noun in each sample and the category expression vectors of its neighboring words;

[0022] Analyze the ratio of the number of participles and the distance between each noun and its adjacent homonyms in each sample, and record it as the first ratio of each noun and its adjacent homonyms in each sample;

[0023] The category feature similarity of each noun in each sample is the result of the fusion of the first ratio of each noun in each sample and all its neighboring words.

[0024] Preferably, the method for determining the feature weights and feature weight vectors of each noun in each sample under different data label categories is as follows:

[0025] Based on the similarity of the category features of each noun in each sample and the degree of abnormality of the category expression vector, the credibility of the task data of each noun in each sample is determined;

[0026] Determine the feature weight of each noun in each sample under each data label category based on the comprehensive category strength of each noun in each sample under each data label category and the credibility of the task data;

[0027] The vector composed of the feature weights of each noun under all data label categories is used as the feature weight vector of each noun.

[0028] Preferably, the method for determining the credibility of the task data of each noun in each sample is:

[0029] The distance between the category expression vector of each noun in each sample and the category expression vector of all the same nouns is averaged and used as the input of the anomaly score algorithm to obtain the anomaly score value of each noun in each text.

[0030] The expression of the task data credibility of each noun in each sample is: In the formula, represents the task data credibility of the jth noun in the i-th sample; is the similarity of the category features of the jth noun in the i-th sample; is the abnormal score value of the jth noun in the ith sample.

[0031] Preferably, the expression of the feature weight of each noun in each sample under each data label category is: In the formula, w i,j (a) represents the feature weight of the jth noun in the i-th sample under the a-th data label category; represents the task data credibility of the xth identical noun among all the identical nouns of the jth noun in the ith sample; It represents the comprehensive category strength of the xth identical noun among all the identical nouns of the jth noun in the ith sample under the ath data label category; X represents the number of the jth noun in the ith sample.

[0032] Preferably, the importance index of each noun in each sample is a normalized value of the sum of the feature weights of each noun in each sample under all data label categories and the product of the word frequency-inverse document frequency of the corresponding noun.

[0033] Preferably, the process of extracting keywords from each sample is:

[0034] The feature weights of each noun in each sample under all data label categories constitute the feature weight vector of each noun in each sample;

[0035] Each noun in each sample is taken as a node of a directed graph, and the similarity between the feature weight vectors of two nouns is taken as the edge weight of the line between the corresponding nodes of the two nouns to construct a directed graph for each sample;

[0036] The directed graph of each sample is used as the input of the TextRank algorithm, and the importance index of each noun is used as the initial weight of each noun. The TextRank scores of all nouns in each sample are output and arranged in descending order. The first preset number of nouns in the arrangement result are used as keywords for each sample.

[0037] Preferably, the multi-task large language model trained with a specific training set is fine-tuned based on weight parameters, including:

[0038] Analyze the vector sum of the feature weight vectors of all keywords in each sample and record it as the feature vector of each sample;

[0039] The feature vectors of all samples in the initial sample set under each emotion-salient task and each emotion-non-salient task are used as the input of the clustering algorithm to obtain each cluster, and the samples corresponding to all feature vectors in the same cluster are classified into one category;

[0040] A class of training samples is constructed using the feature vectors of each class of samples in the sample classification results in the initial sample set under each emotion non-salient task, and all training samples form a common training set; the initial large language model is trained using the common training set and the weight parameters are retained;

[0041] A class of training samples for the emotional saliency task is constructed by using the feature vector of each class of samples in the sample classification results in the initial sample set under each emotional saliency task, and all training samples of the emotional saliency task constitute a specific training set;

[0042] The weight parameters are used as initial parameters of the model weights when training a large language model with a specific training set, and weight migration is performed, and the trained model is used as a multi-task large language model.

[0043] In a second aspect, an embodiment of the present application also provides a data sorting system for a multi-task large language model, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein when the processor executes the computer program, the steps of any one of the above-mentioned data sorting methods for a multi-task large language model are implemented.

[0044] This application has at least the following beneficial effects:

[0045] First, the present application adopts a sentence assignment algorithm to obtain the category strength and data label category of all modifiers of each noun in each sample, classifies and quantifies the sample features in the initial sample set of multiple tasks, and can analyze the data features in the sample at a higher granularity to ensure the quality of the subsequent extraction of keywords to construct a training set; then, the category feature similarity is determined based on the position intervals between the same nouns in the sample and the similarity of the data label category features expressed by the same noun at different positions, which can solve the data label category confusion problem caused by the category feature differences due to different sample sources; secondly, based on the comprehensive category strength of each noun in the sample under the data label category, combined with the difference between the category expression vector of each noun and all its identical noun category expression vectors and the category feature similarity, the feature weight of each noun in the sample under each data label category is determined, which is helpful to identify nouns that contribute more to the overall features of the sample from each initial sample set in different types of tasks; then, based on the feature weight of each noun under each data label category combined with the feature weight of each noun and the proportion of all the same nouns in all nouns, and determine the importance index of each noun, so that the directed graph constructed when extracting each initial sample set in the future can adaptively determine the initial weight based on the different data label category characteristics expressed by the nouns in the sample, thereby improving the accuracy of keyword extraction; then, the feature vector of each sample is determined based on the feature weight vector of the keyword, and the analysis of different initial sample sets under emotionally significant tasks and emotionally non-significant tasks is completed, which is conducive to the subsequent construction of high-quality training sets compared to directly using the initial sample sets for training; then, the initial large language model is trained based on the classified general training set, and the multi-task large language model is fine-tuned based on the weight data of the initial large language model, so that the multi-task large language model has the ability to process multi-task data and has a higher accuracy and precision when targeting specific tasks; finally, multiple multi-task large language models are obtained for multiple specific tasks, which improves the availability of the multi-task large model system formed by multiple multi-task large language models and meets the customized needs of users when using intelligent applications based on large models. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0047] Figure 1 A flowchart of a method for arranging data for a multi-task large language model provided in one embodiment of the present application;

[0048] Figure 2Schematic diagram of the importance index extraction process provided for this application;

[0049] Figure 3 Schematic diagram of the sample classification process provided for this application;

[0050] Figure 4 Schematic diagram of the process of fine-tuning a multi-task large language model using the initial large language model training data provided in this application. DETAILED DESCRIPTION

[0051] In order to further explain the technical means and effects adopted by the present application to achieve the predetermined invention purpose, the data sorting method and system for a multi-task large language model proposed in the present application, its specific implementation method, structure, features and effects are described in detail as follows in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0052] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.

[0053] The specific scheme of the data organization method and system for a multi-task large language model provided by the present application is described in detail below with reference to the accompanying drawings.

[0054] See also Figure 1 , which shows a flowchart of a method for data sorting for a multi-task large language model provided by an embodiment of the present application, the method comprising the following steps:

[0055] Step S1: Obtain the initial sample set for each task, extract all nouns and their modifiers in the initial sample set; use the sentence assignment algorithm to obtain the category strength and data label category of all modifiers of each noun in each sample.

[0056] In this application, the scalable and customizable multi-task large model system is obtained by deploying multiple multi-task large language models with good adaptability to specific tasks on a customized platform. Each multi-task large language model has the ability to process multi-task data and has high adaptability under specific tasks. Based on this, it is ensured that the multi-task large model system can meet the diverse needs of different customers when improving services for users.

[0057] It should be noted that the customization direction of the customized platform can be determined by the implementer according to specific needs and the customer group of the platform, and this application does not impose any special restrictions on this.

[0058] Furthermore, when training multiple multi-task large language models for specific tasks, it is necessary to process the samples in the initial sample set collected under the specific task, and build specific training sets for different tasks based on the processing results, so as to obtain a high-quality general training set for training a general initial large language model and adapting to specific tasks. The multi-tasks that the large language model can handle include but are not limited to interactive tasks such as intelligent question and answer, machine translation, and text generation; tendency analysis tasks such as intent recognition and sentiment analysis; and retrieval tasks such as summary generation, topic extraction, and dialogue systems. Since the actual application scenarios of large language models are not fixed, this application does not impose special restrictions on the tasks targeted by the initial large language model with strong versatility and the large language model with good scenario adaptability. Implementers can select multiple tasks according to specific application scenarios, and the division of different types of tasks can be determined by specific task requirements.

[0059] In this embodiment, the task requirements are set to be affected to different degrees by the emotional features in the text. Different types of tasks are selected and divided from interactive tasks and tendency analysis tasks. Named entity recognition, text classification, and smart question and answer are used as emotional non-significant tasks that are less affected by the emotional features in the text; sentiment analysis and intention recognition are used as emotionally significant tasks that are more affected by the emotional features in the text. The multi-tasks in this embodiment are composed of emotional non-significant tasks and emotionally significant tasks, among which the emotionally significant tasks are specific tasks, and an initial large language model with strong universality is trained based on sample data of the emotionally non-significant tasks; a large language model with good scenario adaptability is trained based on sample data of the emotionally significant tasks combined with the training data of the initial large language model, that is, a multi-task large language model for specific tasks.

[0060] Specifically, for any emotion-insignificant task or emotion-significant task, a default number of samples containing emotion words are obtained from the Internet using a search tool, including but not limited to text files of film review analysis, weekly book reviews, and product reviews, and the combination of samples collected for each emotion-insignificant task or emotion-significant task is used as the initial sample set for each task. The HanLP toolkit is used to perform word segmentation on the samples in each initial sample set, and the stop words in each sample are deleted, and then all non-stop words in each sentence in each sample are tagged for part of speech. The use of the HanLP toolkit is a well-known technology in the field of natural language processing.

[0061] The value of the default number of samples is manually set. In this embodiment, the default number of samples is 5000. The implementer can also set it according to the specific situation. This embodiment does not impose any special restrictions.

[0062] It should be noted that so-called stop words refer to words or phrases that are automatically filtered out before or after processing text in information retrieval to save storage space and improve search efficiency. For example, interjections, conjunctions, auxiliary words, prepositions such as "le", "he", "shi", "de", "zai", etc.; non-stop words usually refer to words with practical meanings such as nouns, verbs, and adjectives.

[0063] In the initial sample set, there may be multiple modifiers modifying a noun in each sentence within a sample. For example, in the sentence "The movie plot is both rich and colorful and exciting", "rich and colorful" and "exciting" are used as modifiers to jointly modify the movie plot.

[0064] Therefore, all non-stop words in each sentence within each sample are used as the input to the HanLP toolkit for dependency syntactic analysis, and the dependency tree of each sentence within each sample is output. All nouns and their modifiers in each sentence are extracted from the dependency tree of each sentence within each sample, thereby obtaining all nouns and their modifiers within each sample. Dependency syntactic trees are well-known technologies in the field of natural language processing.

[0065] It should be understood that whether training an initial large language model with strong generality or a large language model with good adaptability in a scenario, when forming a high-quality training set using the initial sample sets of emotion-insignificant tasks and emotion-significant tasks, it is necessary to analyze the differences between the sample data characteristics in the initial sample sets of emotion-insignificant tasks and emotion-significant tasks, so that the training samples in the subsequently organized training set can better reflect the sample characteristics of different categories under emotion-insignificant tasks and emotion-significant tasks, and ensure that the initial large language model has the ability of a large language model with good adaptability in the fine-tuning scenario.

[0066] Therefore, all modifiers of each noun within each sample are used as the input to the sentence matching algorithm based on the Chinese emotion word ontology library. The data label category numbers of the Chinese emotion word ontology library are set from 1 - 7, specifically as happy, good, angry, sad, fearful, disgusted, and surprised respectively. The category intensity under each category can be specifically divided into five levels: 1, 3, 5, 7, and 9. 9 represents the maximum intensity, and 1 represents the minimum intensity, obtaining the category intensity and the corresponding data label category of all modifiers of each noun within each sample.

[0067] It should be noted that the reason for setting the noun label categories in the initial sample set like this is that for multi-task data, in emotion-insignificant tasks and emotion-significant tasks, the data characteristics of the modifiers of nouns in different samples, that is, the expressed emotion intensity, are different. Quantifying the category intensity numerically can analyze the data characteristics within the sample with higher granularity to ensure the quality of the subsequent keyword extraction for constructing the training set.

[0068] The sentence matching algorithm based on the Chinese emotional vocabulary ontology is a natural language processing method, which aims to identify the label category characteristic tendency of words in the sample. The Chinese emotional vocabulary ontology is a predefined vocabulary library, and each word is associated with one or more data label categories and category strengths. The sentence matching algorithm scans each word in the sample and matches it in the Chinese emotional vocabulary ontology, thereby identifying the emotional meaning of the word and obtaining the corresponding data label category number and category strength. The sentence matching algorithm based on the Chinese emotional vocabulary ontology is a well-known technology, and the process of dividing words into data label categories will not be repeated.

[0069] In this embodiment, the classification of emotions varies from four, six, eight, ten to more than twenty categories. The seven traditional emotions in my country are specifically "good", "bad", "happy", "anger", "sorrow", "fear" and "desire"; the six influential emotions abroad are specifically "happy", "sad", "anger", "fear", "disgust" and "surprise". Among the six major emotions abroad, there is only one positive emotion, "happy", which is not detailed enough. Therefore, "good" is added on the basis of "happy" to describe preferences, which is basically consistent with the traditional "seven emotions" in my country, thus determining seven major emotions, and refining the data label category according to the strength of the category in each data label category, and finally dividing it into multiple subcategories.

[0070] It should be noted that the setting of data label categories and category strengths is artificially determined based on the classification of multiple tasks. In this embodiment, data label categories are divided into seven categories, and category strengths are divided into five levels. Implementers can also choose the data label classification method and category strength division method based on specific circumstances. This embodiment does not impose any special restrictions.

[0071] Step S2: Determine the category feature similarity based on the position interval between the same nouns in the sample and the similarity of the data label category features expressed by the same noun at different positions; determine the task data credibility of each noun in the sample based on the abnormality of the category expression vector of the same noun in the sample.

[0072] For the initial sample sets of sentiment-salient tasks and sentiment-non-salient tasks, the words in the sentences contained in each sample have a certain structure. This is because the sentences in each sample may reflect the same thing from multiple perspectives, and different modifiers may be used in the sample to modify the same noun, resulting in a large difference between the sentiment of a certain noun and the sentiment of other nouns in the sample. For example, the movie review sample is a review text of a movie. The comments of different moviegoers are at different positions in the sample, and different moviegoers have different emotional expressions for the same movie. Then the nouns corresponding to the movie names will appear at different positions in the sample and will be modified by different modifiers. The greater the category strength of the noun modifiers corresponding to the movie names at different positions, the more it means that the nouns modified by the modifiers have profound data label category characteristics and have a strong ability to express the data characteristics of the samples in which they are located. The training sample set should be constructed based on this.

[0073] Specifically, for each sample in each initial sample set, by analyzing the category strength of different modifiers of the same noun, we can understand the data feature tendency of the noun more precisely. Therefore, based on the distribution of the category strength of all modifiers of each noun in each sample under each data label category, the comprehensive category strength of each noun in each sample is determined to improve the accuracy of the sample data feature analysis, specifically:

[0074] The comprehensive category strength of each noun in each sample under each data label category is the cumulative sum of the category strengths of all modifiers of each noun in each sample under each data label category.

[0075] The comprehensive category strength of each noun in each sample under all data label categories constitutes the category expression vector of each noun in each sample.

[0076] Furthermore, in order to more accurately evaluate the strength of the data feature expression ability of samples under different types of tasks, and to improve the expression ability of the training samples constructed in the subsequent training of the initial large language model for multi-task data features. In this application, the data label category feature expression ability of the same noun in each sample in different sentences is considered, and the category feature similarity of each noun in each sample is determined based on the number of participles between each noun and each of its identical nouns, and the similarity between the category expression vector of each noun and its identical noun. The task data credibility of each noun in each sample is determined based on the category feature similarity of each noun in each sample and the abnormality of the category expression vector, specifically:

[0077] S201: Similarity of category features of each noun in each sample.

[0078] In the initial sample sets of different types of tasks, each sample will contain data generated by multiple data sources, including but not limited to film critics and book reviewers. For example, there will be a large number of evaluation results in the review documents of a movie, and the term "movie quality" will appear in a large number of review texts in a sample. At this time, the term "movie quality" should be used as a keyword to construct subsequent training samples for the initial large language model and the large language model with good adaptability in the application scenario, so that the constructed training set can not only train the initial large language model with good data processing capabilities, but also ensure that the fine-tuned large language model has strong scenario adaptability.

[0079] Specifically, in each sample of each initial sample set, nouns with similar appearance positions are more likely to have the same origin. When the emotional expression of nouns in adjacent positions is more authentic, nouns from the same origin often have highly similar emotional expressions. Therefore, based on the number of participles between each noun in each sample and its identical nouns, as well as the similarity between the category expression vector of each noun and its identical nouns, the category feature similarity of each noun in each sample is determined, so as to more accurately distinguish the data features of the nouns in each sample in the initial sample set under each type of task.

[0080] Specifically:

[0081] In each sample, all identical nouns of each noun are obtained, and then the number of participles between each noun and its identical nouns is sorted in descending order, and the identical nouns corresponding to the first preset number of participles in the sorting result are recorded as the adjacent synonyms of each noun in each sample.

[0082] It should be understood that the value of the preset number is artificially set. In this embodiment, the value of the preset number is 5. The implementer can also set it according to the specific situation. This embodiment does not impose any special restrictions.

[0083] Analyze the distance between the category expression vector of each noun in each sample and the category expression vector of each of its neighboring words;

[0084] It should be noted that there are many methods for measuring the distance between two vectors. In this embodiment, the difference between two category expression vectors is measured by calculating the Wasserstein distance between the category expression vector of each noun in each sample and the category expression vector of its adjacent noun. The implementer may also use other methods that can measure the distance, such as Euclidean distance or Manhattan distance, and this embodiment does not impose any special restrictions.

[0085] The calculation process of Wasserstein distance is a well-known technology, and its specific calculation process will not be repeated here.

[0086] Further, the ratio of the number of participles and the distance between each noun and its adjacent homonyms in each sample is analyzed, and recorded as the first ratio of each noun and its adjacent homonyms in each sample;

[0087] The similarity of the category features of each noun in each sample is the result of the fusion of the first ratio of each noun in each sample and all its neighboring words.

[0088] It should be understood that fusion refers to combining two or more indicators by adding or multiplying them together in order to obtain a comprehensive indicator, thereby more comprehensively and accurately evaluating a phenomenon or problem. This fusion method is not limited to simple arithmetic operations, but can also include more complex statistical models and analysis methods. The implementer can choose according to the specific situation, and this embodiment does not impose any special restrictions.

[0089] Preferably, in the present embodiment, the category feature similarity of each noun in each sample is the cumulative sum of the first ratios of each noun in each sample and all its neighboring words; in actual application, as other implementation methods, the category feature similarity of each noun in each sample can be an exponential function value with a natural constant as the base and the cumulative sum of the first ratios of each noun in each sample and all its neighboring words as the independent variable.

[0090] In a sample, the fewer the number of participles between each noun and its neighboring synonyms, the more likely it is that the noun and its neighboring synonyms have the same origin, and the higher the weight should be given; at the same time, the greater the similarity of the category features of the expressed data labels, the more similar the emotional expression between the corresponding noun and its neighboring synonyms, the larger the first ratio, and the greater the similarity of the category features of the corresponding nouns; conversely, the more the number of participles between each noun and its neighboring synonyms, the less likely it is that the corresponding noun and its neighboring synonyms have the same origin, and the weight given to the noun can be reduced; at the same time, the smaller the similarity of the category features of the expressed data labels, the greater the difference in emotional expression between the corresponding noun and its neighboring synonyms, the smaller the first ratio, and the smaller the similarity of the category features of the corresponding nouns.

[0091] S202: The credibility of the task data of each noun in each sample.

[0092] For the emotion-salient tasks and emotion-insignificant tasks, the sample sources in the initial sample sets of the multiple tasks are not consistent, the data quality of the samples varies, and the samples are prone to incorrect expressions in the data label categories, which affects the analysis of the noun category features in the samples. For example, the multiple tasks included are all affected by the polysemy phenomenon, and the combination results of the same word with different words or the category features expressed in different scenarios are different.

[0093] Therefore, in this application, the distance between the category expression vector of each noun in each sample and the category expression vector of all the same nouns is averaged as the input of the anomaly score algorithm to obtain the anomaly score value of each noun in each text.

[0094] It should be noted that there are many commonly used anomaly detection algorithms. In this embodiment, the LOF anomaly score algorithm is used to obtain the anomaly score value of each noun. The implementer can also use other anomaly score algorithms such as the z-score algorithm according to the specific situation. This embodiment does not impose any special restrictions. In addition, there are many methods for calculating the distance between two vectors. In this embodiment, the Wasserstein distance is used. The implementer can also use the Euclidean distance to measure the difference between the two vectors.

[0095] Among them, the LOF anomaly score algorithm is a well-known technology, and the specific process of obtaining the anomaly score by the LOF anomaly score algorithm will not be repeated here.

[0096] The larger the anomaly score value, the greater the difference between the data label category characteristics expressed by each noun in the sample and the data label category characteristics expressed by other identical nouns, and the greater the possibility that the nouns in the sample will have abnormal data label feature expression.

[0097] Furthermore, in order to improve the reliability of data label feature analysis, by detecting the abnormality of the noun category expression vector, based on the category feature similarity of each noun in each sample and the abnormality of the category expression vector, the task data credibility of each noun in each sample is determined to identify possible sentiment logic errors or inconsistencies in the text, specifically:

[0098] The expression of the task data credibility of each noun in each sample is: In the formula, represents the task data credibility of the jth noun in the i-th sample; is the similarity of the category features of the jth noun in the i-th sample; is the abnormal score value of the jth noun in the ith sample.

[0099] The greater the similarity of the category features of nouns, the more consistent the emotional expression of the nouns is with the real emotional opinions of the data source. At the same time, when the anomaly score value of the noun is smaller, it means that the possibility of abnormal expression of the data label category features in the sample is lower, that is, the more effective the data label category features expressed by the nouns, the higher the confidence of the data label category features expressed by the nouns, and the higher the credibility of the task data of the nouns; conversely, the smaller the similarity of the category features of the nouns, the less consistent the emotional expression of the nouns is with the real emotional opinions of the data source. At the same time, when the anomaly score value of the noun is larger, it means that the possibility of abnormal emotional expression of the nouns in the sample is higher, that is, the lower the confidence of the data label category features expressed by the nouns, and the lower the credibility of the corresponding noun task data.

[0100] Step S3: Based on the comprehensive category strength of each noun in the sample under the data label category, combined with the difference between the category expression vector of each noun and the category expression vector of all the same nouns and the similarity of the category features, determine the feature weight of each noun in the sample under each data label category, and combine the proportion of each noun and all the same nouns in all nouns to determine the importance index of each noun.

[0101] When training a multi-task large language model, keywords that can express the characteristics of different data label categories as comprehensively as possible should be extracted from the initial data set of each task to construct a training set, rather than directly training the initial large language model and the multi-task large language model with samples in the initial sample set. The samples in the initial sample set are classified based on the extraction results of the keywords, so as to construct training sets for multiple tasks respectively, improve the balance of emotional samples in the training process, and then increase the ability of the training data of the initial large language model to fine-tune the multi-task large language model.

[0102] For the sentiment saliency task, in order to more accurately capture the data label category features in the sample, based on the distribution of all modifiers of each noun in each sample under each data label category, combined with the category feature similarity of each noun and the degree of abnormality of the category expression vector, the feature weight of each noun in each sample under each data label category is determined to identify which nouns and modifiers contribute the most to the overall data category label features of the sample, thereby identifying the key data category label features, specifically:

[0103] The expression of the feature weight of each noun in each sample under each data label category is: In the formula, w i,j (a) represents the feature weight of the jth noun in the i-th sample under the a-th data label category; represents the task data credibility of the xth noun among all the same nouns of the jth noun in the ith sample; It represents the comprehensive category strength of the xth noun among all the same nouns of the jth noun in the ith sample under the ath data label category; X represents the number of the jth noun in the ith sample.

[0104] When the credibility of the task data of a noun is greater, it means that from the context of the sample, the emotional expression characteristics of the noun are more effective, the credibility of the data label category characteristics is higher, and the degree of adaptation to the corresponding task of the initial training set where the sample is located is higher. At the same time, when the comprehensive category strength of the noun under a certain data label category is greater, it means that the category feature level of the corresponding data label category expressed by the noun is higher, and the corresponding feature weight of the noun is greater; when the credibility of the task data of the noun is smaller, it means that from the context of the document text, the emotional expression characteristics of the noun are more invalid, and the degree of adaptation to the corresponding task of the initial training set where the sample is located is lower. At the same time, when the comprehensive category strength of the noun under a certain data label category is smaller, the corresponding feature weight of the noun is greater.

[0105] Furthermore, the sum of the feature weights of each noun in each sample under all data label categories and the normalized value of the product of the word frequency of the corresponding noun minus the inverse document frequency are used as the importance index of each noun in each sample, reflecting the possibility of various nouns in the sample being screened as keywords.

[0106] The calculation process of term frequency-inverse document frequency (TF-IDF) is a well-known technology, and the specific calculation process is not repeated here. The term frequency-inverse document frequency reflects the frequency of nouns with the same name appearing in the text, and the term frequency-inverse document frequency of nouns with the same name is the same.

[0107] When the word frequency-inverse document frequency of a noun is higher, it means that the corresponding noun appears frequently in the sample, is more likely to be closely related to the sample theme, has a higher category distinction ability, can be used as a keyword for the sample, and has a higher importance index when constructing a training set for training a large language model; when the feature weight of a noun in each data label category is larger, it means that the emotional expression of the corresponding noun is stronger than that of the sample as a whole, can reveal the data label category characteristics of the sample as a whole, can be used as a keyword for the sample, and has a higher importance index for the corresponding noun; conversely, when the word frequency-inverse document frequency of a noun is lower, the feature weight of the noun in each data label category is smaller, and the importance index of the corresponding noun is smaller.

[0108] Preferably, the schematic diagram of the importance index extraction process provided in this application is as follows: Figure 2 shown.

[0109] Step S4: Based on the similarity of feature weights of each noun in each sample and other different nouns under all data label categories, and combined with the importance index, all keywords in each sample are extracted to classify all samples in the initial training set.

[0110] (1) The feature weights of each noun in each sample under all data label categories constitute the feature weight vector of each noun in each sample.

[0111] (2) Each noun in each sample is used as a node of a directed graph, and the similarity between the feature weight vectors of two nouns is used as the edge weight of the line between the corresponding nodes of the two nouns to construct a directed graph for each sample.

[0112] It should be noted that there are many methods for measuring the similarity between two vectors. In this embodiment, the cosine similarity between the feature weight vectors of different nouns is calculated by calculating the feature weight vector of each noun and the feature weight vectors of other different nouns to measure the similarity between the feature weight vectors of different nouns. The implementer may also use the inverse of the Euclidean distance and other methods to measure the similarity according to the specific situation. This embodiment does not impose any special restrictions.

[0113] The calculation process of cosine similarity is a well-known technology, and its specific calculation process will not be repeated here.

[0114] (3) The TextRank algorithm is used to extract keywords for each sample based on the directed graph of each sample.

[0115] Specifically, the directed graph of each sample is used as the input of the TextRank algorithm, the importance index of each noun is used as the initial weight of the node corresponding to each noun, the TextRank scores of all nouns in the sample are output and arranged in descending order, and the first preset number of nouns in the arrangement result are used as keywords for each sample.

[0116] It should be noted that the value of the damping factor and the value of the preset number are both manually set. In this embodiment, the value of the damping factor is 0.85, and the value of the preset number is 5. The implementer can also set them according to the specific situation. This embodiment does not impose any special restrictions.

[0117] Among them, the TextRank algorithm is a well-known technology in the field of keyword extraction and document summary ranking, and the specific process of extracting keywords is not repeated here.

[0118] (4) Analyze the vector sum of the feature weight vectors of all keywords in each sample and record it as the feature vector of each sample.

[0119] (5) The feature vectors of all samples in the initial sample set under each emotionally salient task and each emotionally non-salient task are used as the input of the clustering algorithm to obtain each cluster, and the samples corresponding to all the feature vectors in the same cluster are classified into one category.

[0120] It should be noted that there are many commonly used clustering algorithms. In this embodiment, the k-means clustering algorithm is used to classify the feature vectors. The implementer may also use other clustering methods, and this embodiment does not impose any special restrictions.

[0121] Among them, the k-means clustering algorithm is a well-known technology, and its specific clustering process is not repeated here.

[0122] Preferably, the sample classification process diagram provided in this application is as follows: Figure 3 shown.

[0123] At this point, the samples are classified based on the keywords in each sample and combined with the TextRank algorithm and clustering algorithm.

[0124] Preferably, the flowchart of fine-tuning the multi-task large language model with the initial large language model training data provided in this application is as follows: Figure 4 shown.

[0125] Step S5: Train an initial large language model based on the classified samples, and fine-tune the multi-task large language model based on the weight data of the initial large language model to obtain a multi-task large language model for emotionally significant tasks; multiple multi-task large language models for specific tasks form a multi-task large model system on a customized platform.

[0126] (1) Obtaining the feature vector of each class of samples in the sample classification results in each initial sample set; secondly, counting the most frequently appearing class in the data label classes corresponding to all keywords in each sample, using the number of the most frequently appearing class as the label value of the feature vector of each sample, and encoding the feature vector of each sample with the corresponding label value to obtain a training sample;

[0127] (2) For emotion-insignificant tasks, each type of sample in the sample classification results of the initial sample set of all tasks under the emotion-insignificant task is formed into a type of training sample, and the set of all the training samples is used as a universal training set; the large language model is trained using the universal training set to obtain an initial large language model. Specifically, this embodiment uses the BERT (Bidirectional Encoder Representations from Transformers) model as the large language model, and uses the negative log-likelihood function as the loss function and the Adam (Adaptive Moment Estimation) optimizer for training all task types to obtain an initial large language model that can be used for all emotion-insignificant tasks and has strong versatility, and saves the weight parameters of the model after the training is completed;

[0128] (3) For the emotionally significant task, each class of samples in the sample classification results of the initial sample set of all tasks under the emotionally significant task is encoded in the above manner to form a class of training samples, and the set of all class training samples is used as a specific training set; the large language model suitable for the emotionally significant task is trained using the specific training set, and the weight parameters of the initial large language model are used for fine-tuning to obtain a multi-task large language model. Specifically, this embodiment uses the BERT model as the large language model, and uses the negative log-likelihood function as the loss function and the Adam optimizer for training for all task types. In the first round of the training process, the weight parameters of the initial large language model are used as the initial parameters of the model to complete the weight migration. After the training is completed, a multi-task large language model suitable for the emotionally significant task is obtained. The training of the neural network is a well-known technology, and the specific process will not be repeated.

[0129] (4) Determine the multi-task types that need to be deployed on the customized platform, take each task type as the above-mentioned emotional salient task, and train the multi-task large language model for each type of task in turn according to the above process to obtain multiple multi-task large language models. After that, deploy the multiple multi-task large language models to the customized platform to obtain a multi-task large model system formed by multiple multi-task large language models, and obtain intelligent applications for different tasks based on each multi-task large language model. Users do not need to purchase and install intelligent applications, but can select matching intelligent applications according to specific required tasks through the SaaS model.

[0130] At this point, the present application processes the samples based on the data label category characteristics expressed by the nouns in each initial sample set and the category strength of the noun modifiers under each data label category, and finally obtains the feature vector of each sample, thereby forming a general training set and a specific training set; and uses the initial large language model trained with the general training set to fine-tune the multi-task large language model trained with the specific training set, so that the trained multi-task large language model can not only have the processing capability for multi-task types, but also improve the execution capability of the multi-task large language model for emotionally significant tasks, thereby making the multi-task large model system formed on the customized platform more effective and capable of providing customized services to users.

[0131] Based on the same inventive concept as the above method, an embodiment of the present application also provides a data sorting system for a multi-task large language model, including a memory, a processor, and a computer program stored in the memory and running on the processor, and when the processor executes the computer program, the steps of the data sorting method for a multi-task large language model are implemented in any one of the above-mentioned data sorting methods for a multi-task large language model.

[0132] It should be noted that the above sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above is a description of a specific embodiment of this specification. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0133] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

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

Claims

1. A data arrangement method for a multi-task large language model, characterized in that: The method comprises the following steps: Acquire an initial sample set of multiple tasks, wherein the initial sample set contains a large number of samples; According to the task requirements, the multi-tasks are divided into two categories: emotion-significant tasks and emotion-non-significant tasks; the sentence matching algorithm is used to determine the data label categories and category strengths of all modifiers of each noun in the sample based on the part-of-speech tagging results of the samples in the initial sample set; Determine the category expression vector of each noun in each sample based on the distribution of the category strength of all modifiers of each noun in each sample under different data label categories; Determine the category feature similarity of each noun based on the number of segmentations between each noun and its identical noun in each sample, and the similarity between the category expression vectors of each noun and its identical noun; Determine the feature weight and feature weight vector of each noun in each sample under different data label categories based on the category feature similarity, the category strength of each noun in each sample under different data label categories, and the difference between each noun and its expression vector of the same noun category; Determine the importance index of each noun in each sample based on the feature weight of each noun in each sample under all data label categories and the word frequency statistics of each noun; Extracting keywords in each sample based on the similarity between feature weight vectors of different nouns in each sample and the importance index; The feature weight vectors of keywords in all samples in the initial sample set under the emotion-salient task and the emotion-non-salient task are used to form a general training set and a specific training set respectively; Use the general training set to train the initial large language model and save the weight parameters; fine-tune the multi-task large language model trained with the specific training set based on the weight parameters, and deploy multiple multi-task large language models to a customized platform to form a multi-task large model system.

2. The data sorting method for a multi-task large language model according to claim 1, characterized in that: The method for determining the category expression vector of each noun in each sample is as follows: The cumulative sum of the category strengths of all modifiers of each noun in each sample under each data label category is recorded as the comprehensive category strength of each noun in each sample under each data label category; The comprehensive category strength of each noun in each sample under all data label categories constitutes the category expression vector of each noun in each sample.

3. The data sorting method for a multi-task large language model according to claim 1, characterized in that: The method for determining the similarity of the category features of each noun is as follows: Sort the number of participles between each noun and its identical nouns from small to large, and record the identical nouns corresponding to the first default number of elements in the sorting result as the adjacent synonyms of each noun in each sample; Analyze the distance between the category expression vector of each noun in each sample and the category expression vectors of its neighboring words; Analyze the ratio of the number of participles and the distance between each noun and its adjacent homonyms in each sample, and record it as the first ratio of each noun and its adjacent homonyms in each sample; The category feature similarity of each noun in each sample is the result of the fusion of the first ratio of each noun in each sample and all its neighboring words.

4. The data sorting method for a multi-task large language model according to claim 2, characterized in that: The method for determining the feature weights and feature weight vectors of each noun in each sample under different data label categories is as follows: Based on the similarity of the category features of each noun in each sample and the degree of abnormality of the category expression vector, the credibility of the task data of each noun in each sample is determined; Determine the feature weight of each noun in each sample under each data label category based on the comprehensive category strength of each noun in each sample under each data label category and the credibility of the task data; The vector composed of the feature weights of each noun under all data label categories is used as the feature weight vector of each noun.

5. The data sorting method for a multi-task large language model according to claim 4, characterized in that: The method for determining the credibility of the task data of each noun in each sample is as follows: The distance between the category expression vector of each noun in each sample and the category expression vector of all the same nouns is averaged and used as the input of the anomaly score algorithm to obtain the anomaly score value of each noun in each text. The expression of the task data credibility of each noun in each sample is: ; In the formula, represents the task data credibility of the jth noun in the i-th sample; is the similarity of the category features of the jth noun in the i-th sample; is the abnormal score value of the jth noun in the ith sample.

6. The data sorting method for a multi-task large language model according to claim 4, characterized in that: The expression of the feature weight of each noun in each sample under each data label category is: ; In the formula, represents the feature weight of the jth noun in the i-th sample under the a-th data label category; represents the task data credibility of the xth identical noun among all the identical nouns of the jth noun in the ith sample; It represents the comprehensive category strength of the xth identical noun among all the identical nouns of the jth noun in the ith sample under the ath data label category; X represents the number of the jth noun in the ith sample.

7. The data sorting method for a multi-task large language model according to claim 1, characterized in that: The importance index of each noun in each sample is a normalized value of the sum of the feature weights of each noun in each sample under all data label categories and the product of the word frequency-inverse document frequency of the corresponding noun.

8. The data sorting method for a multi-task large language model according to claim 1, characterized in that: The process of extracting keywords from each sample is as follows: The feature weights of each noun in each sample under all data label categories constitute the feature weight vector of each noun in each sample; Each noun in each sample is taken as a node of a directed graph, and the similarity between the feature weight vectors of two nouns is taken as the edge weight of the line between the corresponding nodes of the two nouns to construct a directed graph for each sample; The directed graph of each sample is used as the input of the TextRank algorithm, and the importance index of each noun is used as the initial weight of each noun. The TextRank scores of all nouns in each sample are output and arranged in descending order. The first preset number of nouns in the arrangement result are used as keywords for each sample.

9. The data sorting method for a multi-task large language model according to claim 1, characterized in that: The method of fine-tuning the multi-task large language model trained with a specific training set based on weight parameters includes: Analyze the vector sum of the feature weight vectors of all keywords in each sample and record it as the feature vector of each sample; The feature vectors of all samples in the initial sample set under each emotion-salient task and each emotion-non-salient task are used as the input of the clustering algorithm to obtain each cluster, and the samples corresponding to all feature vectors in the same cluster are classified into one category; A class of training samples is constructed using the feature vectors of each class of samples in the sample classification results in the initial sample set under each emotion non-salient task, and all training samples form a common training set; the initial large language model is trained using the common training set and the weight parameters are retained; A class of training samples for the emotional saliency task is constructed by using the feature vector of each class of samples in the sample classification results in the initial sample set under each emotional saliency task, and all training samples of the emotional saliency task constitute a specific training set; The weight parameters are used as initial parameters of the model weights when training a large language model with a specific training set, and weight migration is performed, and the trained model is used as a multi-task large language model.

10. A data sorting system for a multi-task large language model, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the data sorting method for a multi-task large language model are implemented as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Micro-video personalized recommendation algorithm based on social network credibility

    CN108920503A

  • Text sentiment analysis method and system based on reinforcement learning

    CN111931516A