Method for training classification model, and related apparatus

By generating diversity training data and marking AI-generated data as unlabeled, the problem of inaccurate short text prediction in AI-generated text detection is solved, and the model's recognition ability and prediction accuracy of AI-generated data are improved.

WO2024212648A1PCT designated stage expired Publication Date: 2024-10-17HUAWEI TECH CO LTD

Patent Information

Application Number
PCT/CN2024/072506
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-14
Filing Date
2024-01-16
Publication Date
2024-10-17

AI Technical Summary

Technical Problem

Existing AI-generated text detection solutions are difficult to obtain accurate prediction results when the input text is short, and the perception of the style of AI-generated data is poor, affecting the prediction accuracy of the classification model.

Method used

By generating target training data with a smaller amount of data, we ensure the scale diversity of the training data, and label the target training data with a smaller amount of data and generated by AI as unlabeled data, so that the classification model can focus on AI generation and training during training. Artificially generated differences avoid affecting the perception of the style of AI-generated data, thereby improving prediction accuracy.

Benefits of technology

It effectively improves the prediction accuracy of the classification model, especially when processing short texts or small amounts of data, and enhances the recognition ability of AI-generated data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024072506_17102024_PF_FP_ABST
    Figure CN2024072506_17102024_PF_FP_ABST
Patent Text Reader

Abstract

A method for training a classification model, which is applied to the technical field of artificial intelligence (AI). In the method, target training data with a smaller data volume is firstly generated on the basis of original training data, so as to obtain training data of different scales, thereby ensuring the diversity of the scales of the training data; moreover, features of AI-generated data are taken into consideration, and for the target training data which has a relatively small data volume and is originally generated by AI, this part of target training data is marked as label-free data, such that during training, a classification model can focus on the AI-generated data, which is different from manually generated data, thereby avoiding the perception of the style of the AI-generated data by the classification model from being affected when the target training data is marked as the AI-generated data, and thus effectively improving the prediction accuracy of the classification model.
Need to check novelty before this filing date? Find Prior Art

Description

A training method for a classification model and related device

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on April 14, 2023, with application number 202310444662.7 and invention name “A training method and related device for a classification model”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of artificial intelligence (AI) technology, and in particular to a training method for a classification model. Background Art

[0003] With the rapid development of AI technology, the data generated by AI is becoming increasingly similar to data generated by humans. As a result, more and more applications are utilizing AI-generated data during operation. This data can include text, voice, video, and images.

[0004] Taking AI-generated text as an example, AI-generated text detection has become an important technology to prevent the negative consequences of AI-generated spam or misinformation. AI-generated text detection is primarily used to distinguish whether the text being tested is human-generated or AI-generated.

[0005] Existing AI-generated text detection solutions typically use binary classification techniques. The text to be tested is fed into a pre-trained model, which then outputs a final prediction: whether the text is human-generated or AI-generated. However, existing technologies have certain requirements for the length of the input text, making it difficult to accurately predict short text.

[0006] Summary of the Invention

[0007] This application provides a classification model training method that can effectively improve the prediction accuracy of the classification model.

[0008] In a first aspect, the present application provides a method for training a classification model, which is applied to the field of artificial intelligence technology. The method comprises: first, obtaining a plurality of original training data, wherein the category label corresponding to each of the plurality of original training data is user-generated data or AI-generated data, that is, the original training data is generated in a manner that is either user-generated or AI-generated. Moreover, the plurality of original training data are all of the same type, for example, the data type of the plurality of original training data is any one of the following types: text, image, video, and voice.

[0009] Then, a plurality of target training data are obtained based on the plurality of original training data. The first portion of the plurality of target training data belongs to the plurality of original training data, i.e., the first portion of the data is a subset of the plurality of original training data. Each target training data in the second portion of the plurality of target training data is obtained from a corresponding original training data in the plurality of original training data, and the data size of each target training data is smaller than the data size of the corresponding original training data. In other words, each target training data in the second portion of the plurality of target training data corresponds to one original training data, and each target training data in the second portion of the data is obtained based on the corresponding original training data.

[0010] Secondly, multiple target training data are input into a classification model to obtain multiple classification results corresponding to the multiple target training data. The classification model can be an AI model that performs a binary classification task and is used to perform classification prediction on the input data of the classification model. Each of the multiple classification results is used to indicate the category to which the corresponding target training data belongs, that is, whether the target training data belongs to user-generated data or AI-generated data.

[0011] Finally, the first model is updated based on the loss function value to obtain a 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, wherein some of the target training data in the second portion of data does not have a category label, the data volume of some of the target training data is less than a preset threshold, and the corresponding original training data is generated by AI.

[0012] In this solution, we first generate target training data with a smaller amount of data based on the original training data to obtain training data of different scales and ensure the scale diversity of the training data. In addition, considering the characteristics of AI-generated data, for target training data with a smaller amount of data and originally generated by AI, this part of the target training data is marked as unlabeled data, so that the classification model can focus on data generated by AI and different from manual generation 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, thereby effectively improving the prediction accuracy of the classification model.

[0013] In a possible implementation, the target training data in the second portion of data is obtained based on a portion of the corresponding original training data.

[0014] In one possible implementation, the second portion of data includes first target training data, which is obtained by clipping a portion of the original training data corresponding to the first target training data. For example, assuming that 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?", the text content of the first target training data may be "How are you! I am fine, thank you! And you?"

[0015] In one possible implementation, the second portion of data includes second target training data, which is obtained by fusing multiple portions of content obtained by cropping original training data corresponding to the second target training data. The fusing of the multiple portions of content involves fusing not all of the cropped content, but only a portion of the content, thereby making the resulting second target training data smaller in size than the corresponding original training data.

[0016] In this scheme, on the one hand, the original training data is processed to obtain target training data with smaller data volume. On the other hand, part of the original training data is used as target training data, which can realize multi-scale amplification of the original training data, thereby ensuring the scale diversity of the final target training data.

[0017] In one possible implementation, the loss function value is obtained based on the first sub-loss function value, and the first sub-loss function value is obtained based on the first difference and the second difference. The first difference is the difference between the classification results corresponding to part of the target training data and the category label assumed for the target training data, and the second difference is the difference between the classification results corresponding to the positive sample training data in the multiple target training data and the category 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 target training data whose category labels are user-generated data.

[0018] Simply put, the first sub-loss function value can be understood as the positive and unlabeled (Positive-Unlabeled, PU) loss, which is obtained based on positive samples (i.e., target training data whose category labels are user-generated data) and unlabeled samples (i.e., target training data without category labels).

[0019] In this solution, the target training data whose category labels are user-generated data are regarded as positive samples, and the target training data without category labels are regarded as unlabeled samples. The classification loss of negative samples is then estimated based on the positive samples and unlabeled samples. This allows the classification model to focus on data generated by AI that is different from artificially generated data during training, avoiding the impact of directly labeling target training data with a small amount of data and originally generated by AI as negative samples on the classification model's perception of the style of AI-generated data, thereby effectively improving the prediction accuracy of the trained classification model.

[0020] 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 of the differences between multiple classification results and 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 target training data are AI-generated data.

[0021] Simply put, the value of the second sub-loss function can be understood as positive-negative (PN) loss, which is obtained based on positive samples (i.e., target training data whose category labels are user-generated data) and negative samples (i.e., target training data whose category labels are AI-generated data).

[0022] In one possible implementation, the loss function value is obtained by weighted summing 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.

[0023] A second aspect of the present application provides a classification method, comprising:

[0024] Obtain data to be classified;

[0025] generating 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 smaller than the data volume of the data to be classified;

[0026] Inputting the data to be classified and at least one target data into the classification model to obtain corresponding multiple classification results;

[0027] Based on the multiple classification results, a target classification result is obtained, and the target classification result is used as the classification result of the data to be classified.

[0028] In this scheme, by amplifying the data to be classified, multiple target data with smaller data volumes are obtained, and then the data to be classified and the target data are input into the classification model for classification together, and 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-making of the classification model from a multi-scale perspective, thereby improving the classification accuracy of the data.

[0029] In one possible implementation, a target classification result is obtained based on multiple classification results, including:

[0030] Perform weighted summation on multiple classification results to obtain the target classification result.

[0031] In a possible implementation, the weight of each classification result among the multiple classification results is related to the data volume of the model input data corresponding to each classification result.

[0032] In a possible implementation manner, in at least one target data, different target data have different data volumes.

[0033] In a possible implementation manner, each target data in the at least one target data is obtained based on a portion of content of the data to be classified.

[0034] In a possible implementation, the at least one target data includes first target data, and the first target data is obtained by clipping part of the content of the data to be classified.

[0035] In a possible implementation, at least one target data includes second target data, and the second target data is obtained by fusing multiple parts of content obtained by cropping the data to be classified.

[0036] A third aspect of the present application provides a training device for a classification model, comprising:

[0037] An acquisition module is used to acquire a plurality of original training data, wherein the category label corresponding to each of the plurality of original training data is user-generated data or AI-generated data;

[0038] a processing module, configured to obtain a plurality of target training data based on the plurality of original training data, wherein a first portion of the plurality of target training data belongs to the plurality of original training data, each target training data in a second portion of the plurality of target training data is obtained from a corresponding original training data in the plurality of original training data, and a data volume of each target training data is smaller than a data volume of the corresponding original training data;

[0039] The processing module is further configured to input the plurality of target training data into the classification model to obtain a plurality of classification results corresponding to the plurality of target training data;

[0040] The processing module is also used to update the first model based on the loss function value to obtain a second model, where the loss function value is obtained based on multiple classification results and category labels corresponding to multiple target training data, wherein some target training data in the second part of the data does not have a category label, the data volume of some target training data is less than a preset threshold and the corresponding original training data is generated by AI.

