Question and answer method and device and computer readable storage medium

By analyzing the attributes of titles and question-and-answer pairs of original documents, selecting relevant question-and-answer pairs and generating answers, the problem of reduced answer quality caused by document diversity in the knowledge base is solved, and more accurate and centralized answers are achieved.

CN118627622APending Publication Date: 2024-09-10JIANGSU XCMG CONSTRUCTION MACHINERY RESEARCH INSTITUTE LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202410830964.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

When there are a large number of documents in the knowledge base, it is difficult for the intelligent question and answer system to provide accurate answers, resulting in a decline in the answer quality of the large language model and the inability to effectively integrate information.

Method used

By determining the title of the original document, setting the attributes of the question and answer pairs, and analyzing the document attributes, we select the question and answer pairs related to the user's questions, determine the target title in the target document, generate the answer, and use the similarity of vectors and core words to filter and generation, ultimately improving the focus and accuracy of answers.

Benefits of technology

It improves the quality of question answers, reduces the dispersion of answer sources, enhances the analysis and integration capabilities of large language models, and improves the accuracy of answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118627622A
    Figure CN118627622A
Patent Text Reader

Abstract

The invention relates to a question answering method and device and a computer readable storage medium, and relates to the field of artificial intelligence. The question and answer method comprises the steps of determining corresponding titles for paragraphs of a plurality of original documents; for the paragraph, determining a corresponding question and answer pair, a title attribute of the question and answer pair and a document attribute of the question and answer pair, the question and answer pair comprising a question and an answer, the title attribute of the question and answer pair comprising a title corresponding to the paragraph to which the question and answer pair belongs, and the document attribute of the question and answer pair comprising a document to which the question and answer pair belongs; selecting a question-answer pair related to the question of the user as a first target question-answer pair; according to the document attribute of the first target question and answer pair, selecting a target document from at least one original document to which the first target question and answer pair belongs; in the target document, determining a target title according to the title attribute of the first target question and answer pair; and according to the first target question and answer pair corresponding to the target title, generating an answer to the question of the user. According to the method and the device, the question answering quality is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a question-answering method and device, and a computer-readable storage medium. Background Art

[0002] With the rapid development of large language model technology, enterprises have a stronger demand for efficient and intelligent knowledge question-answering systems. For example, in the field of engineering technology, technicians often need to obtain detailed and accurate technical knowledge and information during the design and process development process, and intelligent knowledge question-answering systems can meet this demand.

[0003] At present, the mainstream intelligent knowledge question answering technology is Retrieval-Augmented Generation (RAG) based on semantic similarity recall. RAG technology assists the large language model in generating answers by retrieving information from the knowledge base, combining vector search technology and the prompt word function of the large language model. Summary of the invention

[0004] According to a first aspect of the present disclosure, a question-and-answer method is provided, comprising: determining corresponding titles for paragraphs of multiple original documents; for the paragraphs, determining corresponding question-and-answer pairs, title attributes of the question-and-answer pairs, and document attributes of the question-and-answer pairs, wherein the question-and-answer pair includes a question and an answer, the title attribute of the question-and-answer pair includes a title corresponding to the paragraph to which the question-and-answer pair belongs, and the document attribute of the question-and-answer pair includes a document to which the question-and-answer pair belongs; selecting a question-and-answer pair related to a user's question as a first target question-and-answer pair; selecting a target document from at least one original document to which the first target question-and-answer pair belongs according to the document attribute of the first target question-and-answer pair; in the target document, determining a target title according to the title attribute of the first target question-and-answer pair; and generating an answer to the user's question according to the first target question-and-answer pair corresponding to the target title.

[0005] In some embodiments, based on the document attributes of the first target question and answer pair, a target document is selected from at least one original document to which the first target question and answer pair belongs, including: for each original document in the at least one original document, counting the number of first target question and answer pairs corresponding to each original document; and taking the M original documents with the largest number of corresponding first target question and answer pairs as M target documents, where M is a positive integer.

[0006] In some embodiments, in the target document, the target title is determined based on the title attribute of the first target question and answer pair, including: for each title in the target document corresponding to the first target question and answer pair, counting the number of first target question and answer pairs corresponding to each title; selecting the top N titles with the largest number of corresponding first target question and answer pairs as N target titles, where N is a positive integer.

[0007] In some embodiments, selecting a question-answer pair related to the user's question as the first target question-answer pair includes: using a first artificial intelligence model to determine the core words of the user's question; and selecting a question-answer pair including the core words as the first target question-answer pair.

[0008] In some embodiments, based on a first target question-answer pair corresponding to a target title, an answer to the user's question is generated, including: based on a vector of the user's question and at least one of the vectors of the core words and the vector of the first target question-answer pair, a second target question-answer pair is selected from the first target question-answer pair corresponding to the target title; based on the second target question-answer pair, an answer to the user's question is generated.

