An implicit discourse relation analysis method based on logical semantic enhancement

By introducing logical semantics and general semantic special symbols into the pre-trained language model and utilizing adversarial training techniques to enhance logical semantic representation, the problem of insufficient logical semantics in existing technologies is solved, thereby improving the accuracy and effectiveness of implicit discourse relation analysis.

CN116776891BActive Publication Date: 2026-11-20BEIJING INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310758462.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-26
Publication Date
2026-11-20
Estimated Expiration
2043-06-26

AI Technical Summary

Technical Problem

Existing implicit discourse relation analysis methods fail to fully utilize the powerful modeling capabilities of pre-trained language models, resulting in insufficient logical semantic representation and affecting analysis performance.

Method used

By introducing special symbols for logical semantics and general semantics into the pre-trained language model using the Prompt paradigm, and using adversarial training techniques to alternately enhance the two semantic representations, the model performance of logical semantics is improved.

Benefits of technology

It improves the accuracy and effectiveness of implicit discourse relation analysis, especially in sparse data categories, and enhances the ability to represent logical semantics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116776891B_ABST
    Figure CN116776891B_ABST
Patent Text Reader

Abstract

The application discloses a kind of implicit discourse relation analysis methods based on logic semantic enhancement, belong to natural language processing application technical field.The application uses the mode of Prompt to make pre-training language model in different cover positions in argument respectively produce the logic semantics and general semantics of argument, using targeted task, based on the vector representation of two kinds of semantics respectively to logic semantics and general semantics are strengthened;When training, two kinds of semantic strengthening tasks are trained alternately, since the representation produced by pre-training language model has context correlation, when training enhances one kind of semantic representation, the representation of another kind of semantic will be disturbed, and the effect of confrontation is generated, the logic semantics is made to get rid of the influence of general semantics by using this semantic confrontation, the purpose of enhancing logic semantics is achieved, and the effect of implicit discourse relation analysis is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to an implicit discourse relation analysis method based on logical semantic enhancement, belonging to the field of natural language processing application technology. Background Technology

[0002] Implicit discourse relation analysis is one of the most challenging tasks in natural language processing. Connectives between passages can effectively provide clues for machine learning models, allowing them to easily determine the discourse relationship between two arguments. However, in implicit discourse relation analysis, connectives cannot provide these clues; machine learning models must attempt to extract the logical relationship between two arguments from their text. Existing methods typically explore how to better model arguments using pre-trained models and how to better facilitate interaction between the representations of two arguments.

[0003] Currently, existing implicit discourse relation analysis methods do not fully utilize the powerful modeling capabilities and extensive knowledge acquired during pre-training language models. This results in insufficient logical semantics in the semantic representations derived from argument modeling by the pre-trained language models. As the fundamental carrier of human information transmission, text contains multiple semantic aspects. For implicit discourse relation analysis, these can be categorized into logical semantics, which are more crucial to discourse relations, and general semantics, which are less relevant to discourse relations. Language models inevitably learn both logical and general semantics during pre-training. Therefore, when using pre-trained language models to model arguments, it is necessary to enhance the logical semantic component to improve the effectiveness of implicit discourse relation analysis. Summary of the Invention

[0004] The purpose of this invention is to provide an implicit discourse relation analysis method based on logical semantic enhancement. This method utilizes a pre-trained language model with Prompt paradigm prompts to generate logical and general semantics for arguments. Different tasks are used to train the generation process of the two semantics, resulting in an adversarial effect between the two semantic representations. This enhances the logical semantics and improves the effectiveness of implicit discourse relation analysis.

[0005] The objective of this invention is achieved through the following technical solution:

[0006] This invention discloses an implicit discourse relation analysis method based on logical semantic enhancement. First, a pre-trained language model is used to generate logical and general semantics for arguments at different occlusion positions within arguments using a Prompt method. Targeted tasks are then used to enhance both logical and general semantics based on their vector representations. Second, the two semantic enhancement tasks are repeatedly and alternately trained during training. Since the representations generated by the pre-trained language model are context-dependent, enhancing one semantic representation can interfere with the other, creating an adversarial effect. This semantic adversarial effect allows the logical semantics to escape the influence of the general semantics, thereby enhancing the logical semantics and improving the implicit discourse relation analysis performance. The method includes the following steps:

