Multi-task neural network for toxicity detection
AssigneeContexai Ltd.
InventorsLucia Specia, Marina Fomicheva, Ozan Caglayan, Zhenhao Li
Life of this patent
Estimating the term…
Abstract
This specification provides a computer-implemented method for detecting toxic user-generated textual content. The method comprises obtaining input data comprising a representation of user-generated textual content. A toxicity prediction and a prediction for each of one or more attributes for the user-generated textual content are generated by processing the input data using a multi-task neural network.
Claims20
A computer-implemented method for detecting toxic user-generated textual content, the method comprising:
- obtaining input data comprising a representation of user-generated textual content;
- and
- generating a toxicity prediction and a prediction for each of one or more attributes for the user-generated textual content by processing the input data using a multi-task neural network, the processing comprising:
- generating an initial encoding for the user-generated textual content, comprising processing the input data using an initial encoder of the multi-task neural network;
- generating a toxicity feature representation, comprising processing the initial encoding using a task-specific toxicity feature extractor of the multi-task neural network;
- generating an attribute feature representation for each of the one or more attributes, comprising, for each attribute, processing the initial encoding using a respective task-specific attribute feature extractor of the multi-task neural network associated with the attribute;
- generating a common feature representation, comprising processing the initial encoding using a task-common feature extractor of the multi-task neural network;
- generating a plurality of combined feature representations, comprising combining each of the toxicity feature representation and the one or more attribute feature representations with the common feature representation;
- generating the toxicity prediction by processing, using a toxicity output portion of the multi-task neural network, the combined feature representation formed from combining the toxicity feature representation with the common feature representation;
- and
- generating the prediction for each of the one or more attributes by processing, using a respective output portion of the multi-task neural network associated with the attribute, the combined feature representation formed from combining the attribute feature representation for the attribute with the common feature representation.
A computing system to train a multi-task neural network to perform toxicity detection of user-generated textual content, the computing system being configured to:
- obtain one or more training examples, each training example comprising input data comprising a representation of user-generated textual content and a target output for each of one or more tasks out of a plurality of tasks, wherein each of the plurality of tasks is to identify a respective attribute in user-generated textual content, one of the attributes being toxicity;
- perform a training step to train the multi-task neural network on a current task of the plurality of tasks, comprising for each of the training examples:
- generating an initial encoding for the user-generated textual content, comprising processing the input data using an initial encoder of the multi-task neural network;
- generating an attribute feature representation for each of the plurality of attributes, comprising processing the initial encoding using a respective attribute feature extractor of the multi-task neural network associated with the attribute, wherein one of the attribute feature representations is a current task attribute feature representation for the current task that is generated by a current task attribute feature extractor;
- generating a common feature representation, comprising processing the initial encoding using a task-common feature extractor of the multi-task neural network;
- generating a task discriminator output representing a prediction of which task the multi-task neural network is currently being trained to perform in the training step, comprising processing the common feature representation using a gradient reversal layer and a task discriminator;
- generating a combined feature representation, comprising combining the current task attribute feature representation with the common feature representation;
- generating, by an output portion of the multi-task neural network associated with the current task, a plurality of outputs for the current task, the plurality of outputs comprising:
- a specific output generated by processing the current task attribute feature representation;
- a combined output generated by processing the combined feature representation;
- and
- one or more adversarial outputs, each generated by processing an attribute feature representation that is not the current task attribute feature representation using a gradient reversal layer;
- and
- update parameters of the multi-task neural network to:
- (i) minimize a measure of difference between the specific output and the target output for the current task (ii) minimize a measure of difference between the combined output and the target output for the current task, (iii) maximize a measure of difference between each of the one or more adversarial outputs and the target output for the current task, and (iv) maximize a measure of difference between the task discriminator output and a current task identifier indicating the current task.
A non-transitory computer-readable medium storing instructions, which when executed by a processor, cause the processor to:
- obtain input data comprising a representation of user-generated textual content;
- and
- generate a toxicity prediction and a prediction for each of one or more attributes for the user-generated textual content by processing the input data using a multi-task neural network, the processing comprising:
- generating an initial encoding for the user-generated textual content, comprising processing the input data using an initial encoder of the multi-task neural network;
- generating a toxicity feature representation, comprising processing the initial encoding using a task-specific toxicity feature extractor of the multi-task neural network;
- generating an attribute feature representation for each of the one or more attributes, comprising, for each attribute, processing the initial encoding using a respective task-specific attribute feature extractor of the multi-task neural network associated with the attribute;
- generating a common feature representation, comprising processing the initial encoding using a task-common feature extractor of the multi-task neural network;
- generating a plurality of combined feature representations, comprising combining each of the toxicity feature representation and the one or more attribute feature representations with the common feature representation;
- generating the toxicity prediction by processing, using a toxicity output portion of the multi-task neural network, the combined feature representation formed from combining the toxicity feature representation with the common feature representation;
- and
- generating the prediction for each of the one or more attributes by processing, using a respective output portion of the multi-task neural network associated with the attribute, the combined feature representation formed from combining the attribute feature representation for the attribute with the common feature representation.
Dependencies are inferred from the claim text.