[0041] In a possible implementation, the target training data in the second portion of data is obtained based on a portion of the corresponding original training data.

[0042] In a possible implementation, the second portion of data includes first target training data, and the first target training data is obtained by clipping part of the content in original training data corresponding to the first target training data.

[0043] In a possible implementation, the second portion of data includes second target training data, and the second target training data is obtained by fusing multiple portions of content obtained by cropping original training data corresponding to the second target training data.

[0044] In a possible implementation, the data type of the plurality of original training data is any one of the following types: text, image, video, and voice.

[0045] In a possible implementation, the loss function value is obtained based on a first sub-loss function value, and the first sub-loss function value is obtained based on a first difference and a second difference, wherein the first difference is a difference between a classification result corresponding to the portion of the target training data and a category label assumed for the target training data, and the second difference is a difference between a classification result corresponding to positive sample training data in the multiple target training data and the category label assumed for the positive sample data;

[0046] 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 target training data whose category labels are user-generated data.

[0047] In a possible implementation, the loss function value is further obtained based on a second sub-loss function value, where the second sub-loss function value is obtained based on a mean of differences between the multiple classification results and the category labels corresponding to the multiple target training data;

[0048] In the process of determining the value of the second sub-loss function, the category label corresponding to the part of the target training data is AI generated data.

[0049] In a possible implementation, the loss function value is obtained by weighted summing 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.

[0050] A fourth aspect of the present application provides a classification device, comprising:

[0051] An acquisition module is used to obtain data to be classified;

[0052] a processing module, configured 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 smaller than the data volume of the data to be classified;

[0053] The processing module is further configured to input the data to be classified and at least one target data into the classification model to obtain corresponding multiple classification results;

[0054] The processing module is further used 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.

[0055] In a possible implementation, the processing module is further configured to perform weighted summation on multiple classification results to obtain a target classification result.

[0056] In a possible implementation, the weight of each classification result among the multiple classification results is related to the data volume of the model input data corresponding to each classification result.

[0057] In a possible implementation manner, in at least one target data, different target data have different data volumes.

[0058] In a possible implementation manner, each target data in the at least one target data is obtained based on a portion of content of the data to be classified.

[0059] In a possible implementation, the at least one target data includes first target data, and the first target data is obtained by clipping part of the content of the data to be classified.

[0060] In a possible implementation, at least one target data includes second target data, and the second target data is obtained by fusing multiple parts of content obtained by cropping the data to be classified.

[0061] In a fifth aspect, the present application provides a training device for a classification model, which may include a processor coupled to a memory, wherein the memory stores program instructions, and when the program instructions stored in the memory are executed by the processor, the method of the first aspect or any implementation of the first aspect is implemented. For the steps in each possible implementation of the first aspect executed by the processor, please refer to the first aspect for details, and will not be repeated here.

[0062] In a sixth aspect, the present application provides a classification device, which may include a processor coupled to a memory, wherein the memory stores program instructions. When the program instructions stored in the memory are executed by the processor, the method of the second aspect or any implementation of the second aspect is implemented. For details of the steps in each possible implementation of the second aspect executed by the processor, please refer to the second aspect and will not be repeated here.

[0063] In a seventh aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the method of any implementation manner of the first aspect.

[0064] In an eighth aspect, the present application provides a circuit system, which includes a processing circuit, and the processing circuit is configured to execute a method of any implementation manner of the above-mentioned first aspect.

[0065] In a ninth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the method of any implementation manner of the first aspect.

[0066] The tenth aspect of the present application provides a chip system, which includes a processor for supporting a server or a threshold value acquisition device to implement the functions involved in any implementation of the first aspect, for example, sending or processing the data and / or information involved in the above method. In one possible design, the chip system also includes a memory, which is used to store program instructions and data necessary for the server or communication device. The chip system can be composed of a chip, or it can include a chip and other discrete devices.

[0067] The beneficial effects of the second to tenth aspects mentioned above can be referred to the introduction of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] FIG1 is a schematic diagram of the structure of a convolutional neural network provided in an embodiment of the present application;

[0069] FIG2 is a schematic diagram of the structure of another convolutional neural network provided in an embodiment of the present application;

[0070] FIG3 is a schematic diagram of a system architecture 300 provided in an embodiment of the present application;

[0071] FIG4 is a schematic structural diagram of an electronic device 101 provided in an embodiment of the present application;

[0072] FIG5 is a flow chart of a method for training a classification model according to an embodiment of the present application;

[0073] FIG6A is a schematic diagram of obtaining multiple target training data based on multiple original training data according to an embodiment of the present application;

[0074] FIG6B is another schematic diagram of obtaining multiple target training data based on multiple original training data according to an embodiment of the present application;

[0075] FIG7 is a schematic diagram of determining category labels of multiple target training data according to an embodiment of the present application;

[0076] FIG8 is a schematic diagram of a training process of a classification model provided in an embodiment of the present application;

[0077] FIG9 is a schematic diagram of the division of positive samples, unlabeled samples, and negative samples provided in an embodiment of the present application;

[0078] FIG10 is a flow chart of a classification method provided in an embodiment of the present application;

[0079] FIG11 is a schematic diagram of a data classification architecture provided in an embodiment of the present application;

[0080] FIG12 is a schematic diagram of a process for classifying data according to an embodiment of the present application;

[0081] FIG13 is a schematic diagram of the structure of a training device for a classification model provided in an embodiment of the present application;

[0082] FIG14 is a schematic structural diagram of a classification device provided in an embodiment of the present application;

[0083] FIG15 is a schematic diagram of a structure of an execution device provided in an embodiment of the present application;

[0084] FIG16 is a schematic diagram of a structure of a chip provided in an embodiment of the present application;

[0085] FIG17 is a schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION

[0086] In order to make the purpose, technical solutions and advantages of this application more clear, the embodiments of this application are described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only embodiments of a part of this application, rather than all embodiments. It is known to those skilled in the art that with the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.

[0087] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the descriptions used in this way can be interchangeable where appropriate so that the embodiments can be implemented in a sequence other than that illustrated or described in this application. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or modules is not necessarily limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or that are inherent to these processes, methods, products or devices. The naming or numbering of steps in this application does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The named or numbered process steps can change the execution order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved. The division of units in this application is a logical division. In actual application, there may be other division methods. For example, multiple units can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, and the indirect coupling or communication connection between units can be electrical or other similar forms, which are not limited in this application. Moreover, 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 into multiple circuit units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this application.

[0088] To facilitate understanding, some technical terms involved in the embodiments of this application are first introduced below.

[0089] (1) Neural Network

[0090] A neural network can be composed of neural units. A neural unit can refer to an operation unit that takes xs (i.e., input data) and intercept 1 as input. The output of the operation unit can be:

[0091] Where s = 1, 2, ... n, 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, which is used to introduce nonlinear characteristics into the neural network to convert the input signal of the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function. A neural network is a network formed by connecting multiple single neural units mentioned above, 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. The local receptive field can be an area composed of several neural units.

[0092] (2) Deep Neural Networks

[0093] Deep Neural Network (DNN), also known as multi-layer neural network, can be understood as a neural network with many hidden layers. There is no special metric for "many" here. According to the position of different layers of DNN, the neural network inside DNN can be divided into three categories: input layer, hidden layer, and output layer. Generally speaking, the first layer is the input layer, the last layer is the output layer, and the layers in between are all hidden layers. The layers are fully connected, that is, any neural unit in the i-th layer must be connected to any neural unit in the i+1-th layer. Although DNN looks complicated, the work of each layer is actually not complicated. Simply put, it is the following linear relationship expression: in, is the input vector, is the output vector, is the offset vector, W is the weight matrix (also called coefficient), and α() is the activation function. Each layer is just an input vector After such a simple operation, the output vector Since there are many DNN layers, the coefficient W and the offset vector The definition of these parameters in DNN is as follows: Take the coefficient W as an example: Assume that in a three-layer DNN, the linear coefficient from the 4th neural unit in the second layer to the 2nd neural unit in the third layer is defined as The superscript 3 represents the layer number of the coefficient W, while the subscript corresponds to the output of the third layer index 2 and the input of the second layer index 4. In summary, the coefficients from the kth neural unit in the L-1th layer to the jth neural unit in the Lth layer are defined as It's important to note that the input layer has no W parameter. In deep neural networks, more hidden layers allow the network to better capture complex real-world situations. Theoretically, a predictive model with more parameters is more complex and has greater "capacity," meaning it can handle 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 for all layers of a trained deep neural network (a weight matrix formed by the vectors W of many layers).

[0094] (3) Convolutional Neural Network (CNN)

[0095] A convolutional neural network is a deep neural network with a convolutional architecture. It includes a feature extractor consisting of a convolutional layer and a subsampling layer. The feature extractor can be viewed as a filter, and the convolution process can be thought of as convolving an input image or feature map with a trainable filter. A convolutional layer refers to the layer of neural units in a convolutional neural network that performs convolution processing on the input signal (e.g., the first and second convolutional layers in this embodiment). Within a convolutional layer of a convolutional neural network, a neural unit may only be connected to some of the neural units in adjacent layers. A convolutional layer typically contains several feature planes, each of which can be composed of a rectangular arrangement of neural units. Neural units in the same feature plane share weights, which are referred to as the convolution kernel. Shared weights can be understood as the way image information is extracted, regardless of position. The underlying principle is that the statistical information of one part of the image is the same as that of another part. This means that image information learned in one part can also be applied to another part. Therefore, the same learning can be used to obtain image information at all positions in the image. In the same convolutional layer, multiple convolution kernels can be used to extract different image information. Generally speaking, the more convolution kernels there are, the richer the image information reflected by the convolution operation.

