Question and answer processing method and device, computer equipment, readable storage medium and program product

By performing text optimization processing and multi-dimensional search on the initial question text, combined with knowledge base and prompt word templates, the reply accuracy of the intelligent question-and-answer system is improved, and the problems of lack of single question search content and incomplete recall are solved.

CN119066172APending Publication Date: 2024-12-03GUANGZHOU QUYAN NETWORK TECH CO LTD
View PDF 0 Cites 9 Cited by

Patent Information

Application Number
CN202411176682.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

The existing intelligent question-and-answer system has low response accuracy when dealing with user complex and ambiguity language problems, mainly due to the lack of search content for individual questions and incomplete recalls.

Method used

By text optimization processing of the initial question text, multi-dimensional optimized question text is generated, and matching reference document information is retrieved from the preset knowledge base, and target question answering prompts are generated in combination with the prompt word template to indicate the Q&A big model output response content.

Benefits of technology

The accuracy of question answering in the Q&A system is improved, and more relevant information is recalled through multi-dimensional search, reducing the incomplete answers and low accuracy problems caused by single question retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119066172A_ABST
    Figure CN119066172A_ABST
Patent Text Reader

Abstract

The invention relates to a question and answer processing method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the steps of obtaining an initial question text input into a question and answer large model, and performing text optimization processing on the initial question text to obtain an optimized text set; the optimized text set comprises an initial problem text and optimized problem texts of at least two text optimization dimensions; retrieving reference document information matched with each text in the optimized text set from a preset knowledge base; obtaining a target question and answer prompt according to the reference document information matched with each text and a preset prompt word template; the target question and answer prompt is used for indicating the large question and answer model to output target answer content for responding to the initial question text by referring to reference document information matched with each text; and displaying the target answer content output by the question and answer large model. By adopting the method, the question answering accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a question-answering processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] Artificial Intelligence (AI) is a comprehensive technology in computer science. By studying the design principles and implementation methods of various intelligent machines, machines can have the functions of perception, reasoning and decision-making. Artificial Intelligence technology is a comprehensive discipline that covers a wide range of fields, such as natural language processing technology and machine learning / deep learning. With the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.

[0003] The big language model is an important application of natural language processing technology. With the continuous optimization and development of the big language model, the intelligent question-answering system has evolved from simple keyword matching and updating to the big language model that understands user text, identifies intent, and obtains more relevant information to answer questions. Its effect in the field of human-computer dialogue has been greatly improved. Precisely because of this, people have higher requirements for intelligent question-answering systems. The core lies in the ability of the intelligent system to correctly identify the user's words and understand their semantics.

[0004] However, in the related art, since the language of users' questions is complex and ambiguous, the questions may contain professional words with multiple meanings or ambiguous abbreviations, resulting in a low accuracy rate in answering the questions.

[0005] Therefore, there is a problem in the related art that the accuracy of answering questions is low. Summary of the invention

[0006] Based on this, it is necessary to provide a question and answer processing method, device, computer equipment, computer-readable storage medium and computer program product that can improve the accuracy of answering questions in response to the above technical problems.

[0007] In a first aspect, the present application provides a question-answering processing method, comprising:

[0008] Obtaining an initial question text input into the question-answering big model, performing text optimization processing on the initial question text to obtain an optimized text set; the optimized text set includes the initial question text and optimized question texts in at least two text optimization dimensions;

[0009] Retrieving reference document information matching each text in the optimized text set from a preset knowledge base;

[0010] According to the reference document information matched by each of the texts and the preset prompt word template, a target question and answer prompt is obtained; the target question and answer prompt is used to instruct the question and answer large model to output a target answer content for responding to the initial question text by referring to the reference document information matched by each of the texts;

[0011] Display the target answer content output by the question-answering model.

[0012] In one embodiment, the performing text optimization processing on the initial question text to obtain an optimized text set includes:

[0013] Obtain historical conversation content of the question-answering model;

[0014] According to the context information in the historical conversation content, the initial question text is optimized to obtain the optimized question text;

[0015] The optimized text set is obtained according to the optimized question text and the initial question text.

[0016] In one embodiment, the text optimization dimension includes question expansion, and the text optimization processing of the initial question text according to the context information in the historical conversation content to obtain the optimized question text includes:

[0017] Expanding the initial question text according to the context information in the historical conversation content to obtain an expanded question text; the completeness of the question in the expanded question text is higher than that of the initial question text;

[0018] The expanded question text is used as the optimized question text.

[0019] In one embodiment, the text optimization dimension includes question conversion, and the text optimization processing of the initial question text to obtain an optimized text set includes:

[0020] Converting the initial question text to obtain a converted question text; the complexity of the question in the converted question text is lower than the complexity of the question in the initial question text;

[0021] The converted question text is used as the optimized question text.

[0022] In one embodiment, the performing text optimization processing on the initial question text to obtain an optimized text set includes:

[0023] Obtain historical conversation content of the question-answering model;

[0024] Generating an initial answer text for responding to the initial question text according to the context information in the historical conversation content;

[0025] The optimized text set is obtained according to the initial answer text, the optimized question text and the initial question text.

