Toxic speech detection method and system based on forgetting learning

By introducing a forgetting learning mechanism, the forgotten events of the toxic speech detection model are quantified and the dataset is simplified, solving the problems of training data redundancy and annotation noise. This achieves more efficient and robust toxic speech detection, improving the model's generalization ability and detection accuracy.

CN121501995APending Publication Date: 2026-02-10ZHEJIANG UNIV OF TECH

Patent Information

Application Number
CN202511488979.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-17
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

Existing toxic speech detection models suffer from low training efficiency and insufficient generalization ability due to redundant training data and annotation noise.

Method used

By quantifying forgetting events in data samples using forgetting learning theory, filtering and removing samples that are difficult to forget, simplifying the dataset, and optimizing the model through a two-stage training framework, including lightweight model rapid evaluation and efficient parameter fine-tuning techniques, an adaptive toxicity detection system is constructed.

Benefits of technology

It significantly improves model training speed and detection efficiency, reduces computational resource consumption, enhances model robustness and detection accuracy, and improves the accuracy of identifying toxic speech and the control of false positives in non-toxic text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121501995A_ABST
    Figure CN121501995A_ABST
Patent Text Reader

Abstract

The invention discloses a toxic speech detection method and system based on forgetting learning, and the method comprises the steps: firstly constructing a toxic speech classification model, dynamically tracking the classification state change of each sample in a training process, and carrying out the quantitative calculation of the total number of forgetting events; then sorting and analyzing the samples based on the forgetting frequency, and identifying and removing redundant samples which are difficult to forget so as to construct a high-quality simplified training set; and the model is retrained by using the simplified data set, the model parameters are optimized, and the detection efficiency is improved. The system comprises a data preprocessing module, a forgetting event calculation module, a sample screening module, a model training module and a detection generation module, and a complete toxicity speech detection and optimization process is formed. According to the method, a forgetting learning mechanism is introduced, so that the defects of training data redundancy, annotation noise interference and the like in a traditional method are effectively overcome, the model training speed and generalization performance are remarkably improved while the detection accuracy is ensured, and reliable technical support is provided for online content safety management and toxic speech real-time detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of natural language processing and machine learning, and more specifically, to a method and system for improving the performance of toxic speech detection models through a forgetting learning mechanism. Background Technology

[0002] With the rapid development of internet technology, online platforms such as social media, forums, and e-commerce reviews have become important venues for user information exchange, but they have also bred a large amount of toxic speech. Such speech not only infringes on user rights and damages the online environment, but may also trigger social conflicts. Therefore, the detection of toxic speech has become a key requirement for online platform operation and cyberspace governance.

[0003] Currently, toxic speech detection primarily relies on large language models based on deep learning. These models are fine-tuned on labeled toxic speech datasets to enable toxic speech classification. However, existing technologies suffer from the following core problems: Redundant training data: Existing toxic speech datasets typically contain a large number of redundant samples. Once correctly classified during model training, these samples will not be misclassified again, contributing minimally to the model's final toxicity detection performance while consuming significant storage space and training computational resources. This leads to low training efficiency, long training cycles, and high hardware resource consumption. Some toxic speech datasets contain annotation noise: These samples are easily forgotten during training, interfering with the model's learning process and reducing detection accuracy.

[0004] Patent announcement CN119443110A (A Semantic Detection Method, System, and Medium Based on Prompt Optimization) discloses a semantic detection method, system, and medium based on prompt optimization. The method includes: crawling data from various network platforms and filtering out malicious speech data to form a malicious speech dataset; randomly selecting a portion of data from the malicious speech dataset as a training dataset and using the remaining data as a test dataset; generating a malicious speech detection model based on the training dataset and testing the malicious speech detection model using the test dataset; and performing semantic detection using the tested malicious speech detection model. This invention improves the model's efficiency in utilizing small-scale labeled data by automatically designing effective prompts, thereby reducing dependence on large-scale labeled data. This not only reduces the cost of data collection and labeling but also eliminates the instability and cost of manually designing prompts.