[0007] Step 1: Input two arguments and generate encoding information, which includes the following sub-steps:

[0008] Step 1.1: Convert arguments into their word vector representation sequence through the embedding layer, specifically including the following sub-steps:

[0009] Step 1.1.1: Add additional logical semantic special symbols to the pre-trained language model and general semantic special symbols ;

[0010] Step 1.1.2: Connect the two arguments and insert the two special symbols added in Step 1.1.1 to obtain the input sentence. ;

[0011] Step 1.1.3: Construct a vocabulary and segment the sentence from Step 1.1.2;

[0012] Step 1.1.4: The sentence after word segmentation in Step 1.1.3 is mapped word by word into a sequence of word vectors through an embedding layer;

[0013] Step 1.2: Encode the input sentence using a pre-trained language model and output the encoded representation of each symbol in the sentence;

[0014] Each word vector in the sequence of vector representations is mapped to a query value using a matrix. key value and value As shown in equations (1), (2), and (3) respectively:

[0015] (1)

[0016] (2)

[0017] (3)

[0018] in, , , These are the query values. Key value and value Mapping parameters; The input word vectors;

[0019] For each word, its attention value for all other words is determined through a self-attention mechanism, resulting in the corresponding hidden layer state representation vector h, as shown in equation (4):

[0020] (4)

[0021] Where Attention(Q, K, V) represents the attention value of each word for all other words. for Dimensions for Transpose of;

[0022] The representations generated by each attention head are concatenated to obtain the final attention value, as shown in equation (5):

[0023] (5)

[0024] in, The result of concatenating the representations generated by each attention head. The representation generated for the nth head;

[0025] Through two layers The linear layer with activation function is shown in equation (6):

[0026] (6)

[0027] in, This is the representation of the arguments after the insertion of special symbols and the processing by the context encoder. For linear units, These are the weights that need to be trained. They are respectively The corresponding bias term;

[0028] Step 2: Fine-tune the pre-trained language model to enhance logical semantics, specifically including the following sub-steps:

[0029] Step 2.1: Introduce special symbols representing each text category into the language model;

[0030] Step 2.2: Obtain the encoded representation of the special symbols of logical semantics from the encoding obtained in Step 1.2, and determine the probability of occurrence of each symbol introduced in Step 2.1 based on this encoding through a linear layer;

[0031] The encoding of each word in the input argument sequence is determined by a pre-trained language model, resulting in the encoded representation vector of the special symbols of logical semantics. and through In step 2.1 of function determination, among all the symbols introduced, the symbol... probability of occurrence As shown in equation (7):

[0032] (7)

[0033] in The number of chapter relationship categories. For symbols The corresponding weight matrix contains the network parameters that need to be trained.

[0034] Step 2.3: Train the model to maximize the probability of occurrence of symbols corresponding to argument-text relations;

[0035] Step 3: Fine-tune the pre-trained language model to enhance general semantics, which includes the following sub-steps:

[0036] Step 3.1: Obtain the encoded representation after randomly replacing the argument sentences, which specifically includes the following sub-steps:

[0037] Step 3.1.1: Randomly mask the sentence obtained in Step 1.1.2 to obtain... ;

[0038] Step 3.1.2: Use a pre-trained language model to predict the masked portion of the sentence obtained in Step 3.1.1 and fill it into the original sentence to obtain... ;

[0039] Step 3.1.3: Perform word segmentation on the sentence obtained in Step 3.1.2;

[0040] Step 3.1.4: The sentence after word segmentation in Step 3.1.3 is mapped word by word into a sequence of word vectors through an embedding layer;

[0041] Step 3.1.5: Encode the sentence obtained in Step 3.1.4 using a pre-trained language model, and output the encoded representation of each symbol in the sentence. ;

