Label data processing method and device, electronic device, and computer storage medium

By removing duplicate content from the initial annotation instruction data set in the fine-tuning data quality inspection of large model instructions, determining the type of content problems, and using multiple large models for integrated learning, the single dimension and low efficiency of data quality inspection in the existing technology are solved. problem, achieving efficient and reliable multi-dimensional data quality assessment.

CN118485046BActive Publication Date: 2024-09-17北京中科闻歌科技股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410907835.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-08
Publication Date
2024-09-17
Estimated Expiration
2044-07-08

AI Technical Summary

Technical Problem

In terms of fine-tuning data quality inspection of large model instructions, the existing technology has a single dimension of data quality assessment, cannot adapt to Chinese and specific field tasks, lacks unified evaluation standards, and is low in efficiency, especially when processing large-scale data, resulting in data quality inspection Inefficient.

Method used

Propose an annotation data processing method. By obtaining the initial annotation instruction data set, remove duplicate content, determine the content problem type, and use a variety of different types of large models to process, generate a target annotation instruction data set, and combine integrated learning and reward models. Improve multi-dimensional evaluation and efficiency of data quality inspection.

Benefits of technology

It realizes multi-dimensional quality inspection of large model instruction fine-tuning data, improves the efficiency and reliability of data quality inspection, reduces manual quality inspection costs, is suitable for Chinese and specific field tasks, and improves the accuracy and comprehensiveness of data quality inspection. Advantages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118485046B
    Figure CN118485046B
Patent Text Reader

Abstract

The present disclosure provides a method and device for processing annotation data, which relates to the field of artificial intelligence technology, and specifically to the technical fields of natural language processing, deep learning, and large models. The specific implementation scheme is: obtaining an initial annotation instruction data set, which includes annotation reply text data; obtaining a screening annotation instruction data set based on the annotation reply text data in the initial annotation instruction data set, and the annotation reply text data in the screening annotation instruction data set does not have repeated content; determining the content problem type based on the screening annotation instruction data set; processing the screening annotation instruction data set based on the content problem type and a plurality of different types of large models to obtain a target annotation instruction data set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, specifically to technical fields such as natural language processing, deep learning, and large models, and in particular to a method and device for processing labeled data, an electronic device, and a computer-readable storage medium. Background Art

[0002] With the rapid development of artificial intelligence technology, large models have achieved remarkable results in the field of natural language processing. After unsupervised pre-training, large models have mastered sufficient world knowledge. After supervised fine-tuning of instruction data, namely instruction fine-tuning, the model can achieve multi-round dialogue, knowledge question and answer, and align with human values. In the instruction fine-tuning stage, large models require a large amount of supervised annotated data, and the quality of the data directly affects the performance of the model and is also a key factor in determining the upper limit of the model's capabilities. Summary of the invention

[0003] The present disclosure provides a method and device for processing annotation data, a method and device for generating information, an electronic device, and a computer-readable storage medium.

[0004] According to a first aspect, a method for processing annotation data is provided, the method comprising: obtaining an initial annotation instruction data set, the initial annotation instruction data set comprising: at least one initial annotation instruction data, each initial annotation instruction data comprising: annotation reply text data; obtaining a filtered annotation instruction data set based on the annotation reply text data in the initial annotation instruction data set, the annotation reply text data in the filtered annotation instruction data set not having repeated content; determining a content problem type based on the filtered annotation instruction data set; processing the filtered annotation instruction data set based on the content problem type and a plurality of different types of large models to obtain a target annotation instruction data set.

[0005] According to a second aspect, a labeling data processing device is provided, which includes: an acquisition unit, configured to acquire an initial labeling instruction data set, the initial labeling instruction data set includes: at least one initial labeling instruction data, each initial labeling instruction data includes: labeling reply text data; a screening unit, configured to obtain a screened labeling instruction data set based on the labeling reply text data in the initial labeling instruction data set, the labeling reply text data in the screened labeling instruction data set does not have repeated content; a determination unit, configured to determine a content problem type based on the screened labeling instruction data set; a processing unit, configured to process the screened labeling instruction data set based on the content problem type and a plurality of different types of large models, to obtain a target labeling instruction data set.

[0006] According to a third aspect, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in any implementation manner of the first aspect.

[0007] According to a fourth aspect, a non-transitory computer-readable storage medium storing computer instructions is provided, where the computer instructions are used to cause a computer to execute the method described in any implementation of the first aspect.

[0008] The method and device for processing annotation data provided by the embodiments of the present disclosure first obtain an initial annotation instruction data set, the initial annotation instruction data set includes: at least one initial annotation instruction data, each initial annotation instruction data includes: annotation reply text data; secondly, based on the annotation reply text data in the initial annotation instruction data set, a screening annotation instruction data set is obtained, and the annotation reply text data in the screening annotation instruction data set does not have repeated content; thirdly, based on the screening annotation instruction data set, the content problem type is determined; finally, based on the content problem type and a plurality of different types of large models, the screening annotation instruction data set is processed to obtain a target annotation instruction data set. Thus, the initial annotation instruction data with heavy content in the screening annotation reply text data can be removed, and the initial annotation instruction data that is noise data in the large model reply can be removed; based on the content problem type and a plurality of different types of large models, the screening annotation instruction data set is processed, so as to realize the quality detection of the content of the screening annotation instruction data set and improve the reliability of the target annotation instruction data set.

[0009] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0011] Figure 1 is a flow chart of an embodiment of a method for processing labeled data according to the present disclosure;

[0012] Figure 2 It is a structural schematic diagram of using a large model to process a screening and marking instruction data set in an embodiment of the present disclosure;

[0013] Figure 3 is a structural schematic diagram of an embodiment of a labeling data processing device according to the present disclosure;

[0014] Figure 4It is a block diagram of an electronic device used to implement the annotation data processing method of the embodiment of the present disclosure. DETAILED DESCRIPTION

[0015] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0016] Traditional data quality inspection methods mainly rely on manual work, which is time-consuming, labor-intensive and error-prone. Therefore, how to achieve automatic quality inspection of large model instruction fine-tuning data has become an urgent problem to be solved.

[0017] The purpose of fine-tuning quality inspection of large model instructions is to filter out high-quality data from massive training data to reduce training costs and improve the capabilities of large models. Currently, research methods for this task can be mainly divided into indicator system-based methods and model-based methods. Representative methods are as follows:

[0018] 1) Use the evaluation indicators of natural language processing tasks to screen high-quality instruction data. Through linear regression analysis, the relationship between indicators such as perplexity and instruction length and model evaluation loss is established to form evaluation rules. Based on this, the quality score of the instruction data to be evaluated is calculated, and samples with higher scores are filtered out to form the final data.