[0005] Patent announcement CN116304025A (A Customer Service Intelligent Labeling Method and System Based on Artificial Intelligence Technology) discloses a customer service intelligent labeling method and system based on artificial intelligence technology. First, an intelligent labeling model is constructed based on the FastText algorithm. Next, based on business needs, model training rules are configured, including the design of model training hyperparameters and performance measurement schemes. Further, the intelligent labeling model is trained, and its labeling performance is tested. If preset indicators are met, the model is released online. Then, model operation management rules are configured, and the model is continuously iterated and optimized based on incorrectly labeled work orders generated in subsequent business operations. The model operation and labeling results are then output. This invention has wide applications and is generally applicable to customer service in various industries. It constructs and trains an intelligent labeling model based on the FastText algorithm to achieve efficient and accurate labeling of work orders. Incremental training is possible, and by configuring model operation management rules, the model version can be updated based on work order text data accumulated in business operations after the model is launched, continuously iterating and optimizing the model for easy maintenance.

[0006] While the aforementioned existing patents demonstrate some effectiveness in labeling malicious speech and customer service, they do not adequately address the issues of high sample complexity, redundancy, and annotation noise in large-scale datasets, leading to low model training efficiency and insufficient adaptability. Therefore, there is an urgent need to propose a method and system that utilizes forgetting learning theory to quantify the forgetting events of toxic speech samples, filter and remove samples that are difficult to forget, thereby simplifying the dataset and improving the efficiency of toxic speech detection. Summary of the Invention

[0007] To overcome the above-mentioned shortcomings of the prior art, this invention proposes a method and system for detecting toxic speech based on forgetting learning.

[0008] This invention addresses the problems of dataset redundancy and insufficient model generalization ability in existing toxic speech detection methods. By quantifying the forgetting events of data samples during training and then removing samples that are rarely forgotten from the training data, the dataset is streamlined, thereby improving the model's efficiency in detecting toxic speech. This invention effectively reduces dataset redundancy, increases training speed, and eliminates noisy samples to optimize the model learning process, providing a new technical path for building adaptive toxicity detection systems.

[0009] The first aspect of this invention relates to a method for detecting toxic speech based on forgetting learning, comprising the following steps: S1. Collect a dataset of labeled toxic speech. Each sample contains input text and real labels. Standardize the text and convert it into a feature vector that the model can input. S2. Construct a toxic speech classification model and train it using a stochastic gradient descent optimizer. During the training process, track the classification status of each sample, calculate the classification accuracy of the sample in the corresponding training step, and accumulate the total number of forgotten events for each sample based on the classification accuracy. S3. After training, sort the samples according to the total number of forgotten events. The smaller the total number of forgotten events of a sample, the more difficult the sample is to be forgotten. Set a screening threshold and remove the samples with the smallest total number of forgotten events in the training dataset to obtain a simplified dataset. S4. Using the simplified dataset, retrain the toxic speech classification model, using the same model structure and hyperparameters, and output the final detection model. S5. For the input text, predict whether it is toxic speech using the optimized model, output the classification result, and evaluate the efficiency of toxic speech detection.

[0010] Preferably, step S1 specifically includes: S1.1: Collect a dataset of labeled toxic speech Each sample contains the input text. and real labels ; S1.2: Standardize the text and convert it into a feature vector that the model can input; More preferably, step S2 specifically includes: S2.1: Construct a toxic speech generator and train it using a stochastic gradient descent optimizer; S2.2: For each instance in each dataset Initialize two variables:

[0011] in Recording model in In this test, the instance The correctness of the classification Recording Examples The total number of forgotten events; S2.3: During training, one random sample is taken from the dataset in each iteration. batch B For each instance By comparing the predicted class output by the model's forward propagation with the true label, the model's accuracy in predicting the example is calculated. Correctness of classification :