[0096] Convolution kernels can be initialized as matrices of random size, and during the training process of the convolutional neural network, the convolution kernels can be learned to obtain reasonable weights. In addition, the direct benefit of shared weights is that they reduce the number of connections between the layers of the convolutional neural network, while also reducing the risk of overfitting.

[0097] Specifically, as shown in FIG1 , the convolutional neural network 100 may include an input layer 110 , a convolutional layer / pooling layer 120 , wherein the pooling layer is optional, and a neural network layer 130 .

[0098] Among them, the structure composed of the convolution layer / pooling layer 120 and the neural network layer 130 can be the first convolution layer and the second convolution layer described in this application, the input layer 110 is connected to the convolution layer / pooling layer 120, the convolution 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 nonlinear processing on the output of the neural network layer 130.

[0099] Convolutional layer / pooling layer 120. Convolutional layer: As shown in Figure 2, convolutional layer / pooling layer 120 may include layers 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 a convolutional layer can serve as the input to a subsequent pooling layer, or as the input to another convolutional layer to continue the convolution operation.

[0100] Taking convolution layer 121 as an example, convolution layer 121 can include multiple convolution operators, also known as kernels. In image processing, a convolution operator acts as a filter that extracts specific information from the input image matrix. A convolution operator is essentially a weight matrix, which is typically predefined. During the convolution operation, the weight matrix is ​​typically applied horizontally to the input image, pixel by pixel (or two pixels by two pixels, depending on the stride), to extract specific features from the image. The size of the weight matrix should be related to the image size. It is important to note that the depth dimension of the weight matrix is ​​the same as the depth dimension of the input image. During the convolution operation, the weight matrix extends to the entire depth of the input image. Therefore, convolution with a single weight matrix produces a convolution output with a single depth dimension. However, in most cases, a single weight matrix is ​​not used, and multiple weight matrices of the same dimension are applied. The outputs of each weight matrix are stacked to form the depth dimension of the convolved image. Different weight matrices can be used to extract different features in the image. For example, one weight matrix is ​​used to extract image edge information, another weight matrix is ​​used to extract specific colors of the image, and another weight matrix is ​​used to blur unwanted noise in the image... The multiple weight matrices have the same dimensions, and the feature maps extracted by the multiple weight matrices with the same dimensions also have the same dimensions. The multiple feature maps with the same dimensions extracted are then merged to form the output of the convolution operation.

[0101] The weight values ​​in these weight matrices need to be obtained through a lot of 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.

[0102] When the convolutional neural network 100 has multiple convolutional layers, the initial convolutional layer (for example, 121) often extracts 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 the later convolutional layers (for example, 126) become more and more complex, such as high-level semantic features. Features with higher semantics are more suitable for the problem to be solved.

[0103] Pooling layer: Since it is often necessary to reduce the number of training parameters, it is often necessary to periodically introduce a pooling layer after the convolution layer, that is, as shown in the example 120 in Figure 1, each layer 121-126 can be a convolution layer followed by a pooling layer, or multiple convolution layers can be followed by one or more pooling layers.

[0104] Neural network layer 130: After being processed by the convolution layer / pooling layer 120, the convolution neural network 100 is not sufficient to output the required output information. Because as before, the convolution layer / pooling layer 120 only extracts features and reduces the parameters brought by the input image. However, in order to generate the final output information (the required class information or other relevant information), the convolution neural network 100 needs to use the neural network layer 130 to generate one or a group of outputs of the required number of classes. Therefore, the neural network layer 130 may include multiple hidden layers (131, 132 to 13n as shown in Figure 1) and an output layer 140. The parameters contained in the multiple hidden layers can be pre-trained based on relevant training data of a specific task type. For example, the task type may include image recognition, image classification, image super-resolution reconstruction, text classification, speech classification, etc.

[0105] After the multiple hidden layers in the neural network layer 130, that is, the last layer of the entire convolutional neural network 100 is the output layer 140. The output layer 140 has a loss function value similar to the classification cross entropy, which is specifically used to calculate the prediction error. Once the forward propagation of the entire convolutional neural network 100 (the propagation from 110 to 140 in Figure 2 is forward propagation) is completed, the back propagation (the propagation from 140 to 110 in Figure 2 is back propagation) will begin to update the weight values ​​and biases of the aforementioned layers to reduce the loss of the convolutional neural network 100 and the error between the result output by the convolutional neural network 100 through the output layer and the ideal result.

[0106] It should be noted that the convolutional neural network 100 shown in Figure 1 is only an example of a convolutional neural network. In specific applications, the convolutional neural network can also exist in the form of other network prediction models. For example, as shown in Figure 2, multiple convolutional layers / pooling layers are run in parallel, and the extracted features are input into the full neural network layer 130 for processing.

[0107] (4) Recurrent Neural Network (RNN)

[0108] A recurrent neural network is a type of recursive neural network that takes sequence data as input, performs recursion in the direction of sequence evolution, and all nodes (recurrent units) are connected in a chain-like manner.

[0109] Recurrent neural networks (RNNs) possess memory, parameter sharing, and Turing completeness, giving them advantages in learning nonlinear features of sequences. They 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 tasks. RNNs, constructed by incorporating convolutional neural networks, can handle computer vision problems involving sequential inputs.

[0110] RNNs are designed to process sequential data. In traditional neural network prediction models, each layer is fully connected, from the input layer to the hidden layer to the output layer, and the nodes within each layer are disconnected. However, these standard neural networks are inadequate for many problems. For example, to predict the next word in a sentence, you generally need to use the previous words, because the previous and next words in a sentence are not independent. RNNs are called recurrent neural networks because the current output of a sequence is dependent on the previous output. Specifically, the network remembers previous information and applies it to the calculation of the current output. In other words, the nodes between hidden layers are no longer disconnected but connected, and the input to a hidden layer includes not only the output of the input layer but also the output of the previous hidden layer. In theory, RNNs can process sequence data of any length. However, in practice, to reduce complexity, it is often assumed that the current state is only dependent on a few previous states.

[0111] Specifically, the core part of RNN is a directed graph. The chain-connected elements in the directed graph are called RNN cells. Generally, the chain connection composed of recurrent cells can be compared to the hidden layer in a feedforward neural network, but in different discussions, the "layer" of RNN may refer to the recurrent unit of a single time step or all recurrent units. Therefore, as a general introduction, the concept of "hidden layer" is avoided here. Given the learning data X = {X1, X2, ..., X τ}, the expansion length of the RNN is τ. The sequence to be processed is usually a time series, and the direction of sequence evolution is called the time step.

[0112] (5) Residual Network (ResNet)

[0113] Residual networks are an improved form of convolutional neural networks that are easy to optimize and can improve accuracy by increasing their depth. The residual blocks within residual networks use skip connections, which alleviates the vanishing gradient problem associated with increasing the depth of deep neural networks.

[0114] (6) Loss function

