Machine reading comprehension method and system

By introducing external knowledge sets into the machine reading comprehension system, generating and integrating text codes, the accuracy of answers to professional articles is improved, solving the problem of inaccurate answers in existing systems.

CN114741484BActive Publication Date: 2025-11-11IND TECH RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011642613.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2020-12-23
Filing Date
2020-12-30
Publication Date
2025-11-11
Estimated Expiration
2040-12-30

AI Technical Summary

Technical Problem

Existing machine reading comprehension systems suffer from low accuracy when processing technical articles due to the concise content and the assumption that readers have background knowledge.

Method used

By introducing an external knowledge set, a knowledge text generator is used to generate first and second knowledge texts. These texts are then combined with a semantic encoder and an encoding fusion unit for encoding operations. This process of importing external knowledge improves the accuracy of the answers.

Benefits of technology

It improves the accuracy of machine reading comprehension systems when processing professional articles, and solves the problem of difficulty in accurately obtaining answers due to the simplification of article content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114741484B_ABST
    Figure CN114741484B_ABST
Patent Text Reader

Abstract

A machine reading comprehension method includes obtaining a question text and an article text associated with the question text, generating a first knowledge text corresponding to the question text and a second knowledge text corresponding to the article text based on a knowledge set, encoding the question text and the article text to generate an original target text encoding, encoding the first knowledge text and the second knowledge text to generate a knowledge text encoding, performing a fusion operation on the original target text encoding and the knowledge text encoding, importing part of the knowledge in the knowledge set into the original target text encoding to generate a reinforced target text encoding, and obtaining an answer corresponding to the question text based on the reinforced target text encoding, and outputting the answer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence, and more specifically, to a machine reading comprehension method and system. Background Technology

[0002] Machine Reading Comprehension (MRC) is a technology that enables computers to read articles and answer related questions. In recent years, a large amount of textual data has been generated in various industries. If traditional manual processing methods are used, such as listing FAQs, problems such as slow processing speed, huge costs, and incomplete coverage of question-answer pairs will be encountered, and it may even become a bottleneck for enterprise development. Therefore, the demand for machine reading comprehension has been gradually increasing.

[0003] However, generally speaking, for the sake of brevity and literary beauty, authors often omit common sense information when writing. Furthermore, authors of professional articles (such as medical papers) often assume readers have relevant background knowledge and therefore do not include excessive background information. Therefore, if such articles are used as training material or for finding answers, the accuracy of the answers obtained by machine reading comprehension systems will be quite low. Summary of the Invention

[0004] For the reasons mentioned above, the present invention provides a machine reading comprehension method and system.

[0005] The machine reading comprehension method according to embodiments of the present invention includes obtaining question text and article text associated with the question text; generating a first knowledge text corresponding to the question text and a second knowledge text corresponding to the article text based on a knowledge set; encoding the question text and the article text to generate an original target text encoding; encoding the first knowledge text and the second knowledge text to generate a knowledge text encoding; performing a fusion operation on the original target text encoding and the knowledge text encoding to import some knowledge from the knowledge set into the original target text encoding to generate an enhanced target text encoding; and obtaining an answer corresponding to the question text based on the enhanced target text encoding and outputting the answer.

[0006] A machine reading comprehension system according to an embodiment of the present invention includes an input / output interface, a knowledge text generator, a semantic encoder, an encoding fusion unit, and an answer extractor. The knowledge text generator is connected to the input / output interface, the semantic encoder is connected to both the input / output interface and the knowledge text generator, the encoding fusion unit is connected to the semantic encoder, and the answer extractor is connected to the encoding fusion unit. The input / output interface is used to obtain question text and associated article text. The knowledge text generator is used to obtain a first knowledge text corresponding to the question text and a second knowledge text corresponding to the article text, based on a knowledge set. The semantic encoder is used to encode the question text and the article text to generate an original target text encoding, and to encode the first and second knowledge texts to generate a knowledge text encoding. The encoding fusion unit is used to perform a fusion operation on the original target text encoding and the knowledge text encoding, importing a portion of the knowledge from the knowledge set into the original target text encoding to generate an enhanced target text encoding. The answer extractor is used to obtain the answer to the corresponding question text based on the enhanced target text encoding and output the answer.

[0007] With the above architecture, the machine reading comprehension method and system provided by this invention can perform special encoding and fusion operations, and can import external knowledge in the process of analyzing questions and articles, thereby avoiding the problem that it is difficult to obtain the correct answer from the article content due to its simplification, and thus improving the accuracy of the predicted answer.

[0008] The above description of the content of this invention and the following description of the embodiments are intended to demonstrate and explain the spirit and principles of this invention, and to provide a further explanation of the scope of the patent application of this invention. Attached Figure Description

[0009] Figure 1 This is a functional block diagram of a machine reading comprehension system and an external knowledge database, drawn according to embodiments of the present invention;

[0010] Figure 2 This is a flowchart illustrating a machine reading comprehension method according to an embodiment of the present invention;

[0011] Figure 3 This is a flowchart illustrating the generation of knowledge text in a machine reading comprehension method according to an embodiment of the present invention;

[0012] Figures 4A to 4C This is a schematic diagram illustrating the encoding operation in a machine reading comprehension method according to an embodiment of the present invention;

[0013] Figures 5A to 5C This is a schematic diagram illustrating the fusion operation in a machine reading comprehension method according to an embodiment of the present invention;

[0014] Figure 6A and Figure 6BThis is a flowchart illustrating the answer extraction process in a machine reading comprehension method according to an embodiment of the present invention;

[0015] Figure 7 This is a flowchart illustrating the optimization of parameters in a machine reading comprehension method according to an embodiment of the present invention;

[0016] Figure 8A This is a comparison chart of experimental data obtained by training an existing machine reading comprehension system and the machine reading comprehension system of this invention with the first type of data.

[0017] Figure 8B This is a comparison chart of experimental data obtained by training an existing machine reading comprehension system and the machine reading comprehension system of this invention with the second type of data. Detailed Implementation

[0018] The following detailed description of the features and advantages of the present invention in the embodiments is sufficient to enable any person skilled in the art to understand the technical content of the present invention and to implement it accordingly. Based on the disclosure of this specification, the scope of the claims, and the accompanying drawings, any person skilled in the art can easily understand the related objectives and advantages of the present invention. The following embodiments are for further detailed explanation of the viewpoints of the present invention, but are not intended to limit the scope of the present invention in any way.

[0019] refer to Figure 1 , Figure 1 This is a functional block diagram illustrating a machine reading comprehension system and an external knowledge base, based on embodiments of the present invention. Figure 1 As shown, the machine reading comprehension system 1 includes an input / output interface 11, a knowledge text generator 12, a semantic encoder 13, an encoding fusion unit 14, and an answer extractor 15. The knowledge text generator 12 is connected to the input / output interface 11 and can be connected to an unstructured knowledge database 21 and / or a structured knowledge database 22 outside the system. The semantic encoder 13 is connected to the input / output interface 11 and the knowledge text generator 12. The encoding fusion unit 14 is connected to the semantic encoder 13, and the answer extractor 15 is connected to the encoding fusion unit 14 and the input / output interface 11.