[0012] in These are model parameters; S2.4 If the instance If a class is classified incorrectly in two consecutive training steps, a forgetting event occurs. Updated to:

[0013] Use the current batch B Perform gradient updates on the model; Preferably, step S3 specifically includes: S3.1: After training, calculate based on the total number of forgotten events. Sort the samples. The smaller the sample size, the less likely it is to be forgotten; S3.2: Set the filtering threshold Delete dataset Total number of forgotten events The smallest front Samples were used to obtain a simplified dataset. ; Preferably, step S4 specifically includes: S4.1: using the simplified dataset Fine-tuning the large model, loading the pre-trained large model, initialization LoRA Configuration; S4.2: Mini-batch gradient descent is employed, with settings for the learning rate, batch size, and number of training epochs. Cross-entropy loss is used as the loss function, and the optimization objective is to minimize the model's classification loss on the dataset. Early stopping is employed during training to save the optimal model parameters, ultimately resulting in an optimized detection model. ; Preferably, step S5 specifically includes: S5.1: Inputting the text of the speech to be detected into the fine-tuned large model. After text preprocessing, model encoding, and classification head prediction, the system outputs a prediction result indicating whether the statement is toxic or non-toxic, thus completing the toxic statement detection.

[0014] This invention comprises five stages: data preparation, forgotten event tracking, sample screening, model fine-tuning, and performance evaluation. The specific procedures for each stage are as follows.

[0015] The data preparation phase involves the following steps: S1: Collect a dataset of labeled toxic speech, which includes text data and its toxic labels; perform standardized preprocessing on the text, including word segmentation and stop word removal, and use a pre-trained language model to convert the text into feature vectors, providing standardized input for subsequent model training.

[0016] The steps in the forgotten event tracking phase are as follows: S2: Construct an initial toxic speech classification model using a CNN and train it using stochastic gradient descent. During this process, two state variables are initialized for each sample: historical classification accuracy and forgotten event count. In each training batch, the classification state change of each sample is monitored in real time. When a sample changes from a previously correctly classified category to an incorrectly classified category, a forgotten event is determined, and the corresponding forgotten event value is updated, thereby quantifying the frequency of forgetting for each sample during the learning process.

[0017] The sample selection phase involves the following steps: S3: After initial training, all samples are sorted in ascending order based on the total number of forgotten events. Samples with smaller total forgotten events are considered "hard-to-forget samples," meaning they are redundant data that contributes limited improvement to model performance. A selection threshold k is set to 30%, and the top k% of hard-to-forget samples are removed to obtain a streamlined dataset, effectively compressing the dataset size and potentially filtering out annotation noise.

[0018] The model fine-tuning phase involves the following steps: S4: Based on a simplified dataset, fine-tuning training is performed using the more advanced large language model Llama-8B. Combining the efficient parameter fine-tuning technique LoRA, appropriate hyperparameters such as learning rate and batch size are set, and an early stopping strategy is employed to prevent overfitting, ultimately resulting in an optimized toxic speech detection model. Simultaneously, a baseline model is trained based on the original dataset for comparison.

[0019] The performance evaluation phase proceeded as follows: S5: The detection performance of the model was compared and evaluated on an independent test set. The improvement in model performance was quantified using metrics such as accuracy, recall, and F1 score. Experimental results showed that the model trained on the simplified dataset outperformed the baseline model on multiple metrics, particularly in terms of accuracy in identifying toxic text and control of false positives in non-toxic text, thus validating the effectiveness of the forgetting learning mechanism in improving the model's generalization ability and detection efficiency.

[0020] Through the synergistic effect of the above stages, this invention innovatively applies forgetting learning theory to the field of toxic speech detection, achieving the goal of evaluating data value and optimizing training set quality from a dynamic learning perspective. Compared with existing technologies, this invention not only significantly improves model training efficiency and reduces computational resource consumption, but also effectively enhances model robustness and detection accuracy through data refinement.