[0026] In one embodiment, the reference document information includes document text information and rich text information; the rich text information includes image links and image description information; and obtaining a target question and answer prompt based on the reference document information matched with each of the texts and a preset prompt word template includes:

[0027] Arranging the document text information, the image link and the image description information that match the texts according to a preset arrangement order, to obtain the arranged reference document information that matches the texts;

[0028] The target question and answer prompt is obtained according to the edited reference document information and the prompt word template that match each of the texts.

[0029] In a second aspect, the present application also provides a question-answer processing device, comprising:

[0030] An optimization unit, used for obtaining an initial question text input into the question-answering large model, performing text optimization processing on the initial question text, and obtaining an optimized text set; the optimized text set includes the initial question text and optimized question texts in at least two text optimization dimensions;

[0031] A retrieval unit, used to retrieve reference document information matching each text in the optimized text set from a preset knowledge base;

[0032] A determination unit, used to obtain a target question and answer prompt according to the reference document information matched by each of the texts and a preset prompt word template; the target question and answer prompt is used to instruct the question and answer macromodel to output a target answer content for responding to the initial question text by referring to the reference document information matched by each of the texts;

[0033] A display unit is used to display the target answer content output by the question-answering model.

[0034] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the steps of the above method are implemented.

[0035] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.

[0036] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0037] The above-mentioned question and answer processing method, device, computer equipment, computer-readable storage medium and computer program product obtain the initial question text input into the question and answer big model, perform text optimization processing on the initial question text, and obtain an optimized text set; the optimized text set includes the initial question text and optimized question texts of at least two text optimization dimensions; retrieves reference document information matching each text in the optimized text set from a preset knowledge base; obtains a target question and answer prompt based on the reference document information matching each text and a preset prompt word template; the target question and answer prompt is used to instruct the question and answer big model to output the target answer content for responding to the initial question text by referring to the reference document information matching each text; and displays the target answer content output by the question and answer big model.

[0038] In this way, by performing text optimization processing on the initial question text input into the question-answering big model, an optimized question text containing at least two text optimization dimensions and an optimized text set of the initial question text are obtained, so as to retrieve reference document information matching each text in the optimized text set from the knowledge base, realize multi-dimensional retrieval content recall, and solve the problem of lack of content in single question retrieval in related technologies, as well as the problem of low accuracy of the final answer due to the single and incomplete recalled content when searching the knowledge base based on the initial question text. By obtaining the target question-answering prompt based on the reference document information matching each text and the preset prompt word template, the question-answering big model is instructed to output the target answer content for responding to the initial question text by referring to the reference document information matching each of the texts, which can effectively improve the accuracy of the question answers of the question-answering big model. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 A flowchart of a question-answering processing method in one embodiment;

[0041] Figure 2 is a flowchart of a question-answering processing method in another embodiment;

[0042] Figure 3 is an architecture diagram of a question-answering processing system in one embodiment;

[0043] Figure 4 is a structural block diagram of a question-answering processing device in one embodiment;

[0044] FIG. 5 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0046] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0047] In one embodiment, Figure 1 As shown, a question-answering processing method is provided. This embodiment uses the method applied to a computer device as an example. It can be understood that the computer device can be a terminal, a server, or a system including a terminal and a server. In this embodiment, the method includes the following steps:

[0048] Step S110, obtaining the initial question text input into the question-answering model, performing text optimization processing on the initial question text, and obtaining an optimized text set.

[0049] The optimized text set includes the initial question text and the optimized question text in at least two text optimization dimensions.

[0050] The initial question text may be the original question text entered by the user account in the interactive interface of the question-and-answer model.

[0051] The optimized question text may be an optimized question text obtained by performing text optimization processing on the initial question text under the corresponding text optimization dimension.

[0052] Among them, the text optimization dimension may refer to different aspects that may be considered in the text optimization process.

[0053] Among them, the question-answering big model may refer to a big model used to answer the question text input by the user account.

[0054] In a specific implementation, a user account can input an initial question text in the interactive interface of the question-and-answer big model, so that a computer device can obtain the initial question text input into the question-and-answer big model, and perform text optimization processing on the initial question text according to at least two text optimization dimensions to obtain an optimized text set, which includes the initial question text and optimized question texts in at least two text optimization dimensions.

[0055] Step S120: retrieve reference document information matching each text in the optimized text set from a preset knowledge base.

[0056] The preset knowledge base may be an external knowledge base. Reference document information matching each text in the optimized text set is retrieved from the preset knowledge base, which may be data that the question-answering model has not been trained on and has never seen before, such as proprietary research, technical documents or communications in different professional fields.

[0057] In a specific implementation, the computer device may traverse each text in the optimized text set and perform content retrieval to a preset knowledge base in parallel, so as to retrieve reference document information matching each text in the optimized text set from the preset knowledge base.

[0058] Step S130, obtaining a target question and answer prompt according to the reference document information matched with each text and the preset prompt word template.

[0059] Among them, the target question and answer prompt is used to instruct the question and answer model to output the target answer content for responding to the initial question text by referring to the reference document information that matches each text.

