Post-processing method and device for AI generated text, medium and equipment

By using text classifiers and integral gradient methods to perform fine-grained detection in AI-generated text, and using the Agent system to polish text, the problem of insufficient naturalness and accuracy of AI-generated text is solved, and more efficient manual proofreading reduction and text quality improvement is achieved.

CN120181046AActive Publication Date: 2025-06-20HONG KONG UNIV OF SCI & TECH (GUANGZHOU)
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510183781.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-19
Publication Date
2025-06-20
Estimated Expiration
2045-02-19

AI Technical Summary

Technical Problem

The existing AI-generated text has shortcomings in terms of nature and accuracy, making it difficult to effectively distinguish and detect AI-generated parts from human-written parts, and lacks an effective post-revision mechanism, which increases the workload and cost of manual proofreading.

Method used

By obtaining the AI-to-processed text and inputting it into the trained text classifier model, fine-grained detection is used using the preset integral gradient method and Shapley value analysis method to identify the text units generated by the AI, and input them into the Agent system for polishing, outputting more natural and more accurate text results.

Benefits of technology

It improves the naturalness and accuracy of AI-generated text, reduces the workload of manual proofreading, improves overall work efficiency, and effectively solves the problem of insufficient naturalness and accuracy of AI-generated text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120181046A_ABST
    Figure CN120181046A_ABST
Patent Text Reader

Abstract

The invention discloses a post-processing method and device for an AI generated text, a medium and equipment. According to the method, the to-be-processed AI generation text is obtained and input into the trained text classifier model, the model is trained based on the preset academic writing data set and the social media text data set, and the part (first text), generated by artificial intelligence software, in the AI generation text can be accurately recognized. Then, carrying out fine-grained detection on the first text by utilizing a preset integral gradient method and a Shapley value analysis method, and accurately identifying text units generated by each AI in the first text; finally, the text units generated by the AI are input into a preset Agent system, the Agent system carries out retouching on the units through a generative language model, and a more natural and more accurate text result is output. The problem that in the prior art, a text generated by the AI is insufficient in naturalness and accuracy is effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of post - processing of AI - generated text, and particularly to a method, device, medium and equipment for post - processing AI - generated text. Background Art

[0002] With the rapid development of artificial intelligence (AI) technology, especially the progress of natural language processing (NLP), AI - generated text has been widely used in multiple fields such as content creation, translation, customer service, and marketing copywriting. However, although these texts have reached a certain level in terms of grammatical structure and information conveyance, there are still significant problems, especially in terms of naturalness and accuracy. AI - generated text often lacks the emotions, styles, and personalities of human writing, and may exhibit overly straightforward expressions, repeated words, or illogical situations. In addition, AI models are trained based on a large amount of data and sometimes generate incorrect or misleading information, especially in professional fields such as medicine and law, which affects the credibility of the text. Existing AI detection tools can determine whether a text is AI - generated, but they have limitations in fine - grained analysis, are difficult to capture subtle unnatural or incorrect parts, and lack an effective post - modification mechanism, increasing the workload and cost of manual proofreading.

[0003] Many industries have gradually recognized the importance of text quality control and proofreading while AI - generated text improves productivity. Therefore, developing a technology that can accurately detect errors in AI - generated text and rewrite them has become an urgent need. This can not only improve the quality and credibility of the text but also reduce the workload of manual proofreading and improve overall work efficiency. Current technologies are insufficient in accurately detecting potential errors and unnatural parts of AI - generated text, especially in long texts where the AI - generated part is well integrated with the human - written part, making it difficult to effectively distinguish and detect. These problems result in insufficient naturalness and accuracy of AI - generated text in the existing technologies. Summary of the Invention

[0004] The present invention provides a method, device, medium and equipment for post - processing AI - generated text to solve the problem of insufficient naturalness and accuracy of AI - generated text in the existing technologies.

[0005] In a first aspect, the present application provides a method for post - processing AI - generated text, including:

[0006] Obtain the AI - generated text to be processed;

[0007] Input the AI - generated text into a trained text classifier model so that the text classifier model outputs the first text in the AI - generated text that belongs to the text generated by artificial intelligence software;

[0008] Among them, the text classifier model is obtained by training an initial text classifier based on a preset academic writing dataset and a preset social media text dataset;

[0009] Detect the first text according to a preset integrated gradient method and a preset Shapley value analysis method to obtain each AI-generated text unit in the first text;

[0010] Input each of the AI-generated text units into a preset Agent system so that the Agent system outputs the polishing results of each of the AI-generated text units.