[0019] 2) Using the self-guided method, the instruction-following difficulty index IFD (Instruction-Following Difficulty) was designed to automatically identify and select high-quality samples in massive data sets, thereby improving the performance of instruction data fine-tuning. For each data sample, the method first calculates the conditional answer score of the model generating a response under a given instruction and the score of the direct response, and then uses the ratio of the two scores as the IFD score. Finally, the quality of the data is measured by the level of this index.

[0020] 3) Data screening is achieved using labels that reflect the semantics and intent of the sample data. This method uses a large model to complete the labeling of data, and characterizes the diversity and complexity of the data based on the number and coverage of labels for each sample. In the screening stage, this method uses a complexity-first diversity sampling method, starting with the sample with the largest number of labels, until all labels are covered and the specified sample size is reached, and finally the data quality inspection is completed.

[0021] 4) Through the model-oriented data selection method, it is possible to select instruction data that is valuable to a specific basic language model from a large-scale original instruction dataset. This method mainly consists of three modules: quality assessment, diversified selection of seed instruction data, and enhanced data selection. In the quality assessment stage, the model is used to perform quality assessment on all "(instruction, input, output)" triplets in the original instruction dataset, and filter out a high-quality data subset. Then, a seed instruction dataset is selected from this subset using the K-means greedy algorithm to make the selected data as diverse as possible and have a wide coverage. Finally, the seed instruction dataset is used to fine-tune the basic language model, and the necessity assessment model is used to find instruction data that performs poorly in the initial instruction-following language model as the final filtered dataset.

[0022] Although the above existing methods have made certain improvements in the data quality inspection algorithms for large-model instruction fine-tuning, they still have the following three limitations. First, the existing data quality assessment models and methods mainly focus on English data and general fields and tasks, lacking data quality inspection solutions for other languages ​​including Chinese and specific fields and tasks (such as security fields, mathematical format compliance, etc.), and the evaluation dimensions are relatively single, and it is impossible to evaluate data quality from multiple perspectives. Second, there is a lack of unified evaluation standards. At present, different evaluation standards are usually used for different data sources and data selection methods. There is a lack of universal data processing specifications and quality inspection standards, and it is impossible to give full play to the comprehensive advantages of various algorithms. Third, the processing and quality inspection of large-scale instruction fine-tuning data are inefficient. When the scale of the instruction data set is large, the existing methods usually take a long time to filter and process. Therefore, how to achieve comprehensive and efficient quality inspection of instruction fine-tuning data from multiple dimensions is an urgent problem to be solved.

[0023] In view of the above-mentioned second and third limitations, the present disclosure proposes a method for processing labeled data, which combines the instruction engineering of a large model to perform content quality inspection on the initial labeled instruction data set, thereby reducing the cost of manual quality inspection and improving the efficiency of data quality inspection. Figure 1 A process 100 of an embodiment of a method for processing labeled data according to the present disclosure is shown. The method for processing labeled data includes the following steps:

[0024] Step 101: Obtain an initial labeling instruction data set.

[0025] In this embodiment, the initial labeling instruction data set includes at least one initial labeling instruction data, and each initial labeling instruction data includes: labeling sample text data and labeling reply text data, wherein the labeling sample text data is the text data to be solved or processed by the large model, and the labeling reply text data is the standard text data for replying to the labeling sample text data, that is, the labeling sample text data is the question text input into the large model, and the labeling reply text data is the reply text indicating that the large model should reply to the question text.

[0026] In this embodiment, the execution subject on which the annotation data processing method runs can obtain the initial annotation instruction data set in a variety of ways. For example, the execution subject can obtain the initial annotation instruction data set stored in the database server through a wired connection or a wireless connection. For another example, the user can obtain the initial annotation instruction data set collected by the terminal by communicating with the terminal.

[0027] Step 102: obtaining a screening annotation instruction dataset based on the annotation reply text data in the initial annotation instruction dataset.

[0028] The annotation reply text data in the annotation instruction data set is filtered to have no repeated content.

[0029] Repeated content in the initial annotation instruction data refers to the content that may contain the same words, phrases, sentences, paragraphs, etc. that appear several times in each round of the large model's response. This is noise data and is common in some open source data sets and initial annotation instruction data generated by small parameter models. If there is too much such abnormal data in the training set, it may interfere with the normal probability distribution of the large model when predicting words, causing the model to have problems such as repeated output.

[0030] In this embodiment, in the above step 102, repeated content detection is performed on the annotation reply text data of each initial annotation instruction data in the initial annotation instruction data set. When it is detected that any annotation reply text data has one or more repeated characters or words, all initial annotation instruction data with repeated characters or words in the initial annotation instruction data set are removed to obtain a filtered annotation instruction data set.

[0031] Step 103: Determine the content problem type based on the screening annotation instruction data set.

[0032] In this embodiment, the filtered annotation instruction data set is a data set of the initial annotation instruction data set from which annotation reply text data with repeated content is removed. Compared with the initial annotation instruction data set, the data volume of the filtered annotation instruction data set is smaller than that of the initial annotation instruction data set.

[0033] In this embodiment, the content problem type refers to the type of content-related problems existing in each filtering and marking instruction data in the filtering and marking instruction data set (such as the problems of the annotation sample text data or the annotation reply text data, or the problems between the annotation sample text data and the annotation reply text data). Specifically, the content problem types include: irrelevant answers, missing content, factual illusions, and time and space illusions.

[0034] Step 104 , based on the content question type and a plurality of different types of large models, the screening annotation instruction dataset is processed to obtain a target annotation instruction dataset.

[0035] In this embodiment, there are many content-related issues in the screening and labeling instruction data set, and these issues correspond to at least one content problem type. If these issues are solved using traditional machine learning methods or neural network classifiers, firstly, they cannot be traversed using rules, and secondly, the accuracy of the classification model in such tasks usually does not meet actual needs. Therefore, with the help of the generalization ability of the large model itself, the issues related to the content problem types in the screening and labeling instruction data set are automatically detected through instruction engineering methods.

[0036] The above step 104 includes: determining instruction guide words based on the content question type; inputting the instruction guide words and the screening and labeling instruction data set into a plurality of different types of large models respectively, so that the different types of large models automatically score the screening and labeling instruction data in the screening and labeling instruction data set, and voting through ensemble learning to obtain the final score of each screening and labeling instruction data, and sorting the scores of each screening and labeling instruction data in the screening and labeling instruction data set to obtain the target labeling instruction data set,