[0060] Among them, the preset prompt word template can be a Prompt template of the question and answer large model.

[0061] Among them, Prompt is an instruction, question or sentence that can be used to guide or instruct a language model to generate specific text output. Prompt is the starting point for users to interact with language models. It tells the model the user's intention and expects the model to respond in a meaningful and relevant way.

[0062] The target answer content may be a reply content used to reply to the initial question text. The target answer content may include but is not limited to text information, image information, etc.

[0063] In a specific implementation, a computer device can obtain a target question and answer prompt based on the reference document information matching each text and a preset prompt word template. The target question and answer prompt is used as a parameter to call the question and answer big model to instruct the question and answer big model to output the target answer content for responding to the initial question text by referring to the reference document information matching each text.

[0064] Step S140, display the target answer content output by the question-answering model.

[0065] In a specific implementation, a computer device can display the target answer content output by the question-answering model.

[0066] In the above-mentioned question and answer processing method, by obtaining the initial question text input into the question and answer big model, the initial question text is subjected to text optimization processing to obtain an optimized text set; the optimized text set includes the initial question text and optimized question texts of at least two text optimization dimensions; the reference document information matching each text in the optimized text set is retrieved from a preset knowledge base; the target question and answer prompt is obtained according to the reference document information matching each text and the preset prompt word template; the target question and answer prompt is used to instruct the question and answer big model to output the target answer content for responding to the initial question text by referring to the reference document information matching each text; and the target answer content output by the question and answer big model is displayed.

[0067] In this way, by performing text optimization processing on the initial question text input into the question-answering big model, an optimized question text containing at least two text optimization dimensions and an optimized text set of the initial question text are obtained, so as to retrieve reference document information matching each text in the optimized text set from the knowledge base, realize multi-dimensional retrieval content recall, and solve the problem of lack of content in single question retrieval in related technologies, as well as the problem of low accuracy of the final answer due to the single and incomplete recalled content when searching the knowledge base based on the initial question text. By obtaining the target question-answering prompt based on the reference document information matching each text and the preset prompt word template, the question-answering big model is instructed to output the target answer content for responding to the initial question text by referring to the reference document information matching each of the texts, which can effectively improve the accuracy of the question answers of the question-answering big model.

[0068] In one embodiment, text optimization processing is performed on the initial question text to obtain an optimized text set, including: obtaining historical conversation content of the question-answering large model; performing text optimization processing on the initial question text based on context information in the historical conversation content to obtain optimized question text of at least two text optimization dimensions; and obtaining an optimized text set based on the optimized question text and the initial question text.

[0069] The historical conversation content may be the previous conversation content between the user account and the question-and-answer big model.

[0070] In a specific implementation, when the computer device performs text optimization processing on the initial question text to obtain an optimized text set, the computer device can obtain the historical conversation content between the user account and the question-answering large model, for example, it can obtain multiple rounds of historical conversation content, and illustratively, it can obtain the 10 historical conversation contents before the initial question text (the preset number of historical conversation contents can be set according to actual needs, and is not specifically limited here). In this way, the computer device can perform text optimization processing on the initial question text according to the context information in the historical conversation content to obtain the optimized question text; for example, the initial question text can be pre-operated with subject completion, reference resolution, and other problem conversions through the context information in the historical conversation content; thus, the computer device can obtain an optimized text set based on the optimized question text and the initial question text.

[0071] The technical solution of this embodiment obtains the historical conversation content of the question-answering big model; performs text optimization processing on the initial question text according to the context information in the historical conversation content to obtain the optimized question text; and obtains the optimized text set according to the optimized question text and the initial question text. In this way, by performing text optimization processing on the initial question text according to the context information in the historical conversation content, the fuzziness or potential ambiguity in the initial question text can be more accurately eliminated, and the semantics of the initial question text can be more accurately understood, so that the optimized question text can more accurately represent the question intention of the user account.

[0072] In one embodiment, the text optimization dimension includes question expansion, and the initial question text is optimized according to the context information in the historical conversation content to obtain the optimized question text, including: expanding the initial question text according to the context information in the historical conversation content to obtain the expanded question text; and using the expanded question text as the optimized question text.

[0073] Among them, the completeness of the question in the expanded question text is higher than that in the initial question text.

[0074] The completeness of the question may refer to the detail and / or clarity of the question content.

[0075] In a specific implementation, the text optimization dimension may include question expansion. When the computer device performs text optimization processing on the initial question text according to the context information in the historical conversation content to obtain the optimized question text, the computer device may expand the initial question text according to the context information in the historical conversation content to obtain the expanded question text, and the question completeness of the expanded question text is higher than that of the initial question text. In this way, the computer device may use the expanded question text as the optimized question text of the text optimization dimension of question expansion.

[0076] Furthermore, the computer device may expand the initial question text through the question expansion model according to the context information in the historical conversation content to obtain the expanded question text.

[0077] The question expansion model may be a model for expanding the question text. Specifically, the computer device may obtain a prompt word preset in the question expansion model, and expand the initial question text in combination with the context information in the historical conversation content to obtain the expanded question text.

[0078] In some embodiments, expanding the initial question text may include the following methods:

[0079] 1) Understand user intent based on context information, guess what the user is thinking, and form a new question. Guessing the user's intent based on context can retrieve more relevant content.

[0080] 2) Complete the content of the question based on context information. The questions asked by users are often complex and ambiguous. Understanding the intention and completing the context of the question can further optimize it, thereby retrieving more accurate reference content.

[0081] 3) Further parse the question. If it is a complex or compound question, the initial question text is split into multiple sub-questions. Expanding a single query into multiple queries can enrich the content of the query. A complex question can be decomposed into a series of simpler sub-questions using a small to large prompt method. Provide further contextual information to solve any questions that lack specific nuances, thereby ensuring better relevance of the generated answers.

[0082] In some embodiments, a prompt word Prompt of the question expansion model is pre-designed, which includes the design corresponding to the preset role and each ability, as follows:

[0083] 1) Preset roles

[0084] As a user behavior insight expert, I am good at parsing the questions raised by users, understanding their meanings, and generating new question sets by expanding the questions, and outputting them in the JSON format of a string array.

[0085] 2) Problem expansion

[0086] Ability 1: Guess the real problem

[0087] Parse the questions asked by users and understand their meaning.

[0088] Based on the user's initial question text, guess the user's original intention, make assumptions about related questions the user may want to ask, and generate a new question.

[0089] Capability 2: Sub-problem splitting

[0090] Parse the questions asked by users and understand their meaning.

[0091] If the problem involves multiple things or multiple dimensions, it can be split into multiple questions.

[0092] Although it may be split into multiple questions, please focus on 1 or 2 core questions.

[0093] Ability 3: Question context completion

[0094] Parse the questions asked by users and understand their meaning.

[0095] If the question is unclear, the context information is combined to complete the question and generate a new question.

[0096] For example:

[0097] A: Are there any good TV series you like to watch recently?

[0098] B: The second season of TV series A was recently released, telling the story of re-exploring the underworld with the protagonist B.

[0099] A: I want to watch the first season.

[0100] In the above conversation, "I want to watch the first season" is an ambiguous question. Combined with the context information, it can be completed as "I want to watch the first season of TV series A".

[0101] The technical solution of this embodiment includes question expansion in the text optimization dimension. The initial question text is expanded according to the context information in the historical conversation content to obtain the expanded question text; the question completeness of the expanded question text is higher than that of the initial question text; the expanded question text is used as the optimized question text. In this way, the initial question text is expanded according to the context information in the historical conversation content to obtain an expanded question text with a higher degree of question completeness. Content retrieval based on the expanded question text with a higher degree of question completeness can retrieve more relevant and more accurate reference content, which can solve the problem of low answer accuracy caused by complex and ambiguous single questions.

[0102] In one embodiment, the text optimization dimension includes question conversion, and text optimization processing is performed on the initial question text to obtain an optimized text set, including: converting the initial question text to obtain a converted question text; and using the converted question text as the optimized question text.

[0103] Among them, the complexity of the question text after conversion is lower than the complexity of the initial question text.

[0104] In a specific implementation, the text optimization dimension includes question conversion. When a computer device performs text optimization processing on an initial question text to obtain an optimized text set, the computer device can convert the initial question text to obtain a converted question text. The question complexity of the converted question text is lower than the question complexity of the initial question text. In this way, the computer device can use the converted question text as the optimized question text of the text optimization dimension of question conversion.

[0105] Furthermore, the computer device may convert the initial question text through the question conversion model to obtain a converted question text.

[0106] The question conversion model may be a model for converting question texts. Specifically, the computer device may obtain a prompt word preset in the question conversion model, convert the initial question text, and obtain a converted question text.

[0107] In practical applications, the problem conversion big model and the problem expansion big model can be the same big model, and the big model can be the problem expansion and conversion big model.

[0108] In some embodiments, converting the initial question text may include the following methods:

[0109] The problem generalization operation abstracts the initial problem text and raises higher-level questions, which can obtain more comprehensive information related to the problem.

[0110] In some embodiments, a prompt word Prompt of the question conversion model is pre-designed, which includes the design corresponding to the preset roles and various capabilities, as follows:

[0111] 1) Preset roles

[0112] As a user behavior insight expert, I am good at parsing the questions raised by users, understanding their meaning and generating a new set of questions by transforming the questions and outputting them in the JSON format of a string array.

[0113] 2) Problem conversion

[0114] Ability 1: Problem generalization

[0115] Parse the questions asked by users and understand their meaning.

[0116] Based on the user's question, a superordinate summary is made to paraphrase the initial question text into a less complex question that is easier to answer.

[0117] For example:

[0118] 1. Initial question text: What position did politician C hold from May 1955 to April 1956?

[0119] Transformed question text: What positions has politician C held during his career?

[0120] 2. Initial question text: Who was the spouse of movie star D from 1968 to 1974?

[0121] Transformed question text: Who is the spouse of movie star D?

[0122] In the technical solution of this embodiment, the text optimization dimension includes question conversion, and the converted question text is obtained by converting the initial question text; the question complexity of the converted question text is lower than the question complexity of the initial question text; and the converted question text is used as the optimized question text. In this way, by performing content retrieval through the converted question text with lower question complexity, more comprehensive reference document information involved in the initial question text can be obtained, thereby improving the comprehensiveness of the answer content for the initial question text.

