Extraction type retrieval question and answer method and device, equipment and medium

By using the pre-trained search question and answer model and token generation mechanism in the decisive search question and answer system, the problem of large models not being generated according to reference documents is solved, which improves the accuracy and credibility of the answers, and improves the efficiency of the system.

CN120030128AActive Publication Date: 2025-05-23GUANGXI GUIYUNTONG TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510179352.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-05-23
Estimated Expiration
2045-02-18

AI Technical Summary

Technical Problem

In the existing extracted search question and answer system, large models are not generated according to reference documents, and the credibility and accuracy are low.

Method used

By obtaining input data carrying questions, instruction requirements and reference documents, the first token in the target answer is generated using the pre-trained search question and answer model, and the token generation mechanism is determined based on the matching of the current matching token and the reference document, and a new token is generated using a restricted decoding mechanism or a copy mechanism to ensure that the answer generation closely revolves around the reference document.

Benefits of technology

Improve the accuracy and credibility of the target answers, ensure that the answers are as loyal as possible to the reference documents, and enhance the system's response speed and overall operational efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120030128A_ABST
    Figure CN120030128A_ABST
Patent Text Reader

Abstract

The invention discloses an extraction type retrieval question and answer method and device, equipment and a medium. The input data containing the reference document is acquired, and the token generation mechanism is determined according to the matching condition of the current matching token and the reference document, so that the answer generation closely surrounds the reference document. When matched information exists in the reference document, related content can be extracted from the reference document to serve as a newly-added token no matter whether a limited decoding mechanism (multiple matched text sequences exist) or a copying mechanism (only one matched text sequence exists) is adopted, it is guaranteed that the target answer is loyalty to the reference document and consistent with a given information source as much as possible, and the target answer can be extracted from the reference document to serve as the newly-added token. Therefore, the accuracy of the target answer is improved. Due to the fact that the copying mechanism can directly copy the related text fragments from the reference document, time and computing resources needed for generating a plurality of tokens are greatly reduced, the target answer can be rapidly provided for the user, and the response speed and the overall operation efficiency of the extraction type retrieval question-answering system are improved.
Need to check novelty before this filing date? Find Prior Art

Claims

1. An extractive retrieval question answering method, characterized in that: The method comprises: S1: Obtain input data with questions, instruction requirements, and reference documents; S2: Generate the first token in the target answer based on the input data through the pre-trained retrieval question answering model; S3: Determine the first token as the current matching token; S4: Determine whether the current matching token is at the end of the sentence. S4a: If yes, then determine a new token based on the target answer through the retrieval question and answer model; S4b: If not, determining a token generation mechanism according to the matching status of the current matching token and the reference document, and using the token generation mechanism to generate the newly added token; The token generation mechanism includes: Restricted decoding mechanism: when there are multiple text sequences matching the current matching token in the reference document, for each text sequence, determine the adjacent token after the end position index of the text sequence from the reference document; determine the newly added token based on the target answer and each adjacent token through the retrieval question-answering model; Copy mechanism: when there is only one text sequence matching the current matching token in the reference document, obtain the text segment between the end position index of the text sequence and the target sentence end position from the reference document; wherein the target sentence end position is the position of the first symbol belonging to the preset sentence end matching set after the end position index; through the retrieval question-answering model, determine the next token after the text sequence based on the target answer with the text segment concatenated at the end; determine the text segment and the next token as the newly added token; S5: splicing the newly added token to the end of the target answer to update the target answer; S6: Determine whether the updated target answer contains a preset end character. S6a: If yes, then end and output the updated target answer; S6b: If not, then based on the matching status of the current matching token and the reference document, the location information of the current matching token is updated; wherein the location information is initialized to be empty; S7: Update the current matching token according to the updated target answer and the updated location information, and return to execute S4.

2. The method according to claim 1, characterized in that The token generation mechanism also includes a free generation mechanism: when there is no text sequence matching the current matching token in the reference document, the newly added token is determined based on the target answer through the retrieval question and answer model.

3. The method according to claim 2, characterized in that The S6b includes: When there is a text sequence matching the current matching token in the reference document, the end position index of the current matching token is updated by adding a newly added value to the end position index of the current matching token; wherein the newly added value is the number of characters in the newly added token; If there is no text sequence matching the current matching token in the reference document, the position index of the character after the last character in the updated target answer is determined as the starting position index of the current matching token, and the ending position index of the current matching token is updated to empty.

4. The method according to claim 1, characterized in that In the restricted decoding mechanism, each of the adjacent tokens is scored based on the target answer through the retrieval question-answering model, and the adjacent token with the highest score is selected as the newly added token.

5. The method according to claim 1, characterized in that Before S4b, the prefix tree of the reference document is obtained; in S4b, the matching position of the text sequence matching the current matching token is searched in the prefix tree through the AC automaton algorithm.

6. The method according to claim 1, characterized in that S4: determining whether the current matching token is at the end of a sentence, including: Determine whether the last character of the currently matched token belongs to a preset sentence end symbol set; wherein the preset sentence end symbol set includes pre-configured symbols representing the end of a sentence; If yes, then determine that the current matching token is the end of the sentence; If not, it is determined that the current matching token is not the end of the sentence.

7. An extractive retrieval question-answering device, characterized in that: The device comprises: An acquisition unit, used to acquire input data carrying questions, instruction requirements and reference documents; A processing unit is used to perform the following steps: S2: Generate the first token in the target answer based on the input data through the pre-trained retrieval question answering model; S3: Determine the first token as the current matching token; S4: Determine whether the current matching token is at the end of the sentence. S4a: If yes, then determine a new token based on the target answer through the retrieval question and answer model; S4b: If not, determining a token generation mechanism according to the matching status of the current matching token and the reference document, and using the token generation mechanism to generate the newly added token; The token generation mechanism includes: Restricted decoding mechanism: when there are multiple text sequences matching the current matching token in the reference document, for each text sequence, determine the adjacent token after the end position index of the text sequence from the reference document; determine the newly added token based on the target answer and each adjacent token through the retrieval question-answering model; Copy mechanism: when there is only one text sequence matching the current matching token in the reference document, obtain the text segment between the end position index of the text sequence and the target sentence end position from the reference document; wherein the target sentence end position is the position of the first symbol belonging to the preset sentence end matching set after the end position index; through the retrieval question-answering model, determine the next token after the text sequence based on the target answer with the text segment concatenated at the end; determine the text segment and the next token as the newly added token; S5: splicing the newly added token to the end of the target answer to update the target answer; S6: Determine whether the updated target answer contains a preset end character. S6a: If yes, then end and output the updated target answer; S6b: If not, then based on the matching status of the current matching token and the reference document, the location information of the current matching token is updated; S7: Update the current matching token according to the updated target answer and the updated location information, and return to execute S4.

8. A computer device, characterized in that: The computer device includes a processor, and the processor is used to implement the steps of the extractive retrieval question-answering method as described in any one of claims 1 to 6 when executing a computer program stored in a memory.

9. A computer-readable storage medium, characterized in that: It stores a computer program executable by a computer device. When the program is run on the computer device, the computer device executes the steps of the extractive retrieval question-answering method as described in any one of claims 1 to 6 above.

Citation Information

Patent Citations

  • Visual question-answering method and device, and medium

    CN113780486A

  • Retrieval type intelligent question and answer system and method for coal mine safety regulations

    CN114020862A

  • Document question and answer method, system and equipment based on RAG and medium

    CN119003725A

  • Machine reading comprehension-based information extraction method and related device

    WO2021135910A1

  • Question-answer processing method and apparatus

    WO2024220031A1