Text Classification Model Adversarial Training Robustness

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional text classification models are not robust and can make errors when small perturbations are added to the input sentence.

Innovation Solution

A method for training a text classification model that involves obtaining a training sample, determining its semantic representation, generating an adversarial sample with perturbation information, calculating classification and contrastive losses, and optimizing the model parameters based on these losses.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If conventional text classification models are used, then the model structure is simple and training is fast, but the model lacks robustness and makes errors when small perturbations are added to the input sentence

Engineering Contradiction:
ImproverobustnessVSAvoidmodel complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent applies preliminary action by generating adversarial samples before actual classification tasks. The model is pre-trained with perturbed samples that have semantic modifications, allowing it to learn robust features in advance. This prepares the model to handle perturbations during deployment without requiring complex architectural changes.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent employs parameter changes by modifying the input text parameters through semantic perturbations (synonym replacement, word insertion, deletion). During training, the model learns to maintain classification accuracy despite these parameter changes, effectively improving robustness through parameter variation rather than structural complexity.

Inventive Principle:
Principle #35Parameter changes

2Reliability

If adversarial samples with perturbation information are generated and used for training, then the robustness of the model is improved, but the training process becomes more complex and time-consuming

Engineering Contradiction:
ImproverobustnessVSAvoidtraining time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent applies partial action by generating adversarial samples with controlled perturbation levels. Instead of using extreme or excessive perturbations, the method uses semantic modifications that are realistic and bounded, achieving robustness improvement without requiring exhaustive training on all possible perturbations. This reduces training time while maintaining effectiveness.

Inventive Principle:
Principle #16Partial or excessive action

Solution Approach 2:

The patent uses copying by creating adversarial versions of existing training samples rather than generating entirely new data. The perturbed samples are copies of original training data with semantic modifications, allowing the model to learn from familiar patterns while improving robustness. This approach is more time-efficient than creating new training data from scratch.

Inventive Principle:
Principle #26Copying

3Reliability

If the model is trained to correctly classify both original and adversarial samples, then the classification accuracy under perturbation is improved, but the training complexity and computational resources increase

Engineering Contradiction:
Improveclassification accuracy under perturbationVSAvoidcomputational resources
Core Design Contradiction:
ReliabilityVSUse of energy by moving object

Solution Approach 1:

The patent applies merging by combining the training of original samples and adversarial samples into a unified training process. The loss function integrates both clean and perturbed sample classifications, allowing the model to learn robust features efficiently. This combined approach reduces computational overhead compared to separate training processes while improving accuracy under perturbation.

Inventive Principle:
Principle #5Merging (Combining)

Data Source

PatentUS12271701B2Method and apparatus for training text classification model
Publication Date: 2025.04.08 TENCENT TECHNOLOGY (SHENZHEN) CO LTD
  • US12271701B2 patent drawing
  • US12271701B2 patent drawing
  • US12271701B2 patent drawing

AI summary

This disclosure relates to a method and an apparatus for training a text classification model. The method may include determining a semantic representation of the training sample using the text classification model and determining a predicted classification result of the training sample based on the semantic representation. The method may further include generating an adversarial sample corresponding to the training sample based on the training sample and perturbation information and determining a semantic representation of the adversarial sample corresponding to the training sample using the text classification model. The method may further include determining a classification loss of the text classification model based on the predicted classification result, determining a contrastive loss of the text classification model based on the semantic representation and the semantic representation of the adversarial sample, and training the text classification model based on the classification loss and the contrastive loss.