[0042] Step 3.2: Train the pre-trained language model to generate general semantics, which includes the following sub-steps:

[0043] Step 3.2.1: Obtain the encoded representation of the general semantic special symbols from the encoding obtained in Step 1.2. This vector is then concatenated with the vector obtained in step 3.1.5 to obtain the vector... As shown in equation (8);

[0044] (8)

[0045] in, This is a vector concatenation operation;

[0046] Step 3.2.2: Input the vector obtained in step 3.2.1 into the pre-trained language model, and train the model to identify the different symbols in the sentence obtained in step 3.1.2 compared with the sentence in step 1.1.2;

[0047] vector The probability distribution is obtained through linear layer transformation, as shown in equation (9):

[0048] (9)

[0049] in, The Item for and Middle position The probability that the signs are different for Activation function , These are the weights that need to be trained. for The corresponding bias term, for The corresponding bias term;

[0050] Step 4: Repeat steps 2 and 3 to conduct semantic adversarial training. Stop training when the effect of the logical semantic enhancement task on the validation set gradually converges.

[0051] It also includes step 5: using the pre-trained language model obtained in step 4 to perform implicit discourse relation analysis, which can improve the ability to extract logical semantics between arguments, improve the performance in implicit discourse relation analysis, and be applied to natural language processing fields including machine translation, text summarization, information extraction and question answering systems to improve the performance of tasks.

[0052] Beneficial effects:

[0053] 1. The present invention provides an implicit discourse relation analysis method based on logical semantic enhancement. This method utilizes a pre-trained language model to simultaneously generate logical semantics and general semantics for arguments. Different training tasks are specifically constructed to enhance the two semantics. The two tasks are trained alternately, causing the logical semantics and general semantics to compete against each other. This effectively utilizes the modeling capabilities and pre-trained knowledge of the pre-trained language model, allowing the logical semantics to break free from the general semantics and improving the effect of implicit discourse relation analysis.

[0054] 2. The implicit discourse relation analysis method based on logical semantic enhancement of the present invention uses the Prompt method to enhance logical semantics by predicting additional special symbols to prompt the pre-trained language model to represent the logical semantics between arguments, thereby making greater use of the knowledge in the pre-trained language model. Attached Figure Description

[0055] Figure 1 This is a flowchart of an implicit discourse relation analysis method based on logical semantic enhancement according to the present invention.

[0056] Figure 2 This is a flowchart of the process for obtaining argument encoding representation in this invention. Detailed Implementation

[0057] To better illustrate the purpose and advantages of the present invention, the invention will be further described below in conjunction with the accompanying drawings and examples.

[0058] Example 1:

[0059] This embodiment applies an implicit discourse relation analysis method based on logical semantic enhancement of the present invention, performing implicit discourse relation analysis on the Pennsylvania Discourse Treebank (PDTB) 2.0 corpus. PDTB 2.0 is currently the largest dataset in the field of implicit discourse relation analysis, with data derived from over 2000 Wall Street Journal articles, containing both implicit and explicit discourse relation data. The PDTB 2.0 corpus data is divided into 24 distinct parts, a common practice in implicit discourse relation analysis. The training set includes 11639 data points, the validation set includes 1224 data points, and the test set includes 1090 data points. The PDTB 2.0 corpus categorizes discourse relations hierarchically, with the first level including four discourse relation categories, each with several second- and third-level categories. The analysis focuses on the top four discourse relation categories, such as... Figure 1 As shown, the specific steps are as follows:

[0060] Step 1: Input two arguments and generate encoding information, which includes the following sub-steps:

[0061] Step 1.1: Convert arguments into their word vector representation sequence through the embedding layer, specifically including the following sub-steps:

[0062] Step 1.1.1: As Figure 2 As shown, additional logical semantic special symbols are added to the pre-trained language model. and general semantic special symbols ;

[0063] Step 1.1.2: Connect the two arguments and insert the two special symbols added in Step 1.1.1 to obtain the input sentence. ;

[0064] In the example: Argument 1: Living there for six years was really scary; Argument 2: The ghosts of the past are everywhere.