[0009] In some embodiments, based on the vector of the user's question and at least one of the vectors of the core words and the vector of the first target question and answer pair, a second target question and answer pair is selected from the first target question and answer pair corresponding to the target title, including: based on the average value of the vector of the user's question and the vector of the core words and the vector of the first target question and answer pair, a second target question and answer pair is selected from the first target question and answer pair corresponding to the target title.

[0010] In some embodiments, an answer to the user's question is generated based on a first target question-answer pair corresponding to the target title, including: generating a prompt word based on the first target question-answer pair corresponding to the target title; and generating an answer to the user's question based on the prompt word using a second artificial intelligence model.

[0011] In some embodiments, the question-and-answer method also includes: before determining corresponding titles for paragraphs of multiple original documents, for each of the multiple original documents, dividing each original document into multiple paragraphs according to at least one of natural paragraph divisions, chapter divisions, and a word count threshold for each paragraph in each original document.

[0012] According to a second aspect of the present disclosure, a question-and-answer device is provided, comprising: a title determination module, configured to determine corresponding titles for paragraphs of multiple original documents; a question-and-answer pair determination module, configured to determine corresponding question-and-answer pairs, title attributes of the question-and-answer pairs, and document attributes of the question-and-answer pairs for the paragraphs, wherein the question-and-answer pair includes a question and an answer, the title attribute of the question-and-answer pair includes a title corresponding to the paragraph to which the question-and-answer pair belongs, and the document attribute of the question-and-answer pair includes a document to which the question-and-answer pair belongs; a question-and-answer pair selection module, configured to select a question-and-answer pair related to a user's question as a first target question-and-answer pair; a document selection module, configured to select a target document from at least one original document to which the first target question-and-answer pair belongs, based on the document attributes of the first target question-and-answer pair; a target title determination module, configured to determine a target title in the target document based on the title attribute of the first target question-and-answer pair; and a generation module, configured to generate an answer to the user's question based on the first target question-and-answer pair corresponding to the target title.

[0013] According to a third aspect of the present disclosure, a question-and-answer device is provided, comprising: a memory; and a processor coupled to the memory, wherein the processor is configured to execute the question-and-answer method according to any of the embodiments of the present disclosure based on instructions stored in the memory.

[0014] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the instructions are executed by a processor, the question-and-answer method described in any embodiment of the present disclosure is implemented.

[0015] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising computer program instructions, which, when executed by a processor, implement the question-and-answer method according to any of the embodiments of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0017] The present disclosure may be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:

[0018] Figure 1 A flowchart showing a question-answering method according to some embodiments of the present disclosure is shown;

[0019] Figure 2 A schematic diagram showing calculation of average values ​​according to some embodiments of the present disclosure;

[0020] Figure 3 A schematic diagram showing a question-answering process according to some embodiments of the present disclosure;

[0021] Figure 4 A block diagram of a question-answering device according to some embodiments of the present disclosure is shown;

[0022] Figure 5 A block diagram showing a question-answering device according to some other embodiments of the present disclosure;

[0023] Figure 6 A block diagram showing a computer system for implementing some embodiments of the present disclosure; DETAILED DESCRIPTION

[0024] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present disclosure unless otherwise specifically stated.

[0025] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

[0026] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.

[0027] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.

[0028] In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.

[0029] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0030] When there is less data in the knowledge base (for example, only one article is strongly related to the question), RAG technology can provide better corpus for the question-answering model, and the accuracy of the answer output by the question-answering model is also higher. However, if there are more document contents in the knowledge base, the question-answering model tends to look for semantically similar fragments in many files, which is prone to multi-faceted extraction problems. The corpus provided in the end may come from many documents, and the sources of reference content are very scattered, resulting in unsatisfactory answers from the large language model.

[0031] For example, establish a knowledge base for welding quality management system and submit related standard documents to the knowledge base at one time, and the resulting dialogue is as follows.

[0032] User's question: "Storage conditions of welding wire"

[0033] The answer given by the model: "According to the regulations of XXX, the storage conditions of welding wire are as follows:

[0034] 1. The welding rod is a welding rod for manual metal arc welding of non-alloy steel and fine grain steel with a minimum tensile strength not greater than XXX;

[0035] 2. Each batch of welding materials should provide a material certificate. The company should not handle the warehousing procedures for welding materials that cannot provide valid material certificates;

[0036] 3. If the welding production process adopts subcontracting services, the material certificate of the welding materials used in the welding production should be carried when the welded structural parts are supplied;

[0037] 4. The storage and use of welding wire should comply with the provisions of XXX.

[0038] However, regarding the specific storage conditions of the welding wire, I need you to provide more detailed information, such as the type and specification of the welding wire, so that I can provide you with a more accurate answer. "

[0039] Each of the above answer results comes from a different document, which causes the large language model to almost lose its analysis and integration capabilities. The output answer quality is very poor, making it difficult to accurately answer the user's questions.