[0011] In this application, by obtaining the AI-generated text to be processed and then inputting it into a trained text classifier model, which is trained based on a preset academic writing dataset and a social media text dataset, it can accurately identify the part generated by artificial intelligence software (the first text) in the AI-generated text. Then, use a preset integrated gradient method and Shapley value analysis method to perform fine-grained detection on the first text, and accurately identify each AI-generated text unit therein. Finally, input these AI-generated text units into a preset Agent system, and the Agent system uses a generative language model to polish these units and output a more natural and accurate text result. This process not only improves the naturalness and accuracy of the text, but also reduces the workload of manual proofreading and improves the overall work efficiency. This application effectively solves the problem of insufficient naturalness and accuracy of AI-generated text in the prior art.

[0012] As a preferred embodiment of the first aspect, the text classifier model is obtained by training an initial text classifier based on a preset academic writing dataset and a preset social media text dataset. Specifically:

[0013] Obtain a preset academic writing dataset and a preset social media text dataset;

[0014] Input the preset academic writing dataset and the preset social media dataset into the initial text classifier so that the initial text classifier adjusts the weight term and the bias term according to the preset supervised learning principle;

[0015] When the loss function of the initial text classifier reaches a preset threshold and no longer changes within a preset time period, stop training to obtain the text classifier model.

[0016] In this preferred embodiment, the present application trains an initial text classifier by using a preset academic writing dataset and a social media text dataset, achieving efficient recognition and classification of AI-generated text. Specifically, first, these two datasets are obtained, and then they are input into the initial text classifier, and the weight terms and bias terms of the model are adjusted using the principle of supervised learning. When the loss function of the model reaches a preset threshold and no longer changes within a preset time period, the training stops, and the final text classification model is obtained. This process not only ensures that the model has strong generalization ability on different types of texts but also improves the accuracy and reliability of the model. The text classifier trained in this way can more accurately identify AI-generated text, providing a solid foundation for subsequent fine-grained detection and polishing, thus significantly improving the overall quality and naturalness of AI-generated text, reducing the workload of manual proofreading, improving work efficiency, and having important application value especially in industries with high requirements for text quality, such as academia, law, and medicine.

[0017] As a preferred embodiment of the first aspect, the obtaining of the preset academic writing dataset and the preset social media text dataset is specifically as follows:

[0018] The preset academic writing dataset includes various academic papers, research reports, and technical documents;

[0019] The preset social media text dataset includes articles, blogs, and comments published on various social platforms.

[0020] In this preferred embodiment, the present application selects an academic writing dataset containing various academic papers, research reports, and technical documents, as well as a social media text dataset covering articles, blogs, and comments published on various social platforms, ensuring the diversity and representativeness of the training data. This selection of datasets enables the text classifier to learn from a wide range of text types, thereby improving its ability to distinguish between AI-generated text and human-created text. Specifically, the academic writing dataset provides a rigorous language style and structured text examples, while the social media text dataset contributes a more free and flexible expression style. By combining these two types of datasets for training, the text classifier can more comprehensively understand and identify different text features, thereby enhancing its accuracy and generalization ability in practical applications.

[0021] As a preferred embodiment of the first aspect, the detecting of the first text according to the preset integrated gradient method and the preset Shapley value analysis method to obtain each AI-generated text unit in the first text is specifically as follows:

[0022] Calculate the gradients of each text unit in the first text with respect to the output of the text classification model according to a preset integral gradient method;

[0023] Calculate the importance scores of the contribution degrees of each text unit in the first text to the output prediction of the text classification model based on the gradients;

[0024] Quantify the contributions of each text unit to the output prediction result of the text classification model according to a preset Shapley value analysis method, and determine the fair contribution values of each text unit;

[0025] Identify the AI-generated text units in the first text based on the importance scores and the fair contribution values;

[0026] The quantization calculation formula for quantifying the contributions of each text unit to the output prediction result of the text classification model according to the preset Shapley value analysis method is as follows:

[0027]

[0028] In the formula, P {AI} (S) represents the first probability that the text classifier model predicts the text to belong to the first text generated by artificial intelligence software under the input of subset S, and P {AI} (S ∪ {x i}) represents the second probability that the text classifier model predicts the text to belong to the first text generated by artificial intelligence software after adding the feature {x i} to subset S; φ i represents the Shapley value of the feature {x i}, which is used to quantify the contribution of the feature {x i} to the prediction result of the text classifier; is a preset weight.

[0029] The formula for calculating the importance scores of the contribution degrees of each text unit in the first text to the output prediction of the text classification model based on the gradients is as follows:

[0030]

[0031] In the formula, x i represents the i-th feature value of the input $x$; x i ′ represents the i-th feature value of the baseline input x i ′ ; α represents a scaling factor from 0 to 1, Denotes the partial derivative of the text classifier model F with respect to the I-th feature of the input x, i.e., the respective gradients.