[0021] In summary, this invention, based on dynamic learning and evaluation of labeled toxic speech data, effectively solves the problems of low model training efficiency and insufficient generalization ability caused by redundant training data and labeling noise in traditional toxic speech detection by utilizing steps such as forgetting event quantification, screening of hard-to-forget samples, and two-stage fine-tuning training. This invention not only considers the static characteristics of the data itself but also delves deeper into the dynamic behavioral characteristics of the model during the learning process, constructing a more intelligent and efficient data optimization paradigm.

[0022] A second aspect of the present invention relates to a system for implementing a toxic speech detection method based on forgetting learning, comprising: a data preprocessing module, a forgetting event calculation module, a sample screening module, a model training module, and a detection generation module; The data preprocessing module is used to standardize the original toxic speech dataset and generate feature vectors; The forgetting event calculation module is used to track the classification state changes of each sample during model training, and to calculate and store the total number of forgetting events for each sample. ; The sample screening module is used to... Sort the dataset, remove the hard-to-forget samples, and output a simplified dataset. The model training module is used to train a classification model based on a simplified dataset and output an optimized detection model. The detection generation module is used to receive input text and output toxic speech detection results through an optimized model.

[0023] This invention addresses the problems of low training efficiency and insufficient generalization ability in existing toxic speech detection models caused by redundant training data and annotation noise, and makes innovative improvements. By introducing forgetting learning theory into the data quality assessment and screening process, it achieves efficient dataset simplification and simultaneous optimization of model performance. The main innovations are summarized as follows: (1) This invention is the first to systematically apply the forgetting learning mechanism to the field of toxic speech detection, pioneering a new paradigm of evaluating data value through training dynamics. Unlike traditional methods that only focus on static features of data or the final model accuracy, this invention transforms the model's learning process for samples into a quantifiable indicator by quantifying the total number of forgetting events for each training sample during the iteration process, providing a new scientific basis for data screening that originates from the model's learning behavior itself.

[0024] (2) A strategy for identifying and removing forgettable samples is proposed, achieving intelligent simplification of the training dataset. This invention innovatively defines forgettable samples as samples that are rarely forgotten by the model throughout the training process, and demonstrates that such samples are mostly redundant or simple samples that contribute little to the model's performance. By setting a threshold to remove these samples, the size of the dataset can be significantly compressed. While reducing storage and computational costs, this forces the model to focus on learning more challenging and informative key samples, thereby improving training efficiency and model generalization ability.

[0025] (3) A two-stage training framework was constructed. This invention designs a complete process of first screening data based on forgetting learning and then fine-tuning the training using a simplified dataset. The framework has both versatility and flexibility: the first stage can use a lightweight model and use CNN to quickly complete data evaluation; the second stage can load the advanced large language model Llama and use the efficient parameter fine-tuning technique LoRA to train a high-performance model, thereby achieving an efficient combination of data optimization and model fine-tuning.

[0026] (4) It achieves indirect filtering of potential annotation noise, enhancing the robustness of the model. Samples that are easily forgotten during training are often noisy samples with ambiguous or incorrect annotations. Although the direct purpose of this invention is to remove redundant samples, this process can also objectively reduce the interference of noisy samples, allowing the model to learn on cleaner data, which helps to improve the accuracy and stability of the final detection model.

[0027] (5) Through modular system design, data preprocessing, forgetting tracking, sample screening, model training, and testing and evaluation are integrated into a unified solution. The system has a clear process and well-defined responsibilities for each module, which not only facilitates implementation but also provides a solid foundation for subsequent research such as using forgetting analysis for incremental learning or model diagnosis.

[0028] This invention introduces the novel perspective of forgetting learning into the detection of toxic speech, achieving a shift from data quantity to data quality, and providing a more efficient, intelligent, and robust model training and optimization path for core content security tasks.