[0040] The present disclosure provides a question-answering method and device, and a computer-readable storage medium, which can improve the quality of answers to questions.

[0041] Figure 1 A flowchart of a question-answering method according to some embodiments of the present disclosure is shown.

[0042] like Figure 1 As shown, the question-answering method includes steps S1 to S6. In some embodiments, the question-answering method is performed by a question-answering device.

[0043] In step S1, corresponding titles are determined for paragraphs of a plurality of original documents.

[0044] The titles of each level of a document are important elements for dividing the document structure. They are used to help readers quickly grasp the hierarchy and main content of the article. For example, there are first-level titles, second-level titles, and third-level titles in a document. The title of a certain level of a paragraph is used as the title of the paragraph.

[0045] The specific level of title to be selected can be selected by those skilled in the art according to actual needs, and the embodiments of the present disclosure do not limit this.

[0046] In some embodiments, before determining corresponding titles for paragraphs of multiple original documents, for each of the multiple original documents, each original document is divided into multiple paragraphs based on at least one of natural paragraph divisions, chapter divisions, and a word count threshold for each paragraph in each original document.

[0047] For example, the "paragraph" here may not be a natural paragraph, but a text block obtained by further dividing a natural paragraph. Users can upload local files on demand, without restrictions on format and quantity. The system processes various types of documents and organizes them into texts through unstructured loading. In the document segmentation stage, a multi-level segmentation method is adopted to segment the text in order according to the first-level chapter title, second-level chapter title, multiple natural paragraphs, single natural paragraph, etc., and the original text is divided into blocks, thereby retaining the characteristics of the corpus from small to large. You can also preset the length of each block to not exceed 100 words for segmentation. The paragraphs obtained after segmentation are text blocks.

[0048] The following example illustrates how to segment paragraphs.

[0049] For example, the name of the local document uploaded by the user is "Performance Requirements for Solid Welding Wires of Carbon Steel and Low Alloy Steel for Engineering Machinery". A paragraph of original text is taken as an example to illustrate the method of paragraph segmentation.

[0050] “4.4 Mechanical properties test

[0051] Mechanical properties tests include tensile test, shear test, impact test and hardness test, among which tensile test and impact test……

[0052] 4.4.1 Deposited metal tensile test

[0053] 4.4.1.1 Test panel preparation

[0054] 4.4.1.1.1 The parent material for the test of mechanical properties of weld deposited metal shall be a steel plate with chemical composition or mechanical properties equivalent to that of weld deposited metal. If other parent materials are used, the test welding wire or other equivalent welding wire shall be used to weld the isolation layer on the groove surface and the backing plate surface. The thickness of the processed isolation layer shall not be less than 3 mm.

[0055] 4.4.1.1.2 The test plate for mechanical properties of deposited metal shall be prepared in accordance with the requirements of GB / T 25774.1, the test piece type shall be 1.3, and the width of the test plate shall not be less than 125 mm. When welding, use φ1.2 mm or φ1.6 mm welding wire and perform welding according to the parameters specified in Table 7. When using welding wires of other sizes, it is advisable to perform welding according to the parameters recommended by the welding wire manufacturer.

[0056] 4.4.1.1.3 When the welding process involves preheating, the test plate shall reach the specified preheating temperature before starting welding and maintain the interpass temperature during welding. The measurement of the test plate temperature shall comply with the requirements of GB / T 18591.

[0057] 4.4.1.1.4 When the welding process involves post-weld heat treatment, the post-weld heat treatment process regulations shall be formulated and implemented according to the agreement between the supplier and the buyer.

[0058] In the above text, the first-level title is "Test method", the second-level title is "Mechanical properties test", the third-level title is "Deposited metal tensile test", and the fourth-level title is "Test plate preparation aspects".

[0059] First, separate the texts belonging to different first-level headings, then separate the texts belonging to different second-level headings... and so on, and finally get the content under the fourth-level heading "Test board preparation".

[0060] If no threshold is set for each block, the contents under the fourth-level heading "Test panel preparation aspects", that is, subsections 4.4.1.1.1-4.4.1.1.4, are considered as a block as a whole.

[0061] Based on the contents of Sections 4.4.1.1.1-4.4.1.1.4, LLM summarizes the question "What should be considered in the plate preparation and process formulation for the mechanical properties test of weld metal deposits?" As the question and answer pair of this block, the original text of Sections 4.4.1.1.1-4.4.1.1.4 can be directly used as the answer to this question. That is, the question and answer pair is as follows.

[0062] Question: "What should be considered in the plate preparation and process development for the mechanical properties test of weld deposited metal?"