[0032] In this preferred embodiment, the present application performs fine-grained detection on AI-generated text by adopting a preset integrated gradient method and a Shapley value analysis method, and can accurately identify error units in the text. Specifically, first, the integrated gradient method is used to calculate the gradients of each unit in the text with respect to the output of the classification model, and then the importance scores of the contributions of these units to the model prediction are obtained. Next, the Shapley value analysis method is used to quantify the contributions of each unit to the predicted output result of the model and determine its fair contribution value. Combining the importance scores and the fair contribution values, the system can accurately identify the error units in the text. This process not only improves the accuracy of text detection, but also enhances the transparency and interpretability of model decisions, provides clear guidance for subsequent text optimization, thereby effectively improving the quality and naturalness of AI-generated text, reducing the workload of manual proofreading, and improving the overall work efficiency.

[0033] As a preferred embodiment of the first aspect, the step of inputting the respective AI-generated text units into a preset Agent system to enable the Agent system to output the polished results of the respective AI-generated text units is specifically as follows:

[0034] Input the respective AI-generated text units into a preset Agent system to enable the Agent system to call a variety of preset tools and a preset generative language model to output the polished results of the respective AI-generated text units.

[0035] In this preferred embodiment, the present application realizes the automatic polishing and optimization of the identified error text units by inputting them into a preset Agent system. Specifically, the Agent system uses a variety of preset tools and generative language models it calls to generate more natural and accurate polished results for each error text unit. This process not only significantly improves the naturalness and accuracy of the text, but also reduces the need for manual intervention, improving the efficiency and quality of text processing. In this way, the present application not only solves the problems of unnaturalness and errors in AI-generated text, but also improves the overall readability and professionalism of the text, especially in fields with high requirements for text quality, such as academia, law, and medicine, which has important practical application value.

[0036] In a second aspect, the present application provides a post-processing device for AI-generated text. The post-processing device for AI-generated text includes an acquisition module, a first input / output module, a detection module, and a second input / output module;

[0037] The acquisition module is configured to acquire AI-generated text to be processed;

[0038] The first input / output module is used to input the AI-generated text into a trained text classifier model, so that the text classifier model outputs the first text belonging to the AI software-generated text in the AI-generated text;

[0039] Among them, the text classifier model is trained from an initial text classifier based on a preset academic writing dataset and a preset social media text dataset;

[0040] The detection module is used to detect the first text according to a preset integrated gradient method and a preset Shapley value analysis method to obtain each AI-generated text unit in the first text;

[0041] The second input / output module is used to input each AI-generated text unit into a preset Agent system, so that the Agent system outputs the polishing results of each AI-generated text unit.

[0042] This device uses four modules to work in division and coordination to process AI-generated text more accurately. This application obtains the AI-generated text to be processed and then inputs it into a trained text classifier model, which is trained based on a preset academic writing dataset and a social media text dataset and can accurately identify the part belonging to the AI software-generated text (the first text) in the AI-generated text. Then, use the preset integrated gradient method and Shapley value analysis method to perform fine-grained detection on the first text to accurately identify each AI-generated text unit in it. Finally, input these AI-generated text units into a preset Agent system, and the Agent system uses a generative language model to polish these units and output a more natural and accurate text result. This process not only improves the naturalness and accuracy of the text, but also reduces the workload of manual proofreading, improves the overall work efficiency, and this application effectively solves the problem of insufficient naturalness and accuracy of AI-generated text in the prior art.

[0043] In a third aspect, this application provides a computer-readable storage medium, which includes a stored computer program. Among them, when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the post-processing method of an AI-generated text as described above. Its beneficial effects are the same as those of the post-processing method of an AI-generated text provided in the first aspect of this application.

[0044] Fourthly, the present application provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements any one of the post-processing methods for AI-generated text as described in the first aspect. Description of the Drawings

[0045] Figure 1 : A schematic flowchart of an embodiment of the post-processing method for AI-generated text provided by the present application;

[0046] Figure 2 : A schematic flowchart of an embodiment of the post-processing device for AI-generated text provided by the present application. Detailed Description of the Embodiments

[0047] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts belong to the scope of protection of the present invention.

[0048] Embodiment 1

[0049] Please refer to Figure 1 , a post-processing method for AI-generated text provided by an embodiment of the present invention.

[0050] In this embodiment, the process of the post-processing method for AI-generated text in the present application is described in detail through steps S01-S04.

[0051] S01: Obtain the AI-generated text to be processed.

[0052] As a preferred embodiment of Embodiment 1, the AI-generated text refers to the text content generated by an artificial intelligence model (such as GPT, BERT, etc.). These texts are usually trained by learning a large amount of data to automatically generate a language output related to the input.