[0123] In one embodiment, text optimization processing is performed on the initial question text to obtain an optimized text set, including: obtaining historical conversation content of the question-answering large model; generating an initial answer text for responding to the initial question text based on context information in the historical conversation content; and obtaining an optimized text set based on the initial answer text, the optimized question text and the initial question text.

[0124] In a specific implementation, when the computer device performs text optimization processing on the initial question text to obtain the optimized text set, the computer device can obtain the historical conversation content of the question-answering model; generate the initial answer text for responding to the initial question text according to the context information in the historical conversation content; and obtain the optimized text set according to the initial answer text, the optimized question text and the initial question text. That is, the optimized text set may include the initial answer text in addition to the initial question text and the optimized question text of at least two text optimization dimensions.

[0125] Among them, the initial answer text generated to respond to the initial question text can be understood as a hypothetical answer text generated under the text optimization dimension of question conversion. Specifically, the computer device can propose a hypothetical answer based on context information and understanding of the initial question text, and then use the hypothetical answer text for retrieval. When responding to the initial question text, a hypothetical answer is constructed instead of directly searching the database for reference document information related to the query initial question text and its calculated vector. It focuses on the similarity between embedded answers and answers, rather than seeking embedded similarity of questions or queries.

[0126] Taking the question conversion model as an example, the prompt word Prompt of the question conversion model is pre-designed, which includes the design corresponding to the preset roles and various capabilities, as follows:

[0127] 1) Preset roles

[0128] As a user behavior insight expert, I am good at parsing the questions raised by users, understanding their meaning and generating a new set of questions by transforming the questions and outputting them in the JSON format of a string array.

[0129] 2) Problem conversion

[0130] Ability 2: Question hypothesis answer

[0131] Parse the questions asked by users, understand their meaning, and try to answer them.

[0132] Combined with the contextual information in the historical conversation content, the initial question text is answered and an appropriate and possible answer is generated as the initial answer text.

[0133] If there are historical responses related to the initial question text in the historical dialogue content, then focus on the historical responses as the basis for answering the question.

[0134] The technical solution of this embodiment obtains the historical conversation content of the question-answering model; generates the initial answer text for responding to the initial question text according to the context information in the historical conversation content; and obtains the optimized text set according to the initial answer text, the optimized question text and the initial question text. In this way, the optimized text set also includes the initial answer text generated in response to the initial question text, so that in the process of content retrieval in the preset knowledge base based on the initial answer text, the focus is on the similarity between the embedded answers, which can provide more specific and relevant reference document information, thereby improving the accuracy of the answer content.

[0135] In one embodiment, the reference document information includes document text information and rich text information; the rich text information includes image links and image description information; based on the reference document information matching each text and a preset prompt word template, a target question and answer prompt is obtained, including: according to a preset arrangement order, the document text information matching each text and the matching image links and the matching image description information are arranged to obtain the arranged reference document information matching each text; based on the arranged reference document information and the prompt word template matching each text, a target question and answer prompt is obtained.

[0136] The preset arrangement order may be the order of document text information, image link, and image description information.

[0137] In a specific implementation, the reference document information includes document text information and rich text information; the rich text information includes image links and image description information; in the process of obtaining target question and answer prompts based on the reference document information matching each text and a preset prompt word template, the computer device can arrange the document text information matching each text and the matching image links and the matching image description information in a preset arrangement order to obtain the arranged reference document information matching each text; in this way, the computer device can obtain the target question and answer prompts based on the arranged reference document information and the prompt word template matching each text.

[0138] It is understandable that if there is no rich text information in the reference document information that matches the text, the computer device can obtain the target question and answer prompt based on the document text information that matches the text and the prompt word template.

[0139] In the above process, the multimodal content in the rich text information is arranged as follows:

[0140] 1) Content assembly structure

[0141] A. [text], image_url: [image_url], image_description: [image_description];

[0142] B. [text], image_url: [image_url], image_description: [image_description];

[0143] C. [text], image_url: [image_url], image_description: [image_description];

[0144] D……

[0145] 2) On the Prompt project

[0146] If the reference document information contains an image_url (image link) that matches the corresponding text, place the image_url after the corresponding text for user reference. The image_url cannot be modified and should not be fabricated at will.

[0147] Put image_url after the text in the original order. Do not change the position of image_url.

[0148] If the reference document information contains an image_description (image description information), it cannot be used to answer the user's question.

[0149] The data structure of the reference document information involved in the above process is shown in Table 1 and Table 2 below:

[0150] Table 1 Structure of reference document information unit

[0151]

[0152] The structure of the reference document information unit (DocChunk) is shown in Table 2:

[0153] Table 2 Structure of RichTextItem

[0154]