[0020] The input / output interface 11 is used to obtain question text and associated article text, and can also be used to output the answer to the corresponding question text determined by other devices in the system. The question text and article text can be text files; the question text indicates the question for which an answer is sought, while the article text indicates the possible source of the answer. For example, in intelligent customer service applications, product manuals or activity rules can serve as article text, and inquiries about product usage methods or activity offers can serve as question text. As another example, in smart healthcare applications, medical records or medical papers can serve as article text, and inquiries about causes or treatments can serve as question text. The above are merely examples and are not intended to limit the invention.

[0021] The input / output interface 11 may include input devices such as a keyboard, mouse, or touchscreen for users to input or select question text and article text, and may also include output devices such as a screen for outputting the answers generated by the answer extractor 15. Alternatively, the input / output interface 11 may be a wired or wireless connection port for connecting to external devices (such as mobile phones, tablets, personal computers, etc.) to receive instructions on question text and article text or to select specific question text and article text, and may transmit the answers generated by the answer extractor 15 to the external device. Furthermore, in addition to the aforementioned input / output devices or connection ports, the input / output interface 11 may also include a processing module. The input / output interface 11 can receive instructions on question text or to select specific question text via the input devices or connection ports, and then use the processing module to search for article text related to the question text from external or internal databases. Further, the processing module can determine the type or event to which the question text belongs based on keywords or tags in the question text, and search for article text of the same type or event.

[0022] The knowledge text generator 12, semantic encoder 13, encoder fusion unit 14, answer extractor 15, and the aforementioned input / output interface 11 may have processing modules that can be implemented by the same processor or multiple processors, where the processor is, for example, a central processing unit (CPU), microcontroller, programmable logic controller (PLC), etc.

[0023] The knowledge text generator 12 receives question text and article text from the input / output interface 11, and generates a first knowledge text corresponding to the question text and a second knowledge text corresponding to the article text, based on a knowledge set. The knowledge set can be provided by one or both of an unstructured knowledge database 21 and a structured knowledge database 22. The unstructured knowledge database 21 and the structured knowledge database 22 can be publicly available databases on the internet or databases internal to those skilled in the art. The unstructured knowledge database 21 stores multiple unstructured knowledge items, which can be textual descriptions of multiple specific words. For example, the unstructured knowledge database 21 can include Wikipedia, dictionaries, etc. The structured knowledge database 22 stores multiple structured knowledge items, which can be relationships between multiple specific words and other words, for example, represented as "entity-entity relationship-entity" triples, and multiple triples can form a knowledge graph. That is, the structured knowledge database 22 can contain knowledge graphs from multiple domains. Furthermore, the knowledge text generator 12 can output at least a portion of the knowledge set through the input / output interface 11. Furthermore, the knowledge text generator 12 can output the knowledge data stored in the unstructured knowledge database 21 and / or the structured knowledge database 22 through the input / output interface 11, and can also output the knowledge text generated by the knowledge text generator 12 for users to view or adjust. Further embodiments of the knowledge text generator 12 generating knowledge text based on the above knowledge set will be described later.

[0024] The semantic encoder 13 receives question text and article text from the input / output interface 11, encodes the question text and article text to generate original target text encoding, receives first knowledge text and second knowledge text generated by the knowledge text generator 12, and encodes the first knowledge text and second knowledge text to generate knowledge text encoding. The semantic encoder 13 can perform encoding operations in various ways, including non-contextualized encoding and contextualized encoding, further embodiments of which will be described later.

[0025] Encoding fusion unit 14 performs a fusion operation on the original target text encoding and knowledge text encoding generated by semantic encoder 13, so as to import part of the knowledge set into the original target text encoding to generate enhanced target text encoding. Answer extractor 15 obtains the answer to the corresponding question text based on the enhanced target text encoding, and outputs the answer through an input / output interface, wherein the output interface is, for example, an output device such as a screen, or a wired or wireless connection port used to connect and transmit the answer to an external device (such as a mobile phone, tablet, personal computer, etc.). Further implementations of the fusion operation performed by encoding fusion unit 14 and the answer extraction operation performed by answer extractor 15 will be described later.

[0026] refer to Figure 1 and Figure 2 ,in Figure 2 This is a flowchart illustrating a machine reading comprehension method according to an embodiment of the present invention. Figure 2 The machine reading comprehension method shown is applicable to Figure 1 The machine reading comprehension system 1 shown is an example, but not limited to it. For example... Figure 2 As shown, the machine reading comprehension method includes the following steps: S1: Obtaining the question text and the article text associated with the question text; S2: Generating a first knowledge text corresponding to the question text and a second knowledge text corresponding to the article text based on a knowledge set; S3: Encoding the question text and the article text to generate the original target text encoding; S4: Encoding the first knowledge text and the second knowledge text to generate the knowledge text encoding; S5: Performing a fusion operation on the original target text encoding and the knowledge text encoding, importing some knowledge from the knowledge set into the original target text encoding to generate the enhanced target text encoding; S6: Obtaining the answer corresponding to the question text based on the enhanced target text encoding; and S7: Outputting the answer. The following example illustrates... Figure 1 The machine reading comprehension system 1 shown here includes the following devices for further explanation. Figure 2 Various implementations of the resource allocation method shown.

[0027] In step S1, the input / output interface 11 can obtain the question text and the article text related to the question text. Further, the input / output interface 11 can directly receive files containing the question text and article text, or receive instructions to select specific question text and article text, or it can receive the question text or instructions to select specific question text, and then search for the article text related to the question text from external or internal databases. The method for searching for the article text related to the question text can be: determining the type or event to which the question text belongs based on keywords or tags in the question text, and then searching for article text of the same type or event. For example, when the input / output interface 11 determines that the question text is medical, it searches for medical-related article text; when the input / output interface 11 determines that the question text indicates a question related to an anniversary celebration, it searches for related articles about the anniversary celebration. The above are merely examples and are not intended to limit the invention.

[0028] In step S2, the knowledge text generator 12 can generate a first knowledge text corresponding to the question text and a second knowledge text corresponding to the article text based on the knowledge set. That is, the knowledge text generator 12 can process the question text and the article text as texts to be processed, respectively, and generate corresponding knowledge texts. The knowledge set contains knowledge stored in one or both of the unstructured knowledge database 21 and the structured knowledge database 22. In other words, the knowledge text generator 12 can search for materials from the unstructured knowledge database 21 and / or the structured knowledge database 22 to generate the first and second knowledge texts.

[0029] To further explain the process of generating knowledge texts, refer to [reference needed]. Figure 1 and Figure 3 , Figure 3 This is a flowchart illustrating the generation of knowledge text in a machine reading comprehension method according to embodiments of the present invention. For example... Figure 3 As shown, the process of generating knowledge text may include the following steps: S21: segmenting the text to be processed into multiple words; S22: searching a knowledge set based on the multiple words to obtain at least one related knowledge; S23: determining whether the number of related knowledge is one or more; when the number of related knowledge is one, proceeding to step S24: generating target knowledge text using this related knowledge; and when the number of related knowledge is more than one, proceeding to step S25: combining related knowledge to generate target knowledge text based on the order of the multiple words and a preset template. The target knowledge text generated using the question text as the text to be processed is the first knowledge text, while the target knowledge text generated using the article text as the text to be processed is the second knowledge text.