[0115] During neural network training, the goal is to ensure that the network's output is as close as possible to the desired target value. This is done by comparing the network's predictions with the desired target value and then updating the weight vectors of each layer based on the difference between the two. (Of course, before the first update, there's usually an initialization process, which pre-configures the parameters for each layer in the neural network.) For example, if the network's prediction is too high, the weight vectors are adjusted to predict a lower value. This adjustment is repeated until the network can predict the desired target value, or a value very close to it. Therefore, it's necessary to predefine how to compare the difference between the predicted and target values. This is known as the loss function, or objective function. These are important equations used to measure the difference between the predicted and target values. For example, a higher loss function output (i.e., the loss function value) indicates a greater difference, so neural network training becomes a process of minimizing this loss function value.

[0116] (7) Backpropagation algorithm

[0117] Neural networks can use the back propagation (BP) algorithm to correct the size of the parameters in the initial prediction model during training, reducing the error loss of the prediction model. Specifically, the forward propagation of the input signal to the output generates error loss. This error loss information is then backpropagated to update the parameters in the initial prediction model, thereby converging the error loss. The BP algorithm is a backward propagation movement dominated by error loss, aiming to obtain the optimal prediction model parameters, such as the weight matrix.

[0118] (8) Gradient descent

[0119] Gradient descent is a first-order optimization algorithm commonly used in machine learning to recursively approximate minimum-deviation prediction models. To find a local minimum of a function using gradient descent, an iterative search must be performed toward a point on the function at a specified step distance in the opposite direction of the gradient (or approximate gradient) corresponding to the current point. Gradient descent is one of the most commonly used methods for solving unconstrained optimization problems, such as predictive model parameters in machine learning algorithms.

[0120] Specifically, when solving for the minimum value of the loss function, we can use the gradient descent method to iterate step by step to obtain the minimized loss function value and prediction model parameter value. Conversely, if we need to solve for the maximum value of the loss function, we need to use the gradient ascent method to iterate.

[0121] AI-generated data is increasingly being used in our daily lives. This data can include text, images, video, and voice. Taking AI-generated text as an example, AI-generated text detection has become a crucial technology to prevent the negative consequences of AI-generated spam or misinformation. AI-generated text detection primarily distinguishes whether the text being tested is human-generated or AI-generated.

[0122] Existing AI-generated text detection solutions typically use binary classification techniques. The text to be tested is fed into a pre-trained model, which then outputs a final prediction: whether the text is human-generated or AI-generated. However, existing technologies have certain requirements for the length of the input text, making it difficult to accurately predict short text.

[0123] The applicant's research found that the existing AI-generated data detection scheme ignores the relationship between the data volume and detection difficulty of the data to be detected. For example, in AI-generated text detection, the length of the text to be detected will have a certain impact on the detection difficulty. Specifically, as the length of the text decreases, the text generated by AI and the text generated by humans will become more and more similar, resulting in greater difficulty in detecting AI-generated text; in extreme cases, when the text is the length of a single word or phrase, it is almost impossible to objectively judge whether the source of the text of a single word or phrase is AI or human. In this case, if the shorter text is simply marked as AI-generated, it will affect the text detection model's perception of the style of the AI-generated text, resulting in poor prediction results of the text detection model.

[0124] In addition to detecting AI-generated text, similar problems exist when using existing technologies to detect other AI-generated data. For ease of description, the embodiments of this application use AI-generated text detection as an example. The problems encountered when detecting other AI-generated data are similar and will not be described in detail here.

[0125] In view of this, an embodiment of the present application provides a training method for a classification model, which first generates target training data with a smaller data volume based on the original training data to obtain training data of different scales, thereby ensuring the scale diversity of the training data; and, taking into account the characteristics of AI-generated data, for target training data with a smaller data volume and originally generated by AI, this part of the target training data is marked as unlabeled data, thereby enabling the classification model to focus on data generated by AI that is different from artificial generation during training, avoiding affecting the classification model's perception of the style of AI-generated data when it is marked as AI-generated data, thereby effectively improving the prediction accuracy of the classification model.

[0126] For ease of understanding, the following first introduces the training method of the classification model provided in the embodiment of the present application and the system architecture used by the classification method.

[0127] Referring to Figure 3 , an embodiment of the present application provides a schematic diagram of a system architecture 300. As shown in Figure 3 , 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, and load balancers. The execution device 210 can be deployed at a single physical site or distributed across multiple physical sites. The execution device 210 can use data in the data storage system 250 or invoke program code in the data storage system 250 to implement the classification model training method provided in the embodiment of the present application, thereby obtaining a model.

[0128] Users can operate their respective user devices (e.g., local device 301 and local device 302) to interact with execution device 210. Each local device can represent any computing device, such as a personal computer, a computer workstation, a smartphone, a tablet computer, a smart camera, a smart car or other type of cellular phone, a media consumption device, a wearable device, a set-top box, a game console, etc.

[0129] Each user's local device can interact with the execution device 210 through a communication network of any communication mechanism / communication standard. The communication network can be a wide area network, a local area network, a point-to-point connection, etc., or any combination thereof.

[0130] In one implementation, the execution device 210 is used to implement the training method of the classification model provided in the embodiment of the present application, and send the obtained model to the local device 301 and the local device 302 through the communication network, so that the local device 301 and the local device 302 can deploy and run the model, thereby implementing the classification method provided in the embodiment of the present application.

[0131] In another implementation, one or more aspects of the execution device 210 can be implemented by each local device. For example, the local device 301 can 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 embodiment of the present application.

[0132] It should be noted that all functions of the execution device 210 can also be implemented by local devices. For example, the local device 301 implements the functions of the execution device 210 and provides services to its own users, or provides services to the users of the local device 302.

[0133] In general, the classification model training method and classification method provided in the embodiments of the present application can be applied to electronic devices, such as the execution device 210, local device 301, or local device 302 described above. For example, the electronic device can be, for example, a server, a wireless electronic device in industrial control, a smartphone (mobile phone), a personal computer (PC), a laptop computer, a tablet computer, and the like. For ease of understanding, the method provided in the embodiments of the present application will be described below using the application of the method provided in the embodiments of the present application to a server as an example.

[0134] Please refer to Figure 4, which is a schematic diagram of the structure of an electronic device 101 provided in an embodiment of the present application. As shown in Figure 4, electronic device 101 includes a processor 103, which is coupled to a system bus 105. Processor 103 can be one or more processors, each of which can include one or more processor cores. A display adapter (video adapter) 107 can drive a display 109, which is coupled to system bus 105. System bus 105 is coupled to an input / output (I / O) bus via a bus bridge 111. An I / O interface 115 is coupled to the I / O bus. The I / O interface 115 communicates with various I / O devices, such as an input device 117 (e.g., a touch screen), an external memory 121 (e.g., a hard disk, floppy disk, optical disk, or USB flash drive), a multimedia interface, etc., a transceiver 123 (capable of sending and / or receiving radio communication signals), a camera 155 (capable of capturing still and dynamic digital video images), and an external USB port 125. Optionally, the interface connected to the I / O interface 115 may be a USB interface.

[0135] The processor 103 may be any conventional processor, including a reduced instruction set computing (RISC) processor, a complex instruction set computing (CISC) processor, or a combination thereof. Alternatively, the processor may be a dedicated device such as an ASIC.

[0136] 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 card. Network 127 can be an external network, such as the Internet, or an internal network, such as Ethernet or a virtual private network (VPN). Alternatively, network 127 can be a wireless network, such as a WiFi network or a cellular network.

[0137] The hard drive interface 131 is coupled to the system bus 105. The hard drive interface is connected to the hard drive 133. The internal memory 135 is coupled to the system bus 105. The data running in the internal memory 135 may include the operating system (OS) 137 of the electronic device 101, the application 143, and the scheduler.

[0138] The operating system consists of a shell 139 and a kernel 141. Shell 139 is an interface between the user and the operating system's kernel. The shell is the outermost layer of the operating system. The shell manages the interaction between the user and the operating system: it waits for user input, interprets user input to the operating system, and processes various operating system output.

[0139] The kernel 141 consists of the parts of the operating system that manage memory, files, peripherals, and system resources. The kernel 141 directly interacts with the hardware. The operating system kernel typically runs processes and provides inter-process communication, CPU time slice management, interrupts, memory management, and I / O management.

[0140] Please refer to Figure 5, which is a flow chart of a classification model training method provided in an embodiment of the present application. As shown in Figure 5, the classification model training method includes the following steps 501-504.

[0141] Step 501: Acquire multiple original training data, where the category label corresponding to each original training data in the multiple original training data is user-generated data or AI-generated data.

[0142] In this embodiment, the multiple original training data are all of the same type of data. For example, the data type of the multiple original training data is any one of the following types: text, image, video, and voice.

[0143] For any one of the multiple original training data, the original training data may be user-generated (i.e., manually generated) or AI-generated (e.g., generated by an AI model), i.e., the original training data is generated in a manner that is either user-generated or AI-generated. Furthermore, not all of the data in the multiple original training data corresponds to the same generation method, i.e., some of the data in the multiple original training data is user-generated, while another portion of the data in the multiple original training data is AI-generated.

[0144] Therefore, when categorizing multiple raw training data sets using a data generation method, the category label corresponding to each raw training data set is either user-generated data or AI-generated data. When the category label corresponding to raw training data is user-generated data, it indicates that the raw training data was generated by the user; when the category label corresponding to raw training data is AI-generated data, it indicates that the raw training data was generated by AI.

[0145] In the case where the original training data is user-generated data, if the original training data is text, the original training data may specifically be text edited by the user; if the original training data is an image, the image may be an image obtained by the user through photographing, drawing, or artificial synthesis; if the original training data is a video, the video may be a video obtained by the user through creation, recording, or editing; if the original training data is speech, the video may be speech obtained by the user through creation or recording. In general, the embodiments of the present application do not limit how the user generates the original training data.

[0146] In step 502, a plurality of target training data are obtained based on the plurality of original training data, wherein a first portion of the plurality of target training data belongs to the plurality of original training data, and each target training data in a second portion of the plurality of target training data is obtained from a corresponding original training data in the plurality of original training data, and the data volume of each target training data is smaller than the data volume of the corresponding original training data.

[0147] In this embodiment, the first portion of the target training data belongs to the original training data, which means that the first portion of the target training data is a subset of the original training data. That is, in this embodiment, a portion of the original training data may be used as the first portion of the target training data; or, the original training data may be used as the first portion of the target training data. For example, if the original training data includes 10,000 data items, the first portion of the target training data may include a portion of the 10,000 data items, such as 5,000 data items; or, the first portion of the target training data may be the 10,000 data items.

[0148] In addition, each target training data in the second part of the plurality of 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.

[0149] In the second portion of the plurality of target training data, different target training data may correspond to different original training data, i.e., one original training data corresponds to only one target training data; or different target training data may correspond to the same original training data, i.e., one original training data may correspond to one or more target training data. Furthermore, the second portion of the plurality of target training data may correspond to all of the original training data, i.e., each original training data is used to generate the corresponding target training data; or the second portion of the plurality of target training data may correspond to a portion of the original training data, i.e., only a portion of the original training data is used to generate the corresponding target training data.

[0150] In general, among multiple target training data, the first part of the data can be a part of the data or all of the data in the multiple original training data; the second part of the data in the multiple target training data can be obtained based on a part of the data or all of the data in the 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.

[0151] For example, please refer to Figures 6A and 6B. Figure 6A is a schematic diagram of obtaining multiple target training data based on multiple original training data according to an embodiment of the present application; Figure 6B is another schematic diagram of obtaining multiple target training data based on multiple original training data according to an embodiment of the present application. As shown in Figure 6A, the multiple original training data include 2N data in total, specifically: data 1, data 2, data 3...data 2N. When obtaining multiple target training data based on the multiple original training data, the first part of the data in the multiple target training data includes N data, specifically: data 1, data 2...data N, that is, the first part of the data in the multiple target training data is N data in the multiple original training data. In addition, the second part of the data in the multiple target training data also includes N data, specifically: data N+1', data N+2'...data 2N', where data N+1' corresponds to data N+1 in the multiple original training data, data N+2' corresponds to data N+2 in the multiple original training data...data 2N' corresponds to data 2N in the multiple original training data. That is, each original training data from data N+1 to data 2N in the plurality of original training data corresponds to a unique target training data.

[0152] As shown in FIG6B , the multiple original training data include a total of 2N data, specifically: data 1, data 2, ... data 2N. When multiple target training data are obtained based on the multiple original training data, the first portion of the data in the multiple target training data also includes 2N data, specifically: data 1, data 2, ... data 2N. That is, the first portion of the data in the multiple target training data is the multiple original training data. In addition, the second portion of the data in the multiple target training data includes 2N groups of data, each group of data includes multiple target training data, and the different target training data in the same group of data are all obtained based on the same original training data. Specifically, in the second portion of the data, data A1, data B1, and data C1 in group 1 are all obtained from data 1 in the multiple original training data; data A2, data B2, and data C2 in group 2 are all obtained from data 2 in the multiple original training data... and so on. Data A2N, data B2N, and data C2N in group 2N are all obtained from data 2N in the multiple original training data. That is, each of the multiple original training data can be used to generate multiple target training data.

[0153] The above describes the process of obtaining multiple target training data. The following describes the specific method of obtaining target training data based on the original training data.

[0154] There are many ways to obtain target training data based on original training data, and each method needs to ensure that the amount of target training data obtained is smaller than the amount of data 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.

[0155] In a possible implementation, the corresponding target training data is obtained by cropping the original training data, and the target training data only includes a portion of the content of the original training data.

[0156] For example, the second portion of data 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 example, assuming that 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?", the first target training data may be obtained by cropping the text content, such as the text content of the first target training data is "How are you! I am fine, thank you! And you?". Similarly, assuming that the original training data corresponding to the first target training data is video or voice, a shorter first target training data may be obtained by cropping a portion of the video or voice. For another example, assuming that the original training data corresponding to the first target training data is an image, a portion of the image block may be cropped to obtain first target training data containing fewer pixels (i.e., containing less image content). In addition, the cropped image may be rotated, enlarged, or reduced to increase image diversity.

[0157] In another possible implementation, the original training data is cropped and the cropped content is fused to obtain the corresponding target training data.

[0158] Exemplarily, the second part of the data includes second target training data, and the second target training data is obtained by fusing multiple parts of content obtained by cropping the original training data corresponding to the second target training data. In particular, when fusing multiple parts of content, not all the cropped contents are fused, but only part of the contents are fused, so that the amount of data of the obtained second target training data can be smaller than the corresponding original training data. In addition, there can be multiple ways of fusion processing, such as directly splicing multiple parts of content, or performing simple processing on the multiple parts of content before splicing. Optionally, in the process of splicing multiple parts of content, the order of the multiple parts of content can be swapped before splicing the multiple parts of content, or the multiple parts of content can be spliced ​​according to the order in which the multiple parts of content appear in the original training data.

[0159] For example, assuming that 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?", the text content of the original training data can be first cut into the following multiple parts: "Hello!", "How are you!", "I am fine, thank you!", "And you?", and then some of the multiple parts are concatenated to obtain the first target training data. For example, the text content of the first target training data is "Hello! I am fine, thank you! And you?".

[0160] In general, for target training data obtained based on original training data, the target training data includes at least a portion of the corresponding original training data, or the target training data includes data obtained based on a portion of the corresponding original training data.

[0161] This approach, on the one hand, processes the original training data to obtain smaller target training data. On the other hand, by using part of the original training data as target training data, it is possible to perform multi-scale amplification on the original training data, thereby ensuring that the resulting target training data has a variety of scales. Scale diversity in target training data can mean that different target training data have different data sizes, such as different texts of different lengths, different videos or audios of different durations, and different images of different sizes.

[0162] Step 503: Input the multiple target training data into the classification model to obtain multiple classification results corresponding to the multiple target training data.

[0163] In this embodiment, the classification model can be an AI model that performs a binary classification task, and is used to perform classification prediction on the input data of the classification model. In addition, the structure of the classification model can be determined based on the type of input data of the classification model, and this embodiment does not specifically limit this. For example, when the input data of the classification model is an image or video, the structure of the classification model can specifically include a convolutional neural network; when the input data of the classification model is text or speech, the structure of the classification model can specifically include an RNN or an attention network.

[0164] Therefore, after inputting multiple target training data into the classification model, the classification model can predict the classification results corresponding to each target training data, thereby obtaining multiple classification results corresponding to the multiple target training data. Each of the multiple classification results is used to indicate the category to which the corresponding target training data belongs, that is, whether the target training data belongs to user-generated data or AI-generated data.

[0165] Step 504: Update the first model based on the loss function value to obtain a second model. The loss function value is obtained based on multiple classification results and category labels corresponding to multiple target training data, wherein some target training data in the second part of the data does not have a category label, the data volume of this part of the target training data is less than a preset threshold and the corresponding original training data is generated by AI.

[0166] After obtaining the classification results corresponding to each target training data, a loss function can be constructed based on the multiple classification results and the category labels corresponding to the target training data, thereby updating the first model based on the value of the constructed loss function to achieve training of the first model. The method of updating the first model based on the loss function value can be to use a backpropagation algorithm.

[0167] Generally speaking, the loss function can be constructed based on the difference between the category label corresponding to the target training data input into the classification model and the classification result actually output by the classification model.

[0168] It is worth noting that for the multiple target training data input into the classification model, some of the target training data in the second part of the multiple target training data are not marked with category labels, and the data volume of this part of the target training data is less than the preset threshold and the corresponding original training data is generated by AI, that is, this part of the target training data is data with a small data volume (such as short text, video or voice, or images with less content). Since the data volume of this part of the target training data is small, even if this part of the target training data itself is obtained by processing the original training data generated by AI, this part of the target training data is already highly similar to the user-generated data, and it is actually difficult to determine whether this part of the target training data should be attributed to AI generation.

[0169] Therefore, in this embodiment, when calculating the loss function value, it is necessary to regard part of the target training data in the second part of the data as unlabeled data to avoid directly marking this part of the target training data as AI-generated data.

[0170] In addition, among the multiple target training data, since the target training data in the first part of the data is actually a subset of the multiple original training data, the category labels of the target training data in the first part of the data remain unchanged; the other part of the target training data in the second part of the data is obtained based on the corresponding original training data, so the category labels of this part of the target training data can be the same as the category labels of the corresponding original training data. Simply put, if the category label of an original training data is user-generated data, then the category label of the target training data whose data volume is greater than or equal to the preset threshold based on the original training data can also be user-generated data; if the category label of an original training data is AI-generated data, then the category label of the target training data whose data volume is greater than or equal to the preset threshold based on the original training data can also be AI-generated data.

[0171] For example, please refer to Figure 7, which is a schematic diagram of determining the category labels of multiple target training data according to an embodiment of the present application. As shown in Figure 7, the multiple original training data includes a total of 2N data, specifically: Data 1, Data 2, ... Data 2N. Furthermore, the category labels of Data 1 through Data N are all user-generated data, while the category labels of Data N+1 through Data 2N are all AI-generated data.

[0172] Since the first part of the target training data 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.

[0173] Furthermore, the second portion of the target training data includes 2N groups of data. Data A1, data B1, and data C1 in group 1 are all derived from data 1 in the original training data. Data A2, data B2, and data C2 in group 2 are all derived from data 2 in the original training data. Similarly, data A2N, data B2N, and data C2N in group 2N are all derived from data 2N in the original training data. Since the target training data in groups 1-N are derived from data 1 to data N in the original training data, the category labels of the target training data in groups 1-N remain unchanged, indicating that they are user-generated data. In addition, for the N+1th to 2Nth groups of data, the category labels of the original training data corresponding to these N groups of data are all AI-generated data, and the data volume of the first data in each group of data (i.e., data AN+1, data AN+2…data A2N) is less than the preset threshold. Therefore, the first data in each group of data in the N+1th to 2Nth groups of data is marked as unlabeled data, that is, it does not have a category label; and the other data in the N+1th to 2Nth groups of data whose data volume is not less than the preset threshold are marked as AI-generated data, that is, the category labels are the same as the category labels of the corresponding original training data.

[0174] In this solution, we first generate target training data with a smaller amount of data based on the original training data to obtain training data of different scales, thereby ensuring the scale diversity of the training data. Furthermore, considering the characteristics of AI-generated data, for target training data with a smaller amount of data and originally generated by AI, this part of the target training data is marked as unlabeled data, thereby enabling the classification model to focus on data generated by AI that is different from that generated manually 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, thereby effectively improving the prediction accuracy of the classification model.

[0175] Exemplarily, please refer to Figure 8, which is a schematic diagram of the training process of a classification model provided in an embodiment of the present application. As shown in Figure 8, in the process of training the classification model, the training of the classification model can be achieved based on the model training architecture. Among them, the model training architecture includes a data amplification module and a model training module. By inputting the original training data into the data amplification module, the data amplification module can process the original training data, thereby outputting training data with a smaller data volume than the original training data (i.e., the second part of the multiple target training data described in step 502 above). That is, the data amplification module is used to perform the above-mentioned step 502. Then, the original training data and the training data output by the data amplification module are input into the model training model together, and the model training module trains the classification model based on the input data to obtain a trained classification model (i.e., the second model mentioned above). That is, the model training module is used to perform the above-mentioned steps 503 and 504.

[0176] For ease of understanding, the specific process of obtaining the loss function value is introduced below.

[0177] Optionally, the loss function value used to update the first model can be specifically obtained based on the first sub-loss function value and the second sub-loss function value.

[0178] The first sub-loss function value is obtained based on a first difference and a second difference. The first difference is the difference between the classification results corresponding to target training data without a category label and the category label assumed for the target training data. The second difference is the difference between the classification results corresponding to positive sample training data in the multiple target training data and the category label assumed for the positive sample data. 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 target training data whose category labels are user-generated data.

[0179] Simply put, the first sub-loss function value can be understood as the positive and unlabeled (Positive-Unlabeled, PU) loss, which is obtained based on positive samples (i.e., target training data whose category labels are user-generated data) and unlabeled samples (i.e., target training data without category labels).

[0180] Please refer to Figure 9, which is a schematic diagram of the division of positive samples, unlabeled samples and negative samples provided in an embodiment of the present application. As shown in Figure 9, first, for a plurality of target training data obtained based on a plurality of original training data, first, based on the original training data corresponding to each target training data, the target training data whose corresponding original training data is user-generated data is marked as a positive sample, and the target training data whose corresponding original training data is AI-generated data is marked as a negative sample. Then, based on the data volume of the target training data, a part of the target training data is divided from the negative samples and marked as unlabeled samples. Specifically, among the originally marked negative samples, the target training data whose data volume is less than the preset threshold is re-labeled as an unlabeled sample, while the target training data whose data volume is not less than the preset threshold is retained as a negative sample. Therefore, the unlabeled sample is actually the AI-generated data whose data volume is less than the preset threshold, and the negative sample is the AI-generated data whose data volume is not less than the preset threshold.

[0181] Exemplarily, the method for obtaining the value of the first sub-loss function can be shown in the following formula 1.

[0182] in, Represents the first sub-loss function value (i.e. PU loss), π P represents the ratio of the positive sample to the sum of the positive sample and the unlabeled sample, Represents the difference value calculated based on the category label of the positive sample and the classification result corresponding to the positive sample, It represents the difference between the class label assumed for the unlabeled sample (i.e., AI-generated data) and the classification result corresponding to the unlabeled sample. It represents the difference between the assumed category label for the positive sample (i.e., AI-generated data) and the classification result corresponding to the positive sample.

[0183] In this solution, the target training data whose category labels are user-generated data are regarded as positive samples, and the target training data without category labels are regarded as unlabeled samples. The classification loss of negative samples is then estimated based on the positive samples and unlabeled samples. This allows the classification model to focus on data generated by AI that is different from artificially generated data during training, avoiding the impact of directly labeling target training data with a small amount of data and originally generated by AI as negative samples on the classification model's perception of the style of AI-generated data, thereby effectively improving the prediction accuracy of the trained classification model.

[0184] Furthermore, the second sub-loss function value is derived based on the mean difference between the multiple classification results and the category labels corresponding to the multiple target training data. Furthermore, in determining the second sub-loss function value, the category labels corresponding to some of the target training data are AI-generated data.

[0185] That is, when calculating the second sub-loss function value, the corresponding category labels can also be assumed for the portion of target training data that does not have category labels, and the loss function value is then calculated based on the assumed category labels for this portion of target training data and the classification results corresponding to this portion of target training data. The assumed category labels for the portion of target training data that does not have category labels are also AI-generated data.

[0186] Simply put, the value of the second sub-loss function can be understood as positive-negative (PN) loss, which is obtained based on positive samples (i.e., target training data whose category labels are user-generated data) and negative samples (i.e., target training data whose category labels are AI-generated data).

[0187] Exemplarily, the second sub-loss function value may be obtained as shown in the following formula 2.

[0188] in, represents the value of the second sub-loss function (i.e. PN loss), E[·] represents the Find the total expected value, Represents the difference value calculated based on the category label of the positive sample and the classification result corresponding to the positive sample, Represents the difference value calculated based on the category label of the positive sample and the classification result corresponding to the positive sample.

[0189] 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 weightedly 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.

[0190] Exemplarily, a method for obtaining the loss function value based on the first sub-loss function value and the second sub-loss function value is shown in Formula 3.

[0191] in, represents the loss function value, represents the first sub-loss function value, represents the value of the second sub-loss function, and γ is a hyperparameter (i.e., the weight corresponding to the value of the first sub-loss function). In general, PU loss is equivalent to the regularization term of PN classification, which can be used to correct the classification bias of the classification model for small amounts of training data.

[0192] The above describes the process of training a classification model. The following describes the process of classifying data based on the trained classification model.

[0193] Please refer to Figure 10, which is a flow chart of a classification method provided in an embodiment of the present application. As shown in Figure 10, the classification method includes the following steps 1001-1004.

[0194] Step 1001: Obtain data to be classified.

[0195] In this embodiment, the data to be classified can be any of the following types: text, image, video, and voice. In addition, the data to be classified is data that needs to be classified, that is, it is necessary to determine whether the data to be classified is user-generated data or AI-generated data.

[0196] For example, in the news field, news organizations may receive a large amount of news materials (such as text, images, videos, or voice) contributed by users. News organizations need to classify these news materials to determine which of these news materials are generated by users and which are generated by AI, and then further verify the authenticity of the news materials.

[0197] 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 smaller than the data volume of the data to be classified.

[0198] In this embodiment, there are multiple ways to generate target data based on the data to be classified. Each method must ensure that the amount of target data generated is smaller than the amount of data to be classified. That is, the target data contains less content than the data to be classified. Furthermore, each of the at least one target data is generated based on a portion of the content of the data to be classified.

[0199] Optionally, in at least one target data, different target data have different data volumes. That is, when multiple target data are generated based on the data to be classified, the generated multiple target data each have different data volumes, thereby ensuring data scale diversity. For example, when the data to be classified is text data, multiple texts of different lengths may be generated as target data.

[0200] In one possible implementation, the corresponding target data may be obtained by clipping the data to be classified, and the target data may include only a portion of the data to be classified. For example, at least one target data may include first target data, and the first target data may be obtained by clipping a portion of the data to be classified.

[0201] In another possible implementation, the target data may be obtained by cropping the data to be classified and fusing the resulting cropped content. For example, at least one target data may include second target data, which is obtained by fusing multiple portions of content obtained by cropping the data to be classified.

[0202] 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.

[0203] In general, for target data obtained based on the data to be classified, the target data includes at least a portion of the content of the data to be classified, or the target data includes data obtained based on a portion of the content of the data to be classified.

[0204] For example, please refer to Figures 11 and 12. Figure 11 is a schematic diagram of a data classification architecture provided in an embodiment of the present application, and Figure 12 is a schematic diagram of a process for classifying data provided in an embodiment of the present application. As shown in Figure 11, the classification method in this embodiment can be implemented based on a data classification architecture, which includes a data amplification module and a classification module. Among them, the data amplification module is used to execute step 1002, that is, the input of the data amplification module is the data to be classified, and the output is one or more target data with a smaller data volume than the data to be classified.

[0205] As shown in Figure 12, assuming that the data to be classified is text, and the text content of the data to be classified is specifically "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, and the text contents of the two target data are "How are you! I am fine, thank you! And you?" and "I am fine, thank you! And you?" respectively.

[0206] Step 1003: input the data to be classified and at least one target data into a classification model to obtain corresponding multiple classification results.

[0207] In this embodiment, the classification model can specifically be a model trained based on the classification model training method described above (i.e., the second model described in step 504 above). The classification model can be used to classify input data to determine the category to which the input data belongs.

[0208] Therefore, in this embodiment, after the data to be classified and at least one target data are respectively input into the classification model, the classification model can output the classification results corresponding to each input data, thereby obtaining multiple classification results. The multiple classification results correspond to the data to be classified and the at least one target data. Furthermore, each classification result is used to indicate whether the input data belongs to either "user-generated data" or "AI-generated data."

[0209] As shown in Figure 12, after the data to be classified and the two target data are input 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".

[0210] Step 1004: obtaining a target classification result based on the multiple classification results. The target classification result is used as the classification result of the data to be classified.

[0211] When multiple classification results are obtained based on the classification model, the multiple classification results can be combined to obtain a target classification result, which is used as the final classification result of the data to be classified.

[0212] In this scheme, by amplifying the data to be classified, multiple target data with smaller data volumes are obtained, and then the data to be classified and the target data are input into the classification model for classification together, and 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-making of the classification model from a multi-scale perspective, thereby improving the classification accuracy of the data.

[0213] There are many ways to obtain a target classification result based on multiple classification results.

[0214] In one possible implementation, a weighted sum of multiple classification results may be performed to obtain a target classification result, wherein the weight corresponding to each classification result may be the same or different.

[0215] Optionally, the weight of each classification result among the multiple classification results is related to the data volume of the model input data corresponding to each classification result. For example, the weight of each classification result is positively correlated with the data volume of the model input data corresponding to each classification result, that is, the larger the data volume of the model input data, the larger the weight of the classification result corresponding to the model input data. In this way, the classification result corresponding to the data to be classified with the largest data volume can have the largest weight, so that in the process of determining the target classification result, more attention is paid to the classification result corresponding to the original data to be classified.

[0216] It should be noted that in the process of weighted summation of multiple classification results, the classification categories indicated by the multiple classification results (such as "user-generated data" or "AI-generated data") can be directly weighted summed. For example, in Figure 12, the first two classification results output by the classification model are both "AI-generated data", and the last classification result is "user-generated data". When the same weight is given to each classification result, the classification results under each type can be weighted summed to determine that the "AI-generated data" with the larger sum value is the final target classification result.

[0217] In addition, since the classification model actually outputs the category corresponding to each category first when determining the classification result, each classification result actually includes the predicted probability of each category. Therefore, when performing weighted summation on multiple classification results, the predicted probability of each category in each classification result can be weighted summed to determine the category with the largest sum value as the final target classification result. For example, assuming that the classification model outputs three classification results, the predicted probability of the first classification result for the two categories of "user-generated data" and "AI-generated data" is (0.8, 0.2), the predicted probability of the second classification result for the two categories of "user-generated data" and "AI-generated data" is (0.7, 0.3), and the predicted probability of the third classification result for the two categories of "user-generated data" and "AI-generated data" is (0.4, 0.6). Then, if the weights of the three classification results are 0.5, 0.3, and 0.2, respectively, the weighted sum of the "user-generated data" category is 0.5*0.8+0.3*0.7+0.2*0.4=0.69, and the weighted sum of the "AI-generated data" category is 0.5*0.2+0.3*0.3+0.2*0.6=0.31. Clearly, the weighted sum of the "user-generated data" category is greater than the weighted sum of the "AI-generated data" category, so we can determine that the target classification result is "user-generated data."

[0218] In another possible implementation, the target classification result can be determined based on the proportion of each classification result type in multiple classification results. For example, if a certain classification result type accounts for the highest proportion among multiple classification results, then this classification result type is determined as the target classification result. For example, assuming that the classification model outputs a total of 5 classification results, 3 of which are "user-generated data" and the other 2 are "AI-generated data", then the classification result of the type "user-generated data" accounts for the highest proportion among multiple classification results, so "user-generated data" is used as the target classification result.

[0219] Taking text classification as an example, through experimental comparison, the classification method provided in the embodiment of the present application can have higher prediction accuracy on various corpora than the classification method of related technologies, as shown in Table 1.

[0220] Table 1

[0221] As can be seen from Table 1, the classification method provided in the embodiments of the present application has higher prediction accuracy for short texts and mixed long and short texts.

[0222] The above describes in detail the method provided by the embodiment of the present application. Next, the device provided by the embodiment of the present application for executing the above method will be introduced.

[0223] Please refer to Figure 13, which is a schematic diagram of the structure of a training device for a classification model provided in an embodiment of the present application. As shown in Figure 13, the training device for the classification model includes:

[0224] An acquisition module 1301 is configured to acquire a plurality of original training data, wherein the category label corresponding to each of the plurality of original training data is user-generated data or AI-generated data;

[0225] a processing module 1302 configured to obtain a plurality of target training data based on the plurality of original training data, wherein a first portion of the plurality of target training data belongs to the plurality of original training data, each target training data in a second portion of the plurality of target training data is obtained from a corresponding original training data in the plurality of original training data, and the data volume of each target training data is smaller than the data volume of the corresponding original training data;

[0226] The processing module 1302 is further configured to input the plurality of target training data into the classification model to obtain a plurality of classification results corresponding to the plurality of target training data;

[0227] Processing module 1302 is also used to update the first model based on the loss function value to obtain a second model, where the loss function value is obtained based on multiple classification results and category labels corresponding to multiple target training data, wherein some target training data in the second part of the data does not have a category label, the data volume of some target training data is less than a preset threshold and the corresponding original training data is generated by AI.

[0228] In a possible implementation, the target training data in the second portion of data is obtained based on a portion of the corresponding original training data.

[0229] In a possible implementation, the second portion of data includes first target training data, and the first target training data is obtained by clipping part of the content in original training data corresponding to the first target training data.

[0230] In a possible implementation, the second portion of data includes second target training data, and the second target training data is obtained by fusing multiple portions of content obtained by cropping original training data corresponding to the second target training data.

[0231] In a possible implementation, the data type of the plurality of original training data is any one of the following types: text, image, video, and voice.

[0232] In a possible implementation, the loss function value is obtained based on a first sub-loss function value, and the first sub-loss function value is obtained based on a first difference and a second difference, wherein the first difference is a difference between a classification result corresponding to the portion of the target training data and a category label assumed for the target training data, and the second difference is a difference between a classification result corresponding to positive sample training data in the multiple target training data and the category label assumed for the positive sample data;

[0233] 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 target training data whose category labels are user-generated data.

[0234] In a possible implementation, the loss function value is further obtained based on a second sub-loss function value, where the second sub-loss function value is obtained based on a mean of differences between the multiple classification results and the category labels corresponding to the multiple target training data;

[0235] In the process of determining the value of the second sub-loss function, the category label corresponding to the part of the target training data is AI generated data.

[0236] In a possible implementation, the loss function value is obtained by weighted summing 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.

[0237] Please refer to Figure 14, which is a schematic diagram of the structure of a classification device provided in an embodiment of the present application. As shown in Figure 14, the classification device includes:

[0238] An acquisition module 1401 is used to acquire data to be classified;

[0239] A processing module 1402 is configured 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 smaller than the data volume of the data to be classified;

[0240] The processing module 1402 is further configured to input the data to be classified and at least one target data into the classification model to obtain corresponding multiple classification results;

[0241] The processing module 1402 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.

[0242] In a possible implementation, the processing module 1402 is further configured to perform weighted summation on multiple classification results to obtain a target classification result.

[0243] In a possible implementation, the weight of each classification result among the multiple classification results is related to the data volume of the model input data corresponding to each classification result.

[0244] In a possible implementation manner, in at least one target data, different target data have different data volumes.

[0245] In a possible implementation manner, each target data in the at least one target data is obtained based on a portion of content of the data to be classified.

[0246] In a possible implementation, the at least one target data includes first target data, and the first target data is obtained by clipping part of the content of the data to be classified.

[0247] In a possible implementation, at least one target data includes second target data, and the second target data is obtained by fusing multiple parts of content obtained by cropping the data to be classified.

[0248] Please refer to Figure 15, which is a structural diagram of an execution device provided in an embodiment of the present application. The execution device 1500 can be specifically manifested as a mobile phone, a tablet, a laptop computer, a smart wearable device, a server, etc., which is not limited here. Specifically, the execution device 1500 includes: a receiver 1501, a transmitter 1502, a processor 1503 and a memory 1504 (wherein the number of processors 1503 in the execution device 1500 can be one or more, and Figure 15 takes one processor as an example), wherein the processor 1503 may include an application processor 15031 and a communication processor 15032. In some embodiments of the present application, the receiver 1501, the transmitter 1502, the processor 1503 and the memory 1504 may be connected via a bus or other means.

[0249] 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 or extended sets thereof. The operation instructions may include various operation instructions for implementing various operations.

[0250] Processor 1503 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together via a bus system. In addition to a data bus, the bus system may also include a power bus, a control bus, and a status signal bus. However, for clarity, all bus systems are referred to as a bus system in the figure.

[0251] The method disclosed in the above embodiment of the present application can be applied to the processor 1503, or implemented by the processor 1503. The processor 1503 can be an integrated circuit chip with signal processing capabilities. During the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 1503 or the instructions in the form of software. The above-mentioned processor 1503 can be a general-purpose processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0252] The processor 1503 can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1504, and the processor 1503 reads the information in the memory 1504 and completes the steps of the above method in combination with its hardware.