[0155] In the technical solution of this embodiment, the reference document information includes document text information and rich text information; the rich text information includes image links and image description information; by arranging the document text information, image links and image description information that match each text according to a preset arrangement order, the arranged reference document information that matches each text is obtained; according to the arranged reference document information and prompt word templates that match each text, the target question and answer prompt is obtained. In this way, by arranging the document text information, image links and image description information that match each text according to a preset arrangement order, and then combining them with the prompt word template, the reference document information can be effectively integrated to improve the usability of the information.

[0156] In other embodiments, a target question and answer prompt is obtained based on reference document information matching each text and a preset prompt word template, including: a computer device may sort other reference document information from high to low according to the retrieval similarity between the other reference document information and the corresponding text to obtain sorted other reference document information; wherein the other reference document information is reference document information matching text other than the initial question text in the optimized text set; the computer device may combine the sorted other reference document information with the reference document information matching the initial question text to obtain a target reference document information set; in this way, the computer device may obtain a target question and answer prompt based on the target reference document information set and the preset prompt word template.

[0157] Among them, the reference document information that matches the initial question text in the target reference document information set is sorted before the other sorted reference document information.

[0158] Furthermore, based on the target reference document information set and a preset prompt word template, a target question and answer prompt is obtained, including: the computer device can filter out the target reference document information from the target reference document information set; the target reference document information is reference document information whose retrieval similarity with the matching text meets the preset similarity condition, and the target question and answer prompt is obtained based on the target reference document information and the preset prompt word template.

[0159] The preset similarity condition may also be that the document is ranked in the top K (K is a positive integer, and the specific value of K is set according to actual needs) positions in the target reference document information set.

[0160] In this way, by retrieving target reference document information whose similarity meets the preset similarity conditions in the target reference document information set and the preset prompt word template, the target question and answer prompt is obtained, which can reduce the amount of reference document information used to generate the target answer prompt and effectively reduce the waste of computing resources.

[0161] In another embodiment, Figure 2As shown, a question-answering processing method is provided, which is described by taking the method applied to a computer device as an example, and includes the following steps:

[0162] Step S202, obtaining the initial question text input into the question-answering model.

[0163] Step S204, obtaining the historical conversation content of the question-and-answer model.

[0164] Step S206, expanding the initial question text according to the context information in the historical conversation content to obtain an expanded question text, and using the expanded question text as the optimized question text.

[0165] Step S208: generating an initial answer text for responding to the initial question text based on the context information in the historical conversation content.

[0166] Step S210, converting the initial question text to obtain a converted question text, and using the converted question text as the optimized question text.

[0167] Step S212, obtaining an optimized text set according to the initial answer text, the optimized question text and the initial question text.

[0168] Step S214: retrieve reference document information matching each text in the optimized text set from a preset knowledge base.

[0169] Step S216, obtaining a target question and answer prompt according to the reference document information matched with each text and the preset prompt word template.

[0170] Step S218, display the target answer content output by the question-answering model.

[0171] It should be noted that the specific limitations of the above steps can refer to the specific limitations of a question and answer processing method above.

[0172] In another embodiment, if Figure 3 As shown, a question-answering processing system is provided, which includes the following seven modules:

[0173] 1) Question acquisition and answer module: It is used to receive the initial question text entered by the user account and pass it to the downstream module. It also receives the final target answer content processed by the downstream and returns it to the user account.

[0174] 2) Chat history context module: used to support chat history context management of multiple rounds of conversations, provide a chat record storage and query interface, and support the configuration of chat history automatic expiration policy;

[0175] 3) Prompt management module: manages the prompts required for calling the model, including the prompt word template of the question-answering model, the prompt word prompt of the question expansion and conversion model, etc. It supports the acquisition of preset prompts, the arrangement of multimodal retrieval content and the splicing of the final prompt;

[0176] 4) Pre-retrieval optimization module: It mainly optimizes the initial question text, including at least two text optimization dimensions: question expansion and question conversion, and finally returns an optimized text set containing multiple texts;

[0177] 5) Retrieval module: This module is mainly connected to the preset knowledge base, and uses the text in the optimized text set as a parameter to query the knowledge base to obtain the reference document information matching each text;

[0178] 6) Post-retrieval optimization module: It is mainly used for optimization after retrieval. After obtaining the reference document information matching each text, the reference document information is merged, deduplicated and rearranged to reduce resource waste;

[0179] 7) Model calling module: This module mainly receives target question and answer prompts, integrates relevant parameters and calls the question and answer model.

[0180] Take the above question-answering processing system to implement the question-answering processing method as an example to illustrate. Figure 3 , the question-answer processing method may include the following steps:

[0181] 1) The question acquisition and reply module obtains the initial question text entered by the user account, which is a string type, and calls the chat history context module to obtain the historical conversation content. Here, the historical conversation content can be obtained according to the preset number, and the default is the first 10. If it is the initial chat, there is no historical conversation content. If the historical conversation content is empty, only the initial question text is passed; if the historical conversation content is not empty, it is passed to the retrieval pre-module together with the initial question text;

[0182] 2) The retrieval front module receives the initial question text and historical conversation content, and performs expansion and conversion of the initial question text in parallel: obtain the prompt word template of the corresponding text optimization dimension from the prompt management module, and call the question expansion and conversion big model through the big model calling module to generate relevant text. The question expansion includes the following operations: guessing the real question, sub-question splitting, and question context completion; and the question conversion includes the following operations: question hypothesis answer, question generalization; the question context completion strongly depends on the historical conversation content. If the historical conversation content is empty, the question context completion will not be performed;