[0053] S02: Input the AI-generated text into a trained text classifier model so that the text classifier model outputs the first text in the AI-generated text that belongs to the text generated by artificial intelligence software.

[0054] Among them, the text classifier model is obtained by training an initial text classifier based on a preset academic writing data set and a preset social media text data set.

[0055] As a preferred embodiment of the first embodiment, the text classifier model is obtained by training an initial text classifier based on a preset academic writing dataset and a preset social media text dataset. Specifically:

[0056] First, a model for text classification is constructed based on a pre-trained language model. This model will be trained on two main datasets:

[0057] Academic writing dataset: This dataset contains various types of academic papers, research reports, technical literature, etc. The texts usually have a clear structure and a rigorous language style.

[0058] Social media dataset: This dataset contains articles, blogs, comments, etc. published on social platforms. The text style is relatively free, and the grammatical structure is relatively flexible.

[0059] The use of these two datasets ensures that the classifier can show strong generalization ability on different types of texts to distinguish between AI-generated texts and human-created texts.

[0060] During the training process, the labeled training dataset provides the basis for supervised learning of the model, enabling it to identify which text parts are more likely to be generated by AI. After training, the model can assign a label to each part (e.g., sentence or phrase) in the input text, indicating a high or low likelihood of being generated by AI.

[0061] In this preferred embodiment, the present application trains the initial text classifier by using the preset academic writing dataset and the social media text dataset, achieving efficient recognition and classification of AI-generated texts. Specifically, first, these two datasets are obtained, and then they are input into the initial text classifier, and the weight terms and bias terms of the model are adjusted using the principle of supervised learning. When the loss function of the model reaches the preset threshold and no longer changes within the preset time period, the training stops, and the final text classification model is obtained. This process not only ensures that the model has strong generalization ability on different types of texts but also improves the accuracy and reliability of the model. The text classifier trained in this way can more accurately identify AI-generated texts, providing a solid foundation for subsequent fine-grained detection and polishing, thus significantly improving the overall quality and naturalness of AI-generated texts, reducing the workload of manual proofreading, and improving work efficiency. Especially in industries with high requirements for text quality, such as academia, law, and medicine, it has important application value.

[0062] S03: Detect the first text according to the preset integral gradient method and the preset Shapley value analysis method to obtain each AI-generated text unit in the first text.

[0063] As a preferred embodiment of Embodiment 1, detecting the first text according to a preset integral gradient method and a preset Shapley value analysis method to obtain each text unit generated by AI in the first text specifically includes:

[0064] Calculating, according to the preset integral gradient method (Integral Gradient Method), each gradient of each text unit in the first text with respect to the output of the text classification model;

[0065] Calculating, according to each of the gradients, each importance score of each text unit in the first text for the contribution degree of the output prediction of the text classification model;

[0066] Quantifying, according to the preset Shapley value analysis method, each contribution of each text unit to the output prediction result of the text classification model, and determining each fair contribution value of each text unit;

[0067] Identifying each text unit generated by AI in the first text according to each of the importance scores and each of the fair contribution values.

[0068] The preset integral gradient method assigns an importance score to each input feature (such as vocabulary, sentence, etc.) by calculating the gradient of each input feature relative to the model output. This score indicates the contribution degree of the feature to the model prediction result.

[0069] More specifically, for text data, the integral gradient can be used to quantify the contribution degree of each part (such as words or phrases) in the text to the AI prediction. Its core idea is to determine the importance of each input feature by calculating the gradient integral of the model along the straight-line path between the input and the baseline (usually a zero vector or a blank input).

[0070]

[0071] where: x i : the $i$-th feature value of the input $x$; x i ′ : the $i$-th feature value of the baseline input x i ′ ; α: a scaling factor from 0 to 1 for interpolating between the baseline input and the actual input; The partial derivative of the model F with respect to the $I$-th feature of the input x, representing the instantaneous influence of this feature on the model output.

[0072] By calculating the integral gradient value of each feature, the contribution degree of each part in the text to the model prediction can be quantified. The specific steps are as follows:

[0073] Select the baseline input: Usually, a all-zero vector of the same length as the actual input, or other semantically neutral input, is selected.

[0074] Generate interpolation inputs and calculate gradients: For each interpolation input, calculate the partial derivative of the output of the trained detector model with respect to each input feature.

[0075] 1. Approximate integration: Average the gradients of all interpolation inputs and multiply by (x - x ′ ), to obtain the approximate value of the integrated gradient for each feature.

[0076] 2. Attribution analysis: Evaluate the contribution of each feature (i.e., each part of the text) to the model prediction according to the magnitude of the integrated gradient value.