[0065] Constructed input : Living there for six years was really scary. The ghosts of the past are everywhere.

[0066] Step 1.1.3: In this embodiment, BPE is used to encode and construct a vocabulary, and the sentence in step 1.1.2 is segmented.

[0067] Step 1.1.4: The sentence after word segmentation in Step 1.1.3 is mapped word by word into a sequence of word vectors through an embedding layer;

[0068] Step 1.2: Encode the input sentence using a pre-trained language model, and output the encoded representation of each symbol in the sentence:

[0069] Each word vector in the sequence of vector representations is mapped to a query value using a matrix. key value and value As shown in equations (1), (2), and (3) respectively:

[0070] (1)

[0071] (2)

[0072] (3)

[0073] in, , , These are the query values. Key value and value Mapping parameters; The input word vectors;

[0074] For each word, its attention value for all other words is determined through a self-attention mechanism, resulting in the corresponding hidden layer state representation vector h, as shown in equation (4):

[0075] (4)

[0076] Where Attention(Q, K, V) represents the attention value of each word for all other words. for Dimensions for Transpose of;

[0077] The representations generated by each attention head are concatenated to obtain the final attention value, as shown in equation (5):

[0078] (5)

[0079] in, The result of concatenating the representations generated by each attention head. The representation generated for the nth head;

[0080] Through two layers The linear layer with activation function is shown in equation (6):

[0081] (6)

[0082] in, This is the representation of the arguments after the insertion of special symbols and the processing by the context encoder. For linear units, These are the weights that need to be trained. They are respectively The corresponding bias term;

[0083] Step 2: Fine-tune the pre-trained language model to enhance logical semantics, specifically including the following sub-steps:

[0084] Step 2.1: Introduce special symbols to the language model to represent each text category, where represents the text category. The special symbols introduced are ;

[0085] Step 2.2: Obtain the encoded representation of the special symbols of logical semantics from the encoding obtained in Step 1.2, and calculate the probability of occurrence of each symbol introduced in Step 2.1 based on this encoding through a linear layer;

[0086] The encoding of each word in the input argument sequence is determined by a pre-trained language model, resulting in the encoded representation vector of the special symbols of logical semantics. and through In step 2.1 of function determination, among all the symbols introduced, the symbol... probability of occurrence As shown in equation (7):

[0087] (7)

[0088] in The number of chapter relationship categories. For symbols The corresponding weight matrix contains the network parameters that need to be trained.

[0089] Step 2.3: Train the model to maximize the probability of occurrence of symbols corresponding to argument-text relations;

[0090] Step 3: Fine-tune the pre-trained language model to enhance general semantics, which includes the following sub-steps:

[0091] Step 3.1: Obtain the encoded representation after randomly replacing the argument sentences, which specifically includes the following sub-steps:

[0092] Step 3.1.1: Randomly mask the sentence obtained in Step 1.1.2 to obtain the sentence. ;

[0093] Step 3.1.2: Use a pre-trained language model to process the sentence obtained in Step 3.1.1. The covered portion is predicted and filled into the original sentence to obtain the sentence. ;

[0094] In the embodiments, : The ghosts of the past are everywhere, :The [MASK] of the [MASK] are everywhere, : The cats of the past are everywhere;

[0095] Step 3.1.3: Perform word segmentation on the sentence obtained in Step 3.1.2;

[0096] Step 3.1.4: The sentence after word segmentation in Step 3.1.3 is mapped word by word into a sequence of word vectors through an embedding layer;

[0097] Step 3.1.5: Encode the sentence obtained in Step 3.1.4 using a pre-trained language model, and output the encoded representation of each symbol in the sentence. ;

[0098] Step 3.2: Train the pre-trained language model to generate general semantics, which includes the following sub-steps:

[0099] Step 3.2.1: Obtain the encoded representation of the general semantic special symbols from the encoding obtained in Step 1.2. This vector is then concatenated with the vector obtained in step 3.1.5 to obtain the vector... As shown in equation (8);

[0100] (8)

[0101] in, This is a vector concatenation operation;