[0030] In step S21, the knowledge text generator 12 can segment the text to be processed into multiple words using natural language analysis techniques. In step S22, the knowledge text generator 12 can use each segmented word as a keyword to search for knowledge related to the keyword from the knowledge set, that is, to search for knowledge related to the keyword from the unstructured knowledge database 21 and / or the structured knowledge database 22. In particular, the number of keywords contained in the text to be processed does not necessarily correspond to the number of related knowledge found; one keyword may correspond to zero, one, or more related knowledge. That is, the related knowledge obtained by the knowledge text generator 12 may be zero, one, or more. When the number of related knowledge is zero, the knowledge text generator 12 stops operating and / or outputs an error signal; when the number of related knowledge is one or more, the operation of the knowledge text generator 12 is as follows.

[0031] In steps S23-S25, when the number of relevant knowledge items is one, the knowledge text generator 12 generates target knowledge text based on this relevant knowledge. When the number of relevant knowledge items is greater than one, the knowledge text generator 12 combines this relevant knowledge based on the order of the segmented words and a preset template (first preset template) to generate target knowledge text. For example, the first preset template indicates a text description that concatenates all relevant knowledge items, with each pair of relevant knowledge items separated by a delimiter (e.g., a period), wherein the concatenation order is the same as the word order, but is not limited to this. In another embodiment, the knowledge text generator 12 can further generate a simplified version of the knowledge text from the concatenated text description using a text summarization system as the target knowledge text. In addition, when the number of relevant knowledge items obtained by the knowledge text generator 12 exceeds a preset processing limit, the knowledge text generator 12 can filter relevant knowledge based on the type or activity of the text to be processed (e.g., based on the tags attached to the text) or based on the credibility of the relevant knowledge source (e.g., journal articles are preferred over online articles), leaving no more than the preset processing limit number of relevant knowledge items.

[0032] As mentioned earlier, the relevant knowledge obtained by the knowledge text generator 12 based on keywords may come from the unstructured knowledge database 21 and / or the structured knowledge database 22. That is, the relevant knowledge may include unstructured knowledge and / or structured knowledge. For relevant knowledge that belongs to unstructured knowledge, its form is itself a text description, so the knowledge text generator 12 can directly generate the target knowledge text from the relevant knowledge. For relevant knowledge that belongs to structured knowledge, before generating the target knowledge text, the knowledge text generator 12 will first convert the form of the relevant knowledge into a text description based on another preset template (the second preset template). Taking the unstructured knowledge of the form "entity (A) - entity relation (B) - entity (C)" as an example, the second preset template can be set as "A's B is C", but it is not limited to this.

[0033] The following are three examples of using the problem text as the text to be processed: examples where all related knowledge is unstructured, examples where all related knowledge is structured, and examples where related knowledge contains both unstructured and structured knowledge. These examples are merely illustrative and are not intended to limit the invention.

[0034] In the first example, the question text is "What rights does the plaintiff want to protect?", and the knowledge text generator 12 obtains the textual descriptions of the keywords "plaintiff" and "rights" from the knowledge set. Therefore, the knowledge text generator 12 can generate the first knowledge text: "(Plaintiff's textual description). (Rights' textual description)". In the second example, the question text is "Can I take a bath during postpartum confinement?", and the knowledge text generator 12 obtains the triples of the keywords "postpartum confinement" ("postpartum confinement - concept - postpartum care") and "bathing" ("bathing - efficacy - cleaning") from the knowledge set. The knowledge text generator 12 can first convert the two triples into the textual descriptions "The concept of postpartum confinement is postpartum care" and "The efficacy of bathing is cleaning," respectively, and then concatenate the two textual descriptions according to the order of the keywords in the question text to generate the target knowledge text. In the third example, the question text is "What is the date of birth of a child born in wedlock?", and the knowledge text generator 12 obtains the text description of the keyword "child born in wedlock" and the triple of the keyword "date" from the knowledge set. The knowledge text generator 12 first converts the triple of "date" into a text description as described above, and then concatenates the text description according to the order of the keywords in the question text. The above examples are merely illustrative and are not intended to limit the scope of this invention.

[0035] As described above, the machine reading comprehension system 1 can convert structured knowledge into textual descriptions through the knowledge text generator 12 to integrate unstructured and structured knowledge. As a result, the computational complexity of subsequent analysis of articles to produce answers is lower than that of direct analysis of structured data to produce answers.

[0036] Next, let's explain. Figure 2 Steps S3 and S4. It should be specifically noted here that... Figure 2 The illustration exemplarily depicts step S4 performed after step S3; however, in other embodiments, step S4 may be performed before or simultaneously with step S3. In steps S3 and S4, the semantic encoder 13 may encode the question text and the article text to generate the original target text encoding, and encode the first knowledge text and the second knowledge text to generate the knowledge text encoding. That is, in step S3, the semantic encoder 13 uses the combination of the question text and the article text as the object of the encoding operation, while in step S4, it uses the combination of the first knowledge text and the second knowledge text as the object of the encoding operation. This combination can be formed by directly concatenating the two texts, or by adding separators (e.g., adding "CLS" at the beginning, "SEP" at the end, and "SEP" between the two texts) after concatenation, but is not limited to these methods.

[0037] The semantic encoder 13 can perform encoding operations to generate original target text encoding or knowledge text encoding using either a context-independent encoding method or a context-dependent encoding method. Specifically, the methods for generating original target text encoding and knowledge text encoding can utilize the same or different encoding methods. A context-independent encoding method may include: segmenting the target text into multiple characters, obtaining the initial vector corresponding to each character, and combining the initial vectors to generate original target text encoding or knowledge text encoding. Taking English as the target text as an example, the semantic encoder 13 can directly segment words based on spaces in the target text, or it can segment them into subwords using the WordPiece algorithm, for example, segmenting "playing" into "play" and "##ing". Taking Chinese as the target text as another example, the semantic encoder 13 can segment the target text into multiple characters, or it can segment the target text into multiple words using natural language analysis techniques. The above are merely examples, and the invention is not limited thereto.

[0038] The initial vector can be a single token embedding, or it can contain token embeddings, segment embeddings, and position embeddings of the same dimension, for example, the sum of three vectors. A token embedding represents the corresponding token's vector in the vector space, and this can be achieved using a Word2Vec or GloVe model. A segment embedding indicates whether the corresponding token belongs to the first or second text within the execution object. Taking a combination of question text and article text as the execution object, the first text represents the question text, and its corresponding segment embedding is a vector with an encoding of 0; the second text represents the article text, and its corresponding segment embedding is a vector with an encoding of 1. The position embedding represents the position of the corresponding token among all tokens. The original target text encoding or knowledge text encoding can be a vector matrix composed of the initial vectors.

[0039] Encoding methods involving context relationships can include: dividing the execution object into multiple words; obtaining multiple initial vectors corresponding to each word; performing context encoding on these initial vectors to generate multiple encoded vectors; and combining these encoded vectors to generate the original target text encoding or knowledge text encoding. The initial vectors, as mentioned earlier, can be only word vectors, or they can contain word vectors, segment vectors, and position vectors of the same dimension, for example, the sum of three vectors. The meanings of word vectors, segment vectors, and position vectors have been explained previously and will not be repeated here.

[0040] To further illustrate a context encoding method, refer to... Figure 1 and Figures 4A to 4C , Figures 4A to 4C This is a schematic diagram illustrating the encoding operation in a machine reading comprehension method according to an embodiment of the present invention. Figure 4A In the process, the semantic encoder 13 segments the execution object into single characters x1 to x4, and obtains initial vectors a1 to a4 corresponding to each single character x1 to x4 in the aforementioned manner. The semantic encoder 13 then performs context encoding on the initial vectors a1 to a4 respectively, generating multiple encoded vectors b1 to b4. The context encoding performed on the initial vectors a1 to a4 can be performed in parallel or in a specific order. Figure 4B and Figure 4C The example illustrates performing context encoding on initial vector a1 to obtain encoded vector b1. Other initial vectors a2 to a4 can also be processed using the same operation to obtain encoded vectors b2 to b4, therefore no further illustration is provided. It should also be noted that... Figures 4A to 4C The number of characters shown is merely an example, and the invention is not limited thereto.