[0183] 3) The retrieval pre-module will integrate the above generated question expansion and question conversion texts and the initial question text to form a string array, namely the optimized text set. The optimized text set will be simply matched and merged to remove overlaps, and then the processed optimized text set will be passed to the retrieval module;

[0184] 4) The retrieval module obtains the optimized text set, traverses the optimized text set, performs content retrieval in the knowledge base in parallel, and obtains the reference document information that matches each text in the optimized text set. The reference document information is aggregated and passed to the post-retrieval optimization module;

[0185] 5) The post-retrieval optimization module will perform the following operations on the reference document information passed in sequence: remove duplicates according to the search keywords; sort in descending order according to the search similarity. The reference document information retrieved based on the initial question text does not need to be sorted according to the search similarity, but is prioritized at the front of the whole. Then, according to the preset K value, the top K contents of all the reference document information are intercepted to obtain the target reference document information.

[0186] 6) Sort the target reference document information obtained after optimization by the post-retrieval optimization module. If the rich text information set is empty, obtain the document text information. Obtain the preset question-answer large model prompt word Prompt template from the Prompt management module and splice the multimodal content in the above target reference document information: arrange the document text information, image link and image description information in the target reference document information according to the preset arrangement order;

[0187] 7) The large model calling module uses the target question and answer prompt obtained by splicing the above target reference document information and the prompt word template of the question and answer large model as a parameter to call the question and answer large model, guide the question and answer large model to form the final target answer content, and return it to the user account. Among them, the question and answer large model can be a large language model (LLM).

[0188] Among them, the prompt word Prompt of the question-answering model is pre-designed, which includes the design corresponding to the preset roles and various abilities, as follows:

[0189] 1) Preset roles

[0190] As a Q&A expert who is proficient in problem information processing, he is good at understanding user questions and forming the most appropriate answers based on the reference document information provided.

[0191] 2) Preset Capability

[0192] Ability 1: Understanding the problem

[0193] Based on the user's question, clearly understand the essence and purpose of the question.

[0194] Analyze the problem in depth, filter and analyze the reference document information provided, and find the most relevant content and the most critical parts from the reference document information.

[0195] If you obtain a lot of content, please arrange it in an orderly manner in the form of segments and strips to facilitate user understanding.

[0196] Ability 2: Cite reference sources and operate on related content

[0197] If there are questions with similar intentions or meanings in the reference document information, and clear answers are given, the answers to the questions should be returned as is, including text information and image information, without modification, and without additional summarization or refinement;

[0198] When processing the text in relevant reference document information, do not make secondary modifications, stay true to the original text, and do not make additional summaries or refinements.

[0199] Ability 3: Cite reference sources and operate on irrelevant content

[0200] If the content in the reference document information is not relevant to the question, it should be automatically removed and not used as a reference for the answer;

[0201] If all the content in the reference document information is completely irrelevant to the question, clearly tell the user that there is no matching reference document information and that they cannot fabricate information to answer the question.

[0202] Competency 4: Interpreting information

[0203] If the content of the answer does not rely on the reference document information, it is necessary to clearly tell the user that this part is provided in addition;

[0204] When answering questions using reference document information, do not make any subjective interpretations or inferences, and provide the source of the reference document information at the end of the answer.

[0205] After you have finished solving the problem, please check whether your answer meets all the above requirements.

[0206] In this way, by optimizing the initial question text input, including expansion and transformation, multi-dimensional retrieval content recall is achieved, the problem of insufficient content in single question retrieval is solved, the problem of poor question-answering results caused by complex and ambiguous single questions is solved, and the accuracy of question answers is improved.

[0207] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0208] Based on the same inventive concept, the embodiment of the present application also provides a question-answer processing device for implementing the question-answer processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more question-answer processing device embodiments provided below can refer to the limitations on the question-answer processing method above, and will not be repeated here.

[0209] In an exemplary embodiment, Figure 4 As shown, a question-answer processing device is provided, including: an optimization unit 410, a retrieval unit 420, a determination unit 430 and a display unit 440, wherein:

[0210] The optimization unit 410 is used to obtain the initial question text input into the question-answering model, perform text optimization processing on the initial question text, and obtain an optimized text set; the optimized text set includes the initial question text and optimized question texts in at least two text optimization dimensions.

[0211] The retrieval unit 420 is used to retrieve reference document information matching each text in the optimized text set from a preset knowledge base.

[0212] The determination unit 430 is used to obtain a target question and answer prompt based on the reference document information matching each of the texts and a preset prompt word template; the target question and answer prompt is used to instruct the question and answer large model to output a target answer content for responding to the initial question text by referring to the reference document information matching each of the texts.

[0213] The display unit 440 is used to display the target answer content output by the question-answering model.

[0214] In one of the embodiments, the optimization unit 410 is specifically used to obtain the historical conversation content of the question-answering large model; perform text optimization processing on the initial question text according to the context information in the historical conversation content to obtain the optimized question text; and obtain the optimized text set according to the optimized question text and the initial question text.