[0102] Step 3.2.2: Input the vector obtained in step 3.2.1 into the pre-trained language model, and train the model to identify the different symbols in the sentence obtained in step 3.1.2 compared with the sentence in step 1.1.2;

[0103] vector The probability distribution is obtained through linear layer transformation, as shown in equation (9):

[0104] (9)

[0105] in, The Item for and Middle position The probability that the signs are different for Activation function , These are the weights that need to be trained. for The corresponding bias term, for The corresponding bias term;

[0106] Step 4: Repeat steps 2 and 3 to conduct semantic adversarial training. Stop training when the effect of the logical semantic enhancement task on the validation set gradually converges.

[0107] The method also includes step 5: using the pre-trained language model obtained in step 4 to perform implicit discourse relation analysis. In this embodiment, the model can determine that the discourse category of the input text is 1, that is, it infers that the discourse category is Contingency.

[0108] Table 1 shows a comparison of the performance of the method of this invention with the baseline method on PTDB 2.0 for four-class classification:

[0109] Table 1

[0110]

[0111] As shown in Table 1, the method of the present invention outperforms the baseline system with similar model structure complexity in terms of F1 score and accuracy in four-class classification. The method of the present invention can improve the pre-trained model's ability to model argument logical semantics by alternating enhancement of logical semantics and general semantics, thereby improving the effect of implicit discourse relation classification.

[0112] The performance of the method of this invention and the baseline method on each class in the four-class classification on PTDB 2.0 is compared in Table 2: the F1 score of the method on each specific class when performing four-class classification on the PTDB 2.0 dataset.

[0113] Table 2

[0114]

[0115] As shown in Table 2, when comparing the method of this invention with the baseline method in four-class classification on PTDB 2.0, where “Comp.”, “Cont.”, “Exp.”, and “Temp.” represent the four document relation categories in PDDB 2.0, respectively, the F1 score for each specific category is as follows: In PDDB 2.0, since the training data for the “Comp.” and “Temp.” categories is significantly less than the other two, most existing methods, including the baseline method, perform worse on these two categories than on the “Cont.” and “Exp.” categories. The performance of this method on the “Comp.” and “Temp.” categories is comparable to that of the “Cont.” and “Exp.” categories, and even the performance of the “Comp.” category surpasses that of the “Cont.” category. This method can alleviate the data sparsity problem and achieve better results even on categories with less data when the training data is imbalanced.