[0037] The method for processing annotation data provided by the embodiment of the present disclosure first obtains an initial annotation instruction data set, the initial annotation instruction data set includes: at least one initial annotation instruction data, each initial annotation instruction data includes: annotation reply text data; secondly, based on the annotation reply text data in the initial annotation instruction data set, a screening annotation instruction data set is obtained, and the annotation reply text data in the screening annotation instruction data set does not have repeated content; thirdly, based on the screening annotation instruction data set, the content problem type is determined; finally, based on the content problem type and a plurality of different types of large models, the screening annotation instruction data set is processed to obtain a target annotation instruction data set. Thus, the initial annotation instruction data with heavy content in the screening annotation reply text data can be removed, and the initial annotation instruction data that is noise data in the large model reply can be removed; based on the content problem type and a plurality of different types of large models, the screening annotation instruction data set is processed, so as to realize the quality detection of the content of the screening annotation instruction data set and improve the reliability of the target annotation instruction data set.

[0038] In some embodiments of the present disclosure, the above-mentioned processing of the screening labeling instruction data set based on the content problem type and a plurality of different types of big models to obtain the target labeling instruction data set includes: generating an instruction template based on the content problem type; based on the instruction template, using a plurality of different types of big models to process the screening labeling instruction data set respectively to obtain the output results of the plurality of different types of big models; obtaining the target labeling instruction data set based on the output results of all the big models.

[0039]

[0040] In this embodiment, as shown in Table 1, all content question types and question descriptions of content question types are provided. For the content question types shown in Table 1, Figure 2 As shown, the present invention discloses a set of instruction templates that are generally applicable to large models and guide the large models to reason through a thinking chain process. Through centralized learning, on the basis of the content indicated by the instruction templates, a variety of different types of large models (such as ChatGPT, LLaMa2) are used to score the screening and labeling instruction data in the screening and labeling instruction data set and vote on the scoring results of each large model, thereby realizing the detection of content problems of each screening and labeling instruction data.

[0041] like Figure 2 As shown, the content of the instruction template includes: SYSTEM ROLE You are a professional data quality inspector. The user will send you a <human>and <ai>Question and answer data, you need to target <ai>The content of the reply is subject to content quality inspection, including the following four types: irrelevant answers; missing content; factual illusions; time and space illusions. You need to first analyze whether the data has the above four types of content problems and give a final conclusion. If you think the data has quality problems, the conclusion output is "quality inspection failed, problem type: xxxx"; if you think the data has no content problems, the conclusion output is "quality inspection passed". Output format: <Analysis>xxx<Conclusion>xxx; USER ROLE: <human>How is the weather today? <ai>Today is sunny with temperatures ranging from 10 to 20 degrees Celsius.

[0042] exist Figure 2 In the instruction template shown, "SYSTEM ROLE" is the role prompt word of the large model, and "USER ROLE" is the filter label instruction data. <human>is the labeled sample text data, <ai>It is the marked reply text data.

[0043] For instruction templates, each large model (such as Figure 2 ASSISTANT 01, ASSISTANT 02…ASSISTANT N) in the ASSISTANT 01, ASSISTANT 02…ASSISTANT N) give different analyses and conclusions, such as Figure 2 ASSISTANT 01 analyzed that "Since the answer given by AI is about the weather conditions of the day, including weather conditions and temperature range, but no exact date is provided, this may lead to timeliness issues." The conclusion is "Quality inspection failed, problem type: space-time illusion". ASSISTANT 02 analyzed that "Since AI cannot access real-time data, it cannot provide accurate weather information. Therefore, the specific weather conditions and temperatures given by AI are fictitious information, and there are problems with space-time illusion." The conclusion is "Quality inspection failed, problem type: space-time illusion". ASSISTANT N analyzed that "From the structure of the question and answer, AI's answer is targeted at the question, and there is no irrelevant answer, missing content, factual illusion, or space-time illusion." The conclusion is "Quality inspection passed".

[0044] The quality inspection results are obtained by integrated learning and voting on the conclusions given by the large model. The screening and labeling instruction data that have passed the quality inspection in the quality inspection results are collected to obtain the target labeling instruction data set.

[0045] like Figure 2 As shown, it can be expressed in mathematical form as:

[0046]

[0047] In formula (1), Resp i It is a large model LLM i Generated quality inspection results, prompt is the instruction template, data is the screening and labeling instruction data set. In formula (2), the Vote function post-processes each quality inspection result, extracts the problem category label, and votes through the ensemble learning method to obtain the final problem type category label Resp.

[0048] The method for obtaining a target labeling instruction data set provided in this embodiment generates an instruction template based on the content question type; based on the instruction template, different types of large models are used to process the screening labeling instruction data respectively to obtain output results of multiple different types of large models; based on the output results of all large models, a target labeling instruction data set is obtained, thereby improving the reliability of obtaining the target labeling instruction set.

[0049] In this embodiment, after obtaining the output results of all large models, the quality inspection conclusions of all large models can be parsed and converted into integer values ​​0 / 1, where 0 / 1 represents quality inspection failure / pass. In order to further improve the quality inspection results of the target labeling instruction data set, it can also be combined with other large models to give more accurate quality inspection results.

[0050] In some optional implementations of the present disclosure, the above-mentioned processing of the screening and labeling instruction dataset based on the content question type and multiple different types of large models to obtain a target labeling instruction dataset also includes: inputting the screening and labeling instruction dataset into a trained reward model to obtain a reward score of the screening and labeling instruction dataset output by the reward model; the reward model is used to evaluate the reward score of each screening and labeling instruction data and rank the reward score; based on the reward score of the screening and labeling instruction dataset, a target labeling instruction dataset is obtained.

[0051] In this optional implementation, the training principle of the reward model may be to use the reward signal in reinforcement learning to evaluate the quality of the screening labeling instruction data set, and to screen out the target labeling instruction data set from the screening labeling instruction data set.

[0052] In this optional implementation, a weighted average method is used to obtain the scoring results of each filter labeling instruction data in the filter labeling instruction data set. Let ScoreRM represent the scoring result of the reward model for the current instruction data (normalized to between 0 and 1), and Resp represent the output result of the large model. The scoring results of the two are combined by the weighted formula as shown in formula (3):

[0053]

[0054] In formula (3), α is a weight parameter with a value range of 0≤α≤1, which is used to balance the weight between the scoring results of the reward model and the output results of the large model.

[0055] In this optional implementation, after obtaining the comprehensive scoring results of the two, the FinalScore of each filtering and labeling instruction data in the filtering and labeling instruction data set is determined and sorted, so as to select multiple filtering and labeling instruction data with higher scoring results as the target labeling instruction data set.

[0056] The method for obtaining the target labeling instruction dataset provided by this optional implementation can make full use of the scoring results of the reward model to improve the accuracy and reliability of the final quality inspection results. This method not only considers the output results of the large model, but also combines the quality assessment of the reward model to ensure the comprehensiveness and accuracy of the quality inspection process.