[0215] In one embodiment, the text optimization dimension includes question expansion, and the optimization unit 410 is specifically used to expand the initial question text according to the context information in the historical conversation content to obtain an expanded question text; the question completeness of the expanded question text is higher than the question completeness of the initial question text; and the expanded question text is used as the optimized question text.

[0216] In one embodiment, the text optimization dimension includes question conversion, and the optimization unit 410 is specifically used to convert the initial question text to obtain a converted question text; the question complexity of the converted question text is lower than the question complexity of the initial question text; and the converted question text is used as the optimized question text.

[0217] In one of the embodiments, the optimization unit 410 is specifically used to obtain the historical conversation content of the question-answering large model; generate an initial answer text for responding to the initial question text based on the context information in the historical conversation content; and obtain the optimized text set based on the initial answer text, the optimized question text and the initial question text.

[0218] In one of the embodiments, the reference document information includes document text information and rich text information; the rich text information includes image links and image description information; the determination unit 430 is specifically used to arrange the document text information and the matching image links and the matching image description information that match each of the texts in a preset arrangement order to obtain the arranged reference document information that matches each of the texts; and obtain the target question and answer prompt based on the arranged reference document information that matches each of the texts and the prompt word template.

[0219] Each unit in the above-mentioned question-answer processing device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned units can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above-mentioned units.

[0220] In an exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG5. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a question-answering processing method is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0221] Those skilled in the art will understand that the structure shown in FIG. 5 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0222] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0223] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0224] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0225] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0226] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0227] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0228] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A question-answering processing method, characterized in that: The method comprises: Obtaining an initial question text input into the question-answering big model, performing text optimization processing on the initial question text to obtain an optimized text set; the optimized text set includes the initial question text and optimized question texts in at least two text optimization dimensions; Retrieving reference document information matching each text in the optimized text set from a preset knowledge base; According to the reference document information matched by each of the texts and the preset prompt word template, a target question and answer prompt is obtained; the target question and answer prompt is used to instruct the question and answer large model to output a target answer content for responding to the initial question text by referring to the reference document information matched by each of the texts; Display the target answer content output by the question-answering model.

2. The method according to claim 1, characterized in that The performing text optimization processing on the initial question text to obtain an optimized text set includes: Obtain historical conversation content of the question-answering model; According to the context information in the historical conversation content, the initial question text is optimized to obtain the optimized question text; The optimized text set is obtained according to the optimized question text and the initial question text.

3. The method according to claim 2, characterized in that The text optimization dimension includes question expansion, and the text optimization processing is performed on the initial question text according to the context information in the historical conversation content to obtain the optimized question text, including: Expanding the initial question text according to the context information in the historical conversation content to obtain an expanded question text; the completeness of the question in the expanded question text is higher than that of the initial question text; The expanded question text is used as the optimized question text.

4. The method according to claim 1, characterized in that: The text optimization dimension includes question conversion, and the text optimization processing of the initial question text to obtain an optimized text set includes: Converting the initial question text to obtain a converted question text; the complexity of the question in the converted question text is lower than the complexity of the question in the initial question text; The converted question text is used as the optimized question text.

5. The method according to claim 1, characterized in that The performing text optimization processing on the initial question text to obtain an optimized text set includes: Obtain historical conversation content of the question-answering model; Generating an initial answer text for responding to the initial question text according to the context information in the historical conversation content; The optimized text set is obtained according to the initial answer text, the optimized question text and the initial question text.

6. The method according to claim 1, characterized in that The reference document information includes document text information and rich text information; the rich text information includes image links and image description information; the target question and answer prompt is obtained according to the reference document information matched with each of the texts and the preset prompt word template, including: Arranging the document text information, the image link and the image description information that match the texts according to a preset arrangement order, to obtain the arranged reference document information that matches the texts; The target question and answer prompt is obtained according to the edited reference document information and the prompt word template that match each of the texts.

7. A question-answer processing device, characterized in that: The device comprises: An optimization unit, used for obtaining an initial question text input into the question-answering large model, performing text optimization processing on the initial question text, and obtaining an optimized text set; the optimized text set includes the initial question text and optimized question texts in at least two text optimization dimensions; A retrieval unit, used to retrieve reference document information matching each text in the optimized text set from a preset knowledge base; A determination unit, used to obtain a target question and answer prompt according to the reference document information matched by each of the texts and a preset prompt word template; the target question and answer prompt is used to instruct the question and answer macromodel to output a target answer content for responding to the initial question text by referring to the reference document information matched by each of the texts; A display unit is used to display the target answer content output by the question-answering model.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Data retrieval method and device, electronic equipment and medium

    CN119621944A

  • Question and answer method and device based on large language model, electronic equipment and medium

    CN119782492A

  • Question Answering Method, Device, Electronic Device and Medium Based on Large Language Model

    CN119782492B

  • Information processing method, electronic equipment and computer storage medium

    CN120067458A

  • Method for generating fine-tuning question and answer data set based on retrieval enhancement

    CN120745855A