[0029] The advantages of this invention are: by introducing a forgetting learning mechanism, it effectively overcomes the defects of traditional methods such as redundant training data and annotation noise interference, and significantly improves the training speed and generalization performance of the model while ensuring detection accuracy, providing reliable technical support for online content security governance and real-time detection of toxic speech. Attached Figure Description

[0030] The accompanying drawings are provided to give a visual representation of the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof.

[0031] Figure 1 This is an overall flowchart of the method of the present invention; Figure 2 This is a detailed flowchart of the method of the present invention; Figure 3 This is a performance comparison chart of models trained on the original Beavertails dataset and the simplified dataset on the toxicity detection task. Detailed Implementation

[0032] The embodiments are provided to illustrate the objectives, technical methods, and advantages of the present invention in more detail. They are used together with the embodiments of the present invention to explain the invention. The specific embodiments described herein are for illustrative purposes only and do not constitute a limitation thereof.

[0033] Example 1

[0034] like Figure 1 , Figure 2 As shown in this embodiment, a toxic speech detection method based on forgetting learning is proposed, mainly applied to the comment control scenario on online social platforms. In the comment section of social platforms, users generate massive amounts of text content every day, which may contain phrases such as "..." Big ears, pointed ears, rat ears, pork ears, sticky out ears, floppy ears, beetle brains To maintain a healthy online environment, platforms need to detect and delete user-generated toxic comments in real time. In this implementation, the BeaverTails dataset is selected to simulate the distribution of comments on a real platform, aiming to verify the effectiveness of the method of this invention in improving toxicity detection on online social platforms, and to evaluate and analyze the data based on this dataset. This dataset contains approximately 30,207 text data entries, of which approximately 17,315 are toxic comments and approximately 12,892 are non-toxic comments, making it highly representative and of practical significance. The specific implementation steps are as follows: S1, Collect a toxic comment annotation dataset, the steps of which are: S1.1 Load text data and its true labels from the Beavertails dataset. For example, if the input text is " Big ears, pointed ears, rat ears, pork ears, sticky out ears, floppy ears, beetle brains ", tagged " false ”; S1.2. Segment the input text into words by loading a pre-trained model. BERT-base As a text embedding layer, it is transformed into word vectors that the model can input.

[0035] S2. Construct a toxic speech classification model and train it using a stochastic gradient descent optimizer. During training, track the classification state of each sample, calculate the classification accuracy of the sample at each training step, and accumulate the total number of forgotten events for each sample based on the classification accuracy. The steps are as follows: S2.1 Constructing a framework adapted for text toxicity detection tasks CNNThe model extracts local toxicity features and outputs binary classification probabilities. During model initialization, it is trained using a stochastic gradient descent (SGD) optimizer and uses cross-entropy loss as the loss function. S2.2, to Beavertails Each sample in the dataset is initialized with two global tracking variables: the classification correctness of the sample detected by the model and the classification accuracy. The total number of forgotten events that occurred in the sample ; S2.3, Adopt mini-batch SGD For training, 32 samples are randomly sampled in each batch, and the predicted label for each sample is obtained through forward propagation of the model. Compare the predicted labels with the true labels to generate the current classification accuracy. The calculation formula is as follows:

[0036] S2.4. Compare the classification results of the sample in two consecutive training steps. If the previous classification result of the sample was correct and the current classification result is incorrect, then it is determined as a forgotten event. Update the total number of forgotten events, switch the model training mode to perform gradient calculation and parameter update, use the SGD optimizer for backpropagation to minimize the cross-entropy loss, and adopt multiple sub-training strategies to ensure the stability and repeatability of the forgotten event statistics. The calculation formula is as follows:

[0037] S3. The steps of screening for forgettable samples and reducing the dataset are as follows: S3.1 Process the forgetting statistics after training. First, assign a unique identifier to each sample and establish a complete data tracking system. Use a two-level sorting mechanism. The primary sorting key is the average number of forgettings of the sample, and the secondary sorting key is the sample identifier. Ensure that samples with the same number of forgettings have a definite order. Sort the samples in ascending order and divide them into samples from hard-to-forget samples to easy-to-forget samples. S3.2 Setting the filtering threshold That is, before removal Based on a preset retention ratio, the number of samples to be retained is calculated. High-ranking, easily forgotten samples are removed, while low-ranking, key samples are retained, resulting in a streamlined dataset. .