[0057] In some optional implementations of the present disclosure, the above-mentioned reward model is trained by the following steps: obtaining an instruction preference sample set and a pre-trained large model, wherein the large model is a model after replacing the output layer of the generative large model with the linear layer of the regression task, and the instruction preference sample set includes: at least one instruction preference sample, each instruction preference sample includes: model instruction text, positive reply text and negative reply text; selecting an instruction preference sample from the instruction preference sample set; inputting the model instruction text and positive reply text of the instruction preference sample into the large model to obtain a positive score; inputting the model instruction text and negative reply text of the instruction preference sample into the large model to obtain a negative score; calculating the contrast loss of the large model based on the positive score, the negative score and the contrast loss function; and training the large model based on the contrast loss to obtain a trained reward model.

[0058] In this optional implementation, when training the reward model, the classification head of the generative large model for predicting the next word is replaced with a regression head that outputs a scalar reward value. The input of the reward model can be a sequence consisting of an instruction text, a reply text (or response text) to the instruction text, and a special tag. The reward model calculates the reward score through the feature representation of the special tag and outputs the reward score. Among them, the regression head is the output layer of the reward model used to process the regression task (output a numerical value). The goal of the regression task is to predict a continuous numerical value rather than a discrete category label.

[0059] In this optional implementation, in the code for implementing the model structure, the "classification head" of the generative large model, which uses the softmax function to predict the next token, is replaced with a Linear layer (i.e., a fully connected layer without an activation function) to output a continuous rather than discrete scalar value, i.e., a "regression head". The training task of the reward model here is to predict and rank the reward score (regression task), not to predict the next token (classification task) like the generative large model.

[0060] In this embodiment, the above sequence is input into the reward model to be trained, which generates feature representations for each tag one by one (that is, the latent vector of the last layer of the large model body without the regression head). The feature representation of the special tag includes the features of the entire input sequence.

[0061] In this optional implementation, the instruction preference sample appears in the form of a question-answer dialogue pair (Instruction*1+Response*2), that is, a model instruction text Instruction and two possible responses (positive response text , negative reply text ) combination, during the training process, you need to Instruction+ and Instruction+ The reward score for the positive reply text is input into the reward model - the positive score, and the reward score for the negative reply text is obtained - the negative score. Based on the obtained positive score and negative score, the target is optimized by implementing the contrast loss function Pairwise Rank Loss.

[0062] In this optional implementation, the training goal of the contrastive loss function is to rank positive reply texts before negative reply texts, that is, to make the reward of positive reply texts greater than the reward of negative reply texts. This method not only simulates human selection preferences, but also optimizes through a detailed contrastive loss function.

[0063] In this optional implementation, Pairwise Ranking Loss is a loss function used for ranking tasks. It optimizes the ranking ability of the model by comparing paired data items. The goal is to ensure that the score of positive samples is higher than that of negative samples. Specifically, the formula of the contrast loss function is shown in formula (4):

[0064]

[0065] Where s_chosen is the score of the positive sample, s_rejected is the score of the negative sample, and function f is the specific loss. Function f is shown in formula (5):

[0066]

[0067] Among them, margin is a hyperparameter used to define the minimum expected gap between the model's positive and negative sample scores, which is usually set to 1.

[0068] In this embodiment, the above-mentioned training of the large model based on the contrast loss to obtain a trained reward model includes: detecting whether the contrast loss satisfies a loss threshold that is less than or equal to the loss threshold; in response to detecting that the contrast loss is less than or equal to the loss threshold, determining that the training of the large model is completed, and obtaining a trained reward model.

[0069] In this optional implementation, the loss threshold may be determined based on training requirements, for example, the loss threshold is 0.01.

[0070] Optionally, the method of training the large model based on the contrast loss to obtain a trained reward model also includes: in response to detecting that the contrast loss is greater than a loss threshold, adjusting the parameters of the large model, and continuing to select instruction preference samples from the instruction preference sample set; inputting the model instruction text and positive reply text of the instruction preference sample into the large model to obtain a positive score; inputting the model instruction text and negative reply text of the instruction preference sample into the large model to obtain a negative score; calculating the contrast loss of the large model based on the positive score, the negative score and the contrast loss function; and detecting whether the contrast loss satisfies a condition that is less than or equal to the loss threshold.

[0071] The method for training a reward model provided by this optional implementation selects instruction preference samples from an instruction preference sample set, obtains positive scores and negative scores based on the instruction preference samples and a large model in which the output layer of the generative large model is replaced with a linear layer of the regression task, calculates the contrast loss of the large model through a contrast loss function, and obtains a trained reward model based on the contrast loss, thereby improving the reliability of the reward model.

[0072] In some optional implementations of the present disclosure, the above-mentioned method of obtaining a filtered annotation instruction data set based on the annotation reply text data in the initial annotation instruction data set includes: performing data preprocessing on each annotation reply text data in the initial annotation instruction data set to obtain a annotation reply data set; performing word segmentation on the annotation reply data set to generate a word segmentation vocabulary list; generating a window vocabulary list based on the word segmentation vocabulary list and the number of windows; calculating the window repetition rate based on the window vocabulary list using a window repetition rate calculation algorithm, the window repetition rate calculation algorithm is used to measure the repeated window vocabulary in the sequence; calculating the word repetition rate based on the word segmentation vocabulary list and the word weight rate calculation algorithm, the word weight rate calculation algorithm is used to calculate the probability of each word in the sequence appearing in the preceding window of the word; in response to the window repetition rate and the word repetition rate satisfying the repetition condition, determining that the annotation reply text data is repeated, and removing the initial annotation instruction data corresponding to the annotation reply text data.

[0073] In this optional implementation, the word repetition rate (rep / ), the word weight calculation algorithm is used to calculate the model to predict the next word to appear in the previous window (previous window). The probability of a token in a word reflects the degree to which the model generates repeated content when a word appears.

[0074]

[0075] in, Represents the size of the sequence set D. Represents the length of the sequence. Π is an indicator function, which is 1 when the internal condition is met and 0 otherwise. It represents the probability of the model predicting the next word given the first t words. Position before t word, that is, the previous context window.

[0076] In this optional implementation, the window repetition rate calculation algorithm shown in formula (7) is used to calculate the window repetition rate (seq-rep-n). The window repetition rate is also a repeated word sequence. The algorithm uses the repeated window word part in the sequence to measure the sequence-level repetition, that is, for a word sequence ,calculate:

[0077]

[0078] Formula (7) is used to average the word sequence. In formula (7), generating an n-gram list is to initialize a window of length n and slide it back step by step. The size of n can be set based on the quality inspection requirements. For example, n=2, the sentence is "big model data quality inspection". If the sentence is segmented into single words, the generated n-gram list is ["big model", "model", "number of models", "data", "quality of data", "quality inspection"].

[0079] When there is no repeated word sequence in the sequence, the window repetition rate seq-rep-n is zero; when the sequence content is repeated, the window repetition rate of this indicator gradually increases to 1.0.

