| CPC G06F 40/30 (2020.01) [G06F 40/40 (2020.01)] | 20 Claims |

|
1. A method for training a text classification model, executed by a computer device, the method comprising:
obtaining a training sample of the text classification model, the training sample being a text;
determining a semantic representation of the training sample using the text classification model, wherein the semantic representation of the training sample represents a semantic of the training sample;
determining a predicted classification result of the training sample based on the semantic representation;
generating an adversarial sample corresponding to the training sample based on the training sample and perturbation information for the training sample;
determining a semantic representation of the adversarial sample corresponding to the training sample using the text classification model, wherein the semantic representation of the adversarial sample represents a semantic of the adversarial sample, the semantic of the adversarial sample is consistent with the semantic of the training sample;
determining a classification loss of the text classification model based on the predicted classification result of the training sample;
determining a contrastive loss of the text classification model based on the semantic representation of the training sample and the semantic representation of the adversarial sample corresponding to the training sample; and
training the text classification model based on the classification loss and the contrastive loss.
|