[0063] Answer: "4.4.1.1.1 The base material for the test of mechanical properties of weld metal should be a steel plate with the same chemical composition or mechanical properties as the weld metal. If other base materials are used, the test wire or other equivalent welding wire should be used to weld the isolation layer on the groove surface and the backing plate surface. The thickness of the isolation layer after processing should not be less than 3 mm. 4.4.1.1.2 The test plate for mechanical properties of weld metal should be prepared according to the requirements of GB / T 25774.1. The test piece type is 1.3 and the width of the test plate is not less than 125 mm. When welding, use φ1.2 mm or φ1.6 mm welding wire and weld according to the parameters specified in Table 7. When using welding wires of other sizes, it is advisable to weld according to the parameters recommended by the welding wire manufacturer. 4.4.1.1.3 When the welding process involves preheating, the test plate shall reach the specified preheating temperature before welding begins, and the interpass temperature shall be maintained during welding. The measurement of the test plate temperature shall comply with the requirements of GB / T18591. 4.4.1.1.4 When the welding process involves post-weld heat treatment, the post-weld heat treatment process regulations shall be formulated and implemented according to the agreement between the supply and demand parties.

[0064] If a threshold is set for each block, for example, each block can only be 100 words at most, then sections 4.4.1.1.1-4.4.1.1.4 will be divided into two blocks, resulting in question 1 and corresponding answer 1, and question 2 and corresponding answer 2.

[0065] Question 1: What should be considered in the preparation of plates for the mechanical properties test of weld deposited metal?

[0066] Answer 1: 4.4.1.1.1 The base material for the mechanical property test of weld metal should be a steel plate with the same chemical composition or mechanical properties as the weld metal. If other base materials are used, the test wire or other equivalent welding wire should be used to weld the isolation layer on the groove surface and the backing plate surface. The thickness of the isolation layer after processing should not be less than 3 mm. 4.4.1.1.2 The mechanical property test plate of the weld metal should be prepared according to the requirements of GB / T 25774.1. The test piece type is 1.3 and the width of the test plate is not less than 125 mm. When welding, use φ1.2 mm or φ1.6 mm welding wire and weld according to the parameters specified in Table 7. When using welding wires of other sizes, it is advisable to weld according to the parameters recommended by the welding wire manufacturer.

[0067] Question 2: What should be considered when formulating the test process for the mechanical properties of welding wire deposited metal?

[0068] Answer 2: 4.4.1.1.3 When the welding process involves preheating, the test plate shall reach the specified preheating temperature before welding begins, and the interpass temperature shall be maintained during welding. The measurement of the test plate temperature shall comply with the requirements of GB / T 18591. 4.4.1.1.4 When the welding process involves post-weld heat treatment, the post-weld heat treatment process regulations shall be formulated and implemented according to the agreement between the supply and demand parties.

[0069] In step S2, for a paragraph, the corresponding question-answer pair, the title attribute of the question-answer pair, and the document attribute of the question-answer pair are determined, wherein the question-answer pair includes a question and an answer, the title attribute of the question-answer pair includes the title corresponding to the paragraph to which the question-answer pair belongs, and the document attribute of the question-answer pair includes the document to which the question-answer pair belongs.

[0070] For example, summarize the content of each paragraph (text block) to form a question-answer pair. The corresponding question-answer pair can be determined for the paragraph through a large language model. The document that generates the question-answer pair is added as the document attribute of the question-answer pair, and the title of the paragraph that generates the question-answer pair is added as the title attribute of the question-answer pair. Each question-answer pair corresponds to a title attribute and a document attribute. Different question-answer pairs can correspond to the same title attribute and / or the same document attribute.

[0071] In some embodiments, the question of the question-answer pair includes the title of the paragraph to which the question-answer pair belongs.

[0072] In step S3, a question-answer pair related to the user's question is selected as the first target question-answer pair.

[0073] In some embodiments, selecting a question-answer pair related to the user's question as a first target question-answer pair includes: using a first artificial intelligence model to determine the core words of the user's question; and selecting a question-answer pair including the core words as the first target question-answer pair.

[0074] For example, the core words include the first core word and the second core word. The first core word and the second core word are the central word and the keyword of the question respectively. The central word focuses on semantics and can be the original word in the user's question or a summarized word. The keyword is a word directly extracted from the original text based on the sentence structure. Two trained large language models can be used to analyze the central word and the keyword of the user's question respectively.

[0075] Through the search, the question-answer pair containing the core word can be found as the first target question-answer pair. For the keywords and central words initially obtained by the first artificial intelligence model, more keywords and central words can be expanded through the similar word expansion method to match the first target question-answer pair.

[0076] In step S4, according to the document attribute of the first target question-answer pair, a target document is selected from at least one original document from which the first target question-answer pair comes, wherein the target document is a document related to the user's question.

[0077] In some embodiments, based on the document attributes of the first target question and answer pair, a target document is selected from at least one original document to which the first target question and answer pair belongs, including: for each original document in the at least one original document, counting the number of first target question and answer pairs corresponding to each original document; and taking the M original documents with the largest number of corresponding first target question and answer pairs as M target documents, where M is a positive integer.