[0041] like Figure 4BAs shown, the semantic encoder 13 can generate multiple query vectors aq1 to aq4, multiple key vectors ak1 to ak4, and multiple value vectors av1 to av4 based on the initial vectors a1 to a4. Furthermore, the mathematical expressions representing the query vectors aq1 to aq4, the key vectors ak1 to ak4, and the value vectors av1 to av4 can be expressed as follows:

[0042] aq i =W aq a i

[0043] ak i =W ak a i

[0044] av i =W av a i

[0045] Among them, W aq W ak and W av The weight matrix is ​​randomly given, and its optimal value can be determined by analyzing the performance of the machine reading comprehension system 1 multiple times. The further optimization process will be described later.

[0046] Next, the semantic encoder 13 performs inner product operations between the query vector aq1 and the key vectors ak1 to ak4 respectively to obtain multiple initial weights. ~ Alternatively, after performing the inner product operation, you can divide by the dimensions of the query vector aq1 and the key vectors ak1 to ak4 to obtain multiple initial weights. ~ This can be expressed mathematically as:

[0047]

[0048] Where d represents the dimensions of the query vector aq1 and the key vectors ak1 to ak4.

[0049] Semantic encoder 13 then adjusts the initial weights respectively ~ Perform a normalization operation to obtain multiple normalized weights. ~ The normalization operation can be performed using the Softmax function, and the normalized weights obtained by the Softmax function operation are... ~ The mathematical expression can be represented as follows. The normalization operation of this invention can also be performed by other functions that sum the weights to 1, and is not limited to the following mathematical expression:

[0050]

[0051] Then as Figure 4C As shown, the semantic encoder 13 normalizes the weights. ~ A weighted sum operation is performed on the value vectors av1 to av4 to obtain a weighted sum vector, which serves as the encoding vector b1. Mathematically, this can be expressed as:

[0052]

[0053] Encoding vectors b2 to b4 are also generated by semantic encoder 13 using the above-described operation. In another embodiment, the operations performed using query vectors aq1 to aq4, key vectors ak1 to ak4, and value vectors av1 to av4 can be repeated multiple times. That is, Figure 4A The context encoding block can be multi-layered. The semantic encoder 13 uses initial vectors a1-a4 as input to the first layer, and its output (weighted sum vector) as input to the next layer, and so on. The output of the last layer is used as the encoding vectors b1-b4. The weight matrices used to generate the query vector, key vector, and value vector are different in each context encoding process. This can improve the machine reading comprehension system 1's understanding of text. When the encoding operation is performed on a combination of question text and article text, the matrix formed by encoding vectors b1-b4 is the original target text encoding. When the operation is performed on a combination of first knowledge text and second knowledge text, the matrix formed by encoding vectors b1-b4 is the knowledge text encoding.

[0054] Apart from Figures 4A to 4C The context encoding method shown can also be executed by the semantic encoder 13, such as the encoding methods of other context encoders, such as BERT, RoBERTa, XLNet, ALBERT, and ELMo which uses a long short-term memory (LSTM) model.

[0055] After the semantic encoder 13 performs the encoding operation to generate the original target text code and the knowledge text code, the encoder fusion unit 14 can perform a fusion operation on the original target text code and the knowledge text code to import some knowledge from the knowledge set into the original target text code to generate an enhanced target text code, that is... Figure 2 Step S5 is shown. Further, refer to... Figure 1 and Figures 5A to 5C ,in Figures 5A to 5C This is a schematic diagram illustrating the fusion operation in a machine reading comprehension method according to an embodiment of the present invention. Figure 5AIn this diagram, encoding vectors b1 to b4 represent the encoding vectors contained in the original target text encoding, while encoding vectors b1' to b4' represent the encoding vectors contained in the knowledge text encoding. The encoding fusion unit 14 can perform fusion operations on the encoding vectors b1 to b4 of the original target text encoding and the encoding vectors b1' to b4' of the knowledge text encoding to generate fusion vectors m1 to m4. The fusion operations performed to generate fusion vectors m1 to m4 can be performed in parallel or in a specific order. Figure 5B and Figure 5C The example illustrates performing a fusion operation on encoded vector b1 and encoded vectors b1' to b4' to obtain fused vector m1. Other encoded vectors b2 to b4 can also undergo the same operation with encoded vectors b1' to b4' to obtain fused vectors m2 to m4, therefore they are not illustrated separately. It should also be noted that... Figures 5A to 5C The number of encoding vectors is illustrated only as an example, and the number of encoding vectors contained in the original target text encoding does not actually need to be the same as the number of encoding vectors contained in the knowledge text encoding.

[0056] like Figure 5B As shown, the encoding fusion unit 14 can generate multiple query vectors bq1 to bq4 based on the encoding vectors b1 to b4 of the original target text encoding, and generate multiple key vectors bk1' to bk4' and multiple value vectors bv1' to bv4' based on the encoding vectors b1' to b4' of the knowledge text encoding. Furthermore, the mathematical expressions representing the query vectors bq1 to bq4, the key vectors bk1' to bk4', and the value vectors bv1' to bv4' can be expressed as follows:

[0057] bq i =W bq b i

[0058] bk i '=W bk b i '

[0059] bv i '=W bv b i '

[0060] Among them, W bq W bk and W bv The weight matrix is ​​randomly given, and its optimal value can be determined by analyzing the performance of the machine reading comprehension system 1 multiple times. The further optimization process will be described later.

[0061] Next, the encoder-fusion unit 14 performs inner product operations on the query vector bq1 with the key vectors bk1' to bk4' respectively to obtain multiple initial weights. ~ Alternatively, after performing the inner product operation, you can divide by the dimensions of the query vector bq1 and the key vectors bk1' to bk4' to obtain multiple initial weights. ~ This can be expressed mathematically as:

[0062]

[0063] Where d represents the dimensions of the query vector bq1 and the key vectors bk1' to bk4'. The above operation can be viewed as a similarity judgment between the encoding vector b1 of the original target text encoding and the encoding vectors b1' to b4' of the knowledge text encoding. In particular, the encoding fusion unit 14 can also use other functions with similarity judgment capabilities to perform the similarity judgment between the original target text encoding and the knowledge text encoding.

[0064] Encoder fusion unit 14 then adjusts the initial weights ~ Perform normalization operations to obtain multiple normalized weights. ~ The normalization operation can be performed using the Softmax function, and the normalized weights obtained by the Softmax function operation are... ~ The mathematical expression can be expressed as follows; however, the normalization operation of this invention can also be performed by other functions that sum the weights to 1, and is not limited to the following mathematical expression:

[0065]

[0066] Then as Figure 5C As shown, the encoder fusion unit 14 normalizes the weights. ~ By performing a weighted sum operation on the value vectors bv1' to bv4', we obtain a weighted sum vector c1, which can be expressed mathematically as follows:

[0067]