[0253] Receiver 1501 can be used to receive input digital or character information and generate signal input related to executing device-related settings and function control. 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 pack through the first interface to modify data in the disk pack. Transmitter 1502 can also include a display device such as a display screen.

[0254] The electronic device provided in the embodiment of the present application may specifically be a chip, and the chip includes: a processing unit and a communication unit, the processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, a pin or a circuit, etc. The processing unit may execute the computer execution instructions stored in the storage unit, so that the chip in the execution device executes the method for determining the model structure described in the above embodiment, or so that the chip in the training device executes the method for determining the model structure described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit may also be a storage unit located outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.

[0255] Specifically, see Figure 16 , which is a schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip can be represented as a neural network processor NPU 1600. NPU 1600 is mounted on the host CPU (host CPU) as a coprocessor and is assigned tasks by the host CPU. The core of the NPU is arithmetic circuit 1603, which is controlled by controller 1604 to extract matrix data from memory and perform multiplication operations.

[0256] In some implementations, arithmetic circuit 1603 includes multiple processing units (PEs). In some implementations, arithmetic circuit 1603 is a two-dimensional systolic array. Arithmetic circuit 1603 can also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, arithmetic circuit 1603 is a general-purpose matrix processor.

[0257] For example, assume there are input matrix A, weight matrix B, and output matrix C. The arithmetic circuit retrieves the corresponding data of matrix B from weight memory 1602 and caches it on each PE in the arithmetic circuit. The arithmetic circuit retrieves the data of matrix A from input memory 1601 and performs a matrix operation on matrix B. The partial or final matrix result is stored in accumulator 1608.

