WO2022036616A1 - 一种基于低标注资源生成可推理问题的方法和装置 - Google Patents

一种基于低标注资源生成可推理问题的方法和装置 Download PDF

Info

Publication number
WO2022036616A1
WO2022036616A1 PCT/CN2020/110151 CN2020110151W WO2022036616A1 WO 2022036616 A1 WO2022036616 A1 WO 2022036616A1 CN 2020110151 W CN2020110151 W CN 2020110151W WO 2022036616 A1 WO2022036616 A1 WO 2022036616A1
Authority
WO
WIPO (PCT)
Prior art keywords
question
words
entity
answer
vector
Prior art date
Application number
PCT/CN2020/110151
Other languages
English (en)
French (fr)
Inventor
余建兴
王世祺
印鉴
Original Assignee
中山大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中山大学 filed Critical 中山大学
Priority to PCT/CN2020/110151 priority Critical patent/WO2022036616A1/zh
Publication of WO2022036616A1 publication Critical patent/WO2022036616A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology

Definitions

  • the present invention relates to the field of artificial intelligence, and more particularly, to a method and device for generating reasonable questions based on low-label resources.
  • Machine reading comprehension is a research hotspot in the field of artificial intelligence and natural language processing. It measures the machine's ability to understand the semantics of a given text in a question-and-answer format.
  • Question Generation is dedicated to generating questions and corresponding answers based on text, and can provide training data to support the construction of question answering models, generate test questions or exercises for teaching, and use the method of questions to get dialogue feedback and more.
  • Existing question generation methods are mainly aimed at simple questions, that is, learning the alignment and mapping relationship between words in a single sentence and question words, and generating questions through this relationship.
  • the answer is related to the problem of moving objects such as cars, trucks, and airplanes; the Chinese invention patent application (publication number: CN109726274A, publication date: May 07, 2019) first identifies the structure of the text, and selects the corresponding text according to the structure type.
  • the question generation model is used to generate targeted questions for texts with different structures.
  • the above schemes lack fine-grained modeling of entities and relationships in text, which makes it difficult to effectively generate problems that require entity-relational association reasoning.
  • the invention learns a priori problem text expression pattern from non-labeled problems, and is used to standardize the generation of the problem, improving the smoothness and readability of the generated results. , to provide a method and device for generating reasonable questions based on low-label resources.
  • the technical scheme of the present invention is as follows:
  • a method for generating reasonable questions based on low-label resources including the following steps:
  • step S4 Use the encoder to represent the combination of the entity words in the answer and the evidence chain, the reasoning type, the sentences related to the evidence chain and the reasoning chain in the form of vectors through encoding processing, and then process it through the attention mechanism. After the correlation information between, obtain the fusion vector as the input of step S5;
  • step S5. Use the canonical learning unit to characterize the word segment of the question and its context through latent variables, and use the non-labeled data set to estimate the parameters used to control the expression pattern of the question, and use the decoder to obtain the fusion of step S4. vector, based on the question generation function of the step S1 and the parameters used to control the expression pattern of the question, using probability distribution to calculate, and generate a question that can infer the answer in the text;
  • the evaluation unit evaluates and calculates the problem obtained in step S5, and obtains the loss function index. If the preset loss function calculation iteration times or the loss function index is no longer reduced, the preset loss function index is obtained. If the number of iterations of function calculation is at least 2, then the encoder, attention mechanism and decoder are obtained as the generator model, and the calculation is ended; otherwise, according to the loss function index, the encoder and attention mechanism in step S4 and the decoder in step S5 are analyzed. Perform training adjustment on the parameters of , and return to step S4.
  • the labeling data set is Among them, B is the document paragraph, A is the answer, Y is the question, and n is the number of labeled data; the non-labeled data set is Among them, Q j is the non-labeled problem, and the labeled data problem With similar expression patterns, the number of unlabeled data ⁇ >n;
  • the problem generating function is the following formula:
  • B represents text
  • text B (s 1 , L, s I )
  • A represents the answer obtained according to the text content
  • answer A (a 1 , L, a L )
  • Y represents the generated question
  • question Y (y 1 ,L,y T )
  • s I represents the lth sentence in text B
  • I represents the total number of sentences in text B
  • y T represents the lth word in the question
  • T represents the total number of words in the question
  • a L represents the lth word in the answer th words
  • L represents the total number of words in the answer
  • y t represents the word in question Y, obtained by sampling from the probability distribution p( ), and Y ⁇ t represents the word 1 to t-1 in question Y.
  • the step S2 adopts the natural language recognition toolbox CoreNLP to recognize entity words and analyze and record the attributes of the entity words.
  • the entity words are compared and marked with a relationship label, as follows:
  • the first threshold is 2/3
  • the second threshold is 2/3
  • the inference types in step S3 include linear inference types, intersection inference types and comparison inference types.
  • the specific process of analyzing the relationship between the entity words and obtaining the subgraph is to traverse the entity graph and record the qualified relationship labels, and the qualified relationship labels According to the connection of the corresponding entity words, the subgraph and the evidence chain presented by the subgraph are obtained, as follows:
  • S3101 Select the initial entity word, and retrieve a continuous path connecting multiple entity words from the entity graph by recursively accessing adjacent entity words;
  • S3103 Determine whether the path meets the given conditions, if it meets all the given conditions, output the path, otherwise do not operate, wherein the given conditions include: the co-occurring relationship label on the path is greater than 1; the mutual reference on the path The relationship label of is greater than 1; the high-frequency words are not included in the path, and the high-frequency words are the words in the top 5% of the frequency ranking of the labeled training set;
  • S3104 Repeat steps S3101 to S3103 until all the entity words in the entity graph are traversed, and the output path is used as a subgraph.
  • the specific process of analyzing the relationship between the entity words and obtaining the subgraph is as follows:
  • S3201 Select an entity word containing at least two relationship labels as the initial entity word, and retrieve a continuous path connecting multiple entity words from the entity graph by recursively accessing adjacent entity words;
  • S3203 Determine whether the path meets the given conditions, if it meets all the given conditions, output the path, otherwise do not operate, wherein the given conditions include: the co-occurring relationship label on the path is greater than 1; the mutual reference on the path The relationship label of is greater than 1; the high-frequency words are not included in the path, and the high-frequency words are the words in the top 5% of the frequency ranking of the labeled training set;
  • S3204 Repeat steps S3201 to S3203 until all the entity words in the entity graph are traversed, and the output path is used as a subgraph.
  • the specific process of analyzing the relationship between the entity words and obtaining the subgraph is as follows:
  • step S3302 Select a single relationship label, compare the attributes of the entity words at both ends of the single relationship label with the attributes of the entity words at both ends of the relationship label obtained in step S3301 one by one, if the comparison results are consistent, compare The single relationship label and the compared relationship label are recorded as a relationship pair;
  • step S3303 Repeat step S3302 until all the relationship labels are traversed, and the relationship pairs with the same relationship label are connected into subgraphs through the relationship label.
  • the encoder specifically performs the following operations:
  • the calculation process of the normative learning unit in the step S5 is as follows:
  • step S502 after obtaining the word of the problem by the joint distribution of the step S501, based on the bidirectional gated cyclic neural network, set up the function of the word of the problem being represented as a vector;
  • the specific process of calculating the probability distribution by the decoder is as follows:
  • the specific process of calculating the loss function index by the evaluation unit in step S6 includes the following steps:
  • S602. Use reinforcement learning to supplement each word in the question one by one. After each supplement, evaluate and score the currently obtained word as a partial sequence, and obtain the second loss function by accumulating the loss function of the partial sequence;
  • the evaluation score is divided into the analysis benchmark output problem and the generator output problem, and the specific process is as follows:
  • the grammatical fluency index, question solvability index, and semantic relevance index of the partial sequence are calculated respectively, and the grammatical fluency index, question solvability index, and the semantic relevance index are weighted and fused to obtain the scoring function of the benchmark output problem and the scoring function of the generator output problem, and subtract the scoring function of the benchmark output problem and the scoring function of the generator output problem to obtain the loss of the generator output problem function.
  • the method further includes a step S7 executed after the end of the step S6, the step S7 includes a process of evaluating the performance, using the BLEU-4 index, the METEOR index and the ROUGE-L index to evaluate the quality of the generated questions.
  • An apparatus for generating reasonable questions based on low-label resources comprising: an input module, a preprocessing module, a generator module and an output module;
  • the generator module includes an encoder, a normative learning unit, a decoder, and an evaluation unit;
  • the input module is configured to receive text input by the user
  • the preprocessing module is used to obtain evidence point entity words and construct subgraphs
  • the encoder module encodes text, answers, evidence point entity words, subgraphs and inference types and outputs them as vectors;
  • the canonical learning unit module characterizes the word fragments of the question and its context, and generates parameters for controlling the expression pattern of the question;
  • the decoder generates a question capable of inferring an answer in the text based on the question generation function and parameters for controlling the expression pattern of the question;
  • the evaluation unit module calculates a loss function for the problem, trains and adjusts the parameters of the generator module according to the loss function, and the generator module regenerates the problem until the loss function reaches a preset number of iterations of the loss function calculation or no longer. reduce, where the number of iterations for the calculation of the preset loss function is at least 2;
  • the output module outputs to the user the question finally obtained by the generator module.
  • the invention first extracts and establishes an association graph of entities from the text, identifies the inference chain by analyzing the relationship between the entity words, and uses the inference chain to guide the generation of the result;
  • the present invention learns prior knowledge such as the expression pattern of questions from the unlabeled question data, and uses the prior knowledge to standardize the generation results of the model, thereby improving the performance, so that the unlabeled question data contains rich
  • the characteristics of the question expression pattern and structure of can be used to help improve the readability of the generated questions.
  • the invention makes full use of non-labeled data to assist in improving the training process for small-scale labeled data, and helps to solve the problem of shortage of labeled training data that generally exists in the industry.
  • FIG. 1 is a schematic flowchart of a method for generating inference questions based on low-label resources according to the present invention.
  • FIG. 2 is a schematic diagram of an encoder, a decoder and an evaluation unit of the present invention.
  • FIG. 3 is a schematic structural diagram of an apparatus for generating reasonable questions based on low-label resources according to the present invention.
  • a method for generating reasonable questions based on low-label resources includes the following steps:
  • step S4 Use the encoder to represent the combination of the entity words in the answer and the evidence chain, the reasoning type, the sentences related to the evidence chain and the reasoning chain in the form of vectors through encoding processing, and then process it through the attention mechanism. After the correlation information between, obtain the fusion vector as the input of step S5;
  • step S5. Use the canonical learning unit to characterize the word segment of the question and its context through latent variables, and use the non-labeled data set to estimate the parameters used to control the expression pattern of the question, and use the decoder to obtain the fusion of step S4. vector, based on the question generation function of the step S1 and the parameters used to control the expression pattern of the question, using probability distribution to calculate, and generate a question that can infer the answer in the text;
  • the evaluation unit is used to evaluate and calculate the problem obtained in step S5, and the loss function index is obtained. If the preset loss function calculation iteration times or the loss function index is no longer reduced, the preset loss function index is obtained. If the number of iterations of the function calculation is at least 2, the encoder, the attention mechanism and the decoder are obtained as the generator model, and the calculation is ended; otherwise, according to the loss function index, the encoder and attention mechanism in step S4 and the decoder in step S5 are analyzed. The parameters are adjusted for training, and return to step S4.
  • the labeling data set is Among them, B is the document paragraph, A is the answer, Y is the question, and n is the number of labeled data; the non-labeled data set is Among them, Q j is the non-labeled problem, and the labeled data problem With similar expression patterns, the number of unlabeled data ⁇ >n;
  • the problem generating function is the following formula (1):
  • B represents text
  • text B (s 1 , L, s I )
  • A represents the answer obtained according to the text content
  • answer A (a 1 , L, a L )
  • Y represents the generated question
  • question Y (y 1 ,L,y T )
  • s I represents the lth sentence in text B
  • I represents the total number of sentences in text B
  • y T represents the lth word in the question
  • T represents the total number of words in the question
  • a L represents the lth word in the answer th words
  • L represents the total number of words in the answer
  • y t represents the word in question Y, obtained by sampling from the probability distribution p( ), and Y ⁇ t represents the word 1 to t-1 in question Y.
  • the step S2 adopts the natural language recognition toolbox CoreNLP to recognize entity words and analyze and record the attributes of the entity words.
  • the entity words are compared and marked with relation labels, as follows:
  • the first threshold is 2/3
  • the second threshold is 2/3
  • the reasoning type in the step S3 includes a linear reasoning type, an intersection reasoning type and a comparison reasoning type.
  • the specific process of analyzing the relationship between the entity words and obtaining the subgraph is to traverse the entity graph and record the relationship labels that meet the conditions, and the qualified relationship labels are recorded.
  • the entity word corresponding to the relation label of obtains the subgraph and the evidence chain presented by the subgraph according to the connection, as follows:
  • S3101 Select the initial entity word, and retrieve a continuous path connecting multiple entity words from the entity graph by recursively accessing adjacent entity words;
  • S3103 Determine whether the path meets the given conditions, if it meets all the given conditions, output the path, otherwise do not operate, wherein the given conditions include: the co-occurring relationship label on the path is greater than 1; the mutual reference on the path The relationship label of is greater than 1; the high-frequency words are not included in the path, and the high-frequency words are the words in the top 5% of the frequency ranking of the labeled training set;
  • S3104 Repeat steps S3101 to S3103 until all the entity words in the entity graph are traversed, and the output path is used as a subgraph.
  • step S3 for the intersection reasoning type, the specific process of analyzing the relationship between the entity words and obtaining the subgraph is as follows:
  • S3201 Select an entity word containing at least two relationship labels as the initial entity word, and retrieve a continuous path connecting multiple entity words from the entity graph by recursively accessing adjacent entity words;
  • S3203 Determine whether the path meets the given conditions, if it meets all the given conditions, output the path, otherwise do not operate, wherein the given conditions include: the co-occurring relationship label on the path is greater than 1; the mutual reference on the path The relationship label of is greater than 1; the high-frequency words are not included in the path, and the high-frequency words are the words in the top 5% of the frequency ranking of the labeled training set;
  • S3204 Repeat steps S3201 to S3203 until all the entity words in the entity graph are traversed, and the output path is used as a subgraph.
  • step S3 for the comparison reasoning type, the specific process of analyzing the relationship between the entity words and obtaining the subgraph is as follows:
  • step S3302 Select a single relationship label, compare the attributes of the entity words at both ends of the single relationship label with the attributes of the entity words at both ends of the relationship label obtained in step S3301 one by one, if the comparison results are consistent, compare The single relationship label and the compared relationship label are recorded as a relationship pair;
  • step S3303 Repeat step S3302 until all the relationship labels are traversed, and the relationship pairs with the same relationship label are connected into subgraphs through the relationship label.
  • the encoder specifically performs the following operations:
  • the BERT distributed vector thesaurus is used, and the language features used to represent the semantic and contextual relationship of the text are obtained through the natural language recognition toolbox CoreNLP, including: character case, part-of-speech tags, named entities Labels and cross-references refer to labels; but the present invention is not limited to this, and other language features can be introduced as needed;
  • the language feature tag is converted into a corresponding distributed vector through a neural network-based word distributed representation method.
  • the converted vector The dimensions are 3, 12, 8 and 3 respectively; by splicing the vectors of answer words, evidence point entity words and various language features, an enhanced text distribution vector can be obtained;
  • GRU gated recurrent neural network
  • a bidirectional GRU is used to capture the contextual semantics of the text.
  • the GRU encoder is derived from the article ("K.Cho,BVMerrienboer,C.Gulcehre,D.Bahdanau,F.Bougares,H.Schwenk,and Y.Bengio.2014.Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation. In Proceedings of EMNLP").
  • two types of representations can be generated after processing by GRU, including: (a) word vector with context information, for the jth word in the sentence, it can be represented as a vector in and represent the hidden state vector corresponding to the jth word in the forward and backward GRU, respectively, Represents the distributed vector of the word, the symbol [ ⁇ ; ⁇ ] represents the concatenation operation of two vectors; (b) the overall encoding, the overall representation of the sentence is obtained by concatenating the start and end states where J represents the total number of words in the sentence.
  • an N-layer graph transformer is used to represent the inference chain as a distributed vector.
  • This transformer is derived from the article ("Petar Veli ⁇ ckovi'c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Li ⁇ o, and Yoshua Bengio. 2018. Graph Attention Networks. In ICLR.”), suitable for capturing the association relationship. Assuming that there are nodes in the inference chain, each node v is represented by its corresponding entity word distributed vector, namely in is the distributed vector corresponding to the first word of the entity word, is the distributed vector corresponding to the last word, and k represents the number of words of the entity word.
  • the context between nodes is obtained by performing attention-weighted fusion of adjacent nodes, that is, Where
  • a n ( ⁇ , ⁇ ) is the nth attention function, and the function is shown in the following formula (6):
  • each function can learn the corresponding weight independently, W k , We ⁇ ⁇ d ⁇ d .
  • the obtained dot product results are usually normalized by all edges.
  • the present invention uses to normalize.
  • W h , W d are trainable matrices
  • is the set of all nodes in the inference chain.
  • the present invention uses its own attention mechanism to further optimize the distributed representation of the sentence, that is, The mechanism is derived from the article (“Wenhui Wang, Nan Yang, Furu Wei, Baobao Chang, and Ming Zhou. 2017. Gated self-matching networks for reading comprehension and question answering. In Proceedings of the 55th ACL”). Specifically, given the representation H of the sentence, the mechanism uses the control variable to measure the association between the words in the sentence by formula (8), as follows:
  • ⁇ j represents the jth word Relevance scores with other words in sentence H
  • u j represents the contextual relevance vector of the jth word
  • It is updated to f j according to u j
  • the updated part is determined by the control variable g j .
  • the answer-aware interaction encoding is the representation of the jth word in the given sentence s and representation of answers and evidence points Their interrelationships are captured from multiple dimensions by the function fm ( ⁇ ); the present invention employs three dimensions, including the overall association, i.e., computing Correlation with answers and evidence points as a whole cumulative association, i.e.
  • an answer information-aware vector m j [m 1 ; m 2 ; m 3 ] can be obtained, and the vector is input into another bidirectional gated recurrent neural network (GRU) to obtain a vector of context information Finally, a new vector with answer information awareness for the jth word of the sentence is obtained by splicing
  • a vector c t can be obtained, where ⁇ tj is the normalized attention weight, at k is the alignment score between text words, s t Indicates the latent variable corresponding to the generated t th word, v, b, W s , and W b are trainable parameters.
  • Formula (9) is as follows:
  • the calculation process of the normative learning unit in the step S5 is as follows:
  • e i , e j , e k ⁇ d are distributed representations corresponding to segment states i,j,k, and b i,j ,b i,k are scalar bias parameters; in a specific implementation, b i,j are set to negative infinity to avoid iterative transitions on their own, since question fragments of adjacent states usually play different syntactic or semantic roles in expressing patterns;
  • z t ,l t ) is the generation distribution of the words of the question, which is defined as the product of the generation probabilities of all the word items of the question, namely
  • W q and b q are parameters obtained through training
  • ⁇ t (i) represents the state parameter back-propagation weight in the t th word segment, Represents the length parameter back-propagation weight in the t th word segment;
  • h t represents the distributed vector corresponding to the t th question Y, and the initial state is
  • the present invention uses the Chinese processing tool CoreNLP to identify the part of speech of the question text, and the present invention allows the model to try not to destroy words such as verb phrases (VP) when segmenting question fragments. and noun phrase (NP) and other syntactic components; finally, the parameters of the encoder and decoder are learned from the unlabeled data DU by maximizing the log-likelihood estimation loss function through the back-propagation algorithm;
  • the present invention unbiasedly samples a state sequence from the sequence pool
  • the segment length parameter l t corresponding to each state can be calculated by the above p(l t
  • z t ) probability; finally, the present invention calculates by formula (4) to integrate all segments The state information and context information of ; where, The variable m satisfies the constraint i(m-1) ⁇ t ⁇ i(m), k ti(m-1); The effective information of the question expression pattern is captured, which can be used as a parameter corresponding to the prior knowledge to normalize the generation of the question, where y t-1 represents the (t-1) th generated question word.
  • step S5 the specific process of the decoder performing probability distribution calculation in step S5 is as follows:
  • the distributed representation c g of the reasoning chain can guide the generator to consider the logical association of evidence points for reasoning, while the norm variable Can facilitate the model to generate grammar and syntactically express correct questions.
  • is a 1-dimensional vector to represent the inference type
  • W o and b o represent trainable parameters
  • p voc (y t ) represents the probability distribution of generating question words.
  • the present invention adopts a replication mechanism, which is derived from the article ("Jiatao Gu, Zhengdong Lu, Hang Li, and Victor OKLi.
  • the specific process of calculating the loss function index by the evaluation unit in step S6 includes the following steps:
  • the present invention first uses a supervised method to pre-train the model of the first loss function formula (11) by minimizing the negative cross entropy based on the training data DL , as follows:
  • the present invention obtains the canonical variables of the expression by running the Viterbi algorithm on the question Yi instead of sampling T i represents the number of words corresponding to question Yi ;
  • S602. Use reinforcement learning to supplement each word in the question one by one. After each supplement, evaluate and score the currently obtained word as a partial sequence, and obtain the second loss function by accumulating the loss function of the partial sequence;
  • the present invention relies on Reinforcement learning is used to fine-tune the model to make it easier for the model to obtain the optimal solution; reinforcement learning is a training method widely used in the industry and is good at optimizing the goal of non-continuous functions; the present invention uses the second loss function Find the best word generation strategy ⁇ ⁇ to minimize the corresponding question Y s generated; where ⁇ is the parameter set of the model, and the score function r(Y) measures the question text Y s and the output of the model by specifying indicators. Mark the difference between questions Y * ;
  • the present invention adopts a loss function of mixed objectives to improve readability, as shown in the following formula (13) Show:
  • the weight ⁇ of reinforcement learning is set to 0.3.
  • the evaluation and scoring in the step S602 is divided into the analysis of the benchmark output problem and the generator output problem, and the specific process is as follows:
  • the grammatical fluency index, question solvability index, and semantic relevance index of the partial sequence are calculated respectively, and the grammatical fluency index, question solvability index, and the semantic relevance index are weighted and fused to obtain the scoring function of the benchmark output problem and the scoring function of the generator output problem, and subtract the scoring function of the benchmark output problem and the scoring function of the generator output problem to obtain the loss of the generator output problem function;
  • Fluency the present invention adopts the method of calculating the negative perplexity based on the language model to measure the fluency of the generated question text, and the calculation method is From the article ("X.Zhang and M.Lapata.2017.Sentence Simplification with Deep Reinforcement Learning.In Proceedings of EMNLP"), it can effectively measure the quality of generated text in practical applications;
  • the present invention uses a self-critical policy gradient training algorithm to train the model, which is derived from ("SJRennie, E. Marcheret, Y. Mroueh, J. Ross, and V. Goel 2017. Self-Critical Sequence Training for Image Captioning. In Proceedings of the CVPR").
  • the algorithm defines the loss function of the generator output problem, as shown in the following formula (12):
  • Y b represents the output sequence result of the benchmark method.
  • the benchmark method generates training in a locally optimal way, that is, using the greedy algorithm to generate the word with the highest probability each time;
  • Y s is the sequence result output by the generator.
  • the method further includes a step S7 executed after the end of the step S6, and the step S7 includes a process of evaluating the performance, using the BLEU-4 index, the METEOR index and the ROUGE-L index to evaluate the generated problems. quality;
  • the present invention uses the inference data set HotpotQA to conduct experiments, which is derived from the article ("Z. Yang, P. Qi, S. Zhang, Y. Bengio, WW Cohen, R. Salakhutdinov, and CDManning. 2018. HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answering. In Proceedings of the 56th ACL").
  • the dataset is split into training and test sets with 90,000 and 7,000 annotated samples, respectively.
  • the present invention uses 10% of the training data as the development set to tune the model. Each sample consists of a question, an answer, and several paragraphs.
  • the present invention also collects two non-labeled question data sets for training the prior knowledge of question expression patterns, including ComplexWebQuestions and DROP, these two data sets are inferable questions constructed by manual annotation, but not labeled Associate the corresponding document and answer.
  • the scales of these two datasets are 35,000 and 97,000, respectively.
  • the ComplexWebQuestions dataset is derived from the paper ("Alon Talmor and Jonathan Berant. 2018. The web as a knowledge-base for answering complex questions. In Proceedings of the 2018 NAACL”); the DROP dataset comes from the paper (“Dheeru Dua, Yizhong Wang, Pradeep Dasigi, Gabriel Stanovsky, Sameer Singh, and Matt Gardner. 2019.
  • DROP A reading comprehension benchmark requiring discrete reasoning over paragraphs. In Proceedings of the 2019 NAACL ”).
  • the present invention uses three traditional metrics methods to measure the quality of the generated questions, including BLEU-4, METEOR and ROUGE-L.
  • the indicator BLEU-4 comes from the paper (“Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th ACL”); METEOR comes from Paper ("Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th ACL”); ROUGE-L is derived from the paper ("Chin- Yew Lin.2004.ROUGE:A package for automatic evaluation of summaries.In Text Summarization Branches Out”).
  • a device for generating reasonable questions based on low-label resources includes: an input module, a preprocessing module, a generator module, and an output module;
  • the generator module includes an encoder, a normative learning unit, a decoder, and an evaluation unit;
  • the input module is configured to receive text input by the user
  • the preprocessing module is used to obtain evidence point entity words and construct subgraphs
  • the encoder module encodes text, answers, evidence point entity words, subgraphs and inference types and outputs them as vectors;
  • the canonical learning unit module characterizes the word fragments of the question and its context, and generates parameters for controlling the expression pattern of the question;
  • the decoder generates a question capable of inferring an answer in the text based on the question generation function and parameters for controlling the expression pattern of the question;
  • the evaluation unit module calculates a loss function for the problem, trains and adjusts the parameters of the generator module according to the loss function, and the generator module regenerates the problem until the loss function reaches a preset number of iterations of the loss function calculation or no longer. reduce, where the number of iterations for the calculation of the preset loss function is at least 2;
  • the output module outputs to the user the question finally obtained by the generator module.

Abstract

本发明公开了一种基于低标注资源生成可推理问题的方法和装置,其中方法包括以下步骤:S1.获取标注数据集和非标注数据集,建立问题生成函数;S2.以实体词为节点构建实体图;S3.分析实体图的实体词之间的关系来连接实体词,得到子图;S4.将文本和推理链表示为向量,然后通过注意力机制处理为步骤S5的输入的融合向量;S5.利用非标注数据集来预估用于控制问题的表达模式的参数,采用概率分布进行计算,生成问题;S6.对问题计算损失函数指标,如果达到预设条件,则得到最终模型,结束计算;否则调整模型参数,返回步骤S4。本发明的优点在于,从未标注的提问数据中学习出表达模式等先验知识,规范所生成提问的句法,有效提升所生成提问的可读性。

Description

一种基于低标注资源生成可推理问题的方法和装置 技术领域
本发明涉及人工智能领域,更具体地,涉及一种基于低标注资源生成可推理问题的方法和装置。
背景技术
机器阅读理解是人工智能和自然语言处理领域的研究热点,它以问答的方式来衡量机器对给定文本语义的理解能力。作为与之对偶的研究课题,问题生成(QG)致力于基于文本生成问题和与之对应的答案,能够提供训练数据来支撑问答模型的构建、生成用于教学的考题或习题、通过问题的方式来获得对话反馈等。已有的问题生成方法主要是针对简单问题,即学习单个句子中的词和问题单词间的对齐关系和映射关系,通过该关系来生成问题。
然而,目前缺乏对可推理问题的研究,而且当前方法也未能有效生成需要逻辑推理的问题;而推理是衡量机器的高级认知能力的重要指标,具有非常高的科研价值和产业应用价值。这种可推理的问题不但需要在句法语法上要正确,而且需要关联多个句子和段落中的词语和实体来推导出答案。传统的方法聚焦于研究文本和问题的映射关系,例如中国发明专利申请(公开号:CN103226562A,公开日期:2013年07月31日)采用针对给定领域设定规则的方案,例如速度符号v的答案与轿车、货车、飞机等移动物体的问题相关联;中国发明专利申请(公开号:CN109726274A,公开日期:2019年05月07日)则首先对文本的结构进行识别,根据结构类型选择对应的问题生成模型,对不同结构的文本进行针对性地生成问题的操作。上述方案缺乏对文本中实体和关系的细粒度建模,导致难以有效生成需要实体关系关联推理的问题。
另一方面,现有的问题生成方法大多需要大量的标注数据来训练,其中标注数据包括由文本、答案和问题组成的组合。例如,中国发明专利申请(公开号:CN101369265A,公开日期:2009年02月18日)在对文本的结构进行识别后,在预先准备的词语数据库中搜索上述结构中被选中的词语的上位概念,对同样是预先准备的标签进行匹配,从而对词语进行语义标注,构建问题和答案。模型的性能直接受限于训练数据的规模。以往的研究表明,训练数据的规模与模型性能之间存在着近似对数的关联关系,即训练数据越多,模型性能一般越好。然而标 注过程非常耗费人力且昂贵,这限制了标注数据的规模,也同时限制了模型的性能。可以说,标注数据不足是在产业界和科研界普遍存在的难题。据文献调研所致,目前缺乏对在标注数据不足的情况下来做可推理问题生成的方法。
发明内容
本发明为了解决标注数据不足而未能充分地训练模型的难题,从非标注的问题中学习出先验的问题文本表达模式,并用于规范问题的生成,提升生成结果的通顺性和可读性,提供一种基于低标注资源生成可推理问题的方法和装置。
为解决上述技术问题,本发明的技术方案如下:
一种基于低标注资源生成可推理问题的方法,包括以下步骤:
S1.获取标注数据集和非标注数据集,建立问题生成函数,其中,所述标注数据集的数据少于第二非标注数据集的数据,所述问题生成函数通过判断问题中的词与文本、答案和问题中所有的词相对应的概率,确定问题是否能够在文本中推理出答案;
S2.从所述文本中识别出实体词,以实体词为节点构建实体图;
S3.获取推理类型,针对推理类型分析所述实体图的实体词之间的关系,所述实体词之间的关系能够构成与推理类型对应的证据链,通过实体词之间的关系连接实体词,得到子图;
S4.使用编码器通过编码处理将答案和证据链中的实体词的组合、推理类型、证据链相关的句子以及推理链以向量形式表示,然后通过注意力机制进行处理,在获取答案和句子之间的关联信息后,得到作为步骤S5的输入的融合向量;
S5.使用规范学习单元通过隐含变量表征问题的单词片段及其上下文,并利用所述非标注数据集来预估用于控制问题的表达模式的参数,使用解码器获取所述步骤S4的融合向量,基于所述步骤S1的问题生成函数和用于控制问题的表达模式的参数,采用概率分布进行计算,生成能够在文本中推理出答案的问题;
S6.采用训练文本和对应的训练问题,通过评估单元对步骤S5得到的问题进行评估计算,得到损失函数指标,如果达到预设损失函数计算迭代次数或者损失函数指标不再减少,其中预设损失函数计算迭代次数至少为2,则得到编码器、注意力机制和解码器作为生成器模型,结束计算;否则根据损失函数指标,对步骤S4的编码器和注意力机制、以及步骤S5的解码器的参数进行训练调整,返回步骤S4。
优选地,在所述步骤S1中,标注数据集为
Figure PCTCN2020110151-appb-000001
其中,B为文档段落,A为答案,Y为问题,n为标注数据数量;非标注数据集为
Figure PCTCN2020110151-appb-000002
其中,Q j为非标注问题,与标注数据问题
Figure PCTCN2020110151-appb-000003
具有相似的表达模式,非标注数据数量□>n;
所述问题生成函数为以下公式:
Figure PCTCN2020110151-appb-000004
其中,B代表文本,文本B=(s 1,L,s I),A代表根据文本内容获得的答案,答案A=(a 1,L,a L),Y代表生成的问题,问题Y=(y 1,L,y T),
Figure PCTCN2020110151-appb-000005
代表与文本B和答案A对应的问题;
其中,s I表示文本B中第l th个句子,I代表文本B中的句子的总数,y T表示问题中第l th个词,T代表问题中词的总数,a L表示答案中第l th个词,L表示答案中词的总数;
其中,y t代表问题Y中的词,通过从概率分布p(·)中采样而获得,Y <t代表问题Y中第1个到第t-1个的词。
优选地,所述步骤S2采用自然语言识别工具箱CoreNLP识别实体词并分析和记录实体词的属性。
优选地,在所述步骤S2中构建实体图的步骤中,对实体词进行比对并标记上关系标签,具体如下:
S201.如果两个实体词共同出现在同一句子中,将所述两个实体词连接并标记上共同出现的关系标签;
S202.如果两个实体词共同出现在同一段落的不同句子中,而且两个实体词通过词语级精确匹配计算得到的相似度值大于第一阈值,则将两个实体词连接并标记上句子级匹配的关系标签;
S203.如果两个实体词共同出现在不同段落的不同句子中,而且两个实体词通过词语级精确匹配计算得到相似度值的大于第二阈值,则将两个实体词连接并标记上段落级匹配的关系标签;
S204.如果两个实体词通过指代解析工具计算出具有相互引用指代的关系,则将两个实体词连接并标记上相互引用的关系标签。
优选地,第一阈值为2/3,第二阈值为2/3。
优选地,所述步骤S3中的推理类型包括线性推理类型、交集推理类型和比较推理类型。
优选地,在所述步骤S3中,针对线性推理类型,分析实体词之间的关系以及得到子图的具体过程是,遍历实体图并记录符合条件的关系标签,将所述符合条件的关系标签对应的实体词根据连接,得到子图以及由子图呈现的证据链,具体如下:
S3101:选择起始的实体词,通过递归地访问相邻的实体词,从实体图中检索出连接多个实体词的连续的路径;
S3102:统计路径上的关系标签,得到路径上的关系标签的总数;
S3103:判断路径是否符合给定条件,如果符合全部的给定条件,则输出路径,否则不进行操作,其中,给定条件包括:路径上的共同出现的关系标签大于1;路径上的相互引用的关系标签大于1;路径中不包括高频词,其中高频词为标注训练集统计出的频次排列前5%的词;
S3104:重复所述步骤S3101至步骤S3103直至遍历实体图中全部的实体词,将输出的路径作为子图。
优选地,在所述步骤S3中,针对交集推理类型,分析实体词之间的关系以及得到子图的具体过程如下:
S3201:选择包含至少2个关系标签的实体词作为起始的实体词,通过递归地访问相邻的实体词,从实体图中检索出连接多个实体词的连续的路径;
S3202:统计路径上的关系标签,得到路径上的关系标签的总数;
S3203:判断路径是否符合给定条件,如果符合全部的给定条件,则输出路径,否则不进行操作,其中,给定条件包括:路径上的共同出现的关系标签大于1;路径上的相互引用的关系标签大于1;路径中不包括高频词,其中高频词为标注训练集统计出的频次排列前5%的词;
S3204:重复所述步骤S3201至步骤S3203直至遍历实体图中全部的实体词,将输出的路径作为子图。
优选地,在所述步骤S3中,针对比较推理类型,分析实体词之间的关系以及得到子图的具体过程如下:
S3301:记录实体图中的全部的关系标签;
S3302:选择单个关系标签,将所述单个关系标签的两端实体词的属性与其余在步骤S3301得到的关系标签的两端实体词的属性逐一比对,如果比对的结果是一致时,将所述单个关系标签和比对的关系标签记录为关系对;
S3303:重复步骤S3302直至遍历全部的关系标签,将具有相同的关系标签的关系对通过关系标签连接成子图。
优选地,所述步骤S4中,编码器具体进行以下操作:
S401.从所述步骤S3获得的子图的实体词筛选出答案词和证据点实体词,对文本中证据点实体词所在的全部的句子屏蔽部分答案词,其中,部分答案词为不属于比较推理类型的答案词;
S402.对所述步骤S401中获得的答案词、证据点实体词以及推理链相关的句子,通过分布式向量词库,将答案词、证据点实体词和推理链相关的句子分别表示成答案向量、证据点实体向量和句子向量;
S403.使用门控循环神经网络对所述步骤S402的答案向量、证据点实体向量和句子向量进行处理,通过句子向量生成第一具有上下文信息的词向量,将答案向量和证据点实体向量共同处理成实体向量,并且使用N层的图变换器将推理链处理成分布式向量;
S404.基于注意力机制对句子向量进行处理;
S405.基于答案感知的交互编码,对第一具有上下文信息的词向量和实体向量进行处理,计算并拼接答案向量和证据点实体向量整体的关联、答案向量和证据点实体向量的每个词累计向量的关联、以及答案向量和证据点实体向量的每个词最大向量的关联,得到第一答案信息感知的向量,将所述答案信息感知的向量输入到另一门控循环神经网络获得第二具有上下文信息的向量,将第一具有上下文信息的词向量和第二具有上下文信息的向量进行拼接,得到第二答案信息感知的向量;
S406.对步骤S402至步骤S405得到的向量进行处理,得到基于可训练的参数的融合向量。
优选地,所述步骤S5中规范学习单元的计算过程具体如下:
S501.基于马尔可夫神经网络模型,建立用于多次取样生成问题的单词的联合分布;
S502.通过所述步骤S501的联合分布得到问题的单词后,基于双向门控循 环神经网络,建立将问题的单词表示成向量的函数;
S503.通过反向传播算法获得问题的边际分布,最大化对数似然估计损失函数,从非标注数据学习编码器和解码器的参数;
S504.通过维特比算法预测问题的状态序列并构成序列池,从序列池提取状态序列作为问题的表达模式,计算规范变量,其中包括问题的单词片段的状态信息和上下文信息。
优选地,所述步骤S5中解码器进行概率分布计算的具体过程如下:
S505.基于复制机制生成问题的词,然后通过所述步骤S504得到的规范变量将所述问题的词进行组合,得到能够在文本中推理出答案的、句法表达适当的问题。
优选地,所述步骤S6的评估单元计算损失函数指标的具体过程包括以下步骤:
S601.基于有监督方法和训练数据,通过最小化负交叉熵得到第一损失函数;
S602.采用强化学习,将问题中的每个词依序逐个补充,在每次补充后,将当前得到的词作为部分序列进行评估打分,通过累计部分序列的损失函数,得到第二损失函数;
S603.采用混合目标训练,将所述第一损失函数和基于强化学习的损失函数进行加权融合,得到输出的损失函数。
优选地,所述步骤S602中评估打分为分析基准输出问题和生成器输出问题,具体过程如下:
对于基准输出问题和生成器输出问题,分别计算所述部分序列的语法流畅度指标、问题的可解答性指标、以及语义关联度指标,将所述语法流畅度指标、问题的可解答性指标、以及语义关联度指标进行加权融合,得到基准输出问题的打分函数和生成器输出问题的打分函数,将基准输出问题的打分函数和生成器输出问题的打分函数相减,得到生成器输出问题的损失函数。
优选地,所述方法还包括在步骤S6结束后执行的步骤S7,所述步骤S7包括评价性能的过程,采用BLEU-4指标、METEOR指标和ROUGE-L指标评估所生成的问题的质量。
一种基于低标注资源生成可推理问题的装置,包括:输入模块、预处理模块、生成器模块和输出模块;
所述生成器模块包括编码器、规范学习单元、解码器和评估单元;
所述输入模块用于接收用户输入的文本;
所述预处理模块用于得到证据点实体词并构建子图;
所述编码器模块将文本、答案、证据点实体词、子图和推理类型进行编码并输出为向量;
所述规范学习单元模块表征问题的单词片段及其上下文,生成用于控制问题的表达模式的参数;
所述解码器基于问题生成函数和用于控制问题的表达模式的参数,生成能够在文本中推理出答案的问题;
所述评估单元模块对所述问题计算损失函数,根据损失函数对所述生成器模块的参数进行训练和调整,生成器模块重新生成问题,直到损失函数达到预设损失函数计算迭代次数或者不再减少,其中预设损失函数计算迭代次数至少为2;
所述输出模块向用户输出生成器模块最后得到的问题。
与现有技术相比,本发明技术方案的有益效果是:
本发明首先从文本中抽取建立实体的关联图,通过分析实体词之间的关系识别出推理链,并利用推理链来引导结果的生成;在此基础上,为了在少量标注数据的情况下有效地训练模型,本发明从未标注的提问数据中学习出提问的表达模式等先验知识,并利用该先验知识来规范模型的生成结果,进而提升性能,从而利用未标注的提问数据含有丰富的提问表达模式和结构的特点,可以用来帮助提升所生成提问的可读性。
本发明充分利用非标注的数据来辅助提高对小规模标注数据的训练过程,有助于解决行业内普遍存在的标注训练数据短缺的问题。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明的基于低标注资源生成可推理问题的方法流程示意图。
图2是本发明的编码器、解码器和评估单元示意图。
图3是本发明的基于低标注资源生成可推理问题的装置的结构示意图。
具体实施方式
附图仅用于示例性说明,不能理解为对本专利的限制;
为了更好说明本实施例,附图某些部件会有省略、放大或缩小,并不代表实际产品的尺寸;
对于本领域技术人员来说,附图中某些公知结构及其说明可能省略是可以理解的。
下面结合附图和实施例对本发明的技术方案做进一步的说明。
一种基于低标注资源生成可推理问题的方法,如图1和2所示,包括以下步骤:
S1.获取标注数据集和非标注数据集,建立问题生成函数,其中,所述标注数据集的数据少于第二非标注数据集的数据,所述问题生成函数通过判断问题中的词与文本、答案和问题中所有的词相对应的概率,确定问题是否能够在文本中推理出答案;
S2.从所述文本中识别出实体词,以实体词为节点构建实体图;
S3.获取推理类型,针对推理类型分析所述实体图的实体词之间的关系,所述实体词之间的关系能够构成与推理类型对应的证据链,通过实体词之间的关系连接实体词,得到子图;
S4.使用编码器通过编码处理将答案和证据链中的实体词的组合、推理类型、证据链相关的句子以及推理链以向量形式表示,然后通过注意力机制进行处理,在获取答案和句子之间的关联信息后,得到作为步骤S5的输入的融合向量;
S5.使用规范学习单元通过隐含变量表征问题的单词片段及其上下文,并利用所述非标注数据集来预估用于控制问题的表达模式的参数,使用解码器获取所述步骤S4的融合向量,基于所述步骤S1的问题生成函数和用于控制问题的表达模式的参数,采用概率分布进行计算,生成能够在文本中推理出答案的问题;
S6.采用训练文本和对应的训练问题,使用评估单元对步骤S5得到的问题进行评估计算,得到损失函数指标,如果达到预设损失函数计算迭代次数或者损失函数指标不再减少,其中预设损失函数计算迭代次数至少为2,则得到编码器、注意力机制和解码器作为生成器模型,结束计算;否则根据损失函数指标,对步骤S4的编码器和注意力机制、以及步骤S5的解码器的参数进行训练调整,返回步骤S4。
在本实施例中,在所述步骤S1中,标注数据集为
Figure PCTCN2020110151-appb-000006
其中,B为文档段落,A为答案,Y为问题,n为标注数据数量;非标注数据集为
Figure PCTCN2020110151-appb-000007
其中,Q j为非标注问题,与标注数据问题
Figure PCTCN2020110151-appb-000008
具有相似的表达模式,非标注数据数量□>n;
所述问题生成函数为以下的公式(1):
Figure PCTCN2020110151-appb-000009
其中,B代表文本,文本B=(s 1,L,s I),A代表根据文本内容获得的答案,答案A=(a 1,L,a L),Y代表生成的问题,问题Y=(y 1,L,y T),
Figure PCTCN2020110151-appb-000010
代表与文本B和答案A对应的问题;
其中,s I表示文本B中第l th个句子,I代表文本B中的句子的总数,y T表示问题中第l th个词,T代表问题中词的总数,a L表示答案中第l th个词,L表示答案中词的总数;
其中,y t代表问题Y中的词,通过从概率分布p(·)中采样而获得,Y <t代表问题Y中第1个到第t-1个的词。
在本实施例中,所述步骤S2采用自然语言识别工具箱CoreNLP识别实体词并分析和记录实体词的属性。
在本实施例中,在所述步骤S2中构建实体图的步骤中,对实体词进行比对并标记上关系标签,具体如下:
S201.如果两个实体词共同出现在同一句子中,将所述两个实体词连接并标记上共同出现的关系标签;
S202.如果两个实体词共同出现在同一段落的不同句子中,而且两个实体词通过词语级精确匹配计算得到的相似度值大于第一阈值,则将两个实体词连接并标记上句子级匹配的关系标签;
S203.如果两个实体词共同出现在不同段落的不同句子中,而且两个实体词通过词语级精确匹配计算得到相似度值的大于第二阈值,则将两个实体词连接并标记上段落级匹配的关系标签;
S204.如果两个实体词通过指代解析工具计算出具有相互引用指代的关系,则将两个实体词连接并标记上相互引用的关系标签。
在本实施例中,第一阈值为2/3,第二阈值为2/3。
在本实施例中,所述步骤S3中的推理类型包括线性推理类型、交集推理类型和比较推理类型。
在本实施例中,在所述步骤S3中,针对线性推理类型,分析实体词之间的关系以及得到子图的具体过程是,遍历实体图并记录符合条件的关系标签,将所述符合条件的关系标签对应的实体词根据连接,得到子图以及由子图呈现的证据链,具体如下:
S3101:选择起始的实体词,通过递归地访问相邻的实体词,从实体图中检索出连接多个实体词的连续的路径;
S3102:统计路径上的关系标签,得到路径上的关系标签的总数;
S3103:判断路径是否符合给定条件,如果符合全部的给定条件,则输出路径,否则不进行操作,其中,给定条件包括:路径上的共同出现的关系标签大于1;路径上的相互引用的关系标签大于1;路径中不包括高频词,其中高频词为标注训练集统计出的频次排列前5%的词;
S3104:重复所述步骤S3101至步骤S3103直至遍历实体图中全部的实体词,将输出的路径作为子图。
在本实施例中,在所述步骤S3中,针对交集推理类型,分析实体词之间的关系以及得到子图的具体过程如下:
S3201:选择包含至少2个关系标签的实体词作为起始的实体词,通过递归地访问相邻的实体词,从实体图中检索出连接多个实体词的连续的路径;
S3202:统计路径上的关系标签,得到路径上的关系标签的总数;
S3203:判断路径是否符合给定条件,如果符合全部的给定条件,则输出路径,否则不进行操作,其中,给定条件包括:路径上的共同出现的关系标签大于1;路径上的相互引用的关系标签大于1;路径中不包括高频词,其中高频词为标注训练集统计出的频次排列前5%的词;
S3204:重复所述步骤S3201至步骤S3203直至遍历实体图中全部的实体词,将输出的路径作为子图。
在本实施例中,在所述步骤S3中,针对比较推理类型,分析实体词之间的关系以及得到子图的具体过程如下:
S3301:记录实体图中的全部的关系标签;
S3302:选择单个关系标签,将所述单个关系标签的两端实体词的属性与其余在步骤S3301得到的关系标签的两端实体词的属性逐一比对,如果比对的结果是一致时,将所述单个关系标签和比对的关系标签记录为关系对;
S3303:重复步骤S3302直至遍历全部的关系标签,将具有相同的关系标签的关系对通过关系标签连接成子图。
在本实施例中,所述步骤S4中,编码器具体进行以下操作:
S401.从所述步骤S3获得的子图的实体词筛选出答案词、证据点实体词和推理链相关的句子,使用标记<UNK>来屏蔽文本中证据点实体词所在的全部的句子中的部分答案词,其中,部分答案词为不属于比较推理类型的答案词;
S402.对所述步骤S401中获得的答案词、证据点实体词以及推理链相关的句子,通过分布式向量词库,将答案词、证据点实体词和推理链相关的句子分别表示成答案向量、证据点实体向量和句子向量;
具体的,对于文本类编码,采用BERT分布式向量词库,并且通过自然语言识别工具箱CoreNLP获取用于表示文本的语义和上下文关联关系的语言特征,包括:字符大小写、词性标签、命名实体标签和相互引用指代标签;但本发明不局限于此,可以根据需要引入其他的语言特征;
然后,基于上述选定的分布式向量词库和语言特征,通过基于神经网络的词分布式表示方法,将语言特征标记转换成对应的分布式向量,在具体的实施方式中,转换后的向量的维度分别为3,12,8和3;通过把答案词、证据点实体词以及各类语言特征的向量进行拼接,可以获得增强型的文本分布式向量;
S403.使用门控循环神经网络(GRU)对所述步骤S402的答案向量、证据点实体向量和句子向量进行处理,通过句子向量生成第一具有上下文信息的词向量,将答案向量和证据点实体向量共同处理成实体向量,并且使用N层的图变换器将推理链处理成分布式向量;
然后,通过双向的GRU来捕捉文本的上下文关联语义。GRU编码器来源于文章("K.Cho,B.V.Merrienboer,C.Gulcehre,D.Bahdanau,F.Bougares,H.Schwenk,and Y.Bengio.2014.Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation.In Proceedings of EMNLP")。给定句子每个词的分布式向量,经过GRU的处理后能生成两类表示,包括:(a) 带上下文信息的词向量,对于句子中第j th个词,可以表示成一个向量
Figure PCTCN2020110151-appb-000011
Figure PCTCN2020110151-appb-000012
其中
Figure PCTCN2020110151-appb-000013
Figure PCTCN2020110151-appb-000014
分别表示前向和后向GRU中第j th个词对应的隐藏状态向量,
Figure PCTCN2020110151-appb-000015
表示这个词的分布式向量,符号[·;·]表示两个向量的拼接操作;(b)整体的编码,通过拼接开始和终止状态获得句子的整体表示
Figure PCTCN2020110151-appb-000016
其中J表示句子中词的总数。
类似地,答案和证据点实体一起可以表示成
Figure PCTCN2020110151-appb-000017
其中它们第o th个词可表示成
Figure PCTCN2020110151-appb-000018
向量;
对于推理链编码,为了捕捉链上的关联关系,使用N层的图变换器把推理链表示成分布式向量。该变换器来源于文章(“Petar Veliˇckovi′c,Guillem Cucurull,Arantxa Casanova,Adriana Romero,Pietro Li`o,and Yoshua Bengio.2018.Graph Attention Networks.In ICLR.”),适合捕捉图中各个节点间的关联关系。假定推理链上有□各节点,每个节点v通过其对应的实体词分布式向量来表示,即
Figure PCTCN2020110151-appb-000019
其中
Figure PCTCN2020110151-appb-000020
是实体词的第一个单词对应的分布式向量,
Figure PCTCN2020110151-appb-000021
是最后的单词对应的分布式向量,k表示实体词的单词数量。节点间的上下文通过对邻近节点做注意力加权融合获得,即
Figure PCTCN2020110151-appb-000022
其中||表示向量间的拼接运算,e v表示节点v的分布式表示向量,□ v表示节点v的邻近节点集合。a n(·,·)是第n th个注意力函数,函数如以下的公式(6)所示:
Figure PCTCN2020110151-appb-000023
其中,每个函数可以独立地学习出对应的权重,W k,W e∈□ d×d。所得的点积结果通常通过对所有的边来做归一化,在实际中,为了减少这些点积求梯度的计算复杂度,本发明通过
Figure PCTCN2020110151-appb-000024
来做归一化。
最后通过公式(7)聚合所有的节点,可以得到向量c g,具体如下:
Figure PCTCN2020110151-appb-000025
其中,
Figure PCTCN2020110151-appb-000026
W h,W d是可训练矩阵,□是推理链所有节点构成的集合。
S404.基于注意力机制对句子向量进行处理;
具体的,为了能有效刻画句子中单词在语义上的长关联依赖,本发明使用自身注意力机制来进一步优化句子的分布式表示方式,即
Figure PCTCN2020110151-appb-000027
该机制来源于文章(“Wenhui Wang,Nan Yang,Furu Wei,Baobao Chang,and Ming Zhou.2017.Gated self-matching networks for reading comprehension and question answering.In Proceedings of the 55th ACL”)。具体地,给定句子的表示H,该机制使用控制变量通过公式(8)来衡量句子内部各个单词之间的关联关系,具体如下:
Figure PCTCN2020110151-appb-000028
其中,α j表示第j个单词
Figure PCTCN2020110151-appb-000029
与句子H中其他单词的关联分数,u j表示第j个单词的上下文关联向量,
Figure PCTCN2020110151-appb-000030
根据u j来更新为f j,由控制变量g j来确定更新的部分。
S405.基于答案感知的交互编码,对第一具有上下文信息的词向量和实体向量进行处理,计算并拼接答案向量和证据点实体向量整体的关联、答案向量和证据点实体向量的每个词累计向量的关联、以及答案向量和证据点实体向量的每个词最大向量的关联,得到第一答案信息感知的向量,将所述答案信息感知的向量输入到另一门控循环神经网络获得第二具有上下文信息的向量,将第一具有上下文信息的词向量和第二具有上下文信息的向量进行拼接,得到第二答案信息感知的向量;
具体的,答案感知的交互编码是
Figure PCTCN2020110151-appb-000031
给定句子s中第j th个词的表示
Figure PCTCN2020110151-appb-000032
以及答案和证据点的表示
Figure PCTCN2020110151-appb-000033
通过函数f m(·)来从多个维度捕捉它们的交互关联;本发明采用三个维度,包括整体关联,即计算
Figure PCTCN2020110151-appb-000034
和答案和证据点整体的关联
Figure PCTCN2020110151-appb-000035
累计关联,即计算
Figure PCTCN2020110151-appb-000036
和答案和证据点各个词累计向量的关联
Figure PCTCN2020110151-appb-000037
最大关联,计算
Figure PCTCN2020110151-appb-000038
和答 案和证据点各个词最大向量的关联
Figure PCTCN2020110151-appb-000039
而函数被定义为f m(μ,ν,W)=cos(W k□μ,W k□ν),其中□表示向量间的点乘数学符号,W表示权重矩阵,该矩阵的每列W k表示对应关联维度的权重。通过拼接这些维度对应的关联向量,可以获得一个答案信息感知的向量m j=[m 1;m 2;m 3],把该向量输入另一个双向门控循环神经网络(GRU)中来获得带上下文信息的向量
Figure PCTCN2020110151-appb-000040
最后通过拼接获得针对句子第j th个词的带答案信息感知的新向量
Figure PCTCN2020110151-appb-000041
S406.对步骤S402至步骤S405得到的向量进行处理,得到基于可训练的参数的融合向量;
具体的,通过公式(9)加权来融合以上的分布式表示向量,可以获得向量c t,其中α tj是归一化后的注意力权重,a tk表示文本单词之间的对齐分数,s t表示生成出的第t th个词对应的隐含变量,v,b,W s,W b是可训练的参数,公式(9)如下所示:
Figure PCTCN2020110151-appb-000042
在本实施例中,所述步骤S5中规范学习单元的计算过程具体如下:
S501.基于马尔可夫神经网络模型,建立用于多次取样生成问题
Figure PCTCN2020110151-appb-000043
的单词的联合分布,如以下的公式(2)所示:
Figure PCTCN2020110151-appb-000044
其中,p(z t+1,l t+1|z t,l t)代表第(t+1) th个片段的状态变量和长度变量的转移概率,这些概率由前一个t th状态来决定产生;在建立联合分布前先生成功能类似的单词片段,例如(q i(t-1)+1,…,q i(t)),其中i(·)是用于记录片段内单词下标的索引函数,其中第t th个单词的下标为
Figure PCTCN2020110151-appb-000045
i(0)=0,i(T')=T;转移概率可以被分解为p(l t+1|z t+1)×p(z t+1|z t),其中p(l t+1|z t+1)是关于片段最大长度L的均匀分 布,p(z t+1|z t)是关于片段状态的转移概率,如公式(3)所示:
Figure PCTCN2020110151-appb-000046
其中,e i,e j,e k∈□ d是片段状态i,j,k对应的分布式表示,b i,j,b i,k是标量偏置参数;在具体的实施方式中,b i,j设置为负无穷大以避免自身迭代转移,因为相邻状态的提问片段在表达模式上通常扮演不同的语法或语义角色;
其中,p(q i(t-1)+1:i(t)|z t,l t)为问题的单词的生成分布,被定义为所有提问的单词项生成概率的乘积,即
Figure PCTCN2020110151-appb-000047
S502.通过所述步骤S501的联合分布得到问题的单词后,基于双向门控循环神经网络,建立将问题的单词表示成向量的函数
Figure PCTCN2020110151-appb-000048
如公式(4)所示:
Figure PCTCN2020110151-appb-000049
其中,
Figure PCTCN2020110151-appb-000050
Figure PCTCN2020110151-appb-000051
分别表示在提问词和单词片段的分布式表示;□表示按元素进行的乘法;
Figure PCTCN2020110151-appb-000052
表示每个单词片段
Figure PCTCN2020110151-appb-000053
对应的门控因子,该因子可通过学习获得;然后,我们通过相乘获得
Figure PCTCN2020110151-appb-000054
该参数捕获了单词片段上下文信息。通过softmax层把
Figure PCTCN2020110151-appb-000055
输出各个提问单词的概率分布,即:
Figure PCTCN2020110151-appb-000056
其中,W q和b q通过训练获得的参数;
S503.通过反向传播算法获得问题Y的边际分布p(Y),如公式(5)所示:
Figure PCTCN2020110151-appb-000057
其中,其中β t(i)表示第t th个单词片段内的状态参数反向传播权重,
Figure PCTCN2020110151-appb-000058
表示第t th个单词片段内的长度参数反向传播权重;h t表示第t th个提问Y的单词对应的分布式向量,初始状态为
Figure PCTCN2020110151-appb-000059
在具体的实施方式中,为了更合理地学习出单词片段,本发明使用中文处理工具CoreNLP来识别提问文本的词性,本发明让模型在切分提问片段的时候尽 量不要破坏诸如动词短语(VP)和名词短语(NP)等句法成分;最后,通过反向传播算法来最大化对数似然估计损失函数,从非标注数据D U学习编码器和解码器的参数;
S504.通过维特比算法预测问题的状态序列并构成序列池,从序列池提取状态序列作为问题的表达模式,计算规范变量,其中包括问题的单词片段的状态信息和上下文信息;
具体的,本发明无偏地从序列池中抽样出一个状态序列
Figure PCTCN2020110151-appb-000060
作为提问的表达模式,其中,每个状态对应的片段长度参数l t能够通过以上的p(l t|z t)概率来计算得出;最后,本发明通过公式(4)计算出
Figure PCTCN2020110151-appb-000061
来整合所有片段
Figure PCTCN2020110151-appb-000062
的状态信息和上下文信息;其中,
Figure PCTCN2020110151-appb-000063
变量m满足约束i(m-1)<t≤i(m),k=t-i(m-1);
Figure PCTCN2020110151-appb-000064
捕捉了提问表达模式的有效信息,可以作为先验知识对应的参数去规范化提问的生成,其中y t-1表示第(t-1) th个生成的提问单词。
在本实施例中,所述步骤S5中解码器进行概率分布计算的具体过程如下:
S505.基于复制机制生成问题的词,然后通过所述步骤S504得到的规范变量将所述问题的词进行组合,得到能够在文本中推理出答案的、句法表达适当的问题;
具体的,基于上下文向量c t,本发明通过公式(10)的概率分布来生成提问的每个单词,具体如下:
Figure PCTCN2020110151-appb-000065
其中,推理链的分布式表示c g可以引导生成器考虑推理的证据点逻辑关联,而规范变量
Figure PCTCN2020110151-appb-000066
能促进模型生成语法和句法表达正确的提问。其中ρ是一个1维的向量来表示推理类型;W o和b o表示可训练的参数;p voc(y t)表示生成提问单词的概率分布。为了解决无登录词的问题(即生成的词未在训练数据的词集合中出现),本发明采用复制机制,该机制来源于文章(“Jiatao Gu,Zhengdong Lu,Hang Li,and Victor O.K.Li.2016.Incorporating copying mechanism in sequence-to-sequence learning.In Proceedings of the 54th ACL”)。这个机制能通过复制输入文本的词来 一定程度解决未登录词的问题,其中p copy(·)表示复制词的概率分布,p g表示选择复制词或者生成词的控制变量。
在本实施例中,所述步骤S6的评估单元计算损失函数指标的具体过程包括以下步骤:
S601.基于有监督方法和训练数据,通过最小化负交叉熵得到第一损失函数;
具体的,为了提升训练的收敛速度,本发明先使用有监督的方法基于训练数据D L通过最小化负交叉熵来预先训练第一损失函数公式(11)的模型,具体如下:
Figure PCTCN2020110151-appb-000067
为了加速收敛,本发明通过对提问Y i运行Viterbi算法而不是采样来获得表达方式的规范变量
Figure PCTCN2020110151-appb-000068
T i表示提问Y i对应的单词个数;
S602.采用强化学习,将问题中的每个词依序逐个补充,在每次补充后,将当前得到的词作为部分序列进行评估打分,通过累计部分序列的损失函数,得到第二损失函数;
具体的,考虑到传统的有监督学习存在硬匹配偏差和训练和测试之间的评估差异等不足,导致单纯依靠有监督学习并不一定能产生最优解;为了解决该问题,本发明借助于强化学习来微调模型,让模型更容易获得最优解;强化学习是业界广泛使用的一种训练方法,擅长于优化非连续函数的目标;本发明使用第二损失函数
Figure PCTCN2020110151-appb-000069
找出最佳的生成单词策略π θ来最小化所生成提问Y s对应的;其中,θ是模型的参数集,分值函数r(Y)通过指定指标来衡量模型输出的提问文本Y s和标注提问Y *之间的差异;
S603.采用混合目标训练,将所述第一损失函数和基于强化学习的损失函数进行加权融合,得到输出的损失函数;
具体的,考虑到使用单一的损失函数有可能导致生成提问的可读性不强,为了解决该问题,本发明采用一个混合目标的损失函数来提升可读性,如以下的公式(13)所示:
L=γL rl+(1-γ)L sl    公式(13);
其中,γ是权重参数。
在具体的实施方式中,考虑到模型需要约束来逼近标注结果,来避免各类局 部最优的可能,强化学习的权重γ设置为0.3。
在本实施例中,所述步骤S602中评估打分为分析基准输出问题和生成器输出问题,具体过程如下:
对于基准输出问题和生成器输出问题,分别计算所述部分序列的语法流畅度指标、问题的可解答性指标、以及语义关联度指标,将所述语法流畅度指标、问题的可解答性指标、以及语义关联度指标进行加权融合,得到基准输出问题的打分函数和生成器输出问题的打分函数,将基准输出问题的打分函数和生成器输出问题的打分函数相减,得到生成器输出问题的损失函数;
每一种指标的评估方式具体如下:
(a)流畅度:本发明采用基于语言模型计算负困惑度的方式来衡量所生成的提问文本的流畅度,计算方式为
Figure PCTCN2020110151-appb-000070
来源于文章("X.Zhang and M.Lapata.2017.Sentence Simplification with Deep Reinforcement Learning.In Proceedings of EMNLP"),在实际应用中能有效衡量生成文本的质量;
(b)可解答:本发明采用QBLEU 4(Y s,Y *)来衡量生成的提问的可解答性;具体地,准确率和召回率的计算方法分别是
Figure PCTCN2020110151-appb-000071
Figure PCTCN2020110151-appb-000072
其中i∈{r,n,q,f},∑ iw i=1,|l i|,|r i|分别表示属于i th种类型的生成提问和标注提问单词数,r,n,q,f分别代表相关内容词、实体词、提问词和功能词;通过以下公式加权获可解答函数QBLEU 4(·,·)=δAnswerability+(1-δ)BLEU 4其中
Figure PCTCN2020110151-appb-000073
δ是权重参数;BLEU n=4是匹配度函数,来源于文章("K.Papineni,S.Roukos,T.Ward,and W.J.Zhu.2019.BLEU:A Method for Automatic Evaluation of Machine Translation.In Proceedings of the 40th ACL"),通过计算文本对应子串的重叠度来衡量翻译文本和真实文本的匹配状况,即越多子串能匹配,分值越高;
(c)语义关联:考虑到问题表达方式的多样性,本发明奖励地提升与真实问题Y *在分布式空间中高度相似的提问Y s的分值;为了计算相似度,本发明采用词步长距离(WMD),来源于文章("H.Gong,S.Bhat,L.Wu,J.Xiong,and W.Hwu.2019.2019.Reinforcement Learning Based Text Style Transfer without Parallel  Training Corpus.In Proceedings of the 57th NAACL"),具有高效和鲁棒性很强的特点,用于计算两个文本在分布式空间中的语义相似度;通过生成文本的词语长度来正则化,就能获得语义关联指标的分值r sem(Y)=-WMD(Y s,Y *)/Length(Y *);其中WMD(.)函数计算公式如下
Figure PCTCN2020110151-appb-000074
Figure PCTCN2020110151-appb-000075
and
Figure PCTCN2020110151-appb-000076
考虑到以上奖励函数不可微不可导,本发明使用自临界策略梯度训练算法来训练模型,该算法来源于("S.J.Rennie,E.Marcheret,Y.Mroueh,J.Ross,and V.Goel 2017.Self-Critical Sequence Training for Image Captioning.In Proceedings of the CVPR")。具体地,该算法定义生成器输出问题的损失函数,如以下的公式(12)所示:
Figure PCTCN2020110151-appb-000077
其中,Y b表示基准方法的输出序列结果,该基准方法通过一种局部最优的方式生成训练,即使用贪婪算法每次生成概率最大的词;Y s是生成器所输出的序列结果,每个词
Figure PCTCN2020110151-appb-000078
通过采用公式(12)的概率值来获得;通过最小化该损失函数,就能优化模型,让其生成比基准方法分值更高的序列。
在本实施例中,所述方法还包括在步骤S6结束后执行的步骤S7,所述步骤S7包括评价性能的过程,采用BLEU-4指标、METEOR指标和ROUGE-L指标评估所生成的问题的质量;
具体的,考虑到机器阅读理解是提问生成的对偶任务,本发明使用可推理数据集HotpotQA进行实验,该数据集来源于文章("Z.Yang,P.Qi,S.Zhang,Y.Bengio,W.W.Cohen,R.Salakhutdinov,and C.D.Manning.2018.HotpotQA:A Dataset for Diverse,Explainable Multi-hop Question Answering.In Proceedings of the 56th ACL")。,该数据集被分割成训练和测试集,分别有9万和7千个标注样本。本发明使用10%的训练数据作为开发集来调优模型。每个样本由一个提问、答案和若干个段落组成。此外,本发明还收集了两个非标注的提问数据集,用于训练提问表达模式的先验知识,包括ComplexWebQuestions和DROP,这两个数据集均为人工标注构建的可推理提问,但没有标注关联上对应的文档和答案。这 两个数据集规模分别为3.5万条和9.7万条,其中ComplexWebQuestions数据集来源于论文(“Alon Talmor and Jonathan Berant.2018.The web as a knowledge-base for answering complex questions.In Proceedings of the 2018 NAACL”);DROP数据集来源于论文(“Dheeru Dua,Yizhong Wang,Pradeep Dasigi,Gabriel Stanovsky,Sameer Singh,and Matt Gardner.2019.DROP:A reading comprehension benchmark requiring discrete reasoning over paragraphs.In Proceedings of the 2019NAACL”)。
本发明使用三种传统指标方法来衡量生成的提问的质量,包括BLEU-4、METEOR和ROUGE-L。其中指标BLEU-4来源于论文(“Kishore Papineni,Salim Roukos,Todd Ward,and Wei-Jing Zhu.2002.Bleu:a method for automatic evaluation of machine translation.In Proceedings of the 40th ACL”);METEOR来源于论文(“Kishore Papineni,Salim Roukos,Todd Ward,and Wei-Jing Zhu.2002.Bleu:a method for automatic evaluation of machine translation.In Proceedings of the 40th ACL”);ROUGE-L来源于论文(“Chin-Yew Lin.2004.ROUGE:A package for automatic evaluation of summaries.In Text Summarization Branches Out”)。
实验结果表明,本发明生成提问的质量明显地优于传统方法。
一种基于低标注资源生成可推理问题的装置,如图3所示,包括:输入模块、预处理模块、生成器模块和输出模块;
所述生成器模块包括编码器、规范学习单元、解码器和评估单元;
所述输入模块用于接收用户输入的文本;
所述预处理模块用于得到证据点实体词并构建子图;
所述编码器模块将文本、答案、证据点实体词、子图和推理类型进行编码并输出为向量;
所述规范学习单元模块表征问题的单词片段及其上下文,生成用于控制问题的表达模式的参数;
所述解码器基于问题生成函数和用于控制问题的表达模式的参数,生成能够在文本中推理出答案的问题;
所述评估单元模块对所述问题计算损失函数,根据损失函数对所述生成器模块的参数进行训练和调整,生成器模块重新生成问题,直到损失函数达到预设损失函数计算迭代次数或者不再减少,其中预设损失函数计算迭代次数至少为2;
所述输出模块向用户输出生成器模块最后得到的问题。
显然,本发明的上述实施例仅仅是为清楚地说明本发明所作的举例,而并非是对本发明的实施方式的限定。对于所属领域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式的变化或变动。这里无需也无法对所有的实施方式予以穷举。凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明权利要求的保护范围之内。

Claims (16)

  1. 一种基于低标注资源生成可推理问题的方法,其特征在于,包括以下步骤:
    S1.获取标注数据集和非标注数据集,建立问题生成函数,其中,所述标注数据集的数据少于第二非标注数据集的数据,所述问题生成函数通过判断问题中的词与文本、答案和问题中所有的词相对应的概率,确定问题是否能够在文本中推理出答案;
    S2.从所述文本中识别出实体词,以实体词为节点构建实体图;
    S3.获取推理类型,针对推理类型分析所述实体图的实体词之间的关系,所述实体词之间的关系能够构成与推理类型对应的证据链,通过实体词之间的关系连接实体词,得到子图;
    S4.使用编码器通过编码处理将答案和证据链中的实体词的组合、推理类型、证据链相关的句子以及推理链以向量形式表示,然后通过注意力机制进行处理,在获取答案和句子之间的关联信息后,得到作为步骤S5的输入的融合向量;
    S5.使用所述规范学习单元通过隐含变量表征问题的单词片段及其上下文,并利用所述非标注数据集来预估用于控制问题的表达模式的参数,使用解码器获取所述步骤S4的融合向量,基于所述步骤S1的问题生成函数和用于控制问题的表达模式的参数,采用概率分布进行计算,生成能够在文本中推理出答案的问题;
    S6.通过评估单元对步骤S5得到的问题进行评估计算,得到损失函数指标,如果达到预设损失函数计算迭代次数或者损失函数指标不再减少,其中预设损失函数计算迭代次数至少为2,则得到编码器、注意力机制和解码器作为生成器模型,结束计算;否则根据损失函数指标,对步骤S4的编码器和注意力机制、以及步骤S5的解码器的参数进行训练调整,返回步骤S4。
  2. 根据权利要求1所述的基于低标注资源生成可推理问题的方法,其特征在于,在所述步骤S1中,标注数据集为
    Figure PCTCN2020110151-appb-100001
    其中,B为文档段落,A为答案,Y为问题,n为标注数据数量;非标注数据集为
    Figure PCTCN2020110151-appb-100002
    其中,Q j为非标注问题,与标注数据问题
    Figure PCTCN2020110151-appb-100003
    具有相似的表达模式,非标注数据数量□>n;
    所述问题生成函数为以下公式:
    Figure PCTCN2020110151-appb-100004
    其中,B代表文本,文本B=(s 1,L,s I),A代表根据文本内容获得的答案,答案A=(a 1,L,a L),Y代表生成的问题,问题Y=(y 1,L,y T),
    Figure PCTCN2020110151-appb-100005
    代表与文本B和答案A对应的问题;
    其中,s I表示文本B中第l th个句子,I代表文本B中的句子的总数,y T表示问题中第l th个词,T代表问题中词的总数,a L表示答案中第l th个词,L表示答案中词的总数;
    其中,y t代表问题Y中的词,通过从概率分布p(·)中采样而获得,Y <t代表问题Y中第1个到第t-1个的词。
  3. 根据权利要求1所述的自动生成可推理问答的方法,其特征在于,所述步骤S2采用自然语言识别工具箱CoreNLP识别实体词并分析和记录实体词的属性。
  4. 根据权利要求1所述的自动生成可推理问答的方法,其特征在于,在所述步骤S2中构建实体图的步骤中,对实体词进行比对并标记上关系标签,具体如下:
    S201.如果两个实体词共同出现在同一句子中,将所述两个实体词连接并标记上共同出现的关系标签;
    S202.如果两个实体词共同出现在同一段落的不同句子中,而且两个实体词通过词语级精确匹配计算得到的相似度值大于第一阈值,则将两个实体词连接并标记上句子级匹配的关系标签;
    S203.如果两个实体词共同出现在不同段落的不同句子中,而且两个实体词通过词语级精确匹配计算得到相似度值的大于第二阈值,则将两个实体词连接并标记上段落级匹配的关系标签;
    S204.如果两个实体词通过指代解析工具计算出具有相互引用指代的关系,则将两个实体词连接并标记上相互引用的关系标签。
  5. 根据权利要求4所述自动生成可推理问答的方法,其特征在于,第一阈值为2/3,第二阈值为2/3。
  6. 根据权利要求1所述的自动生成可推理问答的方法,其特征在于,所述步骤S3中的推理类型包括线性推理类型、交集推理类型和比较推理类型。
  7. 根据权利要求4和6所述的自动生成可推理问答的方法,其特征在于, 在所述步骤S3中,针对线性推理类型,分析实体词之间的关系以及得到子图的具体过程是,遍历实体图并记录符合条件的关系标签,将所述符合条件的关系标签对应的实体词根据连接,得到子图以及由子图呈现的证据链,具体如下:
    S3101:选择起始的实体词,通过递归地访问相邻的实体词,从实体图中检索出连接多个实体词的连续的路径;
    S3102:统计路径上的关系标签,得到路径上的关系标签的总数;
    S3103:判断路径是否符合给定条件,如果符合全部的给定条件,则输出路径,否则不进行操作,其中,给定条件包括:路径上的共同出现的关系标签大于1;路径上的相互引用的关系标签大于1;路径中不包括高频词,其中高频词为标注训练集统计出的频次排列前5%的词;
    S3104:重复所述步骤S3101至步骤S3103直至遍历实体图中全部的实体词,将输出的路径作为子图。
  8. 根据权利要求4和6所述的自动生成可推理问答的方法,其特征在于,在所述步骤S3中,针对交集推理类型,分析实体词之间的关系以及得到子图的具体过程如下:
    S3201:选择包含至少2个关系标签的实体词作为起始的实体词,通过递归地访问相邻的实体词,从实体图中检索出连接多个实体词的连续的路径;
    S3202:统计路径上的关系标签,得到路径上的关系标签的总数;
    S3203:判断路径是否符合给定条件,如果符合全部的给定条件,则输出路径,否则不进行操作,其中,给定条件包括:路径上的共同出现的关系标签大于1;路径上的相互引用的关系标签大于1;路径中不包括高频词,其中高频词为标注训练集统计出的频次排列前5%的词;
    S3204:重复所述步骤S3201至步骤S3203直至遍历实体图中全部的实体词,将输出的路径作为子图。
  9. 根据权利要求3、4和6所述的自动生成可推理问答的方法,其特征在于,在所述步骤S3中,针对比较推理类型,分析实体词之间的关系以及得到子图的具体过程如下:
    S3301:记录实体图中的全部的关系标签;
    S3302:选择单个关系标签,将所述单个关系标签的两端实体词的属性与其余在步骤S3301得到的关系标签的两端实体词的属性逐一比对,如果比对的结果 是一致时,将所述单个关系标签和比对的关系标签记录为关系对;
    S3303:重复步骤S3302直至遍历全部的关系标签,将具有相同的关系标签的关系对通过关系标签连接成子图。
  10. 根据权利要求1所述的自动生成可推理问答的方法,其特征在于,所述步骤S4中,编码器具体进行以下操作:
    S401.从所述步骤S3获得的子图的实体词筛选出答案词和证据点实体词,对文本中证据点实体词所在的全部的句子屏蔽部分答案词,其中,部分答案词为不属于比较推理类型的答案词;
    S402.对所述步骤S401中获得的答案词、证据点实体词以及推理链相关的句子,通过分布式向量词库,将答案词、证据点实体词和推理链相关的句子分别表示成答案向量、证据点实体向量和句子向量;
    S403.使用门控循环神经网络对所述步骤S402的答案向量、证据点实体向量和句子向量进行处理,通过句子向量生成第一具有上下文信息的词向量,将答案向量和证据点实体向量共同处理成实体向量,并且使用N层的图变换器将推理链处理成分布式向量;
    S404.基于注意力机制对句子向量进行处理;
    S405.基于答案感知的交互编码,对第一具有上下文信息的词向量和实体向量进行处理,计算并拼接答案向量和证据点实体向量整体的关联、答案向量和证据点实体向量的每个词累计向量的关联、以及答案向量和证据点实体向量的每个词最大向量的关联,得到第一答案信息感知的向量,将所述答案信息感知的向量输入到另一门控循环神经网络获得第二具有上下文信息的向量,将第一具有上下文信息的词向量和第二具有上下文信息的向量进行拼接,得到第二答案信息感知的向量;
    S406.对步骤S402至步骤S405得到的向量进行处理,得到基于可训练的参数的融合向量。
  11. 根据权利要求1所述的自动生成可推理问答的方法,其特征在于,所述步骤S5中规范学习单元的计算过程具体如下:
    S501.基于马尔可夫神经网络模型,建立用于多次取样生成问题的单词的联合分布;
    S502.通过所述步骤S501的联合分布得到问题的单词后,基于双向门控循 环神经网络,建立将问题的单词表示成向量的函数;
    S503.通过反向传播算法获得问题的边际分布,最大化对数似然估计损失函数,从非标注数据学习编码器和解码器的参数;
    S504.通过维特比算法预测问题的状态序列并构成序列池,从序列池提取状态序列作为问题的表达模式,计算规范变量,其中包括问题的单词片段的状态信息和上下文信息。
  12. 根据权利要求10和11所述的自动生成可推理问答的方法,其特征在于,所述步骤S5中解码器进行概率分布计算的具体过程如下:
    S505.基于复制机制生成问题的词,然后通过所述步骤S504得到的规范变量将所述问题的词进行组合,得到能够在文本中推理出答案的、句法表达适当的问题。
  13. 根据权利要求1所述的自动生成可推理问答的方法,其特征在于,所述步骤S6的评估单元计算损失函数指标的具体过程包括以下步骤:
    S601.基于有监督方法和训练数据,通过最小化负交叉熵得到第一损失函数;
    S602.采用强化学习,将问题中的每个词依序逐个补充,在每次补充后,将当前得到的词作为部分序列进行评估打分,通过累计部分序列的损失函数,得到第二损失函数;
    S603.采用混合目标训练,将所述第一损失函数和基于强化学习的损失函数进行加权融合,得到输出的损失函数。
  14. 根据权利要求13所述的自动生成可推理问答的方法,其特征在于,所述步骤S602中评估打分为分析基准输出问题和生成器输出问题,具体过程如下:
    对于基准输出问题和生成器输出问题,分别计算所述部分序列的语法流畅度指标、问题的可解答性指标、以及语义关联度指标,将所述语法流畅度指标、问题的可解答性指标、以及语义关联度指标进行加权融合,得到基准输出问题的打分函数和生成器输出问题的打分函数,将基准输出问题的打分函数和生成器输出问题的打分函数相减,得到生成器输出问题的损失函数。
  15. 根据权利要求1所述的自动生成可推理问答的方法,其特征在于,所述方法还包括在步骤S6结束后执行的步骤S7,所述步骤S7包括评价性能的过程,采用BLEU-4指标、METEOR指标和ROUGE-L指标评估所生成的问题的质量。
  16. 一种基于低标注资源生成可推理问题的装置,其特征在于,包括:输入 模块、预处理模块、生成器模块和输出模块;
    所述生成器模块包括编码器、规范学习单元、解码器和评估单元;
    所述输入模块用于接收用户输入的文本;
    所述预处理模块用于得到证据点实体词并构建子图;
    所述编码器模块将文本、答案、证据点实体词、子图和推理类型进行编码并输出为向量;
    所述规范学习单元模块表征问题的单词片段及其上下文,生成用于控制问题的表达模式的参数;
    所述解码器基于问题生成函数和用于控制问题的表达模式的参数,生成能够在文本中推理出答案的问题;
    所述评估单元模块对所述问题计算损失函数,根据损失函数对所述生成器模块的参数进行训练和调整,生成器模块重新生成问题,直到损失函数达到预设损失函数计算迭代次数或者不再减少,其中预设损失函数计算迭代次数至少为2;
    所述输出模块向用户输出生成器模块最后得到的问题。
PCT/CN2020/110151 2020-08-20 2020-08-20 一种基于低标注资源生成可推理问题的方法和装置 WO2022036616A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/110151 WO2022036616A1 (zh) 2020-08-20 2020-08-20 一种基于低标注资源生成可推理问题的方法和装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/110151 WO2022036616A1 (zh) 2020-08-20 2020-08-20 一种基于低标注资源生成可推理问题的方法和装置

Publications (1)

Publication Number Publication Date
WO2022036616A1 true WO2022036616A1 (zh) 2022-02-24

Family

ID=80322428

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/110151 WO2022036616A1 (zh) 2020-08-20 2020-08-20 一种基于低标注资源生成可推理问题的方法和装置

Country Status (1)

Country Link
WO (1) WO2022036616A1 (zh)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114780706A (zh) * 2022-06-15 2022-07-22 共道网络科技有限公司 一种舆情事件的信息提取方法、设备和存储介质
CN114817510A (zh) * 2022-06-23 2022-07-29 清华大学 问答方法、问答数据集生成方法及装置
CN114925210A (zh) * 2022-03-21 2022-08-19 中国电信股份有限公司 知识图谱的构建方法、装置、介质及设备
CN115019906A (zh) * 2022-06-06 2022-09-06 电子科技大学 多任务序列标注的药物实体和相互作用联合抽取方法
CN115310425A (zh) * 2022-10-08 2022-11-08 浙江浙里信征信有限公司 基于政策文本分类和关键信息识别的政策文本分析方法
CN115994537A (zh) * 2023-01-09 2023-04-21 杭州实在智能科技有限公司 用于解决实体重叠与实体嵌套的多任务学习方法及系统
CN116431849A (zh) * 2023-04-07 2023-07-14 四川大学 一种基于证据学习的鲁棒图文检索方法
CN116578690A (zh) * 2023-07-13 2023-08-11 湖南元数科技有限公司 一种基于人工智能的保险客服服务方法与系统
CN116680502A (zh) * 2023-08-02 2023-09-01 中国科学技术大学 数学应用题智能求解方法、系统、设备及存储介质
WO2023225858A1 (zh) * 2022-05-24 2023-11-30 中山大学 一种基于常识推理的阅读型考题生成系统及方法
CN117252209A (zh) * 2023-11-15 2023-12-19 暗物智能科技(广州)有限公司 一种理科大题自动评分方法、系统、存储介质及处理终端
CN117313709A (zh) * 2023-11-29 2023-12-29 中国科学技术大学 一种基于统计信息和预训练语言模型的生成文本检测方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109918489A (zh) * 2019-02-28 2019-06-21 上海乐言信息科技有限公司 一种多策略融合的知识问答方法和系统
CN110765269A (zh) * 2019-10-30 2020-02-07 华南理工大学 基于动态词向量和层级神经网络的文档级情感分类方法
CN111125370A (zh) * 2019-12-06 2020-05-08 南京中新赛克科技有限责任公司 一种适应小样本的关系抽取方法
CN111274814A (zh) * 2019-12-26 2020-06-12 浙江大学 一种新型的半监督文本实体信息抽取方法
CN111428490A (zh) * 2020-01-17 2020-07-17 北京理工大学 一种利用语言模型的指代消解弱监督学习方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109918489A (zh) * 2019-02-28 2019-06-21 上海乐言信息科技有限公司 一种多策略融合的知识问答方法和系统
CN110765269A (zh) * 2019-10-30 2020-02-07 华南理工大学 基于动态词向量和层级神经网络的文档级情感分类方法
CN111125370A (zh) * 2019-12-06 2020-05-08 南京中新赛克科技有限责任公司 一种适应小样本的关系抽取方法
CN111274814A (zh) * 2019-12-26 2020-06-12 浙江大学 一种新型的半监督文本实体信息抽取方法
CN111428490A (zh) * 2020-01-17 2020-07-17 北京理工大学 一种利用语言模型的指代消解弱监督学习方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ZENG YUTAO, LIN XIEXIONG;JIN XIAOLONG;XI PENGBI;WANG YUANZHUO: "Multi-dimensional Information Integration Based Entity Linking for Knowledge Base Question Answering ", PATTERN RECOGNITION AND ARTIFICIAL INTELLIGENCE, vol. 32, no. 7, 15 July 2019 (2019-07-15), pages 642 - 651, XP055901073, ISSN: 1003-6059, DOI: 10.16451/j.cnki.issn1003-6059.201907008 *

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114925210A (zh) * 2022-03-21 2022-08-19 中国电信股份有限公司 知识图谱的构建方法、装置、介质及设备
CN114925210B (zh) * 2022-03-21 2023-12-08 中国电信股份有限公司 知识图谱的构建方法、装置、介质及设备
WO2023225858A1 (zh) * 2022-05-24 2023-11-30 中山大学 一种基于常识推理的阅读型考题生成系统及方法
CN115019906A (zh) * 2022-06-06 2022-09-06 电子科技大学 多任务序列标注的药物实体和相互作用联合抽取方法
CN114780706A (zh) * 2022-06-15 2022-07-22 共道网络科技有限公司 一种舆情事件的信息提取方法、设备和存储介质
CN114817510A (zh) * 2022-06-23 2022-07-29 清华大学 问答方法、问答数据集生成方法及装置
CN115310425A (zh) * 2022-10-08 2022-11-08 浙江浙里信征信有限公司 基于政策文本分类和关键信息识别的政策文本分析方法
CN115310425B (zh) * 2022-10-08 2023-01-03 浙江浙里信征信有限公司 基于政策文本分类和关键信息识别的政策文本分析方法
CN115994537A (zh) * 2023-01-09 2023-04-21 杭州实在智能科技有限公司 用于解决实体重叠与实体嵌套的多任务学习方法及系统
CN116431849A (zh) * 2023-04-07 2023-07-14 四川大学 一种基于证据学习的鲁棒图文检索方法
CN116431849B (zh) * 2023-04-07 2024-01-02 四川大学 一种基于证据学习的鲁棒图文检索方法
CN116578690A (zh) * 2023-07-13 2023-08-11 湖南元数科技有限公司 一种基于人工智能的保险客服服务方法与系统
CN116578690B (zh) * 2023-07-13 2023-09-22 湖南元数科技有限公司 一种基于人工智能的保险客服服务方法与系统
CN116680502A (zh) * 2023-08-02 2023-09-01 中国科学技术大学 数学应用题智能求解方法、系统、设备及存储介质
CN116680502B (zh) * 2023-08-02 2023-11-28 中国科学技术大学 数学应用题智能求解方法、系统、设备及存储介质
CN117252209A (zh) * 2023-11-15 2023-12-19 暗物智能科技(广州)有限公司 一种理科大题自动评分方法、系统、存储介质及处理终端
CN117252209B (zh) * 2023-11-15 2024-03-19 暗物智能科技(广州)有限公司 一种理科大题自动评分方法、系统、存储介质及处理终端
CN117313709A (zh) * 2023-11-29 2023-12-29 中国科学技术大学 一种基于统计信息和预训练语言模型的生成文本检测方法
CN117313709B (zh) * 2023-11-29 2024-03-29 中国科学技术大学 一种基于统计信息和预训练语言模型的生成文本检测方法

Similar Documents

Publication Publication Date Title
WO2022036616A1 (zh) 一种基于低标注资源生成可推理问题的方法和装置
WO2021184311A1 (zh) 一种自动生成可推理问答的方法和装置
CN112001185B (zh) 一种结合中文句法和图卷积神经网络的情感分类方法
Wu et al. Dependency-to-dependency neural machine translation
CN112001186A (zh) 一种利用图卷积神经网络和中文句法的情感分类方法
WO2021243706A1 (zh) 一种跨语言生成提问的方法和装置
Zhang et al. Combining cross-modal knowledge transfer and semi-supervised learning for speech emotion recognition
CN112541337B (zh) 一种基于递归神经网络语言模型的文档模板自动生成方法及系统
CN112420024A (zh) 一种全端到端的中英文混合空管语音识别方法及装置
CN113657123A (zh) 基于目标模板指导和关系头编码的蒙语方面级情感分析方法
WO2023225858A1 (zh) 一种基于常识推理的阅读型考题生成系统及方法
Qiu et al. Chinese microblog sentiment detection based on CNN-BiGRU and multihead attention mechanism
Marreddy et al. Multi-task text classification using graph convolutional networks for large-scale low resource language
CN113157932B (zh) 基于知识图谱表示学习的隐喻计算和装置
Zhang et al. Self-supervised bilingual syntactic alignment for neural machine translation
Acharjee et al. Sequence-to-sequence learning-based conversion of pseudo-code to source code using neural translation approach
Hsiao et al. Construction of an artificial intelligence writing model for English based on fusion neural network model
CN115293168A (zh) 基于预训练模型语义理解的多语言缩写消歧义算法
Hu et al. Emotion prediction oriented method with multiple supervisions for emotion-cause pair extraction
Guo An automatic scoring method for Chinese-English spoken translation based on attention LSTM
Zhang et al. Exploring aspect-based sentiment quadruple extraction with implicit aspects, opinions, and ChatGPT: a comprehensive survey
Wang et al. Chinese Text Implication Recognition Method based on ERNIE-Gram and CNN
Guo et al. A review of the development and application of natural language processing
Ruggeri Towards Unstructured Knowledge Integration in Natural Language Processing
Dharaniya et al. Automatic scene generation using sentiment analysis and bidirectional recurrent neural network with multi-head attention

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20949827

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20949827

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 270623)