[0068] The encoding fusion unit 14 can further add the weighted sum vector c1 to the corresponding encoded vector b1, and use the sum as the fusion vector m1. Alternatively, the encoding fusion unit 14 can concatenate the weighted sum vector c1 with the corresponding encoded vector b1, and use the concatenation result as the fusion vector m1 (doubling the dimension; assuming the original weighted sum vector c1 and encoded vector b1 are each d-dimensional, the fusion vector m1 generated by concatenating them is 2d-dimensional). Fusion vectors m2 to m4 can also be generated by the encoding fusion unit 14 according to the above operations. The encoding fusion unit 14 can combine the fusion vectors m1 to m4 to form a matrix, and use this matrix as the enhanced target text encoding.

[0069] After the aforementioned encoding fusion unit 14 performs fusion operations to import knowledge into the target text encoding to generate enhanced target text encoding, the answer extractor 15 can obtain the answer to the corresponding question text based on the enhanced target text encoding and output this answer through the input / output interface 11. Figure 2 Steps S6 and S7 are shown. Further, the answer extractor 15 can extract the answer corresponding to the question text from the enhanced target text encoding. (See reference...) Figure 1 , Figure 6A and Figure 6B ,in Figure 6A and Figure 6B These are flowcharts illustrating the answer extraction process in a machine reading comprehension method according to two embodiments of the present invention.

[0070] like Figure 6A As shown, the answer extraction task performed by the answer extractor 15 may include the following steps: S61: performing matrix operations and normalization operations on the partial encoding corresponding to the article text in the enhanced target text encoding and the initial classification vector to obtain multiple initial probabilities; S62: performing matrix operations and normalization operations on the partial encoding and the ending classification vector to obtain multiple ending probabilities; S63: determining the starting position of the answer in the partial encoding based on the maximum value among the initial probabilities; and S64: determining the ending position of the answer in the partial encoding based on the maximum value among the ending probabilities.

[0071] In steps S61 and S62, the answer extractor 15 performs matrix operations (especially inner product operations) and normalization operations on the partial codes corresponding to the article text in the enhanced target text encoding with the initial classification vector and the final classification vector, respectively, to obtain multiple initial probabilities and multiple final probabilities. Further, the partial codes are vector matrices composed of fusion vectors corresponding to the initial vectors belonging to the article text from the multiple fusion vectors obtained by the encoding fusion unit 14. Even further, the question text and article text corresponding to each fusion vector have indicators (e.g., 0 / 1 masks) when the question text and article text are input to indicate whether their position belongs to the article or the question. The operation described in step S61 can be represented by the following mathematical formula:

[0072]

[0073] in, Let represent the i-th initial probability in the initial probability vector, where the initial probability vector contains multiple initial probabilities, and each initial probability represents the probability that the corresponding fusion vector in the partial encoding is the starting position of the answer. S represents the initial classification vector. This represents the i-th fusion vector in the partial encoding. Similarly, step S62 can be expressed by the above mathematical formula, where... Replace with Let S represent the i-th termination probability in the termination probability vector, which contains multiple termination probabilities, each representing the probability that the corresponding fusion vector in the partial encoding is the end position of the answer. S is replaced by E to represent the termination classification vector. The initial classification vector and the termination classification vector are randomly given vectors, and the optimal vector can be determined by analyzing the performance of the machine reading comprehension system 1 multiple times. Further optimization procedures will be described later.

[0074] In steps S63 and S64, the answer extractor 15 determines the fusion vector corresponding to the largest value in the initial probabilities as the starting position (i.e., the starting index) of the answer, and determines the fusion vector corresponding to the largest value in the ending probabilities as the ending position (i.e., the ending index) of the answer. For example, if the values ​​of the multiple initial probabilities in the initial probability vector are 0.02, 0.90, 0.05, 0.01, and 0.02 respectively, then the answer extractor 15 determines that the starting position of the answer corresponds to the second fusion vector corresponding to the article text in the target text encoding. The determination of the ending position of the answer is similar to the determination of the starting position, and will not be illustrated further here.

[0075] It should be noted that step S63 is executed after step S61, and step S64 is executed after step S62. However, the present invention does not limit the order of steps S61 and S62, steps S61 and S64, steps S62 and S63, or steps S63 and S64.

[0076] The answer extractor 15 can also perform the answer extraction task in another implementation. For example... Figure 6B As shown, the answer extraction task may include the following steps: Step S61': Perform matrix operations and normalization operations on the partial encoding corresponding to the article text in the enhanced target text encoding and the initial classification vector to obtain multiple initial probabilities; Step S62': Perform matrix operations and normalization operations on the partial encoding and the ending classification vector to obtain multiple ending probabilities; Step S63': Sort the initial probabilities from largest to smallest and select the top few as multiple candidate initial probabilities; Step S64': Sort the ending probabilities from largest to smallest and select the top few as multiple candidate ending probabilities; Step S65': Pair the candidate initial probabilities with the candidate ending probabilities to generate multiple candidate pairs, wherein the position corresponding to the candidate initial probability in each candidate pair precedes the position corresponding to the candidate ending probability; Step S66': Calculate the sum or product of the candidate initial probability and the candidate ending probability in each candidate pair; Step S67': Determine the starting and ending positions of the answer in the partial encoding based on the candidate initial probability and the candidate ending probability corresponding to the maximum sum or maximum product in the candidate pairs.

[0077] The further execution content of steps S61' and S62' is the same as that of... Figure 6A Steps S61 and S62 are not described in detail here. In steps S63' and S64', the answer extractor 15 first selects the top few starting probabilities as candidate starting probabilities and the top few ending probabilities as candidate ending probabilities, respectively. The number of selected candidate starting / ending probabilities is, for example, 5, but is not limited to this. In step S65', the answer extractor 15 can pair candidate starting probabilities with candidate ending probabilities in pairs and filter out pairs where the position corresponding to the candidate starting probability is after the position corresponding to the candidate ending probability, so as to generate multiple candidate pairs. In other words, the position corresponding to the candidate starting probability in each candidate pair will precede the position corresponding to the candidate ending probability. In steps S66' and S67', the answer extractor 15 adds or multiplies the value of the candidate starting probability and the value of the candidate ending probability in each candidate pair, and determines the fusion vector corresponding to the candidate starting probability in the candidate pair with the largest sum or product as the starting position of the answer, and then selects the fusion vector corresponding to the candidate ending probability in the subsequent pair as the ending position of the answer.

[0078] By Figure 6B The illustrated implementation of the answer extraction task allows the answer extractor 15 to avoid situations where the starting position is greater than the ending position (i.e., the starting position is after the ending position), thereby improving the accuracy of the answer. It should be noted that step S63' is executed after step S61' and step S64' is executed after step S62'. However, this invention does not limit the order of steps S61' and S62', nor does it limit the order of steps S61' and S64', nor does it limit the order of steps S62' and S63', nor does it limit the order of steps S63' and S64'.

[0079] Additionally, as mentioned earlier, the semantic encoder 13 uses parameters (e.g., the weight matrix W) for its encoding task. aq W ak and W av The parameters used in the fusion operation performed by the encoder-fusing unit 14 (weight matrix W) bq W bk and W bv The usage parameters (starting classification vector and ending classification vector) of the answer extraction job performed by the answer extractor 15 can be set to optimal usage parameters through the process of optimizing usage parameters. In particular, Figure 2 Steps S2 to S6 of the machine reading comprehension method shown can be the process of performing answer prediction on the machine reading comprehension system 1 that has been trained, or they can be a part of the training process of the machine reading comprehension system 1, wherein the training process includes a process of optimizing the use of parameters.

