A training method of a classification model and a related device
Patent Information
- Application Number
- CN202310444662.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-14
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-04-14
AI Technical Summary
然而,现有技术对于输入文本的长度有一定的要求,在输入文本较短的情况,往往难以得到准确的预测结果
Smart Images

Figure CN116401552B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence (AI) technology, and in particular to a method for training a classification model. Background Technology
[0002] With the rapid development of AI technology, AI-generated data is becoming increasingly similar to human-generated data. Therefore, more and more applications are utilizing AI-generated data during operation. This AI-generated data can include, for example, text, voice, video, and images.
[0003] Taking AI-generated text as an example, in order to prevent AI-generated spam or erroneous information from causing adverse consequences, AI-generated text detection has become an important technology. AI-generated text detection is mainly used to distinguish whether the content of the text to be detected is generated by humans or by AI.
[0004] Existing AI-generated text detection solutions typically employ binary classification techniques. The text to be detected is input into a pre-trained model, which then outputs a final prediction: whether the text was generated manually or by AI. However, current technologies have limitations regarding the length of the input text; when the input text is short, accurate predictions are often difficult to obtain. Summary of the Invention
[0005] This application provides a training method for a classification model that can effectively improve the prediction accuracy of the classification model.
[0006] The first aspect of this application provides a training method for a classification model, applied in the field of artificial intelligence technology. The method includes: firstly, acquiring multiple raw training data sets, where the category label corresponding to each raw training data set is either user-generated data or AI-generated data; that is, the raw training data is generated either by user generation or AI generation. Furthermore, all the raw training data sets are of the same data type, for example, the data type of the raw training data sets is any one of the following types: text, image, video, and audio.
[0007] Then, multiple target training data are obtained based on multiple original training data. The first part of the multiple target training data belongs to multiple original training data, that is, the first part is a subset of the multiple original training data. Each target training data in the second part of the multiple target training data is obtained from the corresponding original training data in the multiple original training data, and the data size of each target training data is smaller than the data size of the corresponding original training data. That is, each target training data in the second part of the multiple target training data corresponds to one original training data, and each target training data in the second part is obtained based on its corresponding original training data.
[0008] Secondly, multiple target training data are input into a classification model to obtain multiple classification results corresponding to the multiple target training data. This classification model can be an AI model performing a binary classification task, used to predict the classification of the input data. Each of these multiple classification results indicates the category to which the corresponding target training data belongs, i.e., whether the target training data belongs to user-generated data or AI-generated data.
[0009] Finally, the first model is updated based on the loss function value to obtain the second model. This loss function value is obtained based on multiple classification results and the category labels corresponding to multiple target training data. Among them, some target training data in the second part of the data does not have category labels, and the amount of data of some target training data is less than a preset threshold, and the corresponding original training data is generated by AI.
[0010] In this approach, smaller target training data is first generated based on the original training data to obtain training data at different scales, ensuring scale diversity of the training data. Furthermore, considering the characteristics of AI-generated data, the smaller target training data that was originally generated by AI is labeled as unlabeled data. This allows the classification model to focus on AI-generated data that differs from manually generated data during training, avoiding the impact of labeling it as AI-generated data on the classification model's perception of the AI-generated data style, and effectively improving the prediction accuracy of the classification model.
[0011] In one possible implementation, the target training data in the second part of the data is obtained based on a portion of the corresponding original training data.
[0012] In one possible implementation, the second part of the data includes the first target training data, which is obtained by cropping a portion of the original training data corresponding to the first target training data. For example, assuming the original training data corresponding to the first target training data is text, and the text content of the original training data is specifically "Hello! How are you! I am fine, thank you! And you?", then the text content of the first target training data could be "How are you! I am fine, thank you! And you?".
[0013] In one possible implementation, the second part of the data includes second-target training data, which is obtained by fusing multiple parts of the original training data corresponding to the second-target training data. However, in fusing the multiple parts, not all the cropped content is merged, but only a portion of it is merged, so that the size of the resulting second-target training data is smaller than the corresponding original training data.
[0014] In this scheme, on the one hand, the original training data is processed to obtain target training data with a smaller data volume; on the other hand, a portion of the original training data is used as target training data, which enables multi-scale augmentation of the original training data, thereby ensuring the diversity of scales of the final target training data.
[0015] In one possible implementation, the loss function value is obtained based on a first sub-loss function value, which is obtained based on a first difference and a second difference. The first difference is the difference between the classification result corresponding to a portion of the target training data and the class label assumed for the target training data. The second difference is the difference between the classification result corresponding to the positive sample training data in multiple target training data and the class label assumed for the positive sample data. Here, the class labels assumed for both the target training data and the positive sample training data are AI-generated data, and the positive sample training data includes the target training data whose class labels are user-generated data.
[0016] In simple terms, the first sub-loss function value can be understood as the positive-unlabeled (PU) loss, which is obtained based on positive samples (i.e., target training data with class labels that are user-generated data) and unlabeled samples (i.e., target training data without class labels).
[0017] In this scheme, target training data with category labels that are user-generated data are considered as positive samples, and target training data without category labels are considered as unlabeled samples. Then, the classification loss of negative samples is estimated based on positive samples and unlabeled samples. This allows the classification model to focus on AI-generated data that is different from human-generated data during training, avoiding the impact on the classification model's perception of the style of AI-generated data when the target training data with a small amount of data and originally generated by AI is directly labeled as negative samples. This effectively improves the prediction accuracy of the trained classification model.
[0018] In one possible implementation, the loss function value is also obtained based on a second sub-loss function value, which is obtained based on the mean difference between multiple classification results and the category labels corresponding to multiple target training data; wherein, in the process of determining the second sub-loss function value, the category labels corresponding to some of the target training data are AI-generated data.
[0019] In simple terms, the second sub-loss function value can be understood as the positive-negative (PN) loss, which is obtained based on positive samples (i.e., target training data with class labels of user-generated data) and negative samples (i.e., target training data with class labels of AI-generated data).
[0020] In one possible implementation, the loss function value is obtained by weighted summation of the first sub-loss function value and the second sub-loss function value, with the first and second sub-loss function values corresponding to different weights.
[0021] A second aspect of this application provides a classification method, including:
[0022] Obtain the data to be classified;
[0023] At least one target data is generated based on the data to be classified, and the at least one target data is obtained based on the data to be classified, and the data volume of the at least one target data is less than the data volume of the data to be classified;
[0024] Input the data to be classified and at least one target data into the classification model to obtain multiple classification results;
[0025] Based on multiple classification results, a target classification result is obtained, which is used as the classification result for the data to be classified.
[0026] In this scheme, the data to be classified is augmented to obtain multiple target data with smaller data volumes. The data to be classified and the target data are then input into the classification model for classification. The multiple classification results output by the classification model are integrated to obtain the final target classification result of the data to be classified. This can strengthen the decision of the classification model from a multi-scale perspective, thereby improving the classification accuracy of the data.
[0027] In one possible implementation, the target classification result is obtained based on multiple classification results, including:
[0028] The target classification result is obtained by weighted summation of multiple classification results.
[0029] In one possible implementation, the weight of each classification result among multiple classification results is related to the amount of data in the model input data corresponding to each classification result.
[0030] In one possible implementation, different target data have different amounts of data in at least one target data set.
[0031] In one possible implementation, each target data point in at least one target data point is derived from a portion of the data to be classified.
[0032] In one possible implementation, at least one target data includes first target data, which is obtained by cropping a portion of the data to be classified.
[0033] In one possible implementation, at least one target data includes second target data, which is obtained by fusing multiple parts of the data to be classified after cropping.
[0034] A third aspect of this application provides a training apparatus for a classification model, comprising:
[0035] The acquisition module is used to acquire multiple raw training data. The category label corresponding to each raw training data is either user-generated data or AI-generated data.
[0036] The processing module is used to obtain multiple target training data based on multiple original training data. The first part of the multiple target training data belongs to multiple original training data. Each target training data in the second part of the multiple target training data is obtained from the corresponding original training data in the multiple original training data, and the data volume of each target training data is less than the data volume of the corresponding original training data.
[0037] The processing module is also used to input training data for multiple targets into the classification model to obtain multiple classification results corresponding to the training data for multiple targets;
[0038] The processing module is also used to update the first model based on the loss function value to obtain the second model. The loss function value is obtained based on multiple classification results and the category labels corresponding to multiple target training data. Some of the target training data in the second part of the data does not have category labels, and the amount of some target training data is less than a preset threshold and the corresponding original training data is generated by AI.
[0039] In one possible implementation, the target training data in the second part of the data is obtained based on a portion of the corresponding original training data.
[0040] In one possible implementation, the second part of the data includes the first target training data, which is obtained by cropping a portion of the original training data corresponding to the first target training data.
[0041] In one possible implementation, the second part of the data includes second target training data, which is obtained by fusing multiple parts of the original training data corresponding to the second target training data.
[0042] In one possible implementation, the data type of the plurality of original training data is any one of the following types: text, image, video, and audio.
[0043] In one possible implementation, the loss function value is obtained based on a first sub-loss function value, which is obtained based on a first difference and a second difference. The first difference is the difference between the classification result corresponding to the partial target training data and the class label assumed for the target training data, and the second difference is the difference between the classification result corresponding to the positive sample training data in the plurality of target training data and the class label assumed for the positive sample data.
[0044] Wherein, the category labels assumed for the target training data and the positive sample training data are both AI-generated data, and the positive sample training data includes the target training data whose category labels are user-generated data.
[0045] In one possible implementation, the loss function value is also obtained based on a second sub-loss function value, which is obtained based on the mean difference between the multiple classification results and the category labels corresponding to the multiple target training data;
[0046] In the process of determining the value of the second sub-loss function, the category labels corresponding to the partial target training data are AI-generated data.
[0047] In one possible implementation, the loss function value is obtained by weighted summation of the first sub-loss function value and the second sub-loss function value, and the first sub-loss function value and the second sub-loss function value correspond to different weights.
[0048] A fourth aspect of this application provides a sorting device, comprising:
[0049] The acquisition module is used to acquire the data to be classified.
[0050] The processing module is used to generate at least one target data based on the data to be classified. The at least one target data is obtained based on the data to be classified, and the data volume of the at least one target data is less than the data volume of the data to be classified.
[0051] The processing module is also used to input the data to be classified and at least one target data into the classification model to obtain multiple classification results;
[0052] The processing module is also used to obtain a target classification result based on multiple classification results, and the target classification result is used as the classification result of the data to be classified.
[0053] In one possible implementation, the processing module is also used to perform a weighted summation of multiple classification results to obtain the target classification result.
[0054] In one possible implementation, the weight of each classification result among multiple classification results is related to the amount of data in the model input data corresponding to each classification result.
[0055] In one possible implementation, different target data have different amounts of data in at least one target data set.
[0056] In one possible implementation, each target data point in at least one target data point is derived from a portion of the data to be classified.
[0057] In one possible implementation, at least one target data includes first target data, which is obtained by cropping a portion of the data to be classified.
[0058] In one possible implementation, at least one target data includes second target data, which is obtained by fusing multiple parts of the data to be classified after cropping.
[0059] The fifth aspect of this application provides a training apparatus for a classification model, which may include a processor and a memory coupled together. The memory stores program instructions, and when the program instructions stored in the memory are executed by the processor, the method described in the first aspect or any implementation thereof is implemented. For details regarding the steps in the various possible implementations of the first aspect executed by the processor, please refer to the first aspect; further details will not be repeated here.
[0060] A sixth aspect of this application provides a classification apparatus, which may include a processor coupled to a memory. The memory stores program instructions, and when the program instructions stored in the memory are executed by the processor, the method described in the second aspect or any implementation thereof is implemented. For details regarding the steps of the various possible implementations of the second aspect executed by the processor, please refer to the second aspect; further details will not be repeated here.
[0061] The seventh aspect of this application provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the method of any implementation of the first aspect described above.
[0062] The eighth aspect of this application provides a circuit system including a processing circuit configured to perform the method of any implementation of the first aspect described above.
[0063] The ninth aspect of this application provides a computer program product that, when run on a computer, causes the computer to perform any implementation of the first aspect described above.
[0064] The tenth aspect of this application provides a chip system including a processor for supporting a server or threshold value acquisition device in implementing the functions involved in any implementation of the first aspect described above, such as transmitting or processing data and / or information involved in the methods described above. In one possible design, the chip system further includes a memory for storing program instructions and data necessary for the server or communication device. This chip system may be composed of chips or may include chips and other discrete devices.
[0065] The beneficial effects of aspects two through ten above can be referred to the introduction of aspect one above, and will not be repeated here. Attached Figure Description
[0066] Figure 1 This is a schematic diagram of the structure of a convolutional neural network provided in an embodiment of this application;
[0067] Figure 2 This is a schematic diagram of another convolutional neural network structure provided in an embodiment of this application;
[0068] Figure 3A schematic diagram of a system architecture 300 provided for an embodiment of this application;
[0069] Figure 4 This is a schematic diagram of the structure of an electronic device 101 provided in an embodiment of this application;
[0070] Figure 5 A flowchart illustrating a training method for a classification model provided in an embodiment of this application;
[0071] Figure 6A This application provides a schematic diagram illustrating how to obtain multiple target training data based on multiple original training data in an embodiment of the present application.
[0072] Figure 6B This application provides another schematic diagram illustrating how multiple target training data are obtained based on multiple original training data in an embodiment of the present application.
[0073] Figure 7 A schematic diagram illustrating the determination of category labels for multiple target training data, provided in an embodiment of this application;
[0074] Figure 8 A schematic diagram illustrating the training process of a classification model provided in an embodiment of this application;
[0075] Figure 9 A schematic diagram illustrating the division of positive samples, unlabeled samples, and negative samples provided in an embodiment of this application;
[0076] Figure 10 A flowchart illustrating a classification method provided in an embodiment of this application;
[0077] Figure 11 A schematic diagram of a data classification architecture provided in an embodiment of this application;
[0078] Figure 12 A schematic diagram illustrating a data classification process provided in this application embodiment;
[0079] Figure 13 A schematic diagram of the structure of a training device for a classification model provided in an embodiment of this application;
[0080] Figure 14 This is a schematic diagram of the structure of a sorting device provided in an embodiment of this application;
[0081] Figure 15 A schematic diagram of the structure of the execution device provided in the embodiments of this application;
[0082] Figure 16 A schematic diagram of the structure of a chip provided in an embodiment of this application;
[0083] Figure 17 This is a schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of this application. Detailed Implementation
[0084] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application are described below with reference to the accompanying drawings. Obviously, the described embodiments are merely some, and not all, of the embodiments of this application. Those skilled in the art will understand that, with the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0085] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such descriptions can be used interchangeably where appropriate to allow embodiments to be implemented in a sequence other than that illustrated or described in this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules is not necessarily limited to those explicitly listed, but may include other steps or modules not explicitly listed or inherent to such processes, methods, products, or devices. The naming or numbering of steps appearing in this application does not imply that the steps in the method flow must be performed in the chronological / logical order indicated by the naming or numbering. The execution order of named or numbered process steps can be changed according to the desired technical purpose, as long as the same or similar technical effect is achieved. The division of units in this application is a logical division. In practical applications, there may be other division methods. For example, multiple units may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the shown or discussed mutual coupling, direct coupling, or communication connection may be through some interface, and the indirect coupling or communication connection between units may be electrical or other similar forms, none of which are limited in this application. Furthermore, the units or sub-units described as separate components may or may not be physically separated, may or may not be physical units, or may be distributed among multiple circuit units. Some or all of the units can be selected to achieve the purpose of the solution in this application according to actual needs.
[0086] For ease of understanding, some technical terms involved in the embodiments of this application will be introduced below.
[0087] (1) Neural Network
[0088] A neural network can be composed of neural units, which can be defined as a computational unit that takes xs (i.e., input data) and an intercept of 1 as input. The output of this computational unit can be:
[0089]
[0090] Where s = 1, 2, ..., n, where n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into an output signal. The output signal of this activation function can be used as the input of the next convolutional layer, and the activation function can be the sigmoid function. A neural network is a network formed by connecting multiple of the above-mentioned individual neural units together, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field, which can be a region composed of several neural units.
[0091] (2) Deep Neural Networks
[0092] Deep Neural Networks (DNNs), also known as multilayer neural networks, can be understood as neural networks with many hidden layers, though there's no specific metric for "many." DNNs can be categorized into three types based on their layer positions: input layers, hidden layers, and output layers. Generally, the first layer is the input layer, the last layer is the output layer, and the layers in between are hidden layers. Layers are fully connected, meaning that any neuron in the i-th layer is connected to any neuron in the (i+1)-th layer. Although DNNs appear complex, the operation of each layer is actually quite simple, resembling a linear relationship as follows: in, It is the input vector. It is the output vector. α is the offset vector, W is the weight matrix (also called coefficients), and α() is the activation function. Each layer is simply an adjustment of the input vector. The output vector is obtained through such a simple operation. Because DNNs have many layers, the coefficients W and the offset vector... The number of these parameters is quite large. The definitions of these parameters in a DNN are as follows: Taking the coefficient W as an example: Assuming a three-layer DNN, the linear coefficient from the fourth neuron in the second layer to the second neuron in the third layer is defined as... The superscript 3 represents the layer number where coefficient W resides, while the subscript corresponds to the output third layer index 2 and the input second layer index 4. In summary: the coefficient from the k-th neuron in layer L-1 to the j-th neuron in layer L is defined as... It's important to note that the input layer does not have a W parameter. In deep neural networks, more hidden layers allow the network to better represent complex real-world situations. Theoretically, the more parameters a predictive model has, the higher its complexity and "capacity," meaning it can perform more complex learning tasks. Training a deep neural network is essentially the process of learning the weight matrix, with the ultimate goal of obtaining the weight matrix of all layers in the trained deep neural network (a weight matrix formed by the vectors W from many layers).
[0093] (3) Convolutional Neural Network (CNN)
[0094] A convolutional neural network (CNN) is a deep neural network with a convolutional structure. A CNN contains a feature extractor consisting of convolutional layers and subsampling layers. This feature extractor can be viewed as a filter, and the convolution process can be seen as using a trainable filter to convolve with an input image or feature map. A convolutional layer refers to the layer of neural units in a CNN that performs convolution processing on the input signal (e.g., the first and second convolutional layers in this embodiment). In a convolutional layer of a CNN, a neural unit can be connected to only some neighboring neural units. A convolutional layer typically contains several feature planes, each of which can be composed of a series of rectangularly arranged neural units. Neural units on the same feature plane share weights, which are the convolutional kernel. Shared weights can be understood as the way image information is extracted regardless of location. The underlying principle is that the statistical information of one part of the image is the same as that of other parts. This means that image information learned in one part can also be used in another part. Therefore, for all locations on the image, we can use the same learned image information. In the same convolutional layer, multiple convolutional kernels can be used to extract different image information. Generally, the more convolutional kernels there are, the richer the image information reflected by the convolution operation.
[0095] Convolutional kernels can be initialized as matrices of random size, and during the training of a convolutional neural network, they can learn appropriate weights. Furthermore, sharing weights directly reduces the number of connections between layers in the convolutional neural network, while also lowering the risk of overfitting.
[0096] Specifically, such as Figure 1As shown, the convolutional neural network 100 may include an input layer 110, a convolutional / pooling layer 120, wherein the pooling layer is optional, and a neural network layer 130.
[0097] The structure consisting of the convolutional layer / pooling layer 120 and the neural network layer 130 can be the first convolutional layer and the second convolutional layer described in this application. The input layer 110 is connected to the convolutional layer / pooling layer 120, and the convolutional layer / pooling layer 120 is connected to the neural network layer 130. The output of the neural network layer 130 can be input to the activation layer, and the activation layer can perform non-linear processing on the output of the neural network layer 130.
[0098] Convolutional / pooling layers: 120. Convolutional layers: such as... Figure 2 The convolutional / pooling layer 120 shown may include layers 121-126 as in Examples 121-126. In one implementation, layer 121 is a convolutional layer, layer 122 is a pooling layer, layer 123 is a convolutional layer, layer 124 is a pooling layer, layer 125 is a convolutional layer, and layer 126 is a pooling layer. In another implementation, layers 121 and 122 are convolutional layers, layer 123 is a pooling layer, layers 124 and 125 are convolutional layers, and layer 126 is a pooling layer. That is, the output of the convolutional layer can be used as the input of a subsequent pooling layer, or as the input of another convolutional layer to continue the convolution operation.
[0099] Taking convolutional layer 121 as an example, it can include multiple convolution operators, also known as kernels. In image processing, a convolution operator acts as a filter, extracting specific information from the input image matrix. Essentially, a convolution operator can be a weight matrix, which is usually predefined. During the convolution operation, the weight matrix processes the input image pixel by pixel (or two pixels by two pixels, depending on the stride) along the horizontal direction, thus extracting specific features. The size of the weight matrix should be related to the image size. It's important to note that the depth dimension of the weight matrix is the same as the depth dimension of the input image; during convolution, the weight matrix extends to the entire depth of the input image. Therefore, convolution with a single weight matrix produces a single-depth convolutional output. However, in most cases, multiple weight matrices of the same dimension are applied instead of a single weight matrix. The outputs of each weight matrix are stacked to form the depth dimension of the convolutional image. Different weight matrices can be used to extract different features from an image. For example, one weight matrix can be used to extract image edge information, another weight matrix can be used to extract specific colors from the image, and yet another weight matrix can be used to blur unwanted noise in the image. These multiple weight matrices have the same dimension, and the feature maps extracted by these multiple weight matrices with the same dimension also have the same dimension. The extracted feature maps with the same dimension are then merged to form the output of the convolution operation.
[0100] The weight values in these weight matrices need to be obtained through extensive training in practical applications. The weight matrices formed by the weight values obtained through training can extract information from the input image, thereby helping the convolutional neural network 100 to make correct predictions.
[0101] When a convolutional neural network 100 has multiple convolutional layers, the initial convolutional layers (e.g., 121) tend to extract more general features, which can also be called low-level features. As the depth of the convolutional neural network 100 increases, the features extracted by later convolutional layers (e.g., 126) become more and more complex, such as high-level semantic features. Features with higher semantic levels are more suitable for the problem to be solved.
[0102] Pooling layers: Because it is often necessary to reduce the number of training parameters, pooling layers are often introduced periodically after convolutional layers, such as... Figure 1 In the example of 120, each layer 121-126 can be a convolutional layer followed by a pooling layer, or multiple convolutional layers followed by one or more pooling layers.
[0103] Neural Network Layer 130: After processing by the convolutional / pooling layers 120, the convolutional neural network 100 is still insufficient to output the required output information. As before, the convolutional / pooling layers 120 only extract features and reduce the parameters introduced by the input image. However, to generate the final output information (the required class information or other relevant information), the convolutional neural network 100 needs to utilize neural network layer 130 to generate one or a set of required class numbers of output. Therefore, neural network layer 130 may include multiple hidden layers (such as...). Figure 1 As shown in 131, 132 to 13n) and output layer 140, the parameters contained in these multi-layer hidden layers can be pre-trained based on relevant training data for specific task types, such as image recognition, image classification, image super-resolution reconstruction, text classification, speech classification, etc.
[0104] After the multiple hidden layers in neural network layer 130, the final layer of the entire convolutional neural network 100 is the output layer 140. This output layer 140 has a loss function value similar to the classification cross-entropy, specifically used to calculate the prediction error. Once the entire convolutional neural network 100 has propagated forward (as... Figure 2 The propagation from 110 to 140 is completed (forward propagation), and the reverse propagation (such as...) Figure 2 The propagation from 140 to 110 (backpropagation) will begin to update the weight values and biases of the layers mentioned above, in order to reduce the loss of the convolutional neural network 100 and the error between the output of the convolutional neural network 100 through the output layer and the ideal result.
[0105] It should be noted that, as Figure 1 The convolutional neural network 100 shown is merely an example of a convolutional neural network. In specific applications, convolutional neural networks can also exist in the form of other network prediction models, such as... Figure 2 The multiple convolutional / pooling layers shown are parallelized, and the extracted features are all input into the full neural network layer 130 for processing.
[0106] (4) Recurrent Neural Network (RNN)
[0107] Recurrent neural networks (RNNs) are a type of recursive neural network that takes sequence data as input, recurses in the direction of sequence evolution, and connects all nodes (recurrent units) in a chain-like manner.
[0108] Recurrent neural networks (RNNs) possess memory, parameter sharing, and Turing completeness, giving them an advantage in learning the nonlinear features of sequences. RNNs have applications in Natural Language Processing (NLP), such as speech recognition, language modeling, and machine translation, and are also used for various time series forecasting techniques. RNNs constructed using convolutional neural networks (CNNs) can handle computer vision problems involving sequential inputs.
[0109] The purpose of RNNs is to process sequential data. In traditional neural network prediction models, the layers are fully connected from the input layer to the hidden layer and then to the output layer, while the nodes within each layer are unconnected. However, this ordinary neural network is ineffective for many problems. For example, to predict the next word in a sentence, you generally need to use the preceding words because words in a sentence are not independent. RNNs are called recurrent neural networks because the current output of a sequence is related to the previous outputs. Specifically, the network memorizes previous information and applies it to the calculation of the current output; that is, the nodes between hidden layers are no longer unconnected but connected, and the input of the hidden layer includes not only the output of the input layer but also the output of the hidden layer at the previous time step. Theoretically, RNNs can process sequential data of any length. However, in practice, to reduce complexity, it is often assumed that the current state is only related to a few preceding states.
[0110] Specifically, the core of an RNN is a directed graph. Elements connected in a chain within this directed graph are called recurrent units (RNN cells). Typically, the chained connections of recurrent units are analogous to hidden layers in a feedforward neural network; however, in different discussions, an "RNN layer" might refer to the recurrent units at a single time step or all the recurrent units. Therefore, for general introduction, the concept of "hidden layers" is avoided here. Given sequentially input learning data X = {X1, X2, ..., X...} τ The expansion length of an RNN is τ. The sequence to be processed is usually a time series, and the direction of evolution of the sequence is called the time step.
[0111] (5) Residual Network (ResNet)
[0112] Residual networks are an improved type of convolutional neural network characterized by their ease of optimization and the ability to improve accuracy by increasing depth considerably. The residual blocks within a residual network utilize skip connections, mitigating the vanishing gradient problem inherent in increasing depth in deep neural networks.
[0113] (6) Loss Function
[0114] During neural network training, to ensure the output closely approximates the desired predicted value, we compare the network's prediction with the target value. Based on the difference, we update the weight vector of each layer (usually pre-configuring parameters before the initial update). For example, if the prediction is too high, the weight vector is adjusted to predict a lower value. This adjustment continues until the neural network predicts the target value or a value very close to it. Therefore, we need to predefine "how to compare the difference between the predicted and target values," which is the loss function or objective function. These are important equations used to measure the difference between the predicted and target values. Taking the loss function as an example, a higher output value (loss) indicates a greater difference, and training the neural network becomes a process of minimizing this loss function value.
[0115] (7) Backpropagation algorithm
[0116] Neural networks can employ backpropagation (BP) to correct the parameters of the initial prediction model during training, thereby reducing the error loss. Specifically, forward propagation of the input signal to the output generates error loss; this error loss information is then propagated back to update the parameters of the initial prediction model, leading to convergence of the error loss. The backpropagation algorithm is an error-loss-driven backpropagation process aimed at obtaining the optimal parameters of the prediction model, such as the weight matrix.
[0117] (8) Gradient descent method
[0118] Gradient descent is a first-order optimization algorithm commonly used in machine learning to recursively approximate a minimum-bias prediction model. To find a local minimum of a function using gradient descent, iterative searches must be performed at points a predetermined step distance away in the opposite direction of the gradient (or approximate gradient) at the current point on the function. Gradient descent is one of the most frequently used methods for solving the prediction model parameters of machine learning algorithms, i.e., unconstrained optimization problems.
[0119] Specifically, when finding the minimum value of the loss function, gradient descent can be used to iteratively solve the problem step by step, obtaining the minimized loss function value and the predicted model parameter values. Conversely, if we need to find the maximum value of the loss function, we need to use gradient ascent iteratively.
[0120] Currently, AI-generated data is increasingly widely used in daily life. This data can include text, images, videos, and audio. Taking AI-generated text as an example, to prevent malicious or erroneous text from causing adverse consequences, AI-generated text detection has become an important technology. AI-generated text detection primarily distinguishes between text that is manually generated and AI-generated.
[0121] Existing AI-generated text detection solutions typically employ binary classification techniques. The text to be detected is input into a pre-trained model, which then outputs a final prediction: whether the text was generated manually or by AI. However, current technologies have limitations regarding the length of the input text; when the input text is short, accurate predictions are often difficult to obtain.
[0122] The applicant's research revealed that existing AI-generated data detection solutions neglect the relationship between the amount of data to be detected and the difficulty of detection. For example, in AI-generated text detection, the length of the text to be detected significantly impacts the difficulty. Specifically, as text length decreases, AI-generated text becomes increasingly similar to human-generated text, making AI-generated text detection more difficult. In extreme cases, when the text is only a single word or phrase, it becomes almost impossible to objectively determine whether a single word or phrase originated from AI or a human. In such situations, simply labeling shorter texts as AI-generated can affect the text detection model's perception of the style of AI-generated text, leading to poor prediction results.
[0123] Besides detecting AI-generated text, similar problems exist when using existing technologies to detect other AI-generated data. For ease of explanation, this application uses AI-generated text detection as an example. The problems encountered when detecting other AI-generated data are similar and will not be elaborated here.
[0124] In view of this, embodiments of this application provide a training method for a classification model. First, based on the original training data, smaller target training data is generated to obtain training data at different scales, ensuring scale diversity of the training data. Furthermore, considering the characteristics of AI-generated data, for target training data that is small in size and originally generated by AI, this part of the target training data is labeled as unlabeled data. This allows the classification model to focus on AI-generated data that differs from manually generated data during training, avoiding the impact of labeling it as AI-generated data on the classification model's perception of the style of AI-generated data, and effectively improving the prediction accuracy of the classification model.
[0125] For ease of understanding, the following will first introduce the training method of the classification model provided in the embodiments of this application and the system architecture applied to the classification method.
[0126] Please see Figure 3 This application provides a schematic diagram of a system architecture 300. For example... Figure 3 As shown, in this system architecture 300, the execution device 210 can be implemented by one or more servers, optionally in conjunction with other computing devices, such as data storage, routers, load balancers, etc. The execution device 210 can be deployed on a single physical site or distributed across multiple physical sites. The execution device 210 can use data from the data storage system 250 or call program code from the data storage system 250 to implement the training method of the classification model provided in this application embodiment, thereby obtaining the model.
[0127] Users can interact with execution device 210 by operating their respective user devices (e.g., local device 301 and local device 302). Each local device can represent any computing device, such as a personal computer, computer workstation, smartphone, tablet, smart camera, smart car or other type of cellular phone, media consumption device, wearable device, set-top box, game console, etc.
[0128] Each user's local device can interact with the execution device 210 through a communication network of any communication mechanism / standard. The communication network can be a wide area network, a local area network, a point-to-point connection, or any combination thereof.
[0129] In one implementation, the execution device 210 is used to implement the training method of the classification model provided in the embodiments of this application, and sends the obtained model to the local device 301 and the local device 302 through a communication network, so that the local device 301 and the local device 302 can deploy and run the model, thereby realizing the classification method provided in the embodiments of this application.
[0130] In another implementation, one or more aspects of the execution device 210 may be implemented by each local device. For example, the local device 301 may provide local data or feedback calculation results to the execution device 210, or execute the training method and classification method of the classification model provided in the embodiments of this application.
[0131] It should be noted that all the functions of execution device 210 can also be implemented by a local device. For example, local device 301 implements the functions of execution device 210 and provides services to its own users, or provides services to users of local device 302.
[0132] In summary, the training method and classification method of the classification model provided in this application embodiment can be applied to electronic devices, such as the execution device 210, local device 301, or local device 302 described above. Exemplarily, the electronic device may be a server, a wireless electronic device in industrial control, a smartphone, a personal computer (PC), a laptop computer, a tablet computer, or other devices. For ease of understanding, the following will describe the method using the application of the method provided in this application embodiment to a server as an example.
[0133] Please refer to Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device 101 provided in an embodiment of this application. Figure 4 As shown, electronic device 101 includes processor 103, which is coupled to system bus 105. Processor 103 can be one or more processors, each of which can include one or more processor cores. A video adapter 107 drives a display 109, which is coupled to system bus 105. System bus 105 is coupled to input / output (I / O) bus via bus bridge 111. I / O interface 115 is coupled to the I / O bus. I / O interface 115 communicates with various I / O devices, such as input device 117 (e.g., touchscreen), external storage 121 (e.g., hard disk, floppy disk, optical disk, or USB flash drive), multimedia interface, etc. A transceiver 123 (capable of sending and / or receiving radio communication signals), a camera 155 (capable of capturing still and moving digital video images), and an external USB port 125. Optionally, the interface connected to I / O interface 115 can be a USB interface.
[0134] The processor 103 can be any conventional processor, including a reduced instruction set computing (RISC) processor, a complex instruction set computing (CISC) processor, or a combination thereof. Optionally, the processor can be a special-purpose device such as an ASIC.
[0135] Electronic device 101 can communicate with software deployment server 149 via network interface 129. Exemplarily, network interface 129 is a hardware network interface, such as a network interface card (NIC). Network 127 can be an external network, such as the Internet, or an internal network, such as Ethernet or a virtual private network (VPN). Optionally, network 127 can also be a wireless network, such as a WiFi network or a cellular network.
[0136] Hard disk drive interface 131 is coupled to system bus 105. Hardware driver interface is connected to hard disk drive 133. Internal memory 135 is coupled to system bus 105. Data running in internal memory 135 may include operating system (OS) 137, applications 143, and schedules of electronic device 101.
[0137] An operating system consists of the Shell 139 and the kernel 141. The Shell 139 is an interface between the user and the operating system kernel. The shell is the outermost layer of the operating system. The shell manages the interaction between the user and the operating system: waiting for user input, interpreting user input for the operating system, and processing various operating system outputs.
[0138] Kernel 141 consists of the parts of the operating system used to manage memory, files, peripherals, and system resources. Kernel 141 interacts directly with the hardware. The operating system kernel typically runs processes and provides inter-process communication, CPU time-slice management, interrupts, memory management, I / O management, and so on.
[0139] Please see Figure 5 , Figure 5 This is a flowchart illustrating a training method for a classification model provided in an embodiment of this application. Figure 5 As shown, the training method for this classification model includes the following steps 501-504.
[0140] Step 501: Obtain multiple raw training data sets. The category label corresponding to each raw training data set is either user-generated data or AI-generated data.
[0141] In this embodiment, all the original training data are of the same type. For example, the data types of the original training data are any of the following types: text, image, video, and audio.
[0142] For any one of the multiple original training datasets, the original training data can be generated by a user (i.e., manually) or by AI (e.g., through an AI model). That is, the original training data is generated either by the user or by AI. Furthermore, not all data in the multiple original training datasets corresponds to the same generation method; that is, some data in the multiple original training datasets are user-generated, while other data are AI-generated.
[0143] Therefore, when classifying multiple raw training data based on their generation method, the category label corresponding to each raw training data is either user-generated data or AI-generated data. When the category label corresponding to the raw training data is user-generated data, it means that the raw training data was generated by the user; when the category label corresponding to the raw training data is AI-generated data, it means that the raw training data was generated by AI.
[0144] In the case where the original training data is user-generated data, if the original training data is text, it can specifically be text edited by the user; if the original training data is an image, it can be an image obtained by the user through taking a photo, drawing, or artificial synthesis; if the original training data is video, it can be a video obtained by the user through creation, recording, or editing; and if the original training data is audio, it can be audio obtained by the user through creation or recording. In general, the embodiments of this application do not limit how the user generates the original training data.
[0145] Step 502: Based on multiple original training data, multiple target training data are obtained. The first part of the multiple target training data belongs to multiple original training data. Each target training data in the second part of the multiple target training data is obtained from the corresponding original training data in the multiple original training data, and the data volume of each target training data is less than the data volume of the corresponding original training data.
[0146] In this embodiment, the first part of the multiple target training data belongs to the multiple original training data, meaning that the first part of the multiple target training data is a subset of the multiple original training data. That is, in this embodiment, a portion of the multiple original training data can be used as the first part of the multiple target training data; or, the multiple original training data can be used as the first part of the multiple target training data. For example, if the multiple original training data includes 10,000 data points, the first part of the multiple target training data can include a portion of those 10,000 data points, such as 5,000 data points; or, the first part of the multiple target training data can be the 10,000 data points themselves.
[0147] Furthermore, each target training data in the second part of the multiple target training data corresponds to an original training data, and each target training data in the second part of the data is obtained based on the corresponding original training data.
[0148] In the second part of the multiple target training data, the different target training data can correspond to different original training data, meaning that one original training data corresponds to only one target training data; or, the different target training data can correspond to the same original training data, meaning that one original training data can correspond to one or more target training data. Furthermore, the second part of the multiple target training data can correspond to all the original training data in the multiple original training data, meaning that each original training data is used to generate the corresponding target training data; or, the second part of the multiple target training data can correspond to a portion of the multiple original training data, meaning that only a portion of the original training data is used to generate the corresponding target training data.
[0149] In general, in multiple target training data, the first part of the data can be a portion or all of the data from multiple original training data; the second part of the data in multiple target training data can be obtained based on a portion or all of the data from multiple original training data, and one original training data can correspond to one or more target training data in the second part of the data.
[0150] For example, please refer to Figure 6A and Figure 6B , Figure 6A This application provides a schematic diagram illustrating how to obtain multiple target training data based on multiple original training data in an embodiment of the present application. Figure 6B This is another schematic diagram illustrating how multiple target training data are obtained based on multiple original training data, as provided in an embodiment of this application. For example... Figure 6AAs shown, the multiple original training data sets comprise 2N data points, specifically: data 1, data 2, data 3… data 2N. When deriving multiple target training data sets based on these original training data sets, the first part of the target training data sets comprises N data points, specifically: data 1, data 2… data N, meaning the first part of the target training data sets consists of the N data points from the original training data sets. Furthermore, the second part of the target training data sets also comprises N data points, specifically: data N+1', data N+2'… data 2N', where data N+1' corresponds to data N+1 in the original training data sets, data N+2' corresponds to data N+2, and so on, with data 2N' corresponding to data 2N. In other words, each original training data point from N+1 to 2N corresponds to a unique target training data point.
[0151] like Figure 6B As shown, the multiple original training data sets comprise 2N data points, specifically: data 1, data 2, ..., data 2N. When deriving multiple target training data sets based on these original training data sets, the first part of the target training data sets also comprises 2N data points, specifically: data 1, data 2, ..., data 2N. In other words, the first part of the target training data sets is the original training data set itself. Furthermore, the second part of the target training data sets comprises 2N sets of data, each set containing multiple target training data points, and different target training data points within the same set are all derived from the same original training data set. Specifically, in the second part of the data set, data A1, data B1, and data C1 in set 1 are all derived from data 1 in the original training data set; data A2, data B2, and data C2 in set 2 are all derived from data 2 in the original training data set, and so on. Similarly, data A2N, data B2N, and data C2N in set 2N are all derived from data 2N in the original training data set. In other words, each of the multiple original training data can be used to generate multiple target training data.
[0152] The above describes the process of obtaining training data for multiple targets. The following will introduce the specific methods for obtaining target training data based on the original training data.
[0153] There are multiple ways to obtain target training data based on the original training data, and each method must ensure that the amount of target training data obtained is less than the amount of the corresponding original training data, that is, the content contained in the target training data is less than the content contained in the corresponding original training data.
[0154] In one possible implementation, the target training data is obtained by cropping the original training data, and the target training data includes only a portion of the content from the original training data.
[0155] For example, the second part of the data mentioned above may include first target training data, which is obtained by cropping a portion of the original training data corresponding to the first target training data. For instance, assuming the original training data corresponding to the first target training data is text, and the text content of the original training data is specifically "Hello! How are you! I am fine, thank you! And you?", then the first target training data can be obtained by cropping the text content, such as the text content of the first target training data being "How are you! I am fine, thank you! And you?". Similarly, assuming the original training data corresponding to the first target training data is video or audio, then a shorter first target training data can be obtained by cropping a segment of the video or audio. As another example, assuming the original training data corresponding to the first target training data is an image, then a portion of the image can be cropped to obtain first target training data containing fewer pixels (i.e., containing less image content). Furthermore, the cropped image can also be processed by rotating, enlarging, or shrinking to improve the diversity of the image.
[0156] In another possible implementation, the target training data is obtained by cropping the original training data and then fusing the cropped data.
[0157] For example, the second part of the data includes second target training data, which is obtained by fusing multiple parts of the original training data corresponding to the second target training data. However, when fusing the multiple parts, not all the cropped content is merged, but only a portion of it is merged, so that the amount of the resulting second target training data is smaller than the corresponding original training data. Furthermore, there are various methods for fusing the data, such as directly concatenating the multiple parts, or performing simple processing on the multiple parts before concatenation. Optionally, the concatenation process can involve rearranging the order of the multiple parts before concatenation, or concatenating them according to the order of the multiple parts in the original training data.
[0158] For example, assuming the original training data corresponding to the first target training data is text, and the specific text content of the original training data is "Hello! How are you! I am fine, thank you! And you?", then the text content of the original training data can be first cut into multiple parts: "Hello!", "How are you!", "I am fine, thank you!", and "And you?". Then, by concatenating some parts of these multiple parts, the first target training data can be obtained. For example, the text content of the first target training data is "Hello! I am fine, thank you! And you?".
[0159] In general, for target training data obtained based on the original training data, the target training data includes at least a portion of the content from the corresponding original training data, or the target training data includes data obtained based on a portion of the content from the corresponding original training data.
[0160] This scheme, on the one hand, processes the original training data to obtain target training data with a smaller data volume; on the other hand, it uses a portion of the original training data as target training data, enabling multi-scale augmentation of the original training data and thus ensuring the scale diversity of the final target training data. Scale diversity in the target training data can refer to different target training data having different data volumes, such as different texts having different lengths, different videos or audio recordings having different durations, and different images having different sizes, etc.
[0161] Step 503: Input the training data of multiple targets into the classification model to obtain multiple classification results corresponding to the training data of multiple targets.
[0162] In this embodiment, the classification model can be an AI model that performs a binary classification task, used to classify and predict the input data. Furthermore, the structure of the classification model can be determined based on the type of input data, and this embodiment does not impose specific limitations on this. For example, when the input data is an image or video, the structure of the classification model may specifically include a convolutional neural network; when the input data is text or speech, the structure of the classification model may specifically include an RNN or an attention network.
[0163] Therefore, after inputting multiple target training data into the classification model, the model can predict the classification result corresponding to each target training data, thus obtaining multiple classification results that correspond one-to-one with the multiple target training data. Each of these multiple classification results indicates the category to which the corresponding target training data belongs, i.e., whether the target training data belongs to user-generated data or AI-generated data.
[0164] Step 504: Update the first model based on the loss function value to obtain the second model. The loss function value is obtained based on multiple classification results and the category labels corresponding to multiple target training data. Some of the target training data in the second part of the data does not have category labels. The amount of data in this part of the target training data is less than a preset threshold and the corresponding original training data is generated by AI.
[0165] After obtaining the classification results for each target training data point, a loss function can be constructed based on these multiple classification results and the corresponding category labels of the target training data. The first model is then updated based on the value of the constructed loss function, thus achieving the training of the first model. The method for updating the first model based on the loss function value can be the backpropagation algorithm.
[0166] Generally, the loss function can be constructed based on the difference between the class labels corresponding to the target training data input to the classification model and the classification results actually output by the classification model.
[0167] It is worth noting that for the multiple target training data input to the classification model, a portion of the second part of the multiple target training data does not have category labels, and the data volume of this portion is less than a preset threshold. Furthermore, the corresponding original training data is generated by AI. In other words, this portion of target training data consists of small amounts of data (e.g., short text, video, or audio, or images containing minimal content). Because of the small size of this portion of target training data, even if it is derived from the AI-generated original training data, it is already highly similar to user-generated data, making it difficult to determine whether this portion of target training data should be considered AI-generated.
[0168] Therefore, in this embodiment, when calculating the loss function value, it is necessary to treat part of the target training data in the second part of the data as unlabeled data to avoid directly labeling this part of the target training data as AI-generated data.
[0169] Furthermore, in the multiple target training data sets, since the target training data in the first part is actually a subset of multiple original training data sets, the category labels of the target training data in the first part remain unchanged. The other part of the target training data in the second part is derived from the corresponding original training data; therefore, the category labels of this part of the target training data can be the same as the category labels of its corresponding original training data. Simply put, if the category label of an original training data set is user-generated data, then the category labels of the target training data set derived from that original training data with a data volume greater than or equal to a preset threshold can also be user-generated data. Similarly, if the category label of an original training data set is AI-generated data, then the category labels of the target training data set derived from that original training data with a data volume greater than or equal to a preset threshold can also be AI-generated data.
[0170] For example, please refer to Figure 7 , Figure 7 This is a schematic diagram illustrating how to determine the category labels of multiple target training data, as provided in an embodiment of this application. Figure 7 As shown, the original training data includes a total of 2N data points, specifically: data 1, data 2, ..., data 2N. Furthermore, the category labels for data 1 to data N are user-generated data, while the category labels for data N+1 to data 2N are AI-generated data.
[0171] Since the first part of the training data for multiple targets also includes the aforementioned data 1, data 2, ..., data 2N, the category labels of the target training data in the first part of the data remain unchanged. That is, the category labels of data 1 to data N are all user-generated data, and the category labels of data N+1 to data 2N are all AI-generated data.
[0172] Furthermore, the second part of the multiple target training data includes 2N sets of data. Data A1, B1, and C1 in the first set are all derived from data 1 in the original training data; data A2, B2, and C2 in the second set are all derived from data 2 in the original training data, and so on. Similarly, data A2N, B2N, and C2N in the 2Nth set are all derived from data 2N in the original training data. Since the target training data in sets 1 through N are derived from data 1 through N in the original training data, the category labels of the target training data in sets 1 through N remain unchanged, i.e., they are user-generated data. Furthermore, for the N+1th to 2Nth data sets, the category labels of the original training data corresponding to these N data sets are all AI-generated data, and the data volume of the first data in each data set (i.e., data AN+1, data AN+2... data A2N) is less than a preset threshold. Therefore, the first data in each data set from the N+1th to the 2Nth data sets is marked as unlabeled data, i.e., without a category label. The other data in the N+1th to the 2Nth data sets with a data volume not less than the preset threshold are marked as AI-generated data, i.e., the category label is the same as the category label of the corresponding original training data.
[0173] In this approach, smaller target training data is first generated based on the original training data to obtain training data at different scales, ensuring scale diversity of the training data. Furthermore, considering the characteristics of AI-generated data, the smaller target training data that was originally generated by AI is labeled as unlabeled data. This allows the classification model to focus on AI-generated data that differs from manually generated data during training, avoiding the impact of labeling it as AI-generated data on the classification model's perception of the AI-generated data style, and effectively improving the prediction accuracy of the classification model.
[0174] For example, please refer to Figure 8 , Figure 8 This is a schematic diagram illustrating the training process of a classification model provided in an embodiment of this application. Figure 8As shown, during the training of the classification model, the model can be trained based on a model training architecture. This architecture includes a data augmentation module and a model training module. By inputting the original training data into the data augmentation module, the module processes the original training data, outputting training data with a smaller volume than the original training data (i.e., the second part of the multiple target training data mentioned in step 502 above). That is, the data augmentation module performs step 502. Then, the original training data and the training data output by the data augmentation module are input into the model training module. The model training module trains the classification model based on the input data, resulting in a trained classification model (i.e., the second model mentioned above). That is, the model training module performs steps 503 and 504.
[0175] To facilitate understanding, the specific process of obtaining the loss function value will be described below.
[0176] Optionally, the loss function value used to update the first model can be obtained based on the first sub-loss function value and the second sub-loss function value.
[0177] The first sub-loss function value is derived based on a first difference and a second difference. The first difference is the difference between the classification result corresponding to the target training data without class labels and the class labels assumed for the target training data. The second difference is the difference between the classification result corresponding to the positive sample training data among multiple target training data and the class labels assumed for the positive sample data. The class labels assumed for both the target training data and the positive sample training data are AI-generated data. The positive sample training data includes target training data whose class labels are user-generated data.
[0178] In simple terms, the first sub-loss function value can be understood as the positive-unlabeled (PU) loss, which is obtained based on positive samples (i.e., target training data with class labels that are user-generated data) and unlabeled samples (i.e., target training data without class labels).
[0179] Please see Figure 9 , Figure 9 This is a schematic diagram illustrating the division of positive samples, unlabeled samples, and negative samples according to an embodiment of this application. Figure 9As shown, firstly, for multiple target training data obtained from multiple original training data, based on the original training data corresponding to each target training data, target training data whose original training data is user-generated data are labeled as positive samples, and target training data whose original training data is AI-generated data are labeled as negative samples. Then, based on the data volume of the target training data, a portion of the negative samples is divided and labeled as unlabeled samples. Specifically, among the previously labeled negative samples, target training data with a data volume less than a preset threshold are relabeled as unlabeled samples, while target training data with a data volume not less than the preset threshold are retained as negative samples. Therefore, unlabeled samples are actually AI-generated data with a data volume less than the preset threshold, while negative samples are AI-generated data with a data volume not less than the preset threshold.
[0180] For example, the value of the first sub-loss function can be obtained as shown in Formula 1 below.
[0181]
[0182] in, This represents the value of the first sub-loss function (i.e., PU loss), π P This represents the ratio between the positive sample and the sum of the positive and unlabeled samples. This represents the difference value calculated based on the category label of the positive sample and the corresponding classification result of the positive sample. This represents the difference value calculated based on the class labels assumed for unlabeled samples (i.e., AI-generated data) and the classification results corresponding to the unlabeled samples. This represents the difference value calculated based on the category label (i.e., AI-generated data) and the classification result corresponding to the positive sample, which is assumed to be a positive sample.
[0183] In this scheme, target training data with category labels that are user-generated data are considered as positive samples, and target training data without category labels are considered as unlabeled samples. Then, the classification loss of negative samples is estimated based on positive samples and unlabeled samples. This allows the classification model to focus on AI-generated data that is different from human-generated data during training, avoiding the impact on the classification model's perception of the style of AI-generated data when the target training data with a small amount of data and originally generated by AI is directly labeled as negative samples. This effectively improves the prediction accuracy of the trained classification model.
[0184] Furthermore, the second sub-loss function value is obtained based on the average difference between multiple classification results and the corresponding category labels of multiple target training data. Also, in determining the second sub-loss function value, some of the category labels corresponding to the target training data are AI-generated data.
[0185] In other words, when calculating the value of the second sub-loss function, corresponding category labels can also be assumed for the portion of the target training data that does not have category labels. The loss function value is then calculated based on the assumed category labels for this portion of the target training data and the corresponding classification results. The assumed category labels for the portion of the target training data that does not have category labels are also AI-generated data.
[0186] In simple terms, the second sub-loss function value can be understood as the positive-negative (PN) loss, which is obtained based on positive samples (i.e., target training data with class labels of user-generated data) and negative samples (i.e., target training data with class labels of AI-generated data).
[0187] For example, the value of the second sub-loss function can be obtained as shown in Formula 2 below.
[0188]
[0189] in, E[·] represents the value of the second sub-loss function (i.e., PN loss), and E[·] represents the sum of the values of the two sub-loss functions. Find the total expected value. This represents the difference value calculated based on the category label of the positive sample and the corresponding classification result of the positive sample. This represents the difference value calculated based on the category label of the positive sample and the corresponding classification result of the positive sample.
[0190] After obtaining the first sub-loss function value and the second sub-loss function value, the first sub-loss function value and the second sub-loss function value can be weighted and summed to obtain the loss function value used to update the first model, and the first sub-loss function value and the second sub-loss function value correspond to different weights.
[0191] For example, the method for obtaining the loss function value based on the first sub-loss function value and the second sub-loss function value is as follows:
[0192] As shown in Equation 3.
[0193]
[0194] in, This represents the value of the loss function. This represents the value of the first sub-loss function. The value of the second sub-loss function is represented by γ, which is a hyperparameter (i.e., the weight corresponding to the value of the first sub-loss function). In general, the PU loss is equivalent to the regularization term in PN classification, and can be used to correct classification bias in a classification model when faced with a small amount of training data.
[0195] The above describes the process of training a classification model. The following will describe the process of classifying data based on the trained classification model.
[0196] Please see Figure 10 , Figure 10 This is a flowchart illustrating a classification method provided in an embodiment of this application. Figure 10 As shown, the classification method includes the following steps 1001-1004.
[0197] Step 1001: Obtain the data to be classified.
[0198] In this embodiment, the data to be classified can be any of the following types: text, image, video, and audio. Furthermore, this data needs to be classified, meaning it's necessary to determine whether the data is user-generated or AI-generated.
[0199] For example, in the news industry, news organizations may receive a large amount of news materials (such as text, images, videos, or audio) submitted by users. News organizations need to classify these news materials to determine which of them are user-generated and which are AI-generated, and then further verify the authenticity of the news materials.
[0200] Step 1002: Generate at least one target data based on the data to be classified. The at least one target data is obtained based on the data to be classified, and the data volume of the at least one target data is less than the data volume of the data to be classified.
[0201] In this embodiment, there can be multiple ways to generate target data based on the data to be classified, and each method must ensure that the amount of target data generated is less than the amount of data to be classified, that is, the content contained in the target data is less than the content contained in the data to be classified. Furthermore, each of the at least one target data mentioned above is obtained based on a portion of the content of the data to be classified.
[0202] Optionally, in at least one set of target data, the different target data may have different amounts of data. That is, when multiple target data are generated based on the data to be classified, the generated target data may each have different amounts of data, thus ensuring diversity in data scale. For example, when the data to be classified is text data, multiple texts of different lengths may be generated as target data.
[0203] In one possible implementation, target data can be obtained by cropping the data to be classified, with the target data including only a portion of the data to be classified. For example, at least one set of target data includes first target data, which is obtained by cropping a portion of the data to be classified.
[0204] In another possible implementation, the target data can be obtained by cropping the data to be classified and then fusing the cropped content. For example, at least one target data includes second target data, which is obtained by fusing multiple parts of the cropped data to be classified.
[0205] The method of generating target data based on the data to be classified is similar to the method of generating target training data based on the original training data in step 502 above. For details, please refer to the description of step 502 above, which will not be repeated here.
[0206] In general, for target data obtained based on data to be classified, the target data must include at least a portion of the data to be classified, or the target data must include data obtained based on a portion of the data to be classified.
[0207] For example, see Figure 11 and Figure 12 , Figure 11 This is a schematic diagram of a data classification architecture provided in an embodiment of this application. Figure 12 This is a schematic diagram illustrating a data classification process provided in an embodiment of this application. Figure 11 As shown, the classification method in this embodiment can be implemented based on a data classification architecture, which includes a data augmentation module and a classification module. The data augmentation module is used to execute step 1002, whereby the input to the data augmentation module is the data to be classified, and the output is one or more target data sets with a smaller data volume than the data to be classified.
[0208] like Figure 12 As shown, assuming the data to be classified is text, and the text content of the data to be classified is "Hello! How are you! I am fine, thank you! And you?", then two target data can be generated based on the data to be classified. The text content of the two target data is "How are you! I am fine, thank you! And you?" and "I am fine, thank you! And you?", respectively.
[0209] Step 1003: Input the data to be classified and at least one target data into the classification model to obtain multiple classification results.
[0210] In this embodiment, the classification model can be a model trained based on the classification model training method described above (i.e., the second model described in step 504 above). This classification model can be used to classify input data to determine the category to which the input data belongs.
[0211] Therefore, in this embodiment, after inputting the data to be classified and at least one target data into the classification model, the classification model can output the classification result corresponding to each input data, thereby obtaining multiple classification results. These multiple classification results correspond to the data to be classified and at least one target data. Furthermore, each classification result indicates whether the input data belongs to either "user-generated data" or "AI-generated data."
[0212] like Figure 12 As shown, after inputting the data to be classified and two target data into the classification model, the classification model outputs the classification results corresponding to the data to be classified and the two target data. Among them, the classification result corresponding to the data to be classified is "AI-generated data", the classification result corresponding to the first target data is "AI-generated data", and the classification result corresponding to the second target data is "user-generated data".
[0213] Step 1004: Based on multiple classification results, obtain the target classification result, which is used as the classification result for the data to be classified.
[0214] When multiple classification results are obtained based on a classification model, the target classification result can be obtained by combining the multiple classification results, and the target classification result is then used as the final classification result of the data to be classified.
[0215] In this scheme, the data to be classified is augmented to obtain multiple target data with smaller data volumes. The data to be classified and the target data are then input into the classification model for classification. The multiple classification results output by the classification model are integrated to obtain the final target classification result of the data to be classified. This can strengthen the decision of the classification model from a multi-scale perspective, thereby improving the classification accuracy of the data.
[0216] There are several ways to obtain the target classification result based on multiple classification results.
[0217] In one possible implementation, multiple classification results can be weighted and summed to obtain the target classification result. The weights corresponding to each classification result can be the same or different.
[0218] Optionally, the weight of each classification result among multiple classification results is related to the amount of data in the model input data corresponding to each classification result. For example, the weight of each classification result is positively correlated with the amount of data in the model input data corresponding to each classification result; that is, the larger the amount of data in the model input data, the greater the weight of the classification result corresponding to that model input data. In this way, the classification result corresponding to the largest amount of data to be classified can have the largest weight, thus making more attention paid to the classification result corresponding to the original data to be classified when determining the target classification result.
[0219] It should be noted that when performing a weighted summation of multiple classification results, the weighted summation can be performed directly on the classification categories indicated by the multiple results (e.g., "user-generated data" or "AI-generated data"). For example, in Figure 12 In this model, the first two classification results output by the classification model are "AI-generated data" and the last classification result is "user-generated data". By assigning the same weight to each classification result, the classification results under each type can be weighted and summed to determine the "AI-generated data" with the larger sum value as the final target classification result.
[0220] Furthermore, since the classification model actually outputs the category corresponding to each class when determining the classification result, each classification result actually includes the predicted probability of each category. Therefore, when performing a weighted summation of multiple classification results, the predicted probabilities of each category in each classification result can be weighted and summed to determine the category with the largest summation value as the final target classification result. For example, suppose the classification model outputs three classification results: the first classification result has a predicted probability of (0.8, 0.2) for the categories "user-generated data" and "AI-generated data"; the second classification result has a predicted probability of (0.7, 0.3) for the categories "user-generated data" and "AI-generated data"; and the third classification result has a predicted probability of (0.4, 0.6) for the categories "user-generated data" and "AI-generated data". With the weights of the three classification results being 0.5, 0.3, and 0.2 respectively, the weighted sum for the "user-generated data" category is "0.5*0.8 + 0.3*0.7 + 0.2*0.4 = 0.69", and the weighted sum for the "AI-generated data" category is "0.5*0.2 + 0.3*0.3 + 0.2*0.6 = 0.31". Clearly, the weighted sum for the "user-generated data" category is greater than the weighted sum for the "AI-generated data" category; therefore, the target classification result can be determined as "user-generated data".
[0221] In another possible implementation, the target classification result can be determined based on the proportion of each classification result type among multiple classification results. For example, if a certain classification result type has the highest proportion among multiple classification results, then this classification result type is determined as the target classification result. For instance, suppose the classification model outputs 5 classification results, 3 of which are "user-generated data" and the other 2 are "AI-generated data." This means that the "user-generated data" type of classification result has the highest proportion among multiple classification results, therefore "user-generated data" is chosen as the target classification result.
[0222] Taking text classification as an example, through experimental comparison, the classification method provided in this application embodiment can achieve higher prediction accuracy on various corpora than the classification methods of related technologies, as shown in Table 1.
[0223] Table 1
[0224] Related technologies 0.3352 0.7360 The method provided in this embodiment 0.8952 0.9336
[0225] As shown in Table 1, the classification method provided in this application has higher prediction accuracy for both short texts and mixed short and long texts.
[0226] The methods provided in the embodiments of this application have been described in detail above. Next, the device for performing the above methods provided in the embodiments of this application will be described.
[0227] Please see Figure 13 , Figure 13 This is a schematic diagram of the structure of a training device for a classification model provided in an embodiment of this application. Figure 13 As shown, the training device for this classification model includes:
[0228] The acquisition module 1301 is used to acquire multiple raw training data, where the category label corresponding to each raw training data is either user-generated data or AI-generated data.
[0229] The processing module 1302 is used to obtain multiple target training data based on multiple original training data. The first part of the multiple target training data belongs to multiple original training data. Each target training data in the second part of the multiple target training data is obtained from the corresponding original training data in the multiple original training data, and the data volume of each target training data is less than the data volume of the corresponding original training data.
[0230] The processing module 1302 is also used to input multiple target training data into the classification model to obtain multiple classification results corresponding to the multiple target training data;
[0231] The processing module 1302 is also used to update the first model based on the loss function value to obtain the second model. The loss function value is obtained based on multiple classification results and the category labels corresponding to multiple target training data. Some of the target training data in the second part of the data does not have category labels, and the amount of some target training data is less than a preset threshold and the corresponding original training data is generated by AI.
[0232] In one possible implementation, the target training data in the second part of the data is obtained based on a portion of the corresponding original training data.
[0233] In one possible implementation, the second part of the data includes the first target training data, which is obtained by cropping a portion of the original training data corresponding to the first target training data.
[0234] In one possible implementation, the second part of the data includes second target training data, which is obtained by fusing multiple parts of the original training data corresponding to the second target training data.
[0235] In one possible implementation, the data type of the plurality of original training data is any one of the following types: text, image, video, and audio.
[0236] In one possible implementation, the loss function value is obtained based on a first sub-loss function value, which is obtained based on a first difference and a second difference. The first difference is the difference between the classification result corresponding to the partial target training data and the class label assumed for the target training data, and the second difference is the difference between the classification result corresponding to the positive sample training data in the plurality of target training data and the class label assumed for the positive sample data.
[0237] Wherein, the category labels assumed for the target training data and the positive sample training data are both AI-generated data, and the positive sample training data includes the target training data whose category labels are user-generated data.
[0238] In one possible implementation, the loss function value is also obtained based on a second sub-loss function value, which is obtained based on the mean difference between the multiple classification results and the category labels corresponding to the multiple target training data;
[0239] In the process of determining the value of the second sub-loss function, the category labels corresponding to the partial target training data are AI-generated data.
[0240] In one possible implementation, the loss function value is obtained by weighted summation of the first sub-loss function value and the second sub-loss function value, and the first sub-loss function value and the second sub-loss function value correspond to different weights.
[0241] Please see Figure 14 , Figure 14 This is a schematic diagram of a sorting device provided in an embodiment of this application. Figure 14 As shown, the sorting device includes:
[0242] Module 1401 is used to acquire data to be classified.
[0243] The processing module 1402 is used to generate at least one target data based on the data to be classified, wherein the at least one target data is obtained based on the data to be classified, and the data volume of the at least one target data is less than the data volume of the data to be classified.
[0244] The processing module 1402 is also used to input the data to be classified and at least one target data into the classification model to obtain multiple classification results;
[0245] The processing module 1402 is also used to obtain a target classification result based on multiple classification results, and the target classification result is used as the classification result of the data to be classified.
[0246] In one possible implementation, the processing module 1402 is further configured to perform a weighted summation of multiple classification results to obtain the target classification result.
[0247] In one possible implementation, the weight of each classification result among multiple classification results is related to the amount of data in the model input data corresponding to each classification result.
[0248] In one possible implementation, different target data have different amounts of data in at least one target data set.
[0249] In one possible implementation, each target data point in at least one target data point is derived from a portion of the data to be classified.
[0250] In one possible implementation, at least one target data includes first target data, which is obtained by cropping a portion of the data to be classified.
[0251] In one possible implementation, at least one target data includes second target data, which is obtained by fusing multiple parts of the data to be classified after cropping.
[0252] Please see Figure 15 , Figure 15This is a schematic diagram of an execution device provided in an embodiment of this application. The execution device 1500 can specifically be a mobile phone, tablet, laptop, smart wearable device, server, etc., and is not limited thereto. Specifically, the execution device 1500 includes: a receiver 1501, a transmitter 1502, a processor 1503, and a memory 1504 (wherein the execution device 1500 may have one or more processors 1503). Figure 15 (Taking a processor as an example), processor 1503 may include application processor 15031 and communication processor 15032. In some embodiments of this application, receiver 1501, transmitter 1502, processor 1503 and memory 1504 may be connected via a bus or other means.
[0253] Memory 1504 may include read-only memory and random access memory, and provides instructions and data to processor 1503. A portion of memory 1504 may also include non-volatile random access memory (NVRAM). Memory 1504 stores processor and operation instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.
[0254] Processor 1503 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together through a bus system, which may include not only the data bus, but also power buses, control buses, and status signal buses. However, for clarity, all buses in the diagram are referred to as the bus system.
[0255] The methods disclosed in the embodiments of this application described above can be applied to processor 1503, or implemented by processor 1503. Processor 1503 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit in the hardware of processor 1503 or by instructions in the form of software. The processor 1503 described above can be a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, and may further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0256] The processor 1503 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory 1504. The processor 1503 reads information from memory 1504 and, in conjunction with its hardware, completes the steps of the above methods.
[0257] Receiver 1501 can be used to receive input digital or character information, and to generate signal inputs related to the settings and function control of the execution device. Transmitter 1502 can be used to output digital or character information through the first interface; transmitter 1502 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; transmitter 1502 may also include a display device such as a display screen.
[0258] The electronic device provided in this application embodiment can specifically be a chip, which includes a processing unit and a communication unit. The processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, pins, or circuits. The processing unit can execute computer execution instructions stored in the storage unit to cause the chip in the execution device to execute the model structure determination method described in the above embodiments, or to cause the chip in the training device to execute the model structure determination method described in the above embodiments. Optionally, the storage unit can be an internal storage unit within the chip, such as a register or cache. Alternatively, the storage unit can be an external storage unit located within the wireless access device, such as a read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions, such as random access memory (RAM).
[0259] For details, please refer to Figure 16 , Figure 16 This is a schematic diagram of a chip provided in an embodiment of this application. The chip can be represented as a neural network processor (NPU) 1600. The NPU 1600 is mounted as a coprocessor on the host CPU, and tasks are assigned by the host CPU. The core part of the NPU is the arithmetic circuit 1603, which is controlled by the controller 1604 to extract matrix data from the memory and perform multiplication operations.
[0260] In some implementations, the arithmetic circuit 1603 internally includes multiple processing engines (PEs). In some implementations, the arithmetic circuit 1603 is a two-dimensional pulsating array. The arithmetic circuit 1603 can also be a one-dimensional pulsating array or other electronic circuits capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 1603 is a general-purpose matrix processor.
[0261] For example, suppose we have an input matrix A, a weight matrix B, and an output matrix C. The arithmetic circuit retrieves the corresponding data of matrix B from the weight memory 1602 and caches it in each PE of the arithmetic circuit. The arithmetic circuit retrieves the data of matrix A from the input memory 1601 and performs matrix operations with matrix B. The partial result or the final result of the obtained matrix is stored in the accumulator 1608.
[0262] Unified memory 1606 is used to store input and output data. Weight data is directly transferred to weight memory 1602 via Direct Memory Access Controller (DMAC) 1605. Input data is also transferred to unified memory 1606 via DMAC.
[0263] BIU stands for Bus Interface Unit, which is used for interaction between the AXI bus and the DMAC and the Instruction Fetch Buffer (IFB) 1609.
[0264] The Bus Interface Unit (BIU) 1610 is used by the instruction fetch memory 1609 to fetch instructions from external memory, and also by the memory access controller 1605 to fetch the original data of the input matrix A or the weight matrix B from external memory.
[0265] The DMAC is mainly used to move input data from external memory DDR to unified memory 1606, or to weight data to weight memory 1602, or to input data to input memory 1601.
[0266] The vector computation unit 1607 includes multiple processing units that further process the output of the computation circuit 1603 when needed, such as vector multiplication, vector addition, exponential operations, logarithmic operations, size comparisons, etc. It is mainly used for computation in non-convolutional / fully connected layers of neural networks, such as batch normalization, pixel-level summation, and upsampling of feature planes.
[0267] In some implementations, the vector computation unit 1607 can store the processed output vector in the unified memory 1606. For example, the vector computation unit 1607 can apply a linear function, or a nonlinear function, to the output of the computation circuit 1603, such as linear interpolation of feature planes extracted by a convolutional layer, or, for example, a vector of accumulated values, to generate activation values. In some implementations, the vector computation unit 1607 generates normalized values, pixel-level summed values, or both. In some implementations, the processed output vector can be used as activation input to the computation circuit 1603, for example, for use in subsequent layers of the neural network.
[0268] The instruction fetch buffer 1609 connected to the controller 1604 is used to store the instructions used by the controller 1604.
[0269] The unified memory 1606, input memory 1601, weight memory 1602, and instruction fetch memory 1609 are all on-chip memories. External memory is proprietary to this NPU hardware architecture.
[0270] The processor mentioned above can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits used to control the execution of the above program.
[0271] Please refer to Figure 17 , Figure 17 This is a schematic diagram of a computer-readable storage medium provided in an embodiment of this application. This application also provides a computer-readable storage medium in some embodiments, wherein the above-described... Figure 5 The disclosed method can be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or on other non-transitory media or articles of art.
[0272] Figure 17 A conceptual partial view of an example computer-readable storage medium arranged according to at least some of the embodiments shown herein is illustrated schematically. The example computer-readable storage medium includes a computer program for executing computer processes on a computing device.
[0273] In one embodiment, the computer-readable storage medium 1700 is provided using a signal bearer medium 1701. The signal bearer medium 1701 may include one or more program instructions 1702, which, when executed by one or more processors, can provide the above-mentioned... Figure 5 The described function or part of the function.
[0274] In some examples, signal carrying medium 1701 may include computer-readable medium 1703, such as, but not limited to, hard disk drive, compact disc (CD), digital video disc (DVD), digital magnetic tape, memory, ROM or RAM, etc.
[0275] In some embodiments, the signal carrying medium 1701 may include a computer-recordable medium 1704, such as, but not limited to, a memory, a read / write (R / W) CD, a R / W DVD, etc. In some embodiments, the signal carrying medium 1701 may include a communication medium 1705, such as, but not limited to, digital and / or analog communication media (e.g., fiber optic cables, waveguides, wired communication links, wireless communication links, etc.). Therefore, for example, the signal carrying medium 1701 may be transmitted by a wireless communication medium 1705 (e.g., a wireless communication medium conforming to the IEEE 802.11 standard or other transmission protocols).
[0276] One or more program instructions 1702 may be, for example, computer-executable instructions or logical implementation instructions. In some examples, the computing device may be configured to provide various operations, functions, or actions in response to one or more program instructions 1702 conveyed to the computing device via a computer-readable medium 1703, a computer-recordable medium 1704, and / or a communication medium 1705.
[0277] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the accompanying drawings of the device embodiments provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0278] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods of the various embodiments of this application.
[0279] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0280] A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A method for training a classification model, characterized in that, Applications in the field of artificial intelligence technology include: Multiple raw training data are obtained, and the category label corresponding to each raw training data is user-generated data or artificial intelligence (AI) generated data. The data type of the multiple raw training data is any one of the following types: text, image, video, and voice. Multiple target training data are obtained based on the multiple original training data. The first part of the multiple target training data belongs to the multiple original training data. Each target training data in the second part of the multiple target training data is obtained from the corresponding original training data in the multiple original training data. The data volume of each target training data is less than the data volume of the corresponding original training data. The multiple target training data are input into the classification model to obtain multiple classification results corresponding to the multiple target training data. Each of the multiple classification results is used to indicate whether the corresponding target training data belongs to the user-generated data or the AI-generated data. The first model is updated based on the loss function value to obtain the second model. The loss function value is obtained based on the multiple classification results and the category labels corresponding to the multiple target training data. In the second part of the data, some target training data does not have category labels. The amount of data in the second part of the target training data is less than a preset threshold and the corresponding original training data is generated by AI.
2. The method according to claim 1, characterized in that, The target training data in the second part of the data is obtained based on a portion of the corresponding original training data.
3. The method according to claim 1 or 2, characterized in that, The second part of the data includes the first target training data, which is obtained by cropping a portion of the original training data corresponding to the first target training data.
4. The method according to claim 1 or 2, characterized in that, The second part of the data includes the second target training data, which is obtained by fusing multiple parts of the original training data corresponding to the second target training data.
5. The method according to claim 1 or 2, characterized in that, The loss function value is obtained based on the first sub-loss function value, which is obtained based on the first difference and the second difference. The first difference is the difference between the classification result corresponding to the partial target training data and the class label assumed for the target training data, and the second difference is the difference between the classification result corresponding to the positive sample training data in the plurality of target training data and the class label assumed for the positive sample data. Wherein, the category labels assumed for the target training data and the positive sample training data are both AI-generated data, and the positive sample training data includes the target training data whose category labels are user-generated data.
6. The method according to claim 5, characterized in that, The loss function value is also obtained based on the second sub-loss function value, which is obtained based on the average difference between the multiple classification results and the category labels corresponding to the multiple target training data. In the process of determining the value of the second sub-loss function, the category labels corresponding to the partial target training data are AI-generated data.
7. The method according to claim 6, characterized in that, The loss function value is obtained by weighted summation of the first sub-loss function value and the second sub-loss function value, and the first sub-loss function value and the second sub-loss function value correspond to different weights.
8. A classification method, characterized in that, Applications in the field of artificial intelligence technology include: Obtain the data to be classified, wherein the data type of the data to be classified is any one of the following types: text, image, video, and voice; At least one target data is generated based on the data to be classified, wherein the at least one target data is obtained based on the data to be classified, and the data volume of the at least one target data is less than the data volume of the data to be classified; The data to be classified and the at least one target data are input into a classification model to obtain multiple classification results. The classification model is a model updated based on a loss function value, which is obtained based on the multiple classification results and the category labels corresponding to the multiple target training data. In this model, some target training data in the second part of the multiple target training data does not have category labels. The first part of the multiple target training data belongs to multiple original training data. Each target training data in the second part is obtained from the corresponding original training data in the multiple original training data, and the data volume of each target training data is less than the data volume of the corresponding original training data. The data volume of some target training data is less than a preset threshold, and the corresponding original training data is generated by AI. Each classification result in the multiple classification results is used to indicate whether the corresponding target data belongs to user-generated data or AI-generated data. Based on the multiple classification results, a target classification result is obtained, which is used as the classification result of the data to be classified.
9. The method according to claim 8, characterized in that, The process of obtaining the target classification result based on the multiple classification results includes: The target classification result is obtained by weighted summation of the multiple classification results.
10. The method according to claim 9, characterized in that, The weight of each classification result is related to the amount of data in the model input data corresponding to each classification result.
11. The method according to any one of claims 8-10, characterized in that, In the at least one target data, different target data have different data volumes.
12. The method according to any one of claims 8-10, characterized in that, Each of the at least one target data is obtained based on a portion of the data to be classified.
13. The method according to any one of claims 8-10, characterized in that, The at least one target data includes first target data, which is obtained by cropping a portion of the data to be classified.
14. The method according to any one of claims 8-10, characterized in that, The at least one target data includes second target data, which is obtained by fusing multiple parts of the data to be classified after cropping.
15. A training device for a classification model, characterized in that, Applications in the field of artificial intelligence technology include: The acquisition module is used to acquire multiple raw training data. The category label corresponding to each raw training data is user-generated data or AI-generated data. The data type of the multiple raw training data is any one of the following types: text, image, video, and voice. The processing module is used to obtain multiple target training data based on the multiple original training data. The first part of the multiple target training data belongs to the multiple original training data. Each target training data in the second part of the multiple target training data is obtained from the corresponding original training data in the multiple original training data. The data volume of each target training data is less than the data volume of the corresponding original training data. The processing module is further configured to input the plurality of target training data into a classification model to obtain a plurality of classification results corresponding to the plurality of target training data, wherein each classification result is used to indicate that the corresponding target training data belongs to the user-generated data or the AI-generated data; The processing module is further configured to update the first model based on the loss function value to obtain the second model. The loss function value is obtained based on the multiple classification results and the category labels corresponding to the multiple target training data. In the second part of the data, some target training data does not have category labels, the amount of the target training data is less than a preset threshold, and the corresponding original training data is generated by AI.
16. The apparatus according to claim 15, characterized in that, The target training data in the second part of the data is obtained based on a portion of the corresponding original training data.
17. The apparatus according to claim 15 or 16, characterized in that, The second part of the data includes the first target training data, which is obtained by cropping a portion of the original training data corresponding to the first target training data.
18. The apparatus according to any one of claims 15 or 16, characterized in that, The second part of the data includes the second target training data, which is obtained by fusing multiple parts of the original training data corresponding to the second target training data.
19. A sorting device, characterized in that, Applications in the field of artificial intelligence technology include: The acquisition module is used to acquire data to be classified, wherein the data type of the data to be classified is any one of the following types: text, image, video, and voice; A processing module is used to generate at least one target data based on the data to be classified, wherein the at least one target data is obtained based on the data to be classified, and the data volume of the at least one target data is less than the data volume of the data to be classified; The processing module is further configured to input the data to be classified and the at least one target data into a classification model to obtain multiple classification results; the classification model is a model updated based on a loss function value, the loss function value being obtained based on the multiple classification results and the category labels corresponding to the multiple target training data, wherein some target training data in the second part of the multiple target training data does not have category labels, the first part of the multiple target training data belongs to multiple original training data, each target training data in the second part of the data is obtained from the corresponding original training data in the multiple original training data, and the data volume of each target training data is less than the data volume of the corresponding original training data, the data volume of the partial target training data is less than a preset threshold and the corresponding original training data is generated by AI, and each classification result in the multiple classification results is used to indicate whether the corresponding target data belongs to user-generated data or AI-generated data; The processing module is further configured to obtain a target classification result based on the multiple classification results, and the target classification result is used as the classification result of the data to be classified.
20. The apparatus according to claim 19, characterized in that, The processing module is further configured to perform a weighted summation of the multiple classification results to obtain the target classification result.
21. The apparatus according to claim 20, characterized in that, The weight of each classification result is related to the amount of data in the model input data corresponding to each classification result.
22. The apparatus according to any one of claims 19-21, characterized in that, In the at least one target data, different target data have different data volumes.
23. The apparatus according to any one of claims 19-21, characterized in that, Each of the at least one target data is obtained based on a portion of the data to be classified.
24. The apparatus according to any one of claims 19-21, characterized in that, The at least one target data includes first target data, which is obtained by cropping a portion of the data to be classified.
25. The apparatus according to any one of claims 19-21, characterized in that, The at least one target data includes second target data, which is obtained by fusing multiple parts of the data to be classified after cropping.
26. A training device for a classification model, characterized in that, The device includes a memory and a processor; the memory stores code, and the processor is configured to execute the code, wherein when the code is executed, the device performs the method as described in any one of claims 1 to 7.
27. A sorting device, characterized in that, The device includes a memory and a processor; the memory stores code, and the processor is configured to execute the code, wherein when the code is executed, the device performs the method as described in any one of claims 8 to 14.
28. A computer storage medium, characterized in that, The computer storage medium stores instructions that, when executed by the computer, cause the computer to perform the method according to any one of claims 1 to 14.
29. A computer program product, characterized in that, The computer program product stores instructions that, when executed by a computer, cause the computer to perform the method described in any one of claims 1 to 14.
Citation Information
Patent Citations
Model training method and device, model identification method and device, electronic equipment and computer storage medium
CN113553849A
Training method of image classification model and image classification method and device
CN114662614A