Large model data screening method and device and storage medium
By conducting quality assessment and professional evaluation of the screened data, combined with cluster analysis and balanced processing, the problem of insufficient data screening in professional fields in the existing technology is solved, and high-quality and balanced professional data is achieved for model fine-tuning, which significantly improves data processing efficiency.
Patent Information
- Application Number
- CN202510315007.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-04-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The lack of optimization of data in professional fields is the result of overfitting and catastrophic forgetting problems during model fine-tuning, and a single data processing method is difficult to meet the complexity and diversity of data in professional fields.
By obtaining the data to be screened, the quality evaluation indicators and professional evaluation indicators are determined, the filtering and screening are performed twice, and clustering analysis and equalization are performed to obtain professional data for fine-tuning of the big model.
It realizes the provision of high-quality data for model fine-tuning, significantly improves data processing efficiency, ensures the professionalism and balance of data, and avoids model overfitting and catastrophic forgetting.
Smart Images

Figure CN119848257A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of model data processing, and in particular to a large model data screening method, device and storage medium. Background Art
[0002] Recently, with the rapid development of natural language processing technology, model fine-tuning has become an important means to improve the performance of professional tasks. Data quality is a key factor in the effectiveness of fine-tuning.
[0003] Existing data screening tools are usually oriented towards general fields and lack optimization for professional field data. In addition, they do not take into account the data quality and balance issues in professional scenarios. Subsequent model fine-tuning will lead to overfitting and catastrophic forgetting problems in the model. Moreover, professional field data is highly complex and diverse, and a single data processing method is difficult to meet its needs.
[0004] In view of this, the present invention is proposed. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides a large model data screening method, device and storage medium, which can achieve the effect of providing high-quality data for model fine-tuning and significantly improve data processing efficiency.
[0006] An embodiment of the present invention provides a large model data screening method, the method comprising:
[0007] Acquire each piece of data to be screened, determine at least one corresponding quality assessment indicator for each piece of data to be screened, and determine each first filtering data according to each quality assessment indicator of each piece of data to be screened;
[0008] Input each first filtered data into a predetermined professional evaluation large language model, determine the professional evaluation index corresponding to each first filtered data, and determine each second filtered data according to the professional evaluation index of each first filtered data;
[0009] Cluster analysis is performed on each second filtered data to determine the standard deviation of the category data, and based on the standard deviation of the category data, each second filtered data is balanced to obtain professional data for fine-tuning the large model.
[0010] An embodiment of the present invention provides an electronic device, the electronic device comprising:
[0011] Processor and memory;
[0012] The processor is used to execute the steps of the large model data screening method described in any embodiment by calling the program or instruction stored in the memory.
[0013] An embodiment of the present invention provides a computer-readable storage medium, which stores a program or instruction, and the program or instruction enables a computer to execute the steps of the large model data screening method described in any embodiment.
[0014] The embodiments of the present invention have the following technical effects:
[0015] By acquiring each piece of data to be screened, determining at least one corresponding quality assessment indicator for each piece of data to be screened, and determining each first filtering data according to each quality assessment indicator of each piece of data to be screened, the data can be filtered and screened for the first time according to the quality assessment indicator, and then, inputting each first filtering data into a predetermined professional evaluation large language model to determine the professional assessment indicator corresponding to each first filtering data, and determining each second filtering data according to the professional assessment indicator of each first filtering data, the data can be filtered and screened for the second time according to the professional assessment indicator, and further, performing cluster analysis on each second filtering data to determine the standard deviation of the category data, and performing balance processing on each second filtering data according to the standard deviation of the category data to obtain professional data for fine-tuning of the large model, so as to ensure that the data of each preset category is balanced and the professional data is balanced with the general data, thereby achieving the effect of providing high-quality data for model fine-tuning and significantly improving the data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 is a flow chart of a large model data screening method provided by an embodiment of the present invention;
[0018] Figure 2 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0020] The large model data screening method provided by the embodiment of the present invention is mainly applicable to the situation where high-quality data is screened for model fine-tuning before model fine-tuning to ensure the professionalism and validity of the data. The large model data screening method provided by the embodiment of the present invention can be executed by an electronic device.
[0021] Figure 1 is a flow chart of a large model data screening method provided by an embodiment of the present invention. Figure 1 , the large model data screening method specifically includes:
[0022] S110, acquiring each piece of data to be screened, determining at least one corresponding quality evaluation indicator for each piece of data to be screened, and determining each first filtering data according to each quality evaluation indicator of each piece of data to be screened.
[0023] The data to be screened is the data prepared in advance for model fine-tuning, which needs to be screened later. The quality evaluation index is the evaluation index of each quality dimension of the data, which may include the length evaluation value, the diversity evaluation value, and the instruction following difficulty evaluation value. The first filtered data is the remaining part of the data after the first data screening of the data to be screened according to the quality evaluation index.
[0024] Specifically, multiple pieces of data to be screened that need to be screened for model fine-tuning data are obtained, and for each piece of data to be screened, the quality assessment indicators of each quality dimension are calculated respectively. According to the quality assessment indicators of each quality dimension, combined with the preset standards corresponding to the quality assessment indicators, that is, the high-quality data standards, it is determined whether the piece of data to be screened is to be eliminated or retained. Furthermore, the pieces of data to be screened that are retained can be used as the first filtered data.
[0025] Based on the above example, if the quality evaluation indicators include a length evaluation value, a diversity evaluation value, and an instruction following difficulty evaluation value, at least one corresponding quality evaluation indicator can be determined for each piece of data to be screened in the following manner:
[0026] For each piece of data to be screened, determine the length evaluation value of the data to be screened according to the preset length range and the weight distribution corresponding to the preset length range;
[0027] For each piece of data to be screened, determine the embedding vector corresponding to each sentence in the data to be screened;
[0028] According to the embedding vectors of each sentence, a similarity matrix is determined, and according to the similarity matrix, a diversity evaluation value of the data to be screened is determined;
[0029] For each piece of data to be screened, determine the perplexity with instructions and the perplexity without instructions through the preset instruction following model;
[0030] The ratio of the perplexity with instructions to the perplexity without instructions is determined as the instruction following difficulty assessment value.
[0031] Among them, the length evaluation value is used to evaluate the text length of the data to be screened. The diversity evaluation value is used to evaluate the semantic diversity covered by the data, such as covering multiple scenarios, task types, and semantic features. The instruction following difficulty evaluation value is used to evaluate the learning value and ensure the effectiveness of fine-tuning data. The preset length range is a predetermined reasonable text length range. The weight distribution is the distribution of different weights pre-assigned to different text lengths. The embedding vector is the embedding representation of each sentence in the data to be screened, which is the sentence-level embedding representation of the data instance. The embedding representation is a vector of fixed dimension and can capture the semantic features of the sentence. The similarity matrix is a matrix composed of the cosine similarity between each sentence in the data to be screened. The diagonal of the similarity matrix represents the self-similarity. The preset instruction following model is a pre-built model used to describe whether the data can follow the instruction for reasonable output. The instruction perplexity and the non-instruction perplexity are the perplexity (PPL) when there is an instruction context and the perplexity when there is no instruction context.
[0032] Specifically, for each piece of data to be screened, the length evaluation value, diversity evaluation value and instruction following difficulty evaluation value are calculated respectively, and one of the data to be screened is used as an example for explanation. It is determined whether the data length of the data to be screened is within the preset length range. If not, the length evaluation value can be directly determined to be 0. If it is, the data length of the data to be screened is matched according to the weight distribution corresponding to the preset length range, and the matching value is the length evaluation value of the data to be screened. Each sentence in the data to be selected is embedded and represented respectively, and the embedding vector corresponding to each sentence can be obtained. Then, the cosine similarity between the embedding vectors of any two sentences is calculated, a similarity matrix is constructed, and each cosine similarity in the similarity matrix is processed according to a preset method, such as finding the median, finding the mean, etc., to obtain the diversity evaluation value of the data to be screened. The data to be screened is input into the preset instruction following model, and the instruction confusion and the non-instruction confusion can be calculated, and the ratio of the instruction confusion to the non-instruction confusion is used as the instruction following difficulty evaluation value.
[0033] Based on the above example, the diversity evaluation value of the data to be screened can be determined according to the similarity matrix in the following way:
[0034] Determine semantic similarity based on each off-diagonal element in the similarity matrix;
[0035] The diversity evaluation value of the data to be screened is determined according to the following formula:
[0036]
[0037] in, is the diversity evaluation value of the data to be screened, and s is the semantic similarity.
[0038] Specifically, the average value of each non-diagonal element in the similarity matrix is used as the semantic similarity, and the above formula is used to further calculate the diversity evaluation value of the data to be screened.
[0039] Based on the above example, the first filtering data may be determined according to the quality evaluation index of each to-be-screened data in the following manner:
[0040] According to the available ranges corresponding to various quality assessment indicators, each data to be screened is processed to obtain each data to be processed;
[0041] Determine the comprehensive evaluation value of each data to be processed according to each quality evaluation index of each data to be processed;
[0042] Each first filtering data is determined according to the comprehensive evaluation value of each data to be processed and a preset evaluation threshold.
[0043] The available range is a pre-set data range of each quality assessment indicator for eliminating the data to be screened that exceeds the available range. The comprehensive evaluation value is an indicator value that integrates various types of quality assessment indicators and is used to evaluate the quality of data at a higher level. The preset evaluation threshold is a pre-set evaluation value for distinguishing high-quality data.
[0044] Specifically, through the available ranges corresponding to various quality assessment indicators, each piece of data to be screened is preliminarily screened, and the data to be screened with at least one quality assessment indicator outside the corresponding available range is eliminated to obtain each piece of data to be processed. For each piece of data to be processed, each quality assessment indicator of the data to be processed is weighted to obtain a comprehensive assessment value of the data to be processed, and accordingly, a comprehensive assessment value of each piece of data to be processed can be obtained. Then, the comprehensive assessment value of each piece of data to be processed is compared with a preset assessment threshold, and each piece of data to be processed that meets the preset assessment threshold requirement (such as greater than the preset assessment threshold) is determined as each first filtered data.
[0045] Based on the above example, the comprehensive evaluation value of each data to be processed can be determined according to each quality evaluation index of each data to be processed in the following manner:
[0046] For each quality assessment indicator, determine the indicator standard deviation based on the quality assessment indicator of each data to be processed;
[0047] Determine the indicator weights corresponding to various quality assessment indicators according to the indicator standard deviations of various quality assessment indicators;
[0048] For each piece of data to be processed, each quality assessment indicator corresponding to the data to be processed is weighted according to the weight of each indicator to obtain a comprehensive assessment value of the data to be processed.
[0049] The indicator standard deviation is the standard deviation of the value of a type of quality evaluation indicator on each data to be processed. The indicator weight is the weight determined for each type of instruction evaluation indicator, which is used for subsequent weighted processing.
[0050] Specifically, for each type of quality assessment indicator, the standard deviation of the quality assessment indicator corresponding to each data to be processed is calculated to obtain the indicator standard deviation of the quality assessment indicator of this type. Weights are assigned according to the indicator standard deviations of various quality assessment indicators, and larger indicator weights are assigned to quality assessment indicators with large indicator standard deviations, and the sum of the weights of each indicator is made to be 1. For example, the indicator weight corresponding to each quality assessment indicator can be the result of dividing the indicator standard deviation of the quality assessment indicator by the sum of the indicator standard deviations of each quality assessment indicator. For each piece of data to be processed, each quality assessment indicator corresponding to the piece of data to be processed is weighted using each indicator weight, and the comprehensive evaluation value of the data to be processed can be obtained by summing them up. In this way, the comprehensive evaluation value of each piece of data to be processed can be obtained.
[0051] For example, when fine-tuning, the quality of the fine-tuning data has a great impact on the final result. Low-quality data can easily lead to problems such as overfitting and catastrophic forgetting. Especially for professional data in a specific field, because the data types are similar, it is more likely to cause such a situation. Therefore, it is necessary and effective to select data quality and diversity. Data is screened from multiple angles by using three quality evaluation indicators based on length, diversity, and instruction following difficulty. And through a multi-indicator weighted evaluation mechanism, high-quality data is screened from a large amount of data to be screened to ensure the representativeness and professionalism of the fine-tuning data.
[0052] For example, regarding the length evaluation value: the length of the text directly affects the learning efficiency of the model. Data that is too short often lacks information and cannot provide enough context or clues to complete the task; data that is too long may contain redundant information, which burdens the model training process. First, by setting a reasonable length threshold, the data to be screened that is too short or too long can be removed. Then, a higher weight (weight distribution) is given to the data to be screened within the preset length range to optimize the contribution of the data to the model.
[0053] Regarding the diversity evaluation value: Its core goal is to ensure that the data covers a variety of scenarios, task types, and semantic features, thereby enhancing the generalization ability of the model. First, a pre-trained language model is used to generate a sentence-level embedding representation, i.e., an embedding vector, for each piece of data to be screened. For each sentence embedding vector, the cosine similarity is used to calculate:
[0054]
[0055] Among them, v 1 and v 2 are the embedding vectors of the two sentences respectively, ‖v 1 ‖ and ‖v 2 ‖ represents the Euclidean norm of the vector.
[0056] By analyzing the semantic distribution of sentences, we can avoid data information being too low, thereby improving the generalization ability of the model. By constructing a similarity matrix through cosine similarity, it is convenient to calculate the sparsity of the semantic distribution of the entire data and measure the diversity of the data. Among them, the diagonal of the similarity matrix represents the self-similarity, and the value is 1; the average of the non-diagonal elements of the similarity matrix is calculated to obtain the overall semantic similarity, that is, the mean s. The formula of the above example can be used to calculate the diversity evaluation value. The higher s is, the higher the semantic repetition rate is. d On the contrary, the lower the s, the higher the semantic diversity. d The higher.
[0057] About the instruction following difficulty evaluation value: The instruction following difficulty evaluates the learning value of instructions by quantifying the impact of instructions on the model generation behavior and ensuring the effectiveness of fine-tuning data. Its core is to calculate the effect of instruction context on model output based on perplexity. The perplexity of the data to be screened is calculated separately when given instructions and when no instructions are given. The instruction following difficulty of the data is evaluated by the calculated perplexity, and noisy data or low-quality data is filtered out.
[0058]
[0059] Among them, w i For each word in the data to be filtered, P(w i ) is the probability of the model predicting the word, and N is the text length of the data to be filtered.
[0060] When calculating the instruction following difficulty evaluation value, two kinds of perplexity are calculated for each piece of data to be screened: the perplexity PPL when there is instruction context with (with instruction perplexity) and perplexity PPL without instruction context without (no instruction confusion), the ratio of the two is defined as the instruction following difficulty evaluation value S i :
[0061]
[0062] If S iGreater than 0 and less than 1. The higher the value, the greater the effect of the instruction on the generation process and the more difficult it is to follow the instruction. The instruction has a significant effect on the generation and the model needs to learn the instruction more preferentially. Values below 0 and above 1 will be judged as outliers, which means that the instruction has no positive effect on fine-tuning and should be filtered. A unified evaluation model is used to calculate the perplexity, and the perplexity ratio is used to eliminate the influence of different models on the score. Therefore, this method allows the use of models with smaller parameters to achieve high-quality data screening and reduce computational consumption.
[0063] In practical applications, the weights of the three quality evaluation indicators are dynamically adjusted according to specific needs to adapt to the priority goals in different scenarios. For example: length evaluation value: ensure that the data is distributed within a reasonable length range and filter out redundant or insufficiently informative data; diversity evaluation value: give priority to data with a wider semantic distribution and covering different task types; instruction following difficulty evaluation value: emphasize data that has significant learning value for the model, especially in instruction fine-tuning scenarios.
[0064]
[0065] Among them, S l , S d , S i are length evaluation value, diversity evaluation value and instruction following difficulty evaluation value, respectively, w l 、w d 、w i is the corresponding indicator weight.
[0066] During the data screening process, the initial weight can be dynamically set according to the standard deviation of the data distribution of each quality assessment indicator. Specifically, the data distribution of each quality assessment indicator will be analyzed and its indicator standard deviation will be calculated. For quality assessment indicators with smaller indicator standard deviations, it means that the difference of data on this quality assessment indicator is small, and the contribution to distinguishing data quality is limited, so the corresponding indicator weight needs to be reduced; while for quality assessment indicators with larger indicator standard deviations, it means that the difference of data on this indicator is significant, and the contribution to distinguishing data quality is large, so the corresponding indicator weight needs to be increased. According to the ratio of the standard deviations of different indicators, the indicator weights will be normalized so that their sum is 1. Through this dynamic weight adjustment based on standard deviation, it is possible to avoid screening bias caused by the overly concentrated distribution of a certain indicator, while highlighting indicators with higher data quality differentiation, and adaptively adjust the data.
[0067] Optionally, the initial weights can be adjusted for a second time in combination with specific application fields, etc., to ensure that the screening results can adapt to the needs of different application fields and improve the pertinence and practicality of the data. For example: according to the application field, determine the secondary adjustment value corresponding to the application field; based on the secondary adjustment value, make corresponding adjustments to the weights of each indicator, and normalize the adjusted weights of each indicator to update the weights of each indicator. Optionally, the secondary adjustment value corresponding to each application field can be set according to the needs of the field, and the adjustment method can be four arithmetic operations determined according to the needs. For example: If a certain field has high requirements for the length evaluation value, the secondary adjustment value corresponding to the length evaluation value can be set to a larger value, and addition or multiplication can be used to increase the indicator weight of the length evaluation value.
[0068] First, each quality assessment indicator can be evaluated independently. For data with a certain quality assessment indicator that is too low, it will be marked as defective low-quality data and deleted. For example, if the text length of a piece of data to be screened is too short or too long (such as a length assessment value lower than 0.5), the semantic diversity is insufficient (the diversity assessment value is lower than 0.3), or the instruction following difficulty is insufficient (the instruction following difficulty assessment value is lower than 0.3), these data will be directly eliminated. This method of filtering out low-quality data at an early stage not only improves the overall data quality, but also significantly reduces the amount of calculation for subsequent processing. Further, the remaining data to be processed are sorted based on the weighted total score (comprehensive assessment value), and the data to be processed with a higher total score is preferentially selected for fine-tuning. The comprehensive assessment value is obtained by weighted summing each quality assessment indicator according to the corresponding indicator weight, which can fully reflect the overall quality of the data. Data with a higher comprehensive assessment value usually has a higher amount of information, diversity and professionalism, so it will be preferred for fine-tuning. The first filtered data can be obtained by re-screening by a preset evaluation threshold, or by re-screening according to a preset number.
[0069] S120, input each first filtered data into a predetermined professional evaluation large language model, determine the professional evaluation index corresponding to each first filtered data, and determine each second filtered data according to the professional evaluation index of each first filtered data.
[0070] Among them, the professional evaluation big language model is a big language model used to evaluate in combination with the application field and application scenarios of the data. Professional evaluation indicators need to cover dimensions such as field relevance, content quality, and logical consistency. Taking the medical field as an example, professional evaluation indicators can include scientificity, correctness, rationality, and sufficiency. Among them, scientificity refers to whether the content conforms to the scientific norms or standards of the relevant field; correctness refers to whether the content is accurate and avoids factual errors; rationality refers to whether the content is logical and has internal consistency; sufficiency refers to whether the content provides enough information to answer instructions. The second filtered data is the first filtered data remaining after professional-level screening according to the professional evaluation indicators.
[0071] Specifically, each first filtered data is input into a predetermined professional evaluation large language model, and each first filtered data is evaluated in multiple professional dimensions, and the professional evaluation index corresponding to each first filtered data can be output. Then, the professional evaluation index is analyzed, and each first filtered data that does not meet the professional requirements is eliminated, and each retained first filtered data is determined as each second filtered data.
[0072] Based on the above example, each second filtering data may be determined according to the professional evaluation index of each first filtering data in the following manner:
[0073] According to the professional fields of the data to be screened, the professional evaluation indicators are divided into core indicators and secondary indicators;
[0074] For each piece of first filtered data, if at least one core indicator of the first filtered data meets the core indicator requirement and at least one of the secondary indicators meets the secondary indicator requirement, the first filtered data is used as the second filtered data.
[0075] Among them, professional fields are the application fields of the data to be screened. Core indicators are professional evaluation indicators that are more concerned in professional fields. Secondary indicators are professional evaluation indicators that are less concerned in professional fields, and are the remaining professional evaluation indicators except core indicators. Core indicator requirements and secondary indicator requirements are requirements set for core indicators and secondary indicators respectively, and are also requirements set in combination with professional fields. It can be understood that the number of core indicators is less than the number of secondary indicators. The number of core indicators is at least one, so the number of secondary indicators is at least two.
[0076] Specifically, according to the pre-configured correspondence between the core indicators and the professional fields, the core indicators corresponding to the professional fields of the data to be screened are determined, and other professional evaluation indicators are used as secondary indicators. For each first filtered data, the core indicators and secondary indicators are judged respectively. For the core indicators, each core indicator needs to meet the corresponding core indicator requirements, and for the secondary indicators, only at least one of them needs to meet the corresponding secondary indicator requirements. When the core indicators and the secondary indicators pass the above judgment, the first filtered data can be used as the second filtered data.
[0077] For example, to facilitate evaluation, prompt words for scoring indicators can be designed to guide the large language model to score the data and return the results in a specific format. The prompt words should clearly define the task requirements to ensure that the evaluation results are operational and consistent.
[0078] Here are some example prompts for medical scenarios:
[0079] You are a professional medical evaluation assistant, responsible for conducting a comprehensive evaluation of the medical answers generated by the model. Please strictly analyze and score the model's answers from the following dimensions and summarize the evaluation results in a structured form.
[0080] Evaluation Dimensions
[0081] 1. Scientificity: Whether the medical advice and knowledge in the answer is consistent with existing scientific research and clinical practice.
[0082] 2. Accuracy: Whether the information in the answer is accurate, correct, and consistent with the facts.
[0083] 3. Reasonableness: Whether the answer is consistent with medical common sense and logic, and whether it can provide reasonable suggestions or explanations based on the question.
[0084] 4. Sufficiency: Whether the answer fully meets the user's needs and covers the core content of the problem.
[0085] Output Format
[0086] Please return the evaluation results in the following JSON format:
[0087] {
[0088] "result": {
[0089] "Scientificity": "0 or 1",
[0090] "Accuracy": "0 or 1",
[0091] "reasonableness": "0 or 1",
[0092] "sufficiency": "0 or 1"
[0093] },
[0094] "analyse": {
[0095] "Scientificity": "Detailed analysis, including pros and cons",
[0096] "Correctness": "Detailed analysis, including strengths and weaknesses",
[0097] "Justification": "Detailed analysis, including pros and cons",
[0098] "adequacy": "Detailed analysis, including strengths and weaknesses",
[0099] "Comprehensive evaluation": "Summarize the evaluation of each dimension and give a comprehensive analysis"
[0100] }
[0101] }
[0102] Each first-filtered data can be strictly evaluated according to the core and secondary needs of different professional fields, and screened using the scoring results generated by the large language model, thereby significantly improving the overall quality of the fine-tuning data.
[0103] For example, in the medical field, scientificity and correctness are core requirements. If a piece of first filtered data scores 0 in terms of scientificity and / or correctness, it will be deleted directly; if a piece of first filtered data scores 0 in terms of rationality and sufficiency, it will also be deleted directly.
[0104] S130, performing cluster analysis on each second filtered data, determining the standard deviation of the category data, and performing equalization processing on each second filtered data according to the standard deviation of the category data to obtain professional data for fine-tuning the large model.
[0105] Among them, the category data standard deviation is the standard deviation of the data volume in each category after cluster analysis.
[0106] Specifically, cluster analysis is performed on each second filtered data according to preset categories, and each second filtered data can be divided into multiple preset categories. The number of data items in each preset category is counted, and then the standard deviation of the category data can be calculated. If the standard deviation of the category data is small, it means that the number of data items in each preset category is basically balanced, and it can be directly used as professional data for fine-tuning the large model; if the standard deviation of the category data is large, the category with a large number of data items is eliminated, which can be based on the number of data items in the preset category with the least number of data items, and the part of the data items exceeding the number in the remaining preset categories is eliminated, or it can be eliminated according to the comprehensive evaluation value, retaining the data with a large comprehensive evaluation value and eliminating the data with a small comprehensive evaluation value. In this way, the balanced processing is completed to obtain professional data for fine-tuning the large model.
[0107] Based on the above example, the following method can be used to perform cluster analysis on each second filtered data, determine the standard deviation of the category data, and perform balanced processing on each second filtered data according to the standard deviation of the category data to obtain professional data for fine-tuning the large model:
[0108] According to the number of categories of the preset categories, cluster analysis is performed on each second filtered data to obtain the amount of data corresponding to each preset category, and according to the amount of data corresponding to each preset category, the standard deviation of the category data is determined;
[0109] In response to the standard deviation of the category data being greater than the preset standard deviation, the maximum value of the category quantity is determined according to the standard deviation of the category data, the preset multiple and the minimum value of each data quantity, and each second filtered data is balanced according to the maximum value of the category quantity to obtain professional data for fine-tuning the large model;
[0110] In response to the standard deviation of the category data being less than or equal to the preset standard deviation, each second filtered data is used as professional data for fine-tuning the large model.
[0111] The preset categories are the categories that are preset for cluster analysis. The number of categories is the number of preset categories. The amount of data is recorded as the number of data items. The preset standard deviation is the standard deviation that is preset to determine whether to continue data screening to ensure that the amount of data in each preset category is balanced. The preset multiple is the multiple value used to determine the amount of data to be retained when balancing data. The maximum number of categories is the maximum amount of data that can be contained in each preset category.
[0112] Specifically, according to the number of categories of the preset categories, cluster analysis is performed on each second filtered data, and each second filtered data can be divided into each preset category, and the amount of data corresponding to each preset category can be obtained by statistics. Furthermore, the standard deviation of the category data is calculated by the amount of data corresponding to each preset category. If the standard deviation of the category data is greater than the preset standard deviation, it means that the amount of data is unbalanced, and it is necessary to continue data screening, and the product of the standard deviation of the category data and the preset multiple is used as the multiple threshold, and the product of the multiple threshold and the minimum value in each data amount is used as the maximum value of the category number. With the maximum value of the category number as the limit, the second filtered data under each preset category is eliminated, that is, for each preset category, the second filtered data under the preset category is sorted from large to small according to the comprehensive evaluation value, and the data of the maximum value of the previous category number is retained, and the redundant data is eliminated. The remaining is high-quality professional data, that is, professional data for fine-tuning the large model. If the standard deviation of the category data is less than or equal to the preset standard deviation, it means that the amount of data in each preset category is already in a relatively balanced state, so each second filtered data can be directly used as professional data for fine-tuning the large model. It can be understood that the maximum value of the category data volume determined in the above manner can retain data as much as possible while ensuring data balance and avoiding a large amount of data loss.
[0113] Based on the above example, after performing equalization processing on each second filtered data to obtain professional data for fine-tuning the large model, in order to ensure that the professionalism and universality of the model are taken into account after subsequent model fine-tuning, universal data can be mixed into the professional data to avoid overfitting of the model. Specifically, it can be:
[0114] Determine the general data to be mixed in based on the amount of professional data and the preset mixing ratio;
[0115] Use professional data and general data to be mixed in as data for fine-tuning the large model.
[0116] The preset mixing ratio is the ratio between professional data and general data, such as 1:1. The general data to be mixed is the general data part of the data used for model fine-tuning later. The large model fine-tuning data includes the screened professional part data and the general part data, which are used for model fine-tuning.
[0117] Specifically, according to the preset mixing ratio, the amount of professional data is calculated to determine the amount of data to be mixed into the general data, and accordingly, the amount of data to be mixed into the general data can be obtained from a large amount of general data as the general data to be mixed in. Then, the professional data and the general data to be mixed are mixed to obtain the large model fine-tuning data.
[0118] Data balancing plays a key role in fine-tuning data screening. By ensuring the diversity and uniformity of data distribution, the model is prevented from being biased towards specific tasks or semantic categories, and the generalization ability of the model is improved. The implementation of data balancing includes two aspects: professional data balancing and general data balancing. Regarding professional data balancing, in order to ensure the diversity of data, first of all, it is necessary to identify the intrinsic distribution structure of each second filtered data. Clustering analysis of semantics and task types is performed through clustering algorithms (such as k-means), and the data is divided into multiple preset categories. For example: by clustering according to semantic features (such as text embedding vectors) and task types (such as classification, generation, question and answer, etc.), it can be divided into multiple preset categories with similar semantics or task types, which can help identify the intrinsic distribution structure of the data and provide a basis for subsequent balancing processing. After completing the clustering analysis, the data balancing strategy can be adaptively adjusted to dynamically determine whether balancing processing is required based on the data distribution of each preset category. Specifically, the standard deviation of the data volume of each preset category (category data standard deviation) will be calculated. If the category data standard deviation is lower than the preset standard deviation (such as 0.5), it is considered that the data distribution is relatively balanced and no adjustment is required; if the category data standard deviation is not lower than the preset standard deviation, the category data standard deviation is multiplied by the preset multiple (such as 10) as the multiple threshold for balancing. During the balancing process, data is filtered from high to low according to the comprehensive evaluation value to ensure that the difference in data volume between each preset category does not exceed the multiple threshold. For example, if the amount of data in a preset category is significantly more than that of other preset categories, the amount of data in the preset category is reduced by downsampling so that the difference in data volume with other preset categories is controlled within the multiple threshold range. This dynamic balancing strategy based on standard deviation can effectively adjust the data volume when the data distribution is uneven and avoid excessive concentration of data. Through the clustering results, the second filtered data with a higher comprehensive evaluation value is selected from each preset category to ensure the diversity and comprehensiveness of the data set. Combined with the sorting and clustering results of the comprehensive evaluation value, a high-quality and richly distributed data set is generated for subsequent instruction fine-tuning.
[0119] Regarding general data balancing, general data (to be mixed in) is mixed in at a preset mixing ratio (such as a one-to-one ratio) to ensure that the model can maintain both professionalism and generality in professional field tasks, thereby preventing model overfitting and catastrophic forgetting.
[0120] The present invention has the following technical effects: by acquiring each piece of data to be screened, determining at least one corresponding quality assessment indicator for each piece of data to be screened, and determining each first filtering data according to each quality assessment indicator of each piece of data to be screened, the data can be filtered and screened for the first time according to the quality assessment indicator, and then, each first filtering data is input into a predetermined professional evaluation large language model to determine the professional assessment indicator corresponding to each first filtering data, and according to the professional assessment indicator of each first filtering data, each second filtering data is determined, and the data can be filtered and screened for the second time according to the professional assessment indicator, and further, cluster analysis is performed on each second filtering data to determine the standard deviation of the category data, and according to the standard deviation of the category data, each second filtering data is balanced to obtain professional data for fine-tuning of the large model, so as to ensure that the data of each preset category is balanced and the professional data is balanced with the general data, so as to achieve the effect of providing high-quality data for model fine-tuning and significantly improve the data processing efficiency.
[0121] Figure 2 Schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 2 As shown, the electronic device 200 includes one or more processors 201 and a memory 202 .
[0122] The processor 201 may be a central processing unit (CPU), a graphics processing unit (GPU), or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 200 to perform desired functions.
[0123] The memory 202 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 201 may run the program instructions to implement the large model data screening method of any embodiment of the present invention described above and / or other desired functions. Various contents such as initial external parameters, thresholds, etc. may also be stored in the computer-readable storage medium.
[0124] In one example, the electronic device 200 may further include: an input device 203 and an output device 204, which are interconnected via a bus system and / or other forms of connection mechanisms (not shown). The input device 203 may include, for example, a keyboard, a mouse, etc. The output device 204 may output various information to the outside, including early warning prompt information, braking force, etc. The output device 204 may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, etc.
[0125] Of course, to simplify, Figure 2 Only some of the components related to the present invention in the electronic device 200 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application conditions, the electronic device 200 may also include any other appropriate components.
[0126] In addition to the above methods and devices, an embodiment of the present invention may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the large model data screening method provided by any embodiment of the present invention.
[0127] The computer program product may be written in any combination of one or more programming languages to write program code for performing the operations of the embodiments of the present invention, 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.
[0128] In addition, an embodiment of the present invention may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, enables the processor to execute the steps of the large model data screening method provided by any embodiment of the present invention.
[0129] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, 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 (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0130] It should be noted that the terms used in the present invention are only for describing specific embodiments, rather than limiting the scope of the present application. As shown in the present specification, unless the context clearly indicates an exception, the words "one", "a", "a kind of" and / or "the" do not specifically refer to the singular, but may also include the plural. The terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method or device. In the absence of further restrictions, the elements defined by the sentence "include one..." do not exclude the presence of other identical elements in the process, method or device including the elements.
[0131] It should also be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. Unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", etc. should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention.
Claims
1. A large model data screening method, characterized in that: include: Acquire each piece of data to be screened, determine at least one corresponding quality assessment indicator for each piece of data to be screened, and determine each first filtering data according to each quality assessment indicator of each piece of data to be screened; Input each first filtered data into a predetermined professional evaluation large language model, determine the professional evaluation index corresponding to each first filtered data, and determine each second filtered data according to the professional evaluation index of each first filtered data; Cluster analysis is performed on each second filtered data to determine the standard deviation of the category data, and based on the standard deviation of the category data, each second filtered data is balanced to obtain professional data for fine-tuning the large model.
2. The method according to claim 1, characterized in that After performing equalization processing on each second filtered data to obtain professional data for fine-tuning the large model, the method further includes: Determine the general data to be mixed according to the data quantity of the professional data and the preset mixing ratio; The professional data and the general data to be mixed are used as large model fine-tuning data.
3. The method according to claim 1, characterized in that The quality assessment indicators include a length assessment value, a diversity assessment value, and an instruction following difficulty assessment value; The step of determining at least one corresponding quality assessment indicator for each piece of data to be screened includes: For each piece of data to be screened, determining a length evaluation value of the data to be screened according to a preset length range and a weight distribution corresponding to the preset length range; For each piece of data to be screened, determine the embedding vector corresponding to each sentence in the data to be screened; Determine a similarity matrix according to the embedding vectors of each sentence, and determine a diversity evaluation value of the data to be screened according to the similarity matrix; For each piece of data to be screened, determine the perplexity with instructions and the perplexity without instructions through the preset instruction following model; The ratio of the perplexity with instructions to the perplexity without instructions is determined as the instruction following difficulty evaluation value.
4. The method according to claim 3, characterized in that Determining the diversity evaluation value of the to-be-screened data according to the similarity matrix includes: Determining semantic similarity according to each off-diagonal element in the similarity matrix; The diversity evaluation value of the data to be screened is determined according to the following formula: in, is the diversity evaluation value of the data to be screened, and s is the semantic similarity.
5. The method according to claim 1, characterized in that Determining each first filtering data according to each quality evaluation index of each data to be screened includes: According to the available ranges corresponding to various quality assessment indicators, each data to be screened is processed to obtain each data to be processed; Determine the comprehensive evaluation value of each data to be processed according to each quality evaluation index of each data to be processed; Each first filtering data is determined according to the comprehensive evaluation value of each data to be processed and a preset evaluation threshold.
6. The method according to claim 5, characterized in that Determining the comprehensive evaluation value of each data to be processed according to each quality evaluation index of each data to be processed includes: For each quality assessment indicator, determine the indicator standard deviation according to the quality assessment indicator of each data to be processed; Determine the indicator weights corresponding to various quality assessment indicators according to the indicator standard deviations of various quality assessment indicators; For each piece of data to be processed, each quality assessment indicator corresponding to the data to be processed is weighted according to the weight of each indicator to obtain a comprehensive assessment value of the data to be processed.
7. The method according to claim 1, characterized in that Determining each second filtering data according to the professional evaluation index of each first filtering data includes: According to the professional fields of the data to be screened, the professional evaluation indicators are divided into core indicators and secondary indicators; For each piece of first filtered data, if at least one core indicator of the first filtered data meets the core indicator requirement and at least one of the secondary indicators meets the secondary indicator requirement, the first filtered data is used as the second filtered data.
8. The method according to claim 1, characterized in that: The cluster analysis is performed on each second filtered data to determine the standard deviation of the category data, and the equalization processing is performed on each second filtered data according to the standard deviation of the category data to obtain professional data for fine-tuning the large model, including: According to the number of categories of the preset categories, cluster analysis is performed on each second filtered data to obtain the amount of data corresponding to each preset category, and according to the amount of data corresponding to each preset category, the standard deviation of the category data is determined; In response to the standard deviation of the category data being greater than the preset standard deviation, the maximum value of the category quantity is determined according to the standard deviation of the category data, the preset multiple and the minimum value of each data amount, and each second filtered data is balanced according to the maximum value of the category quantity to obtain professional data for fine-tuning the large model; In response to the standard deviation of the category data being less than or equal to the preset standard deviation, each second filtered data is used as professional data for fine-tuning the large model.
9. An electronic device, characterized in that: The electronic device comprises: Processor and memory; The processor is used to execute the steps of the large model data screening method as described in any one of claims 1 to 8 by calling the program or instruction stored in the memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program or an instruction, and the program or the instruction enables a computer to execute the steps of the large model data screening method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Text classification model training method, text classification method, device and equipment
CN112214604A
Data set quality general evaluation method oriented to artificial intelligence
CN118297444A
Instruction scheduling method, chip and electronic device
WO2024066259A1