[0078] For example, M is set to 2. If there are 10 first question-answer pairs, 5 of which are from original document A, 3 are from original document B, and 2 are from original document C, then original document A and original document B are used as target documents. The value of M is, for example, less than or equal to 2.

[0079] In step S5, in the target document, the target title is determined according to the title attribute of the first target question-answer pair. For example, the target document has been selected in the previous step, and the target title is selected from the titles of the target document corresponding to the first target question-answer pair. The target title is a title related to the user's question.

[0080] In some embodiments, in the target document, according to the title attribute of the first target question-answer pair, determining the target title includes: for each title corresponding to the first target question-answer pair in the target document, counting the number of first target question-answer pairs corresponding to each title; selecting the top N titles with the largest number of corresponding first target question-answer pairs as N target titles, where N is a positive integer. For example, the value of N is less than or equal to 5.

[0081] For example, set N to 2. If there are 10 first question-answer pairs, of which 4 first question-answer pairs come from several different or the same paragraphs, but these paragraphs are all under the same "Title a" of the original document A, that is, the title attributes of the 4 first question-answer pairs are all "Title a", and the document attributes are all "Document A", and the title attributes of the other 4 first question-answer pairs are all "Title b", and the document attributes are all "Document B", then the 4 first question-answer pairs of "Title a" and the 4 first question-answer pairs of "Title b" are selected as the first target question-answer pairs.

[0082] In step S6, an answer to the user's question is generated based on the first target question-answer pair corresponding to the target title. The first target question-answer pair corresponding to the target title finally obtained is concentrated on the target title from the key target document, while other documents and titles that are not very relevant to the user's question have been filtered out through the above steps. Therefore, the first target question-answer pair used to generate the answer has a stronger focus and is more relevant to the user's question.

[0083] In some embodiments, an answer to a user's question is generated based on a first target question-answer pair corresponding to a target title, including: selecting a second target question-answer pair from the first target question-answer pair corresponding to the target title based on a vector of the user's question and at least one of the vectors of the core word and the vector of the first target question-answer pair; and generating an answer to the user's question based on the second target question-answer pair.

[0084] For example, the user question and core words are vectorized, and the average value of the word vectors of the user question and core words is calculated, which is used for comparison with the vector of the first question-answer pair, and K words with high similarity are selected as the second target question-answer pair; or, the word vector of the question is directly compared with the vector of the first question-answer pair, and K words with high similarity are selected as the second target question-answer pair. Then, the second target question-answer pair is used to generate an answer to the user's question.

[0085] When selecting the first target question-answer pair, the text direct matching method is used to directly select the first question-answer pair including the core word. Then, by comparing the vector similarity, the first target question-answer pair is screened again to select the question-answer pair that is semantically close to the user's question, thereby improving the accuracy of the generated answer.

[0086] At the same time, compared with the method of converting paragraphs (text blocks) into vectors and storing them in a vector library, the above-mentioned method of searching in a text knowledge base (a knowledge base composed of the text of question and answer pairs) first selects a batch of first target question and answer pairs, reduces the amount of calculation of subsequent vector similarities, and improves the question and answer efficiency.

[0087] In some embodiments, based on the vector of the user's question and at least one of the vectors of the core words and the vector of the first target question and answer pair, a second target question and answer pair is selected from the first target question and answer pair corresponding to the target title, including: based on the average value of the vector of the user's question and the vector of the core words and the vector of the first target question and answer pair, a second target question and answer pair is selected from the first target question and answer pair corresponding to the target title.

[0088] Figure 2 A schematic diagram showing calculation of average values ​​according to some embodiments of the present disclosure.

[0089] like Figure 2As shown in the figure, the vectors of user questions alone may affect accuracy due to the diversity and ambiguity of the expressions, while core words can often point out the key points of the problem concisely and clearly. By calculating the average of the vectors of the question itself and the vectors of the core words, the overall semantics and the central semantics can be integrated, the essence of the problem can be grasped in different expressions, and the adaptability of the model to changes in the expression of user questions can be improved.

[0090] In some embodiments, an answer to a user's question is generated based on a first target question-answer pair corresponding to the target title, including: generating a prompt word based on the first target question-answer pair corresponding to the target title; and generating an answer to the user's question based on the prompt word using a second artificial intelligence model.

[0091] For example, according to the first target question-answer pairs selected, the prompt word template is filled in to obtain the prompt word; the prompt word is used to obtain the answer to the user's question output by the second artificial intelligence model. Alternatively, according to the first target question-answer pairs selected and the paragraphs to which they belong, the prompt word template is filled in to obtain the prompt word, that is, the reference material; the second artificial intelligence model reads, analyzes, and refers to the reference material, and finally organizes it to form an answer to the user's question.