[0080] refer to Figure 1 , Figure 2 and Figure 7 , Figure 7 This is a flowchart illustrating the optimization of parameters in a machine reading comprehension method according to embodiments of the present invention. For example... Figure 7As shown, the process for optimizing the usage parameters may include step S8: performing a first encoding task, a second encoding task, a fusion operation, and an answer extraction task on multiple first training materials to generate multiple first training answers, and calculating a first loss value based on the multiple first training answers and a loss function; step S9: adjusting one or more of the multiple usage parameters of the first encoding task, the second encoding task, the fusion operation, and the answer extraction task based on the first loss value; step S10: after adjustment, performing the first encoding task, the second encoding task, the fusion operation, and the answer extraction task on multiple second training materials to generate multiple second training answers, and calculating a second loss value based on the multiple second training answers and a loss function; step S11: adjusting one or more of the multiple usage parameters of the first encoding task, the second encoding task, the fusion operation, and the answer extraction task based on the second loss value. Each first / second training material includes question text and article text. The first encoding task includes the step of encoding the question text and article text in the aforementioned embodiment to generate the original target text encoding. The second encoding task includes the step of generating a first knowledge text and a second knowledge text based on a knowledge set, and the step of encoding the first knowledge text and the second knowledge text to generate the knowledge text encoding. That is, Figure 7 Step S8 may include performing operations on each of the multiple first training data. Figure 2 Steps S2 to S6, Figure 7 Step S10 may include performing an action on each of the multiple second training data. Figure 2 Steps S2 to S6.

[0081] Steps S8 to S11 can be executed by a processing device located externally or internally to the machine reading comprehension system 1. This processing device includes a central processing unit (CPU), microcontroller, programmable logic controller (PLC), or other processor, connected to the semantic encoder 13, encoder fusion unit 14, and answer extractor 15. It can control these devices to operate on multiple first training data with current usage parameters to generate multiple first training answers, generate a first loss value based on the multiple first training answers and a loss function, adjust one or more of the multiple usage parameters of these devices based on the first loss value, control these devices to operate again on multiple second training data after parameter adjustment to generate multiple second training answers, calculate a second loss value based on the second training answers and a loss function, and then adjust one or more of the multiple usage parameters based on the second loss value. The loss function used to calculate the first / second loss value can be expressed as the following mathematical formula:

[0082]

[0083] in, Let the vector represent the starting position of the correct solution. This represents the initial probability vector calculated by the answer extractor 15. Let the vector represent the ending position of the correct solution. This represents the termination probability vector calculated by the answer extractor 15, and N represents the amount of training data used to generate the training answer.

[0084] After step S11, the processing device can execute step S10 again on multiple other training data to calculate the loss value, and then execute step S11 again using this loss value, repeating this process multiple times. In other words, the processing device can perform multiple training iterations, and the loss value calculated in each training iteration can be used as the basis for adjusting the usage parameters before the next training iteration. Furthermore, the processing device can use a batch of training data (first training data) and the current usage parameters to calculate the answer (first training answer), and calculate the loss value (first loss value) based on the answer. Then, it adjusts the usage parameters based on this loss value, and then uses another batch of training data (second training data) and the adjusted usage parameters to calculate the answer (second training answer) and the corresponding loss value (second loss value). This process is repeated, adjusting the usage parameters again, and then using another batch of training data and the adjusted usage parameters to calculate the answer and the corresponding loss value, and so on. For example, assuming the total number of training data is 2560, with 32 data points per batch, the above-mentioned adjustment of usage parameters and the calculation of the adjusted answer and loss value would require 80 iterations to complete one epoch. After one round of training, the processing device can shuffle all the training data before executing the next round of training. Specifically, the number of rounds to be executed is set as a parameter, and its value can be selected by retaining a portion of the training dataset as a validation set and evaluating the performance of this validation set (e.g., loss value, EM, or F1 score).

[0085] In theory, as the number of training iterations increases, the parameters used will better fit the training data. However, when the parameters are too closely fitted to the training data, the prediction accuracy for new data (the data to be predicted) may actually decrease. Therefore, as mentioned above, retaining a portion of the training dataset as a validation set and using it to make predictions to obtain corresponding prediction performance can determine the appropriate number of training epochs. For example, after one training epoch, the processing device can determine whether the performance of the validation set is better than the performance of the validation set in the previous training epoch (e.g., a lower loss value or a higher EM / F1 score). If the performance of the validation set in this epoch is better than that in the previous epoch, the next epoch of training continues; if it is worse or the change is not significant, training stops. The parameters used after the above training process can then be used as the optimal parameters.

[0086] The source of the question text and article text used for training can be a target labeled dataset, i.e., the dataset that the system expects to train to perform predictions, while the source of the knowledge set used to generate the knowledge text is a knowledge database corresponding to the target labeled dataset (e.g., of the same type). In another embodiment, before training with the target labeled dataset, the machine reading comprehension method can first train with an external labeled dataset and a corresponding (e.g., of the same type) knowledge database. That is, the external labeled dataset is used as the source of the question text and article text, and the knowledge database corresponding to the external labeled dataset is used as the source of the knowledge set, to initially determine the optimal usage parameters. For example, assuming the labeled dataset includes DRCD, CMRC 2018, and CAIL 2019, when the target dataset is DRCD, one or both of CMRC 2018 and CAIL 2019 can be used as the training dataset to initially determine the optimal usage parameters, and then DRCD can be used as the training dataset to determine the optimal usage parameters again. By using the above process of optimizing parameters multiple times, the problem of incomplete labeling of the target labeled data set leading to unsatisfactory training results can be avoided.

[0087] refer to Figure 8A and 8B , Figure 8A and 8B These are comparative graphs showing experimental data obtained from training on two different datasets: one for existing machine reading comprehension methods and systems (multi-BERT), and the other for the machine reading comprehension method and system described above in this invention. Figure 8A In the experiment, the machine reading comprehension method and system in this case, like existing machine reading comprehension methods and systems, used the CAIL 2019 dataset in the legal field as the training data source. Furthermore, the machine reading comprehension method and system in this case also used the OpenBase knowledge base (unstructured knowledge) and the HowNet knowledge base (structured knowledge) as knowledge set sources. Figure 8B In the experiment, the machine reading comprehension method and system in this case used the DRCD dataset in the encyclopedia field as the training data source, and the machine reading comprehension method and system in this case also used the HowNet knowledge base as the knowledge set source.

[0088] Figure 8A and Figure 8B The experimental data shown, EM (Exact Match), represents the percentage (%) of the predicted answer matching the standard answer, while F1 is the exact score calculated by wordizing the predicted and standard answers. Furthermore, F1 can be expressed mathematically as follows:

[0089]

[0090] Among them, precision indicates what percentage of words in the predicted answer appear in the standard answer, while recall indicates what percentage of words in the standard answer appear in the predicted answer.

[0091] like Figure 8A and Figure 8B As shown, the machine reading comprehension method and system in this case have higher EM and F1 scores compared to existing machine reading comprehension methods and systems, indicating higher accuracy in answer prediction. The machine reading comprehension method and system in this case demonstrate considerable performance with limited training data, meaning that in the early stages of system training, it can assist labelers in accelerating data labeling. Even with only 1k training data, it achieves an EM score that is 80% of the level of human judgment, thus replacing human work while maintaining considerable accuracy. Furthermore, the F1 score is also close to human level (F1 score: 92).