[0258] Unified memory 1606 is used to store input and output data. Weight data is directly transferred to weight memory 1602 through the Direct Memory Access Controller (DMAC) 1605. Input data is also transferred to unified memory 1606 through the DMAC.

[0259] BIU stands for Bus Interface Unit 1610 , which is used for interaction between the AXI bus, DMAC, and instruction fetch buffer (IFB) 1609 .

[0260] The bus interface unit 1610 (BIU) is used for the instruction fetch memory 1609 to obtain instructions from the external memory, and is also used for the storage unit access controller 1605 to obtain the original data of the input matrix A or the weight matrix B from the external memory.

[0261] DMAC is mainly used to move input data in the external memory DDR to the unified memory 1606 or move weight data to the weight memory 1602 or move input data to the input memory 1601.

[0262] The vector calculation unit 1607 includes multiple operation processing units. When necessary, it further processes the output of the operation circuit 1603, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional / fully connected layer network calculations in neural networks, such as batch normalization, pixel-level summation, and upsampling of feature planes.

[0263] In some implementations, vector calculation unit 1607 can store the processed output vector to unified memory 1606. For example, vector calculation unit 1607 can apply a linear function or a nonlinear function to the output of operation circuit 1603, such as linear interpolation of the feature plane extracted by the convolution layer, or accumulate a vector of values ​​to generate an activation value. In some implementations, vector calculation unit 1607 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to operation circuit 1603, for example, for use in subsequent layers in a neural network.