[0092] Figure 3 A schematic diagram showing a question-answering process according to some embodiments of the present disclosure.

[0093] like Figure 3 As shown, users upload local files with no restrictions on format and quantity. The system processes various types of documents and organizes them into texts through unstructured loading. In the document segmentation stage, a multi-level segmentation method is used for processing, that is, large blocks of text are segmented according to single natural paragraphs, multiple natural paragraphs, secondary chapter titles, primary chapter titles, word count thresholds, etc. Then, the source information of the document segment, including the document name and the name of the title to which it belongs, is added to the attributes of the segment. After that, the Large Language Model (LLM) summarizes the content of each segment to obtain question-answer pairs, and the attributes of the question-answer pairs are the same as the attributes of the segment to which they belong. If the segment has a title attribute, the question statement of the question-answer pair must include the title. All question-answer pairs and their attributes are summarized into a question-answer pair text knowledge base and kept for future use.

[0094] After the user asks a question to the system, the large language model analyzes the central word and keywords of the user's question respectively, and retrieves the first X question-answer pairs including the central word and / or keywords in the question-answer pair text knowledge base, where X is a positive integer.

[0095] Analyze the sources of the X first question-answer pairs, and count the top m documents of the sources of the first question-answer pairs, where m is, for example, not greater than 2. In the m documents, count the top n titles of the sources of the first question-answer pairs, where n is, for example, not greater than 5.

[0096] The question vector is compared with the vectors of the first question-answer pairs of the top n titles, or compared with the vectors of the second question-answer pairs after averaging the question vector and the center word vector. By comparison, the top k second question-answer pairs with high similarity are obtained.

[0097] Based on the k second question-answer pairs, prompt words are generated and submitted to the LLM to obtain answers to the user's questions.

[0098] According to some embodiments of the present disclosure, the question-and-answer method includes: determining corresponding titles for paragraphs of multiple original documents; for paragraphs, determining corresponding question-and-answer pairs, title attributes of the question-and-answer pairs, and document attributes of the question-and-answer pairs, wherein the question-and-answer pairs include questions and answers, the title attributes of the question-and-answer pairs include titles corresponding to the paragraphs to which the question-and-answer pairs belong, and the document attributes of the question-and-answer pairs include documents to which the question-and-answer pairs belong; selecting a question-and-answer pair related to a user's question as a first target question-and-answer pair; selecting a target document from at least one original document to which the first target question-and-answer pair belongs based on the document attributes of the first target question-and-answer pair; in the target document, determining a target title based on the title attributes of the first target question-and-answer pair; and generating an answer to the user's question based on the first target question-and-answer pair corresponding to the target title.

[0099] Through the above-mentioned question-and-answer method, the target title of the target document is screened out, and the answer to the user's question is generated according to the first target question-and-answer pair corresponding to the target title, so that the first target question-and-answer pair finally used to generate the answer is more concentrated on the highly relevant titles from one or several target documents, and the titles with weak relevance are filtered out, thereby improving the quality of the generated answer.

[0100] Figure 4 A block diagram of a question-answering device according to some embodiments of the present disclosure is shown.

[0101] like Figure 4 As shown, the question-answering device 2 includes a title determination module 41 , a question-answer pair determination module 42 , a question-answer pair selection module 43 , a document selection module 44 , a target title determination module 45 , and a generation module 46 .

[0102] The title determination module 41 is configured to determine corresponding titles for paragraphs of multiple original documents, for example, by performing the following steps: Figure 1 Step S1 is shown.

[0103] The question-answer pair determination module 42 is configured to determine, for a paragraph, a corresponding question-answer pair, a title attribute of the question-answer pair, and a document attribute of the question-answer pair, wherein the question-answer pair includes a question and an answer, the title attribute of the question-answer pair includes a title corresponding to the paragraph to which the question-answer pair belongs, and the document attribute of the question-answer pair includes a document to which the question-answer pair belongs, for example, by performing the following steps: Figure 1 Step S2 is shown.

[0104] The question-answer pair selection module 43 is configured to select a question-answer pair related to the user's question as the first target question-answer pair, for example, Figure 1 Step S3 shown.

[0105] The document selection module 44 is configured to select a target document from at least one original document to which the first target question-answer pair belongs according to the document attribute of the first target question-answer pair, for example, by performing the following steps: Figure 1 Step S4 is shown.

[0106] The target title determination module 45 is configured to determine the target title in the target document according to the title attribute of the first target question-answer pair, for example, by performing the following steps: Figure 1 Step S5 is shown.

[0107] The generating module 46 is configured to generate an answer to the user's question according to the first target question-answer pair corresponding to the target title, for example, Figure 1 Step S6 is shown.

[0108] In some embodiments, the document selection module 44 is further configured to: for each original document of at least one original document, count the number of first target question-answer pairs corresponding to each original document; and take the M original documents with the largest number of corresponding first target question-answer pairs as M target documents, where M is a positive integer.