[0092] By means of the above architecture, the machine reading comprehension method and system disclosed in this invention can perform special encoding and fusion operations to import external knowledge in the process of analyzing questions and articles, thereby avoiding the problem that it is difficult to obtain the correct answer from the concise article content, and thus improving the accuracy of the predicted answer.

Claims

1. A machine reading comprehension method, comprising: Obtain the question text and the associated article text; Based on the knowledge set, a first knowledge text corresponding to the question text and a second knowledge text corresponding to the article text are generated; Encode the question text and the article text to generate the original target text encoding; Encode the first knowledge text and the second knowledge text to generate knowledge text encoding; A fusion operation is performed on the original target text encoding and the knowledge text encoding to import some knowledge from the knowledge set into the original target text encoding, thereby generating enhanced target text encoding. as well as Based on the enhanced target text encoding, the answer corresponding to the question text is obtained and the answer is output; The step of performing a fusion operation on the original target text encoding and the knowledge text encoding, and importing a portion of the knowledge from the knowledge set into the original target text encoding to generate enhanced target text encoding, includes: Based on the original target text encoding, multiple first query vectors are generated; Based on the knowledge text encoding, multiple first key vectors and multiple first value vectors are generated; For each of the first query vectors, execute: Perform inner product operations between the first query vector and the plurality of first key vectors respectively to obtain a plurality of first initial weights; Normalization operations are performed on the plurality of first initial weights respectively to obtain a plurality of first normalized weights; and Perform a weighted sum operation on the plurality of first normalized weights and the plurality of first value vectors to obtain a first weighted sum vector; and The enhanced target text encoding is generated based on the first weighted sum vector corresponding to each of the first query vectors.

2. The method according to claim 1, wherein, The process of generating a first knowledge text corresponding to the question text and a second knowledge text corresponding to the article text based on the knowledge set includes: Treat the question text and the article text as separate texts to be processed, and execute the following: The text to be processed is segmented into multiple words; Search the knowledge set based on the multiple words to obtain at least one related knowledge; When the quantity of the at least one piece of related knowledge is one, a target knowledge text is generated based on the related knowledge; and When the number of at least one related knowledge is greater than one, the related knowledge is combined to generate the target knowledge text according to the arrangement order of the multiple words and the preset template; The target knowledge text corresponding to the question text is the first knowledge text, and the target knowledge text corresponding to the article text is the second knowledge text.

3. The method according to claim 2, wherein, The process of generating a first knowledge text corresponding to the question text and a second knowledge text corresponding to the article text based on the knowledge set further includes: If the at least one related knowledge is structured knowledge, then before generating the target knowledge text, the form of the at least one related knowledge is converted into a textual description according to another preset template.

4. The method according to claim 1, wherein, The original target text encoding includes multiple encoding vectors, each corresponding to one of the multiple first query vectors, and the enhanced target text encoding is generated based on the first weighted sum vector corresponding to each first query vector, including: Add or concatenate the first weighted sum vector corresponding to each of the first query vectors with the corresponding encoded vector to obtain multiple fused vectors; and The enhanced target text encoding is generated by combining the multiple fusion vectors.

5. The method according to claim 1, wherein, The encoding of the question text and the article text includes: using the combination of the question text and the article text as the execution object of the encoding operation; the encoding of the first knowledge text and the second knowledge text includes: using the combination of the first knowledge text and the second knowledge text as the execution object of the encoding operation; and the encoding operation includes: The execution object is divided into multiple single words; Obtain the multiple initial vectors corresponding to the multiple single characters respectively; and The multiple initial vectors are combined to generate the original target text encoding or the knowledge text encoding.

6. The method according to claim 1, wherein, The encoding of the question text and the article text includes: using the combination of the question text and the article text as the execution object of the encoding operation; the encoding of the first knowledge text and the second knowledge text includes: using the combination of the first knowledge text and the second knowledge text as the execution object of the encoding operation; and the encoding operation includes: The execution object is divided into multiple single words; Obtain the multiple initial vectors corresponding to the multiple single characters respectively; Based on the multiple initial vectors, generate corresponding multiple second query vectors, multiple second key vectors, and multiple second value vectors; For each of the second query vectors, execute: The second query vector is subjected to the inner product operation with the plurality of second key vectors respectively to obtain a plurality of second initial weights; The normalization operation is performed on the plurality of second initial weights respectively to obtain a plurality of second normalized weights; and Perform the weighted sum operation on the plurality of second normalized weights and the plurality of second value vectors to obtain a second weighted sum vector; Based on the second weighted sum vector corresponding to each second query vector, multiple encoding vectors are generated; and The multiple encoding vectors are combined to generate the original target text encoding or the knowledge text encoding.

7. The method according to claim 1, wherein, The process of obtaining the answer corresponding to the question text based on the enhanced target text encoding includes: Perform matrix operations and normalization operations on the portion of the enhanced target text encoding corresponding to the article text and the initial classification vector to obtain multiple initial probabilities; Perform the matrix operation and normalization operation on the partial encoding and the ending classification vector to obtain multiple ending probabilities; Based on the maximum value among the plurality of initial probabilities, the starting position of the answer in the partial encoding is determined; and The ending position of the answer in the partial encoding is determined based on the maximum value among the multiple ending probabilities.

8. The method according to claim 1, wherein, The process of obtaining the answer corresponding to the question text based on the enhanced target text encoding includes: Perform matrix operations and normalization operations on the portion of the enhanced target text encoding corresponding to the article text and the initial classification vector to obtain multiple initial probabilities; Perform the matrix operation and normalization operation on the partial encoding and the ending classification vector to obtain multiple ending probabilities; Based on the numerical values ​​of the multiple initial probabilities, sort them from largest to smallest, and select the top few as multiple candidate initial probabilities; Based on the numerical values ​​of the multiple termination probabilities, sort them from largest to smallest, and select the top few as multiple candidate termination probabilities; The plurality of candidate start probabilities are paired with the plurality of candidate end probabilities to generate a plurality of candidate pairs, wherein the position corresponding to the candidate start probability in each candidate pair is earlier than the position corresponding to the candidate end probability; Calculate the sum or product of the candidate start probability and the candidate end probability in each candidate pair; and Based on the candidate start probability and the candidate end probability corresponding to the maximum sum or maximum product among the multiple candidate pairs, the start position and end position of the answer in the partial encoding are determined.

9. The method according to claim 1, further comprising: A first encoding task, a second encoding task, the fusion operation, and an answer extraction task are performed on multiple first training data to generate multiple first training answers, and a first loss value is calculated based on the multiple first training answers and the loss function; Based on the first loss value, adjustments are made to one or more of the usage parameters of the first encoding job, the second encoding job, the fusion operation, and the answer extraction job; After the adjustment, the first encoding task, the second encoding task, the fusion operation, and the answer extraction task are performed on multiple second training data to generate multiple second training answers, and a second loss value is calculated based on the multiple second training answers and the loss function; as well as Based on the second loss value, adjustments are performed on one or more of the plurality of usage parameters; wherein the first encoding job includes encoding the question text and the article text, the second encoding job includes generating and encoding the first knowledge text and the second knowledge text, and the answer extraction job includes obtaining the answer corresponding to the question text.