[0264] An instruction fetch buffer 1609 connected to the controller 1604 is used to store instructions used by the controller 1604;

[0265] Unified memory 1606, input memory 1601, weight memory 1602, and instruction fetch memory 1609 are all on-chip memories. External memories are private to the NPU hardware architecture.

[0266] The processor mentioned in any of the above places can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.

[0267] Please refer to Figure 17, which is a schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of the present application. The present application also provides a computer-readable storage medium. In some embodiments, the method disclosed in Figure 5 above 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 products.

[0268] 17 schematically illustrates a conceptual partial view of an example computer-readable storage medium including a computer program for executing a computer process on a computing device, arranged in accordance with at least some embodiments presented herein.

[0269] In one embodiment, computer readable storage medium 1700 is provided using signal bearing medium 1701. Signal bearing medium 1701 may include one or more program instructions 1702 that, when executed by one or more processors, may provide the functionality or portions of the functionality described above with respect to FIG.

[0270] In some examples, the signal bearing medium 1701 may include a computer readable medium 1703 such as, but not limited to, a hard drive, a compact disk (CD), a digital video disk (DVD), a digital tape, a memory, a ROM or RAM, and the like.

[0271] In some embodiments, the signal-bearing 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, or the like. In some embodiments, the signal-bearing medium 1701 may include a communication medium 1705, such as, but not limited to, a digital and / or analog communication medium (e.g., a fiber optic cable, a waveguide, a wired communication link, a wireless communication link, or the like). Thus, for example, the signal-bearing medium 1701 may be communicated via a wireless form of the communication medium 1705 (e.g., a wireless communication medium conforming to the IEEE 802.11 standard or other transmission protocol).