[0109] In some embodiments, the target title determination module 45 is further configured to: for each title in the target document corresponding to the first target question and answer pair, count the number of first target question and answer pairs corresponding to each title; select the top N titles with the largest number of corresponding first target question and answer pairs as N target titles, where N is a positive integer.

[0110] In some embodiments, the question-answer pair determination module 42 is further configured to: determine the core words of the user's question using the first artificial intelligence model; and select the question-answer pair including the core words as the first target question-answer pair.

[0111] In some embodiments, the generation module 46 is further configured to: generate an answer to the user's question based on the first target question-answer pair corresponding to the target title, including: selecting a second target question-answer pair from the first target question-answer pair corresponding to the target title based on the vector of the user's question and at least one of the vectors of the core word and the vector of the first target question-answer pair; and generate an answer to the user's question based on the second target question-answer pair.

[0112] In some embodiments, the generation module 46 is further configured to: select a second target question-answer pair from the first target question-answer pair corresponding to the target title based on the vector of the user's question and at least one of the vectors of the core words and the vector of the first target question-answer pair, including: select a second target question-answer pair from the first target question-answer pair corresponding to the target title based on the average value of the vector of the user's question and the vector of the core words and the vector of the first target question-answer pair.

[0113] In some embodiments, the generation module 46 is further configured to: generate a prompt word based on a first target question-answer pair corresponding to the target title; and generate an answer to the user's question using a second artificial intelligence model based on the prompt word.

[0114] In some embodiments, the question-and-answer device 4 also includes a paragraph segmentation module, which is configured to: before determining the corresponding titles for paragraphs of multiple original documents, for each original document of the multiple original documents, divide each original document into multiple paragraphs according to at least one of the division of natural paragraphs, the division of chapters, and the word count threshold of each paragraph in each original document.

[0115] Figure 5 A block diagram of a question-and-answer device according to some other embodiments of the present disclosure is shown.

[0116] like Figure 5 As shown, the question-answering device 5 includes a memory 51 and a processor 52 coupled to the memory 51, wherein the memory 51 is used to store and execute the question-answering method. The processor 52 is configured to execute the question-answering method in any of the embodiments of the present disclosure based on the instructions stored in the memory 51.

[0117] Figure 6 A block diagram of a computer system for implementing some embodiments of the present disclosure is shown.

[0118] like Figure 6 As shown, the computer system 60 may be embodied in the form of a general purpose computing device. The computer system 60 includes a memory 610, a processor 620, and a bus 600 that connects the various system components.

[0119] The memory 610 may include, for example, a system memory, a non-volatile storage medium, etc. The system memory may store, for example, an operating system, an application program, a boot loader, and other programs. The system memory may include a volatile storage medium, such as a random access memory (RAM) and / or a cache memory. The non-volatile storage medium may store, for example, instructions for executing the question-and-answer method in any of the embodiments of the present disclosure. The non-volatile storage medium includes, but is not limited to, a disk memory, an optical memory, a flash memory, etc.

[0120] The processor 620 may be implemented by a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistors, and other discrete hardware components. Accordingly, each module such as the judgment module and the determination module may be implemented by a central processing unit (CPU) running instructions in a memory that execute corresponding steps, or may be implemented by a dedicated circuit that executes corresponding steps.

[0121] The bus 600 may use any of a variety of bus architectures, including, but not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MCA) bus, and a Peripheral Component Interconnect (PCI) bus.

[0122] The computer system 60 may also include an input / output interface 630, a network interface 640, a storage interface 650, etc. These interfaces 630, 640, 650, the memory 610, and the processor 620 may be connected via a bus 600. The input / output interface 630 may provide a connection interface for input / output devices such as a display, a mouse, and a keyboard. The network interface 640 may provide a connection interface for various networked devices. The storage interface 650 may provide a connection interface for external storage devices such as a floppy disk, a USB flash drive, and an SD card.

[0123] Here, various aspects of the present disclosure are described with reference to flowcharts and / or block diagrams of methods, devices, and computer program products according to embodiments of the present disclosure. It should be understood that each frame of the flowchart and / or block diagram and the combination of frames can be implemented by computer-readable program instructions.

[0124] These computer-readable program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable device to produce a machine, so that the processor executes the instructions to produce means for implementing the functions specified in one or more blocks in the flowchart and / or block diagram.

[0125] These computer-readable program instructions can also be readable and stored in a computer-readable memory, which cause the computer to work in a specific manner to produce a product, including instructions for implementing the functions specified in one or more blocks in the flowchart and / or block diagram.

[0126] The present disclosure can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects.

[0127] The question-answering method and device, and computer-readable storage medium in the above-mentioned embodiments improve the quality of answering questions.