[0038] S4. Simplified dataset training and model optimization, the steps are as follows: S4.1 Employs efficient parameter fine-tuning techniques to load pre-trained large models. Llama-8B For simplified datasets Perform format conversion and adjust toAlpaca The dataset is in a specific format, and word segmentation is performed using the model's native word segmenter. Configuration is required. LoRA adapter; S4.2 Configure training parameters, optimizer is adaw_torch The system includes an early stopping mechanism, initiating the training process, setting up mini-batch gradient descent, loss monitoring to ensure the model trains normally until convergence, and finally saving the data. LoRA Adapter parameters, output final model .

[0039] S5. The evaluation of the efficiency of toxic speech detection involves the following steps: S5.1, Model-based To speculate on toxic remarks, Beavertails The test set of the dataset contains 3021 samples. Batch inference is performed on each sample, and the predicted labels for different models are recorded and metrics are calculated.

[0040] like Figure 3 As shown, after filtering the training data through the forgetting learning mechanism and fine-tuning with LoRA, the toxic speech detection model of this system... The overall recognition accuracy on the test set is higher than that of the benchmark model. of Upgraded to The recall rate for safety-related statements was [missing information]. Increase to This significantly reduces the risk of mistakenly deleting legitimate content; simultaneously, the F1 score for toxic content has increased from 0.47 to 0.52, enhancing the system's robustness in identifying harmful content. This improvement effectively enhances the system's ability to detect various types of toxic content in real-world scenarios, further strengthening the automation level of content moderation on social media platforms.

[0041] This social media content moderation system utilizes a method to statistically analyze forgotten events and filter samples from the BeaverTails dataset. Combined with LoRA fine-tuning, an enhanced detection model is trained, enabling real-time and accurate classification of user comments. The system effectively identifies and filters various types of toxic speech, significantly improving content moderation efficiency. This invention fully leverages data diversity and quality, along with task-specific model optimization, not only dramatically improving the accuracy of toxicity detection in online environments but also providing crucial technical support for content security research and cyberspace governance. The system demonstrates excellent detection timeliness in real-world platform environments, providing practical evidence for subsequent content security governance solutions and showing broad application prospects across various social media platforms.

[0042] Example 2

[0043] This embodiment provides a system for implementing the toxic speech detection method based on forgetting learning according to Embodiment 1, comprising: Data preprocessing module, forgetting event calculation module, sample selection module, model training module, detection generation module; The data preprocessing module is used to standardize the original toxic speech dataset and generate feature vectors; The forgetting event calculation module is used to track the classification state changes of each sample during model training, and to calculate and store the total number of forgetting events for each sample. ; The sample screening module is used to... Sort the dataset, remove the hard-to-forget samples, and output a simplified dataset. The model training module is used to train classification models based on the original dataset and the simplified dataset respectively, and output the optimized detection model. The detection generation module is used to receive input text and output toxic speech detection results through an optimized model.

[0044] The above embodiments of the present invention are for illustrative purposes only and are not intended to limit the invention. The scope of protection of the present invention should be determined by the scope defined in the appended claims. Any modifications, substitutions, improvements, etc., made by those skilled in the art within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for detecting toxic speech based on forgetting learning, characterized in that, Includes the following steps: S1. Collect a dataset of labeled toxic speech. Each sample contains input text and real labels. Standardize the text and convert it into a feature vector that the model can input. S2. Construct a toxic speech classification model and train it using a stochastic gradient descent optimizer. During the training process, track the classification status of each sample, calculate the classification accuracy of the sample in the corresponding training step, and accumulate the total number of forgotten events for each sample based on the classification accuracy. S3. After training, sort the samples according to the total number of forgotten events. The smaller the total number of forgotten events of a sample, the more difficult the sample is to be forgotten. Set a screening threshold and remove the samples with the smallest total number of forgotten events in the training dataset to obtain a simplified dataset. S4. Using the simplified dataset, retrain the toxic speech classification model, using the same model structure and hyperparameters, and output the final detection model. S5. For the input text, predict whether it is toxic speech using the optimized model, output the classification result, and evaluate the efficiency of toxic speech detection.