[0080] In this optional implementation, the repetition condition is: the window repetition rate is greater than the first window repetition rate threshold, and the word repetition rate is greater than the first word repetition rate threshold, wherein the window repetition rate threshold and the word repetition rate threshold can be set based on quality inspection requirements, for example, seq_rep_n is greater than 0.3 and Greater than 0.5.

[0081] Optionally, the repetition condition may also be: the window repetition rate is greater than a second window repetition rate threshold, or the word repetition rate is greater than a second word repetition rate threshold, wherein the second window repetition rate threshold is greater than the first window repetition rate threshold, and the second window repetition rate threshold may be set based on quality inspection requirements, such as the second window repetition rate threshold is 0.7; or the second word repetition rate threshold is greater than the first word repetition rate threshold, and the second word repetition rate threshold may be set based on quality inspection requirements, such as the second word repetition rate threshold is 0.7.

[0082] In this optional implementation, the word weight rate calculation algorithm, the window repetition rate calculation algorithm, the word repetition rate threshold and the window repetition rate threshold can be used to quickly filter out data with duplicate content generation. In the manual quality inspection stage of the duplicate generation problem data, only the data that fails the algorithm-assisted quality inspection needs to be re-checked, which greatly saves labor costs.

[0083] This optional implementation provides a method for obtaining a filtered annotation instruction data set, calculating the window repetition rate and the word repetition rate, and when the window repetition rate and the word repetition rate meet the repetition condition, removing the initial annotation instruction data corresponding to the annotation reply text data. Thus, the algorithm can quickly filter out data with repeatedly generated content, providing a reliable implementation method for removing repeated content in the initial annotation instruction data set, greatly saving labor costs.

[0084] For scenarios where only repeated words need to be removed, optionally, the above-mentioned annotation reply text data based on the initial annotation instruction data set to obtain a filtered annotation instruction data set includes: performing data preprocessing on each annotation reply text data in the initial annotation instruction data set to obtain a annotation reply data set; segmenting the annotation reply data set to generate a segmentation vocabulary list; generating a window vocabulary list based on the segmentation vocabulary list and the number of windows; calculating the window repetition rate based on the window vocabulary list using a window repetition rate calculation algorithm, the window repetition rate calculation algorithm being used to measure repeated window vocabulary in a sequence; in response to the window repetition rate satisfying the vocabulary repetition condition, removing the initial annotation instruction data corresponding to the annotation reply text data.

[0085] For the scenario where only repeated characters need to be removed, optionally, the above-mentioned annotation reply text data based on the initial annotation instruction data set to obtain the screened annotation instruction data set includes: performing data preprocessing on each annotation reply text data in the initial annotation instruction data set to obtain the annotation reply data set; segmenting the annotation reply data set to generate a segmentation vocabulary list; calculating the character repetition rate based on the segmentation vocabulary list and a character weight rate calculation algorithm, the character weight rate calculation algorithm being used to calculate the probability of each word in the sequence appearing in the preceding window of the word; in response to the character repetition rate satisfying the character repetition condition, determining that the annotation reply text data is repeated, and removing the initial annotation instruction data corresponding to the annotation reply text data.

[0086] In response to the first limitation mentioned above, in some embodiments of the present disclosure, the above-mentioned annotation data processing method also includes: inputting the target annotation instruction data set into a pre-trained format classification model to obtain a format classification result output by the format classification model; the format classification result includes: target annotation instruction data with normal format and target annotation instruction data with a problematic format of at least one format type.

[0087] In this embodiment, the format classification model is a classification model that characterizes the correspondence between target labeling instruction data and at least one format type of question format, wherein at least one format type may include: at least one of text format, Markdown format, JSON format, and mathematical formula format. The question format of at least one format type and its question description are shown in Table 2.

[0088]

[0089] In this embodiment, after obtaining the target labeling instruction data in the target labeling instruction data set, the format classification model classifies the target labeling instruction data to determine the classification result of the target labeling instruction data.

[0090] Optionally, when at least one format type is four types, the format classification model can be a multi-classifier based on RoBERTa, predicting five classification labels such as 0-4, corresponding to normal instruction fine-tuning data and four types of problem instruction fine-tuning data. First, regular expressions are constructed for the four major types of data format problems, and m (m>1) samples with a balanced number of samples are sampled from the full instruction fine-tuning data set, and 4*m normal data are sampled at the same time. The data set is divided into a training set, a validation set, and a test set. Among them, the training set accounts for 70% of the total data, the validation set accounts for 15%, and the test set accounts for 15%.

[0091] The RoBERTa model is a pre-trained language model based on the BERT (Bidirectional Encoder Representation from Transformers) model. It has made many improvements on the basis of BERT, including the expansion of training data, the use of dynamic masks, the removal of the Next Sentence Prediction (NSP) task, and the optimization of hyperparameters and training processes, thereby achieving better performance in multiple natural language processing tasks. The model is mainly composed of multiple layers of self-attention layers and feedforward neural networks. It takes word embeddings and positional embeddings as input, and finally outputs dense vector representations of text through multiple layers of transformation. These representations can capture the deep semantic information in the text.

[0092] The annotation data processing method provided in this embodiment classifies the target annotation instruction data set through a format classification model to obtain a format classification result, determines the target annotation instruction data with normal format and the target annotation instruction data with problematic format of at least one format type in the target annotation instruction data set, removes the target annotation instruction data with problematic format, and provides a reliable implementation method for format optimization of the target annotation instruction data set.

[0093] In some optional implementations of the present disclosure, the format classification model is trained using the following steps: constructing a regular expression based on the format type of the question format; using the regular expression to filter first sample data from a full set of sample data, the first sample data having sample data of a question format of at least one format type; filtering second sample data from the sample data set, the format of the second sample data being normal, and the number of the second sample data being greater than the number of the first sample data; and training a pre-trained language model based on the first sample data and the second sample data to obtain a trained format classification model.

[0094] In this embodiment, it is assumed that the input text sequence, that is, the first sample data or the second sample data is ,in is the i-th token in the sequence. The pre-trained language model first converts Convert to the corresponding word embedding sequence , and then through the self-attention mechanism and feedforward neural network Encode to get the context-dependent representation of the text .

[0095] During the training process, the difference between the output of the pre-trained language model and the true label is quantified by the loss function. This disclosure uses the cross entropy loss. Given a specific loss function , the gradient of the pre-trained language model parameters is calculated by the back propagation algorithm. Assume that the model parameters are , then the parameter update formula is as shown in formula (8):

[0096]

[0097] In formula (8), η is the learning rate, is the gradient of the loss function with respect to the parameters of the pre-trained language model. In the five-classification task, the sampled Softmax function converts the output of the last layer of the pre-trained language model into a probability distribution, and then the cross entropy loss function is used to calculate the difference between the output of the pre-trained language model and the true label. Given the output probability distribution of the pre-trained language model for a certain sample and the one-hot representation of the true label , the cross entropy loss calculation formula is:

[0098]

[0099] In (9), by minimizing the loss function The pre-trained language model can be effectively trained on five classification tasks, thereby realizing automatic classification of data with unformatted problems, data with text format problems, data with Markdown format problems, data with JSON format problems, and data with mathematical formula format problems.

[0100] In this embodiment, the format classification model is a trained format classification model obtained after adjusting the parameters of the pre-trained language model through multiple iterative training. The loss value of the pre-trained language model can be used to detect whether the pre-trained language model meets the training completion conditions. After the pre-trained language model meets the training completion conditions, the format classification model is obtained.

[0101] Optionally, in this embodiment, in response to the pre-trained language model not meeting the training completion condition, the relevant parameters in the pre-trained language model are adjusted so that the loss value of the pre-trained language model converges, and the pre-trained language model is continued to be trained based on the adjusted pre-trained language model until the training completion condition is met.

[0102] In this optional implementation, when the pre-trained language model does not meet the training completion conditions, adjusting the relevant parameters of the pre-trained language model helps to converge the loss value of the pre-trained language model.

[0103] The training method of the format classification model provided in this embodiment constructs a regular expression based on the format type; based on the regular expression, the first sample data is screened; the second sample data is screened from the sample data set, and the pre-trained language model is trained based on the first sample data and the second sample data to obtain a trained format classification model, thereby providing a reliable implementation method for training the format classification model.

[0104] In some embodiments of the present disclosure, the training step of the above-mentioned format classification model also includes: determining a format identifier of the question format based on the type of question format; expanding the format identifier into the vocabulary of the pre-trained language model, and expanding the dimension of the vector of the format identifier to be the same as the dimension of the vocabulary.

[0105] In this optional implementation, a format identifier is determined, the format identifier corresponds to the format type, and the added format identifier can prevent the semantics in the first sample data from being cut and represented.

[0106] For example, the secondary title in Markdown format is "## Title" (two pound signs + space + title). The default format identifier may cut a single "#" into a token. However, the format identifier of the question format can expand common format-related combinations such as "##" into the vocabulary for fine-tuning. This can prevent the type-related text sequences of the question format from being chopped up and the compression ratio from being too large. It can also enhance the model's sensitivity to format and modeling capabilities.

[0107] The training method of the format classification model provided in this embodiment determines the format identifier of the question format based on the type of question format; the format identifier is expanded into the vocabulary of the pre-trained language model, so that the format type of the first sample data can be familiar to the model, thereby improving the sensitivity and modeling ability of the format classification model to the question format of at least one format type.

[0108] Aligning large models with human values ​​and security alignment is an important task, and the key to this work lies in high-quality target labeling instruction data related to security. However, some open source models do not perform security alignment well, resulting in the problem that the target labeling instruction data they generate will not meet security standards. In some embodiments of the present disclosure, the above-mentioned labeling data processing method also includes: segmenting each target labeling instruction data in the target labeling instruction data set to obtain a labeling segmentation set; matching each labeling segmentation in the labeling segmentation set with a word node in a pre-constructed prefix tree, and each word node in the prefix data includes text data that does not meet security standards; in response to a labeling segmentation successfully matching a word node in the prefix tree, determining that the target labeling instruction data including the labeling segmentation is non-safe data; removing the non-safe data from the target labeling instruction data set.

[0109] In this embodiment, security issues are classified into two types: general security and position security. Among them, general security issue data refers to instruction fine-tuning data related to the basic security needs of individuals, organizations or society, such as personal safety, property safety, network security, etc. Position security refers to the security threats that individuals or organizations may face in specific situations due to differences in interests, beliefs, values, etc. Position security issues usually involve sensitive areas.

[0110] In this embodiment, the specific process of matching the marked word segments with the word nodes in the pre-built prefix tree is as follows:

[0111] Starting from the root node of the prefix tree, traverse each word in each target labeling instruction data in the target labeling instruction data set.

[0112] For each word, match it character by character in the prefix tree.

[0113] If the match fails at a certain character, the match will restart from the next character in the text.

[0114] If the match is successful and the node is the end node of a word, it is considered that a non-safe data is found.

[0115] The annotation data processing method provided in this embodiment matches each annotation word in the annotation word set with a word node in a pre-constructed prefix tree, and in response to a successful match between a annotation word and a word node in the prefix tree, determines that the target annotation instruction data of the annotation word is unsafe data, removes the unsafe data from the target annotation instruction data set, and improves the security of the target annotation instruction data in the target annotation instruction data set.

[0116] Optionally, the above-mentioned annotation data processing method also includes: segmenting each target annotation instruction data in the target annotation instruction data set to obtain an annotation segmentation set; matching each annotation segmentation in the annotation segmentation set with a word node in a pre-constructed prefix tree, and each word node in the prefix data includes text data that does not meet the security standards; in response to a successful match between an annotation segmentation and a word node in the prefix tree, determining that the target annotation instruction data including the annotation segmentation is non-safe data. Based on the word node that successfully matches the target annotation instruction data, determine the sensitivity level of the target annotation instruction data, and based on the sensitivity level, adjust the annotation reply text data in the target annotation instruction data. Among them, the sensitivity levels include: conventional security, position security, and highly sensitive security.

[0117] For security-related issues in the target labeling instruction data, the expected response of the large model should be dynamically adjusted according to the sensitivity. For routine security issues, users should generally be informed of the correct laws, regulations and values, and guided to comply with relevant rules and regulations, that is, the labeling reply text data in the target labeling instruction data should be adjusted to text data related to compliance with relevant rules and regulations. For stance security issues in the target labeling instruction data, the stance of the model trainer should generally be stated before correcting and further responding to the user's questions, that is, the labeling reply text data in the target labeling instruction data should be adjusted to text data representing the stance and the reply text. For highly sensitive questions, you should learn to refuse to answer, that is, adjust the labeling reply text data in the target labeling instruction data to empty.

[0118] In some embodiments of the present disclosure, the above-mentioned prefix tree is constructed by the following steps: initializing the root node; traversing each rule word in the rule dictionary that does not conform to the rule word expression, and inserting the rule word into the prefix tree to obtain a word node; when inserting the rule word, merging the word nodes with the same prefix.

[0119] The security problem detection algorithm of the initial labeled instruction data set mainly relies on the predefined rule dictionary. The disclosure uses the prefix tree algorithm to perform fast matching to detect whether it contains sensitive words or illegal content, thereby screening out security-related data. In general, it is divided into the prefix tree construction and detection process. Specifically, when constructing the prefix tree:

[0120] Initialize the prefix tree node: Create a prefix tree node class, which contains the following attributes: child node dictionary (used to store character and child node mapping), end tag (used to mark the end of a word).

[0121] Add rule words to the prefix tree: Traverse each rule word in the rule dictionary and insert it into the prefix tree character by character. If the character does not exist in the child nodes of the current node, create a new node. After all characters are added, set the end marker of the last character to True.

[0122] Considering the complexity of Chinese word segmentation, some optimization measures are added when constructing the prefix tree. First, some common non-keyword Chinese characters are skipped, and second, words with the same prefix are merged to reduce the size of the tree. After the prefix tree is constructed, the target labeling instruction dataset can be security tested.

[0123] The method for constructing a prefix tree provided in this embodiment traverses the rule words in the rule dictionary that do not conform to the rule word expression, inserts the rule words into the word nodes of the prefix tree, and merges the word nodes with the same prefix when inserting the rule words, thereby providing a reliable implementation method for obtaining the prefix tree.

[0124] In traditional technology, there are few existing quality inspection algorithms for the initial annotation instruction data set of large models. Most of them only evaluate data quality by designing a single indicator or rule combination, which lacks diversity, comprehensiveness and robustness. Therefore, the present invention conducts intelligent modeling and analysis on different dimensions such as content, format and security of the initial annotation instruction data set, designs different algorithms and strategies, and conducts comprehensive quality inspection on the initial annotation instruction data set through machine learning and deep learning methods, combined with large model instruction engineering, reduces manual quality inspection costs, and improves data quality inspection efficiency.

[0125] Further references Figure 3 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a labeling data processing device, which is similar to Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0126] like Figure 3 As shown, the annotation data processing device 300 provided in this embodiment includes: an acquisition unit 301, a screening unit 302, a determination unit 303, and a processing unit 304. Among them, the acquisition unit 301 can be configured to acquire an initial annotation instruction data set, and the initial annotation instruction data set includes: at least one initial annotation instruction data, and each initial annotation instruction data includes: annotation reply text data. The screening unit 302 can be configured to obtain a screening annotation instruction data set based on the annotation reply text data in the initial annotation instruction data set, and the annotation reply text data in the screening annotation instruction data set does not have repeated content. The determination unit 303 can be configured to determine the content problem type based on the screening annotation instruction data set. The processing unit 304 can be configured to process the screening annotation instruction data set based on the content problem type and a plurality of different types of large models to obtain a target annotation instruction data set.

[0127] In this embodiment, the specific processing of the acquisition unit 301, the screening unit 302, the determination unit 303, and the processing unit 304 and the technical effects thereof can be referred to in detail. Figure 1 The relevant descriptions of step 101, step 102, step 103, and step 104 in the corresponding embodiment are not repeated here.

[0128] In some optional implementations of the present embodiment, the processing unit 304 is further configured to: generate an instruction template based on the content question type; based on the instruction template, use a plurality of different types of big models to process the screening and labeling instruction data sets respectively to obtain output results of a plurality of different types of big models; and obtain a target labeling instruction data set based on the output results of all the big models.

[0129] In some optional implementations of the present embodiment, the screening unit 302 is further configured to: perform data preprocessing on each annotation reply text data in the initial annotation instruction data set to obtain an annotation reply data set; perform word segmentation on the annotation reply data set to generate a word segmentation vocabulary list; generate a window vocabulary list based on the word segmentation vocabulary list and the number of windows; based on the window vocabulary list, use a window repetition rate calculation algorithm to calculate the window repetition rate, and the window repetition rate calculation algorithm is used to measure the repeated window vocabulary in the sequence; calculate the word repetition rate based on the word segmentation vocabulary list and the word weight rate calculation algorithm, and the word weight rate calculation algorithm is used to calculate the probability of each word in the sequence appearing in the preceding window of the word; in response to the window repetition rate and the word repetition rate satisfying the repetition condition, it is determined that the annotation reply text data is repeated, and the initial annotation instruction data corresponding to the annotation reply text data is removed.

[0130] In some embodiments of the present disclosure, the above-mentioned device 300 also includes: a classification unit (not shown in the figure), and the above-mentioned classification unit can be configured to: input the target labeling instruction data set into a pre-trained format classification model to obtain a format classification result output by the format classification model; the format classification result includes: target labeling instruction data with normal format and target labeling instruction data with a problematic format of at least one format type; remove the target labeling instruction data whose format classification result is a problematic format in the target labeling instruction data set.

[0131] In some embodiments of the present disclosure, the above-mentioned format classification model is trained using a training unit, and the training unit is configured to: construct a regular expression based on the format type of the question format; use the regular expression to filter first sample data from a full amount of sample data sets, and the first sample data has sample data of the question format of at least one format type; filter second sample data from the sample data set, the format of the second sample data is normal, and the number of the second sample data is greater than the number of the first sample data; based on the first sample data and the second sample data, train a pre-trained language model to obtain a trained format classification model.

[0132] In some embodiments of the present disclosure, the above-mentioned training unit is further configured to: determine a format identifier of the question format based on the type of the question format; expand the format identifier into the vocabulary of the pre-trained language model, and expand the dimension of the vector of the format identifier to be the same as the dimension of the vocabulary.

[0133] In some embodiments of the present disclosure, the above-mentioned device 300 also includes: a matching unit (not shown in the figure), and the above-mentioned matching unit is configured to: segment each target labeling instruction data in the target labeling instruction data set to obtain a labeling word set; match each labeling word in the labeling word set with a word node in a pre-constructed prefix tree, and each word node in the prefix data includes text data that does not meet the security standard; in response to a labeling word successfully matching a word node in the prefix tree, determine that the target labeling instruction data including the labeling word is non-safe data; remove the non-safe data from the target labeling instruction data set.

[0134] In some embodiments of the present disclosure, the above-mentioned prefix is ​​constructed using a construction unit (not shown in the figure), and the above-mentioned construction unit is configured to: initialize the root node; traverse each rule word in the rule dictionary that does not conform to the rule word expression, and insert the rule word into the prefix tree to obtain a word node; when inserting the rule word, merge the word nodes with the same prefix.

[0135] The annotation data processing device provided by the embodiment of the present disclosure, first, the acquisition unit 301 acquires the initial annotation instruction data set, the initial annotation instruction data set includes: at least one initial annotation instruction data, each initial annotation instruction data includes: annotation reply text data; secondly, the screening unit 302 obtains the screening annotation instruction data set based on the annotation reply text data in the initial annotation instruction data set, and the annotation reply text data in the screening annotation instruction data set does not have repeated content; thirdly, the determination unit 303 determines the content problem type based on the screening annotation instruction data set; finally, the processing unit 304 processes the screening annotation instruction data set based on the content problem type and a variety of different types of large models to obtain the target annotation instruction data set. Thus, the initial annotation instruction data with heavy content in the screening annotation reply text data can remove the initial annotation instruction data that belongs to noise data in the large model reply; based on the content problem type and a variety of different types of large models, the screening annotation instruction data set is processed, which realizes the quality detection of the content of the screening annotation instruction data set and improves the reliability of the target annotation instruction data set.

