Sample enhancement method and device and related product
By combining a vector generation model and a sample augmentation agent, the problems of scarce sample quantity and low generalization ability are solved, thereby increasing the sample quantity and improving the generalization ability.
Patent Information
- Application Number
- CN202411139988.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2026-03-03
AI Technical Summary
In domains with a limited number of samples, existing sample augmentation methods can only generate samples with the same or similar semantics, resulting in a shortage of samples and low generalization ability.
By processing text samples through a vector generation model, target text samples similar to the sample vector to be enhanced are discovered. Then, an enhanced sample with the same type, similar semantics, and similar font type as the text sample to be enhanced is generated using a sample enhancement agent.
It increases the number of samples and improves the generalization ability of sample augmentation, enabling the generation of augmented samples that are more diverse than the text samples to be augmented.
Smart Images

Figure CN121599155A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of sample enhancement technology, and in particular to a sample enhancement method, apparatus and related products. Background Technology
[0002] In the field of machine learning, models are typically built using large-scale datasets. However, in certain domains, the scarcity of samples significantly impacts model accuracy. Current techniques such as EDA, back-translation, and GAN-based methods are commonly used to augment samples and improve model accuracy. However, these techniques can only generate semantically identical or similar samples based on existing ones, potentially leading to a persistent shortage of samples even after augmentation, and to some extent, low generalization ability of the augmented samples.
[0003] Therefore, how to enhance samples has become a pressing technical problem that needs to be solved in the field. Summary of the Invention
[0004] This application provides a sample enhancement method, apparatus, and related products, which aim to enhance samples.
[0005] The first aspect of this application provides a sample enhancement method, including:
[0006] Obtain multiple text samples and a text sample to be enhanced, wherein the text sample to be enhanced is any one of the multiple text samples;
[0007] The vector generation model is used to perform vector processing on the multiple text samples and the text sample to be enhanced, respectively, to generate text sample vectors corresponding to the multiple text samples and the text sample to be enhanced corresponding to the text sample to be enhanced, wherein the vector generation model is used to generate the sample vectors corresponding to the text samples.
[0008] Based on multiple text sample vectors and the sample vector to be enhanced, a target text sample vector similar to the sample vector to be enhanced is determined from among the multiple text sample vectors, and a target text sample corresponding to the target text sample vector is determined from among the multiple text samples based on the target text sample vector;
[0009] The target text sample is augmented by a sample augmentation agent to generate an augmented text sample corresponding to the target text sample. The augmented text sample includes augmented samples with the same sample type, similar semantics, and similar font type as the text sample to be augmented. The sample augmentation agent is used for sample augmentation of the text sample.
[0010] A second aspect of this application provides a sample enhancement device, comprising:
[0011] A text sample acquisition unit is used to acquire multiple text samples and a text sample to be enhanced, wherein the text sample to be enhanced is any one of the multiple text samples;
[0012] The sample vector processing unit is used to perform vector processing on the plurality of text samples and the text sample to be enhanced through a vector generation model, and generate text sample vectors corresponding to the plurality of text samples and the text sample to be enhanced corresponding to the text sample to be enhanced, wherein the vector generation model is used to generate sample vectors corresponding to the text samples.
[0013] The target text sample determination unit is configured to determine, based on multiple text sample vectors and the sample vector to be enhanced, a target text sample vector that is similar to the sample vector to be enhanced among the multiple text sample vectors, and based on the target text sample vector, determine the target text sample that corresponds to the target text sample vector among the multiple text samples;
[0014] A text enhancement sample generation unit is used to perform sample enhancement processing on the target text sample through a sample enhancement agent to generate a text enhancement sample corresponding to the target text sample. The text enhancement sample includes enhancement samples with the same sample type, similar sample semantics, and similar sample font type as the text sample to be enhanced. The sample enhancement agent is used for sample enhancement of the text sample.
[0015] A third aspect of this application provides a computer device, the device comprising a processor and a memory:
[0016] The memory is used to store computer programs and to transfer the computer programs to the processor;
[0017] The processor is configured to execute the steps of the sample enhancement method provided in the first aspect according to the instructions in the computer program.
[0018] A fourth aspect of this application provides a computer-readable storage medium for storing a computer program that, when executed by a computer device, implements the steps of the sample enhancement method provided in the first aspect.
[0019] The fifth aspect of this application provides a computer program product, including a computer program that, when executed by a computer device, implements the steps of the sample enhancement method provided in the first aspect.
[0020] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:
[0021] The technical solution of this application first obtains multiple text samples and text samples to be enhanced. Then, a vector generation model is used to process the multiple text samples and the text samples to be enhanced, generating text sample vectors corresponding to the multiple text samples and text sample vectors to be enhanced corresponding to the text samples to be enhanced. Based on the multiple text sample vectors and the text sample vectors to be enhanced, a target text sample vector similar to the text sample vector to be enhanced is determined. Based on the target text sample vector, a target text sample corresponding to the target text sample vector is determined. Finally, a sample enhancement agent performs sample enhancement processing on the target text sample, generating text-enhanced samples corresponding to the target text sample. The text-enhanced samples include enhanced samples with the same sample type, similar semantics, and similar font type as the text samples to be enhanced.
[0022] As can be seen, in this application, firstly, target text sample vectors similar to the sample vector to be enhanced are mined from multiple text sample vectors based on the method of generating sample vectors. Then, multiple text samples corresponding to the target text sample vector are determined based on the target text sample vector. Finally, a sample enhancement agent is used to enhance the target text samples to obtain enhanced samples with the same sample type, similar semantics, and similar font type as the text sample to be enhanced. In this way, this application can mine target text samples similar to the text sample to be enhanced from multiple text samples, and then perform sample enhancement on the mined target text samples. This not only mines samples from the sample vector aspect to increase the number of existing samples, but also enhances samples from the sample enhancement agent aspect, thereby improving the number of samples and the generalization ability of sample enhancement to a certain extent. Attached Figure Description
[0023] Figure 1 This is a schematic diagram of the back-translation method provided in related technologies;
[0024] Figure 2 This is a scenario architecture diagram of a sample augmentation method provided in the embodiments of this application;
[0025] Figure 3 A flowchart of a sample enhancement method provided in an embodiment of this application;
[0026] Figure 4 This application provides a flowchart of the initial model construction process in a sample augmentation method according to an embodiment of the present application.
[0027] Figure 5 This application provides a flowchart of vector generation for a generative model to be trained in a sample augmentation method.
[0028] Figure 6This application provides a flowchart of the training process for a vector generation model in a sample augmentation method.
[0029] Figure 7 A flowchart illustrating the training process of the vector generation model in another sample augmentation method provided in this application embodiment;
[0030] Figure 8 A flowchart illustrating the process of obtaining a target text sample vector in a sample enhancement method provided in this application embodiment;
[0031] Figure 9 A flowchart illustrating sample enhancement in a sample enhancement method provided in this application embodiment;
[0032] Figure 10 A flowchart of another sample enhancement method provided in this application embodiment;
[0033] Figure 11 This is an overall flowchart of a sample enhancement method provided in an embodiment of this application;
[0034] Figure 12 This is a schematic diagram of the structure of a sample enhancement device provided in an embodiment of this application;
[0035] Figure 13 This is a schematic diagram of the server structure in an embodiment of this application;
[0036] Figure 14 This is a schematic diagram of the structure of a terminal device in an embodiment of this application. Detailed Implementation
[0037] The embodiments of this application will now be described with reference to the accompanying drawings.
[0038] First, we will explain several terms that may be involved in the embodiments of this application below.
[0039] Black samples: Samples constructed using negative, anomalous, or undesirable data.
[0040] EDA stands for Easy Data Augmentation, a data augmentation technique for text classification.
[0041] GAN: Generative Adversarial Networks.
[0042] BERT: A pre-trained language model based on the Transformer architecture.
[0043] SimCSE: Simple Contrastive Learning of Sentence Embeddings.
[0044] LLM: Large Language Model, which is a large language model that operates on language features.
[0045] Multi-Agent: A multi-agent system is a group system composed of multiple agents. In a multi-agent system, the agents can coordinate with each other.
[0046] In the field of machine learning, models are typically built using large-scale datasets. However, in certain domains, the scarcity of samples significantly impacts model accuracy. For example, in black sample detection, models built with a limited number of black samples tend to have poor accuracy. Current technologies commonly employ EDA, back-translation, and GAN-based methods to augment samples and improve model accuracy. However, these solutions can only generate semantically identical or similar samples based on existing data. The following sections will introduce these related technologies.
[0047] In EDA, sample augmentation can be achieved through synonym replacement, random insertion, random swapping, and random deletion. For example, synonym replacement can replace "the weather is great" with "the weather is nice", random insertion can replace "the weather is great" with "the weather is nice", random swapping can replace "the weather is great" with "the weather is great", and random deletion can replace "the weather is great" with "the weather is good".
[0048] In back-translation, text data in the current language can be translated to obtain text data in another language, and then translated back into the current language to obtain text data that is semantically similar to the current language text data. For example... Figure 1 As shown, Figure 1 This is a schematic diagram of the back-translation method provided in related technologies. Figure 1 In Chinese, “This is very cool” can be translated back to “That’s very cool” using language 1, “This is very cool” can be translated back to “That’s cool” using language 2, and “This is very cool” can be translated back to “This is very nice” using language 3.
[0049] In GAN-based approaches, the generator and discriminator in the Generative Adversarial Network (GAN) can learn against each other, allowing the generator to produce text samples similar to real text samples. However, these techniques only augment black samples, and the augmented samples may still suffer from a limited number of samples. Furthermore, they can only generate semantically identical or similar samples, potentially leading to low generalization ability. Therefore, how to achieve effective sample augmentation has become a pressing technical problem in the field.
[0050] In view of the above problems, this application provides a sample enhancement method, apparatus, and related products, aiming to enhance samples. The technical solution provided in this application first obtains multiple text samples and text samples to be enhanced. Then, a vector generation model is used to process the multiple text samples and the text samples to be enhanced to generate text sample vectors corresponding to the multiple text samples and a sample vector to be enhanced corresponding to the text samples to be enhanced. Regarding sample mining of the sample vectors, based on the multiple text sample vectors and the sample vector to be enhanced, a target text sample vector similar to the sample vector to be enhanced is determined from among the multiple text sample vectors. Based on the target text sample vector, a target text sample corresponding to the target text sample vector is determined from among the multiple text samples. Finally, a sample enhancement agent performs sample enhancement processing on the target text sample to generate an enhanced sample with the same sample type, similar semantics, and similar font type as the text sample to be enhanced. Thus, in this application, target text samples similar to the text sample to be enhanced can be mined from multiple text samples, and then sample enhancement can be performed on the mined target text samples. In this way, the technical solution of this application can not only mine samples from the sample vector aspect to increase the number of existing samples, but also enhance samples from the sample enhancement agent aspect, so as to improve the number of samples and the generalization ability of sample enhancement to a certain extent.
[0051] The execution subject of the sample enhancement method provided in this application embodiment can be a terminal device. For example, multiple text samples and text samples to be enhanced can be obtained on the terminal device. As an example, the terminal device may include, but is not limited to, mobile phones, desktop computers, tablet computers, laptops, PDAs, smart voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc. The execution subject of the sample enhancement method provided in this application embodiment can also be a server, that is, multiple text samples and text samples to be enhanced can be obtained on the server. In addition, the sample enhancement method provided in this application embodiment can also be executed collaboratively by the terminal device and the server. The terminal and the server can be directly or indirectly connected through wired or wireless communication, which is not limited here. Therefore, the implementation subject of the technical solution of this application is not limited in this application embodiment.
[0052] Figure 2 An exemplary scenario architecture diagram of a sample augmentation method is shown. The diagram includes a server and various types of terminal devices, such as mobile phones, desktop computers, tablets, laptops, and PDAs, etc., which are not specifically limited here. For example, in this application, multiple text samples and text samples to be augmented can be obtained on the terminal devices, and then the server performs subsequent processing on the multiple text samples and text samples to be augmented. Figure 1 The server shown can be a standalone physical server, a server cluster consisting of multiple physical servers, or a distributed system. Additionally, the server can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0053] See Figure 3 This figure is a flowchart of a sample enhancement method provided in an embodiment of this application. Figure 3 The sample enhancement method shown includes the following steps:
[0054] S301: Obtain multiple text samples and text samples to be enhanced.
[0055] It should be noted that before obtaining multiple text samples, this application needs to obtain a large-scale text sample from a text storage database. This large-scale text sample can be determined by object-generated content, which is the content entered by the object on the terminal device. Afterward, the large-scale text sample can be normalized to obtain multiple text samples. This normalization process includes removing emoticons from the large-scale text sample; the method of normalization is not limited here.
[0056] Specifically, the multiple text samples in this step include a text sample set of type 1 and a text sample set of type 2. Type 1 samples are positive samples, which can be understood as non-leading text in the context of object-generated content. For example, a positive sample could be "The weather is very nice," in which case the positive sample represents normal content generated by the object. Type 2 samples are negative samples, which can be understood as leading text in the context of object-generated content. For example, a negative sample could be... At this point, the negative sample is abnormal content generated by the object.
[0057] The text sample to be enhanced includes the sample that needs to be enhanced, and the text sample to be enhanced can be any one of multiple text samples. It is understood that if the text sample to be enhanced is a positive sample, then the positive sample can be enhanced in the subsequent process; if the text sample to be enhanced is a negative sample, then the negative sample can also be enhanced in the subsequent process. Thus, in this application, sample enhancement can be achieved for both positive and negative samples.
[0058] Furthermore, the text sample to be enhanced can also be a text sample with a smaller number of samples of a certain type among multiple text samples. For example, if there are 100 text samples, 99 of them are positive samples and 1 is a negative sample. In this case, the text sample corresponding to the negative sample can be identified as the text sample to be enhanced. In addition, existing recall models can be used to recall the text sample to be enhanced from multiple text samples, so that similar text samples can be mined from multiple text samples in the subsequent process.
[0059] S302: Perform vector processing on the plurality of text samples and the text sample to be enhanced using a vector generation model to generate text sample vectors corresponding to the plurality of text samples and text sample vectors corresponding to the text sample to be enhanced.
[0060] In this step, the vector generation model is a pre-built model that can generate relatively accurate sample vectors for each text sample. This makes it easier to accurately determine text sample vectors similar to the sample vector to be enhanced from multiple text samples in subsequent processes.
[0061] It should be noted that before constructing the vector generation model, this application also needs to construct an initial generation model. The initial generation model uses the BERT model architecture and includes 12 encoders. The multi-head self-attention mechanism in these encoders can capture richer and more comprehensive text information, enabling the generation of high-quality text vectors. The following section combines... Figure 4 This paper will describe the construction process of the initial generative model in this application. Figure 4 A flowchart illustrating the construction of the initial generative model in a sample augmentation method provided in this application embodiment is shown below. Figure 4 As shown:
[0062] Specifically, in Figure 4First, a first text sample and a second text sample are obtained, where the semantics of the first text sample differ from those of the second text sample. Then, the first and second text samples are input into the generative model to be trained. The model performs vector processing on the first and second text samples, generating a first sample generation vector, a second sample generation vector, and a third sample generation vector corresponding to the first and second text samples. Finally, if the vector distance between the first and second sample generation vectors is less than a first distance threshold, and the vector distance between the first and third sample generation vectors is greater than a second distance threshold, the training of the generative model is complete, obtaining the initial generative model. Here, the first distance threshold is much smaller than the second distance threshold.
[0063] Understandably, this application primarily employs unsupervised training to obtain the initial generative model, enabling training to generate sample vectors without labeling samples. It should also be noted that this application can introduce the Dropout mechanism (i.e., contrastive learning mechanism) from simCSE into the encoder, allowing the trained generative model to generate a more accurate initial generative model of sample vectors. The following section combines... Figure 5 This paper will introduce the vector generation process of the generative model to be trained after introducing the Dropout mechanism. Figure 5 This application provides a flowchart of the vector generation process for a sample augmentation method in which a generative model to be trained is described, as follows: Figure 5 As shown:
[0064] exist Figure 5 In this paper, a contrastive learning mechanism is introduced into the encoder of the generative model to be trained. The encoder in the generative model can mask text sample A to obtain sample generated vector a, and the encoder can mask text sample A to obtain sample generated vector a, and the encoder can mask text sample B to obtain sample generated vector B. This allows the generative model to be trained to narrow the vector distance between sample generated vector A and sample generated vector a, and widen the vector distance between sample generated vector A and sample generated vector B. Thus, through the contrastive learning mechanism in this application, the model can learn the text similarity between text samples, avoid the negative noise problem easily introduced in related technologies, and prevent model overfitting.
[0065] The training process of the vector generation model in this application will be described next. For example... Figure 6 As shown, Figure 6 This is a flowchart illustrating the training process of the vector generation model in a sample augmentation method provided in this application embodiment. Figure 6 This includes steps S3011-S3014, which are detailed below:
[0066] S3011: Obtain the first text sample, the second text sample, and the training label results.
[0067] In this step, the sample relationship between the first text sample and the second text sample can be either similar or dissimilar. The training label results include the similarity label results between the first and second text samples, the type label results corresponding to the first text sample, and the type label results corresponding to the second text sample. For example, the first text sample can be a traffic-driving type sample, and the second text sample can be a non-traffic-driving type sample. The sample types are not limited here and can be determined in practical applications.
[0068] It should be noted that this application may also obtain a first text sample, a second text sample, and a third text sample. The sample relationship between the first and second text samples can be sample similarity, and the sample relationship between the first and third text samples can be sample dissimilarity. This allows the model to learn the sample relationships between similar and dissimilarity simultaneously during subsequent model training. It should also be noted that the terminal device may choose one or combine multiple of the above optional implementation methods, and this application does not impose any restrictions on this.
[0069] S3012: Perform vector processing on the first text sample and the second text sample through the initial generation model to obtain the first sample vector corresponding to the first text sample and the second sample vector corresponding to the second text sample.
[0070] In this step, the first text sample can be processed using an initial generation model to obtain a first sample vector, and the second sample vector corresponding to the second text sample can be processed using the same initial generation model to obtain a second sample vector. Both the first and second sample vectors are 768-dimensional vectors to enable multi-task sharing of subsequent sample vectors.
[0071] It should be noted that this application also adopts a hard-sharing mechanism for hidden layer parameters, which enables the sample vectors generated by the initial generation model to simultaneously express the text features and type features of the text samples. This facilitates the similarity learning and classification learning tasks of the subsequent model and also reduces the risk of model overfitting to a certain extent.
[0072] S3013: Perform vector processing on the first sample vector and the second sample vector to obtain the vector processing result.
[0073] It should be noted that in this application, the initial generative model can be trained using similarity learning and classification learning tasks, enabling better evaluation of the similarity between text samples through these tasks. Furthermore, this application can also utilize classification task network layers to perform classification learning on sample vectors, assisting in subsequent similarity judgments of text samples and improving the accuracy and efficiency of classification.
[0074] Specifically, in this application, similarity calculation can be performed on the first sample vector and the second sample vector to obtain a vector similarity result between the first sample vector and the second sample vector. Vector classification can be performed on the first sample vector to obtain a type classification result corresponding to the first sample vector, and vector classification can be performed on the second sample vector to obtain a type classification result corresponding to the second sample vector. In this application, the vector similarity result between the first and second sample vectors, the type classification result corresponding to the first sample vector, and the type classification result corresponding to the second sample vector can be combined as a vector processing result, allowing it to be used as a pair of training data with the training label result, facilitating subsequent model parameter tuning.
[0075] S3014: Based on the difference between the training label results and the vector processing results, adjust the parameters of the initial generated model until the adjusted model meets the model training cutoff condition, and the adjustment ends to obtain the vector generation model.
[0076] In this step, the model training cutoff conditions include a first loss condition and a second loss condition. The first loss condition includes a condition regarding similarity difference, which includes a similarity difference loss. The second loss condition includes a condition regarding classification difference, which includes a classification difference loss. It is understood that in this application, when the similarity difference loss is less than the first loss threshold and the classification difference loss is less than the second loss threshold, the model parameters are adjusted to terminate the vector generation model. The first and second loss thresholds are preset thresholds and are not specifically limited here.
[0077] In one feasible implementation, the model training cutoff condition can be determined using a model loss formula, which is as follows:
[0078] LOSS = α t loss t +α si loss si
[0079] Where LOSS represents the model training cutoff condition, α tThe weights of the classification learning task during model training are represented by the loss statement. t This represents the second loss condition, α. si The loss represents the weights of the similarity learning task during model training. si This indicates the first loss condition.
[0080] Specifically, in this application, the parameters of the initial generation model can be adjusted based on the difference between the similarity label results between the first and second text samples and the vector similarity results between the first and second sample vectors; the type label results corresponding to the first text sample and the type classification results corresponding to the first sample vector; and the type label results corresponding to the second text sample and the type classification results corresponding to the second sample vector. Thus, this application also employs supervised training to train a vector generation model based on the initial generation model, thereby improving model training efficiency and the accuracy of vector generation for texts that are difficult to generate vectors for.
[0081] like Figure 7 As shown, Figure 7 The training flowchart of the vector generation model in another sample augmentation method provided in this application embodiment is shown in the following diagram. Figure 7 First, the first and second text samples can be input into an initial generation model, which outputs a first sample vector corresponding to the first text sample and a second sample vector corresponding to the second text sample. Then, the first and second sample vectors can be input into a similarity learning task to obtain their output results, and also into a classification learning task to obtain their output results, facilitating subsequent model construction.
[0082] S303: Based on multiple text sample vectors and the sample vector to be enhanced, determine a target text sample vector among the multiple text sample vectors that is similar to the sample vector to be enhanced, and based on the target text sample vector, determine a target text sample among the multiple text samples that corresponds to the target text sample vector.
[0083] In some examples, the text sample to be enhanced can be At this point, the corresponding sample vector to be enhanced for the text sample can be [-0.023746009,-0.052704134,0.020133809,0.013165274,0.911493845,0.03154338,0.007101524,0.061728082,-0.036238389,0.26569627,-0.027529234,0.130113559,0.03833459168,...]. The sample vector to be enhanced is actually a 768-dimensional vector, but only the first 13 dimensions are shown. This improves the accuracy of mining similar sample vectors based on the sample vector itself.
[0084] In this step, firstly, similarity calculations are performed on multiple text sample vectors and the sample vector to be enhanced, resulting in multiple vector similarities. One vector similarity is calculated based on the similarity between a single text sample vector and the sample vector to be enhanced. Next, the multiple vector similarities are compared with a similarity threshold range. Vectors falling within the threshold range are identified as target vector similarities. Finally, the text sample vector corresponding to the target vector similarity is determined as the target text sample vector similar to the sample vector to be enhanced among the multiple text sample vectors. Thus, this application can mine text sample vectors similar to the sample vector to be enhanced through vector similarity comparison, thereby increasing the number of samples to a certain extent.
[0085] It should be noted that the similarity threshold range in this application includes 0.8-0.92. This can avoid the problem that the usability of the subsequently extracted text samples is not strong due to the similarity being too low, and can also avoid the problem that the subsequently extracted text samples and the text samples to be enhanced are too similar due to the similarity being too high.
[0086] In another possible implementation, before determining the target text sample vector similar to the sample vector to be enhanced from among the multiple text sample vectors and the sample vector to be enhanced, this application may further store the multiple text sample vectors in a vector index database. This vector index database is used to retrieve the text sample vectors, and the vector index data may include fax. Subsequently, a vector retrieval can be performed on the vector index database based on the sample vector to be enhanced to determine the target text sample vector similar to the sample vector to be enhanced from among the multiple text sample vectors in the vector index database.
[0087] Specifically, a search algorithm in a vector index database can be invoked to retrieve k text sample vectors that are similar to the vector to be enhanced from multiple text sample vectors, where k is greater than or equal to 1. Then, similarity calculations can be performed between the vector to be enhanced and the k text sample vectors to obtain k similarity calculation results, where each similarity calculation result corresponds to both the vector to be enhanced and a text sample vector. The text sample vector corresponding to the highest similarity calculation result among the k similarity calculation results can then be identified as the target text sample vector similar to the vector to be enhanced from among the multiple text sample vectors. It should also be noted that in practical applications, the text sample vectors corresponding to the first p similarity calculation results from the k similarity calculation results (ranked based on the highest similarity calculation result) can also be identified as the target text sample vectors similar to the vector to be enhanced from among the multiple text sample vectors, where p is greater than or equal to 1 and less than k.
[0088] Furthermore, after identifying the target text sample vector that is similar to the sample vector to be enhanced among multiple text sample vectors, this application can also compare and filter multiple text samples based on the target text sample vector to identify the target text sample that corresponds to the target text sample vector among multiple text samples. This enables sample enhancement based on the target text sample that is similar to the text sample to be enhanced in the subsequent process, thereby further increasing the number of samples.
[0089] like Figure 8 As shown, Figure 8 This is a flowchart illustrating the process of obtaining the target text sample vector in a sample enhancement method provided in this application embodiment. Figure 8 First, the generator model to be trained can be unsupervised to obtain an initial generator model, and then supervised training can be performed on the initial generator model to obtain a vector generator model. At the same time, multiple text samples can be obtained based on the large-scale text samples, and text samples to be enhanced can be obtained from the multiple text samples.
[0090] Following this, vector processing can be performed on multiple text samples and the text sample to be enhanced using a vector generation model to obtain text sample vectors corresponding to the multiple text samples and the sample vector to be enhanced corresponding to the text sample to be enhanced. Finally, based on the similarity between the sample vectors, target text sample vectors similar to the sample vector to be enhanced are determined from among the multiple text sample vectors. This enables this application to discover text sample vectors similar to the sample vector to be enhanced, thereby increasing the number of samples.
[0091] S304: Perform sample augmentation processing on the target text sample using a sample augmentation agent to generate a text augmentation sample corresponding to the target text sample.
[0092] In this step, the sample augmentation agent includes an agent that implements sample augmentation for text samples. The agent architecture of this sample augmentation agent is an LLM-based multi-agent. As can be understood, multi-agent represents a collection of multiple agents; that is, this application can construct and obtain multiple agents under the action of a large language model. In this application, the parameters of the large language model can be customized according to the different needs of the agents, so that agents with different performance can be obtained. For example, this application can adjust the model parameters of the large language model to obtain a conversion agent capable of text conversion; this application can also adjust the model parameters of the large language model to obtain a decision agent capable of providing sample strategies; this application can also adjust the model parameters of the large language model to obtain an analysis agent capable of providing sample analysis results, so that each agent obtained through the large language model can efficiently complete its respective task.
[0093] It should be noted that the currently generated content may contain deformed characters to attract traffic. Since related technical solutions can only generate samples with the same or similar semantics, the model built using the sample set augmented by these solutions has difficulty recognizing this content containing deformed characters. Therefore, this application proposes using a sample augmentation agent to augment text samples, enabling it to generate augmented samples with the same sample type, similar semantics, and similar font type as the text sample to be augmented. For example, if the target text sample is "235", the augmented sample generated by the sample augmentation agent would be "23ㄎ". This can improve the generalization ability of sample augmentation to a certain extent.
[0094] It should also be noted that this application can further perform sample enhancement processing on the text sample to be enhanced, thereby generating a text-enhanced sample corresponding to the text sample to be enhanced. Thus, compared to related technical solutions, this application can generate enhanced samples that differ from those of related technical solutions. Furthermore, the number of text-enhanced samples generated by the sample enhancement agent in this application can be one or multiple, without specific limitation. In practical applications, the number of generated samples can be controlled by setting the number of samples generated by the sample enhancement agent.
[0095] The sample augmentation agent in this application includes a transformation agent, a decision agent, and an analysis agent. The transformation agent performs text transformation on the input text sample, converting characters. The decision agent provides sample strategies to the transformation agent, making sample decisions based on the augmented samples obtained after text transformation. The analysis agent provides sample analysis results to the decision agent, performing semantic comparison between the text sample and its augmented form. Therefore, each agent in the sample augmentation agent possesses domain-specific expertise, improving the comprehensiveness and accuracy of the generated results. The reasonable division of labor among agents allows each to focus on different sub-tasks, making this solution superior to schemes relying on a single agent for sample augmentation. Furthermore, by enabling collaboration among agents, this application reduces the risk of single points of failure, enhancing the robustness and reliability of the agents.
[0096] The sample augmentation process in this application will be described next, focusing on the transformation agent, decision agent, and analysis agent within the sample augmentation agent framework. For example... Figure 9 As shown, Figure 9 This is a flowchart illustrating sample enhancement in a sample enhancement method provided in an embodiment of this application. Figure 9 This includes steps S3041-S3043, which are detailed below:
[0097] S3041: The target text sample is transformed by the transformation agent in the sample enhancement agent to generate the initial enhanced sample corresponding to the target text sample.
[0098] After identifying the target text sample, it can be input into the transformation agent within the sample enhancement agent. This transformation agent performs an initial text transformation on the target text sample to generate an initial enhanced sample corresponding to the target text sample. It can be understood that this initial text transformation is the initial sample enhancement operation performed by the transformation agent when it has not received a decision instruction from the decision agent. At this time, the transformation agent can perform the initial sample enhancement of the target text sample based on the sample enhancement process of historical text samples. That is, it can perform enhancement techniques such as sample semantic transformation and sample character transformation on the target text sample to generate the initial enhanced sample corresponding to the target text sample.
[0099] S3042: The decision agent in the sample enhancement agent performs decision processing on the initial enhanced sample to obtain the sample update strategy corresponding to the initial enhanced sample.
[0100] In this step, after generating the initial augmented sample corresponding to the target text sample, the initial augmented sample can be input into the decision agent in the sample augmentation agent so that the decision agent can judge the initial augmented sample. If the decision agent judges that the augmentation effect of the initial augmented sample is poor, the initial augmented sample is processed to obtain the sample update strategy corresponding to the initial augmented sample.
[0101] It should be noted that when the decision agent in the sample augmentation agent makes decisions, it also needs to make sample decisions based on the sample analysis results made by the analysis agent in the sample augmentation agent. The following section will introduce the judgment process of the decision agent in conjunction with the analysis agent.
[0102] Specifically, before the decision-making agent in the sample enhancement agent processes the initial enhanced sample to obtain the corresponding sample update strategy, this application can further utilize the analysis agent in the sample enhancement agent to perform semantic analysis on the target text sample to obtain the target text semantics corresponding to the target text sample. Additionally, the analysis agent in the sample enhancement agent performs semantic analysis on the initial enhanced sample to obtain the enhanced text semantics corresponding to the initial enhanced sample. Afterward, the analysis agent in the sample enhancement agent performs a semantic comparison between the target text semantics and the enhanced text semantics to obtain the semantic comparison results. This lays the foundation for the subsequent sample decision-making by the decision-making agent, reducing the possibility of errors or inaccuracies in sample decision-making.
[0103] In one feasible implementation, if the semantic comparison result indicates that the semantics of the target text and the semantics of the enhanced text are dissimilar, the decision agent in the sample enhancement agent can make sample decisions on the initial enhanced samples based on the semantic comparison result, thereby obtaining the sample update strategy corresponding to the initial enhanced samples. In this way, under the influence of the semantic comparison result, the decision agent can dynamically adjust the samples to improve the quality and accuracy of subsequently generated samples.
[0104] In one example, if the target text sample is "I'm in a good mood today" and the initial augmented sample is "I'm in a bad mood today", the semantic comparison result indicates that the texts are semantically dissimilar. The decision agent can then update the sample by replacing "bad" with "good" in the initial augmented sample to ensure that samples with similar text semantics are generated. It should be noted that the above examples in this application are only partial examples and are not intended to limit the scope of the application.
[0105] In another feasible implementation, if the semantic comparison result indicates that the target text semantics and the enhanced text semantics are similar, the model judgment result corresponding to the model constructed based on the initial enhanced sample can be received. It is understood that after obtaining the initial enhanced sample, a downstream model can be constructed based on it. This downstream model can combine the model output results during the model's application process to output its judgment result. This downstream model can be a text recognition model, where the judgment result indicates that the text recognition accuracy is low.
[0106] Furthermore, the decision agent within the sample augmentation agent can make sample decisions based on the model's judgment results to obtain the corresponding sample update strategy. This allows the decision agent to implement sample decisions based on the actual application of the downstream model, thus ensuring the accuracy of the generated sample update strategy to a certain extent.
[0107] In one example, if the target text sample is "uk92y", the initial augmented sample is... At this point, the semantic comparison result indicates that the texts are semantically similar. The sample update decision obtained by the decision agent in making sample decisions can be to replace "k" in the initial augmented sample with... Replacing "y" with "γ" ensures that samples with similar text semantics and font types can be generated, thereby improving the accuracy of subsequent model generation. It should be noted that the examples above in this application are only partial examples and are not intended to limit the scope of the application.
[0108] S3043: The transformation agent in the sample enhancement agent performs text transformation on the initial enhanced sample based on the sample update strategy to generate the text enhancement sample corresponding to the target text sample.
[0109] In this step, the transformation agent can also be used to perform text transformation on the initial augmented samples according to the sample update strategy generated by the decision agent, so as to generate text augmented samples corresponding to the target text samples. Thus, by continuously performing text transformation on the samples in this application, more accurate augmented samples can be generated, thereby improving the accuracy of downstream model construction. It should be noted that if the decision agent still needs to perform decision processing on the text augmented samples corresponding to the target text samples, the transformation agent can continue to be called to perform text transformation on the samples until the decision agent no longer needs to perform decision processing.
[0110] It should also be noted that the initial enhanced sample includes a first character and a second character, and the initial enhanced sample also includes the remaining characters, which are not specifically defined here. Specifically, if the sample update strategy is a strategy that requires character conversion of the first character, in this application, first, the conversion agent in the sample enhancement agent can perform character conversion on the first character in the initial enhanced sample based on the sample update strategy to generate the converted first character. The font type of the first character is similar to that of the converted first character. For example, if the first character is "y", the converted first character is "γ". In this way, both the importance of font type similarity can be maintained and the generalization ability of sample enhancement can be improved.
[0111] After that, the conversion agent in the sample enhancement agent can combine the converted first character and the second character to generate a text enhancement sample corresponding to the target text sample. Finally, the conversion agent in the sample enhancement agent can also continue to perform text conversion on the initial enhanced sample based on the sample update strategy to generate a text enhancement sample with a text semantics similar to that of the initial enhanced sample. In some examples, if the initial enhanced sample is "Good things should be shared uk92y.com[em]e10277[ / em]", after the text conversion by the conversion agent, the text enhancement sample is "This is what I recommend ". In this way, under the division of labor and cooperation of the conversion agent, the analysis agent and the decision-making agent, the comprehensiveness and accuracy of sample enhancement can be improved.
[0112] Next, the training process of the sample enhancement agent in this application will be introduced. In this application, first, the initial conversion agent can perform text conversion on the initial text sample to generate an enhanced sample corresponding to the initial text sample. It can be understood that this initial conversion agent plays the role of an attack executor in the text adversarial simulation攻防 (the specific Chinese term "攻防" might need to be adjusted according to the actual context, here it's left as is for translation). It mainly receives the attack perturbation suggestions provided by the initial decision-making agent and performs attack perturbations on the text in order to pass the detection of the defense side (i.e., the initial downstream model constructed in advance using the initial text sample). It should be noted that if the initial conversion agent does not receive the attack perturbation suggestions provided by the initial decision-making agent, the initial conversion agent can generate an enhanced sample according to its own language ability.
[0113] After that, the initial analysis agent can perform semantic comparison on the initial text sample and the enhanced sample corresponding to the initial text sample to obtain the initial semantic comparison result. It can be understood that this initial analysis agent plays the role of a referee in the text adversarial simulation攻防. It mainly evaluates the enhanced sample generated by the initial conversion agent to judge whether the text sample still retains the basic semantics of the original text after the attack perturbation (i.e., text conversion), so that readers can easily understand.
[0114] In some examples, the initial text sample is "Join new group 5494264", and the corresponding augmented sample is "Join new group". At this point, the initial analysis agent can output, "Although the characters for contact information have been replaced, the replaced characters and the original characters are visually similar, and readers can easily identify the characters before the replacement. Meanwhile, the other parts of the text still express the meaning of guiding the addition of contact information, so it is considered that the semantics of this augmented sample have been preserved." This is the initial semantic comparison result, which can indicate that the initial text sample and the augmented sample corresponding to the initial text sample are semantically similar.
[0115] Furthermore, the initial decision-making agent can process the augmented samples corresponding to the initial text samples based on the initial semantic comparison results to obtain the initial update strategy. Understandably, this initial decision-making agent plays the role of the strategy maker in the text adversarial simulation attack team within the agent system. Its main function is to propose attack perturbation strategies (i.e., the initial update strategy) to pass the defender's detection. This initial decision-making agent can provide macro-level perturbation strategies to the initial transformation agent, and can also receive model judgment results from the initial analysis agent and / or the model to generate better attack perturbation strategies.
[0116] It should be noted that in this application, the parameters of the initial decision agent can be continuously adjusted based on the model's judgment results, enabling the initial decision agent to generate better policies. Understandably, the policy generated in the first iteration may not achieve the expected results for subsequent sample transformations; for example, the semantics of the original text may not be well preserved, leading to difficult-to-understand transformed text.
[0117] At this point, this application can adjust the parameters of the initial decision-making agent, enabling it to improve its strategy and generate a better one. Understandably, for characters and keywords that the defender might focus on checking, this application can choose to replace them with characters similar to the original characters, or use some less common characters to replace the original characters, thereby increasing the difficulty of recognition for the defender. Furthermore, it can utilize the difference between full-width and half-width characters for obfuscation, such as converting the original characters to full-width characters, thereby bypassing the defender's checks.
[0118] It should also be noted that after training the intelligent agent, the decision-making intelligent agent in this application can not only generate strategies such as "replacing the original characters with characters similar to the original characters in the target text sample or using uncommon characters to replace the original characters", but also generate strategies such as "converting the original characters in the target text sample into full-width characters", so as to enhance the recognition difficulty of the text sample. And it can also generate strategies such as "rewriting the target text sample so that the text semantics of the rewritten text sample are similar to those of the target text sample", for example, "I'm home" can be rewritten as "Arrived, I'm home", so that the text sample can change at the literal level and also enhance the recognition difficulty of the text sample.
[0119] At this time, the initial transformation intelligent agent can perform text transformation on the enhanced sample corresponding to the initial text sample according to the initial update strategy to obtain the training enhanced sample corresponding to the initial text sample. Finally, a sample recall model can be constructed based on the training enhanced sample, and according to the recall rate of the sample by the sample recall model (i.e., the model judgment result), the parameters of the initial transformation intelligent agent, the initial analysis intelligent agent, and the initial decision-making intelligent agent can be adjusted until the adjusted intelligent agents meet the intelligent agent training termination conditions. After the adjustment is completed, the transformation intelligent agent, the analysis intelligent agent, and the decision-making intelligent agent are obtained, and the transformation intelligent agent, the analysis intelligent agent, and the decision-making intelligent agent are used as sample enhancement intelligent agents for subsequent application of the sample enhancement intelligent agents.
[0120] Among them, the intelligent agent training termination conditions include model discrimination conditions and intelligent agent training round conditions. The model discrimination conditions include the condition that the sample recall rate is greater than the preset sample recall rate, that is, if the recall rate of the sample by the sample recall model is greater than the preset sample recall rate, the transformation intelligent agent, the analysis intelligent agent, and the decision-making intelligent agent are obtained after the adjustment is completed; the intelligent agent training round conditions include the condition that the intelligent agent training round is greater than the preset intelligent agent training round, that is, if the intelligent agent training round is greater than the preset intelligent agent training round, the transformation intelligent agent, the analysis intelligent agent, and the decision-making intelligent agent are obtained after the adjustment is completed. And the process of obtaining the training enhanced sample in this application can be used as an intelligent agent training round. It should be noted that multiple training enhanced samples can be obtained in an intelligent agent training round in this application, which is not specifically limited here and can also be set in actual applications.
[0121] As Figure 10 shown, Figure 10 is the flowchart of sample enhancement in another sample enhancement method provided by an embodiment of this application. In Figure 10First, target text samples similar to the text sample to be enhanced from multiple text samples can be input into the transformation agent within the sample enhancement agent. This transformation agent performs an initial text transformation on the target text sample, obtaining an initial enhanced sample. Afterward, the analysis agent within the sample enhancement agent performs a semantic comparison between the target text sample and the initial enhanced sample to obtain the semantic comparison results between the target text semantics and the enhanced text semantics of the initial enhanced sample.
[0122] Finally, if the semantic comparison result indicates that the target text semantics and the enhanced text semantics are similar, then a model is built based on this initial enhanced sample to obtain the downstream model and its application effect (i.e., the model judgment result). At this time, the decision agent in the sample enhancement agent can generate a sample update strategy for the initial enhanced sample based on the model judgment result of the downstream model for this initial enhanced sample. If the semantic comparison result indicates that the target text semantics and the enhanced text semantics are not similar, then the semantic comparison result is input into the decision agent in the sample enhancement agent. At this time, the decision agent can generate a sample update strategy for the initial enhanced sample based on the semantic comparison result.
[0123] Furthermore, the sample update strategy can be provided to the transformation agent, enabling the transformation agent to continue text transformation of the initial augmented sample based on the sample update strategy to obtain the text augmented sample corresponding to the target text sample. Thus, in this application, the transformation agent can perform text transformation of the text sample, the analysis agent can perform semantic comparison of the corresponding text sample, and the decision agent can generate a strategy for the text sample. This allows multiple agents to collaborate in generating highly adversarial and "creative" augmented samples, thereby achieving sample augmentation of the text sample and improving the generalization ability of the sample augmentation, which is beneficial for the application of subsequent downstream models.
[0124] like Figure 11 As shown, Figure 11 This is an overall flowchart of a sample enhancement method provided in an embodiment of this application, in which... Figure 11 First, the text sample to be enhanced can be determined from multiple text samples. Then, based on the text sample to be enhanced, a target text sample similar to the text sample to be enhanced can be determined from multiple text samples. After that, the target text sample can be enhanced by a sample enhancement agent to generate a text enhancement sample corresponding to the target text sample. Finally, the text enhancement sample can be applied to the construction of subsequent downstream models. The model structure of the downstream model can be BERT or Transformer, without specific limitations.
[0125] In addition, the technical solution of this application can also be used for text sample enhancement in all public scenarios, such as sample enhancement for news and advertisements, and sample enhancement for bad words, etc., which can improve the sample enhancement effect to a certain extent, and can make the subsequent downstream model construction more robust and effective.
[0126] Table 1
[0127]
[0128]
[0129] As shown in Table 1, Table 1 is an example schematic table for determining the target text sample in a sample enhancement method provided by an embodiment of this application, and the examples shown in Table 1 are only partial examples. If the text sample to be enhanced in Table 1 is " Xixi is going home. Be generous. Don't say you don't know this. It's updated daily without membership", and the similarity threshold interval is set to 0.8 - 0.83, at this time, the target text sample can be determined from multiple text samples as " Hehe is going home. Be generous this time. It's updated daily without membership", the sample similarity between the text sample to be enhanced and the target text sample is 0.825806, and the drainage rate of this target text sample is 45.90%.
[0130] If the text sample to be enhanced is "Hey Try it. It's updated daily without membership [em]e166[ / em]", and the similarity threshold interval is set to 0.89 - 0.92, at this time, the target text sample can be determined from multiple text samples as "Hey Try it. It's updated daily without membership [em]e113[ / em]", the sample similarity between the text sample to be enhanced and the target text sample is 0.913196, and the drainage rate of this target text sample is 89.70%.
[0131] If the text sample to be enhanced is "y72km This is updated daily without membership [em]e113[ / em]", and the similarity threshold interval is set to 0.92 - 1.0, at this time, the target text sample can be determined from multiple text samples as "This is updated daily without membership ". The sample similarity between the text sample to be enhanced and the target text sample is 0.94757, and the drainage rate of this target text sample is 100.00%. It can be seen that in practical applications, through the technical solution of this application, the number of effective samples can be expanded to 281% of the original number of samples on average.
[0132] Table 2
[0133]
[0134]
[0135] As shown in Table 2, Table 2 is an example schematic table for a sample enhancement agent to implement sample enhancement in a sample enhancement method provided by an embodiment of the present application. The examples shown in Table 2 are only partial examples. In Table 2, a drainage text recognition model can be obtained through pre-training. The drainage text recognition model can recognize text for drainage. At this time, the drainage text recognition model can recognize "Join new group 5494264" as drainage text, and the recognition accuracy rate of this drainage text is 91.53%, the recall rate of the drainage text recognition model is 85.71%, and at this time the sample enhancement agent has not implemented sample enhancement (i.e., epoch0).
[0136] After the sample enhancement agent implements the first sample enhancement (i.e., epoch1), at this time the drainage text recognition model can recognize "Join new group 5@9@*&@" as drainage text, "Join new group 5@9@*&@" is text with non-preserved semantics, and the recognition accuracy rate of this drainage text is 66.10%, the recall rate of the drainage text recognition model is 42.86%. Among them, the average number of successful times for the drainage text recognition model to recognize drainage text is 73 times, the average number of successful times for the drainage text recognition model to recognize drainage text with non-preserved semantics is 52 times, and the average number of failure times for the drainage text recognition model to fail to recognize drainage text is 15 times.
[0137] After the sample enhancement agent implements the second sample enhancement (i.e., epoch2), at this time the drainage text recognition model fails to recognize " " as drainage text, and the recognition accuracy rate of this drainage text is 54.24%, the recall rate of the drainage text recognition model is 22.86%. Among them, the average number of successful times for the drainage text recognition model to recognize drainage text is 108 times, the average number of successful times for the drainage text recognition model to recognize drainage text with non-preserved semantics is 9 times, and the average number of failure times for the drainage text recognition model to fail to recognize drainage text is 23 times. Thus, the present application can continuously optimize the conversion strategy of text samples according to the actual application of the model to improve the generalization ability of enhanced samples.
[0138] Table 3
[0139]
[0140] As shown in Table 3, Table 3 is an example of a sample augmentation method for constructing a sample model according to an embodiment of this application. The examples shown in Table 3 are only partial examples. In Table 3, a first referral model is obtained by constructing the original sample set (i.e., the sample set without sample augmentation), and a second referral model is obtained by constructing the first referral model. The recognition accuracy (acc) of the first referral model is 89.83%, the recognition precision (prec) is 100%, the text recall is 82.86%, and the model score (F1) is 90.63%. The recognition accuracy of the second referral model is 91.95%, the recognition precision is 92.91%, the text recall is 93.57%, and the model score is 93.24%.
[0141] A first referral model was constructed using a sample augmentation set (i.e., a sample set after sample augmentation), and a second referral model was constructed based on the first referral model. The first referral model had a recognition accuracy of 50.85%, a recognition precision of 100%, a text recall of 17.14%, and a model score of 29.26%. The second referral model had a recognition accuracy of 80.51%, a recognition precision of 91.23%, a text recall of 74.29%, and a model score of 81.89%.
[0142] A first referral model was constructed by using an augmented sample set and an out-of-domain sample set (i.e., the sample set after augmentation and the remaining sample sets). A second referral model was then constructed based on the first model. The first referral model achieved a recognition accuracy of 48.73%, a recognition precision of 100%, a text recall of 13.57%, and a model score of 23.90%. The second referral model achieved a recognition accuracy of 77.97%, a recognition precision of 90.74%, a text recall of 70.00%, and a model score of 79.03%. It is evident that, in practical applications, the model constructed using the technical solution of this application possesses superior accuracy and recall metrics and stronger robustness.
[0143] In summary, in this embodiment, target text samples similar to the text sample to be enhanced can be mined from multiple text samples, and then sample enhancement can be performed on the mined target text samples. Thus, the technical solution of this application can not only mine samples from the perspective of sample vectors to increase the number of existing samples, but also enhance samples from the perspective of sample enhancement agent, so as to improve the number of samples and the generalization ability of sample enhancement to a certain extent, and optimize the model effect of the downstream model subsequently built.
[0144] Based on the sample enhancement method provided in the preceding embodiments, this application also provides a sample enhancement device. The sample enhancement device provided in the embodiments of this application will be described in detail below.
[0145] See Figure 12 This figure is a schematic diagram of the structure of a sample enhancement device provided in an embodiment of this application. Figure 12 As shown, the sample enhancement device specifically includes:
[0146] The text sample acquisition unit 1201 is used to acquire multiple text samples and a text sample to be enhanced, wherein the text sample to be enhanced is any one of the multiple text samples;
[0147] The sample vector processing unit 1202 is used to perform vector processing on the plurality of text samples and the text sample to be enhanced through a vector generation model, and generate text sample vectors corresponding to the plurality of text samples and the text sample to be enhanced corresponding to the text sample to be enhanced, wherein the vector generation model is used to generate sample vectors corresponding to the text samples.
[0148] The target text sample determination unit 1203 is used to determine, based on multiple text sample vectors and the sample vector to be enhanced, a target text sample vector that is similar to the sample vector to be enhanced among the multiple text sample vectors, and to determine, based on the target text sample vector, a target text sample that corresponds to the target text sample vector among the multiple text samples;
[0149] The text enhancement sample generation unit 1204 is used to perform sample enhancement processing on the target text sample through a sample enhancement agent to generate a text enhancement sample corresponding to the target text sample. The text enhancement sample includes enhancement samples with the same sample type, similar sample semantics, and similar sample font type as the text sample to be enhanced. The sample enhancement agent is used for sample enhancement of the text sample.
[0150] In one feasible implementation, the text enhancement sample generation unit 1204 includes:
[0151] The first text conversion unit is used to perform text conversion on the target text sample through the conversion agent in the sample enhancement agent, and generate an initial enhancement sample corresponding to the target text sample;
[0152] The sample decision processing unit is used to perform decision processing on the initial enhanced sample through the decision agent in the sample enhancement agent to obtain the sample update strategy corresponding to the initial enhanced sample.
[0153] The second text conversion unit is used to perform text conversion on the initial enhanced sample based on the sample update strategy through the conversion agent in the sample enhancement agent, and generate the text enhancement sample corresponding to the target text sample.
[0154] In one possible implementation, the second text conversion unit is specifically used for:
[0155] The transformation agent in the sample enhancement agent performs character transformation on the first character in the initial enhancement sample based on the sample update strategy to generate a transformed first character, wherein the font type of the first character is similar to the font type of the transformed first character;
[0156] The transformation agent in the sample enhancement agent combines the transformed first character and the second character to generate a text enhancement sample corresponding to the target text sample.
[0157] In one feasible implementation, the device further includes:
[0158] The sample semantic analysis unit is used to perform semantic analysis on the target text sample and the initial enhanced sample through the analysis agent in the sample enhancement agent, so as to obtain the target text semantics corresponding to the target text sample and the enhanced text semantics corresponding to the initial enhanced sample;
[0159] The sample semantic comparison unit is used to perform semantic comparison between the target text semantics and the enhanced text semantics through the analysis agent in the sample enhancement agent, and obtain the semantic comparison result.
[0160] In one feasible implementation, the sample decision processing unit is specifically used for:
[0161] If the semantic comparison result indicates that the semantics of the target text and the semantics of the enhanced text are not similar, the decision agent in the sample enhancement agent makes a sample decision on the initial enhanced sample based on the semantic comparison result to obtain the sample update strategy corresponding to the initial enhanced sample.
[0162] In one possible implementation, the device further includes an agent training unit, which is specifically used for:
[0163] The initial text sample is augmented by an initial transformation agent, an initial analysis agent, and an initial decision agent to obtain the training augmented sample corresponding to the initial text sample.
[0164] Based on the model judgment results corresponding to the model constructed for the training enhancement samples, the parameters of the initial conversion agent, the initial analysis agent, and the initial decision agent are adjusted until the adjusted agents meet the agent training cutoff conditions. The adjustment ends and the conversion agent, analysis agent, and decision agent are obtained.
[0165] The transformation agent, the analysis agent, and the decision agent are used as sample augmentation agents.
[0166] In one feasible implementation, the agent training unit is further specifically used for:
[0167] The initial text sample is converted by the initial conversion agent to generate an enhanced sample corresponding to the initial text sample.
[0168] The initial semantic comparison result is obtained by performing semantic comparison between the initial text sample and the augmented sample corresponding to the initial text sample by the initial analysis agent.
[0169] The initial decision-making agent performs decision processing on the enhanced samples corresponding to the initial text samples based on the initial semantic comparison results to obtain the initial update strategy;
[0170] The initial conversion agent performs text conversion on the augmented sample corresponding to the initial text sample according to the initial update strategy to obtain the training augmented sample corresponding to the initial text sample.
[0171] In one feasible implementation, the sample decision processing unit is further configured to:
[0172] If the semantic comparison result indicates that the target text semantics and the enhanced text semantics are similar, the model judgment result corresponding to the model constructed for the initial enhanced sample is received;
[0173] The decision agent in the sample augmentation agent makes sample decisions on the initial augmented sample based on the model's judgment results, thereby obtaining the sample update strategy corresponding to the initial augmented sample.
[0174] In one feasible implementation, the target text sample determination unit 1203 is specifically used for:
[0175] Similarity calculation is performed on multiple text sample vectors and the sample vector to be enhanced to obtain multiple vector similarities, one of which is obtained based on a text sample vector and the sample vector to be enhanced.
[0176] The vector similarity that falls within the similarity threshold range among the multiple vector similarities is determined as the target vector similarity;
[0177] The text sample vector corresponding to the similarity of the target vector is determined as the target text sample vector that is similar to the sample vector to be enhanced among the plurality of text sample vectors.
[0178] In one possible implementation, the apparatus further includes a model training unit, which is specifically used for:
[0179] Obtain the first text sample, the second text sample, and the training label results;
[0180] The first text sample and the second text sample are processed by the initial generation model to obtain the first sample vector corresponding to the first text sample and the second sample vector corresponding to the second text sample.
[0181] The first sample vector and the second sample vector are subjected to vector processing to obtain vector processing results, wherein the training label results and the vector processing results are used as a pair of training data.
[0182] Based on the difference between the training label results and the vector processing results, the parameters of the initial generated model are adjusted until the adjusted model meets the model training cutoff condition, and the adjustment ends to obtain the vector generation model.
[0183] In one feasible implementation, the model training unit is further configured to:
[0184] Calculate the similarity between the first sample vector and the second sample vector to obtain the vector similarity result between the first sample vector and the second sample vector.
[0185] Perform vector classification on the first sample vector and the second sample vector to obtain the type classification result corresponding to the first sample vector and the type classification result corresponding to the second sample vector.
[0186] The sample enhancement device provided in this application embodiment has the same beneficial effects as the sample enhancement method provided in the above embodiments, and therefore will not be described again.
[0187] This application provides a computer device, which can be a server. Figure 13This is a schematic diagram of a server structure provided in an embodiment of this application. The server 900 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 922 (e.g., one or more processors) and memory 932, and one or more storage media 930 (e.g., one or more mass storage devices) for storing application programs 942 or data 944. The memory 932 and storage media 930 can be temporary or persistent storage. The program stored in the storage media 930 may include one or more modules (not shown in the diagram), each module may include a series of instruction operations on the server. Furthermore, the CPU 922 may be configured to communicate with the storage media 930 and execute the series of instruction operations in the storage media 930 on the server 900.
[0188] Server 900 may also include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input / output interfaces 958, and / or one or more operating systems 941, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.
[0189] CPU 922 is used to perform the following steps:
[0190] Obtain multiple text samples and a text sample to be enhanced, wherein the text sample to be enhanced is any one of the multiple text samples;
[0191] The vector generation model is used to perform vector processing on the multiple text samples and the text sample to be enhanced, respectively, to generate text sample vectors corresponding to the multiple text samples and the text sample to be enhanced corresponding to the text sample to be enhanced, wherein the vector generation model is used to generate the sample vectors corresponding to the text samples.
[0192] Based on multiple text sample vectors and the sample vector to be enhanced, a target text sample vector similar to the sample vector to be enhanced is determined from among the multiple text sample vectors, and a target text sample corresponding to the target text sample vector is determined from among the multiple text samples based on the target text sample vector;
[0193] The target text sample is augmented by a sample augmentation agent to generate an augmented text sample corresponding to the target text sample. The augmented text sample includes augmented samples with the same sample type, similar semantics, and similar font type as the text sample to be augmented. The sample augmentation agent is used for sample augmentation of the text sample.
[0194] This application also provides another computer device, which can be a terminal device. For example... Figure 14 As shown, for ease of explanation, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application. Taking a mobile phone as an example:
[0195] Figure 14 The diagram shown is a block diagram of a portion of the structure of a mobile phone provided in an embodiment of this application. (Reference) Figure 14 The mobile phone includes: a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (WiFi) module 1070, a processor 1080, and a power supply 1090, etc. Those skilled in the art will understand that... Figure 14 The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0196] The following is combined Figure 14 A detailed introduction to each component of a mobile phone:
[0197] The RF circuit 1010 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with the processor 1080; additionally, it transmits uplink data to the base station. Typically, the RF circuit 1010 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, the RF circuit 1010 can also communicate wirelessly with networks and other devices. The aforementioned wireless communications may use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, and Short Messaging Service (SMS).
[0198] The memory 1020 can be used to store software programs and modules. The processor 1080 executes various mobile phone functions and data processing by running the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 1020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0199] The input unit 1030 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 1031), and drive the corresponding connection devices according to a pre-set program. Optionally, the touch panel 1031 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 1080, and can also receive and execute commands sent by the processor 1080. In addition, the touch panel 1031 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1031, the input unit 1030 may also include other input devices 1032. Specifically, other input devices 1032 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0200] The display unit 1040 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 1040 may include a display panel 1041, which may optionally be configured as a Liquid Crystal Display (LCD), Organic Light-Emitting Diode (OLED), or similar display panel 1041. Further, a touch panel 1031 may cover the display panel 1041. When the touch panel 1031 detects a touch operation on or near it, it transmits the information to the processor 1080 to determine the type of touch event. Subsequently, the processor 1080 provides corresponding visual output on the display panel 1041 according to the type of touch event. Although in Figure 14 In this embodiment, the touch panel 1031 and the display panel 1041 are two separate components to realize the input and output functions of the mobile phone. However, in some embodiments, the touch panel 1031 and the display panel 1041 can be integrated to realize the input and output functions of the mobile phone.
[0201] The mobile phone may also include at least one sensor 1050, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1041 according to the ambient light level, and the proximity sensor can turn off the display panel 1041 and / or the backlight when the phone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, taps), etc. Other sensors that may be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.
[0202] The audio circuit 1060, speaker 1061, and microphone 1062 provide an audio interface between the user and the mobile phone. The audio circuit 1060 converts the received audio data into electrical signals and transmits them to the speaker 1061, where the speaker 1061 converts them into sound signals for output. On the other hand, the microphone 1062 converts the collected sound signals into electrical signals, which are then received by the audio circuit 1060, converted into audio data, and then processed by the processor 1080 before being transmitted via the RF circuit 1010 to, for example, another mobile phone, or the audio data can be output to the memory 1020 for further processing.
[0203] WiFi is a short-range wireless transmission technology. Through the WiFi module 1070, mobile phones can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 14 The WiFi module 1070 is shown, but it is understood that it is not an essential component of a mobile phone and can be omitted as needed without changing the essence of the invention.
[0204] The processor 1080 is the control center of the mobile phone, connecting various parts of the phone through various interfaces and lines. It executes software programs and / or modules stored in the memory 1020 and calls data stored in the memory 1020 to perform various functions and process data, thereby collecting overall data and information from the phone. Optionally, the processor 1080 may include one or more processing units; preferably, the processor 1080 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1080.
[0205] The mobile phone also includes a power supply 1090 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 1080 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0206] Although not shown, mobile phones may also include a camera, Bluetooth module, etc., which will not be described in detail here.
[0207] In this embodiment of the application, the processor 1080 included in the mobile phone also has the following functions:
[0208] Obtain multiple text samples and a text sample to be enhanced, wherein the text sample to be enhanced is any one of the multiple text samples;
[0209] The vector generation model is used to perform vector processing on the multiple text samples and the text sample to be enhanced, respectively, to generate text sample vectors corresponding to the multiple text samples and the text sample to be enhanced corresponding to the text sample to be enhanced, wherein the vector generation model is used to generate the sample vectors corresponding to the text samples.
[0210] Based on multiple text sample vectors and the sample vector to be enhanced, a target text sample vector similar to the sample vector to be enhanced is determined from among the multiple text sample vectors, and a target text sample corresponding to the target text sample vector is determined from among the multiple text samples based on the target text sample vector;
[0211] The target text sample is augmented by a sample augmentation agent to generate an augmented text sample corresponding to the target text sample. The augmented text sample includes augmented samples with the same sample type, similar semantics, and similar font type as the text sample to be augmented. The sample augmentation agent is used for sample augmentation of the text sample.
[0212] This application also provides a computer-readable storage medium for storing a computer program that, when run on a computer device, causes the computer device to perform any one of the sample enhancement methods described in the foregoing embodiments.
[0213] This application also provides a computer program product including a computer program, which, when run on a computer device, causes the computer device to execute any one of the sample enhancement methods described in the foregoing embodiments.
[0214] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the system and equipment described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0215] In the several embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of the system is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple systems may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0216] The system described as separate components may or may not be physically separate. Components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0217] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0218] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing computer programs.
[0219] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0220] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A sample augmentation method, characterized in that, include: Obtain multiple text samples and a text sample to be enhanced, wherein the text sample to be enhanced is any one of the multiple text samples; The vector generation model is used to perform vector processing on the multiple text samples and the text sample to be enhanced, respectively, to generate text sample vectors corresponding to the multiple text samples and the text sample to be enhanced corresponding to the text sample to be enhanced, wherein the vector generation model is used to generate the sample vectors corresponding to the text samples. Based on multiple text sample vectors and the sample vector to be enhanced, a target text sample vector similar to the sample vector to be enhanced is determined from among the multiple text sample vectors, and a target text sample corresponding to the target text sample vector is determined from among the multiple text samples based on the target text sample vector; The target text sample is augmented by a sample augmentation agent to generate an augmented text sample corresponding to the target text sample. The augmented text sample includes augmented samples with the same sample type, similar semantics, and similar font type as the text sample to be augmented. The sample augmentation agent is used for sample augmentation of the text sample.
2. The method according to claim 1, characterized in that, The sample augmentation agent includes a transformation agent and a decision agent. The step of performing sample augmentation processing on the target text sample through the sample augmentation agent to generate an augmented text sample corresponding to the target text sample includes: The target text sample is transformed by the transformation agent in the sample enhancement agent to generate the initial enhanced sample corresponding to the target text sample; The initial augmented sample is processed by the decision-making agent in the sample augmentation agent to obtain the sample update strategy corresponding to the initial augmented sample. The transformation agent in the sample enhancement agent performs text transformation on the initial enhanced sample based on the sample update strategy to generate the text enhancement sample corresponding to the target text sample.
3. The method according to claim 2, characterized in that, The initial augmented sample includes a first character and a second character. The transformation agent in the sample augmentation agent performs text transformation on the initial augmented sample based on the sample update strategy to generate a text augmented sample corresponding to the target text sample, including: The transformation agent in the sample enhancement agent performs character transformation on the first character in the initial enhancement sample based on the sample update strategy to generate a transformed first character, wherein the font type of the first character is similar to the font type of the transformed first character; The transformation agent in the sample enhancement agent combines the transformed first character and the second character to generate a text enhancement sample corresponding to the target text sample.
4. The method according to claim 2, characterized in that, The sample augmentation agent further includes an analysis agent. Before the decision agent in the sample augmentation agent performs decision processing on the initial augmented sample to obtain the sample update strategy corresponding to the initial augmented sample, the method further includes: The analysis agent in the sample enhancement agent performs semantic analysis on the target text sample and the initial enhancement sample to obtain the target text semantics corresponding to the target text sample and the enhancement text semantics corresponding to the initial enhancement sample. The analysis agent in the sample augmentation agent performs a semantic comparison between the target text semantics and the augmented text semantics to obtain the semantic comparison result.
5. The method according to claim 4, characterized in that, The step of processing the initial augmented sample through a decision agent in the sample augmentation agent to obtain the sample update strategy corresponding to the initial augmented sample includes: If the semantic comparison result indicates that the semantics of the target text and the semantics of the enhanced text are not similar, the decision agent in the sample enhancement agent makes a sample decision on the initial enhanced sample based on the semantic comparison result to obtain the sample update strategy corresponding to the initial enhanced sample.
6. The method according to claim 4, characterized in that, The step of processing the initial augmented sample through a decision agent in the sample augmentation agent to obtain the sample update strategy corresponding to the initial augmented sample includes: If the semantic comparison result indicates that the target text semantics and the enhanced text semantics are similar, the model judgment result corresponding to the model constructed for the initial enhanced sample is received; The decision agent in the sample augmentation agent makes sample decisions on the initial augmented sample based on the model's judgment results, thereby obtaining the sample update strategy corresponding to the initial augmented sample.
7. The method according to claim 1, characterized in that, The sample augmentation agent is trained in the following way: The initial text sample is augmented by an initial transformation agent, an initial analysis agent, and an initial decision agent to obtain the training augmented sample corresponding to the initial text sample. Based on the model judgment results corresponding to the model constructed for the training enhancement samples, the parameters of the initial conversion agent, the initial analysis agent, and the initial decision agent are adjusted until the adjusted agents meet the agent training cutoff conditions. The adjustment ends and the conversion agent, analysis agent, and decision agent are obtained. The transformation agent, the analysis agent, and the decision agent are used as sample augmentation agents.
8. The method according to claim 7, characterized in that, The step of performing sample augmentation processing on the initial text sample through an initial transformation agent, an initial analysis agent, and an initial decision agent to obtain the training augmented sample corresponding to the initial text sample includes: The initial text sample is converted by the initial conversion agent to generate an enhanced sample corresponding to the initial text sample. The initial semantic comparison result is obtained by performing semantic comparison between the initial text sample and the augmented sample corresponding to the initial text sample by the initial analysis agent. The initial decision-making agent performs decision processing on the enhanced samples corresponding to the initial text samples based on the initial semantic comparison results to obtain the initial update strategy; The initial conversion agent performs text conversion on the augmented sample corresponding to the initial text sample according to the initial update strategy to obtain the training augmented sample corresponding to the initial text sample.
9. The method according to claim 1, characterized in that, The step of determining a target text sample vector that is similar to the sample vector to be enhanced from the multiple text sample vectors and the sample vector to be enhanced includes: Similarity calculation is performed on multiple text sample vectors and the sample vector to be enhanced to obtain multiple vector similarities, one of which is obtained based on a text sample vector and the sample vector to be enhanced. The vector similarity that falls within the similarity threshold range among the multiple vector similarities is determined as the target vector similarity; The text sample vector corresponding to the similarity of the target vector is determined as the target text sample vector that is similar to the sample vector to be enhanced among the plurality of text sample vectors.
10. The method according to claim 1, characterized in that, The vector generation model is trained in the following way: Obtain the first text sample, the second text sample, and the training label results; The first text sample and the second text sample are processed by the initial generation model to obtain the first sample vector corresponding to the first text sample and the second sample vector corresponding to the second text sample. The first sample vector and the second sample vector are subjected to vector processing to obtain vector processing results, wherein the training label results and the vector processing results are used as a pair of training data. Based on the difference between the training label results and the vector processing results, the parameters of the initial generated model are adjusted until the adjusted model meets the model training cutoff condition, and the adjustment ends to obtain the vector generation model.
11. The method according to claim 10, characterized in that, The training label results include similarity label results between the first text sample and the second text sample, type label results corresponding to the first text sample, and type label results corresponding to the second text sample; the vector processing of the first sample vector and the second sample vector to obtain vector processing results includes: Calculate the similarity between the first sample vector and the second sample vector to obtain the vector similarity result between the first sample vector and the second sample vector. Perform vector classification on the first sample vector and the second sample vector to obtain the type classification result corresponding to the first sample vector and the type classification result corresponding to the second sample vector.
12. A sample enhancement device, characterized in that, include: A text sample acquisition unit is used to acquire multiple text samples and a text sample to be enhanced, wherein the text sample to be enhanced is any one of the multiple text samples; The sample vector processing unit is used to perform vector processing on the plurality of text samples and the text sample to be enhanced through a vector generation model, and generate text sample vectors corresponding to the plurality of text samples and the text sample to be enhanced corresponding to the text sample to be enhanced, wherein the vector generation model is used to generate sample vectors corresponding to the text samples. The target text sample determination unit is configured to determine, based on multiple text sample vectors and the sample vector to be enhanced, a target text sample vector that is similar to the sample vector to be enhanced among the multiple text sample vectors, and based on the target text sample vector, determine the target text sample that corresponds to the target text sample vector among the multiple text samples; A text enhancement sample generation unit is used to perform sample enhancement processing on the target text sample through a sample enhancement agent to generate a text enhancement sample corresponding to the target text sample. The text enhancement sample includes enhancement samples with the same sample type, similar sample semantics, and similar sample font type as the text sample to be enhanced. The sample enhancement agent is used for sample enhancement of the text sample.
13. A computer device, characterized in that, The device includes a processor and a memory: The memory is used to store computer programs and to transfer the computer programs to the processor; The processor is configured to execute the steps of the sample enhancement method according to any one of claims 1 to 11, based on instructions in the computer program.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program that, when executed by a computer device, implements the steps of the sample enhancement method according to any one of claims 1 to 11.
15. A computer program product, characterized in that, Includes a computer program that, when executed by a computer device, implements the steps of the sample enhancement method according to any one of claims 1 to 11.