2. The method for detecting toxic speech based on forgetting learning according to claim 1, characterized in that, The steps for collecting the toxic speech annotation dataset mentioned in step S1 are as follows: S1.1: Collect a dataset of labeled toxic speech Each sample contains the input text. and real labels ; S1.2: Standardize the text and convert it into a feature vector that the model can input.

3. The method for detecting toxic speech based on forgetting learning according to claim 1, characterized in that, The steps for initializing model training and calculating forgetting events in step S2 are as follows: S2.1: Construct a toxic speech generator and train it using a stochastic gradient descent optimizer; S2.2: For each instance in each dataset Initialize two variables: in Recording model in In this test, the instance The correctness of the classification Recording Examples The total number of forgotten events; S2.3: During training, one random sample is taken from the dataset in each iteration. batch B For each instance By comparing the predicted class output of the model's forward propagation with the true label, the model's accuracy in predicting the example is calculated. Correctness of classification : in These are model parameters; S2.4 If the instance If a classification changes from correct to incorrect in two consecutive training steps, a forgetting event occurs. Updated to: Use the current batch B Perform gradient updates on the model.

4. A method for detecting toxic speech based on forgetting learning according to claim 1, characterized in that, Step S3, which involves screening for difficult-to-forget samples and simplifying the dataset, consists of the following steps: S3.1: After training, calculate based on the total number of forgotten events. Sort the samples. The smaller the sample size, the less likely it is to be forgotten; S3.2: Set the filtering threshold Delete dataset Total number of forgotten events The smallest front Samples were used to obtain a simplified dataset. .

5. The method for detecting toxic speech based on forgetting learning according to claim 1, characterized in that, The simplified dataset training and model optimization described in step S4 are as follows: S4.1: Utilizing the simplified dataset Fine-tuning the large model, loading the pre-trained large model, initialization LoRA Configuration; S4.2: Mini-batch gradient descent is employed, with settings for the learning rate, batch size, and number of training epochs. Cross-entropy loss is used as the loss function, and the optimization objective is to minimize the model's classification loss on the dataset. Early stopping is employed during training to save the optimal model parameters, ultimately resulting in an optimized detection model. .

6. The method for detecting toxic speech based on forgetting learning according to claim 1, characterized in that, In step S5, the evaluation of the efficiency of toxic speech detection specifically includes: The text of the speech to be detected is input into the finely tuned large model. After text preprocessing, model encoding, and classification head prediction, the system outputs a prediction result indicating whether the statement is toxic or non-toxic, thus completing the toxic statement detection.

7. A system for implementing the toxic speech detection method based on forgetting learning as described in any one of claims 1-6, characterized in that, include: Data preprocessing module, forgetting event calculation module, sample selection module, model training module, detection generation module; The data preprocessing module is used to standardize the original toxic speech dataset and generate feature vectors; The forgetting event calculation module is used to track the classification state changes of each sample during model training, and to calculate and store the total number of forgetting events for each sample. ; The sample screening module is used to... Sort the dataset, remove the hard-to-forget samples, and output a simplified dataset. The model training module is used to train a classification model based on a simplified dataset and output an optimized detection model. The detection generation module is used to receive input text and output toxic speech detection results through an optimized model.

Citation Information

Patent Citations

  • Customer service intelligent marking method and system based on artificial intelligence technology

    CN116304025A

  • Semantic detection method and system based on prompt tuning and medium

    CN119443110A

Cited By

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

    CN121936632A