10. A machine reading comprehension system, comprising: The input / output interface is used to obtain the question text and the associated article text. A knowledge text generator, connected to the input / output interface, is used to obtain a first knowledge text corresponding to the question text and a second knowledge text corresponding to the article text based on a knowledge set. A semantic encoder, connected to the input / output interface and the knowledge text generator, is used to encode the question text and the article text to generate the original target text encoding, and to encode the first knowledge text and the second knowledge text to generate the knowledge text encoding; An encoding fusion unit, connected to the semantic encoder, is used to perform a fusion operation on the original target text encoding and the knowledge text encoding, and to import some knowledge from the knowledge set into the original target text encoding to generate enhanced target text encoding; An answer extractor, connected to the encoding fusion unit and the input / output interface, is used to obtain the answer corresponding to the question text based on the enhanced target text encoding, and output the answer through the input / output interface; The encoding fusion unit performs a fusion operation on the original target text encoding and the knowledge text encoding, importing a portion of the knowledge from the knowledge set into the original target text encoding to generate enhanced target text encoding, including: Based on the original target text encoding, multiple first query vectors are generated; Based on the knowledge text encoding, multiple first key vectors and multiple first value vectors are generated; For each of the first query vectors, execute: Perform inner product operations between the first query vector and the plurality of first key vectors respectively to obtain a plurality of first initial weights; Normalization operations are performed on the plurality of first initial weights respectively to obtain a plurality of first normalized weights; and Perform a weighted sum operation on the plurality of first normalized weights and the plurality of first value vectors to obtain a first weighted sum vector; and The enhanced target text encoding is generated based on the first weighted sum vector corresponding to each of the first query vectors.

11. The system according to claim 10, wherein, The knowledge text generator, based on a knowledge set, generates a first knowledge text corresponding to the question text and a second knowledge text corresponding to the article text, including: Treat the question text and the article text as separate texts to be processed, and execute the following: The text to be processed is segmented into multiple words; Search the knowledge set based on the multiple words to obtain at least one related knowledge; When the quantity of the at least one piece of related knowledge is one, a target knowledge text is generated based on the related knowledge; and When the number of at least one related knowledge is greater than one, the related knowledge is combined to generate the target knowledge text according to the arrangement order of the multiple words and the preset template; The target knowledge text corresponding to the question text is the first knowledge text, and the target knowledge text corresponding to the article text is the second knowledge text.

12. The system according to claim 11, wherein, The knowledge text generator, based on a knowledge set, generates a first knowledge text corresponding to the question text and a second knowledge text corresponding to the article text, further including: If the at least one related knowledge is structured knowledge, then before generating the target knowledge text, the form of the at least one related knowledge is converted into a textual description according to another preset template.

13. The system according to claim 10, wherein, The original target text encoding includes multiple encoding vectors, each corresponding to one of the multiple first query vectors, and the encoding fusion unit generates the enhanced target text encoding based on the first weighted sum vector corresponding to each first query vector, including: Add or concatenate the first weighted sum vector corresponding to each of the first query vectors with the corresponding encoded vector to obtain multiple fused vectors; and The enhanced target text encoding is generated by combining the multiple fusion vectors.

14. The system according to claim 10, wherein, The semantic encoder performs encoding on the question text and the article text by using the combination of the question text and the article text as the object of the encoding operation. The semantic encoder also performs encoding on the first knowledge text and the second knowledge text by using the combination of the first knowledge text and the second knowledge text as the object of the encoding operation. The encoding operation includes: The execution object is divided into multiple single words; Obtain the multiple initial vectors corresponding to the multiple single characters respectively; and The multiple initial vectors are combined to generate the original target text encoding or the knowledge text encoding.

15. The system according to claim 10, wherein, The semantic encoder performs encoding on the question text and the article text by using the combination of the question text and the article text as the object of the encoding operation; the semantic encoder performs encoding on the first knowledge text and the second knowledge text by using the combination of the first knowledge text and the second knowledge text as the object of the encoding operation, and the encoding operation includes: The execution object is divided into multiple single words; Obtain the multiple initial vectors corresponding to the multiple single characters respectively; Based on the multiple initial vectors, generate corresponding multiple second query vectors, multiple second key vectors, and multiple second value vectors; For each of the second query vectors, execute: The second query vector is subjected to the inner product operation with the plurality of second key vectors respectively to obtain a plurality of second initial weights; The normalization operation is performed on the plurality of second initial weights respectively to obtain a plurality of second normalized weights; and Perform the weighted sum operation on the plurality of second normalized weights and the plurality of second value vectors to obtain a second weighted sum vector; Based on the second weighted sum vector corresponding to each second query vector, multiple encoding vectors are generated; and The multiple encoding vectors are combined to generate the original target text encoding or the knowledge text encoding.

16. The system according to claim 10, wherein, The answer extractor performs the following operations based on the enhanced target text encoding to obtain the answer corresponding to the question text: Perform matrix operations and normalization operations on the portion of the enhanced target text encoding corresponding to the article text and the initial classification vector to obtain multiple initial probabilities; Perform the matrix operation and normalization operation on the partial encoding and the ending classification vector to obtain multiple ending probabilities; Based on the maximum value among the plurality of initial probabilities, the starting position of the answer in the partial encoding is determined; and The ending position of the answer in the partial encoding is determined based on the maximum value among the multiple ending probabilities.

17. The system according to claim 10, wherein, The answer extractor performs the following operations based on the enhanced target text encoding to obtain the answer corresponding to the question text: Perform matrix operations and normalization operations on the portion of the enhanced target text encoding corresponding to the article text and the initial classification vector to obtain multiple initial probabilities; Perform the matrix operation and normalization operation on the partial encoding and the ending classification vector to obtain multiple ending probabilities; Based on the numerical values ​​of the multiple initial probabilities, sort them from largest to smallest, and select the top few as multiple candidate initial probabilities; Based on the numerical values ​​of the multiple termination probabilities, sort them from largest to smallest, and select the top few as multiple candidate termination probabilities; The plurality of candidate start probabilities are paired with the plurality of candidate end probabilities to generate a plurality of candidate pairs, wherein the position corresponding to the candidate start probability in each candidate pair is earlier than the position corresponding to the candidate end probability; Calculate the sum or product of the candidate start probability and the candidate end probability in each candidate pair; and Based on the candidate start probability and the candidate end probability corresponding to the maximum sum or maximum product among the multiple candidate pairs, the start position and end position of the answer in the partial encoding are determined.

18. The system of claim 10, further comprising: A processing device, connected to the semantic encoder, the encoder fusion unit, and the answer extractor, is used to control the semantic encoder, the encoder fusion unit, and the answer extractor to perform operations on multiple first training data, generate multiple first training answers, and calculate a first loss value based on the multiple first training answers and a loss function; The processing device is further configured to adjust one or more of a plurality of usage parameters of the semantic encoder, the encoder fusion unit, and the answer extractor based on the first loss value; The processing device is further configured to, after the adjustment, control the semantic encoder, the encoder fusion unit, and the answer extractor to perform operations on a plurality of second training data, generate a plurality of second training answers, calculate a second loss value based on the plurality of second training answers and the loss function, and adjust one or more of the plurality of usage parameters based on the second loss value.

19. The system of claim 10, wherein the input / output interface is further configured to output at least a portion of the knowledge set.

Citation Information

Patent Citations

  • Machine reading understanding method, system and device based on external knowledge enhancement

    CN111078836A

  • Answer position obtaining method and device based on big data, equipment and medium

    CN111241244A