[0116] The above detailed description further illustrates the purpose, technical solution, and beneficial effects of the invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An implicit discourse relation analysis method based on logical semantic enhancement, characterized in that: The Prompt method is used to generate logical and general semantics of arguments at different occlusion positions in the arguments. Targeted tasks are then used to enhance the logical and general semantics based on the vector representations of the two semantics respectively. During training, the two semantic enhancement tasks are repeatedly alternated. Since the representations generated by the pre-trained language model are context-dependent, when one semantic representation is enhanced, the other semantic representation will be interfered with, producing an adversarial effect. This semantic adversarial effect is used to free the logical semantics from the influence of the general semantics, thereby enhancing the logical semantics and improving the performance of implicit discourse relation analysis. The method specifically includes the following steps: Step 1: Input two arguments and generate encoding information, which includes the following sub-steps: Step 1.1: Convert arguments into their word vector representation sequence through the embedding layer, specifically including the following sub-steps: Step 1.1.1: Add additional logical semantic special symbols to the pre-trained language model and general semantic special symbols ; Step 1.1.2: Connect the two arguments and insert the two special symbols added in Step 1.1.1 to obtain the input sentence. ; Step 1.1.3: Construct a vocabulary and segment the sentence from Step 1.1.2; Step 1.1.4: The sentence after word segmentation in Step 1.1.3 is mapped word by word into a sequence of word vectors through an embedding layer; Step 1.2: Encode the input sentence using a pre-trained language model and output the encoded representation of each symbol in the sentence; Each word vector in the sequence of vector representations is mapped to a query value using a matrix. key value and value As shown in equations (1), (2), and (3) respectively: (1) (2) (3) in, , , These are the query values. Key value and value Mapping parameters; The input word vectors; For each word, its attention value for all other words is determined through a self-attention mechanism, resulting in the corresponding hidden layer state representation vector h, as shown in equation (4): (4) Where Attention(Q, K, V) represents the attention value of each word for all other words. for Dimensions for Transpose of; The representations generated by each attention head are concatenated to obtain the final attention value, as shown in equation (5): (5) in, The result of concatenating the representations generated by each attention head. The representation generated for the nth head; Through two layers Linear layers with activation functions: (6) in, This is the representation of the arguments after the insertion of special symbols and the processing by the context encoder. For linear units, These are the weights that need to be trained. They are respectively The corresponding bias term; Step 2: Fine-tune the pre-trained language model to enhance logical semantics, specifically including the following sub-steps: Step 2.1: Introduce special symbols representing each text category into the language model; Step 2.2: Obtain the encoded representation of the special symbols of logical semantics from the encoding obtained in Step 1.2, and determine the probability of occurrence of each symbol introduced in Step 2.1 based on this encoding through a linear layer; The encoding of each word in the input argument sequence is determined by a pre-trained language model, resulting in the encoded representation vector of the special symbols of logical semantics. and through In step 2.1 of function determination, among all the symbols introduced, the symbol... probability of occurrence As shown in equation (7): (7) in The number of chapter relationship categories. For symbols The corresponding weight matrix contains the network parameters that need to be trained. Step 2.3: Train the model to maximize the probability of occurrence of symbols corresponding to argument-text relations; Step 3: Fine-tune the pre-trained language model to enhance general semantics, which includes the following sub-steps: Step 3.1: Obtain the encoded representation after randomly replacing the argument sentences, which specifically includes the following sub-steps: Step 3.1.1: Randomly mask the sentence obtained in Step 1.1.2 to obtain... ; Step 3.1.2: Use a pre-trained language model to predict the masked portion of the sentence obtained in Step 3.1.1 and fill it into the original sentence to obtain... ; Step 3.1.3: Perform word segmentation on the sentence obtained in Step 3.1.2; Step 3.1.4: The sentence after word segmentation in Step 3.1.3 is mapped word by word into a sequence of word vectors through an embedding layer; Step 3.1.5: Encode the sentence obtained in Step 3.1.4 using a pre-trained language model, and output the encoded representation of each symbol in the sentence. ; Step 3.2: Train the pre-trained language model to generate general semantics, which includes the following sub-steps: Step 3.2.1: Obtain the encoded representation of the general semantic special symbols from the encoding obtained in Step 1.

2. This vector is then concatenated with the vector obtained in step 3.1.5 to obtain the vector... As shown in equation (8); (8) in, This is a vector concatenation operation; Step 3.2.2: Input the vector obtained in step 3.2.1 into the pre-trained language model, and train the model to identify the different symbols in the sentence obtained in step 3.1.2 compared with the sentence in step 1.1.2; vector The probability distribution is obtained through linear layer transformation, as shown in equation (9): (9) in, The Item for and Middle position The probability that the signs are different for Activation function , These are the weights that need to be trained. for The corresponding bias term, for The corresponding bias term; Step 4: Repeat steps 2 and 3 to conduct semantic adversarial training. Stop training when the effect of the logical semantic enhancement task on the validation set gradually converges.

2. The implicit discourse relation analysis method based on logical semantic enhancement as described in claim 1, characterized in that: It also includes step 5: using the pre-trained language model obtained in step 4 to perform implicit discourse relation analysis, which can improve the ability to extract logical semantics between arguments, improve the performance in implicit discourse relation analysis, and be applied to natural language processing fields including machine translation, text summarization, information extraction and question answering systems to improve the performance of tasks.

Citation Information

Patent Citations

  • Multi-modal scene graph knowledge enhanced adversarial multi-modal pre-training method

    CN115331075A

  • Semantic analysis system for interpreting linguistic structures output by a natural language linguistic analysis system

    US20030176999A1