[0136] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0137] Figure 4 A schematic block diagram of an example electronic device 400 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0138] like Figure 4 As shown, the device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0139] A number of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0140] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 401 performs the various methods and processes described above, such as the annotation data processing method. For example, in some embodiments, the annotation data processing method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the computing unit 401, one or more steps of the annotation data processing method described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the annotation data processing method in any other appropriate manner (e.g., by means of firmware).

[0141] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0142] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, causes the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0143] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer 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 foregoing.

[0144] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0145] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0146] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0147] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0148] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.< / ai> < / human> < / ai> < / human> < / ai> < / ai> < / human>

Claims

1. A method for processing annotated data, the method comprising: Acquire an initial marking instruction data set, the initial marking instruction data set comprising: at least one initial marking instruction data, each initial marking instruction data comprising: marking reply text data; Based on the annotation reply text data in the initial annotation instruction data set, a screening annotation instruction data set is obtained, wherein the annotation reply text data in the screening annotation instruction data set does not have repeated content; Determining a content problem type based on the screening and annotation instruction data set; Based on the content question type and a plurality of different types of large models, the screening labeling instruction data set is processed to obtain a target labeling instruction data set; the content question types include: irrelevant answers, missing content, factual illusions, and time-space illusions; The screening annotation instruction dataset is processed based on the content question type and a plurality of different types of large models to obtain a target annotation instruction dataset, including: generating an instruction template based on the content question type; Based on the instruction template, a plurality of different types of large models are used to process the screening and marking instruction data set respectively to obtain output results of a plurality of different types of large models; Based on the output results of all large models, the target labeling instruction dataset is obtained; Inputting the screening and labeling instruction data set into the trained reward model to obtain the reward score of the screening and labeling instruction data set output by the reward model; the reward model is used to evaluate the reward score of each screening instruction data and sort the reward score; Based on the reward score of the filtered labeling instruction dataset, the output results of all large models and the filtered labeling instruction dataset, a target labeling instruction dataset is obtained.

2. The method according to claim 1, wherein: The reward model is trained using the following steps: Obtaining an instruction preference sample set and a pre-trained large model, wherein the large model is a model obtained by replacing an output layer of a generative large model with a linear layer of a regression task, wherein the instruction preference sample set includes: at least one instruction preference sample, each instruction preference sample includes: a model instruction text, a positive response text, and a negative response text; Selecting an instruction preference sample from the instruction preference sample set; Inputting the model instruction text and the positive response text of the instruction preference sample into the large model to obtain a positive score; Inputting the model instruction text and negative response text of the instruction preference sample into the large model to obtain a negative score; Calculating the contrast loss of the large model based on the positive score, the negative score and the contrast loss function; Based on the contrast loss, the large model is trained to obtain a trained reward model.

3. The method according to claim 1, wherein: The obtaining of the screening annotation instruction data set based on the annotation reply text data in the initial annotation instruction data set comprises: Performing data preprocessing on each annotation reply text data in the initial annotation instruction data set to obtain an annotation reply data set; Segmenting the labeled response data set to generate a segmentation vocabulary list; Based on the word segmentation vocabulary list and the number of windows, generating a window vocabulary list; Based on the window vocabulary list, a window repetition rate calculation algorithm is used to calculate the window repetition rate, wherein the window repetition rate calculation algorithm is used to measure the repeated window vocabulary in the sequence; Calculating the word repetition rate based on the word segmentation vocabulary list and the word weight rate calculation algorithm, wherein the word weight rate calculation algorithm is used to calculate the probability of each word in the sequence appearing in the preceding window of the word; In response to the window repetition rate and the word repetition rate satisfying a repetition condition, it is determined that the annotation reply text data is repeated, and the initial annotation instruction data corresponding to the annotation reply text data is removed.

4. The method according to claim 1, further comprising: Inputting the target labeling instruction data set into a pre-trained format classification model to obtain a format classification result output by the format classification model; The format classification result includes: target labeling instruction data in a normal format and target labeling instruction data in a problematic format of at least one format type; The target labeling instruction data set whose format classification result is a problem format is removed.

5. The method according to claim 4, wherein: The format classification model is trained by the following steps: Based on the format type of the question format, construct a regular expression; Using the regular expression, first sample data is filtered from the entire sample data set, where the first sample data has sample data in a question format of at least one format type; Filtering second sample data from the sample data set, where the format of the second sample data is normal and the amount of the second sample data is greater than the amount of the first sample data; Based on the type of the question format, determining a format identifier of the question format; Expanding the format identifier into a vocabulary of a pre-trained language model, and expanding the dimension of the vector of the format identifier to be the same as the dimension of the vocabulary; Based on the first sample data and the second sample data, a pre-trained language model is trained to obtain a trained format classification model.

6. The method according to claim 1, further comprising: Segmenting each target labeling instruction data in the target labeling instruction data set to obtain a labeling segmentation set; Matching each marked word in the marked word set with a word node in a pre-constructed prefix tree, each word node in the prefix tree includes text data that does not meet the security standard; In response to a successful match between the marked word segment and the word node in the prefix tree, determining that the target marked instruction data including the marked word segment is non-safe data; The non-safe data is removed from the target annotation instruction data set.

7. A labeling data processing device, the device comprising: An acquisition unit is configured to acquire an initial annotation instruction data set, wherein the initial annotation instruction data set includes: at least one initial annotation instruction data, each initial annotation instruction data includes: annotation reply text data; A screening unit is configured to obtain a screening marking instruction data set based on the marking reply text data in the initial marking instruction data set, wherein the marking reply text data in the screening marking instruction data set does not have repeated content; A determination unit, configured to determine a content problem type based on the screening and annotation instruction data set; A processing unit is configured to process the screening labeling instruction data set based on the content question type and a plurality of different types of large models to obtain a target labeling instruction data set; the content question types include: irrelevant answers, missing content, factual illusions, and spatiotemporal illusions; The processing unit is further configured to: generate an instruction template based on the content question type; based on the instruction template, use multiple different types of large models to process the screening and labeling instruction data set respectively to obtain output results of multiple different types of large models; based on the output results of all large models, obtain a target labeling instruction data set; input the screening and labeling instruction data set into a trained reward model to obtain a reward score of the screening and labeling instruction data set output by the reward model; the reward model is used to evaluate the reward score of each screening instruction data and rank the reward score; based on the reward score of the screening and labeling instruction data set, obtain a target labeling instruction data set.

8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable the computer to execute the method according to any one of claims 1 to 6.