[0077] The preset Shapley value analysis method quantifies the contribution of each input feature to the final prediction result by perturbing the input features and observing the changes in the model prediction. The Shapley value can provide a more fair and transparent analysis to ensure that the contribution of each input feature is reasonably evaluated.

[0078] More specifically, for the input text X = [x1, x2, …, x n , it can be decomposed into n sub-word parts. The Shapley value of each sub-word part quantifies its contribution to the probability that the model predicts the text as AI-generated. The formula is as follows:

[0079]

[0080] In this formula, P {AI} (S) represents the probability that the model predicts the text as AI-generated under the input of subset S, and S can be achieved by masking the sub-word parts that are not in S (such as removing). P {AI} (S ∪ {x i}) represents the probability that the model predicts the AI-generated text after adding the feature {x i} to the subset S. The output result φ i represents the Shapley value of the feature {x i}, which is used to quantify the contribution of this feature to the prediction result. is a weight to ensure that the contribution of the Shapley value to all combinations is fair. For inputs at different levels of prediction, such as at the word level, the input is the text (the sentence is decomposed into words), and the Shapley value φ i of each word represents the magnitude of the contribution of this word to the prediction. For the sentence level, the document is decomposed into individual sentences, the input text is each decomposed sentence, and the Shapley value represents the contribution of the sentence to the prediction of the text paragraph.

[0081] In this preferred embodiment, the present application uses a preset integrated gradient method and Shapley value analysis method to perform fine-grained detection on AI-generated text, and can accurately identify error units in the text. Specifically, first, the integrated gradient method is used to calculate the gradients of each unit in the text with respect to the output of the classification model, and then the importance scores of these units' contributions to the model prediction are obtained. Next, the Shapley value analysis method is used to quantify the contributions of each unit to the model output prediction result and determine its fair contribution value. Combining the importance scores and fair contribution values, the system can accurately identify the error units in the text. This process not only improves the accuracy of text detection, but also enhances the transparency and interpretability of model decisions, provides clear guidance for subsequent text optimization, thus effectively improving the quality and naturalness of AI-generated text, reducing the workload of manual proofreading, and improving the overall work efficiency.

[0082] S04: Input each of the AI-generated text units into a preset Agent system, so that the Agent system outputs the polished results of each of the AI-generated text units.

[0083] As a preferred embodiment of Embodiment 1, the step of inputting each of the AI-generated text units into a preset Agent system so that the Agent system outputs the polished results of each of the AI-generated text units is specifically as follows:

[0084] After detecting a part of the AI-generated text, the Agent system will be activated and perform subsequent processing. The Agent can call a variety of tools and models (such as generative models like GPT-4) to modify and polish the text.

[0085] The Agent rewrites and polishes the AI-generated part by generating more natural and human-like language expressions. According to the application scenario of the text (such as academic, social media, business copywriting, etc.), the Agent will adjust the tone, structure, and vocabulary selection of the text to make it more in line with the target style.

[0086] If a certain part cannot be effectively modified, the Agent will provide alternative text or modification suggestions for reference by human editors.

[0087] This application obtains the AI-generated text to be processed and then inputs it into a pre-trained text classifier model, which is trained based on a preset academic writing dataset and a social media text dataset and can accurately identify the part generated by artificial intelligence software (the first text) in the AI-generated text. Then, the preset integrated gradient method and Shapley value analysis method are used to perform fine-grained detection on the first text to accurately identify each AI-generated text unit therein. Finally, these AI-generated text units are input into a preset Agent system, and the Agent system uses a generative language model to polish these units and output a more natural and accurate text result. This process not only improves the naturalness and accuracy of the text, but also reduces the workload of manual proofreading and improves the overall work efficiency. This application effectively solves the problem of insufficient naturalness and accuracy of AI-generated text in the prior art.

[0088] Embodiment 2

[0089] Please refer to Figure 2 , which is the post-processing device for AI-generated text provided by the embodiment of this application.

[0090] In this embodiment, the post-processing device for AI-generated text includes an acquisition module 10, a first input / output module 20, a detection module 30, and a second input / output module 40.

[0091] The acquisition module 10 is used to acquire the AI-generated text to be processed.

[0092] As a preferred embodiment of Embodiment 2, the AI-generated text refers to the text content generated by artificial intelligence models (such as GPT, BERT, etc.), and these texts are usually trained by learning a large amount of data to automatically generate language outputs related to the input.

[0093] The first input / output module 20 is used to input the AI-generated text into a pre-trained text classifier model so that the text classifier model outputs the first text generated by artificial intelligence software in the AI-generated text.

[0094] Among them, the text classifier model is obtained by training an initial text classifier based on a preset academic writing dataset and a preset social media text dataset.

[0095] As a preferred embodiment of Embodiment 2, the text classifier model is obtained by training an initial text classifier based on a preset academic writing dataset and a preset social media text dataset, specifically:

[0096] First, a model for text classification is constructed based on a pre-trained language model. This model will be trained on two main datasets:

[0097] Academic writing dataset: This dataset contains various types of academic papers, research reports, technical literature, etc. The text usually has a clear structure and a rigorous language style.

[0098] Social media dataset: This dataset contains articles, blogs, comments, etc. published on social platforms. The text style is relatively free, and the grammatical structure is relatively flexible.

[0099] The use of these two datasets ensures that the classifier can exhibit strong generalization ability on different types of texts to distinguish between AI-generated texts and human-written texts.

[0100] During the training process, the labeled training dataset provides the basis for supervised learning for the model, enabling it to identify which text parts are more likely to be generated by AI. After training is completed, the model can assign a label to each part (e.g., sentence or phrase) in the input text, indicating a high or low likelihood of being generated by AI.

[0101] In this preferred embodiment, the present application realizes the efficient identification and classification of AI-generated texts by using a preset academic writing dataset and a social media text dataset to train an initial text classifier. Specifically, first, these two datasets are obtained, and then they are input into the initial text classifier, and the weight terms and bias terms of the model are adjusted using the principle of supervised learning. When the loss function of the model reaches a preset threshold and no longer changes within a preset time period, the training stops, and the final text classification model is obtained. This process not only ensures that the model has strong generalization ability on different types of texts but also improves the accuracy and reliability of the model. The text classifier trained in this way can more accurately identify AI-generated texts, providing a solid foundation for subsequent fine-grained detection and polishing, thereby significantly improving the overall quality and naturalness of AI-generated texts, reducing the workload of manual proofreading, and improving work efficiency. Especially in industries with high requirements for text quality, such as academia, law, and medicine, it has important application value.

[0102] The detection module 30 is used to detect the first text according to a preset integrated gradient method and a preset Shapley value analysis method to obtain each AI-generated text unit in the first text.

[0103] As a preferred embodiment of the second embodiment, the detecting the first text according to a preset integrated gradient method and a preset Shapley value analysis method to obtain each AI-generated text unit in the first text is specifically:

[0104] According to the preset Integral Gradient Method, calculate the gradients of each text unit in the first text with respect to the outputs of the text classification model;

[0105] According to the gradients, calculate the importance scores of each text unit in the first text for the output prediction contribution degree of the text classification model;

[0106] According to the preset Shapley value analysis method, quantify the contributions of each text unit to the output prediction result of the text classification model, and determine the fair contribution values of each text unit;

[0107] According to the importance scores and the fair contribution values, identify each AI-generated text unit in the first text.

[0108] The preset Integral Gradient Method assigns an importance score to each input feature (such as words, sentences, etc.) by calculating the gradient of each input feature with respect to the model output. This score indicates the degree of contribution of the feature to the model prediction result.

[0109] More specifically, for text data, the integral gradient can be used to quantify the contribution of each part of the text (such as words or phrases) to the AI prediction. Its core idea is to determine the importance of each input feature by calculating the integral of the gradient along a straight-line path between the input and the baseline (usually a zero vector or a blank input).

[0110]

[0111] where: x i : the $i$-th feature value of the input $x$; x i ′ : the $i$-th feature value of the baseline input x i ′ ; α: a scaling factor from 0 to 1, used to interpolate between the baseline input and the actual input; The partial derivative of the model F with respect to the $I$-th feature of the input x, representing the instantaneous impact of this feature on the model output.

[0112] By calculating the integral gradient value of each feature, the contribution degree of each part of the text to the model prediction can be quantified. The specific steps are as follows:

[0113] Select the baseline input: Usually, a zero vector with the same length as the actual input, or other semantically neutral inputs, is selected.

[0114] Generate the interpolated input and calculate the gradient: For each interpolated input, calculate the partial derivative of the output of the trained detector model with respect to each input feature.

[0115] 1. Approximate integration: Average the gradients for all interpolated inputs and multiply by (x - x ′ ), to obtain an approximate value of the integrated gradient for each feature.

[0116] 2. Attribution analysis: Evaluate the contribution of each feature (i.e., each part of the text) to the model prediction according to the magnitude of the integrated gradient value.

[0117] The preset Shapley value analysis method quantifies the contribution of each input feature to the final prediction result by perturbing the input features and observing the changes in the model prediction. The Shapley value can provide a more fair and transparent analysis to ensure that the contribution of each input feature is reasonably evaluated.

[0118] More specifically, for the input text X = [x1, x2, …, x n , it can be decomposed into n sub-word parts. The Shapley value of each sub-word part quantifies its contribution to the probability that the model predicts the text as AI-generated. The formula is as follows:

[0119]

[0120] In this formula, P {AI} (S) represents the probability that the model predicts the text as AI-generated under the input of subset S, and S can be achieved by masking the sub-word parts that are not in S (such as removing). P {AI} (S ∪ {x i}) represents the probability that the model predicts the AI-generated text after adding the feature {x i} to the subset S. The output result φ i represents the Shapley value of the feature {x i}, which is used to quantify the contribution of this feature to the prediction result. is a weight to ensure that the contribution of the Shapley value to all combinations is fair. For inputs at different levels of prediction, such as at the word level, the input is the text (the sentence is decomposed into words), and the Shapley value φ i of each word represents the magnitude of the contribution of this word to the prediction. For the sentence level, the document is decomposed into individual sentences, the input text is each decomposed sentence, and the Shapley value represents the contribution of the sentence to the prediction of the text paragraph.

[0121] In this preferred embodiment, the present application uses a preset integrated gradient method and Shapley value analysis method to perform fine-grained detection on AI-generated text, and can accurately identify error units in the text. Specifically, first, the integrated gradient method is used to calculate the gradients of each unit in the text with respect to the output of the classification model, and then the importance scores of these units' contributions to the model prediction are obtained. Next, the Shapley value analysis method is used to quantify the contributions of each unit to the model output prediction result and determine its fair contribution value. Combining the importance scores and fair contribution values, the system can accurately identify the error units in the text. This process not only improves the accuracy of text detection, but also enhances the transparency and interpretability of model decisions, provides clear guidance for subsequent text optimization, effectively improves the quality and naturalness of AI-generated text, reduces the workload of manual proofreading, and improves the overall work efficiency.

[0122] The second input-output module 40 is used to input each of the AI-generated text units into a preset Agent system, so that the Agent system outputs the polished results of each of the AI-generated text units.

[0123] As a preferred embodiment of the second embodiment, the step of inputting each of the AI-generated text units into a preset Agent system so that the Agent system outputs the polished results of each of the AI-generated text units is specifically:

[0124] After detecting a part of the AI-generated text, the Agent system will be activated and perform subsequent processing. The Agent can call a variety of tools and models (such as generative models like GPT-4) to modify and polish the text.

[0125] The Agent rewrites and polishes the AI-generated part by generating more natural and more in line with human language expression habits. According to the application scenario of the text (such as academic, social media, business copywriting, etc.), the Agent will adjust the tone, structure and vocabulary selection of the text to make it more in line with the target style.

[0126] If a certain part cannot be effectively modified, the Agent will provide alternative text or modification suggestions for reference by human editors.

[0127] This application obtains the AI-generated text to be processed and then inputs it into a trained text classifier model, which is trained based on a preset academic writing dataset and a social media text dataset and can accurately identify the part generated by artificial intelligence software (the first text) in the AI-generated text. Then, the preset integrated gradient method and Shapley value analysis method are used to perform fine-grained detection on the first text to accurately identify each AI-generated text unit therein. Finally, these AI-generated text units are input into a preset Agent system, and the Agent system uses a generative language model to polish these units and output a more natural and accurate text result. This process not only improves the naturalness and accuracy of the text, but also reduces the workload of manual proofreading and improves the overall work efficiency. This application effectively solves the problem of insufficient naturalness and accuracy of AI-generated text in the prior art.

[0128] Embodiment III:

[0129] An embodiment of this application provides a computer-readable storage medium, which includes a stored computer program. Among them, when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the post-processing method of an AI-generated text described above;

[0130] Among them, for the post-processing method of an AI-generated text, if it is implemented in the form of a software functional unit and used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, to implement all or part of the processes in the above embodiment methods of the present invention, it can also be completed by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc.

[0131] Embodiment IV

[0132] The present application provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements any one of the post-processing methods for AI-generated text as described in Embodiment 1.

[0133] In the above specific embodiments, the objectives, technical solutions, and beneficial effects of the present invention have been further described in detail. It should be understood that the above are only specific embodiments of the present invention and are not used to limit the protection scope of the present invention. In particular, for those skilled in the art, any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A post-processing method for AI-generated text, characterized in that: include: Get the AI ​​generated text to be processed; Inputting the AI-generated text into a trained text classifier model so that the text classifier model outputs a first text in the AI-generated text that is generated by artificial intelligence software; The text classifier model is obtained by initial text classifier training based on a preset academic writing dataset and a preset social media text dataset; Detecting the first text according to a preset integral gradient method and a preset Shapley value analysis method to obtain each AI-generated text unit in the first text; The text units generated by the AI ​​are input into a preset Agent system, so that the Agent system outputs the polishing results of the text units generated by the AI.

2. The post-processing method of AI generated text according to claim 1, characterized in that: The text classifier model is obtained by initial text classifier training based on a preset academic writing dataset and a preset social media text dataset, specifically: Get a preset academic writing dataset and a preset social media text dataset; Inputting the preset academic writing dataset and the preset social media dataset into an initial text classifier, so that the initial text classifier adjusts weight items and bias items according to a preset supervised learning principle; When the loss function of the initial text classifier reaches a preset threshold and does not change within a preset time period, the training is stopped to obtain the text classifier model.

3. The post-processing method of AI generated text according to claim 2, characterized in that: The obtaining of the preset academic writing dataset and the preset social media text dataset is specifically as follows: The preset academic writing dataset includes various academic papers, research reports and technical documents; The preset social media text dataset includes articles, blogs and comments published on various social platforms.

4. The post-processing method of AI generated text according to claim 1, characterized in that: The first text is detected according to the preset integral gradient method and the preset Shapley value analysis method to obtain each AI-generated text unit in the first text, specifically: According to a preset integral gradient method, each gradient of each text unit in the first text to the output of the text classification model is calculated; Calculating, based on the gradients, respective importance scores of the contribution of respective text units in the first text to the output prediction of the text classification model; According to a preset Shapley value analysis method, quantify the contributions of each text unit to the prediction result output by the text classification model, and determine the fair contribution value of each text unit; According to the respective importance scores and the respective fairness contribution values, respective AI-generated text units in the first text are identified.

5. The post-processing method of AI generated text according to claim 4, characterized in that: The preset Shapley value analysis method is used to quantify the contribution of each text unit to the prediction result output by the text classification model, specifically: The quantitative calculation formula for quantifying the contribution of each text unit to the prediction result output by the text classification model according to the preset Shapley value analysis method is: Where P {AI} (S) represents the first probability that the text classifier model predicts that the text is the first text generated by the artificial intelligence software under the input of the subset S, P {AI} (S∪{x i }) represents adding the feature {x i }, the text classifier model predicts a second probability that the text belongs to the first text generated by the artificial intelligence software; i Represents the feature {x i }, which is used to quantify the feature {x i } contribution to the prediction results of the text classifier; The preset weights.

6. The post-processing method of AI generated text according to claim 4, characterized in that: The importance scores of the contribution of each text unit in the first text to the output prediction of the text classification model are calculated based on the respective gradients, specifically: The formula for calculating the importance scores of the contribution of each text unit in the first text to the output prediction of the text classification model according to each gradient is: In the formula, x i represents the $i$th eigenvalue of input $x$; x i ′ represents the baseline input x i ′ The $i$th eigenvalue of ; α represents the scale factor from 0 to 1, Represents the partial derivatives of the text classifier model F with respect to the I-th feature of the input x, that is, the gradients.

7. The post-processing method of AI generated text according to claim 1, characterized in that: The step of inputting each AI-generated text unit into a preset Agent system so that the Agent system outputs a polishing result of each AI-generated text unit is specifically as follows: The text units generated by the AI ​​are input into a preset Agent system, so that the Agent system calls a plurality of preset tools and a preset generative language model to output polishing results of the text units generated by the AI.

8. A post-processing device for AI-generated text, characterized in that: It includes an acquisition module, a first input-output module, a detection module, and a second input-output module; The acquisition module is used to obtain the AI ​​generated text to be processed; The first input-output module is used to input the AI-generated text into a trained text classifier model, so that the text classifier model outputs the first text generated by the artificial intelligence software in the AI-generated text; The text classifier model is obtained by initial text classifier training based on a preset academic writing dataset and a preset social media text dataset; The detection module is used to detect the first text according to a preset integral gradient method and a preset Shapley value analysis method to obtain each AI-generated text unit in the first text; The second input-output module is used to input each of the AI-generated text units into a preset Agent system, so that the Agent system outputs the polishing results of each of the AI-generated text units.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the post-processing method of AI-generated text as described in any one of claims 1 to 7.

10. A terminal device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the post-processing method of the AI-generated text as described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Enhancement method, system and equipment for intention recognition training sample data and medium

    CN114548313A

  • Meteorological contribution evaluation method, system and terminal for ozone pollution

    CN118112686A

  • Intelligent manuscript reviewing system and method based on AI

    CN118485060A

  • AI text detection method based on pre-training model

    CN118734124A

  • Construction method and device of AI text detection model, equipment and storage medium

    CN118964615A