[0128] So far, the question-answering method and device, and the computer-readable storage medium according to the present disclosure have been described in detail. In order to avoid obscuring the concept of the present disclosure, some details known in the art are not described. Based on the above description, those skilled in the art can fully understand how to implement the technical solution disclosed here.

Claims

1. A question-answering method, comprising: For paragraphs of multiple original documents, determine corresponding titles; For the paragraph, determining a corresponding question-answer pair, a title attribute of the question-answer pair, and a document attribute of the question-answer pair, wherein the question-answer pair includes a question and an answer, the title attribute of the question-answer pair includes a title corresponding to the paragraph to which the question-answer pair belongs, and the document attribute of the question-answer pair includes a document to which the question-answer pair belongs; Select a question-answer pair related to the user's question as the first target question-answer pair; Selecting a target document from at least one original document to which the first target question-answer pair belongs according to a document attribute of the first target question-answer pair; In the target document, determining a target title according to a title attribute of the first target question-answer pair; An answer to the user's question is generated according to a first target question-answer pair corresponding to the target title.

2. The question-answering method according to claim 1, wherein: According to the document attribute of the first target question-answer pair, selecting a target document from at least one original document to which the first target question-answer pair belongs includes: For each original document of the at least one original document, counting the number of first target question-answer pairs corresponding to each original document; The M original documents with the largest number of corresponding first target question-answer pairs are taken as M target documents, where M is a positive integer.

3. The question-answering method according to claim 1, wherein: In the target document, according to the title attribute of the first target question-answer pair, a target title is determined, including: For each title in the target document corresponding to the first target question-answer pair, count the number of first target question-answer pairs corresponding to each title; Select the top N titles with the largest number of corresponding first target question-answer pairs as N target titles, where N is a positive integer.

4. The question-answering method according to claim 1, wherein: Select a question-answer pair related to the user's question as the first target question-answer pair, including: Using the first artificial intelligence model, determine the core words of the user's question; A question-answer pair including the core word is selected as the first target question-answer pair.

5. The question-answering method according to claim 1, wherein: Generating an answer to the user's question according to the first target question-answer pair corresponding to the target title, including: Selecting a second target question-answer pair from the first target question-answer pairs corresponding to the target title according to at least one of the vector of the user's question and the vector of the core word and the vector of the first target question-answer pair; An answer to the user's question is generated according to the second target question-answer pair.

6. The question-answering method according to claim 5, wherein: According to at least one of the vector of the user's question and the vector of the core word, and the vector of the first target question-answer pair, selecting a first target question-answer pair related to the user's question as a second target question-answer pair, including: According to the average of the vector of the user's question and the vector of the core word, and the vector of the first target question-answer pair, a second target question-answer pair is selected from the first target question-answer pairs corresponding to the target title.

7. The question-answering method according to claim 1, wherein: Generating an answer to the user's question according to the first target question-answer pair corresponding to the target title, including: generating a prompt word according to a first target question-answer pair corresponding to the target title; Based on the prompt word, a second artificial intelligence model is used to generate an answer to the user's question.

8. The question-answering method according to claim 1, further comprising: Before determining the corresponding titles for the paragraphs of the multiple original documents, For each of the multiple original documents, each original document is divided into multiple paragraphs according to at least one of natural paragraph division, chapter division, and word count threshold of each paragraph in each original document.

9. A question-answering device, comprising: A title determination module is configured to determine corresponding titles for paragraphs of a plurality of original documents; a question-answer pair determination module, configured to determine, for the paragraph, a corresponding question-answer pair, a title attribute of the question-answer pair, and a document attribute of the question-answer pair, wherein the question-answer pair includes a question and an answer, the title attribute of the question-answer pair includes a title corresponding to the paragraph to which the question-answer pair belongs, and the document attribute of the question-answer pair includes a document to which the question-answer pair belongs; A question-answer pair selection module, configured to select a question-answer pair related to the user's question as a first target question-answer pair; A document selection module, configured to select a target document from at least one original document to which the first target question-answer pair belongs according to a document attribute of the first target question-answer pair; A target title determination module is configured to determine a target title in a target document according to a title attribute of the first target question-answer pair; A generation module is configured to generate an answer to the user's question based on a first target question-answer pair corresponding to a target title.

10. A question-answering device, comprising: Memory; as well as A processor coupled to the memory, wherein the processor is configured to execute the question-answering method according to any one of claims 1 to 8 based on instructions stored in the memory.

11. A computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement the question-answering method according to any one of claims 1 to 8.

12. A computer program product, comprising computer program instructions, which, when executed by a processor, implement the question-answering method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method and device for recommending question and answer page related questions

    CN104462553A

  • Automatically answering method, device, storage medium and electronic equipment

    CN107980130A

  • Method and device for recommending answers based on natural language understanding

    CN110059172A

  • Question and answer method and device, electronic equipment and readable storage medium

    CN116662518A

  • Document response method and device, equipment and storage medium

    CN116932727A