[0272] The one or more program instructions 1702 may be, for example, computer-executable instructions or logic-implemented instructions. In some examples, the computing device may be configured to provide various operations, functions, or actions in response to the program instructions 1702 communicated to the computing device via one or more of computer-readable media 1703, computer-recordable media 1704, and / or communication media 1705.

[0273] It should also be noted that the device embodiments described above are merely illustrative, in which the units described as separate components may or may not be physically separate, and the components displayed 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 may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines.

[0274] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course can also be implemented by special hardware including application-specific integrated circuits, special CPUs, special memories, special components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits, etc. However, for the present application, software program implementation is a better implementation method in most cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods of each embodiment of the present application.

[0275] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0276] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a training device or a data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode to another website, computer, training device or data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center that includes one or more available media integrations. Available media can be magnetic media, (such as floppy disks, hard disks, tapes), optical media (such as DVDs), or semiconductor media (such as solid-state drives (SSDs)).

Claims

1. A classification model training method, characterized in that: include: Acquire multiple original training data, where the category label corresponding to each original training data in the multiple original training data is user-generated data or artificial intelligence (AI)-generated data; Based on the multiple original training data, a plurality of target training data are obtained, wherein a first portion of data of the multiple target training data belongs to the multiple original training data, each target training data in a second portion of data of the multiple target training data is obtained from a corresponding original training data in the multiple original training data, and the data amount of each target training data is less than the data amount of the corresponding original training data; Inputting 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; The first model is updated based on the loss function value to obtain a second model, wherein the loss function value is 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 data does not have a category label, the data amount of the some 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 data is obtained based on a part of the corresponding original training data.

3. The method according to claim 1 or 2, characterized in that: The second part of data includes first target training data, and the first target training data is obtained by cutting part of the content in the original training data corresponding to the first target training data.

4. The method according to any one of claims 1 to 3, characterized in that: The second part of data includes second target training data, and the second target training data is obtained by fusing multiple parts of content obtained by cutting out original training data corresponding to the second target training data.

5. The method according to any one of claims 1 to 4, characterized in that: The data type of the plurality of original training data is any one of the following types: text, image, video and voice.

6. The method according to any one of claims 1 to 5, characterized in that: The loss function value is obtained based on a first sub-loss function value, and the first sub-loss function value is obtained based on a first difference and a second difference, wherein the first difference is a difference between a classification result corresponding to the part of the target training data and a category label assumed for the target training data, and the second difference is a difference between a classification result corresponding to a positive sample training data in the multiple target training data and a category label assumed for the positive sample data; Among them, 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 target training data whose category labels are user-generated data.

7. The method according to claim 6, characterized in that The loss function value is also obtained based on a second sub-loss function value, and the second sub-loss function value is obtained based on a mean value of differences 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 label corresponding to the part of the target training data is AI generated data.

8. The method according to claim 7, characterized in that The loss function value is obtained by weighted summing 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.

9. A classification method, characterized in that include: Obtain data to be classified; generating 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 smaller than the data volume of the data to be classified; Inputting the data to be classified and the at least one target data into a classification model to obtain corresponding multiple classification results; Based on the multiple classification results, a target classification result is obtained, and the target classification result is used as the classification result of the data to be classified.

10. The method according to claim 9, characterized in that The step of obtaining a target classification result based on the multiple classification results includes: The multiple classification results are weighted and summed to obtain the target classification result.

11. The method according to claim 10, characterized in that The weight of each of the multiple classification results is related to the data volume of the model input data corresponding to each classification result.

12. The method according to any one of claims 9 to 11, characterized in that: Among the at least one target data, different target data have different data amounts.

13. The method according to any one of claims 9 to 12, characterized in that: Each target data of the at least one target data is obtained based on a portion of the content of the data to be classified.

14. The method according to any one of claims 9 to 13, characterized in that: The at least one target data includes first target data, and the first target data is obtained by cutting part of the content of the data to be classified.

15. The method according to any one of claims 9 to 14, characterized in that: The at least one target data includes second target data, and the second target data is obtained by fusing multiple parts of content obtained by cutting the data to be classified.

16. A training device for a classification model, characterized in that: include: An acquisition module, used to acquire a plurality of original training data, wherein a category label corresponding to each of the plurality of original training data is user-generated data or AI-generated data; a processing module, configured to obtain a plurality of target training data based on the plurality of original training data, wherein a first portion of data of the plurality of target training data belongs to the plurality of original training data, each target training data in a second portion of data of the plurality of target training data is obtained from a corresponding original training data in the plurality of original training data, and a data volume of each target training data is smaller than a data volume of a corresponding original training data; The processing module is further used to input the multiple target training data into a classification model to obtain multiple classification results corresponding to the multiple target training data; The processing module is also used to update the first model based on the loss function value to obtain a second model, wherein the loss function value is obtained based on the multiple classification results and the category labels corresponding to the multiple target training data, wherein some of the target training data in the second part of the data does not have a category label, the data volume of the some of the target training data is less than a preset threshold and the corresponding original training data is generated by AI.

17. The device according to claim 16, characterized in that The target training data in the second part of data is obtained based on a part of the corresponding original training data.

18. The device according to claim 16 or 17, characterized in that The second part of data includes first target training data, and the first target training data is obtained by cutting part of the content in the original training data corresponding to the first target training data.

19. The device according to any one of claims 16 to 18, characterized in that: The second part of data includes second target training data, and the second target training data is obtained by fusing multiple parts of content obtained by cutting out original training data corresponding to the second target training data.

20. A classification device, characterized in that: include: An acquisition module, used to acquire data to be classified; A processing module, configured 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 smaller than the data volume of the data to be classified; The processing module is further used to input the data to be classified and the at least one target data into a classification model to obtain corresponding multiple classification results; The processing module is further used 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.

21. The device according to claim 20, characterized in that The processing module is further used to perform weighted summation on the multiple classification results to obtain the target classification result.

22. The device according to claim 21, characterized in that The weight of each of the multiple classification results is related to the data volume of the model input data corresponding to each classification result.

23. The device according to any one of claims 20 to 22, characterized in that Among the at least one target data, different target data have different data amounts.

24. The device according to any one of claims 20 to 23, characterized in that: Each target data of the at least one target data is obtained based on a portion of the content of the data to be classified.

25. The device according to any one of claims 20 to 24, characterized in that The at least one target data includes first target data, and the first target data is obtained by cutting part of the content of the data to be classified.

26. The device according to any one of claims 20 to 25, characterized in that The at least one target data includes second target data, and the second target data is obtained by fusing multiple parts of content obtained by cutting the data to be classified.

27. A training device for a classification model, characterized in that: The device comprises a memory and a processor; the memory stores codes, the processor is configured to execute the codes, and when the codes are executed, the device executes the method according to any one of claims 1 to 8.

28. A classification device, characterized in that: The device comprises a memory and a processor; the memory stores codes, the processor is configured to execute the codes, and when the codes are executed, the device executes the method according to any one of claims 9 to 15.

29. A computer storage medium, characterized in that The computer storage medium stores instructions, which, when executed by a computer, cause the computer to implement the method of any one of claims 1 to 15.

30. A computer program product, characterized in that The computer program product stores instructions, which, when executed by a computer, cause the computer to implement the method according to any one of claims 1 to 15.

Citation Information

Patent Citations

  • Video classification model construction method and device, video classification method and device, equipment and medium

    CN110929780A

  • Image recognition method and device, electronic equipment and storage medium

    CN111814810A

  • Model training method and device, electronic equipment and storage medium

    CN112016633A

  • Method and device for training classification model of IA by combining RPA and AI

    CN115578739A

  • Classification model training method and related device

    CN116401552A

Cited By

  • System and method for detecting texts generated by artificial intelligence

    RU2852474C1